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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ca6cfab61d0a7078719bbe3ce170aac1bfd31fed | Python | huanyushis/Hand-drawing-recognition-based-on-flask-and-keras | /draw/train.py | UTF-8 | 2,452 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
import os
from sklearn.model_selection import train_test_split
from keras.utils import to_categorical
from keras.models import Model, Input
from keras.layers import Conv2D, MaxPool2D, Flatten, Dropout, Dense
from keras.losses import categorical_crossentropy
from keras.optimizers import Ada... | true |
e35d59a879599ef45df9527023cd48eae35a7c15 | Python | QuantumQuadrate/Instrument_Servers | /instruments/analogout.py | UTF-8 | 11,243 | 2.546875 | 3 | [] | no_license | """
AnalogOutput class for the PXI Server
SaffmanLab, University of Wisconsin - Madison
"""
# TODO: could use nidaqmx task register_done_event, which can pass out and allow
# error handling if a task ends unexpectedly due to an error
## modules
import nidaqmx
from nidaqmx.constants import Edge, AcquisitionType, Sign... | true |
47d4cdff8602180596382b5a208a7e839fb72a0e | Python | 4knigc12/COM404 | /1-basics/4-Repetition/1-While-loop/3- Ascii/bot.py | UTF-8 | 256 | 3.609375 | 4 | [] | no_license | # While loop Ascii Art
count= 0
charging= 0
bars= int( input("How many bars should be charged ?"))
while charging < bars:
count += 1
print("Charging: " + str(count*"█"))
charging = charging +1
print()
print("The battery is fully charge")
| true |
bc528e13f717b00c3a8003c1d9f871e0c341c6da | Python | the-roth/HNAARGHBot | /games/game.py | UTF-8 | 10,777 | 2.953125 | 3 | [] | no_license | """
Created on Jun 20, 2017
@author: Rudy Laprade (penguin8r) and the_roth
"""
import threading
import time
import re
from enum import Enum # install via pip install enum34
from commands.command import Command, SubCommand
DEFAULT_SIGNUP_TIME = 130
DEFAULT_PRINT_SPEED = 30
TIMER_COOLDOWN_DURATION = 60
Status = E... | true |
4d434edb7c399744bc036501dc110a36cfe817e7 | Python | vmiklos/dynamic.vmiklos.hu | /szihkcal/szihkcal.py | UTF-8 | 3,869 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
import calendar
import cgi
import locale
import random
import sys
impo... | true |
0042b808aa74d657dd629114605538f9f1e91f5c | Python | Lakshmisudhakarreddy/fundamentals-of-python | /to find third angle of a triangle.py | UTF-8 | 199 | 3.921875 | 4 | [] | no_license | #write a program to enter two angles of triangle and find third angle
a=float(input("enter first angle value:"))
b=float(input("enter second angle value:"))
c=180-(a+b)
print("thrid angle is:",c) | true |
d09045a663ce28d1f958f39d49bd613dcf99e43e | Python | hjiang1/2hg-report | /utils/common.py | UTF-8 | 1,989 | 2.703125 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import pandas as pd
from glob import glob
def parse_filename(file, scan_type):
roi, pipeline = file.split(f'{scan_type}')[-1].split('.')[0].split('-')
if (roi == ''):
roi = 'Lesion'
else:
roi = roi[1:]
return (roi, pipeline)
def c... | true |
898ce9e88fa614d718b2b1881069feb97d79215c | Python | mege330/pythondigital | /Python Labs/Test123.py | UTF-8 | 315 | 3.578125 | 4 | [] | no_license |
#This print will be Hallo World
print("Hallo World")
#This print will be Number
print (1)
#This print will be a Full Name
print ("Menahem Geller")
#this print will be autcam of Numbers
print (1+5)
print(9*4)
print(100/5)
print(10+35)
print(-1+60)
print(9 // 4)
print(9 % 4)
print(3 ** 2)
print(2 * (1/4))
print(5/9)-32)... | true |
32785e0d14c29422e01a401f71501a72c4ff1df8 | Python | GeneseLessa/buy_order_api | /applications/products/models.py | UTF-8 | 774 | 2.59375 | 3 | [] | no_license | from django.db import models
from django.core.validators import MinValueValidator
class Product(models.Model):
"""This class is responsible for modeling the ORM Product model.
The fields are:
name, price, minimum, amount_per_package, max_availability"""
name = models.CharField(max_length=150, unique... | true |
d636402e51958af6ce36979ce8dc22cf58888ae2 | Python | RW21/competitive-code | /atcoder/abc038/d_n.py | UTF-8 | 129 | 2.875 | 3 | [] | no_license | N = int(input())
wh = [[int(j) for j in input().split()] for i in range(N)]
wh.sort(key=lambda x: (x[0], -x[1]))
print(wh) | true |
c2577ab3f0c3243b6aef34ca64b142bb6f43d552 | Python | ushiko/AOJ | /ITP1/ITP1_10_C.py | UTF-8 | 322 | 2.984375 | 3 | [] | no_license |
from functools import reduce
import math
while True:
n = int(input())
if ( n == 0 ):
break
l = list(map(int,input().split()))
mean = float(reduce(lambda a,b:a+b,l)) / (len(l))
t = 0
for i in l:
t += pow((i - mean),2)
bunsan = float(t) / len(l)
print (math.sqrt(bunsan)... | true |
fac64c9ffe6b7d2753b365d223b4afc5d8f01749 | Python | vishnoiprem/pvdata | /lc-all-solutions-master/146.lru-cache/test.py | UTF-8 | 1,075 | 3.265625 | 3 | [] | no_license | from queue import Queue
class LRUCache(object):
def __init__(self, capacity):
"""
:type capacity: int
"""
self.values_dictonary = {}
self.queue = Queue()
def set(self, key):
"""
:rtype: int
"""
if self.queue.full():
rem... | true |
050cf92a61d19d0cd9247625a5c56f9bcc02d3d7 | Python | avioXD/python_basic | /chapter_2/03_input.py | UTF-8 | 196 | 3.8125 | 4 | [] | no_license |
name = input('Enter your name: ')
print(name)
a = input('Enter any number: ')
print(a)
print('The sum of your input is: %d'%(int(input('Enter 1st num: '))+int(input('Enter second number: '))))
| true |
7f1f8fb524e6dd28b3ba3836297e7a56ec465ad2 | Python | cccccccccccccc/Myleetcode | /211/Design Add and Search Words Data Structure.py | UTF-8 | 1,208 | 3.8125 | 4 | [
"Apache-2.0"
] | permissive | from collections import defaultdict
class TrieNode:
def __init__(self):
self.node = defaultdict(TrieNode)
self.isword = False
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode()
def addWord(self, word... | true |
6c6bc9cbcc0a5ff9e68bc13676b686ba02f86c10 | Python | olerasmu/ButterflyMode | /src/root/nested/implementation.py | UTF-8 | 9,187 | 3.109375 | 3 | [] | no_license | '''
Created on 18. mars 2014
@author: olerasmu
'''
import math
import os
import timeit
import sys
from Crypto.Cipher import AES
from _hashlib import new
#===============================================================================
# This now works with files which have a number of blocks n that is a power of 2
#... | true |
900b2e7a672bd7878d83b0f3184dd6a47e45899a | Python | supermitch/Advent-of-Code | /2017/15/fifteen.py | UTF-8 | 1,233 | 3.515625 | 4 | [] | no_license | import time
def part_a():
count = 0
val_a = 883
val_b = 879
for i in range(int(4e7)):
a_val = val_a * 16807 % 2147483647
b_val = val_b * 48271 % 2147483647
count += format(a_val, '016b')[-16:] == format(b_val, '016b')[-16:]
val_a, val_b = a_val, b_val
return count... | true |
aec5dc1304b7f237668590d13e13e1529feaec42 | Python | JJJMLiew/Project-Ideas | /street.py | UTF-8 | 1,314 | 3.546875 | 4 | [] | no_license | from riddle import *
from game import *
from guess import *
from ending import *
def street():
inventory=[]
print("\n\n\nIt is nighttime, you see a long street lit in darknessaaegfgbnergrthsrteh ")
print("\nAfter a glance around you notice a few things")
choice = input('\n>go upstreet\n>head towards t... | true |
8c9c65e31cf8ede044e9f96139bc4daae97c0d42 | Python | Naughtyk/Python | /project11 - theory of games/Лабы Ване/labrab8.py | UTF-8 | 1,505 | 3.421875 | 3 | [] | no_license | """
Программа, вычисляющая вектор Шепли
Автор: Афанасьев И.Е.
Дата написания: 20.09.2020
"""
# импортируем перестановки
from itertools import permutations
# функция, вычисляющая факториал числа
def fact(i):
if i <= 1:
return 1
return i * fact(i - 1)
# Задаём расстояния до домов ("Малое Гадюкино")
X = [40, 9... | true |
8a5582bfc51dac79e6b5482fe586bfd4a1f27426 | Python | comeeasy/study | /python/sw-academy-python2/oop/operator-overloading.py | UTF-8 | 2,008 | 4.125 | 4 | [] | no_license | #####################################################################
class Person :
count = 0
#####################################################################
def __init__(self, name, age) :
self.__name = name
self.__age = age
print(self.name, "이 생성")
Pe... | true |
b6789eaabee5f89afc17fa71f071b6391da2e8eb | Python | javisabalete/s3-sftp-replicator | /lib/sftp.py | UTF-8 | 2,916 | 2.84375 | 3 | [
"MIT"
] | permissive | import os.path
import paramiko
class SSHConnection(object):
def __init__(self, host, username, password, port=22):
self.sftp = None
self.sftp_open = False
self.transport = paramiko.Transport((host, port))
self.transport.connect(username=username, password=password)
def _openSF... | true |
38999419de94619e82fe9b9377f80465aac9508a | Python | devannair777/DistributedNFV-ResourceSynchronization | /Validator/extensions.py | UTF-8 | 2,539 | 2.625 | 3 | [] | no_license | import yaml
import sys
def meta_constructor(loader,node):
value = loader.construct_mapping(node)
return value
yaml.add_constructor(u'tag:yaml.org,2002:Orchestrator.Messages.OrchestratorResource',meta_constructor)
def addNetworkResource(nr):
f = open('resource.yaml','r')
yamlObj = yaml.load(f)
f.c... | true |
c6c1a13b6772ef2d0eeab47c0ac96fab52de669c | Python | haggislea/python_intensive | /coding_bat/warm_up2.py | UTF-8 | 1,118 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 1 19:19:55 2019
@author: leann
"""
#-----
# warm up 2
#-----
# string times
def string_times(str, n):
return str * n
# string splosion
def string_splosion(str):
result = ''
for n in range(0,len(str)+1):
result += str[:n]
return result
# array front... | true |
6f7cd63aef72a5d3c253544193a4cc2cc43256f2 | Python | francescacairoli/WGAN_ModelAbstraction | /Dataset_Generation/src/MAPK/generate_dataset.py | UTF-8 | 10,223 | 2.53125 | 3 | [] | no_license | import numpy as np
from numpy.random import randint, random
import stochpy
import pandas as pd
import os
import shutil
from tqdm import tqdm
import pickle
import time
class AbstractionDataset(object):
def __init__(self, n_init_states, n_trajs, state_space_dim, param_space_bound, model_name, time_step, T):
... | true |
f32fd651ed9420f0d018e6444c76d94a69214773 | Python | holland-backup/holland | /holland/core/backup/base.py | UTF-8 | 12,662 | 2.578125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Define how backup plugins will be called
"""
import errno
import logging
import os
import sys
import time
from holland.core.plugin import PluginLoadError, load_backup_plugin
from holland.core.spool import Backup
from holland.core.util.fmt import format_bytes, format_interval
from holland.core.util.path import dir... | true |
90b02e56b2ef4fbc2add03e6077dabdc9d28eee7 | Python | WookeyBiscotti/TgReminderBot | /reminder.py | UTF-8 | 8,813 | 2.8125 | 3 | [] | no_license | import datetime
import re
import pytz
from calendar import monthrange
date_re = re.compile("(?P<day>\d{1,2}|\*)\.(?P<month>\d{1,2}|\*).(?P<year>\d{2,2}(?:\d\d)?|\*|0)")
time_re = re.compile("(?P<hours>\d{1,2}|\*)\:(?P<minutes>\d{1,2}|\*)(?:\:(?P<seconds>\d{1,2}))?")
def number(str_num):
try:
return int(... | true |
967e7ca7da9818365bb11c22030d7d30b0d76d22 | Python | avicse007/python | /ptrhonClass.py | UTF-8 | 546 | 3.96875 | 4 | [] | no_license | #!bin/python3
class Duck:
def __init__(self,color='white'):
self._color=color;
def setColor(self,color):
self._color=color
def getColor(self):
return self._color
def quack(self):
print("Quack quack !!!!!!!");
def walk(self):
print("Walk like a duck")
def main():
donald = Duck();
donald.quack()
donald.... | true |
7fcd4989b572c615526409788922d6ade4dff476 | Python | marcovankesteren/MarcovanKesteren_V1B | /Les6/pe6_5.py | UTF-8 | 101 | 3.5625 | 4 | [] | no_license | for line in range(1,11):
for table in range(1,11):
print(line * table, '\t',)
print() | true |
192076e68e9ae7b0e7442cfd5ccea2f83e262fbc | Python | m13253/scripts | /rand | UTF-8 | 252 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import random
import sys
if len(sys.argv) >= 3:
print(random.randint(int(sys.argv[1]), int(sys.argv[2])-1))
elif len(sys.argv) >= 2:
print(random.randint(0, int(sys.argv[1])-1))
else:
print(random.randint(0, 32767))
| true |
2bfabb367adf0352854eab1f22d1597af8b771bc | Python | mahehere/Python-Tutorials | /Healthy_Pgmr.py | UTF-8 | 2,037 | 4.03125 | 4 | [] | no_license | # 7.Healthy Programmer
""" There should a reminder for the below exercise in the specified intervals
Work Duration 9-5pm
1. water - water.mp3 - 3.5l water - input drank - timestamp log
2. eyes - eyes.mp3 - done - run every 30 minutes
3. phys activity - phy.mp3 - every 45 minutes
Rules
use pygame module"""
import pyg... | true |
45b350b41ead2b16c21bf386a81785c047aa0b5c | Python | meshyx/Delta-Arm | /ik.py | UTF-8 | 3,908 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
import math
class Ik:
'''Adapted from http://forums.trossenrobotics.com/tutorials/introduction-129/delta-robot-kinematics-3276/'''
def __init__(self, e = 75, f = 62, re = 155, rf = 88):
self.maxangle = 90
self.minangle = -75
self.e = e
self.f = f... | true |
464f51908f3df5dccc334197e9eedf57dd7d148b | Python | grey-area/advent-of-code-2017 | /day02/part2.py | UTF-8 | 341 | 2.828125 | 3 | [] | no_license | import numpy as np
from itertools import product
data = np.loadtxt('input', dtype=np.int64)
total = 0
for i in range(data.shape[0]):
for j1, j2 in product(range(data.shape[1]), repeat=2):
if j1 == j2:
continue
if data[i, j1] % data[i, j2] == 0:
total += data[i, j1] // data[... | true |
80285f101e9a7ccce8013bdd5f1e9d7b0f526a74 | Python | gas1121/JapanCinemaStatusSpider | /scrapyproject/models/showing_booking.py | UTF-8 | 1,064 | 2.609375 | 3 | [
"MIT"
] | permissive | from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy_utils import ArrowType
from sqlalchemy.orm import relationship
from scrapyproject.models.models import DeclarativeBase
from scrapyproject.models.showing import Showing
class ShowingBooking(DeclarativeBase):
__tablename__ = "showing_booking... | true |
8d59df8a96cdaab9cab9bd7da569228d8aae3d74 | Python | AkumuYuma/images_classifier | /back_end/main_api/app.py | UTF-8 | 2,406 | 2.796875 | 3 | [] | no_license | from flask import Flask, render_template, request, abort, jsonify
from flask_cors import CORS
from Database_adaptor import Database_adaptor
app = Flask(__name__)
database = Database_adaptor(app, "images", "localhost")
# Permetto le richieste CORS
CORS(app)
# Main path (test)
@app.route('/')
def hello_world():
""... | true |
779af78e99f3174ce03ab192998f5792ec209ed2 | Python | Devalekhaa/deva | /play26.py | UTF-8 | 48 | 2.71875 | 3 | [] | no_license | import re
s=input()
print (re.sub(' +', ' ',s))
| true |
c2d24e93f94348d63df7c1293382315d48b841b2 | Python | doduong0712/crawler-website | /crawldata/script.py | UTF-8 | 2,178 | 2.75 | 3 | [] | no_license | # Import
from selenium import webdriver
import csv
from bs4 import BeautifulSoup
driver = webdriver.Chrome(executable_path='.\Driver\chromedriver.exe')
url = 'https://www.agencyvietnam.com'
driver.get(url)
""" driver.find_element_by_id('5680').click() """
def GetURL():
page_source = BeautifulSoup(driver.page_sour... | true |
9bbd308008854206c57f4aefbdf8910ea86b89d6 | Python | ciprianprohozescu/georgia-tech-library | /Scripts/Setup/generate_volume.py | UTF-8 | 1,079 | 2.609375 | 3 | [
"MIT"
] | permissive | import random
random.seed()
f = open("populate_volume.sql", "w")
bookTotal = 10000
for i in range(1, bookTotal + 1):
volumeTotal = random.randint(0, 100)
if volumeTotal == 0:
continue
volumeTotal = random.randint(1, 5)
for j in range(1, volumeTotal + 1):
library = random.randint(0, 5... | true |
90887ab07ba62a7a414a990e05bc6558cc631a30 | Python | HyOsori/battle.ai | /game/pixels/PixelsParser.py | UTF-8 | 4,943 | 2.640625 | 3 | [
"MIT"
] | permissive | #-*-coding:utf-8-*-
import base64
import json
import sys
import zlib
sys.path.insert(0,'../')
from gamebase.client.AIParser import AIParser
class PixelsParser(AIParser):
def __init__(self):
pass
def parsing_data(self, decoding_data):
print("parsing_data is called")
base = super(Pixels... | true |
92193c0d69ea6220994e4d56da3d81fde4db72b1 | Python | LokeshVarman/Python | /calci.py | UTF-8 | 412 | 4.3125 | 4 | [] | no_license | print("CALUCULATING TWO NUMBERS")
a=float(input())
b=float(input())
print("1.add \n 2.subtract \n 3.divide \n 4.multiply \n 5.modulo" )
choice=input("enter your choice")
if choice=="1":
ans=a+b
print(ans)
if choice=="2":
ans=a-b
print(ans)
if choice=="3":
ans=a/b
print(ans)
if choice=="4":
ans=a*b
print... | true |
a73c5de5f63813d1ea00ab7cb85ea8a705e8fcb8 | Python | psxvoid/idapython-debugging-dynamic-enrichment | /DDE/Common/memobject.py | UTF-8 | 1,111 | 3.21875 | 3 | [
"MIT"
] | permissive | class MemObject(object):
def __init__(self, addr, deepness = 0):
self.addr = addr
self.deepness = deepness
def __repr__(self):
return "<MemObject at 0x{:X}>".format(self.addr)
def __eq__(self, other):
if isinstance(other, MemObject):
return self.addr == other.ad... | true |
f94dc577740c31034a28f049fcbfe314acf3cc2a | Python | GrishaAdamyan/All_Exercises | /Statistics.py | UTF-8 | 553 | 3.53125 | 4 | [] | no_license | def print_statistics(arr):
arr.sort()
if len(arr) != 0:
erkarutyun = len(arr)
mijin = sum(arr) / len(arr)
minimum = min(arr)
maximum = max(arr)
if len(arr) % 2 == 1:
mijnativ = arr[len(arr) // 2]
else:
mijnativ = (arr[(len(arr) // 2) - 1] +... | true |
11d41b600ae5aaf0d16df22ca822940e80e4f484 | Python | jeen0404/Text-to-speech-python | /entertext.py | UTF-8 | 1,387 | 3.234375 | 3 | [] | no_license | from gtts import gTTS
from playsound import playsound
import playmp3
#here you can add wellcome sound
'''
wellcome=""
playsound(wellcome)
'''
#this function is use to take input from user
def entertext():
text=str(input("enter the text"))
return text
#this is our main function it convert str... | true |
10c1deeb0339bfd4ef441d0ee63ff5d00cb09db5 | Python | pojem/PythonSelenium | /UdemySelenium/pytestDemo/test_demo2.py | UTF-8 | 650 | 2.828125 | 3 | [] | no_license | import pytest
@pytest.mark.smoke
@pytest.mark.skip
def test_firstProgram2():
msg = "hello"
assert msg == "hello", "test failed because condition is"
def test_secondProgram2():
a = 4
b = 6
assert a + b ==10, "addition do not match"
def test_CreditCard():
a = 4
b = 6
assert a + b == 10... | true |
a2eee3464c694a8f43b7bfff83203a674609b498 | Python | RachitVargas/segmentacion_SO | /unidad.py | UTF-8 | 615 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 20 23:36:23 2021
@author: antony.vargasulead.ac.cr
"""
class Unidad():
def __init__(self, disponible):
self.__unidad_disponible = disponible
self.__cola = []
@property
def unidad_disponible(self):
return self._... | true |
b0447875b660a63fe46083713315a1c0b1d02df8 | Python | ryantbvt/MotivationalTwitterBotPublic | /testing.py | UTF-8 | 1,546 | 2.796875 | 3 | [] | no_license | import tweepy
import time
print("Booting")
CONSUMER_KEY = 'yXM2wbNnSzYjDWmyjgSJx72I2'
CONSUMER_SECRET = 'vIU6koLTE1vUe4X4PycNYHONg4kViO02IgF3DU5P3cDvMrLW76'
ACCESS_KEY = '1247728862340972544-XXBsavSHzZPItSOTyNOUEmyhmy8ZSN'
ACCESS_SECRET = 'ZaURSeuvtT3t10K2F0pM8K8WNjHVwuuuAMomcBM80OZll'
#API commands
auth ... | true |
66e76c2ba97274dd8efbe9bb5e19f531b4a686c0 | Python | suyanzhe/291_take_home_final_code | /2.py | UTF-8 | 2,841 | 3.65625 | 4 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Line search on f(x)=x^4
def steepest_descent_x4(alpha, x):
derivative = 4 * np.power(x, 3)
return x - alpha * derivative
def compute_optimal_step_size(x):
derivative = 4 * np.power(x, 3)
return x / derivative if deriva... | true |
4e8648c22b32bbaf2fe94e4d964df2509484cc60 | Python | charlesdaniels/teaching-learning | /data_structures/simple_fa/simple_fa.py | UTF-8 | 8,736 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# Copyright (c) 2018, Charles Daniels
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... | true |
318962fb662e6234ac2a0718798aeb341e81f9c1 | Python | indunilLakshitha/Phthon- | /2.3 Dictionaries.py | UTF-8 | 141 | 2.953125 | 3 | [] | no_license | dict1={'name':'John','age':21,'maths':88,'chem':92,'phys':96,11:0}
dict1[11]=(dict1['maths']+dict1['chem']+dict1['phys'])/3.0
print(dict1)
| true |
79a1ba7a35ada26d5f1a6d1a9009d5340a811253 | Python | johnmapesjr/General | /Neural Net/nn2layer.py | UTF-8 | 1,836 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
def g( x ): return x
class Node( ):
def __init__( self ):
self.value = 0.0
self.i_connections = [ ]
self.o_connections = [ ]
def update( self ):
summation = 0.0
for connection in self.i_connections:
summation += connection.weight * connection.node.value
self.value = g( summation )
... | true |
c9b1b33cb1cb362d56c9b2f0a137184ae2c9029e | Python | WONJUNGHEE/algorithm_practice | /programmers/level2/다리를 지나는 트럭.py | UTF-8 | 633 | 2.625 | 3 | [] | no_license | def solution(bridge_length, weight, truck_weights) :
truck_weights = truck_weights[::-1]
n = len(truck_weights)
passing_weight = [0]*n
passed = []; passing = []
i = 0; j = -1
while len(passed)<n :
if len(truck_weights)>0 and sum(passing) + truck_weights[-1] <= weight :
... | true |
7fabb5a1e468612e0a75011463c4ad840acedd3d | Python | eliotbush/super-duper-dollop | /echo_client2.py | UTF-8 | 387 | 3.140625 | 3 | [] | no_license | import socket
ip = "10.0.0.69"
port = 50149
# Connect to the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
# Send the data
message = 'Hello, world'
print('Sending : "%s"' % message)
len_sent = s.send(message.encode('ascii'))
# Receive a response
response = s.recv(len_sent).decod... | true |
3e78e946e0acc7a628dad75c895660db04133635 | Python | Yelp/Tron | /tests/utils/crontab_test.py | UTF-8 | 3,953 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | from unittest import mock
from testifycompat import assert_equal
from testifycompat import assert_raises
from testifycompat import run
from testifycompat import setup
from testifycompat import TestCase
from tron.utils import crontab
class TestConvertPredefined(TestCase):
def test_convert_predefined_valid(self):
... | true |
428e92490512c182f123cae0be56ebc9dbe772d3 | Python | mars-project/mars | /mars/tensor/base/array_split.py | UTF-8 | 1,631 | 3.03125 | 3 | [
"BSD-3-Clause",
"MIT",
"ISC",
"Apache-2.0",
"CC0-1.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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-... | true |
b880eae365dc7d7994e1b6d4a10c33844d37aa1e | Python | anitera/distributedhw2 | /sessions_authorization.py | UTF-8 | 4,962 | 2.609375 | 3 | [] | no_license | import os
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
try:
import tkMessageBox as tkBox
except ImportError:
from tkinter import messagebox as tkBox
sessionname_return = ''
sessuionsize_return = 0
choice = ''
from threading import Thread
import select
from protocol import *
fro... | true |
e12e8d5cfca1a76ec21fe99412e7589264b9d7fa | Python | val2k/algorithms | /sort/quicksort.py | UTF-8 | 291 | 3.3125 | 3 | [] | no_license | #!/usr/bin/python3.4
def quicksort(liste):
if liste == []:
return []
pivot = liste.pop(0)
bigger = list(filter(lambda x: x > pivot, liste))
smaller = list(filter(lambda x: x <= pivot, liste))
return (quicksort(smaller) + [pivot] + quicksort(bigger))
| true |
c87f8fe4ffd4942a56a60ae694f24ace7c727e9b | Python | alvas-education-foundation/ISE_3rd_Year_Coding_challenge | /4AL17IS012_Danush_Kumar/PradeepSir_codingchallenge/PradeepSir_codingchallenge1/prg3.py | UTF-8 | 338 | 4.03125 | 4 | [] | no_license | ''' 3) Write a program to get a date before and after 1 year compares to the current date. '''
from datetime import date as t
from datetime import timedelta as t1
current = t.today()
before = (t.today()-t1(days=365))
after = (t.today()+t1(days=365))
print("Current Date: ",current)
print("Before : ",before)
print... | true |
89fa90a5d39288bce86942d42297dcf0ff8f6ff9 | Python | vicflair/climate_change_project | /process_kpex.py | UTF-8 | 586 | 2.546875 | 3 | [] | no_license | import numpy
import tokenize
import re
fname = 'enb_corpus_kpex.kpex_n9999.txt'
with open(fname, 'r') as f:
data = f.readlines()
for i in range(0, 10):
line = data[i]
with_synonym = re.search('([^:]*)::SYN::([\w]*),F ([\d]*)', line)
if with_synonym:
concept = with_synonym.group(1)
syno... | true |
a9aa44d0f0845e225f568a00cc81d0298cb89b10 | Python | wellington16/BSI-UFRPE | /2016.1/Exércicio LAB DE PROGRAMAÇÃO/Exercício 2016.1/Exercícios/E10/wellington_luiz_E10.py | UTF-8 | 6,759 | 3.1875 | 3 | [] | no_license | import sys
import os
# Limpar o video
if sys.platform.startswith("Win32"):
os. system("cls")
elif sys.platform.startswith("Linux"):
os.system("clear")
#Autor Wellington Luiz
'''
UNIVERSIDADE FEDERAL RURAL DE PERNAMBUCO - UFRPE
Curso: Bacharelado em Sistemas de Informação
Disciplina: Laboratóri... | true |
f9c26179c87704b3a4b6bdc5fc5a9b782f10ff29 | Python | mrtoss/G2_TLS_Inspired_Custom_Secure_network_communication_System | /src/RSA/mod_exp/modexp.py | UTF-8 | 1,033 | 3.671875 | 4 | [] | no_license | import math
import time
def exp_func(x, y, n):
exp = bin(y)
exp = '0b0000' + exp[2:]
print ("Binary value of y is:",exp)
print ("Bit\tResult")
if exp[2] == '1':
value = x
else:
value = 1
for i in range(3, len(exp)):
value = (value * value) % n
print (i-1,":\t",... | true |
e43fbf2e4e6fac72f5a18501f09a53c4dc74db07 | Python | ftorto/Bubulle-Norminette | /utils/error_handling.py | UTF-8 | 2,588 | 2.640625 | 3 | [] | no_license | import re
from utils.string_utils import colors
errors = []
args = None
class BuError():
def __init__(self, file_name, errid, level, line, message):
self.file_name = file_name
self.errid = errid
self.level = level
self.line = line
self.message = message
def print_erro... | true |
e7828bb1ea4c4ff70264a6f5da42cbd7322c9e3d | Python | dharmesh-coder/Full-Coding | /Extra/freq.py | UTF-8 | 203 | 2.9375 | 3 | [] | no_license | n=int(input())
l=list(map(int,input().strip().split()))[:n]
mydict={}
for i in l:
if i in mydict:
mydict[i]+=1
else:
mydict[i]=1
print(mydict)
Keymax = max(mydict, key=mydict.get) | true |
ffdaaccf23c7f45eb5d4e49d3bd0685b175ae683 | Python | zcutlip/pyonepassword | /tests/fixtures/expected_vault_data.py | UTF-8 | 2,066 | 2.71875 | 3 | [
"MIT"
] | permissive | import datetime
from typing import Dict
from ..test_support._datetime import fromisoformat_z
from .expected_data import ExpectedData
class ExpectedVault:
def __init__(self, vault_dict: Dict):
self._data = vault_dict
@property
def unique_id(self) -> str:
return self._data["id"]
@prop... | true |
a1740b28f4e8a33ea94fe3f8133dca39013722f0 | Python | dionysus/coding_challenge | /leetcode/035_SearchInsertPosition.py | UTF-8 | 1,379 | 3.5625 | 4 | [] | no_license | from typing import List
def searchInsert(nums: List[int], target: int) -> int:
"""
>>> searchInsert02([], 0)
0
>>> searchInsert02([1], 0)
0
>>> searchInsert02([0], 1)
1
>>> searchInsert([1,3,5,6], 5)
2
>>> searchInsert([1,3,5,6], 2)
1
>>> searchInsert([1,3,5,6], 7)
... | true |
5d2ff6bf44c62ba1f1317fdbcec93abe90583502 | Python | jimin0826/python-study | /Algorithm & Data Structure/sorting/selection_sort.py | UTF-8 | 944 | 4.21875 | 4 | [] | no_license | def swap(arr, i, j) :
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def selectionSort(arr) :
for i in range(len(arr) - 1) :
min_num = arr[i] # initialization of minimum number
min_index = i # initialization of index of the minimum number
for j in range(i+1, len(arr)) :
if(arr[j] < min_num)... | true |
e2eb2a1567d2a0123e6657b9f86a078ef21d549d | Python | kklamm/MovieRecommendations | /get_data.py | UTF-8 | 732 | 2.75 | 3 | [] | no_license | import argparse
import pathlib
import urllib.request
import zipfile
URLS = {
"small": "http://files.grouplens.org/datasets/movielens/ml-100k.zip",
"medium": "http://files.grouplens.org/datasets/movielens/ml-1m.zip",
"large": "http://files.grouplens.org/datasets/movielens/ml-10m.zip"
}
def get_dataset():... | true |
96516983bf38a4d73019cf7a748cc5111b55913e | Python | ebjarkason/randomTSVDLM | /src/CholeskyCMinv.py | UTF-8 | 957 | 2.53125 | 3 | [] | no_license | # Evaluate the Cholesky factors of the regularization matrix R = W^T W = CM^(-1):
# Coded by: Elvar K. Bjarkason (2017)
import scipy as sp
import numpy as np
import scipy.sparse as sparse
import evalRegularJacobian
import SaveLoadSparseCSRmatrix as slspCSR
from scipy.sparse import csr_matrix
from scipy.linalg... | true |
f9d1189907f799778050a0758ba57c838cb0d07f | Python | alexloboo/BanckPrediction | /BankPrediction.py | UTF-8 | 14,685 | 2.578125 | 3 | [] | no_license | import tkinter as tk
from tkinter import Entry, LabelFrame
from tkinter import messagebox
from tkinter import ttk
from tkinter.constants import COMMAND, END, VERTICAL
#--------------------------generación modelo, predicción
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score
from... | true |
2423f8a264332dc5ea82c0a07fa31eeade44d150 | Python | carminelaluna/Leetcode-Solutions | /Medium/55-jump_game.py | UTF-8 | 1,089 | 2.765625 | 3 | [] | no_license | class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
neg = []
zero = []
pos = []
res = []
for n in nums:
if n < 0:
neg.append(n)
if n > 0:
pos.append(n)
if n == 0:
zero.app... | true |
c9c47e5f2e8bdcf853f10b0f5ce1808cf32c92b9 | Python | sameer-sarmah/python-concepts | /core/exception_handling.py | UTF-8 | 519 | 3.5625 | 4 | [] | no_license | def divide(numerator,denominator):
try:
result = numerator/denominator
print(result)
except ValueError:
raise Exception('Only number accepted')
except ZeroDivisionError:
raise Exception('zero cant be the denominator')
except:
raise Exception('Either one of the arg... | true |
a08c9e74651b4e99fe3da050289a46c927cb97e4 | Python | fc731097343/csmathHW04 | /LM.py | UTF-8 | 1,124 | 2.765625 | 3 | [] | no_license | import math
import numpy as np
import random
#find one extremum for function y = a *sin(b*x)
a = 2
b = np.matrix([1,2])
x = np.matrix([[3],[2.5]])
gk_norm = 100
k = 0
epson = 1e-13
mu = 0.1
fk = a * math.sin(b * x)
maxk = 1000
qk = 1
while(gk_norm > epson and k < maxk):
gk = a * b * math.cos(b * x)
Gk = -1 *... | true |
d843a56eef66cbfe88b70cc505284dc22e507935 | Python | Xavi-phil/testgit | /sqlitetest.py | UTF-8 | 1,348 | 2.796875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
#获取并打印google首页的html
import urllib.request
from bs4 import BeautifulSoup
import time
import json
from urllib.parse import urlparse
import os
def getdata(url='http://www.nufe.edu.cn'):
response=urllib.request.urlopen(url)
html=response.read()
print(html)
bs = BeautifulSoup(html,"html... | true |
a3f64c85ea1d03245f8338797b158f15ecad1b89 | Python | BussHsu/AI | /A*Search/Heuristics.py | UTF-8 | 1,157 | 3.328125 | 3 | [] | no_license | from state import *
class SimpleHeuristic:
def __init__(self,env):
self.env = env
self.goal = Point(env.end_x,env.end_y)
def heuristic(self, state, goal= None):
if goal is None:
goal = self.goal
start = state.pos
a=(goal-start).abs_sum()
b=abs(self.en... | true |
1f27132f62e59235ac034ea275fa9f785bd23475 | Python | vasana12/python_python_git | /python_Source/Test.Py/re02.py | UTF-8 | 338 | 2.90625 | 3 | [] | no_license | #-*-coding:utf8 -*-
import re
#이스케이프 문자 적용되지 않는 코드
r=bool(re.search('\\\\\w+','\lanana'))
print(r)
#이스케이프 문자 적용한 코드
r02=bool(re.search(r'\\\w+',r'\banana'))
print(r02)
print(re.search('\\\\\w+','\\banana'))
print(re.search('\\\\\w+','\\banana'))
print(re.search(r'\\\w+',r'\banana')) | true |
e05b20f600d0abf2c70993762879f8592f2c9650 | Python | xiaoyisha/cut | /cut1/main.py | UTF-8 | 1,423 | 2.515625 | 3 | [] | no_license | from PyQt5 import QtWidgets
from helloWorld import Ui_MainWindow
from PyQt5.QtWidgets import QFileDialog, QApplication
from cut import videoCut
import sys
from PyQt5.QtCore import *
class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super(MyWindow, self).__init__()
self.setup... | true |
1e85f08fabdec93ae08ce97acfefee2e2a463b29 | Python | virtualcell/test_suite | /report_generation/combine/omex_maker.py | UTF-8 | 4,499 | 2.734375 | 3 | [
"MIT"
] | permissive | """ OMEX archive generator
:Author: Akhil Marupilla <marupilla@mail.com>
:Date: 2020-11-23
:Copyright: 2020, UConn Health
:License: MIT
"""
from libcombine import *
from report_generation.utils.files_list import get_file_list
from report_generation.config import Config
from logzero import logger
class GenOmex:
... | true |
e14332b22d78fe35e8fe0442f25c082e483ea57a | Python | CrkJohn/MITx-6.00.2x | /UNIT2/ProblemSet2/Problem5RandomWalkRobot.py | UTF-8 | 527 | 3.203125 | 3 | [] | no_license | class RandomWalkRobot(Robot):
"""
A RandomWalkRobot is a robot with the "random walk" movement strategy: it
chooses a new direction at random at the end of each time-step.
"""
def updatePositionAndClean(self):
newPosition = self.getRobotPosition().getNewPosition(self.d,self.speed)
if... | true |
a95b881e058ea943eddc53be85f8383b7f55e7ae | Python | bambreeze/sandbox | /python/hexdump.py | UTF-8 | 529 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
import os, sys, string
fname = sys.argv[1]
fname2 = sys.argv[1] + '.hex'
infile = file(fname, "rb")
outfile = file(fname2, "wb")
counter = 0;
while 1:
c = infile.read(1)
if not c:
break
#outfile.write("%02s" % hex(ord(c)))
if ord(c) <= 15:
outfile.write(("0x0"+hex(o... | true |
7c9452d2468a17734a0ff8bfba44eedf19283dfa | Python | Kosov234/University | /Python/(updated)5(5).py | UTF-8 | 872 | 3.625 | 4 | [] | no_license | ##function that reads the file line by line, sorts them by size and writes them to another file
def function(inpu,outpu):
buffer = []
read = open(inpu,'r')
write = open(outpu,'w+')
for line in read:
buffer.append(line)
print(buffer)
i=0
indent = 1
while(i<len(buffer)-... | true |
ee04e4008cae41776e61eff579af1581cd8cf460 | Python | Frogboxe/pygame-pong | /render.py | UTF-8 | 689 | 3.046875 | 3 | [] | no_license |
from __future__ import annotations
from dataclasses import dataclass
import pygame
from vector import Vector
class Render:
"""
A pygame.Surface wrapped with a Vector to simply
allow textures to have an offset from their parent's
Vector pos. This is slotted.
.texture: pygame.Surface
.offse... | true |
fd09333a1d50cd99cf64a4d1b2f6ddaf0cb6b87d | Python | Sarveshgithub/Python-DS-ALgo | /HackerRank/array-left-rotation.py | UTF-8 | 317 | 3.171875 | 3 | [] | no_license | def leftRotation(a, d):
# while d != 0:
# firstElement = a[0]
# for i in range(len(a) - 1):
# a[i] = a[i + 1]
# a[len(a) - 1] = firstElement
# d -= 1
return " ".join(a[d:] + a[:d])
d = int(input().split(" ")[1])
a = input().split(" ")
print(leftRotation(a, d))
| true |
d5040c09792448165fd82a0644e9f912fe4b92bf | Python | Jaime-alv/Blackjack | /blackjack.py | UTF-8 | 24,364 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | # ! python3
# Copyright 2021 Jaime Álvarez Fernández
# 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 law or agreed t... | true |
b371bf5571195643df0e9506e01ae47f8ebf34b2 | Python | shahf14/ClientToServer | /Server.py | UTF-8 | 671 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 21:12:33 2019
@author: shahf
"""
import socket
import logging
logging.basicConfig(filename = 'Server_Record.log',level=logging.INFO)
logger = logging.getLogger()
with socket.socket(socket.SOCK_DGRAM) as s:
s.bind(('127.0.0.1', 65432))
s.list... | true |
63de2c824ed67dd798dfc6163f09c5a627eab83d | Python | Nyuhnyash/lab | /oop/lab1/5.py | UTF-8 | 131 | 3.109375 | 3 | [] | no_license | def solve(x0: float):
x = x0
k = 0
while x < 0:
k += 1
x = 1 + x / k
return k
print(solve(-100))
| true |
b09d6c471a4f7938a0c994614387d3a92f165abd | Python | disclaimedication/Fortigate | /Fortigate_Blacklist_using_list.py | UTF-8 | 2,793 | 2.90625 | 3 | [] | no_license | # Importing modules
import paramiko
import datetime
import sys
def validate_ip(s):
a = s.split('.')
if len(a) != 4:
return False
for x in a:
if not x.isdigit():
return False
i = int(x)
if i < 0 or i > 255:
return False
return True
... | true |
8b30fd3b35ab2f8021d85ddc9bdc2206abaf8f52 | Python | PrajaktaSelukar/Sorting-Visualizer | /Tkinter_GUI/sortingAlgorithms.py | UTF-8 | 3,664 | 3.40625 | 3 | [] | no_license | #Tkinter is used for developing GUI
from tkinter import *
from tkinter import ttk
import random
#create a random new array
#root is the name of the main window object
root = Tk()
root.title('Sorting Algorithm Visualizer')
#setting the minimum size of the root window
root.minsize(900, 600)
root.config(b... | true |
3c4e010d0162dfd33affc1695c0b2ecbf0f985a1 | Python | tlee8/soff | /03_occupation/LeeLee_leeT-leeB.py | UTF-8 | 2,155 | 3.828125 | 4 | [] | no_license | # Team LeeLee - Thomas Lee and Brian Lee
# SoftDev1 pd6
# K06 -- StI/O: DIvine Your Destiny!
# 2018-09-13
import random
d = {}
def read_jobs():
"""
Return a dictionary containing data on jobs in the US.
"""
with open("occupations.csv") as csv:
lines = csv.readlines()
for line in line... | true |
2a3711b40143eea2a6fb9495368cf17dbb86d63e | Python | heiheitian/MordenProgramDesign | /homework5/server.py | UTF-8 | 4,932 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import socket
import thread
import random
import hashlib
import urllib, urlparse
import time
connLock = 0
def sendMsg(conn, msg):
while connLock == 1:
continue
connLock = 1
conn.send(msg)
connLock = 0
class player():
username = ''
token = ''
point = 0
gu... | true |
ebb3a1096b741b3676f910cb5297ffbc1b525c6e | Python | LandenBrown/ProjectFrog | /Main.py | UTF-8 | 881 | 3.421875 | 3 | [] | no_license | #this is the start of something great
###initial planning:
#Frogs: 2
#Predators: 1
#
#
#
#
#
import time
versionNumber = "0.1"
sysQuit = "x"
print ("Welcome to the Prject Frog, Version", versionNumber)
print("Press X to randomize population and biome data...")
#Initial
p_input = input()
if p_input == "X" or p... | true |
9799d8cd924ef4621fdd49b4346983f4db048334 | Python | danieta/autonomous_systems | /ekf_localization/ros/src/ekf_localization_ros/ekf_localization_node.py | UTF-8 | 23,769 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ROS python api with lots of handy ROS functions
import rospy
# to be able to get the current frames and positions
import tf
# to be able to subcribe to laser scanner data
from sensor_msgs.msg import LaserScan
# to be able to publish Twist data (and move the robot)
fro... | true |
61c2b9ba73d71d42c6b9bd54a55d8f40f3eddc9a | Python | RenzoPL23/TF_Complejidad | /1°algoritmo.py | UTF-8 | 1,744 | 2.8125 | 3 | [] | no_license | import math as mt
import heapq as hq
def asd(x):
num = x.split(',')
return int(num[0]),float(num[1])
def LeerListAP(filename):
G=[]
file= open(filename,'r',encoding='utf8')
for line in file:
G.append([asd(x) for x in line.split( )])
return G
def prim(G,s,t):
n = len(... | true |
27c010237574a5b7837077312addd644d3aeecb9 | Python | Nexz/easybackup | /easy-backup.py | UTF-8 | 2,601 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# Norbert van Adrichem / 2019 / www.norbert.in
import argparse
import shutil
import os
import time
version = "0.1"
parser = argparse.ArgumentParser()
current_backup = ""
current_folder = ""
def parser_setup():
parser.add_argument("source", help="The directory that contains the files to be backu... | true |
ae9f3ec2f8b3a30fba2e597972077f5bb126d3be | Python | sebastien/literate | /src/literate.py | UTF-8 | 18,061 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
# encoding=utf8 ---------------------------------------------------------------
# Project : Literate.py
# -----------------------------------------------------------------------------
# Author : FFunction
# License : BSD License
# -----------------------------------... | true |
c94d7babba347d01fe79133562eaac31bad071ba | Python | AnthonyCarrasco/MSLcompiler | /recursiveDescentParser.py | UTF-8 | 7,350 | 3.15625 | 3 | [] | no_license | ''' Recursive Descent Parser '''
''' It verifies the list of tokens from scanner/lexer'''
''' Are valid for MSL Grammar '''
''' Import the lexer '''
from scanner import *
''' The grammar is as follows '''
''' Program -> [RESERVE int] { PROC-DEC } series "." '''
def program(tokens):
print("entering program routine... | true |
1d28f8224671bb524adb512e9d708e598ea1227d | Python | ljrodriguez1/llevame-opti | /main.py | UTF-8 | 3,165 | 2.90625 | 3 | [] | no_license | from parametros import *
import googlemaps
import pandas as pd
from usuarios import Usuario
import requests
import random
def cargarUsuarios(path):
dataUsuarios = pd.read_csv(path)
#print(dataUsuarios.keys())
usuarios = []
for num in range(len(dataUsuarios)): #range(len(dataUsuarios))
nombre... | true |
640a6241753a0fc8f7b241cab208a84d296ea85f | Python | BrianThomasRoss/juxta-city-data-ds | /test_main.py | UTF-8 | 751 | 2.546875 | 3 | [
"MIT"
] | permissive | import os
import psycopg2
import unittest
import pandas as pd
from dotenv import load_dotenv
load_dotenv()
DB_NAME = os.getenv("DB_NAME")
DB_HOST = os.getenv("DB_HOST")
DB_PASS = os.getenv("DB_PASS")
DB_USER = os.getenv("DB_USER")
connection = psycopg2.connect(database=DB_NAME, user=DB_USER,
... | true |
7603005f5c613ab42505e1a700381d37ca1d0b30 | Python | kevburke24/TexasHoldEm-Python | /Modules/stud_poker_hand.py | UTF-8 | 3,867 | 4.09375 | 4 | [] | no_license | """Class creating an object representing a stud poker hand consisting of 2 hole cards
I affirm that I have carried out my academic endeavours with full academic honesty-
Kevin Burke"""
from card import Card
from community_card_set import CommunityCardSet
from itertools import combinations
from poker_hand im... | true |
a9e9f12a55e02b66ea774fd81e7d9244ea889f8a | Python | orlandodiaz/pdbox | /examples/strategies/strat_adx.py | UTF-8 | 5,682 | 2.84375 | 3 | [] | no_license | from backtest.strategy import *
from datetime import time, datetime
class ADXStrat(Strategy):
def __init__(self, name):
super(ADXStrat, self).__init__(name)
self.direction = "long"
self.bar_interval = "5min"
self.body = 0
self.bear_shadow = 0
def get_buy_coordinates(... | true |
7152f6596be72451add79a8770dbb4831179005a | Python | maifatai/image-processing | /code/ThresholdSegmentation.py | UTF-8 | 4,270 | 2.953125 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
阈值分割:OTSU、TRIANGER、熵算法、自适应阈值分割
二值图像的与、或、非、异或运算
'''
src=cv2.imread('lena.jpg',0)
plt.figure('histogram')
plt.title('plt:histogram of lena')
plt.hist(src.ravel(),256)
plt.show()
'''
全局阈值分割
'''
ret,binary_img=cv2.threshold(src,127,255,cv2.THRESH_BINARY)#必须... | true |
48afdd2c6a7ee99df28c357d9b0ca05e520097b4 | Python | huozhiwei/Python3Project | /TCPAndUDP/demo01.py | UTF-8 | 1,366 | 3.78125 | 4 | [] | no_license | # TCP与UDP编程
# TCP: 传输控制协议,面向连接的,保证数据的可达性
# UDP: 数据报协议,无连接的,不能保证数据一定可以到达另一端
# Socket (套接字)
# socketServer模块
# 建立TCP服务端
"""
1. 创建Socket对象
2. 绑定端口号
3. 监听端口号
4. 等待客户端Socket的连接
5. 读取从客户端发过来的数据
6. 向客户端发送数据
7. 关闭客户端Socket连接
8. 关闭服务端的Socket连接
"""
# 以下代码为服务端代码
# 9876
from socket import *
host = "" # ip
bufferSize = 1024 # ... | true |
89134d9f591b19f8cdf15214a90ced07ab81f633 | Python | bintangbhp/dasar-pemrograman-1 | /lab/lab01/lab01.py | UTF-8 | 781 | 3.5625 | 4 | [] | no_license | # Untuk memanggil/mengimpor moodul turtle
import turtle
# Untuk mengubah warna turle menjadi biru
turtle.color("blue")
# Untuk mengaktifkan mode menggambar
turtle.pendown()
# Maju 100 satuan dari posisi awal
turtle.forward(100)
# Berputar 144 derajat ke kiri
turtle.left(144)
# Maju 200 satuan
turtl... | true |
4b3cc1b6cdf517fa1c0c0845fe557cd713ffc46d | Python | Shaurya0802/C99 | /shutilfile.py | UTF-8 | 267 | 3.03125 | 3 | [] | no_license | import os
import shutil
path = "E:/Python/C99/folder"
print("Before Copying File: ")
print(os.listdir(path))
source = "E:/Python/C99/abc"
destination = "E:/Python/C99-test"
dest = shutil.move(source, destination)
print("After Copying file:")
print(os.listdir(path)) | true |