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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d6492255f592fddd13e0a2bb41ff4dbf60181109 | Python | basma-b/nur_coherence | /utilities/my_callbacks_00.py | UTF-8 | 2,433 | 2.5625 | 3 | [] | no_license | from __future__ import division
import keras
import numpy as np
class Histories(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
self.accs = []
self.losses = []
def on_train_end(self, logs={}):
return
def on_epoch_begin(self, epoch, logs={}):
return
def on_epoch_end(self, epoch, logs={}):
... | true |
2ddfc0a84d09d8e8ad1b438589002e59358dc3bc | Python | Yixin-Zhang95/leetcode_challenge | /practice.py | UTF-8 | 781 | 3.6875 | 4 | [] | no_license | class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def build_linked_list(values):
zero = ListNode(-1, None)
previous = zero
for v in values:
head = ListNode(-1, None)
previous.next = head
head.val = v
previ... | true |
af4a8f806d561814ebbe1f3dfca4a02bcbaccd9b | Python | J0ey17/XSS-SQLin-Scripts | /SQLi/blindsql.py | UTF-8 | 1,037 | 2.84375 | 3 | [
"MIT"
] | permissive | #!//usr/bin/python3
import os
import requests
import multiprocessing
alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
url = "https://0a8c00ce049c4c49c0f2a409006a0044.web-security-academy.net/product?productId=2"
valid = "Welcome back!"
manager = multiprocessing.Manager()
password = man... | true |
7997fd47e5534f86966daa3035075aa7602c92c9 | Python | krismaz/dailyprogrammer | /dailyprogrammer/3/medium.py | UTF-8 | 511 | 3.21875 | 3 | [] | no_license | #Simple substitution cypher, supports any alphabet
from string import *
skey = '''$2iS8 l<R&~|BK
5=u0?>!M4)7s("}A6e#*@\y,W%Xc^zE'a/HbL;.+NmGU`JC1d93:pxIv
rwDPoTQt[jOk{Vgnfh]ZF_-Y q'''
def encrypt(s, key = skey, alphabet = printable):
return ''.join(alphabet[key.index(c)] for c in s)
def decrypt(s, key = skey, al... | true |
58a63c44e38a2e23665565049be198bf94be65df | Python | AtoposNemo/personality_detection | /svm_result_calculator.py | UTF-8 | 3,611 | 2.703125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import svm
import numpy as np
def label_converter(row):
if row == 'y':
return 1
else:
return 0
def truth_determiner(column1, column2, equal=True):
if equal:
if column1 == column2:
return 1
else:
return 0
el... | true |
90491f1610b2c83fede9c21050a8e00e8853d338 | Python | echowand/EE219 | /hw5/part1.py | UTF-8 | 2,652 | 2.890625 | 3 | [] | no_license | import json
import logging as logger
from collections import defaultdict
from matplotlib import pyplot as plt
logger.basicConfig(level=logger.INFO, format='%(asctime)-15s - %(message)s')
# hash tags
hash_tags = ['gohawks', 'gopatriots', 'nfl', 'patriots', 'sb49', 'superbowl']
for hash_tag in hash_tags:
tweets =... | true |
cc6c5868fee075628dd7a1c9e87b144c03d47dbf | Python | anaghasethu/tarento-batch-2021 | /prgm1.py | UTF-8 | 1,044 | 4.4375 | 4 | [] | no_license | """
Given a paragraph count the frequency of vowels and consonants in each word and capitalize the vowels/consonants in each word whose frequency is the highest. If the frequency of vowels and consonants are equal then capitalize the whole word.
Sample Input and Output
Input : Hey! How are you? I hope you are fine.
O... | true |
eb22c89530ccde47c024bfcb333fa6197adef24d | Python | holgern/BeemBot.py | /Cogs/Mute.py | UTF-8 | 9,201 | 2.6875 | 3 | [
"MIT"
] | permissive | import asyncio
import discord
import time
from Cogs import DisplayName
from Cogs import Nullify
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(Mute(bot, settings))
class Mute:
# Init with the bot reference, and a reference to the settings var
def __init__(se... | true |
fd3fd88a0f0fbc2a98971e3a52832675833a34ef | Python | fanmuzhi/testFacenet | /face_train_keras.py | UTF-8 | 9,789 | 3.046875 | 3 | [
"MIT"
] | permissive | import random
import keras
import numpy as np
from sklearn.model_selection import train_test_split
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, \
MaxPooling2D
from keras.optimizers import SGD
from k... | true |
3fccf7f608933f40af752958a37a1c0c69283b7b | Python | shinpads/Programming-Problems | /Problems/Censor.py | UTF-8 | 176 | 3.046875 | 3 | [] | no_license | n = int(input())
for i in range(n):
a = input().split( )
for i in range(len(a)):
if len(a[i]) == 4:
a[i] = '****'
a = ' '.join(a)
print(a)
| true |
b2bd88d9677515bb15696b60c583b174c808af04 | Python | cnzh2020/30daysofpython-practice | /day_2/day2.py | UTF-8 | 2,421 | 4.03125 | 4 | [] | no_license | # Day2: 30 Days of python programming
first_name = 'Xu'
last_name = 'Zhihao'
full_name = 'Xu Zhihao'
country = 'China'
city = 'HangZhou'
age = 26
year = '1995'
is_married = True
is_true = True
# first_name,last_name,full_name = 'Xu','Zhihao','Xu Zhihao'
print(first_name)
print(last_name)
print(full_name)
# check dat... | true |
192b6c80ef16e8c48f8e76cc87c49f9c07e1f8bb | Python | ilham20iyang/hitungbola.py | /bola.py | UTF-8 | 268 | 3.171875 | 3 | [] | no_license | import math
def luasbola (r):
return 4 * math.pi * r**2
def volumeBola (r):
return 4/3 * math.pi * r**3
def biodata(nama,nim,kelas,fakultas):
print("nama = ",nama)
print("nim = ",nim)
print("kelas = ",kelas)
print ("fakultas = ",fakultas)
return biodata
| true |
7861211352c3f186bbcef43139a7e3a131249af9 | Python | welbornprod/colr | /test/test_colr_tool.py | UTF-8 | 15,795 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" test_colr_tool.py
Unit tests for colr.py command line tool.
These tests should be ran with `green -q` to quiet stdout.
If you are using nose then stdout should be quiet already.
If you are using unittest to run these, then -b should work to quiet them... | true |
2e282c9d8223b835c0340257406085b4ef41e208 | Python | mohanalearncoding/Leetcodepython | /commoncharacters.py | UTF-8 | 416 | 3.25 | 3 | [] | no_license | from collections import Counter
def commonChars(A):
result=[]
A.sort(key=lambda x: len(A))
shortest=Counter(A[0])
for i in A[1:]:
for j in shortest:
shortest[j]=min(shortest[j],i.count(j))
for k,v in shortest.items():
if v>=1:
for _ in range(v):
... | true |
938986efc6f0492bbd87ea7c638e3c0b7c737984 | Python | whoiszyc/Repo_machine_learning | /UseCase_Forecasting/time-series-forecasting-keras-master/ali_cloud_data.py | UTF-8 | 599 | 2.75 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("./data/machine_usage.csv", header=-1, nrows=1000000, usecols=[0, 1, 2, 3])
df.columns = ["id", "timestamp", "cpu", "mem"]
df['time'] = pd.to_datetime(df['timestamp'], unit='s')
df = df.set_index('time', drop=True)
machine_id = 1944
metrics = "mem"
... | true |
42cce78232276833ba4d822af1cdacca2b08b0cf | Python | viniesposito/factor-playground | /models.py | UTF-8 | 3,951 | 2.640625 | 3 | [] | no_license | from sklearn.decomposition import PCA
from data import ticker_list, DATA_PATH
from statsmodels.regression.rolling import RollingOLS
import statsmodels.api as sm
import pickle
import pandas as pd
import numpy as np
def get_stock_return(ticker):
return pd.read_csv(DATA_PATH + 'stocks.csv', parse_dates=[
0]... | true |
c7550bc9f507e5c288402bcc88de6dcc63ebbe2f | Python | eshamay/interfacemd | /graphics/Coordinator.py | UTF-8 | 2,974 | 2.96875 | 3 | [] | no_license | import csv
import numpy
import matplotlib.pyplot as plt
import matplotlib.patches
from DensityProfiler import DensityProfiler
class Coordinator:
def __init__(self,files=[],norm=False):
self.files = files
self.data = []
self.density = []
self.normalize = False
for file in files:
d = self.DataDict(file ... | true |
11c1cf8ecddd1ce60b1463ba724037d12d6afb9f | Python | mcfee-618/FluentPy | /02/tuple.py | UTF-8 | 458 | 4 | 4 | [] | no_license | import collections
info=("feipeixuan",27,"牛逼")
### 元组拆包
name,age,_ = info
print(name,age)
name,*others =info
print(others) #[27, '牛逼']
### 嵌套元组拆包
info = (222,(3,5))
c,(x,y) =info
print(x,y)
### 命名元祖
Card = collections.namedtuple('Card', ['rank', 'suit']) #
print(Card(2,3))
Person = collections.namedtuple('Person',... | true |
ee8dd3e1156d616d4f8cbb98fcc5b2dcb74403c5 | Python | huchenwenbao/MtimeSpider | /Html_Parser.py | UTF-8 | 1,311 | 3.046875 | 3 | [] | no_license | # coding=utf-8
from bs4 import BeautifulSoup
from Html_Downloader import HtmlDownloader
class HtmlParser(object):
def parser(self, html):
'''
提取所要的影评信息
:param html:解析出的单一影评url由downloader传回来的html
:return: 影评的具体信息们
'''
soup = BeautifulSoup(html, 'html.parser', from_e... | true |
1d566e15a9af963bfce101dcab66d6f8952474d3 | Python | mbr/sqlacfg | /tests/test_sqlacfg.py | UTF-8 | 2,871 | 2.875 | 3 | [
"MIT"
] | permissive | import pytest
from sqlacfg import ConfigSettingMixin, Config
from sqlacfg.format import ini_format
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
Session = sessionmaker()
class ConfigSetting(Base, ConfigS... | true |
c2ab8cfdbc498b118fe484d77f6f5085323fd9db | Python | athithann/Bitflyer-Realtime-API-Python | /realtime_api.py | UTF-8 | 2,232 | 2.765625 | 3 | [] | no_license | import json
import websocket
from time import sleep
from logging import getLogger,INFO,StreamHandler
logger = getLogger(__name__)
handler = StreamHandler()
handler.setLevel(INFO)
logger.setLevel(INFO)
logger.addHandler(handler)
"""
This program calls Bitflyer real time API JSON-RPC2.0 over Websocket
"""
c... | true |
3239ca870317f30d2b0b9a5ed63bdeb4a106a5f8 | Python | partizan007/Instagram-API | /InstagramAPI/src/http/Response/LoginResponse.py | UTF-8 | 1,444 | 2.625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | from .Response import Response
class LoginResponse(Response):
def __init__(self, response):
self.username = None
self.has_anonymous_profile_picture = None
self.profile_pic_url = None
self.profile_pic_id = None
self.full_name = None
self.pk = None
self.is_pr... | true |
3072ab9df540c0100b2bbb406a252bcd7dcbdb80 | Python | AshiqueArman/Codeforces | /Solutions-A/71A.py | UTF-8 | 164 | 3.53125 | 4 | [] | no_license | n = int(input())
for i in range(n):
w = input()
l = len(w)
if l > 10:
fst = w[0]
lst = w[l-1]
print(fst + str(l - 2) + lst)
else:
print(w)
| true |
40adec36920f992fcd4d2823a6214283cc8baa8c | Python | pedrohenriquebraga/Curso-Python | /Mundo 2/Exercícios/ex_054.py | UTF-8 | 330 | 3.953125 | 4 | [
"MIT"
] | permissive | # Mostrar quantas pessoas não estão na maioridade
from datetime import date
mr = 0
ano = date.today().year
for c in range(0, 7):
nasc = int(input(f"Ano de nascimento({c + 1}° Pessoa): "))
if ano - nasc < 21:
mr += 1
print(f"{mr} pessoas tem menos de 21 anos!")
print(f"{7 - mr} pessoas tem mais de 21 a... | true |
a4428149e29ac7d89589a2ad2dd17624823d5480 | Python | sgs-nlp/crawler | /mcrawler/json_response.py | UTF-8 | 645 | 2.546875 | 3 | [] | no_license | """
mcrawler.json_response.py
"""
from django.http import JsonResponse, HttpRequest
from functools import wraps
def decorator(func):
"""
for return true json response
:param func:
:return:
"""
@wraps(func)
def wrapper(request: HttpRequest):
ret = {}
try:
res =... | true |
9164f2feeb731bf722c3d1fa942a65a7254d3995 | Python | fulv1o/Python-Basics | /Tipos de Dados/exemplo18.py | UTF-8 | 271 | 3.0625 | 3 | [] | no_license | """
Fúlvio Taroni Monteforte
Aluno de engenharia de computação do CEFET-MG.
"""
"""
Exercícios retirados da geek university
Leia um valor de volume em metros cúbicos e apresente-o convertido em litros
"""
v = float(input("Informe o volume em m³: "))
v = v*1000
print(f'{v:.2f}L')
| true |
bb1cd26d48856bff2687fcdcecfb0058a70dfa19 | Python | letsgetcooking/Sketches | /processing/2015/summer.py | UTF-8 | 6,000 | 2.8125 | 3 | [] | no_license | W = H = 500
FPS = 20.0
DURATION = 4
N_FRAMES = DURATION * FPS
N_SAMPLES = 4
TREE_COLOR = color(23, 135, 19)
BG_COLOR = color(23, 174, 255)
MAIN_COLOR = color(255, 251, 0)
STROKE_COLOR = color(255, 234, 173)
SECOND_COLOR = color(255, 164, 0)
FRAME_COLOR = color(50, 50, 30)
LIGHT_GREEN = color(200, 255, 50)
WHITE = color... | true |
9e8adfa3fa85d1ee97dee0095b8113066c7b286e | Python | aelkner/coding_challenge | /challenge_app/tests.py | UTF-8 | 3,992 | 2.90625 | 3 | [] | no_license | from bs4 import BeautifulSoup
from django.test import TestCase
import views
# Create your tests here.
class UnitTest(TestCase):
def test_convert_integer_to_roman_numerals(self):
"""
Tests for various values passed to convert_integer_to_roman_numerals.
"""
def assert_convert_intege... | true |
52761022aaa6b1656f1046068e2a3a621233e537 | Python | Rajneesh008/ScheduleScript | /FetchLessThan5Category/schedulerScript.py | UTF-8 | 3,335 | 2.546875 | 3 | [] | no_license | import schedule
import time
import requests
import ast
import pandas as pd
import os
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email import encoders
import smtplib
velocityUrl='http://127.0.0.1:8000/api/'
headers = {'Authorization': "T... | true |
ea8157b50ae2077bc156d205378757d1a40b3c5a | Python | Reeceobligacion/Investment-Contributions-App | /view/buttons.py | UTF-8 | 1,017 | 2.9375 | 3 | [] | no_license | """
Child component to view, holds the frame and components for buttons
"""
try:
import Tkinter as Tk # python 2
except ModuleNotFoundError:
import tkinter as Tk # python 3
class Create_Buttons:
def __init__(self, root):
self.buttons_frame = Tk.LabelFrame(root, text="Buttons Frame")
self.buttons_f... | true |
33420e24d836d4a954a2e9e49b599ee0d601e008 | Python | AlPus108/Python_lessons | /exceptions/test_unittest.py | UTF-8 | 3,720 | 4.03125 | 4 | [
"MIT"
] | permissive | # unittest
# Одна из наиболее древних библиотек для автоматического тестирования. Ей более 20 лет.
# Но, до сих пор встречаются тесты, написанные на синтаксисе, который использует unittest
# Поэтому ее изучение еще актуально для понимания того, что происходит в коде, который содержит синтаксис unittest
# Модуль unittes... | true |
3834ee699c7ac89611418afc344986c2fc9f9ba5 | Python | erichseamon/stat504 | /stat504-project/landslides-project-proposal.py | UTF-8 | 24,387 | 3.265625 | 3 | [] | no_license |
# coding: utf-8
# ## Statistics 504 - Fall 2015
# ### Class Project Proposal
# ### Erich Seamon
# ### erichs@uidaho.edu
# ### http://webpages.uidaho.edu/erichs
# #
#
# ### Title: " Exploring landslide likelihood across Washington using machine learning techniques"
#
# ### Introduction
#
#
# The premise of ... | true |
9205640f5267b1e6be98cb6b9ed921ed8dd8362c | Python | lrsppp/bgunfolding | /bgunfolding/base.py | UTF-8 | 1,125 | 2.875 | 3 | [
"MIT"
] | permissive | import numpy as np
class UnfoldingBase():
"""
Base class.
"""
def __init__(self, *args):
self.is_fitted = False
def fit(self, f, g, b, A, area_eff = None, acceptance = None, eff = None, normalize_response = True):
"""
f : array-like
g : array-like
b : array-... | true |
3242958fda810758c45e94ea0a2a090036fce84d | Python | gmcgsokdeuvmt/screen_shot | /web_socket_client.py | UTF-8 | 425 | 3.140625 | 3 | [] | no_license | import time
from websocket import create_connection
def send_word_wait_one_sec(word):
print("send: %s"% str(word))
ws.send(str(word))
result = ws.recv()
print("Received: %s" % result)
time.sleep(1)
if __name__ == '__main__':
uri = "ws://localhost:8000/"
ws = create_connection(uri)
... | true |
1e7ea222998348d2ae30223c3cc54e38e2eacd50 | Python | alephdata/followthemoney | /tests/test_keys.py | UTF-8 | 4,168 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import yaml
from hashlib import sha1
from unittest import TestCase
from followthemoney import model
from followthemoney.exc import InvalidMapping
class MappingKeysTestCase(TestCase):
def setUp(self):
self.fixture_path = os.path.join(os.path.dirname(__file__), "fixtures")
db_path = os.pa... | true |
2a8e3aacdcdb00a5c814704d967b424e85f9d9eb | Python | FullStackEmbedded/fse2016-python | /unit_tests/sort_utils/sort_sequences.py | UTF-8 | 1,455 | 4 | 4 | [
"MIT"
] | permissive | #!/bin/env python
# -*- coding: utf-8 -*-
'''Sort sequences in different ways.'''
def reverse(l):
"""Reverse the order of elements in a list."""
new_list = []
for i in range(1, len(l) + 1):
new_list.append(l[-i])
return new_list
def sort(l):
"""Sort the items in a list in ascending orde... | true |
92c488fe594e30662856a042fd38fa808c6125c0 | Python | kevinmusker/py3status | /py3status/exceptions.py | UTF-8 | 543 | 2.84375 | 3 | [] | no_license | class Py3Exception(Exception):
"""
Base Py3 exception class. All custom Py3 exceptions derive from this
class.
"""
class RequestException(Py3Exception):
"""
A Py3.request() base exception. This will catch any of the more specific
exceptions.
"""
class RequestTimeout(RequestExceptio... | true |
26d12b69028103617a9daf22c96939c641741891 | Python | nickderobertis/sensitivity | /sensitivity/colors.py | UTF-8 | 155 | 2.9375 | 3 | [
"MIT"
] | permissive |
def _get_color_map(reverse_colors: bool = False, color_map: str = 'RdYlGn') -> str:
if reverse_colors:
color_map += '_r'
return color_map
| true |
8eeb7b5dcc85e0aa345ed2253ccb0d48d3cd9cb9 | Python | juliasc12/Processamento-de-Imagens | /tarefa2/ex1.py | UTF-8 | 225 | 3.25 | 3 | [] | no_license | import random
lista_certa = [7,5,4,3,1]
lista_sorteada = [1,3,4,5,7]
random.shuffle(lista_sorteada)
while (lista_certa != lista_sorteada):
random.shuffle(lista_sorteada)
print(lista_sorteada)
print("conseguimos!")
| true |
0fbf165a51769aaa753852529dfa23d60f28c0b1 | Python | johnnyiller/cluster_funk | /cluster_funk/core/environments/stack_collection.py | UTF-8 | 1,944 | 2.875 | 3 | [
"MIT"
] | permissive | class StackCollection:
def __init__(self, client=None, data=None):
super(StackCollection, self).__init__()
if data is None:
paginator = client.get_paginator('describe_stacks')
results = paginator.paginate()
self.list = list()
for result in results:
... | true |
51d8c087e51c4e8504b6e8075299bd9a2b5ba6d0 | Python | tntC4stl3/checkio | /HOME/pawn_brotherhood.py | UTF-8 | 680 | 3.359375 | 3 | [] | no_license | def safe_pawns(pawns):
count = 0
for pawn in pawns:
column = pawn[0]
row = pawn[1]
brother_columns = (chr(ord(column)-1), chr(ord(column)+1))
brother_row = int(row) - 1
for brother_column in brother_columns:
brother_pawn = '%s%d' % (brother_column, brother_row... | true |
482eadb9416c2b336af9c182c2bdcbec5e39963e | Python | xiaojiangzhang/leetcode_Record | /力扣_牛客刷题/model-滑动窗口/76-Demo.py | UTF-8 | 1,299 | 3.453125 | 3 | [] | no_license | class Solution:
def minWindow(self, s: str, t: str):
window, target = {}, {}
left, right, start = 0, 0, 0
vailds = 0
length = float('INF')
for i in t: target[i] = target.get(i, 0) + 1
while right < len(s):
# 将待放入滑动窗口中的字符c取出
c = s[right]
... | true |
d39445773e88bdbb06792360c9b1809310ec1734 | Python | DeveloperBreno/Projeto-sistema-Fast-Foot | /whatsapp_teste.py | UTF-8 | 690 | 3.140625 | 3 | [] | no_license | nome = 'nome'
numero = '+55 11 94463-4178'
pedido =' Olá, nome seu pedido é P123456 \n total de R$ 12,90 \n 1 chocolate \n 1 misto \n Volte sempre \n '
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://web.whatsapp.com/')
time.sleep(3)
pesquisar = driver.find_element_by_xpa... | true |
8f2b2d58482d4703ac3d499fa704bff782f32219 | Python | aivclab/vision | /neodroidvision/segmentation/masks/mask_drawing_opencv.py | UTF-8 | 2,107 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
Created on 20/10/2019
"""
__all__ = ["draw_masks", "ConvexHullEnum", "draw_convex_hull"]
from enum import Enum
from typing import List
import cv2
import numpy
from sorcery import assigned_nam... | true |
03812de59ff80e0d42548aa10dd1a0f5d5858ec2 | Python | vaeskcode/pylabs | /task_palindrome.py | UTF-8 | 141 | 3.28125 | 3 | [] | no_license | import re
def is_palindrome(s):
pattern = r'[\W_]*'
s = re.sub(pattern, '', str(s).lower())
return list(s) == list(reversed(s)) | true |
5501ee3f84c02757330e8d61453a04bd4d58275b | Python | fgfg56784/johnlee | /nsd_2018/nsd1811/devops/day3/sqlacmy1.py | UTF-8 | 1,566 | 2.609375 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Date, ForeignKey
from sqlalchemy.orm import sessionmaker
#创建引擎,根据数据库类型,选择适当的连接方式
#用户名: 密码@服务器/数据库?参数
# echo = True ,调试模式,屏幕上打印操作详情,生产环境需要关闭
engine = create_engine(
'mysql+pym... | true |
196265b1289d10d9f24092c05cbe70c53dc3acd4 | Python | ywang97/Algorithms | /proximate_sort.py | UTF-8 | 1,901 | 3.328125 | 3 | [
"MIT"
] | permissive | def proximate_sort(A, k):
'''
Return an array containing the elements of
input tuple A appearing in sorted order.
Input: k | an integer < len(A)
A | a k-proximate tuple
'''
##################
# YOUR CODE HERE #
##################
def parent(i):
p=(i-1)//2
... | true |
befaf67a857bddeef7061b48c93bb7d4d5b1ad27 | Python | yashbhutoria/InternetDownAlarm | /app.py | UTF-8 | 691 | 3.15625 | 3 | [
"MIT"
] | permissive | import pyttsx3
import time
import socket
engine = pyttsx3.init()
def speak(text:str,t:int = 0):
engine.say(text)
engine.runAndWait()
time.sleep(t)
def internet(host="1.1.1.1", port=53, timeout=3):
try:
socket.setdefaulttimeout(timeout)
socket.socket(socket.AF_INET, socket.... | true |
150dcfae08a0eb89ea798e27bd01ffc82d981a0b | Python | stuti-rastogi/leetcode-python-solutions | /729_myCalendar1.py | UTF-8 | 1,393 | 3.8125 | 4 | [
"MIT"
] | permissive | class TreeNode:
def __init__(self, start, end):
self.start = start
self.end = end
self.left = None
self.right = None
class MyCalendar(object):
def __init__(self):
self.root = None
def book_helper(self, s, e, node):
if node == None:
self.root = T... | true |
dc5956a475eda3a98b00e5e3133239ceb3ce868f | Python | alonsovidales/interview_questions | /intersection_sorted_arrays.py | UTF-8 | 630 | 3.890625 | 4 | [] | no_license |
def intersec_sorted(arr1, arr2):
p1 = 0
p2 = 0
result = []
while p1 < len(arr1) and p2 < len(arr2):
if arr1[p1] == arr2[p2]:
result.append(arr1[p1])
p1 += 1
p2 += 1
elif arr1[p1] < arr2[p2]:
p1 += 1
else:
p2 += 1
r... | true |
afc094002d6240a5dcfe56542ac4e14a7ec22bb1 | Python | nfg/advent-of-code-2020 | /03/answer.py | UTF-8 | 775 | 3.40625 | 3 | [] | no_license | from typing import List
from functools import reduce
import operator
def solve (data: List[str], right: int, down: int) -> int:
position = 0
row = 0
result = 0
width = len(data[0])
while True:
try:
if data[row][position] == '#':
result += 1
row += do... | true |
047c184eec4b6d8b0bd92d0a6be7e5fb8ef14c10 | Python | aaronkyl/digitalcrafts-python-exercises-flex-02 | /week2/20180306-tues/turtle_exercise_4_main.py | UTF-8 | 339 | 2.78125 | 3 | [] | no_license | from shapes import *
from random import randrange
if __name__ == "__main__":
# prepare screen
Screen().bgcolor("#0F1033")
hideturtle()
speed('fastest')
up()
# draw stars in night sky
for i in range(0, 50):
goto(randrange(-200, 200), randrange(-200, 200))
draw_shape("star", 1, randrange(10), Tr... | true |
070f3f331a4a14595231df4d9549a0876e00b1ac | Python | alvinTaoOps/kvmkit-f7 | /csv_to_escape_table.py | UTF-8 | 1,268 | 2.53125 | 3 | [
"MIT"
] | permissive | import csv
in_file = 'escape_table.csv'
out_file = 'escape_table.txt'
start_declaration = 'const ASCII_USB_RELATION_t escape_string_hid_map[ESC_MAP_SIZE] = {\n'
pattern_str_mod = """\t\t{{ .ascii_rep = "{0}",
\t\t .usage_code_rep = {{.modifiers = {1},\n"""
pattern_key_start = "\t\t\t\t\t\t\t "
pattern_keys = ".key{... | true |
e438b3eb2b5ad1d80edaac4ac9216fa2708801ae | Python | mizu-bai/License-Plate-Recognition | /class2.py | UTF-8 | 2,768 | 2.96875 | 3 | [
"BSD-2-Clause"
] | permissive | import cv2 as cv
import numpy as np
import os
from matplotlib import pyplot as plt
from Preprocess import Preprocess
from SplitLicensePlate import SplitLicensePlate
from ListFile import get_file_list
def split_lp(input_img):
"""
拆分字符
"""
splitLicensePlate = SplitLicensePlate(input_img)
# 获取 row_su... | true |
f1c7eb134305435adbbd126a39880dd28539e9fa | Python | d3m0n4l3x/python | /System_commands.txt | UTF-8 | 753 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import subprocess
#Case #1:
subprocess.call(['df', '-h'])
#Case #2:
subprocess.call('du -sh $HOME', shell=True)
#Case #3:
p = subprocess.Popen(["echo", "hello world"], stdout=subprocess.PIPE)
print p.communicate()
'''
>>> p = subprocess.Popen(["echo", "hello world"], stdout=subprocess.PIPE)
>>> pri... | true |
9142cf108e9846532c8982b0044988fc34ebb822 | Python | Parth-Kapadia/Email-Classification-MLH | /email-classification-master/classification/email/trailmail/__init__.py | UTF-8 | 2,457 | 2.875 | 3 | [] | no_license |
from util.helper import rc
#-----Original Message-----
ORIGINAL_MESSAGE_WORD = rc('(?<=-)( |)((O|o)riginal (M|m)essage)( |)(?=-)')
#---------- Forwarded message ----------
FORWARDED_MESSAGE_WORD = rc('(?<=-)( |)((F|f)orwarded (M|m)essage)( |)(?=-)')
#Begin forwarded message:
BEGIN_FORWARDED_MESSAGE = rc('(((B|b... | true |
e8d03ccf26beb23e19623453105c12235dc11af4 | Python | nsot5/CSE | /notes/Julisa Saavedra- Validator.py | UTF-8 | 979 | 3.46875 | 3 | [] | no_license | import csv
def validate(num: str):
if len(num) == 16:
list_form = list(num)
last_num = list_form.pop(15)
reverse_form = reverse(list_form)
for index in range(len(reverse_form)):
reverse_form[index] = int(reverse_form[index])
if index % 2 == 0:
... | true |
961d7c6089ef3356030823ac206400e6eb12c6cd | Python | syth0le/HSE.Python | /HSE WEEK 2/HSE 2 Task 35.py | UTF-8 | 105 | 3.375 | 3 | [] | no_license | n = int(input())
k = 0
sum = 0
while n != 0:
sum += n
k += 1
n = int(input())
print(sum / k)
| true |
f7ab12a1e6b96768d4ef1b0e3b56d1b45774cec1 | Python | sircosec/relay | /relaytest_motion4.py | UTF-8 | 1,572 | 3.078125 | 3 | [] | no_license | #relaytest_motion4.py
#Import GPIO and time libraries.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
#Set variables for the GPIO pins driving the lamp relay channels, and receiving for
# the PIR sensor.
lamp1 = 5
lamp2 = 6
lamp3 = 13
lamp4 = 19
pirPin = 17
GPIO.setup(lamp1,GPIO.OUT)
GPIO.setup(lamp2,GPIO... | true |
7519ad29621c2af2ba75de495e7b510182fe7be2 | Python | apjaffe/symbolicmt | /mt_util.py | UTF-8 | 2,889 | 2.59375 | 3 | [] | no_license | from collections import defaultdict
def word_freqs(lines):
word_frequencies = defaultdict(int)
for line in lines:
if len(line) > 1:
for word in line.split(" "):
word_frequencies[word] += 1
return word_frequencies
def word_freq_split(lines):
word_frequencies = defaultdict(int)
for line in ... | true |
4da72c45dcbb47d32b906d540cfc6daa431614f0 | Python | Ubuntu18-04/py | /8max.py | UTF-8 | 368 | 3.34375 | 3 | [] | no_license | marks,names=[],[]
n=int(input("Enter the no of students: "))
for i in range(0,n):
marks.append(int(input("enter marks: ")))
names.append(str(input("enter names: ")))
def maximum(ma,na):
maxmarks=max(ma)
i=ma.index(maxmarks)
name=na[i]
return(maxmarks,name)
maxi=maximum(marks,names)
print("ma... | true |
c746affef172f649b934e942adddb84fc0fb66a5 | Python | kazuma104/AtCoder | /ABCproblems/ABC170/Dproblem.py | UTF-8 | 517 | 2.875 | 3 | [] | no_license | from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort()
Aque = deque(A)
out = deque()
out.append(Aque.popleft())
if out[0] != 1:
for i in range(N-1):
yaku = Aque.popleft()
flag = 1
for j in out:
if yaku % j == 0:
... | true |
bfbc7dff59b2bdaa85b88871fd23906c96d8f1bc | Python | llostris/historical-events | /src/tools/unique_category_generator.py | UTF-8 | 2,388 | 3.1875 | 3 | [] | no_license | """Removes duplicates from category list and performs basic filtering of relevant categories"""
from settings import CATEGORIES_UNIQUE_FILENAME, CATEGORIES_RELEVANT_FILENAME, CATEGORIES_FILENAME
from tools.category_matcher import CategoryMatcher
class CategoryLoaderMixin:
def __init__(self, data_dir: str):
... | true |
83f623d8effc63dd1f6da2f52318ba883f98c9cb | Python | PPinto22/ProjectEuler | /p053.py | UTF-8 | 265 | 3.21875 | 3 | [] | no_license | from math import factorial
def c(n,r):
return factorial(n)/(factorial(r)*factorial(n-r))
def main():
count = 0
for n in range(1,101):
for r in range(1,n+1):
cnr = c(n,r)
if cnr > 1000000:
count += 1
print(count)
if __name__ == '__main__':
main() | true |
2c3e3bef4c5b4921df7d3187c478ac8c0af8b7fd | Python | alexandrupirjol/alex_plp | /Phase 1/plp1.py | UTF-8 | 819 | 3.625 | 4 | [] | no_license | list1 = [[1], [2, 3], ["4", [5, [6, [{"some_key":3, "key":4}, [8]]]]]]
list2 = [[1], [2, 3], [4, [5, [6, [7, [8, [9]]]]]]]
print list1, "\n", list2, "\n"
def is_flat(l):
return all(not isinstance(el, list) for el in l)
def flatten(list1, list2, max_depth):
print "flatten\n", list1, "\n", list2
def f(x, y... | true |
f5bdee7088ed79251c14aa85a3fa3349957436ca | Python | Djesco/Project-2-Groep-6 | /Vector.py | UTF-8 | 159 | 3.34375 | 3 | [] | no_license | class Vector2:
def __init__(self, x, y):
self.x = x
self.y = y
def is_same(self, v2):
return self.x == v2.x and self.y == v2.y | true |
ddecfc6b738042c9a445c7fd5aba04ba233c1e05 | Python | ericliu12321/flabbyeric.github.io | /ip.py | UTF-8 | 272 | 2.890625 | 3 | [] | no_license | import re
f = input ("Enter file name (indluding the .txt): ")
g = open(f, "r")
h = open("result.txt", "w")
lines = g.readlines()
for txt in lines:
pattern = '(172\.16\.)(.*)'
match = re.search(pattern, txt)
if not(match):
g.write(txt)
| true |
f51867bab3ca44d241df0cd04d760014409534ef | Python | tejas-gokhale/python | /variables.py | UTF-8 | 708 | 3.921875 | 4 | [] | no_license | #! C:\Python27
hello_str = "Hello World"
hello_int = True
hello_tuple = (21, 32)
hello_list = ["Hello,", "this", "is", "a", "list"]
hello_list = list()
hello_list.append("Hello,")
hello_list.append("this")
hello_list.append("is")
hello_list.append("a")
hello_list.append("list")
hello_dict = {"first_name": "Tejas",
... | true |
9ff9cbe08c0f175d2c407d3005985a752f661db2 | Python | planet2bob/Linguistics-Lab | /pos/assignment.py | UTF-8 | 2,090 | 3.1875 | 3 | [] | no_license | import nltk
parts_translation = {'$':'dollar sign',
'\'':'single quote',
'(':'open paren',
')':'close paren',
',':'comma',
'--':'dash',
'.':'sentence terminator',
':':'colon or elipses',
'CC':'conjunction/coordinating',
'CD':'cardinal number',
'DT':'determiner',
... | true |
120da151a48bc70035d293e155e392d728a060f6 | Python | pdxcycling/carv.io | /video_analysis/code/flow_preprocess.py | UTF-8 | 2,096 | 3.46875 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
import pandas as pd
class FlowPreprocess():
"""
Collection of (static) utilities for processing optical flow data.
"""
@staticmethod
def flow_angles(df):
"""
Calculate the angle of motion for every tracked point
Args:
df: Datafra... | true |
c061d5c85987a4ee0b4324955ba40bddf307f91b | Python | rayandasoriya/CodingPractice | /08-26-2019/replace.py | UTF-8 | 266 | 3.421875 | 3 | [] | no_license | def greatest(arr):
max_n = arr[len(arr)-1]
arr[len(arr)-1] = -1
for i in range(len(arr)-2,-1,-1):
temp = arr[i]
arr[i] = max_n
if temp>max_n:
max_n = temp
return arr
arr = [16, 17, 4, 3, 5, 2]
print(greatest(arr)) | true |
1bef5f309006feb6e8c4321ff72314c81067a52d | Python | EdisonZhu33/Algorithm | /备战2020/010-二进制求和.py | UTF-8 | 1,418 | 3.890625 | 4 | [] | no_license | """
@file : 010-二进制求和.py
@author : xiaolu
@time : 2020-01-07
"""
'''
给定两个二进制字符串,返回他们的和(用二进制表示)。
输入为非空字符串且只包含数字 1 和 0。
输入: a = "1010", b = "1011"
输出: "10101"
'''
class Solution:
def addBinary(self, a, b):
if len(a) > len(b):
end = '0' * (len(a) - len(b))
end += b
... | true |
787f507f5d650da9050a7b32962bf6b5098558c0 | Python | Gurdeep123singh/mca_python | /python/python code/reverse_of_string.py | UTF-8 | 222 | 4.28125 | 4 | [] | no_license | s = input("enter the string")
print(s[len(s)-1 : :-1]) # -1 used for reverse of string # length-1 to start
# or
print(s[::-1]) # from 0 to last value and -1 for decrementinh
# or
print(s[-1::-1]) # from last to start | true |
a6b74efbc275e893b79e4fe4df446141117a1b9d | Python | J14032016/LeetCode-Python | /leetcode/algorithms/p0402_remove_k_digits.py | UTF-8 | 479 | 2.84375 | 3 | [] | no_license | class Solution:
def removeKdigits(self, num: str, k: int) -> str:
stack = []
i, n = 0, len(num)
while i < n:
while stack and stack[-1] > num[i] and k > 0:
stack.pop()
k -= 1
stack.append(num[i])
i += 1
for _ in ra... | true |
baee8248e607849df7a078179c8fc77817ccb5da | Python | sashank-kasinadhuni/CodeEvalSolutions | /Easy_Smallest_multiple.py | UTF-8 | 393 | 3.203125 | 3 | [] | no_license | import argparse
def Mult_finder():
parser = argparse.ArgumentParser()
parser.add_argument("filename")
args = parser.parse_args()
with open(args.filename) as f:
for line in f:
line = line.rstrip('\n')
Numbers = [int(x) for x in line.split(',')]
Base = Numbers[1]
Limit = Numbers[0]
output = Base
... | true |
6fc20063a46d12d147714391d6fac837f430f68a | Python | Alexis9/python-mooc-test | /CurrencyConvert.py | UTF-8 | 387 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/11/19 上午 10:17
# @Author : YYece
# @PROJECT_NAME : Python-mooc-tests
# @File : CurrencyConvert.py
Currency = input()
if Currency[0:3] == "RMB":
USD = eval(Currency[3:]) / 6.78
print("USD{:.2f}".format(USD))
elif Currency[0:3] == "USD":
RMB... | true |
3cd40aa8e0bfe674e6b4bc2642dd6d61babe65ce | Python | katridi/Exercism | /hamming/hamming.py | UTF-8 | 274 | 3.484375 | 3 | [] | no_license | def distance(strand_a, strand_b):
check_length(strand_a, strand_b)
return sum([l2 != l1 for l1,l2 in zip(strand_a, strand_b)])
def check_length(strand_a, strand_b):
if len(strand_a) != len(strand_b):
raise ValueError('Sequences must have equal lenght') | true |
611a454034670d31c54bee04933198230aeaf28c | Python | zhouwei-python/middle_project | /cartapp/car.py | UTF-8 | 1,728 | 2.90625 | 3 | [] | no_license | # coding:utf-8
#@Time : 2019/09/02 14:46
#author : Around
from testapp.models import TBook
class Cart_items():
def __init__(self,book,count):
# book是从数据库书籍详情表中查出来的QuerySet对象
self.book = book
self.count = count
class Cart():
def __init__(self):
self.total_price = 0
... | true |
4f76214457ca1ba3fdff3b1b5e6d5d9cb5e5b728 | Python | wanghui0225/spectra_mole | /spectra_mole/vis.py | UTF-8 | 7,072 | 2.625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
# coding=utf-8
"""
Author: radenz@tropos.de
visualisation of spectra
"""
import os
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from . import helpers as h
def mom2str(l, sep=' '):
return sep.join(['Z:{0:.2f} v:{1:.2f} w:{2:.2f} snr:{5:.2f} | '... | true |
7e411bd1979c98c3928f7f21c8478b5047066ba2 | Python | darknessest/fr_test | /polls/models.py | UTF-8 | 2,480 | 2.609375 | 3 | [] | no_license | from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.contrib.auth.models import User
QUESTION_TYPE_CHOICES = (
(1, 'Multiple Choice Answer'),
(2, 'Single Choice Answer'),
(3, 'Text Answer')
)
class Poll(models.Model):
"""
Model for storing polls
... | true |
0ea7cb5378275e32448e3822e7ee7702df1f163a | Python | ArubaIberia/agora | /python/switch_completo.py | UTF-8 | 1,463 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import sys
import json
# Ejemplo de autenticación básica, sin usar el módulo Aruba.
# Realiza una conexión REST a un switch y lee la lista de VLANs
host_add = "192.168.XX.XX"
username = "XXXX"
password = "XXXX"
# Desactivo el log de certificado autofirma... | true |
d806239eceee4f9141ae7a420a1b39c2800a6956 | Python | Supermaxman/SpaceGAN | /sample.py | UTF-8 | 3,629 | 2.59375 | 3 | [
"MIT"
] | permissive | import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import argparse
import random
import pprint
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
import numpy as np
import json
import matplotlib.pyplot as plt
import gan_models
pp = pprint.PrettyPrinter()
def str2bool(v):
if v.lower() in ('yes', '... | true |
7c74812cb4fa474c30d68ecad3f4017d8c9e21e1 | Python | Sahil12S/Messenger | /welcome.py | UTF-8 | 4,178 | 2.765625 | 3 | [] | no_license | import tkinter as tk
HEADING_FONT = ("Verdana", 18)
class WelcomeWindow(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
# container.title("Hudibaba Messenger")
container.pack(side="top", fill="both", expand=True)
... | true |
5edb18453ffa7a86c40c70ade6b787ce55da5a52 | Python | AndriiOshtuk/scriv | /src/scriv/create.py | UTF-8 | 2,527 | 2.65625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | """Creating fragments."""
import datetime
import logging
import re
import sys
import textwrap
from pathlib import Path
from typing import Optional
import click
import click_log
import jinja2
from .collect import sections_from_file
from .config import Config
from .gitinfo import (
current_branch_name,
git_add... | true |
a90466c7236419b0319c7834f42f9123f5da77d5 | Python | bengori/python | /homeworks/les6/task2.py | UTF-8 | 2,554 | 4.5 | 4 | [] | no_license | """
Реализовать класс Road (дорога), в котором определить атрибуты: length (длина), width (ширина).
Значения данных атрибутов должны передаваться при создании экземпляра класса. Атрибуты сделать
защищенными. Определить метод расчета массы асфальта, необходимого для покрытия всего дорожного
полотна. Использовать формулу... | true |
b86b45ee3fb1878b221969aed84e19674a010b48 | Python | ThomasRouvinez/UserRecognizer | /ImagesLib.py | UTF-8 | 7,192 | 2.96875 | 3 | [] | no_license | #!usr/bin/python
# ------------------------------------------------------------
# Author : Thomas Rouvinez
# Creation date : 04.04.2014
# Last modified : 04.04.2014
#
# Description : image library with split and feature extraction
# functions.
# ------------------------------------------------------------
from PIL im... | true |
addf769fecd889806f9d5cc3a1744c864ff6e580 | Python | komiljonovshohjahon/PythonAI_2 | /02_lottoNumber_1.py | UTF-8 | 869 | 3.890625 | 4 | [] | no_license |
import random # randrange()
import time # sleep()
# Lotto Number Maker (1-45)
# lotto = []
# for i in range(1, 46):
# lotto.append(i)
lotto = [i for i in range(1,46)]
# print(lotto)
# Print List
# for i in range(len(lotto)):
# print('{0:2d} '.format(lotto[i]), end='')
# if (i + 1) % 10 == 0:
# ... | true |
24ef6bc41210b6ea9385bde2d4e840436916cb57 | Python | 21seya/ExerciciosBasicoPython | /aula76.py | UTF-8 | 389 | 3.703125 | 4 | [] | no_license | turmas =int(input("Digite a quantidade de turmas:"))
soma = 0
for i in range(1,turmas+1):
qtd = int(input("Digite o numero de alunos da turma %d:"%i))
while qtd >40 and qtd <0:
print("Numero de alunos invalido")
qtd = int(input("Digite o numero de alunos da turma %d:"%i))
soma += qtd
pri... | true |
6f7ab8a06932a02c399ee13f1076ec96e5c31c5a | Python | thesonyman/Cyberpunk_hacking_script | /hacking.py | UTF-8 | 2,723 | 3.15625 | 3 | [
"MIT"
] | permissive | import random, time, math
w = ("scale", "catsha", "matrix", "obedo", "kylersecureity", "meshumoto")
s = len(raw_input("Who are you hacking? \n")) #based on length determends security level
if s >= 2:
l = random.choice(w)
o = 0
while o < 10:
o = o + 1
sec = random.randint(0, 5)
o =... | true |
ef063ef87f3b3239e94b4719331cdaa1f97c4806 | Python | krsnaapoorv/stock | /prc.py | UTF-8 | 9,285 | 2.828125 | 3 | [] | no_license | import openpyxl
import pandas as pd
import xlsxwriter
import datetime
import copy
path = "/home/apoorva/QED/Nifty 100.xlsx"
s = []
# opening Sheet of xlsx file
wb_obj = openpyxl.load_workbook(path)
sheet_obj = wb_obj.active
row = sheet_obj.max_row
total_return = []
# Finding all the listed company and their acco... | true |
c6da124ec77743bcef4edcaf682ef1a54e2caca8 | Python | lpappalettera/advent-of-code-2020 | /day01/day01.py | UTF-8 | 561 | 3.640625 | 4 | [] | no_license | def calc_answer_part1(entries):
for x in entries:
for y in entries:
if x + y == 2020:
return x * y
def calc_answer_part2(entries):
for x in entries:
for y in entries:
for z in entries:
if x + y + z == 2020:
return x * ... | true |
2626c648d245b7cfed7f815b97524439b644b0c2 | Python | sandro-fidelis/Cursos | /Curso Python/ex060.py | UTF-8 | 520 | 4.34375 | 4 | [
"MIT"
] | permissive | #Exercício feito com WHILE
'''n = int(input('Digite o número: '))
c = n
f = 1
print('Calculando {}! = '.format(n),end='')
while c > 0:
print('{} '.format(c),end = '')
print('x ' if c != 1 else '= ', end = '')
f = f * c
c = c-1
print(f)'''
#Exercícip feito com FOR
n = int(input('Digite um número para ver seu fa... | true |
72fb7baf98b7fba6a39634adf2f397be3dfeb89c | Python | TianXiaPy/PyExcel | /src/Chapter-6/06批量制作数据透视表/为一个工作簿的所有工作表制作数据透视表.py | UTF-8 | 727 | 2.546875 | 3 | [] | no_license | import pandas as pd
import xlwings as xw
app = xw.App(visible=False, add_book=False)
workbook = app.books.open("商品销售表.xlsx")
worksheet = workbook.sheets
for i in worksheet:
values = i.range("A1").expand("table").options(pd.DataFrame).value
pivot_table = pd.pivot_table(values, values="销售金额",
... | true |
8236f7eb5c1a6271ff086b14ac1b919ce4748593 | Python | angelamin/Machine-Learning | /Project/SynthText_Chinese_version-master/visualize_results.py | UTF-8 | 3,910 | 2.65625 | 3 | [] | no_license | """
Visualize the generated localization synthetic
data stored in h5 data-bases
"""
from __future__ import division
import os
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
import h5py
from common import *
from os import path
import scipy.misc
def viz_textbb(k,txt,text_im, charBB_list, wordBB... | true |
e46afab4344609b095d53893f3e25b9ad63789df | Python | ybsdegit/Keras_flask_mnist | /redis_util.py | UTF-8 | 1,832 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/16 20:28
# @Author : Paulson
# @File : testredis.py
# @Software: PyCharm
# @define : function
import redis
from datetime import date
# 增加使用redis统计访问次数的功能
REDIS_HOST = "112.126.101.188" # redis host
REDIS_PASSWORD = "ybsdemima@ybs"
MINIST_KEY ... | true |
7b3f23956d3cfb3ab4589b9b88a8c41cceeccbb8 | Python | burlluk/Perovskites | /Mui/ryan.py | UTF-8 | 15,339 | 2.75 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import sys
import xlrd
num_points = 100
fraction_to_leave_out = 0.80
input_data_range = 2*np.pi
number_of_epochs = 1000
num_iterations = 2
learning_rate = 0.1
output_col = 2
temp_error = None
workbook = xlrd.open_workbook('TestSheet.xlsx')... | true |
0ce5d9dbe7c56b97d19e608774e8090639614ad6 | Python | Harryhar1412/assignement4 | /characterfrequencycount.py | UTF-8 | 559 | 3.6875 | 4 | [] | no_license | # 1.Write a Python program to count the number of characters (character
# frequency) in a string.
val = input("Enter a word For counting Character frequency:")
frequency = {}
d = {}
for i in val:
if i in frequency:
frequency[i] += 1
else:
frequency[i] = 1
# print (frequency)
sort_frequency = sor... | true |
ee08e5e3bd82328a38c7702def3054bbd5be21cd | Python | xwHan0/comlib | /jquery/treegrid/svg.py | UTF-8 | 2,632 | 2.84375 | 3 | [] | no_license |
"""
一个图标由以下结构:
<---------- WIGHT ------------>
---------------------------------
| |
| |
| |
| ————————————————
| | |
| | | |
|----------------| ——————|————... | true |
bf0779d082ae6dbecbafbf2aedeaad5b73867bfb | Python | rs/webassets | /src/webassets/filter/yui.py | UTF-8 | 2,040 | 2.578125 | 3 | [
"BSD-2-Clause"
] | permissive | """Minify Javascript and CSS with
`YUI Compressor <http://developer.yahoo.com/yui/compressor/>`_.
YUI Compressor is an external tool written in Java, which needs to be
available. You can define a ``YUI_COMPRESSOR_PATH`` setting that
points to the ``.jar`` file. Otherwise, an environment variable by
the same name... | true |
4798e802fc36e16c44ea20f2310bce3e48b0ff22 | Python | johnrwilson/puzzles | /phone-number/phone_number.py | UTF-8 | 268 | 3.578125 | 4 | [] | no_license | import re
def Phone(phone):
#Turn into string if it is not already
phone = str(phone)
#Remove everything but numbers
phone = re.sub('[^0-9]','', phone)
#Keep last 11 numbers
phone = phone[len(phone)-10:len(phone)]
#Print
print(phone)
| true |