blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
cf8a206bd2639084dca2db1e5cbb7ceec80c855c | Python | Yanmo/language.processing | /py/q004.py | UTF-8 | 1,012 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import codecs
import io
# for python 2.x
# sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
# for python 3.x
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
#"Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign ... | true |
efd11a9778ade94b89315001ac7767c72640fbeb | Python | yshaath/pyzkaccess | /tests/test_exceptions.py | UTF-8 | 818 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from pyzkaccess.exceptions import ZKSDKError
class TestZKSDKError:
def test_init__should_initialize_right_parameters(self):
obj = ZKSDKError('my message', -5)
assert obj.msg == 'my message'
assert obj.err == -5
@pytest.mark.parametrize('errno,description', (
(-... | true |
4c1404e818a669b257840092e6a1678bac0f71d1 | Python | jackharrhy/muntrunk | /muntrunk/types.py | UTF-8 | 6,046 | 2.78125 | 3 | [] | no_license | from dataclasses import dataclass
from pydantic import BaseModel
from typing import Any, List, Optional, ForwardRef
Campus = ForwardRef("Campus")
class CommonTypes(BaseModel):
campuses: dict
instructors: dict
buildings: dict
rooms: dict
sessions: dict
subjects: dict
common_types = CommonTyp... | true |
d070beaaf8cc604e846d0065a08e94ac8b1e6703 | Python | gtracy/twilio-demo | /app_engine/twilio/rest/resources.py | UTF-8 | 44,928 | 2.515625 | 3 | [
"MIT"
] | permissive | import datetime
import logging
import twilio
from twilio import TwilioException
from twilio import TwilioRestException
from urllib import urlencode
from urlparse import urlparse
# import json
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
from django... | true |
e5b19f33035f5d23e52e54c8c11886691b73c102 | Python | idaholab/raven | /ravenframework/MessageHandler.py | UTF-8 | 13,660 | 2.59375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | # Copyright 2017 Battelle Energy Alliance, LLC
#
# 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 law or agreed t... | true |
33aaf4c67dafb51cde212cf93c2cd1bc22cc9fb1 | Python | clglon/learning_python | /at_seq.py | UTF-8 | 843 | 3.53125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import random
#random.seed(1) # comment-out this line to change sequence each time
# Write a program that stores random DNA sequence in a string
# The sequence should be 30 nt long
# On average, the sequence should be 60% AT
# Calculate the actual AT fraction while generating the sequence
# Rep... | true |
0b4e986b480b00ae10bcd22808034343ed3cb43c | Python | vigneshwaran444/python-folders | /2020/decisionTree-master/decisionTree-master/globalFunc.py | UTF-8 | 5,994 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import pandas
import math
def calculate_info_d(data):
dem = (len(data))
num = []
targets = data.unique()
value = 0.0
for target in targets:
val = (len(data[data == target]))/dem
val *= math.log(val,2)
value -= val
return value
def info_d_for_nominal_a... | true |
ecd8911e805a3e83c66f2148af8224920e2c0627 | Python | gamerdonkey/turtle_python | /turtle_svg.py | UTF-8 | 1,541 | 3.34375 | 3 | [] | no_license | import math
import svg
import sys
from turtle import *
speed(1)
bgcolor("black")
pencolor("orange")
def go_to_coord(dest_x, dest_y, draw = True):
dest_y = -dest_y
delta_x = dest_x - xcor()
delta_y = dest_y - ycor()
if(abs(delta_x) < 1 and abs(delta_y) < 1):
return
if draw:
pendown()
... | true |
79a9a4dbeb37dfcee0a37d71de92b59c4fb00093 | Python | calebshortt/pwanalysis | /engine/validation.py | UTF-8 | 2,916 | 2.78125 | 3 | [] | no_license |
import os
import logging
from sklearn.svm import OneClassSVM
from pathlib import Path
import settings
from engine.utils import get_file, load_obj, save_obj
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG if settings.DEBUG else logging.ERROR)
class PasswordVerifier(object):
class... | true |
3b8d2c6bf70392f7aea7fa1c95f412f722c3fee0 | Python | chujiwu/MyTools | /excelop/exceloperator.py | UTF-8 | 2,121 | 3.15625 | 3 | [] | no_license | from openpyxl import load_workbook
from openpyxl.worksheet import Worksheet
class ExcelSheet(object):
def __init__(self, ws: Worksheet):
self._ws = ws
def load_value(self, column_name):
res = []
tar_column_index = -1
combine_value = None
for row in self._ws:
... | true |
9d1c99ae7d4146abc852a3be3c38e4d204d3dd93 | Python | Fashad-Ahmed/DataStructures-and-Algorithm- | /Data Structures/2-Arrays/Arrays.py | UTF-8 | 429 | 3.421875 | 3 | [] | no_license | # Q NO.1
exp = [2200,2350,2600,2130,2190]
print(exp[1] - exp[0]); print(exp[0]+exp[1]+exp[2])
for i in range(len(exp)):
if exp[i] == 2000:
print(i)
exp.insert(5,1980)
exp[3] = exp[3] + 200
print(exp)
# Q NO.2
heros=['spider man','thor','hulk','iron man','captain america']
print(len(heros))
heros.insert(... | true |
1831e77e2b810b70e6ddbc8157d22e464bfa3448 | Python | scdickson/Argonath | /calibrate_distance.py | UTF-8 | 1,032 | 3.328125 | 3 | [] | no_license | #Tiny script to check if the distance sensor is working and calibrate the distance from the sensor to the garage door
import RPi.GPIO as GPIO
import time
import sys
TRIG = 23
ECHO = 24
def measure_distance():
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
GPI... | true |
a2287de3d421d414fc08d250b231995110ff1e61 | Python | Nisarg851/python-socket | /server.py | UTF-8 | 2,098 | 3.09375 | 3 | [] | no_license | import socket
import threading
port = 5050
ip = socket.gethostbyname(socket.gethostname()) #gets the IP of Host machine
print(ip)
addr = (ip,port)
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) #creates a socket-> family AF_INET(IPV4) and SOCK_STREAM(TCP)
server.bind(addr) ... | true |
91783969f8fa1636ea764aa75208f75f07f03f3e | Python | Rutie2Techie/Hello_python | /function/map_sqaure.py | UTF-8 | 363 | 4.09375 | 4 | [] | no_license | #calculate square of numbers using map function
def calsquare(num):
return num*num
number=[2,4,6,8]
result=map(calsquare,number)
print(result)
#converting map object to tuple
numsquare=tuple(result)
print(numsquare)
#
#number=[2,4,6,8]
#result=map(lambda x:x*x,number)
#print(result)
#converting map object to tuple... | true |
2acdab00919d22308085a7ac53981cc880edb525 | Python | ptyshevs/expert_system | /es.py | UTF-8 | 13,585 | 3.421875 | 3 | [] | no_license | import argparse
import string
import sys
from Fact import Fact
class Operator:
precedence_map = {'<=>': 1, '=>': 2, '^': 3, '|': 4, '+' : 5, '!': 6, '=': 0}
# assoc_map = {'+': 'left', '-': 'left', '*': 'left', '/': 'left', '%': 'left',
# '^': 'right', '=': 'right', '**': 'left', '?': 'left'}... | true |
97b58a9e05c619791170611b744ffc47de502e5f | Python | lg0killer/goodwe | /goodwe/modbus.py | UTF-8 | 2,913 | 2.84375 | 3 | [
"MIT"
] | permissive | import logging
from typing import Union
logger = logging.getLogger(__name__)
MODBUS_READ_CMD: int = 0x3
MODBUS_WRITE_CMD: int = 0x6
MODBUS_WRITE_MULTI_CMD: int = 0x10
def _create_crc16_table() -> tuple:
"""Construct (modbus) CRC-16 table"""
table = []
for i in range(256):
buffer = i << 1
... | true |
d3f32a9b72e8e742a8e69e553e72a7622250981f | Python | ademuri/x-carve-tools | /spoilboard/generate_grid.py | UTF-8 | 1,592 | 2.640625 | 3 | [] | no_license | f = open("grid.nc", "w")
width = 700
height = 700
grid_spacing = 10
major_label_spacing = 50
tick_height = 5
offset_x = 14
offset_y = 18
feed_rate = 1500
z_high = 5
z_low = 0
f.write("; Y lines\n")
forward = True
for x in range(offset_x, width + offset_x + grid_spacing, grid_spacing):
f.write(f"G00 Z{z_high}\n"... | true |
9d8e2da75dd78c206151ef561721026117fe4e33 | Python | Cloudxtreme/dssaas | /dss-side-scripts/gen_zipf_dist_jmeter.py | UTF-8 | 573 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import os
from subprocess import call
maxfilename = 200
maxnumfiles = 200 # num files tbc
param = 1.1
s = np.random.zipf(param, maxnumfiles*3)
call(["touch", "filenames.txt"])
f = open('filenames.txt', 'w')
created = 0
i=0
while created < maxnumfiles:
if (int(s[i])<=maxfilename):
... | true |
de4b31c35f5536edc86abffde6a305cecd7597a8 | Python | paulyyi/Scripts | /doubleshell.py | UTF-8 | 1,686 | 2.71875 | 3 | [] | no_license | #creates 2 shells on target
#one is used to setup a remore port forward using plink, which will kill the shell
#the other can be used to setup a socks proxy with powershell, to pivot into target network
import os,socket,subprocess,threading;
def ss2pp(ss, pp):
while True:
data = ss.recv(1024)
if... | true |
f85cbd4b1f640f4ae5c2e24188d42a4116784a33 | Python | chuckma/pythondemo | /collections/chaper2/tuple_test.py | UTF-8 | 520 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 11:27
# @Author : Administrator
# @Site :
# @File : tuple_test
# @Software: PyCharm
name_tuple = ("boy1", "boy2")
# tuple 拆包
user_tuple = ("bobb1", 24, 170, "杭州",)
# name, age, height = user_tuple
name, *other = user_tuple
print(name, other)
# t... | true |
f083b2cb4d97d19387a4984eb8e95e3eea2d61f2 | Python | patrickhop/tc | /enlitic_1.py | UTF-8 | 1,304 | 3 | 3 | [] | no_license | # find min-subsequence of length two s.t elements of subsequence are non-adjacent
# endpoints aren't of interest. we can safely exclude them from sequence, and base-case computation
# n = 1 (no sol: no subsequence of length two)
# n = 2 (no sol: elements of subsequence must be adjacent)
# n = 3 (sol : opt = [(A_0, 0), ... | true |
3788accd6569f334e6db1621347bb236292f6227 | Python | CatarauCorina/creativai | /finetune_fasterrcnn/utils.py | UTF-8 | 6,780 | 2.96875 | 3 | [] | no_license | import torch
def non_max_suppression(prediction, num_classes, conf_thres=0.5, nms_thres=0.4):
"""
Removes detections with lower object confidence score than 'conf_thres' and performs
Non-Maximum Suppression to further filter detections.
Returns detections with shape:
(x1, y1, x2, y2, object_conf... | true |
fcfb3af8cc947cff30931573c8959a73c560248b | Python | Treinamento-Stefa-IA-DevOps/treinamento-dia-04-08-vitorrangelcs | /docker_tutorial/flask_example/app/flask_app.py | UTF-8 | 608 | 2.953125 | 3 | [] | no_license | from flask import Flask
import os
import psycopg2
app = Flask(__name__)
@app.route('/')
def hello_world():
with psycopg2.connect(f"dbname={os.getenv("DB_NAME")} user={"DB_USER"} password:{os.getenv:"DB_PASS"}") as conn:
cur = conn.cursor()
cur.execute("SELECT * FROM test;")
rows = cur.fet... | true |
7a2e6b7d930c42d4015919a49bfeae1d9bed45fe | Python | jasdeep06/improving_python | /importSaga/code/sizeFunction.py | UTF-8 | 926 | 3.15625 | 3 | [] | no_license | import os
import sys
suffixes={1000:["KB","MB","GB","TB"],
1024:["KiB","MiB","GiB","TiB"]}
def approximate_size(filePath,yardstickIs1024=True):
"""
Returns approximate size of the file at file_path
:param filePath:path of the file
:param yardstickIs1024: 1kb=1024 bytes or 1000 bytes
... | true |
292eec2d9faea3e11e5199176f937491d3a0f59c | Python | BobbyHughes17/Blogz | /models.py | UTF-8 | 1,119 | 2.734375 | 3 | [] | no_license | from app import db,app
import hashlib
from datetime import datetime
class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
user_name = db.Column(db.String(120), unique = True,nullable = True)
pw_hash = db.Column(db.String(120),nullable = False)
blogz = db.relationship('Blog',backref='owne... | true |
57e97a41a808f1ee371ca64e84e25b6052c88458 | Python | slacgismo/solar-data-tools | /pvsystemprofiler/algorithms/angle_of_incidence/lambda_functions.py | UTF-8 | 3,230 | 3.125 | 3 | [
"BSD-2-Clause"
] | permissive | """
This module is used to set the hour_angle_equation in terms of the unknowns. The hour equation is a function of the
declination (delta), the hour angle (omega) , latitude (phi), tilt (beta) and azimuth (gamma). The declination and the
hour angle are treated as input parameters for all cases. Latitude, tilt and azim... | true |
e50927a2d1fa52442e3abcff85c6df6e81ce3b36 | Python | chasefrankenfeld/how_to_think_like_a_computer_scientist | /chapters14_to_16/ch16_classes_digging_deeper.py | UTF-8 | 5,382 | 3.84375 | 4 | [] | no_license | import sys
def test(did_pass):
""" Print the rests of the test """
linenum = sys._getframe(1).f_lineno # gets the callers line number
if did_pass:
msg = "Test at line {} is ok.".format(linenum)
else:
msg = "Test at line {} FAILED.".format(linenum)
print(msg)
class Point:
"""... | true |
ccffe5aea5a33a432328474f402ac7f099d2a3ef | Python | harshareddy794/assignments | /Hacker_rank/find_a_string.py | UTF-8 | 222 | 3.21875 | 3 | [] | no_license | import string
count=0
if __name__ == '__main__':
string=input()
sub_string=input()
for i in range(0,len(string)):
if(string[i:i+len(sub_string)]==sub_string):
count=count+1
print(count)
| true |
b9f35430c84c521dbdef7ac101fd47ec75696645 | Python | yxtay/how-to-think-like-a-computer-scientist | /Files/files_ex5_mystery.py | UTF-8 | 404 | 3.421875 | 3 | [] | no_license | import turtle
def draw(t, values):
if len(values) == 2:
t.goto(int(values[0]), int(values[1]))
elif values[0] == "UP":
t.up()
elif values[0] == "DOWN":
t.down()
alex = turtle.Turtle()
wn = turtle.Screen()
infile = open("mystery.txt")
line = infile.readline()
while line:
values = line.split()
draw(alex, v... | true |
109972125ac49438051f08e14145b929917d493c | Python | depchen/arithmetic | /剑指/23.py | UTF-8 | 1,671 | 3.71875 | 4 | [] | no_license | # 题目描述
#二叉搜索树 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值;
# 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值;
# 它的左、右子树也分别为二叉排序树。
# 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。
# 如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
# -*- coding:utf-8 -*-
class Solution:
def __init__(self):
self.flag=False
def VerifySquenceOfBST(self, sequence):
# writ... | true |
efabcf910a467838b3ec72e3f6ceb3d41f5f7103 | Python | jadsonlucio/EA-iqoption | /robo/web_page.py | UTF-8 | 1,216 | 2.796875 | 3 | [] | no_license | import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton,QGridLayout,QLineEdit
from PyQt5.QtWebEngineWidgets import QWebEngineView
class widget_principal(QWidget):
def __init__(self):
QWidget.__init__(self)
self.resize(250, 150)
self.move(300,... | true |
7002601cae82ca4b3cff90e71ab419f4d956af56 | Python | JeeVeeVee/univ | /1steBachelor/Scriptingtalen/Examenvoorbereiding/Diana/DianaCryptoSystem.py | UTF-8 | 1,083 | 3.25 | 3 | [] | no_license | class Diana:
def __init__(self, bestand):
self.pad = ""
file = open(bestand, "r")
alfabet = "AZERTYUIOPQSDFGHJKJKKLMWXCVNB"
for line in file:
for char in line:
if char in alfabet:
self.pad += char
def index(self, string):
s... | true |
f9bac025c77cd703ac47ea286e4f816feb1eafc1 | Python | xlincw0w/Language-identifier- | /script.py | UTF-8 | 2,016 | 3.40625 | 3 | [] | no_license | from itertools import islice
import numpy as np
import string
lang = {}
def take(n, iterable):
return list(islice(iterable, n))
def getList(dict):
list = []
for key in dict.keys():
list.append(key)
return list
def get_trigrams_freqs(text):
len(text)
freqs = {}
fir... | true |
a682a2db66c1390cfe4d5b5533a54378c1300ba8 | Python | Crypto-Dimo/workbook_ex | /chapter_three/ex_80.py | UTF-8 | 313 | 4.0625 | 4 | [] | no_license | n = int(input('Enter a number that is >= 2: '))
factor = 2
active = True
if n < 2:
active = False
print('Invalid value.')
else:
print(f'The prime factors of {n} are:')
while factor <= n and active:
if n % factor == 0:
print(factor)
n = n // factor
else:
factor += 1
| true |
ff69cf11f9c26fdd1fdfa5105de8b9145f35abba | Python | Eronite/pygamedemo | /niveau.py | UTF-8 | 3,516 | 3.1875 | 3 | [] | no_license | """Classes du jeu de Labyrinthe Donkey Kong"""
import pygame
from pygame.locals import *
from constantes import *
from math import *
from affichage import *
class Niveau:
"""Classe permettant de créer un niveau"""
def __init__(self, fichier,fond):
self.fichier = fichier
self.structure = 0
self.fond = fond
... | true |
0f79a5987184195177291aa8edf3ddb966eb89f8 | Python | Zibsun/lesson1 | /hello.py | UTF-8 | 33 | 2.75 | 3 | [] | no_license | name = "Асхат"
print (name) | true |
488fda17eb34fb04d475978138d05c94fbfe294f | Python | zqy0/spider | /spider_fun1.py | UTF-8 | 1,643 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-04-03 15:03:09
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
from bs4 import BeautifulSoup
html = open('test1.html', 'r', encoding='utf-8')
def html_to_csv(html = html):
soup = BeautifulSoup(html, "lxml"... | true |
fd047568dc16dbd8131fe4808a1e2e20fd0a7196 | Python | MacHu-GWU/Dev-Exp-Share | /docs/source/02-SDE/01-Program-Language/02-Python-Root/10-Manipulate-PDF-in-Python/pikepdf/test.py | UTF-8 | 399 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from pathlib import Path
from pikepdf import Pdf, PdfImage
dir_here = Path(__file__).absolute().parent
path_w2_pdf = dir_here.parent / "w2.pdf"
pdf = Pdf.open(f"{path_w2_pdf}")
for page_num, page in enumerate(pdf.pages, start=1):
# split page
dst = Pdf.new()
dst.pages.append(page... | true |
989a1cf8e8192ddc0a650197c089aa5543b9550a | Python | ssehuun/langStudy | /baekjoon/11654.py | UTF-8 | 87 | 2.71875 | 3 | [] | no_license | # https://www.acmicpc.net/problem/11654
# 아스키 코드
a = input()
print(ord(a))
| true |
a72e0f000a7aeb985531d6a52d0622b4bdc0ce2a | Python | graysoncroom/PythonGraphingPlayground | /histogram.py | UTF-8 | 325 | 3.40625 | 3 | [] | no_license | #!/bin/python
import matplotlib.pyplot as plt
population_ages = [22, 55, 62, 45, 34, 77, 4, 8, 14, 80, 65, 54, 43, 48, 24, 18, 13, 67]
min_age = 0
max_age = 140
age_step_by = 20
bins = [x for x in range(0, 141, 20)]
plt.hist(population_ages, bins, histtype='bar', rwidth=0.8)
plt.xlabel('x')
plt.ylabel('y')
plt.sh... | true |
1243cb2b933a375c46b182f71f77947cf9ce6355 | Python | azeembootwala/DesignPatterns-Deep-learning | /Chapter 1 Neural Networks/multi_label_model_branching.py | UTF-8 | 808 | 3.046875 | 3 | [] | no_license | import numpy as np
from tensorflow.keras import Model, Input
from tensorflow.keras.layers import Dense
def model_branch():
# An example of how a model structure looks for a branched NN
input_shape = (3,)
inputs = Input(input_shape)
x = Dense(10, activation = 'relu')(inputs)
x = Dense(10, activa... | true |
3534cdbb5793414a88cbe20367836b8fa8198303 | Python | krikui/Test_repo | /test.py | UTF-8 | 233 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python
import sys
print('Number of arguments:', len(sys.argv), 'arguments')
type(sys.argv)
print(str(sys.argv))
print("Help\n")
raw_input("\n\nPress the enter key to exit.")
x = 'foo'; sys.stdout.write(x+'\n')
sys.exit(0) | true |
283ee6e0e1e6c4294f0080a98310693db0a813d5 | Python | tzuhwan/dna-count | /myapp.py | UTF-8 | 2,067 | 3.5625 | 4 | [] | no_license | #############################
# Import libaries
#############################
import pandas as pd
import streamlit as st
import altair as alt
#############################
# Page Title
#############################
st.write("""
# DNA Nucleotide Count Web App
This app counts the nucleotide composition of query DNA
... | true |
abf1b636e3aee9ea123f69a4a1ff5c9f637b2280 | Python | SamAndrew27/poker-capstone | /src/datacleaning/columns_from_hand_history.py | UTF-8 | 22,939 | 3.328125 | 3 | [] | no_license | import pandas as pd
def fill_HH_columns(df):
"""takes in dataframe and uses HandHistory column to create the below features
Args:
df (DataFrame): Dataframe created using SQL DriveHud backup
Returns:
DataFrame: same as dataframe input with additional columns
"""
df['buyin'] =... | true |
dd131b4529eceb1fb14c02010b498f83e901062d | Python | mkozel92/algos_py | /graphs/connected_components.py | UTF-8 | 1,418 | 3.59375 | 4 | [] | no_license | from graphs.graph_interface import Graph
class ConnectedComponents(object):
"""class to compute connected components of given graph"""
def __init__(self, g: Graph):
"""
init with a graph
:param g: Graph
"""
self.g = g
self.visited = [False] * self.g.get_size()
... | true |
00ae973ba7e29f94f79273e2b6beb956c2120ecf | Python | fucusy/cs224d-dp-for-nlp | /q1_softmax.py | UTF-8 | 3,290 | 3.515625 | 4 | [] | no_license | import numpy as np
import random
from q2_gradcheck_fuc import gradcheck_naive
def softmax(x):
"""
Compute the softmax function for each row of the input x.
It is crucial that this function is optimized for speed because
it will be used frequently in later code.
You might find numpy functions np.ex... | true |
413b550ca29cc3258ee5e2a9eb7885ec8d7a523c | Python | ShaimaAnvar/python-challenge | /1.py | UTF-8 | 317 | 3.265625 | 3 | [] | no_license | n=int(input())
d={}
for i in range(n):
key,value = input().split(" ")
d[key]=value
querries = []
inp = input()
while len(inp)>0:
querries.append(inp)
inp=input()
for i in range(len(querries)):
if querries[i] in d:
print(querries[i]+"="+d[querries[i]])
else:
print("Not found")
| true |
b045c9a45e036fe1a2ef007168a17ffc2a4a6aae | Python | MistyLeo12/small-projects | /web-scrapers/drink-scraper.py | UTF-8 | 345 | 2.796875 | 3 | [] | no_license | """
Web Scraper for getting drinks dat to add to my random drink recepie project
"""
import requests
def scraper(url):
res = requests.get(url)
text = res.text
status_code = res.status_code
print(status_code)
return (text, status_code)
scraper('https://www.esquire.com/food-drink/drinks/g32402... | true |
9887ea36a28a911fcaf11a717177e37b35849ec9 | Python | bozso11/playground | /getGoogleData.py | UTF-8 | 3,236 | 2.984375 | 3 | [] | no_license | import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.finance import candlestick_ohlc
import matplotlib.dates as mdates
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
###################### Intro and Getting Stock Price Data - Python Programm... | true |
5d5f0c9feba8b9f528e899bbba827500e9a1ae53 | Python | swetasuman94/Machine-Learning | /Neural_network_model_on_Banknote_Authentication/ScikitLearnLab_part2.py | UTF-8 | 2,491 | 3.109375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import classification_report,confusion_matrix
class NeuralNet:
def __init__(se... | true |
8ad7d1ea5b6dc0d83ab423ad0057be2d44e660f2 | Python | mik-laj/docker-swarm-gcp | /app.py | UTF-8 | 552 | 2.546875 | 3 | [] | no_license | from flask import Flask
from flask import jsonify
from flask import request
import os
import socket
app = Flask(__name__)
@app.route("/ip", methods=["GET"])
def get_my_ip():
resp = {}
resp['ip'] = request.remote_addr
if request.environ.get('HTTP_X_FORWARDED_FOR') is not None:
resp['for'] = reques... | true |
2bfb908d6e75af6dc620d084f5998fb3b00fbcca | Python | pawdon/software_engineering | /optimizer_module/greedy_optimizer_file.py | UTF-8 | 8,787 | 2.921875 | 3 | [] | no_license | from .abstract_optimizer_file import IOptimizer
from .shipments_manager_file import ShipmentsManager, Shipment, PlacedContainer, CornerPosition
from containers_module.containers_manager_file import ContainersManager
class GreedyOptimizer(IOptimizer):
"""
A greedy optimize class.
"""
def __init__(self)... | true |
cf7ea6439e36a09995fe4797151820cf5484532e | Python | edwgk/Python_class | /unit_1_example07_function.py | UTF-8 | 375 | 2.984375 | 3 | [] | no_license | def saludar(nombre,mensaje='msj por defecto'):
#mspor defecto por si falta un parametro
#msj por defecto van despues de argumentos que no tengan msj x defecto
print(mensaje,nombre)
return mensaje + '_' + nombre
cadenaCaracteres=saludar('Oscar','Mensaje prueba')
print(cadenaCaracteres)
cadenaC... | true |
295be3d5a4769f2eaedba8aca9a72fc0e53670b3 | Python | aparrish/characterror | /game.py | UTF-8 | 26,177 | 2.59375 | 3 | [
"MIT",
"CC-BY-3.0",
"CC-BY-4.0",
"ISC",
"Apache-2.0"
] | permissive | # Copyright (c) 2011, Adam Parrish <adam@decontextualize.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" A... | true |
d5452f3967c5522801229bfa010d2f84f9f57391 | Python | luozhouyang/matchpyramid | /mp/models.py | UTF-8 | 5,810 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 luozhouyang
#
# 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 law or agreed to in writing, ... | true |
9d824c85ed90c2972c8936e67d1e6365b7f7775e | Python | stevie-h/19.7.2021 | /math_utils.py | UTF-8 | 300 | 3.515625 | 4 | [] | no_license | # ex23
def compare(x, y):
if x > y:
return x
elif y > x:
return y
else:
raise Exception("Numbers are equal")
def three_multiple(x):
if x % 3 == 0:
return True
else:
return False
def power(a, n):
return a ** n
| true |
f0059d3fc99cbdbbef11373b865b9772a69f0c53 | Python | Akhilchowdary97/p3 | /p3/views.py | UTF-8 | 1,672 | 2.953125 | 3 | [] | no_license | from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return HttpResponse("<marquee>Hello ,Welcome To p3 Project</marquee>")
def home(request):
return render(request,"simple.html")
def second(request):
return render(request,"directory/second.html")
def third(request):
... | true |
ad0b0f4611fd6f19452b1e7cb010dfb6e4dcf5ed | Python | rwolst/pandas-merge-product-sum | /merge_product_sum/tests/test_mps.py | UTF-8 | 7,121 | 2.84375 | 3 | [
"MIT"
] | permissive | import pytest
import pandas as pd
import numpy as np
import scipy as sp
import scipy.sparse
from merge_product_sum.mps import (merge_product_sum, to_sparse,
multiply_sparse, reverse_index_map)
@pytest.fixture()
def df1():
df = pd.DataFrame([
[20160404, 'Jo... | true |
aafc71816f029dfcd91adbcfd725ea8f8bce19c5 | Python | veltadestiana/Data-Structure | /Tutorial 1/Tutorial 1 Solution/Tutorial1.py | UTF-8 | 1,616 | 3.78125 | 4 | [] | no_license | """Tutorial 1"""
# Name: [fill in your name here]
# NPM: [fill in you NPM here]
from tkinter import *
def loadMap(filename):
# Loads .map file, filters numbers only and returns a 2D array
# [TO DO]
rawfile = open(filename)
file = (rawfile.read())
file = list(filter(lambda x: x.isdigit(), file))
... | true |
e2443de536e43569e62899b4a6693cab13c540a6 | Python | mozaiques/zombase | /tests/test_config.py | UTF-8 | 1,915 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
import tempfile
import unittest
from zombase import config
class AbstractTestConfig(object):
def test_common(self):
self.assertEqual(self.a_config['KEY_ONE'], 'blaé')
self.assertEqual(self.a_config['KEY_TWO'], 12)
with self.assertRaises(config.ConfigEr... | true |
8bd194e3f98c1f4395c5d200013cef8053f964f8 | Python | rohitash-chandra/ld_bnn_pc | /ld_bnn_pc.py | UTF-8 | 18,430 | 2.65625 | 3 | [] | no_license | # i/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
import random
import time
from scipy.stats import multivariate_normal
from scipy.stats import norm
import math
import os
from expdata import setexperimentdata
import sys
# An example of a class
class Network:
def __init__(self, Topo, Train, Tes... | true |
70b459dec76842c983f4bb9e12983abcbe5737d1 | Python | yuseungwoo/baekjoon | /1076.py | UTF-8 | 326 | 3.609375 | 4 | [] | no_license | # coding: utf-8
color = ['black', 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'violet', 'grey',
'white']
input_list = []
for _ in range(3):
input_list.append(input())
num = ""
num += str(color.index(input_list[0])) + str(color.index(input_list[1]))
print(int(num) * 10**color.index(input_list[2]... | true |
d3a39f7e23511b50e718a68b24fe9ed528e515fe | Python | ramjet-labs/aioredis | /tests/coerced_keys_dict_test.py | UTF-8 | 1,201 | 2.8125 | 3 | [
"MIT"
] | permissive | import pytest
from aioredis.util import coerced_keys_dict
def test_simple():
d = coerced_keys_dict()
assert d == {}
d = coerced_keys_dict({b'a': 'b', b'c': 'd'})
assert 'a' in d
assert b'a' in d
assert 'c' in d
assert b'c' in d
assert d == {b'a': 'b', b'c': 'd'}
def test_invalid_in... | true |
e4a00ef6b98528f42b4d4f8447bcb62ce46829fd | Python | jiniaoxu/matchzoo-lite | /matchzoo/models/conv_highway.py | UTF-8 | 8,447 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | """An implementation of Conv-Highway Model."""
import typing
import keras
from keras import backend as K
from matchzoo import engine
from matchzoo import preprocessors
class ConvHighway(engine.BaseModel):
"""
ConvHighway Model.
Examples:
>>> model = ConvHighway()
>>> model.params['encode... | true |
d1e000c81aa47afcd2a295070019c7caa37b24b3 | Python | chahtk/algostudy | /yang/20210309/3273.py | UTF-8 | 315 | 3.046875 | 3 | [] | no_license | import sys
n=int(sys.stdin.readline())
k=list(map(int,sys.stdin.readline().split()))
x=int(sys.stdin.readline())
k.sort()
count=0
left=0
right=len(k)-1
while left<right:
tmp=k[left]+k[right]
if tmp == x :
count += 1
if tmp < x :
left += 1
continue
right -= 1
print(count) | true |
a5db23ea93a848c5f57c89db1b3dad1a3dc15fd3 | Python | rockymoran/py_work_scripts | /misc/adventure.py | UTF-8 | 763 | 3.8125 | 4 | [] | no_license | # rocco's adventure game
class Player:
def __init__(self):
self.p_name = input("Name? ")
self.stamina = 100
self.inventory = Inventory()
class Inventory:
def __init__(self):
self.equipment = "fishing pole"
self.items = ""
class Level:
def __init__(self):
... | true |
892df9c818ab97d731b782f8d8c3f8fe5580ea56 | Python | lisa906673062/webauto-1 | /ECShop_qxgl_glylb_002.py | UTF-8 | 2,151 | 2.671875 | 3 | [] | no_license | '''
新增管理员
分配权限
'''
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.maximize_window()
url = 'http://192.168.1.120/upload/admin'#后台
driver.get(url=url)
driver.implicitly_wait(10)#隐式等待
time.sleep(2)
user = 'admin'
pwd = 'banxian123'
driver.find... | true |
7c029b32a98ae130cd64185969ec50ae09d65dcc | Python | kanael/omnomnom | /munch.py | UTF-8 | 1,170 | 2.984375 | 3 | [] | no_license | import json, glob, os
def parse_price(s):
return float(str(s).replace('₪','').strip())
def munch_restaurants():
restaurants = []
for restaurant_file in glob.glob("scraps/restaurants/*"):
menu_file = restaurant_file.replace("restaurants", "menus")
restaurant_id = restaurant_file.replace("re... | true |
9054b84df3d7c88bbe6e42d41d55c06a4c549ad2 | Python | KLyudmyla/xml_analyzer | /src/xml_analyzer.py | UTF-8 | 3,895 | 2.953125 | 3 | [] | no_license | import sys
import bs4
import logging
from bs4 import BeautifulSoup
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
class XPath:
@staticmethod
def get_soup(file: str) -> BeautifulSoup:
f = open(file)
soup = BeautifulSoup(f, features="lxml")
f.close()
... | true |
f8d656f5b90fc7dd4a0c92b1d6ae8279f179b47a | Python | jjauzion/salesman_problem | /src/optimisation.py | UTF-8 | 3,619 | 3.03125 | 3 | [] | no_license | # -*-coding:Utf-8 -*
import random
import matplotlib.pyplot as plt
import time
import math
from src.city import City
from src.individual import Individual
from src.population import Population
import src.param as param
class Optimisation():
"""Class Optimisation run the genetic algorithm to solve the TSP""... | true |
1654606218f4866df09a8fee07ffa201e2a9bd28 | Python | 3esawe/Gabumon | /main/HTMLscanner.py | UTF-8 | 2,208 | 2.6875 | 3 | [] | no_license |
import requests
from bs4 import BeautifulSoup
import re
from freq.utils import writeFile
links = []
script_links = []
img_src = []
keywrods = ['a', 'img', 'script']
def source(url, out=None, js =False):
if "http://" not in url and "https://" not in url:
print("[+] You forgot to enter http:// or https://")... | true |
4d2f4c081ff066a7e3f027a883d323e8318ea378 | Python | sk39454/TD_2020_139454 | /Lab 01/Lab01.py | UTF-8 | 2,001 | 3.234375 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
import array
a=4;b=5;c=4;
delta=(b*b)+((-4)*a*c)
if delta == 0:
x1 = (-b) / (2 * a)
print('x1 = ',x1,'\n\n')
if delta > 0:
x1 = ((-b)-(math.sqrt(delta)))/(2*a)
x2 = ((-b)+(math.sqrt(delta)))/(2*a)
print('x1 = ',x1,'\n','x2 = ',x2... | true |
0073f11d8668d96bd13c6276b9ebe662ea98dc5e | Python | amritaravishankar/Hangman | /hangman_main.py | UTF-8 | 4,425 | 4.21875 | 4 | [] | no_license | import random
from words import word_list
def get_word():
word = random.choice(word_list)
return word.upper()
def play(word):
word_completion = "_ " * len(word)
not_guessed = True
guessed_words = []
guessed_letters = []
tries = 6 # (head + body + 2 hands + 2 legs)
print("\n")
pr... | true |
080ce631b7ce896d9650d31eb660b640fae0695f | Python | CRingrose94/ProjectEuler | /problems_000_099/Euler 005.py | UTF-8 | 603 | 3.890625 | 4 | [] | no_license | def check_divisibility(n):
"""Check if n is divisible by all numbers up to 20.
Being divisible by numbers 11->20 means it is implicitly divisible by numbers 1->10 too.
"""
for divisor in range(11, 21):
if n % divisor != 0:
return False
return True
def compute():
"""Calcula... | true |
da1f4c56e40aacbb29b1690a57b18b8f5a68d15a | Python | denny-Madhav/PYTHON-BASIC-PROJECTS | /list/split challenge.py | UTF-8 | 367 | 3.890625 | 4 | [] | no_license | import random
print('Hai, welcome.!! Enter names of all customers with "," in between and let me choose one customer to pay the bill. \n ')
names=input("enter here : ")
sname=names.split(",")
print("\nThe name are : ")
print(*sname,sep="\n")
limit=len(sname)
ran=random.randint(0,limit-1)
print(f"\nWell i ... | true |
580d8c3e55a8a69b0cbdfc2e60908595ace60a51 | Python | yumensiye/firstfortest | /applydata.py | UTF-8 | 331 | 2.8125 | 3 | [] | no_license | test = "[15Fall . MS . AD无奖 ] [ DateScience/Analytics @ MSDS@NYU ] - 2015-03-07 - T : 107 + G : 321 () 本科:南大,浙大,复旦,上交 , ... 2 3"
new_string = test.replace(" " , "").split("]")
univer_info = new_string[1].replace("[", "").split("@")
date = new_string[2].split("-")
print(date)
print(univer_info)
| true |
dd43b912def80fcd32d5e5ce215b9e14d86ac3d9 | Python | ronzohan/bank_app | /test/unit/account_test.py | UTF-8 | 539 | 3.25 | 3 | [] | no_license | import unittest
from bankapp.account import Account
class TestAccount(unittest.TestCase):
def test_account_object_returns_current_balance(self):
account = Account(001, 50)
self.assertEqual(account.account_number, 001)
self.assertEqual(account.balance, 50)
def test_accout_balance_is_st... | true |
1a3dd4fd8c67a1dc335f0b7423d99bda4038aaee | Python | jlmurphy3rd/code-outhouse | /StructuresInPython/src/root/nested/DictionaryExercise.py | UTF-8 | 511 | 2.859375 | 3 | [
"MIT"
] | permissive | '''
Created on May 18, 2016
@author: John
'''
name = raw_input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
counts = dict()
for line in handle:
wds = line.split()
if len(wds) < 2 : continue
if wds[0] != "From" : continue
email = wds[1]
counts[email] = counts.get(ema... | true |
6136f7f44b436c13545329d0db21fdb9565602e3 | Python | ganyc717/Gobang | /graphic.py | UTF-8 | 1,947 | 3.46875 | 3 | [
"MIT"
] | permissive | import tkinter
import config as cfg
from game import Board
class graphicBoard(Board):
def __init__(self):
super(graphicBoard,self).__init__()
self.root = tkinter.Tk()
self.root.geometry('600x600')
self.block_size = 500 // (cfg.board_size - 1)
self.board_width = self.block_s... | true |
ccdcee0ee1d67c023f28aa8f99cad03e797aeec5 | Python | tbohne/AOC17 | /day7/main.py | UTF-8 | 3,383 | 3.140625 | 3 | [] | no_license | import sys
from collections import *
import itertools
stuff = []
# Part 1
def solve_part1(arr):
sol1 = ""
for i in input:
if "->" in i:
x = i.strip().split("->")
arr.append(x)
not_in = True
for i in arr:
for j in arr:
if i != j:
if i... | true |
a484d1789683066e3c27122f15156e1c4f37b0cf | Python | KABIR-VERMA/HR-ANSWERSET | /string_perm/main.py | UTF-8 | 632 | 2.984375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'countPerms' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER n as parameter.
#
def countPerms(n):
# Write your code here
arr = [[1,1,1,1,1]]
for i in range(1, ... | true |
8abc89225335888e8c9657beadddcf71cbe5c1a8 | Python | Shawnsyx/graduation_project | /Dialogue/wo_chatbot/utils.py | UTF-8 | 667 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf8 -*-
import json
def read_json_file(file_name):
with open(file_name, 'r', encoding='utf-8') as f:
data = json.load(f)
return data
def normalize_text(text):
return text.lower()
def find_entity(text, out, id2tag):
entity = []
positions = []
i = 0
... | true |
97645399eafba8b5d98c05fd38957fc3fe68862d | Python | mohammadali110/coursera-google-it-automation-with-python | /crash-course-on-python/week3/8_next_for_loop_home_and_away_team.py | UTF-8 | 562 | 3.828125 | 4 | [] | no_license | # teams = [ 'Dragons', 'Wolves', 'Pandas', 'Unicorns']
# for home_team in teams:
# for away_team in teams:
# What should the next line be to avoid both variables being printed with the same value?
# 1. while home_team != away_team:
# 2. for home_team == away_team:
# 3. away_team = home_team
# 4. if home_team != a... | true |
dacabfc73eb0fd14655f1b4f1124259fa68816b3 | Python | martijnvanbeers/diagnnose | /test/test_activation_reader.py | UTF-8 | 3,873 | 2.640625 | 3 | [
"MIT"
] | permissive | import os
import shutil
import unittest
from typing import List, Sequence
from torch import Tensor
from diagnnose.activations.activation_reader import ActivationReader
from .test_utils import create_and_dump_dummy_activations
# GLOBALS
ACTIVATIONS_DIM = 10
ACTIVATIONS_DIR = "test/test_data"
ACTIVATIONS_NAME = "hx_l... | true |
5a0bd5c8cbd020458c635a046df3e723c22d6406 | Python | jmgraeffe/ieee802-11-simplified-mac-simulator | /simulation/__init__.py | UTF-8 | 3,732 | 2.90625 | 3 | [
"MIT"
] | permissive | from enum import Enum
from multiprocessing import cpu_count, Pool
import logging
import collections
import time
class Scheme(Enum):
DCF_BASIC = 1
DCF_NO_BACKOFF_MEMORY = 2
DCF_GLOBAL_CW = 3
CRB = 4,
TBRI = 5 # 3bRI, 3 bit of reservation information, three bit scheduling
@classmethod
def ... | true |
9471161cd0bef6ac1008befc01ab0cbc5730ea51 | Python | eyurtsev/kor | /tests/test_type_descriptors.py | UTF-8 | 3,023 | 2.96875 | 3 | [
"MIT"
] | permissive | import pytest
from kor import Number, Object, Text
from kor.nodes import Bool, Option, Selection
from kor.type_descriptors import BulletPointDescriptor, TypeScriptDescriptor
OPTION_1 = Option(id="blue", description="Option Description", examples=["blue"])
OPTION_2 = Option(id="red", description="Red color", examples=... | true |
e138fca39f8debc4be770733fc026b6c45b6b7f7 | Python | etwuerschmidt/advent-of-code | /2019/Day_2/Puzzle_2/solution.py | UTF-8 | 1,340 | 3.453125 | 3 | [] | no_license | def find_inputs(filename):
ops = reset_ops(filename)
for noun in range(0, 100):
for verb in range(0, 100):
ops[1] = noun
ops[2] = verb
if parse_op_codes(ops) == 19690720:
return 100 * noun + verb
else:
ops = reset_ops(filen... | true |
bfc0f3fd2bcc34c52edaff63b4fe0e49e20c9753 | Python | DataDog/datadog-api-client-python | /examples/v2/users/GetInvitation.py | UTF-8 | 516 | 2.5625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"MPL-2.0"
] | permissive | """
Get a user invitation returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.users_api import UsersApi
# the "user" has a "user_invitation"
USER_INVITATION_ID = environ["USER_INVITATION_ID"]
configuration = Configuration()
with ApiC... | true |
7294a89d0bb1bd9f243c7c9e36f4ac81beb8fb96 | Python | code-verse/karate_demo | /simple_python_server_sample/app.py | UTF-8 | 842 | 2.671875 | 3 | [] | no_license | from flask import Flask, request, abort
from user import User
from authentication import Authentication
from uuid import uuid4
app = Flask(__name__)
tokens = []
@app.route('/')
def index():
return 'Server Up!'
@app.route('/user/<int:user_id>')
def show_user(user_id):
auth_token = request.he... | true |
7a74108d069a1f057784e02c9074591028cb3094 | Python | JaideepBgit/MachinelearningModels | /supervised_learning_prediction.py | UTF-8 | 1,689 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 13:17:47 2020
@author: Jaideep Bommidi
"""
"""
Idea on the accuracy of the model on validation set.
So first fit the model on the entire training dataset and make predictions on the validation dataset
"""
from pandas import read_csv
from panda... | true |
c8bb2bfdeca4891e24549679c50b76f549a9c7ce | Python | KristiKovacs/ForFun | /quiz.py | UTF-8 | 711 | 4 | 4 | [] | no_license | score = 0
def check_guess(guess, answer):
global score
still_guess = True
attempt = 0
while still_guess and attempt <3:
if guess.lower() == answer.lower():
print('Correct!')
score += 1
still_guess = False
else:
if attem... | true |
18c8f6a41fca4b04fe9f90f2cca92dd728b14c16 | Python | am401/ip_verify | /ip-verify.py | UTF-8 | 752 | 3.640625 | 4 | [] | no_license | import ipaddress
import re
while True:
try:
ip = input("Enter an IP address: ")
if re.search('/', ip):
if ipaddress.ip_network(ip):
print("The IP is a CIDR IP. {}".format(ip))
continue
elif ipaddress.ip_address(ip).is_loopback:
print("... | true |
bc3ae7aacabd5ceb9a93df3bb94cdf65d4d37ea1 | Python | Prosen-Ghosh/Problem-Solving | /Python/Codewars-Get Nth Event Number.py | UTF-8 | 209 | 2.59375 | 3 | [] | no_license | def nth_even(n):
return 2 * n - 2
# TUTORIAL: https://www.khanacademy.org/math/algebra/x2f8bb11595b61c86:sequences/x2f8bb11595b61c86:constructing-arithmetic-sequences/v/finding-the-100th-term-in-a-sequence | true |
7d4618d3753e262bd0c6814ee5417162990cc34f | Python | tzytammy/requests_unittest | /习题/求100内所有奇数的和(2500)/NO.1.py | UTF-8 | 60 | 3.234375 | 3 | [] | no_license | count =0
for i in range(1,100,2):
count+=i
print (count) | true |
bf405c7ef0fc4102386422d01a90ce491420a5b8 | Python | scravy/abnf | /src/abnf/grammars/rfc5234.py | UTF-8 | 2,255 | 2.890625 | 3 | [
"MIT"
] | permissive | """
This is the ABNF grammar, expressed in ABNF, plus the core rules.
Collected rules from RFC 5234
https://tools.ietf.org/html/rfc5234
"""
from ..parser import Rule as _Rule
from .misc import load_grammar_rules
@load_grammar_rules()
class Rule(_Rule):
"""Rule objects generated from ABNF in RFC 4647."""
gr... | true |
f770b337c4d242e45749ae34d09bee8dc014f440 | Python | VOIDS-dev/Advanced-Learning-Lab | /correspondingproject/HellowWorld.py | UTF-8 | 1,592 | 2.75 | 3 | [] | no_license |
import sys,getopt,random
from inputTools import userInput
from inputTools import sampleInput
from outputTools import outputResult
from learningTools import simpleLearning
if __name__ == '__main__':
opts,args = getopt.getopt(sys.argv[1:], "i:o:")
inputFile = ""
outputFile = ""
trainingFile = 'd... | true |
2385ea78cd2dc41c5aba0b4ebed3c20fe0367f5f | Python | jerbridges/Artifact-3 | /rest_server_final.py | UTF-8 | 2,551 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# Jeremy Bridges
# CS 340
# 4/14/2020
# CS 499
# updated 6/2/2020
import json
from bson import json_util
import bottle
from bottle import request, route
import datetime
from pymongo import MongoClient
# connect to database and collection
connection = MongoClient('localhost', 27017)
db = connection['... | true |
ebf044dafc0f23f639e15f5a3184136eecf6766a | Python | jozuah/simplon_devcloud_jeu_pendu_python | /Pendu/script.py | UTF-8 | 5,509 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
import logging
from logging.handlers import RotatingFileHandler
# création de l'objet logger qui va nous servir à écrire dans les logs
logger = logging.getLogger()
def main():
# on met le niveau du logger à DEBUG, comme ça il écrit tout
logger.setLevel(logging.DEBUG)
# c... | true |
9529c0570678ab2e97484bda769a54213f907685 | Python | lexsteens/MSD-challenge | /code/head.py | UTF-8 | 467 | 2.828125 | 3 | [] | no_license | import sys, getopt
def main(argv):
inputfile = ''
n = 10
try:
opts, args = getopt.getopt(argv, "hn:")
except getopt.GetoptError:
print 'head.py -n <lines> file'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'head.py -n <lines> file'
elif opt == '-n':
n = int(arg)
inputfile = args... | true |
a7f4d942c08fed6f70922ac080b5670a6a6734ba | Python | ramanuj760/Python1 | /add.py | UTF-8 | 503 | 3.84375 | 4 | [] | no_license | a=int(input("enter the first number:"))
b=int(input("enter the second number:"))
c=a+b
print("the addition of two numbers is",c)
d=a-b
print("the subtraction of two numbers is",d)
e=a*b
print("the multiplication of two numbers is",e)
f=a/b
print("the division of two numbers is",f)
g=a**b
print("b is power of a",a)
a+=1... | true |