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 |
|---|---|---|---|---|---|---|---|---|---|---|
29b642f0f1295418b8856def170dda331b57ded1 | cireneuguilhermeteixeira/IC-2019.2-activities | /rubik-cube-solver/colors_enum.py | UTF-8 | 131 | 2.6875 | 3 | [] | no_license | from enum import Enum
class ColorsEnum(Enum):
WHITE = 0
YELLOW = 1
RED = 5
ORANGE = 4
GREEN = 3
BLUE = 2
| true |
e073a908a43fa91b247eaba8f829369e8fb2c7ab | usnistgov/valid8 | /valid8/actions/count.py | UTF-8 | 2,250 | 3.40625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"NIST-PD"
] | permissive | # Contents subject to LICENSE.txt at project root
import re
from ..exceptions import IncorrectFileCount, InsufficientFileCount, UnknownArgument
from ..file_utils import filepath_exists
def count(n, context):
"""
Action `count` checks that the context created by the filters
respects the cardinality ``n``... | true |
878da0a11b4b478012b1741566daa1a9237ca8b9 | svfarande/Python-Bootcamp | /PyBootCamp/OOP_Challenge.py | UTF-8 | 880 | 4.21875 | 4 | [] | no_license | class Account:
def __init__(self, owner, balance=0):
self.owner = owner
self.balance = balance
def deposit(self, amount):
if amount > 0:
self.balance = self.balance + amount
print(f"{amount} Money deposited. Now balance is : {self.balance}")
def withdraw(se... | true |
80f739ab8f271878506f2c67f222f5ee67e821e2 | sdharawatnet/Online-Social-Network-Analysis | /Recommendation Systems/a3.py | UTF-8 | 8,623 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 5 15:56:50 2017
@author: Swapnil
"""
# coding: utf-8
# # Assignment 3: Recommendation systems
#
# Here we'll implement a content-based recommendation algorithm.
# It will use the list of genres for a movie as the content.
# The data come from the MovieLens project: ht... | true |
69f186238e8ef4bf6293c8062b99ce6859dc04d4 | ParagDasAssam/Python-Small-Games | /find_your_spirit_animal.py | UTF-8 | 1,668 | 3.734375 | 4 | [] | no_license | import os,sys
import time
os.system("cls")
animals = {10:"Snale",20:"Ant",30:"Rat",40:"Snake",50:"Cat",60:"Panda",70:"Dog",80:"Wolf",90:"Lion",100:"Dragon","Error":"Something is wrong about you..!! :D"}
questions = ["Do you like to go for tracking or out door activities ?","Do you like fighting movies?","Do you lik... | true |
c5431abc4494067537b4b00554dde199de99852f | spedl/uw_python | /week07_assignment/echo_flask.py | UTF-8 | 894 | 3.0625 | 3 | [] | no_license | """
Minimal Flask + forms demo
Send HTML page that echoes message from HTTP request
To get started, point browser at echo_flask.html
"""
from flask import Flask, render_template, request
# form_page is now a template
# No need for message page
# Flask converts view function return string to HTML page
app = Flask(_... | true |
3053dea31afcb53dd9470cfbdb5f9f6276e96a7b | Silverkinzor/PythonCC | /PythonCC3-02.py | UTF-8 | 926 | 4.625 | 5 | [] | no_license | # 3-2. Greetings: Start with the list you used in Exercise 3-1, but instead of just
# printing each person’s name, print a message to them. The text of each message
# should be the same, but each message should be personalized with the
# person’s name.
# I'll also use a for loop because copy and pasting code is b... | true |
2bb5c18a1acf120ef5ee084f0b39999a70308695 | Hyunmo-OH/SMU_Team_project | /final/Analystics1.py | UTF-8 | 7,871 | 2.6875 | 3 | [] | no_license |
# 모듈 Import
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn import metrics
from sklearn.externals.six import String... | true |
6961fcc493299d0ad31a424a2f2949834b3c7d36 | coolba73/PythonLec01 | /CalCutRate2/CalCutRate2_01.py | UTF-8 | 1,030 | 2.6875 | 3 | [] | no_license | import json
import pprint
import pandas as pd
import numpy as np
source = json.loads(open('D:\FinInsightServices\PythonLec01\CalCutRate2\data.dat','r').read())
for k in source["InputData"].keys():
df = pd.DataFrame(source["InputData"][k]["result"])
df["key"] = 1
df = df[["key","ItemCode","ExcessReturn" ,"ExcessR... | true |
b79106986c53a5c6906c865b021c848acd5a1b68 | vmilkovic/uvod_u_programiranje | /predavanje9/moduli.py | UTF-8 | 254 | 3 | 3 | [
"MIT"
] | permissive | #funkcija programa
def Funkcija1():
#tijelo funkcije
return
def Funkcija2():
#tijelo funkcije
return
#glavna funkcija
def main():
Funkcija1()
Funkcija2()
print('izvrseno...')
return
if __name__ == "__main__":
main() | true |
58ae08ee91507f2f6a93b9ce1e8c59cb0c33f090 | catalina85/leetcode | /algorithms/python/_167_TwoSumII_InputArrayIsSorted/Solutions.py | UTF-8 | 528 | 3.515625 | 4 | [] | no_license | class Solution:
def twoSum(self, numbers, target):
left, right = 0, len(numbers) - 1
while (left < right):
if numbers[left] + numbers[right] == target:
return [left + 1, right + 1]
elif numbers[left] + numbers[right] > target:
right -= 1
... | true |
f48df5d11daaaa9990f76ce58c4adc130d10b5dd | eileenjang/algorithm-study | /src/dongjoo/week7/failurerate.py | UTF-8 | 1,992 | 3.265625 | 3 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/42889
from collections import Counter
def solution(N, stages):
# count how many people are in each level
levels = Counter(stages)
# failure rate hashtable
failure_rate = dict()
# number of total people in and above a certain levels, works as den... | true |
2c8d5aa11acfe44934328821738e010c5cc6fea1 | Tayor-Doofs/MyPythonRepo | /wordcheck.py | UTF-8 | 245 | 3.859375 | 4 | [] | no_license | word = input("Please enter base word :")
other_word = input("Please enter word to check :")
print(other_word, "was found : ", other_word in word)
if "Mr" in word:
print("Good day Sir")
elif "Mr" not in word:
print("Baba how far...!!") | true |
9c1160a1be2956b61511f5dd974251554ba61366 | Poplar/tm4cSerial | /savedata.py | UTF-8 | 4,511 | 2.6875 | 3 | [] | no_license | import sys, serial, argparse, threading, struct
#import numpy as np
from time import sleep
from collections import deque
startflag = False
stopflag = False
mode = 0
openspd = 0
closed = 0
def kbdinput():
global stopflag
global startflag
global mode
global closed
global openspd
... | true |
8df5341a018f7bcc0314095add4568b6145c9f08 | faraz176/India_Dataset | /Covid19_India_datasets-main/case_check.py | UTF-8 | 885 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from pathlib import Path
#Importing the file
location = "C:/Users/flyhi/OneDrive/Desktop/india/Covid19_India_datasets-main/combined.csv"
new = Path(location)
df = pd.read_csv(location)
#Dropping col's
df = df.drop(['Unnamed: 0', 'Unnamed: 0.1'], axis=1)
df['Time'] = pd.t... | true |
535a0e11437841a7236c211e81d0627e4dc2ce3e | gammapy/gammapy | /examples/tutorials/data/fermi_lat.py | UTF-8 | 14,598 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | """
Fermi-LAT with Gammapy
======================
Data inspection and preliminary analysis with Fermi-LAT data.
Introduction
------------
This tutorial will show you how to work with Fermi-LAT data with
Gammapy. As an example, we will look at the Galactic center region using
the high-energy dataset that was used for... | true |
b3865d7536b5964da1a589eea36da4019b3a0c2a | athenian-robotics/Deep-Space-Robot | /src/main/python/cv_utils/stream.py | UTF-8 | 1,348 | 2.984375 | 3 | [] | no_license | from threading import Event
from threading import Lock
import cv2
class SharedFrame(object):
def __init__(self):
self.__frame = None
self.__lock = Lock()
self.__completed = Event()
self.__frameAvaliable = Event()
def getFrame(self):
if self.completed: return None
... | true |
22c5dc91d24b421625131b5709137a7e1ad96b3b | paeby/masterThesis | /Analysis/Stability/10min:130bookings:5cars/1/helpers.py | UTF-8 | 1,759 | 2.625 | 3 | [] | no_license | import seaborn
import sys
import six
import datetime
import matplotlib.backends.backend_pdf
import numpy as np
import pandas as pd
import matplotlib.pyplot as pp
def convertColumns(data, cols, func):
newCols = data[cols].applymap(func)
data1 = data.drop(cols, axis=1)
return pd.merge(data1, newCols, left_in... | true |
eaf4791178c163dbce8fdb3c2879edcbb8308576 | mcxu/code-sandbox | /PythonSandbox/src/leetcode/lc328_odd_even_linked_list.py | UTF-8 | 2,147 | 3.78125 | 4 | [] | no_license | '''
LC328: https://leetcode.com/problems/odd-even-linked-list/
'''
import unittest
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
if not head or not head.next:
return he... | true |
60319a26ef4fa599abcb299f40001bcf75808e10 | DenzelLee/python2019 | /2019_07_selenium/20190719_天气预报.py | UTF-8 | 1,610 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env/python3
# -*- coding:utf-8 -*-
'''
Author:lihao
Date&Time:2019-07-19 and 23:15
FileName:
'''
'''
请到如下网址下载最新Chrome浏览器 的 web driver 驱动
https://chromedriver.storage.googleapis.com/index.html
pip 安装Selenium Web driver Python 客户端库
1. 访问天气查询网站(网址如下),查询江苏省天气
http://www.weather.com.cn/html/province/jiangsu.sht... | true |
46f009c1304b4ba1a78bc57b5d1db3a6e063e229 | chivalry/exercism-python | /users/pjhoberman/python/kindergarten-garden/kindergarten_garden.py | UTF-8 | 764 | 3.375 | 3 | [] | no_license | PLANT_MAP = {
"G": "Grass",
"C": "Clover",
"R": "Radishes",
"V": "Violets"
}
STUDENTS = ("Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry")
class Garden:
def __init__(self, diagram, students=STUDENTS):
self.diagram = diagram
... | true |
ffe87a650670ebe9574a543eabfc63db13d68dd8 | N0xem/DiverseStuff | /removeIslands.py | UTF-8 | 1,165 | 3 | 3 | [] | no_license | matrix = [
[1, 0, 0, 0, 0, 0],
[0, 1, 0, 1, 1, 1],
[0, 0, 1, 0, 1, 0],
[1, 1, 0, 0, 1, 0],
[1, 0, 1, 1, 0, 0],
[1, 0, 0, 0, 0, 1]
]
def superalgo(x, y, matrix):
matrix[x][y] = 2
for pos in {"x", "y"}:
for rng in {-1, 1}:
if pos == "x" and 0 <= x + rng < len(matrix):... | true |
01543427736d867a226466d236c7887efc26505f | BrendonPurchase2002-CS/Projects- | /Lab 2/test.py/test.py | UTF-8 | 44 | 3.1875 | 3 | [
"MIT"
] | permissive | num = input("enter a number: ")
print(num*4) | true |
8408616a585ba14e20a6455ba51e46141817faae | bibongbong/pythonDataScience | /src/courseraDataScienceWeek3.py | UTF-8 | 31,379 | 3.890625 | 4 | [] | no_license |
'''
对一维的Series和二维的DataFrame有多种不同的访问和查询方式
比如,使用iloc和loc属性进行行查询,或者使用方括号进行列查询,以及布尔屏蔽
布尔屏蔽非常强大,它允许我们使用广播来确定我们在分析中应该保留哪些数据。比如week2的第八题
Week3学习内容
1. Groupby和Apply来减少和处理数据
2. 如何将多个文件的数据集合在一起
3. Pandas中对于传统统计分析和机器学习的功能
'''
'''
---------------- 合并数据集 --------------------
我们只需要将带有新列名称的方括号运算符,只要索引共用,数据就被添加... | true |
7b6b1d1c4c0961c8db4f7ee795c2919b0aecd9a8 | windard/leeeeee | /82.remove-duplicates-from-sorted-list-ii.py | UTF-8 | 3,715 | 3.46875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
#
# @lc app=leetcode id=82 lang=python
#
# [82] Remove Duplicates from Sorted List II
#
# https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/
#
# algorithms
# Medium (32.21%)
# Likes: 957
# Dislikes: 83
# Total Accepted: 194.4K
# Total Submissions: 575.4K
# Testcase Exa... | true |
d619f5f739a0ebd2388be661c0888be146ccc861 | birdwatcheryebo/ndl-dice-roller | /dice_roller.py | UTF-8 | 2,940 | 3.65625 | 4 | [] | no_license | import random
# allows use of randint()
def getRolls(n=1,d=20,b=0,s='+'):
rolls = []
# initialize list of rolls
for i in range(n):
rolls.append(random.randint(1,d))
# now have a list of Nd(D) rolls
rollsStr = ""
# initialize string of rolls
for i in range(len(rolls)-1):
r... | true |
fa3337bcda2d8758514b07f1acd2a13716bb3d73 | arctikphox/ProBro | /MathHomework.py | UTF-8 | 245 | 3.484375 | 3 | [] | no_license | print("MathHomework.py")
problem = input("Enter a math cool problem, or 'q' quit:")
while (problem != "q"):
print("The answer to ", problem, "is:", eval(problem) )
problem = input("Enter another math problem, or 'q' to quit: ")
#1'q' to quit
| true |
94f51db6cfb310f6114cd8bb62871a81e49eecca | zhaohongqiangsoliva/biotools | /mx_tools/ArchaicPatternCount.py | UTF-8 | 1,808 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
'''
Count the number of pattern of ABBA and BABA.
@Author: wavefancy@gmail.com, Wallace Wang.
Usage:
ArchaicPatternCount.py -p pattern
ArchaicPatternCount.py -h | --help | --version | -f | --format
Notes:
1. Read data from stdin, and output to stdout.
... | true |
c656e54bb589668b3b9ddb4cadd2735195e9329f | feliperobledo/manatee_escape | /src/utils/colors.py | UTF-8 | 725 | 3.25 | 3 | [] | no_license | class Color:
def __init__(self, r=0, g=0, b=0, a=0):
self.r = r
self.g = g
self.b = b
self.a = a
@property
def rgb(self):
return (self.r, self.g, self.b)
@property
def rgba(self):
return (self.r, self.g, self.b, self.a)
def __str__(self):
... | true |
3aa827764ab44490d8879ff4ac1e852c7f4538fa | tzikis/aspanner-demo-lamp | /sample-test-script.py | UTF-8 | 10,593 | 2.515625 | 3 | [] | no_license | import sys
import time
import Spanner
from Testboard import Testboard
import http.client, urllib.parse
import json
from random import randint
testboard = Testboard("Testboard1")
particle_token = "b4992ee32f43c39c8ea4fa0a178672c72f5dead8"
device_id = "370053000351353530373132"
raspberry_base_url = "bdf89d03d3e0cf7d... | true |
02c688881fbb512377f0a6b681691fe635b6c70d | yzhhome/QA | /elmo_main.py | UTF-8 | 2,004 | 2.984375 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import jieba
from elmoformanylangs import Embedder
df = pd.read_csv('./data/qa_data.csv')
questions = df['question'].values
answers = df['answer'].values
elmo_model_path = './elmo/zhs.model'
elmo_model = Embedder(elmo_model_path)
def elmo2vec(sentence):
'''
output_layer... | true |
1dd004b7a624e0d0759d34e34906b0a7e5c82710 | take9999/knock100 | /dai4syou/No38-39.py | UTF-8 | 1,121 | 2.671875 | 3 | [] | no_license | import MeCab
from dai4syou import No30
import collections
from matplotlib import pyplot as plt
from matplotlib.font_manager import FontProperties
fp = FontProperties(fname='/System/Library/Fonts/ヒラギノ角ゴシック W2.ttc')
m = No30.mapping_MeCab("neko.txt.mecab")
nouns = []
noun = []
c = collections.Counter()
for morphemes i... | true |
ea105769657cbc7a9dd3e60a3d5c49ae2cc2927d | blldd/CodeExercise | /LeetCode_b/2019offer/pdd/12.py | UTF-8 | 1,093 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Time : 2019/7/28 3:01 PM
@Author : ddlee
@File : 1.py
"""
import sys
def process1(N, M):
if N < 1:
return 0
ans = 0
return 4 * pow(3, N - 1)
def process2(N, M, W, C):
# print(N, M, W, C)
return
if __name__ == "__main__":
line1 = sys.stdin.readl... | true |
99f1fbb0dee285e53c53e8e1d7450aea259d915e | HeartingU/PythonEx | /pyEx/15/package.py | UTF-8 | 2,163 | 4.21875 | 4 | [] | no_license | '''
封装
将内容隐藏起来,对外不对内
在类内定义的属性加__开头(定义封装)
在外部无法进行封装
'''
class Foo:
__x = 11
y = 22
def __init__(self, name, age):
self.name = name
self.age = age
def func(self):
print('func')
def get_info(self):
print()
# 在外面无法访问
# print(Foo.... | true |
9995f464d5db32084e7117487a744cb3ed8b9e37 | gadgetlabs/reinforcementlearningrobot | /messages/Message.py | UTF-8 | 727 | 3.125 | 3 | [
"MIT"
] | permissive | class Message:
def __init__(self, subject=None, predicate=None, obj=None):
# "The sky has the color blue", consist of a subject ("the sky"), a predicate ("has the color"), and an object ("blue")
self.subject = subject
self.predicate = predicate
self.obj = obj
@property
def... | true |
0391bc6cca685565cd77d534ab0e135154d1fc90 | davidkolden/UiO | /INF4490/Assignment1/INF4490 Assignment1 David kolden/exhaustive.py | UTF-8 | 2,040 | 3.296875 | 3 | [] | no_license | import csv
import sys
import itertools
import datetime
import matplotlib.pyplot as plt
def calcuate_total_distance(seg, table):
total = 0
for i, val in enumerate(seg[:(len(seg) - 1)]):
total += float(table[val][seg[i + 1]])
total += float(table[seg[len(seg) - 1]][seg[0]])
return total
def exha... | true |
9bc591764e17e9fdd8b322bb9937cbdce1eaa33d | duochen/Python-Beginner | /Python_Crash_Course_2e_Solutions/ch02/FavoriateNumber.py | UTF-8 | 76 | 3.328125 | 3 | [] | no_license | fav_num = 42
msg = "My favorite number is " + str(fav_num) + "."
print(msg) | true |
967d0726d4080d8437fd49522425ed910e308bf2 | MokriyYuriy/datapot | /datapot/transformer/category_transformer.py | UTF-8 | 3,354 | 2.828125 | 3 | [] | no_license | import collections
from sklearn.decomposition import TruncatedSVD
from sklearn.preprocessing import OneHotEncoder
from .base_transformer import BaseTransformer
# TODO: change constant's name
CATEGORICAL_FEATURES_MAX_NUMBER = 100
SVD_COMPONENTS = 10
REPEATS_RATE_TO_CHOOSE_THRESHOLD = 0.8
CONFIDENT = 1
NONCONFIDENT = ... | true |
5f863d46f60422ba0626ed64570ec2b47564d855 | hi0t/Outtalent | /Leetcode/517. Super Washing Machines/solution1.py | UTF-8 | 332 | 2.828125 | 3 | [
"MIT"
] | permissive | class Solution:
def findMinMoves(self, machines: List[int]) -> int:
if sum(machines) % len(machines): return -1
avg = sum(machines) / len(machines)
result = total = 0
for m in machines:
total += m - avg
result = max(result, abs(total), m - avg)
return ... | true |
cd1512ada472480b7566b305b29bdd2ffa1f8834 | 2swap/AbStrat | /steadystatec4.py | UTF-8 | 14,046 | 2.640625 | 3 | [] | no_license | from pprint import pprint
import copy, math
import time, random
known_steadystates = [
[
list(" - "),
list(" 2 "),
list(" 1 "),
list(" 2 "),
list(" 11 =-"),
list(" 21 2+")
],
[
list(" # "),
list(" 1 "),
list(" 1 ++"),
list(" 2 =="),
... | true |
86015fff23deaa00384cf59754cfc98ca39cf49e | RaviRockz/PythonDeepDive | /1_Functional/1_QuickRefresher/4_identifier_names.py | UTF-8 | 1,504 | 2.75 | 3 | [] | no_license | """"""
'''Case-Sensitive'''
'''
--> my_var and my_Var are different
--> ham and Ham are different
'''
'''Rules'''
'''
--> Starts with underscore (_) or letters (a-z A-Z)
--> Followed by any number of underscores (_), letters (a-z A-Z) or digits (0-9)
--> Cannot be reserved words
None Tru... | true |
7170b36dcd1f5ca21474d51986ab0cb78e4124ee | jairsan/Speech_Translation_Segmenter | /segmenter/vocab.py | UTF-8 | 2,264 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | import logging
logger = logging.getLogger(__name__)
class VocabDictionary:
def __init__(self, unk="<unk>", pad="<pad>"):
self.dictionary = {}
self.tokens = []
self.unk_symbol = unk
self.pad_symbol = pad
self.unk_index = self.add_symbol(self.unk_symbol)
self.pad_ind... | true |
49fc63b031e799f4f307d86c463f98b0f6e28747 | Jude-A/France-IOI | /Lvl-2/02-Découverte des tableaux/01-Préparation de l'onguent.py | UTF-8 | 128 | 2.953125 | 3 | [] | no_license | numIngrédients=int(input())
listeIngrédients=[500,180,650,25,666,42,421,1,370,211]
print(listeIngrédients[numIngrédients])
| true |
b3762382d1af4ec0e98d220b4119d8448ae2441c | j1nn33/study | /python/CODEWARS/6kyu/Replace_With_Alphabet_Position.py | UTF-8 | 1,419 | 4.34375 | 4 | [] | no_license | # codewars
# 6kyu
# Replace With Alphabet Position
"""
In this kata you are required to, given a string, replace every letter with its position in the alphabet.
If anything in the text isn't a letter, ignore it and don't return it.
"a" = 1, "b" = 2, etc.
Example
alphabet_position("The sunset sets at twelve o' clock... | true |
626bd5489d56ec7ec11698c33a93f24aa31bdc48 | suheda-nura-kahraman/VSCode-Ecodation-PC-1 | /05_fonksiyonlar/0515_lab_pratikleri.py | UTF-8 | 2,566 | 4.34375 | 4 | [] | no_license | # region ornek_1
"""
. sonuc() isimli fonk. olacak
. sonuc() içinde s1, s2 değerleri alınacak
. koşula göre değer return edilecek
. s1, s2 den büyük ise çıkarma, küçük ise toplama, eşit ise de eşitlik geriye dönecek
def sonuc():
s1 = int(input("s1: "))
s2 = int(input("s2: "))
if s1>s2:
return s1-s2... | true |
3899782de85f9c3978e1904c070094490ea112ff | ahmadmowalad/python | /function.py | UTF-8 | 163 | 3.28125 | 3 | [] | no_license | def addtion(num1,num2):
print(int(num1)+ int(num2))
n1=input("please inter first number : ")
n2=input("please inter seconed number : ")
addtion(n1,n2)
| true |
37a8f296c8796036fbf73575a9ff7de3ef8fa723 | sbwrrn/vbpy | /src/ext_src/dist2.py | UTF-8 | 571 | 2.625 | 3 | [] | no_license | import numpy as np
import pdb
def dist2(x, c):
if len(x.shape) == 1:
ndata = len(x)
dimx = 1
else:
ndata, dimx = x.shape()
if len(c.shape) == 1:
ncentres = len(c)
dimc = 1
else:
ncentres, dimc = c.shape()
if dimx != dimc:
print('error')
... | true |
f91f948c6c9e4af8dd4dd033eb93b35318fabff4 | ifd3f/5026-Discord | /src/swear_finder.py | UTF-8 | 3,643 | 2.765625 | 3 | [] | no_license | import logging
import os
import random
import discord
import psycopg2 as pg
from discord.ext import commands
from discord.ext.commands import Context
SWEAR_TABLE = 'swears'
SWEAR_WORDS = 'fuck shit cunt asshole fuk shite'.split()
MESSAGES = [
'hey hey be nice {mention}',
'no swears {mention}',
'censor yo... | true |
2326520f4fe2ff915083c19900f53f81ccc5847d | amingolnari/Deep-Learning-Course | /Introduction/ReadDataXLSX.py | UTF-8 | 1,146 | 3.296875 | 3 | [
"MIT"
] | permissive | """
github : https://github.com/amingolnari/Deep-Learning-Course
Author : Amin Golnari
Pandas Version : 0.23.4
Date : 5/12/2018
Load Data From Excel File with Pandas
Code 0
"""
import pandas
import numpy as np
def Readxlsx(Fname, ShName):
# Read Excel File
Excel = pandas.read_excel(Fname, sheet_name = ShName)
ret... | true |
243661b85511e004be26b27deac83296111d813e | jmiw/UCSC_Python | /NaiyunWang_Homework3.py | UTF-8 | 1,138 | 4.03125 | 4 | [] | no_license | #calculatePay
def calculatePay(rate, workHours):
if workHours <= 40 :
totalPay = workHours * rate
elif workHours > 40 and workHours <= 60:
extraHours = workHours - 40
regularPay = 40 * rate
extraPay = extraHours * (rate * 1.50)
totalPay = regularPay + extraPay
else:... | true |
f8e43bd8c14c55d602d237210eae0ac7d0569a93 | liushiwen555/unified_management_platform_backend | /utils/core/renders.py | UTF-8 | 4,383 | 2.640625 | 3 | [] | no_license | from typing import Mapping, List
from tempfile import NamedTemporaryFile
from django.conf import settings
from rest_framework.renderers import BaseRenderer
from openpyxl import Workbook
from docxtpl import DocxTemplate
class XLSXRenderer(BaseRenderer):
media_type = 'application/vnd.openxmlformats-offic... | true |
338ef2566e52aa25b7c1208f39678cec373c4f19 | wayne83/Leetcode-Python | /110. Balanced Binary Tree.py | UTF-8 | 755 | 3.515625 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isBalanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
if root == No... | true |
60b1c71c847133004742e584525b21af47182696 | RmnSnk/testpycharm | /Chapitre12/5/mesmodules.py | UTF-8 | 1,198 | 4.3125 | 4 | [] | no_license | # coding:utf-8
import math
"""
Bibliothèque de class et fonction pour l'exercice
"""
class Cercle():
""""
Cette class permet d'intancier des cercles par leur rayon
"""
def __init__(self, rayon):
self.rayon = rayon
def surface(self):
"""
:return: La surface de l'o... | true |
060e3a1e5cce7b158c67a20d68c7bd3a39b68133 | TheMiloAnderson/data-structures-and-algorithms | /Py401/radix_sort/tests/radix_sort_test.py | UTF-8 | 800 | 3.3125 | 3 | [] | no_license | from radix_sort.radix_sort import radix_sort
def test_random_values():
arr = [4, 98, 156, 8, 1, 98, 156, 9844, 91, 7, 5, 14, 98, 4, 3, 7, 65]
radix_sort(arr)
assert arr == [1, 3, 4, 4, 5, 7, 7, 8, 14, 65, 91, 98, 98, 98, 156, 156, 9844]
def test_already_sorted():
arr = [1, 3, 4, 4, 5, 7, 7, 8, 14, 6... | true |
b147737e4f36ae848d498cd51e3e4ccb1b34b8fc | XelltheThird/a-PyTorch-Tutorial-to-Image-Captioning | /run_experiment.py | UTF-8 | 2,290 | 2.546875 | 3 | [] | no_license | from train import main
import os
import matplotlib.pyplot as plt
import numpy as np
import argparse
from multiCaptionGenerator import genVis
parser = argparse.ArgumentParser(description='NN - Flo and Ant')
parser.add_argument('--folder', '-f', default="Experiments", help='path to folder')
parser.add_argument('--runs'... | true |
09d2e28663e5c5eb0609aa5a1f38318de74590b8 | pjboy715/heima5 | /04.Web服务器/01.TCP客户端程序开发.py | UTF-8 | 878 | 3.21875 | 3 | [] | no_license | import socket
if __name__ == '__main__':
# 1.创建tcp客户端套接字
# AF_INET:ipv4地址类型
# SOCK_STREAM:tcp传输协议
tcp_client_sockt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 2.和服务段套接字建立连接
tcp_client_sockt.connect(('192.168.1.218', 9090))
# 3.发送数据到服务端
send_content = '你好,我是客户端小白!!'
# 对字符... | true |
9885d05f23123734d2d3a17f6cc72abe7f8aff70 | nburak/Software-for-Crime-Analysis | /main.py | UTF-8 | 5,563 | 2.578125 | 3 | [] | no_license | import pandas as pd
from flask import Flask, render_template, request
import json
def find_by_group(group,data):
group = data[data["Group"] == group]
return group
def find_by_street(street,data):
street = data[data["Street"] == street]
return street
def find_by_day(day,data):
day = data[data["Day... | true |
77a7cc141b868fd01276ffaf63f8f69f67189702 | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc083/B/1890181.py | UTF-8 | 487 | 2.890625 | 3 | [] | no_license | def solve(n, tbl):
ans = 0
for i, row_i in enumerate(tbl):
for j in range(i + 1, n):
row_j = tbl[j]
ij = row_i[j]
mind = min((ik + kj for ik, kj in zip(row_i, row_j) if ik and kj), default=float('inf'))
if ij > mind:
return -1
... | true |
8cd18bafcb68d09075dc0b5501cf55a7327462d1 | Rachine/DataGame | /convnetkaggle.py | UTF-8 | 7,909 | 2.53125 | 3 | [] | no_license | """
@author: Raihan Masud in collaboration with Md Faijul Amin
Borrowing from Elena Cuoco's data loading... &
ConvNet Model from Denial Nouri's kfkd and Tim Hochberg's script
Todos for better accuracy:
1. Filter data
2. Use past history/sliding window data
3. Do not use future data
4. Down sample
... | true |
4428a25280feed82de4df3c5bac60a40d054e165 | ValeriiSielikhov/Stepik_python | /2_1.6_2.py | UTF-8 | 595 | 3.765625 | 4 | [] | no_license | class ExtendedStack(list):
def sum(self):
if len(self) >1:
self.append(self.pop() + self.pop())
return self
def sub(self):
if len(self) > 1:
x = self.pop()
y = self.pop()
self.append(x - y)
return self
def mul(self):
... | true |
4101e8d4f0026f04ba337a04e74f8f9527f65ed0 | TomDrnd/CNN_-_Autoencoder_on_MNIST | /Durand_Tom_P2_codes/project2b_3.py | UTF-8 | 10,274 | 2.546875 | 3 | [] | no_license | from load import mnist
import numpy as np
import pickle
import pylab
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
# 5-layer feedforward network for classification with DAE initialization for hidden layers
#with sparsity constraints and momentum
corrupt... | true |
520a1b764ceeba0ebbf10971841122f2d49eaf97 | tomasbm07/Projeto-ATD | /Main/funcoes_usadas.py | UTF-8 | 18,489 | 3.078125 | 3 | [] | no_license | import numpy as np
from sympy import *
import matplotlib.pyplot as plt
import pandas as pd
import math
from scipy import signal
import scipy as sy
from numpy.fft import fft, fftshift
import seaborn as sns
import matplotlib
from scipy.stats import entropy
dark_background = False
if dark_background:
sns.set_palette... | true |
6c6813a8ead36f16e00036110a0993bc31d0cc2e | Jatin345Anand/Python | /AdvancePython/01-OOPS/08-MultilevelInheritance.py | UTF-8 | 1,207 | 3.640625 | 4 | [] | no_license | # Multilevel Inheritance
class Car:
def __init__(self):
self.speed = 350
self.tyre = 4
self.engine = '2000cc'
self.color = 'red'
self.gearSystem = 'automatic'
def showFeatures(self):
print("Car Details :",self.speed,self.tyre,self.engine,self.color,se... | true |
a7f0f23c7d5ef7eb34a144abfd4411ba3613568e | IshanManchanda/Keepyr | /src/db.py | UTF-8 | 3,477 | 2.765625 | 3 | [
"MIT"
] | permissive | import mysql.connector
import context
from encryptor import decrypt_password, encrypt_password, hash_password
def init_db():
try:
context.db = mysql.connector.connect(
host='localhost',
user='root',
passwd='37ujTpLAp@!WoyL&',
database='PasswordManager'
)
except mysql.connector.errors.ProgrammingErr... | true |
10132529476ba5812b2b047212fdb8029de5d6a8 | anassBelcaid/pydps | /pydps/datasets/neuroblastoma2.py | UTF-8 | 5,620 | 2.96875 | 3 | [] | no_license |
"""
Special Class to perform a classification on the
neuroblastoma segmentation problem.
"Learning smooth models of copy number profiles using break points annotations
Hocking et al (2013)
"
The problem is different to the general framework as the annotation
only contain the existence or absence, not the position ... | true |
777ebb7ac2ba1ec79b67ddbbf0f6a9ff79a9705a | shkhaider2015/artificial_intelligence | /Task1/chapter19.py | UTF-8 | 147 | 2.953125 | 3 | [] | no_license | players = ["Messi", "Suarez", "Coutinho", "Dembele", "Pique"]
print(players)
defenders = players.pop(4)
print("Attackers are :")
print(players) | true |
c33b1e77074bd3052f612a718ae6b550b0f8c39d | stephenblakesanders/cst-305 | /CST-305/taylor1.py | UTF-8 | 2,518 | 4.03125 | 4 | [] | no_license | ##############################################################
# Project 6: Numeric Computations with Taylor Polynomials #
# #
# Logan Hoots, Stephen Sanders #
# CST - 305 #
... | true |
340d94af9f12ef1b4e007872396bab2f9364f4c0 | christian-hall/python-MAX | /ch08/ch08/main.py | UTF-8 | 2,632 | 4.65625 | 5 | [] | no_license | # chapter 8 - lists and dictionaries
# processing strings
name = 'Christian Neal Hall'
print(name)
# print name length
print(len(name))
# get portions of the name by index and slicing
print('first char:', name[0])
# get first name by where the first space is
idx_1 = name.index(' ')
first_name = name[0:idx_1]
print(fir... | true |
227a691ed1afd73da56d49cd9eeafbc9a2b1a490 | samantharothman/Intro-to-MRI | /Python MRI/T1Invpt2.py | UTF-8 | 971 | 3.65625 | 4 | [] | no_license | """
This program plots the inversion
recovery absolute magnitude after a
90 degree pulse.
"""
import numpy as np
import matplotlib.pyplot as plt
#constants
Mo = 1
TR = np.arange(0, 2000)
t = np.array([10, 50, 100, 200, 500, 1000, 2000])
#set up graph
plt.xlim(0,2001)
plt.title('Magnitude')
plt.xlabel('TR') #check ... | true |
5ddaa1278677dfb45d642e051f9d2d45c60e8bd4 | dews/gameRobot | /matchImage.py | UTF-8 | 1,461 | 2.921875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
import numpy as np
import cv2
def matchImage(fileName, type, maxVal=130000000):
# load the puzzle and waldo images
puzzle = cv2.imread(fileName)
waldo = cv2.imread(type)
(waldoHeight, waldoWidth) = waldo.shape[:2]
# find the waldo in the puzzle
result = cv2.matchTemplate... | true |
dfca2644a499ed4488636ec664bc131af38510b3 | kafitimi/lab02-aigulmal | /Малгараева Айгуль/gauss.py | UTF-8 | 1,516 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from PIL import Image
from math import pi, log, exp
import numpy as np
import sys
def main(filename, r):
# должна обрабатывать файл filename гауссовым размытием в квадрате [-r, +r] x [-r, +r]
# и записывать результат в <filename>.gaussblurred.png
img = Image.open(filename... | true |
0dc547298ceb94b31ce51c2d463df025ee124d07 | rsirazhdinov/MTS_dropdown_menu | /dropdown/models.py | UTF-8 | 1,700 | 2.984375 | 3 | [] | no_license | """
models.py
- Data classes for the dropdown application
"""
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.utils import cached_property
db = SQLAlchemy()
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer... | true |
93c5dbc1105709c2ed7b7a410c188e8bc89c93ed | jrctrabuco/PiCamera-GUI | /picamera-gui/Exceptions_ModuleCamera.py | UTF-8 | 403 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Ce fichier contient deux classes d'exceptions qui héritent de "Exception"
# Exception de Tkinter
class TkinterError(Exception):
def __init__(self, mismatch):
Exception.__init__(self, mismatch)
# Exception de la PiCamera
class PiCameraError(Excepti... | true |
e48b9cfb0cf72acb61fad5340a75ba60483c6a83 | Python-Repository-Hub/image_processing_with_python | /06_enhancing/enhance_color.py | UTF-8 | 421 | 3.109375 | 3 | [] | no_license | # enhance_color.py
from PIL import Image
from PIL import ImageEnhance
def enhance_color(image_path, enhance_factor, output_path):
image = Image.open(image_path)
enhancer = ImageEnhance.Color(image)
new_image = enhancer.enhance(enhance_factor)
new_image.save(output_path)
if __name__ == "__main__":
... | true |
36673ce9b4f91de8df1ae7c8d2ea488b0b8b89ea | tomyahu/PicartoAlertBoxApp | /view/configuration_views/components/canvas_objects/tkinter_canvas_image.py | UTF-8 | 961 | 3.078125 | 3 | [] | no_license | import Tkinter as Tk
import tkFont
from abstract_tkinter_canvas_object import AbstractTkinterCanvasObject
from model.components.image import Image
class TkinterCanvasImage(AbstractTkinterCanvasObject):
def __init__(self, canvas, an_image_path):
"""
Creates a new instance of TkinterCanvasImage
... | true |
f90761edb317c6763aff2aa113495425c8529809 | nex3z/tensorflow-exercise | /examples/captcha/app.py | UTF-8 | 1,814 | 2.703125 | 3 | [] | no_license | import base64
from io import BytesIO
import numpy as np
import tensorflow as tf
from PIL import Image
from flask import Flask, request, jsonify
from keras.models import load_model
NUMBER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
MODEL_FILE = './model/captcha_adam_binary_crossentropy_bs_100_epochs_10.h5'
... | true |
b5ad50a385d1e0d162ed853be73ed0b2e70db275 | denotepython/pythonbook | /learn python without code knowledge-- Craig Richardson/code 标准答案/adventure1/praise.py | UTF-8 | 437 | 4.15625 | 4 | [] | no_license | again = "yes"
while again == "yes":
praiseType = raw_input("Select a type of praise \n a: personality \n b: appearance \n c: intelligence")
if praiseType == "a":
print "You are an interesting person"
elif praiseType == "b":
print "You are smart"
elif praiseType == "c":
print "You... | true |
386413ec505855d3ed954946b7adb544731b89b9 | ucbds-infra/otter-grader | /otter/execute/checker.py | UTF-8 | 3,260 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | """Class for running tests from test files"""
import inspect
from ..test_files import create_test_file
class Checker:
"""
A class for running and optionally tracking checks against test files.
This class is not meant to be instantiated and is composed solely of class methods.
"""
_track_result... | true |
9b6d8ef4b15ff703fe91a2309d92907918657648 | eslamasaleh/Professional-Data-Analysis-Bike-Share | /bikeshare.py | UTF-8 | 8,218 | 3.875 | 4 | [] | no_license | import time
import pandas as pd
import numpy as np
CITY_DATA = { 'Chicago': 'chicago.csv',
'New York City': 'new_york_city.csv',
'Washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns:
(str) city - name ... | true |
9bdeae532cf1154d0b61c05f0f8d4be0997bc86f | gfpaiva/wishlist-api | /app/src/domains/wishlists/repository/__init__.py | UTF-8 | 2,798 | 2.578125 | 3 | [] | no_license | from src.domains.wishlists.repository.wishlists_repository import (
WishlistsRepository
)
from src.domains.wishlists.repository.wishlists_products_repository import (
WishlistsProductsRepository
)
from src.domains.wishlists.model.wishlist import Wishlist
from src.domains.wishlists.model.wishlist_product import... | true |
16d4644be09e577e661b4de9da0d7c665c1050cb | Pyae-Sone-Nyo-Hmine/Run-length-encoder-decoder | /run-length encoder.py | UTF-8 | 710 | 2.796875 | 3 | [] | no_license | def run_length_encoder(in_string):
i = 0
l = []
in_string+= "/"*10
for keys in range(len(in_string)-10):
if in_string[i] != in_string[i+1] and i < len(in_string)-10 and in_string[i]!= "/":
l.append(in_string[i])
i += 1
if in_string[i] == in_string[i+1] and i < le... | true |
92f019f2abac3e32237443f53108a84e456e0778 | Raparker88/Critters-and-Croquettes | /animals/animal.py | UTF-8 | 828 | 3.734375 | 4 | [] | no_license | # import the python datetime module to help us create a timestamp
from datetime import date
class Animal:
def __init__(self, name, species, food, chip_num):
self.name = name
self.species = species
self.food = food
try:
self.__chip_num = int(chip_num)
except Valu... | true |
2727a5b84cf7388d9a27ed54af27b93661961777 | SergioRodas/Curso-Python | /parte09/ex9.09_patron_letra_Z.py | UTF-8 | 249 | 3.953125 | 4 | [] | no_license | # Ejercicio 9.9: Construir un patrón con asteriscos que represente la letra Z.
# *******
# *
# *
# *
# *
# *
# *******
for i in range(7):
if i == 0 or i == 6:
print('*' * 7)
else:
print(' ' * (6 - i) + '*') | true |
9503f806fb5edbf6d0eb6bb49272f9a196af148f | seyfullah/stockprediction | /StockDatasetRunner.py | UTF-8 | 748 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function, division
# Ignore warnings
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from StockDataset import StockDataset
warnings.filterwarnings("ignore")
plt.ion() # interactive mode
stock_frame = pd.read_csv('AAPL_data.csv')
n = 1
date = st... | true |
9b0ac0f14586fce73be7c58d8e42817cb3b182cc | posguy99/comp660-fall2020 | /src/M4_lambda.py | UTF-8 | 124 | 3.53125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# creates a function add_one() from the lambda x: x + 1
add_one = lambda x: x + 1
print(add_one(2))
| true |
82db04e62dd1890f9af3cb29776bed951bc7ee69 | Amit-Git1690/APICode | /SDET/MultiBrowser/ReadExcelFile.py | UTF-8 | 395 | 3.1875 | 3 | [] | no_license | '''
Created on 06-Aug-2019
@author: Amitava
'''
import openpyxl
path="E:\PythonExcelData.xlsx"
workbook=openpyxl.load_workbook(path)
sheet=workbook.active
# workbook.get_sheet_by_name(sheet)
rows=sheet.max_row
cols=sheet.max_column
print(rows)
print(cols)
for r in range(1,rows+1):
for c in range(1,cols+1):... | true |
0d868563622637ba2cfc6c9b5a8838e6312e24ba | T-Nawrocki/Udemy-Python | /Notes11-ModulesAndFunctions/08-tkinter.py | UTF-8 | 861 | 3.265625 | 3 | [] | no_license | # tkinter provides access to the tk widget toolkit
# this is a toolkit which lets you make gui programs
#
# the toolkit was designed for a language called TCL
# this module essentially takes that and interprets between python and TCL,
# but we don't need to worry about that directly
# what it does mean is that the docu... | true |
5883f03cfc6969db52d1da15fac87a4e341b8398 | newsocialsandra/guessthenumber | /numberguess.py | UTF-8 | 606 | 4.28125 | 4 | [] | no_license | from random import randint
guessesTaken = 0
number = (randint(0,100))
print "I'm thinking of a number between 0 and 100"
while guessesTaken < 6:
print "Take a guess!"
guess = raw_input()
guess = int(guess)
guessesTaken +=1
if guess < number:
print "Your guess is too low."
elif guess > number:
print "Yo... | true |
a2da191840ed9e63882bf75fb65ca816062ffda1 | DojoFatecSP/Dojos | /2019/20190920 - media1 - python/1064.py | UTF-8 | 260 | 3.765625 | 4 | [] | no_license |
somaTotal = 0
contadorPositivos = 0
for i in range(6):
n = float(input())
if n > 0:
contadorPositivos += 1
somaTotal += n
print("{} valores positivos".format(contadorPositivos))
print("{:.1f}".format(somaTotal/contadorPositivos))
| true |
332d762da0790c71a37fbe69c31ddaaae680b72e | universidad-del-istmo/Blockchains-2020 | /ejercicios/RSA/entregas/Mateo/sign.py | UTF-8 | 991 | 3.015625 | 3 | [] | no_license | import hashlib
def file_hash(ffile):
#crear hash del documento
BLOCK_SIZE = 65536
hhash = hashlib.sha256()
with open(ffile, 'rb') as f:
fb = f.read(BLOCK_SIZE)
while len(fb) > 0:
hhash.update(fb)
fb = f.read(BLOCK_SIZE)
print ('hash:' ,hhash.hexdigest(... | true |
0763fd69b6ff8430f3b7a6f3f00ca1c30cc98b9e | AntoniaSandoval/NitroFuzzy | /SimpleTriangularImpar.py | UTF-8 | 22,432 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 21 14:46:09 2018
@author: Usuario
modulo fuzzy2
Advantages of FLSs
- Mathematical concepts within fuzzy reasoning are very simple
- You can modify a FLS by just adding or deleting rules due to flexibility of fuzzy logic
- Fuzzy logic Systems can take imprecise, distorted... | true |
58d19aaf564d120ebfcb8ac1d7a609ae03a25c66 | kunal951990/InitialSource | /Drawing_Functions.py | UTF-8 | 1,997 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 21:24:12 2018
@author: kisku
"""
import numpy as np
import cv2
#Create a black image
img = np.zeros((512,512,3), np.uint8)
"""To draw a line, you need to pass starting and ending coordinates of line.
We will create a black image and draw a blue line... | true |
564a84caaf3e6eef3195d9abc66902d1e9cd8a08 | SamantazFox/AoC-2020 | /day_19/solve.py | UTF-8 | 2,935 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
import os, sys
import re, copy
import math
lines = []
with open("input.txt", 'r') as fd:
for line in fd:
tmp = line.strip("\r\n")
lines.append( tmp )
rules={}
p2 = False
strings = []
for l in lines:
if l == '':
p2 = True
continue
if p2:
strings.append(l)
else:
x = l.split('... | true |
e45f77f8fbcb19236cfeaa8fcbd69246cd5e7b5e | dbbudd/Python-Experiments | /AI/BOOK - Problem Solving with Algorithms and Data Structures - EXAMPLES/Source/chap5/listing_5_26.py | UTF-8 | 552 | 3.171875 | 3 | [] | no_license | def findSuccessor(self):
succ = None
if self.rightChild:
succ = self.rightChild.findMin()
else:
if self.parent.leftChild == self:
succ = self.parent
else:
self.parent.rightChild = None
succ = self.parent.find... | true |
a111fa7ae962628fe44ddf45c9fa3298fc3ed9dc | SnappierSoap318/Component-Price-Scraper | /mdcomputer.py | UTF-8 | 1,275 | 2.640625 | 3 | [] | no_license | from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
def mdComputers(component):
searchUrl = 'https://mdcomputers.in/index.php?category_id=0&search='
final_list = {}
for i in range(len(component)):
if component[i] == ' ':
searchUrl += '+'
else:
se... | true |
8c82267bd024db9c9078ca4aa2c9fd8a01a47d8e | cyrustabatab/CodingBat | /rabin_karp.py | UTF-8 | 797 | 3.515625 | 4 | [] | no_license |
def rabin_karp(s1,s2):
assert len(s1) >= len(s2)
current_hash = target_hash = 0
x = 53
same = True
for i in range(len(s2)):
if same and s1[i] != s2[i]:
same = False
current_hash = current_hash * x + ord(s1[i])
target_hash = target_hash * x + ord(s2[i])
... | true |
1c96686d30b8aa3af3a90ce587dcb66e6c454b59 | sdbaronc/taller_de_algoritmos | /algoritmo_38.py | UTF-8 | 144 | 3.296875 | 3 | [] | no_license | a=int(input("ingrese un año"))
if (a%4==0 and a%100!=0)or a%400==0:
print("el año es bisiesto")
else:
print("el año no es bisiesto")
| true |
a45be9113301345d88d6dac8dc8187cbb2a9e764 | solomonli/PycharmProjects | /Idioms/lesson3/task5/task.py | UTF-8 | 127 | 3.3125 | 3 | [] | no_license | # List loops
finances = [10, -5, 15]
double = [ ]
for x in finances:
double.append( x*2 )
print( "double", double )
| true |
24fa81bb29cb36bcaa6912a5c01e7e732029aeaa | ajaychaurasia25921/pythonAssistant | /scrollbar.py | UTF-8 | 302 | 3.03125 | 3 | [] | no_license | from tkinter import *
root=Tk()
scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT,fill=Y)
mylist=Listbox(root,yscrollcommand=scrollbar.set)
for i in range(100):
mylist.insert(END,"Number"+str(i))
mylist.pack(side=LEFT,fill=BOTH)
scrollbar.config(command=mylist.yview)
root.mainloop()
| true |
aa861abc619c07f86054f858cb490b43b2307e74 | gabbhack/discord-bot-hello-world | /bot/img_api.py | UTF-8 | 694 | 2.734375 | 3 | [
"MIT"
] | permissive | from typing import Optional
from aiohttp import ClientSession
from pydantic import BaseModel
class Image(BaseModel):
link: str
class ImageApi:
def __init__(self) -> None:
self.session: Optional[ClientSession] = None
async def create_session(self) -> ClientSession:
if self.session is ... | true |