blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
0de3e00b04c3f4e369e6e42a659d6c1643e57936
Python
deepika087/CompetitiveProgramming
/GeneralPractice/5561. Get Maximum in Generated Array.py
UTF-8
855
3.171875
3
[]
no_license
__author__ = 'deepika' """ Submitted: Success """ class Solution(object): def getMaximumGenerated(self, n): """ :type n: int :rtype: int """ if n == 0: return 0 if n == 1: return 1; if n == 2: return 1 arr = [ 0 ...
true
fbc4acd9863a0079fcd1dae431162186b41fc866
Python
tomp/AOC-2017
/day6/day6.py
UTF-8
2,278
3.59375
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 # # Advent of Code 2017 - Day 6 # INPUTFILE = 'input.txt' def load_input(infile): lines = [] with open(infile, 'r') as fp: for line in fp: line = line.strip() if line: lines.append(line) return lines def redistribute(banks): ...
true
390944960f14040ac00140fac6410bc9e089d0df
Python
cbschaff/dl
/dl/rl/envs/frame_stack_wrappers.py
UTF-8
6,508
2.75
3
[]
no_license
"""Frame stack environment wrappers.""" from dl.rl import VecEnvWrapper, pack_space, unpack_space from gym.spaces import Box, Tuple, Dict import numpy as np from dl import nest class VecFrameStack(VecEnvWrapper): """Frame stack wrapper for vectorized environments.""" def __init__(self, venv, k): """I...
true
9fb987da9691c168a14cad5b5b39ed213fee3e16
Python
Bini19/Maquina-de-Turing-py
/mqn2.py
UTF-8
755
3.0625
3
[]
no_license
from turing import * ''' Maquina de Turing 1 L = Complemento de entrada binaria ''' DIR = True ESQ = False alfabeto = ['0','1'] alfabeto_aux = ['0','1'] trans_q0 = [['#','#',DIR,"q0"],['0','1',DIR,"q0"],['1','0',DIR,"q0"],[' ',' ',ESQ,"q1"]] trans_q1 = [['1','1',ESQ,"q1"],['0','0',ESQ,"q1"],['#','#',DIR,"qf"]] trans...
true
c8a19cf96d6d495564c9fb7be4ab1f572bab5c26
Python
chihun21c/chihun21c
/pset6/pset6/DNA.py
UTF-8
917
3.25
3
[]
no_license
import csv from sys import argv, exist #커멘드 입력의 실수가 있을경우: if len(argv) != 3: print("Usage: python dna.py data.csv sequence.txt") exit(1) #딕셔너리 만들기 dictionary = {} #csv파일 읽어 드리기 with open(argv[1]) as csvfile: read = csv.reader(csvfile) for STR in read: DNAtype = tuple(STR[1:]) break next...
true
53c7f8952f434412729aa6bb4084e8c1cada7136
Python
sindredl/Python-IS-206
/Exercise45/language.py
ISO-8859-15
1,143
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- default = "NO" title = "s" def setLan(lang): land = lang def language(language, room): if language == "NO" or language == "EN": return room_checker(language, room) else: return room_checker(default, room) def room_checker(language, room): if room == "england": return englandLN(la...
true
8e6d088b80c4d6417a2519e01fa23d9ca9a6eae3
Python
libAtoms/testing-framework
/tests/Si/surface_Si_diamond_110/test.py
UTF-8
3,200
2.546875
3
[]
no_license
# This script defines a test case which computes one or more physical # properties with a given model # # INPUTS: # model.calculator -- an ase.calculator.Calculator instance # this script can assume the calculator is checkpointed. # # OUTPUTS: # properties -- dictionary of key/value pairs corresponding # to...
true
e5194b872e00863794645643170f5c84fb475b94
Python
kamuc2012/Session_1_to_5
/Session2/ProblemStatement1.py
UTF-8
341
4.0625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Write a program which accepts a sequence of comma-separated numbers from console and generate a list. """ numbers = input("Please enter comma-separated numbers: ") list_numbers = [] for i in numbers.split(","): list_numbers.append(int(i)) print("Comma Separated ...
true
682141a9ed2509af33ae23a1fe7d3a9f43dbcd3e
Python
forkcodeaiyc/skulpt_parser
/run-tests/t309.py
UTF-8
190
3.203125
3
[ "MIT" ]
permissive
s = set([1, 2, 3]) t = set([3, 4, 5]) s.symmetric_difference_update(t) t.symmetric_difference_update(s) print(s) print((s == t)) print((s == set([1, 2, 4, 5]))) print((s == set([1, 2, 3])))
true
746280a5e53b211c442c2fe82136a83014ce1122
Python
b05902062/image_cloning_tool
/src/create_node.py
UTF-8
804
2.8125
3
[]
no_license
import cv2 import numpy as np import sys def find_edge(mask): result = [] for i in range(mask.shape[0]): for j in range(mask.shape[1]): if mask[i][j] == 255: if i == 0 or i == mask.shape[0]-1: result.append([i, j]) elif j == 0 or j == mask.shape[1]-1: result.append([i, j]) else: for ...
true
6542013ed86bdddc41ff3dd9a0a76fa534381398
Python
jS1ngle/crypto_simulations
/googleTrendPriceVolumeCorrelation.py
UTF-8
2,929
2.890625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Author: jS1ngle # License: MIT License (http://opensource.org/licenses/MIT) import pandas as pd import requests import matplotlib.pyplot as plt from pytrends.request import TrendReq import datetime from datetime import timedelta from scipy.stats.stats import pearsonr from SimulationHelperFunc...
true
43247f6f78b1031b4388a701ca5553694d717f06
Python
thanoojgithub/PythonOne
/SingletonInPython.py
UTF-8
1,209
3.203125
3
[]
no_license
class MySingleton: __instance = None def __setattr__(self, prop, value): self.__dict__[prop] = value def __getattr__(self, prop): return self.__dict__[prop] @staticmethod def getMySingleton(name, age): if MySingleton.__instance is None: ...
true
54bffc917a2130a9a5170f0e583b07be9582c55e
Python
Tech-at-DU/CS-1.0-Introduction-To-Programming
/T006-Lists-and-Pseudocode/assets/T6-StockPrices.py
UTF-8
562
4.3125
4
[]
no_license
# Stock Prices # Step 1: Create a list called stock_history with the Open, High, and Low stock prices for APPL as float values. Then print the list to the Python console check the values. # Step 2: Use list indexing to access and print the High value of the stock for the day. Remember that the first value in the list...
true
251eb820479c044647b91462396cd7dec8ca7ea6
Python
metamorph-inc/openmeta-examples-and-templates
/graph-gremlin/python/ComputeMetrics.py
UTF-8
1,934
2.8125
3
[]
no_license
#!/usr/bin/env python from __future__ import print_function, unicode_literals import os import json import numpy as np def main(): data = np.genfromtxt("output.csv", delimiter=",") plantOutput = data[:, 1] metrics = { 'MaxCurrent': { 'value': np.amax(plantOutput), 'unit':...
true
b7b61c56841dfad537e7c0b289c336efd2363c0d
Python
rahuldshetty/Text-Summarization
/summary.py
UTF-8
174
2.609375
3
[]
no_license
from summarizer import Summarizer model = Summarizer() def get_summary(body,min_length = 60): result = model(body, min_length) full = ''.join(result) return full
true
ff78489e116fe41f190a6c8852deb4ac4c2e5a8c
Python
henryZe/code
/leetcode/daily/1006_clumsy.py
UTF-8
703
3.234375
3
[]
no_license
class Solution: def clumsy(self, N: int) -> int: option = ("*", "/", "+", "-") n = len(option) stack = [N] N -= 1 index = 0 while N: if index % n == 0: stack.append(stack.pop() * N) elif index % n == 1: tmp = st...
true
32cf0da00365f5a683b997df75cba4831c221704
Python
arthur900530/Python-practice
/Ch19/main.py
UTF-8
2,628
2.90625
3
[]
no_license
from random import randint from tkinter import * import time from PIL import Image, ImageTk import math # tk = Tk() # canvas = Canvas(tk, width=640, height=480) # canvas.pack() # x_center, y_center, r = 320, 240, 100 # x,y = [],[] # # for i in range(12): # x.append(x_center+r*math.cos(30*i*math.pi/180)) # y.ap...
true
8c292c3c9c861bf52d887bd00a06e95b57d0a774
Python
Parsonfan/good
/assignment-main/assignment-main/T1/Q4.py
UTF-8
857
4.1875
4
[]
no_license
#要求四 ( 請閱讀英文 ):演算法 Given an array of integers, show indices(複數) of the two numbers such that they add up to a # specific target. You can assume that each input would have exactly one solution, and you can not use the same element twice def twoSum(nums, target): # your code here #找出相加起來會等於target的數字,append to list...
true
43918e2c66b8fde0aab84982579e9cd117e1f54c
Python
abhi8585/GeneratedART-NFT-VISION
/layers.py
UTF-8
8,604
2.65625
3
[]
no_license
#!/usr/bin/env python """Provides different layers to be used the model, classes for Image Generation. This module implement different utilities to standardize the data. """ import tensorflow as tf from tensor2tensor.layers.common_layers import shape_list, dense __author__ = "Abhishek Sharma" __license__ = ...
true
a6c9922a23b881c5d94647ffdd08d25afa744599
Python
Freiheitnf/FN_Answer
/Question6.py
UTF-8
4,011
3.703125
4
[]
no_license
#Question6 #Explanations """ When a line crosses a polygon boundary, there are only two cases: entering the polygon or passing through the polygon. Without considering the non Euclidean space, it is impossible for a straight line to enter the polygon again from the inside or pass through the polygon again from the ...
true
75c1fbad1b8e760e059a38b8ea72de1368a4e710
Python
mulu14/python-exercises
/test_unit_calculator.py
UTF-8
3,035
3.40625
3
[]
no_license
import unittest from source.calculator import Calculator class TestCalculator(unittest.TestCase): def test_one_operator_sum_value_level_1(self): """ Test strings sum """ data = "10 + 20" result = Calculator.calculate(self, data) self.assertEqual(result, 30) d...
true
6fc99ff87f62b08f02d24e1b6f49664d8ddbb29a
Python
wen600313/python
/backupToZip.py
UTF-8
1,377
3.515625
4
[]
no_license
#! python3 # backupToZip.py - 备份文件为ZIP格式 # 备份指定文件夹内容为文件名递增的zip文件 import zipfile,os def backupToZip(folder): #将“文件夹”的全部内容备份到zip文件中 folder = os.path.abspath('C:\\pythonS') #确保文件夹是绝对路径的 #找出这段代码应该基于的文件名 #哪些文件已经存在 number = 1 while True: zipFilename = os.path.basename(folder) + '_' + str(n...
true
55239f9ae1daa9d5a8e516eaea3db3fdc226c235
Python
Cbkhare/Algorithms
/Sorting/quick_sort.py
UTF-8
998
3.890625
4
[]
no_license
""" Quick sort """ class QuickSort(object): def __init__(self, arr): self.lst = arr def quick_sort(self, A): n = len(A) if n==0: return [] pivot = A[n-1] # last elements as the pivot # all elements less than pivot lss_elements = [A[j] for j in rang...
true
ca230b7f0f0dba826fdf665f3f861d931a56bd40
Python
vaibhavkakodiya/assignment1_que1
/ass.py
UTF-8
2,461
3.203125
3
[]
no_license
import matplotlib.pyplot as plt import math import random import numpy as np from fun import * # main program if __name__ == '__main__' : # initializing the parameters data_set = 100 #no of data points m = 10 #degree of the equation gamma = 0.1 #mult...
true
129119eed68a9f8096f38545dc8beeb7da3feab3
Python
gdario/ppi_with_lstm
/src/experiments/cnn_bilstm.py
UTF-8
2,766
2.546875
3
[]
no_license
import h5py from keras.models import Model from keras import layers import os import argparse from keras import optimizers from keras.callbacks import ModelCheckpoint, EarlyStopping parser = argparse.ArgumentParser() parser.add_argument('maxlen', help='maximum protein length', type=int) parser.add_argument('ppi_path',...
true
ed4392e45067ca613abf56484c39fb581016cd11
Python
nikgun1984/Currency-Converter
/currencies.py
UTF-8
2,047
2.875
3
[]
no_license
from forex_python.converter import CurrencyRates, CurrencyCodes from numbers import Number from flask import flash, session def check_value(val): """Checking for value validity""" if not val: raise ValueError("Amount cannot be empty...") if not val.isnumeric(): raise ValueError("Value must ...
true
224e8ecb9d5dfb03d9d0803891167b6faec28f28
Python
ACBGZM/ml-notes
/ng-ml2014/code/00-numpy&pandas/pd04.py
UTF-8
726
3.765625
4
[]
no_license
# pandas 处理丢失数据 import pandas as pd import numpy as np dates = pd.date_range('20210225', periods=6) df = pd.DataFrame(np.arange(24).reshape((6, 4)), index=dates, columns=['A', 'B', 'C', 'D']) # 用iloc按位置查找 df.iloc[0, 1] = np.nan df.iloc[1, 2] = np.nan print(df) # dropna # how = {'any', 'all'} print('丢掉有nan的行:') print...
true
b9962d1e0cc21a7e1a820daf14774b137e0f1406
Python
giomagi/rentscanner
/main/houses/agents/winkworth.py
UTF-8
1,433
2.515625
3
[]
no_license
import locale from datetime import datetime import re from main.houses.agents.base_extractors import RssBasedExtractor from main.houses.model import Address, Price, Property class Winkworth(RssBasedExtractor): def __init__(self): RssBasedExtractor.__init__(self) self._titlePattern = re.compile(r'(...
true
9c635a4c1b23f850e450cdc037982361e4cbbf1a
Python
lucasolifreitas/ExerciciosPython
/secao4/exerc19.py
UTF-8
142
3.703125
4
[]
no_license
litros = float(input('Digite o valor em litros: ')) metros_cubicos = (litros / 1000) print(f'O valor em metros cubicos é: {metros_cubicos}')
true
c965e60726365e53d26e1a2a0b4c2a9b9d99652c
Python
Winter-Smile2/Project
/wiki/wiki/test.py
UTF-8
385
2.984375
3
[]
no_license
child = [ {'id': 1,'parent_id':0}, {'id': 2, 'parent_id': 1}, {'id': 3, 'parent_id': 0}, {'id': 4, 'parent_id': 3}, ] parent = [] children = [] for item in child: if item['parent_id'] != 0: res = {} res['id'] = item['parent_id'] children.append(item['id']) res['child...
true
103bad28eeeb0e6b1ab19e293670c40b88ac3210
Python
williamwbush/prework
/pcc_exercises/chapter_3/seeing_the_world.py
UTF-8
386
3.171875
3
[]
no_license
world_places = ["New Zealand", "Great Britain", "Australia", "India", "Spain"] print(world_places) print(sorted(world_places)) print(world_places) print(sorted(world_places, reverse=True)) print(world_places) world_places.reverse() print(world_places) world_places.reverse() print(world_places) world_places.sort() print...
true
bc48a5d454b68e987effca6da58981ab556c620d
Python
dagopher/fimfiction-stories-downloader
/test_fimfic_lib.py
UTF-8
654
2.609375
3
[ "MIT" ]
permissive
import fimfic import pprint import json session = fimfic.Session() session.enable_mature() session.infodump() print("-------------") URLs = [ "http://www.fimfiction.net/bookshelf/1364962/xeno", "https://www.fimfiction.net/bookshelf/683004/favourites?view_mode=1", ] #"https://www.fimfiction.net/bookshelf/6830...
true
505c91f538b6766af2877db09f3bd634da74bcfe
Python
Anekdotin/stock_finder_wallstreetbets
/app/cleaner/clean_word.py
UTF-8
183
2.84375
3
[]
no_license
import re from .remove_space import remove_space def clean_word(word): word = re.sub(r'[^\w]', ' ', word) word = word.lower() word = remove_space(word) return word
true
7049f5f24ca75714a8ecb9223da0be6ff8f65295
Python
Eduflutter/EXE_python
/EX - 13.py
UTF-8
196
3.453125
3
[]
no_license
from cor import box_txt box_txt('SALARIO') sl = float(input('Informe o valor do seu salário: R$')) ds = sl+(sl*(15/100)) print('O Seu salário de R${:.2f} vai para R${:.2f} '.format(sl, ds))
true
51fcabbd58ddc678689d2e1e069fb7709fc099cf
Python
liguob/pytest
/pytest_1/check_caculator_testcases.py
UTF-8
1,130
2.859375
3
[]
no_license
import pytest import yaml from pytest_1.caculator_base.calculator_method import Calculators @pytest.mark.parametrize("a, b", yaml.safe_load(open("data/data.yml"))) class TestCalculator(Calculators): @pytest.mark.run(order=-2) def test_mul(self, a, b): try: print(self.mul(a, b)) ...
true
52b53f53583c20b77fbdfb6400ea081e8ba9c1a4
Python
wpinheiro77/python
/Guanabara/ex011.py
UTF-8
224
3.578125
4
[]
no_license
largura = float(input('Digite a altura da parede: ')) altura = float(input('Digite a largura da parede ')) area = float(altura * largura) tinta = area / 2 print('Você precisará de {:.2f} litros de tinta.' .format(tinta))
true
11df83b35f35605c47a96f8d6c8ce7806496d3e3
Python
aarontinn13/MPCS-52010
/project1/Address.py
UTF-8
3,955
3.15625
3
[]
no_license
from math import log class Address(): def __init__(self, RAM_size, cache_size, block_size, associativity): self.bits = len(bin(RAM_size).partition('b')[2]) # number of bits maximum self.associativity = associativity ...
true
0bdc1914e8d54bf8f96c442dcb78e5397f988619
Python
mmarihart/challenge_solutions
/sha256_cracker_wordlist.py
UTF-8
808
2.71875
3
[]
no_license
__author__ = 'blackfox' import hashlib from itertools import permutations import os s = "9791cbe0ae919a0330994a2d6ba26b8f0c3a1da15c73bce5fca39495881a6c90" #s = "3f3fcbe0ae3f3f03303f4a2d6ba26b8f0c3a1da15c73bce5fca33f3f3f1a6c90" #wrong f = open("/home/blackfox/Desktop/Hacking-Lab/HackyEaster/hashestoashes/wordlist.txt") ...
true
f604ecde13425ccdeaf307d455d55d1bc9748c58
Python
Jinyoyyo/Leetcode
/InvertBinaryTree.py
UTF-8
1,600
3.3125
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def invertTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ #return...
true
dfa405eb80daa62f7138f298264a2d7015017389
Python
highshoe/PYTHON
/python-06-exercise5/let's-python/.svn/text-base/exercise03.py.svn-base
UTF-8
788
3.09375
3
[]
no_license
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' @author: selfimpr @blog: http://blog.csdn.net/lgg201 @mail: lgg860911@yahoo.com.cn @date: 2009-11-19 ''' #=============================================================================== # switch 模拟switch语法 # @param value: 选择分支的值 # @param cases: 可变关键字参数, key...
true
fdea7e603dfa9ded4471911d1404f237dc4e3ffe
Python
maxim1317/path
/wave/calculations.py
UTF-8
3,639
3.328125
3
[]
no_license
#!/usr/bin/env python3 import math as m import numpy as np from numpy import arccos, array, dot, pi, cross from numpy.linalg import det, norm def my_norm(p_1, p_2): """Takes to points and counts distance between them""" return m.sqrt((p_2[0] - p_1[0]) ** 2 + (p_2[1] - p_1[1]) ** 2) def arc_length(Eps, alph...
true
5226ce3e291de81857910b9ccb9ad7e6789505e1
Python
Vadim-Step/Big_task
/web.py
UTF-8
12,783
2.8125
3
[]
no_license
import math import os import sys import pygame import requests coords = input() coords_num = coords.split(',') coords_num = [float(coords_num[0]), float(coords_num[1])] spn = input() spn_num1 = float(spn.split(',')[0]) spn_num2 = float(spn.split(',')[1]) if spn_num1 <= 1: z = '8' elif spn_num1 <= 2: z = '7' ...
true
360b430235bfdef9a115236fc152694fd2433951
Python
miccls/arbitrage_trader
/bot.py
UTF-8
3,415
2.953125
3
[]
no_license
# coding=utf-8 ''' arbitrage.py Bot som handlar cryptos vid arbitrage-tillfällen. Hur fungerar boten? Kollar olika exchanges samtidigt. Om den upptäcker ett arbitragetillfälle så köper den köper den och säljer valutorna på ett fördelaktigt sätt. Den kommer att ta värden från Binance. Där hittar den priser för valut...
true
0e19203a6a5195a95dd48a8a4387ef1274f49b28
Python
developerdrone/Copycat-abstractive-opinion-summarizer
/mltoolkit/mlutils/helpers/formatting/general.py
UTF-8
5,533
3.171875
3
[ "MIT" ]
permissive
import re from html.entities import name2codepoint def format_big_box(message, ws_offset=20): """ Formats a message by wrapping it into a big box of # and white space symbols. Works for multi-line message (splat by \n). :param message: self-explanatory. :param ws_offset: two sided white space off...
true
f9b09f145e02f32a73686866a3a43eb6fe4e3307
Python
TonyAngelo/spyeberrypi
/models/spye.py
UTF-8
6,069
2.6875
3
[]
no_license
from models.models import Observable import time # for measuring spyeworks buffer timeout import socket # for ip comms import chardet # for character encoding/decoding import logging logging.basicConfig(format='%(asctime)s %(levelname)-5s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', filename='../logs/spye.log', level=lo...
true
89c6f48a803da10c09e24be97d0fcb136c85980f
Python
49257620/reboot
/leetcode/20180807/leetcode_168.py
UTF-8
1,569
3.8125
4
[]
no_license
""" 168. Excel表列名称 给定一个正整数,返回它在 Excel 表中相对应的列名称。 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB ... 示例 1: 输入: 1 输出: "A" 示例 2: 输入: 28 输出: "AB" 示例 3: 输入: 701 输出: "ZY" """ class Solution(object): def convertToTitle(self, n): """ :type n: int :rt...
true
752cabe14766dc86d645fc07f566c84d376f85d0
Python
Aasthaengg/IBMdataset
/Python_codes/p03345/s019578924.py
UTF-8
286
2.96875
3
[]
no_license
def main(): a, b, c, operation = map(int, input().split()) answer = a - b if abs(answer) > 10 ** 18: print("Unfair") else: if operation % 2: print(answer * -1) else: print(answer) if __name__ == '__main__': main()
true
bdd6af7278695c45d1c44f36482c833141472d90
Python
LichAmnesia/LeetCode
/python/317.py
UTF-8
1,471
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- # @Author: Lich_Amnesia # @Date: 2016-11-27 18:53:01 # @Last Modified by: Lich_Amnesia # @Last Modified time: 2016-11-27 19:23:05 # @Email: alwaysxiaop@gmail.com # need to use deep copy to get the answer # use bfs. import copy class Solution(object): def shortestDistance(self, grid): ...
true
3e6eb56d49df191961a06f0b8d1f4456e0bfbd6b
Python
pieisland/BaekJoon
/py/step12/11866.py
UTF-8
492
2.96875
3
[]
no_license
''' 2019.03.26.Tue. <조세퍼스 순열> ''' n, m=map(int, input().split()) li=[-1] for i in range(1, n+1): li.append(i) result=[] cnt=0 i=0 while(len(result)<n): i+=1 if i>n: i=1 if li[i]!=-1: cnt+=1 if cnt%m==0: result.append(li[i]) li[i]=-1 cnt=0 for i in ran...
true
65b5986b78e277da66d2788886113356d9481649
Python
jurfliu/machine-learning
/day02/knn-demo.py
UTF-8
2,107
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- # @File : knn-demo.py # @Date : 2019-12-28 19:02 # @Author : admin # -*- coding: utf-8 -*- # @File : sk-learn-knn-demo.py # @Date : 2019-12-28 11:51 # @Author : admin from sklearn.neighbors import KNeighborsClassifier import pandas as pd from sklearn.model_selection import tr...
true
2ce740a70d9f4f7b8d908676c4bd792be01fdb26
Python
TotallyFine/DataScienceBowl18
/utils/Loss.py
UTF-8
731
2.609375
3
[ "MIT" ]
permissive
# coding:utf-8 from torch import nn class Loss(nn.Module): def __init__(self, name): super(Loss, self).__init__() assert isinstance(name, str) self.name = name def forward(self, inputs, targets): # batch size num = targets.size(0) m1 = inputs.view(nu...
true
846ae4f22223bd51d7eb6309c0c4fcb1bed45a22
Python
poppindouble/AlgoFun
/maximum_subarray.py
UTF-8
2,662
3.859375
4
[]
no_license
""" This is a classic dynamic programming question. Let's see the traditional solution: Use M[i] represent the maximum subarry which HAVE TO INCLUDE nums[i] AS THE LAST ELEMENT so, M[0] = nums[0] M[1] = max(nums[0] + nums[1], nums[1]), because we have to include nums[1], so only two possible value, nums[0] + nums[1] o...
true
07ef0a02ba328cec2feaa7a0628d79a702d5ce68
Python
snowedev/baekjoon-code.plus
/baekjoon/[Bruteforce]/문제1/[Brute_Force]테트로미노(문제1).py
UTF-8
2,190
3.234375
3
[]
no_license
# 테트로미노 # 기초편과는 다른 방법 # B_14500 """ # 테트로미노는 회전하는 경우까지 합쳐서 총 19가지의 도형이 있고 # 하나의 테트로미노당 놓을 수 있는 방법의 개수는 약, O(NM)가지가 있다 # 19*250000 = 4,750,000 # 총 O(19NM)가지로 경우의 수가 많지 않기 때문에 각각의 테트로미노에 대해서 모든 칸에 놓아본다 """ dx = [0,0,1,-1] dy = [1,-1,0,0] n, m = map(int,input().split()) a = [list(map(int, input().split())) for _ in range(...
true
10ee455497ca53012fef12123fbe11db896731ae
Python
yukapril/learning
/python-starter/numberSort.py
UTF-8
572
3.75
4
[]
no_license
import random def sort(arr): items = arr[:] length = len(items) for i in range(length - 1): for j in range(i + 1, length): if items[i] > items[j]: items[i], items[j] = items[j], items[i] return items def rnd(count): arr = [] for _ in range(count): ...
true
3807dd546e6df455932324378f9213e1af20b669
Python
dzon4xx/Turbine_code_git
/LabJackFiles/LJU3HV.py
UTF-8
45,649
2.5625
3
[]
no_license
import u3 #imports the library provided by the produce #print u3.openAllU3()#future module for multiple device operation d = u3.U3() #start the single device with all the defaults #d.debug=True d.getCalibrationData()#calibration of measuring device ConfigList=[] for b in range (0,13): ConfigList.append(b) def ...
true
571d355a2351ec1ca6905946e29e1ad192d04695
Python
Kulsoom-Mateen/Python-programs
/compare_triplets.py
UTF-8
375
3.78125
4
[]
no_license
def compareTriplets(a, b): alias=0 bob=0 for x in range(len(a)): if a[x]>b[x]: alias=alias+1 elif a[x]<b[x]: bob=bob+1 else: alias=alias bob=bob print("Alias won ",alias," match / matches") print("Bob won ",bob," match / matches...
true
a0619233522d9840280d8d02c3e25bb4679d9bec
Python
Felty/shiny-octo-dubstep
/doing it the dumb way.py
UTF-8
3,375
3.015625
3
[]
no_license
"""Making an image with every RGB color used once, the dumb way.""" from PIL import Image from PIL import ImageDraw from random import randint import time #4096x4096 for every RGB color xres = 80 yres = 80 startPos = (int(xres*.5), int(yres *.5)) im = Image.new("RGBA", (xres, yres), (0,0,0,0)) draw = ImageDraw.Draw(...
true
4cadd257f7444b4ad844fa626a88dd091c4dd74b
Python
zaboevai/python_base
/lesson_010/python_snippets/03_raise.py
UTF-8
4,608
3.703125
4
[]
no_license
# -*- coding: utf-8 -*- # Порождение исключений # Зачастую нужно самим создавать исключение, если код не может справиться с данными def greet_person(person_name): """ says hello """ if person_name == 'Robert': # создаем обьект исключения и райзим его raise BaseException("We don't like...
true
042c55fa7c29abcceea75cd6d0f534e491a938d5
Python
kirillmasanov/skillbox
/lesson_008/01_family.py
UTF-8
13,310
3.75
4
[]
no_license
# -*- coding: utf-8 -*- from termcolor import cprint from random import randint ######################################################## Часть первая # # Создать модель жизни небольшой семьи. # # Каждый день участники жизни могут делать только одно действие. # Все вместе они должны прожить год и не умереть....
true
c5f0e34fe1fe2db43231928f7bef163fa76479df
Python
sachinsaurabh04/pythonpract
/Function/function8.py
UTF-8
308
3.765625
4
[]
no_license
#!/usr/bin/python3 #DefaultArguments example #Function defenition is here def printinfo(name, age = 35): "This prints a passed info into this function" print("Name: ", name) print("Age ", age) return # Now you can call printinfo function printinfo(age=50, name="miki") printinfo(name="Miki")
true
f65179b2922ea727e3bd5eccc9d583304a10704a
Python
DerXu/py-tedopa
/tests/test_tmps_for_transverse_ising_model.py
UTF-8
6,913
2.640625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" Test to check the whole TMPS algorithm for the transverse Ising model """ from scipy.linalg import expm from scipy.linalg import sqrtm import numpy as np import mpnum as mp from tedopa import tmps precision = 1e-7 # required precision of the tMPS results def test_mpo_trotter2(): n = 4 # number of sites ...
true
ae0f527eb411c4397f2ab7c1012bb596a12d8bd1
Python
yvah/problems
/HW12_task3.py
UTF-8
2,508
3.6875
4
[]
no_license
# 3. Создайте класс который будет хранить параметры для подключения к физическому юниту(например switch). # В своем списке атрибутов он должен иметь минимальный набор (unit_name, mac_address, ip_address, login, password). # Вы должны описать каждый из этих атрибутов в виде гетеров и сеттеров(@property). # У вас должна ...
true
bc0a52a1162155265087bcbc42adf619f39bc089
Python
machzqcq/Python_Page_Object
/features/lib/pages/automation_home_page1.py
UTF-8
1,508
2.75
3
[]
no_license
from selenium.webdriver.common.by import By from base_page_object import BasePage class AutomationHomePage1(BasePage): locator_dictionary = { "startButton_loc3":(By.LINK_TEXT, 'Welcome'), "startButton_loc4":(By.LINK_TEXT, 'Welcome1'), "startButton_loc5":(By.LINK_TEXT, 'Welcome2') } ...
true
e7ccc067c088e41a4bcdd162b8f57f1af25eb6df
Python
ridhomain/python-programming
/python_foundation/exercise4.py
UTF-8
77
2.9375
3
[]
no_license
### Write a function that takes a number and return whether it is even or not
true
2d79aad1e9b27d52233b9240b0f3b17a39d2b463
Python
danielcdl/scripts
/banco.py
UTF-8
579
3.765625
4
[]
no_license
notas = [100, 50, 20, 10, 5, 2, 1] while True: valor_saque = input('Qual o valor que gostaria de sacar? R$ ') if valor_saque.isdigit(): valor_saque = int(valor_saque) quantidade_notas = {} valor = valor_saque for nota in notas: quantidade = 0 wh...
true
06205a2df1596bf82aa2a2d9b2cd75a7f39d3ce7
Python
jakubchudon/Matura
/2016/matura_2016_rozszerzenie_czerwiec_e.py
UTF-8
437
2.96875
3
[]
no_license
plik = open('/Users/jakubchudon/Desktop/matury/2016_rozszerzenie_czerwiec/liczby.txt', 'r') max_dec=0 min_dec=10000000000000 for linia in plik: linia=linia.strip() liczba=linia[0:len(linia)-1] sys=int(linia[len(linia)-1]) wynik=int(liczba,sys) if wynik>max_dec: max_dec=wynik max_kod=...
true
d8b8d8ebebe79c2418606b6ec5cee80baa7649e2
Python
chasewolff/royalroad_discord_bot
/bot.py
UTF-8
3,994
3.03125
3
[]
no_license
# Version 2 of the RoyalRoad Webhook bot. # Author: chasewolff # Interacts with RSS feeds on RoyalRoad to determine updates. # Saves the latest version chapter to a file so starting the bot is quick and easy. from webhook import webhook import feedparser import time # Set how often the bot refreshes the page...
true
1014b13e22aab73f8a3722a13494c326dd1b61e4
Python
taylankabbani/METAHEURISTIC-APPROACH-TO-SOLVE-PORTFOLIO-SELECTION-PROBLEM
/TS_TokenRing.py
UTF-8
14,404
2.78125
3
[]
no_license
from toolz import valmap, valfilter import numpy as np from InitialSolution import ConstructiveALGO as CH import random as rd class POP(): ''' Input: mean_return & SD filePath, Correlation filePath, Risk aversion(Lambda), assets in portfolio(k), upper and lower bounds (epsilon & delta) ''' def __in...
true
8a87ae05f60e3f102edb9e496694644589679f36
Python
jcoyle4/OOSD-Labs
/Lab 6/world_distance_Q4.py
UTF-8
2,257
4.03125
4
[]
no_license
from math import pi, acos, sin, cos r_earth = 6371 def dist(lat_1, lat_2, long_1, long_2): if lat_1 > 0: lat_1 = 90 - lat_1 else: lat_1 = 90 + abs(lat_1) if lat_2 > 0: lat_2 = 90 - lat_2 else: lat_2 = 90 + abs(lat_2) lat_1 = deg_to_rad(lat_1) long_1 = deg_to_...
true
5003ad53b34c463e70192b0436c12451bd354811
Python
Dhruvil30/Python-Data-structure
/linked_list.py
UTF-8
1,234
3.71875
4
[ "Apache-2.0" ]
permissive
class node: def __init__(self,data): self.data = data self.next = None class link_list_operation: def __init__(self): self.head = None def insert_at_end(self,data): n = node(data) if self.head is None: self.head = n else: point = self.head while point.next: point =...
true
570b5da2b3eb11190f2728c6a652b13f72a3fc5c
Python
onlyskin/qconvo
/exchange/tests.py
UTF-8
2,752
2.5625
3
[]
no_license
from django.test import TestCase from django.contrib.auth.models import User from exchange.models import Language, Country, Link class ExchangeViewsTestCase(TestCase): def make_user(self, username, name, native_lang, learning_lang, country, age): u = User.objects.create_user(username=username, password='p...
true
73414b76c6a3ac02b45ee8ff40412ce81ef161b1
Python
will004/ktp_validation
/ktp_validation/functions.py
UTF-8
7,558
3.140625
3
[]
no_license
import re import json import os import base64 from difflib import SequenceMatcher from datetime import datetime from urllib.request import urlretrieve # Read the json file based on its path def read_json(path): with open(path) as file: text = json.load(file) return text # Read the txt file based on ...
true
b3054f005663832e03ad8c693591e00c0d0249c3
Python
danielcesarcs/Python_aulas_cursoemvideo
/exercicios/006.py
UTF-8
315
4.21875
4
[ "MIT" ]
permissive
"""Dobro, triplo e raiz quadrada""" # Uso de operadores aritméticos num = int(input('Digite um número: ')) dob = num * 2 # dobro tri = num * 3 # triplo rq = num ** (1/2) # Raíz quadrada print('Você digitou {}\ne o seu dobro é {}\no seu triplo é {}\ne sua raiz quadrada é {}'.format(num, dob, tri, rq))
true
b8f8698eb5e2389bf4b4e345265fd803c480b560
Python
Agalya7/DWT-based-Compression
/dwt.py
UTF-8
6,170
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Mar 27 22:45:29 2019 @author: 15pt03 """ import matplotlib.pyplot as plt from numpy import zeros import numpy as np import scipy.misc import pywt.data import pywt import cv2 import random """ -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-...
true
031f86302741ef39fe73a71daf21d8b333a33d76
Python
marturoch/Fundamentos-Informatica
/Pandas/Practica 8 - pandas/4.py
UTF-8
477
4.25
4
[]
no_license
#Ejercicio 4 #Escribí un programa que elimine las primeras n filas # de un DataFrame. Pista: el DataFrame original no debe # modificarse. import pandas as pd df = pd.DataFrame({1: [1, 4, 3, 4, 5], 2: [4, 5, 6, 7, 8], 3: [7, 8, 9, 0, 1]}) def eliminar(df, fila): df2 = df.iloc[fila:] return df2 print(df) # 1...
true
8098b34e23775cb0f2765cbbd610feff3b9367ee
Python
AmShei57/SchoolWork
/CNT 4713/PS4/test.py
UTF-8
1,437
2.734375
3
[]
no_license
t#FTPClient.py from socket import socket, AF_INET, SOCK_STREAM from ast import literal_eval import time def send(socket, msg): print ("===>sending: " + msg) socket.send(msg.encode() + "\r\n".encode()) recv = socket.recv(1024).decode() print ("<===receive: " + recv) return recv serverName = 'ftp.cs.fiu.edu' se...
true
b0cd615e7eb8b5d4d40d6241baa80c0944a2c0b7
Python
petuum/tuun
/tuun/models/gp_gpytorch.py
UTF-8
5,485
3
3
[ "Apache-2.0" ]
permissive
""" Classes for GP models with GpyTorch. """ from argparse import Namespace import copy import numpy as np import gpytorch import torch from ..util.misc_util import dict_to_namespace from ..util.data_transform import DataTransformer from .gp.gp_utils import sample_mvn class GpytorchGp: """ Gaussian processe...
true
4defb184afa70f727f9d2e2cd0e2a48738a1b221
Python
ClabEnergyProject/Energy_Code_Repository
/SimpleEnergyModel_v0/Core_Model.py
UTF-8
14,668
2.90625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ File name: Core_Model.py Idealized energy system models Spatial scope: U.S. Data: Matt Shaner's paper with reanalysis data and U.S. demand_series. Technology: Generation: natural gas, wind, solar, nuclear Energy storage: one generic (a pre-determined round...
true
dac3249ec5947db932188dc28f7f9736a98b138a
Python
opendr-eu/opendr
/src/opendr/perception/activity_recognition/cox3d/algorithm/se.py
UTF-8
6,185
2.5625
3
[ "Apache-2.0" ]
permissive
from collections import OrderedDict import continual as co import torch from torch import Tensor, nn from torch.nn.modules.pooling import AdaptiveAvgPool2d from opendr.perception.activity_recognition.x3d.algorithm.operators import Swish def _round_width(width, multiplier, min_width=8, divisor=8): """ Round w...
true
f19d6c4467cbbe0574c7c8267beb102ffc8c84bb
Python
aaliveone/python-primary
/8/8.1DocStrings.py
UTF-8
1,295
4.65625
5
[]
no_license
# 函数定义,def关键字定义函数 def greet_user(): # 紧跟在def greet_user():后面的所有缩进行构成了函数体 # 文档字符串Documentation Strings 简称DocStrings,这是一种注释,Python使用三引号来生成有关程序中函数的文档 # 其中第一行以某一大写字母开始, 以句号结束。 # 第二行为空行, 后跟的第三行开始是任何详细的解释说明 """"Show simple greetings.显示简单的问候语。 其中第一行以某一大写字母开始, 以句号结束。第二行为空行, 后跟的第三行开始是任何详细的解释说明. DocS...
true
7782b3ceed7e1fc2227431bac297fc000b686101
Python
bgruening/ngsutils
/ngsutils/fastq/convertqual.py
UTF-8
954
2.6875
3
[ "BSD-3-Clause", "BSD-3-Clause-Open-MPI" ]
permissive
#!/usr/bin/env python ## category Conversion ## desc Converts qual values from Illumina to Sanger scale ''' Converts Illumina Qual values to Sanger scale. ''' import os import sys from ngsutils.fastq import FASTQ, convert_illumina_qual def usage(): print __doc__ print "Usage: fastqutils convertqual filename...
true
1b32173d64260421685548396d67c99b03720078
Python
Czuuzen/Laboratorium-Surma-Bartosz-43271
/Laboratorium 5/z2.py
UTF-8
740
3.90625
4
[]
no_license
x = int(input("Podaj liczbę całkowitą")) n = int(input("Podaj liczbę całkowitą")) z = x y = n s = 0 i = 0 while x - n >= 5 or n - x >= 5: if x < n and i <6: print(z) i += 1 s += z z += 1 else: if x > n and i <6: print(y) i += 1 ...
true
f883342103c89911a5b14caa7a224c2d5fe8c9f3
Python
kpdudek/ME416_Intro-to-Robotics
/ros/nodes/zigzag_op.py
UTF-8
1,243
3.234375
3
[]
no_license
#!/usr/bin/env python """ Node that outputs a sequence of forward-moving arches """ import rospy from geometry_msgs.msg import Twist class ZigZagCommander(object): """ Publishes Twist commands on robot_twist topic corresponding to a sequence of forward-moving arches """ def __init__(self): ...
true
b546e37a640f66591f8742c64199da1fbfcce1d5
Python
JJStoker/HackerRank
/python/basic/find_second_maximum_number_in_a_list.py
UTF-8
355
3.4375
3
[]
no_license
""" https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/ """ if __name__ == '__main__': n = int(input()) arr = list(map(int, input().split())) high_score = max(arr) value = None for score in sorted(arr, reverse=True): if score < high_score: value = score ...
true
d4c7daabf9d2192e81480262c87f1d4466f0378d
Python
f20170227/Low-power-approximate-multipliers
/scheme_1_mult_bits.py
UTF-8
14,062
2.90625
3
[]
no_license
##### 128 ########### import numpy as np from matplotlib import pyplot as plt import pandas as pd from pandas import Series import random num = 8 err = [0, 0, 0, 0, 0,0] err1 = [0, 0, 0, 0, 0,0] get_bin = lambda x, n: format(x, 'b').zfill(n) x=list(range(100000)) x1=list(range(6)) yans=list(range(100000)) yans1=list...
true
b8804d19c78ecd66bc5d4da3c53daca46ca05285
Python
ZoranPandovski/al-go-rithms
/math/AddBinaryNumbers/Python/AddBinaryNumbers.py
UTF-8
177
3.484375
3
[ "CC0-1.0" ]
permissive
number1 = input("Enter the first number: ") number2 = input("Enter the second number: ") result = (int(number1, 2) + int(number2, 2)) result = bin(result) print(result[2:])
true
4ef973bc05d683261a2adf6c2c286989b157a01c
Python
dyf/genart
/genart/gen_images.py
UTF-8
5,560
2.796875
3
[ "MIT" ]
permissive
import skimage.draw as skd import skimage.io as skio import numpy as np import h5py import itertools import random from typing import List from dataclasses import dataclass, field def default_float(n=1,low=0.0,high=1.0): if n == 1: return field(default_factory = lambda: np.random.uniform(low, high) ) e...
true
97f781584d695133e11935f1903eff1c790074f8
Python
fengges/leetcode
/剑指 Offer/剑指 Offer II 080. 含有 k 个元素的组合.py
UTF-8
614
2.75
3
[]
no_license
import copy class Solution: def combine(self, n,k): t=[] self.result = [] nums=[ i+1 for i in range(n)] index=[False for i in range(len(nums))] self.isSelect(index,nums,t,k,0) return self.result def isSelect(self,index,nums,t,k,s): if k==0: se...
true
2bcdf7beba8f56224548c2796c8114b011c7235b
Python
mzebin/Password-Generator-Android
/main.py
UTF-8
1,395
3.421875
3
[]
no_license
# Importing required modules. import random import string import kivy from kivy.app import App from kivy.core.clipboard import Clipboard from kivy.uix.boxlayout import BoxLayout # Minimum requirements. kivy.require("1.9.0") # The Characters for generating passwords. UPPERCASE = string.ascii_uppercase LOWERCASE = str...
true
1ee64e8edee00bebaa963eca5c58f564eb300697
Python
alfredolimams/PDI
/vini/vinicius_workspace/14-02-19/colors.py
UTF-8
496
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Feb 14 09:48:26 2019 @author: alunoic """ #%% import cv2 import matplotlib.pyplot as plt img = cv2.imread('baboon.png', cv2.IMREAD_COLOR) bgr = cv2.split(img) plt.subplot('221'); plt.title('B'); plt.imshow(bgr[0], 'gray') plt.subplot('222'); plt.title('G'); plt.imshow(bgr[1...
true
8d54f3bcbdd91d752687b53a4d85903fd4e0e223
Python
gieeedreee/project_235
/app.py
UTF-8
744
2.796875
3
[ "MIT" ]
permissive
import json import pickle import numpy as np from flask import Flask from flask import request app = Flask(__name__) with open("clf.pkl", "rb") as f: clf = pickle.load(f) def __process_input(request_data: str) -> np.array: return np.array(np.asarray(json.loads(request.data)["data"])) # C...
true
125da100b1e8fe3fb242cbbcd5fecc5a4f16ead2
Python
eBLDR/MasterNotes_Python
/Database_ORM_SQLAlchemy/session.py
UTF-8
6,214
3.75
4
[]
no_license
""" Session object states: - Transient: an instance that's not included in a session and has not been persisted to the database. - Pending: an instance that has been added to a session but not persisted to a database yet - add() - Persistent: an instance that has been persisted to the database - commit() - Det...
true
08a8a3b26b74445cbd26c41128c47306c5581281
Python
antatranta/Educational-Game-Recursions
/src/family_tree_node.py
UTF-8
267
3.765625
4
[]
no_license
"""Family Tree Node""" class FamilyTreeNode: """Family Tree Node""" def __init__(self, name, father=None, mother=None): self.name = name self.father = father self.mother = mother def __str__(self): return str(self.name)
true
19ab3f1ee68456f4ba5ecb212e7fa0582ef3b6d3
Python
Dullz95/function-activity
/main.py
UTF-8
851
3.515625
4
[]
no_license
# Hotel costs for different cities # Cost is in Rands def hotel_cost(nights): return nights * 140 def plane_ride_cost(city): if "cape_town" == city: return 2500 elif "Durban" == city: return 2300 elif "JHB" == city: return 2000 elif "BFN" == city: return 1800 # c...
true
8d31aecba18e6ac3c087c7f0e1b77330804d4f5d
Python
Shridipta/Hangman
/hangman_gui.py
UTF-8
18,620
2.703125
3
[ "MIT" ]
permissive
import random import pygame from pygame import time import time from words import words_list global hint_count pygame.init() screen = pygame.display.set_mode((600, 400)) pygame.display.set_caption("Hangman") icon = pygame.image.load("hangmanIco.png") pygame.display.set_icon(icon) pygame.mixer.music.set...
true
ee3e815338b5bbb7c02fbfed0986ba99fddea089
Python
SpencerZahn/Daily-Python-Exercise-01
/Daily Exercise 2 020818.py
UTF-8
382
4.5625
5
[]
no_license
#Spencer Zahn - Python Daily Exercise 2 - 020818 # 2. Create a program that asks the user to enter their name and their age. # Print out a message addressed to them that tells them the year that they will turn 100 years old. Clue input() name = input("Enter your name: ") age = int(input("Enter your age: ")) pr...
true
5e4dda4bbe5aea52a3dcdde3a5933093afdd8bb7
Python
shiauyeei/InsurancePremium
/MH6191 Practicum 4th Draft.py
UTF-8
9,301
2.90625
3
[]
no_license
# Import Library import pandas as pd import numpy as np import seaborn as sbn import matplotlib.pyplot as plt import statsmodels.api as sm # Import Pre-processing Package from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import StandardScaler # I...
true
0f8fd120936886b23ddf6faacb6d159fa840e786
Python
zolotarov/dehydrin_promoters
/scripts/protein_domain_summary.py
UTF-8
498
2.609375
3
[]
no_license
import cPickle from collections import Counter all_deh_d = cPickle.load(open("../results/all_deh_matches.pkl", "r")) for val in all_deh_d: counter = 0 empty_counter = 0 for item in all_deh_d[val]: if 'Dehydrin' in item: counter += 1 elif item == '': empty_counter += 1 if (len(all_deh_d[val]) - counter -...
true
85b390f9022bee02fa7d983dff36116bd821bdb1
Python
liuyuzhou/python3.7sourcecode
/chapter12/file_input.py
UTF-8
143
2.609375
3
[]
no_license
#! /usr/bin/python # -*-coding:UTF-8-*- import fileinput path = './test.txt' for line in fileinput.input(path): print(f'line is:{line}')
true
779ea7493c620cd3f886e8f1e01da773b1c849d2
Python
rr-learning/disentanglement_dataset
/read_data.py
UTF-8
941
3.03125
3
[ "CC-BY-4.0" ]
permissive
#!/usr/bin/env python import imageio import numpy as np import os import glob import re import argparse numbers = re.compile(r'(\d+)') def numericalSort(value): parts = numbers.split(value) parts[1::2] = map(int, parts[1::2]) return parts def main(): parser = argparse.ArgumentParser(description='Rea...
true