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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
da5305b00a6e55c0b273d5828213368ad2d2c3dd | Python | meganoop/DataMining-Visualization | /CodeFiles/NC_latlong.py | UTF-8 | 2,352 | 3.1875 | 3 | [] | no_license | ## Goal: extract only the lat longvalues for all the business in north carolina state
import argparse
import collections
import csv
import json
def read_and_write_file(json_file_path, csv_file_path, column_names):
# """Read in the json dataset file and write it out to a csv file, given the column names."""
wit... | true |
fa02c672b03ac67c0d520d8e3c84eb295bb39556 | Python | ekimekim/gbos | /tests/meta_test.py | UTF-8 | 3,185 | 3.15625 | 3 | [] | no_license | """Example test to test the testing framework"""
# Normally you'd specify a top-level directory .asm file to 'include'.
# This file should contain the target function. We 'include' it rather than linking it
# so the test can potentially access unexported ('private') labels.
# You can say None, but it's a weird case.
f... | true |
3a97bef84920ed57544ff085e20b587867d6fb59 | Python | oglebee/python.learning | /tuples.py | UTF-8 | 361 | 3.796875 | 4 | [] | no_license | import os
os.system("clear")
tuple1 = ("John", "Bob", "Tina")
tuple2 = ("Mary",)
#tuple3 = tuple1 + tuple2
tuple3 = tuple1[1]
#print(tuple1[0:2])
print(tuple3)
#tuples are like lists that can't be changed
#use parentheses instead of square brackets
#Tuples are a little faster than lists in processing power
#tuples wi... | true |
98ee432a0f32e91bb09518387c92bcf337374513 | Python | zfh1005/PythonPackage | /DataParse/deletePointParse.py | UTF-8 | 1,190 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!/usr/bin/env python
'''
If a file's every line start with '.', delete the '.' and the content before the '.'
'''
import os
import sys
PARSE_PATH = 'D:\\Temp\\temp.txt'
LOG_PATH = 'd:\\result.txt'
#parse test data
#the param sourcePathath is filePath need parse
def parseData(sourcePath):
... | true |
b698fa8870ad7b476e2f7fe67912cf42b9a1a527 | Python | zww999/zww999.github.io | /MedicalExtract/RemoteSupervision/gen_ner_bieo.py | UTF-8 | 3,730 | 2.96875 | 3 | [] | no_license | import random
random.seed(8)
def load_entity_dict(dict_name="字典库.txt"):
entity_type = "medicine".split(",")
with open(dict_name, encoding='utf-8') as file_in:
# 得到字典库中的每一列组成为列表
lines = [line.strip() for line in file_in.readlines() if len(line.strip())>1]
# 随机打乱字典库
random.shuffle(lin... | true |
e28db4ffb7f779c48a8f010c67f20d0df807165d | Python | janafuchs/GPErks | /GPErks/gp/data/dataset.py | UTF-8 | 5,306 | 2.53125 | 3 | [
"MIT"
] | permissive | from typing import Callable, List, Optional
import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import qmc
from GPErks.constants import HEIGHT, WIDTH
from GPErks.plot.options import PlotOptions
from GPErks.plot.plottable import Plottable
from GPErks.utils.random import RandomEngine
class Datase... | true |
980ec3295c684b51614396be4ef1c8871bea715b | Python | mmaines16/django-AirBud | /scripts/windDir.py | UTF-8 | 4,614 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import os
import time
import random
import redis
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import Queue
import math
## Software SPI Setup
#CLK = 18
#MISO = 23
#MOSI = 24
#CS = 25
#mcp = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS, miso=MISO, mosi=MOSI)
#HARDWARE SPI
SPI_PORT = 0
SPI_DE... | true |
e84fad9902339b824d5c6dba7db2d4aa46e99e0e | Python | MaximPushkar/PythonUniversity | /2_term/Classworks/Classwork 4/problem 4.1.py | UTF-8 | 874 | 3.890625 | 4 | [] | no_license | import random
import turtle
def draw_a_point(x, y):
turtle.up()
turtle.goto(x,y)
turtle.down()
turtle.begin_fill()
turtle.circle(1)
turtle.end_fill()
def midpoint(x1, y1, x2, y2):
return [(x1+x2)//2, (y1+y2)//2]
N = 10000
"""x = random.randint(-250, 250)
y = random.randint(-250, 250)"""... | true |
cd961a000f96f052713d3fe4cfcc9c6e4ce6cbe9 | Python | ion-bueno/covid-greenhouse-effects | /loader/germany_covid_loader.py | UTF-8 | 1,189 | 2.53125 | 3 | [] | no_license | from loader.loader import *
import pandas as pd
import pickle
class GermanyCovidLoader(Loader):
def __init__(self):
super().__init__()
self.covid_data: pd.DataFrame
self.geo_data: pd.DataFrame
self.covid_geo_data: pd.DataFrame
def load(self):
# read number of cases in... | true |
9380e52bf90f63bb635f06fdc9c4d6f378c24c48 | Python | Dnurudeen/alx-higher_level_programming | /0x04-python-more_data_structures/3-common_elements.py | UTF-8 | 167 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python3
def common_elements(set_1, set_2):
"""
A function that returns a set of
common elements in two sets
"""
return(set_1 & set_2)
| true |
b4d279bd2323aecc5664a6d2ef23df8702165427 | Python | franchuterivera/dask_random_search | /job_dispatcher.py | UTF-8 | 2,983 | 2.609375 | 3 | [] | no_license | import collections
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
from sklearn.ensemble import GradientBoostingClassifier
import numpy as np
# Create a run object
RunInfo = collections.namedtuple('RunInfo', 'run_id model dataset configuration cv')
class Dispatcher:
def __init__(self, bud... | true |
639f36d4d758ff909decb6e49729d7c13db844fc | Python | MikeCarrillo2020/AdmonODatos | /EJERCICIOS LECCIÓN 2/Ejercicio 2.7.py | UTF-8 | 295 | 3.46875 | 3 | [] | no_license | f = open("poem_2.txt", "w")
f.write("When I think about myself, ")
f.write("I almost laugh myself to death.")
f.close() # close the file and flush the data in the buffer to the disk
f = open("poem_2.txt", "r") # open the file for reading
data = f.read() # read entire file
print(data)
f.close() | true |
9707c5acda45b47c7cad56fc247e13fcc828de4e | Python | sarahcstringer/skills-assessment-2 | /advanced.py | UTF-8 | 3,307 | 4.25 | 4 | [] | no_license | """Advanced skills-dictionaries.
**IMPORTANT:** these problems are meant to be solved using
dictionaries and sets.
"""
# I didn't use any sets in this but did use dictionaries.
def top_chars(phrase):
"""Find most common character(s) in string.
Given an input string, return a list of character(s) which
a... | true |
004d44e4e0a81b6ab325de0a10f473a66bcc52b1 | Python | sebastien/tlang | /research/compiler-query.py | UTF-8 | 10,438 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
## @tdoc:indent spaces=2
## title: Query compiler research
## text|texto
## We want to create a compiler that will transform a TLang query expression
## into some kind of executable program that yields the different values.
##
## The first part is going to be about *normalizing the query* s... | true |
3245dcc3334f8edbf2ca75ba6cfd946d1fc7ba37 | Python | Annxia/learn-automated-testing | /code/seleniumStu/day4/5iframe切换.py | UTF-8 | 753 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# __author__:lenovo
# 2020/5/24
from selenium import webdriver
# 创建一个浏览器驱动对象
driver = webdriver.Chrome(r"E:\Program Files\JetBrains\PyCharm 2019.3.3\bin\chromedriver.exe")
# 访问网址
driver.get("D:/learn-automated-testing/code/seleniumStu/day4/test2.html")
# 第一部曲:定位到需要切换进去的iframe
iframeEle =... | true |
8665db6dfca121a6b693b485acd64b23f5c67b4d | Python | gwind/YWeb | /yweb/yweb/utils/__init__.py | UTF-8 | 2,490 | 2.75 | 3 | [
"MIT"
] | permissive | # coding: UTF-8
# yweb.utils 模块
import hashlib
import pprint
try:
import fcntl
HAS_FCNTL = True
except ImportError:
# fcntl is not available on windows
HAS_FCNTL = False
def is_fcntl_available(check_sunos=False):
'''
Simple function to check if the `fcntl` module is available or not.
If... | true |
d4b9efcd4a1bef382c144271be3d21dc289aa579 | Python | Yashg2910/LeetCode | /Top Interview Questions/Medium/Arrays/lengthOfLongestSubStringOptimized.py | UTF-8 | 586 | 3.203125 | 3 | [] | no_license | class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
l = len(s)
if (l < 1):
return 0
if (l == 1):
return 1
ans = 1
start = 0
chars = {}
for end,char in enumerate... | true |
0ca5b734c16cf2cb76b1ce690a35a604aa868fc0 | Python | lion-tohiro/MyEigenface | /eigenface_detect.py | UTF-8 | 1,922 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import sys
from cv2 import cv2
import numpy as np
# some parameters of training and testing data
train_sub_count = 40
train_img_count = 5
total_face = 200
row = 70
col = 70
row_original = 112
col_original = 92
def eigenfaces_detect(src, average, values, vectors, weight, a):
src_img = cv2.... | true |
6f7437072bdd34c789e131c0ef309cdf63461301 | Python | apolcyn/polypaths_planar_override | /build/lib.win32-2.7/planar/__init__.py | UTF-8 | 3,579 | 2.671875 | 3 | [] | no_license | #############################################################################
# Copyright (c) 2010 by Casey Duncan
# Portions copyright (c) 2009 The Super Effective Team
# (www.supereffective.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
... | true |
419df62389776a16aba1e633fc64752f8fbb697c | Python | pruvi007/LeetCode | /add_two_nums_LL.py | UTF-8 | 1,480 | 3.53125 | 4 | [] | no_license | class ListNode:
def __init__(self,x):
self.val = x;
self.next = None
class Solution:
def addTwoNumbers(self,l1:ListNode,l2:ListNode) -> ListNode:
ans = ListNode(0)
temp1, temp2 = l1,l2
if temp1==None:
return temp2
elif temp2==None:
return temp1
#... | true |
9c51b58d552c0e7b8f0e420d71966eb80bc2bf26 | Python | jlrcolmenares/Data-Science-Platzi | /src/01-core/01-intro-pensamiento-computacional/16_scope.py | UTF-8 | 347 | 3.03125 | 3 | [] | no_license | def func_1(arg_x):
var1 = 'scope_1\n'
return arg_x + var1
def func_2(arg_y, func_y):
def func_3(arg_z):
var3 = 'scope_3\n'
return arg_z + var3
var2 = 'scope_2\n'
valor = func_3(arg_y)
return func_y(valor) + var2
var0 = 'scope_general\n'
output = func_2(var0,func_1)
print('co... | true |
34f53f119700f692901712a0be183225548f02fc | Python | CAM-Gerlach/brokkr | /src/brokkr/pipeline/datavalue.py | UTF-8 | 2,398 | 2.90625 | 3 | [
"MIT"
] | permissive | """
Represent each measurement/observation/variable as a standard DataValue.
"""
# Standard library imports
import datetime
# Local imports
import brokkr.utils.misc
class DataType(brokkr.utils.misc.AutoReprMixin):
def __init__(
self,
name,
conversion=True,
binary_... | true |
7befb526834cc2e60ffcd829eb2b1831b869fcb8 | Python | rrabit42/Python-Programming | /Python프로그래밍및실습/ch0-python programming/numbers' sum and average.py | UTF-8 | 214 | 3.90625 | 4 | [] | no_license | n1 = int(input("정수1 : "))
n2 = int(input("정수2 : "))
n3 = int(input("정수3 : "))
sum = n1 + n2 + n3
average = sum / 3
print()
print("="*10)
print("합계 = ", sum)
print("평균 = ", average)
| true |
57379144e80674015e185bc628a883782becd35e | Python | mbhs/mbit | /archive/2020f/solutions/TheDuplicator.py | UTF-8 | 400 | 2.96875 | 3 | [] | no_license | from collections import defaultdict
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
aDict = defaultdict(int)
bDict = defaultdict(int)
both = defaultdict(int)
ret = n * (n - 1) // 2
for i in range(n):
ret += both[(a[i], b[i])] - aDict[a[i]] - bDict[b[i]]
... | true |
c4097fa7afc513b53f860456173ac272e5877bd5 | Python | edmundoferreira/thermocup | /test_rpio.py | UTF-8 | 2,266 | 2.609375 | 3 | [] | no_license | import RPIO
import time
#debounce time varaible (None -> XXX miliseconds typical between 10 and 200)
tb=None
#eliminating warnings
RPIO.setwarnings(False)
def call_P1(gpio,val):
print "P1-4"
RPIO.del_interrupt_callback(4)
RPIO.add_interrupt_callback(25,call_C1,edge='falling',pull_up_down=RPIO.PUD_UP,debou... | true |
3c18952135a4c3ccce175c1d0bc545a81cfd984f | Python | DPDominika/checkio | /elementary/Digits multiplication.py | UTF-8 | 246 | 3.078125 | 3 | [] | no_license | # https://py.checkio.org/mission/digits-multiplication/
def checkio(number):
list = "123456789"
new_number = str(number)
wynik = 1
for i in new_number:
if i in list:
wynik *= int(i)
return wynik
| true |
6f8474f0ea651106164f1a1fd27f0fa6605390d5 | Python | ylkwd/senior-design | /test/ItemTest.py | UTF-8 | 895 | 3.03125 | 3 | [] | no_license | import unittest
from src.lib.Item import Item
class ItemTest(unittest.TestCase):
item: Item
def setUp(self) -> None:
self.item = Item(100, 100, 100, 5, "SerialNumber")
def testGetLength(self):
self.assertEqual(self.item.get_length(), 100)
def testGetWidth(self):
self.assert... | true |
3a2f312d2da3e5fb2aff2326f63ffb8109f0910b | Python | noname34/CHARM_Project_Hazard_Perception_I | /cookie-cutter/src/data/labels_txt2csv.py | UTF-8 | 2,025 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/user/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Kevin Bürgisser
# @Email: kevin.buergisser@edu.hefr.ch
# @Date: 03.04.2020
# Context: CHARM PROJECT - Harzard perception
import fnmatch
import os
import pandas as pd
from configuration import PATH_DIR_RAW_DATA, PATH_DIR_INTERIM_DATA
from data.external.datase... | true |
d9acccb4fe7b7574b7f10813ec0ebf8b27b7da35 | Python | yurimalheiros/IP-2019-2 | /lista4/karolliny/q2.py | UTF-8 | 194 | 3.765625 | 4 | [] | no_license | print ("Questão 2")
numero = int(input("Digite um número: "))
lista = []
while (numero != 0):
lista.append (numero)
numero = int(input("Digite um número: "))
print (lista)
| true |
3896ab08de3cb001ece34c764d1c762a206e8611 | Python | bonicim/technical_interviews_exposed | /tst/tree_questions/test_get_nearest_ancestor_v2.py | UTF-8 | 1,045 | 3.25 | 3 | [] | no_license | import pytest
from src.algorithms.tree_questions.get_nearest_ancestor_v2 import (
get_nearest_ancestor_v2,
)
from src.algorithms.node import Node
def test_easy_case():
assert get_nearest_ancestor_v2(left_child, right_child) == Node(42)
def test_ancerstor_2nd_level():
assert get_nearest_ancestor_v2(child... | true |
cafb51346f99a0f142642f3800b68c0928150e2f | Python | bernardosequeir/CTFSolutions | /HackerRank/10DaysOfStats/Day1_InterquartileRange.py | UTF-8 | 970 | 3.53125 | 4 | [
"MIT"
] | permissive | size = int(input())
values_list = list(map(int, input().split()))
frequency_list = list(map(int, input().split()))
numbers = []
for i in range(size):
numbers += [values_list[i]] * frequency_list[i]
numbers = sorted(numbers)
lower_quartile = 0
higher_quartile = 0
if(size % 2 != 0):
first_half = numbers[:size/... | true |
763fa2b0005b367a151a1791a440a593e63f5a11 | Python | mikefraanje/Programming-Blok1 | /les1/week1.py | UTF-8 | 3,446 | 4.40625 | 4 | [] | no_license |
# 1_1
# vraag: noteer van elke expressie wat de uitkomst en type is:
#invoer Uitkomst Type
# 5 5 Integer
# 5.0 5.0 Floating point
# 5 % 2 1 Integer
# ‘5’ '5' String
# 5 * 2 10 ... | true |
bc568414fa4f4e4a00131c837ed82f354cb8767d | Python | averywein/SI206 | /HW3-StudentCopy/madlibhw3.py | UTF-8 | 388 | 3.28125 | 3 | [] | no_license | # Using text2 from the nltk book corpa, create your own version of the
# MadLib program.
# Requirements:
# 1) Only use the first 150 tokens
# 2) Pick 5 parts of speech to prompt for, including nouns
# 3) Replace nouns 15% of the time, everything else 10%
# Deliverables:
# 1) Print the orginal text (150 tokens)
# 1)... | true |
71d8a9718c7dc47e2388169ee9ff11b2408da960 | Python | faizkhan12/Basics-of-Python | /exercise2.9.py | UTF-8 | 121 | 3.09375 | 3 | [] | no_license | #This program is about my favourite number
favNumb=16
message=str(favNumb) +" is my favourite number"
print(message)
| true |
f5c1dafee124320ffec7bc4da5e483fc0b7976ff | Python | funbp6/Python_Data_Analysis | /parse_paf.py | UTF-8 | 1,509 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import time
import argparse
start_time = time.time()
p = argparse.ArgumentParser()
p.add_argument('paf_file', help='paf file')
p.add_argument('-o', '--out', help='output file name')
args = p.parse_args()
input_paf = args.paf_file
output_file = args.out
print("start p... | true |
688b0e602e09b01ab41cfc5800943d4c1a256669 | Python | Jeff654/my_machine_learning | /NLP_exercise/基础算法/base_algorithm/sklearn/linearModel/plot_lasso_lars.py | UTF-8 | 630 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn import datasets
diabetes = datasets.load_diabetes()
x = diabetes.data
y = diabetes.target
print("computing regularization path using the Lars...")
alphas, _, coefs = linear_model.lars_path(x, y, ... | true |
e652aea6eb90342f05ee8dffb0129161f2d0338d | Python | uint0/classutil-scraper | /classutil_scraper/scrape.py | UTF-8 | 4,087 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
scrape.py
=========
`python scrape.py <file>`
A python utility to scrape `http://classutil.unsw.edu.au/`
Data is stored a json format into a specified file.
"""
from Scraper import WebScraper
from Parsers import parsers
from util import extract_table, extract_links, get_latest_update
im... | true |
e8c9a90e36c41bc364291bea7077cbcb3df31ac3 | Python | PasinduUkwatta/Python-Dash | /numpy_and_pandas.py | UTF-8 | 176 | 3.015625 | 3 | [] | no_license | import numpy as np
import pandas as pd
mat =np.arange(0,10).reshape((5,2))
print(mat)
df =pd.DataFrame(data=mat ,columns=['A','B'])
print(df)
print(df.describe()) | true |
fcbe5ef6a2d4670b347ef36573871f102c54aa8a | Python | aulb/notes | /array/JumpGameII.py | UTF-8 | 2,062 | 3.390625 | 3 | [] | no_license | class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) < 2: return 0
max_distance = nums[0]
step_counter = 1
current_max_distance = max_distance # zone
for index in range(1, len(nums)):
if current_max_distance >= len(nums) - 1:
return... | true |
d9d1a62d3e164ea7b48c2f8be8f78f4ad88b1566 | Python | NongE/BOJ_Coding | /Greedy/BOJ_11399/BOJ_11399.py | UTF-8 | 207 | 2.796875 | 3 | [] | no_license | import sys
people = sys.stdin.readline()
time = sorted(list(map(int, sys.stdin.readline().split())))
time_sum = 0
_time = []
for i in time:
time_sum += i
_time.append(time_sum)
print(sum(_time))
| true |
85fe0b6d2a2b2151c82f7fb99867af18f7eea264 | Python | GavriloviciEduard/Fundaments-of-Programming_4 | /test/test_passenger_repo.py | UTF-8 | 1,177 | 3.046875 | 3 | [] | no_license | import unittest
from domain.passengers import Passenger
from infrastructure.passengers_repo import PassengersRepo
class PassengersRepoTest(unittest.TestCase):
def test_add_passenger(self):
r=PassengersRepo()
p=Passenger("Ion","Marcel",199724507890)
r.add_passenger(p)
... | true |
9306936b73dff26a80f8cb98aebc19c9bcceecf0 | Python | Limych/py-beward | /beward/util.py | UTF-8 | 1,019 | 2.890625 | 3 | [
"CC-BY-NC-SA-4.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # Copyright (c) 2019-2022, Andrey "Limych" Khrolenok <andrey@khrolenok.ru>
# Creative Commons BY-NC-SA 4.0 International Public License
# (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/)
"""Utilities."""
import re
def normalize_fqdn(hostname) -> str:
"""Normalize full qualified domain na... | true |
5345ea131d1b171c4c77ae06f1a0105a17ecd68b | Python | carlos-echeverria/RobotTuples | /robotTuples.py | UTF-8 | 6,219 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python3
# Library of functions to find tuples from a list of elements (robots) intended
# for preparing a Best-Worst scaling comparison.
from itertools import combinations
from collections import Counter, defaultdict
from random import choice, choices, seed, sample
def possibleTuples(robots,k):
#... | true |
7537a2df592922415baa69b382deeb65650d64ab | Python | austinlf96/fcc-information-security-projects | /SHA 1 Password Cracker/password_cracker.py | UTF-8 | 1,345 | 3.203125 | 3 | [] | no_license | import hashlib
#create hash for each password of the top 10000 passwords, and compare that hash to
#the hash submitted to the function. if use_salts is true, place each sale from known
#salts at the beginning of the top10000 password and then hash, do the same for that
#same password, but add the salt to the end of t... | true |
2e1b59de944c993eb99841853c12e94120332a90 | Python | Aasthaengg/IBMdataset | /Python_codes/p03324/s559636124.py | UTF-8 | 186 | 3.109375 | 3 | [] | no_license | d, n = map(int, input().split())
if d == 0 and n == 100:
print(101)
elif d == 1 and n== 100:
print(10100)
elif d == 2 and n == 100:
print(1010000)
else:
print(n*100**d) | true |
3e39936b5434c5dfdc89d1659b155f576bf81027 | Python | lagerfeuer/exercism-solutions | /python/binary-search/binary_search.py | UTF-8 | 488 | 4.3125 | 4 | [] | no_license | def binary_search(list_of_numbers, number):
if not list_of_numbers:
raise ValueError("list_of_numbers is empty!")
begin = 0
end = len(list_of_numbers) - 1
while begin <= end:
middle = (begin + end) // 2
if list_of_numbers[middle] == number:
return middle
if ... | true |
71177d493ce1de2e620fc58b0a1886e768b5a8d0 | Python | nbhatia8/Assistance | /NewBot/Virtual_File.py | UTF-8 | 6,701 | 2.796875 | 3 | [] | no_license | import os
import time
import playsound
import speech_recognition as sr
from gtts import gTTS
import datetime
import warnings
import calendar
import wikipedia
import pyttsx3
import random
import subprocess
from webbrowser import open
from WeatherAPP import WeatherInformation
from sys import argv
import webbrowser
import... | true |
152a6ecb143af3dd452c206c98441dd56904ea25 | Python | leeiopd/algorithm | /before2021/python/문제풀이/day3/C4_[TST] 도약.py | UTF-8 | 1,935 | 3.296875 | 3 | [] | no_license | '''
개구리가 연못 위에서 놀고 있다. 개구리는 N개의 연 잎 들을 이용해서 이리저리 뛰어 놀고 있다.
개구리가 뛰는 장면을 보던 철수는 개구리가 도약을 하는 경우가 얼마나 있는지 궁금해졌다.
여기서 도약은 아래 조건을 만족하는 경우를 말한다.
1. 개구리가 뛴 거리가 이전에 뛴 거리 이상 뛰지만 그 2배보다 멀리 뛰지는 않는다.
2. 개구리는 오른쪽으로만 뛴다.
3. 개구리는 두 번만 뛴다.
4. 위 세 가지 조건을 만족한다면 어느 곳에서든 시작할 수 있다.
허나, 연 잎 들이 너무 많기 때문에 가능한 횟수가 매우 많아질 것 같다고 생각한... | true |
1366fcc49e442fad9dfb2043ab83688174af7380 | Python | ShoniB/CartoonFilter | /cartoon.py | UTF-8 | 6,130 | 3.015625 | 3 | [] | no_license | ## Shondell Baijoo
## Computer Vision Project
## Dec 2017
from PIL import Image, ImageFilter
import cv2
# input and output image names
PICTURE = "silva.png"
PICTUREBLUR = "sb.jpg" #blur output
PICTURETHRES = "st.jpg" # threshold output with pasted eyes
PICTUREFACE = "sf.jpg" # face/eye detection
PICTUREOUT = "so.jp... | true |
b42b2a666a2261170b75ba62d56b602abe35a5d7 | Python | KushagrGarg/A-Hybrid-System-for-Real-Time-Face-Mask-Detection | /models.py | UTF-8 | 2,433 | 2.609375 | 3 | [] | no_license | import numpy as np
from keras.models import Sequential
from keras.layers import Dense,Activation,Flatten,Dropout
from keras.layers import Conv2D,MaxPooling2D
from keras.callbacks import ModelCheckpoint
from sklearn.decomposition import PCA
from sklearn import svm
from matplotlib import pyplot as plt
import pickle as pk... | true |
d272a6cf7ad7bb1d21536a52533d91a0e650ca0e | Python | souptik5/create-project-automation | /create.py | UTF-8 | 838 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
from github import Github
print("Hello\n")
# path = os.getcwd()
# path= path+"/000Test"
path = "D:/Projects/"
url = "www.github.com/login"
username="iamthecubixnerd5@gmail.com"
password="Souptik5!"
# print("the current working directorhy is: %s" %path)
def ... | true |
c092a570f1c7da44a72282f03137cf004c494c5d | Python | mishrakeshav/Radiosonde-Ground-Station-Software | /src/app/controllers/StartMenuController.py | UTF-8 | 879 | 2.5625 | 3 | [] | no_license | from PySide2 import QtWidgets
from src.app.controllers.PortSelectionController import PortSelectionController
from src.app.controllers.ViewPreviousFlightController import ViewPreviousFlightController
from src.app.views.StartMenuWindow import StartMenuWindow
class StartMenuController(StartMenuWindow):
def __init_... | true |
c1c81722f4f92b7121a4693f47c8f3f7a534cf1f | Python | srikanthpragada/PYTHON_30_AUG_2021 | /demo/funs/sorted_demo.py | UTF-8 | 299 | 3.359375 | 3 | [] | no_license | def clean(s):
return s.strip().upper()
a = [-10, 29, 11, 45, -50]
names = ['abc', 'xy', 'pqrs', 'aaaaa']
data = [' abc', ' Xy', 'pqrs', 'Aaaaa ', 'bbb']
for n in sorted(a, key=abs):
print(n)
for n in sorted(names, key=len):
print(n)
for n in sorted(data, key=clean):
print(n)
| true |
cc42f309d0b2bb5efa46f13208e76691ae4b82c2 | Python | Nereus-Minos/flaskLoveWeb | /app/static/images/img_suofang.py | UTF-8 | 805 | 2.546875 | 3 | [] | no_license | import os
from PIL import Image
ext = ['jpg', 'jpeg', 'png']
files = os.listdir('./index/home-setion')
def process_image(filename, mwidth=300, mheight=400):
image = Image.open('./index/home-setion/' + filename)
w, h = image.size
if w <= mwidth and h <= mheight:
print(filename, 'is OK.')
r... | true |
dad35f4879440277ff089a4ee5f817935a01dd3e | Python | demetoir/ps-solved-code | /hacker earth/Prefix numbers.py | UTF-8 | 397 | 3.046875 | 3 | [] | no_license |
head=[1]*10
tail=[0]*10
direct = [[],[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9],[3,6,9],[2,4,6,8],[1,2,3,4,5,6,7,8,9],[3,6,9],[7],[4,8],[9]]
for i in range(10):
print i,direct[i]
n=2
for k in range(n-1):
for i in range(1,10):
for j in direct[i]:
tail[i]+=head[j]
print head
print ... | true |
bb15af36db60a299593cfd438893abd72a0aa08a | Python | jacindaz/6.00.2x | /ProblemSet2/ps2.py | UTF-8 | 12,392 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 6.00.2x Problem Set 2: Simulating robots
import math
import random
# import ps2_visualize
# import pylab
#For Python 2.7:
#from ps2_verify_movement27 import testRobotMovement
# If you get a "Bad magic number" ImportError, you are not using
# Python 2.7 and using most likely Python 2.6:
... | true |
ca43a3fe4fd64c50e750e2539e34efaac55ebe2f | Python | likitha-9/Location-based-Recommender-System | /location_based_recommender_systems.py | UTF-8 | 10,503 | 2.765625 | 3 | [] | no_license | import pandas as pd,matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
import numpy as np
from geopy.distance import great_circle
import random
from shapely.geometry import MultiPoint
import webbrowser
x=open("C:/Python27/new_abboip.txt",'r')
arr=[]
lines=list(x)
for i in range(0,len(lines)):
a=lines[i].s... | true |
c9735eae5d7d1889e7d2396f984b7b27ca38c20b | Python | pastalina/python | /hw8ex1.py | UTF-8 | 1,032 | 4.03125 | 4 | [] | no_license | # Задание 1
class Date:
def __init__(self, date):
self.date = str(date)
@classmethod
def to_int(cls, date):
date_list = []
for el in date.split("-"):
date_list.append(int(el))
return date_list
@staticmethod
def valid(date):
if 1 <= Date.to_int(da... | true |
cd10a9a37666d0b96b1f7716492d66b87a155089 | Python | Sandyk-95/Sentimental-Analysis-of-Speech | /Sentiment Analyzer V1/bin/Debug/SpeechToText.py | UTF-8 | 542 | 2.6875 | 3 | [] | no_license | import sys
import assemblyai
import TextAnalysis as ta
print("Type of cmd line arguments are ",type(sys.argv))
fileName = sys.argv[1]
try:
aai = assemblyai.Client(token='Your Assembly AI token ID')
transcript = aai.transcribe(filename=fileName)
while transcript.status != 'completed':
transcript = ... | true |
81d2f1cc7828cb82c36b67dca1bef81b22bb5d85 | Python | 4josew16/COM404 | /1-basics/5-functions/6-multiple-functions/bot.py | UTF-8 | 345 | 3.796875 | 4 | [] | no_license |
def display_ladder(steps):
steps=int(input())
print("| " * steps)
print("* " * steps)
print("| " * steps)
print("* " * steps)
print("| " * steps)
print("* " * steps)
print("| " * steps)
print("* " * steps)
def create_ladder():
print("Please enter a number of steps")
create_la... | true |
ea9ba122322b51fe452988fb0d8b9a773ca0e684 | Python | butter-lion/eclipse-workspace | /python_base_stu/面向对象/类方法.py | UTF-8 | 781 | 4 | 4 | [] | no_license | '''
Created on 2018年5月11日
@author: zhang
'''
class animal(object):
name = '骨傲天'
def __init__(self,name,age):
self.name = name
self.age = age
def worf(self):
print('wangwangwang')
#静态方法
@staticmethod
def eat(self):
print('%s is eating!'%sel... | true |
924ca70e9d071d367295a16b74ac3a148156d843 | Python | StianIsmar/machine-learning-course-ntnu | /assignment_1_linear_regression/regression/LinRegTwoFeatures.py | UTF-8 | 3,206 | 3.703125 | 4 | [] | no_license | #Two feature linear regression
#!/usr/local/bin/python3
import csv
import numpy as np
import os
import matplotlib.pyplot as plt
class LinearRegressOneFeatureTraining():
def __init__(self):
dataArray, numOfObs = self.readCsv()
weights, X, Y = self.constructMatrix(dataArray, numOfObs)
self.... | true |
f810a93e3c4770bb7bbf5949ba37f0821a3611b4 | Python | YutingYao/crater_lakes | /bin/plot_normalized_temperatures.py | UTF-8 | 1,445 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
plot_normalized_temperatures.py
Created on Tue Feb 7 18:44:17 2017
@author: sam
"""
import os
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
import datetime
target = 'Yugama'
# load data
os.chdir('/home/sam/Dropbox/HIGP/Crater_Lakes/Dmitr... | true |
6e239c874739c2339d54d4c163d94d2ff0c39985 | Python | tobincorporated/TobincorpBlog | /handlers/signup.py | UTF-8 | 1,968 | 2.546875 | 3 | [
"MIT"
] | permissive | import re
from google.appengine.ext import db
from bloghandler import BlogHandler
from models import User
# Validation of information
USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,20}$")
EMAIL_RE = re.compile(r'^[\S]+@[\S]+\.[\S]+$')
PASS_RE = re.compile(r"^.{3,20}$")
def valid_username(username):
return username and ... | true |
b4502e4c51d43e42fc4e03554133c8c6cceeb48e | Python | tuobulatuo/Leetcode | /src/ltree/TreeLinkNode.py | UTF-8 | 447 | 3.265625 | 3 | [] | no_license | __author__ = 'hanxuan'
# Definition for binary tree with next pointer.
from ltree.TreeNode import TreeNode
class TreeLinkNode(TreeNode):
def __init__(self, x):
super(x)
self.next = None
@staticmethod
def traverse(root):
if root is None:
print('none')
else:
... | true |
b1b986cc1795703ca5c184e6032174403e85731e | Python | WestonMarek/TITAN | /EarthAspect.py | UTF-8 | 3,344 | 2.515625 | 3 | [] | no_license | # This is the python code for the Summer 2018 Titan research
# This code will take objects in dune fields and find the aspect face of the object and the width. This will all be based on the wind direction.
import arcpy
from aspect_helper import *
import math
import numpy as np
from arcpy.sa import *
# settin... | true |
140a48bda34ce4907f606c4b2a638be3cead6fbb | Python | iambriangon/upf-calendar-exporter | /calendar_exporter.py | UTF-8 | 4,118 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | from csv_utils.csv_exporter import export_csv
from utils import *
from common import *
from typing import List
CALENDAR_HEADERS = ["Subject", "Start Date", "Start Time", "End Date", "End Time", "All Day Event", "Description",
"Location", "Private"]
ROW_TITLE_INDEX = -1 # index
def dict_to_valid_... | true |
985f24304f2fb738d23182162855694a2cad080c | Python | adilsachwani/PythonCrashCourse_Solutions | /9_7.py | UTF-8 | 1,113 | 3.34375 | 3 | [] | no_license | class User():
def __init__(self, first_name, last_name, age, education):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.education = education
self.login_attempts = 0
def describe_user(self):
print(self.first_name.title() + " " + self.... | true |
c5290dbd785596a82391a2303581a4ae1b09f4da | Python | ehean/2-Opt-Solution-for-TSP | /tsp-verifier.py | UTF-8 | 2,550 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
import math, re, sys
import TSPAllVisited as visit
# usage: python tsp-verifier.py inputfilename solutionfilename
def main(instancefile, solutionfile):
visit.main(instancefile, solutionfile)
cities = readinstance(instancefile)
solution = readsolution(solutionfile)
checksolution(c... | true |
6d0b1d965c31c412fe8a47af36eba4c829e50500 | Python | strange-fruit/scripts | /ports-scan.py | UTF-8 | 989 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
#Auteur: Nicolas Masure
from scapy.all import *
print("Les ports indiqués sont les ports ouverts, si un port n'y figure pas, c'est qu'il est fermé. \n")
host_target=input("Entrez l'IP de la machine à scanner \n")
ports_target=input("Plage de port, exemple : 0,1024")
req=Ether()/IP(dst=host_target... | true |
a078b13847e9e5e07f2d41445edb8db905dd2427 | Python | FA4-0/ABBREVIATIONS.FA | /mine_abbr_pdf.py | UTF-8 | 14,864 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 07:15:38 2020
@author: emse
"""
###############################################################################
#MIT License
#
#Copyright (c) 2021 AI for Fault Analysis FA4.0
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this softw... | true |
315d768f6d29289c527c9a84fd55b8ef824c1164 | Python | divyaparmar18/saral_python_programs | /count.py | UTF-8 | 712 | 3.84375 | 4 | [] | no_license | #Code likho jo di gayi list mein jo number 20 se bade hai aur 40 se chote hai unhe count kare. Aur firr unka count print kare.
numbers=[50, 40, 23, 70, 56, 12, 5, 10, 7]
i=0# here we defined the index of the list
count = 0 # this is the variable given to the numbers of the number between the condition given below
whil... | true |
2057b70c2363584821b1833e9fcab1b5a14381d5 | Python | SveRKeR92/SnakePython | /Fruit.py | UTF-8 | 502 | 3.21875 | 3 | [] | no_license | from math import pi
import math
import pygame
import random
class Fruit:
def __init__(self, ecran, screenWidth, screenHeight):
self.ecran = ecran
self.width = 25
self.color = (255, 0, 0)
self.x = random.randrange(0, screenWidth, 25)
self.y = random.rand... | true |
a8676b5998bb1b608fafcde4ca8234d7245ad1cd | Python | zahraaassaad/holbertonschool-machine_learning | /supervised_learning/0x11-attention/1-self_attention.py | UTF-8 | 686 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
"""Self Attention class"""
import tensorflow as tf
class SelfAttention(tf.keras.layers.Layer):
"""Self Attention class"""
def __init__(self, units):
"""Class constructor"""
super().__init__()
self.W = tf.keras.layers.Dense(units)
self.U = tf.keras.layers... | true |
b3b59073b59ac9ca3cd5214186e134b2098c10ed | Python | arpitkjain7/synapse | /datahub/sql/crud/user_crud.py | UTF-8 | 729 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from sql import session
from sql.orm_models.user import User
class CRUDUser:
def create(self, **kwargs):
user = User(**kwargs)
with session() as transaction_session:
transaction_session.add(user)
transaction_session.commit()
transaction_session.refresh(user)
... | true |
c273ad021c76734a48706768d5ba6b5d217aed3f | Python | spike23/Colorboard_game | /game/views.py | UTF-8 | 3,087 | 2.90625 | 3 | [] | no_license | from django.shortcuts import render, redirect
# Create your views here.
from .forms import GameForm
from .models import GameData, GameTestInput
def index(request):
test_case = request.GET.get('input')
first_input = GameTestInput.objects.filter(pk=1).values()[0]
second_input = GameTestInput.objects.filt... | true |
b2a9ec86210ac1d8543e52687e0fe2cf4dce09d7 | Python | XiaowenLin/cs431 | /obstacle-avoidance/cameras/generic_camera.py | UTF-8 | 1,768 | 3.25 | 3 | [] | no_license | """
This module implements camera frame retrieval, used for object avoidance, for
any camera supported by OpenCV.
"""
__author__ = "Ron Wright"
__copyright__ = "Copyright 2015 Ronald Joseph Wright"
__maintainer__ = "Ron Wright"
from camera import Camera
import cv2
class GenericCameraIterator:
"""
Iterator cl... | true |
2d9e1e6e7e34d6db74c00385c4fbca06a9a8e8ab | Python | jeyasri-001/Python-internship-30-days | /Day 4/task3.py | UTF-8 | 97 | 2.515625 | 3 | [] | no_license | cinema=("hero","heroin","comedian","musicdirector")
list_cinema=list(cinema)
print(list_cinema) | true |
69f638b5adb52e0db13ee14be6eae0dbeb4d3e05 | Python | yt7589/iching | /fak/option/simulation_base.py | UTF-8 | 3,304 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #
import numpy as np
import pandas as pd
class SimulationBase(object):
''' Providing base methods for simulation classes.
Attributes
==========
name: str
name of the object
mar_env: instance of market_environment
market environment data for simulation
corr: bool
True if ... | true |
2e1e33a18d20b1561186c44428e2f741ac66f7c0 | Python | hl2055/tools | /Music/demo.py | UTF-8 | 673 | 3.171875 | 3 | [] | no_license | #1/usr/bin/env python
import music
import tunings
print "Lets find a tuning!"
t = tunings.way_low
print t
print "This is actually really fun, but would require re-stringing the guitar (trust me, I've done it, you need thick strings, and thicker skin)."
print "So lets transpose it 6-semi-tones up to D2, which is totall... | true |
347ce6102afd382d8f90d212c551953dee1e8c81 | Python | vesln/robber.py | /tests/matchers/test_types.py | UTF-8 | 4,720 | 2.875 | 3 | [
"MIT"
] | permissive | import unittest
from robber import expect
from robber.matchers.types import String, Integer, Float, List, Dict, Tuple, Non
class TestString(unittest.TestCase):
def test_matches(self):
expect(String('str').matches()).to.eq(True)
expect(String(1).matches()).to.eq(False)
def test_explanation_mes... | true |
5e5eabf60eb979cb483d2ab304d98cb2d7f2dff6 | Python | Sangdol/python-test-driven-learning | /tests/ml/test_sklearn.py | UTF-8 | 7,454 | 2.515625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
from sklearn... | true |
ab7916dfe76be00c4460882cd01b42e78d123f42 | Python | lainfec/Steganography | /decoder.py | UTF-8 | 574 | 3.03125 | 3 | [] | no_license | from PIL import Image
im = Image.open("new_img.png")
pixels = im.load()
bin_string=''
for x in range(0,im.width):
for y in range(0,im.height):
r,g,b=pixels[x,y]
bin_string+=str(r%2)+str(g%2)+str(b%2)
n=len(bin_string)
true_string=''
itr=7
while itr<n:
true_string+=chr(int(bin_string[itr-7:... | true |
3a8d4f35acf9ed5dac1b6dde58a3e94df23b6dda | Python | esix/competitive-programming | /e-olymp/0xxx/0066/main.py | UTF-8 | 768 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
import re
n = int(input())
times = []
for i in range(n):
s = input()
matches = re.match(r"(\d+):(\d+) (\d+):(\d+)", s)
hh = int(matches.group(1))
mm = int(matches.group(2))
start = hh * 60 + mm
hh = int(matches.group(3))
mm = int(matches.group(4))
end = hh * 60... | true |
74f0ee814e519d6aeaaca55544d410308f3b0dcc | Python | lekah/samos | /examples/ex2-compute-VAF-from-extxyz/compute-vaf.py | UTF-8 | 2,103 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec
from samos.analysis.dynamics import DynamicsAnalyzer
from samos.trajectory import Trajectory
from samos.plotting.plot_dynamics import (plot_vaf_isotropic,
plot_power_spectrum)
from ase.io import rea... | true |
ae9ab2a32b78e62b485162eb9fd7820ead872cf4 | Python | slad99/pythonscripts | /File Operations/Find Files Recursively By Extension/find-files-recursively-by-extension.py | UTF-8 | 1,254 | 2.921875 | 3 | [] | no_license | recPath='C:\Users\sam\Desktop'## Here mention the path to find files
Ext= '.exe'## here mention extension of the file to find
import ctypes
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection... | true |
f7457c8eae1db4bf5a8e21067c74e6ab3a399f1d | Python | P-jinsan/daoshi | /daoshi/pipelines.py | UTF-8 | 2,116 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pymysql
from twisted.enterprise import adbapi
import copy
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class DaoshiPipeline(object):
def __init__(self,dbpool):
... | true |
17656e27ecd38cc751ac716770d29bd646300102 | Python | evidaurre/AnotherTest | /mapperdata.py | UTF-8 | 1,060 | 2.859375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import sklearn
df=pd.read_csv("tda18may.csv")
#df.iloc[:,:].str.replace(',', '').astype(float)
def genderAssignment(x):
if x == "M":
return 0
if x == "F":
return 1
else:
return 0.5
df.Gender = df.Gender.map(genderAssignment)
data = df[["Am... | true |
ace31d768ade8ea53a1c3379d4787241fdf95871 | Python | haltosan/dr-worm | /portCleanup.py | UTF-8 | 424 | 2.578125 | 3 | [] | no_license | #python
a=open("lib/sshOpen","r")
sshRaw=a.read()
a.close()
lines=sshRaw.split("\n")
lines.pop(0)
for i in range(3):
lines.pop(1)
opens=[]
while True:
if(not "Nmap" in lines[0]):
break
if("open" in lines[1]):
opens.append(lines[0].split(" ")[len(lines[0].split(" "))-1])
for i in range(4):
lines.... | true |
9fcb96d8012ce6a78460beefc75f39067bcfa266 | Python | sonudoo/proxy-server | /src/response_parser.py | UTF-8 | 7,839 | 3.0625 | 3 | [] | no_license | import time,re
'''
This script prepares the response in proper format to be sent
'''
def parse(res, server_addr, absolute_path):
# Set the Server header to your own server
res.headers['Server'] = "ProxyServer/0.1"
try:
'''
!Important
The requests library automatically decompresses the response data. So ... | true |
4b3d34dcc89dc32963fc4409560040dde9425717 | Python | sinhasaroj/Python_programs | /Multithreading/MultiThreading_Advanced/synchronization1.py | UTF-8 | 1,070 | 3.6875 | 4 | [] | no_license | # If multiple threads are executing simultaneously then there may be a chance of data
# inconsistency problems.
from threading import Thread
from time import sleep
def wish(name):
for _ in range(10):
print('Good Evening:',end='',flush=True)
sleep(2)
print(name)
t1 = Thread(target=wish,ar... | true |
9ace97e4111ebf54ca1c19d9260ca76d0902c12d | Python | Aasthaengg/IBMdataset | /Python_codes/p02802/s064785579.py | UTF-8 | 327 | 2.890625 | 3 | [] | no_license | n,m = map(int, input().split())
AC = [False]*n
WA = [0]*n
for i in range(m):
p,s = input().split()
p = int(p)-1
if AC[p] == False:
if s == 'WA':
WA[p] += 1
else:
AC[p] = True
wa = 0
for i in range(n):
if AC[i]:
wa += WA[i]
print(AC.count(True... | true |
6a4309cddb039cd924bdc0e288580576223b9458 | Python | JStrbg/citisense | /spi_devices.py | UTF-8 | 1,707 | 2.984375 | 3 | [] | no_license | import pigpio
pi = pigpio.pi()
bus = pi.spi_open(0,1000000,0) #slave 0, spi bus 0, 1MHz
mic = pi.spi_open(1,48000,0) #slave 1, spi bus 0, 48KHz
refvoltage = 3.3
#Peacefully close buses
def close_bus():
pi.spi_close(bus)
pi.spi_close(mic)
pi.stop()
#Try to figure out availability, should be some noise if c... | true |
7db9f2c7ea65bcd4a2c521fbad6d3c35fe37f053 | Python | JohnRen1211/PLDassign-3 | /PLDassignfunc02.py | UTF-8 | 908 | 4.46875 | 4 | [] | no_license | print("Good morning costumer price the of an apple is 20 pesos and the orange is 25 pesos each:")
apple = 20
orange = 25
def getApples():
print(" How many apples you want to buy?: ")
applesFunc = int(input())
return applesFunc
def getOranges():
print(" How many oranges you want to buy?: ")
oranges... | true |
574658daed7b24a1540d8d15193abade5c46a6c6 | Python | KoliosterNikolayIliev/Softuni_education | /Programming_basics_2019/Nested Loops - Lab/06. Name Wars.py | UTF-8 | 328 | 3.90625 | 4 | [] | no_license | name = input()
max_sum = 0
winner_name = ''
while name != 'STOP':
current_sum = 0
for char in name:
ascii_value = ord(char)
current_sum += ascii_value
if current_sum > max_sum:
max_sum = current_sum
winner_name = name
name = input()
print(f'Winner is {winner_name} - {max_... | true |
7a36d889b8156ba11e27446a09eee8622babbf90 | Python | fernandamcohen/batch4-workspace | /S06 - DS in the Real World/BLU14 - Deployment in Real World/app.py | UTF-8 | 5,594 | 2.546875 | 3 | [] | no_license | import os
import json
import pickle
import joblib
import pandas as pd
from flask import Flask, jsonify, request
from peewee import (
Model, IntegerField, FloatField,
TextField, IntegrityError
)
from playhouse.shortcuts import model_to_dict
from playhouse.db_url import connect
#################################... | true |
92535200fb6752022c6b12c55e610ec69189d441 | Python | Drevanoorschot/xkcd-bot | /post_checker.py | UTF-8 | 863 | 2.796875 | 3 | [] | no_license | import io
import json
import requests
from discord import File
class PostCheck:
def __init__(self):
info = json.loads(requests.get('https://xkcd.com/info.0.json').text)
self.num = str(info['num'])
self.title = info['title']
self.alt = info['alt']
self.img_link = info['img'... | true |
c7a09ed410c750c459fe4c708b959c4280d848e5 | Python | muddyfish/AOC2020 | /6a.py | UTF-8 | 294 | 3.1875 | 3 | [] | no_license | with open("6.txt") as f:
lines = [[]]
for i in f.readlines():
i = i.strip()
if i:
lines[-1].append(i)
else:
lines.append([])
total = 0
for group in lines:
group_total = len(set("".join(group)))
total += group_total
print(total)
| true |
68e7e2a5a80196903b8c92046940d913bf58a5cd | Python | tomrotst/tom-j | /product.py | UTF-8 | 478 | 3.4375 | 3 | [] | no_license |
class Product():
def __init__(self,prType,price, amount):
self.prType = prType
self.price = price
self.amount = amount
def printProduct(self):
print(self.prType, self.price, self.amount)
def __repr__(self):
return ("{0} {1} {2}".format(self.prType , se... | true |
e7073b949f91af9fd7b6470d7537ca696df59d50 | Python | linghu8812/pytorch_insightface | /margin/LabelSmoothing.py | UTF-8 | 1,411 | 3.328125 | 3 | [] | no_license | import torch
import torch.nn as nn
class LabelSmoothing(nn.Module):
'''
Implement label smoothing. size表示类别总数
'''
def __init__(self, smoothing=0.0):
super(LabelSmoothing, self).__init__()
self.criterion = nn.KLDivLoss(size_average=False)
self.LogSoftmax = nn.LogSoftmax()
... | true |