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
e17b266d3644db751531f8facbd144700e507614
liyangjie/MANtpp
/MANtpp.py
UTF-8
7,290
2.546875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding=utf-8 -*- # @Author: Yangjie Li import optparse import os import csv import numpy as np from scipy.stats import fisher_exact from statsmodels.sandbox.stats.multicomp import multipletests from method import methods import sys parse = optparse.OptionParser(usage='"usage:%prog [-n Numb...
true
b52d68b6c2f233cfa73e49a5f3722827004110db
daanwierstra/pybrain
/pybrain/tools/gridsearch.py
UTF-8
13,519
3.015625
3
[ "BSD-3-Clause" ]
permissive
__author__ = 'Michael Isik' from pybrain.tools.validation import CrossValidator from numpy import linspace, append, ones, zeros, array, where, apply_along_axis import copy class GridSearch2D: """ Abstract class providing a method for searching optimal metaparmeters of a training algorithm. It is...
true
0b56d039a06a46039f6081daf93f11b431ad7f1a
SilverMaple/LeetCode
/34.find-first-and-last-position-of-element-in-sorted-array.py
UTF-8
942
3.1875
3
[]
no_license
# # @lc app=leetcode id=34 lang=python # # [34] Find First and Last Position of Element in Sorted Array # # @lc code=start class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ def bsLeft(A, x):...
true
a8e9149dfd355c83381bd9bfcd0d928a54a8a281
itdanja/python_2
/COS PRO_2/문제만들기_1차시/문제1.py
UTF-8
2,448
3.90625
4
[]
no_license
# 문제1 : 리스트내 동일한 개수 세기 # 조건 1: 리스트에 사이즈별로 개수를 담아서 리턴해주는 함수 def 함수(선호티셔츠): #함수 만들기 티셔츠개수 = [ 0 , 0 , 0 , 0 , 0 , 0 ] # 처음에는 0으로 설정 #XS #S #M #L #XL #XXL for 티셔츠 in 선호티셔츠 : # 선호티셔츠 하나씩 티셔츠에 넣기 if 티셔츠 == "XS" : # 만약에 "XS" 이면 티셔츠개수[0] += 1 # XS 자리에 1 추가 i...
true
30254cec7b9e82dbe5e095c3eb1c49a166eff00b
dumin199101/PythonLearning
/python3/010列表生成式/001.py
UTF-8
265
3.71875
4
[]
no_license
#coding=utf-8 #列表生成式 #后边代表循环的次数,前边代表变量的值 a = [i for i in range(0,10)] print(a) #元组方式 b = [(x,y) for x in range(0,2) for y in range(0,4)] print(b) #加入筛选条件 c = [i for i in range(10) if i%2==0] print(c)
true
6d89410e2374f45b99eba1368fd65c6d48672ce8
Akash5210/Python
/pattern/star pattern/Right_Star_pattern.py
UTF-8
426
3.5625
4
[]
no_license
n=int(input("Enter the number of rows: ")) #Right pyrimid for i in range(0,n): for j in range(0,n//2+1+1): if i<=n//2+1+1: print("*",end="") else: print(" ",end="") print("\r") for i in range(0, n): for j in range(0, n // 2 + 1 + 1): if i <= n // 2 ...
true
61f5676b94fee57defecfb6017cdf2163e695f35
0827cg/spiderCompany
/test/year_print/test_print.py
UTF-8
128
2.890625
3
[]
no_license
#!/usr/bin/python3 """ Author: cg Date: 2020/12/31 14:07 """ value = "你好的, 这是测试" print(value.center(50, "*"))
true
1be32771a509e4ed3be489119cde2e88d1c0ecf9
lucxt18/lucxt18
/generate_NoiseMeasurementsMatrix.py
UTF-8
5,223
2.53125
3
[]
no_license
########### # --Imports ########### import numpy as np import matplotlib.pyplot as plt from pathlib import Path import sys sys.path.append('../..') # -- Pytorch tools import torch import torch.nn as nn # -- Dataloading tools import torchvision from torchvision import datasets, models, transforms # -- Spyrit packag...
true
03bdaf6253fec47c2d80ad322ff1b8a88ba762c6
monteua/Python
/Dictionary/12.py
UTF-8
221
3.78125
4
[]
no_license
''' Write a Python program to remove a key from a dictionary. ''' def remove_key(dict1): dict1.pop('removing') return dict1 print (remove_key({1: 1, 2: 4, 3: 9, 4: 16, 'removing':'this', 5: 25, 6: 36, 7: 49}))
true
160f07bc238a720eedec5ee024e9481a808a872b
okps123/AlgorithmLab
/Baekjoon/3/3034.py
UTF-8
127
3.078125
3
[]
no_license
n, w, h = map(int, input().split()) for i in range(n): x = int(input()) print('DA' if (x**2 <= (w**2+h**2)) else 'NE')
true
d0f6490341f4bec8be05e3ebbf37beb13fa3a3db
michaelgraemeshort/py_algos
/job_scheduler/job_scheduler.py
UTF-8
4,155
3.3125
3
[ "MIT" ]
permissive
# error handling woes # end time must be after start time # separate add-to-list and add-to-tree functions # job should ONLY be added to list if successfully added to tree first # tree.insert() should RETURN a value rather than simply printing success/not # likewise remove from list/tree # get_job should only return jo...
true
d576d76d86f866c60b0e309d3ea9d469b9ffa6c0
Designercancode/Learn
/8.4.py
UTF-8
650
4.53125
5
[]
no_license
#8.4 # Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the # split() method. The program should build a list of words. For each word on each line check to see if the word is # already in the list and if not append it to the list. When the program completes, ...
true
c8cae3503a7303a268d23012cc473d77f7bb059e
joeghodsi/interview-questions
/cracking-the-coding-interview/ch1-arrays-and-strings/1.3-permutation.py
UTF-8
773
4.03125
4
[ "Unlicense" ]
permissive
''' Problem: given an two strings, determine if one is a permutation of the other Solution: sort and compare with early return if not same length strings - nlogn time, constant space (assuming in-place sort) total time: 10 minutes ''' def are_permutations(str1, str2): if str1 is None or str2 is None: ...
true
d72ef81d446c7b53234db96583dd90fe461bb7d5
michael-ranieri/Misty
/lighthouse.py
UTF-8
4,791
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # Copyright (C) 2011 Michael Ranieri <michael.d.ranieri at gmail.com> # input to methods will be a tuple (Message from irc, user who sent msg, channel, known channel users) # Must return a location or None # The first string is the relative location of the isle from the settings.PATH_TO_ISLE # re...
true
8e9a33ab631ad2c93f8a02142735f8a09f74df7f
mynameiskate/clustering-algorithms
/main.py
UTF-8
698
2.65625
3
[]
no_license
from maxmin_clusterer import MaxMinClusterCreator from k_clusterer import KClusterCreator from plotter import Plotter # Defining parameters CLUSTERS = 6 OBSERVATIONS = 20000 MIN_VALUE = 0 MAX_VALUE = 100 # K-means clustering analyzer = KClusterCreator(6, 20000, 0, 100) res = analyzer.create_clusters() # K-means Plot...
true
15ea034f0ce0242e1590229b893b351d62a4fe0a
codalab/codalab-worksheets
/codalab/worker/fsm.py
UTF-8
2,669
3.03125
3
[ "Apache-2.0" ]
permissive
class DependencyStage(object): ''' Defines the finite set of possible stages and transition functions Note that it is important that each state be able to be re-executed without unintended adverse effects (which happens upon manager resume) ''' # if not in _downloading, create and start _downlo...
true
c19ee0cf301d4c155fae96fc5fe268c5bd4f5ba8
skratz17/rate-my-music-server
/rmmapi/views/rater.py
UTF-8
1,159
2.53125
3
[]
no_license
"""Rater ViewSet and Serializers""" from django.shortcuts import get_object_or_404 from django.contrib.auth import get_user_model from rest_framework import serializers from rest_framework.viewsets import ViewSet from rest_framework.response import Response from rmmapi.models import Rater class UserSerializer(serializ...
true
c1dc3655bda30187e82bca932b7eda9c68f15f05
kruthikapalleda/python
/testfile23.py
UTF-8
136
3.125
3
[]
no_license
str = "durga" print(str) print(str[2]) print(str[4]) print(str[-2]) print(str[-4]) #print(str[5]) print(str[-5]) #print(str[-6])
true
77f5f949f40b29d150fb3a7c4600a14cec6c8046
imemedb/keyverbum
/tests/test_keywords.py
UTF-8
1,898
2.796875
3
[ "MIT" ]
permissive
import pymorphy2 from keyverbum.keywords import ( Textrank, TopicalPagerank, PymorphyStemmer, BasicPreprocessor, StopwordsFilter, TfIdf, ) TEXT_1 = ( "Challenges in natural language processing frequently involve" "speech recognition, natural language understanding, natural language" ...
true
60a8c690df0da891fd38588110e88ec996ef7035
rackerlabs/python-saml
/saml/schema/samlp.py
UTF-8
19,597
2.671875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from . import types, base, Element, saml class Base(base.Base): class Meta: namespace = 'samlp', 'urn:oasis:names:tc:SAML:2.0:protocol' class _Message(saml._Message, Base): """Contains common information found in most SAML/2.0 protocols. """ # A URI reference indica...
true
a218d0e9700eaa3ef08527aa4038484341138d4f
progresivoJS/python-playground
/class.py
UTF-8
255
4.46875
4
[]
no_license
# Define __str__ in a class to show a human-readable representation. class Point(): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return '{0}, {1}'.format(self.x, self.y) p = Point(1, 2) print(p)
true
0910b8787925a1816f7c49f49526539f31eb1823
itsmesanju/pythonSkills
/leetCode/3.longest_subString_without_repeating_character_SlidingWindow.py
UTF-8
1,216
3.765625
4
[]
no_license
# merge(fuse) two sorted linked lists def concatenate_lists(head1, head2): if head1 == None: return head2 if head2 == None: return head1 # use left for previous. # use right for next. tail1 = head1.left tail2 = head2.left tail1.right = head2 head2.left = tail1 h...
true
9733823111661d0c769f8a42e3ff962710863414
itsx/deepdiff
/deepdiff/diff.py
UTF-8
46,207
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # In order to run the docstrings: # python3 -m deepdiff.diff # You might need to run it many times since dictionaries come in different orders # every time you run the docstrings. # However the docstring expects it in a specific order in order to pass! from __future__ imp...
true
1582b299f4b22c036fc526e73e5993daecccf204
saurabhgpt/SeleniumProjects
/automatedLogInFB.py
UTF-8
1,267
2.65625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait import unittest class firstFBLogIn(unittest.TestCase) : def setUp(self) : self.driver = webdriver.Firefox() self.driver.get("https://www.facebook.com/") def test_Login(self) : driver = self.driver #initialize credentials ...
true
6f95a198235d253425ab149e50affa90969d9130
podojuice/TIL
/startcamp/20181218/first_python.py
UTF-8
161
3.59375
4
[]
no_license
print('happy hacking') if (10 % 2 == 1): print('odd number') else: print('even number') x=True y=1 z=10.1 print(type(x)) print(type(y)) print(type(x))
true
f8ce0aa2d8894f81a0e96647ca4bea7b4482599c
kemistree4/School-of-Total-Good
/Statistics/Normal_Distribution.py
UTF-8
637
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 7 10:54:18 2020 @author: rsholes """ #import matplotlib.pyplot as plt #from IPython.display import Math, Latex #from IPython.core.display import Image import seaborn as sns sns.set(color_codes=True) sns.set(rc={'figure.figsize':(10,10)}) #import uniform distribution f...
true
543513ec60b95596e071cb2582021aafa35139d9
tttokiooo/AtCoder_python
/ABC101_200/ABC162/e.py
UTF-8
423
2.625
3
[]
no_license
# https://atcoder.jp/contests/abc162/tasks/abc162_e import sys def input(): return sys.stdin.readline().rstrip() def main(): N, K = map(int, input().split()) MOD = 10 ** 9 + 7 ans = 0 memo = [0] * (K + 1) for i in range(K, 0, -1): c = pow(K // i, N, MOD) - sum(memo[i::i]) % MOD mem...
true
c61c2b0a457e50fd459ce83d6609eceb548cc4e1
pannchat/1day1commit
/2748.py
UTF-8
409
3.875
4
[]
no_license
import sys # n = int(sys.stdin.readline()) # def fib(n): # if n == 0 : return 0 # if n == 1 : return 1 # return fib(n-1)+fib(n-2) # print(fib(n)) # 위는 Top-Down 방식. 재귀 시간초과 N = int(sys.stdin.readline()) def fib(n): fib_list=[0,1] for i in range(2,n+1) : fib_list.append(fib_list[i-2] + fib...
true
92e43358c5886c5cc78fa00093de22561155df41
zhenming-xu/pydefect
/pydefect/input_maker/defect_entries_maker.py
UTF-8
4,505
2.640625
3
[ "MIT", "Python-2.0" ]
permissive
# -*- coding: utf-8 -*- # Copyright (c) 2020. Distributed under the terms of the MIT License. from typing import List, Tuple import numpy as np from pydefect.defaults import defaults from pydefect.input_maker.defect import SimpleDefect from pydefect.input_maker.defect_entry import DefectEntry from pydefect.input_make...
true
b4bef72e5c275115573895605eb2abe611d45d70
seahu/433Utils
/RPi_utils/pokus.py
UTF-8
555
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/python import time import sys while 1==1: code=sys.stdin.readline() if code=='' : continue code=code[:-1] #delete enter from end string code=code[:-2] #delete protocol number if len(code) > len('Received '): if code[:len('Received ')]=='Received ': code=code[len('Received '):] ...
true
3e8e9398ecdfacc92e6da69a6e2ab793a98b9fec
topder/Hackathon
/HackathonProject/Server.py
UTF-8
6,130
2.953125
3
[]
no_license
import threading import time from _thread import start_new_thread from socket import * from struct import * from scapy.all import get_if_addr #------------GIT----------------# #https://github.com/topder/Hackathon #UDP server class Server(): def __init__(self,serverPort,udp_port): self.serverIP= get_if_addr...
true
2c81150b43416c91fd572c7e9a16086030275b56
JH-601-SWE-DeepStateTeamProject/Clue
/server.py
UTF-8
7,946
2.8125
3
[]
no_license
import socket from _thread import * from Card import Card from Deck import Deck from ClueBoard import ClueBoard from Player import Player import pygame import pickle import random server = socket.gethostname() port = 5555 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((server, ...
true
888f7e5946238de5ec107ed08528e5cb2fd26c6d
jessica-ziegler/pygame-zero
/weihnachtsregen.py
UTF-8
2,860
3.3125
3
[]
no_license
import random WIDTH = 500 HEIGHT = 500 # Enthält alle fallenden Schneeflocken himmel = [] # Erzeuge eine Weihnachtskugel mit zufälliger Geschwindigkeit, Drehrichtung und Startposition def erschaffe_weihnachtskugel(): # wähle Farbe der kugel zufällig kugelfarbe = "" if (random.randint(0,1) == 1): ...
true
da99a8b81606efc4e8512df36cd11097cb02053f
CoderTangYin/LeetCode_Python
/LeetCode/ReplaceSpace.py
UTF-8
555
3.515625
4
[]
no_license
''' 请实现一个函数,把字符串 s 中的每个空格替换成"%20"。   示例 1: 输入:s = "We are happy." 输出:"We%20are%20happy." 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 ''' class Solution: def replaceSpace(self, s: str) -> str: res = '' for str in s: if s == ' ': ...
true
2060d547cb016f8a273f788b3be2dda18b752f66
shubhamxdeveloper/Python_Practice_Programs_Repository
/addition_program.py
UTF-8
131
3.859375
4
[]
no_license
print("Enter First Number") num1=int(input()) print("Enter Second Number") num2=int(input()) sum=num1+num2 print("Sum is:",sum)
true
f5dc2022761aef67def0596059c79f35f38e974b
lilbooth53/discord-py
/bot-local/main.py
UTF-8
1,351
2.59375
3
[]
no_license
import discord import os import pandas as pd client = discord.Client() ## Initiate IEX import pyEX as p iex = p.Client(api_token=iex_key, version='stable') ## Get Quote ## Get News ## Date import datetime def convert_date(x): stamp = x date = datetime.datetime.fromtimestamp(stamp / 1e3) date = da...
true
a06f0a022eb1def93a31d1508d443ea75ee35b54
basavarajnavalgund/tracking-with-Extended-Kalman-Filter
/Docs/ekf-std_deviations.py
UTF-8
800
3.515625
4
[ "MIT" ]
permissive
import pandas as pd #read .txt file and assigned name to each columns df = pd.read_table('output1.txt', delim_whitespace=True, names=['est_px','est_py','est_vx','est_vy','meas_px','meas_py','gt_px','gt_py','gt_vx','gt_vy']) """ print("Std. Deviation of Estimated values") print(df.loc[:,"est_px"].std()) print(df.loc[:...
true
07cc68a05bc4ed1808ad5f8228bc6d27cfd45802
schrodinger/coordgenlibs
/mol_generator.py
UTF-8
4,182
2.734375
3
[ "BSD-3-Clause" ]
permissive
""" Using the schrodinger Python modules, read a template .mae file to generate the coordgen template C++ files. """ import sys import os import textwrap import argparse import subprocess from schrodinger import structure NAME = 'CoordgenTemplates' # String that creates a molecule and adds it to a container # of sk...
true
0cda395bc8fae16b8bb94d3b03d938a38b33b2ed
perhells/Euler
/Python/problem5.py
UTF-8
334
3.3125
3
[]
no_license
def iscool(n): for x in reversed(range (2,21)): if not n % x == 0: return False return True def findsmallest(): factor = 2*3*5*7*11*13*17*19 smallest = factor while True: if iscool(smallest): return smallest smallest = smallest + factor print(str(fin...
true
4ee5507b9360de2fbba07548a7e3a863efe8fd73
orion-test/pyfiles
/str1.py
UTF-8
462
3.75
4
[]
no_license
sample1 = 'This is a single quote example' sample2 = "This is a double quote example" sample3 = '''This is a triple single quote example''' sample4 = """This is a triple double quote example""" multiline = """This is the firstline This is the second line This is the third line""" print ((sample1)) print ((sample2)) pr...
true
f38fd988cbb1118ffbb66b99548e7f20eeb7e05f
Lenashalaumova/Informaticshomework
/Prime numbers.py
UTF-8
263
3.4375
3
[]
no_license
from random import randint def isSimple(x): for j in range(2, x): if x % j == 0: return False return True a=[randint (0,100) for x in range (10)] print (a) b=[] for x in a: if isSimple(x) and x != 0: b.append(x) print(b)
true
fb013eea4651954c637f4a7552b8dab2cacfd812
lpvera22/Study
/runner-up.py
UTF-8
287
3
3
[]
no_license
if __name__ == '__main__': n = int(input()) arr =list( map(int, input().split())) arr.sort(reverse=True) if arr[0] != arr[1]: print(arr[1]) else: for i in range(n): if arr[0]!=arr[i]: print(arr[i]) break
true
5213301c1028b6d8775e149ae96aaa3d2d652b83
nsotiriou88/Python
/Training/Database/SQL, Cursors, Injection Attacks, Placeholders.py
UTF-8
2,531
3.359375
3
[]
no_license
import sqlite3 db = sqlite3.connect("contacts.sqlite") db.execute("CREATE TABLE IF NOT EXISTS contacts (name TEXT, phone INTEGER, email TEXT)") db.execute("INSERT INTO contacts(name, phone, email) VALUES('Tim', 6545678, 'tim@email.com')") db.execute("INSERT INTO contacts VALUES('Brian', 1234, 'brian@myemail.com')") c...
true
b7bada372b35ff4712bf2a84e616d83c0644e7de
akshata-akkanna/IMDB
/IMDB_PY.py
UTF-8
5,425
3.265625
3
[]
no_license
#How many movies are made each year? #Show the distribution over the past 100 years. # Databricks notebook source #Import Spark Session - Encompasses SparkContext & SQLContext from pyspark.sql import SparkSession #SQL functions from pyspark.sql import functions #Get the raw data ----> I have used Databricks F...
true
56d273d372a7b19217b1436aab9b6ff5172025c0
ald77/ra4_macros
/run/rpv_bkg_syst.py
UTF-8
17,813
2.734375
3
[]
no_license
#!/usr/bin/env python """This script plots bkg systematics for the RPV analysis""" import sys import math import ROOT from array import array import argparse parser = argparse.ArgumentParser() parser.add_argument("-i", "--input") args = parser.parse_args() if (args.input): infile = args.input else: sys.exit("Pleas...
true
1fb9220507b5745e27cea8a6833412e32bce5ab6
EBernardoJR/Sistema-de-aulas---django
/courses/models.py
UTF-8
1,674
2.921875
3
[]
no_license
from django.db import models #manage class CourseManager(models.Manager): def search (self, query): #quando a função for chamada, a string que for apssada como parametro vai ser usada na busca return self.get_queryset().filter( #e vai retornar um objeto q contenha a string passada na descrição ou no nome ...
true
bbde30b3559cdd0bcc2385861f82e205d6018e4a
surusara/NLB-Python
/Day1/input-#money.py
UTF-8
73
3.59375
4
[]
no_license
money= input("How much money you have? ") print("Your have : ", money)
true
7c68a651122eac6a65f91712ec4afb2c6803c175
ChrisProgramming2018/algoritm
/Recursion/NumberOfBinaryTreeTopologies/python/test.py
UTF-8
1,591
2.96875
3
[]
no_license
# Add, edit, or remove tests in this file. # Treat it as your playground! import program import unittest class TestProgram(unittest.TestCase): def test_case_1(self): self.assertEqual(program.numberOfBinaryTreeTopologies(0), 1) def test_case_2(self): self.assertEqual(program.numberOfBinaryTre...
true
25b67942c4acc9cc33d2c72e5e3fce8630c5e62b
sk1122/Python-Algorithms-Package
/Algorithms.py
UTF-8
2,477
3.765625
4
[ "MIT" ]
permissive
""" Author : Satyam Kulkarni Version : 1.0.0 Python Package https://github.com/sk1122/Alogrithm-Package-Python https://pypi.org """ class Search: """ class Search :params = arr - list of elements (sorted) :params = n - key """ def linear_search(self, arr, n):...
true
db5752850ae90446d8a12b2af4e3e929bcecae7c
1lch2/PythonExercise
/leetcode/linked_list/23.py
UTF-8
2,302
3.796875
4
[ "MIT" ]
permissive
# 给你一个链表数组,每个链表都已经按升序排列。 # 请你将所有链表合并到一个升序链表中,返回合并后的链表。 # 示例 1: # 输入:lists = [[1,4,5],[1,3,4],[2,6]] # 输出:[1,1,2,3,4,4,5,6] # 解释:链表数组如下: # [ # 1->4->5, # 1->3->4, # 2->6 # ] # 将它们合并到一个有序链表中得到。 # 1->1->2->3->4->4->5->6 # 示例 2: # 输入:lists = [] # 输出:[] # 示例 3: # 输入:lists = [[]] # 输出:[] # 提示: # k == lists.length #...
true
97f361498234e0dc66a77dff424e4dbc5ee935a6
heartflow89/tensorflow_tutorial
/07.SoftmaxRegression/07_01_softmax.py
UTF-8
1,365
2.828125
3
[]
no_license
import tensorflow as tf x_data = [[1,2,1,1], [2,1,3,2],[3,1,3,4],[4,1,5,5],[1,7,5,5],[1,2,5,6],[1,6,6,6],[1,7,7,7]] # one-hot y_data = [[0,0,1],[0,0,1],[0,0,1],[0,1,0],[0,1,0],[0,1,0],[1,0,0],[1,0,0]] X = tf.placeholder(tf.float32, shape=[None, 4]) Y = tf.placeholder(tf.float32, shape=[None, 3]) W = tf.Variable(tf.r...
true
c18342fdec3e33d9140f1eebae61c3a51f15c47c
AvivSham/LeetCodeQ
/Easy/PowerOfTwo.py
UTF-8
406
3.34375
3
[ "MIT" ]
permissive
import math def isPowerOfTwo(n: int) -> bool: """ :type n: int :rtype: bool - returns true if n is power of 2, false otherwise """ return True if math.log2(n) % 1 == 0 else False def isPowerOfTwo_ver2(n: int) -> bool: """ :type n: int :rtype: bool - returns true if n i...
true
00ae37cf074775d9ad5be82406be36617564bccb
shoppon/Python-learning
/shoppon/algorithm/sort/quick_sort.py
UTF-8
464
3.578125
4
[ "MIT" ]
permissive
def sort(nums, left, right): if left < right: pivot = nums[left] low = left high = right while low < high: while low < high and nums[high] > pivot: high -= 1 nums[low] = nums[high] while low < high and nums[low] < pivot: ...
true
c6900973f095033618b3f7fee4adc97660e017a8
aarthisandhiya/aarthisandhiya1
/41player.py
UTF-8
147
3.21875
3
[]
no_license
a,b=map(int,input().split()) c=0 for i in range(0,a): if b**i==a: c=c+1 break if c>0: print("yes") else: print("no")
true
e4675edd19d831000225410fcc0be5c28eae9e31
PeramVishnuSree/HackerRank
/problem.py
UTF-8
324
3.359375
3
[]
no_license
n = int(input()) def function(num): count = 0 #num should be in string format length = len(num) for i in range(length): x = num[i-1] if int(x) != 0 and int(num)%int(x) == 0: count +=1 return count for i in range(n): num = input() sol = function(num) print(s...
true
f8e008850c01bda5e3eb238520487362a29dbf6a
wd5/1-django-vkontakte-api
/vkontakte_api/decorators.py
UTF-8
1,725
3.09375
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- from django.utils.functional import wraps def opt_arguments(func): ''' Meta-decorator for ablity use decorators with optional arguments from here http://www.ellipsix.net/blog/2010/08/more-python-voodoo-optional-argument-decorators.html ''' def meta_wrapper(*args, **kwargs): ...
true
0988178730d79e7b309a42a2856553928117e320
xRuiAlves/FEUP-ROBO
/robo2_src/robo_fi/fault_injector.py
UTF-8
3,098
2.6875
3
[]
no_license
#!/usr/bin/env python import rclpy import argparse import sys from robo_fi.communication import PipelinedRetransmitter from robo_fi.injection_types import FixedInjector, ScaleInjector, RandomInjector, NullInjector, AddConstantInjector, RotationInjector def get_args(): p = argparse.ArgumentParser(description='Faul...
true
ef1c2847ab2aa96424e6cdc190c0a60a891b9d1f
dazza10/Covid-Economic-Dashboard
/covid_project/daily_stats.py
UTF-8
1,983
3.109375
3
[]
no_license
''' First code is to define a general function used to pull different data from the same website. Second code is to pull the data of corona cases on a daily basis ''' import pandas as pd import datetime import requests import secrets import sqlalchemy #Defining the function to pull api from website def re...
true
97c31c256ee6a9f65de4e04f09ca7f6239687124
dyonende/ATM
/code/svm.py
UTF-8
2,777
3.15625
3
[]
no_license
''' Authors: Anouk Twilt, Dyon van der Ende, Lois Rink Argument 1: pre-processed train file in conll format Argument 2: pre-processed test file in conll format Argument 3: output file Based on https://github.com/cltl/ma-ml4nlp-labs/blob/main/code/assignment1/basic_system.ipynb ''' from sklearn.feature_extraction impor...
true
ec6511a4cb5b308d2f1fd46a29cf695994775ce3
chjberlioz/project_euler
/Coded triangle numbers.py
UTF-8
395
3.453125
3
[]
no_license
# coding = utf-8 def is_triangle_num(n): for i in range(n+1): if n == i*(i+1)/2: return True return False def to_num(w): return sum([ord(i)-64 for i in w]) count = 0 with open('words.txt') as ws: words = ws.read() wl = [i.strip('"') for i in words.split(',')] for i in wl:...
true
824e0eb031b6f0da1d4eeda575aa8dc6532b63dc
lfsmoura/AoC2017
/day19.py
UTF-8
1,216
3.171875
3
[]
no_license
grid = [] with open("input.txt") as f: for line in f.readlines(): grid.append(line) test = """ | | +--+ A | C F---|----E|--+ | | | D +B-+ +--+ """ tgrid = [ line for line in test.split('\n')] def seq(g): w = len(g[0]) h = len(g) y, x = 0...
true
77f0238a0b28f01bb2dd16f36f3d49be0f70d652
chandu7077/cryptography
/playfair/playfair_original/playfair_enc.py
UTF-8
1,980
2.796875
3
[]
no_license
##encryption from playfair_space import playfair_space def playfair_encrypt(text,key): #space,alpdic,dicalp,temp=playfair_space(key) cipher="" strs=text.split() for it in strs: cipher+=" "+encrypt(it,key) return cipher.lstrip() def encrypt(text,key): space,alpdic,dicalp,temp=playfair_spa...
true
5a57cca0634964ce8a794505ff441fe33514e91a
StevenJ87/Python_Learning
/app11.py
UTF-8
664
2.53125
3
[]
no_license
has_high_income = True has_good_credit = False if has_good_credit and has_high_income: print('Eligible for loan') else: print('Not eligible for laon') has_high_income = True has_good_credit = False if has_good_credit or has_high_income: print('Eligible for loan') else: print('Not eligible for laon') ...
true
7d65c8686682c48e2a55ecba146242ef6623f512
RakeshKumar045/interviewbit-solutions-python
/Dynamic Programming/CNTTrue.py
UTF-8
1,629
2.890625
3
[]
no_license
class Solution: # @param A : string # @return an integer def cnttrue(self, A): if not A: return 0 elif len(A) == 1: return True if A == 'T' else False symbols = "".join([A[i] for i in range(len(A)) if (A[i] == "T" or A[i] == "F")]) operato...
true
4f64fbbbb9604cfd202d794dcbff80383302b581
ken8203/na-python-prog
/na_socket_client.py
UTF-8
294
2.75
3
[]
no_license
#! /usr/bin/env python # -*-coding: utf-8 -*- # file: na_socket_client.py import socket HOST = '' PORT = 50007 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((HOST, PORT)) sock.sendall('Hello, world') data = sock.recv(1024) sock.close() print "Received: " + str(data)
true
c103ba0266bb750ba30b0cdb40aea1df3c5a51b8
ruben-jimenez/python-basic
/python-exercises/10-list-overlap-comprehensions.py
UTF-8
469
3.5625
4
[]
no_license
""" Exercise from: https://www.practicepython.org/exercise/2014/04/10/10-list-overlap-comprehensions.html Code created by Ruben Jimenez """ #Python imports import random def run(): ran1 = random.randint(7,13) ran2 = random.randint(5,10) a = random.sample(range(25), ran1) b = random.sampl...
true
dcebd4fb9017491ba2f4cf0a0f7b41dee06ab10f
suhasbhairav/Pandas
/practise4.py
UTF-8
612
3.546875
4
[]
no_license
import pandas as pd import numpy as np #Descriptive Statistics #Create a Dictionary of series d = {'Name':pd.Series(['Tom','James','Ricky','Vin','Steve','Smith','Jack', 'Lee','David','Gasper','Betina','Andres']), 'Age':pd.Series([25,26,25,23,30,29,23,34,40,30,51,46]), 'Rating':pd.Series([4.23,3.24,3.98,2.56,...
true
95a6f1f4f84feb16714a7542f4ee52b0d7ca62ce
syllog1sm/swbd_tools
/Treebank/PTB/_PTBSentence.py
UTF-8
3,787
2.71875
3
[]
no_license
import re from Treebank.Nodes import Sentence from _PTBNode import PTBNode from _PTBLeaf import PTBLeaf class PTBSentence(PTBNode, Sentence): """ The root of the parse tree Has no parent, and one or more children """ def __init__(self, **kwargs): if 'string' in kwargs: nod...
true
9813ea353c79d50649270c1593110c0efa1b9e1e
Fahimeh1983/Python-MIT-course
/sqrt-exh.py
UTF-8
370
3.3125
3
[]
no_license
number = float(raw_input("Enter an integer:")) if number < 0: isNeg = True else: isNeg = False number = abs(number) ans= 0. nstep = 0 max_step =100000 epsilon = 0.01 step_size= epsilon **2 while (abs(number - ans**2) > epsilon) and (ans**2 <= number) : ans = ans + step_size nstep += 1 if isN...
true
b5a147f825896488398b0ce52352a8161bdbc5be
Terfno/2017_yayoifes_safenet
/Untitled-1-DESKTOP-80N2MUM-2.py
UTF-8
572
2.6875
3
[]
no_license
import tkinter import sys #初期化 root = tkinter.Tk() root.title=('2017弥生祭展示作品') root.minsize(1000,1500) event='title' canvas = tkinter.Canvas(bg='white',width=8000,height=10000) canvas.place(x=0,y=0) #title用 def title_drow(): label_title = tkinter.Label(root, text='~名前はまだ無い~',font=('none','45','bold'),bg='white') ...
true
cc789d7ce0bd88e1a5cf3403a9226655f692c0cc
rellermeyer/TUD-DistributedSystems
/Conflict-free_Replicated_Data_Types/src/benchmarking/Neo4jClient.py
UTF-8
2,966
2.828125
3
[ "Apache-2.0" ]
permissive
import requests class Neo4jClient(): # The url of instance to make the requests to server_url="http://neo4j:mySecretPassword@localhost:7000" # The endpoint to handle Cypher queries & commands endpoint = "/db/neo4j/tx/commit" def add_vertex(self, vertex_name): url = self.server_url + self...
true
0104ecf700ea5c93a635b712048aadaed76c3854
shreyasAserkar/Bigdataproject
/separateRetweets.py
UTF-8
539
2.84375
3
[]
no_license
#our original data has tweets and retweets in same file. #Tweets and Retweets both have different formats. #It would be cumbersome to analyse the json with different format in same file. #This code sepearates retweets and tweets in 2 files. import json with open('final2.json', 'r') as f: for eachline in f: try: ...
true
223811af6caf7b605119a2992c69165dbd27309c
XiangkeChen/My_Leetcode
/Algorithm/26. Remove Duplicates from Sorted Array.py
UTF-8
1,227
4.1875
4
[]
no_license
# given nums is sorted def removeDuplicates(nums): # Since, our first element is already present at index 0 (it is a unique element), we quickly run a for loop for the entire array to scan for unique elements. # If the current element and the next element are the same, then we just keep on going till we find a d...
true
d6903db995bfc6decc7461ff4cf7f9f6fbd93323
mars20/suspect
/tests/test_mrs/test_fitting.py
UTF-8
2,134
2.734375
3
[ "MIT" ]
permissive
from suspect.fitting import singlet from suspect import basis, MRSData import numpy def test_gaussian(): time_axis = numpy.arange(0, 0.512, 5e-4) fid = basis.gaussian(time_axis, 0, 0, 50.0) data = MRSData(fid, 5e-4, 123) model = singlet.Model({ "g1": { "amplitude": 1.0, ...
true
33c32cc63f67267ddc06888b2c6f35c38c5ae0f6
Bakhtaki/Bookstore
/Lib-App/Main/frontend.py
UTF-8
3,486
2.71875
3
[]
no_license
import os import random from tkinter import Label import colorama import tkinter as tk from tkinter import * import backend def ClearList(): Listbox1.delete(0,END) def FillListBox(BookList): for each in BookList: Listbox1.insert(END,each) def ViewCommand(): ClearList() Books =backe...
true
3a6430ece29fbca9012d57f7b34ba3962a387ca3
Shreyaskum/data-structures
/doublelinkedlist.py
UTF-8
5,437
4.09375
4
[]
no_license
class Node(object): def __init__(self,value): self.info = value self.prev = None self.next = None class DoublLinkedList(object): def __init__(self): self.start = None def display_list(self): if self.start is None: print("Empty list") return ...
true
34676b544edde22b70588c9e1d0bd5fc1f661301
AkiraXD0712/LeetCode-Exercises
/Permutation II.py
UTF-8
736
3.03125
3
[]
no_license
''' Given a collection of numbers that might contain duplicates, return all possible unique permutations. ''' class Solution: def permuteUnique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ def func(nums, res=None): if len(nums) == 1: ...
true
3c8918215de751be5da1e41804de429748ca8c5d
lpantano/seqcluster
/seqcluster/libs/barchart.py
UTF-8
3,803
2.6875
3
[ "MIT" ]
permissive
HEAD=''' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>DB summary</title> <link rel="stylesheet" href="css/style.css" type="text/css"> <script ...
true
b6197eb8a9444555e71deaf82bf4964d5eb266fe
joeryan/web-data
/scraper/linkFollower.py
UTF-8
630
3.3125
3
[ "MIT" ]
permissive
# linkFollower.py # follows links at a specific position a specific number of times # part of the assignments for University of Michigan course: # Using Python to Access Web Data - offered on Coursera.org # Author: Joe Ryan # 19 November, 2015 import urllib from BeautifulSoup import * url = raw_input('Enter URL: ') c...
true
08f2156c0d6a201c939c612d629dd429e51d99e1
dhananjayneelakantan/ML_Projects
/Address_Classifier_and_geocoder/address_filter_ml.py
UTF-8
4,341
2.90625
3
[]
no_license
from sklearn.feature_extraction.text import CountVectorizer, HashingVectorize from sklearn import linear_model import datetime import pandas as pd import pickle """ Word frequency analysis of text extracted for solar equipments from one line diagrams """ from sklearn.neural_network import MLPClassifier from sklearn.m...
true
6ffa6216fdc9947443c12a1e0d9cf86626ab2e73
CitrineInformatics/citrine-python
/src/citrine/resources/api_error.py
UTF-8
1,326
2.8125
3
[ "Apache-2.0" ]
permissive
from citrine._serialization import properties from citrine._serialization.serializable import Serializable class ValidationError(Serializable["ValidationError"]): """A user-facing error message describing why their request was invalid.""" failure_message = properties.Optional(properties.String(), "failure_me...
true
3fbb7a99d5b8852f58380581efd1f2d3acc887d6
ahojcn/practice-code
/Python/itcast/02-Python进阶2/06-生成器/02-斐波那契数列.py
UTF-8
666
3.796875
4
[]
no_license
def create(): print("start") a,b = 0,1 for i in range(5): print("1") yield b # 只要函数里有 yield,就生成了一个对象,返回 b print("2") a,b = b,a+b print("3") print("end") if __name__ == '__main__': '''这里接收返回来的对象''' c = create() # next(c) # next(c) # 取得生成器...
true
f49aedc02c99893211ef311868792a5e3274f719
lqqnjust/gamesanguo
/sanguo/core/view.py
UTF-8
777
3.390625
3
[]
no_license
# coding:utf-8 import pygame class View(object): def __init__(self, width=800, height=600): self.width = width self.height = height self.size = (self.width, self.height) self.surface = self.surface = pygame.Surface((width, height), pygame.SRCALPHA, 32) self.children = []...
true
285f90ed624d2b6c73001e836c6f03279ee40c1a
fossabot/python-dyndnsc
/dyndnsc/tests/common/test_dynamiccli.py
UTF-8
1,632
2.578125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import unittest from dyndnsc.common.dynamiccli import parse_cmdline_args, DynamicCliMixin class Dummy(DynamicCliMixin): def __init__(self, userid, password): pass @staticmethod def configuration_key(): return "dummy" @staticmethod def configuration_key_p...
true
c9685fe1d887a5f52952043f559ce6e71108ef27
anand-ryuzagi/Data-Structue-and-Algorithm
/Sorting/merge-sort.py
UTF-8
1,123
4
4
[]
no_license
# mergesort = it is divide and conquer method in which a single problem is divided in to small problem of same type and after solving each small problem combine the solution. # Time complexity : O(nlogn) # Space complexity : O(n) # algorithms : # 1. divide the array into two equal halves # 2. recursively divide each...
true
4a00d243368af43c7e476824c9395a1f59ebc5bf
FluencyMedia/py_util
/py_file/file_manager.py
UTF-8
6,714
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Sep 1 22:53:00 2016 @author: lstanevich """ import os from py_file.path_manager import objLoc class fWriter: """ Base class to manage file output -- meant to be attached to 'fManager' class objects """ def __init__(self, fManager): """ Co...
true
0d7f9c341821c815b350a2e7c89986a5311f151d
den1den/web-inf-ret-ml
/inputoutput/imaging.py
UTF-8
784
3.03125
3
[ "MIT" ]
permissive
import time import numpy from matplotlib import pyplot as plt def plot_and_show_matrix(numpy_2d_array, treshhold=0.7): t0 = time.time() arr = numpy_2d_array rowI = 0 for row in arr: colI = 0 for el in row: if colI == rowI: row[colI] = 0 elif el ...
true
9acb867cc8e7e9a46eb51f7ac961c6f954f963fc
yashdevikar/KERAS-PROJECTS
/CATS AND DOGS/helper.py
UTF-8
903
2.90625
3
[]
no_license
import matplotlib.pyplot as plt from keras.models import load_model import json def show_losses(history): acc = history['acc'] val_acc = history['val_acc'] loss = history['loss'] val_loss = history['val_loss'] epochs = range(1, len(acc) + 1) plt.plot(epochs, acc, 'bo', label='Training acc') plt.plot(epo...
true
cb58d6cddd78a9253f444ba204a5ddc4bfa22410
Feenix33/PyGameG
/Roads/entity.py
UTF-8
1,464
3.296875
3
[]
no_license
""" entity.py """ import pygame as pg from direction import Dir class Entity: _Count = 0 def __init__(self, name, xy, wh, #xy and wh in pixels etype, ai=None, direction=Dir.R, ): self.ndx = Entity._Count Entity._Count += 1 se...
true
4fe4eaa36eb3abad6e13b7fa396c8188716dd115
srbarden/InteractiveProgramming
/compute_distances.py
UTF-8
4,266
3.53125
4
[]
no_license
""" Data Visualization Sarah Barden and Alisha Pegan Takes data collected from news sources about Hillary and Michelle's travels and creates a figure that shows that distance between them over time. The data collected ranges from the 1990s to 2017. """ import json import datetime from datetime import date from tim...
true
98aa5506d0d8919b3d076b3158112702de09e569
jsl1113/LeeJiSeon
/Coding_Test_study/python/B15829.py
UTF-8
148
2.921875
3
[]
no_license
a, b, v = map(int, input().split()) day = 0 high = v-a if high % (a-b) == 0: print(int(high/(a-b)) + 1) else: print(int(high/(a-b) + 1) + 1)
true
6b684e45f108bb2a0e496040c9a8eafe8709b677
gps08/scripts
/subs_dl
UTF-8
3,316
2.8125
3
[]
no_license
#!/usr/bin/python # downloads subtitles for given media file from thesubdb.com or yts from urllib import request from bs4 import BeautifulSoup import requests, sys, os, re, zipfile, hashlib, time def get_hash(name): readsize = 64 * 1024 with open(name, 'rb') as f: size = os.path.getsize(name) ...
true
eaec72b66ae2946e5f35660bc5c355c9b041435c
MicroDanjiao/myTFLearn
/word_embedding/embed_utils.py
UTF-8
2,309
3.21875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys import numpy as np class EmbedUtils(object): ''' utils to insight the word embeddings ''' def __init__(self, embed_file): self.id2word = [] embeddings = [] # load word embedding file with open(embed_fi...
true
afcb58af0443c1f7870dd4d675aff3c04ce5b339
michaelhabeck/bayesian-random-tomography
/isdbeads/hmc.py
UTF-8
5,833
3.171875
3
[ "MIT" ]
permissive
""" Module implementing Hamiltonian Monte Carlo. """ import numpy as np from .probability import Probability from .mcmc import AdaptiveWalk class Hamiltonian(object): """Hamiltonian Implements kinetic and potential energies and their gradients with respect to positions and momenta. """ def ...
true
27da6f707e68bc9a944a2c9ce2f038269cbf94cf
BGCX067/family-feeding-svn-to-git
/trunk/python/feeding_modules/calculate_weekly_ingredient_amount.py
UTF-8
2,003
2.90625
3
[]
no_license
class calculate_weekly_ingredient_amount : def __init__ ( self ) : self . _unit = None self . _amount = None self . _calculate_units_ratio = None self . _consts = None self . _dishes_by_weekday_storage = None self . _find_smallest_convertible_unit = None self ...
true
af465b9c4bbf6fb6244987a2abd33838a930b1f7
galid1/Algorithm
/python/baekjoon/2.algorithm/sort/11650.좌표 정렬하기.py
UTF-8
1,724
3.078125
3
[]
no_license
# JAVA # package com.example.java_study; # # import java.io.BufferedReader; # import java.io.IOException; # import java.io.InputStreamReader; # import java.util.*; # # public class Main { # # public static int n; # public static int[][] cs; # # public static void solve() { # Arrays.stream(cs) # ...
true
391c874a79bae133bf6a7a1f903fee65a2812d49
taufikfathurahman/SISTER-ImageProcessing
/image_rgbtohsv.py
UTF-8
1,833
3.0625
3
[]
no_license
import numpy as np import cv2 from threading import Thread import time class rgb2hsv(Thread): def __init__(self, img, date, host_id): Thread.__init__(self) self.img = img self.date = date self.host_id = host_id def run(self): height,width,channel = self.img.shape ...
true
ca98421ddafc95bb004108da0b89436ba92417f0
kimkyury/DeepLearning_PYTHON
/kerasTest_multi.py
UTF-8
1,624
3.109375
3
[]
no_license
# 다중선형회귀를 해보자 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import numpy as np from tensorflow import keras from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras import optimizers # 데이터셋설정: , 전처리기 과정을 거침 # 나의 수입, saveMoney = (월초주급, 월말주급, 월보너스) saveMoney= ...
true
d09ce3452a79c0b7e9e7fc67a83ffea93cfe7b6e
ElianaGomez2020/holberton-system_engineering-devops
/0x15-api/1-export_to_CSV.py
UTF-8
720
2.828125
3
[]
no_license
#!/usr/bin/python3 """Export data in the CSV format""" from csv import writer, QUOTE_ALL from csv import QUOTE_ALL from sys import argv from requests import get if __name__ == '__main__': users = get( 'https://jsonplaceholder.typicode.com/users/{:s}' .format(str(argv[1]))).json() todos = get( ...
true
c119c4c64cee9436bcbb606a8a46c08b1b26e936
estejairo/muon-daq
/test/script.py
UTF-8
1,019
3.265625
3
[]
no_license
from tempfile import NamedTemporaryFile import shutil import csv def countSetBits(n): count = 0 while (n): n &= (n-1) count+= 1 return count filename = 'test15 - Kopie.csv' tempfile = NamedTemporaryFile('w+t', newline='', delete=False) with open(filename, 'r', newline='') as c...
true