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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f489764ba1fdfb0dc9601b803ac64037ad10de88 | Python | vishnu-meera/Algorithms-And-DTs | /alogorithms/quickSort.py | UTF-8 | 1,187 | 3.96875 | 4 | [] | no_license | def quickSort(array,low,high):
if(low<high):
pivotIndex = partition_2(array,low,high)
quickSort(array,low,pivotIndex-1)
quickSort(array,pivotIndex+1,high)
def partition(array,low,high):
i = low
pivot = array[high]
for j in range(low,high):
if(array[j]<pivot):
... | true |
fe4f8b0f66160c20ada6ee3d1f1d9f8cbe120c30 | Python | iamquang95/timetracker | /time_tracker.py | UTF-8 | 2,100 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
import os, datetime, sys, time
from AppKit import NSWorkspace
class TimeTracker:
# Public methods
def track(self):
while True:
self._add_instace(self._get_current_app_name(), int(time.time()))
if (self._total_time > 0):
self._pretty_format... | true |
867c37767fd2c6d02dc02864b83749fffe1f0ff2 | Python | john966/CMDB | /api/utils/ansible/extract_setup.py | UTF-8 | 5,395 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
解析setup信息,提取相关硬件信息,方便入库
"""
class extract(object):
"""
提取有效数据
"""
def __init__(self,ip,data):
self.ip = ip
self.data = data
def get_disk(self,info):
"""
获取磁盘信息
:param info:
:return: ... | true |
3d194d3c53c881b80bef9087f2ee41bb8197efb1 | Python | sunchong137/pyscf_2017 | /future/pyscf | UTF-8 | 2,697 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import sys
import re
import tempfile
from pyscf import lib
def parse(s):
words = re.split('[,; ]+',s)
iw = 0
atom = []
symb = [i.upper() for i in lib.parameters.ELEMENTS_PROTON.keys()]
elements = dict(zip(symb, lib.parameters.EL... | true |
dcb963552165c307e07ef60c104d10f7245ae1d5 | Python | ADSL-Plucky/learngit | /homework-2/7.py | UTF-8 | 568 | 3.59375 | 4 | [] | no_license | '''
随机生成20个学生的成绩; 判断这20个学生成绩的等级; 用函数来实现;
A---成绩>=90;
B-->成绩在 [80,90)
C-->成绩在 [70,80)
D-->成绩<70
'''
from random import randint
def Judge(score):
if score >= 90:
return 'A'
elif score >= 80:
return 'B'
elif score >= 70:
return 'C'
else:
return 'D'
name = [x ... | true |
eeb74abaa2cee5b8cdcdad3ca89a43c3f78d943f | Python | RealNameHidden/guess-the-word-game | /guess.py | UTF-8 | 4,198 | 3.703125 | 4 | [] | no_license | import random
from game import game
from stringDatabase import stringDatabase
class guess:
gamesList = []
quitIt = False
choice = ''
stringDB = stringDatabase()
def intialize(self):
self.stringDB.loadWords()
def updateGamesList(self,game):
"""This method adds the game objec... | true |
0e2c6c1105e954b4dc24ab0261914c9ad568d599 | Python | girone/forestmaps | /scripts/grid.py | UTF-8 | 4,779 | 3.40625 | 3 | [] | no_license | """ grid -- This module contains the class grid.
Copyright 2013: Institut fuer Informatik
Author: Jonas Sternisko <sternis@informatik.uni-freiburg.de>
"""
from PIL import Image, ImageDraw
import numpy as np
import sys
from itertools import chain
def hom(point):
""" Returns homogenous representation of a point. ""... | true |
9f31fd127cae29e34e8da1e84e31ffbad0292808 | Python | aiminghu/HelloWorld | /Pyecharts/demo_2.py | UTF-8 | 361 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : demo_2.py
# @Author: HAM
# @Date : demo_2
from pyecharts import Bar
bar = Bar("我的第一个图表","这里是副标题")
bar.add("服装", ["P0", "P1", "P2", "P3", "微小"], [65, 177, 177, 4, 0])
# bar.print_echarts_options() # 该行只为了打印配置项,方便调试时使用
bar.render()
| true |
ce6b6d1aad39a36979ecf7e5ab9c1c48869031bc | Python | miracle2k/genericapi | /tests/test_auth.py | UTF-8 | 5,812 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | """
Test authentication hooks.
"""
from django.http import HttpRequest, QueryDict
from shared import *
def make_request(key, value):
r = HttpRequest()
r.META['HTTP_'+key] = value
return r
class SampleAPI(GenericAPI):
class Meta:
expose_by_default = True
def check_key(re... | true |
c84c6b5307bf8d53ba9465a58adeb714858b2e53 | Python | Nordenbox/Nordenbox_MachineLearning_Study | /.history/playground2_20211223101647.py | UTF-8 | 3,485 | 2.703125 | 3 | [] | no_license |
import os
import shutil
from aip import AipFace
import json
import pprint
import math
#图片分类
from aip import AipImageClassify
APP_ID = '25318522'
API_KEY = 'w07MZbos3TN8IiN7FZWNBDDO'
SECRET_KEY = '4M9YrNcuHc6yLdgU2svq282C5EOX0RlO'
# 新建一个AipImageClassify,并赋值给变量client
client = AipImageClassify(APP_ID, API_KEY, SECRET_... | true |
0333846ca8c16be34a9e69387c924f323e01cde9 | Python | itdanja/python_2 | /COS PRO_2/모의고사/문제4.py | UTF-8 | 859 | 3.609375 | 4 | [] | no_license |
def solution(scores):
grade_counter = [0 for i in range(5)]
# grade_counter : 학점목록에 학점[A~F] 5개을 0으로 설정
for x in scores: # 점수목록에서 하나씩 X에 대입
if x >=85 : # x가 85점 이상이면
grade_counter[0] += 1 # 학점목록[0] = A학점 한명 추가
elif x >=70 : # x가 70점 이상이면
grade_counter[1] ... | true |
197d3df1117e51d1b3491aef5c213a05625fd1df | Python | louisuss/Algorithms-Code-Upload | /Python/Programmers/Level2/압축.py | UTF-8 | 957 | 3.421875 | 3 | [] | no_license | # 문자열을 리스트로 바꾸기 보다 문자열 자쳬로 슬라이싱 처리하는 것이 더 편한 경우임
def solution(msg):
# 출력
output = []
# 사전
dic = {chr(v): i for i, v in enumerate(range(ord('A'), ord('Z')+1), 1)}
idx = 0
lastIdx = 26
length = 0
while True:
length += 1
# dic에 해당 문자열이 포함안되어 있는 경우
if not msg[idx:i... | true |
ecba14ec7e13f2a173648425a0c26ce676b70253 | Python | kishanpolekar/kishanpolekar.github.io | /numsys.py | UTF-8 | 16,046 | 3.078125 | 3 | [] | no_license | import os
def binary():
num=input('Enter the Binary number: ')
l=len(num)
check=False
for i in range(l):
if num[i] in ('01.'):
pass
else:
print('Invalid Binary number entered!')
return
if num[i]=='.': check=True
nor,inv,i,j=0,0,0,0
if ... | true |
3ec8f8a31370ba3959da3a3103891b92603e00fb | Python | gshridhar/pylrn | /promptingPassingEx14.py | UTF-8 | 818 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python
# Author: shridhar gadekar
# Date: 10th August 2015
# Subject: Exercises for prompting and passing
from sys import argv
# Along with script, just provide your username
script, user_name, OS = argv
prompt = '> '
# printing the first lines with arguments provided at the command line.
print "Hi, %s, I... | true |
ea423231ab4cb5d2b28636f4ab2ccb7aa3d1c84d | Python | Sigmund1s/CSE-250 | /Project_3/notes.py | UTF-8 | 2,413 | 2.578125 | 3 | [] | no_license | #%%
import datadotworld as dw
import pandas as pd
import altair as alt
import numpy as np
#%%
results = dw.query('byuidss/cse-250-baseball-database',
'SELECT * FROM batting LIMIT 5')
batting5 = results.dataframe
# %%
q = '''
SELECT *
FROM batting
LIMIT 5
'''
dw.query('byuidss/cse-250-baseball-database', q).da... | true |
e8ef280cd6f4437c3855b80cfcb910f99f97007e | Python | rcadecaro/wheresmunna | /HOG-Landmarks/landmarks.py | UTF-8 | 8,261 | 2.953125 | 3 | [
"MIT"
] | permissive | import face_recognition
import cv2
import csv
import pandas as pd
import numpy as np
from scipy.signal import savgol_filter
import tkinter as tk
from tkinter import filedialog
from natsort import natsorted
import os
import sys
def landmarks_smoothed_video_csvexport(video, length):
### This function will take a vi... | true |
fce3d7c54f18325a44ee4321087abeef9668eaa2 | Python | HumanCellAtlas/ingest-broker | /broker/service/submission_summary_cache.py | UTF-8 | 654 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from expiringdict import ExpiringDict
from .exception.cache_miss_exception import CacheMissException
FIVE_MINUTES = 60 * 5
MAX_CACHE_SIZE = 10000
class SubmissionSummaryCache:
def __init__(self, cache_size=None, expiry=None):
self.cache_size = MAX_CACHE_SIZE if not cache_size else cache_size
sel... | true |
3606005a97cdca245ec9e34959d595f806220d3f | Python | bktsh/python-tdd | /tests/helloworld/helloworld_tests.py | UTF-8 | 1,488 | 3.109375 | 3 | [] | no_license | import unittest
from lib.helloworld.helloworld import *
class HelloworldTests(unittest.TestCase):
@classmethod
def setUpClass(self):
print("setup_class class:%s" % self.__name__)
@classmethod
def tearDownClass(self):
print("teardown_class class:%s" % self.__name__)
def s... | true |
2a00327169088f381ef9b26198cf7040c7604d78 | Python | AymanMagdy/hands-on-python | /String-operations/add_ing.py | UTF-8 | 308 | 4.09375 | 4 | [] | no_license | # Weite a func that adds 'ing' to the end of a given word.
def add_verb_ing(given_word):
return given_word+'ing'
if __name__ == "__main__":
user_string_input = str(input("Enter the needed word to add ing to: "))
result = add_verb_ing(user_string_input)
print("The word: {}".format(result)) | true |
8e6d8ef409ee508b009338ab237db570b8af1197 | Python | kontik-pk/python_code | /detection/dataloader_dataset.py | UTF-8 | 4,155 | 2.59375 | 3 | [] | no_license | class DataLoader(torch.utils.data.DataLoader):
def __init__(self, dataset, **kwargs):
super().__init__(dataset, collate_fn=DataLoader.collate_data, **kwargs)
@staticmethod
def collate_data(batch):
images, targets = zip(*batch)
return list(images), list(targets)
class Dat... | true |
72328dcfda36d94fe6ffdaec29704d0c32ed1573 | Python | kentontroy/draft_bond_yeids_spot_rates | /src/utility.py | UTF-8 | 281 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import division
def lambda_reverse_range(start=1, stop=0, step=-0.00001):
if (stop>=start or step>=0):
raise Exception("Invalid parameters. Requirements: Start>=Stop and Step<0")
i = start
while i > stop:
i += step
yield i
| true |
7cbef4e0053ee085163b8f1d6e54a1b9688ffeae | Python | goto-ru/GoTo-Summer-17-2 | /Day 2 - Photo/3_black_and_white.py | UTF-8 | 577 | 3.015625 | 3 | [] | no_license | from PIL import Image
im = Image.open("cat.jpg").convert("RGBA")
pixels = im.load()
for i in range(0,im.width):
for j in range(im.height):
r, g, b, a = pixels[i, j]
av = (r + g + b)//3
if av < 125:
pixels[i, j] = (r,0,0,a)
else:
pixels[i, j] = (r, g, b, a)
... | true |
f4245a1551ff047f5aed9be8f736464b5c6256c5 | Python | Pizzorni/PyBSaccounting | /pbsacc.py | UTF-8 | 2,892 | 2.9375 | 3 | [] | no_license | import argparse
import re
import datetime
from itertools import product
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-y','--year',nargs='*',type=int,
help='list of years')
parser.add_argument('-m','--month',nargs='*',type=int,
help='list of mont... | true |
41496771d853bb04c50160f3da4257542c870a28 | Python | Kampangchau/practicals-of-programming2 | /Prac1/loops.py | UTF-8 | 366 | 3.796875 | 4 | [] | no_license | for o in range(1, 21, 2):
print(o, end=' ')
print()
#a
for a in range(0, 101, 10):
print(a, end=' ')
print()
#b
for b in range(20, 0, 19):
print(b, end=' ')
print()
#c
number_of_stars = int(input("Number of stars: "))
for c in range(number_of_stars):
print(c, end=' ')
print()
#d
for d in range(1, nu... | true |
94c28ba14c192b0037f1e21f0a858aa0deb78993 | Python | ernestocharry/textAnalysis | /Text_Analysis_2.py | UTF-8 | 1,531 | 2.5625 | 3 | [] | no_license | import nltk # Natural Languaje TollKit nltk.download() Download all!
import matplotlib.pyplot as plt
import glob # To know all the txt files in a folder
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.probability import FreqDist
import re # Removing \n
import pandas as pd
from nltk.corpus import stopwo... | true |
e6c55a0cbf5621fb356cff52021f0170496505d8 | Python | smetj/wishbone | /tests/test_event.py | UTF-8 | 5,773 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_wishbone.py
#
# Copyright 2017 Jelle Smet <development@smetj.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 o... | true |
f592b0d407060b1158f1feb91e6891085b987951 | Python | ibkuroyagi/birdclef-2021 | /input/modules/models/utils.py | UTF-8 | 2,472 | 2.90625 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
def init_layer(layer):
"""Initialize a Linear or Convolutional layer. """
nn.init.xavier_uniform_(layer.weight)
if hasattr(layer, "bias"):
if layer.bias is not None:
layer.bias.data.fill_(0.0)
def init_bn(bn):
"""Initialize a... | true |
c5bd40a7985c7d6490b159e0a95647677b3f679a | Python | carolchenyx/Few-shot-Scene-adaptive-Anomaly-Detection | /dataset.py | UTF-8 | 1,232 | 2.671875 | 3 | [
"MIT"
] | permissive | from PIL import Image
from torch.utils.data import Dataset,DataLoader
class TrainingDataset(Dataset):
def __init__(self, img, transform=None):
self.img= img
self.transform=transform
# Length of Dataset will be # of Epochs (6)
def __getitem__(self, index):
epoch = []
... | true |
5fc99483255695bd5a8924cdaeaaaafb759530a6 | Python | Kreisso/MaciejPolakBarbaraSzewczykKNN | /venv/bin/main.py | UTF-8 | 678 | 2.8125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from KNN import KNN
iris_test_filename = 'iris.data.test.csv'
iris_learning_filename = 'iris.data.learning.csv'
irisTest = pd.read_csv(iris_test_filename, sep=',', decimal='.', header=None, names=['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'target'])
irisLear... | true |
cdb30eeb36305ceb795b43e1559475c3e4de300f | Python | tkanchin/adaptive_reg_active_learning | /bench_speed.py | UTF-8 | 2,413 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
import timeit
from sklearn.linear_model import Ridge
from efficient_learning.model import *
FILE = 'data/movie_reviews_use.pkl'
### load data
def load_data():
df = pd.read_pickle(FI... | true |
58c16efebd561ee39b8b9467d6534f3ce2d1e300 | Python | kranthikumar27/demo | /cspp1-practice/m20/matrix_operations.py | UTF-8 | 2,829 | 3.8125 | 4 | [] | no_license | '''
this is the program ror module20
'''
def mult_matrix(matrix1, matrix2):
'''
check if the matrix1 columns = matrix2 rows
mult the matrices and return the result matrix
print an error message if the matrix shapes are not valid for mult
and return None
error message should b... | true |
bed4260ade9be94ef2714068af4d97a2afed2197 | Python | ErikArndt/GMTK-Jam-2020 | /background.py | UTF-8 | 1,918 | 3.640625 | 4 | [] | no_license | """I wanted to make a class for the space background, and
I figured if I'm making a class, I might as well make a separate
file, too.
"""
import random
import pygame
import const
## Module-specific constants
NUM_INITIAL_STARS = 10
MAX_TIME_BETWEEN_STARS = 20
class Star:
def __init__(self, x_pos=const.WIN_LENGTH):... | true |
435cadc60db640128095d37813321b8c83885a7b | Python | glushenkovIG/PythonTasks | /evklid/t.py | UTF-8 | 592 | 3.25 | 3 | [] | no_license | def IsPrime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True
a = int(input())
b = a
A = []
while not IsPrime(a):
for i in range(2, int(a ** 0.5) + 1):
if a % i == 0 and IsPrime(i):
A.append(i)
a = a // i
pass
... | true |
7acb80ccc2db4872adf177439016dd2e08fe5e1c | Python | NikitaGordia/ItJimAssignment | /bounds/__init__.py | UTF-8 | 1,286 | 3.234375 | 3 | [] | no_license | import numpy as np
from collections import deque
THRESHOLD = 0.4
def search_center(matrix):
h, w = matrix.shape
q = deque()
q.append((0, 0, h, w))
while len(q) > 0:
x1, y1, x2, y2 = q.popleft()
if x1 == x2 - 1 or y1 == y2 - 1: continue
md_x = (x1 + x2) // 2
md_y = (y1... | true |
51dbff3d1b05e2f29ffc8da28b92f7336a219d05 | Python | abhaykatheria/cp | /HackerEarth/Catch_Theif.py | UTF-8 | 247 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 22:52:32 2018
@author: Mithilesh
"""
def catch(x,v,u):
if u>=v:
print(-1)
else:
net_v=v-u
t=x/(v-u)
print(2*t)
x,v,u=map(int,input().split())
catch(x,v,u) | true |
2e10aadfde05fbd42a84ec2dbf6014d738eb7806 | Python | mailru/skill_cosmo_quest | /src/skill_cosmo_quest/utils.py | UTF-8 | 2,064 | 2.625 | 3 | [
"MIT"
] | permissive | from typing import Dict, List, Optional
def set_response(
response, text_and_tts=None, text=None, tts=None, buttons=None, speak_text=True
) -> None:
if text_and_tts is not None:
text = text_and_tts[0]
tts = text_and_tts[1]
if (tts is None) and speak_text:
tts = text
if text i... | true |
f79b67575fa2f66659ab0cbd962b33ac054b03d7 | Python | Tymon-ctrl/Knowledge-Graph-Movie | /blog02_seaborn_kg/show_scatter.py | UTF-8 | 799 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import pandas as pd
#获取数据
df = pd.read_csv('stat_character.csv')
fig = plt.figure()
axes = fig.add_subplot(111)
#显示数据
print(df["height"])
print(df["mass"])
height = df["height"]
mass = df["mass"]
sex = df["gender"]
for i in range(len(sex)):
if sex[i] =... | true |
244a8136126af99a9b4b9782aef6a081a165581a | Python | morkvaivan/data-science | /data-normalization-and-regression-problems-using-keras/normalization.py | UTF-8 | 1,071 | 2.546875 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense
from keras import optimizers
from keras.utils import plot_model
import numpy
numpy.random.seed(7)
dataset = numpy.loadtxt("data.csv", delimiter=",")
# normalize
for i in range(1,10):
m = max(dataset[:, i])
dataset[:, i] *= 1 / m
X = dat... | true |
7bbf5eb0b94217493e53ce8adb183979bc9257ce | Python | jim90247/cluster-maintain | /monitor/getrapl-server.py | UTF-8 | 984 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3.6
import zmq
import threading
import time
import datetime
context = zmq.Context()
socket = context.socket(zmq.ROUTER)
socket.bind("tcp://*:2321")
power = {}
def server_thread():
while True:
[host, contents] = socket.recv_multipart()
data = contents.split()
cpu0, cp... | true |
db818c5011e13141cffe40f818eeb8c5346ba77a | Python | Bhagyashree-Mandora/Twitter-data-analysis | /src/sentiment.py | UTF-8 | 1,212 | 2.984375 | 3 | [] | no_license | import pandas
import re
import requests
import json
f= open("responses","w+")
tweets = pandas.read_csv('trumpdataCleaned1.csv')
# Send an HTTP POST request to the url on the website http://text-processing.com/docs/sentiment.html
# Since there is a limit on the number of requests per day, query for smaller chunks of d... | true |
1dae1cb2beb97c32165b6bb60b881ef043949f15 | Python | nralif/crash_course | /chapter_02/example_3.py | UTF-8 | 140 | 2.96875 | 3 | [] | no_license | #msg print
msg = input('enter your message: ')
print(msg)
# ex-2
m = 'hello world!'
print(m)
ipt = input('enter your msg: ')
print(ipt)
# | true |
38c9c81b71c5e678df4dd65f3464fc1e81514994 | Python | vug/coding-moding | /problems/largest_rectangle_in_histogram.py | UTF-8 | 2,175 | 3.671875 | 4 | [] | no_license | """
https://github.com/vug/coding-moding/wiki/Largest-Rectangle-in-Skyline-%28or-Histogram%29
"""
def largest_rectangle_brute3(a):
areas = []
for k in range(len(a)):
for l in range(k + 1, len(a)):
h = min(a[k:l])
area = h * (l - k)
areas.append(area)
return max(... | true |
59c49b92405a553480f44cc752e0bca37f4e7ac6 | Python | dgrant/interview_problems | /decent_number.py | UTF-8 | 1,301 | 3.71875 | 4 | [] | no_license | import unittest
def decent(n):
if n % 3 == 0:
return int('5' * n)
else:
num_fives = n
while num_fives >= 0:
print('trying num_fives=', num_fives)
if num_fives % 3 == 0:
num_threes = n - num_fives
print('trying num_threes=', num_thr... | true |
e059fe3a3ed2026c0925830cf03e2efcf41b95be | Python | burlamix/Gendered-Pronoun-Resolution | /hltproject/dataset_utils/parsing.py | UTF-8 | 2,454 | 2.796875 | 3 | [] | no_license | import numpy as np
import collections
RawSentence = collections.namedtuple ('RawSentence', ['id', 'text', 'pron', 'pron_off', 'A', 'A_off', 'A_coref', 'B', 'B_off', 'B_coref', 'url'])
Sentence = collections.namedtuple ('Sentence', ['id', 'tokens', 'embeddings', 'A_tok_off', 'A_coref', 'B_tok_off', 'B_coref', 'pron_tok... | true |
6b977e849924e23b28bc115f65016686f17cff70 | Python | komunikator1984/Python_RTU_08_20 | /Diena_5_strings/d5_g1_u1.py | UTF-8 | 335 | 4.21875 | 4 | [
"MIT"
] | permissive | # your_name = input(f'Please enter name: ')
# back_name = your_name[::-1]
# print(f'{your_name} -> {(back_name.capitalize())} , pamatigs juceklis vai ne {your_name[0].upper()}?')
name = input("Enter the name:")
name = name.capitalize()
name_rev = name[::-1].capitalize()
print(f"{name_rev}, pamatīgs juceklis, vai n... | true |
47882ab43ae4be627d4c9a912e6000ac0352bfef | Python | drdicno/alpro | /aplikasi 6a.py | UTF-8 | 959 | 3.53125 | 4 | [] | no_license | """
Nama : Dicky Novanda Syaifulah
NM : 20083000068
Kelas : 2C
Hitung nilai total transaksi pembelian Printer Epson T20
"""
print("************************************")
print(" Nilai Total Transaksi ")
print("************************************")
jwbulangprog = "y"
while jwbulangprog=... | true |
00172dc174366bb97bb94624489d1c92d8fb0b3d | Python | rayankikavitha/InterviewPrep | /IK-Homwork/sorting_timed_test/dutch_flag_012.py | UTF-8 | 207 | 2.90625 | 3 | [] | no_license | """
Dutch national flag problem (DNF) is a computer science
Sort an array of 0s, 1s and 2s
"""
def quick_sort(arr):
sort_012(arr,len(arr))
def sort_012(arr, n)
start = 0
l = 0
r = n-1
| true |
f702b22ee2bddc6e70ed15625e5e8150fdae3ec5 | Python | d99b09/Rl_projects | /src/mrm_env/nodes/tests.py | UTF-8 | 657 | 2.828125 | 3 | [] | no_license |
import time
'''
'models/{MODEL_NAME}__{max_reward:_>7.2f}max_{average_reward:_>7.2f}avg_{min_reward:_>7.2f}min__{int(time.time())}.model'
modelsname = 'name'
max_reward = ''
average_reward = ''
min_reward = ''
time = str(int(time.time()))
'''
MODEL_NAME = 'RL'
max_reward = 0.123548655454486341545
average_reward = ... | true |
bf0ae87228c8d6426df82d39ea62a52d413b89e0 | Python | nah-ko/Tools-project | /scripts/nerim_accounting/GetNerimAccounting.py | UTF-8 | 3,739 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import httplib, urllib, os
import sys, string, locale
import ConfigParser
from HTMLParser import HTMLParser
from optparse import OptionParser
class MonParseurHTML( HTMLParser ):
def __init__(self):
HTMLParser.__init__(self)
self.in_dico = False
self.current_def = None
self.current_tag ... | true |
5fb23bc090f987238450dfdf1a20865083b191d9 | Python | herculeshssj/python | /caelum-py-14-cap3/programa.py | UTF-8 | 1,489 | 4.53125 | 5 | [
"MIT"
] | permissive | print('Hello World')
print(2)
print(type('Hello World')) # tipo string
print(type(2)) # tipo inteiro
print(type(3.2)) # tipo float
print(type('2')) # string que representa o algarismo 2
print(type('3.2')) # string que representa o número real 3.2
# Números complexos. A parte imaginário é indicada pela letra 'j'
p... | true |
a61d752782c68f33bb11016c023a875e881e5c9d | Python | ju-c-lopes/Univesp_Algoritmos_II | /Semana4/BSTNode_ref.py | UTF-8 | 2,037 | 3.921875 | 4 | [] | no_license | class BSTNode(object):
"""
os parâmetros left e right são as referências a outros nós,
o campo key guarda a chave utilizada para identificar o nó
e value representa o valor que desejamos armazenar nele
"""
def __init__(self, key, value=None, left=None, right=None):
self.key = key
... | true |
b086858d5f967b804db2d4a8f9193f23e763cb99 | Python | Gazian/wh_codeclan_karaoke_jpg | /classes/song.py | UTF-8 | 154 | 3.15625 | 3 | [] | no_license | class Song:
def __init__(self,song_title,artist,genre):
self.song_title = song_title
self.artist = artist
self.genre = genre
| true |
da236fee1b1e2a0ad300cd09b0744c947325ecff | Python | JenniferWenHsu/BotAnimation | /classes/terrain.py | UTF-8 | 1,905 | 3.515625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import random
import math
class Terrain:
"""
This constructs the Terrain for the environment.
The terrain is broken up to SEGCOUNT number of segments
"""
def __init__(self,
xlim = (0,100),
ylim = (0,1),
segCount = 10
):
self.segCount = se... | true |
6c2b04fbb1ed8330b848ce17f682b5f7c9f174aa | Python | BeefyTowers/string-speller | /test.py | UTF-8 | 1,175 | 4.375 | 4 | [] | no_license | # Program to check if a string is palindrome or not
my_str = 'aIbohPhoBiA'
# make it suitable for caseless comparison
my_str = my_str.casefold()
# reverse the string
rev_str = reversed(my_str)
# check if the string is equal to its reverse
if list(my_str) == list(rev_str):
print("The string is a palindrome.")
els... | true |
6d01ce9535c704063c1c8239e37b74bbe8ca677e | Python | robgoyal/CodingChallenges | /CodeWars/6/findMissingLetter.py | UTF-8 | 483 | 4.1875 | 4 | [] | no_license | # Name: findMissingLetter.py
# Author: Robin Goyal
# Last-Modified: June 25, 2018
# Purpose: Find the missing letter in a series of consecutive characters
def find_missing_letter(chars):
"""find_missing_letter
Return the missing letter in a series of chars from
a list.
Examples:
>>> find_missing... | true |
b26c6ce8aa60e020ed6708ecc12b8157a490a238 | Python | IacobEd/MachineLearningProject | /Proiect/dtFeatures.py | UTF-8 | 845 | 2.65625 | 3 | [] | no_license | from datetime import timedelta
def dateTime_features(dataFrame,date_start,date_end):
date_end=date_end+timedelta(days=4)
dataFrame['month'] = dataFrame.index.month
dataFrame['day'] = dataFrame.index.day
dataFrame['year'] = dataFrame.index.year
dataFrame['quarter'] = dataFrame.index.quarter
... | true |
7d576b0927abb94753df73bbc79080979ec40b0d | Python | slongwell/opentrons-api | /opentrons/robot/command.py | UTF-8 | 848 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | class Command(object):
def __init__(self, do=None, setup=None, description=None):
assert callable(do)
self.setup = setup
self.do = do
self.description = description
def __call__(self):
if self.setup:
self.setup()
self.do()
def __str__(self):
... | true |
2abfb20bd3afbf4da1499d45441b9f5624e2f452 | Python | liangb02/loan_assistant | /app/learning/rej_data_processing.py | UTF-8 | 3,921 | 3.046875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from model import Model_Pipeline
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from text_analysis import bag_of_words
from nlp_feature_extraction import title_length, keyword
'''
This module is... | true |
b7900c4ebdcfa710fc9ac4533a0dd9e09db26289 | Python | asad632/Python | /comprhrnsion1_list.py | UTF-8 | 518 | 4.1875 | 4 | [] | no_license | # # List Comprehension with if statement
# number = [1,2,3,4,5,6,7,8,9,10]
# new_nums = []
# odd=[]
# for i in number:
# if i%2==0:
# new_nums.append(i)
# else:
# odd.append(i)
# print(new_nums)
# print(odd)
# # list comprehension
# even_number = [i for i in number if i%2 == 0]
# odd_number = [... | true |
97e63bd2bcafb174502486d586a7ce4f33a3bf88 | Python | MartinFoche/Algoritmos-y-Estructura-de-datos | /tp_lista/tda_lista.py | UTF-8 | 1,585 | 3.203125 | 3 | [] | no_license | class nodoLista(object):
def __init__(self):
self.info = None
self.sig = None
class Lista(object):
def __init__(self):
self.inicio = None
self.tamanio = 0
def insertar(lista, dato):
nodo = nodoLista()
nodo.info = dato
if(lista.inicio is None or ... | true |
27773a07442dffb813b2a101eaba96d41c6435df | Python | cs-fullstack-2019-spring/python-review3-cw-PorcheWooten | /classwork.py | UTF-8 | 2,305 | 4.5 | 4 | [] | no_license | # calls problem being viewed!
def main():
# problem1()
# problem2()
problem3()
# Given a number n, return True if n is in the range 1..10, inclusive. Unless outside_mode is True, in which case return True if the number is less or equal to 1, or greater or equal to 10. Print the result returned from your f... | true |
a63862609769f79118f230d5c8d88f973b83c7c1 | Python | natalka1122/advpyneng-online-2-sep-nov-2020 | /examples/04_pytest_basics/test_check_password_func_input_getpass.py | UTF-8 | 520 | 2.796875 | 3 | [] | no_license | from check_password_function_input import check_passwd
import pytest
@pytest.mark.parametrize(
"user,passwd,min_len,result",
[
("user1", "123456", 4, True),
("user1", "123456", 8, False),
("user1", "123456", 6, True),
]
)
def test_check_passwd(monkeypatch, user, passwd, min_len, re... | true |
01114a82fe0cece50c80b1f9c4d672fa02b70457 | Python | monu234tonu/TriviaNationBot | /misc-cogs.py | UTF-8 | 98,833 | 2.546875 | 3 | [
"MIT"
] | permissive | #Included: doge, warm, cookie, eightball, coinflip, farm, sport/play
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord.utils import find
import asyncio
import logging
import os
import time
import requests
import random
from time import localtime, strftime
fr... | true |
201a9a9f9b0576acb9d0c950cb3ab67ddc806b02 | Python | badranarayana/Python_2021 | /1) Python_basic_programs.py | UTF-8 | 2,024 | 4.40625 | 4 | [] | no_license |
"""
1) Python program to add two numbers
"""
a = 10
b = 20
print(a+b)
# write code to get the user input
#a = int(input("Please enter num1 ")) # str
#b = int(input("Please enter num2")) # str
print(a + b)
# write a program to print first_name
full_name = '. --'#input("Please enter a full name")
if ' ' in full_name... | true |
99662e9465ef105f6fd43871bf5fffe1bb785221 | Python | marlee926335/build-a-blog | /main.py | UTF-8 | 2,054 | 2.6875 | 3 | [] | no_license | from flask import Flask, request, redirect, render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['Debug'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://build-a-blog:password@localhost:8889/build-a-blog'
app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)
c... | true |
c8d33459bf244a00a7f6af943be8916186dce816 | Python | rafa-santana/Curso-Python | /Aula 10/ex28.py | UTF-8 | 351 | 3.875 | 4 | [
"MIT"
] | permissive | import random
n = int(input('Advinhe o número que o computador está pensando. *Dica: ele está entre 0 e 5: '))
sorteio = random.randint(0,5)
if n==sorteio:
print('Parabéns, eu pensei no número {} e você advinhou!!!'.format (sorteio))
else:
print('Que pena, não acertou dessa vez... Pensei em {} mas você chutou ... | true |
9ab9ebae2071831336c514974b0dc4c7bd721247 | Python | Huijuan2015/leetcode_Python_2019 | /611. Valid Triangle Number.py | UTF-8 | 1,549 | 3.03125 | 3 | [] | no_license | class Solution(object):
def triangleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
#2 pointer, sort,
nums.sort()
res = 0
# 不需要去重
for third in range(2, len(nums)):
if nums[third] == 0:
continue
... | true |
6b941481a362e2f2e8a85a4861134e42d532ee71 | Python | usapes2/CodeJams | /lambda.py | UTF-8 | 1,058 | 4.25 | 4 | [] | no_license |
def f(x):
return 3*x + 1
# Anonymous Function = Lambda Expression
lambda x: 3*x + 1 # Can not use it like this, since it is anonymous
g = lambda x: 3*x + 1
print('f(x = 3) : ' + str(f(3)))
print('g(x = 3) : ' + str(g(3)))
full_name = lambda fn, ln: fn.strip().title() + ' ' + ln.strip().title()
print(full_name('... | true |
139513093b4b0c766da3449d8f3eb5ee500888b5 | Python | azurecloudkevin/azure-sphere-gallery | /MultiDeviceProvisioning/provision.py | UTF-8 | 4,547 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import time
import urllib.request
import json
from threading import Thread
import socket
import sys
import subprocess
import shutil
def done(device, ok):
if ok is None:
print("WARNING: per device action returned 'None' - assuming suc... | true |
b383128c5570d77e2ff8a12feb1c66d247256160 | Python | anjiannian/Udacity | /ascii.py | UTF-8 | 1,945 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import webapp2
import urllib2
from gaeHandler import Handler
from xml.dom import minidom
from time import sleep
from google.appengine.ext import db
GMAPS_URL = "http://maps.googleapis.com/maps/api/staticmap?size=380x263&sensor=false&"
def gmaps_img(points):
markers = '&'.j... | true |
865444896c99304843f2e6089e89399f41de9a56 | Python | Jondes/Python | /While.py | UTF-8 | 215 | 4.15625 | 4 | [] | no_license | data = [ ]
while True:
name = input('Enter the name :')
data.append(name)
choice = input('Enter another name ??:')
if choice.casefold() == 'n':
break
for element in data:
print(element)
| true |
9351ccc1cfd7b83b7239ba5d914d11596dca155a | Python | curtischung/CS-491-blackjack | /card.py | UTF-8 | 717 | 4.0625 | 4 | [] | no_license | class Card:
def __init__(self, suit, value):
self.suit = suit
self.value = value
def cardValue(self):
return self.value
def show(self):
if(self.value == 11):
print("{} of {}".format("Jack", self.suit))
return True
elif(self.value == 12):
... | true |
50d54c5cd257b8045c4208d6854b0349e992b8a7 | Python | DuyToanIT/Fruit-Image-Recognition | /initData.py | UTF-8 | 670 | 2.71875 | 3 | [] | no_license | """
Code by Tu Thanh Nguyen
Date : September 17, 2017
Last Update: September 18, 2017
"""
from PreProcessing.PreProcessing import ScaleImage
import os
import os.path
PATH = 'Data-Raw/'
Validate = 'Validate/'
Labels = os.listdir(PATH)
SIZES = 512, 512
count = 0
for label in Labels:
print "Resize image processing ... | true |
f672a6e4d0327043c9ca4383eafafd218de87eb5 | Python | VINCENT101132/vincent1 | /20210713/class/1.py | UTF-8 | 124 | 3.734375 | 4 | [] | no_license | number=int(input("整數"))
if (number%2)==0:
print("偶數")
elif (number%2)==1:
print("奇數")
else:
print('error') | true |
753b39738a419f812c4647db2ec4eabd929c01ee | Python | prectechadmin/kafka-pyspark | /Producer/producer_start.py | UTF-8 | 475 | 2.625 | 3 | [] | no_license | from kafka import KafkaProducer
from kafka.errors import KafkaError
from random import randint,uniform
import json,time
time.sleep(50)
producer = KafkaProducer(bootstrap_servers=['kafka_cluster:9092']
, value_serializer=lambda m: json.dumps(m).encode('ascii')
)
for n in range(... | true |
5a287b325f31a4c536474f03c85bbdea4213cbe3 | Python | Anaivbvo/CSE | /notes/Anai S.L. Lopez - Challanges.py | UTF-8 | 1,455 | 4.78125 | 5 | [] | no_license | """
Easy:
1. Write a Python program which accepts the user's first and last name and print them in reverse order with a space
between them.
"""
print("Anai", "Lopez")
namelist = ["Anai", "Lopez"]
namelist. reverse( )
print(namelist)
"""
2. Write a Python program to find whether a given number (accept from the user) i... | true |
54d10c366da22d95909c3c7fc29fd5744e33aeee | Python | drordotan/trajtracker | /src/trajtracker/misc/_PictureSet.py | UTF-8 | 6,563 | 3.296875 | 3 | [] | no_license | """
Picture set: A dictionary-like interface for a set of named pictures
@author: Dror Dotan
@copyright: Copyright (c) 2017, Dror Dotan
"""
from enum import Enum
import re
from expyriment.stimuli import Picture
import trajtracker
class PictureSet(trajtracker._TTrkObject):
"""
A class that holds a set of ... | true |
7be6150e28d745e60056e021d553c4cbf703a991 | Python | neuroph12/nlpy | /nltks/treebanks.py | UTF-8 | 465 | 2.953125 | 3 | [] | no_license | import nltk
from nltk.corpus import treebank
# show samples of treebank
t = treebank.parsed_sents('wsj_0001.mrg')[0]
# print(t)
# filter sentential complements
def filter(tree):
child_nodes = [child.label() for child in tree if isinstance(child, nltk.Tree)]
return (tree.label() == 'VP') and ('S' in child_node... | true |
0bd5e4d34f7e9bc4691e0753dcdca000bc11fd3f | Python | lizhihui16/aaa | /pbase/day04/ll.py | UTF-8 | 5,162 | 4.53125 | 5 | [] | no_license | # 输入三行文字,让这三行文字依次以20个字符的宽度右对齐输出
# 如:
# 请输入第1行: hello world
# 请输入第2行: abcd
# 请输入第3行: a
# 输出结果为:
# hello world
# abcd
# a
# 做完上面的题后再思考:
# 能否以最长字符串的长度进行右对齐显示(左侧填充空格)
# # print('%20s' % "hello world")
# print('%20s' % 'abcd')
# print('%20s' % 'a')
# a=input('')
# b=input()... | true |
72de0b444f34c2c187d19cb4190dcb9028032530 | Python | wcphkust/WebQA | /lib/json_parser.py | UTF-8 | 5,178 | 2.78125 | 3 | [] | no_license | import json
from typing import Dict
from lib.tree import ParseTree, ListTree
class JsonParser:
def __init__(self):
pass
def run_parser(self, file_path, file_name) -> ParseTree:
pt = self.parse_json("{}/{}.json".format(file_path, file_name))
pt.construct_index()
pt.file_name = ... | true |
71217e265c1a0add9f7eea61deb6d6a12a3a0e04 | Python | samkohn/dyb-event-selection | /dyb_analysis/batch_processing/dynamic_run_full_process_adtime.py | UTF-8 | 3,630 | 2.90625 | 3 | [] | no_license | """Dynamically pick a good set of runs to process."""
import argparse
import itertools
import subprocess
import sys
import time
import common
def get_unfinished_runs(progress_db):
"""Get the list of runs which have not completed SubtractAccidentals."""
with common.get_db(progress_db) as conn:
cursor ... | true |
711e36aa4516f4b14e22d11d5bc88139d6c05f05 | Python | kimurakousuke/MeiKaiPython | /chap09/list0928.py | UTF-8 | 221 | 3.5625 | 4 | [] | no_license | # 添加了标注的函数puts
def puts(n: int, s: str) -> None:
"""连续打印输出n个s"""
for _ in range(n):
print(s, end='')
puts(5, '*')
print()
print(puts.__annotations__)
print()
puts('*', 5)
| true |
6976012807dfaaa3fa7049201de4f48892df074c | Python | FriedrichBar/MazeGenerator | /Display.py | UTF-8 | 1,053 | 3.53125 | 4 | [] | no_license | from ImagesUtils import empty_img, write_img
from Maze import *
def mazeToPixels(Maze, startingCell):
"""
Transforms a maze(matrix) into pixels
IN: Maze(matrix)
OUT: pixels
"""
startingCellX = startingCell[0]
startingCellY = startingCell[1]
# Fetching size of the maze
pixels = emp... | true |
b2dadd91b0aaf0652a17491bff122b5b844bc314 | Python | DaniellyCarvalho/2021.1-ProgComp | /2021_07_26/exemplo_lista_05.py | UTF-8 | 1,110 | 3.078125 | 3 | [] | no_license | lista_estados = [ ['BA', 'Salvador' , 2872000 , ['BA_1', 'BA_2', 'BA_3'] ],
['RN', 'Natal' , 884000 , ['Parnamirim', 'Mossoró', 'Caicó'] ],
['CE', 'Fortaleza' , 2669000 , ['CE_1', 'CE_2', 'CE_3'] ],
['PE', 'Recife' , 1645000 , ['PE_1', 'PE_2', 'PE_3'] ]... | true |
41778de1c8feecb76f5680db7889b28689ca99ce | Python | balapitchuka/python-utilities | /map-reduce-improvements/specific/complex-mapper.py | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | import sys
def main():
for each_line in sys.stdin:
words = each_line.strip().split("\t")
count = words[0]
for letter in words[1].strip().split(","):
print(count+","+letter+"\t1")
if __name__ == '__main__':
main() | true |
e9e7295b547e823edd36ba98a3c73d46137857a8 | Python | jhlax/curriculum | /curriculum/day_1.py | UTF-8 | 4,038 | 3.9375 | 4 | [] | no_license | """
Curriculum - Comp Sci in Python and C
=====================================
Section 1
---------
I will use Python as a *pseudocode* primarily, with C being the actual language of learning
for at least a few lessons. Learning types, functions, arrays, pointers, then the compiler
as a tool is first. Mixed in throug... | true |
6bde124f4108422bc0641398052b3785ae6e4cf5 | Python | lechemrc/cs-module-project-hash-tables | /applications/expensive_seq/expensive_seq.py | UTF-8 | 1,123 | 3.40625 | 3 | [] | no_license | cache = {}
def expensive_seq(x, y, z):
"""
if x <= 0: y + z
if x > 0: exps(x-1,y+1,z) + exps(x-2,y+2,z*2) + exps(x-3,y+3,z*3)
"""
result = 0
if x <= 0:
result = y + z
elif (x, y, z) in cache:
result = cache.get((x, y, z))
else:
result = expensive_seq(x-1,... | true |
94b1bb3b6610daf9ca6edbc5fa9ffd64f0137115 | Python | beforeuwait/webCrawl | /old code/Demo/demo.py | UTF-8 | 1,121 | 2.8125 | 3 | [] | no_license | # coding=utf8
'''这是一个爬虫脚本,model和ua从别的类来调用'''
from userAgent import user_agent_list
from sqlalchemy.orm import sessionmaker
from sqlEngine import Base, eng
from models import User
import requests
import random
class Demo():
def __init__(self):
'''初始化内容'''
self.headers = {
'host': '主机地址'... | true |
5c0e281b75d60ca5bc3a384fa067158aea3d12b0 | Python | sayloren/anise | /dep_flowchart.py | UTF-8 | 671 | 3.125 | 3 | [] | no_license | """
Script to make flow chart
Wren Saylor
August 5 2017
https://github.com/pygraphviz/pygraphviz/blob/master/examples/star.py
"""
import argparse
import pygraphviz as pgv
def makeFlow():
A=pgv.AGraph()
A.add_edge('Input Data as .csv Files','Run Main Script with Options')
A.add_edge('Run Main Script with Option... | true |
8c0645df0ad586dcad8047ca51af74fa0da2b493 | Python | neilharvey/AdventOfCode | /2020/Day5/day5.py | UTF-8 | 803 | 3.390625 | 3 | [] | no_license | import sys
def read_boarding_passes(path):
with open(path) as f:
return f.read().splitlines()
def get_seat_number(boarding_pass):
bin = boarding_pass.translate({ord('B'):'1', ord('F'):'0', ord('R'):'1', ord('L'):'0'})
row = int(bin[0:7], 2)
col = int(bin[-3:], 2)
return (row, col)
def ge... | true |
9f5f87f118edb3acf145c5aed50a344414a7a2b2 | Python | dhlab-basel/0827-pou-scripts | /Data Modification/clean.py | UTF-8 | 1,538 | 2.796875 | 3 | [] | no_license | import pandas as pd
from pprint import pprint
file = pd.read_excel('helper files/Places names POU_vkedits_2SEP (1).xlsx', 'Vilayet names')
def removeDuplicates():
store = []
delStack = []
for i in range(0, len(file.index)):
data = {'sanjak': '', 'vilayet': '', 'correction': '', 'sanarm': '', 'vilar... | true |
ba55f0fda11a6aef72c23ec88dde40b91db668c9 | Python | pu1et/algorithm | /baekjoon/greedy/2812/2817.py | UTF-8 | 435 | 2.796875 | 3 | [] | no_license | import sys
from queue import PriorityQueue
N, K = map(int, sys.stdin.readline().split())
K = N-K
tmp = list(map(int, sys.stdin.readline().rstrip()))
arr = PriorityQueue()
for i in range(N-K+1):
arr.put([-tmp[i],i])
num, last_idx = arr.get()
print(-num, end='')
for i in range(N-K+1, N):
arr.put([-tmp[i],i])
wh... | true |
2e3d9b4cc797a9b465ab902f064d06593927dbe6 | Python | juddc/Dipper | /dip/basicio.py | UTF-8 | 2,584 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
from rpython.rlib.objectmodel import we_are_translated
if we_are_translated():
from rpython.rlib.streamio import open_file_as_stream
def readall(filename):
if not file_exists(filename):
raise IOError(filename)
# must catch WindowsError here or it won't compile ... | true |
e59a9441cb2bea99a794e0f112a2a8fc1d6e822b | Python | ApplePie420/CueSheetGenerator | /cuefilegenerator.py | UTF-8 | 2,269 | 2.53125 | 3 | [] | no_license | import os
import sys
import traceback
def write_cue_file(performer, title, file, tracks, tracks_timestamp, savePath):
f = open(savePath + title + ".cue", "w")
# check if all of data is present
if(performer == ""):
print("Performer not specified!")
return 1
elif(title == ""):
pri... | true |
5122191be1f0c9f90d326e436817fbfddd0c61e7 | Python | ben-mackenzie/mst-kruskal | /graph.py | UTF-8 | 2,407 | 3.609375 | 4 | [] | no_license | '''
Created on Apr 2, 2018
@author: benjaminmackenzie
'''
class Graph:
'''Representation of an undirected graph using an adjacency map'''
class Vertex:
'''creates vertex objects for graph'''
__slots__ = '_element'
def __init__(self, x):
'''graph's insert_verte... | true |
b10b42aeed507b1b76918b597d562237484ebbad | Python | vblaker/My_Tutorials | /Tutorials/List_directory.py | UTF-8 | 259 | 3.28125 | 3 | [] | no_license | import os
file_list = os.listdir(r".")
print("Current Path is %s" % os.getcwd())
print(file_list)
print("There are %d files in this directory" % len(file_list))
for file_name in file_list:
os.renames(file_name, file_name.translate("0123456789")) | true |
fbbe750c1232d4eb79ee67025762802a93996db7 | Python | capslockd/test | /unit_testing/mycode.py | UTF-8 | 392 | 2.78125 | 3 | [] | no_license | class unittest_sample():
def hello_world(self):
return 'hello world'
def create_num_list(self, length):
return [x for x in range(length)]
def custom_func_x(self, x, const, power):
return const * (x) ** power
def custom_non_lin_num_list(self, length, const, power):
retu... | true |
3ea10cb50f1e80c6b9ed468e26daf694eb247cdf | Python | miyamotohk/context-tree-compression | /ct/ct_draw.py | UTF-8 | 3,384 | 3.328125 | 3 | [
"MIT"
] | permissive | ################################################
# Context-tree functions
################################################
import os
### Main function
def drawTree(root, type, filename='tree', show_probs=False):
"""
Draw a context-tree as a LaTeX file.
Inputs:
root: root node of the tree
type: 'CTW... | true |
bef70d814aa4b6de610155977d996df2ba586417 | Python | NaychukAnastasiya/goiteens-python3-naychuk | /lesson_5_work/Ex1.py | UTF-8 | 88 | 2.84375 | 3 | [
"MIT"
] | permissive | simpsons = ["Гомер","Мардж","Ліза","Барт","Мегі"]
print(simpsons) | true |
427709dc60f89cb3748f1a8c9c5e4049fe559e0d | Python | dgarlitt/release_notes_generator | /tests/git_tests.py | UTF-8 | 7,523 | 2.53125 | 3 | [
"MIT"
] | permissive | import mock
from nose.tools import eq_, ok_, raises
import subprocess
from lib.git import TAG_CMD, LOG_CMD, CMT_CMD, ADD_CMD
from lib.git import PUSH_CMD, PULL_CMD, FETCH_CMD, CHECKOUT_CMD
from lib.git import LOG_SEPARATOR
from lib.git import Git
# def log_for_tag_side_effect(cmd):
# if 'tag' in cmd:
# retu... | true |