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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ad018a2ac2240ba9bb186b602107fe6801ff7617 | Python | django/django | /django/contrib/gis/utils/ogrinfo.py | UTF-8 | 1,956 | 3.15625 | 3 | [
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"GPL-1.0-or-later",
"Python-2.0.1",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-permissive",
"Python-2.0"
] | permissive | """
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
"""
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.geometries import GEO_CLASSES
def ogrinfo(data_source, num... | true |
4187f390a09df691776e445a9a46ad336e9dcaaf | Python | xigrug/sqlpro | /app/core/basemodel.py | UTF-8 | 925 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : basemodel.py
# Author: jixin
# Date : 18-10-19
from enum import Enum
class Serializable(object):
class FieldNotFound(Exception):
pass
def serialize(self, fields=[]):
convert = dict()
# add your coversions for things like datetim... | true |
bff68ed500eb684764a6cd3ad45030e33acf621c | Python | 0620191/clothes-pricing | /zara/prices.py | UTF-8 | 352 | 2.84375 | 3 | [] | no_license | # Copyright Beverly Xin Chong Tan (c) 2020.
from bs4 import BeautifulSoup
def get_prices_for(file):
# Get the URL page
soup = BeautifulSoup(open(file), "html.parser")
# Find the price tags
prices = [
float(price["data-price"].replace(" USD", ""))
for price in soup.findAll("span", {"... | true |
e9c01c601c36e25656e121f49f6aa649c3396ea2 | Python | nikampe/OCR_NLP_Scanner | /segmentdistance.py | UTF-8 | 1,096 | 3.375 | 3 | [] | no_license | import math
import numpy as np
#testsegment = np.array([[10, 10], [9, 2]])
#testpoint = np.array([10,10])
#print(testpoint)
#print(testsegment)
def distancePointSegment(Segment, Point):
# defining variables from the input arrays
x = Point[0]
y = Point[1]
x1 = Segment[0][0]
y1 ... | true |
b4cb1c6d3da2f10e4b75b1d012d05344c53882b5 | Python | Alice86/StatsProgramming | /Linear_Regression tutorial.py | UTF-8 | 1,521 | 3.546875 | 4 | [] | no_license | import matplotlib.pyplot as plt
from sklearn import datasets, linear_model
# Load the iris dataset
iris = datasets.load_iris()
X = iris.data[:, :2]
y = iris.target
# Create a linear regression object
regr = linear_model.LinearRegression()
# Fit the linear regression to our data
regr.fit(X, y)
# Print model coeffic... | true |
b5b06d032ab0d68baec101efbeb9583c92b4b824 | Python | vunguyen1408/no-more-weekend | /adwords_python3/online_marketing/final/insert_GG_MCC_List.py | UTF-8 | 2,573 | 2.546875 | 3 | [] | no_license | import cx_Oracle
import json
import os
from datetime import datetime
def InsertMCCList(value, cursor):
#==================== Insert data into database =============================
statement = 'insert into ODS_GG_ACCOUNT_LIST ( \
MCC, MCC_ID, ENTITY, DEPT, STATUS, CONTACT_POINT) \
values (:1, :2, :3, :4, :5, :6... | true |
85fef606faec1f4b3798649d7830b0d416971e8c | Python | jgibbons94/cse251-course | /week09/assignment/assignment09-p2.py | UTF-8 | 5,443 | 3.765625 | 4 | [] | no_license | """
Course: CSE 251
Lesson Week: 09
File: assignment09-p2.py
Author: <Add name here>
Purpose: Part 2 of assignment 09, finding the end position in the maze
Instructions:
- Do not create classes for this assignment, just functions
- Do not use any other Python modules other than the ones included
- Each thread requi... | true |
c49de14d2836ef34baf7b3f3ca5b6b2a43090579 | Python | ferhatelmas/algo | /codechef/practice/medium/twtclose.py | UTF-8 | 229 | 2.75 | 3 | [
"WTFPL"
] | permissive | n, k = map(int, input().split())
ls = [False] * n
for _ in range(k):
s = input()
if s.startswith("CLICK"):
i = int(s.split()[1]) - 1
ls[i] = not ls[i]
else:
ls = [False] * n
print(sum(ls))
| true |
92e1b86baec080df064de8a0a0dc631d8c437a42 | Python | jinbao-x/python | /pycharm/45--匿名函数.py | UTF-8 | 406 | 4.09375 | 4 | [
"Apache-2.0"
] | permissive | # 匿名函数的用法:
fun = lambda a, b: a + b # fun在这里是引用lambda,引用完之后就可以当作函数使用了
# 也就是:自定义函数名 = lambda 参数1, 参数2, 参数3: 表达式
result = fun(1, 2)
print(result)
# 匿名函数就是没有名字的函数,匿名函数只能有一个式子
# 匿名函数常用在比较简单的操作,复杂的还是需要使用def定义
| true |
f6e21e67e39ccde0f1cf379c9c1a94c07b386c06 | Python | hhstore/learning-notes | /python/src/exercise/py35/threading_usage/ex01.py | UTF-8 | 1,003 | 3.390625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
"""
普通版本测试:
- 多线程, 并没有非多线程版本快, 受限于 GIL 影响.
"""
# 性能分析装饰器:
def profile(func):
def wrapper(*args, **kwargs):
import time
start_at = time.time()
func(*args, **kwargs)
end_at = time.time()
print("<Cost: {}... | true |
da66b9031539b4c5192f61a5ad67830cdf7fb742 | Python | jcrns/iblinkco-flask | /project/social_apis.py | UTF-8 | 2,471 | 2.5625 | 3 | [] | no_license | import pyrebase, json, requests
from flask_oauthlib.client import OAuth
import requests as rq
from bs4 import BeautifulSoup
def firebaseConnect():
# Configuring connection to database
config = {
'apiKey': "AIzaSyB-zW5qNKkTlfLzhbigIZkMWypJ4XMAAvY",
'authDomain': "cpanel-8d88a.firebaseapp.com",
'databas... | true |
af1fa0569a9979de6241ba2e296b86bd3f13380d | Python | hayaken8112/grad-experiment | /experiment.py | UTF-8 | 1,102 | 2.578125 | 3 | [] | no_license | import sys
from bottle import Bottle,route,post,request, run, HTTPResponse
import base64
import io
import simplejson as json
sys.path.append('./code')
import argparse
import collections as cl
app = Bottle()
sentences_1 = []
sentences_2 = []
@app.post('/save')
def index():
print(request.remote_addr)
jsontext =... | true |
d569b101c37ae640561444437b9bd35c6d8e9361 | Python | Tej-Singh-Rana/REPOLIST | /vm.py | UTF-8 | 1,085 | 2.84375 | 3 | [] | no_license | import os
print('''
Enter the keyword for following process :
-> Press 1 Check details of running state.
-> Press 2 Check details of all machine.
-> Press 3 To shutdown your machine.
-> Press 4 Create your own image.
-> Press 5 Create your Instance.
-> Press 6
->
->''')
press = int(input("Enter your key : "))
if pre... | true |
6f0a7c46856ba13effea795aca21671bb2749491 | Python | ritwiksahay/marine_parts | /marine_parts/apps/dashboard/bulk_price_updater/forms.py | UTF-8 | 1,846 | 2.59375 | 3 | [] | no_license | import os
from django import forms
from oscar.apps.partner.models import Partner
from django.utils.translation import ugettext_lazy as _
class ExtFileField(forms.FileField):
"""
Same as forms.FileField, but you can specify a file extension whitelist.
>>> from django.core.files.uploadedfile import SimpleU... | true |
6086a48ccc095f5360f91d9510d21a26ab140d7e | Python | ReitenSchnell/DeepLearning | /data_sources/image_utils.py | UTF-8 | 733 | 2.640625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def build_gif(imgs):
img_array = np.asarray(imgs)
h, w, *c = imgs[0].shape
interval = 0.1
dpi = 72
fig, ax = plt.subplots(figsize=(np.round(w / dpi), np.round(h / dpi)))
fig.subplots_adjust(bottom=0)
... | true |
dc0d2acfc0bfaab33f4fa76a6800be2d2dd7320a | Python | bopopescu/pythonprograms | /floatrange.py | UTF-8 | 58 | 2.734375 | 3 | [] | no_license | import numpy
for i in numpy.arange(0,5.5,.5):
print(i) | true |
7576fbdbf50b6ce03c97b047930e1cc1142df8fe | Python | daniel-reich/ubiquitous-fiesta | /53phFTw72XLmxJ7Jt_21.py | UTF-8 | 169 | 3.125 | 3 | [] | no_license |
def marathon_distance(d):
distance = 0
for miles in d:
if miles < 0:
distance -= miles
if miles > 0:
distance += miles
return distance == 25
| true |
2ae56146baf4f7bcf0d89b9318aaad8011202e17 | Python | gamersdestiny/simple-educational-purpose | /half_finished_calculator.py | UTF-8 | 608 | 3.46875 | 3 | [] | no_license | def calx():
input1 = int(input(
'''
1 2 3
4 5 6
7 8 9
'''))
operator = input('+ - * / \n')
input2 = int(input(
'''
1 2 3
4 5 6
7 8 9
'''))
print(input1, operator, input2, '=')
if operator == '+':
result = input1+input2
print(result)
elif operator == '-':
... | true |
9ea7d6bf23d3059f475a89b382988dc32c2a0ad5 | Python | diemori/leetcode | /15_3sum.py | UTF-8 | 1,431 | 3.03125 | 3 | [] | no_license | class Solution:
def threeSum(selfself, nums):
nums = sorted(nums)
result = list()
lnum = len(nums) - 1
for pos, n in enumerate(nums):
if pos + 1 == lnum:
break
start = pos + 1
end = lnum
if pos > 0 and nums[pos - 1]... | true |
4f001418f43b1550d04a97e38f22f63ea9daf852 | Python | UdayKiranDamodara/BillAllocaor | /code.py | UTF-8 | 2,136 | 2.9375 | 3 | [] | no_license | #%%
import pandas
import os
excel_name = 'NWA_Mapping_Sample.xlsx'
nwa_name ='NWAMasterCode'
emp_name = 'Mapping'
nwa = pandas.read_excel(excel_name,sheet_name=nwa_name)
emp = pandas.read_excel(excel_name,sheet_name=emp_name)
emp['NWA Code']=''
nwa = nwa.rename(columns= lambda x: x.strip())
emp = emp.rename(columns... | true |
0fb5c073519bcfe30753b0b4563cad2adb5f9975 | Python | qinacme/astro-physics-research | /other/read_fits_file.py | UTF-8 | 2,965 | 2.796875 | 3 | [] | no_license | # read star PSF from .fits file
import time
from astropy.io import fits
import numpy as np
import math
import matplotlib.pyplot as plt
image_file = 'assets/star_power831555_01.fits'
label_file = 'assets/star_info831555_01.dat'
# star_power -> HDUList (Header Data Unit)
# HDUObj -> .header .data
# Eg for .header
# ... | true |
480526ec32fec8d755f0fe6b2a85ba2a2c3c9764 | Python | ds257/COEN166_Labs | /Lab1/Part1/Ex3.py | UTF-8 | 769 | 3.375 | 3 | [] | no_license | L=[123, 'spam', 1.23] # A list of three different-type objects
len(L) # number of items in the list
L[0]
L[:-1] # Slicing a list returns a new list
L+[4,5,6] # contact/repeat make new lists too
L*2 # repeat
L # we are not changing the original list
M = ['bb', 'aa', 'cc']
M.sort()
M
M.reverse()
M
M = [[1,2,3], [4,5,6], ... | true |
a3075b54a982e6aeab3e6e22d531ac64ced8b7d5 | Python | jesusmorenop/NanoWalletBot | /seed_check.py | UTF-8 | 604 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Nano Telegram bot
# @NanoWalletBot https://t.me/NanoWalletBot
#
# Source code:
# https://github.com/SergiySW/NanoWalletBot
#
# Released under the BSD 3-Clause License
#
import hashlib, binascii
# MySQL requests
from common_mysql import mysql_select_seed
def seed_d... | true |
13f5a2aed026b02109c91c85a9625fbe7f1e3993 | Python | pombredanne/maxify | /test/test_stopwatch.py | UTF-8 | 812 | 2.546875 | 3 | [
"MIT"
] | permissive | """Unit tests for the ``maxify.stopwatch`` module.
"""
import time
from datetime import timedelta
import pytest
from maxify.stopwatch import StopWatch
def test_stopwatch():
s = StopWatch()
s.start()
time.sleep(2)
s.stop()
assert timedelta(seconds=1) <= s.total <= timedelta(seconds=2)
def tes... | true |
52b3ae28cee8d34937d22086d995ac42c1534922 | Python | pppoke/poke | /第四周-源码/源码/Atm/core/atm_api.py | UTF-8 | 13,259 | 2.515625 | 3 | [] | no_license | # Author:Game_bu
import os, functools, pickle, time, json
user_state = False
user_name = ''
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def login(user_type=False):
def out_wrapper(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
global user_state
... | true |
46882400c0b2350d976df1fbf753ceef4ebd5b16 | Python | levantocode/ONG-Software | /1. Model/Formacao.py | UTF-8 | 839 | 2.75 | 3 | [] | no_license |
class Formacao:
def __init__(self, data, horaInicio, horaFim, qtdPresente):
self.data = data
self.horaInicio = horaInicio
self.horaFim = horaFim
self.qtdPresente = qtdPresente
# - - - - - - - - - - GETS & SETS - - - - - - - - - -
##GETS
def ge... | true |
47bd4c47cbd7f8a29160c3c2db2b5558ff8ae434 | Python | LeoniekevandenBulk/Internship | /Python/find_route_per_series.py | UTF-8 | 2,905 | 2.765625 | 3 | [] | no_license | import numpy as np
# Script to create file that states the most common routes per train series
# Open files to read from
input_trainseries_file = open(
"C:\\Users\Leonieke.vandenB_nsp\\OneDrive - NS\\Data_vertragingen\\TrainseriesFromAnswerForm.txt","r")
input_trainnumbers = input_trainseries_file.readline().spli... | true |
a498d00ff2977e2c7ebdcfbee52a3ff715814474 | Python | aneeshvaidya/internet-architecture-class | /project1/simulator/examples/test_loop.py | UTF-8 | 1,957 | 2.875 | 3 | [] | no_license | """
Test routing with a link failure
Creates a topology like:
s5
/ | \
h1 -- s1 -- s2 -- s4 -- h2
\ | /
s3
Sends a ping from h1 to h2.
Waits a while.
Sends a ping from h1 to h2.
The test passes if h2 gets two pings.
"""
import sim
import sim.api as api
import sim.... | true |
4f5be03d767784cfe02e7f9ea3010c2d4f61a298 | Python | huzaifabaloch/Python_Crash_Book_Exercises | /Chap_7 - User Input And While Loop/7_6_three_exits.py | UTF-8 | 615 | 4.625 | 5 | [] | no_license |
# Use a conditional test in the while statement to stop the loop.
message = ""
while message != 'quit':
message = input("What's your name? ")
print("Hello, " + message.title())
# Use a break statement to exit the loop when the user enters a 'quit' value.
message = ""
while message != 'quit':
message = input("W... | true |
d2def26db5ce49e32c6219da1df420f02a5d57c2 | Python | kkk857i/P5P6_Line_TEST_FRAME | /samples/0328/re_demo07.py | UTF-8 | 472 | 3.546875 | 4 | [] | no_license |
#re.sub函数 用于替换字符床中的匹配项
import re
str1 = '135 7766 8899 , 湖南号码'
str1 = str1.replace(' ','')
print(str1)
str1 = '135 7766 8899 , 湖南号码'
result_01 = re.sub('\d\s+\d','',str1)
print(result_01)
result_02 = re.sub('(\d+)\s+(\d+) (\d+)',r'\1\2\3',str1) #\1\2表示()的分组
print(result_02)
# result_03 = re.sub(... | true |
dd1bfc8c9eaa0ad4b5e4b51b61299c2390a1fb4c | Python | estebanafonso/rr_simulation | /homebase_test.py | UTF-8 | 1,355 | 3.265625 | 3 | [] | no_license | import simpy
class Crew_Homebase(object):
def __init__(self, env, crew_list, min_sleep_time):
self.env = env
self.crew_at_home = simpy.Store(env)
self.min_sleep_time = min_sleep_time
for crew in crew_list:
self.crew_at_home.put(crew)
print self.crew_at_home.items... | true |
198c2d4cfab10f60dd38ea3076be743e9b64a4f0 | Python | gnsaddy/RVCE | /FirstSemester/python/employee.py | UTF-8 | 1,551 | 3.8125 | 4 | [] | no_license | # 1) WAP for employee with empid,ename,pay,email,dept and
# initilize the objects with data.Disolay the employee
# information and number of employee objects created.
# 2) setattr(obj,name,value)
# getattr(obj,attribute)
# hasattr(obj,attribute)
# delattr(obj,attribute)
class Employee:
count = 0
... | true |
694b72a4a7235983b5c6a198c97ff3a52609c3fd | Python | Dimagious/crossword-helper-bot | /parser.py | UTF-8 | 1,115 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | from bs4 import BeautifulSoup
import messages
import requests
import config
import logging
import re
logger = logging.getLogger(__name__)
def get_word(user_input):
if len(user_input.strip()) == 0:
logger.error(messages.NO_INPUT)
return messages.INPUT_PLEASE
elif not re.search('[*]', user_inpu... | true |
40a9db53862e01852542a959f06497d8ff554fcf | Python | hp77-creator/mini-projects-python | /bagels/main.py | UTF-8 | 1,676 | 3.921875 | 4 | [] | no_license | from src.helpers import getSecretNum, getClues
NUM_DIGITS: int = 3
MAX_GUESSES: int = 10
def main():
print('''
Let's Play Bagels
- A game inspired by the bagels game presented in the Al-Sweigart
Rules are pretty simple, you will have to guess {} digit number and you will
get {} tries to do that!... | true |
186230d7f6474d9681cb508f18c9f368416f2983 | Python | willianflasky/growup | /python/day07/面向对象高级.py | UTF-8 | 821 | 3.390625 | 3 | [] | no_license | #
# class Foo:
# def __init__(self,name):
# self.name=name
# def __call__(self, *args, **kwargs):
# print('====>')
# f=Foo('egon')
# f()
# class Foo:
# def __init__(self,name):
# self.name=name
# def __getitem__(self,item):
# print('getitem',self.__dict__)
... | true |
6f129592174619765ce0524a23dcb640e0e246e9 | Python | raulFuzita/py_rental_car | /src/factory/card/visacard_factory.py | UTF-8 | 368 | 2.609375 | 3 | [] | no_license | from .card_factory import AbstractCardFactory
from src.card.visacard import VisaCard
from src.util.random_date import *
import random as rd
class VisaCardFactory(AbstractCardFactory):
def make(self, holdername: str) -> VisaCard:
card = VisaCard(holdername)
card.expire_date = rand_date(3)
c... | true |
f5814a14cac21a6a84bc92c72c371ecb179231b1 | Python | timostrating/ponypicpy | /scrapers/nieuws/pipelines.py | UTF-8 | 882 | 2.90625 | 3 | [] | no_license | from sqlalchemy.orm import sessionmaker
from models import Nieuws, db_connect, create_nieuws_table
class NieuwsPipeline(object):
"""Nieuws pipeline for storing scraped items in the database"""
def __init__(self):
"""
Initializes database connection and sessionmaker.
Creates nieuws tabl... | true |
d363f6369ae9fb607cddcb0e1b4f9bab1df0194e | Python | TejaswitaW/Advanced_Python_Concept | /OOP9.py | UTF-8 | 454 | 3.46875 | 3 | [] | no_license | #use of destructor
import time
class Test:
def __init__(self):
print("I am doing initialisation")
def __del__(self):
print("I am doing cleanup activity")
t1=Test()
t2=t1
t3=t2
t4=Test()
t5=t4
print("Deleting t1")
time.sleep(5)
del t1
print("Deleting t2")
time.sleep(5)
del t2
print("Deleting t3")... | true |
d19863bfb31ce7f26ed2fb4b617e318a9a3986e8 | Python | vodp/mapcrawler | /test_mapping.py | UTF-8 | 996 | 3.15625 | 3 | [] | no_license | import os
import json
from mapping import *
def test__get_cities_by_country():
cities = get_cities_by_country('France')
assert cities is not None and len(cities) > 0, 'Do not get any city with country "France"'
cities = get_cities_by_country('abc')
assert cities is None, "Returned result should be None"
cities... | true |
2fa027cf1148b12d6026c248bdc91016f22986b2 | Python | KhalidOwlWalid/CookieProject | /datahandling.py | UTF-8 | 2,989 | 3.40625 | 3 | [] | no_license | import collections
import pandas as pd
from collections import defaultdict
class ExtractData:
def __init__(self):
self.dataFrame = pd.read_excel("cookie_project.xlsx")
def seperated_data(self):
self.name_list = self.dataFrame["Name "]
self.sender_class = self.dataFr... | true |
6afb016aee6e3ec72b0a02bf0db60d3b756a12b2 | Python | willtack/autoregulation | /code/excel_conversion/convert_excel_to_tsv.py | UTF-8 | 510 | 2.921875 | 3 | [] | no_license | import pandas as pd
import os
import sys
try:
excelfile = sys.argv[1]
except IOError:
print("No excel file specified.")
sys.exit(1)
#Read excel file into a dataframe
data_xlsx = pd.read_excel(excelfile, 'Sheet1', index_col=None)
#Replace all fields having line breaks with space
df = data_xlsx.replace('\n... | true |
c8e28db0bfe04db88e497dff2b32a2831ac42f9e | Python | vnaazleen/CS50-s-Introduction-to-Computer-Science | /pset6/hello.py | UTF-8 | 124 | 4.0625 | 4 | [] | no_license | # Prompts user to enter his input
name = input("What is your name?\n")
# Prints hello with the name
print("Hello, " + name) | true |
61ed49af215589288018cf0d999e08fc7aa84a93 | Python | acekavi/SD1-Project | /functions.py | UTF-8 | 5,866 | 3.734375 | 4 | [] | no_license | class CharInput:
def __init__(self, question, param):
self.question = question
self.param = param
def int_input(self):
while True:
try:
x = int(input(f"{self.question} : "))
if x in self.param:
return x
els... | true |
760a7b247b4eaca1d6b28111737259ae1a5bab8d | Python | 316060064/Taller-de-herramientas-computacionales | /Clases/Programas/Tarea4/Problema03S.py | UTF-8 | 319 | 3.765625 | 4 | [] | no_license | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
'''
Josue Artemio Hernandez Rodriguez, 316060064
Este programa realiza la conversion de grados
centigrados a farenheit, y viceversa.
'''
from Problema03 import grados
x = input ("¿Qué quieres convertir \n" +
"1.-Cª - Fª o 2.- Fª - Cª?: ")
x = input ("Cantidad: ")... | true |
2b67b3bc3348e5c46de200c5e1f10c9e3b6f433f | Python | gorlovjob/python_level_1_Gorlov_Andrew | /hw06_easy_Gorlov_Andrey.py | UTF-8 | 6,247 | 4.3125 | 4 | [] | no_license |
__author__ = 'Горлов Андрей Гарриевич'
# Задача-1: Написать класс для фигуры-треугольника, заданного координатами трех точек.
# Определить методы, позволяющие вычислить: площадь, высоту и периметр фигуры.
print('Задача №1')
class triangle:
def __init__(self, point1, point2, point3):
# Вводим координаты ... | true |
5a9ba6579f5e71a03b502af1f43f407b16be6114 | Python | patallen/rmndin-backend | /rmndin/rmndin/lib/verification.py | UTF-8 | 830 | 2.578125 | 3 | [] | no_license | from itsdangerous import URLSafeTimedSerializer
def serialize_key(payload, secret_key):
s = URLSafeTimedSerializer(secret_key)
return s.dumps(payload)
def deserialize_key(key, secret_key, max_age):
s = URLSafeTimedSerializer(secret_key)
return s.loads(key, max_age=max_age)
def make_verify_url(payl... | true |
a013eeaa6ca0b1b94beea7c883e65ce98aaf62ce | Python | flekschas/jupyter-scatter | /jscatter/encodings_test.py | UTF-8 | 1,948 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from functools import reduce
from .encodings import Encodings
def test_encodings():
enc = Encodings()
assert len(enc.data) == 0
assert enc.max == 2
enc.set('color', 'test')
assert len(enc.data) == 1
assert len(enc.visual) == 1
assert enc.data[enc.visual['color'].data].component == 2
... | true |
37d492a5f5b8bf8d14ac951d9981be82e73d9acf | Python | wayoalamos/artificial-intelligence-investigation | /Tarea2-Solucion/pancake_base.py | UTF-8 | 1,913 | 3.46875 | 3 | [] | no_license | import sys
import random
import copy
class Pancake:
goal = None
size = 0
def __init__(self, stack):
self.stack = list(stack)
if Pancake.size == 0:
Pancake.set_size(len(stack))
def set_size(size):
Pancake.size = size
Pancake.goal = list(range(1, Pancake.siz... | true |
fe954d80d4fa23e2154f7a518eed3c863304c35d | Python | fagan2888/monkeybot | /python-rtmbot/plugins/monkeybot/create_modules.py | UTF-8 | 2,890 | 3.046875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import csv
import codecs, cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self):
return self
def next(... | true |
5f1b995dd9b709ddfc724d051801911997adf800 | Python | dsp-uga/Hastings-p4 | /hastings/io_support.py | UTF-8 | 5,849 | 3.015625 | 3 | [
"MIT"
] | permissive | import cv2
import os
import numpy as np
def load_img(img_parent_path,hash):
'''
Load mask image
Args:
img_parent_path: parent path of the image
type: STRING
hash: hash name of the mask image
type: STRING
... | true |
19ab95bdce9d004106e1d07871ad4cedd1cda449 | Python | Yiyang-C/Data-Mining | /hw4/task6.py | UTF-8 | 2,362 | 2.734375 | 3 | [] | no_license | import sys
import numpy as np
import collections
def page_rank(matrix, d=0.8, tol=1e-2, max_iter=10000, log=False):
"""Return the PageRank of the nodes in the graph.
:param dict G: the graph
:param float d: the damping factor (teleportation)
:param flat tol: tolerance to determine algorithm convergence
... | true |
5eb5a6e3b9344c6495a1a78664ef922ad5446716 | Python | aucready/inflearn_2020 | /파이썬+실용프로젝트/14.GUI시계/clock.py | UTF-8 | 1,765 | 2.90625 | 3 | [] | no_license | from PyQt5 import QtWidgets
from PyQt5 import QtCore
class MyClock(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.mouseClick = False
self.setWindowTitle("시계")
self.initWidgets()
self.setFixedSize(250, 100)
self.setWindowFlags(Qt... | true |
2df1a01d0bb371f383b334f7656a5c718a81f632 | Python | Lee-ChongMyeong/PYTHON_Study | /Python_basic2/Day05/while02.py | UTF-8 | 116 | 3.734375 | 4 | [] | no_license | num = 1
sum = 0
while num <= 10:
sum += num
num += 1
print("1부터 10까지의 누적 합 : " + str(sum)) | true |
f7cd7fadbc174c7c5c24ac9b3a28ba7e540153c8 | Python | PumucklOnTheAir/TestFramework | /power_strip/power_strip.py | UTF-8 | 793 | 2.984375 | 3 | [] | no_license | from abc import abstractmethod
from network.remote_system import RemoteSystem
class PowerStrip(RemoteSystem):
"""
This class provides the Interface for the basic functions to manage the power strip.
"""""
@abstractmethod
def port_status(self, port_id) -> str:
"""
Returns the statu... | true |
9bf80f5f22b6ca720685556c8fa36e5e1834ec44 | Python | daniel-reich/ubiquitous-fiesta | /GGibsZwLpLQJrxw8v_19.py | UTF-8 | 293 | 2.828125 | 3 | [] | no_license |
size = 5000
A = list(range(1, size + 1))
kill = 2
while True:
A = [A[i] for i in range(len(A)) if (i + 1) % kill != 0]
kill += 1
while kill not in A and kill < A[-1]:
kill += 1
if kill > A[-1]:
break
def get_lucky_number(size, nth):
return A[nth - 1]
| true |
9b502344d648112858251791716f0bd98c84522a | Python | MarceloChaves/GLU | /src/Dados/repositorios/FuncionarioRepositorio.py | UTF-8 | 6,186 | 3.1875 | 3 | [] | no_license | from Entidades import Funcionario
def funcionario_existe(cpf,linhas):
posicao = None
for x in range(0, len(linhas)):
valores_separados = linhas[x].split(' ')
if cpf == valores_separados[0]: # verifica se o cpf é igual ao cpf no arquivo
posicao = x
return posicao
def adicionar... | true |
930e275383d4b4e6a1152cfcdf00370672d47a04 | Python | arnautovd/py_projects | /hello.py | UTF-8 | 363 | 2.953125 | 3 | [] | no_license | import unittest
from module import get_sum, print_some
class Test(unittest.TestCase):
def test_get_sum(self):
result = get_sum(10, 11)
self.assertEqual(result, 21)
def test_print_some(self):
result = print_some(12)
self.assertEqual(isinstance(result, str), True)
if ... | true |
1c076b9f2cad9cb7970613e6abacf8f77f2a0490 | Python | neandrey/checkio | /ghostFibonachi.py | UTF-8 | 891 | 3.859375 | 4 | [] | no_license | #------------------------
def fibonachi(s):
if s == 0 or s == 1:
return True
i = 1
h = 1
while 1:
z = i + h
h = i
i = z
if s == z:
print(z)
return True
if s < z:
return False
#------------------------------
def chec... | true |
2d0bad6cc76ea70d44c783b9d73a5120c058d3fe | Python | ljxgit/DataStructure | /HeapAndHeapSort/Heap.py | UTF-8 | 4,857 | 4.28125 | 4 | [] | no_license | # # -*- coding:utf-8 -*-
"""
利用Python构建一个堆,使用数组存储,定义建立堆、调整堆、维护堆(pop&push)等方法,实现堆排序、topK等应用
堆heap是一个特殊的完全二叉树,其任意结点始终不大于(不小于)其左右子结点,分别为小顶堆、大顶堆,由于完全二叉树存储效率高,不浪费空间,
所以一般用数组来描述一个堆,直接采用下标索引每个结点,节省了子结点指针空间,父结点下标为i,则其左右子结点下标分别为2*i+1、2*i+2
大顶堆:arr[i] >= arr[2i+1] && arr[i] >= arr[2i+2]
小顶堆:arr[i] <= arr[2i+1] && arr[i] <= arr[2... | true |
187df63b1d4ef02f34f193a3f6cccfd843cf83fe | Python | jayzmudka/OpenStreetMap-Data-Wrangling | /audit.py | UTF-8 | 3,019 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
from pprint import pprint as pp
from zipfile import ZipFile
samplefile = 'sample.osm'
zipfile = 'openstreetmapdata.zip'
filename = 'openstreetmapdata'
outfile = 'openstreetmapdata.json'
# uncomment the data you want to use
usefile = sam... | true |
4e440a0a49128c80818d054ad4cf743192977e4d | Python | tzahishimkin/extended-hucrl | /rllib/algorithms/bptt.py | UTF-8 | 1,722 | 2.59375 | 3 | [
"MIT"
] | permissive | """Back-Propagation Through Time Algorithm."""
from rllib.value_function.model_based_q_function import ModelBasedQFunction
from .abstract_algorithm import AbstractAlgorithm
class BPTT(AbstractAlgorithm):
"""Back-Propagation Through Time Algorithm.
References
----------
Deisenroth, M., & Rasmussen, ... | true |
0d137c56fa9498a8b63851deca88a955259bb64c | Python | AlexJeannot/Python_bootcamp | /python_week/python_day00/ex09/guess.py | UTF-8 | 1,080 | 4.03125 | 4 | [] | no_license | import random
def main():
nb = random.randint(1, 99)
cmp = 0
while 1:
user_nb = input("What's your guess between 1 and 99?\n>> ")
try:
user_nb = int(user_nb)
if user_nb > 0 and user_nb < 100:
if (nb == user_nb):
if (nb == 42):
... | true |
e69ad78bc29ec485c58c3796fb0c614f4874837f | Python | ekambareswaran-j/PythonRepository | /GetInput_exercise.py | UTF-8 | 99 | 3.8125 | 4 | [] | no_license | name=input('Enter your name')
color = input('What color do you like')
print(name, 'likes', color) | true |
5467ae3593dcef61e8ac25db558f3ade81636220 | Python | ETspielberg/sdg_query_execution | /model/SdgSlice.py | UTF-8 | 3,830 | 2.6875 | 3 | [
"MIT"
] | permissive | import math
import xml.etree.cElementTree as ElementTree
from model.Point import Point
class SdgSlice:
@property
def svg_element(self):
return self._svg_element
@property
def svg_path(self):
return self._svg_path
@property
def color(self):
return self._color
de... | true |
7c79bee201927d17dce7de8d05c760c66c8ef6fe | Python | xenndy/stepik-selpy-homework | /unit2/u2_lesson2_task3.py | UTF-8 | 1,604 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://stepik.org/lesson/228249/step/8?unit=200781
# Задание: загрузка файла
# В этом задании в форме регистрации требуется загрузить текстовый файл
from selenium import webdriver
import os
import time
try:
link = "http://suninjuly.github.io/file_input.html"
... | true |
25628fe872ea6c7604f0a9dc9f939ef588d6ff02 | Python | sereneliu/AoC-2018 | /day11.py | UTF-8 | 5,733 | 4.40625 | 4 | [] | no_license | # --- Day 11: Chronal Charge ---
# You watch the Elves and their sleigh fade into the distance as they head toward the North Pole.
# Actually, you're the one fading. The falling sensation returns.
# The low fuel warning light is illuminated on your wrist-mounted device. Tapping it once causes it to project a hologram... | true |
d6b48b9ae52b6ba0b9e8226e6b978ad63843a3e8 | Python | pragmatictester/vcard | /vcard21_maker.py | UTF-8 | 5,599 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
""" Generate a vCard in the vCard 2.1 file format """
__author__ = "Parul Mathur"
__email__ = "parul@pragmatictester.com"
import sqlite3
import os
import sys
import random
from datetime import datetime, time, timedelta
from PIL import Image, ImageDraw, ImageOps
import base64
import StringIO
#... | true |
37dd4df1474c129b0726f26c7155a0839befc6ea | Python | seema200/babies_names_project | /q01_create_dict/build.py | UTF-8 | 283 | 2.875 | 3 | [] | no_license | # %load q01_create_dict/build.py
import pandas as pd
path = 'data/babies_name.csv'
data = pd.read_csv(path,names=['Name', 'Gender', 'Count', 'Year'])
def q01_create_dict(data):
dic = dict(zip(data.Name, data.Count))
print(type(dic))
return dic
q01_create_dict(data)
| true |
217c7f6c9e3c49b00ab1e2356e15fa71aad65586 | Python | 64octets/BitcoinTracker-python | /bitcoin/utilities/weighted_average.py | UTF-8 | 2,782 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/python
#
#
# Copyright 2014 Abid Hasan Mujtaba
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | true |
38a78df2426a4d2bc6981e373e86e100ba4da751 | Python | DavidShelbs/Speed-Reader | /main.pyw | UTF-8 | 25,827 | 2.828125 | 3 | [] | no_license | import time
import os
import pygame
from time import sleep
import sys
from pygame.locals import *
import tkFileDialog as filedialog
from Tkinter import *
import Tkinter as ttk
from ttk import *
#set constant variables
SCREEN_WIDTH = 144
SCREEN_HEIGHT = 256
SCALE = 2
color = (255, 255, 255)
#set variables
i = 0
def ... | true |
d58243422329e23a959327b4542b0e73dbf6c59f | Python | El3ct71k/Sandworm-Detector | /sandwormdetector.py | UTF-8 | 946 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = 'El3ct71k'
import os
import re
import zipfile
from argparse import ArgumentParser
def sandworm_detactor(name):
if not os.path.exists(name):
print("File not found")
exit(-1)
files = list()
try:
with zipfile.ZipFile(name, 'r') as z:
for f in ('ppt/embeddings/oleObject1.bi... | true |
f616c7d2c72afb8a8755f9c2c295dd9c99caad3c | Python | kapilchandrawal/War-Game | /war.py | UTF-8 | 2,578 | 3.71875 | 4 | [] | no_license | from random import shuffle
suite = 'H D S C'.split()
ranks = '2 3 4 5 6 7 8 9 10 J Q K A'.split()
class Deck:
def __init__(self):
self.deck_cards = [(s,r) for s in suite for r in ranks ]
def shuffle(self):
shuffle(self.deck_cards)
def split_in_half(self):
return (self.deck_cards[:... | true |
c0ff6117cf410a63a743467c6d9e45de59f14eb0 | Python | KBVijayVarma/papers | /jee/linalg/3d/codes/5.2.py | UTF-8 | 1,481 | 2.671875 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from funcs import *
import numpy as np
#if using termux
import subprocess
import shlex
#end if
#creating x,y for 3D plotting
xx, yy = np.meshgrid([-2,2], [-2,2])
#setting up plot
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d',aspect=... | true |
8d8c8afcfdfeb870e4aef643b744b044430f8d43 | Python | Ivan252512/TallerDeModelacion | /Practica4/practica5_ejercicio1.py | UTF-8 | 2,255 | 3.578125 | 4 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
#f=función que recibe
#a=cota inferior
#b=cota superior
#N= numero de iteraciones
#IV=valores iniciales
def heun( f, a, b, N, IV ):
h = (b-a)/float(N)
t = np.arange( a, b+h, h )
w = np.zeros((N+1,))
t[0], w[0] = IV
for i in range(1,N+1... | true |
46c797478af17e573d17b44c1408b8e0aa48c6bd | Python | baby-factory/baby-ai | /main.py | UTF-8 | 3,197 | 2.6875 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
#这里放置主程序以及IO
from numpy import *
from utils.tools import loadvoc
from keras.models import Sequential,load_model,Model
from keras.layers import Input, Embedding, LSTM, Dense, merge, RepeatVector,TimeDistributed,Masking
from keras.optimizers import SGD,Adam
from keras.utils.np_utils import to_categorica... | true |
455c27c4cc8c81905e5608facd465a5c1d54d2b8 | Python | kunalyadav0954/Neural_Nets | /neural_nets.py | UTF-8 | 41,228 | 3.484375 | 3 | [] | no_license |
import numpy as np
import h5py as h5
import math
import matplotlib.pyplot as plt
def load_data(fname,dataset):
"""
loads a specified data set from a hdf5 file
:param fname: location of the hdf5 file from where data is to be loaded ex: folder/fname.hdf5
:param dataset: name of the dataset to be loaded... | true |
23791ac681b6356876efb1e4142fa5aa7d235894 | Python | alexbruckner/primematrix | /primes.py | UTF-8 | 3,116 | 3.203125 | 3 | [] | no_license | import sys
from colorama import init, Fore, Back, Style
def get_prime_list(max_number):
#create some constants
max_plus_1 = max_number + 1
max_plus_1_div_2 = max_plus_1 / 2;
#create list of integers
integers = []
for position in xrange(max_plus_1):
integers.append(position)
#set no... | true |
6535a9d9460472d189a8aca1a0b057e8a4660a74 | Python | dominic-domingo/leaguechatbot | /lol_commands.py | UTF-8 | 8,759 | 2.75 | 3 | [] | no_license | import requests
import api
from lol_data import champions
import time
roles = {"TOP": ("top", "Top"),
"JUNGLE": ("Jungle", "jungle", "jg", "jung"),
"MIDDLE": ("Middle", "middle", "Mid", "mid"),
"DUO_CARRY": ("ADC", "adc", "AD", "ad" "Bot", "bot"),
"DUO_SUPPORT": ("Support", "support... | true |
bcf89cc86f232dd8a527aa40661ca81dcbd28170 | Python | belgorodtsev/lab_ITIB | /lab06.py | UTF-8 | 8,483 | 3.03125 | 3 | [] | no_license | import requests
import json
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Данные колледжей
# https://data.mos.ru/opendata/546
# Цвета для центров - округов москвы
COLORS = ['y', 'b', 'r', 'g', 'c', 'm', 'lime', 'gold', 'orange', 'coral', 'purple', 'grey']
DISTRICT = {"Восточный администрат... | true |
ff355790f6d71148e01655a035f60fc512420f2e | Python | chenxu0602/LeetCode | /2171.removing-minimum-number-of-magic-beans.py | UTF-8 | 300 | 2.625 | 3 | [] | no_license | #
# @lc app=leetcode id=2171 lang=python3
#
# [2171] Removing Minimum Number of Magic Beans
#
# @lc code=start
class Solution:
def minimumRemoval(self, beans: List[int]) -> int:
return sum(beans) - max((len(beans) - i) * n for i, n in enumerate(sorted(beans)))
# @lc code=end
| true |
4c1902d4d947ef1c45f5b8e1751aa820c0fe5514 | Python | aquarioos/dvik-print | /dvik_print/dvik_print.py | UTF-8 | 5,641 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
import inspect
import os
class PrettyPrint(object):
def __init__(self, tab=4, head=2, tail=1, max_str_len=100, filename=None, show_line=False):
self.tab = tab
self.head = head
self.ta... | true |
8ae28b449ab4b53cf15d0e2fb1a35df65030f665 | Python | BioMapOrg/biomap-utils | /biomap/utils/http.py | UTF-8 | 747 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | import os
import requests
class HTTPSConsumer:
def __init__(self, local_path, verbose=True):
self.local_path = local_path
self.verbose = verbose
def download(self, baseurl, filename, force=False):
local_file = os.path.join(self.local_path, filename)
if not force and os.path.isf... | true |
4f52da3cfe1c6ceb8e3e861f463b601565e042c0 | Python | coder-surendra/leetcode | /easy_mySolutions_py/pascalsTriangle.py | UTF-8 | 570 | 4.09375 | 4 | [] | no_license | # https://leetcode.com/problems/pascals-triangle
def pascalTriangle(n):
if(n == 0):
return []
i = 0
myList = [[1]]
# using n-1 , because we already starting with first entry i.e. [1]
while(i < (n-1)):
k = 0
lastEntry = myList[-1]
newEntry = []
newEntry.ap... | true |
71d1cfd73e8fc4af3b72668b7c5f9156c43acdcf | Python | ThakkarDhrumil/Demo_Python-proj | /temp.py | UTF-8 | 1,829 | 3.453125 | 3 | [] | no_license | __author__ = 'Dhrumil'
__author__ = 'Dhrumil'
anumber = 15040010
account = []
cousomer = []
balance=0
d={}
def create_account(anumber):
name = input("Enter your name=")
ia = int(input("Enter initial amount to open account="))
print("Your account number")
balance=ia
anumber= anumber +1
d[anumbe... | true |
342d5841b182d4a038abb877c1a7effa2a4d24e1 | Python | fattybobcat/telegram_ChGK_bot | /datab.py | UTF-8 | 1,568 | 3.15625 | 3 | [
"MIT"
] | permissive | import sqlite3
test_bd = 'testdb.sqlite3'
class BDBot():
def __init__(self):
self.con = sqlite3.connect(test_bd)
with self.con:
self.cur = self.con.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS game ("
"id INTEGER PRIMARY KEY,"
... | true |
b1855bb895bb6f78b0d604a8845c781354716921 | Python | nimit0703/Nearly-similar-Rectanggles-hackerrank- | /python.py | UTF-8 | 493 | 3.1875 | 3 | [] | no_license | def getCount(rows, columns, A):
res = 0
for i in range(rows):
for j in range(i + 1, rows, 1):
if (A[i][0] * A[j][1] ==
A[i][1] * A[j][0]):
res += 1
return res
if __name__ == '__main__':
rows = int(input())
... | true |
2e4baa566868a7c3093ad366102f6e034ab584f4 | Python | kingl4166/CTI-110 | /P3LAB_King.py | UTF-8 | 652 | 3.734375 | 4 | [] | no_license | # CTI-110
# P3TLAB: Debugging
# Lafayette King
# 2/28/2018
# program starts
def main ():
# This program takes a number grade and outputs a letter grade.
# system uses 10-point grading scale
A_score = 90
B_score = 80
C_score = 70
D_score = 60
score = int(input('Enter... | true |
1c10b92f37ef7adf1b090aa32fa180b64701e71d | Python | Mbank8/DojoAssignments | /Python/flask/dojo_survey/server.py | UTF-8 | 893 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, session, flash
app = Flask(__name__)
app.secret_key = "Thisisabigsecret"
@app.route('/')
def index():
return render_template('index.html')
@app.route('/result', methods=['post'])
def results():
errors = False
if len(request.form['name']) < 1:
... | true |
851ca0c30beb7ef486cb0a2a5efbb1e58427bbb9 | Python | AlinesantosCS/vamosAi | /Módulo - 2/Módulo 2-4 - São tantas emoções, bicho!/pilha.py | UTF-8 | 140 | 3.671875 | 4 | [] | no_license | # LIFO - Last in , first out -> Pilha
stack = []
stack = [1,2,3,4,5,6]
print(stack)
stack.append(7)
print(stack)
stack.pop()
print(stack) | true |
f13135046196a5950d45173c5d4b3b9bb17ad027 | Python | markodraisma/lpp_uitwerkingen | /desktop/English/moneyexcept.py | UTF-8 | 1,840 | 4 | 4 | [] | no_license | #!/usr/bin/env python3
class Money(object):
""" a Money class. Keeps track of entires and cents.
This class supports calculations.
"""
def __init__(self, entire, cent):
""" initialize a Money object
entire: entire euros
cent: cents
"""
self.entire=entire
... | true |
63b2bd90d01ec290bfeeb83e775bf91bba41454e | Python | hamie96/CS-4720-Internet-Programming | /In Class Code/in_class_190115/bankAccount.py | UTF-8 | 564 | 3.578125 | 4 | [] | no_license |
class bank_account:
def __init__(self, balance=0):
self.balance = balance
def withdraw(self, amount):
if amount > 0 and amount < self.balance:
self.balance -= amount
def deposit(self, amount):
if amount > 0:
self.balance += amount
def ... | true |
4e3a03e967a70cfa57d71ce51cea0d50c79c81a4 | Python | nicholask98/assignments-from-coder-pete | /3-2/test.py | UTF-8 | 116 | 3.515625 | 4 | [] | no_license | class Person:
name=""
money=0
bob = Person()
bob.name = 'Bob'
print (bob.name,"has", bob.money,"dollars.")
| true |
b493ed3e9e1a2475af03acdb0983dc0306057e6d | Python | joyzoso/Python | /EndOfPythonDrills/datetime27PLN.py | UTF-8 | 990 | 3.140625 | 3 | [] | no_license | import datetime
import time
pdx_local = datetime.datetime.now()
pdx_local_hour = pdx_local.hour
print (pdx_local.strftime("The local time in Portland is %I:%M%p"))
nyc_local = datetime.datetime.now() + datetime.timedelta(hours = 3)
nyc_local_hour = nyc_local.hour
print (nyc_local.strftime("The local time in NYC is %... | true |
7e6aadcfb2f626707b4d44ea081cc6dbe33b5fd8 | Python | jdvelasq/techminer | /src/core/corpus_filter.py | UTF-8 | 601 | 2.515625 | 3 | [
"MIT"
] | permissive | import pandas as pd
def corpus_filter(data, clusters, cluster):
data = data.copy()
data["SELECTED"] = False
column = clusters[0]
members = set(clusters[1][cluster])
data["COLUMN"] = data[column].copy()
data["COLUMN"] = data.COLUMN.map(lambda w: set(w.split(";")), na_action="ignore")
data[... | true |
62ce42ae9ed8c73faa6a6cd813f414234caa25c5 | Python | michaelvitello/python-exercises | /exercise-8.py | UTF-8 | 421 | 4.03125 | 4 | [] | no_license | # Function to count capital letters in a file
# First, need to open and read (r mode only) text file
# Second, create counter then count and print number of capital letters
path = '/Users/michaelvitello/Desktop/text.txt' #change your file path accordingly
text_file = open(path, 'r')
text = text_file.read()
uppercas... | true |
800ebca9f93ec7e352934383b7ea909006190a7e | Python | Aasthaengg/IBMdataset | /Python_codes/p03837/s548196764.py | UTF-8 | 747 | 2.859375 | 3 | [] | no_license | #隣接する点へいく最短経路で使われないことが必要。かつ十分
n,m = map(int, input().split( ))
Ad = [[] for _ in range(n)]
for _ in range(m):
ai,bi,ci = map(int, input().split( ))
ai -= 1
bi -= 1
Ad[ai].append((bi,ci))
Ad[bi].append((ai,ci))
dp = [[10**10 for i in range(n)] for j in range(n)]
for i in range(n):
dp[i][i] = 0
... | true |
629e72d78fc35df2258ee25303734ee5fe423dfa | Python | KevinCarpricorn/INFO1910 | /C coding/workspace/menu.py | UTF-8 | 11,139 | 3.359375 | 3 | [] | no_license | import py_functions
import translation
import os
# Determine if a string is an integer
def isinteger(x):
try:
x = int(x)
return isinstance(x, int)
except ValueError:
return False
def ask_indexofimage1():
while True:
image1 = input('What is the index of the... | true |
489802453d9217cd498b51eaffd69bdc4990d862 | Python | OleksaRiabukha/US_exports_inspections | /output.py | UTF-8 | 3,634 | 2.78125 | 3 | [] | no_license | from data import Grains
from text_generator import text_generator
import pandas as pd
# sets grains types, which will be used to generate output
grains_type = ["WHEAT", "CORN", "SOYBEANS"]
# aggregates the text and files, which will be sent to email
def generate_output(list_of_grains):
wheat_text = ""
corn_te... | true |
3db4c175d82c2493fad6d939e93f7e62a3df9974 | Python | UWPCE-PythonCert/Py300 | /Examples/testing/wikidef/solution/define.py | UTF-8 | 255 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Script to contact Wikipedia and get articles on a specified topic.
python define.py interesting_topic
"""
import sys
from definitions import Definitions
title = sys.argv[1]
print(Definitions.article(title).encode('utf-8'))
| true |
607ee38fcc1a172bca7fa355f9ee26e4f0702831 | Python | Alexanderklau/Algorithm | /Everyday_alg/2021/10/2021_10_19/submissions.py | UTF-8 | 1,126 | 3.71875 | 4 | [] | no_license | # coding: utf-8
__author__ = 'Yemilice'
"""
请实现一个函数,用来判断一棵二叉树是不是对称的。如果一棵二叉树和它的镜像一样,那么它是对称的。
例如,二叉树 [1,2,2,3,4,4,3] 是对称的。
1
/ \
2 2
/ \ / \
3 4 4 3
但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:
1
/ \
2 2
\ \
3 3
示例 1:
输入:root = [1,2,2,3,4,4,3]
输出:true
示例 2:
输入:root = [1,2,2,null,... | true |