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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a9ed423e9c5764389b6b01030d56212aff28f32f | Python | shangeth/Facial-Emotion-Recognition-PyTorch-ONNX | /PyTorch/FER_image.py | UTF-8 | 1,931 | 2.59375 | 3 | [] | no_license | import cv2
import torch
import torchvision.transforms as transforms
from PIL import Image
import matplotlib.pyplot as plt
import argparse
import os
from model import *
def load_trained_model(model_path):
model = Face_Emotion_CNN()
model.load_state_dict(torch.load(model_path, map_location=lambda storage, loc: ... | true |
7bb5b2eb3ec8b300f3adc69c5e2756e7d9955886 | Python | jrefusta/LP-FIB-QuizBot | /bot/bot.py | UTF-8 | 8,110 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import telegram
from telegram import ParseMode
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import networkx as nx
import matplotlib.pyplot as plt
import os
import pickle
def start(bot, update):
bot.send_message(chat_id=update.message.chat_id, tex... | true |
c5982356cac32ea27d239f0438258f57c4b40f2d | Python | omizu-12/AtCorder | /ABC158/B.py | UTF-8 | 122 | 2.96875 | 3 | [] | no_license | N,A,B = list(map(int,input().split()))
C = A+B
D = int(N/C)
E = A*D
F = N%C
if F>A:
print(E+A)
else:
print(E+F)
| true |
53a2649e6ca6f660f4cf84e9296c72595146be0f | Python | ucefizi/KattisPython | /conundrum.py | UTF-8 | 210 | 3.265625 | 3 | [] | no_license | # Problem statement: https://open.kattis.com/problems/conundrum
s = input()
x = 0
for i, v in enumerate(s):
if (v != 'P' and i%3 == 0) or (v != 'E' and i%3 == 1) or (v != 'R' and i%3 == 2):
x += 1
print(x)
| true |
9028b9c75b99dc00b8a8f509aa88519061f8d0f6 | Python | sarguhl/Exyls-Bot-LOL | /lib/cogs/warn.py | UTF-8 | 2,195 | 2.75 | 3 | [] | no_license | import discord
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
import json
with open('./data/db/reports.json', "r", encoding='utf-8') as f:
try:
report = json.load(f)
except ValueError:
report = {}
report['users'] = []
class Warn(co... | true |
ee13bce52a2340fa65efdab7fd811c4df37b99b7 | Python | ZarmeenLakhani/Python-Documentation | /Lists.py | UTF-8 | 1,365 | 4.3125 | 4 | [] | no_license | x=1
print(str(x))
print(float(x))
bool(0) #only 0 is considered as false rest of the integers are considered true.even the negative ones
#sometimes a specific data type is required
fruit = 'banana'
len(fruit)
digits=[11,0,1,2,3,9,5,4,6,18]
digits.sort()
print(digits[-len(digits)])
print(digits[-1]) # last element
print... | true |
73710ac828b09153c6ae26ee96fa31c9c59faabe | Python | gilsontm/linguagens-formais | /source/utils/messages.py | UTF-8 | 514 | 2.859375 | 3 | [] | no_license | INVALID_AUTOMATA = "Autômato inválido."
INVALID_GRAMMAR = "Gramática inválida."
INVALID_REGEX = "Expressão regular inválida."
INVALID_FIRST_OPERAND = "Operando 1 inválido."
INVALID_SECOND_OPERAND = "Operando 2 inválido."
GRAMMAR_NOT_REGULAR = "A gramática não é regular."
GRAMMAR_NOT_CONTEXT_FREE = "A gramática não é ... | true |
0735b9cf80a69eb310b65ad0e07fae2b21bd67c9 | Python | dongqing7/herb_pairs_netowrk_v4 | /herb_distance_generation.py | UTF-8 | 4,809 | 2.65625 | 3 | [] | no_license |
from proximity_key import *
from collections import defaultdict
class Herb_Distance:
def __init__(self, G_obj, Ingredients_obj, Herb_obj):
self.G_ogj = G_obj
self.G = self.G_ogj.g
self.Ingredients = Ingredients_obj
self.Ingredients.ingredients_target_dict(list(self.G_ogj.G.nodes))
... | true |
2fb022755844502687c00443db5736ea00236c8d | Python | alekospj/GoogleForecast | /src/sc_1_forecast.py | UTF-8 | 6,900 | 2.796875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import warnings
import time
from datetime import datetime
from datetime import date
from statsmodels.tsa.statespace.sarimax import SARIMAX
from statsmodels.tsa.stattools import adfuller
from pmdarima import auto_arima
import statsmodels.api as sm
import plotly.graph_objects as go
import plotly.e... | true |
82b228035724e542ba0073471b0399428482e944 | Python | Dikzamen/task_nerdysoft | /main.py | UTF-8 | 4,865 | 3.1875 | 3 | [] | no_license | import json
import tkinter as tk
from tkinter.ttk import Button, Entry, Label
from tkinter.filedialog import askopenfilename
from tkinter import LEFT, RIGHT
def contains(word, letters):
word_dict = {i: word.count(i) for i in set(word)}
letters_dict = {i: letters.count(i) for i in set(letters)}
for key, va... | true |
5b7537e7f66c92550bc06dcf8d285c09ed6b991c | Python | almazkun/the_hard_way | /Python_3/ex21.py | UTF-8 | 763 | 4.46875 | 4 | [] | no_license | def add(a, b):
print("Adding {} + {}".format(a, b))
return a + b
def subtrackt(a, b):
print("Subtrackting {} - {}".format(a, b))
return a - b
def multiply(a, b):
print("Multyplying {} * {}".format(a, b))
return a * b
def divide(a, b):
print("Dividing {} / {}".format(a, b))
return a... | true |
7e8527474dec9c9f8681f721695d6ed29d5b5c57 | Python | chudacontreras/python_basico_platzi | /poo/dados/dados.py | UTF-8 | 2,450 | 4.21875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
""" Este programa es un juego de azar en el que se lanza un dado y si el valor no es ni 1 ni 6 se pierde.
Para esto creamos la clase Dice con los atributos de un dado su valor y su cantidad de lados así como su comportamiento
como lo es el lanzarlo o girarlo para que obtengamos un valor al azar... | true |
dc4bfd269dcbfbb123af73e2090922ea43380fca | Python | ZSX-JOJO/crawler_html2pdf | /webargstest.py | UTF-8 | 1,709 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import re
from flask import Flask, jsonify, request
from webargs import fields
from webargs.flaskparser import use_args
app = Flask("hello")
@app.route("/api/login", methods=["POST"])
@use_args({"username": fields.Str(required=True)},
location="json")
def login(args):
name = args['username']
passw... | true |
cb3f54d6c871e64d07cb26f2bf56bc0c50717db4 | Python | jlp1701/fbHash | /tests/test_fbHashB.py | UTF-8 | 2,176 | 2.578125 | 3 | [] | no_license | import pytest
from fbHash import fbHashB
def read_file(file_path):
with open(file_path, "rb") as f:
return f.read()
def test_test():
assert True == True
def test_document_weights():
files = ["./tests/files/testfile_1.txt", "./tests/files/testfile_2.txt", "./tests/files/testfile_3.txt", "./test... | true |
61fa05eed59ece280c59e171e44788f0ea627e68 | Python | amarusyak/Telegram-Bot | /api_client/client.py | UTF-8 | 1,995 | 2.640625 | 3 | [] | no_license | import requests
import config
import curlify
from logger.logger import Logger
requests.packages.urllib3.disable_warnings()
class Client:
def __init__(self):
self._session = requests.Session()
######################
# Basic HTTP methods #
######################
def get(self, url, headers... | true |
0f6c10384d250f57a1ae090fcc763820e496f6f0 | Python | grantozz/flower_cnn | /src/splitdata.py | UTF-8 | 1,732 | 3.203125 | 3 | [] | no_license | """### Split data into test and train sets"""
import os
import shutil
import sys
import tarfile
import wget
from config import archive
#given a data set of sub dirs of images copy 20% of files to a
# new dir preserving dir structure
numfiles=0
numclasses=0
def split(src,dest_dir):
src_files = os.listdir(src)
... | true |
eeabb7a700fdc6678c4954d42b36b62165cdbfe4 | Python | AIHackerTest/RachyJ_Py101-004 | /Chap1/project/ex42.py | UTF-8 | 1,816 | 4.40625 | 4 | [] | no_license | ## Animal is-a object, a base class
class Animal(object):
## a placeholder when a statement is required syntactically, but no code needs to be executed
pass
## Dog is a class, inherit Animal
class Dog(Animal):
def __init__(self, name):
## dog has a name
self.name = name
print("The d... | true |
353b5ddfe89e88188b54b5a97b24c41edbb4c7db | Python | bergercookie/pymendeley | /lmendeley/__init__.py | UTF-8 | 1,406 | 2.765625 | 3 | [] | no_license | """Access document data in the Mendeley sqlite3 database.
.. note:: Currently looks in fixed paths on Linux. Changing
EXPECTED_MENDELEY_SQLITE_DIR and EXPECTED_MENDELEY_CONFIG_PATH
should allow it to work on non-linux or non-standard
installs.
"""
import os
from configparser import Conf... | true |
c0f71ba30d1aee3e797c4c4f57407798c5839235 | Python | LidiaDomingos/Samurai-Andrew-Desagil | /src/game_screen.py | UTF-8 | 4,201 | 2.75 | 3 | [
"MIT"
] | permissive | from os.path import join
from random import randint
import pygame
from pygame import image
from pygame.sprite import Group
from pygame.mixer import Sound
from pygame.time import delay
from config import *
from Character_assets import Character_assets
from Player import Player
from Fruit import Fruit
from Cursor impor... | true |
3a7dce6b6744ab0507ae789edf19112c79b52502 | Python | ChibaniMohamed/fake_faces_DCGAN | /dcgan_model.py | UTF-8 | 3,582 | 2.65625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import os
from PIL import Image
from keras.models import Sequential,Model
from keras.layers import Conv2D,Conv2DTranspose,LeakyReLU,Dropout,Dense,UpSampling2D,Flatten,Reshape,Input
from keras.initializers import RandomNormal
from keras.optimizers import Adam
PATH = './... | true |
a878b079c46405c86305441b5aef3b167d9ef92b | Python | TrevorQuan/C2-Data-Types | /main.py | UTF-8 | 117 | 2.90625 | 3 | [] | no_license | firstName = "Trevor" # String
age = "12" #String
favNumber = 37 #Integer
favChar = 'T' #char
isHungry = True #boolean | true |
3508cf6bd5f9209939e2f48af576a6adb2a12a52 | Python | Zulko/moviepy | /moviepy/video/fx/loop.py | UTF-8 | 750 | 3.078125 | 3 | [
"MIT"
] | permissive | from moviepy.decorators import requires_duration
@requires_duration
def loop(clip, n=None, duration=None):
"""
Returns a clip that plays the current clip in an infinite loop.
Ideal for clips coming from GIFs.
Parameters
----------
n
Number of times the clip should be played. If `None` ... | true |
d49c03a009a1bffc88273c17230453a1ee7ecd01 | Python | AtulSinghTR/AtulSinghTR | /exercism-py/python/raindrops/raindrops.py | UTF-8 | 261 | 3.171875 | 3 | [] | no_license | def convert(number):
sound=''
if number%3==0:
sound='Pling'
if number%5==0:
sound=sound+'Plang'
if number%7==0:
sound=sound+'Plong'
if len(sound)==0:
sound=str(number)
return sound
| true |
ef08e227d2d7a34ac0a32f37309c709dc955fb73 | Python | saqibns/CodeVita | /Practice/brackets.py | UTF-8 | 812 | 3.296875 | 3 | [] | no_license | def main():
for i in range(10):
print('Test', str(i + 1) + ':')
length = input()
expression = list(input())
operations = int(input())
for j in range(operations):
operation = int(input())
if operation == 0:
check(expression)
... | true |
7c87fd279338bf1da8418400f9eae4d66605e239 | Python | Aasthaengg/IBMdataset | /Python_codes/p02912/s689541834.py | UTF-8 | 311 | 2.53125 | 3 | [] | no_license | from heapq import heapify, heappop, heappush
N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
if N == 1:
print(N >> M)
exit()
heapify(A)
while M > 0:
a = -heappop(A)
while M > 0 and a >= -A[0]:
a >>= 1
M -= 1
heappush(A, -a)
print(-sum(A)) | true |
b1ed91e939019cc80cebc6a9b3526852dee9b753 | Python | rugbyprof/4883-Software-Tools | /Lectures/L03/main.py | UTF-8 | 447 | 2.796875 | 3 | [] | no_license | """
"""
import json
from rich import print
def processJson():
with open('dwarf_family_tree.json') as f:
data = json.load(f)
for person in data:
print(person)
def processCsv():
with open('dwarf_family_tree.csv') as f:
data = f.readlines()
for line in data:
... | true |
93583cc813edc5d71dc10f4d4a2917846a16d187 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/CJ_16_1/16_1_1_ManojRK_A.py | UTF-8 | 309 | 3.4375 | 3 | [] | no_license | for tc in range(1, int(input()) + 1):
s = input()
back = []
front = [s[0]]
for ch in s[1:]:
if ch >= front[-1]:
front.append(ch)
else:
back.append(ch)
print('Case #{}: '.format(tc), *(front[i] for i in range(len(front) - 1, -1, -1)), *back, sep='')
| true |
5e4a0037357e9860046a86d072a5870936e51b5a | Python | MH-Lee/Gobble-v.1 | /utils/processor_checker.py | UTF-8 | 302 | 3.328125 | 3 | [] | no_license | from time import time
def timeit(method):
"""decorator for timing processes"""
def timed(*args, **kwargs):
ts = time()
result = method(*args, **kwargs)
te = time()
print("Process took " + str(round(te-ts,2)) + " seconds")
return result
return timed
| true |
dcb332593d29075a047a07f6db71f05e344f2fe3 | Python | dirk0082/hello-world | /web_scraping_incognito.py | UTF-8 | 746 | 3 | 3 | [] | no_license | import bs4
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
my_url = 'https://thegolfnewsnet.com/golfnewsnetteam/2020/02/09/2020-att-pebble-beach-pro-am-money-purse-winners-share-prize-money-payout-118206/'
#opening up connection, grabbing page
uClient = uReq(my_url)
#offloads content i... | true |
cf67833290880d8504992037ecfb730c641d5759 | Python | zeeshanahmad10809/sst-deep-tensorflow | /sst/utils.py | UTF-8 | 1,338 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
from loguru import logger
from tqdm import tqdm
import os
def get_binary_label(sentiment):
if sentiment <= 1:
return 0
else:
return 1
def loadFastTextModel(path=""):
logger.info("Loading FastText Model!")
embeddings_index = dict()
try:
with open(path, ... | true |
ebca102afbfd43ab1faef5aeaef2b6a203a31856 | Python | flocknroll/text2fb | /text2fb.py | UTF-8 | 1,684 | 2.875 | 3 | [] | no_license | import numpy as np
from datetime import datetime
from PIL import Image, ImageDraw, ImageColor, ImageFont
sRes = (120, 80)
oRes = (480, 320)
def px24_to_16(r, g, b):
r >>= 3
g >>= 2
b >>= 3
return ((r << 11) + (g << 5) + b).to_bytes(2, "little")
def rgb24_to_rgb16(bmp):
bBuffer = memoryview(bmp.t... | true |
c671a49ef7ccb5bf6beb4e8d747e59021135dd11 | Python | honoraip/brick_breaking | /breakout.py | UTF-8 | 11,107 | 3.515625 | 4 | [] | no_license | # breakout.py
# Honora Ip, hi52
# December 12, 2014
"""Primary module for Breakout application
This module contains the App controller class for the Breakout application.
There should not be any need for additional classes in this module.
If you need more classes, 99% of the time they belong in either the gameplay
mod... | true |
8af625aba36e0452ed02c3f9d9ee0aeb36ebc127 | Python | udapy/Hashing-1 | /isIsomorphic2Hash.py | UTF-8 | 897 | 3.609375 | 4 | [] | no_license |
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
"""
We are optimizing rathar than iterating over values of hashmap
Which will reduce our value search space O(n).
Double hash mapping, storing reverse mapping into other hash map to keep track they bisected.
... | true |
252f9e39e06ecf7989b4822bd02625595b71ccd9 | Python | badr1002/M_R_Task | /app.py | UTF-8 | 2,951 | 2.5625 | 3 | [] | no_license | from os import error
from threading import ThreadError
from flask import Flask, request, jsonify
from flask_mongoengine import MongoEngine
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
app.config['MONGODB_SETTINGS'] = {
'db': 'test',
'host': 'localhost',
'port': 27017
}
db = MongoEngine()
d... | true |
901f36828202d565a154a94d57bb6254cf670dbb | Python | OntonYakut/python | /mysock.py | UTF-8 | 273 | 2.578125 | 3 | [] | no_license | import socket
mysock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
mysock.connect(('www.py4inf.com',80))
mysock.send('GET http://www.py4inf.com/code/romeo.txt HTTP/1.0\n\n')
while True:
data=mysock.recv(512)
if( len(data) < 1 ) :
break
print data
mysock.close() | true |
2a089c343481f6862543ddc6ce7e7dd7c44a0ad4 | Python | fedorpashin/physics | /physics/boundary_conditions/third_type_boundary_condition.py | UTF-8 | 579 | 2.546875 | 3 | [
"MIT"
] | permissive | from physics.boundary_conditions.boundary_condition import BoundaryCondition
from dataclasses import dataclass
from final_class import final
from overrides import overrides
__all__ = ['ThirdTypeBoundaryCondition']
@final
@dataclass
class ThirdTypeBoundaryCondition(BoundaryCondition):
__ν: float
__κ: float
... | true |
4d5dc2e7ed3d46e3aa46d1d58a52c7ed45a499fc | Python | zgrzebnickij/test_automation | /src/tic_tac_toe/database.py | UTF-8 | 798 | 3 | 3 | [] | no_license | # tic_tac_toe/database.py
from sqlalchemy import Table, Column, Integer, String, MetaData, select
from .utilities import tic_tac_toe_winner
metadata = MetaData()
history = Table(
'history',
metadata,
Column('game_id', Integer, nullable=False),
Column('move_id', Integer, primary_key=True),
Column(... | true |
e87a79a8126118ae26f7a60c8bb1dd703b6c3164 | Python | nicolasque/mi-primer-programa | /wile.py | UTF-8 | 236 | 3.359375 | 3 | [] | no_license | numero_inicia = 2000000
while numero_inicia > 0:
print(numero_inicia)
if numero_inicia % 2 == 0:
print("este numero es par")
else:
print("este numero es inpar")
numero_inicia -= 1
print("he terminado")
| true |
1c659173823e601f8d56a2fc552535f385c2f252 | Python | juangamella/stars | /docs/stars_example.py | UTF-8 | 587 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import stars
# Define a dummy estimator (returns the same estimate for all subsamples)
def estimator(subsamples, lmbda):
p = subsamples.shape[2]
A = np.triu(np.random.uniform(size=(p,p)), k=1)
A += A.T
A = A > 0.5
return np.array([A] * len(subsamples))
# Generate data from a nei... | true |
48fb645c564d0e83d59230d2ec2b9695ee475de2 | Python | vivekmids/nlp-summarization | /beam_search.py | UTF-8 | 2,700 | 3 | 3 | [] | no_license | def get_top_beam_search_sentences(input_seq, beam=3):
# Encode the input as state vectors.
e_out, e_h, e_c = encoder_model.predict(input_seq)
top_sentences = {}
def top_tokens(last_token, out, h, c):
output_tokens, h_new, c_new = decoder_model.predict([[last_token]] + [out, h, c])
... | true |
d9243622b6e0647168ca582039e6ad80d67e56a0 | Python | lev2cu/python_test | /pandas/test/movie.py | UTF-8 | 847 | 2.796875 | 3 | [] | no_license |
import numpy as np
from pandas import Series, DataFrame
import pandas as pd
path ='/Applications/XAMPP/xamppfiles/htdocs/IMDB/IMDBMovie.txt'
MOVIE_n = ['id', 'name', 'year', 'rank']
idn,rank,year,name = [],[], [], []
with open(path) as f:
for i, line in enumerate(f): ... | true |
a7636870574dfe60e58f13ae031e74543cf1fb30 | Python | Rakalute/Atcoder | /ARC121/A.py | UTF-8 | 2,437 | 3.125 | 3 | [] | no_license | def main():
N = int(input())
X = []
Y = []
ans = 0
# Z = []
for i in range(N):
x, y = map(int, input().split())
X.append([x, i]), Y.append([y, i])
X_sort = sorted(X, reverse = True, key=lambda x: x[0])
Y_sort = sorted(Y, reverse = True, key=lambda x: x[0])
X_max... | true |
ef74fc7c414e1f1d7a0ef4f2803847b8643e0f84 | Python | Coby-chan/AID1906 | /7.24homework.py | UTF-8 | 689 | 3.796875 | 4 | [] | no_license | """
给出两个有序的链表L1,L2 .
在不创建新的链表的基础上将两个链表合并为一个
要求合并后的链表仍为有序
"""
from day01.linklist import *
L1 = LinkList()
L2 = LinkList()
L1.init_list([1,5,7,8,10,12,13,19])
L2.init_list([0,3,4,8,14,21,22])
L1.show()
print("=========================")
L2.show()
def merge(L1,L2):
p = L1.head
q = L2... | true |
29052ecbb3a0529315627e947a2f64f35571eae6 | Python | TimVanDyke/Computer-Vision | /load.py | UTF-8 | 1,161 | 2.6875 | 3 | [] | no_license | import numpy as np
import gzip
def load_data(dataset):
def load_images(filename):
with gzip.open(filename, 'rb') as f:
data = np.frombuffer(f.read(), np.uint8, offset=16)
# The inputs are vectors now, we reshape them to monochrome 2D images,
data = data.reshape(-1, 1, 28, 28)
... | true |
9b60278886cfdae240762b9491401067f57d43a7 | Python | gorgonun/rpg_dso1 | /playerDao.py | UTF-8 | 1,178 | 2.875 | 3 | [] | no_license | from dao import Dao
class PlayerDao(Dao):
def __init__(self, datasource="players.pickle"):
super().__init__(datasource)
def get_all(self):
return [x for x in self.object_cache.values()]
def get_dict(self):
return self.object_cache
def get(self, name):
player = self.... | true |
a7e19e4b5efcec43ae432799d052069ad1ed186d | Python | rohun-kulkarni/gastronomy | /manipulation/azure_kinect_calibration/utils/prepare_multi_dir_calibration_data.py | UTF-8 | 2,464 | 2.609375 | 3 | [] | no_license | import numpy as np
import os
import shutil
def main(path_list, dest_path):
img_count = 1
main_dest_dir = os.path.join(dest_path, 'main')
secondary_dest_dir = os.path.join(dest_path, 'secondary')
for p in [main_dest_dir, secondary_dest_dir]:
if not os.path.exists(p):
os.makedirs(p)... | true |
bec5840fd27bbc271c6a2420fd2448b315bd519c | Python | farukara/Project-Euler-problems | /files/041 - pandigital prime.py | UTF-8 | 1,478 | 4.03125 | 4 | [
"MIT"
] | permissive | #!python3
# coding: utf-8
# We shall say that an *n*-digit number is pandigital if it makes use of all the digits 1 to *n* exactly once. For example, 2143 is a 4-digit pandigital and is also prime.
# What is the largest *n*-digit pandigital prime that exists?
#https://projecteuler.net/problem=30
from time import perf_... | true |
a2a8208867f30526888067e9bed260a46d25407d | Python | realshovanshah/restura-virtual-assistant | /restura_assistant.py | UTF-8 | 1,631 | 2.84375 | 3 | [] | no_license | import io, random
from gtts import gTTS
#requies ffmeg
from pydub import AudioSegment
from pydub.playback import play
import speech_recognition as sr
from restura_api import ResturaApi
from helper import toStr
class ResturaAssistant:
all_items = ResturaApi.items
top_items = random.sample(all_items, k=4)... | true |
c9278fc416bb1aee53f89b8a296d5dccfd3768ec | Python | Qingchuan-Ma/Photo_Editor | /functions/skin.py | UTF-8 | 1,035 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 27 16:38:07 2019
@author: qingchuan-ma
"""
import numpy as np
import cv2
def beauty_face(img, degree = 5, detail = 1):
if degree >= 1:
dst = np.zeros_like(img)
#int value1 = 3, value2 = 1; 磨皮程度与细节程度的确定
valu... | true |
36d95ce3801f6eee31a7236610da4163ca9288fd | Python | yzl232/code_training | /mianJing111111/Google/interleave iterator of iterators_join iterator of iterators.py | UTF-8 | 2,547 | 3.84375 | 4 | [] | no_license | # encoding=utf-8
#超高频的一道题目了
'''
问的是和java里的iterator有关的问题:
假设有n (下面的例子n=3)个lists:
l1: a1 a2 a3 a4 a5 ...
l2: b1 b2 b3 b4...
l3: c1 c2 ....
要求交替输出:a1 b1 c1 a2 b2 c2....
给的输入是Iterator<Iterator<T>>,要实现一个
class InterleavingIterator<T>
刚开始脑子一团浆糊,太紧张了,过了有好几分钟才想清楚怎么写,(想的过程中漂亮的面试官还问我哪里卡住了,超级nice的),然后就写完了,然后面试官 说你要怎样测试你的code哇? ... | true |
7acfcc3c23320b749fae6f90b66e09631e7d9f1f | Python | mdhvkothari/Python-Program | /hackerrank/co.py | UTF-8 | 570 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 18 17:19:49 2018
@author: Madhav
"""
for _ in range (input()):
c=input()
main=0
maxnum=1
for x in range (1,c+1):
temp=0
T=x
while True :
if x%2 ==0 :
x=x/2
else :
x=3*x+1
... | true |
11e2ca45808c9571f3fe3dca8d1ffb87d6195087 | Python | mrunalruikar/PythonFundamentals | /ex3.py | UTF-8 | 449 | 4.09375 | 4 | [] | no_license | print "I will now count my chickens:"
print "Hens", 25 + 30 /6
print "Roosters", 100 - 25 * 3 % 4
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
print "Is it true that 3 + 2 < 5 - 7 ?"
print 3 + 2 < 5 - 7
print "What is 3 + 2 ?", 3 + 2
print "What is 5 - 7 ?", 5 - 7
print "Oh that's why it is False. "
print "How abou... | true |
231581a0d55b46015b1d68d08c5b695396bce852 | Python | cseharshit/Python_Practice_Beginner | /55.Selection_Sort.py | UTF-8 | 297 | 3.65625 | 4 | [
"MIT"
] | permissive | from random import randint
x=int(input("Enter number of elements: "))
arr=[randint(1,100) for i in range(x)]
print(arr)
j=x-1
while j!=0:
k=0
for i in range(1,j+1):
if arr[i] > arr[k]:
k=i
# Swap the values
arr[k],arr[j]=arr[j],arr[k]
j-=1
print(arr) | true |
6bf694170d25bdab3232c85913591c8235e855bb | Python | Puckery-fc/tests | /验证码/Login.py | UTF-8 | 2,645 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# File : Login.py
# Date : 2019/4/28
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import time,os,unittest
class JD(unittest.TestCase):
def setUp(self):
self.driver = webdriver.... | true |
d0ff1020d4ebda8909bc3d1f10837b17091a0c9f | Python | chenchuangc/algorithm | /03.mythink_/09.code_python02/03.all_search_/08_how_to_iterator_/08_01_hannuo_tower.py | UTF-8 | 1,381 | 3.765625 | 4 | [] | no_license | # !/bin/python
# -*- encoding:UTF-8 -*-
# 有三根杆子A,B,C。A杆上有 N 个 (N>1) 穿孔圆盘,盘的尺寸由下到上依次变小。要求按下列规则将所有圆盘移至 C 杆:
# 每次只能移动一个圆盘;
# 大盘不能叠在小盘上面。
# 提示:可将圆盘临时置于 B 杆,也可将从 A 杆移出的圆盘重新移回 A 杆,但都必须遵循上述两条规则。
# 问:如何移?最少要移动多少次?
# 这个是经典的汉诺塔问题,我们可以使用递推的方式进行 假如能够完成f(n)到b上,那就一定能够完成f(n+1)到c上面,
# 因为,完成了f(n),只需要将第n+1个移动到c,后面的问题就等于f(n)了
# 递归的的主体... | true |
66d55404659adaad9681eb1b07ffe67453f9de7a | Python | aascode/emotion | /scripts/training/train_multiple.py | UTF-8 | 3,416 | 2.6875 | 3 | [
"MIT"
] | permissive | import argparse
import pickle
from pathlib import Path
import numpy as np
from emotion_recognition.classification import PrecomputedSVC
from emotion_recognition.dataset import CombinedDataset, NetCDFDataset
from sklearn.metrics import (average_precision_score, f1_score, get_scorer,
make_sc... | true |
f0229d3524ad8a562caf5676335f117ae07c8515 | Python | zhtea/codejam | /2008/milkshakes/solve.py | UTF-8 | 999 | 2.59375 | 3 | [] | no_license | #coding=utf-8
import sys
N = int(sys.stdin.readline().strip())
for i in range(1,N+1):
flavor = int(sys.stdin.readline().strip())
customer = int(sys.stdin.readline().strip())
flavors = [0]*flavor
r = True
j = 0
while j < customer:
l = [int(i) for i in sys.stdin.readline(... | true |
697e3b0452c5f3ed28f72e14126e8e92cd7b3aa3 | Python | chrillux/brottsplatskartan | /brottsplatskartan/__init__.py | UTF-8 | 4,775 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | # coding=utf-8
""" Brottsplatskartan API """
import datetime
import time
from json.decoder import JSONDecodeError
from typing import Union
import requests
AREAS = [
"Blekinge län", "Dalarnas län", "Gotlands län", "Gävleborgs län",
"Hallands län", "Jämtlands län", "Jönköpings län", "Kalmar län",
"Kronober... | true |
ddcf30bfbe7ad8eeff0aea1c41a812526b694b02 | Python | Rockyzsu/StudyRepo | /python/my_py_notes_万物皆对象/modules_python常用模块/cmath/cmath_test.py | UTF-8 | 262 | 3.28125 | 3 | [] | no_license | # coding = utf-8
__author__ = 'super_fazai'
# @Time : 17-7-26 下午2:22
# @File : cmath_test.py
import cmath
print(cmath.exp(2)) # return the exponential value e**x
print(cmath.sqrt(4)) # 开方
print(cmath.asin(0.5))
print('%.20f' % cmath.pi) | true |
ccc6ebc7713b5456ddce86b8dc2933ecbc973bcf | Python | AngelBachler/Proyecto-Algebra | /vec.py | UTF-8 | 3,579 | 3 | 3 | [] | no_license | # Copyright 2013 Philip N. Klein
def getitem(v,k):
assert k in v.D
if k in v.f.keys():
return v.f[k]
else:
return 0
#pass
def setitem(v,k,val):
assert k in v.D
v.f[k] = val
#pass
def equal(u,v):
assert u.D == v.D
for x in u.D:
if getitem(u, x) != getitem(v, ... | true |
6ae5d2ccaafae70148ab565df6efe5b10efaa01b | Python | liwit101/HHU_ProjetcSeminar_5.Semester | /p2_will/dataHander.py | UTF-8 | 551 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 23 22:41:36 2013
@author: yuankunluo
"""
def dataBreaker(dataList):
times = []
hashtags = []
words = []
clients = []
for data in dataList:
time = data[0]
word = data[2].split(" ")
client = data[3]
hashtag = data[5].spli... | true |
269d04dedd1c7018cd9418c6d8043852658b6abd | Python | nishio/atcoder | /abc177/b.py | UTF-8 | 1,313 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def debug(*x):
print(*x, file=sys.stderr)
def solve(S, T):
buf = []
for i in range(len(S) - len(T) + 1):
diff = 0
for j in range(len(T)):
if S[i + ... | true |
08587957415c6be4390cc06853f6ca994a793671 | Python | boschma2702/ContainerStacking | /main/model/dataclass/terminal.py | UTF-8 | 4,254 | 2.671875 | 3 | [] | no_license | from __future__ import annotations
from dataclasses import dataclass
from typing import Tuple, List, Optional
from main.model.dataclass import tuple_long_replace, StackLocation, Container, StackTierLocation
from main.model.dataclass.block import Block
from main.model.dataclass.stack import Stack
@dataclass(order=Tr... | true |
dfb92bb2387cb118db115e441e1cc067848a04ef | Python | jsleep/cs231n-2017 | /assignment1/cs231n/classifiers/linear_svm.py | UTF-8 | 2,826 | 3.625 | 4 | [] | no_license | import numpy as np
from random import shuffle
from past.builtins import xrange
def svm_loss_naive(W, X, y, reg):
"""
Structured SVM loss function, naive implementation (with loops).
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of sh... | true |
a0bdac4ac528e3f2f77b100a810daddae799a674 | Python | yoshichulo/RubikSolver | /rubiktools.py | UTF-8 | 2,770 | 3.453125 | 3 | [] | no_license | from PIL import Image, ImageDraw
colors = {
0: '#FF0000', # RED
1: '#0000FF', # BLUE
2: '#FFFF00', # YELLOW
3: '#008000', # GREEN
4: '#FF8C00', # ORANGE
5: '#FFFFFF' # WHITE
}
def show_cube(cube):
''' This function shows the actual state of all the Cube faces '''
... | true |
4767476fe56215c49e1f4b4b7055640ee3aa7860 | Python | westgate458/LeetCode | /P0593.py | UTF-8 | 512 | 2.90625 | 3 | [] | no_license | class Solution(object):
def validSquare(self, p1, p2, p3, p4):
"""
:type p1: List[int]
:type p2: List[int]
:type p3: List[int]
:type p4: List[int]
:rtype: bool
"""
# check distances between corners
def l(p1, p2): return (p1[1] - p2[1])**2 + (... | true |
c6739fec30f14af855849b1f09cce60e259a536a | Python | messah/Workspace | /python/Lab çalışmaları/lab2 calısma/soru5.py | ISO-8859-9 | 219 | 2.765625 | 3 | [] | no_license | uzun=input("uzun kenar gir:")
ksa=input("ksa kenar gir:")
pi=3.14
dairealan=(pi*ksa*ksa)/4.0-(ksa**2/2.0)
dikdrtgenalan=ksa*uzun
print "toplam alan=",dairealan+dikdrtgenalan,"dr."
| true |
cd6881d8d17d212177b4031495bc73f8926c9160 | Python | mandar-degvekar/DataEngineeringGCP | /Utility.py | UTF-8 | 215 | 3.328125 | 3 | [] | no_license | class util:
def splitandlist(input):
l = []
for i in input:
try:
l.append(int(i))
except:
print(i + " is not a number")
return l | true |
6eb5cb0c208022350e4de33e4e9a311131f2b321 | Python | Auguste0904/CAESAR | /src/repeating_key_XOR.py | UTF-8 | 1,653 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
##
## EPITECH PROJECT, 2020
## B-SEC-500-PAR-5-1-caesar-lucas.moritel
## File description:
## repeating_key_XOR.py
##
import os
import sys
import codecs
def error_gestion_arg(argv):
if len(argv) != 2:
print("Error: Invalid number of arguments")
exit(84)
if os.path.isfil... | true |
7e2b0ecad14e730c1199acb78af78bcc815d485a | Python | Sketchjar/url-stacking | /cnn.py | UTF-8 | 2,913 | 2.734375 | 3 | [] | no_license | from tensorflow.keras.layers import Input, ELU, Embedding, BatchNormalization, Convolution1D, MaxPooling1D, concatenate, Dense, Dropout, Lambda
from tensorflow.keras.models import Model
from tensorflow.keras import regularizers
from tensorflow.keras import backend as K
class cnn(Model):
def __init__(self, max_len=... | true |
938243882f6413ea247a308bb8480c05df32ae0f | Python | CyricV/SumofSuffixes | /sos.py | UTF-8 | 1,346 | 3.21875 | 3 | [] | no_license |
def sos(arrayB,arrayC):
zeroest = arrayB[len(arrayB)-1]+arrayC[(len(arrayC)-1)]
for s in range(len(arrayB)):
for t in range(len(arrayC)):
newSum = sumArrays(arrayB[s:],arrayC[t:])
if isCloserToZero(newSum,zeroest):
zeroest = newSum
finalS = s
finalT = t
return [zeroest,finalS,finalT]
def ssos(... | true |
16c410001ef0083009f98ce8c4fbf30c2ee35075 | Python | DmitriiDes/automate_updating_catalog_information | /health_check.py | UTF-8 | 1,647 | 2.796875 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
import psutil
import emails
import socket
import time
from ipaddress import ip_address
def check_sys_health():
sys_health = {
"cpu_usage" : psutil.cpu_percent(1),
"available_disk_space" : psutil.disk_usage('/').free / psutil.disk_usage('/').total * 100,
... | true |
9f73207381b02cd90648d7dfa36bc54c1f0f96bd | Python | antonioml97/DAI-Desarrollo-de-Aplicaciones-para-Internet | /ejercicios/ejercicio1.py | UTF-8 | 615 | 3.875 | 4 | [] | no_license | import random
numero_a_adivinar=random.randint(1, 100)
print(numero_a_adivinar)
print("Estoy pensado un numero... Adivinalo esta entre 1 y 100")
numero_usuario=int(input());
for i in range(0,10):
if numero_a_adivinar == numero_usuario :
print("Lo has adivinado! Es " + str(numero_usuario) )
brea... | true |
783d1b885c6b091986f03371b0a37c8b520e2820 | Python | johnnoone/cooperate | /cooperate/concurrency.py | UTF-8 | 671 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | import math
__all__ = ['Concurrency']
class Concurrency:
def __init__(self, *, size=None, part=None):
if size and part:
raise ValueError('size and part are mutually exclusive')
self.size = size
self.part = part
def batch(self, collection):
if self.size:
... | true |
c334dae2dba5b099f8e2efaf687aa72aa11ad936 | Python | eshthakkar/coding_challenges | /sliding_window.py | UTF-8 | 1,278 | 3.265625 | 3 | [] | no_license | from queue import *
# make it for n seconds
class WebHits(object):
def __init__(self, n=300):
self.queue = Queue(maxsize=n - 1)
self.last_second = 0
self.sec_hits_count = 0
self.last_n-1th_hit_count = 0
def record_hit(self):
""" Record the hit for the corresponding tim... | true |
cf323ac3fa388a6f8e3a74146f06622b99f7dd96 | Python | margarita-v/PyChain | /3_consensus_and_mining/merkle_tree/another_solve_for_python2.py | UTF-8 | 1,495 | 3.125 | 3 | [] | no_license | # http://pythonfiddle.com/merkle-root-bitcoin/
import hashlib
# Hash pairs of items recursively until a single value is obtained
def merkle(hashList):
length = len(hashList)
if length == 1:
return hashList[0]
newHashList = []
# Process pairs. For odd length, the last is skipped
for i in ra... | true |
ae694b971b90d44ba6993731e747f4204c2d02e3 | Python | HarkerJC/python-extend | /package/class.py | UTF-8 | 1,070 | 3.65625 | 4 | [] | no_license | class People:
#base property
name=""
age=0
#private property other object can not visit
__weight=0
def __init__(self,name,age,weight):
self.name=name
self.age=age
self.__weight+weight
pass
#private function
def __run(self):
print("run")
class Pe... | true |
fc7c028c2e25f12f251b1aa86b9f7d9a8f3a4b48 | Python | nanfeng-dada/leetcode_note | /easy/203.removeElements.py | UTF-8 | 843 | 3.765625 | 4 | [
"MIT"
] | permissive | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
#注意cur与cur.next的区别,要删除节点一定要留有前驱
# 定义一个节点指向头结点,
class Solution:
def removeElements(self, head: ListNode, val: int) -> ListNode:
if not head:
return None
h = ListNo... | true |
3f973c4c886a750e007da7589f9e201e43d24da7 | Python | EDGSCOUT/domain_adapt_segm | /utils/metrics.py | UTF-8 | 1,658 | 2.75 | 3 | [
"MIT"
] | permissive | from collections import OrderedDict
import torch
import torch.nn as nn
def softIoU(out, target, e=1e-6):
sm = nn.Softmax(dim=1)
out = sm(out)
target = target.float()
out = out[:, 1, :, :]
num = (out * target).sum()
den = (out + target - out * target).sum() + e
iou = num / den
retu... | true |
fc138649a9302760ceda98eecaf87440e3f76552 | Python | pulkitgupta317/Python | /ConstructionOfATowerWithoutSorting.py | UTF-8 | 5,260 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 22:39:41 2020
@author: pulkit
"""
from os import path
# Constants
inputFile = 'inputPS3.txt'
outputFile = 'outputPS3.txt'
# Queue class for handling operations of a queue
class Queue:
def __init__(self):
self.queue = []
# append an element in the q... | true |
28f9342985caedf7bdabd0108c6f6d32bad536c5 | Python | yangshuqi/FoodAnalysis | /codes/get_volume_main.py | UTF-8 | 3,008 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 13:11:48 2018
@author: shuqi
"""
from segment_food import *
from calculate_volume import *
from get_food_region import *
from skimage import data, color, transform, feature, morphology
from skimage import io
def get_volume_main(filepath, plate_color, ref_len, shape... | true |
f9d653460e9a200a6fde061a065acc81d40b75a7 | Python | rjsvaljean/python-testing-tools | /ireton/tests/test_paramtrize.py | UTF-8 | 700 | 2.859375 | 3 | [
"MIT"
] | permissive | from ireton import parametrize
import unittest
class TestParametrize(unittest.TestCase):
def test_parametrized_test(self):
@parametrize([
(1, 2),
(2, 3),
(3, 4),
])
def run_test(x, y):
assert x + 1 == y
def test_failures(self ):
... | true |
42a46a03b2bbd2768964f703c755b1c2326177df | Python | cutejiejie/Algorithms | /查找排序/quick_sort.py | UTF-8 | 1,529 | 3.296875 | 3 | [] | no_license | import random
from cal_time import *
import copy
import sys
sys.setrecursionlimit(100000)
@cal_time
def bubble_sort(li):
for i in range(len(li) - 1): #第i趟
isexchange = False
for j in range(len(li) - i -1):
if li[j] > li[j+1]:
li[j], li[j+1] = li[j+1], li[j]
... | true |
c960eff2879c9b7daac82c40547942758bf6347e | Python | pewosas/DuongHieu-C4T6 | /turtle_intro.py | UTF-8 | 202 | 2.796875 | 3 | [] | no_license | from turtle import *
speed(0)
for i in range (500*500):
forward (100)
left (90)
forward (100)
left (90)
forward (100)
left (90)
forward (100)
left (119)
mainloop()
| true |
ed2fe1c8b05a30b0da4ef96e3545ff83de8b0946 | Python | abelatnvidia/IntroTF | /src/module_02/code01.py | UTF-8 | 386 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import os, tensorflow as tf
# create a constant in default graph
a = tf.constant(10)
with tf.Session() as sess:
# create tensorboard log files
sfw = tf.summary.FileWriter(os.getcwd(), sess.graph)
# dump the graph definition as JSON
print(sess.graph.as_graph_def())
# clean up
sfw.close()
# ... | true |
ed4cde158a06e6cedea64afc2568aec0597a6f7a | Python | anaiortega/XCmodels | /puente_quintanavides/calculo_dinamico/oscilacion_viga_biapoyada_xcm.py | ISO-8859-1 | 19,140 | 3.15625 | 3 | [] | no_license | '''Devuelve la primera forma modal de la viga biapoyada de
acuerdo con la figura B.5 de la IAPF, siendo:
x: Abcisa para la que se obtiene el valor.
L: Luz entre apoyos de la viga.
'''
def Fi1X(x,L):
return(sin(PI*x/L))
'''Devuelve el valor de la amplitud del movimiento de vibracin para el primer modo de vibracin... | true |
a35332e9b4638bcdad54d4f7bf727402175a743a | Python | KeeganRen/SLAMwithCameraIMUforPython | /keypoint_pair.py | UTF-8 | 550 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
keypoint.py
author: Keita Nagara 永良慶太 (University of Tokyo) <nagara.keita()gmail.com>
Class for key points pair between images
"""
class KeyPointPair:
def __init__(self,data_):
cx = 540.0 + 19.840576 # (image size X)/2 + principal point X
cy = 960.0 + 9.901855 # (image size Y)/... | true |
6b73cc0ecbc241e22033c30dc67b38fe49cd9f3e | Python | isaacpena/CS477-Python-Natural-Language-Processing | /Homework1/solutionsB.py | UTF-8 | 16,632 | 3.375 | 3 | [] | no_license | import sys
import nltk
import math
import time
from collections import Counter
START_SYMBOL = '*'
STOP_SYMBOL = 'STOP'
RARE_SYMBOL = '_RARE_'
RARE_WORD_MAX_FREQ = 5
LOG_PROB_OF_ZERO = -1000
# TODO: IMPLEMENT THIS FUNCTION
# Receives a list of tagged sentences and processes each sentence to generate a list of words a... | true |
9fa45df0e2770fcdee59b1deb14d0d5c6bbbb0f8 | Python | fomalhaut88/pybackup2 | /models/base_command.py | UTF-8 | 423 | 2.765625 | 3 | [] | no_license | from models.errors import CommandError
class BaseCommand:
command = None
args = ()
doc = ""
def __init__(self, *args):
if len(args) != len(self.__class__.args):
raise CommandError("invalid number of arguments")
self.args = {
key: arg
for key, arg i... | true |
33179ab9b38618c19a15fba5718b030712d1cded | Python | sbacheld/sudoku-solver | /domain.py | UTF-8 | 231 | 3.21875 | 3 | [
"MIT"
] | permissive | class Domain:
_values = []
def __init__(self, values):
self._values = values
@property
def values(self):
return self._values
def update_values(self, values):
self._values = values
| true |
83ff9fb44c296b15fd0d4505c8b5745d58ccd752 | Python | OpenFAST/python-toolbox | /pyFAST/input_output/examples/Example_PlotBinary.py | UTF-8 | 638 | 2.828125 | 3 | [] | no_license | """
- Open and OpenFAST binary file
- Convert it to a pandas dataframe
- Plot a given output channel
"""
import os
import matplotlib.pyplot as plt
from pyFAST.input_output import FASTOutputFile
# Get current directory so this script can be called from any location
scriptDir = os.path.dirname(__file__)
fastoutFilenam... | true |
15e82f8de1609de491a4e03e9fefbc7c1a027c14 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2338/60639/244373.py | UTF-8 | 464 | 2.953125 | 3 | [] | no_license | def solution():
inp=input().split(' ')
n=int(inp[0])
sum=int(inp[1])
inp=input().split(' ')
nums=[]
for i in range(n):
nums.append(int(inp[i]))
for i in range(n-1):
for j in range(i+1,n):
if nums[i]+nums[j]==sum:
print("Yes")
return... | true |
ce3b40f90fd20f96d706403129473582eabd177c | Python | aptend/leetcode-rua | /Python/905 - Sort Array By Parity/905_sort-array-by-parity.py | UTF-8 | 976 | 3.234375 | 3 | [] | no_license | from leezy import Solution, solution
"""
How about returning an inverleaving array?
even, odd, even, odd, ... and so forth
[1, 2, 3, 4] -> [2, 1, 4, 3]
one solution:
N = len(A)
i, j = 0, 1
while True:
while i < N and (i + A[i]) % 2 == 0:
i += 2
while j < N and (j + A[j]) % 2 == 0:
j += 2
... | true |
72ba8dca05d9a480f57dc1db308cd9923f2d3d8e | Python | hancse/model_rowhouse | /House model_2R2C_Python/house_model/configurator.py | UTF-8 | 6,553 | 3.0625 | 3 | [] | no_license | """
A certain Python style gives the modules (*.py files) names of a profession:
in this style, the module that encapsulates the parameter configuration can be called
configurator.py
the module performs the following tasks:
1. read the input parameters for the model simulation from a configuration file
"Pythonic" co... | true |
b7548ce3cdaa04ca2aaac4ca69db5a09cb685745 | Python | nikita199801/binary_tree | /main.py | UTF-8 | 877 | 3.578125 | 4 | [] | no_license | from bintree import BinTree
new_tree=BinTree()
while True:
choose = int(input("1. Ввести дерево \n"
"2. Вывести дерево\n"
"3. Вывести все возможные слова\n"
"0. Выход\n"
"Выберите пункт: "))
if choose == 1:
val=""
while val !=" ":
val=input("... | true |
39afa0ca203edb0a22fd5ea80fdaa78391cf985e | Python | vr2262/framer | /bin/make_vertical.py | UTF-8 | 1,551 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""The command-line entry point for combining images into a single image."""
from framer import combine_vertical_from_iterable
from PIL import Image
import argparse
import os
def main():
"""Combine images vertically given file names on the command line."""
parser = argparse.ArgumentPar... | true |
d8bade4c3171359a3e2c7ee27b0c0ee2858e7e78 | Python | kxie8/cs1113 | /code/idris/examples.py | UTF-8 | 297 | 3.640625 | 4 | [] | no_license | # assignment commands
x = 6
y = 5
z = 5
# conditions
if (True):
x = 3
y = 6
else:
x = 7
z = 6
# { (x,3), (y,6), (z,5) }
if (x > 0 or y == 1):
x = 2
y = 4
else:
x = 1
z = 0
# iteration
times = 10
while (times > 0):
print("Hello")
times = (times - 1)
| true |
fd87533135530d7f7c1cb931869b9e283703dcde | Python | SophiaMVaughn/Pollution-CSC4996 | /Backend/main.py | UTF-8 | 6,360 | 2.765625 | 3 | [] | no_license | from scraperInterface import ScraperInterface
from parse import isArticleEvent
from parse import convertScrapedtoSent
from RNNBinary import readBinary
from officialComm import officialComment
from dateRegex import dateInfo
from textColors import bcolors
from Location import locationsInfo
from mongoengine import connect... | true |
b05cf969f1e67d620d8240031274fb9aaee82681 | Python | mattesko/torch-toolkit | /torch-toolkit/datasets.py | UTF-8 | 5,202 | 3.03125 | 3 | [
"MIT"
] | permissive | import random
import PIL
from PIL import Image
import pydicom
import numpy as np
import os
import torch
from torch.utils.data import Dataset
class ClassificationDataset(Dataset):
"""Simple input, target classification"""
def __init__(self, X, y, transform=None):
"""
Arguments:
X ... | true |
f84430104cff4f29ab9310bca5ba411a36c40363 | Python | memray/springleaf | /ruimeng/FeatureSelection.py | UTF-8 | 3,055 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from sklearn.svm import LinearSVC
__author__ = 'Memray'
import pandas as pd
import numpy as np
import urllib
import time
from sklearn import datasets
import pandas as pd
from pandas import Series
from sklearn.ensemble import RandomForest... | true |