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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8fbaa4e72f429178e0f7eaeec72fc1c7381189b9 | Python | drstrange11/code | /pro_28.py | UTF-8 | 149 | 2.921875 | 3 | [] | no_license | #28
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=0
c1=0
for i in range(len(l)):
if l[i]>=s:
c1=c1+1
s=s+l[i]
print(c1)
| true |
6955f4d949deefa243d5b5ac22ac44adefeb7043 | Python | Infratek/Antrian | /loket3_3.py | UTF-8 | 217 | 2.546875 | 3 | [] | no_license | while True:
path = '/var/www/html/audio_counter/data3.txt'
loket_3 = open(path,'r')
lihat = loket_3.read()
data = int(lihat)
#writeNumber(data)
print ("Pin 09 Next")
print (data)
loket_3.close()
time.sleep(1) | true |
f18befa3c9f590fbeeb9dea268b48b1db35ad439 | Python | Aasthaengg/IBMdataset | /Python_codes/p02762/s590380418.py | UTF-8 | 1,399 | 3.53125 | 4 | [] | no_license |
class DisjointSet:
def __init__(self, N):
self.parents = [i for i in range(N)]
self.size = [1]*N
def find_parent(self, x):
path = []
while self.parents[x] != x:
x = self.parents[x]
path.append(x)
for p in path:
self.parents[p] = x
... | true |
f346fa912a88930e3e772bcf89ac449951e0e6d1 | Python | aimhigh53/AlgoWing | /Goni/programmers/programmers_๊ตฌ๋ช
๋ณดํธ.py | UTF-8 | 1,052 | 3.078125 | 3 | [] | no_license | def solution(people, limit):
answer=0
#ํผ์๋ฐ์ ๋ชปํ๋ ์ฌ๋๋ค ๋บ
#people.sort(reverse=True)
# for i,each in enumerate(people):
# if limit-40>=each:
# answer+=i
# break
# people=people[i:]
#์์๊บผ๋ก ํ๋ฉด ์ ํ์ฑ 55์ ํจ์ธ์ฑ ๋นต์
#์๋๊บผ๋ก ํ๋ฉด ์ ํ์ฑ ๋ค๋ง๊ณ (75) ํจ์จ์ฑ๋์ 85
for i,each in enumerate... | true |
b95458e49b1ad8df9cf2bbf22bbac63f847f8ac8 | Python | daniel-reich/ubiquitous-fiesta | /tgd8bCn8QtrqL4sdy_13.py | UTF-8 | 386 | 3.515625 | 4 | [] | no_license |
def minesweeper(grid):
for r in range(len(grid)):
for c in range(len(grid[0])):
if grid[r][c]=="?":
tempval=0
for a,b in [(1,0),(-1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1)]:
if r+a>=0 and c+b>=0 and r+a<len(grid) and c+b<len(grid[0]):
if grid[r+a][c+b]=="#":
... | true |
bc6961e507c779f9ea8943a5c02300efffe99feb | Python | akscram/lollipop-jsonschema | /tests/test_jsonschema.py | UTF-8 | 11,434 | 2.71875 | 3 | [
"MIT"
] | permissive | import lollipop.types as lt
import lollipop.validators as lv
from lollipop_jsonschema import json_schema
import pytest
from collections import namedtuple
class TestJsonSchema:
def test_string_schema(self):
assert json_schema(lt.String()) == {'type': 'string'}
def test_string_minLength(self):
... | true |
62c7b40b4e01dea6ae580d4c004f9115173aa286 | Python | tisnik/python-programming-courses | /Python2/examples/tkinter/18_theme_selection.py | UTF-8 | 1,140 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# vim: set fileencoding=utf-8
import tkinter
from tkinter import ttk
import sys
def exit():
sys.exit(0)
root = tkinter.Tk()
style = ttk.Style()
style.configure("Red.TButton", background="#ff8080")
button1 = ttk.Button(root, text="clam", command=lambda: style.theme_use("clam"))
button... | true |
19b0ec26edb096032c184ce9fff3a7fc70d4d11c | Python | pefoley2/cmsc424-fall2015 | /project4/testing.py | UTF-8 | 5,932 | 3.1875 | 3 | [] | no_license | import math
from disk_relations import *
from btree import *
from queryprocessing import *
from create_sample_databases import *
from grading import *
import sys
# Create a sample database
db1 = createDatabase1("univ")
db1.getRelation("instructor").printTuples()
db1.getRelation("department").printTuples()
db1.getIndex... | true |
2831ec3873215cbd160e09dbfc5235af5e6251d4 | Python | bao-ho/Python-Snake-Game | /snake.py | UTF-8 | 2,532 | 3.34375 | 3 | [] | no_license | from turtle import Turtle, Screen
SHAPE = "circle"
COLOR = "green"
BABY_LENGTH = 10
STAMP_SIZE = 20
FOOD_EATEN = True
class Snake:
def __init__(self, width):
self.segment_size = width
self.relative_size = self.segment_size/STAMP_SIZE
self.segments = []
for i in range(BABY_LENGTH):
... | true |
c7b2a32a3b7a6455b81568e6dc8dc2afbd4579a7 | Python | shaunagm/trust-rank | /src/ratings/lib/algorithms/statementtrust.py | UTF-8 | 1,022 | 3.125 | 3 | [] | no_license | from ratings.models import Rating
conf = ["version_0001"]
def version_0001(statement):
'''Super simple first algorithm: Get all raters, weight by rating of raters'''
ratings = statement.get_ratings()
# If no ratings, return default .5
if not ratings:
return .5
# Create dict of ratings to w... | true |
74ca0f282901ab6700ef75e71fbaa04d9e938d68 | Python | tlechien/PythonCrash | /Chapter 6/6.5.py | UTF-8 | 705 | 4.53125 | 5 | [] | no_license | """
6-5. Rivers: Make a dictionary containing three major rivers and the country
each river runs through. One key-value pair might be 'nile': 'egypt'.
โข Use a loop to print a sentence about each river, such as The Nile runs
through Egypt.
โข Use a loop to print the name of each river included in the dictionary.
โข Use a ... | true |
2245a0d8bb345b36f0142c2ee849d40c96e1f5f2 | Python | Marcus1911/MULTIFLOW | /matrix_optimizate.py | UTF-8 | 3,581 | 2.609375 | 3 | [] | no_license | """
Marcus Sandri
Universidade Federal de Sao Carlos
Este codigo monta a topologia fora do Handle_PacketIn() e
v. Beta 1.0
"""
#import matplotlib.pyplot as plt
#from collections import *
import networkx as nx
#import numpy as np
#import matplotlib.pyplot as plt
#import pylab
#import itertools
#import hashlib as ha... | true |
8156500dc58fd029fbdb932c5b56d214abdb40e4 | Python | TAMU-IEEE/programming-101-workshop | /Workshop 2/looping_1.py | UTF-8 | 454 | 4.375 | 4 | [] | no_license | ''' Write a loop that prints all odd integers from 0 to a user picked limit.
Test Suite:
inputs: output: domain:
3 1 3 Positive Integers
0 Zero (border case)
-5 We won't deal with these either, lol '''
# Getting a number from the user
num = int(input("Enter a number:"))
# Start at 1, step by 2, go until j... | true |
e2bc5c3369a47dd7d50e9238c213e8ea41588e77 | Python | nazna/archives | /competitive-20201107/atcoder/atcoder_beginner_contest/abc116/c_grand_garden.py | UTF-8 | 120 | 2.78125 | 3 | [] | no_license | N = int(input())
count = 0
p = 0
for h in map(int, input().split()):
count += max(0, h-p)
p = h
print(count)
| true |
c0750d543d39b8d889a5ec8b7022027a4928a520 | Python | dcos/dcos | /gen/tests/test_service_account.py | UTF-8 | 4,784 | 2.640625 | 3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-oracle-bcl-javase-javafx-2012",
"ErlPL-1.1",
"MPL-2.0",
"ISC",
"BSL-1.0",
"Python-2.0",
"BSD-2-Clause"
] | permissive | import uuid
import cryptography.hazmat.backends
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from gen.tests.utils import validate_error, validate_error_multikey, validate_success
cryptography_default_backend = cryptography.hazmat.backends.default... | true |
e128e124a5051eb01d2a1470df63b510dc64884e | Python | kn9ts/biblicol | /biblicol/utilities/helper.py | UTF-8 | 5,199 | 2.921875 | 3 | [] | no_license | import re
import operator
class Helper(object):
default_book = "matthew"
books = {
"total_books": 66,
"old_testament": [
"genesis", "exodus", "leviticus", "numbers", "deuteronomy",
"joshua", "judges", "ruth", "samuel", "2 samuel",
"1 kings", "kings", "chron... | true |
e337b38b7e5a6d10fc96fe3555f9285aa70a146a | Python | JohnLi2012/LitigationSupport | /Scripts/bates_range_generator/script.py | UTF-8 | 2,810 | 3.65625 | 4 | [
"MIT"
] | permissive | import re
## function that extracts numbers from a bates
## if prefix doesnt include number, the result will return a list with single itme
## if prefix inluces a number, for example like 'ABC-3-ddd-000232',
## the return result will be like ['3','000232']
## please note all returned results are list of strings that o... | true |
7526c2c3d24a69731f7d81ac967d9344e2ce8fff | Python | Tubasatan/statblockcreator | /xmlparser.py | UTF-8 | 474 | 2.828125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import argparse
def createSoup(xml_source):
soup = BeautifulSoup(open(xml_source), "lxml")
print soup.find_all('monster')[33].prettify()
def parseArgs():
parser = argparse.ArgumentParser(description = 'reads monster data from xml')
parser.add_argument('--filename', '-f'... | true |
c3914156628f6930618d72ae8baaa3a7146cb57b | Python | atoultaro/right_whale_upcall_net | /dsp/abstractstream.py | UTF-8 | 2,849 | 3.15625 | 3 | [] | no_license | '''
Created on Aug 21, 2017
@author: mroch
'''
from abc import abstractmethod, ABCMeta
import math
class Streamer(object):
'''
streamer - An abstract class for streaming signals
'''
__metaclass = ABCMeta
@abstractmethod
def __init__(self):
'''
streamer - Abstr... | true |
a157c16c40a63d679505bac182a60da86a464cff | Python | k8440009/Algorithm | /leetcode/215. Kth Largest Element in an Array_4.py | UTF-8 | 264 | 3.09375 | 3 | [] | no_license | """
๋ฐฐ์ด์ K๋ฒ์งธ ํฐ ์์
์ ๋ ฌ์ ์ด์ฉํ ํ์ด : ์
๋ ฅ๊ฐ์ด ๊ณ ์ ๋์ด ์๊ธฐ ๋๋ฌธ
"""
from typing import List
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
return sorted(nums, reverse=True)[k - 1] | true |
f7f1cce3c2abc0969933c1134664c53ba52626e0 | Python | jeremyCtown/data-structures-and-algorithms | /challenges/fifo-animal-shelter/stack.py | UTF-8 | 936 | 3.953125 | 4 | [
"MIT"
] | permissive | from node import Node
class Stack:
def __init__(self, iterable=[]):
self.top = None
self._size = 0
def __len__(self):
return self._size
def __repr__(self):
return '<head> => {}'.format(self.top.val)
def push(self, val):
"""
creates new node and pushes... | true |
a2ea616c41f2da5583464422889319cb3eaf371e | Python | miguelzeph/Python_Git | /2020/08_Flask/09_datastorm_site/__init__.py | UTF-8 | 1,512 | 2.578125 | 3 | [] | no_license | from flask import (
Flask,
render_template,
redirect,
session, # Quem faz as transferรชncias de informaรงรตes entre as funรงรตes
url_for,
flash
)
from form import *
import os
app = Flask(__name__)
app.config['SECRET_KEY'] = 'mykey'
#Dica: SHIFT+CTRL+R atualizar pรกgina deletando cache
@app.rou... | true |
78c03e0bb36e6c8cc579cba2a5fd90fb9809bd06 | Python | varunkumar415/Leetcode | /solutions/496-next-greater-element-i/next-greater-element-i.py | UTF-8 | 2,004 | 3.890625 | 4 | [] | no_license | # You are given two integer arrays nums1 and nums2 both of unique elements, where nums1 is a subset of nums2.
#
# Find all the next greater numbers for nums1's elements in the corresponding places of nums2.
#
# The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does ... | true |
4419878af490c44bbbd4d2102b7ecdb06ce65860 | Python | mohanbabu2706/100 | /2020/December/14-Dec/customimportname.py | UTF-8 | 340 | 2.84375 | 3 | [] | no_license | #game.py
#import the draw module
if visual_mode:
#in visual mode we draw using graphics
import draw_visual as draw
else:
#in extual mode,we print out text
import draw_textual as draw
def main():
result = play_game()
#this can eiter visual or textual depending on visual_mode
draw... | true |
63362bb9df1d9b9df9f29a2b33ddc8fe94357bab | Python | Micah-Zhang/CSCI_2824_Discrete_Structures | /homework3b.py | UTF-8 | 211 | 2.953125 | 3 | [] | no_license | def first_D_digit_Lucas(D):
list = [0,1]
index = 1
length = 1
while length < D:
newnum = list(index) + list(index-1)
length = len(str(newnum))
list.append(newnum)
index = index + 1
return newnum
| true |
d30321606eb96745970598d3f7124957c795772a | Python | aureliewouy/AirBnB_clone_v3 | /api/v1/views/cities.py | UTF-8 | 2,599 | 2.75 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python3
"""
A new view for City objects that handles all default RestFul API actions
"""
from flask import Flask, abort, make_response, jsonify, request
from models import storage
from api.v1.views import app_views
from models.state import State
from models.city import City
@app_views.route('/states/<stat... | true |
6a03a2908254a5745f7c53adaa50491b3bc9d5d5 | Python | qamine-test/codewars | /kyu_7/maximum_multiple/test_maximum multiple.py | UTF-8 | 2,467 | 3.53125 | 4 | [
"Unlicense",
"BSD-3-Clause"
] | permissive | # Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
import unittest
import allure
from utils.log_func import print_log
from kyu_7.maximum_multiple.maximum_multiple import max_multiple
# FUNDAMENTALS NUMBERS BASIC LANGUAGE FEATURES ARRAYS LOOPS CONTROL... | true |
ee3a1d811d4b601043bdb2461f1998885f173f71 | Python | GunnerLab/Develop-MCCE | /bin/geometry.py | UTF-8 | 584 | 3.625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
import math
def d2vv(v1, v2):
"""Squared distance between two vectors"""
dx = v1[0] - v2[0]
dy = v1[1] - v2[1]
dz = v1[2] - v2[2]
return dx*dx+dy*dy+dz*dz
def dvv(v1, v2):
"""Distance between two vectors"""
return math.sqrt(d2vv(v1,v2))
def inrad(v1, v2, r):
"""A... | true |
5b06852a8a4ee6ba3f54a6a4f5eb35e8d5430767 | Python | CoryCollins/src-class | /code25_all/python/2401117.txt | UTF-8 | 917 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
from subprocess import *
from Queue import Queue
from Queue import Empty
import multiprocessing
from multiprocessing import Process
def main():
r = Runner()
r.run()
class Runner(object):
processes = []
def run(self):
q = Queue()
for t in range(1,6):
q.p... | true |
d78cb7d6c0bed3d6346b2116320deae55141e147 | Python | prisme60/mastermind | /c/Mastermind.py | UTF-8 | 3,204 | 3.15625 | 3 | [] | no_license | #!/bin/python
import sys
import time
def fillList0(elem):
return 0
class game:
def __init__(self,nb_pigs,nb_colors):
self.nb_pigs = nb_pigs
self.nb_colors = nb_colors
self.secretCombinaison = []
def generateSecretCombinaison(self):
self.secretCombinaison = []
for ... | true |
0bbd072c95aff6501ca4a99006f84207ef38bb09 | Python | soohyun-lee/python1 | /python1.4.py | UTF-8 | 148 | 3.53125 | 4 | [] | no_license | for i in range(1,51):
if ('3' in str(i)) or ('6' in str(i)) or ('9' in str(i)):
print('*', end =' ')
else:
print(i, end=' ') | true |
a8769664e43a976492880659d4cb1ee3f44a3346 | Python | AmunRha/ChallengeSet1 | /Codeforces/1031A.py | UTF-8 | 128 | 3.21875 | 3 | [] | no_license | w, h, k = map(int, input().split())
tot = 0
for i in range(0, k):
tot += 2*(w+h) - 4
w = w - 4
h = h - 4
print(tot) | true |
3d634c134cce73afa5255b4af30552edf35b8764 | Python | mihiic/connect-4-mpi | /main.py | UTF-8 | 8,305 | 2.65625 | 3 | [] | no_license | import copy
import os
import sys
import time
from mpi4py import MPI
from board import Board
from message import Message
class Program:
def __init__(self):
self.max_depth = 8
self.file_name = 'board.txt'
self.comm = MPI.COMM_WORLD
self.rank = self.comm.Get_rank()
self.size =... | true |
1f6ed9c838355e253f01a2f4968be0b4d0540e23 | Python | YoadTew/ray_tracing | /modules/box.py | UTF-8 | 3,886 | 2.546875 | 3 | [] | no_license | import numpy as np
from modules.entity import Entity
from modules.plane import Plane
class Box(Entity):
def __init__(self, params, materials):
super().__init__(params, materials)
self.center = np.array(params[0:3], dtype=float)
self.scale = float(params[3])
offset_x = np.array([1, ... | true |
c115828afdd7fab0ee42ee9e9a8ba1f897653976 | Python | KaitlynKeil/bug-free-spork | /old_junk/frank_test.py | UTF-8 | 220 | 3.40625 | 3 | [
"MIT"
] | permissive | class Frank(object):
def __init__(self, bob):
self.bob = bob
def __cmp__(self, other):
return self.bob - other.bob
franky = Frank(10)
franklin = Frank(2)
franks_list = [franky, franklin]
print min(franks_list).bob | true |
494f69e2bbd9f3410ebd59b3c355e8bcb96a0ce0 | Python | abhisjai/python-snippets | /Python Essential/Exercise Files/Chap05/boolean.py | UTF-8 | 592 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
a = True
b = False
x = ( 'bear', 'bunny', 'tree', 'sky', 'rain' )
y = 'bear'
if a or b:
print('expression is true')
else:
print('expression is false')
if y in x[0]:
print('expression is true')
else:
print('expression is false')
if 'tre... | true |
6a861782b68662cbbbf41c32e8a6830eaee3fd6b | Python | makeesyai/makeesy-python | /python_advance/python_classes/magic_func.py | UTF-8 | 994 | 4.59375 | 5 | [
"Apache-2.0"
] | permissive | # Dunder (Double underscore name Double underscore) methods or magic methods
# Usage:
# Commonly used for operator overloading.
# Modifying object creation using __init__() and __new__()
# Making a class instance callable using __call__
class String(object):
def __init__(self, greet):
self.greet = greet
... | true |
6586a806ff4d6900a08973b47313dc23b1d54eae | Python | Denis-711/tyubaev_denis_lab4 | /game_module.py | UTF-8 | 14,611 | 3.453125 | 3 | [] | no_license | import pygame
import math
import pygame.draw
import pygame.font
from random import randint
class Base_Target():
def __init__(self, screen, screen_widht, screen_height):
'''
Keyword argument:
screen_widht -- game window width
screen_height -- game window height
'''
self.spawn_x_min = 2... | true |
6979e6937ec6bd89d7d60d5445d5a2c4efb7dec8 | Python | Shameel123/Learning-Python | /tkinter/harry/image.py | UTF-8 | 401 | 2.8125 | 3 | [] | no_license | from tkinter import *
from PIL import Image, ImageTk
root = Tk()
#GUI Logic here!
root.geometry("600x600") #WxH
root.minsize(200,200)
root.title("image")
# #-----------------For JPG FILES-------------------#
# image = Image.open("1.jpg")
# photo = ImageTk.PhotoImage(image)
photo = PhotoImage(file="1.png")
... | true |
c8951a2c91e2fbbc9354681a0add022ba42096e8 | Python | masintech/epi_python | /ch1_primitive_type/parity.py | UTF-8 | 2,354 | 3.921875 | 4 | [
"MIT"
] | permissive | import functools
class Parity:
"""Bitwise operation
Find the parity
from EPI Ch 1
"""
def __init__(self, x):
self._x = x
def set_x(self, x):
self._x = x
def print_result(fun):
@functools.wraps(fun)
def wrap(self):
result = fun(self)
... | true |
99d2f0276e3c5edd58cfbb988742aa9dc47a22d3 | Python | urjajindal18/basics | /forloop.py | UTF-8 | 101 | 3.75 | 4 | [] | no_license | t=input("What table you want to display")
t=int(t)
for i in range(11):
print (t,"X",i,"=",t*i) | true |
242326eb0a8abe20f595b9b91c1d5c70b47c4325 | Python | MisaelGuilherme/100_Exercicios_Em_Python | /Desafio 05.py | UTF-8 | 143 | 3.65625 | 4 | [
"MIT"
] | permissive | print('====== DESAFIO 05 ======')
v1 = int(input('Digite um valor: '))
print('O sucessor de ',v1,' รฉ ',v1+1,', e o antecessor รฉ ',v1-1)
| true |
bc7a3a3d9b946ef927a458ab80accd78a067cfa2 | Python | Arsenal591/Compiler-AsciiC | /src/symbols.py | UTF-8 | 1,692 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive |
class SymbolTable(object):
def __init__(self):
self.items = {}
def insert(self, name, actual_name, data_type, array_size=None):
new_item = {
'actual_name': actual_name,
'data_type': data_type,
'array_size': array_size,
}
self.items[name] = new_item
return new_item
def get_item(self, name):
re... | true |
30bf1deb2b7b58051edddf3a1e816fafd0ffad12 | Python | COVISART/detection-and-tracking | /host/src/utils/draw.py | UTF-8 | 1,597 | 3.03125 | 3 | [
"MIT"
] | permissive | import cv2
BGR = {
'black':(0,0,0),
'blue':(255,0,0),
'green':(0,255,0),
'orange':(0,153,255),
'red':(0,0,255),
'white':(255,255,255)
}
def draw_bbox(frame, bbox, label, color):
if bbox:
cv2.rectangle(frame,(bbox[0],bbox[1]),(bbox[0]+bbox[2],bbox[1]+bbox[3]),BGR[color],2)
... | true |
07c239f172088f16ca3beb2f9f8d4b59daea3159 | Python | authman/Python201609 | /Jessie Smith/assignments/averagelist.py | UTF-8 | 38 | 2.59375 | 3 | [
"MIT"
] | permissive | a=[1,2,5,10,255,3]
print sum(a)/len(a) | true |
8d81692863d72ef62443ad5f6928d7bdd880a4ba | Python | shaconley21/COMSW4701--Projects---robo- | /bishapes.py | UTF-8 | 4,749 | 2.96875 | 3 | [] | no_license | import sys, random, math, pygame
from pygame.locals import *
from pygame.draw import *
from math import sqrt,cos,sin,atan2
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
from shapely.geometry.linestring import LineString
import random
XDIM, YDIM = 600, 600
WINDOW = [XDIM, YDIM]
EPSILON... | true |
6b26d3d80b4bc9fc4fa299f40cd31ab950b04f1d | Python | ocoronel1/road-scanner | /data_extraction/parseimagesspark.py | UTF-8 | 1,759 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 29 16:47:23 2019
@author: achakrab
"""
import requests
import os
import sys
from pyspark import SparkContext
import json
import os
import pandas as pd
import numpy as np
from os import path
with open('coordinates.txt','r') as f:
content1=f.re... | true |
c28ebc9c3814801168698ff4f86c1601d4223cb8 | Python | Ragul-SV/Data-Structures-and-Algorithms | /Graph/DFS and BFS.py | UTF-8 | 782 | 3.65625 | 4 | [] | no_license | class Graph:
def __init__(self):
self.graph = dict()
def addEdge(self,u,v):
if u not in self.graph:
self.graph[u] = [v]
else:
self.graph[u].append(v)
def DFSUtil(self,v,visited):
if v not in visited:
visited.add(v)
print(v,end=" ")
for i in self.graph[v]:
self.DFSUtil(i,visited)
d... | true |
ca09bb1ca4deb5920303151a032dfaab48251de7 | Python | COLOSOUS/found_web | /cgi-bin/list.py | UTF-8 | 1,446 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import cgi
import cgitb
cgitb.enable()
import db
print('Content-type: text/html; charset=UTF-8')
print('')
utf8stdout = open(1, 'w', encoding='utf-8', closefd=False)
form=cgi.FieldStorage()
hbdb=db.Doctor('localhost','usuario','usuario','ejercicio4')
data=hbdb.get_doctors(... | true |
7bbbc888d15f82e610ea439cf4d8d923291ac4fe | Python | jal07/P1R2 | /Servidor.py | UTF-8 | 1,442 | 2.90625 | 3 | [] | no_license | import socket
import mysql.connector
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the port
server_address = ('localhost', 10000)
print('starting up on {} port {}'.format(*server_address))
sock.bind(server_address)
# Listen for incoming connections
s... | true |
68ec15abe43de3e650edef8d591fe3e4cfa6c33a | Python | sidhenriksen/corrboosting_viz | /app.py | UTF-8 | 8,399 | 2.59375 | 3 | [] | no_license | import dash,pickle
import dash_core_components as dcc
import dash_html_components as html
from scipy.stats import linregress
import plotly.graph_objs as go
import numpy as np
from plotly import tools
with open('data.pickle','rb') as f:
data = pickle.load(f)
app = dash.Dash()
server = app.server
cellNames = list(d... | true |
b601c05a288aa9243be37593e87c66101520e9c7 | Python | zenuie/codewars | /python/Complementary_DNA.py | UTF-8 | 372 | 3.15625 | 3 | [] | no_license | def DNA_strand(dna):
# code here
total = []
newtotal = ""
for i in dna:
if i == "A":
total.append("T")
elif i == "T":
total.append("A")
elif i == "C":
total.append("G")
elif i == "G":
total.append("C")
for i... | true |
e474c3aeb54114a0ed1910a7abe0c78af1f1ae94 | Python | alisson-fs/projeto-ES-I | /estado.py | UTF-8 | 834 | 2.703125 | 3 | [] | no_license | from abc import ABC, abstractmethod
class Estado(ABC):
def __init__(self):
self.__container = None
self.__window = None
self.__erro = False
@property
def container(self):
return self.__container
@property
def window(self):
return self.__window
... | true |
8ffd708c5005050fd43908e52fc388f0b9fa4f65 | Python | Himstar8/Algorithm-Enthusiasts | /algorithms/strings/longest_valid_parentheses/longest_valid_parentheses.py | UTF-8 | 2,403 | 3.46875 | 3 | [] | no_license | def longest_valid_parentheses_dp(s):
"""
:type s: str
:rtype: int
"""
if s == "":
return 0
len_s = len(s)
m = [[0] * len_s for i in range(len_s)]
for i in range(len_s):
m[i][i] = 0
for i in range(len_s - 1):
if s[i] == '(' and s[i + 1] == ')':
m[i]... | true |
701d70154978f113c546912b7aaf391536cb196c | Python | graviteja28/Hyperskill-Password-Hacker | /Stage 3-5/tests.py | UTF-8 | 3,908 | 2.90625 | 3 | [
"MIT"
] | permissive | from hstest.stage_test import StageTest
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from threading import Thread
from time import sleep
import socket
import random
CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)... | true |
5a114e6c4745596ef228e6c97c0ed8b4480c7178 | Python | LalitGsk/Programming-Exercises | /Leetcode/isPalindrome.py | UTF-8 | 339 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 30 18:36:40 2019
@author: lalit
9: Determine whether an integer is a palindrome.
An integer is a palindrome when it reads the same backward as forward.
"""
def isPalindrome(x):
s = str(x)
rev_s = s[::-1]
if s==rev_s:
return True
return False
print... | true |
c76b85a794244ff22000dfa1cb3ad3a7bfedec0e | Python | NextTechLabAP/Smart-Dustbin | /TestUSonic.py | UTF-8 | 629 | 3.09375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(7,GPIO.IN)#echo1
GPIO.setup(8,GPIO.OUT)#Trig1
GPIO.setup(16,GPIO.OUT)#Servo Motor
GPIO.setup(20,GPIO.OUT)#Trigger2
GPIO.setup(21,GPIO.IN)#Echo2
GPIO.output(8, False)
time.sleep(2)
print( "Calculating distance")
GPIO.outp... | true |
511f090d97c4b5b9912fe5837e5da1e90be90bf7 | Python | ejmichaud/Image_Scanner | /model.py | UTF-8 | 3,211 | 2.59375 | 3 | [] | no_license | from __future__ import division
import tensorflow as tf
import numpy as np
#import data
#THE ACCURACY EVALUATION FUNCTION
def get_accuracy(net_out, answers):
outputs = np.round(net_out)
return np.sum(answers == outputs)
x = tf.placeholder(tf.float32, [None, 80*120])
y_ = tf.placeholder(tf.float32, [None, 1])
... | true |
732946e2929ba9502ac959c454a37c179fd4f12f | Python | ServerBaby/Weather-App | /archived modules/weather_app_data.py | UTF-8 | 854 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
import requests
import json
import datetime
# Gets information from website and turns it into a usable format
x = requests.get('http://www.bom.gov.au/fwo/IDQ60801/IDQ60801.99435.json')
y = json.loads(x.text)["observations"]["data"]
# [0] is the position of the most recent dataset ins... | true |
3122ec0ce70d2a3eaef00b23afa4423c5dd42fa2 | Python | mariadelmarr/Python | /dia4/fibonacci.py | UTF-8 | 166 | 3.453125 | 3 | [] | no_license | x = 0
y = 1
ficonacci = True
while ficonacci:
print(y)
t = y
y = x + y
x = t
ficonacci = True if input ('Continuar? s/n ') == 's' else False
| true |
5a3f1b8935ab1ace0564d659d75d0a4a22508b32 | Python | pzrsa/pcc2-work | /users.py | UTF-8 | 615 | 3.84375 | 4 | [] | no_license | class User:
def __init__(self, first_name, last_name, age):
self.first_name = first_name
self.last_name = last_name
self.age = age
def describe_user(self):
print(f"\nThe users first name is {self.first_name}.")
print(f"The users last name is {self.last_name}.")
... | true |
ca5dc105689c2f59bd7ebcb53189f7dafa72439e | Python | webclinic017/stock-market-challenge | /database/models.py | UTF-8 | 750 | 2.921875 | 3 | [] | no_license | """User database model"""
from passlib.context import CryptContext
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
class RegisteredUser(Base):
__tablename__ = "users... | true |
3b4b9937751e7f30f831c05374550977a9ef3d38 | Python | jizhi/jizhipy | /Basic/PsGrep.py | UTF-8 | 612 | 2.640625 | 3 | [] | no_license |
def PsGrep( *args ):
'''
PsGrep('python wait.py') => ps | grep "python wait.py"
Parameters
----------
*args:
Can match many keys
Returns
----------
return pid, pid is a list of str
'''
from jizhipy.Basic import ShellCmd
value, _value, pid = [], [], []
for key in args:
_value += ShellCmd('ps | grep "'... | true |
c3f43aa36cf9ba9fae802d1eea6335a118ea09e5 | Python | naumenko-sa/bioscripts | /scripts/fasta2nexus.py | UTF-8 | 1,729 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import sys
if ("--help" in sys.argv) or ("-?" in sys.argv):
sys.stderr.write("usage: fasta-to-nexus.py [<fasta-file-path>] [<nexus-file-path>]\n")
sys.exit(1)
if len(sys.argv) < 2:
src = sys.stdin
else:
src_fpath = os.path.expanduser(os.path.expandvars(sys.argv[1]))
... | true |
b5ebe5236bd0a4cb5f763843d962507f2f487cca | Python | dfr-hub/kumpulan_code | /python/reversenumber.py | UTF-8 | 196 | 4.0625 | 4 | [] | no_license | def reverse_for_loop(s):
s1 = ''
for c in s:
s1 = c + s1
return s1
my_number = '123456'
if __name__ == "__main__":
print('Reversing the given number using for loop =', reverse_for_loop(my_number)
| true |
d617beaab2ca2dbc6e522c7b6d0ae059e90bb092 | Python | magicbycalvin/StochasticTargetMonitoring | /parameters.py | UTF-8 | 1,173 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 06:42:06 2020
@author: ckielasjensen
"""
import numpy as np
class Parameters:
"""
"""
def __init__(self):
# Agent
self.nveh = 3 # Number of vehicles
self.dsafe = 1 # Minimum safe distance between ... | true |
c5a7807fc996f73fc148f7dc3643deeb589ff7f4 | Python | lantuzi/know_your_nyms | /Model Predictions/analyze_predictions.py | UTF-8 | 652 | 2.78125 | 3 | [] | no_license | import pandas as pd
df1 = pd.read_csv('mero.predictions', sep='\t', names=['X','Y','Actual','Predicted'])
df2 = pd.read_csv('mero.predictions2', sep='\t', names=['Y','X','Actual','Predicted'])
df2 = df2[['X','Y','Actual','Predicted']] # Reorder columns
#s = sum(df[''])
avg1 = df1['Predicted'].mean()
print avg1
avg2 = ... | true |
903578c75b8804f42e36d3b5e7f36b795fca0161 | Python | ThomasLiu/python_study | /dome/lesson13/datetime_test.py | UTF-8 | 1,594 | 3.46875 | 3 | [] | no_license | from datetime import datetime, timedelta, timezone
import re
now = datetime.now()
print(now)
print(type(now))
dt = datetime(2015, 4, 19, 12, 20) # ็จๆๅฎๆฅๆๆถ้ดๅๅปบdatetime
print(dt)
print(dt.timestamp())
t = 1429417200.0
print(datetime.fromtimestamp(t))
print(datetime.utcfromtimestamp(t))
cday = datetime.strptime('2015-6... | true |
e66d0bdd012ad7f18f41256940dcf41b32f86bc4 | Python | abhay382/opencv | /List/Ex4.py | UTF-8 | 478 | 4.3125 | 4 | [] | no_license | #Changing Values in a List with Indexes
spam = ['cat', 'bat', 'rat', 'elephant']
spam[1] = 'aardvark'
print(spam)
spam[2] = spam[1]
print(spam)
spam[-1] = 12345
print(spam)
#List Concatenation and List Replication
print([1, 2, 3] + ['A', 'B', 'C'])
print(['X', 'Y', 'Z'] * 3)
spam = [1, 2, 3]
spam = spam + ['A', 'B... | true |
99d45a127106183ac16f454cf5f275345510c8df | Python | Akasurde/pysnippet | /pytestdemo/test_example_12.py | UTF-8 | 555 | 3.015625 | 3 | [] | no_license | #Scope
# function : default
# class
# module
# session
import pytest
scopevar = "function"
#scopevar = "module"
#scopevar = "class"
@pytest.fixture(scope=scopevar)
def mysql_db(request):
print("Connecting to database")
s = { 'foo': 1, 'bar': 2}
def close_connection():
print("Closing database con... | true |
2f5f74bbe1b2b8168abcb981b42d01e9e125edb1 | Python | IngoScholtes/csh2018-tutorial | /solutions/5_exploration.py | UTF-8 | 2,394 | 3.109375 | 3 | [] | no_license | #%%
import markdown
from IPython.core.display import display, HTML
def md(str):
display(HTML(markdown.markdown(str + "<br />")))
#%%
md("""
# 5 Exploration: Higher-order analysis of real-world pathway data
**Ingo Scholtes**
Data Analytics Group
Department of Informatics (IfI)
University of Zuri... | true |
889dfa0e41b08c83c27a046de5563d67081ae850 | Python | NikitaBukreyev/UniDump | /I ะััั/1 ะกะตะผะตััั/ะะปะณะพัะธัะผั/ะะฐะฑ.3/Main.py | UTF-8 | 1,405 | 4.15625 | 4 | [] | no_license | import random
from InsertionSort import *
from BubleSort import *
from SelectionSort import *
# ะะตัะพะด ะฟะพ ัะพะทะดะฐะฝะธั ัะฟะพััะดะพัะตะฝะฝัั
ัะฟะธัะบะพะฒ
def make_consistent_list(list_range):
empty_list = []
for x in range(list_range):
empty_list.append(x)
return empty_list
# ะะตัะพะด ะฟะพ ัะพะทะดะฐะฝะธั ัะปััะฐะนะฝัั
ัะฟะธัะบะพะฒ
def... | true |
11987f15015f4042094f1a9cdbdbf71db32a4e6d | Python | ritumalhotra/ud120-projects | /naive_bayes/nb_author_id.py | UTF-8 | 1,236 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
"""
This is the code to accompany the Lesson 1 (Naive Bayes) mini-project.
Use a Naive Bayes Classifier to identify emails by their authors
authors and labels:
Sara has label 0
Chris has label 1
"""
import sys
from time import time
sys.path.append("../tools/")
from em... | true |
a22bbe81c5ed4fb900a7f5ac9bfc3fe7599df2e0 | Python | liam-middlebrook/gallery | /gallery/s3.py | UTF-8 | 1,050 | 2.625 | 3 | [
"MIT"
] | permissive | import boto
import boto.s3.connection
from boto.s3.key import Key
from datetime import timedelta
class S3():
con = None
def __init__(self, host, access_key=None, secret_key=None, secure=True):
self.con = boto.connect_s3(aws_access_key_id=access_key,
aws_secret_access... | true |
e08b6069545e5f5a068927216cb874645749eea9 | Python | sauravgsh16/DataStructures_Algorithms | /g4g/DS/Graphs/Introductions_and_traversals/RN_22_height_of_a_generic_tree.py | UTF-8 | 2,525 | 4.0625 | 4 | [] | no_license | ''' Height of a generic tree '''
'''
Problem Statement:
We are given a tree of size n as array parent[0..n-1] where every index i
in parent[] represents a node and the value at i represents the immediate
parent of that node. For root node value will be -1. Find the height of the
generic tree given t... | true |
acc83dd9f93cf5d977b6e27da1ab4ac552b1d15e | Python | SaiSriLakshmiYellariMandapaka/Sri_PythonDataQuest | /practice mode_1_python.py | UTF-8 | 2,950 | 4.71875 | 5 | [] | no_license | #Practice using Python to perform calculations and printing results to the screen.
#1.Add the values 1234 and 9876 together and print the result to the screen.
print(1234+9876)
#2.
'''You received a bonus of $1,000 for your outstanding work! You are planning to go to the restaurant to celebrate. You invited your two... | true |
ec9e3ac23b8deb865ad6d9ba16d689d56786175c | Python | josephcourtney/compass | /examples/pklist_v_pklist/filter.py | UTF-8 | 1,825 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
# Import peaks from SPARKY peaklist with columns:
# Assignment w1 w2
# filter the peaks to exclude peaks that are:
# not within the aliphatic region (10 ppm, 80 ppm)
# not matched on either side of the diagonal withint cross_tol
# within diag_tol of the diagonal
# ... | true |
b2eb93002f8c19bc315f13fc7a607da97ca60e15 | Python | leschultz/atd | /download/filecopier.py | UTF-8 | 3,503 | 2.921875 | 3 | [] | no_license | from shutil import copy
import tarfile
import os
# The name of important files for each job
trajdotlammpstrj = 'traj.lammpstrj'
testdotout = 'test.out'
depdotin = 'dep.in'
compressed = 'outputs.tar.gz'
def filecopy(copyname, filelist, copypath, savepath):
'''
Copy the file if it exists in path.
inputs... | true |
1c70847fc8607c7efc61a2020afc0985e8cbaad5 | Python | naopiyo23/btc | /csv_parser.py | UTF-8 | 1,085 | 2.9375 | 3 | [] | no_license | from event import TickEvent
import pandas as pd
from datetime import datetime
import queue
class CoinCheckPriceHandler():
def __init__(self, events_queue=queue.Queue(), file_path=None):
self.events_queue = events_queue
self.file_path = file_path
self.data = []
self.dt_format = "%Y-%... | true |
ac36156682399a97a497988a5795343f9a304c16 | Python | Kumudayini/ItemCatalogProject | /lotsofmenus.py | UTF-8 | 4,446 | 2.59375 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Category, Base, Item, User
import datetime
engine = create_engine('sqlite:///catalogappdb.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSessio... | true |
396287012e4d18e54dfc9b87707acb8022ccb2b3 | Python | ch-jeju/phyton-practice | /03_loo.py | UTF-8 | 492 | 3.625 | 4 | [] | no_license | # n = 0
# while n < 5:
# print('๋ํ๋')
# foods = ['pizza']
# for food in foods:
# print(food)
numbers = [1, 2, 3, 4, 5, 6]
#for number in numbers:
# print (number=*2, end= '.')
new_numbers = []
for number in numbers:
new_numbers.append(number=*2)
... | true |
1fadead9c3e07f673af03032cdcddb30f5689a21 | Python | khimacademy/uu | /solutions/ch4/4_7_a.py | UTF-8 | 242 | 3.78125 | 4 | [] | no_license | '''
4-7. 3๋ฐฐ์
3๋ถํฐ 30๊น์ง 3์ ๋ฐฐ์๋ก ๋ฆฌ์คํธ๋ฅผ ๋ง๋์ธ์. for ๋ฃจํ๋ฅผ ์จ์ ๊ฐ ์ซ์๋ฅผ ์ถ๋ ฅํ์ธ์.
Output:
3
6
9
12
15
18
21
24
27
30
'''
threes = list(range(3, 31, 3))
for number in threes:
print(number)
| true |
f60e655f5c2005b432e1f2b5be640ef444ee776f | Python | shunz/Python-100-Days_Practice | /turtle/draw_circle.py | UTF-8 | 220 | 3.875 | 4 | [] | no_license | import turtle
# draw circle
r = 10
dr = 40
head = 90
for i in range(4):
turtle.pendown()
turtle.circle(r)
r += dr
turtle.penup()
turtle.seth(-head)
turtle.fd(dr)
turtle.seth(0)
turtle.done()
| true |
bc71af3d7c2faa69421d42c5d9d6eddc2912d621 | Python | jiajiabin/python_study | /day11-20/day15/01_ๅผๅธธๅค็.py | UTF-8 | 572 | 3.578125 | 4 | [] | no_license | try:
i = int(input())
print(5 / i) # ่งฃ้ๅจๆ ๆณๅค็่ฟไธชๆไฝ๏ผไผๆๅบไธไธชๅผๅธธ๏ผZeroDivisionError
except ZeroDivisionError as e: # ็ๅฌๅนถๆ่ทๅผๅธธ, ๆ่ทๅฐๅผๅธธไฟกๆฏ๏ผๅฐฑไผๆง่กexceptไธ้ข็ไปฃ็ ๏ผๅผๅธธไฟกๆฏไนๆฏๅฏน่ฑก๏ผๆบๅธฆ็ๅฏนๅผๅธธ็ๆ่ฟฐ
print("้คๆฐไธบ0", e) # ๆ่ทๅผๅธธ๏ผ็ปไปไธไธชๅผ็จe
except ValueError: # ไธไธชtryๅฏไปฅๅฏนๅบๅคไธชexcept
print("่พๅ
ฅ็ๆฐๆฎไธๆฏๆฐๅญ")
finally:
... | true |
34a298c273d81c234c097a2aa9475a12863ad5ee | Python | ronnyworm/bachelorthesis_qasystem | /print_matches_in_tables.py | UTF-8 | 4,289 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
#coding=UTF-8
from __future__ import print_function
import nltk
import sys
import sqlite3
from nltk.corpus import wordnet as wn
from nltk.corpus import stopwords
import os.path
from subprocess import check_output
import en
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
# http:/... | true |
1650ab6a353ac6da93e8ab022f1dbaf6c9715703 | Python | sterliakov/IT-2022-labs-1-sem | /lab5/task3.py | UTF-8 | 211 | 2.78125 | 3 | [] | no_license | from operator import itemgetter
arr = [int(input()) for _ in range(int(input()))]
d = int(input())
ret = list(map(itemgetter(0), filter(lambda x: x[1] % d == 0, enumerate(arr))))
print(*(ret if ret else [-1]))
| true |
918f94873ec7535339c2cf1a261fc4d513923796 | Python | alfredox10/ip_parse_geo | /main.py | UTF-8 | 6,553 | 3.03125 | 3 | [] | no_license | import filter_ops
import ip_parsing
import geo_info
# -------------- Global Settings -----------
# Delimters to find values for commands
delim = ('[', ']')
fpath = 'list_of_ips.txt'
keep_running = True
ip_address_dict = {}
ip_geo_values = []
if __name__ == '__main__':
# Functionality
# Metrics:
# + Total... | true |
444ffff137e9bf163ac02bcd58280fcefe22f752 | Python | dmathews98/Solid-State | /PS5/plot_mag.py | UTF-8 | 449 | 3.046875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def Curie(C, T):
return (float(C)/T)
def twolevel(N, mu, B, T):
kb = 1.0
return (N*kb*np.tanh(mu*B/(kb*T)))
def main():
N = 1
mu = 1
B = 1
C = 1
t = np.arange(0.0001, 50, 0.001)
curie_dat = Curie(C, t)
twolev_dat = twolevel(... | true |
14fcb1c0b2ac2c3d379512da243f1bd71619d10b | Python | ByteInternet/searchguard-python | /tests/tests_rolesmapping/test_check_rolemapping_exists.py | UTF-8 | 1,584 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
from mock import Mock, ANY
from tests.helper import BaseTestCase
from searchguard.rolesmapping import check_rolemapping_exists
from searchguard.exceptions import CheckRoleMappingExistsException
class TestCheckRoleMappingExists(BaseTestCase):
def setUp(self):
self.role = "DummyRole"
... | true |
8d4154bd64bd84cdbc2e8e759d8349b0bf005922 | Python | 911akash/python-blackjack | /Chips.py | UTF-8 | 620 | 3.71875 | 4 | [] | no_license | class Chips():
def __init__(self):
self.initialamount=100
self.bet=0
def placebet(self, bet_amount):
self.bet_amount=bet_amount
if self.bet_amount <= self.initialamount:
return True
else:
print("not enough amount in account")
return F... | true |
4219d6efa14bc5928acecbd4ce61469e333fa00b | Python | vivian31aa/University-Project | /Machine Learning/Backpropagation/0616038.py | UTF-8 | 2,597 | 2.890625 | 3 | [] | no_license | import random
from random import seed
import numpy as np
import matplotlib.pyplot as plt
import copy
import csv
def getLoss(predict, target):
return np.mean(np.absolute(predict-target))
def Sigmoid(x):
return 1.0/(1.0 + np.exp(-(np.clip(x, -100, 100))))
def Sigmoid_Der... | true |
24a0d62c4dabcc759d40f233fced95507a549de6 | Python | vimalpachiappan/Rapid1 | /question4_v2.py | UTF-8 | 845 | 3.015625 | 3 | [] | no_license | number=input("enter the number of array values : ")
runs=[]
for i in range(int(number)):
n=input('number : ')
runs.append(int(n))
print(runs)
B1=0
B2=1
S1=0
S2=0
TOTAL=0
global z
z=0
number=int(number)
while(z!=number):
x=runs[z]
print(x)
if(x in [1,3,5]):
... | true |
43cc811edbfa03a3b56a20062d11b23b5019e44d | Python | purushottamkaushik/DataStructuresUsingPython | /StringProblem/LetterArrangementToFormPallindrome.py | UTF-8 | 301 | 3.34375 | 3 | [] | no_license | s = "mamad"
def PallindromePossibleOrNot(s):
d = dict()
for i in s:
if i not in d.keys():
d[i] = 1
else:
d[i] = d.get(i) + 1
return len([key for key, value in d.items() if value % 2 == 1]) <= 1
print(PallindromePossibleOrNot(s))
| true |
2a17744de58efd66f17795ef0664770d038be6b4 | Python | teasakotic/cinema | /src/main.py | UTF-8 | 1,141 | 3.3125 | 3 | [] | no_license | import ucitavanje
import menadzer
import prodavac
if __name__ == '__main__':
ucitavanje.ucitajEntitete()
print("<<<<<<<<<< Dobrodosli >>>>>>>>>>")
trajanje = True
losiPodaci = True
while trajanje:
ime = input("Unesite korisnicko ime: ")
sifra = input('Unesite sifru: ')
kori... | true |
175e8b816d34f8069c98c3cf384f9d3e067597ce | Python | DaniBunny/recommenders | /examples/07_tutorials/KDD2020-tutorial/utils/PandasMagClass.py | UTF-8 | 7,745 | 2.625 | 3 | [
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# MicrosoftAcademicGraph class to read MAG streams for Pandas
#
# Note:
# MAG streams do not have header
#
import numpy as np
import pandas as pd
class MicrosoftAcademicGraph:
# constructor
def __init__(s... | true |
e5ffa6a05800d82882e2dfaa4946f01dc0969248 | Python | hzfmer/pyawp | /topography.py | UTF-8 | 7,436 | 3.453125 | 3 | [] | no_license | import numpy as np
class Topography(object):
def __init__(self, nx, ny, h, ngsl):
self.nx = nx
self.ny = ny
self.h = h
self.ngsl = ngsl
def refine(self, refine_factor):
"""
Apply a factor of two grid refinement.
If `refine_factor = 0` then no grid ref... | true |
dfeeae4fe03d2e434ac74f108fd6187801e9aba6 | Python | Piyushsrii/Python_Data_Structure_Program | /Basic_core_Programing/Dictionary/IterateDict.py | UTF-8 | 628 | 4.46875 | 4 | [] | no_license | '''Write a Python program to iterate over dictionaries using for loops'''
class IterateDictionary:
#create a method for iteration
def iterate(self, dictOfNum):
print("Dictionary : ", dictOfNum)
for key, value in dictOfNum.items():
print(key, " is the key belongs to " , dictOfNum[key... | true |
f56293a20d07820c55191b78e4dd127715215894 | Python | Sem31/flask-basics | /7 HTTP-USE-GET & POST/7 HTTP-USE-GET.py | UTF-8 | 527 | 2.96875 | 3 | [] | no_license | #post and get method how we use in flask
from flask import Flask, redirect, url_for, request
app = Flask(__name__)
@app.route("/wel/<name>")
def wel(name):
return "welcome %s Bro!"%name
@app.route("/login",methods = ['POST','GET'])
def login():
if request.method =='POST':
user = request.form['txt']... | true |
ea2a57edbceb8e2adca996e4729c1ea2fd413762 | Python | SFDO-Tooling/CumulusCI | /cumulusci/utils/http/multi_request.py | UTF-8 | 7,111 | 2.609375 | 3 | [
"LicenseRef-scancode-free-unknown"
] | permissive | import typing as T
from concurrent.futures import as_completed
from itertools import chain
from requests.exceptions import ReadTimeout
from requests_futures.sessions import FuturesSession
from cumulusci.utils.iterators import iterate_in_chunks, partition
RECOVERABLE_ERRORS = (ReadTimeout, ConnectionError)
class HT... | true |
51f52dfdd4584c299e2dcb679b8ea52513cdbd2f | Python | diegomezg/tournament-register | /register_failed.py | UTF-8 | 455 | 2.734375 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk
class RegisterFailed(tk.Tk):
def __init__(self):
super().__init__()
self.resizable(0,0)
label = tk.Label(self, text='Por favor complete todos los campos\n para registrarse.')
label.grid(row=0, column=0, padx=15, pady=15, sticky='NSEW')
... | true |