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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
81933c5e45315f17f9b4b5d9f98d9adbc20b7f86 | Python | David90Mar/Pokebot | /calculate_probability.py | UTF-8 | 3,318 | 2.59375 | 3 | [] | no_license | class game:
def __init__(self, name='partita_poker', blind=0.005):
self.name = name
self.deck = deck_poker()
self.players=0
self.turni=[]
self.inizio=[]
self.bet = True
self.piatto=0
self.max_bet=0
self.scommesse=1
self.blind... | true |
84828bec6b5822d1acddb7bc43cbc26ab55a7c98 | Python | taehoon95/python-study | /enumerate와리스트내포/확인문제(2,8,16진법).py | UTF-8 | 321 | 3.609375 | 4 | [] | no_license | print("{:b}".format(10))
print("{:o}".format(10))
print("{:x}".format(20))
print(int("1010",2))
print()
print(int(12),8)
print(int(10),16)
output = [i for i in range(1,100+1)
if "{:b}".format(i).count("0") == 1]
for i in output:
print("{} : {}".format(i, "{:b}".format(i)))
print("합계: ", sum(output)) | true |
36a2f893e947a0b74f675b4061de6d63ccc77b7e | Python | Satxm/aliddns | /GetIPv6Address/LinuxIPv6.py | UTF-8 | 768 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import os
import re
def ShortIPv6Address():
output = os.popen("ifconfig").read()
result = re.findall(r" inet6 ([a-f0-9:]*::[a-f0-9:]*) prefixlen 128 scopeid 0x0<global>", output, re.I)
return result
def LongIPv6Address():
output = os.popen("ifconfig").read()
result = re.findall(r" ... | true |
dcbfede07fb07cf8984e4cc37dc87887203217f1 | Python | ryavorsky/EduMap | /python/parse_direktor_shkoly.py | UTF-8 | 3,311 | 2.609375 | 3 | [] | no_license | import os
import sys
os.chdir('../data/Direktor_Shkoly/html/')
file_names = os.listdir()
print(os.getcwd(), os.listdir())
res_data = []
for file_name in file_names:
f_in = open(file_name, "r", encoding="cp1251")
source_text = f_in.read()
f_in.close()
year = file_name.split(".")[0].split("_")[0]
... | true |
477edd944af535b442f03794bee7565241694faa | Python | JoshuaPedro/5E-Character | /CSM/character/management/commands/populate_db.py | UTF-8 | 1,676 | 2.734375 | 3 | [] | no_license | """Single command to call all other populate commands. This will require that all initial migrations have been made."""
# Django Imports:
from django.core.management.base import BaseCommand
from django.core.management import call_command
class Command(BaseCommand):
"""
Command to populate the database with ... | true |
9aae3b7e49def95860e965b89ecc700ec8e145c8 | Python | faizkhan12/Basics-of-Python | /exercise 5.11.py | UTF-8 | 445 | 4.09375 | 4 | [] | no_license | Ordinals=[1,2,3,4,5,6,7,8,9]
for Ordinal in Ordinals:
if Ordinal==1:
print("1st")
elif Ordinal==2:
print("2nd")
elif Ordinal==3:
print("3rd")
elif Ordinal==4:
print('4th')
elif Ordinal==5:
print('5th')
elif Ordinal==6:
print('6th')
... | true |
d25a86f26a9137faa1d310753a1bf68f9bb5c50e | Python | jondfin/Python-Projects | /AddAccess.py | UTF-8 | 2,537 | 2.9375 | 3 | [] | no_license | import sys, os, re
def userGroupExists(userGroupName):
data = []
with open("./files/UserGroups.txt", "r") as f:
data = f.readlines()
for line in data:
(group, users) = filter(None, line.split("="))
if group.strip() == userGroupName:
return
print("User group {} does not exist").format(userGroupName)
s... | true |
498ee4978d8f9555dbb54f43def7ce3fcfc1ab0c | Python | afcarl/swedish_chef | /preprocessing/mover.py | UTF-8 | 1,952 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
Module for moving files around for the preprocessor.
"""
import glob
import os
import shutil
import myio.myio as myio
import preprocessing.prep_global as prep_global
import chef_global.debug as debug
import chef_global.config as config
def _append_all_recipe_files():
"""
Takes each file in the config.DAT... | true |
bcdba2a7326f2a793454324b69acbf2ad3b23f0f | Python | saubhik/leetcode | /problems/valid_parentheses.py | UTF-8 | 935 | 3.71875 | 4 | [] | no_license | from unittest import TestCase
class Solution:
# Time Complexity: O(n).
# Space Complexity: O(n).
def isValid(self, s: str) -> bool:
stack = []
for char in s:
if char in ("(", "{", "["):
stack.append(char)
else:
if stack and (
... | true |
8d72865268c7b7ddad22de2664db3bcf9eb10db8 | Python | higor-gomes93/curso_programacao_python_udemy | /Sessão 8 - Exercícios/ex36.py | UTF-8 | 458 | 4 | 4 | [] | no_license | '''
Faça uma função não-recursiva que receba um número inteiro positivo n e retorne o superfatorial desse número. O
superfatorial de um número N é definido pelo produto dos N primeiros fatoriais de N.
'''
def superfatorial(numero):
produto = 1
fatorial = 1
for i in range(1, numero+1):
for j in ran... | true |
d0a4729a6f98d20944f59b7f6195064a25e8957e | Python | WHOIGit/nes-lter-ims | /neslter/workflow/underway.py | UTF-8 | 1,563 | 2.515625 | 3 | [
"MIT"
] | permissive | from . import logger
import pandas as pd
from neslter.parsing.files import Resolver
from neslter.parsing.underway import Underway, DATETIME
from .api import Workflow
UNDERWAY = 'underway'
class UnderwayWorkflow(Workflow):
def __init__(self, cruise):
self.cruise = cruise
def directories(self):
... | true |
529ec3f542c22783e90fcf7c7bb138018ad07751 | Python | hafsaabbas/-saudidevorg | /23 day.py | UTF-8 | 938 | 3.0625 | 3 | [] | no_license | Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> dic={"model":"ford","brand":"mus","year":12344}
>>> if "model" in dic:
print("yyas")
yyas
>>> print(len(dic))
3
>>>
>>> dic["blac... | true |
f8bba9213a799ff0a2bf31440c37f5b9213ebb20 | Python | daniboomberger/modul122_LB2 | /create_invoice_text.py | UTF-8 | 2,765 | 2.78125 | 3 | [] | no_license | import configuration
import create_log
from string import Template
class createInvoice():
def __init__(self):
self.finished_invoice_text = ''
self.positions_text = ''
#creates the invoice.txt locally
def writeInvoice(self, invoice_data, calculated_date, invoice_positions, calculated_pric... | true |
2aa2dd4e0f6626da47a9289fa0e0ba7f733a6351 | Python | Madhu-Kumar-S/Python_Basics | /pattern_printing/dimond.py | UTF-8 | 215 | 3.515625 | 4 | [] | no_license | n = int(input("Enter limit:"))
s = n
for i in range(1, n+1):
print(" " * s, end=' ')
print("* "*i)
s = s-1
s = s+2
for i in range(n-1, 0, -1):
print(" " * s, end=' ')
print("* "*i)
s = s+1
| true |
246a0878df467c2ae71d20b66b0bdb5afea2eaab | Python | jinseoo/DataSciPy | /src/파이썬코드(py)/Ch11/code_11_7.py | UTF-8 | 551 | 3.25 | 3 | [] | no_license | #
# 따라하며 배우는 파이썬과 데이터과학(생능출판사 2020)
# 11.7 막대형 차트도 손쉽게 그려보자, 290쪽
#
from matplotlib import pyplot as plt
# 1인당 국민소득
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [67.0, 80.0, 257.0, 1686.0, 6505, 11865.3, 22105.3]
plt.bar(range(len(years)), gdp)
plt.title("GDP per capita") # 제목을 설정한다.
plt.ylabe... | true |
72bab96fa805c97010cd6fb4cc1d2575a4ee8fa1 | Python | davelush/autotrader-search | /app.py | UTF-8 | 770 | 2.640625 | 3 | [] | no_license | from autotrader.scraper import Scraper
from autotrader.vehiclerepository import VehicleRepository
import psycopg2
def main():
# set up search parameters
max_distance = 1500
postcode = "rg315nr"
berths = 6
max_price = 27500
keywords = "bunk"
postgres_host = "localhost"
postgres_port = ... | true |
9e758e15f20b4ee61294e0bbb7b782b3d145970e | Python | LimaRubson/Estudos-Python | /ex004.py | UTF-8 | 736 | 4.6875 | 5 | [] | no_license |
#Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo a todos as informações possíveis sobre ele.
a = input('Digite algo: ')#Retorna uma STRING independente do tipo
print('O tipo primitivo desse valor é ', type(a))
print("Só tem espaço? ", a.isspace())#Só tem espacos
print("É um número? "... | true |
fbb07fd358f0e477dc48c0a213c2990d626a9cb8 | Python | bricaud/OCR-classif | /classify_docs_from_graph.py | UTF-8 | 1,090 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
""" Classify the documents using the graph and the texts in pickle file (dataframe).
"""
import txt2graph
import argparse
import os
import sys
parser = argparse.ArgumentParser(description='Create the graph from the texts in pickle file (dataframe).')
parser.add_argument('folder',
... | true |
25ff0b26a1e3992c6074899053b835ed97abe0b9 | Python | Shreyansmalu/numberGuessingGame | /countingCha2.py | UTF-8 | 258 | 3.53125 | 4 | [] | no_license | count = input("hi")
print (count)
characterCount = 0
wordCount = 1
for cap in count:
if cap ==' ':
wordCount = wordCount +1
characterCount = characterCount +1
print (cap)
print (characterCount)
print (wordCount) | true |
d8dc915167c15375e7f68f2c31665069b0d2d0e8 | Python | python-practice-b02-006/gromov | /lab2.2/ex3.py | UTF-8 | 403 | 3.21875 | 3 | [] | no_license | from turtle import *
from numpy import *
def addnum(num:int):
inp = open('ex3_sup.txt', 'r').readlines()
s = inp[num].rstrip()
commlist = s.split(' -> ')
for command in commlist:
eval(command)
def drawindex(index:float):
for num in index:
addnum(int(num))
shape('turtle')
speed(8... | true |
1171336cc7181b886ec2c0c3fb4f912efc6b3009 | Python | Dhavade/Data-structure | /Stack/stack_list.py | UTF-8 | 931 | 3.796875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 21 11:33:45 2021
@author: Admin
"""
stack=[]
def push():
if len(stack)==n:
print("stack is full")
else:
element=input("enter tha element")
stack.append(element)
print(stack)
def pop_element():
if not s... | true |
fd4381e571b39bca9de867080ae0ed5b2bf402ac | Python | ShelbertT/20210513_arcgis-earth-api | /WorldTour.py | UTF-8 | 4,726 | 2.5625 | 3 | [] | no_license | import random
import time
import requests
import os
import sys
import getpass
import json
import cv2
import readkml
base_address = "http://localhost:8000/"
camera = "arcgisearth/camera"
snapshot = "arcgisearth/snapshot"
def mkdir(path):
path = path.strip()
path = path.rstrip("\\")
exist... | true |
a0716135a887d942c106a4162f89a26f29a04a43 | Python | alecherryy/CS5001_Computer_Science | /Homework _4/kmeans_driver.py | UTF-8 | 5,337 | 2.828125 | 3 | [] | no_license | '''
Alessia Pizzoccheri - CS 5001 02
'''
import random
import turtle
import kmeans_viz
DATA = [
[-32.97, -21.06], [9.01, -31.63], [-20.35, 28.73], [-0.18, 26.73],
[-25.05, -9.56], [-0.13, 23.83], [19.88, -18.32], [17.49, -14.09],
[17.85, 27.17], [-30.94, -8.85], [4.81, 42.22], [-4.59, 11.18],
[9... | true |
f776988ae3ddad5fd626b971dc11d59030cefdf8 | Python | PerfectFit-project/goal_setting_virtual_coach | /actions/actions.py | UTF-8 | 26,719 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | # This files contains your custom actions which can be used to run
# custom Python code.
## if you want to run code, that would go in the actions.py file (python).
# code that you create and action, if you need action to be triggered add to stories, add to list of actions in domain file, if the action
# See this gui... | true |
6544e454cf9ac82fe2f64acffa0f744f94e0d5f8 | Python | lmccalman/spacerace | /clients/zmq/state_watcher.py | UTF-8 | 2,402 | 2.6875 | 3 | [
"MIT"
] | permissive | # state_watcher.py
#
# threaded state monitoring - pushed from spacerace over zmq
import json
import argparse
import time
import threading
import zmq
# from zmq.eventloop import ioloop
# from zmq.eventloop.ioloop import ZMQIOLoop
# from zmq.eventloop.zmqstream import ZMQStream
# install PyZMQ's IOLoop
# ioloop.install... | true |
c9705c48c24f2aefbd6b3922f8c1e5c1206764d9 | Python | javaTheHutts/Java-the-Hutts | /src/unittest/python/test_sa_id_book_old.py | UTF-8 | 11,119 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | """
----------------------------------------------------------------------
Authors: Jan-Justin van Tonder
----------------------------------------------------------------------
Unit tests for the SA ID book old module.
----------------------------------------------------------------------
"""
from hutts_verification.i... | true |
1a84c4ad7a9c5f200b98a6a76522566e957f8191 | Python | alperkesen/codecarbon | /codecarbon/core/cpu.py | UTF-8 | 12,632 | 2.609375 | 3 | [
"MIT"
] | permissive | """
Implements tracking Intel CPU Power Consumption on Mac and Windows
using Intel Power Gadget
https://software.intel.com/content/www/us/en/develop/articles/intel-power-gadget.html
"""
import os
import shutil
import subprocess
import sys
import time
import warnings
from typing import Dict, Tuple
import pandas as pd
... | true |
88b07716aaf6a2c040bed53442dca199ef0b285c | Python | meatware/FixedTermDepositGrapher | /ftd_main/models.py | UTF-8 | 1,614 | 2.6875 | 3 | [
"MIT"
] | permissive | from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin, LoginManager
db = SQLAlchemy()
login = LoginManager()
login.login_view = 'login'
@login.user_loader
def load_user(id):
return User.query.get(int(id))
class User(Use... | true |
d38c869b8781053037287d60008a91d414236bee | Python | konflic/python_qa_test_data | /examples/1_txt_reader.py | UTF-8 | 441 | 3.25 | 3 | [] | no_license | from files import TXT_FILE_PATH
some_file = open(TXT_FILE_PATH, "r")
# Read the exact bites amount
print(some_file.read(7))
# Read a single line
print(some_file.readline())
# Get all lines as list
print(some_file.readlines(), "\n")
# Read from current cursor position till the end
print(some_file.read())
# Positio... | true |
4af37495b47067211210dd088f1bda225f4d77f8 | Python | scaraclette/pycode | /interview_practice/APIHackerrank/practice1.py | UTF-8 | 1,808 | 2.953125 | 3 | [] | no_license | import requests, pprint
def getTotalPages(team, year):
link = 'https://jsonmock.hackerrank.com/api/football_matches?year=' + str(year) + '&team1=' + team + '&page=1'
req = requests.get(link).json()
totalPages = req.get('total_pages')
print('TOTAL PAGES:', totalPages)
return totalPages
def getTotal... | true |
fca21f66c8384845f940fc19957900e92d92f7ba | Python | tawrahim/Taaye_Kahinde | /Tawheed/chp6/flav.py | UTF-8 | 112 | 2.671875 | 3 | [] | no_license | import easygui
disney = int(easygui.enterbox("What is your number "))
addme = disney + 20
easygui.msgbox(addme)
| true |
ebb7e636e6b821a3c0264479046de6682a6f15ca | Python | wilkinsonlab/m-oryzae-polya | /info_content_motif.py | UTF-8 | 1,586 | 2.640625 | 3 | [] | no_license | import sys, re, numpy, math
from Bio import SeqIO
g = open(sys.argv[1], 'r')
f = open(sys.argv[2], 'r')
m = sys.argv[3]
length = int(sys.argv[4])
m = m.replace('R', '[GA]').replace('Y', '[TC]').replace('S', '[GC]').replace('W', '[TA]').replace('K', '[GT]').replace('M', '[AC]').replace('D', '[GTA]').replace('H', '[TAC... | true |
0c27014186243c1f8b9c372e1da00d043bd14cdd | Python | xulu199705/LeetCode | /leetcode_1252.py | UTF-8 | 538 | 2.96875 | 3 | [
"MIT"
] | permissive | from typing import List
class Solution:
def oddCells(self, n: int, m: int, indices: List[List[int]]) -> int:
matrix = [[0 for i in range(m)] for i in range(n)]
for i in range(len(indices)):
for j in range(n):
matrix[j][indices[i][1]] += 1
for j in range(m):
... | true |
d652e228edd90daccda256d167331deeb9a5aeed | Python | blepfo/RL-MDPs | /policy_approximators.py | UTF-8 | 4,882 | 3.203125 | 3 | [] | no_license | """ Approximates an RL policy from sample episodes. """
import itertools as it
from collections import deque
from typing import Deque, Dict, Tuple
import numpy as np
from _types import Action, History, Position, State, Policy
from utils import policy_shape
def naive_approx(states: np.ndarray, actions: np.ndarray, ... | true |
0993ce7e889d6e89ea60fafa64150c63328fb5c2 | Python | xtracthub/xtract-maps | /border_extraction.py | UTF-8 | 7,270 | 3.234375 | 3 | [] | no_license | import numpy as np
import cv2
import logging
from contouring import pre_process_image
from coordinate_extraction import pixel_to_coords_map, coord_to_abs
# Setup for the debug logger
logging.basicConfig(format='%(asctime)s - %(filename)s - %(funcName)s - %('
'message)s', level=loggi... | true |
2dcde9920fc8ffa7f8e6cebe0d3a83fe48fd7b3d | Python | vtt-project/VTT_vid_emotion | /src/loss_def.py | UTF-8 | 1,209 | 2.984375 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
class emo_loss(nn.Module):
def __init__(self, loss_lambda):
super(type(self), self).__init__()
# balancing term
self.loss_lambda = loss_lambda
# bce loss obj
self.bce_loss = nn.BCEWithLogitsLoss()
def loss_neutral(self, e0, e... | true |
3e3a7c9bfe649f292a57c5d924f5cc7c2dd2725c | Python | aanimesh23/ReturnToSleep | /src/checkers-python/StudentAI.py | UTF-8 | 5,438 | 3.125 | 3 | [] | no_license | from random import randint
from BoardClasses import Move
from BoardClasses import Board
#The following part should be completed by students.
#Students can modify anything except the class name and exisiting functions and varibles.
class StudentAI():
def __init__(self,col,row,p):
self.col = col
self... | true |
f9cbeaa6d4481b9599feb947224eab534ff3bdd3 | Python | Rosovskyy/ellipticCurvePoints | /ellipticCurve.py | UTF-8 | 3,391 | 3.640625 | 4 | [] | no_license | class Helper:
@staticmethod
def modularSqrt(s, mod):
if Helper.multiplicative(s, mod) != 1 or s == 0:
return 0
part, number = mod - 1, 0
while part % 2 == 0:
part /= 2
number += 1
nWithLegend = 2
while Helper.multiplicative(nWithLegend,... | true |
2bb30a2628e7ff3e3f5053185a9eae5a5d80e998 | Python | mdyousuf77/python | /fibonacci.py | UTF-8 | 410 | 4 | 4 | [] | no_license | #program to display fibonacci series upto nth term
n=int(input('enter the limit:')) #accepting the limit from user
n1,n2=0,1 #first two terms
i=0
if n<=0: #checking if the number is valid
print("enter a positive integer")
elif n==1:
print("fibonacci series:",n1)
else:
print("fibonacci series:")
whil... | true |
9c552b5a57047f180ab0ad5f3959d9867590b121 | Python | prajeet-oza/High-Performance-Computing | /md/lammps_plot.py | UTF-8 | 1,247 | 2.765625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
file1 = open('log.lammps', 'r')
lines = file1.readlines()
start = 71
length = 1000
data_lmp = lines[start:start+length+2]
file1.close()
file2 = open('lammps_data', 'w')
file2.writelines(data_lmp)
file2.close()
data_ = pd.read_table('lammps_data', sep = '\s+')
data_... | true |
e93fb31f77ccd91b7b115d50e0d2c5a489cb4a7f | Python | janroddy/physics-ws | /physicsproblem_solution.py | UTF-8 | 1,247 | 3.609375 | 4 | [] | no_license | from math import sqrt
from matplotlib import pyplot
# A block of mass m_1 slides down a frictionless ramp of height h and
# collides inelastically with a block of m_2 that is initially at rest.
# The solver function uses an energy calculation to find the speed of
# m_1 at the bottom of the ramp, and then uses a ... | true |
8247991d23b03577162bb500c211c77eb6f72ab3 | Python | hanzhenlei767/NLP_Learn | /文本匹配/MIX/代码/data_process.py | UTF-8 | 18,383 | 2.671875 | 3 | [] | no_license | import os
import numpy as np
import pandas as pd
import tensorflow as tf
import jieba
import re
import copy
import pickle
import json
import nltk
from nltk.corpus import stopwords
from gensim.models import word2vec
from gensim.models import KeyedVectors
#nltk.download('averaged_perceptron_tagger')
def clean_str(text):... | true |
98e963718746dc4e7594c847545543cc9298f7c7 | Python | multavici/DSR-Bird-Song | /birdsong/data_management/utils/signal_extraction.py | UTF-8 | 4,713 | 3.15625 | 3 | [] | no_license | """
The following functions serve to highlight sections of bird vocalizations in a
audio recording. They are based on the methodologies described in Lasseck 2013
and Sprengler 2017.
Usage:
import the function "signal_timestamps" from this script and pass it a path to
a audio file. It will then return the total durati... | true |
49199666485420604dae4311e5992de9720fd80a | Python | C0deSamurai/deep-2048-shredder | /train_nnet.py | UTF-8 | 840 | 3.234375 | 3 | [] | no_license | """Runs a round of training where the bot plays lots and lots of games, and then reads them all in
again to learn from its mistakes. Saves the net's data to a file afterwards."""
import nnet
from game import Game
N_GAMES = 10
N_EPOCHS = 10
N_TRAINING_BOARDS = 100
agent = nnet.QLearningNNet()
for epoch in range(N... | true |
9f99d868e580ecf18df8c65d049b39094a1173bd | Python | UnaStankovic/DisorderProteinsMetapredictor | /gui_and_socket/disprot_service.py | UTF-8 | 1,285 | 2.640625 | 3 | [] | no_license | import requests
import json
import re
def shortened_sequence(sequence):
if(sequence[0] == ">"):
pom = ''.join(sequence.split("\n")[1:])
else:
pom = sequence.replace("\n","")
return pom
# This function is parsing the data given from the server
def prepare_sequence(data):
if data == "No... | true |
7b593e1bd973b519b5135ab7c4eb952e125e27ec | Python | likelion-kookmin/python-study-8th | /김시은/assignment2-1.py | UTF-8 | 110 | 3.921875 | 4 | [] | no_license | a = int(input("줄 수를 입력해주세요: "))
for i in range(1, a+1):
print(" "*(a-i)+("*"*(2*i-1)))
| true |
dcb142ef843fe2f78cd6c03ccf0f6692b5d4e07e | Python | guoshan45/guoshan-pyschool | /Strings/10.py | UTF-8 | 229 | 2.671875 | 3 | [] | no_license | def startEndVowels(word):
if len(word) != 0:
if word[0].lower() in 'aeiou' and word[len(word)-1].lower() in 'aeiou':
return 'True'
else:
return 'False'
else:
return 'False'
| true |
b888048a4a51969f03bc3000c1c7f386a708a790 | Python | hard1mpulse/pyneng | /tasks/Par4/4.7.py | UTF-8 | 195 | 3.015625 | 3 | [] | no_license | mac = 'AAAA:BBBB:CCCC'
mac = mac.replace(':','')
print('{:b}{:b}{:b}{:b}{:b}{:b}'.format(int(mac[0:2],16),int(mac[2:4],16),int(mac[4:6],16),int(mac[6:8],16),int(mac[8:10],16),int(mac[10:12],16))) | true |
5bb3f9ecab45a5792ab0fbf803ae65d1b258204a | Python | Cornellio/dashing-dashboards | /webstats/jobs/api_net_stats.py | UTF-8 | 9,349 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/python
'''
Dashing job for graphing open HTTP connections across server farm.
Get network stats from each server.
Get sum and write to file.
Push stats to dashing widget.
'''
import sys
import json
import time
import argparse
import urllib2
import httplib
import paramiko
import os
def vprint(message, ver... | true |
454f0a1b10f31ea5879d7bf79b95dda5602f0bcb | Python | amanryzus/temp | /question 3a.py | UTF-8 | 717 | 3.546875 | 4 | [] | no_license | phone={}
ph=[]
pr=[]
q=1
def add():
ph,pr=input("Enter the phone name and it price").split()
if pr not in phone:
phone[pr] = []
phone[pr].append(ph)
else:
phone[pr].append(ph)
def find():
k=int(input("Enter the price"))
print(phone[k])
def rem():
k=int(inpu... | true |
4ee8a63c6231e487a44b3eeb7058d03eaf1c95aa | Python | alexdylan/app1 | /planta.py | UTF-8 | 516 | 2.5625 | 3 | [] | no_license | class Planta:
def __init__(self,conexion,cursor):
self.conexion = conexion
self.cursor = cursor
def agregar(self, cultivo, fecha, id_clasi, id_inv):
insertar = ("INSERT INTO planta(cultivo,fecha, id_clasi,id_inv) VALUES(%s,%s,%s,%s)")
self.cursor.execute(insertar, (cultivo,fecha,id_clasi,id_inv))
self.co... | true |
0a1546727c5c78e7464dc8a73baa1db7b2f5efb4 | Python | SrPrakhar/airflow-training-skeleton | /dags/excercise2.py | UTF-8 | 1,126 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from datetime import date, datetime, timedelta
import airflow
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
args = {
'owner': 'Prakhar',
'start_date... | true |
4866153e4cc761b1c524c3ba9c853bc44497b212 | Python | kduan005/nand2tetris | /project7/src/VMTranslator.py | UTF-8 | 10,353 | 3.28125 | 3 | [] | no_license | import sys
import collections
class parser(object):
'''
parser class that parse a single line of vm command into individual parts
including:
commandType: if a command is arithmetic or push/pop
argOne: first argument including "sub", "neg", "gt", "not",
"add", "eq", "lt", "or", "and", "not", "pu... | true |
ad1750b02e4d7767f1365d5dd2133cb5189a2565 | Python | ramadevim/Basic-python | /basic/basic/slicing.py | UTF-8 | 279 | 3.0625 | 3 | [
"MIT"
] | permissive | l=[1,2,3,4,5,6,7,8,9]
print(l[-1])
#l[start:stop:step]
print(l[:])
print(l[0:5])
print(l[0:5:2])
print(l[-1::-1])
a='http://coreyms.com'
print(a)
print(a[::-1])#reverse url
print(a[-4:])#top level domain
print(a[7:])#without http
print(a[7:14])#without http and top level domain | true |
a4e01b24756bdf83acb143470d02bb11e32da061 | Python | I-ll-Go-Rythm/2021_winter_study | /geonhokim/3.Divide_and_Conquer/부분배열_고르기_오답.py | UTF-8 | 1,313 | 3.109375 | 3 | [] | no_license | from typing import List
class Solution:
def subArray(self, arr: List[int]) -> int:
if len(arr) == 1:
return arr[0]*arr[0]
if len(arr) == 2:
return max(arr[0]*arr[0], arr[1]*arr[1], sum(arr) * min(arr))
maxSum = 0
piver = len(arr) // 2
... | true |
1a313a9a4d2baed70a308b8cd9d1b03ccee7308a | Python | heroku11/MentionAjg | /bot/modules/doom_dao.py | UTF-8 | 866 | 2.625 | 3 | [] | no_license | from dataclasses import asdict, dataclass
from datetime import datetime
from pymongo.collection import Collection
@dataclass
class DoomedUser:
uid: int
first_name: str
chat_id: int
ts_doom: datetime
ts_lib: datetime
ts_reset: datetime
@property
def asdict(self):
return asdict... | true |
75d0a9ff46d5d5dbf6c745f492f74b46ccb90069 | Python | brunotjuliani/Fiu | /Programas/ECMWF_SFC_SIMPLES.py | UTF-8 | 1,698 | 2.609375 | 3 | [] | no_license | ## PARA DADOS EM NÍVEL DE SUPERFÍCIE
#imports
import pandas as pd
from datetime import datetime, timedelta
from ecmwfapi import ECMWFService
#fazendo um range para se colocar às datas selecionadas
date_range = pd.date_range(start='20190531',end='20190531', freq="D").strftime('%Y%m%d').to_list()
for dates in date_range:... | true |
907b3521de633b5376a3d94a7fc18a5ec4e795ba | Python | mcpeer/django_polls | /polls/tests.py | UTF-8 | 4,823 | 2.703125 | 3 | [] | no_license | import datetime
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.test import TestCase
from django.utils import timezone
from django.urls import reverse
from .models import Question
# Create your tests here.
class QuestionModelTests(TestCase):
def test_was_pu... | true |
572a064a1505dfde03b998f182f87dc16842f29d | Python | djaney/machine-learning | /05_mnist.py | UTF-8 | 2,300 | 2.859375 | 3 | [] | no_license |
'''
Use MNIST database
1 layer with 10 neurons in softmax yeilds 19%
2 layer with 10 neurons each in softmax yeilds 9%
2 layer with 10 neurons each in relu and softmax yeilds 53%
5 layer with 10 neurons each in relu and softmax, 0.003 to 0.1 learning yeilds 85%
with decay 73%
with dropout 93%
some droppings
'''
# Im... | true |
aca2e723571a39b4fc8810d26181588e275eccbc | Python | mtreinish/bqskit | /bqskit/compiler/task.py | UTF-8 | 3,052 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | """
This module implements the CompilationTask class, TaskException, TaskStatus
enum, and the TaskResult class.
The CompilationTask class describes a compilation problem. These can be
submitted to an engine. The different CompilationTask states are enumerated in
TaskStatus. Once a CompilationTask is completed, a TaskR... | true |
e011a80b61528556f31ba5759aa41c549da3a1c1 | Python | frozbiz/pe | /010 - sum of primes less than a million.py | UTF-8 | 652 | 3.71875 | 4 | [] | no_license | # Find the sum of all the primes below two million.
nCurrPrime = 2
def isPrime(x):
# slight speed-up, although starting at 2 and going by one works fine as well
if (x == 2):
return True
if (x % 2 == 0):
return False
i = 3
while (i*i <= x):
if (x % i == 0):
... | true |
8fbda9e9e0f69ac59ca843c245de1a38b382d631 | Python | JulianaM2/roadFighter | /menu.py | UTF-8 | 2,222 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 09:39:33 2019
@author: jumunoz
"""
import tkinter as tk
import roadFighter as rf
from PIL import ImageTk, Image
#Function to replace the window with the gameover menu
def gameOverWindow (points):
gameOver = tk.Tk() #Start a new window named gameover
gam... | true |
6f86528e915d1672b2e56cdd42bc46ba01972401 | Python | mic16/area | /backend/service/Trigger.py | UTF-8 | 399 | 2.671875 | 3 | [] | no_license | class Trigger():
def __init__(self, func=None, types=[]):
self.types = types.copy()
self.action = func
def addType(self, type):
self.types.append(type)
return self
def getTypes(self):
return self.types
def setAction(self, func):
self.action ... | true |
10e1264be3a6c5caa0b1ee0ac249d4828af003e3 | Python | EmbraceLife/LIE | /my_utils/line_continuous_color.py | UTF-8 | 3,744 | 3.5 | 4 | [] | no_license | """
line_continuous_color
key answer is found here
https://stackoverflow.com/questions/17240694/python-how-to-plot-one-line-in-different-colors
# I have two datasets, one is array with shape (30,), named line_data; the other one is array (1, 30), named color_data.
# I have used line_data to plot a line, use color_dat... | true |
02795a3874849ab461576f4f1a4d14c661d68552 | Python | ftarantuviez/Classification-Iris | /main.py | UTF-8 | 1,671 | 3.046875 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import pickle
from sklearn import datasets
st.set_page_config(page_title='Simple Iris Classification', page_icon="./f.png")
hide_streamlit_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
</style>... | true |
e5f99c2156dbb3e3af6991553218c7103ec4dd88 | Python | yangroro/gitpractice2 | /예제6.py | UTF-8 | 247 | 3.53125 | 4 | [] | no_license | user_input = input("저장할 내욜을 입력하세요:")
f = open('test.txt', 'a') # 내용을 추가하기 위해서 'a'를 사용
f.write(user_input)
f.write("\n") # 입력된 내용을 줄 단위로 구분하기 위해 줄 바꿈 문자 삽입
f.close()
| true |
dd16ca0bda97bc5df24fdd996ca849e5ccff1fc9 | Python | chi-jams/Projects | /ICPC_Practice/oop.py | UTF-8 | 423 | 3.203125 | 3 | [] | no_license | N, Q = [int(i) for i in input().split(" ")]
words = []
for i in range(N):
words.append(input())
for i in range(Q):
pattern = input().split('*')
len0, len1 = len(pattern[0]), len(pattern[1])
match = 0
for word in words:
if len0 + len1 > len(word):
continue
if pattern[0]... | true |
e555af5a08a7ac3e639027206f9abd10b46da523 | Python | ReyRizki/Komgraf | /Blender/W12/fence.py | UTF-8 | 4,076 | 2.953125 | 3 | [] | no_license | import bpy
import random
from math import radians, sin, cos, tan, pi
from mathutils import Matrix
def clear_scene():
for obj in bpy.data.objects:
if(obj.name != 'Sun'):
bpy.data.objects.remove(obj)
for mtr in bpy.data.materials:
bpy.data.materials.remove(mtr)
def rotat... | true |
5429c5f8bd93e942424a393f11f1543707723a9b | Python | cmeuth/SIUEDSS | /GPIO/accelerator.py | UTF-8 | 921 | 3.09375 | 3 | [] | no_license | import Adafruit_BBIO.GPIO as GPIO
import time as t
import threading
def blink_leds( led ):
global running
while running:
GPIO.output( led, GPIO.HIGH )
t.sleep( 0.5 )
GPIO.output( led, GPIO.LOW )
t.sleep( 0.5 )
print "thread closed"
############### Function Definitions over #############
def main():
pr... | true |
db6595a5d8e0cf5102250160f9b0d7b015e9f7cb | Python | rocknrolltt/pir_webservice | /web-services-master-2c4daf620c344203ab5c51bf160d2bc4f0de3fda/PIR/output_xml.py | UTF-8 | 9,768 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 22 09:54:40 2015
@author: bwoods
"""
import logging
from datetime import datetime
import xml.etree.ElementTree as ET
import numpy as np
from PIR import __version__
class Annual_Peril:
'''
Peril-specific data to be included in the report
'''
def __ini... | true |
574bf0c42d1d59f9bf0eded49cc5b0d8682ec6fe | Python | mohanrex/music_led_strip_control | /client/main.py | UTF-8 | 4,234 | 2.734375 | 3 | [
"MIT"
] | permissive |
from libs.config_service import ConfigService
from libs.effects import Effects
from libs.effects_enum import EffectsEnum
from libs.notification_enum import NotificationEnum
from libs.notification_service import NotificationService
from libs.server_service import ServerService
from libs.audio_process_service import Aud... | true |
645fc701ed2be6063b3d59f4797bbfe79d3af449 | Python | jihoahn9303/tensorflow_manual | /code/17.Gradient_Vanishing.py | UTF-8 | 2,291 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 20 11:00:40 2021
@author: jiho Ahn
@topic: Gradient Vanishing Problem
"""
import os
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = "true"
import json
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from termcolor import colored
import ten... | true |
5b5171a708a0e01dcdc2185d927a678d525bc73a | Python | 5362396/Wizualizacja-Danych | /cw5/zad4.py | UTF-8 | 531 | 4.125 | 4 | [] | no_license | # Korzystając z powyższego kodu stwórz kilka instancji klasy Point i spróbuj odwołać się do zmiennej counter z poziomu różnych instancji, porównując jej wartość dla każdej z nich oraz spróbuj zmienić jej wartość
class Point:
counter = []
def __init__(self, x=0, y=0):
self.x = x
self.y = y
... | true |
db2bc7d8404fd801f10ac6fa983ba88123eb1f4f | Python | rexuru17/planning-master | /products/models.py | UTF-8 | 1,048 | 2.546875 | 3 | [] | no_license | from django.db import models
# Create your models here.
class ProductGroup(models.Model):
product_group = models.CharField(max_length=100, unique=True)
def __str__(self):
return self.product_group
class ProductSubGroup(models.Model):
product_group = models.ForeignKey(ProductGroup, on_delete=mo... | true |
76da4e6ae085340d515e6ef608b606dadb7b0301 | Python | Sarthak762/Friday-Mini-Desktop-Assistant | /main.py | UTF-8 | 2,304 | 2.78125 | 3 | [] | no_license | import pyttsx3
import speech_recognition as sr
from datetime import datetime
import wikipedia
import webbrowser
import os
def speak(text):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
engine.say(text)
engine.runAndWait()
def welcome():
''... | true |
2971b6800fbb92467047a154a6c060eb1cb04b72 | Python | sohelahmadkhan/inferential_stats_project | /q04_chi2_test/build.py | UTF-8 | 482 | 2.875 | 3 | [] | no_license | # Default imports
import scipy.stats as stats
import pandas as pd
import numpy as np
df = pd.read_csv('data/house_pricing.csv')
# Enter Code Here
def chi_square(df):
x = df.LandSlope
price = pd.qcut(df['SalePrice'],3,labels = ['High','Medium','Low'])
freqtab = pd.crosstab(x,price)
chi2,pval,dof,expe... | true |
290ab7edb84ebd9cf543bca847889a882ce949f1 | Python | tarashetman/stmodelling | /modules/FCNmodule.py | UTF-8 | 1,859 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
class FCNmodule(torch.nn.Module):
"""
This is the CONV implementation used for linking spatio-temporal
features coming from different segments.
"""
def __init__(self, img_feature_dim, num_frames, num_class, relation_type):
... | true |
13c06844583259bcb3fe1cf024b4942ac2d7192f | Python | furas/python-examples | /flask/ajax-setinterval-get-thread-result/main.py | UTF-8 | 2,135 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# date: 2020.01.17
# https://stackoverflow.com/questions/59780007/ajax-with-flask-for-real-time-esque-updates-of-sensor-data-on-webpage/
from flask import Flask, request, render_template_string, jsonify
import datetime
import time
import threading
app = Flask(__name__)
running = False # to co... | true |
90e01ed3410a0af85102496c5384cf9c06f94e0d | Python | MattHartshorn/otp-encryption | /test/testhelper.py | UTF-8 | 806 | 2.65625 | 3 | [
"MIT"
] | permissive | import unittest
import sys
import os
sys.path.append(os.path.abspath("../src"))
import keygenerator
from helper import binStrToBytes
class TestHelper(unittest.TestCase):
def test_binStrToBytes(self):
key = keygenerator.generate(8, True)
self.assertEqual(len(binStrToBytes(key)), 8)
def test_b... | true |
daef694441f85592b9e4d3a1767e5ed247201d91 | Python | haiou90/aid_python_core | /day19/personal_house_information_manager_system/bll.py | UTF-8 | 1,466 | 2.984375 | 3 | [] | no_license | """
业务逻辑层
"""
from dal import HouseDao
class HouseManagerController:
def __init__(self):
self.__list_houses = HouseDao.load()
self.max = self.__list_houses[0]
self.dict_type_house = {}
self.set_house =set()
@property
def list_houses(self):
return self.__list_hous... | true |
9ac88c5b6818d91177b096a5cfb5dfc303cac925 | Python | ytakzk/timber_assemblies | /UR_Control/geometry/surface.py | UTF-8 | 18,161 | 2.921875 | 3 | [
"MIT"
] | permissive | import Rhino.Geometry as rg
from geometry.beam import Beam
import copy
import math
class Surface(object):
def __init__(self, surface, u_div=5, v_div=3, beam_width = 160, beam_thickness = 40):
""" Initialization
:param surface: Base rg.geometry object that will be edited
:param u_d... | true |
a2db046f11286b79ff68844072e1a6bf783d2f92 | Python | AndreaCenturelli/IoT_for_professor | /emulator/sensor_emulators/heartBeat_emulator.py | UTF-8 | 972 | 2.796875 | 3 | [] | no_license | import json
from datetime import datetime
import pytz
utc = pytz.utc
class HeartBeatEmulator(object):
def __init__(self):
self.BPM = 85
def increaseHeartBeat(self):
increaseInit = 0.08
increaseLater = 0.01
if self.BPM <120:
self.BPM = self.BPM + self.... | true |
1d3ce5372b1ad609f562fde8b69a1beb2db058a2 | Python | AdrianTVB/AreYouBeingServed | /scrape/scripts/url_to_text.py | UTF-8 | 2,990 | 2.640625 | 3 | [] | no_license | # Initial script sourced from https://stackoverflow.com/questions/328356/extracting-text-from-html-file-using-python
#import urllib
import requests
from bs4 import BeautifulSoup
#from cStringIO import StringIO
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextCo... | true |
da415245283472a5db1320c646d370ec0623d865 | Python | ScribesZone/ModelScript | /modelscript/megamodels/dependencies/__init__.py | UTF-8 | 702 | 2.515625 | 3 | [
"MIT"
] | permissive | # coding=utf-8
"""Dependencies.
This module provides only one abstract class "Dependency",
the root of all concrete dependencies defined in separated modules.
"""
from abc import ABCMeta, abstractmethod
from modelscript.base.exceptions import (
MethodToBeDefined)
MegamodelElement = 'MegamodelElement'
class Dep... | true |
a5ea5fd94e30654d7002003f1701f8ba4d35d495 | Python | ngynmt/venmo-autopay | /pay_my_bills.py | UTF-8 | 3,207 | 2.703125 | 3 | [] | no_license | from splinter import Browser
with Browser() as browser:
# visit url
url = "https://www.venmo.com"
browser.visit(url)
browser.cookies.delete()
# credentials
my_name = "John Smith" # your name on venmo
my_number = "5555555555" # phone number used to log in
my_password = "YOUR_PASSWORD" # password
# bills
bil... | true |
a68fcbc0c07f668327aa010d4fa593b4fb801a6d | Python | andiselvam77/example | /Tkinter.py | UTF-8 | 213 | 2.671875 | 3 | [] | no_license | from tkinter import *
root=Tk()
root.geometry('100x100')
def b1():
s=e1.get()
d=eval(s)
label1=Label(root,text=d).pack()
e1=Entry(root)
e1.pack()
but1=Button(root,text='click',command=b1).pack()
mainloop()
| true |
e9e4d7b43ad34d2f95e2d342edc7f068f4f63220 | Python | ctaylor4874/lat_lng_queue_loader | /app/__init__.py | UTF-8 | 1,719 | 2.59375 | 3 | [
"MIT"
] | permissive | import os
import logging
from json import dumps
from flask import Flask, render_template, request, redirect, url_for, flash
import sqs
GOOGLE_API_KEY = os.getenv('GOOGLE_API_KEY')
SECRET = os.getenv('QUEUE_LOADER_SECRET').encode()
app = Flask(__name__)
app.config['SECRET_KEY'] = bytes(SECRET)
def send_message(queue... | true |
ed0cf769823d3f068a1757d7b6a31934950b0ae2 | Python | JC-Quil/Seizure_prediction_from_iEEG | /converter.py | UTF-8 | 14,550 | 2.78125 | 3 | [] | no_license | ### This script convert the sample signals into subsamples and calculate the features ###
# Import python libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Get specific functions from some other python libraries
from math import floor, log
from scipy.stats import skew, kurtosis
from s... | true |
699639a9a26044e995fd1f75b465d4773b4413f7 | Python | Aasthaengg/IBMdataset | /Python_codes/p02401/s212531329.py | UTF-8 | 138 | 2.75 | 3 | [] | no_license | while True:
a, op, b = input().split()
if op == '?':
break
if op == '/':
op = '//'
print(eval(a + op + b)) | true |
dfa99d339fbee70bd93d40b19028090439d91870 | Python | klehman-rally/pyral | /rallyfire.py | UTF-8 | 2,921 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
#################################################################################################
#
# rallyfire - Exemplar script to test the basic connectivity to a Rally server
# and obtain basic workspace and project information
#
#################################################... | true |
7884b49b0e20d3b6c64402cbf9f4951aae1bb54d | Python | robledito/Proyect-Euler | /untitled.py | UTF-8 | 115 | 3.046875 | 3 | [] | no_license | def D(n):
if n==0:
return 400000*1.05
else:
return ((D(n-1)*1.05 )) - 25000
print(D(37)) | true |
3279a9249325abe58e03cca6933bae3afce219d1 | Python | chui101/covid-vis | /flask/states.py | UTF-8 | 2,672 | 3.546875 | 4 | [] | no_license | import json
class state_info:
def __init__(self, datafile = "data/states.json"):
with open(datafile,'r') as fp:
self.data = json.load(fp)
def get_states(self):
"""Gets a list of two letter state codes present in states.json"""
return self.data.keys()
def get_name(self,... | true |
ed7a409aafd9fb97b057744edfbbb1391d31c260 | Python | Aasthaengg/IBMdataset | /Python_codes/p03693/s589044069.py | UTF-8 | 134 | 3.09375 | 3 | [] | no_license | r,g,b = input().split(" ")
r = int(r)
g = int(g)
b = int(b)
i = 100*r + 10*g + b
x = i % 4
if x==0:
print("YES")
else:
print("NO") | true |
d304898faa9df15b6314fd37e0d7fa5de3cfa65b | Python | XtmRebron20/learning_web_spider | /learning_urllib/urllib_URLError.py | UTF-8 | 673 | 3.28125 | 3 | [] | no_license | # 学习urllib标准库中error模块
# 这是一个打开一个未知页面的脚本
# 用于学习URLError类的reson属性
# 标准库:urllib 模块:error 类:URLError
# 继承自OSError类(error异常模块的基类)
# from urllib import request, error
try:
response = request.urlopen('https://cuiqingcai.com/index.html')
except error.URLError as e:
print(e.reason)
# 标准库:urllib 模块:error 类... | true |
d46b0979531cc2e952947852058b7ce24d908502 | Python | slash-todo/advent-of-code-2018 | /04/wizzardoo/day4.py | UTF-8 | 3,413 | 3.8125 | 4 | [
"MIT"
] | permissive | class Guard:
def __init__(self, guard_id):
self.id = guard_id
self.activity = [0] * 60 # Represents their cumulative 60 minutes
self.sleep_times = {} # Not in use yet
self.time_asleep = 0
puzzleinput = []
with open("puzzleinput.txt", "r") as file:
for line in file:
... | true |
76b0c13e35a7d7064fb7dba74a776adc45144512 | Python | cdroulers/dr-who-vs-daleks | /DrWhoGame.py | UTF-8 | 28,891 | 2.6875 | 3 | [
"Unlicense"
] | permissive | # -*- encoding: utf-8 -*-
# Programme par Xtian Droulers et Pie-Hoes Leclapi
# Version 0.1 d�but� le 5 septembre 2006
# version 1.0 pr�te le 15 septembre 2006
# version 1.1 pr�te le 19 septembre 2006, voir "Docs/About.txt" pour les d�tails.
from Tkinter import *
import random
import winsound
from time import sleep
#fr... | true |
1e2661f70cb7b97050204c8b6a0f8b7b9908e41e | Python | cowlove/winglevlr | /plot_on_map.py | UTF-8 | 1,740 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python3
# Plot the files "out.plog" and "wpts.txt" on google maps, output file to "map.html"
# Display with "google-chrome ./map.html"
import gmplot
import re
import sys
filePlog1 = "./out.plog" if len(sys.argv) < 2 else sys.argv[1]
filePlog2 = "./out.plog" if len(sys.argv) < 3 else sys.argv[2]
fileWpts ... | true |
2d1e8c1ffeaccbe722350b58e1555629ebaf8c6d | Python | GayanSandaruwan/Concurrent-Matrix-Multiplication | /Submition/execute.py | UTF-8 | 3,334 | 2.609375 | 3 | [] | no_license | import subprocess
import math
import sys
import statistics
seq = []
parallel = []
parallelOpt = []
seqMean = {}
parallelMean = {}
parallelOptMean = {}
seqFile = sys.argv[1]
parallelFile = sys.argv[2]
parallelOptFile = sys.argv[3]
executeLimit = 2000
def numberOfSamples(dataSet):
n = ((100 * 1.96 * statistics.... | true |
3f53d5510b8658ed50204587cb493e79a6778ea3 | Python | xinsec/py | /ts2.py | UTF-8 | 215 | 2.546875 | 3 | [] | no_license | import time
import progressbar
bar = progressbar.ProgressBar(widgets=[
' [', progressbar.Timer(), '] ',
progressbar.Bar(),
' (', progressbar.ETA(), ') ',
])
for i in bar(range(200)):
time.sleep(0.1) | true |
cef12213ed12f9b8f4bacbba09174559e702c317 | Python | rldaugherty/Python-Repo | /01. Syntax/08. Calculations.py | UTF-8 | 787 | 4.3125 | 4 | [] | no_license | # Using numbers in calculations means we have to define them in a very specific way. We can't define them as strings (surrounded by quote marks). They need to be defined as INT() or FLOAT() to be used in mathmatical equations.
# When building equations, remember the "Order of Operations", or PMDAS for short (Parenthis... | true |