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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
db11e0934114548d31745405551f221c50c927e2 | Python | TomaszMichalski/rqa | /dbservice/database/insertions/misc.py | UTF-8 | 2,455 | 2.703125 | 3 | [] | no_license | # database.insertions.misc.py
from api import airly_reader
from database.getters import misc
def insert_address(cur, location, address):
latitude = location.get('latitude')
longitude = location.get('longitude')
country = address.get('country')
city = address.get('city')
street = address.get('stree... | true |
26d227680afeedc2819cf9e113ce3e7b6928ed0e | Python | hualili/opencv | /IP110-Deep-Learning/106-pytest55.py | UTF-8 | 468 | 3.515625 | 4 | [] | no_license | #!/usr/bin/python2.7
import math
def LoG2d(x, y, sigma):
xyp2 = x ** 2 + y ** 2
LoG = ((xyp2 - 2 * sigma**2) /(math.sqrt(2 * math.pi) * math.pow(sigma, 5))) * math.exp(-xyp2 / (2 * sigma**2))
return LoG
if __name__ == "__main__":
#try to see if position (-1, 0), (1, 0) and (0, -1), (0, 1) are all same... | true |
cc51a6222487508929d48fe20946559e5e6ea757 | Python | svdreijen/Cognitive_face_test | /cognitive_services_face/Face_verification_final.py | UTF-8 | 3,999 | 2.75 | 3 | [] | no_license | # Import libraries
import numpy as np
import cv2
import matplotlib.patches as patches
import requests
import matplotlib.pyplot as plt
import json
# Define functions to post request to face and vision API's
def detect_face(pic):
headers = {'Ocp-Apim-Subscription-Key' : subscription_key_face,
... | true |
3c2c6cc2c77d8b84f93304e08deb129f60323de2 | Python | pombredanne/django-roesti | /roesti/models.py | UTF-8 | 10,649 | 2.71875 | 3 | [
"MIT"
] | permissive | import collections
from hashlib import md5
import pickle
from django.db import models, transaction
def freeze(obj):
# If this is dict-like, return a sorted tuple.
if hasattr(obj, 'items') and hasattr(obj.items, '__call__'):
return tuple(sorted((key, freeze(value))
for key,... | true |
776d062439d06e9fcaceb3faf729f8c242fc7108 | Python | RSIP4SH/PythonFramework | /saveable/saveable.py | UTF-8 | 1,141 | 2.546875 | 3 | [] | no_license | __author__ = 'Aubrey'
import abc
#import configs.base_configs as base_configs
import copy
from configs import base_configs
class Saveable(object):
#__metaclass__ = abc.ABCMeta
def __init__(self,configs=base_configs.Configs()):
self._name_params = {}
self.configs = copy.deepcopy(configs)
... | true |
85899c911f44357b905685eab565fd52ac764fad | Python | Vaylide/pigeon | /breadcrumbs/poke.py | UTF-8 | 504 | 2.859375 | 3 | [] | no_license | # echo:
# repeats your message at you, unless
# the message is self-originated
class poke:
def __init__(self, client):
self.client = client
def act(self, msg):
self. client.privmsg(msg.targ, "ow")
return 0
def eat(self, msg):
return 0
class poek:
def __init(self, cli... | true |
2241f6d45a42228faa31116af55bdadba33f9a6b | Python | NULanguageLearning/Latin | /LatinN改.py | UTF-8 | 1,174 | 3.171875 | 3 | [] | no_license | import random
#名詞の活用語尾
suf=[["a","ae","am","ae","a","ae","arum","as","is","is"],["us","i","um","o","o","i","orum","os","is","is"]\
,["um","i","um","o","o","a","orum","a","is","is"]]
n=["単数","複数"]
s=["主格","属格","対格","与格","奪格"]
dic={}
def makedic(read):
file=open(read,"r")
f=file.read()
file.close()
f... | true |
de2bd1d132f78687050ab0aa0d4bec330fd5a862 | Python | yunini2/knowledge | /pearson.py | UTF-8 | 691 | 3 | 3 | [] | no_license | import math
def pearson(vector1, vector2):
n = len(vector1)
# simple sums
sum1 = sum(float(vector1[i]) for i in range(n))
sum2 = sum(float(vector2[i]) for i in range(n))
# sum up the square
sum1_pow = sum([pow(v, 2.0) for v in vector1])
sum2_pow = sum([pow(v, 2.0) for v in vector2])
# su... | true |
2e6857d2ac9a527924071e0ac42ca8e43e1cb65e | Python | anliec/CV_homeworks | /HW6/question1.py | UTF-8 | 1,015 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
def gaussian_reduce(im: np.ndarray):
im = cv2.GaussianBlur(im, (3, 3), 0)
im = cv2.resize(im, (0, 0), fx=0.5, fy=0.5, interpolation=cv2.INTER_NEAREST)
return im
def gaussian_expend(im: np.ndarray):
im = cv2.resize(im, (0, 0), fx=2.0, fy=2.0, interpolation=cv2.INTER_NEAR... | true |
e96b472d38c56302c9953d478f416787999cf7a3 | Python | daniel-reich/ubiquitous-fiesta | /3gziWsCxqGwGGZmr5_10.py | UTF-8 | 168 | 3.109375 | 3 | [] | no_license |
def is_prime(n):
return n>1 and all(n%i for i in range(2, int(n**0.5)+1))
def fat_prime(a, b):
return [x for x in range(min(a,b), max(a,b)+1) if is_prime(x)][-1]
| true |
212f14db4836078904b8966df84ddcdf6fcd1e54 | Python | nguyenngoclinhchi/CS3244-Project | /linh_chi.py | UTF-8 | 2,877 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Linh_Chi.ipynb
Original file is located at
https://colab.research.google.com/drive/13SEnWoVQlVhCtoKFGTQQbbwpF0k3MBcD
"""
# Commented out IPython magic to ensure Python compatibility.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
pd.set_optio... | true |
b039720e0a09b3126d928c66ff4a7f4f976435e9 | Python | sylvaus/presentations | /python/code/exercise_solutions/01_print_input.py | UTF-8 | 437 | 4.4375 | 4 | [] | no_license | """
Exercise 1:
Fill your_function to make it ask for a name and then print a welcome message
Help: to display text to the operator use the print function
Example:
print("hello")
You can print print multiple things by separating them by a comma:
Example:
print("hello", "and", "welcome")
"""
def your_function... | true |
ebf9be3eeedd4c901f8464a62bf58785cb6b4ec1 | Python | samshipengs/AlgoTool | /A1/fibonacci_huge/fibonacci_huge.py | UTF-8 | 535 | 3.25 | 3 | [] | no_license | # Uses python3
import sys
def get_fibonaccihuge(n, m):
if m == 1:
return 0
else:
N = m*10
F = [0]*(N+1)
F[0] = 0
F[1] = 1
F_mod = [0]*(N+1)
F_mod[0] = 0
F_mod[1] = 1
for i in range(2,N+1):
F[i] = F[i-1] + F[i-2]
F_mod[i] = F[i] % m
rep = int(i/2)+1
if F_mod[:rep] == F_mod[rep:i+1]:
... | true |
f87d18e9e6ffd0647dccba96f2d9c331eb71baff | Python | Aasthaengg/IBMdataset | /Python_codes/p03071/s328507384.py | UTF-8 | 105 | 2.765625 | 3 | [] | no_license | a,b=map(int,input().split())
ans=max(a,b)
if ans==a:
a=a-1
else:
b=b-1
ans+=max(a,b)
print(ans)
| true |
7e8e3e64234bec55f36c8a9621bf6edce029fd42 | Python | gregburek/Coding-Out-of-a-Wet-Paper-Bag | /pythonchallenge.com/3.py | UTF-8 | 863 | 2.734375 | 3 | [] | no_license | equality_file = open('equality.html')
#equality_file = ['mkPytpvUSvuPtLFmkeKQIiWNNNaJouCnyPyiaRBSYuvMtBXylHWIKkexawFeNwjIpTJBImSUXiAAAipljptIj']
rare_chars = ''
answer = ''
for line in equality_file:
for char in line:
if char.isalpha() == False:
continue
if len(rare_chars) < 3 and char.i... | true |
722a891f2028b8f9f1a96b1f5abfcbac77cf625f | Python | MlvPrasadOfficial/KaggleNoteboooks_of_Projects | /4 jigsaw/lightgbm-fast-compact-solution.py | UTF-8 | 9,253 | 2.59375 | 3 | [
"MIT"
] | permissive | #import modules
import numpy as np
import pandas as pd
from contextlib import contextmanager
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy.sparse import hstack
import time
import re
import string
from scipy.sparse import csr_matrix
from sklearn.preprocessing import MinMaxScaler
impor... | true |
b4abcba4e96b9e43e52da9c13d159ce8cc2b8649 | Python | groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples | /Examples/AdvancedUsage/CustomizeChangesStyles.py | UTF-8 | 1,708 | 2.625 | 3 | [
"MIT"
] | permissive | # Import modules
import groupdocs_comparison_cloud
from Common import Common
# This example demonstrates how to compare documents with customizing changes styles
class CustomizeChangesStyles:
@classmethod
def Run(cls):
api_instance = groupdocs_comparison_cloud.CompareApi.from_config(Common.GetConfig... | true |
7a2aa8ba12cfa2a053275609e192c321ba741cb7 | Python | hsstock/hsstock | /hsstock/vnpy/event/event_type.py | UTF-8 | 553 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # encoding: UTF-8
'''
本文件仅用于存放对于事件类型常量的定义。
由于python中不存在真正的常量概念,因此选择使用全大写的变量名来代替常量。
这里设计的命名规则以EVENT_前缀开头。
常量的内容通常选择一个能够代表真实意义的字符串(便于理解)。
建议将所有的常量定义放在该文件中,便于检查是否存在重复的现象。
'''
EVENT_TIMER = 'eTimer' # 计时器事件,每隔1秒发送一次
EVENT_TIMER2 = 'eTimer2'
EVENT_TIMER3 = 'eTimer3'
| true |
3a49c13b8bd80ae724fa84b0ccb32c24f9278b06 | Python | WellersonPrenholato/Maratona-UFV | /machinelearning.py | UTF-8 | 390 | 3.234375 | 3 | [] | no_license |
p = ['capivara', 'capivaro','capivarista', 'capivaristo']
def resp(lines):
for line in lines:
for palavra in p:
if ( line.find(palavra) >= 0 ):
return 'YES'
return 'NO'
lines = []
while True:
try:
line = input()
line = line.lower()
... | true |
b333b2f62a3e066c8c243e06d8e119c85fb77565 | Python | thaus03/Exercicios-Python | /Aula07/Desafio010.py | UTF-8 | 282 | 4.25 | 4 | [] | no_license | # Crie um programa que leia quanto dinheiro a pessoa tem na carteira e mostre quantos dólares ela pode comprar.
# Considere:
# US$ 1,00 = R$3,27
dinheiro = float(input('Informe quanto dinheiro você possui: '))
print(f'Você pode comprar \033[32m{dinheiro//3.27}\033[m dólares')
| true |
d7d212e90abc70e82a41902ab3f6c775f7684214 | Python | 15194779206/practice_tests | /education/B:oldBoy/2不懂知识点汇总/1文件的读与写/8:with.py | UTF-8 | 127 | 2.75 | 3 | [] | no_license | with open("yesterday2",'r',encoding="utf-8") as f:
#相当于f=open("yesterday",'r',encoding="utf-8")
print(f.readline()) | true |
1866300f2b8eb3e29d30586fc0ec9a16d0738a39 | Python | porcpine1967/aoe2_comparisons | /utils/sample.py | UTF-8 | 3,230 | 2.75 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
""" Build sample data sets. """
import argparse
import concurrent.futures
import csv
import pathlib
import random
import time
import utils.solo_models
import utils.team_models
ROOT_DIR = str(pathlib.Path(__file__).parent.parent.absolute())
def get_record(n):
return n.to_record()
def matche... | true |
695996d2bd619a61bbbe2bb207e17d3d978cfbed | Python | keith-packard/altusmetrum | /packages/RN4678.py | UTF-8 | 4,586 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
# Copyright 2016 by Bdale Garbee <bdale@gag.com>. GPLv3+
#
# Program to emit PCB footprint for Microchip RN4678 Bluetooth LE module
#
# dimensions in mm from BM70/71 Data Sheet (part of the same family)
BodyWidth = 12.00
BodyHeight = 22.00
GndEdgeLine = 18.00
PinWidth = 0.7
PinHeight = 1.5
PinSpa... | true |
957be96cead5e84ca005ea77e241a1739146d9af | Python | harveylabis/GTx_CS1301 | /codes/CHAPTER_4/Chapter_4.2_Strings/Lesson_5/Split-4.py | UTF-8 | 65 | 3.5 | 4 | [] | no_license | names = input("Enter a list of names: ")
print(names.split(","))
| true |
a501d5195f297d7141289e8fd7cdb3fdc3cc91df | Python | Jiao-Jia-Xiong/path-finding | /demo/visualization_for_nodes.py | UTF-8 | 4,753 | 3.1875 | 3 | [] | no_license | import pygame as pg
from demo_map import nodes_map, Node
from typing import Tuple, List
from random import randint
pg.init()
def get_nodes_position(node: Node,
ox: int,
oy: int,
sqr_len: int) -> Tuple[int, int]:
"""return nodes position in a py... | true |
591156bef70cf0d4574193311acb42c6efd45d1c | Python | GyuriKim12/CodingTestStudy | /choigoun/1week/1920.py | UTF-8 | 1,711 | 3.796875 | 4 | [] | no_license | # # binary search를 안 쓰면 런타임 에러
# class Stack:
# def __init__(self):
# self.list =[]
# def push(self,item):
# self.list.append(item)
# def pop(self):
# # 비어 있지 않다면
# if not self.isEmpty():
# return self.list.pop(-1)
# else:
# return -1
#... | true |
8367b2b7185eaf1066cc850705f7397ced8c076a | Python | hernancardoso/p2p-file-sharing | /downloadHandler.py | UTF-8 | 7,267 | 2.609375 | 3 | [] | no_license | import socket
import time
import threading
import sys
import lib.common as utils
import lib.variables as variables
import settings.config as config
serverSocket = ""
threadError = {}
def init():
global serverSocket
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverSocket.bind((confi... | true |
bc63c70b43442fe365866d0bcf511b7d7e8e32ab | Python | TakanoriHasebe/DeepLearning | /ManufactureDeepLearning/make-neural-network/make_trainer.py | UTF-8 | 3,909 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 21 09:57:36 2017
@author: Takanori
"""
"""
ニューラルネットワークの訓練を行うクラス
* 課題点
0. 初期化関数群
1. バッチ処理について忘れている
2. バッチ処理とミニバッチ処理について
3. バッチ処理の書き方
4. 勾配の最適化手法の初期化
5. 勾配の更新でパラメータをどこから持ってくるかについて
6. ミニバッチ学習の際の繰り返しの回数の設定について
7. ミニバッチ学習とバッチ学習
8. train_step関数とtrain関数
9... | true |
66e77b04861a4045c314c5c2a7dd2191cb2f4f2d | Python | smart8099/Zaana | /static/css/Q2.py | UTF-8 | 326 | 4.28125 | 4 | [
"MIT"
] | permissive | #program to check if a string is palindrome
def check_palindrome(value):
if value == value[::-1] :
print('the string is palindrome')
else:
print('the string is not palindrome')
value = input('enter the string to check whether it is palindrome or not: ')
check_palindrome(value) ... | true |
e1000b2370e572314aac51b2ae0d163d32a202d9 | Python | Tiagoksio/estudandoPython | /exercicios004/conteA.py | UTF-8 | 502 | 4.40625 | 4 | [] | no_license | '''Faça um programa que leia uma frase pelo teclado e mostre:
Quantas vezes aparece a letra "A";
Em que posição ela aparece pela primeira vez;
Em que posição ela aparece pela última vez.'''
frase = " ".join(input('Informe uma frase: ').lower().split())
print('''A frase: "{}"...
Possui {} letras "A";
A primeira... | true |
56731e7bf62011733f09d85c0dc7a3a302de4403 | Python | huangqing6/RUL-prediction | /codes/feature_selection.py | UTF-8 | 3,448 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import f1_score,confusion_matrix
from sklearn.metrics import accuracy_score
import seaborn as sns
# Data preproces... | true |
6492c8add49cfa4f10228adebf3c2d54bcc3d555 | Python | victorltd/DEV_python | /Repeticao/loops.py | UTF-8 | 1,449 | 4.65625 | 5 | [] | no_license | # Exemplo das estruturas de repitções em Python
# Primeiro vamos ver como funciona o FOR
# Se temos uma Lista de nomes, números e queremos acessar esses valores um por um fazemos o seguinte
nomes = ['Ramon', 'André', 'Leon', 'Victor', 'Matheus']
for i in nomes: # Podemos observar que o valor de saída é o valor q... | true |
602d5bb3ab45f4cd410b93bd5d3604f705cd0c7e | Python | yyfxm/pyblackhat | /chp3/sniffer.py | UTF-8 | 389 | 2.59375 | 3 | [] | no_license | import socket
import os
#host
host = "192.168.1.104"
#create orginal socket and bind in public port
if os.name == "nt":
socket.protocol = socket.IPPROTO_IP
else:
socket_protocol = socket.IPPROTO_ICMP
sniffer = socket.socket(socket.AF_INET,socket.SOCK_RAW,socket_protocol)
sniffer.bind((host,0))
sniffer.setsockopt(so... | true |
595f5effb6a4834b48060ccafca7f49105fcec50 | Python | hybae430/Jungol | /LC/119_디버깅_형성평가4.py | UTF-8 | 154 | 3.125 | 3 | [] | no_license | from datetime import datetime
now = datetime.now()
a = 0
print(a, end=" ")
a = now.year - 1900
print(a, end=" ")
a += now.month - 1
a += now.day
print(a) | true |
2ce18c2284afa79c390fd820aef449874867b8d2 | Python | ralsuwaidi/BotMother | /utils/common.py | UTF-8 | 214 | 3.296875 | 3 | [] | no_license | import random
def random_line(file) -> str:
"""gets random line from file"""
lines = []
with open(file) as f:
lines = f.read().splitlines()
return lines[random.randint(0, len(lines)-1)]
| true |
b1945638159349d0cb109c53f17a4af7aa302114 | Python | dykesk/Plant_EnergySE | /src/plant_energyse/openwind/rwTurbXML.py | UTF-8 | 17,398 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | # rwTurbXML.py
# 2014 03 28
# Read and write turbine XML (*.owtg) files
# - created by merging rdTurbXML.py and wrtTurbXML.py
'''
Read/write XML tree that conforms to the OpenWind TurbineType XML format
G. Scott, NREL 2013 07 09
2014 03 24: updated documentation
USAGE (reading):
import rwTurbXML... | true |
329f1a2e664c79d11ce1bf12435a35ffbdf0ccc4 | Python | shen-huang/selfteaching-python-camp | /exercises/1901010167/1001S02E03_calculator.py | UTF-8 | 1,203 | 3.59375 | 4 | [] | no_license | #<<<<<<< master
def calculator():
while True:
x=int(input('x='))
opo=str(input('输入运算符'))
y=int(input('y='))
if opo == '+':
return (x+y)
elif opo == '-':
return (x-y)
elif opo == '*':
return (x*y)
elif opo == '/':
... | true |
678e2aab8eed9254325aa5acc36a8ec4be683114 | Python | NancyHebert/tssbe | /data/models/researcher.py | UTF-8 | 2,073 | 2.515625 | 3 | [] | no_license | from sqlalchemy import *
from data.models.utils.postgres_mixin import PGModel
class Model(PGModel):
def __init__(self, *args, **kwargs):
PGModel.__init__(self, args, kwargs)
self.researchers_table = Table('researchers', self.metadata, autoload = True)
def get(self, uniweb_number):
... | true |
cdfa59d7f806a19ce668f8269d5acdf79539326b | Python | StrongWind001/MagicAuto | /MagicAuto/common/operateYaml.py | UTF-8 | 371 | 2.515625 | 3 | [
"MIT"
] | permissive | #! -*- coding:utf-8 -*-
import yaml
def getyaml(fileName):
try:
with open(fileName,'r',encoding='utf-8') as f:
ret = yaml.load(f)
print(ret)
return ret
except FileNotFoundError:
print(u"找不到文件")
if __name__ == "__main__":
getyaml(r"D:\AutoEnv... | true |
7b4f84ae9cb817223f3c46121a4c585bb6927d35 | Python | Aboostrom/Blackjack-study | /dealer_hand.py | UTF-8 | 186 | 2.875 | 3 | [] | no_license | from deck import Deck
class Dealer:
def __init__(self, card):
self.deck = Deck().cards_as_array()
self.deck.remove(card)
self.hand = [card, self.deck.pop()]
| true |
1318bfeeb9610ec618afcfc24ecd7ec61e9f7d4a | Python | krnorris65/keahua-arboretum | /actions/feed_animals/feed_animal.py | UTF-8 | 1,533 | 3.875 | 4 | [] | no_license | import os
from .choose_animal import choose_animal
def feed_animal(arboretum):
'''Presents a list of animals a user can feed.
Arguments:
arboretum that animal will be in
'''
# list all types of animals
# once user selects an animal, create a list of all that animal in the arboretum (organize... | true |
831cff05f7ea267cb32aad4b6de460bbcaa7c132 | Python | chauhanmahavir/Python-Basics | /4.py | UTF-8 | 221 | 3 | 3 | [
"MIT"
] | permissive | example=10;
print(example);
example="hii"+"hello";
print(example)
exa=print("hello")
print(exa)
x,y=(3,5) #(x,y)=(3,5) , x,y=3,5
print(x)
print(y)
'''
x,y=(3,5,6) error :- too many value to unpack
'''
| true |
18306f50ae8377818d5415b5a76f5b69479770cd | Python | gracie524/comp5349 | /workload1.py | UTF-8 | 1,344 | 2.65625 | 3 | [] | no_license | from pyspark import SparkContext
import argparse
if __name__ == "__main__":
sc = SparkContext(appName="work1")
parser = argparse.ArgumentParser()
parser.add_argument("--input", help="the input path",
default='~/assignment/')
parser.add_argument("--output", help="the output path"... | true |
54a5d2f849cde12116652daa7ceed7dd652d988b | Python | FilipaNunes/CrossDocking | /cross.py | UTF-8 | 1,173 | 3.046875 | 3 | [] | no_license | import os
import pandas as pd
import jedi
data = pd.read_excel('data.xlsx')
# define data as a matrix
data.as_matrix()
i=0
j=0
same_client = [1] * len(data)
# the following cycle determines the number of packages to be delivered to a specific city
while i < len(data) - 1:
# if the next iteration is verified it ... | true |
765f4f2f79d7144c33a224830dce6ff622755835 | Python | mak705/Python_interview | /oops/class7_1.py | UTF-8 | 10,556 | 3.96875 | 4 | [] | no_license | def outer_function(): #outer function doesnt take any params
message = 'Hi' # Locat variable
def inner_function(): #Inner function will print the result
print message
return inner_function()
outer_function()
>> Hi
-------------------------------------------------------------------
def outer_functi... | true |
fcb102f306b40277035ca441338cc5a7b33318e6 | Python | JunjieZhouwust/Coronavirus-Estimation | /Coronavirus Estimationv1.1.py | UTF-8 | 5,347 | 2.9375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用于正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
L = 60 # 1月1日开始计算,总共预测50天
Today = 31 # 今天第31天
def dShift(lst, k):
return lst[k:] + lst[:k]
def dPPNum(n, k, ... | true |
d1ccc3da439a96c7b25af277ac166685882eb264 | Python | BinaryBurger/Cron-o-graph-Nagios | /binaryburger-cronograph-nagios.py | UTF-8 | 2,573 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
binaryburger-cronograph-nagios.py: Nagios plugin to monitor servers executing tasks managed by the BinaryBurger Cron-o-graph
Author: Jens Nistler <loci@binaryburger.com>
License: GPL
Version: 1.0
"""
import argparse, sys, urllib2, base64, json
# Constants
EXIT_OK = ... | true |
3486ff970216445c00c70301df48c8586717cf21 | Python | lordzizzy/leet_code | /04_daily_challenge/2021/03-mar/week2/swapping_nodes_linked_list.py | UTF-8 | 4,992 | 3.546875 | 4 | [] | no_license | # https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3671/
# You are given the head of a linked list, and an integer k.
# Return the head of the linked list after swapping the values of the kth node
# from the beginning and the kth node from the end (the list i... | true |
5f20fe776c15b6cb5f8c24c9bab47ff86f12bcf8 | Python | nilearn/nilearn | /examples/01_plotting/plot_haxby_masks.py | UTF-8 | 1,872 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Plot Haxby masks
================
Small script to plot the masks of the Haxby dataset.
"""
#########################################################################
# Load Haxby dataset
# ------------------
from nilearn import datasets
haxby_dataset = datasets.fetch_haxby()
# print basic information on the dat... | true |
821e6db208ae14d86e3d86ebe577870239a462c6 | Python | shiyoung77/6DoF_Pose_Estimation_with_Particle_Filtering | /pf_pose_estimation/preprocess.py | UTF-8 | 1,698 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | import os
import time
import numpy as np
import trimesh
from mesh_to_sdf import mesh_to_voxels # pip install mesh-to-sdf; https://github.com/marian42/mesh_to_sdf
def mesh_to_tsdf(mesh_path, vol_dim=101, save_path=None):
mesh = trimesh.load(mesh_path)
voxels = np.swapaxes(mesh_to_voxels(mesh, vol_dim - 2, pad... | true |
1bfc4853ada992122a852826f989dc45f9c7c350 | Python | zhosoft/python_learn | /lesson003/readme.py | UTF-8 | 644 | 2.875 | 3 | [] | no_license | # 模块定位顺序
# 当导入一个模块,python解析器对模块位置的搜索顺序是:
# 1、当前目录
# 2、如果不在当前目录,python则搜索在shell变量的PYTHONPATH下的每个目录
# 3、如果都找不到,python会查看默认路径,unix下,默认路径一般是/usr/local/python/
# 注意事项:
# 自己的文件名不要和已有的模块名重复,否则导致模块功能无法使用
# 使用from 模块名 import 功能的时候,如果功能名字重复,调用到的是最后定义或者导入的功能
# ----------------------------------------------------------------------... | true |
f19dab35f971baf9a8a62a0c92c36d775ab73365 | Python | kgolezardi/simulation-project | /pqueue.py | UTF-8 | 893 | 3.328125 | 3 | [] | no_license | import heapq
import itertools
class PriorityQueue:
def __init__(self):
self.heap = []
self.counter = itertools.count()
self.entry_finder = {}
self._size = 0
def size(self):
return self._size
def push(self, priority, x):
count = next(self.counter)
e... | true |
62d293f6ef145e4ef92cb4ef29b8d1fceccdea09 | Python | npkhang99/Competitive-Programming | /Codeforces/703A.py | UTF-8 | 277 | 3.5625 | 4 | [] | no_license | n = int(input())
a = [0, 0]
for i in range(n):
inp = input().split()
if inp[0] > inp[1]:
a[0] += 1
elif inp[0] < inp[1]:
a[1] += 1
if a[0] > a[1]:
print("Mishka")
elif a[0] < a[1]:
print("Chris")
else:
print("Friendship is magic!^^")
| true |
71518af222145936935b41ddbc01dcdf4a212d12 | Python | vinsmokemau/Imaging | /gamma_correction.py | UTF-8 | 2,632 | 3.65625 | 4 | [
"MIT"
] | permissive | """Histogram Equalization of an Image."""
from skimage import data, color, io
import numpy as np
import matplotlib.pyplot as plt
def get_histogram(img):
"""Return the histogram of a grayscale image.
img: numpy array [n, m, 1]
return: numpy array [256, 1, 1]
"""
rows, columns = img.shape
his... | true |
f64948c4293e6e1e1581a3fff4662432b4b4b929 | Python | AbzGtz/PythonGames | /games/tic-tac-toe.py | UTF-8 | 8,257 | 4.03125 | 4 | [] | no_license | ########################################################################
# Global Variables
########################################################################
player_setup = {'PL1':['token','turn'],'PL2':['token','turn']} # Keeps track of a player's token - player_setup['PL1'][0] - and wheather is its turn - pl... | true |
9b140687711e4e6f9afcd8607b4324d35ffaa3d5 | Python | MinuraSilva/superdict | /other/original_code.py | UTF-8 | 2,644 | 3.71875 | 4 | [] | no_license | import re
# Only for reference
# This is the original code written for a scraping project.
def extract_val_re(obj, keys):
"""
Input:
obj: A python dict (also allows a list of lists - not sure if that is valid JSON)
keys: Either string or compiled regex object or a list of strings and/or compil... | true |
72af059a2c6a337a82a87c9d69f3ab64e0316c50 | Python | crim-ca/RACS | /jassrealtime/document/interval.py | UTF-8 | 1,360 | 3.890625 | 4 | [] | no_license | # coding: utf-8
class Interval:
def __init__(self, begin, end, openBegin=False, openEnd=False, isFullyInclusif=True):
"""
Creates a new interval. Begin must be < end.
Example:
open,open = (a,b) = {a < x < b}
close,close = [a,b] = {a <= x <= b}
Here some example for ... | true |
adb4997a590302b524a7033e2440b36ee2f1a93f | Python | optionalg/cracking-the-coding-interview-3 | /1-3.py | UTF-8 | 253 | 3.296875 | 3 | [] | no_license | # Time: O(n^2)
# Space: O(1)
def is_permutation(str1, str2):
if len(str1) == len(str2):
for char in str1:
if char in str2:
str2.replace(char, '', 1)
if len(str1) == len(str2) == 0:
return True
| true |
a66dd49368db25a1d82eba58e960d3383878920f | Python | NewMike89/Python_Stuff | /Ch.4/4-10slices.py | UTF-8 | 902 | 4.375 | 4 | [] | no_license | # Michael Schorr
# 4/3/19
# using PLAYERS.PY to print some lines with certain sections of the list
players = ['charles', 'martina', 'michael', 'florence', 'eli']
# displays from the first index to the one before the last listed index
print(players[0:3])
print(players[1:4])
# displays from the beginning of the list to ... | true |
a6bb93c2538f9cbd7fbb2060508b2bdd786a18da | Python | gritjz/Python_Crawler | /7_Dynamic Loading Data Process/03_selenium自动化操作.py | UTF-8 | 626 | 2.65625 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
bro = webdriver.Chrome(executable_path='./chromedriver')
bro.get('https://world.taobao.com/')
#定位搜索栏
search_input = bro.find_element_by_id('mq')
#输入搜索信息
search_input.send_keys('iPhone 12')
#执行js程序,滚屏到底
bro.execute_script('window.scrollTo(0, document.body.scrollHe... | true |
4d517490bc182816206ecd8bd5315dd41b143280 | Python | MinjeongSuh88/python_workspace | /20200731/win4.py | UTF-8 | 979 | 3.625 | 4 | [] | no_license | # 구구단 3단 출력하는 클릭 버튼 만들기
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLineEdit
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('구구단 출력하기')
self.resize(800,600)
... | true |
431e9926c59c7e1e11e4ec60a336d18723f70ec6 | Python | JustinWayneOlson/Air-Traffic-Analysis | /application/src/Routing.py | UTF-8 | 7,093 | 2.921875 | 3 | [] | no_license | # Referenced http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html for this implementation
import numpy
import sys
import matplotlib.pyplot as plt
# Lat lon of Portal ND 48.9959° N, 102.5496° W
# Lat lon of Eureka calif 40.8021° N, 124.1637° W
# Homestead fl lat lon 25.4687° N, 80.4776° W
# ... | true |
c91e3a97bbb7ccc201855a343c491874d53fd6ae | Python | Ackermannn/MyLeetcode | /src/edu/neu/xsz/leetcode/algorithms/easy/066_加一.py | UTF-8 | 341 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
leetcode 66.加一
"""
def add(x):
flag = 1
for i in range(-1,-len(x)-1,-1):
if flag + x[i] != 10:
x[i] += 1
flag = 0
return x
else:
x[i] = 0
if flag == 1:
x.append(0)
x[0] = 1
return x
x = [9,8... | true |
9b177952c79da4aded9db10b902370af9a2eadcd | Python | DouglasBzzz/problemas_e_solucoes_python | /bytecode_behind/main.py | UTF-8 | 108 | 3.234375 | 3 | [] | no_license | def saudacao(name):
return "Olá, "+name+" !"
print(saudacao("Douglas"))
import dis
dis.dis(saudacao) | true |
4d5e823ac441493d9130cb460ec196fc3ac9ea9b | Python | dbetm/crash-course-python | /intro/excepciones02.py | UTF-8 | 440 | 4.15625 | 4 | [] | no_license | # Capturar varias excepciones
def divide():
try:
op1 = float(input("Número 1: "))
op2 = float(input("Número 2: "))
print("La división es: " + str(op1/op2))
except ValueError:
print("El valor introducido es erróneo")
except ZeroDivisionError:
print("No se puede dividir entre 0")
# except:
# print("Erro... | true |
149290f56501785fa781eec46e587a233a2872ec | Python | EchoChloe/hdf5examples | /hdf5examples/low_level/h5ex_t_float.py | UTF-8 | 1,787 | 3.5625 | 4 | [] | no_license | """
This example shows how to read and write float datatypes to a dataset. The
program first writes floats to a dataset with a dataspace of DIM0xDIM1, then
closes the file. Next, it reopens the file, reads back the data, and outputs
it to the screen.
"""
import sys
import numpy as np
import h5py
FILE = "h5ex_t_floa... | true |
69ab2d5d6e4e695413a8f4c60aa412e3d71f1512 | Python | iampramodyadav/FEA | /test2.py | UTF-8 | 459 | 3.125 | 3 | [
"MIT"
] | permissive | from sympy import *
def SHAPE(p,z):
'''
SHAPE(p,z)
p: order (p) of approximation
z:value of natural coordinate
This function return shape funtions values at given x
note: x=symbols('x')
'''
z=Symbol('z')
n=[]
for i in range(0, p+1):
point=-1
point=point+2*i/p
n.append(point)
shape=[1... | true |
a8f9ededbf2e1620f33e32b8c843a0d95654f5b8 | Python | cnbcloud/mjserver | /majiang2/src/majiang2/win_loose_result/table_results.py | UTF-8 | 1,849 | 2.515625 | 3 | [] | no_license | # -*- coding=utf-8
'''
Created on 2016年9月23日
本桌的输赢结果
1)陌生人桌,打完后直接散桌,有一个round_results
2)自建桌,SNG,打几把,有几个round_results
@author: zhaol
'''
from freetime.util import log as ftlog
class MTableResults(object):
def __init__(self):
super(MTableResults, self).__init__()
self.__results = []
self... | true |
25d0ef8a47cb530092f3255109b40b285b7a1276 | Python | jichenqing/MapQuest | /mapquest_interface.py | UTF-8 | 2,499 | 2.796875 | 3 | [] | no_license | #Sue Ji 33337876
import mapquest_APIs
import mapquest_output
import json
def _user_request()->list:
'''
takes the user input for all the addresses and returns them as a list
'''
user_input=int(input())
if user_input>=2:
locations=[]
for address in range(user_input):
... | true |
83119fc71e56ece523985c4ea46e1fad2d0a065d | Python | pranjay01/leetcode_python | /LongestCommonPrefix.py | UTF-8 | 791 | 2.984375 | 3 | [] | no_license | strs=["flower","flow","flight"]
result=''
tmpres=''
if len(strs)>1:
i=0
str1=strs[0]
str2=strs[1]
while i<len(str1) and i<len(str2):
if str1[i]==str2[i]:
result=result+str1[i]
i=i+1
else:
break
if len(result)>0:
for index in range(2,len(st... | true |
26e547cee19ebf092bac35563d6a6fcf6d4a31f7 | Python | moshegplay/moshegplay | /LABs/variables.py | UTF-8 | 235 | 2.765625 | 3 | [] | no_license | name="moshe hazan"
age=29
mail="moshe@gmail.com"
print("full name: " + name +"\nage: " + str(age) +"\nmail:" + mail)
print("full name: " + name[::-1] +"\nage: " + str(age*3))
print("moshe" in "idan ben dudu moshe shimon yeal gal adam shahar yana")
| true |
33ffdea2b86660cdb23f8f43d95661c87622477f | Python | suriyadeepan/PyroDemystified-PyCon2019 | /getorix/data.py | UTF-8 | 1,539 | 2.65625 | 3 | [] | no_license | import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch
import pandas as pd
import torchvision.transforms.functional as TF
from PIL import Image
import os
DATA = 'data/'
def mnist(batch_size=128, one_hot=False):
root = 'data/'
download = True
trans = transforms.ToTen... | true |
90a97443b306375d0101b19e850d02536fd63c1c | Python | Jason003/Interview_Code_Python | /uber/24game.py | UTF-8 | 583 | 2.859375 | 3 | [] | no_license | import itertools as it
class Solution:
def judgePoint24(self, nums) -> bool:
if len(nums) == 1:
return round(nums[0], 4) == 24
else:
for (i, m), (j, n) in it.combinations(enumerate(nums), 2):
new_nums = [x for t, x in enumerate(nums) if i != t != j]
... | true |
8cdf3f49d798c59227158472bcf39e7bd6cce366 | Python | kimsup10/octopus | /octopus/ml/naive_bayes.py | UTF-8 | 1,322 | 3.296875 | 3 | [
"MIT"
] | permissive | import numpy as np
class NaiveBayes:
'''전체 유저수'''
total_user_cnt = None
'''사전확률'''
pre_prob = None
'''좋아요 수 평균'''
mean_likes_cnt = None
def __init__(self, articles):
self.prepare(articles)
def prepare(self, articles):
'''나이브 베이즈 사전확률 계산'''
self.pre_prob = {}... | true |
d1455ed5e365c5e1c1cfe473e4c620b81b2e6e02 | Python | CodeTest-StudyGroup/Code-Test-Study | /JJangSungWon/삼성 기출/14502_연구소.py | UTF-8 | 2,106 | 3.09375 | 3 | [] | no_license | # boj 14502
# blog : jjangsungwon.tistory.com
import sys, copy
import itertools
from collections import deque
def bfs():
q = deque(virus)
visited = [[0] * M for _ in range(N)]
while q:
row, col = q.popleft()
# 상
if row - 1 >= 0 and temp_arr[row - 1][col] == 0 and v... | true |
1b67df272b5f8fb9875e6dd4a41a3063b1df7fcb | Python | MayankR/cmr | /demo.py | UTF-8 | 5,344 | 2.515625 | 3 | [
"MIT"
] | permissive | """
Demo of CMR.
Note that CMR assumes that the object has been detected, so please use a picture of a bird that is centered and well cropped.
Sample usage:
python -m cmr.demo --name bird_net --num_train_epoch 500 --img_path cmr/demo_data/img1.jpg
"""
from __future__ import absolute_import
from __future__ import di... | true |
2d361f33028aa74c6c99a84893bcd5316039c118 | Python | odacremjorge/pryecto_taller_ENDESYC | /app/controllers/HistorialController.py | UTF-8 | 2,351 | 2.59375 | 3 | [] | no_license | import os
import time
from app import db
from app import app
from flask import render_template, request, redirect, url_for, flash
from app.models.Historial import Historial
from PIL import Image #pip install pillow
import urllib.request
from werkzeug.utils import secure_filename
class HistorialController():
def ... | true |
b5eb56d47db776f067a247ad86fd0653d5e37413 | Python | 7Aishwarya/Data-Structures-and-Algorithms | /Dynamic-Programming/MaximumSubarray-KadensAlgorithm.py | UTF-8 | 374 | 2.84375 | 3 | [] | no_license | class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
cur_best = nums[0]
overall_best = nums[0]
for i in range(1, len(nums)):
cur_best = max(nums[i], cur_best + nums[i])
overall_best = max(overal... | true |
e49a8948105d02ba89f50dade6f756c20f3c8402 | Python | 988dengwenbo/meeting | /comnon/time_module.py | UTF-8 | 920 | 2.96875 | 3 | [] | no_license | import math
def pc_time_module_week(num):
if num == 0:
return num+1
elif num == 1:
return num
elif num == 2+1:
return num
elif num == 3:
return num+1
elif num == 4:
return num+1
elif num == 5:
return num+1
elif num == 6:
return num+1
... | true |
3a2d0153f0736ac85051cdcdfc83c01940dd8938 | Python | csvchicago/BlackWinter | /stop.py | UTF-8 | 309 | 2.65625 | 3 | [] | no_license | from gpiozero import Robot
from time import sleep
#from gpiozero import Buzzer
#bz = Buzzer(14)
#bz.on()
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
b = TonalBuzzer(14)
b.play(Tone("A4"))
blackWinter = Robot(left=(7,8), right=(9,10))
blackWinter.forward()
sleep(1)
blackWinter.stop() | true |
f8e36a76e3ba8dd799926bd92bb04587ddffae09 | Python | Isdaril/python | /Hackerrank/towerbreakersrev.py | UTF-8 | 921 | 3.484375 | 3 | [] | no_license | import math
class Calculator:
def __init__(self):
self.alreadyFound = dict()
def findPrimeCount(self,n):
result = 1
if n in self.alreadyFound:
return self.alreadyFound[n]
if n == 1:
self.alreadyFound[1] = 0
return 0;
lim = math.fl... | true |
4d326ab9348ef3eb59b08857cbc5e5d3f146c2dd | Python | julianpistorius/ds-playbooks | /irods/library/irods_user | UTF-8 | 15,880 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Provides an ansible module for creating, updating and removing iRODS users.
"""
import ssl
from ansible.module_utils.basic import AnsibleModule
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community"
}
DOCUMENTATION ... | true |
f6423e96ce482349d87a6d0ff3526858fed62181 | Python | Stereo-Alex/Music_prediction_ting | /functions_for_music_predictor.py | UTF-8 | 2,413 | 2.921875 | 3 | [] | no_license | import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
from IPython.display import Javascript
import pandas as pd
##################Part 1, conecting to the api and dowloading the data frames##############
#### Takes user input: (only works with the numerical part of the link or the uri)
def getting_user... | true |
06ae681332b674d8987fc6611ef07ae38da79bfa | Python | atlanticwave-sdx/atlanticwave-proto | /localctlr/LCRuleManager.py | UTF-8 | 9,633 | 2.671875 | 3 | [] | no_license | # Copyright 2018 - Sean Donovan
# AtlanticWave/SDX Project
import cPickle as pickle
from lib.AtlanticWaveManager import AtlanticWaveManager
from shared.ManagementLCRecoverRule import *
# List of rule statuses
RULE_STATUS_ACTIVE = 1
RULE_STATUS_DELETING = 2
RULE_STATUS_INSTALLING = 3
RULE_STATUS_REMOVED ... | true |
690b0cd91cf500da99389a0f58ca7db9aa693b67 | Python | mkornyev/scheduler | /myTime/management/commands/populate.py | UTF-8 | 2,552 | 2.5625 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from datetime import datetime
from myTime.models import DailyHours, Location, Reservation, Report
# POPULATE SCRIPT
class Command(BaseCommand):
args = '<this func takes no args>'
help = 'A populate script for the current locations & hours.'
def _create... | true |
799ab62fa2e84b39723c59691682f1b6bb7209f2 | Python | avatar333/py2learning | /01-HelloWorld.py | UTF-8 | 2,157 | 4.34375 | 4 | [] | no_license |
#Import regexp module
import re
print ("Hello World!\tkTest")
# Print the output of a calculation
print (1+1)
# Assign value of calcuation to a variable
NUM1 = 1+1
# print a string and variable
print "NUM1 =", NUM1, NUM1
# split a string, specifying a delimiter, and then which element
print ("Hello World").spli... | true |
d78151dcb982721e40d1cb1386d42524963ebcd4 | Python | venkatadri123/Python_Programs | /Sample_programs/32max.py | UTF-8 | 153 | 3.640625 | 4 | [] | no_license | #To find a giggest number in a list.
l=[10,12,14,15,-20,22,11]
max=l[0]
n=len(l)
for i in range(1,n):
if l[i]>max:
max=l[i]
print('max=',max) | true |
f70cc154ead2abc8ce5a6a177da736265f57769f | Python | mooncrater31/pdfExtraction | /csvToPopularity.py | UTF-8 | 3,445 | 2.703125 | 3 | [] | no_license | import pandas as pd
import numpy
from time import time
import csv
import gc
import os
def make_popularity_csv(csvName,state,yearrange):
df = pd.read_csv(csvName)
names = df['elector_name'].values
nameDict = {}
for name in names:
for part in name.split(" "):
nameDict[part] = nameDict.... | true |
b1605cb7512204e42ab0ae22d4bafcc0a23e8b0e | Python | diegoPaladino/alarme_temporal | /tabela/format_string.py | UTF-8 | 705 | 3.171875 | 3 | [] | no_license | # format_string
# source: https://stackoverflow.com/questions/53908134/what-is-20-format-string-meaning-in-python
popularity = [["Language", 2017, 2012, 2007, 2002, 1997, 1992, 1987],
["Java", 1, 2, 1, 1, 15, 0, 0],
["C", 2, 1, 2, 2, 1, 1, 1],
["C++", 3, 3, 3, 3, 2, 2, 5],
["C... | true |
5373dccf58a8d45c734145302a3c1e887ddabde8 | Python | vishwanath79/PythonMisc | /20Pythonlibs/collection.py | UTF-8 | 351 | 3.125 | 3 | [] | no_license | from collections import OrderedDict, defaultdict, namedtuple
from string import ascii_lowercase
print(OrderedDict(zip(ascii_lowercase, range(4))))
# specify a default value for all new keys
d = defaultdict(list)
print(d['a'])
A = namedtuple('A', 'count enabled color')
tup = A(count=1, enabled=True, color="red")
pri... | true |
8713091ae7ceb5ba5d6fb628365509655664341a | Python | cilame/any-whim | /感兴趣的算法/QQ_TEA算法.py | UTF-8 | 2,899 | 2.796875 | 3 | [] | no_license | import struct
def Hex2Bytes(hexstr:str):
strBytes = hexstr.strip()
pkt = bytes.fromhex(strBytes)
return pkt
class QQ_TEA():
""" QQ TEA 加解密, 64比特明码, 128比特密钥 """
def __init__(self, secret_key):
self.secret_key = secret_key
def xor(self,a, b):
op = 0xffffffff
a1,a2 = stru... | true |
5bdc662e8c529907cdb479eb36cdb9aec3414a0e | Python | Aasthaengg/IBMdataset | /Python_codes/p00005/s129430195.py | UTF-8 | 149 | 2.609375 | 3 | [] | no_license | import sys
from fractions import gcd
[print("{} {}".format(gcd(*x), x[0] * x[1] // gcd(*x))) for x in [list(map(int, x.split())) for x in sys.stdin]] | true |
8fbc9d787c31a78fea0068ce89455ee37ad0eaad | Python | o11c/typeshed | /builtins/2.7/_random.pyi | UTF-8 | 365 | 2.59375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | from typing import Optional, Union, Any
class Random(object):
def __init__(self, seed: Optional[Union[int, Any]] = ..., object = ...) -> None: ...
def getstate(self) -> tuple: ...
def setstate(self, state: tuple) -> None: ...
def random(self) -> float: ...
def getrandbits(self, k: int) -> int: ...
... | true |
af323b3cd19159ab09ea36daf6c822bf9918e9de | Python | rczyrnik/ProjectEuler | /E037_TruncatablePrimes.py | UTF-8 | 1,288 | 4.1875 | 4 | [] | no_license | '''
The number 3797 has an interesting property. Being prime itself,
it is possible to continuously remove digits from left to right,
and remain prime at each stage: 3797, 797, 97, and 7.
Similarly we can work from right to left: 3797, 379, 37, and 3.
Find the sum of the only eleven primes that are
both truncatable fr... | true |
b0403a8800cf4ae8e30a8b28657887fc956d6300 | Python | mahtabfarrokh/classic-search | /Astar.py | UTF-8 | 2,436 | 3.0625 | 3 | [] | no_license | class AStar:
def __init__(self, initial_state, actions, result, goal_test, get_cost, heuristic):
self.f = []
self.e = []
self.res = []
self.visited = []
self.initial_state = initial_state
self.actions = actions
self.result = result
self.goal_test = goa... | true |
5416ded41a7152f0836a18b4206cb37ee862d271 | Python | fjparedesb/cursos | /python/beyond_basics/password_check.py | UTF-8 | 251 | 3.75 | 4 | [] | no_license |
correct_password = "123"
name = input("Ingrese su nombre: ")
password = input("Ingrese su contraseña: ")
while correct_password != password:
password = input("Contraseña erronea, intente de nuevo: ")
print("Hola %s ya estas logueado" % name) | true |
d0ebba677f186fbb76039cbe0aae9320b79328a1 | Python | BlackdogCEO/my-leetcode-venture | /7.reverse-integer.py | UTF-8 | 683 | 3 | 3 | [] | no_license | class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
b = 0
a = 0
c = 1
if x < 0:
x = -x
c = -1
while x != 0:
if (2147483647 - a) / 10 < b:
a = b = 0
break
... | true |
deb2b0e14831055cc3f44af9c9584aad126a171d | Python | samlex20/Google-Maps-Scraper | /mapsscraper.py | UTF-8 | 5,068 | 2.90625 | 3 | [] | no_license | import requests, json, time, csv, sys
# Covers entire northern virginia
# 38.837211,-77.412990 3 mi
# 38.916717,-77.503911 4mi
# 38.915541,-77.404331 3.5 mi
# 39.025810,-77.393600 4 mi
# 38.921594,-77.248507 4 mi
# 38.843642,-77.284189 3.7 mi
# 38.845399,-77.107912 4 mi
# 38.756228,-... | true |
20f6da7cdf344ce1f5bb9a969fc5b7a6774343c4 | Python | andrewrosenkilde/LPTHW | /Exercises/ex4.py | UTF-8 | 1,388 | 4.28125 | 4 | [] | no_license | #defines the variable "cars".
cars = 100
# defines the variable space_in_a_car
space_in_a_car = 4
# defines the variable drivers
drivers = 30
#defines the variable passengers
passengers = 90
#defines the variable cars_not_driven as the math of
# cars - drivers
cars_not_driven = cars - drivers
# defines the variable car... | true |
8fb0a5fd4cd75e8b67f1b0ba21fb2f8a6719b58d | Python | anna-jego/simplon_nantes | /hanoi/boulangerie-1-a-completer-checkpoint.py | UTF-8 | 3,500 | 3.953125 | 4 | [] | no_license | # Micro-monde économique de la boulangerie
# Gestion de la production
class Produit: # Classe abstraite
def __init__(self):
self.quantite = 0
self._type = 'Produit non défini' # Attribut protégé
def __repr__(self):
return self._type + ' : ' + str(self.quantite)
class Pain(Produit)... | true |