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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a44c04c2078ee528fffa057993935e23c06912b6 | Python | BaekJongHwan/algorithm | /Baekjoon Online Judge/Python/5543.상근날드.py | UTF-8 | 309 | 3.109375 | 3 | [] | no_license | minVal = 0
minVal2 = 0
for i in range(0, 5):
a = int(input())
if i < 3:
if minVal == 0:
minVal = a
elif minVal > a:
minVal = a
else:
if minVal2 == 0:
minVal2 = a
elif minVal2 > a:
minVal2 = a
print(minVal+minVal2-50) | true |
3d9ffc440467023ec0186476a9ec0f5a0d12c51e | Python | kbhalerao/gdalCompose | /async_file_copier.py | UTF-8 | 1,592 | 2.65625 | 3 | [
"MIT"
] | permissive | ## Author: Kaustubh Bhalerao, Soil Diagnostics, Inc.
import os
import shutil
from contextlib import asynccontextmanager
import tempfile
import asyncio
from functools import wraps, partial
def async_wrap(func):
@wraps(func)
async def run(*args, loop=None, executor=None, **kwargs):
if loop is None:
... | true |
faf065ec6e1bba246ade45ce6cebdd9b2450cc32 | Python | WholesomeM3me/Per3_PatrickDalton_pygame | /game_window.py | UTF-8 | 346 | 3.375 | 3 | [
"MIT"
] | permissive | import pygame
x = int(input("How many pixels wide do you want the window resolution to be?"))
y = int(input("How many pixels tall do you want the window resolution to be?"))
screen = pygame.display.set_mode((x, y))
while True:
event = pygame.event.poll()
if event.type == pygame.QUIT:
break
screen.fill((250, 70, ... | true |
61a624708bdf90ed90937acd1181c68fc65220dd | Python | rdestefa/python_server_js_client | /server/test/test_users_key.py | UTF-8 | 5,797 | 2.765625 | 3 | [] | no_license | import unittest
import requests
import json
class TestUsersKey(unittest.TestCase):
SITE_URL = 'http://localhost:51080'
USERS_URL = SITE_URL + '/users/'
RESET_URL = SITE_URL + '/reset/'
print(f'Testing for server: {SITE_URL} USERS KEY EVENT HANDLERS')
def reset_data(self):
m = {}
... | true |
b000cde9413840b03e861416f95c1ae6f8982a90 | Python | MMaltez/FileIndexer | /exp/exp001.py | UTF-8 | 193 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Hello world.
@author Miguel Maltez Jose
@date 20210314
"""
def main():
"""There can be only one."""
print("Hello.")
if __name__ == "__main__":
main()
| true |
6d2ef745e5143eef9a1b8db59c9ea06d9affff80 | Python | TrentHand/Django-Music-History-RestAPI | /quickstart/models/artistmodels.py | UTF-8 | 381 | 2.890625 | 3 | [] | no_license | from django.db import models
from .genremodels import Genre
class Artist(models.Model):
"""
Stores a single Artist
fields:
'name' is a character field
'genre' is a foreign key
"""
name = models.CharField(max_length=55)
genre = models.ForeignKey(Genre, on_delete=models.CASCADE)
def ... | true |
ff97dbd9a105848e0c506615564f40a9fbb8e4ba | Python | hortonew/SpaceInvaders-Like-Game | /classes/game.py | UTF-8 | 3,196 | 2.640625 | 3 | [] | no_license | import logging
import random
from config import *
from classes import player
from classes.bullet import Bullet
from classes.enemy import EnemyGroup, Enemy
from classes.scenes import MainMenu, WinScreen, LoseScreen
from classes.gameitem import GameItem
from classes.hud import Score, Lives
import pyglet
logger = logging... | true |
79a4b55978c5e6bc329ed0571f9cfefd62e22f12 | Python | Reqin/Network-Video-Transmission | /modules/network/Communicator.py | UTF-8 | 960 | 2.96875 | 3 | [] | no_license | # coding:utf8
import socket
import time
class Communicator:
def __init__(self, address, conn=None):
self.message_send = None
self.message_recv = None
self.sock = conn
if not conn:
print(55)
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | true |
d13056670ea9f2c59988c7da8128ec421886245d | Python | sumin123/CodingTest | /0825/불량 사용자.py | UTF-8 | 762 | 2.625 | 3 | [] | no_license |
from itertools import permutations
def solution(user_id, banned_id):
def check(id):
for i in range(len(id)):
if len(id[i]) != len(banned_id[i]):
return False
for j in range(len(id[i])):
if banned_id[i][j] == '*':
continue
... | true |
68ffc4a9fc224d972a52410dd89d6f34d43c0973 | Python | yanshugang/study_data_structures_and_algorithms | /sort_algorithms/s03_insertion_sort.py | UTF-8 | 770 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: ysg
# @Contact: yanshugang11@163.com
# @Time: 2019/7/24 下午6:07
"""
插入排序
每次挑选下一个元素插入已经排序的数组中,初始时已排序数组只有一个火元素。
"""
def insertion_sort(seq):
n = len(seq)
print(seq)
for i in range(1, n):
value = seq(i) # 保存当前位置的值, 因为转移的过程中它的位置可能被覆盖
# 找到这个值的合适位置,使得前边的数组有序... | true |
92a6b3b77b443538f900a7da063570e48a3e5443 | Python | alexandraback/datacollection | /solutions_5634697451274240_1/Python/Alon/foo.py | UTF-8 | 305 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python
import sys
def calc(pan):
cnt = 0
curr = '+'
for c in pan[::-1]:
if c != curr:
cnt += 1
curr = c
return cnt
def main():
d = file(sys.argv[1]).readlines()
n = int(d[0])
for j in xrange(1,n+1):
print "Case #%d: %d" % (j, calc(list(d[j][:-1])))
main()
| true |
e03aff4ff8608a8877763d37513c8bea9501d6e4 | Python | zompi2/HouseOffersCrawler | /mailsender.py | UTF-8 | 508 | 3.125 | 3 | [] | no_license | # Sends an email with given content
import smtplib
def sendMail(receivers, subject, content) :
sender = "me@example.com"
message = """From: <{}>
To: {}
MIME-Version: 1.0
Content-type: text/html
Subject: {}
{}
""".format(sender, '<' + '>,<'.join(receivers) + '>', subject, content)
try:
smtpObj = smtpli... | true |
2e1c8471b6a9912b8cc97d981e7b903832363cb0 | Python | junyoung-o/PS-Python | /by date/2021.02.08/1010.py | UTF-8 | 603 | 3.3125 | 3 | [] | no_license | t = int(input())
def get_mul(m, n):
result = 1
for i in range(n):
result *= (m - i)
return result
def get_result(n, m):
source = get_mul(m, n)
target = get_mul(n, n)
return source // target
def is_extra(n, m):
if(n == m):
print(1)
return True
if(n == 1):
... | true |
b7395feb15526974fdb71fbc7267f9fb9a650ccb | Python | ddlinz/PBnB | /testfunction_rosenbrock.py | UTF-8 | 437 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 23 21:47:31 2017
@author: TingYu Ho
r: number of replication
"""
import numpy as np
def testfunction_rosenbrock(X,r):
mu, sigma = 0, 0 # mean and standard deviation
s = np.random.normal(mu, sigma, r)
x = X[0]
y = X[1]
a = 1. - x
b =... | true |
e8b48c599a27e6024ae461da09c69ef06d4b9c75 | Python | rizquuula/PaperRockScissor-DicodingSubmission | /MLpredict.py | UTF-8 | 1,868 | 2.53125 | 3 | [] | no_license | from keras.models import load_model
import cv2
import numpy as np
import os
img_width, img_height = 300//2, 200//2
def preprocessing(img_name = None, i = None):
# print(img_name, i)
if i == 0:
img_dir = paperDir
elif i == 1:
img_dir = rockDir
else:
img_dir = scissorDir
img... | true |
2fce39586ac7c684f2cfe54f3525556f4a37b455 | Python | maxblunck/irony_detection | /src/surface_patterns.py | UTF-8 | 1,766 | 3.125 | 3 | [] | no_license | from collections import Counter
from ngram_feature import NgramFeature
import config
class SurfacePatternFeature(NgramFeature):
"""
Class representing feature f3
extract-method returns a feature-vector of length of its vocabulary
containing surface-pattern-n-gram counts
"""
corpus_key = 'SURFA... | true |
a8742c59f79409445384b99674a8eb7d6abadfe5 | Python | Gubba-Jaydeep/MissionRnDPythonCourse | /finalproblems/finaltest_problem2.py | UTF-8 | 1,154 | 4.34375 | 4 | [] | no_license | __author__ = 'Kalyan'
max_marks = 25
problem_notes = '''
A palindrome is a word which spells the same from both ends (case-insensitive).
If a word is not a palindrome, you can make a palindrome out of it by adding letters to either ends of the word.
Your goal is to make a palindrome of the minimum length.
For e.... | true |
e172897340f94bfa85f39d2286e073883fb06417 | Python | rakieu/python | /pop cidades igual.py | UTF-8 | 220 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
def main ():
x = 1
fim = int(input("Digite um número: "))
while x <= fim:
print (x)
x = x = 1
# ------
main () | true |
5565750dd483317b2e8bc573e2e70717ef451247 | Python | imdduoming/GameProject | /gui.py | UTF-8 | 43,364 | 3.03125 | 3 | [] | no_license | from tkinter import *
import random as rd
import time
from tkinter import messagebox
from PIL import Image as pim # png 이미지 활용을 위해 사용
from PIL import ImageTk as pit
# ------tk, 프레임 클래스--------
class GameMain(Tk): # Tk(프로그램) 클래스
def __init__(self): # 초기화 - 화면 크기, 크기 조정 불가능 설정
Tk.__init__(self)
... | true |
029279c8d1a5bedb0e6396dc91ed6ed751eb99d1 | Python | huozhiwei/SafeNL | /UI/ProcessCCSL.py | UTF-8 | 450 | 3 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
from Process.CCSLToMyCCSL import CCSLToMyCCSL
def ProcessCCSL(inputMyCCSLstr):
# 传入的每条CCSL元素包含着用";"隔开的各种MyCCSL语句
tmpList = inputMyCCSLstr.split(";")
text = ""
for i,tmpstr in enumerate(tmpList):
tmpList[i] = tmpstr.strip()
for i,tmpstr in enumerate(tmpList):
... | true |
d6adca89673bb9524adb08b9ee38e21d7074b567 | Python | tonysyu/deli | /deli/stylus/segment_stylus.py | UTF-8 | 993 | 3.640625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | import numpy as np
from .line_stylus import LineStylus
class SegmentStylus(LineStylus):
""" A Flyweight object for drawing line segemnts.
Line segments, unlike lines drawn by `LineStylus`, are strictly straight
line pairs of start and end points ((x0, y0), (x1, y2)).
"""
def draw(self, gc, star... | true |
469d8b52287f86d131828934c76874f851931e75 | Python | voussoir/etiquette | /etiquette/searchhelpers.py | UTF-8 | 16,383 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | '''
This file provides helper functions used to normalize the arguments that
go into search queries. Mainly converting the strings given by the user
into proper data types.
'''
from . import constants
from . import exceptions
from . import helpers
from . import objects
from voussoirkit import expressionmatch
from vous... | true |
e70b0c9952f24f76c7019808a541c3d699c72f78 | Python | harshp8l/deep-learning-lang-detection | /data/train/python/4178666cbde24e15bbb5996f3d3ee2851278135ctasks.py | UTF-8 | 1,671 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
if __name__ == "__main__":
import dev_appserver
dev_appserver.fix_sys_path()
import os, webapp2, logging, datetime
from xml.dom.minidom import Text, Element, Document
from models import SharkAttack, Country, Country, Area
from utils import StringUtils
from repositories import SharkAttac... | true |
a3db2c8b161778651c2d55ef14efd6cb5d3a093d | Python | BensonMuriithi/python | /lpthw pys/ex11.py | UTF-8 | 274 | 4.0625 | 4 | [] | no_license | #introduction to input
print "How old are you?",
age = raw_input()
print "How tall are you?",
height = raw_input()
print "How much do you weigh in kilograms?",
weight = raw_input()
print """
So you're %r years old, %r cm tall and %rkg in weight
""" % (age, height, weight) | true |
c948cf05896c4c71633aed8dd561339629d14c6a | Python | avivko/pythonWS1819 | /myTurt.py | UTF-8 | 922 | 3.328125 | 3 | [] | no_license | import tkinter
window = tkinter.Tk()
'''button = tkinter.Button(window, text="do not press", width=40)
button.pack(padx=10, pady=10)
clickCount = 0
def on_click(event):
global clickCount
clickCount = clickCount + 1
if clickCount == 1:
button.configure(text='seriously?')
elif clickCount == 2:
... | true |
f379088dfeffa120d98d00c74dc9e18a761d2f7e | Python | acurzons/c | /BootstrapCorrelation.py | UTF-8 | 3,126 | 3.453125 | 3 | [] | no_license |
# coding: utf-8
# In[235]:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
from scipy.optimize import curve_fit
from scipy import stats
# # Uncertainty of Correlation Coefficient
#
# ... due to uncertainty of data points.
# In[184]:
def korr(x,y,xerr,yerr... | true |
651b4bd0d262c8ae9fda4105d0bf3b12e7ddb6f1 | Python | DrewRust/DS-Unit-3-Sprint-2-SQL-and-Databases | /module3-nosql-and-document-oriented-databases/mongo_explorer.py | UTF-8 | 3,439 | 2.984375 | 3 | [
"MIT"
] | permissive | import os
import json
import pymongo
from dotenv import load_dotenv
from pdb import set_trace as breakpoint
#### importing from my_sql_to_mong.py the function put_sqltable_in_dict
from my_sql_to_mongo import put_sqltable_in_dict
#### loading .env file and credentials for MongoDB
load_dotenv()
DB_USER = os.getenv("MON... | true |
d9cd7cfc89b5f6645db7afc7121617d35f40c1d2 | Python | ammardodin/daily-coding-problem | /2021-01-13/solution.py | UTF-8 | 898 | 3.546875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from collections import OrderedDict
def make_palindrome(candidate):
freq = OrderedDict()
for c in candidate:
freq[c] = freq.get(c, 0) + 1
num_odd = 0
odd_char = ''
for c, f in freq.items():
if f & 1:
num_odd = num_odd + 1
odd_char = c
... | true |
7cf10a17ac662d87945453bd4c2e97402865f4bd | Python | andreag-dev/Natural-Language-Processing-class | /hw2/homework2.py | UTF-8 | 3,912 | 3.5 | 4 | [] | no_license | from nltk import word_tokenize
from nltk import pos_tag
from nltk import sent_tokenize
from nltk.text import Text
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.stem.porter import *
from collections import Counter
from random import seed
from random import randint
import random
impo... | true |
f737cee548279ee7a92b36ac27e67493585ad182 | Python | engshorouq/Marks | /student.py | UTF-8 | 734 | 3.46875 | 3 | [] | no_license | import marks
class student():
Student=[]
def __init__(self,student_id,student_name):
assert type(student_id)==int,'Plesae enter number'
assert type(student_name)==str,'Plesae enter string'
self.student_id=student_id
self.student_name=student_name
def add_student(self):
student.Student.append(self)
def... | true |
e6616d36ead7d592c8d6e8b9f099aa2bdad0647f | Python | grassriver/Zhidao | /Portfolio_Optimization/analytical.py | UTF-8 | 4,406 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 5 10:54:48 2018
@author: Kai Zheng
"""
import numpy as np
import pandas as pd
from numpy.linalg import pinv
#%%
def form_mat(mu, sigma):
if not (isinstance(mu, np.ndarray) and isinstance(sigma, np.ndarray)):
raise ValueError('mu and sigma should be np.ndarr... | true |
939f7aa99992370aee38f6fb568096a2d6e4edf1 | Python | JoshuaW1990/leetcode-session1 | /leetcode321.py | UTF-8 | 834 | 3.03125 | 3 | [] | no_license | class Solution(object):
def maxNumber(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[int]
"""
def preprocess(nums, k):
stack = []
drop = len(nums) - k
for ch in nums:
... | true |
343f8841386cbb6dd8995ea76e18e929d4d7499b | Python | gtambi143/Discussion-Forum | /syncclient.py | UTF-8 | 723 | 2.75 | 3 | [] | no_license | import socket # Import socket module
import time
#s = socket.socket() # Create a socket object
# Reserve a port for your service.
#s.connect((host, port))
#s.send("Hello server!")
f = open('sync1.txt','rb')
print 'syncronising...'
l = f.read(1024)
while(1):
s = sock... | true |
905fae2b859b6208b59c96f272d85a75c8c926b0 | Python | sonesuke/Kata | /Bowling/python/SerializeService.py | UTF-8 | 3,032 | 2.90625 | 3 | [] | no_license | from Model import Game, Roll
class Stream:
def write_header(self, tag):
raise NotImplemented
def write_footer(self, tag):
raise NotImplemented
def write_count(self, count):
raise NotImplemented
def write_body(self, body):
raise NotImplemented
def load_header(se... | true |
6647cd0adfb6b6c8e3a877045013057220c4947e | Python | somous-jhzhao/bayesian-free-energies | /bams/convergence_analysis_tools.py | UTF-8 | 11,233 | 2.9375 | 3 | [] | no_license | import numpy as np
from copy import deepcopy
from bams.example_systems import *
from bams.bayes_adaptor import BayesAdaptor
from bams.sams_adapter import SAMSAdaptor
#---Functions to compute SAMS and BAMS mean-squared error using the `GaussianMixtureSampler`---#
def gaussian_thermodynamic_length(s_min, s_max):
""... | true |
9629bca437bf1b8d6ca4e5f3668f449852bd09f1 | Python | xrw560/ai_bf | /DecisionTree/决策树分类买模型可视化.py | UTF-8 | 5,726 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import warnings
from sklearn import tree #决策树
from sklearn.tree import DecisionTreeClassifier #分类树
from sklearn.model_selection import train_test_split#测试集和训练集
from sklearn.pipeline import Pipeline ... | true |
f58999acedbd548cf7fb47b860c57b7a3620f249 | Python | italovinicius18/urisolutionspy | /1134.py | UTF-8 | 294 | 3.640625 | 4 | [] | no_license | ver = 0
gas = 0
alc = 0
die = 0
while ver!=4:
ver = int(input())
if ver == 1:
alc+=1
elif ver == 2:
gas+=1
elif ver == 3:
die+=1
elif ver == 4:
break
print('MUITO OBRIGADO')
print('Alcool:',alc)
print('Gasolina:',gas)
print('Diesel:',die) | true |
ce2e36b4f4623ed1c21d8a33994457ecd2f0da11 | Python | shubhamsinha1/Python | /PythonDemos/1.Introduction_of_Python/6.Iterable/0.Introduction.py | UTF-8 | 821 | 4.375 | 4 | [] | no_license | #anything which can be traversed is iterator
#There are 3 concepts : Iteration , Interable and iterator
#iterable is any object which can provide us with an iterator.
#Iterator is any object which has next method
#Iteration is the process of accessing element one by one
#Generator are iterators but they are interated... | true |
ccf4b56e552d739be89988ad7deadc4dabcaa59b | Python | YuriQueriquelli/fatec_tg | /classifier.py | UTF-8 | 1,582 | 2.9375 | 3 | [] | no_license | from naive_bayes import postgresql_to_dataframe
import pickle
import psycopg2
from instance.config import config
def de_para_previsao(previsao):
return {
'Análise e Desenvolvimento de Sistemas':1,
'Comércio Exterior':2,
'Gestão Empresarial':3,
'Gestão de Serviços':4,
'Logíst... | true |
3be9b0c1b1cf54ef2f000683d868798e33b319ea | Python | yw7vvAW611/LeecodePracticeNotes | /Combinations.py | UTF-8 | 1,592 | 3.6875 | 4 | [] | no_license | '''
77. Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
You may return the answer in any order.
Example 1:
Input: n = 4, k = 2
Output:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
Example 2:
Input: n = 1, k = 1
Output: [[1]]
Constraints:
1 <... | true |
56e2414c45b1a646939b65624ad371ff3472aeab | Python | yang4978/Huawei-OJ | /Python/1900. 【认证试题】字符排序.py | UTF-8 | 947 | 3.296875 | 3 | [] | no_license | """
Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
Description: 上机编程认证
Note: 缺省代码仅供参考,可自行决定使用、修改或删除
"""
class Solution:
def character_sort(self, input_str):
# 在此添加你的代码
arr = [[] for _ in range(3)]
index = []
for c in input_str:
if c.... | true |
b2eadcf90c4fcb1f689ec169c083e3f8189856e5 | Python | gabminamedez/kattis | /1.9/abc.py | UTF-8 | 334 | 3.546875 | 4 | [] | no_license | nums = input()
nums = [int(num) for num in nums.split()]
letters = input()
nums.sort()
new = []
for letter in letters:
if letter == "A":
new.append(nums[0])
elif letter == "B":
new.append(nums[1])
elif letter == "C":
new.append(nums[2])
print(str(new[0]) + " " + str(new[1]) + " " ... | true |
2a2454b1020ea6107487a8f91020fda5f8016949 | Python | CaioBrighenti/fake-news | /data/FakeNewsNet/code/util/util.py | UTF-8 | 2,829 | 2.640625 | 3 | [
"MIT"
] | permissive | import csv
import errno
import os
import sys
from multiprocessing.pool import Pool
from tqdm import tqdm
from util.TwythonConnector import TwythonConnector
class News:
def __init__(self, info_dict, label, news_platform):
self.news_id = info_dict["id"]
self.news_url = info_dict["news_url"]
... | true |
f723464bcef5f79dc833c76221b7d7e62ca6b3f7 | Python | creich/CarND-Advanced-Lane-Lines | /calibrate_camera.py | UTF-8 | 6,033 | 2.8125 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import glob
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import pickle
DEBUG = False
#TODO make filename a parameter
PICKLE_FILE_NAME = 'camera_calibration_data.p'
def calibrate_camera():
## find chessboard corners
# prepare object points
nx = 9# the nu... | true |
f2bb501da4e5b05c84b633dc8210efed2dddfde7 | Python | Gozea/Danmaku | /End_menu.py | UTF-8 | 2,556 | 3 | 3 | [] | no_license | import pygame
from Player import *
from Enemy import *
class End_menu:
"""Classe qui représente le menu d'accueil du jeu"""
def __init__(self, game):
"""Constructeur de classe"""
self.game = game
self.title = pygame.image.load('assets/title/game_over.png').convert_alpha()
... | true |
b6122ee53357088e6ef11240134bd9eb5ad13bdd | Python | Andos25/CodeforFundFlow | /stephanie/data-analysis/correlation-analysis.py | UTF-8 | 1,488 | 2.78125 | 3 | [] | no_license | # coding=UTF-8
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
from scipy.stats.mstats import zscore
# ['Interest_O_N', 'Interest_1_W', 'Interest_2_W', 'Interest_1_M', 'Interest_3_M', 'Interest_6_M', 'Interest_9_M', 'Interest_1_Y']
tianchi_path = '/home/lt/data/tianchi/'
cle... | true |
cfd4e9903031b5dcf849f9cfdffa856ee72281e8 | Python | changhoonhahn/central_quenching | /CenQue/archive/test_smf.py | UTF-8 | 1,194 | 2.71875 | 3 | [] | no_license | '''
Test integrated mass evolution
'''
import numpy as np
from scipy import interpolate
from smf import SMF
from util.cenque_utility import get_z_nsnap
from defutility.plotting import prettyplot
from defutility.plotting import prettycolors
def analytic_smf_evol(source='li-drory-march'):
'''
Evolution of... | true |
c9f45ed5f93af6408b3a9b69a89ff9f9f6e1ed30 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/nth-prime/febc67306da24d3785b9b60e51b729c5.py | UTF-8 | 820 | 2.96875 | 3 | [] | no_license | import math,cProfile
def nth_prime(number):
primes = []
i=1
while True:
i+=1
if i%2==1 or i==2:
prime = True
if primes:
if len(primes) == number:
return primes[len(primes)-1]
... | true |
259a7bd523d77dd3504cf02494391f04ec970fc4 | Python | Aasthaengg/IBMdataset | /Python_codes/p03567/s724524410.py | UTF-8 | 58 | 2.890625 | 3 | [] | no_license | N=input()
if N.find('AC')+1:print("Yes")
else :print("No") | true |
6551f0a8276c4353b5433977b2bea0fddebce275 | Python | alexliqu09/Python_for_ML_and_DL | /src/parser.py | UTF-8 | 484 | 3.484375 | 3 | [] | no_license | import numpy as np
import argparse
def tanh(x):
return (np.exp(x) + np.exp(-x)) / (np.exp(x) - np.exp(-x))
def parser(funct):
parser = argparse.ArgumentParser()
parser.add_argument("argument", help = "If you want to compute the tanh we need you give a x parammeters",
type = int)
... | true |
ee6b7acdd67065f27800e35e347da3eb9c8ab9bc | Python | Orelm32/Hotel-Project | /hotel.py | UTF-8 | 15,040 | 3.484375 | 3 | [] | no_license | from time import sleep
room1 = open("C:/Users/Orel Moshe/Desktop/Python Projects/room1.txt", "r")
room2 = open("C:/Users/Orel Moshe/Desktop/python Projects/room2.txt", "r")
room3 = open("C:/Users/Orel Moshe/Desktop/Python Projects/room3.txt", "r")
room4 = open("C:/Users/Orel Moshe/Desktop/Python Projects/room4.tx... | true |
3953c407856ef83db643609335dc8526bd470ba6 | Python | sallarak/Automation | /pyAutomation/pyStuff/print_numbers.py | UTF-8 | 90 | 3.578125 | 4 | [] | no_license | #!/usr/bin/python
# Script that prints numbers 1 -10
for i in range(1,11):
print(i)
| true |
1339f21e5eef6e918fa33ccc9c9f0fb86728c016 | Python | agyenes/greenfox-exercises | /08 tkinter_python/02.py | UTF-8 | 441 | 3.859375 | 4 | [] | no_license | # create a 300x300 canvas.
# draw a box that has different colored lines on each edge.
from tkinter import *
root = Tk()
canvas = Canvas(root, width='300', height='300')
canvas.pack()
side_1 = canvas.create_line(30, 30, 270, 30, fill='red')
side_2 = canvas.create_line(270, 30, 270, 270, fill='blue')
side_3 = canvas... | true |
6a8ce1abad64ee9a1195a7d8b38a44118dfbdd92 | Python | BrendanMoore42/midi_infinite | /main.py | UTF-8 | 3,900 | 3.265625 | 3 | [] | no_license | import time
import rtmidi
import random
from card import *
"""
rtmidi version = 1.1.0
Cards! to Midi!:
A deck of cards has 52! possible permutations - there are
52 * 51 * 50 ... * 2 * 1 possible orders the deck can have.
52! = 8.1 x 10^67 possible configurations.
The current estimated age of the universe
is cur... | true |
d9c8ca35dc21e355f3b80db1dea6ec1a63363f18 | Python | KoreyEnglert/HW4-unit-testing | /Q2_unit_test.py | UTF-8 | 511 | 3.0625 | 3 | [] | no_license | import unittest
import Q2
class TestCase(unittest.TestCase):
def test_average(self):
self.assertAlmostEqual(Q2.average([3,4,5]), 4);
def test_average2(self):
self.assertAlmostEqual(Q2.average([3,4,5]), 5);
def test_average3(self):
self.assertAlmostEqual(Q2.average([3.2,4.7,5.1,-.1... | true |
46bb3fb46cf43152398ab8cff912f41097aea8da | Python | alexandraback/datacollection | /solutions_2652486_1/Python/jbochi/3.py | UTF-8 | 1,432 | 2.96875 | 3 | [] | no_license | import itertools
from collections import defaultdict
def cards(m):
return range(2, m + 1)
def combinations(c, n):
return itertools.combinations_with_replacement(c, n)
def select(n):
return itertools.product([True, False], repeat=n)
def choices(m, n):
for cs in combinations(cards(m), n):
prod... | true |
489c5fd3d8dc334f227a5b8ed4d0e51a95c4c81b | Python | dst1213/python_canslim | /CANSLIM/get_stock_df.py | UTF-8 | 2,019 | 2.890625 | 3 | [] | no_license | from datetime import date
import pandas as pd
from get_eps import get_quarterly_eps
from get_roe_revenue import get_roe, get_revenue_quarterly
columns = ['TICKER', 'Q1', 'Q2', 'Q3', 'Q4',
"Q1'", 'EPS%', 'ROE', 'REV%', 'UPDATED DATE']
tickers_row = []
tickers_dict = {}
def get_revenue_growth_quarterly(rev... | true |
b9b2cebbd0ca305e379e9f0eeab8f961fcc968f5 | Python | judgegc/se-res-calc | /scripts/extract_blocks.py | UTF-8 | 2,590 | 2.5625 | 3 | [] | no_license | import re
import json
import xml.etree.ElementTree as ET
SOURCE = 'CubeBlocks.sbc'
def extract_block(el):
componentMap = {
'SteelPlate': 'steel_plate',
'Construction': 'construction_component',
'PowerCell': 'power_cell',
'Computer': 'computer',
'MetalGrid': 'metal_grid',
... | true |
ca926994c6288e4cfdf174bf4ff63638a362fa0f | Python | JenZhen/LC | /lc_ladder/Adv_Algo/dp/Longest_Continuous_Increasing_Subsequence_II.py | UTF-8 | 3,883 | 3.828125 | 4 | [] | no_license | #! /usr/local/bin/python3
# https://www.lintcode.com/problem/longest-continuous-increasing-subsequence-ii/description
# https://leetcode.com/problems/longest-increasing-path-in-a-matrix/submissions/
# Same as LC329 Longest Increasing Path in a Matrix
# Example -- 从山顶滑雪问题, 最长下山路径
# Give you an integer matrix (with row ... | true |
9a1f38f15cd412e6ed42d0e931aa84889ccb45e2 | Python | yuxueCode/Python-from-the-very-beginning | /01-Python-basics/05-Lists-and-dictionaries/chapter05/list/sample1.py | UTF-8 | 138 | 4 | 4 | [] | no_license | #列表的创建
#变量名=[元素1,元素2,....]
list = ['a' , 'b' , 'c' , 'd' , 1 , 2 , 3 , 4]
print(list)
list1 = []
print(list1) | true |
803450c0a3075f119b124d251b591847887a372e | Python | AndreasWituschek/fermi_analysis | /fermi_analysis/functions.py | UTF-8 | 26,507 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 13:22:02 2019
@author: Andreas
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
#import pandas as pd
import scipy as sp
import scipy.constants as spc
from scipy import optimize
from scipy import fftpack
import h5py
import os
#physical constants:
c = s... | true |
6fce5f57bb9ced1f431fb874865d995c082e23d8 | Python | SURAJNAYA/git-tutodrial- | /input1.py | UTF-8 | 19,090 | 3.5625 | 4 | [] | no_license | # name=input("type your name")
# print ("hello" + name)
# age= input("what is your age ?")
# # print("your age is",age)
# number_first = int(input("enter first number"))
# number_sec = int(input("enter second number"))
# total= number_first + number_sec
# print("totle is" + str(total))
# print(f"totle number {... | true |
709d55da3f63324cb2b6b460869bc5cfd35e75f6 | Python | ghosthamlet/abstraction-and-reasoning-challenge | /src/operator/transformer/reducer/fill_pattern/periodicity_row_col.py | UTF-8 | 6,667 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy as np
import numba
from src.data import Problem, Case, Matter
from src.operator.solver.common.shape import is_same
@numba.jit('i8(i8[:, :], i8)', nopython=True)
def find_periodicity_row(x_arr, background):
"""
:param x_arr: np.array(int)
:param background: int
:return: int, minimum period... | true |
d48bc5947439c12a819ff73ff614de287b766fe8 | Python | DaehanKim/projectEuler | /29.py | UTF-8 | 1,103 | 3.390625 | 3 | [
"MIT"
] | permissive | import math
from tqdm import tqdm
from collections import Counter
def is_prime(num):
if num == 2: return True
for i in range(2, math.ceil(math.sqrt(num))+1):
if num % i == 0 : return False
return True
def get_largest_prime_factor(num):
if is_prime(num) : return int(num)
for i in range(math.ceil(math.sqrt(num)... | true |
c9627ada6e77a4da27f064659cfb69cd3b158c50 | Python | ferologics/twitter-bot-python-ferologics | /section_3/word_frequency.py | UTF-8 | 811 | 3.546875 | 4 | [] | no_license | import sys
import re
def histogram(source_text):
file = open(source_text)
string = file.read()
compiled_rgx = re.compile(r"[^a-zA-Z0-9]*")
list = re.split(compiled_rgx, string.lower())
histogram = {}
for word in list:
if word in histogram:
histogram[word] += 1
el... | true |
bdde447852c575313d164f408f37f21d551afa0a | Python | seagullQ77/nfd-autotest | /codewars/high.py | UTF-8 | 462 | 3.1875 | 3 | [] | no_license | #Highest Scoring Word
def high(x):
listx= x.split()
sumhigh = 0
for i in listx:
sum=0
for j in i:
sum += ord(j.lower())-96
if sum>sumhigh:
sumhigh = sum
highstr = i
return highstr
highstr=high('take me to semynak')
print(highstr)
#, 'taxi'... | true |
ba5dbc3edf68473e453cadc5d30f54a50cb0f1fb | Python | angvp/ursine | /ursine/parsing.py | UTF-8 | 4,185 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | '''Regex based parsing for sip uris.'''
import re
import multidict
# optionally extract either a quoted or unquoted
# contact name and extract the rest discarding the <>
# brackets if present
contact_re = re.compile(r'("(?P<quoted>[^"]+)" '
r'|(?P<unquoted>[^\<"]+) )?'
... | true |
afeefd3cc6f8598379f13e29ba5bf1ae91ad26e4 | Python | israkir/sentiment-analyzer | /src/sentiment_analyzer.py | UTF-8 | 6,774 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------------------------------------------------
#
# Program Name : sentiment_analyzer.py
# Authors : W.B.Lee, H.C.Lee, Y.K.Wang, T.T.Mutlugun, H.C.Kirmizi
# Date ... | true |
71f58ae469b897c3a90eafed0b81933588e7e148 | Python | jercamadalina/python-codewars-exercises | /8kyu/hello-name-or-world.py | UTF-8 | 976 | 4.40625 | 4 | [] | no_license | def hello(name=""):
return "Hello, World!" if name == "" else "Hello, {}!".format(name.capitalize())
tests = (
("John", "Hello, John!"),
("aLIce", "Hello, Alice!"),
("", "Hello, World!"),
)
for inp, exp in tests:
print(hello(inp), exp)
print(hello(), "Hello, World!")
'''
# Details
Define a... | true |
b7d1482e6c6e0bd0c7f2103e0e94a6a11bd3f5b0 | Python | miskamvedebel/miskamvedebel | /HSE/lines_other.py | UTF-8 | 758 | 3.296875 | 3 | [] | no_license | def lines(a):
deleted = 0
counter = 1
i = 0
while i < len(a)-2:
j = i + 1
while j <= len(a)-1 and a[i] == a[j] :
j += 1
counter += 1
if counter >= 3:
indexes = list(range(i,j))
a[:] = [a[k] for k in range(len(a)) if k not in in... | true |
b2461333398e3a11683aaa13544765337a35ca6a | Python | raajeshlr/Python-Stuffs | /additional basic programs/power of 2.py | UTF-8 | 192 | 3.546875 | 4 | [] | no_license | nterms = int(input("enter the count"))
result = list(filter(lambda x : 2**x , range(nterms+1)))
for i in range(0,nterms+1):
print("2 raised to the power {} is {}".format(i,result[i]))
| true |
e2298e97cadd334c00a3d2dc076e7fbaab49c9a8 | Python | sangeethapl/count | /search.py | UTF-8 | 215 | 2.84375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import re
count=0
url=input()
search=input()
r=requests.get(url)
bs=BeautifulSoup(r.text,'html.parser')
b=bs.get_text()
l=b.lower()
s=re.findall(search,l)
print(len(s))
| true |
6e566876e9120b56a7c3bee79ab21f2d35c24859 | Python | ylliu/send-converted-contents-to-cloud-note | /test/unittest/test_content_extractor.py | UTF-8 | 676 | 2.9375 | 3 | [] | no_license | import unittest
from app.ContentExtractor import ContentExtractor
class ContentExtractorTest(unittest.TestCase):
def test_should_extract_content_from_xunfei_converted_result(self):
content_expected = "大家好,我是某某某,今天由我跟大家"
json_convert_result = '[{\"bg\":\"610\",\"ed\":\"7580\",\"onebest\":\"大家好,\",... | true |
6a43d1a29bdd07af278883e40f2f692218fcb11f | Python | python-ops-org/python-ops | /aws/compute/lambda+/ec2/v.0.1/instance-debug-2.py | UTF-8 | 1,756 | 2.8125 | 3 | [] | no_license | #python in-2.py -a lambda_start -r us-east-1 -s started
import boto3
import argparse
def ec2_control():
parser = argparse.ArgumentParser()
#parser.add_argument("file", type=str, help="File name of JSON file")
parser.add_argument("-a", dest="command", required=False, type=str, help="Command")
parser.a... | true |
e11c4c465f32623af14df1a918d0ac25d4b53209 | Python | kangli-bionic/algorithm | /lintcode/832.1.py | UTF-8 | 682 | 3.0625 | 3 | [
"MIT"
] | permissive | """
832. Count Negative Number
https://www.lintcode.com/problem/count-negative-number/description?_from=ladder&&fromId=152
o(n+m)
https://www.jiuzhang.com/solution/count-negative-number/#tag-other
"""
class Solution:
"""
@param nums: the sorted matrix
@return: the number of Negative Number
"""
def c... | true |
efa5beb4a245ec4d5fa58a2a2dbd19d4ddb18364 | Python | IncompleteInformation/Live_Dubstep | /ZZZ-Deprecated/Pre-Mac/AccelGrapher/writetime.py | UTF-8 | 101 | 2.921875 | 3 | [] | no_license | import time
w=open("file.txt",'w')
for i in range(1000):
w.write(str(time.clock())+'\n')
w.close() | true |
1b378b2b6d42eaf5297fb15ab4a871184ddaac67 | Python | Rachneet/PySpark | /kmeans.py | UTF-8 | 886 | 2.640625 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.ml.clustering import KMeans
from pyspark.ml.feature import VectorAssembler, StandardScaler
from pyspark.ml.evaluation import BinaryClassificationEvaluator, MulticlassClassificationEvaluator
spark = SparkSession.builder.appName("clustering").getOrCreate()
df = spark.re... | true |
851fcf8676e4f38e88d568480b485158208273ca | Python | mlforcada/Appraise | /eval/similar_words.py | UTF-8 | 1,413 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | __author__ = 'Sereni'
import networkx
import itertools
from operator import itemgetter
def similarity(word1, word2, gr, pos_tags):
pos = ''
for tag in pos_tags:
if tag in word1[1][1]:
pos = tag
break
if pos in word2[1][1]:
tags1 = set(word1[1][1])
tags2 = s... | true |
8feb13810e8bb7a84a16c42559a222e2c977479e | Python | reddymadhira111/Python | /programs/filter.py | UTF-8 | 293 | 4.15625 | 4 | [] | no_license | '''
The function filter(function, list) offers a convenient way
to filter out all the elements of an iterable, for which the function returns True.
'''
def even(n):
if n %2 == 0:
return True
x=filter(even, range(10))
print(list(x))
x=filter(lambda n:n%2==0, range(10,20))
print(list(x)) | true |
cb579ae5e2430886afab295c12610d3761591059 | Python | tiagniuk/daily_expenses | /models/Locations.py | UTF-8 | 959 | 2.734375 | 3 | [] | no_license | from sqlalchemy import Column, Integer, String, Text, DateTime, \
UniqueConstraint, func
from models import Base
class Locations(Base):
__singular__ = 'location'
id = Column(Integer, primary_key=True)
city = Column(String(100), nullable=False)
country = Column(String(100), nullable=False)
not... | true |
f19313dbb048684d9dc117347ad2e0735dcad4e9 | Python | Chacon-Miguel/Project-Euler-Solutions | /Multiples_Of_3_And_5.py | UTF-8 | 152 | 3.890625 | 4 | [] | no_license | count = 0
for x in range(3, 1000):
# If its divisible by three or 5, add it to count
if not x%3 or not x%5:
count += x
print(count) | true |
24b20bf25eaf4a9eca400b8302f0d123f1966254 | Python | msproteomicstools/msproteomicstools | /analysis/data_conversion/pseudoreverseDB.py | UTF-8 | 3,719 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================================
msproteomicstools -- Mass Spectrometry Proteomics Tools
=========================================================================
Copyright (c) 2013, ETH Zurich
For a full list of authors, r... | true |
e1f8259e5f9cd52561750c1bd4e81fd565208e80 | Python | AlexPav217/BubbleSort | /tests.py | UTF-8 | 1,914 | 3.375 | 3 | [] | no_license | import unittest
from main import bubbleSort
class TestStringMethods(unittest.TestCase):
def test_empty(self):
self.assertEqual(bubbleSort([]), [])
def test_one_element_array(self):
self.assertEqual(bubbleSort(["1"]), ["1"])
def test_simple_strings(self):
self.assertEq... | true |
e3163d1e5e30d828072849aa1dcfec57fed8476b | Python | alisw/AliPhysics | /PWGJE/EMCALJetTasks/Tracks/analysis/base/Graphics.py | UTF-8 | 22,061 | 2.625 | 3 | [] | permissive | #**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | true |
cc2f4f4a68e90c1953071b0494e6f01cf79c9d2e | Python | AllaZhulyanova/Autotests_for_ADUKAR | /Fixture/List_items_before_autorization.py | UTF-8 | 9,601 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive |
class BeforeAutorizationHelper:
def __init__(self,app):
self.app = app
# выбор предмета по порядку, возвращает кол-во уроков/тестов
def Test_list_of_all_items(self, TEXT):
driver = self.app.driver
Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов... | true |
f7170aa5c149ebc6edb88e9058bffeb4102ea876 | Python | entbappy/My-python-projects | /Ex7 Healty programmer50.py | UTF-8 | 1,582 | 3.4375 | 3 | [] | no_license | #Healthy programmer
# 9am - 5pm
# Water = water.mp3 (3.5 liters)every 40min - Drank - log
# Eyes = eyes.mp3 (Every 30 min) - EyesDone - log
# Pysical Activity = pysical.mp3 (every 45 min)- ExDone - log
#
# Rules - pygame module to play audio
from pygame import mixer
from datetime import datetime
from time import time
... | true |
648b3bbb0f553cb74d2289663a2cb2306a0e7c14 | Python | murning/EEE4022S_Final_Year_Project | /localisation_software/simulation.py | UTF-8 | 12,161 | 2.640625 | 3 | [] | no_license | import numpy as np
import data_generator_lib
import pandas as pd
import librosa
import data_cnn_format as cnn
import gccphat
import constants
import rotate
import final_models
import utility_methods
from plotting import plotting
class Simulation:
"""
Class for running a single simulation of doa estimation bas... | true |
a8545612e79a2e6d7e82e963b2634727828f9ba6 | Python | Meziel/TradingHarvester | /mbt/recovery_agent.py | UTF-8 | 1,596 | 3.03125 | 3 | [] | no_license | import requests
import datetime
import pymongo
class RecoveryAgent:
def __init__(self, database_info):
self.database_info = database_info
self.mongo_connection = None
self.database = None
self.collection = None
async def recover(self, last_close, current_close):
self... | true |
45a278347752b22ad8dc91e7a78437a4a322c245 | Python | AmenehForouz/leetcode-1 | /python/problem-1389.py | UTF-8 | 862 | 4.375 | 4 | [] | no_license | """
Problem 1389 - Create Target Array in the Given Order
Given two arrays of integers nums and index. Your task is to create target
array under the following rules:
Initially target array is empty.
- From left to right read nums[i] and index[i], insert at index index[i] the
value nums[i] in target array.
- Repea... | true |
8d747c51cbf72fa1e35d373f553797f3ab112370 | Python | AhnDogeon/algorithm_study | /날짜별 문제/0222/사다리.py | UTF-8 | 568 | 2.859375 | 3 | [] | no_license | import sys
sys.stdin = open("input.txt", "r")
for t in range(1, 11):
x = input()
num = []
for i in range(100):
num.append([0]+list(map(int, input().split()))+[0])
last = num[99].index(2)
idx = [99, last]
x = idx[0]
y = idx[1]
while 0 < x <= 100 and 0 < y <= 100:
if num[x][y - ... | true |
a589586ebb686cd4f7bb558eb560b0f61f185056 | Python | mit-ll/spacegym-kspdg | /scripts/example_agent_runner.py | UTF-8 | 1,534 | 2.515625 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2023, MASSACHUSETTS INSTITUTE OF TECHNOLOGY
# Subject to FAR 52.227-11 – Patent Rights – Ownership by the Contractor (May 2014).
# SPDX-License-Identifier: MIT
"""
This example shows how to define agents so that they can be systematically run
in a specific environment (important for agent evaluation pu... | true |
f56cbe8fe7c05d7d33abadc609c85379c51a9857 | Python | Camebax/Sonoluminescence | /venv/Functions.py | UTF-8 | 7,899 | 3.125 | 3 | [] | no_license | import math
import random
import time
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits import mplot3d
# Функция для цветного вывода всего кубика
def show_cube_3d(array):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
z, y, x = array.nonzero()
cube = ax.scatter(x, y,... | true |
2d40c2b72e90f90b85bddde809e6e5ed28c578a0 | Python | abhinandanbaheti/python-tricks | /Algos/trees/trees.py | UTF-8 | 1,178 | 4.15625 | 4 | [] | no_license | # bfs traversal
class Tree(object):
def bfs(self, graph, start):
visited = list()
queue = list()
visited.append(start)
queue.append(start)
while queue:
val = queue.pop(0)
print(val)
for neighbour in graph[val]:
if neigh... | true |
67d83abdc9254ad37b04ff4f73658cab2d73a8da | Python | Easy-Shu/shapenet-reconstruction-jittor | /losses.py | UTF-8 | 613 | 2.828125 | 3 | [] | no_license | def iou(predict, target, eps=1e-6):
dims = tuple(range(len(predict.shape))[1:])
intersect = (predict * target).sum(dims)
union = (predict + target - predict * target).sum(dims) + eps
return (intersect / union).sum() / intersect.numel()
def iou_loss(predict, target):
return 1 - iou(predict, target)
... | true |
42dedc7fe7adc492ddaa8dc131b42b2c42910f0c | Python | nikiluk/signalife-moo-spine-analysis | /iofunctions.py | UTF-8 | 2,087 | 2.796875 | 3 | [] | no_license | #
# functions to process file loading and data manipulation
import datetime
import os
import numpy as np
import pandas as pd
def list_files(path,ext):
# returns a list of names (with extension, without full path) of all files
# in folder path ext could be '.txt'
#
files = []
for name in os.listd... | true |
f76416d327b09df4a4261ef20d5a2e5016631fb1 | Python | EeshaanJain/ML-Algorithms | /Concept Learning/CandidateElimination.py | UTF-8 | 4,002 | 3.65625 | 4 | [] | no_license | """
The CE algorithm incrementally builds the version space given hypothesis space H and set E of examples.
This is an extended form of the Find-S algorithm. We add the examples one by one and shrink the version space
by removing the inconsistent hypotheses.
Algorithm :
For each training sample d = <x, c(x)> :
1. ... | true |
b41142c080358cdb07dd0784314a67dd2288c019 | Python | lastbyte/dsa-python | /problems/easy/valid_parentheses.py | UTF-8 | 1,535 | 4.375 | 4 | [] | no_license | ```
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Example 1:
Input: s = "()"
Output: true
Example 2:... | true |
d22fbbaef716174bdddec58b84b8b187707d6e48 | Python | edudawla/scraping | /test scrap.py | UTF-8 | 1,322 | 3.3125 | 3 | [] | no_license | ###...Metodo 1
###...Separei uma classe dentro da Div.
###...Separei a tag <a> e transformei em String
###...Quebrei a lista por ',' usando a biblioteca RE
###...Falta terminar e fazer o CRUD
import requests
from bs4 import BeautifulSoup
import re
url = 'https://www.sjc.sp.gov.br/servicos/mobilidade-urbana/novos-horari... | true |
24a327e4918d39cb4dbc8ed47971052014c3317b | Python | Jackuna/PythonXample | /aws_bs_inst_health_v0.py | UTF-8 | 3,655 | 2.921875 | 3 | [] | no_license | # ---------------------------------------------------------------------------------------------------------------------------- #
# aws_bs_inst_health_v0.py : AWS Beanstalk Health Status, An xample for the implemenantion of python's boto3 library with
# other python packages.
# Script will show the overall health of b... | true |
c3fc019183b5b1a9dd025405cc1455b34793bdf9 | Python | euzivamjunior/pythonbirds | /oo/carro_solucao_instrutor.py | UTF-8 | 3,261 | 3.390625 | 3 | [
"MIT"
] | permissive | # Os comandos escritos abaixos são utilizados para 'doctests', uma forma de testar o código a partir da interação a ser
# realizada no console, para utilizá-lo. basta clicar com o botão direito sobre o doctest e então na opção:
# Run 'Doctests in <this_name_file>'
"""
#Testando motor
>>> motor = Motor()
>>> motor... | true |