blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
00ccabca272902bdb95981e4071b71dd97536bfb | Python | jmberros/stem-loop | /bin/slice-fastas.py | UTF-8 | 2,272 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
#-*- encoding:utf-8 -*-
import sys
import os
import argparse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
def slice_fasta(filename, subseq_name, start, end, subdir):
# "Negative" nucleotides won't work for the slicing
if start < 0:
start = 0
print "Warning! {} ha... | true |
ca2345559a8d296488f1031b2382db71af57b8e4 | Python | AkaiTobira/TetrisAgents | /Libraries/game_master.py | UTF-8 | 2,572 | 2.84375 | 3 | [] | no_license | import pygame
import time
import enum
from Libraries.Structures.tetrisGame import Tetris
from Libraries.game import Game
from Libraries.presenter import Presenter
from Libraries.tester import Tester
from Libraries.consts import *
class GameState(Enum):
LearningApp = 1,
PresentingApp = 2,
TestingApp = 3... | true |
4b32154f1f0fd3a8598c61f26d510ca1b5575df9 | Python | cryptolovers-tipbots/words2binary_converter | /Words2Binary.py | UTF-8 | 1,700 | 3.4375 | 3 | [] | no_license | # Auto converter words to Binary or hex(later)
s = input()
def binary(input):
encrypt = {'A': '01000001', 'B': '01000010', 'C': '01000011', 'D': '01000100', 'E': '01000101', 'F': '01000110',
'G': '01000111', 'H': '01001000', 'I': '01001001', 'J': '01001010', 'K': '01001011', 'L': '01001100',
... | true |
07ead8857ccba543a15f3123d5f6a190201148a7 | Python | maina2998/python_test.py | /python_test.py | UTF-8 | 1,048 | 4.03125 | 4 | [] | no_license | y =[]
x =[100,110,120,130,140,150]
for d in x:
if d * 5:
y.append(x)
print(x)
def divisible_by_three(n):
for x in n:
n = 10
if x % 3 == 0:
print("{} is divisible by three".format(x))
else:
print("{} is not divisible by three".format(x))
y =[... | true |
00502f082d3df5472daae4246cdbe3902234482f | Python | KimYeong-su/Baekjoon | /python/1074_Z.py | UTF-8 | 1,335 | 3.359375 | 3 | [] | no_license | '''
1074_Z
sol) col과 row의 나머지를 통해 어느만큼의 값이 더해져야하는지를 판단
또한 가장 큰 사각형에서 점점 작아질 수록 4의 배수로 나눠진다는 것을 생각!!
정사각형의 넓이는 길이의 제곱의 비례 한다는 거.. 이걸 놓치면 힘듭니다.
진짜 코드를 더럽게 짰는데 각각의 row는 2의 배수로 커지고 col은 1씩 커진다는 점을 생각해
그냥 2진수로 바꿔서 자리마다의 크기를 이용한다면 단 2줄로 풀수 있다는 점..
'''
def z_potition(size, tr, tc, result):
global answer
if size==0:
... | true |
9791deeec7c9c5bef473bdb48113f4d4d71d9fe4 | Python | donadivarun/MLCMS | /MLCMS-master/gui2.py | UTF-8 | 3,659 | 2.859375 | 3 | [] | no_license | import wx
import sys
import system as model
import json
def initialize_system(file_name):
"""
Reads the scenario file and initializes the system
:param file_name:
:return:
"""
with open(file_name) as scenario:
data = json.load(scenario)
rows = data['rows']
cols = data['cols']
... | true |
52b3000009ce20e2c3a9c0f234055086a168376e | Python | ek-ok/deep-cupid | /char_rnn.py | UTF-8 | 5,689 | 2.71875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
class CharRNN():
def __init__(self, char_to_ind, batch_shape, rnn_size, num_layers,
learning_rate, grad_clip, predict=False):
self.char_to_ind = char_to_ind
self.num_classes = len(char_to_ind)
self.num_samples, self.num_chars = ba... | true |
ddcef4292b9c34a778cfcd88fd208dee31fd7b5f | Python | PaulHancock/Aegean | /tests/unit/test_cluster.py | UTF-8 | 5,404 | 2.578125 | 3 | [
"AFL-3.0"
] | permissive | #! /usr/bin/env python
"""
Test cluster.py
"""
import logging
import math
from copy import deepcopy
import numpy as np
from AegeanTools import catalogs, cluster, wcs_helpers
from AegeanTools.models import SimpleSource
from astropy.io import fits
__author__ = 'Paul Hancock'
logging.basicConfig(format="%(module)s:%(le... | true |
eea41ede11f47409661461ed44a93ce333cfc195 | Python | dillonhicks/ipymake | /branches/devel-0.2-alpha/examples/kusp/subsystems/datastreams/postprocess/headfilter.py | UTF-8 | 6,651 | 2.625 | 3 | [] | no_license | import filtering
import entities
import thread
import time
import inputs
import copy
import sys
class HeadFilter(filtering.Filter):
"""this is the first filter in a pipeline, and has an execution loop
which drives the rest of the pipeline"""
#debug_flag = True
def choose_next(self, entitydict):
"""entitydict i... | true |
6ab8b5bd3125eaf1e9ee191281a0f58a84de60d4 | Python | SvenGronauer/successful-ingredients-paper | /sipga/common/online_mean_std.py | UTF-8 | 2,115 | 3.21875 | 3 | [] | no_license | import numpy as np
import torch
class OnlineMeanStd(torch.nn.Module):
"""Track mean and standard deviation of inputs with incremental formula."""
def __init__(self, epsilon=1e-5, shape=()):
super().__init__()
self.mean = torch.nn.Parameter(torch.zeros(*shape), requires_grad=False)
sel... | true |
a3d0d6d3c2a5dbcea1ea61a641309af3c2db2502 | Python | clpetrie/nuclear | /notes/invertP/invertexpm2r.py | UTF-8 | 815 | 2.734375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import random as ran
from math import pi
num=100000
rmin=0.0
rmax=10.0
a=0.0
b=0.5 #max value of P
nbin=50
ranr=[]
r=[]
mybin=[]
for i in range(0,num):
temp=0.5*np.log(1/(2*ran.uniform(a,b))) #P=2*exp(-2r)
ranr.append(temp)
step=(rmax-rmin)/nbin
for i in range... | true |
d7b53b50a7fff94d3e480da4144cc43eb6b6e777 | Python | ibrahimsha23/prak_algo | /binary_search_algo.py | UTF-8 | 1,428 | 4.21875 | 4 | [] | no_license | import random
def generate_random_list():
# Generate Random List
random_list = random.sample(range(45), 34)
print("Random List is - {0}".format(random_list))
return random_list
def sort_list(rlist):
# Sorting - Insert Sort
for i in range(1, len(rlist)):
key = rlist[i]
positio... | true |
0d467a899abc4604bb898045005c4f6a2c953fb0 | Python | BohdanKryven/Python-Orion-basic- | /homework_14_decorators_practice/2_task.py | UTF-8 | 787 | 3.359375 | 3 | [] | no_license | class WrongType(Exception):
pass
class DecoratorTypeR:
def __init__(self, arg_1, arg_2, arg_3, arg_4):
self.arg_1 = arg_1
self.arg_2 = arg_2
self.arg_3 = arg_3
self.arg_4 = arg_4
def __call__(self, func):
def wrap(a, b, c):
try:
if isins... | true |
ab2bbd2026d9e3fe323a2dc3b818c4e26eb0dcef | Python | wattaihei/ProgrammingContest | /AtCoder/ABC-B/086probB.py | UTF-8 | 128 | 3.0625 | 3 | [] | no_license | a, b = map(str, input().split())
X = int(a+b)
ans = 'No'
for x in range(1001):
if x**2 == X:
ans = 'Yes'
print(ans) | true |
3685311cffcce1a0c2491daf109d624eeb457c58 | Python | Kingdon065/Replace | /Color/color.py | UTF-8 | 931 | 2.859375 | 3 | [] | no_license | #! python3
# _*_ coding: utf-8 _*_
from colorama import init, Fore
init(autoreset=False)
class Colored:
# 前景色:红色 背景色:默认
def red(self, s):
return Fore.LIGHTRED_EX + s + Fore.RESET
# 前景色:绿色 背景色:默认
def green(self, s):
return Fore.LIGHTGREEN_EX + s + Fore.RESET
# 前景色:黄色 背景色:默... | true |
0c4198d0c08425db431d48b058d8caf814226ef1 | Python | gannaramu/LeetCode-1 | /python/140_Word_Break_II.py | UTF-8 | 1,415 | 3.8125 | 4 | [
"MIT"
] | permissive | """
Given a non-empty string s and a dictionary wordDict
containing a list of non-empty words, add spaces in s to
construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
Note:
The same word in the dictionary may be reused multiple times in the segmentation.
You may assu... | true |
10260e79086a7c836e91b11e541b21d38a755d98 | Python | avi9839/document-converter | /txt2doc.py | UTF-8 | 458 | 2.59375 | 3 | [] | no_license | from docx import Document
import re
import os
path = '/home/tusharsk/Desktop/game_is_on'
direct = os.listdir(path)
for i in direct:
document = Document()
document.add_heading(i, 0)
myfile = open('/home/tusharsk/Desktop/game_is_on/'+i).read()
myfile = re.sub(r'[^\x00-\x7F]+|\x0c',' ', myfile) # remove ... | true |
de0b738356aa1a45510eedba72ab78386f8952ed | Python | allenmattp/automate | /ch12/tickerScraper.py | UTF-8 | 2,249 | 2.84375 | 3 | [] | no_license | import bs4, requests
def getQuote(ticker):
site = "https://finance.yahoo.com/quote/" + ticker
res = requests.get(site)
res.raise_for_status() # make sure yahoo is talking to us
# collect selections from site
soup = bs4.BeautifulSoup(res.text, "html.parser")
last_price = soup.select("#quo... | true |
2443120e25bc81bb1738c5c338252adb0902dc8e | Python | Helga-Helga/consistency-constraints-recognition | /lab2_max_flow/src/utils.py | UTF-8 | 1,755 | 3.421875 | 3 | [] | no_license | from numpy import (
dot,
zeros,
reshape,
where,
array,
clip,
)
lookup_table = zeros((256, 256))
for i in range(256):
for j in range(256):
lookup_table[i, j] = (i - j) ** 2
def neighbor_exists(i, j, neighbor_index, height, width):
"""Returns True if a given neighbor exists for ... | true |
67c70519ed71add7dfe8f00c4366839f393811f8 | Python | chenliang15405/python-learning | /study_day05-多任务/协程/01_迭代器.py | UTF-8 | 1,888 | 4.96875 | 5 | [] | no_license | """
int 类型不是可迭代的类型,所以不可以直接迭代
for i in range(10):
print(i)
这种不是遍历int类型,是遍历一个列表,range(10) 是创建一个1-10的列表
元组、列表、字典、字符串都是可迭代类型,数字类型都是不可以迭代的类型
想要创建的对象可以迭代,需要重写__iter__方法,并且该方法需要返回一个对象的引用(这个对象中必须包含__iter__ 和__next__方法)
"""
from collections.abc import Iterable
print(isinstance("123", Iterable))
""" 自己实现一个可迭代的对象... | true |
4c78d3b4d2c237dc31feca8337e6a62136693e85 | Python | xuelang201201/PythonCrashCourse | /数据可视化/动手试一试/die_visual.py | UTF-8 | 872 | 3.546875 | 4 | [] | no_license | """
自动生成标签:请修改 die_visual.py 和 dice_visual.py,将用来设置hist.x_labels值的列表替换为一个自动生成这种列表的循环。
如果你熟悉列表解析,可尝试将 die_visual.py 和 dice_visual.py 中的其他 for 循环也替换为列表解析。
"""
import pygal
from die import Die
# 创建一个D6
die = Die()
# 掷几次骰子,并将结果存储在一个列表中
results = [die.roll() for roll_num in range(1000)]
# 分析结果
frequencies = [results.cou... | true |
617e96aaf22739c43607d6d7833a6e59e23e9799 | Python | aarsh-sharma/Competitive-Programming | /CodeChef/KS2.py | UTF-8 | 209 | 3.78125 | 4 | [] | no_license | def sumDigit(n):
s = 0
while (n > 0):
s += n % 10
n = n//10
return s
t = int(input())
while(t):
t -= 1
n = int(input())
n *= 10
while (sumDigit(n) % 10 != 0):
n += 1
print(n)
| true |
5849576132c0d77baae374f9467dc3f1a9065ca7 | Python | isabella232/ignite-python-thin-client | /examples/get_and_put_complex.py | UTF-8 | 2,239 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | true |
01b3ee1be227019b6144e997fd8bffff6616c94c | Python | lyssym/NER-toolkits | /keras_kit/multi/runModel.py | UTF-8 | 1,305 | 2.78125 | 3 | [
"MIT"
] | permissive | # _*_ coding: utf-8 _*_
from __future__ import print_function
import nltk
from .util.preprocessing import addCharInformation, createMatrices, addCasingInformation
from .neuralnets.bilstm import BiLSTM
import sys
if __name__ == '__main__':
if len(sys.argv) < 3:
print("Usage: python runModel.py modelPath i... | true |
eff1ff235bf5c6df5c41a9a7f7a650ef44b9dbf3 | Python | ThomasZumsteg/adventofcode2015 | /day16.py | UTF-8 | 1,860 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
from get_input import get_input, line_parser
import operator
def filter_aunts(aunts, props):
for prop, test in props.items():
new_aunts = {}
for a, props in aunts.items():
if prop not in props or test(props[prop]):
new_aunts[a] = props
au... | true |
e13593c50e95055a4b5dcd06844ef470cf92137f | Python | xuming0629/xm-study | /xm-study/python-test/yearif.py | UTF-8 | 252 | 3.609375 | 4 | [] | no_license | year=int(input("请输入一个年份:"))
if(year%400==0):
print("是闰年")
else:
if(year%4==0):
if(y%100==0):
print("不是闰年")
else:
print("是闰年")
else:
print("不是闰年")
| true |
78c582ff6fd7db8ea5bc3359baf7d79fd8f9d16f | Python | GbotemiB/Simple-Tasks | /factorial.py | UTF-8 | 212 | 3.921875 | 4 | [] | no_license | def fact(n):
if n == 1:
return 1
return n*fact(n-1)
factorialOf = int(input("Enter the number which you seek to find it factorial \n"))
print("Factorial of %s :" % factorialOf,fact(factorialOf))
| true |
a8eec4e77b38e9da8579d3103a0aa55c4db6b92b | Python | pip-install-HSE/TelegramCalendarBot | /bot/keyboards.py | UTF-8 | 5,592 | 2.8125 | 3 | [] | no_license | import calendar
import re
from bot.modules.keyboard import KeyboardInline, KeyboardReply
from aiogram import types
from datetime import datetime, timedelta
import locale
import logging
def toArray(object):
if type(object) == type([]):
array = object
elif type(object) == type("string") or type(object)... | true |
5a16b99cd35a0c482ea68dfb9a1f4ea64b7123b7 | Python | gochab/project_calculate_it | /chapter_03.py | UTF-8 | 340 | 4.125 | 4 | [] | no_license |
def addition():
first_number = 30
second_number = 60
print(first_number + second_number)
addition()
def multiplication():
first_number = 50
second_number = 20
print(first_number * second_number)
multiplication()
def height():
heigh = raw_input("What is you weight?")
print ("You mesure... | true |
5ffee59e643d7500b9e597a144fb53a9eccb1e21 | Python | Aasthaengg/IBMdataset | /Python_codes/p02791/s670187435.py | UTF-8 | 141 | 2.96875 | 3 | [] | no_license | n=int(input())
p=list(map(int,input().split()))
t=0
ans=0
for i in range(n):
if t>=p[i] or t==0:
ans+=1
t=p[i]
print(ans) | true |
a6e390341a306666fba93983a088eee864bfe5d4 | Python | KristoferSundequist/Slider | /Dreamer/simple_slider.py | UTF-8 | 3,905 | 3.46875 | 3 | [] | no_license | from graphics import *
import numpy as np
import globals
from typing import List
##########
## GAME ##
##########
width = globals.width
height = globals.height
def clear(win):
for item in win.items[:]:
item.undraw()
win.update()
class Slider:
def __init__(self):
self.reset()
def r... | true |
65f00fd9f6863140b9ceff7cbd51bfe9ef9f5322 | Python | liquor1014/blog | /blog.py | UTF-8 | 2,905 | 2.96875 | 3 | [] | no_license | import os
from flask import Flask, render_template, request, redirect
from flask_sqlalchemy import SQLAlchemy
#初始化程序和数据库
app = Flask(__name__) #创建应用程序对象;
basedir = os.path.abspath(os.path.dirname(__file__)) #获取当前目录的绝对路径;
# print(__file__)
# print(basedir)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.p... | true |
1cb1a8b1cddf5b396d9052564010a32d0a25529e | Python | abawgus/Trolin | /DONTTOUCH/TerminalDrivenBackend.py | UTF-8 | 1,213 | 3.15625 | 3 | [] | no_license | c=0
#class bg(self):
# def f(self):
# if bg =='AC':
# pass
#loc='url'
#class Person(name):
# """who the player is interacting with"""
# if name=='Storey':
# pass
while c is 0:
var=raw_input("Hey welcome to your freshman year! I'm your sibb! It's my job to teach you t... | true |
1eb2b793f16fea465fd011b211e4e3c031920fee | Python | jornbergmans/snippets | /02_python/discord/raidcalendar.py | UTF-8 | 487 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import discord
TOKEN = 'NjAzMTQxMTQ5NjM2Njg5OTIw.XTbM3w.2VE73TyajD6kg0h2yh0KDYUAZog'
client = discord.Client()
@client.event
async def on_message(message):
if message.author.id == client.user.id:
return
if message.content.startswith('!hello'):
msg = 'Hello {0.author.m... | true |
7622a94abc9a369c6e7e4349366666b3987e0d80 | Python | waynewu6250/LeetCode-Solutions | /852.peak-index-in-a-mountain-array.py | UTF-8 | 493 | 2.90625 | 3 | [] | no_license | #
# @lc app=leetcode id=852 lang=python3
#
# [852] Peak Index in a Mountain Array
#
# @lc code=start
class Solution:
def peakIndexInMountainArray(self, A: List[int]) -> int:
left = 0
right = len(A)-1
while left + 1 < right:
mid = (left+right) // 2
if A[mid]... | true |
7c008ac508328fca8a3c2151a78d75e7991c8fc0 | Python | OdedMous/Imbalanced-Dataset | /adversarial.py | UTF-8 | 5,855 | 3.15625 | 3 | [] | no_license | import copy
import models
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import visualizations
def adversarial_optimizing_noise(model, org_img, true_label, target_label, regularization="l1"):
"""
Creates an adversarial image by o... | true |
48a0d471d4d94049b6bd782f407c0785138e09ab | Python | Bryan-Brito/IFRN | /TESTES LEGAIS/PYCODEBR V1.py | UTF-8 | 120 | 2.9375 | 3 | [] | no_license | import socket as s
host = 'google.com'
Ip = s.gethostbyname(host)
print('O IP do Host"' + host + '" é: ' + Ip) | true |
33e64556876207cd729514503501f1a89c7e92f1 | Python | Hellofafar/Leetcode | /Easy/566.py | UTF-8 | 2,173 | 4.09375 | 4 | [] | no_license | # ------------------------------
# 566. Reshape the Matrix
#
# Description:
# In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.
# You're given a matrix represented by a two-dimensional array, and two positive integers ... | true |
25847034ca11c46e1a8b7ead090e54eb293eed4f | Python | nbyouri/LINGI2261-AI | /Assignment3_Siam/basic_agent.py | UTF-8 | 2,220 | 3.390625 | 3 | [] | no_license | from agent import AlphaBetaAgent
import minimax
from state_tools_basic import rocks
from constants import*
"""
Agent skeleton. Fill in the gaps.
"""
class MyAgent(AlphaBetaAgent):
"""This is the skeleton of an agent to play the game."""
def get_action(self, state, last_action, time_left):
"""This fu... | true |
7a7e8b7b1ef0e01596216343dedb4b739df641b7 | Python | kurakura1412/luna-offlineserver | /_z_python/sorting.py | UTF-8 | 1,755 | 2.671875 | 3 | [] | no_license | #! python
# readonly data. do not edit. [ "name", index, position, special_id]
mdata =[
["EMPTY_C", 999999, 0, 874],
["Potion x5", 200012, 1, 875],
["Potion x20", 200012, 2, 556],
["Magicgong", 200014, 3, 235],
["Ether", 200015, 4, 587],
["Elixir", 200016, 5, 547],
["Megalixir", 200017, 6, 897],
["Enfuss", 20... | true |
aab69da308b59b71d66e7471c89ff487891c81b8 | Python | gianheck/MeshSim | /scripts/chainsim/pp_scripts/tabulate | UTF-8 | 3,379 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
import re
import getopt
def build_table(file_name):
tbl = {}
# Read table data
fp = open(file_name, 'r')
for l in fp:
l = l.strip()
if len(l) == 0:
continue
l = l.split(' ')
if l[0] == 'file':
size = int(re.sear... | true |
2f8fcd1904edea9207a65cd3bc15b581e6067a87 | Python | elginbeloy/trading | /backtester/strategies/macd_strat_1.py | UTF-8 | 2,821 | 3.09375 | 3 | [] | no_license | from ta.trend import MACD, SMAIndicator
from ta.volume import MFIIndicator
from strategy import Strategy
from utils import has_n_days_data
# Risk 5% of capital per trade by default (weighted by probability)
DEFAULT_RISK_PER_TRADE = 0.05
# MACDStratOne: MACD has positive slope and crosses signal
# in a not already ove... | true |
3372917ecee2767485fed41bbf9e6312df417da6 | Python | robobrobotcop/shadow-boys | /mtg-card-sale/mtg_card_sale.py | UTF-8 | 2,522 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import requests
import os
from datetime import datetime, timedelta
from retry import PostFailure, retry
today = datetime.utcnow()
update = datetime.utcnow() - timedelta(1)
@retry(PostFailure)
def get_api_data(user):
response = requests.post(user['url'], data="""{
me {
... | true |
3f3ccc6581092bb7d5597140a1002fc776b32300 | Python | xkdytk/Algorithm | /sort/count_sort.py | UTF-8 | 430 | 3.640625 | 4 | [] | no_license | def count_sort(array):
sort_arr = []
count = [0] * (max(array)+1)
index = 0
for i in array:
count[i] += 1
while index < len(count):
if count[index] != 0:
count[index] -= 1
sort_arr.append(index)
else:
index += 1
return sort_arr
prin... | true |
0ce217d67e7e19414eef48b1f32bd6c096f5799e | Python | FilaCo/upg | /src/ui/cli/group.py | UTF-8 | 338 | 2.890625 | 3 | [
"MIT"
] | permissive | from ui.cli.command import Command
class Group(Command):
def __init__(self):
self.__children = []
def render(self):
map(lambda x: x.render(), self.__children)
def add(self, child: Command):
self.__children.append(child)
@property
def children(self) -> list:
retur... | true |
82482d8ff1eda48ec89b610926534442d01510db | Python | shengexing/AlgorithmLearn_Python | /AlgorithmDiagram9787115447630/Chapter04/c04_2_quickSort/quickSort.py | UTF-8 | 604 | 4.1875 | 4 | [] | no_license | """ 快速排序 """
import random
# 快速排序的函数
def quickSort(array):
if len(array) < 2:
return array # 基线条件:为空或只包含一个元素的数组是 “有序” 的
else:
index = random.randint(0, len(array) - 1)
return quickSort(
[i for i in array[0:index] + array[index+1:] if i < array[index]]
) + [array[i... | true |
8ba754f530c78564917b39fcfdc001dcb9565e04 | Python | yanrising/bitez | /resources/bch/rates.py | UTF-8 | 391 | 2.6875 | 3 | [
"MIT"
] | permissive | from bitcash.network import satoshi_to_currency_cached, currency_to_satoshi_cached
def bch_to_fiat(amount, currency):
amount = amount * (10**8)
conversion = satoshi_to_currency_cached(amount, currency)
return conversion
def fiat_to_bch(amount, currency):
conversion = currency_to_satoshi_cached(amount,... | true |
63b4fbe597fa921d86f245d5116655c30c5c1876 | Python | AdityJadhao/pythonProject | /dictAndsets.py | UTF-8 | 587 | 3.703125 | 4 | [] | no_license | #dictonary is collection of key value pair
#create dictionary
myDic = {
"Power": "Knowledge",
"Aditya": "Student",
"Marks": [1,2,3,5],
"myDic2": {'Taste': 'Sweet'} #nested dictionary
}
print(myDic['Power'])
print(myDic['myDic2']['Taste'])
print(myDic.keys())
print(myDic.values())
print(myDic.items... | true |
339f92fa1047d62e6e31b14eee897410827930b9 | Python | jhl667/compbio-galaxy-wrappers | /nanostring/nanostring_client.py | UTF-8 | 2,114 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
## author: Janice Patterson
## targets nCounter MAX/FLEX system
import ftputil
from ftputil import FTPHost
import sys
import os
import json
class nCounter(FTPHost):
'''
inheriting from ftputil.FTPHost
'''
def download_datadir(self, source_dir, dest_dir):
'''
:pa... | true |
4346ca5735253e5fe63dec5e8aad40613eebcdb4 | Python | XiaoyanYang2008/IRS-MRS-F2M2HRSystem | /webapp/search.py | UTF-8 | 7,057 | 2.671875 | 3 | [] | no_license | import re
import string
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.neighbors import NearestNeighbors
import app_constants
import lk_parser
import normalizeText
class ResultElement:
def __init__(self, rank, n... | true |
a181148cb257c606cb3ef073ff4b6f515098cf0a | Python | alehander92/bach | /bach/opcodes.py | UTF-8 | 542 | 3.34375 | 3 | [
"MIT"
] | permissive | class Opcodes(object):
'''
a collection of cpython opcodes
for cleaner opcode comprehensions in generator
'''
def __init__(self, *values):
self.values = []
for value in values:
if isinstance(value, list):
data = Opcodes(*value)
self.values... | true |
aa7f217eff47d8554d688d062e303aa6cd4c3ff1 | Python | sanjiv576/Game | /rootPackage/agreement_file.py | UTF-8 | 3,916 | 2.84375 | 3 | [] | no_license |
from tkinter import *
from tkinter.font import *
from rootPackage.create_accounts import link
def terms_and_conditions():
agreement = Toplevel()
agreement.title("Terms and Conditions")
agreement.geometry("800x700")
agreement.iconbitmap("agree_0.ico")
agreement.configure(bg="silver")
# using ... | true |
7470b8822c206a916e67f88d448b1d90ef026a2c | Python | igortereshchenko/datascience | /holenyshchenkosd/integration/validator.py | UTF-8 | 1,474 | 3.265625 | 3 | [] | no_license | def city_validator(text):
match = re.match('[A-Z\s]+', text)
if match:
return True
else:
print(f'\'{text}\' is not valid, must be capital word(-s)!')
return False
def zip_code_validator(text):
match = re.match('^\d{5}$', text)
if match:
return True
else:
... | true |
a9805fb45001b5176649e445aff2fb9d02dba397 | Python | Liu0330/spider | /xiaospider/01_tieba_spider.py | UTF-8 | 3,698 | 2.71875 | 3 | [] | no_license | # coding=utf-8
import requests
from lxml import etree
import json
class TiebaSpider:
def __init__(self,tieba_name):
self.tieba_name = tieba_name
self.start_url = "http://tieba.baidu.com/mo/q----,sz@320_240-1-3---2/m?kw="+tieba_name+"&pn=0"
self.part_url = "http://tieba.baidu.com/mo... | true |
734fae2c5c11d12088606601943d97b6a1132f9e | Python | dmoranj/cvdatasetutils | /cvdatasetutils/oranalysis.py | UTF-8 | 2,844 | 2.546875 | 3 | [
"MIT"
] | permissive | from cvdatasetutils.pascalvoc import load_VOC
from cvdatasetutils.visualgenome import load_visual_genome, extract_object_dataframe
from mltrainingtools.cmdlogging import section_logger
import pandas as pd
import os
from cvdatasetutils.coco import COCOSet
def extract_voc_object_data(img_url):
def extractor(obj):
... | true |
3b4eff6f8441c56821db6c042ae4bfacf9a182d0 | Python | JobJob/DeepLearningTutorials | /code/starty.py | UTF-8 | 4,440 | 2.625 | 3 | [] | no_license | import cPickle, gzip
import numpy as np
import scipy as sp
import theano
import theano.tensor as T
from PIL import Image
# Load the dataset
f = gzip.open('../data/mnist.pkl.gz', 'rb')
train_set, valid_set, test_set = cPickle.load(f)
f.close()
len(train_set[1])
len(valid_set[1])
len(test_set[1])
def shared_dataset(da... | true |
748ca91d9a7955b2727284ccba7cd896f99153a8 | Python | trevino-676/users-service | /app/api/routes.py | UTF-8 | 4,151 | 2.578125 | 3 | [] | no_license | from flask import Blueprint, request, jsonify, make_response
# from werkzeug import check_password_hash, generate_password_hash
from app import app
from app import db
from app import jwt_required
from app.models.company import Company
from app.models.users import User
from app.api.controllers.user_controller import Us... | true |
a3d56a666364fc53c25371d47ac769e4c03717a1 | Python | tedrepo/nlg-mcts | /lm_mcts_sequence_demo.py | UTF-8 | 744 | 2.78125 | 3 | [
"MIT"
] | permissive | from nlgmcts import *
if __name__ == '__main__':
print("creating language model...")
lm = ShakespeareCharLanguageModel(n=5)
num_simulations = 1000
width = 6
text_length = 50
start_state = ["<L>"]
eval_function = lambda text: 100 - lm.perplexity(text)
# mcts = LanguageModelMCTS(lm, w... | true |
ba3e9386d79256de80a1053d8d89f34e3da2abf3 | Python | verasazonova/textsim | /corpus/reuters.py | UTF-8 | 3,321 | 2.828125 | 3 | [] | no_license | __author__ = 'verasazonova'
from nltk.corpus import reuters
import argparse
import numpy as np
from corpus.medical import word_valid
class ReutersDataset():
def __init__(self, categories=None, lower=True):
if categories == None or len(categories) == 1:
self.fileids = reuters.fileids()
... | true |
6954ce78332b3688910b1f6fa0228c049afc1bd9 | Python | drummonds/fab_support | /tests/test_utils.py | UTF-8 | 285 | 3.46875 | 3 | [
"MIT"
] | permissive | from shutil import rmtree
def remove_tree(path):
assert path not in ("c:\\", "c:", "\\", "/") # Add safety check
if isinstance(path, tuple) or isinstance(path, list):
for this in path:
remove_tree(this)
else:
rmtree(path, ignore_errors=True)
| true |
5339debd744e07523929e5a7f9a1ef75f2971035 | Python | sdbaronc/taller_de_algoritmos | /algoritmo_23.py | UTF-8 | 159 | 3.453125 | 3 | [] | no_license | seg=int(input("Digita la cantidad de segundos: "))
min=seg/60
seg_2=int(seg%60)
horas=int(min/60)
min_2=int(min%60)
print("Tiempo ",horas,":",min_2, ":",seg_2) | true |
93f324b6d60900aab1dc3dce5c4bbc0a7139fcf9 | Python | aidanr002/Emergency-Watch | /EmergencyWatch/python serverside/wafire.py | UTF-8 | 6,479 | 2.65625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import json
import time
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from datetime import datetime
from dateutil import tz
from scraper_cleanup import character_ord_check
from scraper_cleanup import tag_removal_for_linebre... | true |
e13f702b13f6ad9c9abf62de9bbce1a0e891a55d | Python | tianxing1994/MachineLearning | /Kaggle/titanic/方法二/测试数据得分 95%.py | UTF-8 | 5,649 | 3.59375 | 4 | [] | no_license | """训练数据中, 根据有 Age 值的样本, 线性回归预测出无 Age 值的样本之 Age 值. """
import re
from sklearn.linear_model import LinearRegression, LogisticRegression
import pandas as pd
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVR
Titanic = pd.read_csv(r"C:\Users\tianx\PycharmProjects\analysistest\dataset\titanic\tra... | true |
82266bdbfb736076e175672cdc5c81d2718b3362 | Python | abeasock/python | /weatherunderground_api.py | UTF-8 | 5,259 | 3.015625 | 3 | [] | no_license | ##############################################################################
#-----------------------------------------------------------------------------
# Program Information
#-----------------------------------------------------------------------------
# Author : Amb... | true |
a9e8432a55e1d8201a9d980c12f6aac626d6e8d6 | Python | lmagalhaes/toy-robot | /toy_robot/robot.py | UTF-8 | 2,407 | 3.0625 | 3 | [] | no_license | from toy_robot.utils import Boundary, CardinalCoordinates, Point
default_boundary = Boundary(Point(0, 0), Point(4, 4))
class Robot:
def __init__(self, location: Point = None, direction: str = None, boundary: Boundary = None):
self.location = location
self.direction = direction
self.boun... | true |
f91848ce185e71c39c63344e8a674964b7bc3741 | Python | Gwiradus/Dynamic-Programming-and-Reinforcement-Learning | /ev_fleet_model.py | UTF-8 | 4,753 | 3.453125 | 3 | [] | no_license | """EV Fleet Model"""
import numpy as np
import matplotlib.pyplot as plt
"""Helper Functions"""
def rayleigh_cdf(x_value, sigma=11.1):
"""Rayleigh cumulative distribution function"""
return 1 - np.exp(-(x_value**2 / (2*sigma**2)))
def rayleigh_pdf(x_value, sigma=11.1):
"""Rayleigh probabi... | true |
75355144051ececf0e1ed0e6eb40a53bb7fcb4e2 | Python | AnaMaria99/EasyChatBot | /utils.py | UTF-8 | 405 | 2.890625 | 3 | [] | no_license | class FileReader:
def __init__(self, filename):
self.__filename = filename
def citire_date(self):
date = []
with open(self.__filename) as f:
for intrebare in f:
raspuns = f.readline().strip('\n')
date.append((intrebare, raspuns))
return date
def parsefloat(string):
try:
return float(''.joi... | true |
9477300204d583663760f98b74a0acc45d4f5c51 | Python | ThanHuuTuan/python-Spider | /Spider/Nine--Shoe Figure/鞋图.py | UTF-8 | 1,957 | 2.984375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import os
import time
import random
def get_urls(url):
res=requests.get(url)
# print(res.text)
s=1
html=BeautifulSoup(res.text,'lxml')
div=html.find_all('div','showindex__children')
for i in range(len(div)):
# print(div[i])
... | true |
b9bbff89b17218769f471ded6f9c29df8c7387bc | Python | tkkuehn/aoc19 | /day9/part1.py | UTF-8 | 13,312 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python3
with open('./input.txt', 'r') as f:
contents = f.read().splitlines()[0]
program = [int(x) for x in contents.split(',')]
class Computer:
def __init__(self):
self.memory = {}
self.inst_ptr = 0
self.input_queue = []
self.output_buffer = []
self.relative... | true |
b78c56d1fc74f528fe60acda215964ef83af19ff | Python | gezpage/opyapi | /tests/schema/validators/test_date_time.py | UTF-8 | 767 | 3.09375 | 3 | [
"MIT"
] | permissive | import pytest
from opyapi.schema.validators import DateTime
from datetime import datetime
def test_can_instantiate():
validator = DateTime()
assert validator.validate("2016-09-18T17:34:02.124Z")
@pytest.mark.parametrize(
"value",
(
"2016-09-18T17:34:02.124Z",
"2016-09-18 17:34:02.124... | true |
11e5f4f70ef1ef84cf7abda18cc47f5d044fb592 | Python | jseranna/HPE-Python-repository | /tr_assessment_IT calculator.py | UTF-8 | 590 | 3.71875 | 4 | [] | no_license | # tax calculation app
# input data
name = input('What is your name: ')
age = int(input('age please: '))
sal = int(input('what is your total CTC: '))
sec = int(input('money invested under section 80C(if any): '))
# process
x= int(250000)
if(sal <=250000):
y=0
elif(sal >=250001 and sal <=500000)... | true |
fe48ab6f1062d4ccbf89ebbe773b3e2d582b992d | Python | juneharold/PH526x_UPFR | /review/numpy_practice/numpy3.py | UTF-8 | 416 | 3.6875 | 4 | [] | no_license | import numpy as np
z1 = np.array([1, 3, 5, 7, 9])
z2 = z1+1
print(z1)
print(z2)
ind = [0, 2, 3]
z3 = z1[ind]
print(z3)
z4 = (z1>6)
print(z4)
z5 = z1[z1 > 6] # only returns values where the index is true
# slicing vs indexing
z1 = np.array([1, 3, 5, 7, 9])
w = z1[0:3] # if w is modified, z1 also gets modified
w[0]=3
p... | true |
9fddfd4f5dad0d2f8cbf03cd6588173ead9bf680 | Python | xuehanshuo/ref-python-lan | /05_高级变量/hm_01_列表增删查改.py | UTF-8 | 1,023 | 4.15625 | 4 | [] | no_license | name_list = ["one", "two", "three"]
"""
name_list.
name_list.append name_list.count name_list.insert name_list.reverse
name_list.clear name_list.extend name_list.pop name_list.sort
name_list.copy name_list.index name_list.remove
"""
# 1.取值和取索引
# 取值
print(name_list[0])
# 取索引
print... | true |
057d20c6613085b868397dc6677134382343bfe5 | Python | SuryankDixit/LeetCode_Algorithms | /Python/Spiral_Matrix.py | UTF-8 | 767 | 3.140625 | 3 | [] | no_license | class Solution(object):
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
k, l = 0, 0
m = len(matrix)
n = len(matrix[0])
res = []
while (k < m and l < n):
for i in range(l, n):
re... | true |
7e32f4e01ef209571853ece8eaf7b319dd5df3ee | Python | itsavik4u/python-learning | /test_calc.py | UTF-8 | 868 | 3.484375 | 3 | [] | no_license | import unittest
from calc import Calc
class TestCalc(unittest.TestCase):
def test_add(self):
c = Calc()
# cover the edge cases
self.assertEqual(c.add(36, 4), 40)
self.assertEqual(c.add(-1, 1), 0)
self.assertEqual(c.add(-2, -4), -6)
self.assertEqual(c.add(-36, 4), -... | true |
5526ab7d57981edbe79dcd197652d938b9c003ec | Python | ziqizhang/msm4phi | /code/python/src/analysis/IAA_kappa.py | UTF-8 | 1,973 | 2.6875 | 3 | [] | no_license | import sklearn
from sklearn.metrics import cohen_kappa_score
lookup={}
lookup["Advocates"]=0
lookup["Patient"]=1
lookup["P"]=1
lookup["HPO"]=2
lookup["HPI"]=3
lookup["Other"]=4
lookup["Research"]=5
def read_annotations(in_csv, num_lines:int, ignore_header=True):
converted_labels=[]
with open(in_csv, 'r') as ... | true |
8e6842779b87380cc90393e24fb0dc6c4c65ea54 | Python | baubrun/dp_py | /observer/observer.py | UTF-8 | 259 | 2.59375 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
class Observer(metaclass=ABCMeta):
@abstractmethod
def update(self, desc):
pass
@abstractmethod
def unsubscribe(self):
pass
@abstractmethod
def subscribe(self):
pass
| true |
98b10b4b9c6024feb65652b321dc1d3945b4ff40 | Python | ky8778/AL_study | /A/BackTracking/BJ2580스도쿠_KY.py | UTF-8 | 1,211 | 2.609375 | 3 | [] | no_license | inData = [list(map(int,input().split())) for _ in range(9)]
result = [[0 for _ in range(9)] for _ in range(9)]
def checkMap(y,x):
checkNum = [False for _ in range(10)]
for idx in range(9):
val = inData[y][idx]
checkNum[val] = True
val = inData[idx][x]
checkNum[val] = True
... | true |
e364d18be3b242b3a07ea2a86a91548f648f752e | Python | TimurKTI/PythonProjects | /mono.py | UTF-8 | 1,892 | 3.8125 | 4 | [] | no_license |
alf = tuple("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ")
N = len(alf)
def encrypt(text, a, k):
print(f"Зашифровка по ключу: {key}\n")
text = text.upper()
gv_txt = ""
for ch in text:
if ch in alf:
enc_ch = (a * alf.index(ch) + key) % (N)
gv_txt += alf[enc_ch]
... | true |
db59edcd86a97c5d6816fd92d9e006f9be9ed3ee | Python | mattijn/pynotebook | /2015/2015-12-18 Cartopy Global Drought.py | UTF-8 | 24,480 | 2.625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER
import matplotlib.ticker as mticker
import matplotlib.colors as mcolors
import matplotlib.colorbar as mcb
import cartopy.feature as cfeature
from matplotlib im... | true |
904980c5f87a3a8187d023c38936992d3abb612f | Python | adslchen/leetcode | /E15/lc310.py | UTF-8 | 1,152 | 3.1875 | 3 | [] | no_license | class Solution(object):
def findMinHeightTrees(self, n, edges):
"""
:type n: int
:type edges: List[List[int]]
:rtype: List[int]
"""
if n == 1:
return [0]
graph = {}
# build the neighbor list
for edge in edges:
node1 = ed... | true |
f84b3f75a098d32b93fb49a14afdc974a143b724 | Python | englandbaron/CadvisorAnalysis | /K8sModel/Deployment.py | UTF-8 | 476 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: Tang Smith
@contact: 415107188@qq.com
@software: PyCharm
@time: 2019/9/13 上午12:25
"""
from .Pod import Pod
class Deployment(object):
def __init__(self,name,InitialPodNumber):
# TODO: Logic View for Pods
self.PodNumber = InitialPodNumber
... | true |
45dc097d5334bc6ab7ba7fe9a046d6728a5ab9c5 | Python | SharpColton/HighSchoolCodingAA | /NumTemp.py | UTF-8 | 338 | 4.0625 | 4 | [] | no_license | def GetTemp():
while True:
try:
print('Please Enter The Temperature You Would Like Converted ')
print('Numeric Values Only')
temp = eval(input('Temperature To Be Converted: '))
return temp
break;
except NameError:
print... | true |
8210d8222aff6c3e8b6897ab73ff9e05557b99a5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02410/s412174668.py | UTF-8 | 314 | 2.953125 | 3 | [] | no_license | # coding: utf-8
n, m = map(int, input().split())
matrixA = []
vectorB = []
for i in range(n):
matrixA.append(list(map(int, input().split())))
for i in range(m):
vectorB.append(int(input()))
for i in range(n):
num = 0
for j in range(m):
num += matrixA[i][j] * vectorB[j]
print(num)
| true |
3ee6055f0b355179b0934daa19ac3ec316aa72f3 | Python | VinF/deer | /examples/ALE/ALE_env_gym.py | UTF-8 | 4,140 | 2.59375 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | """ Interface with the ALE environment
Authors: Vincent Francois-Lavet
"""
import numpy as np
np.set_printoptions(threshold=np.nan)
import cv2
#from ale_python_interface import ALEInterface
import gym
from deer.base_classes import Environment
#import matplotlib
#matplotlib.use('qt5agg')
#from mpl_toolkits.axes_grid1 ... | true |
5fe01016af5e4bed37a7865dece431f970647423 | Python | Cc618/ML0 | /linear_regression.py | UTF-8 | 1,558 | 3.9375 | 4 | [] | no_license | from random import random
def predict(x):
'''
Prediction by the network
'''
return a * x + b
def show():
'''
Displays the data in a graph
'''
import matplotlib.pyplot as plt
# Blue = ground truth
plt.plot(x_data, y_data, 'b.')
# Red = prediction
plt.plot(x_d... | true |
e6983674bc0b5743ee75df53dc8e859c7d289ec7 | Python | basakrajarshi/HackerRankChallenges-Python | /InterviewPreparationKit/Arrays/array_manipulation.py | UTF-8 | 717 | 2.703125 | 3 | [] | no_license | import math
import os
import random
import re
import sys
def arrayManipulation(n, queries):
diffarr = [0]*(n+1)
#print(diffarr)
for i in queries:
diffarr[i[0]-1] += i[2]
diffarr[i[1]] -= i[2]
maxi = 0
asum = 0
for j in diffarr:
asum += j
if (asum > maxi):
... | true |
e438a62e4bef285ad5cca8dcf12e25a8d9079f73 | Python | emrantalukder/eventstream-stack | /eventstream-transform/transform.py | UTF-8 | 1,890 | 2.59375 | 3 | [] | no_license | import os
import socket
import logging
from time import strftime
from datetime import datetime
from flask import Flask, request, json, jsonify
from elasticsearch import Elasticsearch
ELASTICSEARCH_URL = os.getenv('ELASTICSEARCH_URL', 'http://elasticsearch:9200')
app = Flask(__name__)
es = Elasticsearch([ELASTICSEARCH... | true |
c50a327b22c5b52d957a8a82c1b8268bfeb6ea0e | Python | beasyx0/cexio | /cexio/bot/tests/test_models.py | UTF-8 | 2,820 | 2.6875 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from django.utils import timezone
from cexio.bot.models import TimeStamped, BotConfigurationVariables, Order
class TestModels(TestCase):
'''Tests for all bot.models'''
def test_timestamped_save_method(self):
'''Test model 'TimeStamped' checks that self.date and self.... | true |
7d9d3a067dfa6f081bd1af30a96131d9b8641552 | Python | kersky98/stud | /coursera/pythonHse/fifth/9.py | UTF-8 | 402 | 3.3125 | 3 | [] | no_license | # Найдите и выведите все двузначные числа, которые равны удвоенному
# произведению своих цифр.
ns = 10
ne = 100
tt = tuple()
for i in range(ns, ne):
t = tuple(str(i))
zm = 2 * int(t[0]) * int(t[1])
if i == zm:
# print(i)
tt += (zm, )
for i in range(len(tt)):
print(tt[... | true |
558eae1b75fc9bd292145f33bd1ea3c3cadfb0a8 | Python | bartlebythecoder/otu_reports | /enigma_finder.py | UTF-8 | 2,307 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
import matplotlib.pyplot as plt
import sqlite3
def hex_to_num(x):
h2n_dict = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,
'8':8,'9':9,'A':10,'B':11,'C':12,'D':13,'E':14,'F':15,'G':16,'H':17,'J':18}
return int(h2n_dict[x])
# MAIN PROGRAM
# Open the SQLite 3 database
... | true |
b8aaa5c1dd451b33c03d65d7e62666f904f71d06 | Python | tonkla555/CP3-Klapathai-Chaikla | /Exercise8_Klapathai_C.py | UTF-8 | 1,749 | 3.53125 | 4 | [] | no_license | username = input("Username : ")
password = input("Password : ")
if username == ("tonkla555") and password == ("tonkla55"):
print("---Welcome To TK-Shop---")
print("No. Product price")
print("1. TK-001 (100 THB)")
print("2. TK-002 (150 THB)")
print("3. TK-002 (200 THB)")
... | true |
d6a834777aacdec11c4533527236e156e595f8e5 | Python | holcombddf/Protein-Design-Scripts | /src/plotter.py | UTF-8 | 6,147 | 3.328125 | 3 | [] | no_license | #!/bin/python
#Creates a graph for all data in a given CSV, using the first column as the x-values, and all other columns as the y-values for the plots. Change the sizing and plotting to suit your needs.
import sys,re,os
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import csv
import argparse
c... | true |
759e320069935d34f7434e46fe0f667162b53f26 | Python | nairaaoliveira/ProgWeb | /Exercicios_Python/Lista 5_Python/q01_Lista 5_Ex_Python.py | UTF-8 | 386 | 3.984375 | 4 | [] | no_license | '''1. Faça uma função que recebe uma quantidade desejada de itens e retorna uma
lista carregada com essa quantidade. Faça outra função para exibir esses itens
esperados por espaço em branco.'''
def ListaQuant(quant):
L = [12, 9, 5]
i = 0
while i < 3:
print(len(L[quant]))
break
... | true |
4a6b5579655bdc4257a87e1c184b688ad0ac6196 | Python | sayantanauddy/hierarchical_bipedal_controller | /matsuoka_walk/robots.py | UTF-8 | 14,259 | 2.859375 | 3 | [] | no_license | """
Module for wrappers of robot specific classes
"""
from abc import ABCMeta, abstractmethod, abstractproperty
from nicomotion import Motion
import math
import pypot
from pypot.vrep import from_vrep
from pypot.creatures import PoppyHumanoid
import time
import numpy as np
from pypot.utils.stoppablethread import Stoppa... | true |
cf53ef9304116af8bf2caa501c19f0ce2c53a991 | Python | SteveEwell/python-ldap-filter | /tests/test_filter_output.py | UTF-8 | 2,167 | 2.71875 | 3 | [
"MIT"
] | permissive | import pytest
from ldap_filter import Filter
class TestFilterOutput:
def test_to_string(self):
filt = '(&(|(sn=ron)(sn=bob))(mail=*)(!(account=disabled)))'
parsed = Filter.parse(filt)
string = parsed.to_string()
assert string == filt
def test_string_typecast(self):
fil... | true |
ceb31a29f3a27f3007fd46ebe715528b212191c9 | Python | bigbear11/TextClassify | /nbbaye.py | UTF-8 | 1,751 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import argparse
from collections import defaultdict
def loaddata(corpus_file):
f=open(corpus_file)
labels=defaultdict(int)
labels_words=defaultdict(int)
total=0
for line in f.readlines():
arr=line.strip().split('/')
if len(arr)< 2:continue
... | true |
6efb5571a96cdf49380ec1c562b89fb8c3a42a6a | Python | kashifusmani/interview_prep | /beyond/test.py | UTF-8 | 271 | 3.109375 | 3 | [] | no_license | def find_duplicate(arr):
s = set()
for elem in arr:
if elem not in s:
s.add(elem)
else:
return elem
def find_missing(arr):
return 0
if __name__ == "__main__":
a = [1, 4, 2, 0, 4, 5]
print(find_duplicate(a))
| true |
56068f612af76e285aa0b235e5ee56144c53eea1 | Python | koseus/CSE566 | /hw1/hw1.py | UTF-8 | 2,027 | 3.6875 | 4 | [] | no_license | import numpy as np
f = open("input.txt", "r")
size = int(f.readline())
# print(size)
data = []
for i in range(size):
line = f.readline()
# print(line)
instance = []
for l in line.split():
# print(l)
instance.append(float(l))
# print(instance)
data.append(instance)
data = np.asarray(data, dtype=np.floa... | true |
f1da9446da4f5865379fbb5bdf80986cda6a9d35 | Python | MLmicroscopy/distortions | /src/ang/phase.py | UTF-8 | 7,261 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import io
import re
import collections
def np2str(arr, precision=6, smart_int=False):
assert len(arr.shape) == 1
s = []
for x in arr:
x = float(x)
if smart_int and x.is_integer():
s += ["{}".format(int(x))]
else:
s += ["{0:.{1}f}".format... | true |