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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a2894adf35af90e98848ade70a858d4557552402 | Python | vagueGM/GamersPlane | /api/src/helpers/endpoint.py | UTF-8 | 225 | 2.90625 | 3 | [] | no_license | def require_values(data_obj: object, fields: list) -> list:
missing_fields = []
for key in fields:
if key not in data_obj or not data_obj[key]:
missing_fields.append(key)
return missing_fields
| true |
c2e51ac045202c5400fd2a3d179255e928213be2 | Python | Himanshu-jn20/PythonNPysparkPractice | /Practise_beginner/test_vbasic.py | UTF-8 | 558 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 00:06:49 2020
@author: Himanshu
"""
import sys
print ("himsanshu")
#name=input("What's your name? ")
#color=input("Color? ")
#print(name + ' likes ' + color)
currency=[1,2,5,10,50,100]
print(currency[1 - 1])
val=currency[2]//currency[1]
val2=currenc... | true |
3a2b60e97c54333f5b3239c4d3dfce087b47aabe | Python | resurgo-genetics/scATAC-seq | /BernoulliMixture_generatedata.py | UTF-8 | 2,846 | 2.875 | 3 | [] | no_license | #code to generate data using generative model for infinite bernoulli mixture
import scipy.stats
import numpy as np
import pymc3 as pm
import math
#number of cell types = K
#number of sites = D
#number of cells = N
#proportion of each cluster in the data is a vector pi
K = 5
D = 500
N=500
pi = [.1,.25,.4,.07,.18]
clus... | true |
6b814106906e3919fe0e77e6405968f297f89107 | Python | jpxiong/platform_cts | /tools/selinux/SELinuxNeverallowTestGen.py | UTF-8 | 2,066 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
import re
import sys
import SELinuxNeverallowTestFrame
usage = "Usage: ./gen_SELinux_CTS_neverallows.py <input policy file> <output cts java source>"
# extract_neverallow_rules - takes an intermediate policy file and pulls out the
# neverallow rules by taking all of the non-commented text betwe... | true |
e4c2d48ba6338d37d8c31fa936629b450bbc787b | Python | openZH/covid_19 | /scrapers/scrape_sz_districts.py | UTF-8 | 1,678 | 2.515625 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
import scrape_common as sc
url = 'https://www.sz.ch/behoerden/information-medien/medienmitteilungen/coronavirus.html/72-416-412-1379-6948'
content = sc.download(url, silent=True)
soup = BeautifulSoup(content, 'html.parser')
pdf_ur... | true |
e3d9ce8cd5f2e0ce010b215e89fa5ec8a3ea6578 | Python | shinys88/challenges-python | /Day_04_Requests_reg_legit/main.py | UTF-8 | 1,586 | 3.3125 | 3 | [] | no_license | import os
import requests, re
# Response Status Codes
# https://2.python-requests.org/en/master/user/quickstart/#response-status-codes
# url 검증 함수.
def legit() :
print("Welcome to UsUtDown.py!")
url_arr = input(str("Please write a URL or URLs you want to check. (separated by comma)\n")).split(",")
print("----... | true |
18d5dd9a3be370aaec63d727990a43a43003f9ad | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4145/codes/1836_2603.py | UTF-8 | 155 | 2.578125 | 3 | [] | no_license | from numpy import*
from numpy.linalg import*
m= array(eval(input("matriz4x4: ")))
m=m
for i in range(4):
m[:,i]= sorted(m[:,i], reverse = True)
print(m) | true |
77a5987f276bcca6c1b0ebb0d37085a29750285e | Python | asleniovas/keywordAnalysis | /test/test_main.py | UTF-8 | 859 | 2.96875 | 3 | [] | no_license | import unittest
import os
from main import cleanTextFiles
class TestMainMethods(unittest.TestCase):
def setUp(self):
self.data_folder = os.path.join(os.path.expanduser("~"),
"Documents/repos/keywordAnalysis/data")
self.stop_... | true |
05690c0215eb794136878e3b3ea6f99b32e372ad | Python | HyeminNoh/Coding-Test-Study | /Programmers/Lv2/NextMaxNum.py | UTF-8 | 135 | 2.875 | 3 | [] | no_license | def solution(n):
cnt = bin(n).count('1')
for i in range(n+1,1000001):
if bin(i).count('1') == cnt:
return i | true |
de4a5e41e5a72f1b5a740e240838c077efb0c2f9 | Python | Mistery03/mainMenu | /Main Menu/menu.py | UTF-8 | 5,373 | 3 | 3 | [] | no_license | import pygame;
class Menu():
def __init__(self,game):
self.game = game;
self.mid_w, self.mid_h = self.game.DISPLAY_W/2, self.game.DISPLAY_H/2;
self.runDisplay = True;
self.cursorRect = pygame.Rect(0,0,20,20);
self.offset = -100;
def drawCursor(self):
... | true |
f9001c241655b00ac02468e341a25bc3859195af | Python | seymasultan/HIT-SONG-PREDICTION | /SVM.py | UTF-8 | 2,319 | 2.96875 | 3 | [] | no_license | import pickle
import joblib
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.svm import SVC
import SpotifyConnection
import dataset
def main():
allSong, targetList = dataset.main()
allSong = np.array(allSo... | true |
774c1651efef6b366c891f99281db3a9eea603aa | Python | diegopso/hybrid-urban-routing-tutorial-sbrc | /smaframework/common/hashing.py | UTF-8 | 116 | 2.71875 | 3 | [] | no_license | import hashlib
def md5(string):
m = hashlib.md5()
m.update(string.encode('utf-8'))
return m.hexdigest() | true |
1e42d8e560631c82b5cb392c9838481105fe8344 | Python | lilei8630/leetcode | /68_Text_Justification.py | UTF-8 | 1,133 | 2.796875 | 3 | [] | no_license | s = [""]
l = 2
res = []
line=""
i=0
while i < len(s):
if(len(line)+len(s[i])<=l):
line = line + s[i]
line = line +" "
if(i==(len(s)-1)):
len1 = len(line.replace(' ',''))
len2 = len(line.strip())
remain = l - len1
temp = line.strip().split(" ")
num_words = len(temp)
num_slot = num_words-1
mor... | true |
d89c3102daf0acc46b99cfb7d9084b5991c6bfe9 | Python | BouzasLab25/Curso_LaboratorioVirtualenPython | /Viernes - Distribución Normal y Teoría de Detección de Señales/CursoPython_Normal_Funciones.py | UTF-8 | 710 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 30 11:07:06 2017
@author: Adriana
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import math
import scipy.stats
mu = 0
varianza = 1
sigma = math.sqrt(varianza)
x = np.linspace(-6,6, 100)
valor = 3
plt.plot(x,mlab.normpdf(x,mu, si... | true |
4a3bb004554719cd949c8caf9f04651124aea86e | Python | danielsada/100daysofalgorithms | /algorithms/sliding-window/sliding-window-max-sum.py | UTF-8 | 1,076 | 4.1875 | 4 | [] | no_license | """
Maximum Sum Subarray of Size K (easy)
Problem Statement
Given an array of positive numbers and a positive number ‘k,’ find the maximum sum of any contiguous subarray of size ‘k’.
Example 1:
Input: [2, 1, 5, 1, 3, 2], k=3
Output: 9
Explanation: Subarray with maximum sum is [5, 1, 3].
Example 2:
Input: [2, 3, ... | true |
ce19c50540358752b096ca6034855ae9278bfdf6 | Python | minhduc9699/mx-game-logic | /fsm.py | UTF-8 | 6,160 | 2.578125 | 3 | [] | no_license | import random
from datetime import date, datetime, timedelta
# admn
# readonly
players = [
{
"player_name": "huy",
"quizzes": [{
'question': 'Học viên đang pick tướng',
'choices': [0, 0, 0, 2, 0, 0, 0, 0, 0],
'time_allowed': 12,
'right_choice_indexes': [3],
'date_sent':... | true |
8798ce524341933d5596b8b7a90ded9c87621417 | Python | hanpiness/history_study | /历史文件/爬取经纬度.py | UTF-8 | 1,107 | 2.9375 | 3 | [] | no_license | import json
from urllib.request import urlopen,quote
import requests,csv
import time
# 构造经纬度获取函数
def getlnglat(address):
url = 'http://api.map.baidu.com/geocoding/v3/'
output = 'json'
ak = 'txrm69lvmWHa66jgClsR1F8yuVfhKNkK'
add = quote(address) # 由于本文城市变量为中文
uri = url+'?'+'address='+a... | true |
c4ee13fa23519552402efdefd5657b2633b4ab10 | Python | tks3210/autoJudge | /regiater_cmd.py | UTF-8 | 1,339 | 2.828125 | 3 | [] | no_license | import os
import sys
import argparse
if __name__ == '__main__':
# 登録するコマンド名を受け取るパーサーの作成
parser = argparse.ArgumentParser()
# 引数がなければatjudgeにする
parser.add_argument('command_name', help='commmand name to register', type=str, nargs='*', default='atjudge')
args = parser.parse_args()
targetfilepat... | true |
c3935acbf2b781ab5c5e30452647390d901b3d2b | Python | jicruz96/AirBnB_clone_v2 | /3-deploy_web_static.py | UTF-8 | 1,892 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python3
""" generates a .tgz archive of web_stack folder """
from fabric.api import local, run, put, env
from os.path import exists
from datetime import datetime as time
web_01 = '35.190.188.58'
web_02 = '52.23.162.134'
env.hosts = [web_01, web_02]
def do_pack():
""" does pack """
time_and_date... | true |
cb9ada82985019326278f18c00b6287bb552f0d9 | Python | lade043/grade-program | /user_IO.py | UTF-8 | 3,135 | 4.0625 | 4 | [
"MIT"
] | permissive | import exceptions
def user_input():
todo = input("Ok, do you want to see them or to edit them [see/edit/exit]?\n")
if todo == "see":
print("Which subject do you want to know the information?")
subject = input()
return "output", subject
elif todo == "edit":
print("Do you wan... | true |
87d22e4c599cd62f6dfe94fe33417973b8878d6f | Python | chenshanghao/LeetCode_learning | /Problem_31/learning_solution.py | UTF-8 | 879 | 2.859375 | 3 | [] | no_license | class Solution(object):
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
# Example 6 9 7 4 3 2
# Step 1 *6* 8 7 4 3 2
# Step 2 6 8 *7* 4 3 2
... | true |
e0bf749a61fd0a6e342944553f05ad2e21732f19 | Python | nordugrid/arc | /src/services/acix/core/test/test_bloomfilter.py | UTF-8 | 1,301 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | from twisted.trial import unittest
from acix.core import bloomfilter
KEYS = ['one', 'two', 'three', 'four']
FALSE_KEYS = ['five', 'six', 'seven' ]
SIZE = 160
class BloomFilterTestCase(unittest.TestCase):
def setUp(self):
self.bf = bloomfilter.BloomFilter(SIZE)
def testContains(self):
fo... | true |
c80e24c688b9407efe0902af617ad6e00f855baf | Python | slad99/pythonscripts | /Application/Check if the Application is Running or Not/check-if-the-application-is-running-or-not.py | UTF-8 | 465 | 2.828125 | 3 | [] | no_license | #To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
appName =itsm.getParameter('parameterName')
import os
def IsAppRunning(appName):
proObj = os.popen('TASKLIST /FI "STATUS eq running"')
runApps = proObj.read()
return ap... | true |
c659081c42aaf020ab3e8d3390bf6a6c57a14f22 | Python | kelvinfan001/mini-programs | /MarsTime Converter/MarsTime.py | UTF-8 | 5,148 | 3.984375 | 4 | [] | no_license | """
MarsTime Converter Module
Instructions:
Excel dates in a plain text file named 'excel_time.txt' will be converted into
Mars time and written on a plain text file named 'marstime.txt'
"""
from typing import List
import math
path = 'excel_time.txt'
new_path = 'marstime.txt'
time_file = open(path, 'r')
time_file_st... | true |
003b61fed0f7b5af5e1fed3fafb9c563536f6786 | Python | UtkrishtDhankar/cubinator | /rotation.py | UTF-8 | 1,208 | 3.203125 | 3 | [
"MIT"
] | permissive | from point import *
import math
def rotate_about_x_clockwise(point):
rotation_matrix = [[1, 0, 0],
[0, 0, -1],
[0, 1, 0]]
return point.return_rotation(rotation_matrix)
def rotate_about_x_counter_clockwise(point):
rotation_matrix = [[1, 0, 0],
... | true |
c970e1a9cba99cb609cf00b4911034208edf9d11 | Python | montellasebastien/resume | /education.py | UTF-8 | 5,983 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
from manimlib.imports import *
class Education:
def __init__(self, seb_resume, title='Education', color=YELLOW):
self.seb_resume = seb_resume
self.seb_resume.apply_transition(title=title,
color=color)
def show_universities(self):... | true |
5d31f63c6e947d5d9021f02233b4002045dac529 | Python | nstarman/templates | /python/script.py | UTF-8 | 3,924 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
#
# TITLE :
# AUTHOR :
# PROJECT :
#
# ----------------------------------------------------------------------------
"""**DOCSTRING**.
This script can be run from the command line with the following parameters:
... | true |
227a79a67c2b1f2416b7996f856b317cf414e4fd | Python | wgf5544/wugaofeng | /python/matplotlib_learning.py | UTF-8 | 3,261 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | __author__ = 'wgf'
__date__ = ' 下午11:54'
'''
量化交易系统中,绘图是数据可视化最直接的方法,也是直观分析数据必不可少的步骤。
Matplotlib是Python中专门用于数据可视化操作的第三方库,也是最流行的会图库。
两种绘图方式:函数式绘图和对象式绘图。
'''
# 函数式绘图
'''
MATLAB是数据绘图领域广泛使用的语言和工具,调用函数命令可以轻松绘图。、
Matplotlib是受NATLAB的启发而构建,设计了一套完全仿照MATLAB函数形式的绘图API。
'''
import matplotlib.pyplot as plt # 导入Matplotlib库中的pyplo... | true |
1a8e5e3682f8514ea2ae16d6adb424e7754e13ae | Python | Jnewgeek/handson-ml | /tackle_titanic.py | UTF-8 | 8,047 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 9 11:19:39 2019
@author: Administrator
# Tackle The Titanic datasets
"""
import os
os.chdir(os.getcwd())
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rc("axes",labelsize=14)
mpl.rc("xtick",labelsize=12)
mpl.rc("ytick",labelsize=12)
plt.rcParams["font.sa... | true |
d517cf84b3fb6b346397b26174491b3c0c7995b0 | Python | closcruz/wallbreakers-code | /week1/reverseWords.py | UTF-8 | 305 | 3.875 | 4 | [] | no_license | # Reverse words in a string while preserving spaces and word order
class ReverseWords:
def reverseWords(self, s):
reversedSentence = " ".join(list(map(lambda x: x[::-1], s.split())))
return reversedSentence
t1 = ReverseWords().reverseWords("Let's take LeetCode contest")
print(t1)
| true |
1c13d15c727f9939858e8072c32de5bc5f8ea044 | Python | ipunk007/Blog_TaufikSutanto | /TSutantoSMA.py | UTF-8 | 9,517 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 10 11:25:43 2018
MIT License with Acknowledgement
@author: Taufik Sutanto
Simple Social Media Analytics ver 0.11.1
https://taufiksutanto.blogspot.com/2018/01/easiest-social-media-analytics.html
"""
from pattern.web import Twitter, URL
from nltk.tokenize import Twe... | true |
ae5f9bbbe93ec33df57dfab1b8914b7e6d9f69a7 | Python | floor66/fsr | /main.py | UTF-8 | 26,687 | 2.515625 | 3 | [] | no_license | """
main.py
Created by Floris P.J. den Hartog, 2018
Main file for the GUI / processing of Force Sensitive Resistor data
Used in conjunction with Arduino for analog-digital conversion
"""
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matp... | true |
a122fcc01f2961735c8e4e03ef17e86b257be884 | Python | Aasthaengg/IBMdataset | /Python_codes/p03400/s119273461.py | UTF-8 | 93 | 2.71875 | 3 | [] | no_license | n, d, x, *a = map(int, open(0).read().split())
for i in a:
x += 1 + (d - 1) // i
print(x) | true |
60ddf5ffce56a17c0f2782f58a55b48493dbdc44 | Python | TeodorStefanPintea/Sentiment-mining-of-the-bioinformatics-literature | /AnaliseSentiment/sentiment_AnalyseSentiment.py | UTF-8 | 1,596 | 3.21875 | 3 | [] | no_license | '''
This method uses VADER to measure the sentiment score.
The thresholds can be changed.
'''
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
class AnalyseSentiment:
def __init__(self):
pass
def Analyse(self, sentence):
# parameter can be a paragraph or a sentence... | true |
8eded6328c694c8272b32c29794189523581a585 | Python | one-last-time/python | /NLTk/TF-IDF.py | UTF-8 | 3,086 | 3.109375 | 3 | [] | no_license | import nltk
import re
import nltk
import heapq
import numpy as np
paragraph="""Thank you all so very much. Thank you to the Academy. Thank you to all of you in this room. I have to congratulate the
other incredible nominees this year. The Revenant was the product of the tireless efforts of an unbelievable cast and c... | true |
f66cdd81d52308315933415bedc1a6b45df342ca | Python | swift-fox/ml-demos | /ml-fundementals/pytorch_mnist_validation.py | UTF-8 | 858 | 2.515625 | 3 | [] | no_license | import torch, torchvision
from torch import nn, optim
from torchvision import datasets, transforms
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,))
])
validate_set = datasets.MNIST('data', download=True, train=False, transform=transform)
validate_loader = torch.util... | true |
54678f6f657f8dad5aa6f6e8eca6e06805338758 | Python | leeanna96/Python | /Chap03/숫자 맞추기 게임_도전문제.py | UTF-8 | 315 | 3.796875 | 4 | [] | no_license | answer=5
print("숫자 게임에 오신 것을 환영합니다")
while True:
n=int(input("숫자를 맞춰보세요: "))
if n==answer:
print("사용자가 이겼습니다.")
break
elif n>answer:
print("너무 큼")
else:
print("너무 작음")
print("게임 종료")
| true |
977c8ba9d54dfd5808726fc3bc7fdbf645c3fc16 | Python | nricklin/leafpy | /leafpy/leaf.py | UTF-8 | 1,606 | 2.5625 | 3 | [
"MIT"
] | permissive | from .auth import login
import requests
BASE_URL = 'https://gdcportalgw.its-mo.com/api_v200413_NE/gdc/'
class Leaf(object):
"""Make requests to the Nissan Connect API to get Leaf Info"""
custom_sessionid = None
VIN = None
region_code = None
def __init__(self, username=None, password=N... | true |
9e1fc4ab3006a73cfbb96ea5292d214d1c4b2b93 | Python | RavingSmurfGB/MuteOnMuteOff | /setup.py | UTF-8 | 7,579 | 2.5625 | 3 | [] | no_license | import os, shutil, pathlib, ctypes, time, sys, glob, subprocess, stat
current_file_path = pathlib.Path(__file__).parent.absolute() #This will get the current file path but will not update if you move the setup.py, move the setup.py last
print(current_file_path)
#-1. Relaunch program as admin if not: ... | true |
23ae85c8f83c6c26eb082460b08f31356b243895 | Python | wansang93/Algorithm | /SW Expert Academy/Python/Python D3/10505. 소득 불균형.py | UTF-8 | 257 | 3.671875 | 4 | [] | no_license | T = int(input())
for t in range(1, T+1):
N = int(input())
income = list(map(int, input().split()))
average = sum(income) / N
answer = 0
for i in income:
if i <= average:
answer += 1
print(f'#{t} {answer}')
| true |
6c34300f4eb44654b15ef2399901e0437ee808dc | Python | Free0xFF/DbtLock | /Redlock-python/lock_utility.py | UTF-8 | 2,006 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | '''
@author: yongmao.gui
'''
from Redlock import Redlock,Lock
import logging
key = None
redis_connection = ["redis://localhost:6379/0"]
'''
get lock
'''
def lock(name, validity, retry_count=3, retry_delay=500, **kwargs):
global key
if retry_count < 0:
retry_count = 0
is_blockin... | true |
f093ec7a51346f267692a8b322cf6e40a136cd79 | Python | eecheve/Gaussian-2-Blender | /gui/IonRegion.py | UTF-8 | 4,439 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import tkinter as tk
import CreateTooltip
tooltip = CreateTooltip.CreateTooltip
import SelectedIon
class IonRegion(object):
"""Section of the app that receives information about possible ions present"""
def __init__(self, parent):
self.ionCount = 0
self.lst_ions = []
self.var... | true |
ea1e046d3ca712c6f9fc74adc0c9f3bcd7fe8019 | Python | tms1337/tensorflow-tutorial | /intro.py | UTF-8 | 1,848 | 2.859375 | 3 | [] | no_license | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import numpy as np
def main():
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0)
print(node1, node2)
sess = tf.Session()
print(sess.run([node1, node2]))
print(sess.run(node1))
node3 = tf.add(node1, ... | true |
a96dcbc864d6ce6e61ae7c71fbfa40f54e832992 | Python | BetulCengiz/pythonProject | /Harmonik Toplam.py | UTF-8 | 292 | 3.453125 | 3 | [] | no_license | def harmonik_toplam(n):
if n == 1:
return 1
else:
return 1/n + harmonik_toplam(n-1)
def harmoniktoplamiteratif(n):
toplam = 0
for i in range (1, n+1):
toplam = toplam + 1
return toplam
print(harmonik_toplam(4))
print(harmoniktoplamiteratif(4))
| true |
086ddb804bb6c3b866c839d126614f1effb8745f | Python | Zt-1021/ztpython | /study/mogugu/unit/testHomePageSuite.py | UTF-8 | 1,017 | 2.515625 | 3 | [] | no_license | """初学测试集"""
import unittest
from study.mogugu.unit_test.home_page_test import homepage
import HTMLTestRunner
# 加载用例
suite = unittest.TestSuite()
# 通过对象加载用例
# suite.addTest(testMathMethod.TestMathMethodAdd('test_two_zero')) # TestMathMethodAdd('test_two_zero')
loader = unittest.TestLoader()
# 通过类加载用例
# suite = loa... | true |
f7760f34e905e3fbcab992e2f1cbdae4503c2a75 | Python | entn-at/rnnt-speech-recognition | /debug/get_common_voice_stats.py | UTF-8 | 1,401 | 2.859375 | 3 | [
"MIT"
] | permissive | from argparse import ArgumentParser
from scipy.io.wavfile import read as read_wav
import glob
import os
def main(args):
max_length = 0
min_length = 0
total_length = 0
count = 0
with open(os.path.join(args.data_dir, args.split + '.tsv'), 'r') as f:
next(f)
for line in f:
... | true |
15f4841840d1e636d9ab8c0f059f183e16dc13d4 | Python | mikochou/leetcode_record | /FlattenBinaryTreetoLinkedList.py | UTF-8 | 556 | 3.1875 | 3 | [] | no_license | class Solution(object):
def flatten(self, root):
"""
:type root: TreeNode
:rtype: None Do not return anything, modify root in-place instead.
"""
s = []
while root and (root.left or root.right or s):
if root.right:
s.append(root.right)
... | true |
db9789a91a878710c9ec91db541bee65b28396f0 | Python | piazentin/programming-challenges | /hacker-rank/implementation/absolute_permutation.py | UTF-8 | 541 | 3.328125 | 3 | [
"MIT"
] | permissive | # https://www.hackerrank.com/challenges/absolute-permutation
def absolute_permutation(n, k):
if not k:
return ' '.join(str(i) for i in range(1, n + 1))
elif n % (k * 2) != 0:
return -1
else:
cicle = [k + i for i in range(1, k + 1)] + [i for i in range(1, k + 1)]
ans = [2 * ... | true |
46094f7f22b056b7487a4f9c73e71703dce3e313 | Python | tarsioonofrio/PySDDP | /PySDDP/dessem/script/bateria.py | UTF-8 | 3,367 | 2.78125 | 3 | [
"MIT"
] | permissive | from PySDDP.dessem.script.templates.bateria import BateriaTemplate
import pandas as pd
from typing import IO
import os
COMENTARIO = '&'
class Bateria(BateriaTemplate):
"""
Classe que contem todos os elementos comuns a qualquer versao do arquivo Bateria do Dessem.
Esta classe tem como intuito fornecer d... | true |
63494e10404b75704f19d9381eac743d3ec1bd2f | Python | mac389/phikal | /src/old/calculate-effect-matrix.py | UTF-8 | 1,037 | 2.703125 | 3 | [] | no_license | import json
import numpy as np
from progress.bar import Bar
from awesome_print import ap
#create effect matrix
db = json.load(open('../data/db.json','rb'))
effects = open('../data/master-class-list','rb').read().splitlines()
taxonomy = json.load(open('../data/drug-taxonomy.json','rb'))
def process(effect,entry):... | true |
6ec1532cf6d78c660f368ce694d15a9895d6b743 | Python | woosikyang/NLP | /torchtext_tutorial.py | UTF-8 | 1,971 | 3.015625 | 3 | [] | no_license | '''
Creating Dataset
'''
import torch
import torchtext.data as data
import pandas as pd
import os
import pickle
with open('data/data1.txt', 'rb') as f:
train = pickle.load(f)
train = train.iloc[:,:-1]
train = train[['business_goal','class_code']]
train.columns = ['text','label']
with open('data/data2.txt', '... | true |
c3c97d7fb642b1d68b5a7499b5f8eea5a22fb31c | Python | screnary/Algorithm_python | /sort_mian17_14_smallestK.py | UTF-8 | 1,116 | 3.328125 | 3 | [] | no_license | # 最小K个数: 堆排序
# 维护K维大顶堆
class Solution:
def smallestK(self, arr: List[int], k: int) -> List[int]:
"""
input| arr: List[int], k: int
output| List[int]
"""
if k==0: return []
# max heap
def sift_down(arr, root, n):
cur_val = arr[root]
wh... | true |
00f839b6003b83c16d3697f30fae4759ada94a18 | Python | rootid23/fft-py | /heap/meeting-rooms-ii.py | UTF-8 | 1,809 | 3.90625 | 4 | [] | no_license | class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
#W/ Sorting
# Very similar with what we do in real life. Whenever you want to start a meeting,
# you go and check if any empty room available (available > 0) and
# if so take one of them ( available -=1 ). Otherwise,
# you n... | true |
bf3a19938b8d7220b0f74a4a3a5f6d19d08fc143 | Python | openforcefield/openff-interchange | /openff/interchange/_tests/unit_tests/components/test_toolkit.py | UTF-8 | 3,291 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-unknown"
] | permissive | import pytest
from openff.toolkit import Molecule, Topology
from openff.toolkit.topology._mm_molecule import _SimpleMolecule
from openff.utilities.testing import skip_if_missing
from openff.interchange._tests import _BaseTest
from openff.interchange.components.toolkit import (
_check_electrostatics_handlers,
_... | true |
3857855d2b80b4437a16f34eb270752f4658e367 | Python | Zagrebelin/django-voice-machine | /voice_machine/models.py | UTF-8 | 5,440 | 2.671875 | 3 | [] | no_license | import datetime
from django.db import models
from django.template import Context, Template
from django.utils import timezone
from . import humanize
class Holiday(models.Model):
date = models.DateField()
year = models.IntegerField()
def __str__(self):
return self.date.strftime('%d.%m.%Y')
clas... | true |
26e715b219dcd5284406fbda597ade4f11af03e9 | Python | xRame/PyMaster | /web/Json parse/parse.py | UTF-8 | 1,523 | 3.046875 | 3 | [] | no_license | import json
def del_elem(fromd, key):
fromd.pop(key)
def check_type(data, key):
if issubclass(list, type(data[key])):
print("list: ", key)
size_list(data, key, data[key])
pass
elif issubclass(tuple, type(data[key])):
print("tuple: ", key)
pass
elif issubclass(dict, type(data[key])):
print("dict: "... | true |
d637cd6cf51c2e1dd3961b4623685133ab8e4d43 | Python | sdwivedi19/inventory_management_system | /create_db1.py | UTF-8 | 1,721 | 2.59375 | 3 | [
"CC0-1.0"
] | permissive | import sqlite3
def create_db():
con=sqlite3.connect(database=r'pntb.db')#creating connection, r is used to avoid path issue
cur=con.cursor() #to execute queries
#cur.execute("DROP TABLE IF EXISTS employee")
cur.execute("CREATE TABLE IF NOT EXISTS employee(eid INTEGER PRIMARY KEY AUTOINCREMENT,"
... | true |
46116bd167fe6041f4ee907cf094144e5a3db487 | Python | hugovk/mass_shoot_bot | /mass_shoot_bot.py | UTF-8 | 9,114 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
"""
There is a mass shooting on average every day in the United States.
Here are the shootings on this day last year.
https://twitter.com/mass_shoot_bot
"""
import argparse
import csv
import datetime
import os.path
import sys
import webbrowser
import inflect # pip install inflect
import twitter ... | true |
09c2596c53eb41fe76800868ee347a1dc793a1bc | Python | Cloudxtreme/vpnease-l2tp | /src/python/codebay/l2tpserver/config/daemon.py | UTF-8 | 3,969 | 2.546875 | 3 | [
"WTFPL"
] | permissive | """Configuration and start/stop wrapper for a system daemon."""
__docformat__ = 'epytext en'
import os, time
from codebay.common import logger
from codebay.l2tpserver import helpers
from codebay.l2tpserver import constants
from codebay.l2tpserver import runcommand
from codebay.l2tpserver import daemonstart
run_comman... | true |
0e15ea1b8090b6f8c069f652472021d1e0651d9c | Python | martinMutuma/ah-cli | /utils/files.py | UTF-8 | 1,616 | 2.875 | 3 | [] | no_license | import click
import json
import os
import random
import csv
import logging
def create_imports_folder():
if not os.path.isdir('./imports'):
os.mkdir("./imports", 755)
def export_to_json(filename="ah_cli", data={}):
create_imports_folder()
file_name = "./imports/"+filename+'.json'
if os.path.i... | true |
777239c6fe1afa6220808faf73a1ac9edeb674e6 | Python | SBen-IV/TP3-Algo2 | /grafo.py | UTF-8 | 2,301 | 2.984375 | 3 | [] | no_license | from random import choice
class Grafo:
def __init__(self,grafo_dirigido):
self.dic_vertice={}
self.dirigido=grafo_dirigido
def agregar_vertice(self,vertice):
if vertice in self.dic_vertice:
return False
self.dic_vertice[vertice]={}
return True
def borrar_vertice(self,vertice):
if not vertice in self.... | true |
f5ba1fc7fa6bc06e57a4b1174c90cf1e7d84fbdb | Python | dFoiler/a-password-manager | /JASocket/jasocket.py | UTF-8 | 2,147 | 3.484375 | 3 | [] | no_license | ''' Just another socket '''
import json # loads, dumps
import socket # socket
import string # printable
class JASocket:
''' This is a simple socket wrapper class '''
def is_printable(s):
'''
Determines if s contains printable characters
Parameters
----------
s : str
String to test
Returns
... | true |
3e158338fb838fc448c342fc2babd96235478656 | Python | afgane/slurmscale | /slurmscale/nodes/nodes.py | UTF-8 | 7,773 | 2.921875 | 3 | [
"MIT"
] | permissive | """Represent and manage nodes of the target cluster."""
import re
from bunch import Bunch
import pyslurm
from .node import Node
from slurmscale.util.config_manager import ConfigManagerFactory
from slurmscale.util.provision_manager import ProvisionManagerFactory
import slurmscale as ss
import logging
log = logging.g... | true |
7a87c43b79d27ff5e64235dbde04e233c93174cb | Python | Chadyka/python-projects | /4_muveletek/diamond.py | UTF-8 | 412 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
def diamond(num):
if num % 2 == 0:
print("Diamond failed! Input has to be an odd number.")
else:
for i in range(1, num+1, 2):
print(("*"*i).center(num))
for i in range(num-2, -1, -2):
print(("*"*i).center(num))
def main():... | true |
332cecc09eca15451a3537ad26b803a39b030f42 | Python | biglukefish/krystallion | /game.py | UTF-8 | 2,695 | 3.078125 | 3 | [] | no_license | import pygame
import pytmx
import characters
import platforms
import leveldata
"""
holds game object and level objects
"""
class Game(object):
'''class for new instances of game'''
def __init__(self):
# Create level objects
self.current_level_number = 0
self.current_level = Level(leveldata.level_data[0])
s... | true |
1b1ec3d019933e0da8d10ee4ff164bd604318978 | Python | RaskurSevenflame/masterneuralgaswithcnn | /self_organizing_maps/TrainSelfOrganizingMap.py | UTF-8 | 1,686 | 2.640625 | 3 | [] | no_license | import pickle
from self_organizing_maps.Base import Base
from errorcalculations.DistributedCrossEntropy import DistributedCrossEntropy
from errorcalculations.CrossEntropy import CrossEntropy
import numpy as np
from self_organizing_maps.growing_neural_gas.GNG import GNG
class TrainSelfOrganizingMap:
@staticmethod... | true |
998649baa7285122e041cdaf4a5dfbe984bc7c86 | Python | vishnuap/Algorithms | /Chapter-03-Arrays/Zip-It/Zip-It.py | UTF-8 | 1,449 | 5.125 | 5 | [] | no_license | # Chapter-3: Arrays
# Zip-It
# 1. Create a function that accepts two arrays and combines their values sequentially into a new array at alternating indices starting with the first array. Extra values of either array should be included afterwards. Given [1,2] and [10,20,30], return [1,10,2,20,30]
# 2. Combine the two arr... | true |
2afee61559f61ea0344f2ae911d3df7aaf5881e5 | Python | devwill77/Python | /Ex01.py | UTF-8 | 312 | 3.90625 | 4 | [
"MIT"
] | permissive | '''
DESAFIO 01
- Crie um script Python que leia o nome de uma pessoa e mostre
uma mensagem de boas vindas de acordo com o valor digitado.
'''
nome = str(input('\033[36mQual o seu nome?\033[m '))
print('\033[31mOlá\033[m {}{}{}\033[31m, muito prazer em te conhecer!\033[m'.format('\033[1;34m', nome, '\033[m'))
| true |
80e0fce75467513da62c7ee9a65ce8761a5cb7dc | Python | smckay/TicTacToe | /Player.py | UTF-8 | 641 | 3.15625 | 3 | [] | no_license | class Player:
def __init__(self, user_id, arrival_time, address, char):
self.user_id = user_id
self.arrival_time = arrival_time
self.address = address
self.status = "Available"
self.char = char
def get_user_id(self):
return self.user_id
def get_arrival_time... | true |
3eeb4b146a8459dd2b18e27882f883284382c92f | Python | EEExphon/Basic_Codes_for_Python | /LIST/Add element.py | UTF-8 | 289 | 3.96875 | 4 | [] | no_license | print("Make a list!")
BB = [ ]
YON="y"
PPO=0
while YON=="y":
YU=input("Add an element:")
PPO=PPO+1
BB.append(YU)
YON=input("Enter 'y' in order to add a new element.")
input("(press enter to look at the whole list)")
for i in range (0,PPO):
print(i,"---",BB[i-1])
| true |
08f8da6091bab58d711878d3ab166ce8a1bf479d | Python | souzajunior/URI | /uri - 1235.py | UTF-8 | 1,190 | 3.375 | 3 | [] | no_license | N = int(input())
for i in range(N):
entrada = input()
if (len(entrada) % 2 == 0):
primeira_parte = entrada[len(entrada)//2 -1::-1]
segunda_parte = entrada[:len(entrada)//2 -1:-1]
else:
primeira_parte = entrada[len(entrada)//2::-1]
segunda_parte = entrada[:len(entrad... | true |
a3a454a15f2116e23eb438c4340a16fa3b873997 | Python | chiubor/VPhysics | /VPhthon進階練習/03_2_simple_projectile_spring.py | UTF-8 | 1,469 | 2.875 | 3 | [] | no_license | from visual import *
size = 0.2
scene = display(center = vector(0, 4, 0), background = vector(0.5, 0.5, 0))
ball1 = sphere(radius = size, color = color.red, make_trail = True)
ball2 = sphere(radius = size, color = color.blue, make_trail = True)
ball3 = sphere(radius = size, color = color.yellow, make_trail = True)
cub... | true |
9e1e7525e9e9f9eb614430282ece159e10bd843d | Python | kushanjanith/Python-Exercises-from-www.practicepython.org-website | /Exercises/04Divisors.py | UTF-8 | 162 | 3.609375 | 4 | [] | no_license | import math
num = int(input("Number: "))
list = []
x = num / 2
for i in range(1,math.floor(x)):
if num % i == 0:
list.append(i)
print(list) | true |
573d430a0fd110321109d73d100dcf8c3ead2511 | Python | akshay-bhagdikar/FLASK_REST_API | /Create_DB.py | UTF-8 | 3,133 | 2.96875 | 3 | [] | no_license | ## Created by: Akshay Bhagdikar
## Date modified: 11/02/2018
## Application to create a database and tables if they do not exist
import mysql.connector
from mysql.connector import errorcode
#Function to create a connection to the remote database service. Returns cursor and connection object
def create_connection_cur... | true |
b6c79d5fd799e24a60c065010f4cd2e9426bcf96 | Python | chenfeng125078/Test | /work_tips/tensorflow2.1固化模型以及c++上预测/jsonToImg.py | UTF-8 | 1,927 | 2.765625 | 3 | [] | no_license | import numpy as np
import json
import os
import sys
import glob
import cv2
def clip_image(current_image, x1, x2, y1, y2, image_number):
img = cv2.imread(current_image)
# print(img.shape)
cut_img = img[x1:x2, y1:y2, :]
try:
cv2.imwrite("%s.bmp" % image_number, cut_img)
except:
print... | true |
669de0fe16ba945a67922f60e30ac9c2cf213ab2 | Python | IIioneR/VM_HM_14 | /VM_HM_9.py | UTF-8 | 3,463 | 3.921875 | 4 | [] | no_license | import random
class Fighter(object):
max_health = 100
max_armor = 50
def __init__(self, name, health, armour, power):
self.name = name
self.__health = health
self.armour = armour
self.power = power
self.currenthealth = health
self.equipments = []
def... | true |
18c0206e8b9f754ceb8e6bf718bd834cb991b136 | Python | jeMATHfischer/Bayesian_Data_Assimilation | /Sheet8Ex1.py | UTF-8 | 791 | 2.578125 | 3 | [] | no_license | import numpy as np
def likilihood(z):
return np.exp(-(1-z)**2/2)
def normalizer(L,v):
return 1/np.dot(L,v).sum()
def resampler(M, pi):
p_resampled = np.zeros(len(pi))
for i in range(M):
dummy = np.zeros(len(pi))
u = np.random.rand()
ind = (pi.cumsum() > u).sum()
dummy[... | true |
e0f669e4a2da9c192a03d0e2608950068e5804fa | Python | luoxc613/dronedeploy | /dronedeploy.py | UTF-8 | 2,768 | 2.71875 | 3 | [] | no_license | import math
import cv2
import numpy as num
imgpath = 'Camera Localization/IMG_6726.jpg'
img = cv2.imread(imgpath)
print("Processing image: ", imgpath)
img = cv2.resize(img, (500, 900))
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
re, threshold = cv2.threshold(imgray, 150, 255, cv2.THRESH_BINARY)
contourimage, cont... | true |
174b143960437085286e1536ca3b577d78c8bcd7 | Python | ruzhaa/SDA_SI_2015 | /project/IndianaJones/validation.py | UTF-8 | 662 | 2.96875 | 3 | [] | no_license | def validation_max_weight(number):
try:
number == int(number)
except (TypeError, ValueError):
raise TypeError("Error type!")
def validation_commands(split_text):
if split_text[0] == "exit" or split_text[0] == "EXIT":
return True
if len(split_text) != 3:
raise Exception(... | true |
5acd369ebd03515411da37111f7d6807f225ffd2 | Python | ryansalsbury1/NCAA-Tournament-Modeling | /Pre_Tournament_Data_Scrape.py | UTF-8 | 50,928 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 19:11:27 2020
@author: ryansalsbury
"""
#import libraries
try:
import urllib.request as urllib2
except ImportError:
import urllib2
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup
im... | true |
dfd5dc7ab0bb9c4344ca0304b06f262bc7447486 | Python | CorcovadoMing/PuzzleGameRobot | /module/imageprocess.py | UTF-8 | 1,361 | 3.125 | 3 | [] | no_license | from __future__ import print_function
import Image
def cluster(r, g, b):
if r in range(70, 160) and g in range(0, 50): return 0 # red
elif r in range(70, 160) and g in range(50, 120): return 1 # yellow
elif g in range(170, 230) and b in range(0, 100): return 2 # green
elif r in range(0, 70) and b in ra... | true |
c8ccd2f8c87f00dbff3edc9c52a7b7640818c98a | Python | guangyi/Algorithm | /pacscal's_Triangle.py | UTF-8 | 849 | 3.28125 | 3 | [] | no_license | class Solution:
# @return a list of lists of integers
def generate(self, numRows):
if numRows == 0: return []
result = [[1]]
currArr = result[0]
index = 2
for index in range(2, numRows + 1):
newArr = []
for i in range (0, len(currArr)):
... | true |
95ff8ebebe842569f41d2006ff7fb73a4d65c446 | Python | nasa/giant | /giant/ufo/clearable_queue.py | UTF-8 | 4,695 | 3.1875 | 3 | [
"LicenseRef-scancode-us-govt-public-domain",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright 2021 United States Government as represented by the Administrator of the National Aeronautics and Space
# Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved.
from multiprocessing.queues import Queue
from multiprocessing import Value, get_cont... | true |
33666de00d3f24eb66c0a6154dc8672f36924902 | Python | xingyunsishen/pixiu_runoob | /69-二分查找.py | UTF-8 | 830 | 4.28125 | 4 | [] | no_license | #-*- coding: utf-8 -*-
#返回x 在arr中的索引,如果不存在返回-1
def binarySearch(arr, l, r, x):
#基本判断
if r >= l:
mid = int(l + (r -l) / 2)
#元素整好的中间位置
if arr[mid] == x:
return mid
#元素小于中间位置的元素,只需要再比较左边的元素
elif arr[mid] > x:
return binarySearch(arr, l, mid-1, x)
... | true |
e492316a99fe822407cf24d9ca2ad39bda87d6d1 | Python | hu279318344/Python-work | /PycharmProjects/Task/tread/tread2.py | UTF-8 | 469 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@version: Python 3.6
@author: Admin
@license: Apache Licence
@contact: yang.hu@live.com
@software: PyCharm
@file: tread2.py
@time: 2017/4/1 15:21
"""
import threading
import time
class MyThread(threading.Thread):
def_init_(self,name)
threading.Thread.__init__(sel... | true |
cda5f2d46758fcc29f397ebf055932633f744a75 | Python | jiachen247/CodeIt2018-CreditSussie | /codeitsuisse/routes/tallyexpense.py | UTF-8 | 2,033 | 2.578125 | 3 | [] | no_license | import logging
import operator
from flask import request, jsonify;
from codeitsuisse import app;
logger = logging.getLogger(__name__)
@app.route('/tally-expense', methods=['POST','GET'])
def evaluate_tally_expense():
data = request.get_json();
print("input: {}".format(data))
logging.info("data sent for ... | true |
1621d7dcce28e92cac82779a1197bdd7ebf0e987 | Python | yigalirani/leetcode | /20_valid_parentheses.py | UTF-8 | 1,003 | 3 | 3 | [] | no_license | class Solution(object):
def isValid(self, s):
head=[0]
pairs={
'{':'}',
'[':']',
'(':')'
}
def look_ahead():
if head[0]>=len(s):
return '.'
return s[head[0]]
def read_token():
... | true |
d09727386f0b66307c9293c379374c1f57054d99 | Python | ericrommel/codenation_python_web | /Week01/Chapter05/Exercises/ex_5-11.py | UTF-8 | 1,036 | 4.90625 | 5 | [] | no_license | # Write a function is_rightangled which, given the length of three sides of a triangle, will determine whether the
# triangle is right-angled. Assume that the third argument to the function is always the longest side. It will return
# True if the triangle is right-angled, or False otherwise.
#
# Hint: Floating point ar... | true |
7ac965a38cf19be224e0026f4ec768d9d4e3896e | Python | jdrese/PyFlow | /PyFlow/UI/Canvas/SelectionRect.py | UTF-8 | 2,330 | 2.65625 | 3 | [
"MIT"
] | permissive | from Qt import QtGui, QtWidgets, QtCore
class SelectionRect(QtWidgets.QGraphicsWidget):
__backgroundColor = QtGui.QColor(100, 100, 100, 50)
__backgroundAddColor = QtGui.QColor(0, 100, 0, 50)
__backgroundSubColor = QtGui.QColor(100, 0, 0, 50)
__backgroundSwitchColor = QtGui.QColor(0, 0, 100, 50)
__... | true |
37c14cbd197fc30b72e14761ec65045f54186608 | Python | buzhdiao/deep-learning-with-python-notebooks | /tensorflow_version/3.6-classifying-newswires.py | UTF-8 | 8,165 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
import tensorflow as tf
tf.__version__
# '2.0.0-alpha0'
# 本节使用路透社数据集,它包含许多短新闻机器对应的主题,由路透社在1986年发布,
# 它是一个简单的,广泛使用的文本分类数据集,它包含46个不同的主题,某些主题的样本更多
# 但训练集中国每个主题都至少有10个样本
from tensorflow.keras.datasets import reuters
# 加载数据集,num_words意味着只保留训练集中最常出现的10000的单词,不经常出现的单词被抛弃,最终所有评论的维度保持相... | true |
84c48fae3189dc47b766d44397d9afbcdbdd1c40 | Python | LaraCalvo/TalkAboutSeries | /text_preprocess.py | UTF-8 | 1,352 | 3.34375 | 3 | [] | no_license | import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()
###########################
#Text preprocessing methods
###########################
def noise_removal(words):
noise = ['?', '!', '.', ',', '[', ']', '-', '_']
w... | true |
00b8fbaa4f5e47d5f66b4f49cfda887da32d6dc5 | Python | zmxhdu/excel | /新建文件夹/color.py | UTF-8 | 287 | 3.078125 | 3 | [] | no_license | import os
import openpyxl
from openpyxl.styles import Color, Fill
wb = openpyxl.load_workbook('工作簿1.xlsx')
sheet = wb.get_active_sheet()
for i in range(1, sheet.max_row):
for j in range(1, sheet.max_column):
cell = sheet.cell(row=i,column=j)
print(cell.fill)
| true |
5541cf7623e5dad8851e9beac7f1fc186fd42aea | Python | hxperl/hackerrank | /python3/Strings/SwapCase.py | UTF-8 | 267 | 3.453125 | 3 | [] | no_license | def swap_case(s):
tmp = list()
for i in s:
if i.isupper():
tmp.append(i.lower())
else:
tmp.append(i.upper())
return ''.join(tmp)
if __name__=='__main__':
string = 'fsdojfSFQsodifoqf'
print(swap_case(string)) | true |
16086581953ca38f17b934064fe4cce57696924e | Python | kvbik/lightweight-virtualenv | /tests/test_virtualenv.py | UTF-8 | 2,991 | 2.515625 | 3 | [] | no_license |
import sys, os
from os import path
from shutil import rmtree, copytree
from unittest import TestCase
from tempfile import mkdtemp
from subprocess import Popen, PIPE
class TestRunCase(TestCase):
def setUp(self):
# store curr path
self.oldcwd = os.getcwd()
# create test dir structure
... | true |
8013d64de8c454a30b6a7a6ba772d57a506d8b7e | Python | Harrisonsam932/Python | /Previous Courses/KITS/Samples/sample66.py | UTF-8 | 176 | 3.46875 | 3 | [] | no_license |
class SampleDemo:
def display(self,*var):
s = 0
for item in var:
s+=item
print(s)
obj = SampleDemo()
obj.display(10,20,30,40,50)
| true |
5fe16d4a30306fec5dd3e8899ef59604595fb75c | Python | IdanErgaz/test-Delete | /pingByCsvInput.py | UTF-8 | 1,485 | 3.1875 | 3 | [] | no_license | #ping to destination number of times after reading and using csv as input
import csv, time, subprocess
count=0
destination=0
csvFile='EnvVars.csv'
resFile='pingRes.txt'
#Function to read details from csv
def readFromCsv(csvFileName):
with open (csvFileName) as csvfile:
reader = csv.reader(csvfile,delimiter... | true |
91cc671593aeaa567cabc4dc21ea9e6a9000b691 | Python | ducdh-dev/python_quiz | /python_quiz/bitwise_operators.py | UTF-8 | 1,024 | 4.03125 | 4 | [] | no_license | a = int("00111100", 2) # hệ nhị phân
b = int("00001101", 2)
# a >> 2 => 00001111 => dịch phải 2 bit
# a << 2 => 11110000 => dịch trái 2 bit
# a & b => 00001100 => = 1 nếu bit tồn tại ở cả 2 mảng
# a | b => 00111101 => = 1 nếu bit tổn tại ở 1 trong 2 mảng
# ~a => 11000011 =>... | true |
38f9fc72423c5d44704e123c8aa116d7de96cd11 | Python | Fraxinus/stock | /pythonProject/class/matlabtest.py | UTF-8 | 7,878 | 2.75 | 3 | [] | no_license | #_*_coding:utf-8_*_
from PyQt4 import QtGui, QtCore, uic
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as figureCanvas
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import sys
import prettyplotlib as ppl
class DrawWidget(QtGui.QWidget):
... | true |
2c6755bd084a2398bc9087975b7321239e4df8ec | Python | TechInTech/algorithmsAnddataStructure | /numberArray/interview60b.py | UTF-8 | 1,354 | 3.421875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""n个骰子的点数(基于循环求骰子点数)
"""
import copy
G_MAXVALUE = 6 # 骰子点数可自定义
class Solution_60b(object):
def print_probability(self, number):
if number < 1:
return
# probabilities = [[0] * (G_MAXVALUE * number + 1), [0] * (G_MAXVALUE * number + 1)]
ls = [0] * (G_MAXV... | true |
a284b468b3f1037b8f7016ffc468b7365053f43b | Python | 511753317/algorithm | /mechinelearn/kmeans/sklearniris.py | UTF-8 | 549 | 2.875 | 3 | [] | no_license | #!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@time: 2018/06/29 13:52
@author: 柴顺进
@file: sklearniris.py
@software:machineline
@note:
"""
from matplotlib import pyplot as plt
from sklearn import datasets
iris=datasets.load_iris()
x_index=3
color=['blue','red','green']
for label,color in zip(range(len(iris.tar... | true |