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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b534914224d0f7ac16d99d74a4404bc0a92cf76f | Python | pombredanne/Rusthon | /regtests/lang/raise.py | UTF-8 | 332 | 3.0625 | 3 | [
"BSD-3-Clause"
] | permissive | from runtime import *
'''
raise and catch error
'''
def main():
a = False
try:
raise TypeError
except TypeError:
a = True
assert( a==True )
b = False
try:
b = True
except:
b = False
assert( b==True )
c = False
try:
raise AttributeError('name')
except AttributeError:
c = True
assert( c==Tru... | true |
b6958c8aa6866c8393cb77dc9826aa22ed091041 | Python | Shubha737/100-days-code-challenge | /day_11_reversing_list.py | UTF-8 | 316 | 4.125 | 4 | [] | no_license | # Day 11 code 1
# Reversing a List in Python
total_element = int(input("Enter the total number of elements :"))
list = []
rev_list = []
for num in range(total_element):
elements = (input("Enter the element value:"))
list.append(elements)
print(list)
list.reverse()
print(list)
| true |
fdb661cec088c7129fa6f4c92084ff56c0d93f09 | Python | Neltab/PolyHash | /utils/output/output.py | UTF-8 | 1,144 | 2.953125 | 3 | [] | no_license | def CreateFile(bras: list, nomFichier: str):
""" Création du fichier de sortie en fonction des paramètres fournis dans la liste de bras
:param bras: Liste des bras créés par le programme
"""
with open("./output_files/" + nomFichier + ".out", "w") as fichier:
# On écrit le nombre de bras à ... | true |
190bb3896b5fac5622156faec1cb8391b1dcd227 | Python | juanmunoz00/python_classes | /list_example1.py | UTF-8 | 1,545 | 4.375 | 4 | [] | no_license | import random
##Definimos la lista
milista = ["Ford", "Toyota", "Nissan", "Dodge", "Masserati"]
##Imprimimos la lista
print(milista)
print("****************************************")
##Agregamos un elemento a la lista
milista.append("Porshe")
##Imprimimos la lista
print(milista)
print("*********************... | true |
c70a58520bcebf2a201d36144b7acf5fadbad822 | Python | caohaitao/PythonTest | /opengl/test1.py | UTF-8 | 1,818 | 2.953125 | 3 | [] | no_license | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from threading import Timer
import time
from stl_reader import read_one_file
triangles = []
def drawFunc():
global triangles
# 清楚之前画面
glClearColor(0.0, 0.0, 0.0, 0.0)
glClear(GL_COLOR_BUFFER_BIT)
# glRotatef(0... | true |
a2bd10a14af79d62ae433378b297eac75b1dca95 | Python | NondairyDig/GenDocks | /netnet.py | UTF-8 | 487 | 2.6875 | 3 | [] | no_license | import socket
import time
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
i = 1
while True:
data = s.recv(1024)
if data == b"":
break
print("Received:", repr(data))
... | true |
86671edbf579d1659f8313b1b6c3342312d9df33 | Python | AAVoid/TowerDefenseEvolution | /main.py | UTF-8 | 1,029 | 2.65625 | 3 | [] | no_license | #-*- coding:utf-8 -*-
from system import *
from personnage import *
from carte import *
from animation import *
from menuPrincipal import *
pygame.init()
systeme = Systeme()
systeme.chargerStatistiquesTxt()
system.actualiserExperienceNiveauSuivant(systeme)
system.actualiserPrixInvocation(systeme)
systeme.chargerSa... | true |
b3d00c9e01f5d750f94d9b84e18527ee66c6abbd | Python | shanemat/CIS-530-MP-01 | /mp2-3.py | UTF-8 | 1,601 | 3.40625 | 3 | [] | no_license | import sys
import aig
import queue as q
from aig import SearchNode
def construct_solution(final_search_node):
"""
Constructs string containing solution in proper format from final search node
:param final_search_node: Result of search
:return: String containing solution
"""
result = ""
... | true |
5f3c150e603efb0fbd6fea199abc8df4cc276487 | Python | rojter-tech/Codility | /Python/Lesson05/Lesson[5-3]Five.py | UTF-8 | 516 | 3.296875 | 3 | [] | no_license | #Author: Daniel Reuter
#Github: https://github.com/rojter-tech
def solution(A):
n = len(A)
minavg = 10**5 + 1
minpos = 0
for i in range(n-1):
thisavg = (A[i] + A[i+1])/2
if thisavg < minavg:
minavg = thisavg
minpos = i
if i < n - 2:
... | true |
d2011ff54591c46dd70d476e77e43e1612f5f6bf | Python | YulanJS/Advanced_Programming_With_Python | /lecture9.py | UTF-8 | 4,943 | 4 | 4 | [] | no_license | # ----------------------------------------------------------------------
# Name: lecture9
# Purpose: Demonstrate the use of classes
#
# Author: Rula Khayrallah
# ----------------------------------------------------------------------
"""
Module containing some class definitions to be used in lecture 9.
... | true |
bc1c2dfcd62df7d8a482c6ce471703697baa9525 | Python | LeiLikun/WebsiteBlocker | /blockWebsite.py | UTF-8 | 810 | 2.53125 | 3 | [] | no_license | import os
import re
import urllib2
def block(website):
f = os.popen('ipconfig /displaydns')
lines = filter(lambda x:x.count(website)>0,f.readlines())
lines = list(set(map(parse, lines)))
lines = map(lambda x:' 127.0.0.1 ' + x + '\n',lines)
with open('C:\Windows\System32\drivers\etc\hosts','... | true |
3f29ab1d4cab8bb7201e36c22e0f90caf1cb74f8 | Python | nickthequik/thesis | /experiment.py | UTF-8 | 1,647 | 3.015625 | 3 | [] | no_license |
import sys
import time
from file_utils import get_exp_cfg, make_data_dir
from env_utils import init_env
from plot_utils import plot_episodes_data, plot_loss_data
from agents import init_agent
from training import train_agent
from ep_utils import store_episodes_data, store_episodes_stats, get_episodes_stats
d... | true |
8f46efb740898fc7002f07b5bbfae01d2f6b65f5 | Python | duckheada/neural_package | /nn/noise.py | UTF-8 | 1,755 | 2.65625 | 3 | [] | no_license | import numpy as np
import theano, theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.ifelse import ifelse
from .module import Module
class Dropout(Module):
def __init__(self, drop_prob, **kwargs):
super(Dropout, self).__init__(**kwargs)
assert drop... | true |
6a910c760c0af5ebf209b190482fa5ad84f13da7 | Python | magnusoy/Python-Grunnleggende | /Kapittel-11/oppgaver_1.py | UTF-8 | 1,641 | 3.890625 | 4 | [] | no_license | """
Oppgave 1
Skriv en lambda som aksepterer et tall og høyer det opp i 3
lambda kan hete cube
"""
"""
Oppgave 2
Lag en funksjon decrement_list som tar inn en liste med tall som parameter.
Den skal returnere en kopi av listen hvor alle verdiene er i dekrementert med 1.
Eks:
decrement_list([1, 2, 3]) -> [0, 1, 2]
d... | true |
eedd99fca629b36521c615ed196d1fddd2830a53 | Python | andiegoode12/Artificial-Intelligence | /Knapsack Problem/KnapsackDFS.py | UTF-8 | 2,406 | 3.84375 | 4 | [] | no_license | """
Andie Goode
Knapsack DFS
"""
import math
import itertools
from collections import deque
def DFS(items, weight, values, capacity):
#starting stack is empty
stack = deque(['_'])
#list of visited
visited = []
#popped elements
popped = [0]
W = 0
V = 0
w = 0
v = 0
solution = ... | true |
5aba2ea5b9045c316324f3c6c990346edef8b709 | Python | mwendar/test | /grade_calculator.py | UTF-8 | 1,361 | 3.75 | 4 | [] | no_license | def grade(scores):
average = sum(scores) /3
if average >= 90:
return 'A'
elif average >= 80:
return 'B'
elif average >= 70:
return 'C'
elif average >= 60:
return 'D'
else:
return 'E'
def getHighest(data):
highest = 0
for i in range(len(data)):
... | true |
0feb02214575f5f36d2d992862ed186f32be3b9d | Python | collinkatz/BotLate | /translate_test.py | UTF-8 | 1,708 | 2.78125 | 3 | [] | no_license | from Translator import Translator
from Conversation import Conversation
from Content import Content
from google.cloud import dialogflow
if __name__ == '__main__':
trans = Translator()
convo = Conversation(trans, "English")
while not convo.is_done():
prompt, hint = convo.ask()
print(prompt)... | true |
c04284cedf590c1fe8d9eaf84a9f4949b86183fc | Python | sirikata/sirikata | /scripts/img/imgdiff.py | UTF-8 | 1,110 | 3.0625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# imgdiff.py - Computes error values for a pair of images or a set of
# images against a reference image.
import Image
import sys
def filter_name(orig):
filtered = ''
for x in orig:
if x.isdigit():
filtered = filtered + x
return filtered
args = sys.argv
opt_filter... | true |
1281d4e79dd37b15388d6d14add62be69258d947 | Python | ooni/pm-tools | /cycle_planner.py | UTF-8 | 5,688 | 2.5625 | 3 | [] | no_license | import os
import csv
import argparse
import json
from pprint import pprint
from github import Github
from constants import OONI_TEAMS_BY_NAME, EFFORT_MAP
g = Github(os.environ["GITHUB_TOKEN"])
total_effort = 0
efforts_by_person = {}
class IssueError(Exception):
def __init__(self, issue_title, issue_url):
... | true |
f052ba513894d21705a5000eb2a4d42fa1269a73 | Python | b73201020/codeingInterview | /Roman_to_Integer.py | UTF-8 | 1,350 | 3.34375 | 3 | [] | no_license | class Solution:
# @return an integer
def romanToInt(self, s):
if (s == None):
return None
counter = 0
currentNum = 0
lastNum = 0
charNum = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
for i in range(len(s)):
index ... | true |
a8fb538b4021f552a67fb0a91698a76a14e6eb73 | Python | clefever/aoc2019 | /day02.py | UTF-8 | 1,275 | 3.21875 | 3 | [
"MIT"
] | permissive | import adventofcode
def run_program(codes, noun = None, verb = None):
"""
>>> run_program([1, 0, 0, 0, 99])
[2, 0, 0, 0, 99]
>>> run_program([2, 3, 0, 3, 99])
[2, 3, 0, 6, 99]
>>> run_program([2, 4, 4, 5, 99, 0])
[2, 4, 4, 5, 99, 9801]
>>> run_program([1, 1, 1, 4, 99, 5, 6, 0, 99])
... | true |
029b3e47b3d917b5949b2892612f5c820b128d2b | Python | theromis/mlpiper | /mlcomp/parallelm/components/restful/uwsgi_cheaper_subsystem.py | UTF-8 | 1,575 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | """
For internal use only. The uwsgi cheaper sub system provides the ability to dynamically
scale the number of running workers via pluggable algorithms
Reference: https://uwsgi-docs.readthedocs.io/en/latest/Cheaper.html
"""
import math
import multiprocessing
class UwsgiCheaperSubSystem:
CPU_COUNT = multiprocess... | true |
26e9be8e25b5f562b0193bcb8fb60ff677c13e1a | Python | owen94/CVI_RL | /REINFORCE.py | UTF-8 | 7,942 | 2.78125 | 3 | [] | no_license | '''
In this file, we will implement the REINFORCE algorithm: Monte-Carlo Policy Gradient with
OpenAI gym and tesnforflow.
'''
import gym
import itertools
import matplotlib
import numpy as np
import sys, random
import tensorflow as tf
import collections
import matplotlib.pyplot as plt
env = gym.make('CartPole-v0')
obs... | true |
72307946f67825c3545d9baf81c96fe3879bc7fb | Python | ht5678/yzh-learn | /demo_pythond_jango/templatedemo/views.py | UTF-8 | 6,548 | 2.65625 | 3 | [] | no_license | from django.shortcuts import render,redirect
from django.template import loader,RequestContext
from django.http import HttpResponse
from templatedemo.models import BookInfo
# Create your views here.
def my_render(request,template_path,context={}):
#1.加载模板文件,获取一个模板对象
temp = loader.get_template(template_path)... | true |
f8cfed74b1d60dcff5d80f2b76dc8a0daeaef540 | Python | kmjawadurrahman/bengali-to-english-translator | /translator/datasets.py | UTF-8 | 1,823 | 2.765625 | 3 | [] | no_license | import io
import os
import utils
class SUParaDataset():
def __init__(self, path_to_eng_file, path_to_beng_file, num_data_to_load):
self.path_to_eng_file = path_to_eng_file
self.path_to_beng_file = path_to_beng_file
self.num_data_to_load = num_data_to_load
def read_data(self):
... | true |
3a0616005153e303b04d561467f46ff0f3e113a6 | Python | flaminghakama/part-format | /layoutFormats.py | UTF-8 | 6,079 | 2.53125 | 3 | [
"MIT"
] | permissive | # layoutFormats.py
# Define the valid page formats
validPageFormats = {
'1': 'half',
'1L': 'half',
'1R': 'half',
'2': 'half',
'2L': 'half',
'2R': 'half',
'2X': 'full',
'3': 'half',
'3X': 'half',
'3XL': 'half',
'3XR': 'half',
'4': 'full',
'4X': 'full',
'5': 'half',
'5L': 'half',
'5R': 'half... | true |
bd2e01419b8df99070a8b70c873d301159ba35a5 | Python | Inderway/MyProjects | /shells/prepare_data.py | UTF-8 | 2,021 | 3 | 3 | [] | no_license | # prepare the data: turn the raw data into json format
# created by wei
# April 13, 2023
import json
import os
from tqdm import tqdm
data=[]
def hasData(li):
if 'source.txt' in li:
return True
else:
return False
def visit(path):
folder=os.listdir(path)
if hasData(folder):
wit... | true |
5ce68498eaa46422a6909a2f0e42e26fee448f7f | Python | Omkar02/geture_recon | /main_app.py | UTF-8 | 785 | 2.984375 | 3 | [] | no_license | import streamlit as st
import real_time_capture
import user_cust_pannel
class MultiApp:
def __init__(self):
self.apps = []
def add_app(self, title, func):
self.apps.append({
"title": title,
"function": func
})
def run(self):
app = st.selectbox(
... | true |
4833f3c665f32f6711477b1aa794f20f65ed064a | Python | snehilk1312/Python-Progress | /python_revision/datetime_module/datetime_1.py | UTF-8 | 454 | 3.25 | 3 | [] | no_license | import datetime
import pytz
dt_utcnow = datetime.datetime.now(tz=pytz.UTC) # could use 'dt_utcnow=datetime.datetime.utcnow()' too
print(dt_utcnow)
'''
for tz in pytz.all_timezones:
print(tz)
'''
dt_indnow = datetime.datetime.now(pytz.timezone('Asia/Kolkata'))
print(dt_indnow)
print(dt_indnow.isoformat())
p... | true |
91c16cb598568131195c728b375d8a01e9565a98 | Python | suchennuo/book-example | /openwx/config.py | UTF-8 | 2,274 | 3.484375 | 3 | [] | no_license | from importlib.util import module_from_spec
"""
getattr(obj, "attribute)
Get a named attribute from an object. AttributeError
eg:
class A(object):
bar=1
a = A()
getattr(a, 'bar')
http://www.cnblogs.com/pylemon/archive/2011/06/09/2076862.html
compile(source, filename, model[, flags[, dont_inherit]])
source -- 字... | true |
6fb63dbededa86772d09fc9371821dcb9eefa63f | Python | Bshel419/Spatial-DS-Shelton | /Assignments/Assignments/Program_5/Query2.py | UTF-8 | 3,975 | 2.5625 | 3 | [] | no_license | from mongo_helper import *
from map_helper import *
import pprint as pp
import sys
import pygame
DIRPATH = os.path.dirname(os.path.realpath(__file__))
#display stuff
background_colour = (255,255,255)
black = (0,0,0)
(width, height) = (1024,512)
color_list = {'volcanos':(255,0,0),'earthquakes':(0,0,255),'meteorites':... | true |
f7ed7a59dc36e2226c3754a83e69d6a6b1c53e7d | Python | reverbdotcom/datarobot-2.25.1 | /datarobot/models/shap_matrix_job.py | UTF-8 | 1,879 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from .job import Job
from .shap_matrix import ShapMatrix
class ShapMatrixJob(Job):
def __init__(self, data, model_id, dataset_id, **kwargs):
super(Job, self).__init__(data, **kwargs)
self._model_id = model_id
self._dataset_id = dataset_id
@classmethod
def get(cls, project_id, job_... | true |
b6a755319ce3a71e8bda8d0dd2a0233533bd8f1e | Python | willsheffler/pymol | /misc/xyzGeom.py | UTF-8 | 41,505 | 2.984375 | 3 | [] | no_license | """
Easy 3D Linear Algebra, like xyz\* in rosetta
"""
from random import gauss, uniform
from math import pi, sqrt, sin, cos, acos, asin, atan2, degrees, radians, copysign
from itertools import chain, product, izip
import operator as op
import re
EPS = 0.000000001
SQRTEPS = sqrt(EPS)
def isint(x):
return type(x) is... | true |
d35d5f545241c764fb91a2eed31938812edd33a5 | Python | proevgenii/EPAM-HW-2020- | /hw2/hw4.py | UTF-8 | 744 | 3.765625 | 4 | [] | no_license | """
Write a function that accepts another function as an argument. Then it
should return such a function, so the every call to initial one
should be cached.
def func(a, b):
return (a ** b) ** 2
cache_func = cache(func)
some = 100, 200
val_1 = cache_func(*some)
val_2 = cache_func(*some)
assert val_1 is val_2
... | true |
e6064ea9a48f667e99cde440be58b0b0abbad154 | Python | hafsaabbas/-saudidevorg | /52 day.py | UTF-8 | 274 | 3.296875 | 3 | [] | no_license | import datetime
x=datetime.datetime.now()
print(x)
import datetime
x=datetime.datetime.now()
print(x.year)
print(x.strftime("%A"))
import datetime
x=datetime.datetime(2202,5,17)
print(x)
import datetime
x=datetime.datetime(2018,6,1)
print(x.strftime("%B"))
| true |
605206875d9afea1f54adfcf6118946254de0c93 | Python | mmurch/advent2020 | /main.py | UTF-8 | 441 | 3.359375 | 3 | [] | no_license | def star_one():
print(f'star one answer: { "shrug" }')
def star_two():
print(f'star two answer: { "shrug" }')
def get_input_as_strings():
with open('input.txt', 'r') as fd:
return fd.read().splitlines()
def get_input_as_ints():
with open('input.txt', 'r') as fd:
lines = fd.read().s... | true |
b24ebb11682eed0e8d4a6c5cac1163b01ffd8932 | Python | chelsyx/photoPreprocess | /crop_resize_sketch.py | UTF-8 | 3,064 | 2.890625 | 3 | [] | no_license | import sys
import cv2
import numpy as np
import os
"""
Using OpenCV Python interface, cv2, this script execute the following task:
1, Detect face in a photo
2, Crop the photo into a square with the face in the center
3, Resize the image
4, Create a sketch from the photo
Usage:
python crop_resize_sketch.py xdim ydim p... | true |
63c2ce47b4fff9a03418c2ab0e676c7ec22c8120 | Python | Fredpwol/AdventofCode2020 | /DAY3/PART2/day3part2.py | UTF-8 | 519 | 3.421875 | 3 | [] | no_license | data = open("input.txt", "r")
path = data.readlines()
cleaned_path = [ ln.strip() for ln in path ]
max_window = len(cleaned_path[0])
def find_path_tree(right, down):
x = 0
y = 0
tree_count = 0
while y < len(cleaned_path):
if cleaned_path[y][x % max_window] == "#":
tree_count += 1
... | true |
c73405f127eda2c9d4ce492c2a4184c4a7242d1a | Python | sergogoose/ivt105 | /Гускин ЛР-1.py | UTF-8 | 1,624 | 4.125 | 4 | [] | no_license | @author: sergey
"""
Name = input("Как вас зовут?")
print("Привет, {}".format(Name))
#2 Задание
print('''Ага!
Я могу управлять этим компьютером!
Вот только зачем? :'C
Пойду поищу смысл жизни "__"''')
#3 Задание
print("Задайте последовательно 3 числа: ")
a = int(input("Первое число: "))
... | true |
107f45ec08b2b81a5167b8cf46aa544b9bcaf6e9 | Python | galipkaya/exercism-python | /tournament/tournament.py | UTF-8 | 2,096 | 3.140625 | 3 | [] | no_license | import functools
class Info:
def __init__(self, name, match_played, win, draw, loss, point):
self.name = name
self.match_played = match_played
self.win = win
self.draw = draw
self.loss = loss
self.point = point
def compare(item1, item2):
if item1.point < item2... | true |
5933116f96bbd3e286c4b32bd0a8e4061db1afc2 | Python | dkeProjekt/LoginSignupSettingsService | /signupService/signup_server.py | UTF-8 | 1,521 | 2.53125 | 3 | [] | no_license | #!flask/bin/python
from flask import Flask, jsonify, request, abort
from flask_cors import CORS
from pymongo import MongoClient
from datetime import date
import json
today = date.today()
app = Flask(__name__)
CORS(app, support_credentials=True)
@app.route('/signup', methods=['POST'])
def signup():
if not reques... | true |
00c5151a20ffe28c00fd374a776b23d551ea0cc5 | Python | yusufa84/PythonBaseCamp | /Assignments/IteratorsGeneratorsHomeAssignment.py | UTF-8 | 422 | 4.1875 | 4 | [] | no_license | # Problem 1
def gensquares(n):
for num in range(n):
yield num**2
for x in gensquares(10):
print(x)
# Problem 2
import random
def rand_num(low,high,n):
for num in range(n):
yield random.randint(low,high)
for num in rand_num(1,10,5):
print(num)
# Problem 3
s = 'hello'
s_iter = iter(s... | true |
1309186340621f4ccbbc2ee5155e02f36c51d9d9 | Python | soumilmishra/Tkinter | /sample2.py | UTF-8 | 595 | 2.8125 | 3 | [] | no_license | import tkinter
from tkinter import *
app = Tk()
app.title("Welcome")
#image2 =Image.open('sad1.png')
image1 = PhotoImage(file="gradecap1.png")
w = image1.width()
h = image1.height()
app.geometry('%dx%d+0+0' % (w,h))
#app.geometry("800x600")
#app.configure(background='C:\\Usfront.png')
#app.configure(background = image... | true |
65691836cc71b27e5f2f56028ba1a9bca26c60d1 | Python | shanbady/sent-suggest | /sent-suggest.py | UTF-8 | 3,752 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
"""
sent-suggest.py:
Generates an alernative sentence by looking up synonyms for particlar words based on their part of speech.
This was inspired by an email I received which I have used as the initial example text.
"""
__author__ = "Shankar Ambady"
__copyright__ = "Copyright 2012, s... | true |
a6a1d4257a1dabf6ff6f3ce3f57deb43674285b7 | Python | jekin000/Fluent_Python | /ch01_Python_Data_Structure_Magic_Function/deck.py | UTF-8 | 2,279 | 3.953125 | 4 | [] | no_license | ##########################################
# 1.1 The deck by __getitem__, __len__
## collections.nametuple, only property,no method's object
## for use __getitem__,__len__, the FrenchDeck get benefit like
### 1. could use python standard method, such as len,
### 2. could use python standard module, such as random.cho... | true |
a1e289edfb9ddf639c97ab945b631edf99212f6f | Python | sammersheikh/python | /numeric.py | UTF-8 | 388 | 4.375 | 4 | [] | no_license | num = 1
num += 1 #equivalent to num = num + 1
print(abs(-3)) #absolute value (get positive number)
print(round(3.75, 1)) #round to nearest digit, second number means round to the first digit after the decimal
num_1 = '100'
num_2 = '200' #these are strings, not integers
num_1 = int(num_1) #prefacing with int() cas... | true |
3ce73f557d254d89d8050f5c11aa39438069220f | Python | gregsalvesen/diskspec | /analysis/scripts/gs_stats.py | UTF-8 | 15,629 | 3.40625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from scipy.integrate import quad, simps
from scipy.special import erf, erfc
from scipy.optimize import curve_fit
'''
This is a collection of handy statistics tools:
interpolated_median -
confidence_interval -
error1D -
'''
#==========================================================================... | true |
8c89d30c981cb861af7b4230afe8c752c1e8648b | Python | manoelrui/python-data-structures | /test/datastructure/list/TestQ1.py | UTF-8 | 5,407 | 4.125 | 4 | [] | no_license | import unittest
from datastructure.list.LinkedList import LinkedList
class TestQ1(unittest.TestCase):
# 1. Criar uma lista vazia;
def test_creation(self):
l = LinkedList()
self.assertIsNotNone(l)
self.assertIsNone(l.head)
self.assertEqual(len(l), 0)
# 2. Inserir elemento n... | true |
a8a63b8c7496b1eb943c677bd251964ce1472a7e | Python | foone/vs-movie-generator | /generatevs.py | UTF-8 | 312 | 3.375 | 3 | [] | no_license | import random
def initial_caps(name):
return name[0].upper()+name[1:]
names={}
for line in open('names.txt','r'):
name = line.strip()
names[name.lower()]=initial_caps(name)
for i in range(10):
selections = [random.choice(names.keys()) for _ in range(2)]
print ' vs. '.join([names[x] for x in selections]) | true |
a01673b12a33cf6de60d97dbdf629a8a4e1e2def | Python | thedavidharris/advent-of-code-2020 | /day3/3b.py | UTF-8 | 220 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
from math import prod
print((lambda m:prod(sum(line[i*dx %len(line)] == '#' for i,line in enumerate(m[::dy])) for dx,dy in [(3,1),(1,1),(5,1),(7,1),(1,2)]))(open('input.txt').read().splitlines())) | true |
b222193c5cd500c735c8ceda60014d3ad219335e | Python | awaz456/Test_feb_19 | /Q_5.py | UTF-8 | 345 | 3.75 | 4 | [] | no_license | class Student:
def __init__(self, name, sec):
self.name = name
self.sec = sec
@classmethod
def gen_stu_from_string(cls, inp):
name, sec = inp.split("-")
return cls(name, sec)
stu1 = Student.gen_stu_from_string(input("Enter input in the form of 'Name-Sec': "))
... | true |
c58ff46f6270da051758cbfbdb95e689c4c97503 | Python | Edgar-Saavedra/intro-machine-learning-python | /ch1/iris.py | UTF-8 | 4,406 | 3.171875 | 3 | [] | no_license | # these imports are assumed
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import mglearn
from IPython.display import display
# END: these imports are assumed
from sklearn.datasets import load_iris
iris_dataset = load_iris()
print("Keys of iris_dataset: \n", iris_dataset.keys())
print(iris_dat... | true |
25a15137c3d649f8cca1c9297ff387683880ad67 | Python | sertachak/InterviewQuestions | /project/src/crypt/aes.py | UTF-8 | 882 | 2.890625 | 3 | [] | no_license | from Crypto.Cipher import AES
from pbkdf2 import PBKDF2
import os, random, string, struct
def randomword(length):
chars = string.ascii_lowercase+string.digits+string.ascii_uppercase
return ''.join(random.choice(chars) for i in range(length))
password = randomword( 64 )
salt = os.urandom(8)
key = PBKDF2( pa... | true |
8f1c3e7d6fbfac072d8734001203c5cbf8b7c5a4 | Python | ihaeyong/SphereGAN-Pytorch-implementation | /ops.py | UTF-8 | 981 | 3.1875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
class HyperSphereLoss(nn.Module):
def forward(self, input):
'''
Calcuate distance between input and N(North Pole) using hypersphere metrics.
Woo Park, Sung, and Junseok Kwon.
"Sphere Generative Adversarial Network Based on Geometric Moment Matchin... | true |
b6d21889a6008de07c3eaa2b9c659d79968c4d75 | Python | daniel-reich/ubiquitous-fiesta | /Jjpou65vd6t6xGwvN_1.py | UTF-8 | 108 | 2.859375 | 3 | [] | no_license |
def get_case(txt):
if txt.islower(): return 'lower'
if txt.isupper(): return 'upper'
return 'mixed'
| true |
e4eea3a37fb680074e099af1e40b1ff92995839b | Python | Yuvanshanker/Data-Structures-and-Algorithms | /Linked List/Find the middle of a given linked list.py | UTF-8 | 1,458 | 4.375 | 4 | [] | no_license | class Node:
# Function to initialise the node object
def __init__(self, data):
self.data = data # Assign data
self.next = None # Initialize next as null
# Linked List class contains a Node object
class LinkedList:
# Function to initialize head
def __init__(self):
... | true |
1b753205a9184f8efafc4030322bf69e87bbf4e1 | Python | ahmedaliyahia86/mahratech-python-basics | /Mahartech24.py | UTF-8 | 1,047 | 3.953125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 20:48:18 2020
@author: ahmedali
"""
# Python Collections: 2- Lists
# 13- Lists in Memory:
# ** Storing in both different locations:
L1 = [1, 2, 3]
L2 = [1, 2, 3]
print(L1)
print(L2)
print('-------------------------------')
# ** Alias:
L... | true |
db059237fa468128895834f12f314905d88cfae7 | Python | westbrookmd/Python-AtBS | /Python-Files/collatzSequence.py | UTF-8 | 378 | 4.21875 | 4 | [] | no_license | # Write your code here :-)
def collatz(number):
if number %2 == 0:
number = number//2
else:
number = (3*number) + 1
print(number)
return number
# Loop the program
a = 0
while a == 0:
number = input("Enter an integer: ")
number = int(number)
while number != 1:
number... | true |
c0f94401d792c1157b1babf5a0383c80dfdaf082 | Python | Shr1ftyy/casper-python-sdk | /pycspr/api/get_account_info.py | UTF-8 | 1,124 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import typing
import jsonrpcclient as rpc_client
from pycspr.client import NodeConnectionInfo
# RPC method to be invoked.
# TODO: use new endpoint -> state_get_account_info
_API_ENDPOINT = "state_get_item"
def execute(
connection_info: NodeConnectionInfo,
account_hash: bytes,
state_root_hash: typing... | true |
8a61e041368ae6c95e2a646b6adc4f979ad8b86c | Python | khushalimehta/Rock_Pepper_Scissors | /Rock_Pepper_Scissors.py | UTF-8 | 688 | 3.78125 | 4 | [] | no_license | print("Please pick one: Rock Scissors Paper")
while True:
dict1 = {'rock':1,'scissors':2,'paper':3}
playera = str(input("Player a:"))
playerb = str(input("Player b:"))
a = dict1.get(playera)
b = dict1.get(playerb)
dif = a - b
if dif in [-1,2]:
print("Player a win")
str = inpu... | true |
7134bd1dec8aff6ced22afbed19ef8988800a194 | Python | NirmaySriharsha/ReinforcementLearning-LunarLander | /reinforce.py | UTF-8 | 5,980 | 3.1875 | 3 | [] | no_license | import torch
from torch import optim
from torch import nn
import gym
import numpy as np
class BanditEnv(gym.Env):
'''
Toy env to test your implementation
The state is fixed (bandit setup)
Action space: gym.spaces.Discrete(10)
Note that the action takes integer values
'''
def __init__(self... | true |
e43a086cbbb6d0ed399e1c35492e7a45a0210418 | Python | Yakub-B/PR-DDB | /L1_OOP/models.py | UTF-8 | 380 | 3.03125 | 3 | [] | no_license | from dataclasses import dataclass, asdict
@dataclass
class UserModel:
pk: int
email: str
first_name: str
last_name: str
@property
def full_name(self) -> str:
return f'{self.first_name} {self.last_name}'
@property
def as_dict(self) -> dict:
return asdict(self)
def... | true |
5589d056bf4c58c08d556719e2aa5511dad6e63d | Python | marcinpgit/Python_days | /day11/metody_klas4.py | UTF-8 | 1,375 | 3.640625 | 4 | [] | no_license | class Pracownik(object):
roczna_podwyzka = 5
ilosc_pracownikow = 0
def __init__(self, imie, stanowisko):
self.imie = imie
self.stanowisko = stanowisko
self.wynagrodzenie = None
Pracownik.ilosc_pracownikow += 1
def ustaw_pensje(self, kwota):
if kwota... | true |
7586cb6694df0b15990b73da7734dfa1d5b6f0d6 | Python | raufmca/pythonCodes | /leadingzeros.py | UTF-8 | 513 | 4.0625 | 4 | [] | no_license | # leadingzeros
# Request input from the user
num = int ( input ( 'Enter the number between 0 - 9999 : ' ) )
if num < 0:
num = 0
if num > 9999:
num = 9999
print ( end=' [ ' )
# Extract and print thousands-place digit
digit = num // 1000 # extract 1000 place number
print ( digit, end='')
num %= 1000
digit... | true |
e5029462714ef9e8e1c5d96acab06a15459570f0 | Python | wonggamggik/algorithm_solving | /dongbin_book/chap7_binary_search/iterative_binary_search.py | UTF-8 | 763 | 3.96875 | 4 | [] | no_license | """
# Input Data 1
7
1 3 5 7 9 11 13 15 17 19
# Output 1
4
# Input Data 2
7
1 3 5 6 9 11 13 15 17 19
# Output 2
Cannot find 7 in list
"""
import sys
readline = lambda: sys.stdin.readline().rstrip()
def binary_search(array, target, start, end):
while start <= end:
mid = (start + end) // 2
if a... | true |
fccbd2b2c54494dbd9da41dde28ccd85668a9729 | Python | teacupfull/python_system | /programming/ex1.py | UTF-8 | 115 | 3.5 | 4 | [] | no_license | x = 34 - 23
y = "Hello"
z = 3.45
if z == 3.45 or y == "Hello":
x = x + 1
y = y + " World"
print (x)
print (y)
| true |
961716580451524186426a87171683b937116ebe | Python | HashCodeINSA/hashcode2016 | /simu.py | UTF-8 | 2,151 | 2.625 | 3 | [] | no_license | from drone import DRONE_STATUS
#
# DM = DroneManager
# OM = OrderManager
# WM = WarehouseManager
#
def load_drone(drone, order, WM):
item_id, item_qty = order.item_left() # recuperation de l'item restant
# tant que le drone n'est pas plein ou que la commande n'est pas complète
while item_id is not N... | true |
624bb95440202df6934ec3011d2e14214b0b2456 | Python | 17craigiec/Connect_Four_AI | /Bomberman/group02/testcharacter.py | UTF-8 | 9,761 | 3.390625 | 3 | [] | no_license | # This is necessary to find the main code
import sys
sys.path.insert(0, '../bomberman')
# Import necessary stuff
from entity import CharacterEntity
from colorama import Fore, Back
class TestCharacter(CharacterEntity):
char = CharacterEntity
char_x = 0
char_y = 0
def do(self, wrld):
# Your cod... | true |
93af56a6439b3027ddbd7f4d24aa632f095e0043 | Python | Pandani07/Scripting-Languages-Lab | /Assignment7/Odd number range/python.py | UTF-8 | 223 | 3.734375 | 4 | [] | no_license | def OddRange(num1,num2):
list1=[]
for n in range(num1,num2+1):
if n%2!=0:
list1.append(n)
print(list1)
a=int(input("Enter the lower base"))
b=int(input("Enter the upper base"))
OddRange(a,b)
| true |
d948bd63136e06a6e9c6edb97c81404f264b7dcd | Python | AndreaSalmaso/segnalazioniProduzioneGUI | /segnalazioni_prod_GUI.py | UTF-8 | 11,068 | 2.609375 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk, font
import ctypes, center_tk_window, keyboard, math
import pandas as pd
import mytkinter as mytk
import excel_handler as eh
from popup import warning_msg
class InserimentoSegnalazioniGUI:
def __init__(self, master, main_color, path_excel):
self.master = mas... | true |
d624344c7e2f1ccfeef37475a5b7a76bb795257c | Python | JakeStubbs4/CMPE-365 | /Assignment 1/connecting_flights.py | UTF-8 | 5,824 | 3.8125 | 4 | [] | no_license | # CMPE 365 Week 2 Lab Problem: Connecting Flights
# Jake Stubbs
# 20005204
# I certify that this submission contains my own work, except as noted.
import sys
INFINITY = sys.maxsize
# Prompts user for flight schedule input in the form of a text file.
def readInput():
filename = input("Enter a file name representin... | true |
9012f8360cba879e2f466b903eba194ac5b9de2e | Python | saki45/CodingTest | /py/CLRS1_9/findNearestKth.py | UTF-8 | 1,112 | 3.609375 | 4 | [] | no_license | from findKth import findKth
def findNearestKth(a, n, k):
# This method returns the nearest k elements along with the nth largest element
if n >= len(a):
print('illegal n')
return None
p, v = findKth(a, n)
print(v)
if k == 0:
return v
if k < 0:
k = -k
# p -- the kth nearest element to a[n]
# a[:p+1] ... | true |
532dffe85d680dcee8dbbcd7adb6b0a66201ca63 | Python | INKWWW/NLP | /preprocess_server.py | UTF-8 | 4,628 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''直接匹配算法'''
import os
import copy
import jieba
import csv
dirname = print(os.getcwd())
# 加载停词
def getStopwords(filepath):
'''训练模型的时候不用加载停词文件表,直接使用只去除标点符号的停词'''
with open(filepath, 'r', encoding='utf-8') as f:
words = f.read()
# print(type(words)... | true |
5ee8d884e30afa4e091ebb9ada425c0c0a856bb2 | Python | l5d1l5/CCRCexamples | /markdown_thesis/plot_wordcount.py | UTF-8 | 1,709 | 2.53125 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import pandas as pd
print('plotting wordcount from log_wordcount.txt...')
data = pd.read_csv('log_wordcount.txt',delim_whitespace=True,header=None, usecols=[0,1,3],
names=['date','time','words'],parse_dates=[['date','time']],index_c... | true |
379da3e121157f9eafbb1f2ae18cf5b11298b807 | Python | Deveshshukla4/Insta_bot | /insta_bot.py | UTF-8 | 8,385 | 3.203125 | 3 | [] | no_license | import requests # Requests library imported to perform different queries such as get , post , delete ,put
APP_ACCESS_TOKEN = "3068983250.94b2134.006490b178c24fefa74dba819dddaa1c" # access token
BASE_URL = "https://api.instagram.com/v1/"
#Function to prints the user info
def self_info():
requests_url ... | true |
c74e5fb4b803deae21bb089003689f9b2730bb6e | Python | fitai/fitai_controller | /FitAI/php_process_data.py | UTF-8 | 3,781 | 2.9375 | 3 | [] | no_license | import sys, os
import getopt
import json
from pandas import DataFrame
try:
print 'Adding {} to sys.path'.format(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
except NameError:
print 'working in Dev mode.'
from processing.functions import calc_vel2,... | true |
026285701f24e270dfcc394a4a81b533583c7564 | Python | doanc4/SalaryPrediction | /preprocessing.py | UTF-8 | 1,979 | 3.140625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from nlp import clean_text
def get_bin(salary, percentiles):
"""Bins salaries into groups based on percentile. Used for fine-tuning BERT."""
for i, val in enumerate(percentiles):
if i < len(percentiles) - 1:
if salary > val and salary <= percentiles[i... | true |
e90f11ebbb184e36510ddab112c86c064f9d7b6f | Python | SanyaBoroda4/Hillel_Homeworks | /LESSON_06(LISTS, TUPLES)/HM_01.py | UTF-8 | 208 | 3.1875 | 3 | [] | no_license | matrix = [int(input()) for i in range(6)]
k = int(input("Please enter the index number from 0 to 5: "))
for i in range(k, len(matrix) - 1):
matrix[i], matrix[i+1] = matrix[i+1], matrix[i]
matrix.pop()
| true |
f3a607e100863b26c49e950a0624fd23b4142f24 | Python | MaryamGambo/PythonTest | /functions.py | UTF-8 | 2,798 | 3.578125 | 4 | [] | no_license | import sqlite3
import queries
try:
with sqlite3.connect("students.sqlite3") as conn:
cur = conn.cursor()
# to create a table
cur.execute(queries.CREATE_TABLE)
conn.commit()
class Connectivity:
def start(self):
while True:
self.options()
... | true |
dd8b1aae651472e687a4c165afbee7cae23b8f0e | Python | 88daxiong/leetcode | /Interview/yanfudao/1.py | UTF-8 | 1,003 | 3.078125 | 3 | [] | no_license | '''
@Descripttion: 分组对话
@Author: daxiong
@Date: 2019-08-24 15:59:56
@LastEditors: daxiong
@LastEditTime: 2019-08-24 17:37:01
'''
import sys
if __name__ == "__main__":
C = int(sys.stdin.readline().strip())
ans = 0
nums = list()
for i in range(C):
line = sys.stdin.readline().strip()
studen... | true |
290343068d830a282f6209c4642a38f43df8043e | Python | bot-createor/ios | /calculator.py | UTF-8 | 975 | 3.34375 | 3 | [] | no_license | import tkinter as tk
root = tk.Tk()
root.title("calculator")
class Screen:
def __init__(self):
self.screen_width = root.winfo_width / 7
self.screen_height = root.winfo_height / 4
root.geometry(self.screen_width + "x" + self.screen_height)
# input variables
input_width = self.screen_width - ... | true |
dba3205d74d24345d1547efda68cd0338d836cd5 | Python | Aasthaengg/IBMdataset | /Python_codes/p03814/s646616164.py | UTF-8 | 244 | 3.15625 | 3 | [] | no_license | def main():
s = input()
a = len(s); z = 0
for i, t in enumerate(s):
if t == 'A':
a = min(a, i)
if t == 'Z':
z = max(z, i)
ans = z-a+1
print(ans)
if __name__ == "__main__":
main()
| true |
59b93d66d83c0ade1ca731d1a3cca6f3ff58ff2e | Python | nhmishaq/Python-Assignments | /python_platform_assignments/stringsLists.py | UTF-8 | 1,740 | 4.75 | 5 | [] | no_license | #This is version 2.0 of the same python platform assignments that I worked on in my first attempt.
#The goal is to implement better coding practices and sharpen my command over the language.
# Find and Replace
# In this string: words = "It's thanksgiving day. It's my birthday,too!" print the
# position of the first ... | true |
19ff7f2cabc027cc30fce6c7120b868af5908b1f | Python | tagyro/GCoM-Cities-Action-Explorer | /mainScript.py | UTF-8 | 9,289 | 2.96875 | 3 | [] | no_license | import json
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
## only needed for plots:
# import seaborn as sns
# import matplotlib.pyplot as plt
# import random
### parameters
# population cutoff for cities:
pop_cutoff = 50000
# similarity score cutoff for matching:
sim_cutoff ... | true |
73f83739a22c6760eedaa05992275b32b06a1153 | Python | cin-derella/python_datascience | /YC_DataAnalysis/code/numpyTest/13.broadcast.py | UTF-8 | 204 | 2.921875 | 3 | [] | no_license | import numpy as np
x = np.array([[1],[2],[3]])
y = np.array([4,5,6])
b = np.broadcast(x,y)
b.index
print(b.__next__()) #循环下一个
print(b.__next__())
print(b.__next__())
print(b.index) #索引位置 | true |
e2abe6cd74c9fb2f11e65914f6fd9eb522fde2e7 | Python | WebucatorTraining/classfiles-actionable-python | /advanced-python-concepts/Demos/with_filter.py | UTF-8 | 166 | 3.828125 | 4 | [
"MIT"
] | permissive | def is_odd(num):
return num % 2
def main():
nums = range(0, 10)
odd_nums = filter(is_odd, nums)
for num in odd_nums:
print(num)
main() | true |
e958045f1c59d27c8e1650c0c317da519c09e9fc | Python | gabminamedez/leetcode | /easy/1108.py | UTF-8 | 141 | 2.71875 | 3 | [] | no_license | # [1480] Defanging an IP Address
class Solution:
def defangIPaddr(self, address: str) -> str:
return address.replace('.', '[.]') | true |
2242b0b9e41a2936b012eb1a2d71f3b59132f5c2 | Python | brakdag/cursoBasicopython | /src/invertir.py | UTF-8 | 59 | 3.234375 | 3 | [
"MIT"
] | permissive | numero = input("ingrese un numero:")
print(numero[-1::-1])
| true |
a1189d1cd5386efc0077da22bed68641af789f65 | Python | aisichenko/gdsfactory | /gdsfactory/components/cutback_bend.py | UTF-8 | 6,579 | 2.875 | 3 | [
"MIT"
] | permissive | from numpy import float64
import gdsfactory as gf
from gdsfactory.cell import cell
from gdsfactory.component import Component
from gdsfactory.components.bend_circular import bend_circular, bend_circular180
from gdsfactory.components.bend_euler import bend_euler, bend_euler180
from gdsfactory.components.component_seque... | true |
0170773e410ad6644ba934e7fc5102d8a00a72f6 | Python | martewegger/fys4150 | /project2/main.py | UTF-8 | 5,996 | 2.6875 | 3 | [] | no_license | import os
import sys
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.size'] = 16
#IMPORTANT: The two first functions use the potential for 1 electron. The last function use the potential for 2 electrons. In addition to turning the function on in this python script, the corresponding call to the «... | true |
51831de3dc08c2fa241e37f29c8ed670ee79dafb | Python | sekil9529/django-demo | /libs/error_code/enum.py | UTF-8 | 1,498 | 2.875 | 3 | [] | no_license | # coding: utf-8
"""错误码枚举类"""
from __future__ import annotations
from typing import NamedTuple
from enum import Enum, EnumMeta, unique
from types import DynamicClassAttribute
__all__ = (
'ECData',
'BaseECEnum',
)
class ECData(NamedTuple):
"""错误码数据"""
code: str # 错误码
mes... | true |
df3affb773c2f476a87da94aa138f61b1a099c20 | Python | KamilBabayev/Scripts | /aws_s3_boto_daily_backuper.py | UTF-8 | 1,332 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
import os
import boto3
from datetime import datetime
day=str(datetime.now())[:10]
access_key = '***************'
secret_key = '************************'
subfolder = day + '/'
#subfolder='2017-09-05/'
records = '/var/lib/freeswitch/recordings'
actual_day = records + '/' + day
#actual_day = records +... | true |
beeab924f7d139eafe3fc58557a3798554d35331 | Python | aleedom/DjangularMessaging | /authentication/models.py | UTF-8 | 988 | 2.5625 | 3 | [] | no_license | from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db import models
class AccountManager(BaseUserManager):
def create_user(self, username, password=None,):
if not username:
raise ValueError('Users must have a valid username.')
account = self.model(use... | true |
d16696c1bdeb9318c1bec92b083818fb8d7e9919 | Python | art-vybor/twnews | /core/twnews/recommend.py | UTF-8 | 3,200 | 2.6875 | 3 | [] | no_license | import heapq
import logging
from scipy import sparse
from twnews.utils.extra import progressbar_iterate
def get_index_of_correct_news(tweet, news_list):
news_list = sorted(news_list, key=lambda x: x[1], reverse=True)
for idx, (news, score) in enumerate(news_list):
for url in tweet.urls:
if... | true |
6d03bf60deb6075e95e436fef76552c89655e841 | Python | Zihaokong/DeepLearning | /CSE151B_PA3/datasets.py | UTF-8 | 1,953 | 2.953125 | 3 | [] | no_license | import torch
from torch.utils.data import Dataset
import torch
from PIL import Image
import os
from torchvision import transforms
import numpy as np
# Dataset class to preprocess your data and labels
# You can do all types of transformation on the images in this class
class bird_dataset(Dataset):
# You can read t... | true |
23fa5c2b847fd15208908402f7da0b6414ad70cd | Python | mishav78/conversational-summarization | /src/data/make_dataset.py | UTF-8 | 4,424 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
from glob import glob
import json
import torch
from torch.utils.data.dataset import TensorDataset, random_split
from transformers import BartTokenizer
import numpy as np
def text_cleaner(text: str)... | true |
0a0c58460240e79d1ee745c5af032efa963a2dfa | Python | joshua-lai/ETNP_TMAO_metagenomics | /formatBlastHits_v6.py | UTF-8 | 8,926 | 2.84375 | 3 | [] | no_license | import re
import sys
import os
from Bio import SeqIO
def formatAccession(preAccession):
"""gets accesion from within the |'s or the entirety
this was made with first seeing clara's prokdb but i think most things are fine w/o it"""
if '|' in preAccession:
start = preAccession.find('|')
... | true |
de54dc804b8eb00884dc7a222ca3b2812358a212 | Python | cdalvara/Mini-Python-Interpreter | /Testcases/tc10.py | UTF-8 | 173 | 3.109375 | 3 | [] | no_license | var1=230
var2=450
var3=var1+var2
v4=var3+100
if var1>=var2:
if var3==500:
s="A"
else:
s="B"
else:
if v4<=500:
s="C"
else:
s="d"
print(v4)
print(s) | true |
ee45d4a46b3555c103e1d088663e0a5145505f65 | Python | arpitdixit445/Leetcode-30-day-challenge | /Day_7__Counting_Elements.py | UTF-8 | 777 | 3.65625 | 4 | [] | no_license | '''
Problem Statement -> Given an integer array arr, count element x such that x + 1 is also in arr.
If there're duplicates in arr, count them seperately.
Example 1 -> Input: arr = [1,2,3]
Output: 2
Explanation: 1 and 2 are count... | true |
b75329a1458a240ecb8122b4cfba2892b4c07422 | Python | JoeyNeidigh/robo_cleanup | /scripts/robo_cleanup.py | UTF-8 | 6,035 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import map_utils
import tf
import actionlib
import numpy as np
from move_base_msgs.msg import MoveBaseGoal, MoveBaseAction
from geometry_msgs.msg import Pose, Point
from geometry_msgs.msg import PoseWithCovarianceStamped
from nav_msgs.msg import OccupancyGrid
from actionlib_msgs.msg i... | true |