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
45e25b0064fa8d7c4aca955f2983c35a17b2032d
jcpc17/python
/exercicio-9.py
UTF-8
177
3.578125
4
[]
no_license
#FAÇA UM PROGRAMA QUE LEIA UM NUMERO QUALQUER E MOSTRE NA TELA SUA TABUADA num = int(input('Digite um numero: ')) tab = 0 for tab in range (1, 11): print(tab * num)
true
e9fc185cd265a6bfd31906e5a4f45d9374eea748
XiaJune/A-small
/d11_spider/boss/boss/spiders/tt_course.py
UTF-8
795
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule class TtCourseSpider(CrawlSpider): name = 'tt_course' allowed_domains = ['ke.qq.com'] start_urls = ['http://ke.qq.com/'] rules = ( Rule( LinkExtractor...
true
5f525d2fae389f8ebf3bfc2cb5a0c7651f6d01cc
analaura09/pythongame
/p102.py
UTF-8
568
3.46875
3
[]
no_license
import run() def fatorial(num, show=False): f = 1 for c in range(num,0,-1): if show: print(c,end='') if c > 1: print(' x ' , end='') else: print(' = ', end ='') f *= c return f print(fatorial(5,show=True)) opçao = int(input('deseja repetir...
true
6b6fbf853caec4713ecf76baf2e56c4bb44c416b
LuYueee/Sentiment-Analysis-of-Chinese-Microblog-Based-Stacked-Bi-LSTM
/5 Visualization/[Subgraph] Visualization_layer_num.py
UTF-8
2,377
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ [Subgraph] Visualization layer num: 1. Load data from 'Data' folder 2. Visualize loss and accuracy with different layer number Created on Sat Apr 28 12:25:40 2018 @author: Yue, Lu """ import os import matplotlib.pyplot as plt import seaborn as sns #读取数据 path=os.path.abspath('../...
true
510e56300884c4dfb43601961fe8fc443a2d3a02
ZoeGerst/CS362
/zoe_gerst_hw3.py
UTF-8
561
4.25
4
[]
no_license
#Zoe Gerst #CS 362 #4/25/2021 #leap year program but with error handling try: year = int(input("Enter a year: ")) if(year % 4) == 0: if(year % 100) == 0: if(year % 400) == 0: print("{0} is a leap year".format(year)) else: ...
true
80263f489e806ee62f990aca8ba3e06817421d99
joaogehlen91/calculo_numerico
/newton.py
UTF-8
308
3.09375
3
[]
no_license
from math import * run = True xn = 1.3 while (run): fxn = ((exp(xn)) - (tan(xn))) dfxn = (exp(xn)) - (1/cos(xn**2)) xn_1 = xn - (fxn/dfxn) modulo = xn_1 - xn if modulo > 0 and modulo < 0.001: run = False print fxn print dfxn print xn_1 print modulo print "----" xn = round(xn_1, 10)
true
09fb58c0c02cbfc7895b3728cee5bf6447aa8c58
Sol-cito/CodeMonsterStudy
/Graph/q_9466_sol.py
UTF-8
1,757
2.9375
3
[]
no_license
import sys def search(dic): visit = [0] * len(dic) res = 0 for i in range(1, len(dic) + 1): cur = i if visit[cur - 1] == 0: start = cur cnt = 0 while visit[cur - 1] == 0: visit[cur - 1] = 1 cur = dic.get(cur) ...
true
3dc33708a3bf17bd1a063e827d1f86b6b14bd8c2
vint-1/dfa-identify
/tests/test_identify.py
UTF-8
1,572
3.015625
3
[ "MIT" ]
permissive
from dfa_identify import find_dfa, find_dfas def test_identify(): accepting = ['a', 'abaa', 'bb'] rejecting = ['abb', 'b'] my_dfa = find_dfa(accepting=accepting, rejecting=rejecting) for x in accepting: assert my_dfa.label(x) for x in rejecting: assert not my_dfa.label(x) a...
true
ff72f01fa96ce80b2b410f0100138add6d3687a6
KhachKara/Python_Tutor
/Math/Factorial.py
UTF-8
391
4.5625
5
[]
no_license
""" Example 3-1 =========== Finding Factorial with Recusion Author: Adnan Umer <u.adnan@outlook.com> """ def fact(n): """ Finds Factorial of given number using recusion """ if n <= 1: # factorial of 1 is 1 return 1 else: # factorial of n = n x [factorial of n -1] return n ...
true
a73050ae8498c7efd36ee7ea7ba3b66c39ed2d75
mcfadd/Job_Shop_Schedule_Problem
/JSSP/solution/solution.py
UTF-8
14,278
2.953125
3
[ "ISC" ]
permissive
import datetime import numpy as np from ._makespan import compute_machine_makespans from ._schedule_creator import create_schedule_xlsx_file, create_gantt_chart from ..data import Data from ..exception import IncompleteSolutionException class Operation: def __init__(self, job_id, task_id, machine, wait, setup, ...
true
e2aa5a22f144a2b323825a1f6fc711588fdec5d5
alstndhffla/PythonAlgorithm_Practice
/Stack_Queue/fixed_queue.py
UTF-8
5,016
4.09375
4
[]
no_license
# 고정 길이의 큐 구현하기 from typing import Any class FixedQueue: class Empty(Exception): """ 비어있는 FixedQueue 에 대해 deque 또는 peek 를 호출할 때 내보내는 예외처리 """ class Full(Exception): """ 가득 찬 FixedQueue 에 enque(인큐) 를 호출할 때 내보내는 예외처리 """ def __init__(self, capacity: int) -...
true
9efbc7dcc76be6f6e3e5cbd929bc1e7eed424873
hc-BLISTR/BLISTR-main
/Database_Inputs/toxix_tree_table_maker.py
UTF-8
2,391
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jul 26 15:40:24 2016 @author: Owen Neuber Program to produce an excel table which will be converted into an html table. It will be based off of 'metadata_table.xlsx's first 3 rows. This program is UNUSED in BLISTR """ import xlsxwriter from openpyxl import load_workbook ...
true
bff355036cabc23cdeb764677d26cc7b19904a16
pantoska/oe-project
/Algorithm/Cross/CrossAlgorithms.py
UTF-8
7,695
2.90625
3
[]
no_license
import numpy as np class CrossAlgorithms: def single_cross(self, pop, probability,times): new_pop = np.array(pop, copy=True) temp = np.array(pop, copy=True) for i in range(0, (pop.shape[0] // 2) + 1, 2): rnd = np.random.random() if (rnd < probability): ...
true
a00271acb9ccc3bc63c492465ae1110ac1646975
apolmig/DL-experiments
/smart-tutor/smart_tutor.py
UTF-8
1,382
2.9375
3
[]
no_license
!pip install streamlit openai import streamlit as st import openai openai.api_key = "your_key" # App title and introduction st.title("GPT-4 Smart Tutor for Families") st.write("Welcome to the GPT-4 Smart Tutor! Get personalized help on various subjects.") # User login or signup st.sidebar.title("User Login / Signu...
true
ec49545c84d30dd0e4e8c290cb82f6f0dbd0382a
James-Xu-Xinyuan/EE3-24-Embedded-LLLD-CW1
/smbus_comm.py
UTF-8
2,214
2.515625
3
[]
no_license
import smbus2 import time import paho.mqtt.client as mqtt import json client = mqtt.Client() #client.tls_set(ca_certs="mosquitto.org.crt", certfile="client.crt",keyfile="client.key") client.connect("broker.mqttdashboard.com",port=1883) client.publish("IC.embedded/LLLD/Device","hello") # Get I2C bus bus = smbus2.SMBus(1...
true
bee9e7d18affaf51907d42d5f6f9de71488006a9
olivierthereaux/otCMS
/bin/makegall.py
UTF-8
6,000
2.625
3
[ "WTFPL" ]
permissive
#!/usr/bin/env python # encoding: utf-8 """ makegall.py Find jpg fnames in current dir and output basic gallery markup Created by Olivier Thereaux on 2012-07-11. """ import sys import os import re import getopt help_message = ''' makegall.py - Find jpg fnames in current dir and output basic gallery markup Options:...
true
fdffdce485ea7f4d74f0033bff77fa070b8f7093
Aasthaengg/IBMdataset
/Python_codes/p03053/s895897780.py
UTF-8
582
2.875
3
[]
no_license
from collections import deque h, w = map(int, input().split()) m = [list(input()) for _ in range(h)] flag = [[True] * w for _ in range(h)] q = deque() for i in range(h): for j in range(w): if m[i][j] == "#": q.appendleft((i, j, 0)) flag[i][j] = False ans = 0 while q: (i, j, ...
true
0f0decd19806b007c4e9a4a10c23108cbdc0115f
tomas2212/python
/MUNI/servers.py
UTF-8
1,311
2.578125
3
[]
no_license
import optparse import shlex import ConfigParser parser = optparse.OptionParser("%prog [options]") # 1st argument is usage, %prog is replaced with sys.argv[0] parser.add_option( "-s", "--server", # short and long option dest="server", # not needed in this case, because default dest name is derived fro...
true
b7fa8920a386bee625cfc2e7ce35c471d3b23b22
ankitboss/Python_Program
/regular_expresions1.py
UTF-8
229
3.15625
3
[]
no_license
import re string = "how are you . and how is everything" #print(string) #matches =re.findall("how",string) matches =re.split("is",string) #matches = re.search("is",string) matches = re.match("are",string) print(matches)
true
1f7fbaf4df4bfa4fe28a95cf4008411aed94431e
miguelgondu/vegas-lattice
/vlattice/scripts.py
UTF-8
9,705
2.78125
3
[ "MIT" ]
permissive
import collections import itertools import json import click import numpy from .lattice import Atom from .lattice import Vertex from .lattice import Lattice from .lattice import NanoParticle from .lattice import DepletedLattice from .material import Material Geometry = collections.namedtuple( 'Geometry', ['site...
true
53501f1abcfc6c601d0a6c7280916aa06a7bc432
olinguyen/machinelearning-templates
/nlp/text_features.py
UTF-8
1,737
3.375
3
[ "MIT" ]
permissive
import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from collections import Counter class NumWordExtractor(BaseEstimator, TransformerMixin): def __init__(self): pass def transform(self, X): return np.array([len(sentence.split()) for sentence in X]).reshape(-1, ...
true
1a977b5f4ca7d11b45b96b73eef19a6458acc3fc
zxcc0712/python_basis
/第6章/if-else.py
UTF-8
1,162
4.03125
4
[]
no_license
# # name = input('what is your name?') # # # if name.endswith('Gumby'): # # # print('hello Gumby') # # #if else 语句,进行逻辑判断 # # # elif 是else if 的缩写 # # # # a = ord('s') # # # # print(a) # # name = '' # # while not name: # # name = input('please enter your name:') # # # # # # print('hello,{}' .format(name)) #for 循...
true
b43e0b639e6d4eb3b513110f53947c6425dfe710
big-Bong/AlgoAndDs
/PythonPractice/LeetCode/Medium/213_HouseRobber2.py
UTF-8
590
3.359375
3
[]
no_license
def rob(nums): N = len(nums) if(N == 1): return nums[0] if(N == 2 or N == 3): return max(nums) return max(houseRob(nums[:N-1],N),houseRob(nums[1:],N)) def houseRob(nums,N): print(nums) max_so_far = nums[0] temp_arr = [0]*(N-1) temp_arr[0] = nums[0] temp_arr[1] = nums[1] for i in range(2,N-1): temp_ar...
true
75a25f57af5aab4dc3dc145f9e47377699e310a6
sivaneshl/python_data_analysis
/intro_data_science_python/advanced_python_pandas/scales/scales_cut.py
UTF-8
562
3.125
3
[]
no_license
import pandas as pd import numpy as np s = pd.Series([168, 180, 174, 190, 170, 185, 179, 181, 175, 169, 182, 177, 180, 171]) # cateogrize into 3 bins print(pd.cut(s, 3)) # You can also add labels for the sizes [Small < Medium < Large]. print(pd.cut(s, 3, labels=['Small', 'Medium', 'Large'])) # cut dataframe df = pd.r...
true
b1256f78dffa17e5f9a5ebfd9d22f3690dff5040
sergst83/testCase
/main_test.py
UTF-8
1,028
2.90625
3
[]
no_license
import ipaddress import unittest import main # задаем список адресов для созания серти ip_strings = [ '192.168.0.3', '192.168.0.1', '192.168.0.2', '192.168.0.63', '192.168.0.64' ] net = '192.168.0.0/25' class MyTestCase(unittest.TestCase): def test_calc_network(self): network = main.g...
true
0fa7d67c7407c5d40c69cbc0534eda65f74f6d82
phanikmr/Graph-Matching-for-Image-Retrival
/GraphMatching/graphs/graphmatch.py
UTF-8
3,677
2.890625
3
[]
no_license
import cv2 import numpy import itertools from Queue import * from graph import Graph class GraphMatch(object): model_graph = None query_graph = None model_visited = None query_visited = None def __init__(self, ModelGraph, QueryGraph): self.model_graph = ModelGraph self.query_...
true
575f74197eeb9bc7f5691c9f60f31bb24d1e8ac6
dataiku/dss-plugin-geocoder
/tests/python/unit/test_geocoding_processors.py
UTF-8
1,853
2.703125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- from cache_handler import CacheHandler from dataframe_reverse_geocoding import add_reverse_geocode_columns, get_reverse_geocode_function import pandas as pd def test_reverse_geocoding_processor(): """ Isolated test for the reverse geocoding :return: """ config = {'lat_col...
true
d2828b72a60dff498276cdb03bfa69a8ad6a047f
marcospramirez/birds-of-a-feather
/diagnostics.py
UTF-8
1,154
2.875
3
[]
no_license
import os dropletIp = "206.189.166.76" def dropletHealth(): print("\n----------- BEGIN TEST CASE: dropletHealth() -----------\n") print("\nMaking request to " + dropletIp + "... ... ...") print("------------------------------------------------------------\n") ## tidy -i formats output with indentation so it's e...
true
a25dc8868111ef77399cd3f107287b588d14ae5a
watupzack/Python_Marathon2
/my_package/my_functions.py
UTF-8
1,491
4.3125
4
[]
no_license
print("Here are my functions") def greet(name): print("Привет, " + name + ", каков ваш возраст?") user_age = "" while user_age == "": try: user_age = int(input()) if int(user_age) < 0: raise ValueError("No!") except ValueError: user_age =...
true
7a697b8f8a3e0f2f48b8d747e4b5b6e5164df859
Deplim/eui_ar
/algorithm/brute_force - 영화감독 솜.py
UTF-8
368
2.828125
3
[]
no_license
# 백준 | 영화감독 솜 : (https://www.acmicpc.net/problem/1436) # EuiRyeong Jeong (wjddmflud@gmail.com, https://github.com/Deplim) def solution(input): count = 0 num = 666 while 1: if '666' in str(num): count += 1 if count == input: return num num += 1 input...
true
1552250a4f2c67f3e7481e0bb60dd2d0e8eb66a8
Ornetolog/Acceptance-2.0
/Acceptance 2.0.py
UTF-8
666
2.6875
3
[]
no_license
import keyboard import MyThread potok1 = MyThread.MyThread('accept') potok1.start() keyboard.add_hotkey('Enter + plus', potok1.swich_flag) keyboard.add_hotkey('Enter + -', potok1.deth_Thread) print("Оно живое и хочет принимать игры!!!\n") print("Коротко обо мне:") print("\t (Enter и +) - временно приостановить/включи...
true
450c639cc94b1887c39c65ca32abbed01f53f777
utahnlp/therapist-observer
/tensorflow/math_utils.py
UTF-8
928
2.84375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -* # Time-stamp: <2019-06-04 14:50:45 jcao> # -------------------------------------------------------------------- # File Name : math_utils.py # Original Author : jiessie.cao@gmail.com # Description : Utils for math operaters # -----------------------------------------------------...
true
cab650f810bf440250be42590fa0d6292d3c5d86
cphl/cfd
/simple_animate.py
UTF-8
1,708
3.4375
3
[]
no_license
# -*- coding: utf-8 -*- """ Animates by drawing every solution provided in a time-stepped solutions array @author: cepuuher """ import numpy from matplotlib import pyplot from matplotlib import animation # TODO: add option to sample from provided array, important for high timesteps # Use something like solutions[::str...
true
4780e9046f99584a5a425887c4e22bed355757fe
jubalh/poezio
/poezio/daemon.py
UTF-8
2,587
2.859375
3
[ "Zlib", "CC-BY-2.0" ]
permissive
#!/usr/bin/env python3 # Copyright 2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify # it under the terms of the zlib license. See the COPYING file. """ This file is a standalone program that reads commands on stdin and executes the...
true
a5ccde06dba7fe180eac7b5964f875ad4f5682b3
brdayauon/interviewPreparation
/uciHWch4.py
UTF-8
2,179
3.78125
4
[]
no_license
2. (20 points total, 5 pts off for each wrong answer, but not negative) Label the following as T (= True) or F (= False). Unless stated otherwise, assume a finite branching factor, step costs ≥ ε > 0, and at least one goal at a finite depth. You may be in either a tree or a graph. a. (5 pts) An admissible heuristic ...
true
6e83a523068effbc34d00273bdf0c4d16c0e9062
omagiz01/oversea
/cutSentence2.py
UTF-8
2,178
3.078125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -- word = open('sample_word.txt','r').read().replace(" ","").replace("\n","").replace("\t","") #ตัดช่องว่าง ตัดเว้นบรรทัด ตัดแท๊บ #print(word) #--------------------------variable------------------------ check_day =['วันแรก','วันที่สอง','วันที่สาม','วันที่สี่','วันที่1','วันที่2',...
true
a79786767e93ebc34c7428a50a968a429319b826
drklauss/python_learning
/exercise_06/task_01.py
UTF-8
303
3.421875
3
[]
no_license
# Заполнить список из шести элементов произвольными целочисленными значениями. Вывести список на экран. import random myList = list() for i in range(0, 6): myList.append(random.randint(0, 1000)) print(myList)
true
98ae5c877cf639e075bb7b05679898ac99f34158
rajeshsaha782/bongo
/problem1/dict_depth.py
UTF-8
467
3.625
4
[]
no_license
def print_depth(data, depth=0): """ :param data: dictionary :param depth: optional :return: None """ for key, value in data.items(): print(key, depth + 1) if isinstance(value, dict): print_depth(value, depth=depth + 1) if __name__ == '__main__': a = { "k...
true
5967c578fc8482fde32b0419caa1dc1b9e8aac1e
liudandantj/mysite
/polls/tests.py
UTF-8
3,509
2.640625
3
[]
no_license
# Create your tests here. #django单元测试 from django.test import TestCase from django.contrib.auth.models import User from django.test import Client class UserTestCase(TestCase): def setUp(self): """创建用户""" User.objects.create_user("test01", "test01@email.com","test123456") def test_user_select(s...
true
9efe87f2eb72a45ffb40b78e804243ca585fa08c
bvn-architecture/Pycon-CircuitPython
/stdin_input.py
UTF-8
114
2.625
3
[]
no_license
""" serial read echo function for CPE """ import sys while True: x = sys.stdin.readline() print(x)
true
62f5d466c7c7980cca5a8ee952d3259cc8ff8cec
tooledesign/pybna
/pybna/stress.py
UTF-8
18,791
2.53125
3
[]
no_license
#! /usr/bin/python # Module for conducting level of traffic stress analysis on roadway datasets. # Allows for flexible naming of columns via a config file. import os, io import psycopg2 from psycopg2 import sql from psycopg2.extras import DictCursor import yaml import pandas as pd from .conf import Conf from .dbutils...
true
53e2c8c87c765d715f0c61ccf833605054c41683
maksympc/pythontutorial
/miscellaneous/simple_http_server.py
UTF-8
820
3.0625
3
[]
no_license
#HTTP server example from http.server import BaseHTTPRequestHandler, HTTPServer # HTTPRequestHandler class class HTTPServer_RequestHandler(BaseHTTPRequestHandler): # GET def do_GET(self): # Send response status code self.send_response(200) # Send headers self.send_header('Con...
true
53a83dee7e858284875c023896898fabef7650ab
quincysoul/python-ds-binarytree
/solutions/__test__/test__first_key_greater_than_val_eop14_2.py
UTF-8
2,086
3.609375
4
[]
no_license
import unittest import binarytree from ...solutions.first_key_greater_than_val_eop14_2 import Solution class Test_BST_Greater_Than(unittest.TestCase): def test_finds_next_highest_value(self): """ Should find value 6 if input value is 5. """ """ ______8_____ ...
true
4fccffe8ccd877985255894afa89199bad1121d2
dylan-wright/cs499-intell
/editor/tests.py
UTF-8
9,735
2.84375
3
[]
no_license
''' INTELL The Craft of Intelligence https://github.com/dylan-wright/cs499-intell/ https://intellproject.com editor/tests.py EventTestCase test_create_event test_single_described_by test_multiple_described_by CharacterTestCase test...
true
229fae62d773b4f1407dd3a08dc39b4ca0384e6b
arielsilveira/Bioinformatica
/main.py
UTF-8
1,407
3.671875
4
[]
no_license
import sys from Hamming import hamming from Levenshtein import levenshtein from SmithWaterman import smithWaterman from NeedlemanWusch import needlemanWusch from Blast import blast import functions as func def algorithm(option, dna_seq): if( option == 1): hamming(dna_seq[0], dna_seq[1]) if( option == 2...
true
206c2d19a2533f05ec0f24a2db1d983c19fd0406
bperfect/AMATH583
/homework2/taylor.py
UTF-8
936
3.71875
4
[]
no_license
import numpy def exp1(x,n, debug=False): """Approximate the exponential function with a Taylor Series""" if n<0: print "***Invalid input -- n must be non-negative integer" return numpy.nan term=1.0; sum=term; for i in range(1,n+1): term=term*x/i if debug: print "j = %i, term = %.15f" %(i,term) print...
true
82ec87cc43c8cf1f6b21fc7773c663b8f8496544
bvsbrk/Algos
/src/Practice/Datastructures/Stacks/GeeksForGeeks/LongestValidSubString.py
UTF-8
482
3.625
4
[]
no_license
tc = int(input()) while tc > 0: inp = input() l = [] count = 0 for i in inp: if i == '(' or i == '{' or i == '[': l.append(i) elif i == ')' and len(l) != 0: if l.pop() == '(': count += 2 elif i == ']' and len(l) != 0: if l.pop()...
true
1a1316fd1a41fa78aff6da9f0fabc41c750af1cb
TheMerret/ttd-book-example
/functional_tests/test_layout_and_styling.py
UTF-8
1,215
2.859375
3
[]
no_license
from .base import FunctionalTest from .list_page import ListPage class LayoutAndStylingTest(FunctionalTest): """тест макета и стилевого оформления""" def test_layout_and_styling(self): """тест макета и стилевого оформления""" # Эдит открывает домашнюю страницу self.browser.get(self.li...
true
af686bd91e2aa0910efb4ef3228701b64097b830
ahmadSyifaur/flask-skripsi
/cosine.py
UTF-8
1,644
2.625
3
[]
no_license
# query= "arial helvetica roboto lato" # doc1 = "TimesNewRoman Arial" # doc2 = "TimesNewRoman HaasGrotTextRWeb HelveticaNeue Helvetica Arial SansSerif" # doc3 = "TimesNewRoman lato Roboto HelveticaNeue Helvetica Tahoma Arial PingFangSC MicrosoftYaHei NotoSansSemiBold sansserif NotoSansMedium" # documents = [doc1, d...
true
e552d5026904515f7c77de7fc83a21c535813d75
erjan/coding_exercises
/correct_a_binary_tree.py
UTF-8
4,593
4.03125
4
[ "Apache-2.0" ]
permissive
''' You have a binary tree with a small defect. There is exactly one invalid node where its right child incorrectly points to another node at the same depth but to the invalid node's right. Given the root of the binary tree with this defect, root, return the root of the binary tree after removing this invalid node and...
true
0f143e2be3c51893c0df92cf9e502cf4db60f503
LEDCoyote/GaussMode
/mode_overlap_integral.py
UTF-8
1,078
3.078125
3
[]
no_license
# mode_overlap_integral.py # Compute the mode overlap integral between intensity image data and an # analytically defined Gaussian mode. Flat phasefronts are assumed, i.e. both # the image and the analytic mode are defined at their waist. # Ref. https://www.rp-photonics.com/mode_matching.html # Charlie J Keith 2018 f...
true
94c0b1c04fc735798cee26dbc3e438641aa0e1a7
ABHISHEK-G0YAL/Competitive-Programming
/practice/HackerRank/Extra_Long_Factorials.py
UTF-8
307
3.546875
4
[]
no_license
// https://www.hackerrank.com/challenges/extra-long-factorials/problem #!/bin/python3 # Complete the extraLongFactorials function below. def extraLongFactorials(n): f=1 while n: f=f*n n=n-1 print(f) if __name__ == '__main__': n = int(input()) extraLongFactorials(n)
true
ed4938dfa10dc0effa8926fa299e7a3a6e532c2a
MLWhiz/data_science_blogs
/fastapi/fastapi_put.py
UTF-8
378
2.859375
3
[]
no_license
from fastapi import FastAPI from pydantic import BaseModel class Input(BaseModel): age : int sex : str app = FastAPI() @app.put("/predict") def predict_complex_model(d:Input): print("not processed") # Assume a big and complex model here. For this test I am using a simple rule based model if d.age<10 or d.sex=='...
true
bcd2f53e804640b09d594492e54d3d3a45845b16
melmatt7/lin_alg_utility
/gram_schmidt.py
UTF-8
227
2.625
3
[]
no_license
import numpy as np def projection(s2, v1): # s2 onto v1 return np.dot(s2,v1)/np.dot(v1,v1)*v1 def gram_schmidt(span): v1 = span[:,0] v2 = span[:,1] - projection(span[:,1], v1) return v1, v2
true
ce176580c3c07b1442415c42ec6d5074cc6f68dd
songzy12/LeetCode
/python/52.n-queens-ii.py
UTF-8
735
3.234375
3
[]
no_license
class Solution(object): def __init__(self): self.ans = 0 self.n = -1 def DFS(self, queens, xy_dif, xy_sum): # if (x,y) in queens, then (p,q) with \ # p+q == x+y or p-q == x-y not in queens p = len(queens) # now the p-th row if p == self.n: self.ans += ...
true
5e7ccce6bf62f8110d4ae8a5f9bf5df05c789a1a
not-notAlex/holbertonschool-higher_level_programming
/0x0B-python-input_output/1-number_of_lines.py
UTF-8
289
3.421875
3
[]
no_license
#!/usr/bin/python3 """ module for 1-number_of_lines.py """ def number_of_lines(filename=""): """ returns number of lines in a file """ with open(filename, 'r', encoding="utf-8") as f: counter = 0 for line in f: counter += 1 return counter
true
63db114328cbd4e0cf868f6e971356338b5e8161
genomematt/CountESS
/countess/config/config_check.py
UTF-8
4,627
2.640625
3
[ "BSD-3-Clause" ]
permissive
""" Enrich2 config_check module =========================== Functions for identifying the type of :py:class:`~enrich2.base.storemanager.StoreManager` derived object associated with a given configuration object (decoded from a JSON file as described `here <https://docs.python.org/2/library/json.html>`_). """ from ...
true
7969ab8b63b0a8c523891d953af13f6585827f9f
Ronczo/Ermlab
/Ermlab/API/models.py
UTF-8
3,230
3.171875
3
[]
no_license
from django.db import models from datetime import datetime class Car(models.Model): brand = models.CharField(max_length=50) model = models.CharField(max_length=50) registration_number = models.CharField(max_length=15, unique=True, null=True, blank=True) date_of_next_technical_examination = models.Date...
true
4031a773f21d01c4db865500e866c3fd54bdb7e8
gyoscha/PythonPY100
/Занятие4/Лабораторные_задания/task1_7/main.py
UTF-8
230
2.8125
3
[]
no_license
def func(): sr_arif = sum(list_) / len(list_) print(sr_arif) list_new = [i - sr_arif for i in list_] return list_new if __name__ == "__main__": list_ = [4, -1, 10, -1, 3, -3, -6, 8, 6, 9] print(func())
true
909114a75eadb6eae9b0aaa0eb466c1b92c83231
Renugadevi-S/python3
/30_area_triangle.py
UTF-8
195
3.65625
4
[]
no_license
#python program that will accept the base and height of a triangle and compute #the area. base=float(input("enter the no")) height=float(input("height")) area=(base*height)/2 print(area)
true
fccaacba93e28d50f5ff6139d1f01e8dc0ed26d0
messi-1020/School-Work
/Lab 07/Lab07_Q5.py
UTF-8
295
4.0625
4
[]
no_license
# Lab 07 - Problem 05 def main(): score_list = [] i = 0 while i != 5: score = float(input("Enter a score: ")) score_list.append(score) i = i + 1 avg_score = sum(score_list) / len(score_list) print("The average score is", avg_score) main()
true
ec2cdce040005d26e23fc2792df5a9f53bf5b9df
dabutvin/datasciencelab-utaustin
/lab6/kmeans.py
UTF-8
2,725
3.359375
3
[]
no_license
import numpy as np from collections import defaultdict from copy import deepcopy class KMeans(object): def __init__(self, df, k): """ Given a pandas dataframe and the of clusters, Initializes k-means to its initial K centroids via uniform random sampling (without replacement). ...
true
68f5846774d729462da7d00cfa938bce3d41ca9c
Jeetendranani/yaamnotes
/developer_career_guide/contents.py
UTF-8
2,446
2.859375
3
[]
no_license
""" Contents Preface is this book for me? chapter 1 - how to use this book? section 1 getting start as a software developer chapter 2 - how to get start chapter 3 - the technical skill you need to have chapter 4 - how to develop technical skills chapter 5 - what programming language should i learn chapter 6 - learni...
true
f0f058f8b8f07892d7312696266ec75f81afad0b
chusehwan/python
/baek_jun/for/별 찍기 - 1.py
UTF-8
62
3.65625
4
[]
no_license
a = input() a = int(a) for i in range(a): print('*'*(i+1))
true
66db6dbf752e183631d425feb4715bdfaf0da128
edenjohnson/proteinHMM
/BLAST.py
UTF-8
1,509
2.65625
3
[]
no_license
# Import modules from Bio.Blast import NCBIWWW from Bio import SeqIO def perform_BLASTp_search(entrez_query, output_file, query_fasta): """ :brief Function takes in an entrez query, an output file, and a query fasta file as input and performs a BLASTp search over the internet with the function param...
true
bd54617acab641f6945189951cf3fccd65e0e9d8
arnour/PAA-2926-2019
/paa191t1/tests/dijkstra/datastructs/tree/test_tree.py
UTF-8
1,790
3.4375
3
[ "Apache-2.0" ]
permissive
from paa191t1.dijkstra.datastructs.tree import DistanceNode, TreeTraversal from paa191t1.dijkstra.datastructs.tree.avl import AVLNode as Node from paa191t1.tests import TestBase from hamcrest import ( assert_that, equal_to, greater_than, less_than ) class TestDistanceNode(TestBase): def test_node...
true
9c8894f6fef436d48eb2e67fa235c41eff295b09
OmkarRatnaparkhi/Basic_Python_Programs
/Problems_on_numbers/Q9_Display_First_Number_In_Second_Number_Times/Module.py
UTF-8
339
3.640625
4
[]
no_license
#Defination of Display funtion #Function Name : Display #Description: It is use to display first number in second number times #Date : 08 Feb 2021 #Author name : OMKAR NARENDRA RATNAPARKHI def Display(no,frequency): if (frequency < 0): frequency = -frequency for iCnt in range (0,fr...
true
2876ab7748f19538895402b2ac37ea3b79238b5a
Bowenwu1/Bob-LeetCode-Solution
/72. Edit Distance.py
UTF-8
659
2.84375
3
[]
no_license
class Solution: def minDistance(self, word1: str, word2: str) -> int: S_1, S_2 = len(word1), len(word2) D = [[0 for _ in range(S_2 + 1)] for _ in range(S_1 + 1)] for i in range(S_2 + 1): D[0][i] = i for i in range(S_1 + 1): D[i][0] = i for i ...
true
86ad043e1d089533a3bf846300526f994b6b2c8f
kevinbc0/contest-writing
/lego-solitaire/gen.py
UTF-8
1,675
3.078125
3
[]
no_license
from random import randint, choice from collections import defaultdict def main(): ind = defaultdict(int) color = defaultdict(int) graph = defaultdict(list) n = randint(80000, 100000) print(n) for i in range(1, n + 1): c = randint(1, 8) m = randint(0, 10) print(c, m) ...
true
ba50cfa4e84d59ddc6fbf4d69da0c76e9f3be109
Aasthaengg/IBMdataset
/Python_codes/p03265/s898079448.py
UTF-8
189
2.65625
3
[]
no_license
import sys import copy import math import itertools import numpy as np l = [int(c) for c in input().split()] a = l[0] b = l[1] c = l[2] d = l[3] x = c - a y = d - b print(c-y,d+x,a-y,b+x)
true
6222d9a45f8d37b90eec379c449cec84b2baeb26
Irene2607/miproyecto
/hola.py
UTF-8
76
2.765625
3
[]
no_license
print(´Hola git :)´) nombre = input('Lulu') print (' Bienvenido', lulu)
true
08a0a1af54d9ad29a73b91ceaeb45ea41d3bdd4c
Aasthaengg/IBMdataset
/Python_codes/p03852/s178941008.py
UTF-8
105
3.6875
4
[]
no_license
c = input() if c =='a' or c =='i' or c =='u' or c =='e' or c =='o':print("vowel") else:print("consonant")
true
105a95992992abf98bbf67dbd1e64b3c54d0efe7
anupam858/AI102Files
/Computer_Vision/Extract_text_from_images/Extract information from forms or receipts.py
UTF-8
1,989
2.609375
3
[]
no_license
import os from azure.core.exceptions import ResourceNotFoundError from azure.ai.formrecognizer import FormRecognizerClient from azure.ai.formrecognizer import FormTrainingClient from azure.core.credentials import AzureKeyCredential key = "<enter your key here>" endpoint = "<enter your endpoint URL here>" form_recogni...
true
1f7a0e1e7a771429b0de8b55b86777ebd2fce2b6
k3an3/home
/home/core/tasks.py
UTF-8
2,453
2.640625
3
[ "MIT" ]
permissive
""" tasks.py ~~~~~~~~ Handles running of tasks in an asynchronous fashion. Not explicitly tied to Celery. The `run` method simply must exist here and handle the execution of whatever task is passed to it, whether or not it is handled asynchronously. """ from concurrent.futures.process import ProcessPoolExecutor from c...
true
1c47f535bf30a82f7a56212b1abcd6885e352ba6
Amaguk2023/Pyspark_Spotify_ETL
/ETL_Modules/extract.py
UTF-8
1,048
2.640625
3
[]
no_license
import pandas as pd import transform from pyspark.sql import SparkSession import load def data_extraction(recently_played_json): song_name = [] artist_name = [] played_at = [] time_stamp = [] for i in recently_played_json["items"]: song_name.append(i["track"]["name"]) artist_name....
true
6d0a4b7d5441e90ddbd7b8bab0dc660d5f7208e2
eap3/siscom
/Main.py
UTF-8
918
2.59375
3
[]
no_license
from Simulator import Simulator from Estimators import * import matplotlib.pyplot as plt if __name__ == '__main__': simulator = Simulator(initial_slots=64, simulations=1, min_tags=100, max_tags=1000, step=100, estimator=eom_lee) # Use this to generate graphics result = simulator.run() print(result) #...
true
98da8d829c37eddcd1ebfe78f54a8736d074abc1
chakid/ImageProcess
/source/test4.py
UTF-8
468
2.78125
3
[]
no_license
# coding:utf-8 ''' 浮雕效果 ''' import cv2 import numpy as np gray=cv2.imread('img/cxk.jpg',0) imgInfo=gray.shape height=imgInfo[0] weight=imgInfo[1] dst=np.zeros((height,weight,1),np.uint8) for i in range(0,height): for j in range(0,weight-1): gray0=gray[i,j] gray1=gray[i,j+1] newp=gray0-gra...
true
b9e201dc02f30fb5cebbbd437bd19d8f8ab7aad7
LeonardoArcanjo/Praticas-Python
/oneToTwentyDivisor.py
UTF-8
669
3.953125
4
[]
no_license
""" Faça um programa que calcule o menor numero dívisivel por cada um dos numeros de 1 a 20? Ex: 2520 é o menor numero divisivel que pode ser dividido por cada um dos numeros de 1 a 10, sem sobrar resto """ i = 0 while 1: i += 1 if i % 1 == 0 and i % 2 == 0 and i % 3 == 0 and i % 4 == 0 and i % 5 == 0 and i % 6...
true
cf1c18a42e9f89fac4d5dc215986e0a7e924f65b
algorban/algorithms
/python/word_search_2.py
UTF-8
2,188
4.125
4
[]
no_license
""" Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. Example: Input: b...
true
6c3a6e3a19451986c4d5b5757951baf2daf721fd
MertUsenmez/Some-Python-Libraries-for-Data-Science-
/Some Python Libraries for Data Science/Pandas/temp.py
UTF-8
3,917
3.90625
4
[]
no_license
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ # Why Pandas ? : # 1) Fast and efficient for DataFrames. # 2) Pandas library provides convenience for files between files. (Orn: .csv to .txt) # 3) Makes our work easier from Missing Value Data. # 4) We can reshape the data and us...
true
d198e7011372dcf4fd0c2965341bbef40290e911
bindog/one-deploy
/serve/cortex_internal/lib/type/type.py
UTF-8
1,893
2.578125
3
[ "MIT" ]
permissive
# Copyright 2021 Cortex Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
true
2b22ca6c93f810eca1e5aff77b78b36e54703a8b
ehcj/pr_euler
/p15/p15.py
UTF-8
150
3.5
4
[]
no_license
#!/usr/bin/python def fact(n): f = 1 for x in xrange(1, n+1): f = f * x return f print("Answer: %d" % (fact(40) / fact(20) / fact(20)))
true
24a5ced6f777662ce57e26ad3be2cf205dd20828
rhps/py-learn
/Tut1-Intro-HelloWorld-BasicIO/py-hello.py
UTF-8
414
3.90625
4
[]
no_license
# This is helloworld program # run this as: # python hello.py print "hello, world!" 1 + 2 x, y = 2, 6 x, y = y, x + 2 print x, y a, b = 2, 3 c = a b = c + 1 print a, b, c d = """This is a multi-line string written in three lines.""" print d e = '''multi-line strings can be written using three single quote charac...
true
80a4bb32c1e7cb26066979289563f2134f618be0
taktike17/uni
/crypto/caesar.py
UTF-8
514
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 2 13:36:26 2017 @author: alex """ def encrypt(m, key): c = (m + key) % 256 return c def decrypt(m, key): c = (m - key) % 256 return c def encrypt_data(data, key): cypher_data = [] for m in data: c = encrypt(m, key) ...
true
ed422a72ea21b88e60090caf0bb63ba16d65cbfd
MisterXY89/textAnalysis
/src/helper.py
UTF-8
637
3.078125
3
[]
no_license
def prepareText(sentences, forSentiment=True): preped_sentences = [] preped_sentences_append = preped_sentences.append for i, sentence in enumerate(sentences): sentence = sentence.replace("\n", " ") if sentence.startswith(" "): sentence = sentence[1:] if forSentiment: ...
true
df715c79a4d9de5cbbdc776437991a7375f6a751
TrellixVulnTeam/twitter_sklearn_6BGB
/sklearn/read_data.py
UTF-8
2,071
3.078125
3
[]
no_license
import re from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split REPLACE_NO_SPACE = re.compile("[.;:!\'?,\"()\[\]]") REPLACE_WITH_SPACE = re.compile("(<br\s*/><br\s*/...
true
c2f160b8f84bc58d01781bb6efe54dd8f82de0d0
ckolos/pthw
/ex3/ex3_pi.py
UTF-8
140
3.625
4
[]
no_license
# Calculates the area of a circle pi = 3.14 radius = 9.0 print "The area of a circle with a radius of", radius, "is", pi * radius * radius
true
aa7dbcdc12e18efa48d1f8c6022e7e8fafb2d171
201410090/p1_201410090
/w3Main2.py
UTF-8
352
3.84375
4
[]
no_license
import turtle wn=turtle.Screen() t1=turtle.Turtle() sel=raw_input("F or C:") print sel temp=raw_input("please enter temperature:") temp=float(temp) if(sel=='F'): print ((temp-32)/1.8,"C") elif(sel=='C'): print ((temp*1.8)+32,"F") else: print "Entered again plea...
true
bb3e23fba2503765bb3a9730e4b7484a6d702231
jh247247/hd2-calc
/elementHandler.py
UTF-8
4,491
2.921875
3
[]
no_license
#!/usr/bin/python import sys from PyQt4 import QtCore, QtGui from threading import Timer import settings import os class ElementHandler(QtGui.QWidget): def __init__(self, statusHandler=None): """ Creates a list for storing the individual gui elements Might need restructuring later down th...
true
758d0f27c7a2478feb47ab6321606dd6209e4b2f
srikloud/PyProjects
/Multiposting/extract_csv_columns.py
UTF-8
824
3.0625
3
[]
no_license
import re import sys, argparse, csv def extract_csv_cols(): f = open('C:/Users/C5259095/Downloads/Multiposting/test_file.csv', "r", encoding='utf-8', errors='ignore') print(f) with open('C:/Users/C5259095/Downloads/Multiposting/test_file.csv','rb') as csvfile: # get number of columns ...
true
f46bcbaae13737ab1e60418d6bc8c170d2c9636f
zhangrengang/cebai
/src/depth_contig.py
UTF-8
932
2.5625
3
[]
no_license
import sys from collections import OrderedDict from xopen import xopen as open def main(inDepth=sys.argv[1], outTab=sys.stdout, maxdepth=5): d_bins = OrderedDict() for line in open(inDepth): temp = line.rstrip().split() CHR = temp[0] POS = int(temp[1]) DEPTH = map(int, temp[2:]) TOTAL = sum(DEPTH) if TOT...
true
7a21c94f0636a972ad4ca43fe886797f67e82df6
Micseb/Hands-On-Artificial-Intelligence-for-Banking
/Chapter07/7A_Sentiment/7A_2_run_parse_tweets.py
UTF-8
2,816
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 07:38:32 2018 @author: jeff """ '''************************************* #1. Import libraries and key varable values ''' import json import os import re import sqlite3 import lib_cnt_sentiment as sentiment #db file db_path = 'parsed_tweets.d...
true
79523921e1c6cd6b23e64129c6a5c10de3af1873
pawwahn/python_practice
/exceptions/assertionException.py
UTF-8
232
3.609375
4
[]
no_license
num1 = int(input("enter a")) num2 = int(input("enetr b")) def test(a,b): assert a>b," condition fails" try: test(num1,num2) print "does not raise exception as a is greater than b" except Exception as e: print e
true
3ecb0e434ae612c6dfa5e6eb05b6b4371d73cc1e
FengYuchen/cse258
/homework2_test.py
UTF-8
9,318
2.703125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import urllib import scipy.optimize import random from math import exp from math import log from operator import itemgetter, attrgetter from sklearn.decomposition import PCA from collections import defaultdict from sklearn.linear_model import LinearRegression random....
true
9e628aa58ce6906e18b734966d7265c8e346a232
murayama333/sample_code
/src/day2/no40_40.py
UTF-8
176
3.5625
4
[]
no_license
def contains(lst, value): return value in lst names = ["Andy", "Bob", "Carol"] print(names) print("Bob:", contains(names, "Bob")) print("Dave:", contains(names, "Dave"))
true
4fa48f4c47014c23449bb5b2576a285509b0e9e2
konny0311/Coding-training
/quiz/q_01.py
UTF-8
1,072
3.65625
4
[]
no_license
def convert_decimal2binary(num): mod_list = [] x = num while x != 0: q, mod = divmod(x, 2) mod_list.append(mod) x = q mod_list.reverse() binary = '' for mod in mod_list: binary += str(mod) return binary def convert_decimal2octa(num): mod_list = [] x =...
true
11d6bd200c6076413861599a2fa324614bad45c3
sohumd96/CTCI
/Chapter1/Problem6/string_compress.py
UTF-8
331
2.953125
3
[]
no_license
def compress(s): if len(s) == 0: return "" count = 1 curr_l = s[0] solution = "" for l in s[1:]: if l == curr_l: count += 1 else: solution += curr_l + str(count) count = 1 curr_l = l solution += curr_l + str(count) retur...
true
03ffdf4db0847bd4acf0261c57b92142a7899b39
wyaadarsh/LeetCode-Solutions
/Python3/0055-Jump-Game/soln.py
UTF-8
373
2.828125
3
[ "MIT" ]
permissive
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ max_pos = 0 for i, num in enumerate(nums): if max_pos < i: break max_pos = max(max_pos, i + num) if max_pos >= len(nums) - 1: ...
true
716c6887aede584313e16553114126d2c115e397
YoyinZyc/Leetcode_Python
/Facebook/Pro640_Solve_Equation.py
UTF-8
2,328
3.453125
3
[]
no_license
''' Facebook_Medium 11.05 11:46pm ''' class Solution: def solveEquation(self, equation): """ :type equation: str :rtype: str """ # 记录x的个数 x = 0 num = 0 # operator 和 d是为了方便设置下一个数是加还是减 operator = True d = {'+': True, '-': False} ...
true
4afdbf74467420f98b9ab8dcbc2e2d5b8df87505
IagoMendes/CloudComputing
/APS1/main.py
UTF-8
935
2.671875
3
[]
no_license
from fastapi import FastAPI, HTTPException from pydantic import BaseModel app = FastAPI() test = dict() class Task(BaseModel): name: str description: str # /task @app.get("/task") async def get_task(): return test @app.post("/task") async def post_task(task: Task): test[len(test.keys())] = task # /...
true