blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
6609b48727e3d0b462eb198e661ee59a8e501f80 | yajoy/lc-500 | /算法/回溯/131.py | UTF-8 | 733 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author : Joey Wong
@Time : 2021/3/26 14:45
@File : 131.py
@Desc : m
"""
res = []
def func(s):
def check(s):
l = 0
r = len(s) - 1
while l <= r:
if s[l] != s[r]:
return False
l += 1
r -= 1
... | true |
9adad2b85c5321400e7b8a4b339258f99d45bdd4 | ExchangeRateCrawler/CADCrawler | /ChinaEverBrightBankCrawler.py | UTF-8 | 1,432 | 3.03125 | 3 | [] | no_license | """
中国光大银行加币汇率爬虫
"""
import requests
import re
def get_html_text(url):
try:
r = requests.get(url)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:
print('爬取失败')
return None
def parse_page(html):
# print(html)
pattern = re.com... | true |
d113a7681ef81fac9440f6f037a42bc0473e9ba9 | voodoo888/python-git | /less3_#4.py | UTF-8 | 698 | 4.46875 | 4 | [] | no_license | # Программа возведения X в отрицательную степень Y
x = int(input('Введите действительное положительное число X: '))
y = int(input('Введите отрицательное целое число Y: '))
def my_func(x, y):
"""Возвращает результат возведения числа X в степень Y"""
return x ** y
def my_func1(x, y):
"""Возвращает резул... | true |
3cd6a52bb25fad6eb2b4f57b8c749a342aef069e | Rutrle/algorithms | /recursions/linked_list_reversion.py | UTF-8 | 512 | 4.03125 | 4 | [] | no_license | from linked_list import LinkedList
def linked_list_reverse(head):
'''
reverse linked list, returns new head
:param head: Node
'''
if head.data == None or head.next == None:
return head
node = linked_list_reverse(head.next)
head.next.next = head
head.next = None
print(f"nod... | true |
b3350b5b7704fa4aca9b8fc5d46e4cf6e4fc1e9b | alonzoc1/Inheritance-Simulation | /parasite.py | UTF-8 | 1,542 | 2.8125 | 3 | [] | no_license | #See special for details on the parasite class
from mobilesimulton import Mobile_Simulton
import model
from math import atan2
class Parasite(Mobile_Simulton):
def __init__(self,x,y,target,mother):
Mobile_Simulton.randomize_angle(self)
Mobile_Simulton.__init__(self,x,y,7,7,self._angle,7)
se... | true |
7f11fce275b2d18cc74bfa96253c55134ce6cdc3 | HaohuiHU/IVUS | /cost_matrix.py | UTF-8 | 3,486 | 2.90625 | 3 | [] | no_license | import numpy as np
def compute(CorrPv, CorrPa, CorrPt, CorrArea, w=0.1, angle=0):
# determine number of BL and FU images as well as number of angular steps
num_BL = CorrPv.shape[0]
num_FU = CorrPv.shape[2]
steps = CorrPv.shape[1]
# initialize weights
alpha = 0.4
beta = 0.4
gamma = 0.2... | true |
4319653eda85b404b9a50e2395bc603921ade03b | abhijitbonik/Spoken-Analytics-System | /dashboard/events_info.py | UTF-8 | 2,332 | 2.9375 | 3 | [] | no_license | """
This file contains name of events of which logs are being logged.
Currently this file is being used only to find the titles of page using event name.
The logs stored using middleware do not contain title of page.
So the function get_title_of_event() is used to get the page title.
This file is only used in the calc... | true |
bc4de083455bd4304ce846cf8f9e4cc248d1e13a | sudhirabadugu/Natural_Language_Processing | /lang_detector.py | UTF-8 | 2,833 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
from optparse import OptionParser
import collections
import os, logging
import string
import re
import math
def create_model(path):
model = []
f = open(path,"r")
unigram= collections.defaultdict(int)
bigram=collections.defaultdict(lambda : collections.defaultdict(int))
# model.... | true |
7c4fbf41f310e289433cd9a289fb3f7da57a7ed3 | HiagoW/Biopython | /Visualizacao/pontos.py | UTF-8 | 1,199 | 2.875 | 3 | [] | no_license | from Bio import SeqIO
import pylab
handle = open("exemplo_pontos.fasta")
record_iterator = SeqIO.parse(handle, "fasta")
rec_one = next(record_iterator)
rec_two = next(record_iterator)
handle.close()
# Definindo tamanho da janela
window = 11
dict_one = {}
dict_two = {}
# Comparacoes
for (seq, section_dict) in \
[(st... | true |
8f75f727d3193adef751fc567c6d62c9e967dea6 | sconklin/satnog-tools | /lib/satnogsdb.py | UTF-8 | 2,950 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# Author: Steve Conklin, AI4QR <steve@conklinhouse.com>
# Copyright (C) 2015
#
# This script is distributed under the terms and conditions of the GNU General
# Public License, Version 3 or later. See http://www.gnu.org/copyleft/gpl.html
# for details.
try:
# For Python 3.0 and later
from... | true |
7c8536aecfc5899b76bef020148cae8027aa8c48 | hyeonahkiki/home | /problem_soliving/sw_expert/6692. 다솔이의 월급상자.py | UTF-8 | 294 | 3.015625 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt', 'r')
T = int(input())
for tc in range(1, T+1):
N = int(input())
total = 0
for i in range(N):
per, money = map(float, input().split())
salary = per * money
total += salary
print('#{} {}'.format(tc,'%.6f' % total)) | true |
211b0e8eb66886f6d010355c925286c4c273daf2 | Shekeen/ChessLibrary | /figure.py | UTF-8 | 386 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Figure:
@staticmethod
def is_valid_move(from_cell, to_cell):
pass
@staticmethod
def intermediate_cells(from_cell, to_cell):
pass
class Pawn(Figure):
pass
class Rook(Figure):
pass
class Knight(Figure):
pass
class Bishop(Figure):
pas... | true |
a7ad4e877820012ab09fe05ba09dbec0c394a818 | rajtpd/telemetry_workshop | /environment/web-alarm.py | UTF-8 | 777 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python2
import web
urls = ('/', 'index')
class index:
def GET(self):
return "Hello, world!"
def POST(self):
data = web.data()
print
print 'HTTP POST RECEIVED:'
print data
print
if 'CRITICAL' in data:
print "Alert Received: Crit... | true |
dccee60a00737ac6ec67b98090437da80bb94a21 | minman2115/with-aws | /Weekly_Report_ChatBot/codes/lambda_handler.py | UTF-8 | 3,979 | 2.6875 | 3 | [] | no_license | import boto3
import json
import random
import requests
from urllib.request import urlopen, Request
import urllib
from pprint import pprint
# DataOps topic
jandi_url = "{Jandi_Incoming_Webhook_URL}"
weather_desc = {
"Thunderstorm": "오늘은 천둥 번개네요... 이불밖은 위험한데... ㄷㄷ",
"Drizzle": "오늘은 비가 오네요. 우산들은 다들 챙기셨죠?",
"R... | true |
9a19c3388387236deb96303eead64711c163e494 | Adrian94F/BUS | /lab2/Alicja_tez_xoruje.py | UTF-8 | 897 | 3.203125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# author: Adrian Frydmański
import base64
encoded = 'PAADREshCgcRDgZPBAoPSxgGBBEOAR0ABksVEUUeDw4YCksoBlQWAg5PBgoRGBUNAxkEGBUGSx8KGkUfDgQHEUVLIgEWAgoDVAoFSw0NBksFBhEGBEsLGBARGBUNSUsKDQ1FBgQVGAwcDk8WHAcETwQXEQ4fBgocCgsOAAUCClQADQ4EABwcBQoTCksKGxUOHkVPOQoRDk8eABgRDA4ASx8dGwYDDk... | true |
7376dbc389e2ab100594baf815801f36889dc0e5 | kholann/python | /lesson2_task4.py | UTF-8 | 528 | 4.09375 | 4 | [] | no_license | # 4. Пользователь вводит строку из нескольких слов, разделённых пробелами. Вывести каждое слово с новой строки.
# Строки необходимо пронумеровать. Если слово длинное, выводить только первые 10 букв в слове.
str = input("Введите строку: ")
s = str.split(' ')
for i, j in enumerate(s, 1):
if len(j) > 10:
j = ... | true |
a3fb88f68bf1148b830e8bf2cb403f05c64b8cb9 | basu-sanjana1619/python_projects | /singleLL_append.py | UTF-8 | 1,036 | 4.3125 | 4 | [] | no_license | #In singly linked list there is a head and a tail.
#Head denotes the starting point and tail denotes the end node which points to null
class Node:
def __init__(self,data):
self.data = data
self.pointer = None
class SinglyLL:
def __init__(self):
self.head = None
self.tail = None
def append(self,val):
n... | true |
10f42e465ab5f69c9edd9aedbf7bfb74dd481181 | uwescience/TrafficCruising-DSSG2017 | /pipeline/filter_spurs.py | UTF-8 | 1,689 | 3.3125 | 3 | [
"MIT"
] | permissive | def filter_spurs(trip_list, filter_time, silent=True):
"""Filters false positive sensor reads and arranges trips by timestamp.
trip_list [list]: a list of dicts in JSON format.
filter_time [int]: Of two successive reads within this amount of time,
the one with the weaker signal will be filtered ou... | true |
fb859d216c9fe5d7f70ed40e00e384c94ee4f62a | grischdian/Packt-Publishing-Free-Learning | /src/cli.py | UTF-8 | 1,636 | 3.09375 | 3 | [
"MIT"
] | permissive | """Module with Interactive shell to deal with a particular ebook."""
from cmd import Cmd
class Prompt(Cmd):
prompt = 'packt>'
intro = "Welcome to Packt-Shell! Type ? to list commands"
def __init__(self, completekey: str="tab",
stdin=None,
stdout=None,
all... | true |
4bd73df70bcd6e1dcce99049a35062f9f3cbf0ec | DrMikeG/AdventOfCode2020 | /15a/tool_src/advent.py | UTF-8 | 1,050 | 3.265625 | 3 | [] | no_license | import os
import re
import copy
import math
def age(n,turn,lastspoken):
if n not in lastspoken:
return 0
if n in lastspoken and len(lastspoken[n]) == 1:
return 0
return lastspoken[n][-1] -lastspoken[n][-2]
def numberIsSpoken(n,turn,lastspoken):
print("Turn %d number %d"... | true |
6e3c14a133379e44f3b70317b7f844c7a93ae3f8 | BigdataTeam3/DownloadMusic | /chording/Piano_association_analysis.py | BIG5 | 11,226 | 2.890625 | 3 | [] | no_license | # coding=utf-8
import numpy as np
from operator import itemgetter
import collections,pymongo
from pymongo import MongoClient
from decimal import Decimal, ROUND_HALF_UP
from bson.son import SON
from bson.code import Code
# ե
Piano_dict = {
'0':'Piano_acoustic_grand',
'1':'Piano_bright_acoustic',
'2':'Pian... | true |
bf697b42e6daf253cc8b54e87d2ee5af1663a361 | meteoric-minks/code-jam | /tests/test_main.py | UTF-8 | 4,055 | 3.078125 | 3 | [
"MIT"
] | permissive | import pytest
from blessed import Terminal
from application.ascii_box import Heavy
from application.ascii_drawing import DrawingChar
from application.dungeon import Dungeon, Item, Room
from application.menu import Button, Menu, TextUI
def test_text_ui() -> None:
"""This is the example test that shows that packag... | true |
5ff31643f091a80a0941b8dd57c8756b6f5a43fa | perfecto25/FlaskFlavors | /app/views/main.py | UTF-8 | 2,343 | 2.609375 | 3 | [] | no_license | from flask import render_template, redirect, url_for, flash, request
from app import app, log
from app.forms import LoginForm
from app.models import User
from flask_login import login_user, login_required, logout_user, UserMixin, login_manager, current_user
# ROUTING
@app.route('/')
def index():
''' index page '''... | true |
a0c386d7e14843bf1dab5beb8297f2b89af18ab2 | EvanMisshula/advpy | /9-zip.py | UTF-8 | 234 | 3.4375 | 3 | [] | no_license | ## Zip
to a single list of tuples of list1 = ['a', 'b', 'c']
list2 = [1, 2, 3]
my_zipList = zip(list1, list2)
print my_zipList
## unpack
pairs = [('a',1), ('b',2), ('c',3)]
letters, numbers = zip(*pairs)
print letters
print numbers
| true |
3c58b4a8c714b4e6685e57e85be54511b7a5c024 | LllC-mmd/SHAFTS | /src/shafts/mathexpr.py | UTF-8 | 18,576 | 2.84375 | 3 | [] | no_license | import numpy as np
import cv2
import skimage.morphology as skmorph
import skimage.feature as skfeature
import skimage.util as sku
import multiprocessing
# import matplotlib.pyplot as plt
def get_confusion_matrix(val_true, val_pred, num_quantile=20, normed=False):
q_list = np.linspace(0.0, 1.0, num_quantile+1)
... | true |
26398599517955cf8f8bd218e29734536a4e24b6 | weiteli/leetcode2018-19 | /LC746.py | UTF-8 | 394 | 2.96875 | 3 | [] | no_license | class Solution(object):
def minCostClimbingStairs(self, cost):
"""
:type cost: List[int]
:rtype: int
"""
if len(cost) == 1 or len(cost)==0:
return 0
a = cost[0]
b = cost[1]
for i in range(2, len(cost)):
total = min(a, b... | true |
a8c8f3c34396da86d1623f728888eff32aad8ded | mofei952/cookbook | /c01_data_structures_and_algorithms/p02_unpack_elements_from_iterables.py | UTF-8 | 1,616 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : mofei
# @Time : 2018/10/26 19:07
# @File : p02_unpack_elements_from_iterables.py
# @Software: PyCharm
"""解压可迭代对象赋值给多个变量"""
# 使用星号表达式解压可迭代对象
# 计算除掉第一个和最后一个分数的平均分数
grades = [1, 2, 3, 4, 5]
first, *middle, last = grades
print(sum(middle) / len(middle)) #... | true |
1bec405b83e321be3b6e6c531cbadef402c51a31 | dionwang88/lc1 | /algo/010_Regular_Expression_Matching/Q010_1.py | UTF-8 | 499 | 3.25 | 3 | [] | no_license | // Recursion Solution
class Solution:
def isMatch(self, s, p):
if not p:
return not s
if p[-1] == '*':
if s and (s[-1] == p[-2] or p[-2] == '.'):
return self.isMatch(s, p[:-2]) or self.isMatch(s[:-1], p)
else:
return self.isMatch(... | true |
e1c3d97149636decba5166fc85bf757cac4cb459 | jason-mcnulty/100-days-of-code | /day-3/require-name-field.py | UTF-8 | 858 | 4.1875 | 4 | [] | no_license | ###########################################################################
# This program will require a name to be used as the input.
# The challenge is not to allow any numbers 0-9
###########################################################################
# Adding additonal code to execute after the loop is close... | true |
951fb4e2743b86c1d697ff5b9f7014553eb910ed | lffbupt/Data_Structure | /DS/Chap5/Edge.py | UTF-8 | 300 | 2.84375 | 3 | [] | no_license | from enum import Enum
class EStatus(Enum):
UNDETERMINED = 0
TREE = 1
CROSS = 2
FORWARD = 3
BACKWARD = 4
class Edge:
def __init__(self,data = None,weight = None,status = EStatus.UNDETERMINED):
self.data = data
self.weight = weight
self.status = status | true |
d8f8a229d2ce1b4eace12959c5113de54433d846 | JOYFLOWERS/joyflowers.github.io | /github_unit_1/Mod_7/write_fav_num.py | UTF-8 | 205 | 2.984375 | 3 | [] | no_license | #Joy Flowers
#10/14/19
#writing the favorite number
file_name = 'fav_num.txt'
with open(file_name, 'w') as file_object:
name = input('Enter your favorite number: ')
file_object.write(name)
| true |
138479a03a5cba943a3f3f316e623c8cfc9bc5b3 | sahamath/ADASwarm | /tests/__init__.py | UTF-8 | 341 | 2.671875 | 3 | [] | no_license | # Integration Test
import torch
from swarmoptimizer import SwarmOptimizer
class CubicFunction:
def evaluate(self, x):
return x ** 2 + torch.exp(x)
pso = SwarmOptimizer(1, 100, swarm_optimizer_type="exponentially_weighted", max_iterations=10)
pso.optimize(CubicFunction())
print(pso.run(verb... | true |
49a5b69488d2c7618fc2a8de70e8b56e4ef0e53c | sbhackerspace/sbhx-rov | /multijoystick.py | UTF-8 | 4,148 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
################################################################
# Module: multijoystick.py
# Created: 2 April 2008
# Author: Brian D. Wendt
# http://principialabs.com/
# Version: 0.2
# License: GPLv3
# http://www.fsf.org/licensing/
'''
Provides four-axis joystick servo control from a ... | true |
4acd8d8ce99e995bec6e118da8d4a1abcff2a838 | txytju/checkio | /pawn-brotherhood.py | UTF-8 | 1,324 | 3.609375 | 4 | [] | no_license | def safe_pawns(pawns):
num = 0
s = "abcdefgh"
for pawn in pawns:
p = pawn[0]
n = int(pawn[1])
if n != 1 :
n -= 1
n = str(n)
ind = s.find(p)
if ind == 0 :
p2 = s[1]
pawn_2 = p2 + n
pawn_1 = None
elif ind == 7... | true |
ee6f07b58c570506cef72ffcba834ea45914d830 | omarcostahamido/Qu-Beats | /Qu-Beats.py | UTF-8 | 5,033 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from typing import List, Callable
import numpy as np
from mido import Message, MidiFile, MidiTrack
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, Aer, execute
from qiskit.tools.visualization import plot_histogram
#~~~~~~~ Circuit Transformations ~~~~~~... | true |
9fd661d9cc3299b9c7c266c03ac19f5cf83af6e5 | jsam/math-labeler | /tasks/prepare.py | UTF-8 | 2,885 | 2.765625 | 3 | [] | no_license | import struct
import math
import json
import cv2
import numpy as np
from tqdm import tqdm
from pathlib import Path
from lxml import etree
dim = (750, 1024)
def hexlongbits2double(s):
return struct.unpack('d', struct.pack('Q', int(s, 16)))[0]
def bbox2rect(bbox, t):
"""Convert bbox to a description dicti... | true |
b2f23708c517defee97b052764fdc776620ea2d1 | anand755/MachineLearningSection | /LogisticRegression/AdvertisingSolution.py | UTF-8 | 1,153 | 2.765625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
ad_data = pd.read_csv("Data/advertising.csv")
print(ad_data.info())
#print(ad_data.head())
#print(ad_data.describe())
# sns.set_style('whitegrid')
# ad_data['Age'].hist(bins=30)
# plt.xlabel('Age')
#sns.jointplot(x='Age', y... | true |
e3b92a155b106ff54408641c99f7821443fb07c3 | dundunmao/LeetCode2019 | /938. Range Sum of BST.py | UTF-8 | 1,977 | 3.15625 | 3 | [] | no_license | # # Definition for a binary tree node.
# # class TreeNode:
# # def __init__(self, x):
# # self.val = x
# # self.left = None
# # self.right = None
#
# class Solution:
# def rangeSumBST(self, root: TreeNode, L: int, R: int) -> int:
# if root is None:
# return 0
# ... | true |
8b3b82382c8928176e9a67f36933492983d95e80 | narame7/set2regex | /fado-python3/FAdo/reex.py | UTF-8 | 61,310 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""**Regular expressions manipulation**
Regular expression classes and manipulation
.. *Authors:* Rogério Reis & Nelma Moreira
.. Contributions by
- Marco Almeida
- Hugo Gouveia
- Eva Maia
.. *This is part of FAdo project* http://fado.dcc.fc.up.pt
.. *Version:* 0.9.8
.. *Copy... | true |
761ff9fff06a3eb1abd1867faa6e6422d039b228 | CRJoshuaa/Poladrone-Image-Preprocessing-V2 | /crop_controller.py | UTF-8 | 7,370 | 2.53125 | 3 | [] | no_license | from PyQt5.QtWidgets import QApplication,QDialog,QTabWidget,QWidget,QFileDialog,QMessageBox,QErrorMessage,QProgressBar
from PyQt5 import QtCore, QtGui, QtWidgets
import os
import sys
import cv2
class Crop_Controller():
def __init__(self,view,main_controller):
super().__init__()
self.view=view
... | true |
ad2d8a860a190155c52857e86816682738587dfd | httpdaniel/cartpole-algorithms | /algorithms/Plotter.py | UTF-8 | 1,232 | 2.75 | 3 | [] | no_license |
import matplotlib
matplotlib.use("TkAgg")
from Genetic import CartPoleGenetic
from CartpoleDQN import CartpoleAgent
from PIDController import gradient_descent
from Baseline import main
import matplotlib.pyplot as plt
import gym
episodes = 110
# Baseline
baseline_values = main(episodes)
# Get values from PID algorit... | true |
5f25d8981a440cb2414d8538c5803052eb7a2a19 | devanshu-shah/NFT-API | /env/Lib/site-packages/mythx_models/response/group_list.py | UTF-8 | 3,140 | 3.0625 | 3 | [] | no_license | """This module contains the GroupListResponse domain model."""
import json
from typing import Dict, Iterator, List
from mythx_models.response.base import BaseResponse
from mythx_models.response.group import Group
from mythx_models.util import resolve_schema
INDEX_ERROR_MSG = "Group at index {} was not fetched"
cla... | true |
e3f036dd9970d7fe1a6e1840d7446b4fb4a3b847 | xiang-123352/code_snippets | /python/beispiele/16_Schnittstelle_BS/02_acc_Dateisystem.py | UTF-8 | 2,802 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Mit den hier stehenden Funktionen kann man sich die das Dateisystem
wie mit einem Dateimanager oder einer Shell bewegen,
Informationen zu Dateien und Ordnern ermitteln,
diese umbenennen, erstellen oder loeschen
Oft Nutzung von Pfad als Parameter (absolut oder relativ)
"""
impor... | true |
34511697b5a526e4ff79b1124596a408097082a8 | rmitra/DLWorkshop-lab2 | /wgan_repnet.py | UTF-8 | 5,190 | 2.78125 | 3 | [] | no_license | """
Implementation of the Paper from Wandt and Rosenhahn
"RepNet: Weakly Supervised Training of an Adversarial Reprojection Network for 3D Human Pose Estimation"
This training script trains a neural network similar to the paper.
Except some minor improvements that are documented in the code this is the original implem... | true |
4708afd24a529f2ca461ba026807dd57d44026c0 | wirelessjeano/py4kids | /lesson-22-music/classical_music.py | UTF-8 | 2,327 | 2.953125 | 3 | [] | no_license | # use full-name to lookup Wikiwand
import json
def ts2sec(ts):
tmp = ts.split(":")
if len(tmp) >= 3:
sec = 60*60*int(tmp[0]) + 60*int(tmp[1]) + int(tmp[2])
elif len(tmp) == 2:
sec = 60*int(tmp[0]) + int(tmp[1])
else:
sec = int(tmp[0])
return sec
def make_youtube_ur... | true |
75d61bcf11db27186455b7dc7f0e374321af41e1 | sachin-aryal/tikinter-gui | /testing.py | UTF-8 | 1,497 | 3.03125 | 3 | [] | no_license | # import tkinter as tk
# from tkinter import *
# from project1 import main
#
# win = tk.Tk()
# win.geometry("380x640")
# # Set window title here to 'FedUni Banking'
# win.title("FedUni Banking")
#
# fed_ui_banking = tk.Label(win, text="FedUni Banking", font=("Helvetica", 24))
# fed_ui_banking.grid(column=0, row=0, stic... | true |
35650691ed58c237321aabe97fb393f276782dac | zchen0211/topcoder | /python/leetcode/tree/314_bin_tree_vertical.py | UTF-8 | 2,363 | 4.125 | 4 | [] | no_license | """
314. Binary Tree Vertical Order Traversal (Medium)
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from left to right.
Examples:
Given binary tree [3,9,20,null,null,15,7],
... | true |
3dda0fe2f3953edb11e8fc78d5bfa16b05c74280 | swincas/cookies-n-code | /tutorials/modularising_and_packaging_code/modularising_code/postmodules/calculate_recession_velocity.py | UTF-8 | 1,214 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
import astropy.units as apu
import astropy.constants as apc
import astropy.cosmology as acosmo
import utils
def calculate_Hubble_flow_velocity_from_cMpc(cMpc, cosmology="Planck15"):
"""
Calculates the Hubble flow recession velocity from comoving distance
Parameters
----------
c... | true |
87c97c64a245ef0858cea81739a9f0a889ebb738 | rneil06/PythonMathsSoftware | /Maths Software/MHOME.py | UTF-8 | 1,494 | 3.484375 | 3 | [] | no_license | #Home page for software
print('Welcome to the most advanced maths software')
print('1. Simple Calculator')
print('2. Kilometres to Miles Converter')
print('3. Fahrenheit to Celsius Converter')
print('4. Celsius to Fahrenheit Converter')
print('5. Average Percentage Calculator')
print('6. Area Calculator')
print('7. Pe... | true |
3a8d28f1229638a304a23b8c0bb9e64c9e6f78ae | CalvinCheungCoder/Python-100-Days | /Old/PythonOne/19.6.6.py | UTF-8 | 1,328 | 3.015625 | 3 | [] | no_license | import wx
class MyFrame(wx.Frame):
def __init__(self):
super().__init__(parent=None, title='静态图片控件', size=(300, 300))
self.bmps = [wx.Bitmap('images/bird5.gif',wx.BITMAP_TYPE_GIF),
wx.Bitmap('images/bird4.gif',wx.BITMAP_TYPE_GIF),
wx.Bitmap('images/bird3.gi... | true |
a708d1497d6f22e16f9fe707106382f4e137a12b | ramehx/Machine-Learning-Techniques | /Activity_1/activity_1.py | UTF-8 | 2,570 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 27 18:30:21 2017
@author: José Ángel Martín Baos, Oscar Pérez Galán, Miguel Ampuero
López-Sepúlveda
"""
import codecs
import time
import sys
import numpy as np
from numpy import corrcoef, transpose, arange
from pylab import pcolor, show, colorbar, xticks, y... | true |
8235cb2de284ceb03073547959805d9a32cd7c88 | youngblood00/code_snippets | /Python-Ints/intro.py | UTF-8 | 3,519 | 4.59375 | 5 | [
"MIT"
] | permissive | # Python 3.6 Tutorial for Beginners
# Working with Numeric Data
# Integers and Floats
#let's set some integer numbers
num = 4
num1 = 5
num2 = 3
num3 = 3.68
num4 = -6
# number that get set value of number within a string
num5 = '86'
num6 = '28'
#------------------------------------------------------------------------... | true |
92f3657ce03eb0e06f1d6cea49b13c79b55fb5d8 | JVercout/falsk_jbase | /manage.py | UTF-8 | 2,818 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Flaskr Application Framework
Usage:
manage.py devserver [-p NUM]
manage.py celerydev
manage.py create_all
manage.py (-h | --help)
Options:
-p NUM --port=NUM Flask will listen on this port number
[default: 5000]
"""
import signal
... | true |
edc1975213e35eb408b836d1632f8316a288d6fa | YoureWhatsOn/twitterfeelz | /feelz.py | UTF-8 | 3,544 | 2.53125 | 3 | [
"Unlicense"
] | permissive | import os, sys, random, time, json
import pandas as pd
import pickle as pickle
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from textblob import TextBlob
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
... | true |
145db2a05dcb8af5d8a959b32248bee2bc7456ec | yywecanwin/PythonLearning | /day04/06字符串切片步长的使用.py | UTF-8 | 826 | 4.40625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# author:yaoyao time:2019/9/28
"""
字符串切片步长的格式:
字符串名[开始索引:结束索引:步长]
假如步长是n
从 开始索引对应的元素截取,一直截取到 结束索引 对应的元素
先 截取出 开始索引对应的元素,然后每次都是向后数n个元素,第n个元素是谁把谁截出来
最后按照截取的先后顺序,组成一个字符串,这个字符串,就是截取的结果
"""
# 步长默认就是1,
s = "hello python"
print(s[2: 10: 2]) # lopt
print(s[2: 10: 1]) # llo pyth
pr... | true |
e707178fff3727875c60964417fbd837705ef7ea | ZharyonovOleg/HomeWork | /Task_1.3.py | UTF-8 | 451 | 3.453125 | 3 | [] | no_license | n1 = input('Введите переменную n от 1 до 9: ')
while(int(n1) <= 0 or int(n1) > 9):
print('Вы ввели отрицательное, равное нулю или число, которое больше девяти!')
n1 = input('Введите переменную n от 1 до 9: ')
n2 = n1 + n1
n3 = n1 + n1 + n1
summ = int(int(n1) + int(n2) + int(n3))
print('Выражение n+nn+nnn=',n1,... | true |
db7e8c2939aae37f493269f947f48fd7c03fb1c9 | mwhoffman/mogmdp | /demo.py | UTF-8 | 1,751 | 2.75 | 3 | [] | no_license | from __future__ import division
import numpy as np
import matplotlib.pyplot as pl
import mogmdp
# construct the model.
params = {}
params['mu0'] = -5.0
params['Sigma0'] = 0.5
params['A'] = 1.0
params['B'] = 1.0
params['Sigma'] = 0.3
params['w'] = [1.0, -.5]
params['y'] = [[3.,0.], [2.,0.]]
params['M'] = [3*np.eye(2), ... | true |
b93607d3c57c1c57ff596ae2aa763d43e9e57f57 | jsguerrero/machinelearning-az | /datasets/Part 2 - Regression/Section 6 - Polynomial Regression/polinomial_regression_sbn.py | UTF-8 | 2,102 | 3.5625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 15:29:53 2020
@author: jguerrero
"""
# Regresion polinomica
# Como importar las librerias
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importar el dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = ... | true |
2ee43109813db486122181b2fe9f72f4e0ff1b3b | bemagee/LearnPython | /Python Class 6.00.1_3x/L3Problem4-4.py | UTF-8 | 119 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
for num in range(2,12):
if num % 2 == 0:
print 'print ' + str(num)
print 'Goodbye!' | true |
a0fe02842c3b742d8005f87d59b2939188aff849 | sudeep0901/python | /src/matplotlib/13.matlabimages.py | UTF-8 | 747 | 2.640625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as pyplot
import matplotlib.image as mpimg
import numpy as np
img = mpimg.imread(r'src\matplotlib\stinkbug.png')
print(len(img), type(img))
imgplot = pyplot.imshow(img)
pyplot.show()
ar = [np.random.randn(1000), np.random.randn(10000), np.random.randn(10000)]
lum_img = img[:, :, 0]
pyplot.... | true |
449ebe76132e9e82e5c48b66d1e00545d8dc3f8d | run-fourest-run/ecs-airflow | /dags/create_directories_in_s3.py | UTF-8 | 611 | 2.578125 | 3 | [
"MIT"
] | permissive | import boto3
import itertools
import datetime
def create_directories_in_s3(**kwargs):
bucket_name = kwargs['bucket_name']
s3 = boto3.client('s3')
date = '{:%B%d%Y}'.format(datetime.now())
records = [record for record in list(itertools.product(holding_symbols, endpoints))]
file_pattern_list = []
... | true |
e11e4fe9abbc0896647114d689e9e1e9cb721824 | kol-ol/SF_D3.4 | /news/templatetags/custom_filters.py | UTF-8 | 2,346 | 3.4375 | 3 | [] | no_license | from django import template
# если мы не зарегистрируем наши фильтры, то Django никогда не узнает, где именно их искать и фильтры потеряются
register = template.Library()
stop_words = [
'плохое_слово1',
'плохое_слово2',
'плохое_слово3',
]
# Теперь каждый раз, когда мы захотим пользоваться нашими фильтра... | true |
d4b790f87961f324537b41e7d4ffe60e01dc0760 | crcrpar/ChainerDenseNet | /densenet.py | UTF-8 | 10,679 | 2.9375 | 3 | [] | no_license | # coding: utf-8
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import initializers
class DenseLayer(chainer.Chain):
"""element of DenseBlock"""
def __init__(self, in_ch, growth_rate, bn_size, dropout_rate=0.5):
r"""initialization of denselayer.
Args:
... | true |
15aef7cd3b357ef29798cdcd7538c16dbd270599 | jsakhnin/airbnb_predictions | /lib/models.py | UTF-8 | 8,600 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense, Input, Dropout
import time
import math
from sklearn.metrics import mean_squared_error
import numpy as np
import os
import pandas as pd
### ----------------------------------- ... | true |
1423b787bab59a7d5d4233c639a29efed117d7ad | felipesilvadv/Quinto_semestre | /Arquitectura_computadores/Tareas/T1/15635570.py | UTF-8 | 2,621 | 3.59375 | 4 | [] | no_license | # Tarea 1 Arquitecura de Computadores
import os
def convertir_float(decimal, l_exp=8, l_sig=23):
if float(decimal) < 0:
signo = "1"
else:
signo = "0"
punto = decimal.find(".")
pe = float(decimal[0:punto])
pd = float("0."+decimal[punto+1:])
restos_enteros = []
while pe != 0:
... | true |
4213ee08dbc1a77c8f6e4d2a4b3ae67c7f95171f | katrinakalantar/AbateLab | /preliminary_outdated/clusterData.py | UTF-8 | 1,614 | 3 | 3 | [] | no_license | __author__ = 'KATRINA'
'''
clusterData.py [input data matrix] [input refseq taxons] [output file name]
usage: this script was used to cluster data based on MASH distance to the RefSeq database.
Creates a dendrogram from hierarchical clustering (via python fastcluster module) of the refseq MASH data.
- NOTE:... | true |
701d93bbdf906e534e44a1da72a70d2dbe497aa2 | henryZe/code | /leetcode/tree/medium/right_pointer_3_4.py | UTF-8 | 1,078 | 3.546875 | 4 | [] | no_license | from typing import List
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
def __str__(self):
return "[{}:l {} r {} n {}]".format(self.val, sel... | true |
a3419e18994a0fa897b8d5871bcebecfe6e7e77e | khiladikk/Basic_OpenCV_Projects | /Detecting_Face_Eye_Live/CV (Face and eye Live).py | UTF-8 | 1,615 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Importing the library
import cv2
# In[2]:
# Using the pre-trained haar cascade XML file
# for face and eyes separately
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier("haarcascade_eye.xml")
# In[3]:... | true |
d677b365dd9b86c53aeb951a63eba2b6b4404dd4 | opmishra08/Git-Tutorials | /PYTHON/Python_Artificial_Intelligence/Machine_Learning_Heart_Disease_Detector/main.py | UTF-8 | 600 | 2.640625 | 3 | [] | no_license | from flask import Flask, render_template, request
import pickle
file = open('model.pkl', 'rb')
clf = pickle.load(file)
file.close()
app = Flask(__name__)
@app.route('/', methods=["GET", "POST"])
def hello_world():
if request.method=="POST":
myDict = request.form
bloodPreasure = int(myDict['blood... | true |
6ddf9ee01c3203d1db41974d9db616f14832b9d7 | bufubaoni/antitools | /some_arith/snake_list.py | UTF-8 | 1,805 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 这是一个很有意思的遍历二次数组的方式
# 类似蛇盘踞一样遍历整个数组
source_list = [[11, 12, 13, 14, 15, 16],
[21, 22, 23, 24, 25, 26],
[31, 32, 33, 34, 35, 36],
[41, 42, 43, 44, 45, 46],
[51, 52, 53, 54, 55, 56],
[61, 62, 63, 64, 65, 66]]
start = (0,... | true |
57247645f0b678d3e3c032559c891ebe5ef713a3 | amkashyap1220/Python-TicTacToe | /board.py | UTF-8 | 2,804 | 3.796875 | 4 | [] | no_license | class Board:
def __init__(self):
# board is a list of cells that are represented
# by strings (" ", "O", and "X")
# initially it is made of empty cells represented
# by " " strings
self.sign = " "
self.size = 3
self.board = list(self.sign * self.size**2)
... | true |
5ed7de53550d424919dbc09afbfbe7bb87698aaf | ilitteri/7541-Algo2 | /final2020c2-3/algoritmos/python/queue.py | UTF-8 | 398 | 3.375 | 3 | [
"MIT"
] | permissive | from typing import Any
class Queue:
'''Estructura de cola'''
def __init__(self):
self.__data = []
self.__count = 0
def push(self, data: Any):
self.__data.append(data)
self.__count += 1
def pop(self):
self.__count -= 1
data = self.__data.pop(0)
... | true |
e32f5912b82e5954ef1dd77ef6602c307794cf2f | AK-1121/code_extraction | /python/python_15198.py | UTF-8 | 137 | 2.765625 | 3 | [] | no_license | # how would i separate a string based on some pattern without loosing the match parameter in python?
print re.split('(\(%[oi]\d+\))', a)
| true |
96c0880fd7864ed10baf1e994048d5edac9a4355 | DrWiki/Alliance_Sentry_CNN_Tensorflow_Pytorch | /Robomaster_CNN.py | UTF-8 | 6,374 | 2.625 | 3 | [] | no_license | import cv2
import os
import torch
import torch.nn as nn
import torchvision
import argparse
import numpy as np
import copy
from torch.autograd import Variable
pa = argparse.ArgumentParser()
pa.add_argument("--input_row", type=int, default=0)
pa.add_argument("--input_col", type=int, default=0)
pa.add_argument("--input_c... | true |
5cbd0aee32124c1f3578ac1bfcd4851fe3ae7458 | lszxw1234/Leetcode | /518coin_change2.py | UTF-8 | 390 | 2.6875 | 3 | [] | no_license | class Solution(object):
def change(self, amount, coins):
"""
:type amount: int
:type coins: List[int]
:rtype: int
"""
dp = [0 for j in range(amount + 1)]
dp[0] = 1
for i in range(1, len(coins) + 1):
for j in range(coins[i - 1], amount + 1... | true |
108415df872adc66779ba35e1659796143c12b4e | AstroSoM/hudf | /rescale_segmap.py | UTF-8 | 6,340 | 2.90625 | 3 | [] | no_license | import numpy as np
import os
from PIL import Image
from astropy.io import fits
from scipy.misc import imread, toimage, imresize
from map_galaxies2notes import *
#====================================================================================================
'''
Produce a re-scaled version of the Segmentation Map ... | true |
7c1abfe5f81a68a0db43e7f63b49af925a577b83 | dwcm/datawiz | /dw_v1.py | UTF-8 | 20,944 | 2.921875 | 3 | [
"CC0-1.0"
] | permissive | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import LinearRegression
from sklearn import svm, preprocessing
from sklearn.cluster import KMeans
from statsmodels.stats.multicomp import pairwise_tukeyhsd
######### CONFIG ##... | true |
4a80c718323ade654b189da44feb280046e5f2ce | JalonJia/PythonStudy | /src/Jalon/201801/20180118.py | UTF-8 | 1,218 | 3.34375 | 3 | [] | no_license | """
读取文件,随机显示一个字出来
"""
import os
import os.path
import glob #通配符
import tempfile #文件缓存
import linecache
#from linecache_data import *
import codecs #打开其他编码的文件
import random #随机数
#def open_charfile():
# f = open(os.curdir + '/一年级语文生字.txt', 'rw')
print(os.curdir)
print(os.path.abspath(os.curdir))
... | true |
740aa12a003e10dfc314e149d94a2d242e93fc51 | chvillap/spark-scripts | /mllib_guide/extracting_transforming_and_selecting_features/feature_transformers/pca.py | UTF-8 | 980 | 3.296875 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.ml.linalg import Vectors
from pyspark.ml.feature import PCA
# PCA is a statistical procedure that uses an orthogonal transformation to
# convert a set of observations of possibly correlated variables into a set
# of values of linearly uncorrelated variables called prin... | true |
09d76baa5a2cc3200b2af728b15f1c9b05224a79 | TarandeepSingh562/NeuralNetwork | /Neurode.py | UTF-8 | 5,013 | 2.984375 | 3 | [] | no_license | from abc import ABC, abstractmethod
import numpy as np
import random
from enum import Enum
# Perhaps learning rate should be a variable in the network
class LayerType(Enum):
INPUT = 0
OUTPUT = 1
HIDDEN = 2
class MultiLinkNode(ABC):
class Side(Enum):
UPSTREAM = 0
DOWNSTREAM = 1
... | true |
b1ee1df03bdb0241dd94cd1cbcb62766c6f973d0 | JAIMX/PycharmProject | /homework/week11.py | UTF-8 | 3,047 | 3.609375 | 4 | [] | no_license |
'''
1. data1 是40名癌症病人的一些生存资料,其中,X1表示生活行动能力评分(1~100),X2表示病人的年龄,X3表示由诊断到直入研究时间(月);X4表示肿瘤类型,X5把ISO两种疗法(“1”是常规,“0”是试验新疗法);Y表示病人生存时间(“0”表示生存时间小于200天,“1”表示生存时间大于或等于200天)
试建立Y关于X1~X5的logistic回归模型
2. data2 是关于重伤病人的一些基本资料。自变量X是病人的住院天数,因变量Y是病人出院后长期恢复的预后指数,指数数值越大表示预后结局越好。
尝试对数据拟合合适的线性或非线性模型
'''
# coding: utf-8
#Q1
imp... | true |
28b80578e4017cb6c946ad639768032d0e7a18d7 | marcusbfs/Sindri | /Sindri/polyEqSolver.py | UTF-8 | 4,974 | 3.40625 | 3 | [
"MIT"
] | permissive | from numba import jit, float64
from constants import DBL_EPSILON
@jit((float64, float64, float64), nopython=True, cache=True)
def solve_quadratic(a, b, c):
"""
Solves the real roots of a quadratic equation.
Solves the real root of the equation
a*x^2 + b*x + c = 0
Parameters
----------
... | true |
d52cd63e1fb66844ebb2564519daf2a5e0759cc5 | cognitedata/populate-mypy-pre-commit | /populate_mypy_pre_commit/main.py | UTF-8 | 2,461 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import re
import subprocess
from pathlib import Path
from typing import Dict, List, Tuple
import yaml
PRE_COMMIT_CONFIG_FILE_PATH = ".pre-commit-config.yaml"
MYPY_PRE_COMMIT_REPO = "https://github.com/pre-commit/mirrors-mypy"
MYPY_PRE_COMMIT_HOOK_ID = "mypy"
def get_poetry_dependencies() -> List[str... | true |
944698a69765e1f74a6e2c95b7bc407f3a4904fa | dundunmao/LeetCode2019 | /743. Network Delay Time.py | UTF-8 | 3,870 | 2.921875 | 3 | [] | no_license | # Dij
import heapq
class Solution:
def networkDelayTime(self, times, N, K) -> int:
graph = {}
for edge in times:
if not edge[0] in graph:
graph[edge[0]] = []
graph[edge[0]].append((edge[1], edge[2]))
heap = [] # 存(node, distanc),按distance排序,min heap
... | true |
97cf2c8ad9914e158f825e24a45df3912175d388 | estout82/text-database | /util.py | UTF-8 | 464 | 3.53125 | 4 | [] | no_license | #!/usr/local/bin/python3
# function: strips \n from given string
# return: newline-less string on sucess, empty string on failure
def stripnewlines(string) -> str:
if type(string) != str:
print("ut > unable to strip new lines from {}. type is not string".format(string))
return str()
return stri... | true |
e224e8e09c106c8754d49e5c8d4c3a4054eedd67 | peterfrancisrit/Enduco | /SemanticAnalysis/Tourmagazin/CrawlerTour.py | UTF-8 | 303 | 2.609375 | 3 | [] | no_license | # Tour magazine crawler
from bs4 import BeautifulSoup
import requests
import numpy as np
url = "https://www.tour-magazin.de/"
req = requests.get(url)
soup = BeautifulSoup(req.text,"lxml")
tabs = [x.find('a') for x in soup.find('nav',class_='main vertical').find('ul').find_all('li',recursive=False)]
| true |
bcea473f03c908803953f2cf54519ae2d93535bb | qnn5342/nguyennhatquang-fundamental-c4e15 | /session2/homework/turtle_shape2.py | UTF-8 | 300 | 3.59375 | 4 | [] | no_license | from turtle import *
shape("turtle")
odd = "blue"
even = "red"
sides = 2
turn = 0
for u in range (4):
sides +=1
turn +=1
if turn %2 ==0:
color(even)
else:
color(odd)
for i in range(sides):
forward(100)
left (360/sides)
print (turn)
mainloop()
| true |
0a9deffd3fced054c7f9f99b5e78230a3dbb7fd3 | Qiangzi-pro/BeautyDesign | /PerformanceCounter/article39/NewReporter39.py | UTF-8 | 3,343 | 2.625 | 3 | [] | no_license | """
负责展示 OR 以一定频率统计&推送统计数据
"""
import abc
import json
import sched, time
from typing import Dict
from apscheduler.schedulers.blocking import BlockingScheduler
from PerformanceCounter import RequestStat
from PerformanceCounter.article40.MetricsStorage import MetricsStorage
from PerformanceCounter.article40.Aggregator im... | true |
ce7cff3daa589bf2bc48dc2c60403f512c165320 | tjweldon/MicroProxy | /snipe.py | UTF-8 | 1,440 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import config
import history
import requests
import utils
crlf = "\r\n"
tab = " " * 4
quote = "\""
def _format_lines(raw: str):
def _format(line):
return tab * 2 + "f" + quote * 3 + line + quote * 3 + ","
return [_format(line) for line in raw.split(crlf)]
def create_templat... | true |
28d292764e30c34312be61647862182be4c20002 | f7deleon/azlyrics | /tests/test_azlyrics.py | UTF-8 | 446 | 2.75 | 3 | [
"MIT"
] | permissive | import unittest
from azlyrics import artists, songs, lyrics
class AzlyricsTests(unittest.TestCase):
def test_artists(self):
a = artists("T")
self.assertIsNotNone(a)
self.assertIn('Taylor Swift', a)
def test_songs(self):
s = songs("Taylor Swift")
self.assertIsNotNone(s... | true |
5449d1b8931f9d3e77f46e8e8cabed963094ba3a | happyhappyhappyhappy/pythoncode | /atcoder/beginners/chap2/ABC095A_3.py | UTF-8 | 394 | 3 | 3 | [] | no_license | # Problem https://atcoder.jp/contests/abc095/tasks/abc095_a
# Python 3rd Try
def solver(memoStr):
result = 700
if memoStr[0] == 'o':
result = result + 100
if memoStr[1] == 'o':
result = result + 100
if memoStr[2] == 'o':
result = result + 100
return result
if __name__ == ... | true |
1762d99c8ef1e34f1aa0f7869eece796628bb3ca | Rafat97/RafatProgtammingContest | /LeedCode/Algorithms/6. ZigZag Conversion.py | UTF-8 | 685 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | '''
"PAYPALISHIRING"
3
"PAYPALISHIRING"
4
"A"
1
"ABCDEF"
2
'''
class Solution:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1:
return s
str1 = [""] * numRows
trac = 0
flag = False
for stri in s:
str1... | true |
59439a3c970fdb75f6ff3d566ec6a53be21e64f7 | GrinTwisted/Twitch-Chat-Bot | /channel_class.py | UTF-8 | 147 | 3.015625 | 3 | [] | no_license | class Channel:
def __init__(self, channel):
self.channel = channel
def __getattr__(self, attr):
return getattr(self, attr) | true |
4b49ad1bb7bd979e37cf11088888e074d194bbb8 | ObertShen/py_practice | /ObertShen/0009/htmllink.py | UTF-8 | 572 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""Python 练习册 第8题 获取HTML文件的链接 仓库地址https://github.com/ObertShen/py_practice"""
__author__ = 'Shen'
import urllib
from bs4 import BeautifulSoup
def catch_html_link(url):
"""根据提供的url来获取该html文件的链接内容"""
content = urllib.urlopen(url)
soup = BeautifulSoup(content, ... | true |
398de7533cc0c4e2204c3aa8b972e50352461d96 | vikramforsk2019/FSDP_2019 | /day03/frequency.py | UTF-8 | 315 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 09:30:25 2019
@author: vikram
"""
my_dict={}
input_str=input('enter a string>')
print(input_str)
for item,value in enumerate(input_str):
if value not in my_dict:
my_dict[value]=1
else:
my_dict[value]+=1
print(my_dict) | true |
390e21df19653c31db51b9e752984183a1012155 | JeisyLiu/Repository_Charlie | /VariousFeatures/Scripts/ctrlOrderCopy.py | UTF-8 | 1,308 | 2.546875 | 3 | [] | no_license | import os
import keyboard
import pyautogui
import threading
import time
resetmark = False
ctrlbuffer = ['a', 'a', 'a', 'a']
def shutter():
global resetmark
resetmark = True
global ctrlbuffer
ctrlbuffer = ['a', 'a', 'a', 'a']
print('a thread finished')
def changer(x, i):
globa... | true |
1a9ecaf7fedf122b1557f4bedbcb44b271853f8b | abhishekgarg16/Ire-Major-Project | /dnn-doc2vec.py | UTF-8 | 1,867 | 2.5625 | 3 | [] | no_license | import numpy as np
from sklearn.metrics import accuracy_score
from sklearn import linear_model
from collections import namedtuple
def label_to_int(label):
labels={'SOCL':0,'PREG':1,'GOAL':2,'TRMT':3,'DEMO':4,'FAML':5,'DISE':6}
return labels[label]
X=[]
Y=[]
with open('./input-data-merged.txt') as f:
for line in ... | true |
6bfc5021dd0f327c84a3181a8c095561c55fbb62 | amalolan/game-ai | /Project 1/untitled0.py | UTF-8 | 25,579 | 2.765625 | 3 | [] | no_license | #import sys
#from collections import deque
#import time
#import random
#import queue
#import heapq
#import itertools
#
#sys.setrecursionlimit(2900)
#args = sys.argv
#B=list(args[2])
#a=''
#for i in B:
# a+=i
#
#depthDict={}
#Len=0
#
#class ParentBoard(object):
# def __init__(self,board,n):
# self.boa... | true |
7e3d0fb3c0519da6d73702d96e48e09ae5326aa7 | udit52/project | /DataAnalysisProject/Graph.py | UTF-8 | 6,218 | 2.78125 | 3 | [] | no_license | import pandas as pd
import datetime
import math
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
from Validator import Validator
class Graph:
def __init__(self,dataFile,field_list,isDateTimeSelected,xmin,xmax,ymin,ymax,dates,percent,target):
v=Validator(dataFile... | true |
7dbfb594bae7de6b58e49204061b8eb8af1a5025 | otnansirk/flask-python | /app/repositories/User.py | UTF-8 | 334 | 2.578125 | 3 | [
"MIT"
] | permissive | from .Base import Base
from app.models.User import User as Model
class User(Base):
def insert(
self,
data: dict
)->Model:
user = Model(**data)
return user.save().reload()
def get_by_email(
self,
email: str
)->Model:
return Model.objects(email=ema... | true |