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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1e016432cc8e24b453ee9c7d8c2156c6f0dc8cbe | Python | NaviaJin/SortAlgorithm | /heap_sort.py | UTF-8 | 1,911 | 3.65625 | 4 | [] | no_license | # '''
# 当前节点为k,
# 父节点为(k-1)/2
# 左子树为2k+1
# 右子树为2k+2
# '''
def adjust_heap(arr,i):
l_child = 2*i+1
r_child = 2*i+2
n = len(arr)
min = i
if i < int(n/2):
if l_child < n and arr[min] > arr[l_child]:
min = l_child
if r_child < n and arr[min] > arr[r_child]:
... | true |
2b0859c8d61918ed55e7f15f16cdf0634e00937b | Python | git4lhe/Lezhin_data_challenge | /haeunlee/core/transforms.py | UTF-8 | 1,996 | 2.796875 | 3 | [] | no_license | import numpy as np
from sklearn.preprocessing import (
StandardScaler,
OneHotEncoder,
)
from sklearn.feature_extraction.text import HashingVectorizer
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import Fun... | true |
1d41db94d36ba4739835a8c56f587445135e327e | Python | s570504071/learngit | /date/date0927/crawl_liuli.py | UTF-8 | 3,944 | 2.796875 | 3 | [] | no_license | #coding=utf-8
#琉璃神社首页 http://www.hacg.at/
#动漫页面 http://www.hacg.at/wp/category/all/anime/
import urllib2
import urllib
import json
import re
import logging
import pdb
from bs4 import BeautifulSoup as bs
class GetLink(object):
def __init__(self):
#self.url='http://www.hacg.at/wp/category/all/anime/'
... | true |
dd2828173e9ba99516e67147bc939f0500f6c8b9 | Python | okyanusoz/datasets | /tensorflow_datasets/core/utils/generic_path.py | UTF-8 | 3,599 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | true |
f2ecb193d12734cb7869a628a6e6e12521e88ca3 | Python | fwb04/spider | /spydersql/population.py | UTF-8 | 4,913 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
import json
import time
import sqlite3
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
# 获得时间戳
def gettime():
return int(round(time.time() * 1000))
# 爬取人口数据
def getpopulation():
# 用来自定义头部的
headers = {}
# 用来传递参数的
keyvalue = {}
# 目标网址
ur... | true |
bee2474a2912483eaa0632413b45efe2185c7136 | Python | tathagata-raha/CP_python | /binarytree/binartree.py | UTF-8 | 4,325 | 3.09375 | 3 | [] | no_license | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class DiameterOfABinaryTree:
def __init__(self):
self.diameter = 0
def height(self,node):
if node is None:
return 0
lh = self.... | true |
f8af8fddcfacbdacab18b574c58d93e6d061a91f | Python | theSaab/leetcode | /good_pairs.py | UTF-8 | 178 | 3.203125 | 3 | [] | no_license |
def pairs( nums ):
count = 0
for i,num in enumerate(nums):
for elem in nums[i+1:]:
if elem == num:
count += 1
return count | true |
d7a39b42fd4d4b4d816f0b58ac7de95da272b6c5 | Python | ProfAvery/cpsc449 | /stats/bin/stats.py | UTF-8 | 1,702 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import contextlib
import datetime
import random
import sqlite3
import faker
DATABASE = './var/stats.db'
SCHEMA = './share/stats.sql'
NUM_STATS = 1_000_000
NUM_USERS = 100_000
YEAR = 2022
random.seed(YEAR)
fake = faker.Faker()
fake.seed(YEAR)
with contextlib.closing(sqlite3.connect(DATABASE))... | true |
92e2c95afe386cb1346ec5881098d3fbdca69667 | Python | zebravid/python-examples | /acc.py | UTF-8 | 771 | 3.4375 | 3 | [] | no_license | class Acco:
def __init__(self,filename):
self.filepath=filename
with open(filename,"r") as file:
self.balance=int(file.read())
def withdrow(self,amount):
self.balance=self.balance-amount
self.commit()
def deposit(self,amount):
self.balance=self.balance+amount
self.commit()
def commit(self):
with ... | true |
c0bb613bb9518444304d70fe8a1ae1b232820e96 | Python | pitambar3210/exceptionhandling-assignment | /exception_handling_assignment.py | UTF-8 | 771 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
# assignment-5
# exception handling assignment
# In[6]:
# question-1
# write a python program to implement 5/0 and use try/except to catch exceptions
# In[7]:
try:
a = int(input('enter the number: '))
result = 5/a
print(result)
except Exception as e:... | true |
86785476e34f5161a5b43e9b7aebe20119b5dc19 | Python | mmyoungman/advent-of-code | /2017/python/08b.py | UTF-8 | 685 | 2.890625 | 3 | [] | no_license | file = open("08input.txt", 'r')
list = []
while True:
line = file.readline()
if line == '':
break
line = line.rstrip('\n')
list.append(line.split())
file.close()
registers = {}
maxReg = 0
for line in list:
if line[0] not in registers:
registers[line[0]] = 0
if line[4] not in registers:
... | true |
759096c663f01bfd41420c51b89985ec50f18127 | Python | BK-notburgerking/Algorithm | /Programmers/2021DevMatching_행렬테두리회전하기.py | UTF-8 | 1,648 | 2.859375 | 3 | [] | no_license | def solution(rows, columns, queries):
arr = [([0] * columns) for _ in range(rows)]
for i in range(rows):
for j in range(columns):
arr[i][j] = (j + 1) + columns * i
def move(sr, sc, er, ec):
xr, xc = sr, sc # 이전좌표
ex_num = arr[xr][xc] # 이전 값
min_num = ex_num # ... | true |
d11882cc780bbcad65f1e1a4a2e777d19f438b6c | Python | BennyJane/Python_Project_Benny | /数据处理/second_获取极值.py | UTF-8 | 10,451 | 2.921875 | 3 | [] | no_license | #!/user/bin/env Python
#coding=utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mtk
#变量调整
#将第一段代码生成的文件路径拷贝到下方
FirstResult_filepath="E:/编程接单/2019-4-14/提取数据11.csv"
#变化的比率调整
The_Limition=0.001
#最值文件保存的位置及文件名,4列,每列两个点
Final_filename="E:/编程接... | true |
9613ef678b3d0449c4b2df72b31fcc67786c03b9 | Python | carson-1999/Personal-Python-Project | /爬虫相关/carson网易云.py | UTF-8 | 2,782 | 2.765625 | 3 | [] | no_license | import requests
import os
import bs4
from fake_useragent import UserAgent
from selenium import webdriver
from time import sleep
# 随机产生请求头
ua = UserAgent(verify_ssl=False, path='fake_useragent.json')
# 当前目录下 # 创建保存音乐的文件夹
path = os.path.join('网易云音乐')
if not os.path.exists(path):
os.mkdir(path)
# 配置浏览器... | true |
0ce70934824ce96706f4ee53b380db9666a8d459 | Python | hkchengrex/so | /drawing_cross_51455622/main.py | UTF-8 | 1,754 | 3.03125 | 3 | [] | no_license | import cv2
import matplotlib.pyplot as plt
IMG_SIZE = 224
im = cv2.cvtColor(cv2.imread('lena.jpg'), cv2.COLOR_BGR2GRAY)
im = cv2.resize(im, (IMG_SIZE, IMG_SIZE))
# Your detector results
detected_region = [
[(10, 20) , (80, 100)],
[(50, 0) , (220, 190)],
[(100, 143) , (180, 200)],
[(110, 45) , ... | true |
b32a1c6cb78d97704ef19e57ac7f352df2675aca | Python | deanmolinaro/EpicToolbox | /python/EpicToolbox/mkdirfile.py | UTF-8 | 258 | 2.75 | 3 | [
"MIT"
] | permissive | import os
def mkdirfile(outfile):
outfolder,outextension=os.path.splitext(outfile)
if outextension=='':
os.makedirs(outfolder,exist_ok=True)
else:
outfolder,_=os.path.split(outfolder)
os.makedirs(outfolder,exist_ok=True)
| true |
8c505fa9a95d9490a1d10c92e66c0f2c6a9eac37 | Python | parkwisdom/Python-Study-step3 | /day01/day01-01.py | UTF-8 | 407 | 3.21875 | 3 | [] | no_license | #퀴즈 1. 1부터 100까지 3의 배수의 합계.
#클래스 선언부
#함수 선언부
#변수 선언부
start,end,hap = [0]*3
#메인 코드부
if __name__=='__main__':
for i in range(1,101,1):
if i%3==0:
hap +=i
else:
pass
print(hap)
# s=[]
# for i in range(1,101):
# if i%3==0:
# a=+i
# s.append(a... | true |
d28cded78d668322935dd6ddc47c8a278addc115 | Python | lilberick/Competitive-programming | /online-judge-solutions/Codeforces/1631A.py | UTF-8 | 375 | 3.15625 | 3 | [] | no_license | #https://codeforces.com/problemset/problem/1631/A
#Lang : Python 3.8
#Time : 46 ms
#Memory : 0 KB
for _ in range(int(input())):
n=int(input())
a,b=list(map(int,input().split()))[:n],list(map(int,input().split()))[:n]
a2,b2=list(range(n)),list(range(n))
for i in range(n):
a2[i],b2[i]=ma... | true |
d53610caeb4a37f8846daabd7d0cb91eed3f9775 | Python | PiyushChaturvedii/My-Leetcode-Solutions-Python- | /Leetcode 5/Maximize Distance to Closest Person.py | UTF-8 | 559 | 3.265625 | 3 | [] | no_license | class Solution:
def maxDistToClosest(self, seats):
"""
:type seats: List[int]
:rtype: int
"""
distance=1
i=0
n=len(seats)
while i<n and seats[i]==0:
i+=1
distance=max(distance,i)
while i<n:
j=i+1
... | true |
493def4a2db9dfc2476d6690ca32a793fb3a0db1 | Python | tlechien/PythonCrash | /Chapter 6/6.9.py | UTF-8 | 598 | 4.53125 | 5 | [] | no_license | """
6-9. Favorite Places: Make a dictionary called favorite_places. Think of three
names to use as keys in the dictionary, and store one to three favorite places
for each person. To make this exercise a bit more interesting, ask some friends
to name a few of their favorite places. Loop through the dictionary, and print... | true |
bfbfa5820c7500639a08ce08b79d6cf54fabaa3b | Python | Saranya-sharvi/saranya-training-prgm | /exc-pgm/subclass.py | UTF-8 | 278 | 3.546875 | 4 | [] | no_license | """Define a class named American and its subclass NewYorker"""
#parent class creation
class American(object):
pass
#subclass creation
class NewYorker(American):
pass
anAmerican = American()
aNewYorker = NewYorker()
#print result
print(anAmerican)
print(aNewYorker)
| true |
8e11e3746e769e5becab109eec2993d0b7954923 | Python | ljinwoo9633/Stock-Bot | /merge.py | UTF-8 | 545 | 2.78125 | 3 | [] | no_license | import csv
resultFile = open('./mergedStock.csv', 'w', encoding='euc-kr', newline='')
fileOne = open('./mergedStock1.csv', 'r', encoding='euc-kr')
fileTwo = open('./mergedStock2.csv', 'r', encoding='euc-kr')
readerOne = csv.reader(fileOne)
readerTwo = csv.reader(fileTwo)
writer = csv.writer(resultFile)
index = 0
fo... | true |
b0bada48bc0e69f19660dbbfa48503799782f0eb | Python | abheeshta97/college-project | /fib_encrypt_1.py | UTF-8 | 3,221 | 3.40625 | 3 | [] | no_license | from tkinter import Tk, messagebox
import creationANDopening as note
#---INITIALIZATION OF LOWER AND UPPER ASCII LIMIT
ASCII_MIN = 33
ASCII_MAX = 126
#---FUNCTION TO CONVERT LIST TO STRING---
def convertToString(s):
#---INITIALIZATION OF STRING---
new = ""
#---TRAVERSES THE STRING---
for x in s:
... | true |
c95ce89ff463342acdabedf185c79d4a5f46bc46 | Python | acad2/crypto | /designs/other/math/printnumbers.py | UTF-8 | 1,058 | 3.4375 | 3 | [] | no_license | # every N numbers has N as a factor
# 1 2 3 4 5 6 7 8 9
# 2 4 6 8
# 3 3 3
# 5 5
# 7
from crypto.utilities import prime_generator
def prime_generator():
filter = dict()
prime = 2
filter[2] = 4
for number in itertools.count(3):
if number not in ... | true |
bd27243d1395cf33d2e7538a9e653eefb60765fe | Python | bobqywei/curiosity-driven-exploration | /icm.py | UTF-8 | 2,289 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
from modules import FeatureEncoderNet
class ICMAgent(nn.Module):
def __init__(self, action_space_size, config, device):
super(ICMAgent, self).__init__()
features_size = 288 # same as ActorCritic
self.device = device
self.ac_size = action_space_size... | true |
e8d47ef4cae1e15485df40de60d5257dd94b59a5 | Python | e-south/CS506Spring2021Repository | /Police_Budget_Overtime_Project/code/count_event_clus_desc_records.py | UTF-8 | 2,623 | 2.9375 | 3 | [] | no_license | """
count_event_clus_desc_records.py
Counts/plots number of records in each file in /event_clus_desc
"""
import pandas as pd
import matplotlib.pyplot as plt
def plot_records():
# List of cluster descriptions
desc = ['BAA_BOSTON_MARATHON',
'BFS_EVENT_ACTIVITY',
'BRIGHTON_DAY_PARADE',
'CARIBBEAN_C... | true |
ed6ab5823065d56f7dfd2db98a1cd1033fe1a769 | Python | dvandra/fabric8-analytics-nvd-toolkit | /src/toolkit/transformers/hooks.py | UTF-8 | 2,377 | 3.484375 | 3 | [
"Apache-2.0"
] | permissive | """This module contains the Hook class to handle pipeline hooks."""
import weakref
class Hook(object):
"""Convenient class for handling hooks.
:param key: str, unique identifier of the hook
:param func: function to be called by the hook
The function can not modify any items fed by its arguments... | true |
1dd233b59745f489fabad83100e6461141c217a1 | Python | Patergia/pwp-capstones | /TomeRater/TomeRater.py | UTF-8 | 5,960 | 3.28125 | 3 | [] | no_license | class User(object):
def __init__(self, name, email):
self.name = name
self.email = email
self.books = {}
def get_email(self):
return self.email
def change_email(self, address):
self.email = address
print(self.name + "'s email address has been updated")
... | true |
70589b89b7ae9910315be51ad1a8c31190a8c916 | Python | nekapoor7/Python-and-Django | /PythonNEW/Function/UppercaseAndLowercase.py | UTF-8 | 383 | 3.84375 | 4 | [] | no_license | """Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters.
Go to the editor
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12"""
import re
t = input()
upper = re.findall(r'[A-Z]',t)
low... | true |
d0a9081808fccdee53da61feabdeb38cf45379f8 | Python | rikard-helgegren/Big_Data_ST10 | /plotting boundaries/Main.py | UTF-8 | 2,694 | 2.921875 | 3 | [] | no_license | from read_CSV import read_CSV
from split_data import split_data_list
from misslabel_data import misslabel_data_list
from convert_data import convert_data
import copy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.ensemble import Rando... | true |
e490b3bc823929801543aca2d18ea26cdff6ffd0 | Python | shangguanxiaoguan/Python- | /requestsdemo/17_pytest_fixture/test_pytest_fixture.py | UTF-8 | 291 | 2.609375 | 3 | [] | no_license | import pytest
@pytest.fixture
def first_fix():
return ["a"]
def test_case01(first_fix):
first_fix.append("b")
assert first_fix == ["a", "b"]
print(first_fix)
if __name__ == '__main__':
pytest.main(["-s"]) # 以这种方式运行,文件名必须以test_开头
| true |
9b0d91806c3cff5f9682da3a9f3840b913743cb4 | Python | Andrey-Raspopov/PyXelate | /pyxelate.py | UTF-8 | 562 | 2.640625 | 3 | [] | no_license | import PIL.Image as Image
from imageio import imwrite
from Image import PyImage
from Palettes import Palettes
color_palette = Palettes['bw']
if __name__ == "__main__":
img = PyImage('test.png', 400, Palettes['bw'])
img.load()
img.pyxelate()
filename_parts = img.filename.rsplit('.', 1)
filename_p... | true |
deb4052645e7300fa1d7c26c3aeee44bdee050fa | Python | BanisharifM/Problems | /Quera/3429/solution.py | UTF-8 | 98 | 3.09375 | 3 | [] | no_license | #Yakhdar chi
T=int(input())
if T>100 :
print("Steam")
elif T<0 :
print("Ice")
else :
print("Water")
| true |
e7d7f8a90a56f05219bc6c1fd2115ed7230618df | Python | dibovdmitry/laba5 | /Hard.py | UTF-8 | 282 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python 3
# -*- coding: utf-8 -*-
import sys
if __name__ == '__main__':
p1 = input('Напишите первое предложение 1 ').split()
p2 = input('Напишите второе предложение 2 ')
print(*(i for i in p1 if i in p2))
| true |
7cd99c4fb6cd24103cea76b0a98621e9e2b5f77b | Python | Silver-L/TFRecord_example | /read_record.py | UTF-8 | 1,125 | 2.65625 | 3 | [] | no_license | import os
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
def main():
file_name = ['./tfrecord/recordfile_{}'.format(i+1) for i in range(60)]
dataset = tf.data.TFRecordDataset(file_name)
dataset = dataset.map(lambda x: _parse_function(x... | true |
9becbfc9c013856e9c139e316f1784a54500ae87 | Python | serkanishchi/zerosleap | /zerosleap/gui/composer.py | UTF-8 | 7,482 | 2.921875 | 3 | [] | no_license | """
Manages video reading, video processing, track
processing and compose raw frames with processed
data. Acts as a provider for video player.
This class is a content producer for video player.
And generates frames with raw and processed data.
"""
from threading import Thread
import time
from queue import Queue
impor... | true |
583ffa23a18e2dd7ac957bcb462bbc0a7e2eba75 | Python | kenesbekov/PPII2021SPRING | /tsis6/13.py | UTF-8 | 307 | 3 | 3 | [] | no_license | def pascal_triangle(n):
row = [1]
y = [0] # for validate working zip [1, 1, 0] + [0, 1, 1] = [1, 2, 1]
# (1, 0), (1, 1), (0, 1) l l l r r r l+r l+r l+r
for _ in range(n):
print(row)
row = [l+r for l,r in zip(row+y, y+row)]
pascal_triangle(int(input())) | true |
92afd13ad2744f1153e0152ef56461d45979d5a8 | Python | kdm604/TIL | /알고리즘문제/말이 되고픈 원숭이.py | UTF-8 | 1,384 | 2.984375 | 3 | [] | no_license | import sys
from collections import deque
# K = 0 ~ 30 , W,H = 1 ~ 200 최대 200 X 200 판
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
hdx = [-2, -2, 2, 2, -1, 1, -1, 1]
hdy = [-1, 1, -1, 1, -2, -2, 2, 2]
def bfs(x, y, cnt, move):
global ans
Q = deque()
Q.append((x, y, cnt, move))
while len(Q):
x, ... | true |
16ba54df176ae8b1b5bda469584f6ea1ad15c4f4 | Python | Junhyun-Nam-Olin/SoftDesSp15 | /proj3/word_frequency.py | UTF-8 | 1,991 | 3.09375 | 3 | [] | no_license | def process_text(filename):
"""Makes histogram of text"""
d = dict()
fp = open(filename, 'r')
for line in fp:
for word in line.split():
while not (word == '' or word[0].isalpha() or word[0].isdigit()):
word = word[1:]
while not (word == '' or word[-1].isalpha() or word[-1].isdigit()):
word = word[0... | true |
c8100ca8e45a12602154fb9d1811b78f9d7f3457 | Python | lyfree132/Relation_Extraction-1 | /preprocess_ace/c_relation.py | UTF-8 | 5,863 | 2.703125 | 3 | [] | no_license | #coding:utf-8
import numpy as np
class Relation:
# Definition a class to turn relation mention to embedding
def __init__(self):
self.mention = "" # content of mention
self.mention_pos = [0, 0] # bias of mention
self.arg1 = "" # content of arg1
self.arg1_pos = [0, 0] # bias... | true |
80295d537df8a4358cd98c96e6d441f11d24f61f | Python | nandakoryaaa/pypy | /app/models/usertable.py | UTF-8 | 823 | 2.921875 | 3 | [
"CC0-1.0"
] | permissive | from app.models.userdata import UserData
class UserTable:
COUNT = 10
def __init__(self, file = None):
self.table = [None] * self.COUNT
self.file = file
for i in range(self.COUNT):
self.table[i] = UserData()
if file is not None:
self.read()
def read(self):
fp = op... | true |
5cf4eaf8ce8d5a1bb8f0ce325a88bd11a124e743 | Python | nikhilsopori/Speech-To-Text | /Python/Speech Recognition.py | UTF-8 | 662 | 2.9375 | 3 | [] | no_license | #Installing of the Python Package
#**Note that the SpeechRecoginition will only work for Python (2,2.7,3,3.3,3.4,3.5,3.6)
!pip install SpeechRecognition
!pip install librosa
!pip install soundfile
#Import Speech Recognition Package
import speech_recognition as sr
import librosa
import soundfile as sf
import wave
r... | true |
d32a770ed3303fc423256a17d5e1041bb6f265da | Python | ytsmm/mybot | /tokenizer.py | UTF-8 | 194 | 3.03125 | 3 | [] | no_license | import nltk
# Разбиение на предложения и слова
def tokenizer(raw):
raw = raw.lower()
word_tokens = nltk.word_tokenize(raw)
return word_tokens
| true |
83e980a39c54fb2fb2d88457c7c21dff67ca43ff | Python | alanboaventura/trabalho2-ia | /caixeiroviajante/funcaoAptidao.py | UTF-8 | 1,424 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy
def apt_func(populacao, distanciacidades, n_rotas):
# Gera a matriz 20x21 da população onde a última coluna é a cópia da primeira coluna.
# A última coluna é igual a primeira pois o caixeiro viajante precisa retornar a cidade original.
tour = num... | true |
9cdde04b021695620bbbf8627c50b82a8fe412da | Python | ro13hit/Competitive | /alienpiano.py | UTF-8 | 551 | 3.0625 | 3 | [] | no_license | def main():
n= int(input())
a = list(map(int,input().split()))
b,c,cnt = 0,0,0
for i in range(n):
if a[i]>a[i-1]:
b+=1
c=0
if b == 4:
b =0
cnt+=1
elif a[i]<a[i-1]:
c+=1
... | true |
8818af93a371466c16b73a575ad14dd96e7dee9a | Python | xiaoheizai/python_for_leetcode | /腾讯top50/89 格雷编码.py | UTF-8 | 1,324 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Apr 13、4
@author: xiaoheizai
"""
'''
格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。
给定一个代表编码总位数的非负整数 n,打印其格雷编码序列。格雷编码序列必须以 0 开头。
示例 1:
输入: 2
输出: [0,1,3,2]
解释:
00 - 0
01 - 1
11 - 3
10 - 2
对于给定的 n,其格雷编码序列并不唯一。
例如,[0,2,3,1] 也是一个有效的格雷编码序列。
00 - 0
10 - 2
11 - 3
01 - 1
示例 2:
输入: 0
输出: [... | true |
855271ed376161d286ef28c15247ff8609648f56 | Python | Qsingle/MedicalImage | /datasets.py | UTF-8 | 8,327 | 2.515625 | 3 | [
"MIT"
] | permissive | #-*- coding:utf8 -*-
#!/usr/bin/env python
'''
@Author:qiuzhongxi
@Filename:datasets.py
@Date:2020/3/7
@Software:PyCharm
Some Dataset Class for this project
'''
from torch.utils.data import Dataset
import torch
import cv2
from PIL import Image
import numpy as np
import os
from matplotlib import pyplot as plt
from albu... | true |
525b209c4d2485771d3a2e028db74761d73068f8 | Python | RyanArnasonML/stock-analysis | /stock_analysis/candles.py | UTF-8 | 3,004 | 3.40625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""This cell defineds the plot_candles function"""
def plot_candles(pricing, title=None, volume_bars=False, color_function=None, technicals=None):
""" Plots a candlestick chart using quantopian pricing data.
Author: Daniel Treiman
... | true |
acd7ce4fe5cc43a928bce0fd3154ded1c6b4990a | Python | HukLab/3d-integ-analysis | /bin/mle.py | UTF-8 | 8,422 | 2.828125 | 3 | [] | no_license | import logging
import itertools
import numpy as np
from scipy.optimize import minimize
logging.basicConfig(level=logging.DEBUG)
APPROX_ZERO = 0.0001
add_dicts = lambda a, b: dict(a.items() + b.items())
make_dict = lambda key_order, thetas: dict(zip(key_order, thetas))
def theta_to_dict(thetas, theta_key_order, the... | true |
9994101c97c30cc222aed6aff7bec89e0e49fde2 | Python | piushvaish/pythonProgrammingExcercises | /List/List.py | UTF-8 | 1,695 | 3.796875 | 4 | [] | no_license | # ipAddress = input('please enter an ip address : ')
# print(ipAddress.count('.'))
# parrotList = [' non pinin',' no more',' a stiff',' bereft of live']
#
# parrotList.append('Norwegian blue')
# for state in parrotList:
# print('The parrot is ' + state)
# even = [2,4,6,8]
# odd = [1,3,5,7,9]
#
# numbers = even +... | true |
4126e0004f24474d851b694b6acb08d19c2221f1 | Python | santoshghimire/typeform | /postapi/typeform.py | UTF-8 | 8,056 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python2
import json
import sys
import urllib
import pprint
from sheets_typeform import Sheets
TYPEFORM_JSON_API = 'https://api.typeform.com/v1/form/njxhSJ?key=cd3c5967bd6331d8fdbe134f81cc9accfdeecfc4'
def tf_load_data(json_file_path=None, answers_json=None):
'''
Row structure:
B. ... | true |
a340bcdc4c12b705b1a52dfe508ffc84aec10083 | Python | k123321141/ADLxMLDS2017 | /project/mnist-cluttered/png2npz.py | UTF-8 | 1,950 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | import os, sys
import argparse
import numpy as np
from scipy.ndimage import imread
from os.path import join
def parse():
parser = argparse.ArgumentParser(description='utils')
parser.add_argument('train_dir', help='png image files directory')
parser.add_argument('valid_dir', help='png image files directory... | true |
0aa59a1e1255bd2e2dfce82226cb5fc0e0d79b0e | Python | karthikbharadwaj/CodeRepo | /Practice/leetcode/is_palindrome.py | UTF-8 | 355 | 3.34375 | 3 | [] | no_license | __author__ = 'karthikb'
class Solution:
# @return a boolean
def isPalindrome(self, x):
x = str(x)
length = len(x)
i,j = 0,length-1
while i <=j:
if x[i] != x[j]:
return False
i += 1
j -= 1
return True
s = Solution()
pri... | true |
416c041e0fda16d02bbd39b54dd36091e8ee1bb5 | Python | IntroToCompBioLSU/week12 | /assignments/ewhart1/try_except.py | UTF-8 | 199 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
try:
int = int(input("Enter a number: "))
except:
print("Sorry, the instructions weren't very specific. Please enter an integer next time.")
# DB: Simple, but good example! | true |
3fd85b2b22357df4249f43d37d2c7bff02db36d2 | Python | HaohanWang/backProjection | /CNN/optimizers.py | UTF-8 | 3,914 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import theano
import theano.tensor as T
import numpy as np
__author__ = "Sandeep Subramanian"
__maintainer__ = "Sandeep Subramanian"
__email__ = "sandeep.subramanian@gmail.com"
class Optimizer:
"""
Optimization methods for backpropagation
"""
def __init__(self):
"""
... | true |
09feba41ac70cb3b8c9d7793948d70abceb2ec85 | Python | Candy-YangLi/ylscript | /python/firstdemos/demo170704.py | UTF-8 | 99 | 3.71875 | 4 | [] | no_license | g = [x * x for x in range(1,10)]
g = (x * x for x in range(1,10))
for n in g:
print(n,end=' ')
| true |
ae19bdf6504573431f7763531d18f6172642f978 | Python | EruditePanda/ingestors | /ingestors/support/pdf.py | UTF-8 | 1,542 | 2.578125 | 3 | [
"MIT"
] | permissive | import os
import glob
import uuid
from normality import collapse_spaces # noqa
from pdflib import Document
from ingestors.support.temp import TempFileSupport
from ingestors.support.shell import ShellSupport
from ingestors.support.ocr import OCRSupport
class PDFSupport(ShellSupport, TempFileSupport, OCRSupport):
... | true |
f75344e3c13c6bc297f8a5dacdd8dc4c612e3000 | Python | roynwang/mbt_test | /Action.py | UTF-8 | 297 | 2.5625 | 3 | [] | no_license | class Action(object):
def __init__(self):
self.name = 'test'
def check(self):
raise NotImplementedError()
#it should return a status
def transfer(self,status):
raise NotImplementedError()
def execute(self):
raise NotImplementedError()
def __str__(self):
return str(self.name)
| true |
260757c56c34dbb3446e159e1e426ace5292d695 | Python | danong/leetcode-solutions | /solutions/group_anagrams.py | UTF-8 | 563 | 3.390625 | 3 | [] | no_license | from collections import Counter, defaultdict
def counter_to_tuple(counter):
chars = [0] * 26
for char, count in counter.items():
chars[ord(char) - ord('a')] = count
return tuple(chars)
class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: Li... | true |
f4efab80b62284434978c0f2be11f6ca30b8097d | Python | BogiTheNinjaTester/TestAppChat | /wtform_fields.py | UTF-8 | 1,973 | 2.75 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Length, EqualTo, ValidationError
from models import User
from passlib.hash import pbkdf2_sha256
def invalid_credentials(form, field):
''' Method checks if credentials are valid... | true |
a1f4885f6c7a0d69591b57947deac0af456381f6 | Python | kimx3129/Simon_Data-Science | /AWSLearners/9장/dynamodb_bulk_upload.py | UTF-8 | 1,230 | 2.65625 | 3 | [] | no_license | ### 다이나모디비 실습 Lambda Function 코드 ###
# 코드 - 다이나모디비 다량의 데이터 업로드
import boto3
def lambda_handler(event, context):
client = boto3.resource('dynamodb')
table = client.Table('aws-learner-customer-transaction-table')
with table.batch_writer() as batch:
batch.put_item(
Item={
'... | true |
a0f40a97c162d152309cf4ed701492c810db63ef | Python | evespimrose/for_2Dgameprograming | /for_In_Class/09_10.py | UTF-8 | 475 | 2.640625 | 3 | [] | no_license | from pico2d import *
open_canvas()
boy = load_image('C:/Users/Jang/Desktop/gitupload/for_In_Class/run_animation.png')
gra = load_image('C:/Users/Jang/Desktop/gitupload/for_In_Class/grass.png')
x = 0
frame = 0
while (x<800):
clear_canvas()
gra.draw(400,30)
boy.clip_draw(frame*100,0,100,1... | true |
e80023de6facc15e97871cbe1438f0d05317e8e6 | Python | fovegage/learn-python | /Pytho内建函数/进制.py | UTF-8 | 289 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/12/29 17:20
# @Author : fovegage
# @Email : fovegage@gmail.com
# @File : 进制.py
# @Software: PyCharm
# oct 八 bin 二 hex 十六
# oct 八进制
# return oct
print(oct(6))
# bin() 二进制
# return bin
print(bin(6))
# hex 16进制
print(hex(6)) | true |
cc8896da1a8c4d536f290c9e4c90af488c303c7f | Python | somnoynadno/shift_summer_2019 | /ssrf/app/port_scan.py | UTF-8 | 220 | 2.859375 | 3 | [] | no_license | import requests
for x in range(1,65536):
r = requests.get('http://127.0.0.1/get_url_requests?url=http://127.0.0.1:'+str(x)+'/')
if r.status_code != 200:
print("port", x, "closed");
else:
print("port", x, "open"); | true |
0bff07bd9a2945de412a6a6c14e16e5e51a45417 | Python | kushal200/python | /Basic/triangle.py | UTF-8 | 239 | 3.59375 | 4 | [] | no_license | a=int(input("Enter the value of a:"))
b=int(input("Enter the value of b:"))
c=int(input("Enter the value of c:"))
s=(a+b+c)/2
print("s=",s)
Area_Of_Triangle=(s*(s-a)*(s-b)*(s-c))-0.5
print("The area of taingle is :%0.2f" %Area_Of_Triangle) | true |
0d142dcd7bad8206fdec1dc5ca63ff4e7ac24b31 | Python | williamhogman/operant | /operant/currency.py | UTF-8 | 1,987 | 3.078125 | 3 | [
"BSD-2-Clause"
] | permissive | """Module for currency systems.
Currencies are a closely related to points, but differ in that they
are often exchanged for rewards of some kind. The value of a
currencies stem from what they are traded in, while points often carry
some intrinsic value. A currency loses this intrinsic value because it
is redeemable.
"... | true |
90dcfc13541f244ddd3147dfbd06c67494b2ca10 | Python | gixita/pulsarnews | /tests/conftest.py | UTF-8 | 1,465 | 2.578125 | 3 | [
"MIT"
] | permissive | import pytest
from app import create_app, db
from app.models import User
from configtest import Config
@pytest.fixture(scope='module')
def new_user():
user = User(username="kris", email="kris@pulsarnews.io")
return user
@pytest.fixture(scope='module')
def test_client():
flask_app = create_app(Config)
... | true |
fef6bdb68e79d6bd1508d5b78e63d56b82f85791 | Python | BandiSaikumar/PythonDjangoFullStackDevolpment | /Python/PythonIntroduction/lesson2/task6/assignments.py | UTF-8 | 95 | 3.125 | 3 | [] | no_license | a = 54.0
print("a = " + str(a))
a -= 4
print("a = " + str(a))
a += 10
print("a = " + str(a)) | true |
927c2f9e84a7193cb4e8e785271d6427bef23266 | Python | xogxog/SWEA | /IM대비/1926.간단한369게임.py | UTF-8 | 345 | 3.28125 | 3 | [] | no_license |
N = int(input())
for i in range(1,N+1) :
cnt = 0
num = i
# print(num, cnt)
while num>0 :
if num % 10 == 3 or num % 10 == 6 or num % 10 == 9 :
cnt += 1
num //= 10
# print(num,cnt)
if cnt == 0 :
print('{} '.format(i),end='')
else :
print('{} '.... | true |
7c68eec0d945113994ffee5d632c2d59122a3d16 | Python | bitwoman/curso-em-video-python | /Curso de Python 3 - Mundo 1 - Fundamentos/#015.py | UTF-8 | 514 | 4.34375 | 4 | [
"MIT"
] | permissive | #Exercício Python 015: Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a
#quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0,15 por Km rodado.
km_traveled = float(input('Enter km travaled by car: '))
days_used = i... | true |
2f13946cdce3d20746e3ba8658a859583c1f6ba6 | Python | 05satyam/Buggy-Pinball-alpha | /Gradient Descent and Variants/GDmeasures.py | UTF-8 | 1,654 | 3.203125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from functions import *
from learningRates import *
import random
import time
times=[]
a = simpleLR(0.2)
#gama=0.9
gama1=0.8
gama2=0.999
e=1e-6 #standard value to avoid dividing with 0
algo_trials=100000
low=-10
high=10
for exp in range(0, algo_trials)... | true |
7c77a5d9001a9d32e62dde65c52bd78259e65c29 | Python | Sanchi02/Dojo | /LeetCode/Logical/MeetingRooms.py | UTF-8 | 1,299 | 3.28125 | 3 | [] | no_license | # Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
# Example 1:
# Input: [[0, 30],[5, 10],[15, 20]]
# Output: 2
# Example 2:
# Input: [[7,10],[2,4]]
# Output: 1
class Solution:
def minMeetingRooms(se... | true |
4ee2bfac8eb86c474a47637bcc31b7afa2a9810d | Python | gkupdx/CS350-Project | /_pythonCodeForTestFiles/measuringResult.py | UTF-8 | 4,209 | 3.25 | 3 | [] | no_license | # This file measure the time of sorting experimental data using the different sorting algorithms
from generateBinary import arraySetBinaryDigits
from generateRandom import arraySetRandom
from generateReverseSorted import arraySetRevSorted
from generateSorted import arraySetFiftyUnsorted
from generateSorted import arra... | true |
888ea6949978849ac56d11f2d59f0dfeefd727ff | Python | FrancisFan98/algorithm-practices | /POKERS.py | UTF-8 | 2,433 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
import random, math, collections
def shuffle(deck):
length = len(deck)
for e in range(0, length-1):
swap(deck, e, random.randrange(e, length))
def swap(deck, i, j):
deck[i], deck[j] = deck[j], deck[i]
def test_shuffle(shuffler, deck, n = 100000):
ex = (n*1.)/math.factorial(len(deck))
resul... | true |
24bc5fc0cf6053fb4e69ca145ac3b3f7862aa36f | Python | trevorandersen/colour | /colour/examples/contrast/examples_contrast.py | UTF-8 | 3,310 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Showcases contrast sensitivity computations.
"""
from pprint import pprint
import numpy as np
from scipy.optimize import fmin
import colour
from colour.utilities import as_float, message_box
from colour.plotting import colour_style, plot_single_function
message_box('Contrast Sensitivity ... | true |
229e35564b9270f7cfe40a63479d391773a6efb0 | Python | dashang/ga-learner-dsmp-repo | /Banking_Inference_from_Datacode.py | UTF-8 | 2,473 | 2.984375 | 3 | [
"MIT"
] | permissive | # --------------
import pandas as pd
import scipy.stats as stats
import math
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#Sample_Size
sample_size=2000
#Z_Critical Score
z_critical = stats.norm.ppf(q = 0.95)
# path [File location variable]
data = pd.read_csv(path)
... | true |
22dbde10dd1b79866048a613616ebad1dcb3f8b2 | Python | davis-lin/Python-Practices | /4.7.6.py | UTF-8 | 89 | 2.59375 | 3 | [] | no_license | def echo(anything):
'echo returns its input argument'
return anything
help(echo) | true |
119235e1dba8ab57283113573240a645b45b2e32 | Python | LwqDeveloper/ToolShell | /selectorUnrefs/FindSelectorUnrefs.py | UTF-8 | 11,719 | 2.609375 | 3 | [] | no_license | # coding:utf-8
import os
import re
import sys
import getopt
reserved_prefixs = ["-[", "+["]
# 获取入参参数
def input_parameter():
opts, args = getopt.getopt(sys.argv[1:], '-a:-p:-w:-b:',
['app_path=', 'project_path=', 'black_list_Str', 'white_list_str'])
black_list_str = ''
whi... | true |
72308ed09c968b3db6f38f5ca92e8814c1d32ce9 | Python | VamsiMohanRamineedi/Algorithms | /538. Convert BST to Greater Tree.py | UTF-8 | 1,541 | 3.78125 | 4 | [] | no_license | # Convert BST to Greater Tree: Time: O(n), space: O(log n) average case and O(n) worst case
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def __init__(self):
self.total = 0
... | true |
7aa8788a240f74e05010a453615346c0eb7b1a7b | Python | mohitreddy1996/IEEE_Summer_Projects-2015 | /IEEE-Applied-Python/merge_sort.py | UTF-8 | 563 | 3.015625 | 3 | [] | no_license | import sys
def merge(a,p,q,r):
n1=q-p+1
n2=r-q
L=[0]*(n1)
R=[0]*(n2)
for i in range(0,n1):
L[i]=a[p+i]
L.append(sys.maxint)
for i in range(0,n2):
R[i]=a[q+i+1]
R.append(sys.maxint)
w=0
e=0
for i in range(p,r+1):
if L[w]<R[e]:
a[i]=L[w]
w=w+1
else:
a[i]=R[e]
e=e+1
def mergesort(a,p,r)... | true |
a5aa56d9b5a2d611c63bf64888d0b28262e406f9 | Python | yiming1012/MyLeetCode | /LeetCode/递归/779. 第K个语法符号.py | UTF-8 | 1,153 | 3.703125 | 4 | [] | no_license | """
779. 第K个语法符号
在第一行我们写上一个 0。接下来的每一行,将前一行中的0替换为01,1替换为10。
给定行数 N 和序数 K,返回第 N 行中第 K个字符。(K从1开始)
例子:
输入: N = 1, K = 1
输出: 0
输入: N = 2, K = 1
输出: 0
输入: N = 2, K = 2
输出: 1
输入: N = 4, K = 5
输出: 1
解释:
第一行: 0
第二行: 01
第三行: 0110
第四行: 01101001
注意:
N 的范围 [1, 30].
K 的范围 [1, 2^(N-1)].
来源:力扣(LeetCode)
链接:https://leetcode-... | true |
adf0c78ac09a808f316f2db05d20b38db31105cd | Python | Algolytics/dq_client | /dq/response.py | UTF-8 | 1,191 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import json
from .error import DQError
class Response:
def __init__(self, method, status, content):
self.method = method
self.status = status
self.content = content
def is_ok(self):
return self.status and int(self.status) < 400
def json(self):
... | true |
993fbda9136d96d97b2956c35e86932c9f24c2c9 | Python | ezradiniz/blockchain-from-scratch | /blockchain.py | UTF-8 | 702 | 2.953125 | 3 | [
"MIT"
] | permissive | from block import Block
class Blockchain(object):
def __init__(self):
self.chain = [Block.genesis()]
def add_block(self, data):
block = Block.mine_block(self.chain[len(self.chain) - 1], data)
self.chain.append(block)
return block
def is_valid_chain(self, chain):
g... | true |
100c35d9f0d8e1acd373668aba11aca7fdd73af6 | Python | amoisoo/APPJINYOUNG | /00_doc/test/soup4.py | UTF-8 | 3,045 | 2.6875 | 3 | [] | no_license |
table = """
<table align="center" class="table mb-0 table-bordered table-sm table-width-80">
<thead>
<tr>
<th style="width: 19.9197%;">label</th>
<th style="width: 19.881%;">한국</th>
<th style="width: 19.8809%;">중국</th>
<th style="width: 20.0803%;">일본</th>
<th style="width: 20.0000%;">인도</th>
</tr... | true |
f7a7d3f17025e29f3f032972153ebb99a6b8090f | Python | hyeyeonjung/YONI | /word.py | UTF-8 | 783 | 3.953125 | 4 | [] | no_license |
word1 = input("글자를 입력하세요.")
if (len(word1)==3):
while True:
word2 = input("글자를 입력하세요.")
if(len(word2)==3) and (word2[0]==word1[2]):
print("정답입니다.")
else:
print("오답입니다.",word2[0],word1[2])... | true |
35905d46f31421232959fe1b79fdd44301d1c22c | Python | thomas-rohde/Classes-Python | /exercises/exe81 - 90/exe085.py | UTF-8 | 275 | 3.328125 | 3 | [
"MIT"
] | permissive | matriz = [[], [], []]
R = list(range(0, 3))
for c in R:
for i in R:
matriz[c].append(int(input(f'Digite um valor para[{c}, {i}]: ')))
print('-' * 30)
for d in R:
print('(', end=' ')
for j in r:
print(f'[{matriz[d][j]:^5}]', end=' ')
print(')') | true |
061e688a1067fdf6bd4bf4babca62e155c4947f3 | Python | zhuchangzhan/SEAS | /deprecated/atmosphere_effects/mixing_ratio_generator.py | UTF-8 | 4,966 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# Copyright (C) 2017 - Massachusetts Institute of Technology (MIT)
#
# 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 of the License, or
# (at your option... | true |
af655f62c6045848b8621c62f26802f557e63902 | Python | Hamitay/MO443 | /trab4/ex1.py | UTF-8 | 3,559 | 3.234375 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
# Loads the image in grayscale
def load_image():
img_path = "img/bitmap.pbm"
return cv2.imread(img_path, 0)
def display_image(img, img_title):
# Converts to unsigned 8 bit int
#abs_img = cv2.convertScaleAbs(img)
cv2.imwrite(f'{img... | true |
72be3a8c34b2150c044de316d99af5f41ef893fb | Python | AlvarocJesus/Exercicios_Python | /AulaTeorica/exerciciosModulos/exercicio2/pitagoras.py | UTF-8 | 98 | 2.625 | 3 | [] | no_license | from math import sqrt
def pitagoras(cateto1, cateto2):
return sqrt(((cateto1**2)+(cateto2**2))) | true |
e918bde3c6fa82fe08670d907c895751bebef139 | Python | Todorovikj/InstagramScraper | /index.py | UTF-8 | 5,393 | 2.65625 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
import os
import requests
import shutil
from xlsxwriter import Workbook
# advice: use delays to avoid getting blocked, try torrequest for changing your IP
# driver.switch_to.window(driver.window_handles[1]) changig active tab in driver... | true |
24b2f1475308cfeec8c77eeda05c8697c3634196 | Python | brodyzt/Testing | /Classes.py | UTF-8 | 350 | 3.125 | 3 | [] | no_license | '''__author__ = 'brodyzt'
class Car:
def __init__(self):
self.color = None
def printColor(self):
print(self.color)
myCar = Car()
myCar.color = "Red"
myCar.printColor()'''
class Test:
def __init__(self):
self.structure = [1,2,3,4,5]
def __iter__(self):
return self.st... | true |
a214f79eb13e3c04080a666390e7216d23e0d9a8 | Python | Raision-seudun-koulutuskuntayhtyma/Painonhallinta | /sanity2.py | UTF-8 | 4,499 | 3.34375 | 3 | [
"CC0-1.0"
] | permissive | # Tiivistetty versio Sanity.py-modulista eli suurinpiirtein se, mitä tuhosin vahingossa
def liukuluvuksi(syote):
"""Tarkistaa syötteen ja muuttaa sen liukuluvuksi
Args:
syote (string): Käyttäjän syöttämä arvo
Returns:
list: virhekoodi, virhesanoma ja syöte liukulukuna
"""
# Asete... | true |
2ca1528f4f380a64b8ff64b2e603a15b93c82b47 | Python | Tatyana-jl/TrialTests | /Futurealms/test.py | UTF-8 | 531 | 3.09375 | 3 | [] | no_license | import numpy
matrica = numpy.random.random_integers(0, 9, (10,10,10))
coordinate=0
for x in range(0,len(matrica)):
while coordinate==0:
for y in range(0,len(matrica)):
while coordinate==0:
for z in range(0,len(matrica)):
if matrica[x][y][z]==0:
... | true |
ba5f2fbf438d1a1912f56fc84ab67449674742de | Python | xiao2mo/script-python | /linelength/length.py | UTF-8 | 156 | 2.65625 | 3 | [] | no_license | import os
import sys
with open(sys.argv[1]) as fin:
lines = fin.readlines()
lines.sort(key=lambda x:len(x))
for line in lines:
print line.rstrip("\n")
| true |
6689b16caaab4cdee458b139be95eca903cbc7e7 | Python | koushik1330/Emails_Classifications_using_ClassificationMachineLearingAlgorithms | /Emails-Classification-UsingSupervisedLeraningTechniques/4. Email Classification using Ada Boost Classifier.py | UTF-8 | 1,188 | 3.5625 | 4 | [] | no_license | """
Using an Ada Boost Classifier to identify emails by their authors
authors and labels:
Sara has label 0
Chris has label 1
"""
import sys
from time import time
sys.path.append("C:\\Users\\satyam\\Desktop\\MajorProject Final\\Emails-Classification-UsingSupervisedLeraningTechniques\\")
fro... | true |
2412217f8dbe3c5a81b25ed7083ae24a78547b89 | Python | canadaduane/sydney-m4 | /rtaparser.py | UTF-8 | 1,820 | 2.828125 | 3 | [] | no_license | import csv
import datetime
rhCSV = csv.reader(open('RTAData.csv')) # read in the data
whf = open('lcb_submit2.csv','w') # create a file where the entry will be saved
wh = csv.writer(whf, lineterminator='\n');
date_format = "%Y-%m-%d %H:%M"
timeStamp = ["2010-08-03 10:28","2010-08-06 18:55","2010-08-09 16:19",... | true |
6bf32a0aca46a61ce6ad18a2cdbfc6d199710eda | Python | saratiedt/python-exercises | /semana 3/ImparPar.py | UTF-8 | 242 | 3.375 | 3 | [] | no_license | total = [9,5,6,4,8,12,11,15,0,1,3,2]
impar = []
par = []
for i in range(len(total)):
if total[i] % 2 == 0:
par.append(total[i])
else:
impar.append(total[i])
print(f'Total: {total}')
print(f'Par: {par}')
print(f'Impar: {impar}')
| true |
a64c2f84dfa6de9294ceaf7a7d8a26e5b4ff31f6 | Python | hixio-mh/PUBGMovieDelete | /Test Fragments/Menu.py | UTF-8 | 260 | 3.03125 | 3 | [] | no_license | print("Choose and option from the following:")
print("[1] Auto detect game files")
print("[2] Use the location from path.txt")
option = input()
if int(option) == 1:
print("eureka")
input("Press ENTER to terminate this program")
raise SystemExit(0)
| true |
514ed702121bed7423f64361575a3f5385320cf9 | Python | hffan/yjy015_prj | /element_opt/read_sta_mag_1m.py | UTF-8 | 5,454 | 2.59375 | 3 | [] | no_license | #--coding:utf-8--
# date: 2019-08-14
# function: read Real-time Interplanetary Magnetic Field Values sampled once per minute
import os
import sys
import time
import calendar
import datetime
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
matplo... | true |
9ab297b34eeafe35a4680a37bf1ae52dbf9d35ee | Python | TARENTOO/DUB | /dub/main.py | UTF-8 | 1,328 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Módulos
import sys, os
sys.path.append(os.path.abspath(".."))
import pygame
from pygame.locals import *
from dub import images
from dub import objetos
WIDTH = 400
HEIGHT = 128
IMAGES = os.path.abspath(".") + "\imagenes"
# Constantes
# Clases
# -----------------... | true |