blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
60ddac4db0367285d301cf668300a561fed66f9d | komunikator1984/Python_RTU_08_20 | /Diena_1_4_thonny/d2_u3_d11.py | UTF-8 | 163 | 3.796875 | 4 | [
"MIT"
] | permissive | #3 uzdevums
celsium = float(input("Outside temperature in Celsius."))
farenheit = round(32+celsium*(9/5), 1)
print(f"Temperature in farenheit - {farenheit} F.")
| true |
9b8447ad7a0f2360798edb0eaad6fa9f6bd79ee3 | saarangbond/ML-MessageScoring | /WordModel/wordModel.py | UTF-8 | 1,681 | 2.703125 | 3 | [] | no_license | import pandas as pd
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from WordModel.wordTraining import PrepTrainingData
from WordModel.wordTesting import PrepTestingData
ps = PorterStemmer()
class WordModel:
def __... | true |
6786921c1784d6f09da9b9e8cc500ccdf807fc48 | alexandrera/udacity_practice | /turtle.py | UTF-8 | 674 | 3.65625 | 4 | [] | no_license | import os
import turtle
def draw_square_circle_and_triangle():
window = turtle.Screen()
window.bgcolor("black")
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("white")
brad.speed(2)
count = 0
while count < 4:
count += 1
brad.forward(100)
brad.right(90)... | true |
dfb87d747b17f3e0b85c33de3c3b73680da22bc7 | MrZhangzhg/nsd_2018 | /nsd1811/devops/day02/timeit.py | UTF-8 | 913 | 2.96875 | 3 | [] | no_license | import time
import threading
import os
def myadd():
result = 0
for i in range(1, 20000001):
result += i
print(result)
if __name__ == '__main__':
start1 = time.time()
for i in range(2):
myadd()
end1 = time.time()
print(end1 - start1)
###################################
s... | true |
96a05ab993a8f53e10e57d2fcac9f23d765157d8 | stungkit/Leetcode-Data-Structures-Algorithms | /08 String/541. Reverse String II.py | UTF-8 | 474 | 3.46875 | 3 | [] | no_license | class Solution:
def reverseStr(self, s: str, k: int) -> str:
ls = [s[i:i+2*k] for i in range(0, len(s), 2*k)] # segment into chunks of length 2k
res = ''
for seg in ls:
res += seg[:k][::-1] # reverse the first k characters of each chunk
if len(seg) > k:
... | true |
20f714a8d3abef6d86bedfc781231c2fde918516 | beimingmaster/learnit | /ai/ModelTraining.py | UTF-8 | 3,920 | 2.859375 | 3 | [] | no_license | import tensorflow
import keras
import os
import numpy as np
import sys
import pickle
from sklearn.model_selection import train_test_split
from keras.layers import Dense, Embedding, LSTM, Dropout
import pandas as pd
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
BA... | true |
e0b393d4e5d455607ed56e312a413b38414aec7c | walkerwzy/walker_jupyter_lab | /deepblue/python_numpy_cv/opencvs/t08.py | UTF-8 | 183 | 2.71875 | 3 | [] | no_license | import cv2
img = cv2.imread("./cv2.png")
px = img[100, 100]
print(px)
px1 = img[100, 100, 0]
print(px1)
img[100:, 100:] = [255, 255, 255]
cv2.imshow("img", img)
cv2.waitKey(5000)
| true |
0c6bbafaec5279c4218be7831098767d498bd747 | piotrpiekos/StochSym-Project | /wiecej_pudel/sym.py | UTF-8 | 3,852 | 3.28125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sys
def parse_input(scheme_name):
"""
Prepare csv to usable dataframes or numpy arrays
:param scheme_name: name of the directory with necessary files
:return: nodes, transitions - parsed csv files describing the chain of the process
"""
transitions... | true |
1f8899185b82ba5c8f1023bfb0a76d1977b855b1 | cgjosephlee/PBJelly | /pbsuite/utils/setupLogging.py | UTF-8 | 310 | 2.578125 | 3 | [
"BSD-2-Clause-Views",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """
Logger
"""
import logging, sys
def setupLogging(debug=False):
logLevel = logging.DEBUG if debug else logging.INFO
logFormat = "%(asctime)s [%(levelname)s] %(message)s"
logging.basicConfig(stream=sys.stderr, level=logLevel, format=logFormat )
logging.info("Running %s", " ".join(sys.argv))
| true |
48cf125732c0521d14625ffa6cfbb1c23fc8b610 | CjayBillones/project-euler | /python/project-euler-10.py | UTF-8 | 539 | 3.640625 | 4 | [] | no_license | from UtilityFunctions import is_prime
from UtilityFunctions import sieve_of_erastothenes
import time
def solution_one():
result = 0
for i in range (2, 2000001, 1):
if is_prime(i):
result = result + i
return result
def solution_two():
return sum(sieve_of_erastothenes(2000000))
if __name__ == "__mai... | true |
c40ac0e5b56dcb124eb3a4c294e310d4f7ca544c | paddycarey/beardo-control | /app/app/utils/name_gen.py | UTF-8 | 1,237 | 2.890625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | """Utilities used for generating random project names.
"""
# future imports
from __future__ import absolute_import
# stdlib imports
import os
import random
# third-party imports
from nacelle.conf import settings
# local imports
from app.utils.slug import slugify
def _random_line(filename):
"""Returns a random ... | true |
35b67f643cf18ae105af6f3432967ccb14ae1304 | zack4114/Amazon-Questions | /Find2NonRepeatingElementsInArrayOfRepeatingElements.py | UTF-8 | 1,058 | 4.125 | 4 | [] | no_license | # Find the two non-repeating elements in an array of repeating elements
# Asked by SG
# Given an array in which all numbers except two are repeated once. (i.e. we have 2n+2 numbers and n numbers are occurring
# twice and remaining two have occurred once). Find those two numbers in the most efficient way.
# arr[] = {2... | true |
52540c00ae62f285ed41bcfac90cbee0fe256d42 | pilnikthomas/ATTA_ProjetoFinal | /Genius.py | UTF-8 | 871 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 6 17:23:45 2017
@author: Alfredo Acerbi, Ariel Iglicky, Tiago Mingossi, Thomas Pilnik
"""
import pygame
from pygame.locals import *
import sys
import random
class Button:
def __init__(self, color, bright_color, pos_x, pos_y):
self.x = pos_x
self.y = pos_y
self... | true |
7c77ec71b5681768ce13d1fb180921b8d9d680bb | kuangyl0212/PAAA | /src/test/resources/py-source-a/046py_source_file2.py | UTF-8 | 886 | 4.40625 | 4 | [] | no_license | """
2.(10分)在一个农场中,养了一群鸡和兔。一只鸡有两条腿,一只兔有四条腿。请编写程序,完成以下任务:
(1) 编写函数calculate(head, leg),其中形参head和leg分别表示农场中所有动物的头和脚的个数。通过该函数计算,在屏幕上显示鸡和兔的个数。
例如:向该函数传入实参10和32,屏幕显示结果为:
4 6
(注:4和6中间没有空格;表示鸡和兔的个数分别为4和6)
(2) 假设所有动物的头和脚的个数分别为12和32,调用(1)中的函数,打印鸡和兔的个数。
注:(1)题中动物个数需为整数。(2)编程题中的过程代码要同时写在纸质试卷上。
"""
def calculate(head,leg)... | true |
be0ec1e8f106a7bade6fb7ff3851dd1fdfaafe79 | daxiangpanda/shiyanba | /countofctf.py | UTF-8 | 244 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
with open(r'E:\dictionary.txt','r') as f:
n = f.read()
words = n.split('\n')
# print words[0]
num = 0
for i in words:
if 'ctf' in i:
num+=len(i)
print i
print len(words)
print num | true |
c057431311ac7fbab65d08c8311be51c56b32d34 | jasonpul/MarketGym | /src/MarketGym/TradierLib.py | UTF-8 | 2,385 | 2.65625 | 3 | [
"MIT"
] | permissive | import datetime
import os
import requests
import pandas as pd
import time
import random
from tqdm import tqdm
from multiprocessing import Pool
from dotenv import load_dotenv
from typing import Union, List
from . import Types
load_dotenv()
tradier_url = 'https://api.tradier.com'
def load_env_file(path: str):
loa... | true |
efb2d29d19e88c65ba52fcd5b00d12cdd3a1c8d2 | st-pauls-school/python | /specimen.py | UTF-8 | 1,810 | 3.078125 | 3 | [] | no_license |
def task_1(names, test1scores, test2scores, test3scores):
valid = [""] * len(names)
ok1 = [0] * len(names)
ok2 = [0] * len(names)
ok3 = [0] * len(names)
limits = [(test1scores, ok1, 20), (test2scores, ok2, 25), (test3scores, ok3, 35)]
for i in range(len(names)):
for s in limits:
if s[0][i].isnumeric():
... | true |
6134611ef541ef30b0d9e470741611a0c32dfba6 | brenj/solutions | /interviews/nginx/frequency/frequency | UTF-8 | 1,076 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import argparse
from collections import Counter
import os
import sys
def main(path_to_logfile):
"""Print top ten most frequently logged IP addresses from specified log.
Args:
path_to_logfile (str): Path to NGINX log file to parse.
Returns:
int: Su... | true |
5fd5cb3d332c04c64ad251918120297e5327dfd5 | alonalbert/plex-scanners | /Plug-ins/SportsScanner.bundle/Contents/Code/F1Agent.py | UTF-8 | 1,721 | 2.578125 | 3 | [] | no_license | import re
class F1Agent(object):
def get_regex(self):
return re.compile('^f1', re.IGNORECASE)
SESSION_RE = re.compile('f1 (?P<extra>extras )?(?P<round>\d\d) (?P<location>[a-z ]+)$', re.IGNORECASE)
PARTS = {
1: "Inside Line",
2: "The F1 Report",
3: "Driver Press Conference",
4: "Paddock Unc... | true |
a61e91cd72466df11e9ff463523df24f8073f19d | low-sky/AstroStat_Results | /obs_analysis_pipeline.py | UTF-8 | 4,412 | 2.53125 | 3 | [] | no_license |
'''
Reproduce the sim vs obs plots from the paper
Expects the following folder structure before running:
- Des_to_Obs
- HDF5
- Obs_to_Fid
- HDF5
- Obs_to_Obs
The design matrix (saved in csv format) should be in the parent directory
(given as sys.argv[1]).
The obs to fiducial comparisons... | true |
943d3cddff8ae37e3399cbc6d25f42f3ee5ad72f | semalPatel/web-information-management | /Project2/recommend.py | UTF-8 | 7,663 | 2.90625 | 3 | [] | no_license | import numpy as np
from similarity import (
cosine_similarity,
pearson_correlation,
adj_cosine_similarity
)
def train_users(users, train_file='train.txt'):
training = open('train.txt', 'r')
training = training.read().strip().split('\n')
for i, line in enumerate(training):
users[i] = [i... | true |
b5c76d8427ab0a058d172756dbe532cc1875c5b1 | nobaluis/dgac2020-nurbs | /code/bspline_examples.py | UTF-8 | 2,174 | 2.734375 | 3 | [] | no_license | import bspline
import examples_data
import numpy as np
import matplotlib.pyplot as plt
def plot_example(p, p_list, c_u, nip_u, u, ex_number, save_figs=False):
# plot the curve & control points}
plt.figure(figsize=(6.4, 4.8), dpi=150)
plt.plot(c_u[:, 0], c_u[:, 1])
plt.plot(p_list[:, 0], p_list[:, 1], ... | true |
16f74a4e4fee2fe517c1bd2e4983e54198ae1427 | mamueller/benchmark | /benchmark/proto/Testclass.py | UTF-8 | 607 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python
# vim:set ff=unix expandtab ts=4 sw=4:
class Coords(object):
cV=50
@staticmethod
def sm():
print("This is sm")
print("I am a static method I can only acces variables of a specific class and not of subclasse")
print(Coords.cV)
#print(????.subclassParameter)
... | true |
92636ddd08357fb49936d70f9bd8eb374bb4cee5 | JoshData/python-email-validator | /email_validator/syntax.py | UTF-8 | 23,969 | 2.6875 | 3 | [
"CC0-1.0"
] | permissive | from .exceptions_types import EmailSyntaxError
from .rfc_constants import EMAIL_MAX_LENGTH, LOCAL_PART_MAX_LENGTH, DOMAIN_MAX_LENGTH, \
DOT_ATOM_TEXT, DOT_ATOM_TEXT_INTL, ATEXT_RE, ATEXT_INTL_RE, ATEXT_HOSTNAME_INTL, QTEXT_INTL, \
DNS_LABEL_LENGTH_LIMIT, DOT_ATOM_TEXT_HOSTNAME, DOMAIN_NAME_REGEX, DOMAIN_LITERAL... | true |
4a17e2d2c3927a0acb61b77b46207a15f6db2382 | dssg/dickens | /src/descriptors.py | UTF-8 | 5,072 | 3.296875 | 3 | [] | no_license | """Dickens
Additional decorators implementing the descriptor interface.
"""
import functools
import types
__version__ = '2.1.1'
class classproperty:
"""Descriptor decorator implementing a class-level read-only
property.
"""
def __init__(self, func):
self.__func__ = func
def __get__(s... | true |
f95737b40de6f6fcb0d41ed7b2b3c7491d73f518 | byoutsey/Deduper | /youtsey_deduper.py | UTF-8 | 4,254 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import argparse
import re
########MANAGE INPUTS
def get_args():
parser = argparse.ArgumentParser(description="Deduplicates SAM File of single-end alignments. Outputs the input SAM file name with (_deduped.sam) extension")
parser.add_argument("-f", "--file", help= "SAM file to b... | true |
9deeffcd365273f6452a3f687388f832cf484f45 | MountAllison/comp4911 | /sockets/tcp_client_simple.py | UTF-8 | 539 | 3.1875 | 3 | [] | no_license | from socket import *
# Address (name) and port of the server process
# we will connect to
serverName = '10.0.0.2'
serverPort = 12000
server = (serverName, serverPort)
# Create socket and connect to server
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect(server)
# Get user input
message = raw_input('I... | true |
354ace859c1cdd78d0bd097af713dfb62ca5a0e3 | Goi-27/homeworks | /trans2num.py | UTF-8 | 2,735 | 3.671875 | 4 | [
"MIT"
] | permissive | # -*- coding: UTF-8 -*-
def trans1(s):
if len(s) <= 2:
s[1] = s[1]
return s
if s[0]=='整数':
n=1
elif s[1]=='增加' or s[1]=='减少':
n=1
elif s[0]=='如果':
n=7
if s[len(s)-n] == '零':
s[len(s)-n] = 0
elif s[len(s)-n] == '一':
s[len(s)-n] = 1
eli... | true |
10263a344158c102bbfa6748e77476dd5f09dc17 | jdmonaco/neuroswarms | /neuroswarms/matrix.py | UTF-8 | 6,837 | 2.671875 | 3 | [
"MIT"
] | permissive | """
Matrix operations for neuroswarms models.
Author: Joseph Monaco (jmonaco@jhu.edu)
Affiliation: Johns Hopkins University
Created: 2019-05-12
Updated: 2020-11-16
Related paper:
Monaco, J.D., Hwang, G.M., Schultz, K.M. et al. Cognitive swarming in complex
environments with attractor dynamics and oscillatory... | true |
00787a7c925a3144eaab884800ac77ce3748cc1e | ravi4all/PythonAugMorningReg_19 | /Pygame/game_1/game_2.py | UTF-8 | 4,470 | 3.25 | 3 | [] | no_license | import pygame
import random
pygame.init()
pygame.mixer.init()
width = 1000
height = 500
screen = pygame.display.set_mode((width,height))
color_1 = 200, 120, 100
red = 255, 0, 0
white = 255, 255, 255
black = 0, 0, 0
blue = 0,0,255
pygame.mixer.music.load('StreetFighter.ogg')
pygame.mixer.music.play(... | true |
a8cef0163451017c70a2bbe615ea020c291b3b15 | xutpuu/ProjectEuler | /Problem28.py | UTF-8 | 600 | 4.4375 | 4 | [] | no_license | # Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
# 21 22 23 24 25
# 20 7 8 9 10
# 19 6 1 2 11
# 18 5 4 3 12
# 17 16 15 14 13
# It can be verified that the sum of the numbers on the diagonals is 101.
# What is the sum of the numbers on the di... | true |
352497bf1ea9253b0d28b57b3e6b8445d91a95bd | timrappold/WeeBro | /bin/infer.py | UTF-8 | 3,444 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import logging
import os
import importlib
import train_model
import training_data
import features
import lib
importlib.reload(train_model)
importlib.reload(training_data)
importlib.reload(features)
MODEL_DIR = './trained_models/' + 'scaler_svc.pkl'
def main():
infer = make_infer()
infer_test_files(infe... | true |
1aa7c8c2664bec509c5c1f3da7347852069f96a1 | th0mp50n/RDM-client-software-inventory | /performancePlots.py | UTF-8 | 2,334 | 2.609375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import pickle
%matplotlib
#reading in results from pickle
infile = open('data/irodsPerformances_cadaver.out.pickle', 'rb')
davrodsRes = pickle.load(infile)
infile = open('data/irodsPerformances_python0.9.out.pickle', 'rb')
python9 = pickle.loa... | true |
37be5a5101f4070d9ebab09e0be67058b50e1e41 | hellroft9711/adding-a-cms-to-your-web-app-course | /code/flask/ch05-the-redirects/pypi_flask_ch05/pypi_org/viewmodels/shared/viewmodelbase.py | UTF-8 | 990 | 2.5625 | 3 | [] | no_license | from typing import Optional
import flask
from flask import Request
from pypi_org.data.users import User
from pypi_org.infrastructure import request_dict, cookie_auth
from pypi_org.services import user_service
class ViewModelBase:
def __init__(self):
self.request: Request = flask.request
self.__u... | true |
cfe88d409e7a5a25386680059ff12f63b5827b56 | K-Schubert/Swiss_Mountain_app | /dl_urls_csv.py | UTF-8 | 882 | 2.578125 | 3 | [] | no_license | from execute_js import execute_js
from scraping import scrap_mountains
from selenium import webdriver
import os
from paths import path
def dl_urls_csv(n_mtns):
url = "http://www.images.google.com"
# Get mountain names from Wikipedia
mtns = scrap_mountains(n_mtns)
driver = webdriver.Chrome()
# Download photo u... | true |
51ecb72bd92b9540b5596389cd194e1640eba334 | imaytone/learn_leetcode | /week03/[50]Pow(x,n).py | UTF-8 | 1,085 | 3.5 | 4 | [] | no_license | # 实现 pow(x, n) ,即计算 x 的 n 次幂函数。
#
# 示例 1:
#
# 输入: 2.00000, 10
# 输出: 1024.00000
#
#
# 示例 2:
#
# 输入: 2.10000, 3
# 输出: 9.26100
#
#
# 示例 3:
#
# 输入: 2.00000, -2
# 输出: 0.25000
# 解释: 2-2 = 1/22 = 1/4 = 0.25
#
# 说明:
#
#
# -100.0 < x < 100.0
# n 是 32 位有符号整数,其数值范围是 [−231, 231 − 1] 。
#
# Related ... | true |
9e8be5de7af7b05c1eb96fa6ce6b499dfd79148b | Akrata/CursoCF | /tuplas.py | UTF-8 | 1,092 | 3.890625 | 4 | [
"Apache-2.0"
] | permissive | #no podemos modificar los elementos de una tupla.
tupla = (1,2,3,4,5,6,7,8,9,0)
elemento = tupla[4]#busca en el indice numero
sub = tupla[:5:2]#genera una tupla con esos parametros
tupla[1] = 20 ##LAS TUPLAS NO SE PUEDEN MODIFICAR SON INMUTABLES
#COMPRIMIR Y DESCOMPRIMIR TUPLAS
tupla = (1,2,3,4)
uno, dos, tres, ... | true |
c6aee8c28d54ec92e54ac457232243b1cf58ab75 | csiwale/TweetsFromZambia | /Parser.py | UTF-8 | 698 | 2.78125 | 3 | [] | no_license | __author__ = 'csiwale'
import json
from collections import defaultdict
from pandas import DataFrame, Series
import pandas as pd
def get_tweets(path):
return [json.loads(line) for line in open(path)]
def get_counts(sequence):
counts = {}
for x in sequence:
if x in counts:
counts[x] += 1... | true |
627774ff3d7e6ac49548fe2def49cf5f3ca108ab | alongigi/InformationRetrievalEngine | /Model.py | UTF-8 | 4,008 | 2.703125 | 3 | [] | no_license | import os
from collections import defaultdict
import sys
from Indexer import Indexer
from Observable import Observable
from Parser import Parser
from ReadFile import ReadFile
from Stemmer import Stemmer
import time
class Model(Observable):
def __init__(self, docs_path, postings_path):
super().__init__()... | true |
31f8b4b69903454ee13bc2a9ab0d2640a896a2c4 | josmfred/reddit_reply_generator | /scripts/train/next_word_markov_model.py | UTF-8 | 1,420 | 3.28125 | 3 | [] | no_license | import pickle
import numpy as np
# Creates a model that for each pair of words, stores, for each word,
# the count of the word given that follows the pair.
def train_next_word_markov_chain(texts, vocab_size=10000):
chain = {}
for text in texts:
for pair in zip(zip(text, text[1:]), np.append(text[2:], ... | true |
0f3d21cc92cc203f375bd6fa1d941b22d377e476 | Alvin-Zeng/PGCN | /pgcn_models.py | UTF-8 | 10,917 | 2.703125 | 3 | [] | no_license | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import math
class GraphConvolution(nn.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, bias=True):
super(Graph... | true |
9198ae7002b1085e0b742fddb6328fa5c51b3563 | sunlandli/stock | /quantdigger/branches/quantweb/quantdigger/util/progressbar.py | UTF-8 | 832 | 3.0625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# Copyright: Lustralisk
# Author: Cedric Liu
# Date: 2015-11-08
import sys
import time
class ProgressBar:
def __init__(self, count=0, total=0, width=50):
self.count = count
self.total = total
self.width = width
def move(self):
self.count += 1
def ... | true |
b31a7c82c7340e35582fa3776bb14909a40470a5 | tlittle2/Kattis-Solutions-Python | /4thought/4thought.py | UTF-8 | 1,419 | 3.953125 | 4 | [] | no_license | #!/bin/usr/env python3
def main():
#make set of operators
#make sure they have spaces, it is important to the output
operators = (' // ', ' * ', ' - ', ' + ')
#we will store the values answer and the equation into a dictionary for easy lookup
dict = {}
#get all possible combin... | true |
9324e80f8ba375f5be3b81d15101d9543f41498d | thelyad/FinalProjects | /constitution.py | UTF-8 | 634 | 3.5 | 4 | [] | no_license | '''
Created on Nov 4, 2017
@author: ITAUser
'''
import string
def calculate_char(filename, mychar):
f = open(filename, 'r')
count = 0;
words = f.read()
for word in words:
for letter in word:
if letter.lower() == mychar:
count = count+1
return count
letters = l... | true |
ec0fa0926e4439960ee5c8d0044af3f09fa18780 | zuoyuwang/ML-Correctness-prediction | /code/part_a/ensemble_knn.py | UTF-8 | 1,493 | 3.234375 | 3 | [
"MIT"
] | permissive | # TODO: complete this file.
from utils import *
from sklearn.impute import KNNImputer
from sklearn.utils import resample
def knn_impute_by_user(matrix, k):
""" Fill in the missing values using k-Nearest Neighbors based on
student similarity. Return the accuracy on valid_data.
See https://scikit-learn.org... | true |
c2698914eb3c03b172c7854a2e00c438c2ca1a4d | sunny-coffee/KG-Engineering-Info | /src/ontology_creator.py | UTF-8 | 9,352 | 2.703125 | 3 | [] | no_license | from owlready2 import DataProperty, FunctionalProperty, get_ontology, ObjectProperty, Thing, types
from owlready2.prop import DataPropertyClass, ObjectPropertyClass, ThingClass
import pandas as pd
import re
class OntologyCreator:
__filename: str
def __init__(self, iri,filename):
self.__filename = file... | true |
4c8840a8799dcd886fbbbb9ddc0cf1cf4cfd562a | advancedpythonprogramming/hands-on-activities | /AC_solutions/chapter_06/AC06_0/AC06_0.py | UTF-8 | 1,607 | 3.296875 | 3 | [] | no_license | import string
import encryptor as enc
import pytest
def check_bijection(rot):
dom = range(26)
rec = []
for x in dom:
y = rot.get(x)
assert y is not None
rec.append(y)
assert set(dom) == set(rec)
def setup_module(module):
enc.create_alphabet((list(string.ascii_lowercase)... | true |
f25ca68d7dd024677434cefa3047a7a8310c869d | WoradeeKongthong/opencv | /05_img_processing_convolution.py | UTF-8 | 446 | 2.703125 | 3 | [] | no_license | """
Convolution คือ การกรองข้อมูลจากภาพ
สามารถใช้ convolution ลด noise ได้ คล้ายการ Blur
"""
import cv2
import numpy as np
img = cv2.imread('source/coffee05.jpg', 0)
kernel = np.ones((3,3), np.float32) / 10
imgConv = cv2.filter2D(img, -1, kernel)
stackImg = np.hstack([img, imgConv])
cv2.imshow('output', stackImg)
... | true |
41bab0e879d257e05c39beff92d5b7cadd0f8837 | noahgolmant/SGLD | /sgld/train.py | UTF-8 | 8,063 | 2.65625 | 3 | [
"MIT"
] | permissive | """ Main file to orchestrate model training! Most of the work should go here."""
import os
import time
import torch
import track
import skeletor
from skeletor.datasets import build_dataset, num_classes
from skeletor.models import build_model
from skeletor.utils import AverageMeter, accuracy, progress_bar
from .opti... | true |
00e39e79977e2490cd4c9da5e429f6235279926f | qianrenjian/CPRec | /model.py | UTF-8 | 2,818 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
class Model():
def __init__(self, usernum, itemnum, args):
self.usernum = usernum
self.itemnum = itemnum
d_emb = args.latent_dimension
learning_rate = args.learning_rate
self.u_embeddings = tf.Variable(tf.random_uniform([usernum, d_emb], maxval=0.1... | true |
725f8272805476da7ab5ad14b0983c4cd2639d11 | Ziaeemehr/cython | /examples/cython_for_ODEs/ode0_main.py | UTF-8 | 1,131 | 2.65625 | 3 | [] | no_license | import sys
import time
import numpy as np
import time
if __name__ == "__main__":
version = sys.argv[1]
if int(version) > 12:
print('1st command-line arg must be version number, not', version)
sys.exit(1)
if version == '0':
import ode0 as ode # pure Python
else:
name ... | true |
e4138d4e629bf37b8e8afcc5dab3e4d20b3c9dfb | bong-o-hari/Daily | /sum_ll.py | UTF-8 | 901 | 3.5625 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1, l2, c = 0):
# Fill this in.
sum = l1.val + l2.val
carry = int(sum / 10)
l3 = ListNode(sum%10)
p1 = l1.next
p2 = l2.next
... | true |
097193bba72148ef682773b7de49e9d51b522c61 | sierrakatow/cryptosolver | /nlp.py | UTF-8 | 1,818 | 2.984375 | 3 | [] | no_license | import nltk
import itertools
import operator
solutionslist = open ("answer.txt").readlines()
#reads the text file of possible solutions into a list of solutions
solutions_tagged = [nltk.pos_tag(nltk.word_tokenize(solution)) for solution in solutionslist]
# word_tokenize(solution) takes each solution (for example, "T... | true |
f69ac4826ee0b75c24f2d03a864745c503ebcb33 | cheungh/python | /insertion_sort.py | UTF-8 | 752 | 3.9375 | 4 | [
"MIT"
] | permissive | """
Very inefficient sort method
takes 20 seconds to sort 20000 integer
use mergesort or quicksort for larger than 200 elements
"""
def insertion_sort(A):
# for n element in list
n = len(A)
# let i be iterate counter of outer loop
for i in xrange(n - 1):
# if left greater than right
# sw... | true |
8976c0a31b44138ab5919902f29bc4a772c46187 | Paarisaa/NLP-Word2Vec_for_combining_Lexical_and_Semantic_Similarities | /Combining_Lexical_and_Semantic_Similarities.py | UTF-8 | 7,667 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thur Nov 5 15:58:03 2020
@author: psarikh
"""
# read the data:
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import GridSearchCV
from sklearn import svm
from nltk.stem.porter import *
from nltk.co... | true |
2029707bd066ae3cb7dd6550df82ffcb1a3b0bea | gaurangdavda/InvestoBot | /Utilities/OptimizePortfolio.py | UTF-8 | 6,846 | 2.859375 | 3 | [
"MIT"
] | permissive | import re
import numpy as np
import pandas as pd
import os
from alpha_vantage.timeseries import TimeSeries
from collections import OrderedDict
from datetime import datetime
from scipy.optimize import minimize
class OptimizePortfolio():
def __init__(self):
self.ts = TimeSeries('P9HHDBDFZ3RZYTSW', output_fo... | true |
1f4dcc9d832b0c76baec548497245457944fcfb7 | StudentOwl/StudentOwl-Monitoreo | /student-owl/utils/threader.py | UTF-8 | 976 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Timer
import time
class RepeatedTimer(object):
"""
An class to implement the running periodically function
"""
def __init__(self, interval: int, theFunction, *args, **kwargs) -> None:
self._timer = None
self._interva... | true |
a7c544d144eb6c10af2766bb861703573c0b185c | mahima1997/Dogs-vs-Cats | /dogsvscatsbyCNN.py | UTF-8 | 9,636 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 20 11:36:46 2017
@author: mah
"""
#HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes,
#and is designed for flexible and efficient I/O and for high volume and complex data (more info).
#TFLearn can d... | true |
55951eac6a812ae34432eb3c12f28fabe4fd417a | KyattPL/algorithms-and-data-structures | /data-structures/PriorityQueue.py | UTF-8 | 1,622 | 4.09375 | 4 | [] | no_license | # Priority queue implemented using heap structure
class PriorityQueue:
def __init__(self):
self.list = []
def enqueue(self, value):
self.list.append(value)
self.swim(len(self.list) - 1)
def isEmpty(self):
if len(self.list) == 0:
return True
else:
... | true |
89f192e22636ca4f89dfe0dd7d053563a4016fda | sireesha98/ome | /ome.py | UTF-8 | 89 | 3.109375 | 3 | [] | no_license | i=input("enter i value")
p=input("enter p value")
for i in range(p):
print("hello")
| true |
ca32055c9a95a3271d664dd2cda19de4ba6d217c | JuanC-Fandino/P.Audio-Tarea | /PRUEBA.py | UTF-8 | 1,474 | 3.28125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
plt.style.use("ggplot")
# Setup
x_ = np.linspace(-20,20,10000)
T = 8
armonics = 10
def squarewave(x):
global T
lowerBoundLeft = (-T/2)
lowerBoundRight = 0
upperBoundLeft = 0
upperBoundRight = (T/2)
one = 1
negativeOne... | true |
f925cc70aa26991f0122b444b5b1f2d1b504ee1f | khizra-ali/Python-Practice | /10.py | UTF-8 | 210 | 3.90625 | 4 | [] | no_license | num=int(input("enter number"))
if (num%2) == 0:
print(num,"number is even number")
else:
print(num,"number is odd number")
#or we can write print("the number i.e "+ str(num) + "odd")
| true |
f4c66661cac79c7b41fcab47a7b3722721e297c6 | zaepfle/hfpython | /kapitel4/seite128.py | UTF-8 | 1,128 | 4.125 | 4 | [] | no_license | """Dies ist das Modul “schachtler.py". Es stellt eine Funktion namens
print_lvl(), die eine Liste mit beliebig vielen eingebetten Listen ausgibt."""
import sys
def print_lvl(liste, einzug=False, ebene=0, dat=sys.stdout):
"""Diese Funktion erwartet ein positionelles Argument namens "liste", das
eine beli... | true |
1b837972f22a91726c7bd25effe2e5d048da6154 | eggduzao/Costa_TfbsPrediction | /Code/util/aux.py | UTF-8 | 9,380 | 3.34375 | 3 | [] | no_license | #################################################################################################
# Contains miscelaneous auxiliary functions.
#################################################################################################
# Import
import constants
import os
def isInteger(s):
"""
Returns Tr... | true |
d92a833bccd582d33fb6babf137866fbfef3f512 | Hidderqu/ArchNum | /ISS/launch.py | UTF-8 | 2,088 | 3.234375 | 3 | [] | no_license | import os
import sys
import time
''' ----------------- Functions ---------------------- '''
def display_title():
os.system("clear")
print("\t>>>>>>>>>>>>>>>>>>>> ISS by Quentin HIDDERLEY & Alexandre HOUDEVILLE <<<<<<<<<<<<<<<<<<<\n")
print("Type 'help' if you feel a bit lost...\n")
def display_help():
print("\n"... | true |
56be1a89e12d1fd76e84fc3ab7bf131c07b66679 | ALREstevam/TopicosBD-DataMining-IBGE-Apriori | /datamining/AprioriProject/util/FileRenamer.py | UTF-8 | 513 | 3.125 | 3 | [] | no_license |
class FileRenamer:
def __init__(self, filename):
self.fullfilename = filename
self.extention = '.'.join(filename.split('.')[-1:])
self.filename = '.'.join(filename.split('.')[:-1])
def appendNameAtEnd(self, name):
return '{}{}.{}'.format(self.filename, name, self.extention)
... | true |
a99e996d8f1fa95e0b6bed7b1afc96dd2ed01896 | HafizulHaque/Python-Practice- | /membership.py | UTF-8 | 464 | 4.15625 | 4 | [] | no_license | vowels = "aeiou"
while(True):
vowelCnt = 0
consCount = 0
other = 0
str = input("Enter a string (-1 to exit) :")
try:
if int(str) == -1:
print("Thank you !")
break
except ValueError as error:
pass
for char in str:
if char.isalpha():
if char.lower() in vowels:
vowelCnt += 1
... | true |
e2f853df8928e8ad36aa7863ca85e5e8399868d5 | joicodes/Skybot | /app.py | UTF-8 | 4,376 | 2.75 | 3 | [] | no_license | from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse
import random
from database import *
import sendgrid
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import os
from sendgrid.helpers.mail import *
engine = create_engine('sqlite:///site... | true |
0b02d2acbab9a3203f28f96d79767b51304f84eb | snsunlee/LeetCode | /数组/454.四数相加-ii.py | UTF-8 | 469 | 2.71875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=454 lang=python3
#
# [454] 四数相加 II
#
class Solution:
def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
count=0
a_b_hash={}
for a in A:
for b in B:
a_b_hash[a+b]=a_b_hash.get(a+b,0)+1
... | true |
ee6e26f5fd6cc24dd6aa67ea7ae348ad5b97c4bc | csparpa/robograph | /robograph/datamodel/nodes/lib/strings.py | UTF-8 | 586 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | from robograph.datamodel.base import node
class TemplatedString(node.Node):
"""
This node returns a string by filling a string template with named parameters
Requirements:
template --> a str template, containing named labels. Format is
parameters --> dict with named parameters to be replaced i... | true |
261e36e19f3055b34a372f014104a266d4e9ad1e | BrianMao04/PlayMatrix | /threads.py | UTF-8 | 2,489 | 3.203125 | 3 | [] | no_license | ###############################
# Programmer: Kenneth Sinder
# Date: June 4, 2015
# Filename: threads.py
# Description: Thread Subclasses
###############################
import socket
import threading
CONTINUE = ['CONTINUE']
EXIT = ['EXIT']
class AIThread(threading.Thread):
def __init__(self, aiClass, responseQ... | true |
ab63193668f312194e3ad700695f028065f0771e | JacobWeinhold/cs50.io_content | /pset6/mario.py | UTF-8 | 626 | 3.25 | 3 | [] | no_license | import cs50
def main():
while(True):
print("Height: ", end="")
height = cs50.get_int()
if height >= 0 and height <= 23:
break
for i in range(height):
blanks = height-(i+1)
for j in range(blanks):
print(" ", end="")
for k in range(i+1):
... | true |
7bc7734ab82230dc7e3dad1f59e06c7fda046859 | ADesoutter/src-python | /carte.py | UTF-8 | 488 | 3.84375 | 4 | [] | no_license | # cette classe est utilisée par `12-classes.py`
class Carte:
def __init__(self, couleur, symbol, rang):
self._couleur = couleur
self._symbol = symbol
self._rang = rang
def plus_grand_que(self, c):
return self._rang > c._rang
def plus_petit_que(self, c):
return self... | true |
058603abd93fa2b6e32dd01e358b5391d42306a1 | ShwarzeWolf/MLContest | /L.py | UTF-8 | 574 | 3.5 | 4 | [] | no_license | K = int(input())
N = int(input())
data = [[] for i in range(K)]
for i in range(N):
currentX, currentY = input().split()
x = int(currentX) - 1
y = int(currentY)
data[x].append(y)
result = 0.0
for i in data:
numberOfElements = len(i)
if (numberOfElements != 0):
sumOfS... | true |
2d7836ec5329101e5c6a379915f84174866430bb | cheddalu/py4e | /2-4.py | UTF-8 | 265 | 3.859375 | 4 | [] | no_license | # assign the 2 variables, 1 int and 1 float value
width = 17
height = 12.0
# width//2
# width/2.0
# height/3
# 1 + 2 * 5
print('width//2')
print(width//2)
print('width/2.0')
print(width/2.0)
print('height/3')
print(height/3)
print('1 + 2 * 5')
print(1 + 2 * 5)
| true |
9b2ebd59ed7cfd6004e45f471f7f4ce11e7a801e | fvelizs/Basic_python | /algoritmo_busqueda_binaria_raiz.py | UTF-8 | 657 | 3.640625 | 4 | [] | no_license | def run ():
objetivo = int(input("ingrese numero: "))
epsilon = 0.000000000001
alto = objetivo
bajo = 0.0
respuesta = (bajo + alto)/2
if objetivo <= 0:
print("los numeros negativos no tienen raices reales")
else:
while abs(respuesta**2 - objetivo) >= epsilon:
... | true |
3813095c28a4650c99c3e060278f4029877e45de | westmark/maeve | /src/maeve/utils.py | UTF-8 | 3,618 | 2.515625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from calendar import Calendar
from datetime import datetime, timedelta, date
from google.appengine.ext.ndb import model
import os
import re
import time
import json
monday_calendar = Calendar(0)
def slugify(inStr):
removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from", "... | true |
5420ab3bdc814e5c278e227dc7bad4f75843b786 | dilshan3/Software-Development-Automation | /src/main/java/com/myprojcet/sdaproject/Component1/TimePredict_research.py | UTF-8 | 1,400 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[12]:
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
import sys
import os
import numpy as np
#load dataset
data = pd.read_csv(r'.\\src\\main\\java\\com\\myprojcet\\sdaproject\\Component1\\dataSet_timeforecast.csv')
#view dataset
data
... | true |
c850c0e2d729b3b3ae98857e4b67b87df4f97560 | zhulf0804/Coding.Python | /codeforces/982A_Row.py | UTF-8 | 454 | 3.296875 | 3 | [] | no_license | n = int(input())
seating = input()
l = 0
ok = True
for i in range(n):
if seating[i] == '1':
l = i + 1
if i < n - 1 and seating[i + 1] == '1':
print("No")
ok = False
break
else:
nums = i - l + 1
if nums >= 3 or (i == n - 1 and nums == 2) or (i =... | true |
662a875549c5cf7034ada4bbeed8a002c4702950 | tpracser/PracserTamas-GF-cuccok | /week-04/day-1/01_io/crypto_4encoded.py | UTF-8 | 533 | 3.59375 | 4 | [] | no_license | # Create a method that decrypts texts/encoded_zen_lines.txt
def decrypt(file_name):
file = open(file_name, "r")
lines = file.readlines()
file.close()
output = ""
for line in lines:
for i in line:
if i == " " or i == "\n":
output += i
else:... | true |
6646172f894cf2a1b297fbd2e034ecc6d96f710c | janenicholson1/Python | /class.py | UTF-8 | 452 | 3.375 | 3 | [] | no_license |
class ONS:
def message(self):
print("hello my friend")
self.add (7,2)
def add(self,A,B):
C = A + B
print("Result: %d" %C)
self.mult (7,3)
#def mult(self,A,B):
#C = A * B
#print("Result: %d" %C)
def mult(self,A=0,B=0,C=1):
D=A+B+C
print("Result: %d" %D)
self.Add (3,2,5... | true |
b555cac5dacd66cad0d986da31a42c009fdf2d01 | ferranmesas/AdventOfCode2017 | /13-packet-scanners/solve.py | UTF-8 | 331 | 2.765625 | 3 | [] | no_license | import re
import fileinput
firewalls = []
for line in fileinput.input():
[l, r] = map(int, line.strip().split(': '))
firewalls.append((l, r))
total = 0
for offset in range(10000000):
for l, r in firewalls:
if (offset + l) % ((2 * r) - 2) == 0:
break
else:
print(offset)
... | true |
f7559d048d0909eca113ab160ea27212aa72c9ce | wblachowski/camculator | /training/train.py | UTF-8 | 2,931 | 2.828125 | 3 | [] | no_license | import argparse
from os import listdir
from os.path import isfile, join
import cv2
import keras
import numpy as np
import sklearn.model_selection
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Dense, Dropout, Flatten
from keras.models import Sequential
LABELS_DICT = {'0': 0, '1': 1, '2': 2, '3... | true |
c3e2ca6878c86acd8ed6b72ff9197b891c3cf6d0 | antoinewg/HashCode2020 | /algo1.py | UTF-8 | 2,569 | 2.609375 | 3 | [] | no_license | from classes import Library, NotFoundError
from utils import get_best_library
from books import get_books_to_scan
import time
from pathlib import Path
from operator import itemgetter
def handle(lines):
num_books, num_libraries, total_days = list(map(int, lines[0].split()))
book_scores = list(map(int, lines[1].... | true |
71b3384d2e5dfab748911ac3a8bd085f40a5e887 | Zichuanyun/go-shuati | /zemiao/25.py | UTF-8 | 1,145 | 3.5 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseKGroup(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
def leng... | true |
434d41149892ef90d834c97c534ace02e8c27c5e | colinaardsma/baseball | /gqlqueries.py | UTF-8 | 1,549 | 2.734375 | 3 | [] | no_license | from dbmodels import Users, Blog #import Users and Blog classes from python file named dbmodels
from google.appengine.ext import db
import logging
def get_posts(limit=None, offset=0, user=""):
logging.error("DB QUERY")
if user:
query = Blog.all().filter("author", user).order("-created") # .all() = "SE... | true |
0257cb9db37ebd7fae5ec96bff32791c097fd906 | kor1999/dslab | /send_file.py | UTF-8 | 520 | 2.75 | 3 | [] | no_license | import socket
import time
import sys
import os
file, addr, port = sys.argv[1], sys.argv[2], int(sys.argv[3])
s = socket.socket()
s.connect((addr,port))
f = open (file, "rb")
encoded_file = bytes(file, 'utf-8')
b = bytearray()
for i in range(100 - len(encoded_file)):
b.append(0)
b += encoded_file
s.send(b)
si... | true |
029d0385be337ddf9989b7d1e973978769029d84 | Topological-SLAM/Theano-LtRRE | /mnist.py | UTF-8 | 8,395 | 2.921875 | 3 | [] | no_license | """
Demonstration of incorporating a memory module into a standard classification
network.
Base code for getting mnist up and running courtest of the Lasagne mnist
examples: https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py
"""
import os
import sys
import time
import numpy as np
import thea... | true |
ecc2f0e29a842b9a88dc3b2f68a4b13629bea39a | iammiori/Algorithm_study | /old/baekjoon/boj_1350.py | UTF-8 | 595 | 3.53125 | 4 | [] | no_license | import sys
input = sys.stdin.readline
# 디스크 공간의 개수를 구하는 함수
def diskSpace(file,cluster):
total = 0
for i in file :
# 파일사이즈가 0이거나 클러스터 크기랑 같을때
if i % cluster == 0 :
total += i//cluster
# 그 외에는 몫 + 1
else:
total += i//cluster + 1
return total
n = int(input())
file = list(map(int,input().split()))
clus... | true |
ba0b60274384dc577ff1599bfbec29c2c174aa15 | HvaiY/PythonLine | /Python基础/源码/01_Python基础/dh_04_变量.py | UTF-8 | 393 | 3.828125 | 4 | [] | no_license | # 赋值方式创建变量 变量名只有在第一次出现的
# 时候,才是定义变量,再次出现那就不是定义变量了而是使用变量
qq_number = "123456789"
print(qq_number)
# 另外一个变量赋值创建
qq_password = "Ben"
print(qq_password)
print("__________________"*10)
# 买苹果
price = 8.5
weight = 7.5
money = weight * price
# 得到结果
print(money)
| true |
6e60e8d9244a40b8f518af258d96c1b93a41bfed | surabhiiyer/GoldenGlobes | /src/WinnersData.py | UTF-8 | 8,616 | 2.78125 | 3 | [] | no_license | # WinnersData.py contains all the reg ex for finding winners for each category.
# It also contains the nominees for each category
import re
nomineesMovieDrama = ['Argo', 'Django Unchained', 'Life of Pi', 'Lincoln', 'Zero Dark Thirty']
nomineesMovieComedy = ['Les Miserables', 'The Best Exotic Marigold Hotel', 'Moonris... | true |
13abdf9f7549305a355b56fbeb0986c89da8155e | rutherfordcraze/words | /words.py | UTF-8 | 934 | 3.34375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | import json, operator
from sys import version_info
from random import randint
py3 = version_info[0] > 2
minLength = 2
output = []
if py3:
letters = input("Characters to include: ")
else:
letters = raw_input("Characters to include: ")
if py3:
minLength = int(input("Minimum word length: "))
else:
minLength = int(... | true |
8d18ea29064528643fcba8c39cb7c077df00591c | AntonChernyshovDolgopa/PY-5_HW_2.3 | /hw_2.3_1.py | UTF-8 | 905 | 3.15625 | 3 | [] | no_license | import chardet
import json
import re
from collections import Counter
from html.parser import HTMLParser
def get_file():
file = input ()
with open(file, 'rb') as f:
data = f.read()
result = chardet.detect(data)
s = result['encoding']
json_file = open(file, encoding = s)
... | true |
8e731df36c56f0259c28bd8ad3700b4e2b026eea | jua16073/compis | /tablas.py | UTF-8 | 18,263 | 2.65625 | 3 | [] | no_license | import sistema_de_tipos as tables
from DecafVisitor import DecafVisitor
DEFAULT_TYPES = {
'int': 4,
'boolean': 4,
'char': 4,
}
class MyDecafVisitor(DecafVisitor):
def __init__(self):
DecafVisitor.__init__(self)
self.scope_ids = 0
self.symbols_ids = 0
self.offset = 0
... | true |
1ec1e3479fe0a7068cff5d4a71fe166d146b9763 | DishantK1807/Leetcode-Practice | /189 - Rotate Array/PythonSolution.py | UTF-8 | 459 | 2.84375 | 3 | [] | no_license | class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
temp = 0
length = len(nums)
if k > length:
k -= length
if k == length:
k = 0
for i in range(k):
... | true |
c801e2e6b998c7950491a718ac490b7fa4e80a45 | gschen/where2go-python-test | /1906101011 周远杰/第十四周02.py | UTF-8 | 912 | 3.8125 | 4 | [] | no_license | #假设 a b c d e 代表1~9不同的5个数字(注意是各不相同的数字,且不含0)
#能满足形如: ab * cde = adb * ce 这样的算式一共有多少种呢?
#请你利用计算机的优势寻找所有的可能,并回答不同算式的种类数。
#满足乘法交换律的算式计为不同的种类,所以答案肯定是个偶数。
#因为 36 * 495 = 396 * 45 = 17820
#类似这样的巧合情况可能还有很多,比如:27 * 594 = 297 * 54
#思路:循环遍历。
#答案:142
n=0
for a in range(1,10):
for b in range(1,10):
for c in range(1,10... | true |
1449b612e9e6a52e1a0dc849b96a4d48a12dfa37 | ines-san/lesson1 | /HW2.py | UTF-8 | 187 | 3.59375 | 4 | [] | no_license | secret = 4
guess = int(input("Make your guess: "))
if guess == secret:
print("Congratulations, your guess was correct!")
else:
print("Sorry, your guess was incorrect.")
| true |
95cb53fe59940ebde58f580fb530eaa371cd2228 | bruceweir/neural-network-genetic-algorithm | /tests.py | UTF-8 | 20,271 | 3.015625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 10 15:38:41 2017
@author: bruce.weir@bbc.co.uk
"""
import tensorflow as tf
from network import Network
from optimizer import Optimizer
from train import Train
from network_compiler import Network_Compiler
import numpy as np
def test_network():
print('network.ad... | true |
c5e0d0b38be91a3e480f873167f31cbc94ed4979 | KoretsuNobuyasu/started_Python3 | /Interpreter/System/tcp_client.py | UTF-8 | 435 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# Created by nobuskate on 2018/01/19.
# import
import socket
from datetime import datetime
address = ('localhost', 6789)
max_size = 1000
print('Starting the client at', datetime.now())
client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
client.connect(address)
clien... | true |
7b8075155d4c58abfcd70e580a9f3f6f6d8185a5 | Jeffrey1202/comp9021 | /Sample questions/sample_3.py | UTF-8 | 1,793 | 3.84375 | 4 | [] | no_license | '''
Given a word w, a good subsequence of w is defined as a word w' such that
- all letters in w' are different;
- w' is obtained from w by deleting some letters in w.
Returns the list of all good subsequences, without duplicates, in lexicographic order
(recall that the sorted() function sorts strings in lexicographic... | true |