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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4ef1e04e37c82995efac4db5e381e3d3431180b5 | Python | RAPIDS-NU/NBAstats | /nbastats.py | UTF-8 | 6,399 | 2.75 | 3 | [] | no_license | import json
import requests
import pandas as pd
import numpy as np
import seaborn as sns
import pprint as pprint
import NBAData as nba
import time
pd.set_option('display.max_rows', 10000)
pd.set_option('display.max_colwidth', 10000)
pd.set_option('display.width', None)
sns.set_color_codes()
sns.set_style("white")
#o... | true |
1601990b73c524f477b7e0cdd4e2a99333c58bdd | Python | orram/Curiosity | /RUN.py | UTF-8 | 1,330 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Lets see it all run!!
"""
import gym
import gym_autoRobo
import numpy as np
import matplotlib.pyplot as plt
from LearningSteps import LearningStep
import utilities
learn = LearningStep()
learn.flatten_image = False
learn.prunning_treshold = 0.5
print(vars(learn))
le... | true |
71255c30a6800033f610bd35d5940e9356695a0f | Python | jackjchen/map | /helios/pipeViewer/pipe_view/model/plain_file.py | UTF-8 | 748 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | import shlex
## reads a file created by neato -Tplain <file> > outfile
class Plain:
# indices into data
NODE_POSX = 0
NODE_POSY = 1
NODE_DATA = 4
def __init__(self, filename):
# objects keyed by identifiers
self.nodes = {}
self.edges = []
self.bounds = (0, 0)
... | true |
f55552aa39513100e1711ef1393b909fe373650c | Python | nathantheinventor/solved-problems | /uva/11831 Sticker Collector Robots/sticker.py | UTF-8 | 1,270 | 2.65625 | 3 | [] | no_license | left = {"N": "W", "E": "N", "S": "E", "W": "S"}
right = {"N": "E", "E": "S", "S": "W", "W": "N"}
move = {"N": -1j, "E": 1, "W": -1, "S": 1j}
dir = {"O": "W", "N": "N", "S": "S", "L": "E"}
n, m, s = map(int, input().split())
while n > 0:
# get the grid bounded by #s
grid = [["#"] * (m + 2)]
for _ in range(n... | true |
706ad9fc67502211c7492e87c7e20f47d7e3e827 | Python | dkwired/coursework | /cs141/labs/lab1/fib2.py~ | UTF-8 | 472 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python2.7
#
###################################
# CS141, 12 Spring
#
# fib2.py
###################################
import sys, timeit
sys.setrecursionlimit(1000)
def fib2_a(n):
if n==1:
return (0, 1)
else:
a, b = fib2_a(n-1)
print a,b
return (b, a+b)
def fib2(n):
i... | true |
c0e7ad7e3b65b977f883e72a1ee182bf12faab50 | Python | BlesslinJerishR/PyCrash | /__5__IfStatements__/ordinal_numbers.py | UTF-8 | 353 | 3.21875 | 3 | [] | no_license | #ordinal_numbers.py
#5.11
#import
import sys
from _0_AddOns.defs import *
ordinal_numbers = list_numbers(9)
zero_remover(ordinal_numbers)
print(ordinal_numbers)
for number in ordinal_numbers:
if number == 1:
print(f"{number}st")
elif number == 2:
print(f"{number}nd")
elif number == 3:
print(f"{number}rd"... | true |
06857ad676a70968a0cb24eb78cb699a6d371b02 | Python | ispastlibrary/Titan | /2015/AST1/vezbovni/anja/liste.py | UTF-8 | 789 | 3.625 | 4 | [] | no_license | lista = ['jan', 3, 'mart', 3.14]
print(lista[1])
print (len(lista[0])
# ovo nam vraca duzinu liste/clana
lista1=np.array[1,2,3,4]
lista2=np.array[7.8.9.4]
lista3=lista1+lista2
for i in lista:
print(i)
#vraca clan po clan funkcije
for i in range(len(lista)):
print(lista[i])
for i in range(len(lista)):
p... | true |
fbc76c600aebe7364981d0c7408b4f0176f99cc9 | Python | Michael-Joe/origin_server | /pythonWorkspace/bmi.py | UTF-8 | 234 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
height = 1.75
weight = 80.5
bmi = weight/(height * height)
print ('bmi:',bmi)
if bmi < 18.5:
print ('too thin')
elif bmi < 25:
print ('normal')
elif bmi < 32:
print ('too fat')
else:
print ('very fat')
| true |
f30d89cabdf10fcd20170e042e8dd2936b3422ce | Python | KevinLoudi/Python3 | /src/ui.py | UTF-8 | 3,779 | 2.65625 | 3 | [] | no_license | """
ui core of monpoly
&1 2018-2-4 Kevin
create monpoly place display
&2 2018-2-4 Kevin
create a list to display a group of places
&2 2018-2-4 Kevin
organize layout of display
Author: Kevin
Last edited: August 2017
"""
import sys
from PyQt5.QtWidgets import QLabel, QApplication,QVBoxLayout, QWidget, QPushBu... | true |
71f7d10fd66b15705eee55c45d47318ebdc00808 | Python | DongZhuoran/Artificial-Intelligence-CSCI561 | /hw1/hw1b/autotest/autoTestScript.py | UTF-8 | 1,422 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import os
import sol4
def main():
num_cases = 10000
num_pass = 0.0
l = range(0, 10)
l = [x * num_cases * 0.1 for x in l]
for i in xrange(num_cases):
if i in l:
print float(i) / num_cases
testCasesCreator()
ret... | true |
c39152945a83eb631f1f725d24865e02935347f7 | Python | cold-pumpkin/Recommender-Project | /3.Modeling/1.XGBoost/MF_1.py | UTF-8 | 1,252 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 22 15:57:26 2018
@author: philip
"""
#################################################################
#################### Matrix Factorization #######################
#################################################################
## 데이터 읽어오기
... | true |
bf755c1b08f0afd11154c35c471b50509b49b579 | Python | beingveera/whole-python | /python/projects/100`s of python/main.py | UTF-8 | 162 | 3.25 | 3 | [] | no_license | class ran:
def number(self,no):
for i in range(1,100):
l=no/i
print(" {} ".format(l))
user=ran()
x=int(input())
user.number(x)
| true |
a7d9e682fbdcd23ecbfaf1b172428c04aae471c4 | Python | huangshizhi/learngit | /icis_to_mysql.py | UTF-8 | 5,536 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 09:40:50 2021
@author: huangshizhi
测试从excel自动更新安迅思数据到数据库
ICIS Excel Plug-In
WDF.Addin
"""
from logger import Logger
import numpy as np
import time
import pandas as pd
from sqlalchemy import create_engine
from scrapy_util import *
from datetime import datetime,date
i... | true |
f12db3a8e6133ccf1044cf4330d45683168d7043 | Python | mit-d/euler | /euler.py | UTF-8 | 1,008 | 4 | 4 | [] | no_license | def factors(n):
"""
Returns list of all factors of n
"""
ls = []
f = 1
m = n
while f <= n:
m = n
if m % f == 0:
ls.append(f)
m /= f
f = f + 1
return ls
def list_primality(n):
"""
Return a list of booleans representing each number ... | true |
d3177b9f6414a6fac162d872256b121dbaee19fd | Python | CedricJ08/Stock_prediction | /Code Annex/RNN_AWS.py | UTF-8 | 2,789 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 2 13:33:30 2018
@author: Alu
"""
Day_before= 60
Size_test = 100
import numpy as np
import pandas as pd
dataset = pd.read_csv('data.csv')
dataset_train = dataset[Size_test:]
dataset_test = dataset[:Size_test]
#############################################... | true |
1e2bb2eae486452dd6adc049027a044b828de40a | Python | HeHisHim/restartTornado | /testTornado/testTorXSRF.py | UTF-8 | 2,502 | 2.640625 | 3 | [] | no_license | """
XSRF 跨站请求伪造
在Application构造函数中设置xsrf_cookies = True, 因为xsrf_cookies涉及到安全Cookie, 所以还需要同时配置cookie_secret开启密钥
当这个参数被设置时, Tornado将拒绝请求中不包含正确_xsrf值的POST, PUT和DELETE请求
并报错 403 Forbidden('_xsrf' argument missing from POST)
"""
"""
在模板中使用XSRF保护, 只需在模板中添加
{% module xsrf_form_html() %} -- xsrf_token.html
这样在会在模板代码中嵌入一句
<inp... | true |
e02a476b3e16bf6b67a5607d8dbb83e714a1e95b | Python | krombo-kode/AdventOfCode2020 | /Day6/solution.py | UTF-8 | 997 | 3.140625 | 3 | [] | no_license | import copy
def answer_list_maker(input_file):
groups_answers = []
with open(input_file, "r") as file:
temp_lines = []
for line in file:
if line != "\n":
temp_lines.append(line.rstrip("\n"))
else:
groups_answers.append(copy.copy(temp_line... | true |
498f2adaef136c66916e635abbe1e2d9eae1f3dd | Python | karnrage/PyStack | /dictionaries.py | UTF-8 | 333 | 3.390625 | 3 | [] | no_license |
self_info = {"name": "kamalpreet", "age": "30", "language":"english"} #literal notation
# self_info = {} #create an empty dictionary then add values
# self_info["name"] = "Kamalpreet"
# self_info["age"] = "30"
# self_info["language"] = "english"
# data = ""
# val = ""
for key, value in self_info.items():
print k... | true |
7606cd6e92458d436e19e31c51896080745b6e31 | Python | B314-N03/PythonProjects | /RandomPassGerman.py | UTF-8 | 532 | 3.640625 | 4 | [] | no_license | import random
import string
import pyperclip
def randPassw(length):
digits = string.digits
lower = string.ascii_lowercase
upper = string.ascii_uppercase
special = str(['@' '!''#' '*''$' '§''&'])
passw = ''.join(random.choice(digits + upper + lower + special) for i in range(length))
print("Rand... | true |
d18cf3c4415c7594826144b22fec91997e046c76 | Python | anima-unr/Distributed_Collaborative_Task_Tree_ubuntu-version-16.04 | /vision_manip_pipeline/scripts/jb_Yolo_obj_det.py | UTF-8 | 1,110 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from gpd.msg import GraspConfigList
from darknet_ros_msgs.msg import BoundingBoxes
from darknet_ros_msgs.msg import BoundingBox
# global variable to store object_locations
obj_loc = []
# Callback function to receive bounding boxes.
def callback(msg):
global obj_loc
obj_loc ... | true |
9920ee09eececcf9857c04661e559e5d06444701 | Python | JpradoH/Ciclo2Java | /Ciclo 1 Phyton/Unidad 2/Ejercicios/Imprimir cadenas str.py | UTF-8 | 319 | 3.75 | 4 | [] | no_license | #imprimr cadenas de str de varias formas
camellos = 42
ver ='Hevisto %d camellos' % camellos #% cumple funcion de .format. he imprimir str
ver1 ='Hevisto {} camellos'.format(camellos) # #una forma de imprimir str
ver2 ='Hevisto '+str(camellos)+ ' camellos' #una forma de imprimir str
print(ver)
print(ver1)
print(ver2) | true |
3f6218cb627e064b413ee970b4f4f9f41d1f8d5c | Python | islamuzkg/LPTHW | /ex31_MakingDecisions/ex31.py | UTF-8 | 4,548 | 3.734375 | 4 | [] | no_license | # Apologize for spelling mistake, please, just don't tell my wife
print """
You enter a dark room through below doors.
Each does will take you to different adventure.
#1 bear
#2 insanity
#3 media
#4 gym
#5 technology
#6 school
#7 food
#8 animals
"""
door = raw_input("> ")
if door == "1":
print "There's a giant b... | true |
8c0e9372c43bac7910694b9cd47a10e9615ef7da | Python | ApplauseOSS/keycloak-config-tool | /keycloak_config/keycloak_client.py | UTF-8 | 7,278 | 2.90625 | 3 | [
"MIT"
] | permissive | """
Keycloak Client.
~~~~~~~~~~~~~~~~
"""
import re
import requests
import time
class NoSessionException(Exception):
pass
class KeycloakClient(object):
ADMIN_LOGIN_CLIENT_ID = 'admin-cli'
RELATIVE_HEALTH_CHECK_ENDPOINT = '/realms/master'
RELATIVE_TOKEN_ENDPOINT = '/realms/master/protocol/openid-con... | true |
c8f713858e2133a22c5e680a0e1217a24d828a35 | Python | JingkaiTang/github-play | /want_public_group/big_day_and_day/child/big_eye/fact/work_or_day.py | UTF-8 | 241 | 2.671875 | 3 | [] | no_license |
#! /usr/bin/env python
def company_and_young_week(str_arg):
new_man_and_child(str_arg)
print('problem')
def new_man_and_child(str_arg):
print(str_arg)
if __name__ == '__main__':
company_and_young_week('point_and_number')
| true |
22fb6e3adfb538d448bf91029032a829c5a8bd56 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2667/60898/317201.py | UTF-8 | 136 | 2.796875 | 3 | [] | no_license | t=eval(input())
for i in range(0,t):
arr=input().split()
i=int(arr[0])
l=int(arr[1])
result=pow(2,l)-i
print(result) | true |
d27d2a1ff323458663ade13e83c066edc82f8946 | Python | cwczarnik/machine_learning_analysis_packages | /logistic_regression_classifier_analysis.py | UTF-8 | 1,890 | 2.90625 | 3 | [] | no_license | from sklearn import metrics
from sklearn.cross_validation import train_test_split
from sklearn.metrics import roc_curve, precision_recall_curve
def logistic_regression_analysis(model,X_train,y_train,X_test,y_test):
model.fit(X_train,y_train)
y_pred = model.predict_proba(X_test)[:,1]
prec, rec, thresh_ = pr... | true |
680030d19b77e1e4d315cca6d6216bf5be908b8b | Python | Yey007/HOI4ImageGenerator | /generator.py | UTF-8 | 863 | 2.8125 | 3 | [] | no_license | import os
import sys
import errno
from PIL import Image
import glob
def main():
trymakedir("Large")
trymakedir("Medium")
trymakedir("Small")
files = glob.glob("*.png")
files.extend(glob.glob("*.jpg"))
files.extend(glob.glob("*.jpeg"))
for infile in files:
filename,... | true |
ad7f3ea8fd63d1b418cc03e1344582063c54edcc | Python | alex-romanovskii/summareyez | /eyetrackergui.py | UTF-8 | 12,472 | 2.765625 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
import os
from tkinter.ttk import Combobox
from PIL import Image, ImageTk
import random
import time
import pandas as pd
import numpy as np
class First_screen(Tk):
def __init__(self):
super().__init__()
self.config(cursor='circle red')
... | true |
d8dd2fbe9f71e651b2681f55f91731252b62acb4 | Python | persesvilhena/python_studies | /outros/codigos2/Codigos/14 - servidor.py | UTF-8 | 263 | 2.578125 | 3 | [] | no_license | from socket import socket, AF_INET, SOCK_STREAM
HOST = ''
PORT = 2223
s = socket(AF_INET, SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1) # Numero de Conexoes
conn, addr = s.accept()
data = conn.recv(1024)
print data
conn.send('Mensagem do Servidor!')
conn.close()
| true |
4d4d1de990925ddd2419c6f73842e905ece3ceb2 | Python | paper-NLP/en-cy-bilingual-embeddings | /src/main_test.py | UTF-8 | 717 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import data_manager
from argparse import ArgumentParser
from gensim.models import FastText,Word2Vec
import logging
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('-c','--corpus', help='Corpus file', required=True)
args = parser.parse_args()
logging.basicConfig(format='%(asctime)s : %(le... | true |
116f766b8c8d98557c6fea40199f0e508002ff27 | Python | bmilenki/Connect-3-AI---Minimax | /main.py | UTF-8 | 842 | 2.796875 | 3 | [] | no_license | import util
import connect3 as c3
import human
import game
import agent
def main():
p1 = util.get_arg(1)
p2 = util.get_arg(2)
currState = c3.State()
if p1 == "human":
player1 = human.HumanPlayer("X")
elif p1 == "random":
player1 = agent.RandomPlayer("X")
elif p... | true |
f47884106136c76477a7b850dd2e4ff83b15b0b7 | Python | jennyshane/nn_demos | /perceptron.py | UTF-8 | 1,663 | 2.703125 | 3 | [] | no_license | import time
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import tensorflow
import tensorflow.keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation
from tensorflow.keras import optimizers
class1center=[3, 3]
class2cente... | true |
5422a1d2e53d2bd052ff794da24c5fe02f44eafb | Python | emmernme/MENA-Compfys | /Project3/diff_plot.py | UTF-8 | 1,459 | 3.109375 | 3 | [] | no_license | """
Program to plot the results from the methods.
"""
import matplotlib.pyplot as plt
import numpy as np
N = np.linspace(5, 35, 13)
exact = 0.192765
c_lag = [0.170492, 0.154422, 0.177081, 0.187305, 0.193285, 0.194396,
0.194786, 0.194813, 0.194804, 0.194795, 0.194779, 0.194764, 0.194734]
diff_lag = [exact-c_lag[0]... | true |
04a883b0f84e725d40b3f90320c8acc96d89fb96 | Python | feiyuerenhai/python-basics | /02-列表.py | UTF-8 | 969 | 4.5625 | 5 | [] | no_license | #!/usr/bin/python
#coding=utf-8
#列表,基本上就是JavaScript中的数组
#列表可包含多种类型的数据
arr = ['test', 42, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']]
#使用in进行存在性检查
print 'test' in arr
#取数
print arr[1]
#分片操作
sub_arr = arr[2]
#从2取到8,每隔3个取一个
print sub_arr[2:8:3]
#list方法可以将字符串还原为列表
arr3 = list('love')
arr4 = list('hate')... | true |
201a44d6a31f8698c2d63e79a52b1b69be0eb79c | Python | Hitoki/ieee | /profiler.py | UTF-8 | 2,016 | 3.25 | 3 | [] | no_license | from logging import debug as log
import time
from util import odict
class Profiler:
"""
Used to manually profile functions and see where time is being spent.
Usage:
p = Profiler('page number 1')
# ...
p.tick('Before action X')
# ...
p.tick('Before act... | true |
8cd01ef0f166ba714d4c840e4a329de7d0413e19 | Python | somchaisomph/NN | /nn/activators.py | UTF-8 | 1,228 | 3.21875 | 3 | [] | no_license | import numpy as np
class ReLU:
def forward(self,X):
z = np.zeros(X.shape)
return np.maximum(X,z)
def backward(self,X):
p1 = self.forward(X)
ones = np.ones(p1.shape)
prime = np.minimum(p1,ones)
return prime
class Sigmoid:
def forward(self, X):
return 1.0 / (1.0 + np.exp(-X))
def backward(self, ... | true |
8fb0e073091dc4baca56590c7cf56a05d1ed187a | Python | Washington-University/HCPpipelinesXnatPbsJobs | /lib/utils/delete_all_resources_by_name.py | UTF-8 | 3,199 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
"""
utils/delete_all_resources_by_name.py: Program to delete all DB resources
of a given name for all sessions in a given ConnectomeDB project."
"""
# import of built-in modules
import glob
import os
import sys
# import of third party modules
# import of local modules
import utils.delete_reso... | true |
081d5c9a1420b37803abdde23ccc167badd79d13 | Python | TDA/spc-leetcodeOJ | /src/powerof4.py | UTF-8 | 246 | 2.875 | 3 | [] | no_license | import re
__author__ = 'saipc'
regex = re.compile(r"^0*10*$")
item = "00011000"
item2 = "00001000"
if regex.search(item):
x = regex.search(item)
print x.group(0)
if regex.search(item2):
x = regex.search(item2)
print x.group(0) | true |
0b5c976590b2fd39e48b367f1435529ca939f66d | Python | RoboISM/Roboism | /mainsite/forms.py | UTF-8 | 4,210 | 2.515625 | 3 | [] | no_license | import re
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from .models import *
class RegistrationForm(forms.Form):
username = forms.RegexField(regex=r'^\w+$', required=True, max_length=30, widget=forms.TextInput(attrs={'class':'inputfiel... | true |
e47bf934f7219f6f914932985aa853bf88fec546 | Python | stephendsm/general | /python/pytorial/classesNobjects.py | UTF-8 | 2,068 | 4.84375 | 5 | [] | no_license | # Make a group of similar variables and functions together
class Enemy: # Naming begin with a captial letter is a common practice, differentiate btw noral variable and class
life = 3 # each enemy has a life of 3, ofcoz this life variable is part of 'Enamy' class
# Make a couple function for this class 'Enemy'
... | true |
e3d59178d499d753be064f18b2813fd85e712391 | Python | shaunakbhanarkar/Analysis-of-Robotic-Behaviour-using-TurtleBot | /Turtlebot.py | UTF-8 | 6,531 | 2.8125 | 3 | [] | no_license | import rospy
from geometry_msgs.msg import Twist
import copy
from math import pi
#Tiles are 2*2 feet
def move_circle():
rospy.init_node('Node1',anonymous=True)
#Copy the initial position
##initial_turtlebot_odom_pose = copy.deepcopy(turtlebot_odom_pose)
# Create a publisher which ... | true |
6ae8f0f3a59bb40741b787cce9d1c727d970bd25 | Python | PatrickKutch/FUDD | /Fudd.py | UTF-8 | 4,440 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | ##############################################################################
# Copyright (c) 2017 Patrick Kutch
#
# 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.apac... | true |
bcee12ca6844d52c608a4cbc669ef901c34b5059 | Python | DagoPeralta94/CursoPythonPlatzi | /decomposicion.py | UTF-8 | 1,051 | 3.5625 | 4 | [] | no_license | class Automovil:
def __init__(self, modelo, marca, color):
self.modelo = modelo
self.marca = marca
self.color = color
self._estado = "en_reposo"
self._motor = Motor(cilindros=4)
print(f'Modelo: {self.modelo} - Marca: {self.marca} - Color: {self.color}')
def acel... | true |
3b2030b8c3e55c3475257b206bb264b7bcfc1981 | Python | Chaitra-21/PYTHON-BASIC-CODES | /cinema.py | UTF-8 | 717 | 3.828125 | 4 | [] | no_license | films={ "Finding Doru":[3,5],
"Bourne":[12,5],
"Tarzan":[15,4],
"Ghost Buster":[12,6]
}
while True:
choice=input("Which film you want to watch?: ").strip().title()
if choice in films:
age=int(input("How old are you?: ").strip())
#check user age
... | true |
608807740ca1f5c093e5bbc7f91ff4ce1a24a7e3 | Python | gregorylburgess/makahiki | /makahiki/scripts/verify.py | UTF-8 | 1,446 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
"""Invocation: scripts/verify.py
Runs pep8, pylint, and tests.
If all are successful, there is no output and program terminates normally.
If any errors, prints output from unsuccessful programs and exits with non-zero error code.
"""
import sys
import os
import getopt
def main(argv):
"""Verif... | true |
6bdab68868e0885ddc2358132056c4fb9e1b2e32 | Python | summercake/Python_Jose | /11.If.py | UTF-8 | 422 | 3.765625 | 4 | [] | no_license | # if case1:
# perform action1
# elif case2:
# perform action2
# else:
# perform action3
if True:
print('It was Ture')
x = False
if x:
print('x was false')
else:
print('I will print x is anything not True')
loc = 'Bank'
if loc == 'Auto Shop':
print('loc is Auto Shop')
elif loc == 'Bank':
... | true |
f647062c093159a42a7a87f9be25ba636ddb5d4c | Python | minseunghwang/YouthAcademy-Python-Mysql | /작업폴더/09_Set/main.py | UTF-8 | 1,755 | 3.828125 | 4 | [] | no_license | # Set
# 파이썬에서 집합 처리를 위한 요소
# 중복을 허용하지 않고, 순서 혹은 이름으로 기억장소를 관리하지 않는다.
# set 생성
set1 = {}
set2 = set()
print(f'set1 type : {type(set1)}')
print(f'set2 type : {type(set2)}')
print(f'set2 : {set2}')
set3 = {10, 20, 30, 40, 50}
print(f'set3 : {set3}')
print(f'set3 type : {type(set3)}')
# 중복 불가능 (중복제거용도로 사용)
print('중복 No-... | true |
95748e61bd8fbdf971a71aadb90a597003a4e1c1 | Python | karslio/PYCODERS | /Assignments-02/rotated_list.py | UTF-8 | 399 | 3.875 | 4 | [] | no_license | listElements = []
slip = int(input("how many index you will slip left"))
print("to stop the program please enter 'q'")
while True:
value = input("Enter list element: ").lower()
if value == 'q':
break
else:
listElements.append(value)
print(listElements)
newList = listElements[slip:] + listEle... | true |
c0f66396a906b90575ee38d99c46fcf3cec8fbed | Python | BryannaSav/PythonOOPExercises | /MathDojo.py | UTF-8 | 853 | 3.671875 | 4 | [] | no_license | class MathDojo(object):
def __init__(self):
pass
self.tot=0
def add(self, *num):
self.num=num
for i in range (0,len(num)):
if isinstance(num[i], (list,tuple)):
for j in range(0,len(num[i])):
self.tot = self.tot + num[i][j]
... | true |
81a8d9abf73a544c2f6a72c54e94c47dbfb48245 | Python | HeyMikeMarshall/python-challenge | /PyPoll/main.py | UTF-8 | 2,028 | 3.40625 | 3 | [] | no_license | import os
import csv
election_data = os.path.join(".", "election_data.csv")
output_dir = os.path.join(".", "results.txt")
## initialize results.txt
with open(output_dir, "w+") as text_file:
print("", file=text_file)
ttl_vote = 0
candidates = []
canid = -1
tallys = []
winner = 0
compline = []
##funtion to output... | true |
d2906c40d8aef2b1be36f51374bdac2e1a26893c | Python | DSJacq/Miscellaneous | /HackerRank/Python/collections_namedtuple.py | UTF-8 | 960 | 3.4375 | 3 | [] | no_license | from collections import namedtuple
# exemple 1
Point = namedtuple('Point','x,y')
pt1 = Point(1,2)
pt2 = Point(3,4)
dot_product = ( pt1.x * pt2.x ) +( pt1.y * pt2.y )
print(dot_product)
# exemple 2
Car = namedtuple('Car','Price Mileage Colour Class')
xyz = Car(Price = 100000, Mileage = 30, Colour = 'Cyan', Class = 'Y'... | true |
971059b90c201c8aa68eee8907da7e1c3cb1f647 | Python | jjhenkel/averloc | /models/pytorch-seq2seq/seq2seq/evaluator/metrics.py | UTF-8 | 3,356 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import sys, os
import numpy as np
import tqdm
try:
from bleu import moses_multi_bleu
except:
from seq2seq.evaluator.bleu import moses_multi_bleu
def calculate_metrics_from_files(pred_file, labels_file, verbose=False):
f_pred = open(pred_file, 'r')
f_true = open(labels_file, 'r')
hypotheses = f_pred... | true |
4188af5928fd2bf07c7d943a4aae3d88f48cf44b | Python | freestylofil/PKSS_heat_installation | /energy_provider/ActualTime.py | UTF-8 | 923 | 2.734375 | 3 | [] | no_license | from datetime import datetime, timedelta
import ntplib
time_client = ntplib.NTPClient()
class ActualTime:
def __init__(self, date=datetime.now()):
self._date = date
self._date0 = date
self._period = timedelta(minutes=5)
@property
def date(self) -> datetime:
return self._... | true |
e5ca586a2bbaebf65d532127f4e3b2eba0f0bef6 | Python | apjanco/LostVoicesCadenceViewer | /LV_Streamlit_Viewer_App.py | UTF-8 | 5,488 | 2.890625 | 3 | [
"CC0-1.0"
] | permissive | import streamlit as st
import pandas as pd
import altair as alt
import plotly.graph_objects as go
import networkx as nx
import numpy as np
import requests
st.header("Du Chemin Lost Voices Cadence Data")
# st.cache speeds things up by holding data in cache
#@st.cache
def get_data():
url = "https://raw.githubuserco... | true |
98666a65094838c6d2be7cac7e13a2bd64302432 | Python | Tr0ub1e/Izbushka | /printer_m.py | UTF-8 | 5,906 | 2.875 | 3 | [] | no_license | from bs4 import BeautifulSoup
class Make_html():
def __init__(self, start_date, end_date, car_data, usl_data, zap_data, money_data):
self.car_data = car_data
self.zap_data = zap_data
self.money_data = money_data
self.usl_data = usl_data
self.start_date, self.end_date = sta... | true |
29759020b585332831001c851ec55c7fc8bef016 | Python | beCharlatan/gu_ai | /pyalgs/lesson3/task02.py | UTF-8 | 648 | 4.15625 | 4 | [] | no_license | # 2. Во втором массиве сохранить индексы четных элементов первого массива. Например, если дан массив со значениями 8, 3, 15, 6, 4, 2, второй массив надо заполнить значениями 0, 3, 4, 5 (помните, что индексация начинается с нуля), т. к. именно в этих позициях первого массива стоят четные числа.
first = [8, 3, 15, 6, 4,... | true |
3752b2c94976fdaa9a4d1b0e636b7c723c0a6f3a | Python | mit-ccrg/ml4c3-mirror | /tensorize/bedmaster/bedmaster_stats.py | UTF-8 | 7,310 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | # Imports: standard library
import os
from typing import Dict
# Imports: third party
import numpy as np
import pandas as pd
# Imports: first party
from tensorize.bedmaster.data_objects import BedmasterSignal
class BedmasterStats:
"""
Class that gets together the summary data from all the writers.
It is... | true |
18758edb44b3d5cf3840ceed19909e3174a9e335 | Python | Nicolas-Fernandez/ChineseRemainder | /PiratesV1.py | UTF-8 | 2,964 | 3.53125 | 4 | [] | no_license | import random
print ("")
print ("You are a poor chinese slave cook on a bloodthirsty pirates ship.")
NBPIRATES1 = int (input ("How many pirates on this ship? (7)--> "))
print("")
print ("After their last ritual,"), (NBPIRATES1), ("the forbans finally decided to share their magot ...")
print ("The chest cont... | true |
c24d65732413c0abbe3c46313eb6fd9cdb97c646 | Python | dhrvdwvd/practice | /python_programs/95_requests_module.py | UTF-8 | 510 | 3.28125 | 3 | [] | no_license | import requests
# Now let's try to get a webpage. For this e.g., let's try
# to get Github's public timeline:
r = requests.get("https://api.github.com/events")
# Now we have a Response object called r. We can get all the
# information from this object.
# Requests' simple API means that all HTTP requests are obvious... | true |
660b50432d3014854a38b8a3ffee12599ef519e6 | Python | chaoshoo/python | /machineL/com/chaos/machineL/LogisticRegression.py | UTF-8 | 4,189 | 2.921875 | 3 | [] | no_license | '''
Created on 2016年7月19日
@author: Hu Chao
'''
import random;
import matplotlib.pyplot as plt;
import numpy as np;
import copy
import com.chaos.machineL.Helper as Helper
from com.chaos.machineL import GradientDescent
def initTheta(exampleXs):
theta = [];
for exampleX in exampleXs:
while len(e... | true |
43e65ffad501c3be360f5a70110e0925f55cc4d7 | Python | GlenEder/AdventOfCode2017 | /Day6/partA.py | UTF-8 | 1,099 | 3.1875 | 3 | [] | no_license | import copy
def hasHappened(listA, fullList):
for i in fullList:
if listA == i:
return True
return False
with open("input.txt") as f:
data = f.read()
numberWords = data.split('\t')
numbers = []
for i in range(len(numberWords)):
numbers.append(int(numberWords[i]))
steps = 0
previ... | true |
a2d98dc60df3619e1418ca22ba470b374ae6f41d | Python | ChalamiuS/desubot | /plugins/ap-marathon.py | UTF-8 | 989 | 2.75 | 3 | [] | no_license | from motobot import command
from requests import get
from bs4 import BeautifulSoup
from time import time
from re import sub
@command('marathonlist')
def marathonlist_command(bot, nick, channel, message, args):
return "The marathon list can be found at {}.".format(url)
@command('marathon')
def marathon_command(b... | true |
a0672f1df40ffc642f741250905b84b2b5bd93d4 | Python | xuan-w/wp-blog | /_posts/convert_pandoc.py | UTF-8 | 6,973 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
# ---coding=utf-8 -----
import re, os, glob, sys, shutil
def is_empty(s):
return len(s.strip()) == 0
cjk_ranges = [
(0x4E00, 0x62FF),
(0x6300, 0x77FF),
(0x7800, 0x8CFF),
(0x8D00, 0x9FCC),
(0x3400, 0x4DB5),
(0x20000, 0x215FF),
(0x21600, 0x230FF),
(0x23100, 0x245... | true |
f20381ed8aca0d2f86228542a30b4afcbb9fc349 | Python | offbynull/offbynull.github.io | /docs/data/learn/Bioinformatics/output/ch9_code/src/Router.py | UTF-8 | 409 | 2.984375 | 3 | [] | no_license | if __name__ == '__main__':
import importlib
val = input()
val = val.split()
if len(val) == 1:
module_name = val[0]
function_name = 'main'
elif len(val) == 2:
module_name = val[0]
function_name = val[1]
else:
raise ValueError(f'Too many parameters: {val}')... | true |
2192f442ed983603565f3626e35b9676d22fb9af | Python | kjnh10/pcw | /work/atcoder/abc/abc051/D/answers/056036_hs484.py | UTF-8 | 521 | 2.796875 | 3 | [] | no_license | N,M = map(int,input().split())
INF = 100000000
g = [ [INF] * N for _ in range(N) ]
for _ in range(M):
a,b,c = map(int,input().split())
a-=1
b-=1
g[a][b] = c
g[b][a] = c
t = [ [INF] * N for _ in range(N) ]
for i in range(N):
for j in range(N):
t[i][j] = g[i][j]
for k in range(N):
for i in range(N)... | true |
e4bfc023bcc10eae1b4b5bc0c17bc6f6d3471367 | Python | WEgeophysics/watex | /examples/applications/plot_data_exploratory_quick_view.py | UTF-8 | 8,710 | 3.296875 | 3 | [
"BSD-3-Clause"
] | permissive | """
=====================================================
Data exploratory: Quick view
=====================================================
Real-world examples for data exploratory, visualization, ...
"""
# Author: L.Kouadio
# Licence: BSD-3-clause
#%%
# Import required modules
import matplotlib.... | true |
a836d5580b838f4e9a40f89d4d37ce679f1a0dfe | Python | szarroug3/X-Ray-Creator-2 | /XRayCreator.py | UTF-8 | 11,453 | 2.609375 | 3 | [
"MIT"
] | permissive | # XRayCreator.py
import os
import sys
import argparse
import re
import httplib
from kindle.books import Books
from kindle.customexceptions import *
from time import sleep
from glob import glob
from shutil import move, rmtree
from pywinauto import *
#--------------------------------------------------------------------... | true |
2ed5fbf3a9a28520244e6dd5dc7ce20c2a86a275 | Python | dewiniaid/sigsolve | /sigsolve/board.py | UTF-8 | 12,752 | 2.890625 | 3 | [] | no_license | import collections
import itertools
import re
from sigsolve.geometry import DEFAULT_GEOMETRY, Point, Rect
class TileBase:
"""Base class for tiles."""
def __init__(self, parent=None, number=None):
self.parent = parent
self._exists = False
self.number = number
self.bit = 0 if nu... | true |
03fd072b905e34a4d0e17baa1a13df096dd426f5 | Python | Elyorbek0209/SeleniumWithPython | /DownloadFILE_InChrome.py | UTF-8 | 1,746 | 3.09375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
#---------DECLARING VARIABLES -------------
chromePath = "/home/elyor/Selenium/chromedriver"
geckoPath = "/home/elyor/Selenium/geckodriver"
URL = "https://www.toolsqa.com/automation-practice-form/"
#---------END ... | true |
f4942ad059de9cc22b2d7b281652fae708b05a43 | Python | s781825175/learnpython | /8queen.py | UTF-8 | 534 | 3.25 | 3 | [] | no_license | n = 8
x = []
X = []
def conflick(k):
global x
for i in range(k):
if x[i] == x[k] or abs(x[i] - x[k]) == abs(i-k):
return True
return False
def queens(k):
global n, x, X
if k >= n:
X.append(x[:])
else:
for i in range(n):
x.append(i)
if... | true |
c3f9f6649dba72146572d0f3990d6b08c5a5450e | Python | siiddd/HandwrittenDigitsRecognition | /Handwritten Digits Recognition/SimpleNN.py | UTF-8 | 1,868 | 3.34375 | 3 | [] | no_license | #Import packages
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow import keras
import seaborn as sns
#Import MNIST Digits Dataset
df = keras.datasets.mnist.load_data()
x_train = df[0][0]
y_train = df[0][1]
x_test = df[1][0]
y_test = df[1][1]
#Checking the Shape of the D... | true |
dd79b60e403a054395076489d0608ef09a4fc377 | Python | dennisdnyce/Questioner | /app/api/v1/models/meetup_models.py | UTF-8 | 1,053 | 2.6875 | 3 | [
"MIT"
] | permissive | from datetime import datetime
class MeetupRegistration():
''' class model for meetup registration '''
def __init__(self, location, images, topic, happeningOn, Tags):
self.location = location
self.images = images
self.topic = topic
self.happeningOn = happeningOn
self.Tags... | true |
5cbb1fa30032ab8ae91fabb7cfee505114788afc | Python | quite-smart-stuff/smart-home | /www/heat1off.py | UTF-8 | 225 | 2.671875 | 3 | [] | no_license | import RPi.GPIO as GPIO
GPIO.setwarnings(False)
def ledoff1(pin):
GPIO.output(pin,GPIO.LOW)
print("led 1 off")
return
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.OUT)
ledoff1(15)
GPIO.cleanup()
| true |
d7d7373a1192c66d5efcd7fbe4cee534a7bdb523 | Python | zhang-chao-zhi/autoTestBook | /5/5.1.2/try_proxy.py | UTF-8 | 302 | 2.625 | 3 | [] | no_license | from urllib import request
url = 'http://httpbin.org/ip'
proxy = {'http': '218.18.232.26:80', 'https': '218.18.232.26:80'}
proxies = request.ProxyHandler(proxy) # 创建代理处理器
opener = request.build_opener(proxies) # 创建opener对象
resp = opener.open(url)
print(resp.read().decode()) | true |
7d86b36683e4c2cae621652c67b61ebd3fc41fe7 | Python | antoniojkim/AlgLib | /Algorithms/Graphs/DFS/tests/test_DFS.py | UTF-8 | 410 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import sys
file_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(file_dir, "../"))
sys.path.append(os.path.join(file_dir, "../../"))
from graphs import create_graph
from DFS import DFS
def test_DFS_1():
G = create_graph(["A", "B", "C"],... | true |
2f429f7fe46d8fd066dae2d8c2c92c173efb040e | Python | srmarcballestero/Newtons-Cradle | /Source/VariaParametre.py | UTF-8 | 2,096 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Projecte: Newton's Cradle.
- Mòdul: VariaParametre.py
- Autors: Parker, Neil i Ballestero, Marc.
- Descripció: Fer simulacions iterant un paràmetre.
- Revisió: 06/10/2020
"""
import numpy as np
from scipy import constants as const
from datetime import timedelta
import Simulacio as si... | true |
a9de4d34a33549d8024d14e3f0d5fa9fee24f0a3 | Python | ash/python-tut | /course/if2.py | UTF-8 | 87 | 3.359375 | 3 | [] | no_license | x = 10
if x < 5:
print('< 5')
elif x < 8:
print('< 8')
else:
print('>= 8') | true |
58125611b77dd0368398620fa649a08a0e2468b0 | Python | Pallavi-Jadhav/loginpygit | /log/Login.py | UTF-8 | 1,036 | 2.6875 | 3 | [] | no_license | import guizero as g
def clear_uname():
uname.clear()
def clear_pass():
password.clear()
app = g.App(title='Login', height=300, width=500, layout='grid', bg='lightblue')
title = g.Text(app, text='SIGN IN', size=40, color='blue', font='Helvetica', grid=[1, 0], align='left')
uname_label = g.Text(app, text='Ent... | true |
2d4e80a6d8ca5eefb7b81e399ce0abbdc271861f | Python | turpure/urrest | /urapi/firstv/dbtools/ebaydata.py | UTF-8 | 1,457 | 2.546875 | 3 | [] | no_license | import MySQLdb
import json
def get_feedback_json(sellername):
query = [
"select *,",
"concat(round(fstmonthpostive/(fstmonthpostive+fstmonthnegative)*100,2), '%') as score1,",
"concat(round(sixmonthpostive/(sixmonthpostive+sixmonthnegative)*100,2), '%') as score6,",
"concat(round(tw... | true |
77435cf9c7e53413cdc69114739f85d8653df882 | Python | hbyhl/utils4py | /utils4py/data/neo4j.py | UTF-8 | 1,875 | 2.53125 | 3 | [] | no_license | #!usr/bin/env python
# -*- coding: utf-8 -*-
# Desc:
# FileName: neo4j.py
# Author:yhl
# Version:
# Last modified: 2020-02-28 11:12
import threading
from py2neo import Graph
from utils4py import ConfUtils
_neo4j_conf = ConfUtils.load_parser("data_source/neo4j.conf")
_conn_pool = dict()
_reuse_mutex = threading.R... | true |
142324945985721968ca37f0304fc43bf125c5c7 | Python | harsh6292/Behavioral-Cloning-CarND | /model.py | UTF-8 | 7,515 | 3.140625 | 3 | [] | no_license | #import keras
import csv
import cv2
import numpy as np
DBG = True
lines = []
# Load Udacity training data
udacity_training_log_file = 'udacity_data/driving_log.csv'
if (DBG):
print(udacity_training_log_file)
with open(udacity_training_log_file) as csvfile:
reader = csv.reader(csvfile)
# Read each line in driv... | true |
3a58db076c873504fdac452dc36debc6659efc4b | Python | 0x17/SP-Simulation | /spmergetraces.py | UTF-8 | 2,252 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import os
TIME_LIMIT = 1
instance_names = []
opt_profits = {}
with open('OptimalResults.txt', 'r') as fp:
for line in fp.readlines()[1:]:
parts = line.split(';')
instance_name = parts[0].rstrip()
opt_profit = float(parts[1].rstrip())
opt_profits[instance_name... | true |
b33176a6805bfc96a4f84c1e62c5613055e7d408 | Python | Ahnseungwan/Phython_practice | /2020.12/12.30/12.30 변수.py | UTF-8 | 529 | 4.03125 | 4 | [] | no_license | # 애완동물을 소개해 주세요
animal = "고양이"
name = "연탄이"
age = 4
hobby = "산책"
is_adult = age >= 3
print("우리집 "+ animal +"의 이름은 "+ name +"예요")
hobby = "공놀이"
# print(name + "는" + str(age) + "살이며, "+ hobby + "을 아주 좋아해요") #정수 앞에선 str을 넣어준다
print(name, "는" , age , "살이며, ",hobby,"을 아주 좋아해요") #정수 앞에선 str을 넣어준다
print(name + "는 어른일까요? " + ... | true |
ff27c5de522d8ca0b33a25bbe7ce624ec7223fc3 | Python | multikillerr/Hacking | /server_get.py | UTF-8 | 245 | 2.578125 | 3 | [] | no_license | #!usr/bin/python27
import sys
import socket
import os
s=socket.socket(sock.AF_INET, sock_STREAM)
try:
connection=s.bind(127.0.0.1, 8000)
except:
print("Could not bind on the ip provided")
while True:
data=s.recv(1024)
print data
| true |
a90662f3f4f4c496fa2633103c7567fbed6ea996 | Python | ffabut/kreap2 | /4/examples/post-method/main.py | UTF-8 | 1,707 | 3.125 | 3 | [] | no_license | import tornado.ioloop
import tornado.web
#jednoducha ukazka toho, jak prijimat data skrze POST request
#na index page se zobrazuje index.html soubor, ktery obsahuje html <form> pro zadani dat
#zadana data se posilaji jako POST request na adresu /enterdata
#kde je zpracuje EnterDataHandler pomoci metody post()
class M... | true |
23953781838c0e06c118732f940464e4dd183424 | Python | midhun999/Diabetes-Predictor-ML-Web-App1 | /diabetes_pred.py | UTF-8 | 2,024 | 3.1875 | 3 | [] | no_license | import numpy as np
import pickle
import pandas as pd
import streamlit as st
pickle_in = open("model_svc_pickle", "rb")
classifier = pickle.load(pickle_in)
df = pd.read_csv('diabetes.csv')
df_features = df.iloc[:,0:8]
def diabetes_prediction(Pregnancies, Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPe... | true |
e4c1d8837c72eb401bed19ad0f4c5e3e51b13df5 | Python | SLKyrim/vscode-leetcode | /0590.n叉树的后序遍历.py | UTF-8 | 2,133 | 3.6875 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=590 lang=python3
#
# [590] N叉树的后序遍历
#
# https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/description/
#
# algorithms
# Easy (71.16%)
# Likes: 55
# Dislikes: 0
# Total Accepted: 17.1K
# Total Submissions: 23.7K
# Testcase Example: '[1,null,3,2,4,null,5,6]\r'
#
# 给定一个 N 叉树... | true |
664ed9ca5607f8364e6ebe1ed417666127aa185a | Python | gieoon/Generate-Websites-with-AI | /RL2/main.py | UTF-8 | 874 | 2.75 | 3 | [] | no_license | # Implement q-learning.
import numpy as np
from flask import Flask, render_template
from flask_socketio import SocketIO
from action import generateHTMLAction, displayHTMLFile
app = Flask(__name__)
socketio = SocketIO(app)
k = 5
# Number of steps before human intervention
ACTION_STEPS = 10
@app.route('/')
def run()... | true |
efbd806d7aa95a4e045de7b69495c7f2e1d564f8 | Python | hdelei/espsemaphore | /check_tests.py | UTF-8 | 1,156 | 2.75 | 3 | [] | no_license | #Script para chamar outro script em caso de modificação
from os import path, system
import platform
from time import sleep
import requests
def windows_loop():
file = 'programa.py'
url = 'http://192.168.25.9/set?{}=on'
create_time = path.getctime(file)
while(True)... | true |
4aa7d91833a8ef3b0b3293d100a43f252e904eff | Python | k-harada/AtCoder | /ABC/ABC101-150/ABC145/C.py | UTF-8 | 850 | 3.390625 | 3 | [] | no_license | import math
def solve(n, x_list, y_list):
d_total = 0.0
for i in range(n - 1):
for j in range(i + 1, n):
d_total += math.sqrt((x_list[i] - x_list[j]) ** 2 + (y_list[i] - y_list[j]) ** 2)
return d_total * 2 / n
def main():
n = int(input())
x_list = [0] * n
y_list = [0] * n... | true |
57b2079b2d4b459c3f29803454285af526c43d53 | Python | PascalVA/adventofcode2018 | /dec1/dec1.py | UTF-8 | 384 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
dup = False
freq = 0
seen = []
with open("input.txt", "r") as f:
inList = f.read().splitlines()
while not dup:
for item in inList:
freq = freq + int(item)
if freq in seen:
dup = freq
break
seen.append(freq)
print("PART 1: %d" % dupl)
pri... | true |
1e481f552a9a47fb66be31e5c0d3b7656ab0cf4d | Python | Misk77/Python-Svenska-Gramas | /Python svenska - 5 - Flödeskontroll.py | UTF-8 | 120 | 3.203125 | 3 | [] | no_license | age = 18
if age >= 18:
print ("Grattis! du får köra bil!")
else:
print ("Tyvärr du får vänta några år")
| true |
78c53a66c67edddb3b991bb3733e3345b1b661ba | Python | FlavioImbertDomingos/repo-scraper | /repo_scraper/filetype.py | UTF-8 | 151 | 2.5625 | 3 | [
"MIT"
] | permissive | import re
def get_extension(filename):
try:
return re.compile('.*\.(\S+)$').findall(filename)[0].lower()
except:
return None
| true |
886d044cc305cddc61861069563d3ffbbcc859de | Python | Camila2301/PARCIAL_4 | /Punto1 (1).py | UTF-8 | 464 | 3.890625 | 4 | [] | no_license | """El siguiente codigo calcula e imprime"""
"""Sumatoria de Riemann"""
"""Autor:Maria Camila Vargas Giraldo"""
"""Ultima actualizacion:22 de septiembre/2021"""
import numpy as np
def Zeta(n):
r=0 # inicializo la variable que va a guardar la suma
for i in range(1,n+1): # este ciclo hace la sumatoria
r=r+(i**(-2))... | true |
3e0caf2547b030722d774adf07b03dfe884160d5 | Python | tanvijain13/CS5590-490-0001-Python-and-Deep-Learning-Programming- | /ICP1/Source Code/replace.py | UTF-8 | 249 | 3.453125 | 3 | [] | no_license | str="I love playing with python"
split= str.split()
lis=[]
final_string=""
for i in split:
if i == "python":
i = "pythons"
lis.append(i)
for x in lis:
final_string += x
final_string += " "
print(final_string)
| true |
50904894944954ec7e879abe144d10c6a78bacf4 | Python | aiventures/tools | /code_snippets/sample_inspect/module_loader_example.py | UTF-8 | 3,013 | 2.796875 | 3 | [
"MIT"
] | permissive | """ loading python modules programmatically can be used for inspect """
import sys
import logging
import os
from pathlib import Path
from importlib import util as import_util
from os import walk
logger = logging.getLogger(__name__)
class ModuleLoader():
def __init__(self,p_root) -> None:
if os.path.isdir... | true |
27cad35a2acd68851031bf03f66e6cc7592bd498 | Python | awesomewyj/54young | /unit/test_demo.py | UTF-8 | 543 | 2.9375 | 3 | [] | no_license | import unittest
class TestDemo(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
print("setupcalss")
def setUp(cls) -> None:
print("setup")
@classmethod
def tearDownClass(cls) -> None:
print("tearDownClass")
def tearDown(cls) -> None:
print("tearD... | true |
95ea2d51105ce5fd13f4a3cf936b1c9c0e10d455 | Python | sohumh/encryption | /cryptoCracker.py | UTF-8 | 7,466 | 3.421875 | 3 | [] | no_license | import enchant
from random import randint
"""
FUTURE NOTES
Does not support punctuation
Does not work efficiently on long inserts for the subsitution decoder (nor does it return the correct answer on small ones)
Caesar cipher works perfectly fine
GOALS
connect to a web app
"""
class Answers():
def __init__(self, ... | true |
ab2db76f3c99d8412dda3bc1ebfc0f95b052b45a | Python | Aurora-yuan/Leetcode_Python3 | /0476 数字的补数/0476 数字的补数.py | UTF-8 | 1,046 | 4.375 | 4 | [] | no_license | #label: 位运算 difficulty: easy
"""
第一种思路:
最简单的按照题意的思路:
先得到输入的二进制形式,再逐位取反, 最后转回十进制。
"""
class Solution:
def findComplement(self, num: int) -> int:
s = bin(num)[2:] #转换成二进制有“0b”前缀
b = ""
for ch in s:
if ch == "0":
b += "1"
else:
b += "... | true |
585a319d78dae14250f4cf29551cedb1308ca277 | Python | wency1111/new_chat | /chat_server.py | UTF-8 | 4,051 | 3.546875 | 4 | [] | no_license | """
socket fork 练习
群聊聊天室
功能 : 类似qq群功能
【1】 有人进入聊天室需要输入姓名,姓名不能重复
【2】 有人进入聊天室时,其他人会收到通知:xxx 进入了聊天室
【3】 一个人发消息,其他人会收到:xxx : xxxxxxxxxxx
【4】 有人退出聊天室,则其他人也会收到通知:xxx退出了聊天室
【5】 扩展功能:服务器可以向所有用户发送公告:管理员消息: xxxxxxxxx
"""
"""
1.技术点的确认
*转发模型:客户端--》服务端--》转发给其他客户端
*网络模型:UDP通信
*保存用户信息 [(name,addr),(...)] {name:addr}
*... | true |