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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a5f2770b598c9dc140f867ce913e8cc3e37bcad6 | Python | miaocunfa/Python_demo | /python-crash-course/chapter-04/4-5.py | UTF-8 | 98 | 3.09375 | 3 | [] | no_license | list = [value for value in range(1,1000001)]
print(min(list))
print(max(list))
print(sum(list))
| true |
3a5d668e1d1edddf52fd9aa58273ef8fc25ea9da | Python | csm9493/FC-AIDE-Pytorch | /core/utils.py | UTF-8 | 7,320 | 2.59375 | 3 | [
"MIT"
] | permissive | import sys
import random
import time
import datetime
import numpy as np
import scipy.io as sio
from PIL import Image
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import torchvision.transforms.functional as tvF
import h5py
import random
import torch
import math
from skimage import m... | true |
2442452fccc7e40eddacb148e8699a225b7853a1 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc028/A/4666170.py | UTF-8 | 142 | 2.703125 | 3 | [] | no_license | N,A,B = map(int,input().split())
newN = N - N//(A+B) * (A+B)
if newN == 0:
print('Bug')
elif A >= newN:print('Ant')
else:print('Bug') | true |
1729553d4a51c640bfff5664cff5b9c258637f7e | Python | JohnHenrySplitMyHeart/bikesanity | /bikesanity/output_transformers/pdf_output.py | UTF-8 | 6,792 | 2.609375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import bikesanity.io_utils.log_handler as log_handler
from bikesanity.entities.content_blocks import Image, Map, TextBlock
from bikesanity.entities.journal import Journal
from .pdf_templates.journal_pdf import JournalPdf
from .pdf_templates.journal_pdf_reduced import JournalPdfReduced
class PdfTocEntry:
def __in... | true |
02099b58730a0edf12ffd46f03d56c654e7336db | Python | VJaGG/visualization | /model.py | UTF-8 | 1,758 | 2.546875 | 3 | [] | no_license | import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 32, 3, padding=1),
nn.BatchNorm2d(32),
nn.ReLU(),
)
self.layer2 = nn.Sequential(
nn.Conv2d(32, ... | true |
b498ffb4ed2828ab1accbefa2a08fe19c526a74c | Python | white5pace/python-practice | /Python-programming/3.2.3.py | UTF-8 | 153 | 3.375 | 3 | [] | no_license | def f(x):
return x * 10
n = int(input())
di = dict()
for i in range(n):
x = int(input())
if x not in di:
di[x] = f(x)
print(di[x]) | true |
054ac2562f8fd9ee4a76be10f9986877088cdebe | Python | CoolProgrammerX/qiskit-terra | /qiskit/result/utils.py | UTF-8 | 5,660 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | true |
2f527334dccd1ec971dc2333fa6695b1659068f0 | Python | ckq2018/ck003 | /base/read_yaml2.py | UTF-8 | 514 | 2.828125 | 3 | [] | no_license | import os
import yaml
class DataRead2():
def __init__(self, filename):
self.filename = os.getcwd() + os.sep + "data" + os.sep + filename
# os.getcwd() + os.sep + "data" + os.sep +
def read_yaml2(self):
with open(self.filename, "r", encoding="utf-8") as f:
return yaml.load(f)
... | true |
1366ec7e2e985dac8b1ca11cea88be79d6fe72e7 | Python | kckevinchen/SparseBenchmark | /exp/mtx.py | UTF-8 | 349 | 2.65625 | 3 | [] | no_license | import scipy.io as sio
import numpy as np
import os
def load_from_mtx(mtx_path):
"""
Function that takes a network and a list of masks and applies it to the relevant layers.
mask[i] == 0 --> Prune parameter
mask[i] == 1 --> Keep parameter
"""
matrix = sio.mmread(mtx_path).astype(np.float32... | true |
fc0714489c3149ac6ce674e107f14e6fd81e2347 | Python | cbolton56/bioinformatics_workspace | /gene.py | UTF-8 | 8,403 | 3.078125 | 3 | [] | no_license | import os
import sys
import pandas as pd
import graph as gx
import phylo_tree as px
FILE_PATH = "/home/turing/mhou/csci652/data/sars-cov2/UCSC/wuhCor1.strainName119way.maf"
ASCII_LENGTH = 128
def main():
#Opens the main file that contains the alignment blocks
infile = open(FILE_PATH)
lines = infile.readli... | true |
376c5cef6532356e5f0eb9bd6b3143b2dad6ce9a | Python | souldzin/doorman | /src/doorman-entryway-sensor/src/doorman/entryway/sensor/sensor_random.py | UTF-8 | 540 | 2.65625 | 3 | [] | no_license | import random
import math
from rx import Observable
def get_random_value():
val = random.random() * 30 + 15
return math.floor(val * 10) / 10
def get_random_frame():
return [get_random_value() for x in range(0,64)]
class RandomSensor:
def get_frames(self, scheduler=None):
return Observable.gen... | true |
a5db1b21031d34d694018905566ee8f66d3054eb | Python | caiquemarinho/python-course | /Exercises/Module 05/exercise_09.py | UTF-8 | 391 | 4.21875 | 4 | [] | no_license | """
Read the salary of the employee amd and the loan monthly pay. If the pay is higher than 20% of the employee's
salary print that the loan is being denied.
"""
print('Input your salary')
salary = float(input())
print('Input the monthly pay')
pay = float(input())
threshold = salary*0.20
print(threshold)
if pay <... | true |
86c2223f204595c9ddf6e20b1e4fb3dd7627e15a | Python | Huaxulei1/nlp_learning | /English_text_analysis_and_processing_nltk/demo1.py | UTF-8 | 1,663 | 3.453125 | 3 | [] | no_license | import nltk
#nltk.download('punkt')
# 导入内置分词器和分句器
from nltk import word_tokenize,sent_tokenize
# 导入内置停用词
from nltk.corpus import stopwords
# 导入词性标注工具
from nltk import pos_tag
# 导入正则表达式分块器
from nltk.chunk import RegexpParser
import matplotlib
matplotlib.use('Agg')
# 读入数据
corpus = open('1.txt','r').read()
# 查看数据类型
# pri... | true |
a2fe537e296470ca1694a5854c45e925983975a5 | Python | Ryan0o0/boat-wars | /src/screens/instructions.py | UTF-8 | 1,977 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import pygame
import screens
import screens.boats
import screens.introduction
import screens.rules
import screens.main_menu
import screens.sound as sound
import widget.button
class InstructionsScreen:
def __init__(self, canvas):
self.canvas = canvas
self.image = pygame.image.load('resources/scree... | true |
b29b18bfa44cd8d778fb939623c7fb5a8664cf23 | Python | yiguid/LeetCodePractise | /finished/024.py | UTF-8 | 564 | 3.359375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
v = ListNode(0)
v.next = head
p = v... | true |
d92f0fd79db95152a4251ad4e659aff3b83ef590 | Python | yuki-uchida/Competitive_programming | /AtcoderBeginnerContest/042/c.py | UTF-8 | 659 | 2.96875 | 3 | [] | no_license | from collections import deque
N, K = map(int, input().split())
nums = list(map(str, input().split()))
can_use_nums = set([str(i) for i in range(10)])
for num in nums:
can_use_nums.remove(num)
# print(can_use_nums)
queue = deque([[num] for num in can_use_nums if num != '0'])
# print(queue)
min_num = float('inf')
wh... | true |
96ccaea7373ff5a2562860ade9180e9ff639a150 | Python | manpreet1994/topgear_python_level2 | /q3.py | UTF-8 | 531 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 25 18:14:33 2020
@author: manpreet
"""
from functools import reduce
numerals = { 'M' : 1000, 'D' : 500, 'C' : 100, 'L' : 50, 'X' : 10, 'V' : 5, 'I' : 1 }
def program3(s):
return reduce(lambda x, y: -x + y if x < y else x + y, map(lambda x:... | true |
b3fd9a52b5c778fa08db51f4c2b63d553a1bfbbb | Python | kryp2/serverless-flask-on-aws | /serverless_flask/pages/test_index.py | UTF-8 | 455 | 2.546875 | 3 | [
"MIT"
] | permissive | import json
from flask.testing import FlaskClient
def test_index(test_client: FlaskClient):
rv = test_client.get("/")
assert "Hi! I am running on unittest.example.com" in rv.data.decode("utf-8")
def test_example_json_api(test_client: FlaskClient):
rv = test_client.get("/example_json_api")
assert rv.... | true |
7d99bfb77fe32d90829b29e00b3c6164303ab72a | Python | maehler/kmer-haplotype-merge | /scripts/build_contig_graph.py | UTF-8 | 1,944 | 3 | 3 | [
"MIT"
] | permissive | import pysam
import sys
def construct_edge(aln):
# Set the lexicographically smaller contig name as source.
if aln[0].reference_name <= aln[1].reference_name:
source_index = 0
target_index = 1
else:
source_index = 1
target_index = 0
return (
aln[source_index].re... | true |
34a7cba68541bdc5f6eb381665fdcca20344239e | Python | Dmurav/graph_maker | /graph_service/service/parametrs_service.py | UTF-8 | 3,188 | 2.5625 | 3 | [] | no_license | from graph_service.graph_makers.cpuGraph import GraphCPUMaker
from graph_service.graph_makers.diskAvgRwGraph import GraphDiskAvgRwMaker
from graph_service.graph_makers.diskQueueGraph import GraphDiskQueueCPUMaker
from graph_service.graph_makers.loadAvgGraph import GraphLoadAvgMaker
from graph_service.graph_makers.memor... | true |
1fa110e1b2954f8c736563f7c4892b8a557653ca | Python | edinburgh-university-OOSA/OOSA-code-public | /foundations/basic_features/05_loops_and_functions.py | UTF-8 | 3,464 | 4.40625 | 4 | [] | no_license |
'''
Intro to loops, funcitons and ifs
'''
# So far we have written "monolithic" code. We can create reusable chunks of code called "functions".
# We have already been using these from some packages (eg plt.plot()), but can create our own.
# to create a function, define it, the populate it with commands with a set... | true |
01f8d8a5d9d1ea53408b4da8f1cbc8e6cf856509 | Python | Back-On-Track/Web-Server | /backontrack/charting.py | UTF-8 | 5,791 | 3.125 | 3 | [] | no_license | import datetime
def get_piechart_data(courses):
all_durationStudied_types = {
'STUDY': 0,
'HOMEWORK': 0,
'PROJECT': 0,
'LAB': 0,
'OTHER': 0
}
for course in courses:
for event in course["events"]:
if event["type"] == 0: all_durationStudied_types['S... | true |
b574a9a1327e5b4f71c73bb55efd7449417975e1 | Python | joseph8th/MyPyMLS | /mlearner/mlearner.py | UTF-8 | 7,911 | 2.53125 | 3 | [] | no_license | from dtl.controls import *
from knnl.knnl import *
from tools.controls import *
from tools.adaboost import *
"""
Command-line and sys-level config and control
for my basic machine learning packages.
Joseph Edwards <jee8th@unm.edu>
CS429 - Spring 2012 - UNM
"""
def _print_help():
print "\nUSAGE: python nmlearner.... | true |
24e6581e70b52396193adfbeb254149623f4735f | Python | estrada-josh/ichi-bol | /funcs.py | UTF-8 | 9,082 | 2.8125 | 3 | [] | no_license | import pandas as pd
from datetime import date
import numpy as np
import yfinance as yf
import datetime as dt
from datetime import timedelta
from pandas_datareader import data as pdr
import requests
from statistics import mean
# Returns list of tickers
def filters(file):
tickers = []
vol_lim = 500000
price_... | true |
e22a28d92c07d6a0f31a97e4ee7fa6c89cde00f7 | Python | HarshadMagam/MS-Student-Admission-Predictor | /project.py | UTF-8 | 858 | 2.609375 | 3 | [] | no_license | from flask import Flask, request, render_template
import numpy as np
import pickle
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template('home1.html')
@app.route('/front')
def my_form_return():
return render_template('home1.html')
@app.route('/',methods = ['POST'])
def my_form... | true |
7ca49eb752d2a426067a4980a04e61af7aeda077 | Python | uk-kim/anomaly_p3d | /dbread.py | UTF-8 | 7,149 | 2.71875 | 3 | [] | no_license | import os
import random
import PIL.Image as Image
import numpy as np
from config import *
def normalize(im):
return im / 255.0
# def normalize(im):
# return im * (2.0 / 255.0) - 1
# def denormalize(im):
# return (im + 1.) / 2.
class DBreader:
def __init__(self, dbtype='UCSDped1', batch_size=1, n_f... | true |
f205fc32052edda2c3ecd3cf2bb6aa9a65471f7d | Python | DDR7707/Final-450-with-Python | /Arrays/36.Min subarray with given sum.py | UTF-8 | 558 | 2.640625 | 3 | [] | no_license | class Solution:
def smallestSubWithSum(self, a, n, x):
# Your code goes here
que = []
add = 0
final = n
for i in range(n):
que.append(a[i])
add += a[i]
while que and add > x:
top = que[0]
if x < add-top:
... | true |
a0aa621e541eed3a4576f42600bb758e7f3ce8bf | Python | uqspace/star-cover | /util.py | UTF-8 | 1,284 | 3.8125 | 4 | [
"MIT"
] | permissive | import numpy as np
def stereographicProjection(alt, az):
"""Project stars onto a 2D plane stereographically.
Parameters
----------
alt : np.ndarray
The altitude of a star, relative to an observer.
Values are processed as radians.
az : np.ndarray
The azimuth of a star, rela... | true |
03d418b4ebff8b88ca377fb11601cbe8b8c16202 | Python | stepik/SimplePyScripts | /html_parsing/get_game_genres/parsers/mobygames_com.py | UTF-8 | 1,942 | 2.640625 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from urllib.parse import urljoin
from typing import List
from base_parser import BaseParser
class MobygamesCom_Parser(BaseParser):
def _parse(self) -> List[str]:
url = f'https://www.mobygames.com/search/quick?q={self.game_name}&p=3... | true |
43dcd4ab035e9e9630515ff4b73b8b616f4f37a4 | Python | e-mayo/mscreen | /mscreen/autodocktools_prepare_py3k/mglutil/web/HTMLParser.py | UTF-8 | 21,365 | 2.890625 | 3 | [
"MIT"
] | permissive | #########################################################################
#
# Date: Oct. 2002 Author: Daniel Stoffler
#
# Copyright: Daniel Stoffler and TSRI
#
#########################################################################
import _py2k_string as string
import re, urllib.request, urllib.parse, urllib.error... | true |
a27e003d7c2cde7607f4bafc0fa8bfc9cd8c4d52 | Python | Jhanay/Collector | /creator/collector_info.py | UTF-8 | 6,649 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pymysql
import json
import datetime
import os
from configs_creator import ConfigsCreator
class DateEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj,datetime.datetime):
return obj.strftime("%Y-%m-%d %H:%M:%S")
else:
retur... | true |
d8487992e6d95e47d31bdfbfe0d4f117312cdfc1 | Python | rsbusby/dodeca | /get_dodeca_points.py | UTF-8 | 1,850 | 2.921875 | 3 | [] | no_license |
from transformations import rotation_matrix, euler_matrix
from numpy import zeros, array, dot, cross
#from scipy import spatial
import math
from math import sqrt
pi = math.pi
# pick which side is 'up'
OFF_SIDE_INDEX = 4
# generate 12 points in Cartesian space, with 'spiral' method
# from http://blog.andreaskahler.co... | true |
53cac944973c7e340b9ac2e8838253108e94005e | Python | Hupeng7/pythondemo | /coredemo/test.py | UTF-8 | 349 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# 导入包
from coredemo.support import print_func
# printinfo(name="miki")
print_func("python")
'''
如上,为了举例,我们只在每个文件里放置了一个函数,但其实你可以放置许多函数。
你也可以在这些文件里定义Python的类,然后为这些类建一个包。
''' | true |
8c04e868f11f3fffe80657a05bc9b4bd62bd07bf | Python | mah1212/opencv-basic-to-advanced | /3. CoreConcepts/5_DrawingImage.py | UTF-8 | 1,828 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 2 05:15:29 2018
@author: Mahbub
"""
import cv2
def main():
print('This is inside the main function')
# Read Image
img_path = 'peppers_color.tif'
img = cv2.imread(img_path, 1) # Load image to img variable
print(type(img))
print(img.dtype)
... | true |
a4ee6d78fba7e778d7ab1bf993c6df2406f5a0a4 | Python | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/tfbanks/Lesson03/List_Lab.py | UTF-8 | 4,657 | 4.34375 | 4 | [] | no_license | # List Lab Exercise by tfbanks
#!/usr/bin/env python3
# Series 1
fruits = ["Apples", "Pears", "Oranges", "Peaches"] # Original List of Fruits
# Welcome to series 1 and tells how many fruits are in the list
print("Welcome to Series 1\nThis list has the following", len(fruits), "fruits: ", fruits, "\n")
new_fruit = ... | true |
1fa62f7dae1708371aa5b3a2778cae3e19015f21 | Python | rahuljnv/SMART_GARBAGE_MONITORING_SYSTEM | /Sbin_IOT.py | UTF-8 | 4,289 | 2.875 | 3 | [] | no_license | # include all necessary libs
from tkinter import *
import matplotlib.pyplot as plt
import pandas as pd
from PIL import ImageTk, Image
import tkinter.messagebox
# KMEANS
def PtGraph():
# Importing the dataset
dataset = pd.read_csv('time.txt')
X = dataset.iloc[:29].values
# Splitting the dataset into ... | true |
950aa0448d7ba3247d5b0bee1a5b27538c08e963 | Python | plasmatiger/Adversary_ML | /slic.py | UTF-8 | 1,394 | 2.546875 | 3 | [
"MIT"
] | permissive |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import numpy as np
from skimage import io
from skimage.filters import gaussian
from skimage.util import img_as_float
from skimage.segmentation import slic, mar... | true |
e54e2e6b7525890663a176382166996b2ce9c9fb | Python | kylin5207/MachineLearning | /数据预处理/nonlinearTransformation.py | UTF-8 | 1,705 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 15 22:33:49 2019
单变量非线性变换的模拟
@author: Kylin
"""
import numpy as np
from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams[u'font.sans-serif'] = 'Times Ne... | true |
4b081fb349f52c90da9a0c444a1f4a3970875392 | Python | aravindvrm/bnfo | /avrm_rosalind_solutions/rosalind_counting_point_mutations.py | UTF-8 | 581 | 3.4375 | 3 | [
"MIT"
] | permissive | """
ROSALIND - Counting Point Mutations
Given: Two DNA strings and of equal length (not exceeding 1 kbp).
Return: The Hamming distance
"""
from __future__ import print_function
from __future__ import division
def hamming_dist(input_file):
h_dist = 0
sequences = open(input_file, 'r').readlines... | true |
d3112d5bd54bbba90b7a66407dd9b50f13284676 | Python | erinwoodrum/python-intro-labs | /functions_lab.py | UTF-8 | 420 | 4.8125 | 5 | [] | no_license | #Create a function called age_calculator that takes in two parameters (Two different years) and returns the difference of the two years:
def age_calculator(y1, y2):
return abs(y1 - y2)
print(age_calculator(1983, 2021))
#Define another function, avg_numbers that takes three parameters, that returns the average of ... | true |
4c30d4e6a3c4b83acf4bb8b576c85a7d54477067 | Python | k123321141/paper_notes | /hw/hw1/ammai_hw1.py | UTF-8 | 1,775 | 2.53125 | 3 | [] | no_license | from l2_distance import l2_distance #l2_distance.py
from sparse_coding import sparse_coding,similarity_sparse_coding #sparse_coding.py
from calculate_map import calculate_map #calculate_map.py
import pickle
lfw_path = './hw1_data/LFW_DATA.pickle'
with open(lfw_path, 'rb') as f:
lfw = pickle.load(f)
database = lfw['... | true |
1cc4a5bff05c8a2453d6839c987f759615a1611c | Python | timel2ss/Problem-Solving | /BOJ/1339/main.py | UTF-8 | 494 | 3.296875 | 3 | [] | no_license | import sys
N = int(sys.stdin.readline())
alpha_dict = dict()
for i in range(N):
word = sys.stdin.readline().rstrip()
for j in range(len(word)):
value = 10 ** (len(word) - j - 1)
if word[j] not in alpha_dict:
alpha_dict[word[j]] = value
else:
alpha_dict[word[j]] ... | true |
2bda9da3978d323eb8e02f112ce584c55c7039e6 | Python | SashaNullptr/Google-Foo-Bar | /solution_1_test.py | UTF-8 | 1,576 | 3.125 | 3 | [] | no_license | import unittest
import os
import logging
import solution
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class SolutionTest( unittest.TestCase ):
def test_substring(self):
test_string = "abcabcabcabc"
sub_strs=solution.get_all_substrings( test_string )
# pr... | true |
72396d4c9b6c7b1de6639dcd8f7a0a30a02ced4f | Python | Alexcuellar18/vigenere-cypher | /caesar.py | UTF-8 | 1,053 | 3.609375 | 4 | [] | no_license | from helpers import alphabet_position, rotate_character
def encrypt(text, rot):
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
encrypted = ''
for char in text:
if char.isalpha():
if char.isupper():
char = char.lower()
... | true |
3e3299128ac39a009850cf7b3430107fb5094b52 | Python | Cesar-Villegas/Cesar | /gestor-de-datos-master/src/helpers/processor.py | UTF-8 | 2,112 | 2.6875 | 3 | [] | no_license | from datetime import date, timedelta
import requests, json, random
class Processor:
@staticmethod
def extract_created_uid(res, key):
assert isinstance(res, requests.Response)
if res.status_code == 200:
response = json.loads(res.text)
if not 'data' in respo... | true |
bb6fd26e46bc23d9714d8b0afdb3934ce4fd1b25 | Python | bermec/challenges | /vertical_printing.py | UTF-8 | 306 | 2.890625 | 3 | [] | no_license | import itertools
candidates = '''Kernel
Microcontroller
Register
Memory
Operator'''
candidates = candidates.split()
txt = ''
for word in candidates:
txt += word + ' '
l = txt.split(' ')
for i in itertools.zip_longest(*l, fillvalue=" "):
if any(j != " " for j in i):
print(" ".join(i)) | true |
77180f4bc4e900ef03ce1e371ca909a8a5549fac | Python | cole-brown/veredi-code | /data/records/record.py | UTF-8 | 13,485 | 2.8125 | 3 | [] | no_license | # coding: utf-8
'''
A class for loading a record of save game data.
A Record Class can have multiple documents, like 'metadata' and 'game.record'.
'''
# -----------------------------------------------------------------------------
# Imports
# --------------------------------------------------------------------------... | true |
296ec18cbc621a529eb07cf7a22fda7bd6fb3781 | Python | kongxiuzhi/python-practice | /Vector.py | UTF-8 | 809 | 3.390625 | 3 | [] | no_license | class Vector:
"""Represent a vector in multidimensional sapce"""
def __init__(self,d):
self._coodrs =[0] *d #create d-dimensional vector of zeros
def __len__(self):
return len(self._coodrs)
def __getitem__(self,j):
return self._coodrs[j]
def __setitem__(self,j,value):
self._coodrs[j] = value
def _... | true |
4b0e45281df50aaadc687b1ec0cbaa8cf0398473 | Python | atKsOption/Ks | /test.py | UTF-8 | 122 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 0.1, 0.01)
print x
plt.plot(x, np.sin(x))
plt.show()
| true |
8476c4e5dd3e50fccd63717957f7366fc624623b | Python | vipin-s0106/DataStructureAndAlgorithm | /SearchingAlgorithm/LinearSearch.py | UTF-8 | 143 | 3.640625 | 4 | [] | no_license | arr = [4,2,8,7,6,1,3]
def search(ele):
for num in arr:
if num == ele:
return True
return False
print(search(21))
| true |
cdb730659435087e2309aabf62ef5bedf2b5d1c2 | Python | MrPaoBrother/PaperFormatterTool | /handler_process.py | UTF-8 | 1,545 | 2.546875 | 3 | [] | no_license | # -*- coding:utf8 -*-
import os
import docx
import config
import util
from pku_parser import PKUParser
class HandlerProcess(object):
def __init__(self):
self.doc = self.fetch_doc()
self.paper = self.init_paper()
self.parser = self.choose_parser()
def choose_parser(self):
i... | true |
0778d7a34f3d5f615fba4d9a23c2ab8f59f3107e | Python | ALU-RWA/hello-world | /flags.py | UTF-8 | 1,970 | 3.5 | 4 | [] | no_license | #Okoye-Nobert Chukwuebuka
from aluLib import *
window_width = 1000
window_height = 500
# Note that functions are expected to be lowercase, so don't be tempted to capitalize
def congo_brazaville():
#Your code for the Congo brazaville flag goes here
disable_stroke() #this function removed the strokes from t... | true |
d6bd9e299a3e7148273f6290f1b8ca51fff988cb | Python | miki-minori/python-work | /AtCoder/216/216A.py | UTF-8 | 141 | 3.3125 | 3 | [] | no_license | li = list(map(int,input().split('.')))
if(li[1]<3):
print('%d-'%li[0])
elif(li[1]<7):
print('%d'%li[0])
else:
print('%d+'%li[0]) | true |
c60f21885b7e85baa5470689fe7d91fd12577635 | Python | manuzhh/TaxonomyService | /StopwordHandler.py | UTF-8 | 1,445 | 2.921875 | 3 | [] | no_license | from ConfigReader import ConfigReader
from DiskStorageStopwordHandler import DiskStorageStopwordHandler
from SessionLogger import SessionLogger
class StopwordHandler:
db_type_fs = 'filesystem'
# returns a string set of the session's current stopwords
@staticmethod
def read_stopwords():
db_ty... | true |
09b1c0e662f4fcc7cab9f4d6ebdfdc37a56ead82 | Python | whucyb/computational_physics_N2014301020067 | /Exercise_03/figure.py | UTF-8 | 428 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
x_1=np.linspace(1,5)
x_2=np.linspace(1,5,10)
y_1=25/x_1
y_2=x_2**2
p1,=plt.plot(x_1, y_1,'r-')
p1.set_dashes([10,5,2,5])
p2,=plt.plot(x_2, y_2,'cD')
plt.grid()
plt.title('Figure')
plt.xlabel('x axis')
plt.ylabel('y axis')
plt.xlim(... | true |
03f0e9299afc13692bbb5ac92c45bfebc77e1218 | Python | gujie1216933842/codebase | /多线程/08_线程池.py | UTF-8 | 1,436 | 3.28125 | 3 | [] | no_license | from concurrent.futures import ThreadPoolExecutor
import time
def my_feature(message):
time.sleep(2)
return message
pool = ThreadPoolExecutor(max_workers=2) # 创建一个最大容纳2个task的线程池
f1 = pool.submit(my_feature, 'hello') # 使用submit方法来往线程池中加入一个task,返回一个featrue对象,可以理解为一个未完成的操作
f2 = pool.submit(my_feature, 'nihao... | true |
764de5915d3b95b621a7d9911192287ebd94bc58 | Python | zeroth/scikit-image | /doc/examples/registration/plot_opticalflow.py | UTF-8 | 2,302 | 3.296875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | # coding: utf-8
"""Registration using optical flow
==================================
Demonstration of image registration using optical flow.
By definition, the optical flow is the vector field *(u, v)* verifying
*image1(x+u, y+v) = image0(x, y)*, where (image0, image1) is a couple of
consecutive 2D frames from a seq... | true |
54e9f112ad6bf4ab3d270f22c880e25539faa136 | Python | PGDataScienceCN/DM_Cleaning_Mapping | /wm_tracking_cleanning.py | UTF-8 | 4,402 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: gbk -*-
import xlrd
import glob
import csv
import sys
import pandas as pd
import Levenshtein
prefix_path = 'C:/Users/liu.y.25/Desktop/Promo Forecast/2 DM Data/Fem'
def check_summary_sheet (dir_path):
for f in glob.glob(dir_path):
workbook = xlrd.open_workbook(f)
... | true |
8dacf4b1598afa9f93d3438c440514925736f169 | Python | kevin-2015/iosSmokeTestAppium | /MPSmokeTestCase/tapByCoordinate/tapByCoordinate 2.py | UTF-8 | 415 | 2.59375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
#!/usr/bin/python
import unittest
import os
from random import randint
#from appium import webdriver#
from selenium import webdriver
from time import sleep
class tapByCoordinate(webdriver.Remote):
def tapByCoordinate(self, element):
location = element.location
el_size = element.size
ret... | true |
7baad6b3794a237bcf2b0e0d1e31239bf3c7e42c | Python | MalharK/CNF-SAT-solver | /dpll.py | UTF-8 | 4,579 | 3.125 | 3 | [] | no_license | # coding=utf-8
import copy
inferred_group_count = 0
def remove_key_dict(clause, literal, make_copy):
"""
Removes from the dictionary the key *key* if present and returns the remaining dictionary
:param clause: clause in the sentence
:param literal: literal that needs to be removed from the clause
... | true |
0be9e6e6825d8264d5c48d6bef01ac7315125263 | Python | durgeshugale/CRUD-Employee-FLASK-APP | /app.py | UTF-8 | 3,564 | 2.8125 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.secret_key = "Secret Key"
# SqlAlchemy Database Configuration With Mysql
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:''@localhost/crud'
app.config['SQLALCHEMY_TRACK_M... | true |
95757426b4cb4d13a1e5217b1e95941b53e60e91 | Python | gizatt/robot_painting | /robot_painting/models/tests/test_sprite_blitting.py | UTF-8 | 1,565 | 2.78125 | 3 | [
"MIT"
] | permissive | import pytest
import torch
import robot_painting.models.sprite_blitting as mut
import numpy as np
def test_oilpaint_converters():
'''
Just make sure we can instantiate the oilpaint converters.
'''
mut.oilpaint_converters()
def test_pose_utils():
pose = torch.tensor([[
1., 2., np.pi/2.
... | true |
15f10e288b7a6e4f53c9f1349f067c9839d0cf22 | Python | acbart/attribute-learning-system | /spyral/sprite.py | UTF-8 | 22,046 | 2.875 | 3 | [] | no_license | import spyral
import pygame as pygame
from weakref import ref as _wref
import math
_all_sprites = []
def _switch_scene():
global _all_sprites
_all_sprites = [s for s in _all_sprites if s() is not None and s()
._expire_static()]
class Sprite(object):
"""
Sprites are how images ar... | true |
88e40f205d9d984a868754106deba048f4b25a59 | Python | todddeluca/gym-berkeley-reinforcement | /pacmanapp.py | UTF-8 | 10,320 | 2.703125 | 3 | [] | no_license |
import argparse
import numpy as np
import pickle
import random
import time
import gym
import gymberkeleyrl
from gymberkeleyrl.envs import PacmanEnv
from reinforcement.pacman import parseAgentArgs, replayGame
from reinforcement import (ghostAgents, learningAgents, qlearningAgents,
keyboardA... | true |
018ead22288309650aee648489196c113303d487 | Python | DW-Lay/2dtan_with_annotation | /tan/modeling/tan/featpool.py | UTF-8 | 1,770 | 2.90625 | 3 | [] | no_license | import torch
from torch import nn
class FeatAvgPool(nn.Module):
def __init__(self, input_size, hidden_size, kernel_size, stride):
super(FeatAvgPool, self).__init__()
# class torch.nn.Conv1d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True)
# in_ch... | true |
1de74528b2e7018470bc0baebd2df398032ec52c | Python | x1916/PythonScripts | /sql.py | UTF-8 | 4,598 | 2.984375 | 3 | [] | no_license | ########################################################################
#
# SQLITE DATABASE ANALYSER BY PETER BYRNE
#
########################################################################
import sqlite3
import sys
import time
##### Print the usage of the script. ###################################
def usage():
... | true |
42aae58573dd88c8e3073bfa215453a3475aa759 | Python | Quitino/ImageProcess_course | /02_ImageAnalysis/08_UnderwaterImage-Enhancement/underwater-dehaze-and-recognize/neural_net-master/DraftCode/img_test.py | UTF-8 | 1,115 | 2.9375 | 3 | [] | no_license | import import_label_data as imp
import numpy as np
"""
scaleIn = 16
scaleOut = 16
data = imp.import_all(scaleIn, scaleOut)
print data.train_x.shape
print data.train_y[0:100]
def dense_to_one_hot(a, num_classes=6):
labels_dense = np.asarray(a)
num_labels = labels_dense.shape[0]
index_offset = np.arange... | true |
fb6121d9e5c41c4efe0439a72fa1fc0c04aaf0f5 | Python | hrushikesh-dhumal/Hacker-Rank | /AI/EASY/Laptop Battery/laptop_battery_data_exploration.py | UTF-8 | 260 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
df = pd.read_csv("trainingdata.txt" , sep=',', names={'time_charged', 'time_lasted'}, header=None)
df.describe()
import matplotlib.pyplot as plt
%matplotlib inline
plt.scatter(df['time_charged'], df['time_lasted'])
plt.show() | true |
79a90a95ed703a6400a4bfd580ee3949db21ab24 | Python | mikhail-7975/computational_physics | /task7_predator-prey.py | UTF-8 | 1,311 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def SystemOfEquations(X: np.ndarray, t = 0, a = 10, b = 2, c = 2, d = 10):
#def SystemOfEquations(X: np.ndarray, t=0, a=1., b=1., c=1., d=1.):
x = np.float64(X[0])
y = np.float64(X[1])
return np.array([a * x - b * x * y,
c * x... | true |
74f1edc033c4c7f58885ea18168e977ab9800293 | Python | renanmat/ExPython | /ex095.py | UTF-8 | 1,376 | 3.703125 | 4 | [] | no_license | dados = dict()
jogadores = list()
while True:
dados.clear()
dados['nome'] = str(input('Nome do Jogador? '))
dados['partidas'] = int(input(f'Quantas partidas {dados["nome"]} jogou? '))
dados['gols'] = list()
for cont in range(dados['partidas']):
dados['gols'].append(int(input(f'Quantos gols n... | true |
c7bb6e0c45adb96431ff5f0cb3dcf2fda4022f86 | Python | 49257620/reboot | /studysrc/day01/testList.py | UTF-8 | 80 | 3.421875 | 3 | [] | no_license | # encoding utf-8
nums = [1, 2, 3, 4, 5, 6, 7]
for num in nums:
print(num)
| true |
e538fc0287153149c7198fe58fe165326b989068 | Python | JamesPeralta/Competitive-Programming | /January 29, 2020/generate-crossword.py | UTF-8 | 606 | 3.65625 | 4 | [] | no_license | word_a, word_b = input().split(" ")
a_indices = {}
for index, char in enumerate(word_a):
data = a_indices.get(char, [])
data.append(index)
a_indices[char] = data
a_row = 0
b_col = 0
for index, char in enumerate(word_b):
data = a_indices.get(char, False)
if data is not False:
a_row = index... | true |
811a2cd356da5423ecd6c152b478a975b3061002 | Python | xiali-github/Automatic-Rental-of-Gynecology-in-Traditional-Chinese-Medicine | /4.自动组方/2.基于互信息的组方模块/p4_validate.py | UTF-8 | 3,738 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import utils
import gol
from collections import Counter
def count_prescript(series_two, list_name, group_list_word):
"""
计算症状团在药方数据中出现的次数
:param series:
:param list_name:
:param group_list_word:
:return:
"""
group_list = utils.word_2_num(list_name, g... | true |
c81038b6ee74ba6b57700fdbf50509e1d5d93bdc | Python | anirudhpillai/algorithms | /leetcode/minimum_moves_to_equal_array_elements.py | UTF-8 | 150 | 2.5625 | 3 | [] | no_license | class Solution(object):
def minMoves(self, nums):
# return sum(i-min(nums) for i in nums)
return sum(nums) - len(nums)*min(nums)
| true |
18b0ac9bd9fd19ba1fdec6600010899b4a9dad47 | Python | JalexChang/cross-media-attribution | /test/test_dataset.py | UTF-8 | 3,864 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | import numpy
import unittest
from mta.dataset import Dataset
import mta.utility as utility
from datetime import timedelta
class TestDataSet(unittest.TestCase):
def setUp(self):
self.ratings = numpy.loadtxt('cust_ratings',delimiter=',')
self.touchs = numpy.loadtxt('cust_touchs',delimiter=',')
... | true |
879620d74700dffa68e2cbc2f9610c05d097189b | Python | Aasthaengg/IBMdataset | /Python_codes/p03548/s783165876.py | UTF-8 | 111 | 3.046875 | 3 | [] | no_license | X,Y,Z=map(int,input().split())
answer=0
width=Y+2*Z
while(width<=X):
answer+=1
width+=Y+Z
print(answer) | true |
5fe7f263d722694fefea1b38d6a0e453f32741ff | Python | utecrobotics/labs_robotica_20182 | /lab3/src/show_image.py | UTF-8 | 1,353 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
#
# Robotica Autonoma 2018-2
# Universidad de Ingenieria y Tecnologia - UTEC
#
# Este nodo se suscribe a una imagen de ROS, la convierte en una matriz de
# OpenCV y la muestra en pantalla
#
import rospy
import cv2
import numpy as np
from sensor_msgs.msg import Image
from cv_bridge import CvBr... | true |
a81ce4ce74f456db6760c242653581701e92a800 | Python | fushengyong/Free-motion-planning-of-multiple-AGVs | /Code/wh_environment.py | UTF-8 | 5,993 | 2.96875 | 3 | [] | no_license | """
This file is part of the master thesis of Michiel De Deken, MSc. in Engineering: Logistics & Traffic @ KU Leuven:
" Free motion planning of multiple AGVs using a spline based-approach
--- A multi-frame technique applied to a warehouse environment --- "
June 2018
Author: Michiel De Deken
"""
import numpy as np... | true |
0f20f4d4ea6a935e8ff3860e0f25c2385c7f96db | Python | ercembu/personal | /Bit/key.py | UTF-8 | 1,090 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
import os, binascii, hashlib, base58, ecdsa
import random
"""
import qrcode
img = qrcode.make(publ_addr)
img.save("coin.png")
"""
def shex(x):
return binascii.hexlify(x).decode()
def b58wchecksum(x):
checksum = hashlib.sha256(hashlib.sha256(x).digest()).digest()[:4]
return base58.b... | true |
b5ad5aa7236f766160a0571eaef81212abde9108 | Python | kpiyush17/voting-app-python | /votingapp/models.py | UTF-8 | 920 | 2.6875 | 3 | [] | no_license | from votingapp import db
# User Table Schema
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(20), unique=True, nullable=False)
password = db.Column(db.String(200), nullable=False)
has_voted = db.Column(db.Boolean, nullable=False, default=False)
def... | true |
37e2e33ace91dc86b2c9c9fa924d3e8de71e46db | Python | CristianGaleano04/ayed-2019-1 | /laboratorios/1-recursion/B/problem.py | UTF-8 | 925 | 3.203125 | 3 | [
"MIT"
] | permissive | import json
from sys import stdin
# TODO Complete!
def arrange(numbers,a,b):
if len(numbers)== 1:
return a+b+numbers
else:
if numbers[0]%2 == 0:
a.append(numbers[0])
numbers.remove(numbers[0])
return arrange(numbers,a,b)
else:
b.append(num... | true |
bf742b5f0d64ac0dca6f13f7c45573d9333f4c0e | Python | damonallison/python-examples | /tests/libraries/test_pandas/test_plotting.py | UTF-8 | 515 | 2.890625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import pytest
# Mark all tests this module as 'plot'. These tests will be skipped with `make
# test` since they block when GUI rendering.
pytestmark = pytest.mark.plot
def test_hist() -> None:
df = pd.DataFrame(
{
"one": [0, 0.5, 1, 2, 2.5,... | true |
c3777187125edb3160d7337bb00ab649dc49904a | Python | hannesthiersen/zelle-2010 | /02-writing_simple_programs/avg2.py | UTF-8 | 839 | 4.03125 | 4 | [] | no_license | # File: avg2.py
# Date: 2019-09-21
# Author: "Hannes Thiersen" <hannesthiersen@gmail.com>
# Example: avg2.py
# Description:
# A simple program to average two exam scores
# Illustrates use of multiple input
#-----------------------------------------------------------------------------... | true |
67c0d424ba89372ca5053761592dfcda631f9d1d | Python | xiilei/pytools | /host-dev.py | UTF-8 | 1,841 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# change hosts
# Usage
# sudo ./host.py dev
#
__author__ = 'xilei'
import sys
import os
hosts_dir = "./hosts"
prefix = "company-"
mode_tpl = "tpl"
host_path = "/etc/hosts"
tpl_repl = "{tpl}"
def usage():
help_text = "usage: %s mode,all modes follow:\n\t%s " % (os... | true |
5fbec6de0785a51b51f492e228072b8b6321792d | Python | Jazende/ProjectEuler | /solved/000-099/problem_004.py | UTF-8 | 714 | 3.578125 | 4 | [] | no_license | def problem_4(digits=3, brute_force = True):
def is_palindrome(number):
if str(number) == str(number)[::-1]:
return True
else:
return False
if brute_force == True:
numbers = [x for x in range(10**(digits-1),10**digits) if len(str(x)) == digits]
numbers = s... | true |
b61df114bca1a4b30367ebf36d65cfe0147f5c03 | Python | ja999/sem5 | /kck/lab2/Michael/begin.py | UTF-8 | 259 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def main():
plt.figure(figsize=(3, 3))
plt.plot([100,200,300,400],[0.1,0.2,0.8,0.9])
plt.savefig('myplot.pdf')
plt.close()
if __name__ == '__main__':
main()
| true |
3a5ff865918d46c3e8518997c9301562032dc4e5 | Python | netket/netket | /netket/operator/_ising/base.py | UTF-8 | 6,563 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021 The NetKet Authors - All rights reserved.
#
# 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 applicable ... | true |
f5f636cc65caced0b8ff73af91e8eaa820c17001 | Python | robin200912/python-awesome | /04.爬虫/selenium-test.py | UTF-8 | 670 | 2.5625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
import getpass
import time
option = webdriver.ChromeOptions()
option.add_argument(r'--user-data-dir=C:/Users/{}/AppData/Local/Google/Chrome/User Data'.format(getpass.getuser()))
driv... | true |
51a80da5876f7127b823019c9767bb19b2d302b3 | Python | nisais-n/TowerOfHanoiSolver | /Tower of Hanoi.py | UTF-8 | 844 | 3.5 | 4 | [] | no_license | def HanoiSolver(disks, source, helper, target):
if disks == 1:
print('\nMove disk 1 from peg - {} to peg - {}.'.format(source,target))
return
HanoiSolver(disks-1, source,target,helper)
print('\nMove disk {} from peg - {} to peg - {}.'.format(disks,source,target))
HanoiSolver(disks-1,hel... | true |
4eb65a5ea460e935e28439c0e3935cdb4e7caed3 | Python | rsprenkels/kattis | /python/1_6/prozor.py | UTF-8 | 3,962 | 3.21875 | 3 | [] | no_license | # https://open.kattis.com/problems/prozor
class Prozor():
def __init__(self, picture, racket_size):
self.picture = picture
self.racket_size = racket_size
def output(self):
grid = self.picture
max_killed_flies = 0
best_spot = (0, 0)
for y in range(len(grid) - (se... | true |
d5956f1e1ec342445c509dbe05216138e47b7add | Python | JishanaJ/My-projects | /Edyoda Final assessment/Quiz.py | UTF-8 | 8,478 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#-super user
#- - sign up
# - login
#- - - Quiz
#- - - - Create quiz
#- - - - - Difficulty level
# - - - - Topic
#- - - - Read quiz
#- - - - Add User
#- - - - Update quiz
#- - - - Delete quiz
#-user
#- - login
#- - - Take Quiz
#- - - view topics
## final score and rig... | true |
4c95d7a03d828370c300afeaa7af8293b020fd71 | Python | naveen882/mysample-programs | /metaclass.py | UTF-8 | 6,511 | 4.3125 | 4 | [] | no_license | """
Metaclass
http://eli.thegreenplace.net/2011/08/14/python-metaclasses-by-example
A metaclass is defined as "the class of a class". Any class whose instances are themselves classes, is a metaclass. So, according to what we've seen above, this makes type a metaclass - in fact, the most commonly used metaclass in Pyth... | true |
f5699fd4c709c65669f321260b0747742ff3c283 | Python | saranshmanu/Flask-Authentication-API | /examples/PyCrypto Encryption Decryption.py | UTF-8 | 1,650 | 3.328125 | 3 | [] | no_license | # ---------------------------------------- DES and DES3 ----------------------------------------
from Crypto.Cipher import DES, DES3
from Crypto import Random
iv = Random.get_random_bytes(8)
ENCRYPTION_STANDARD = DES
# The size of the key is limited to have a size of 8 characters because of DES algorithm
ENCRYPTION_DE... | true |
d698a064a2ef9f430023599dd7b0f2999124eb2c | Python | blackfeather-wang/Dynamic-Vision-Transformer-MindSpore | /utils/logging.py | UTF-8 | 2,282 | 2.546875 | 3 | [] | no_license | """Some logging utilities."""
# pylint: disable = logging-fstring-interpolation
import logging
import os
import sys
try:
import moxing as mox
MODEL_ARTS = True
except ImportError:
MODEL_ARTS = False
LOGGER_NAME = 'mindspore-benchmark'
class LOGGER(logging.Logger):
"""Logger nheritor with additional... | true |
5c81120c5c4ce59621d1dd1e672cc211193e61b7 | Python | maci2233/Competitive_programming | /CodeForces/A/580a.py | UTF-8 | 242 | 3.40625 | 3 | [] | no_license | n = int(input())
numbers = [int(i) for i in input().split()]
res = 1
total = 1
for i in range(n-1):
if numbers[i+1] >= numbers[i]:
res+=1
if total < res:
total = res
else:
res = 1
print(str(total))
| true |
68f8d743de340e4f20db1b3811a0c558798b9b90 | Python | necall/feature-engineering | /classify.py | UTF-8 | 5,296 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
from collections import defaultdict
from csv import DictReader, DictWriter
import nltk
import codecs
import sys
import copy
from nltk.corpus import wordnet as wn
from nltk.tokenize import TreebankWordTokenizer
kTOKENIZER = TreebankWordTokenizer()
def morphy_stem(word):
"""
Simple stemm... | true |
8c6e210c35cf83ae666da386746349bada75029b | Python | JoneNash/improve_code | /JianZhi/14.py | UTF-8 | 668 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: leidelong
@contact: leidl8907@gmail.com
@time: 2019/2/6 16:31
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def FindKthToTail(self, head, k):
# write code here
arrs = []
... | true |
2084876c4c18e8d33ea66f6ee3383bf175f486bd | Python | Ilya37/StudyHSE | /module1/hw4.py | UTF-8 | 48 | 3.03125 | 3 | [] | no_license | n = int(input())
s = int(input())
print(s % n)
| true |
06c4a2d3f2ef51a0622be10cdb71ab88161d379b | Python | mii012345/team-bot | /radb.py | UTF-8 | 2,123 | 2.765625 | 3 | [] | no_license | import random
import math
class Radb:
def __init__(self):
self.voice_member = []
self.battle_member = []
self.ready_mes = None
self.red_team = []
self.white_team = []
def get_voice_member(self, ctx):
"""ボイスチャンネルに接続しているメンバーを取得
"""
auth = ctx.autho... | true |
cfc5ef8b5276fd8cc9fb2d15e5cac65449070b04 | Python | patpij2/Logia-Competition-All-Solutions | /logia 17/2/kolittt.py | UTF-8 | 424 | 2.75 | 3 | [] | no_license | def kolit(slowo):
licznik = 0
while len(slowo) > 0:
napis = ''
i = 0
krok = 1
while i < len(slowo):
napis += slowo[i]
slowo = slowo[:i] + '0' + slowo[i+1:]
i += krok
krok += 1
slowo = slowo.replace('0','')
if napis... | true |