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
8a66856761553707c99f5dce0359aa6ab4d4ab8a
Python
Diegoslourenco/CS50x
/pset6/cash/cash.py
UTF-8
428
3.359375
3
[]
no_license
from cs50 import get_float change = 0 coins = 0 while True: change = int(get_float("Change owned: ") * 100) if change > 0: break while change > 0: if change >= 25: change -= 25 coins += 1 elif change >= 10: change -= 10 coins += 1 elif change >= 5: ...
true
85cc5f7329c3d798dbf99ff69407d66d1184b3bb
Python
Jhonnis007/Python
/ex040.py
UTF-8
676
4.4375
4
[]
no_license
''' Crie um programa que leia duas notas de um aluno e calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida: - Média abaixo de 5.0: REPROVADO - Média entre 5.0 e 6.9: RECUPERAÇÃO - Média 7.0 ou superior: APROVADO ''' n1 = float(input('Digite a primeira nota:')) n2 = float(input('Digite a ...
true
05b276ce581c9fb22377e11f385446bf4abbf0da
Python
ningtangla/escapeFromMultipleSuspectors
/src/envWithProbabilityDistractor.py
UTF-8
14,274
2.5625
3
[ "MIT" ]
permissive
import os import numpy as np import pandas as pd import pygame as pg import itertools as it import random import anytree import AnalyticGeometryFunctions as ag import math #np.random.seed(123) class TransitionFunction(): def __init__(self, resetPhysicalState, resetBeliefAndAttention, updatePhysicalState, transiteS...
true
8844eb7bd7fe53155941389742878375068f84e4
Python
breezekiller789/LeetCode
/428_Serialize_And_Deserialize_N_ary_Tree.py
UTF-8
2,060
3.578125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://leetcode.com/problems/serialize-and-deserialize-n-ary-tree/ class Node(object): def __init__(self, val=None, children=None): self.val = val self.children = children root = Node(1, []) root.children.extend([Node(3, []), Node(2, []), Node(4...
true
d212a18a7a969c06ee33da3aac8a47bad3ce46dd
Python
mwappner/Tesis
/Analisis cantos/recortar.py
UTF-8
2,685
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 3 12:26:24 2018 @author: Marcos """ import numpy as np from PIL import Image import os #from skimage import filters #para otsu motivoPath = os.path.join(os.getcwd(),'Motivos') sonoPath = os.path.join(motivoPath,'Sonogramas','Nuevos') sonoFiles = os.listdir(sonoPath) s...
true
13f141517da93da4396c756e1bc7b376d9daa516
Python
srisivan/python
/newton_law_gravity.py
UTF-8
869
4.46875
4
[]
no_license
# A program to get the approximate value of newton's law. print("This is a program to calcute the Force between two bodies, Using Newton's law of gravity.") Gravitational_constant = 6.67 * 10 ** -11 print(" ") Mass1 = int(input("Enter Mass of Body 1 \n")) Mass2 = int(input("Enter Mass of Body 2\n")) Distance = i...
true
7d88ce1ed07182f09687de87bdd6c076b3be251c
Python
afarahi/XCat
/XCat.v.0.0.1/source/healpy/rotator.py
UTF-8
28,784
2.953125
3
[]
no_license
# # This file is part of Healpy. # # Healpy is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Healpy is distributed in the h...
true
bdcfe91f87f75643c538b14f79ab700ccd3e8231
Python
lynardsalingujay/myevo_odoopython
/svn_myevo/trunk/chicken_api/json/replay.py
UTF-8
360
2.515625
3
[]
no_license
import requests import sys def getFileContent(pathAndFileName): with open(pathAndFileName, 'r') as theFile: data = theFile.read() return data def main(): URL = "http://localhost:5202/chicken/api/order/create" data = getFileContent(sys.argv[1]) r = requests.post(url=URL, data=data) print r.t...
true
ab4b697ada072459918f2b570ae1ac24a596cbad
Python
AneliyaPPetkova/Programming
/Python/5.ModulesAndTime/2.MostProfitableDate.py
UTF-8
800
3.703125
4
[]
no_license
""" Find the most profitable date from a file with data """ from datetime import datetime from datetime import date FILENAME = './CommonResources/sales.csv' sales = {} maxProfit = 0.0 dateWithMaxSales = date.today() with open(FILENAME) as f: for line in f: sale = line.strip().split(",") dayAndTime...
true
357c23c386f0710f63539bc76fc94bda83bee50a
Python
smraus/python
/43.py
UTF-8
1,387
2.78125
3
[]
no_license
# 43-what is machine learning # 1-import data # 2-clean data # 3-split the data into training/test sets # 4-create a model # 5-train the model # 6-make predictions # 7-evaluate and improve the predictions # ------------------------------------------ # 44-machine learning libraries and tools # 1-numpy # 2-panda # 3-ma...
true
007179df592f22e3b4db5cfccd820446655c66a7
Python
odubno/algorithms
/stack_queue_deque/queue.py
UTF-8
602
3.9375
4
[]
no_license
# An ordered collection of items. # New items are added at one end -> the "rear" # Items are removed from the other end -> the "front" # FiFo, first-in first-out or "first-come first served" # The item that has been in the queue the longest is in the front class Queue: def __init__(self): self.items = [] ...
true
1c5c6e8e529ef6ad77c61303d93f6567e67fce60
Python
AvinashSingh1996/Vaibhav_Codes
/Practise_Codes/printing_citizend.py
UTF-8
826
3.6875
4
[]
no_license
class Citizen: def __init__(self, state, men, women, children): self.state = state self.men = men self.women = women self.children = children def show(self): print("State =>",self.state) print(" Men =>",self.men) print("Women =>",sel...
true
f09b79d3cc708a7e92a82b1465f9df3f8e3fc382
Python
darkyvro1/REXA
/pokebrbot.py
UTF-8
18,178
2.625
3
[]
no_license
import time import random import telepot import pickle import schedule import PokeFight import _thread """ PokeBot versão beta Bot criado com o propósito de aprender programação. possui alguns comandos simples e uma batalha. """ pokelist = pickle.load(open("pokelist2.p", "rb")) battledic = {} battledic[0] = PokeFight....
true
655f98c7b9eee540ccd3c41fcfe9c5b807d76bae
Python
garnachod/tfg
/sources/tests/Research/NLP/test_tweets.py
UTF-8
2,750
2.59375
3
[]
no_license
# gensim modules from gensim import utils from gensim.models.doc2vec import TaggedDocument from gensim.models.doc2vec import LabeledSentence from gensim.models import Doc2Vec from collections import namedtuple import time import random from blist import blist # numpy import numpy as np class LabeledLineSentence(obje...
true
e0c9c760834ca9fffa5ed8f4bf7492b8af706739
Python
codeAligned/LEETCodePractice
/Python/PerfectNumber.py
UTF-8
337
3.15625
3
[ "MIT" ]
permissive
class Solution(object): def checkPerfectNumber(self, num): """ :type num: int :rtype: bool """ if num <= 1: return False total = 1 for i in range(2, int(num**0.5) + 1): if num % i == 0: total += i + num / i ret...
true
41555654dba2071ee9e7970bc713f6178f760c53
Python
ucaiado/SignLgRecognizer
/aind/my_recognizer.py
UTF-8
1,918
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- """ Implement a recognizer that used models already trained to classify unseen data @author: udacity, ucaiado Created on 10/03/2017 """ import warnings from aind.asl_data import SinglesData def recognize(models: dict, test_set: SinglesData): """ Recognize test word seq...
true
2035dcdbcee398f9cddd4602dc0427491a6cda3b
Python
0n1cOn3/YT_View_Bot
/viewbot_1.py
UTF-8
1,597
2.53125
3
[ "Unlicense" ]
permissive
#!/usr/bin/python3 import random import bs4 as pi import requests as R from requests.exceptions import ConnectionError import headers as H class test: def __init__(self, url): self.url = url def views(self): Z = R.get(self.url) X = pi.BeautifulSoup(Z.content.decode('utf-8'), 'html5lib')...
true
804a755051c62914286c61b4ba474bf8998679d4
Python
khalidalmuhawis/calculator
/calculator.py
UTF-8
775
4.21875
4
[]
no_license
def main(): first_number = input("Enter the first number: ") second_number = input("Enter the second number: ") operation = input("Choose an operation: ") if first_number.isdigit() and second_number.isdigit(): first_number = int(first_number) second_number = int(second_number) ...
true
19bcd8a84c3fc285f5c647296428dd9c483f8e09
Python
dagrawa2/ece692_deep_learning
/project2-improve-training/see.py
UTF-8
225
2.53125
3
[]
no_license
import os import numpy as np files = os.listdir("results/") files.sort() files.remove("1-3b-grads.npy") for f in files: print(f) acc = np.load("results/"+f) print("epochs: ", len(acc)) print("acc: ", np.max(acc), "\n")
true
5d138241b3738bfb97fd20324546d7e78e896432
Python
JulseJiang/leetcode
/牛客网热题_反转链表.py
UTF-8
964
3.65625
4
[]
no_license
# Title : 牛客网热题_反转链表.py # Created by: julse@qq.com # Created on: 2021/7/17 10:02 # des : TODO # -*- coding:utf-8 -*- class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # 返回ListNode def ReverseList(self, pHead): # write code here if not pH...
true
93d368574f0cb4e95406225c4f0d3793e508fc62
Python
gokul0801/departure_times
/rtt/queries_lxml.py
UTF-8
8,895
2.71875
3
[]
no_license
import urllib, urllib2 import log import sys import lxml from lxml import etree BASE_URL = 'http://services.my511.org/Transit2.0/' SECURITY_TOKEN = '4272b807-452a-406b-b034-d2b471318fea' sessionCache = {} routes_dict_cache = {} def getXml(requestURL): try: return sessionCache[requestURL] except KeyErr...
true
3ee86ad5581544bb5ca1d65a8f1cd16927ec46d4
Python
yuki7125/mlpp_pop_pc
/final-project/util_gmm.py
UTF-8
9,550
2.859375
3
[]
no_license
import numpy as np import torch import pandas as pd import pyro import pyro.distributions as dist from matplotlib import pyplot from matplotlib.patches import Ellipse def get_train_test_split(movies_metadata): """Get train test split of obs and new data""" movies_metadata = normalize_data(movies_metadata) ...
true
45d8bd600dbdc976d801f5c2d417c326e00a67ca
Python
andrey-ladygin-loudclear/deep-learning
/helper/week1/decorators_hard.py
UTF-8
373
3.0625
3
[]
no_license
def logger(filename): def decorator(func): def wrapped(*args, **kwargs): result = func(*args, **kwargs) with open(filename, 'w') as f: f.write(str(result)) return result return wrapped return decorator @logger('new_log.txt') def summator(num_l...
true
484538cb3ac2b9b53b00ca0f67e628196d8c395c
Python
sergelemon/python_training
/old/task9.py
UTF-8
778
4.21875
4
[]
no_license
#9. n школьников делят k яблок поровну, неделящийся остаток остается в корзинке. Сколько яблок достанется каждому #школьнику? Сколько яблок останется в корзинке? Программа получает на вход числа `n` и `k` и должна вывести искомое #количество яблок (два числа). n = int(input("Укажите количество школьников\n")) k = int(...
true
6d725e715f7d5b487d8f557df45293f2cd4004fe
Python
Sapphirine/202005-17-Understandin--Personal-Value-and-Objectives
/python/processing/neo4j_loader.py
UTF-8
6,508
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from datetime import datetime import sys import os import shutil import time import csv import argparse import re import numpy as np from neo4j import GraphDatabase GIT_REPO = "https://tbd.com" class Neo4jUtil: """ This class postprocesses data collected during the personality netwo...
true
f7d62df130aa4411efd9ac4fcb3dba2188624268
Python
15871687941/PyCode
/GUI_tkinter/Enter_Text.py
UTF-8
540
3.15625
3
[]
no_license
# coding = UTF-8 from tkinter import * Windows = Tk() Windows.title("MY WINDOWS") Windows.geometry("200x200") e1 = Entry(Windows, show="*", width=16, font=("楷体", 10)) e1.pack() def insert_point(): var = e1.get() t1.insert("insert", var) b1 = Button(Windows, text="Insert Point", width=16, command=insert_point...
true
e741894e11af99c42298a8b0b61fbee67dcbc439
Python
Insomnia1437/PV_crawler
/telnetEV.py
UTF-8
3,105
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : # @File : telnetEV # @Software: # @Author : Kudoh # @Email : import time import telnetlib class Reset: def __init__(self): self.rtimeout = 1 def open(self, host, port): tn = telnetlib.Telnet(host, port) time.sleep(1) tn.write("\n") ...
true
96396306de3a92c554ee9475424a3e0a74369a7a
Python
nitoc-ict/slack-FileRemove
/channel_list.py
UTF-8
344
2.53125
3
[ "MIT" ]
permissive
import requests import os import json def get_channel_list(): url = "https://slack.com/api/channels.list" slack_res = requests.get(url, params = {"token": os.environ["SLACK_TOKEN"]}).json() if slack_res["ok"]: channel_id = [i.get("id") for i in slack_res["channels"]] return channel_id ...
true
d07692da0f2fe51c22231e55d589a0fd1ea91f4c
Python
vjek/procedural_generation
/otp-enc.py
UTF-8
2,499
3.53125
4
[ "Unlicense" ]
permissive
#!/usr/bin/env python3 # script to demonstrate mod10 Message + Key = Ciphertext # by vjek, 20200426, updated 20230422 ### from getpass import getpass import random,hashlib,sys def getphrase(): #get sha512 of passphrase, use it as rand seed to generate OTP of any length #if you wanted true OTP, add ISO 8601 met...
true
3dd3c7725a5ca263152659e42e803f39c5906377
Python
nabmctackle/pythonbelt18
/beltexam/models/model.py
UTF-8
3,192
2.703125
3
[]
no_license
import re from beltexam.config.mysqlconnection import connectToMySQL from beltexam import app from flask_bcrypt import Bcrypt app.secret_key = "theMostSecret" mysql = connectToMySQL('mydb') bcrypt = Bcrypt(app) EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') class Model: def register(self...
true
e8899be690842cbb604f6297c3621da6c49afbb0
Python
ForceCry/iem
/scripts/feature/multiday_timeseries.py
UTF-8
2,909
2.703125
3
[]
no_license
import iemdb import mx.DateTime import numpy ASOS = iemdb.connect('asos', bypass=True) acursor = ASOS.cursor() COOP = iemdb.connect('coop', bypass=True) ccursor = COOP.cursor() cdates = [] chighs = [] clows = [] ccursor.execute("""SELECT case when extract(month from valid) = 1 then valid + '1 year'::interval else val...
true
7fc1e0293298aa53bff9822caba74c3de373342b
Python
samlawlerr/HalfBrick_Project-Sam_Lawler
/src/csv_to_json.py
UTF-8
439
2.734375
3
[]
no_license
import json import csv csvFile = "sandbox-installs.csv" jsonFilePath = "jsonOutput.json" # Read the CSV file and add data to dictionary data = {} with open(csvFile, encoding="utf8") as csvFile: csvReader = csv.DictReader(csvFile) for rows in csvReader: id = rows["user_pseudo_id"] data[id] = ro...
true
389d12bb2ae3e52aea567222f7ab61a38e2ccfba
Python
edu-athensoft/ceit4101python
/stem1400_modules/module_4_function/func2_recursive/recursive_problem_03_b.py
UTF-8
547
4.3125
4
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- """ Fibonacci sequence 0,1,1,2,3,5,8,13,21,... Input n and get the n-th number in the sequence key point: a = 0, b = 1 a = 1 = b, b = 1 = last_a + b a = 1 = b, b = 2 = last_a + b """ # iteration def fib(n): a, b = 0, 1 for i in range(n-1): # a, b = ...
true
736d90b956ccb2180c29b95879eb24cca088546d
Python
chrishefele/kaggle-sample-code
/WordImputation/sandbox/src/try_w2v.py
UTF-8
1,150
3.171875
3
[]
no_license
import os.path import gensim from nltk.corpus import brown TRAIN_FILE = '/home/chefele/kaggle/WordImputation/download/train_v2.txt' MODEL_FILE = 'model.mdl' def sentence_reader(): for line_num, line in enumerate(open(TRAIN_FILE,'r')): if line_num % (100*1000) == 0: print 'read line:', line_num...
true
23539007725a52356dabcf9d1e97306028602319
Python
adi1201239/b
/Q_15.py
UTF-8
522
4.03125
4
[]
no_license
list1 = [] for i in range(0,5,1): a = str(input("Enter the name in list ")) list1.append(a) print("Name in list ",list1) j = str(input("Enter the name to search ")) if j in list1: print("The given name is present in list") else: print("The given name is not present in list") l=len(list1) ...
true
2ed760b39fad878ee4ed46397b66b72a81d61159
Python
Nguyen-Tommy/Employee-Management-System
/app.py
UTF-8
5,250
3.078125
3
[]
no_license
# Employee Management System # Local web server application, MySQL database, CRUD operations, injection safe queries, file reading from flask import Flask, render_template, url_for, request, redirect from flask_mysqldb import MySQL from werkzeug.utils import secure_filename import os # Import packages as var...
true
2bac96a9fc92c1f188cbe6000095aefbd6881ab7
Python
cyberjam/TIL
/Prog_L1_자릿수더하기.py
UTF-8
1,241
4.1875
4
[]
no_license
def solution(n): return sum([int(i) for i in str(n)]) # 다른 사람풀이 # 재귀 대박.. def sum_digit(number): if number < 10: return number; return (number % 10) + sum_digit(number // 10) # 아래는 테스트로 출력해 보기 위한 코드입니다. print("결과 : {}".format(sum_digit(123))); # 1의 자리가 아니라면 return에 10을 나눈 나머지 1의 ...
true
4586cb3b315e1dd71d0d770157da6751ac6ef43a
Python
RuslanBilyk/pytest-ethereum
/tests/api/contracts/test_factory.py
UTF-8
566
2.59375
3
[ "MIT" ]
permissive
from hexbytes import HexBytes def test_CreateFactoryFromInterface(t): _interface = {'abi': [], 'bytecode': '0x', 'bytecode_runtime': '0x'} # Factory class has the same interface that we gave it # NOTE: Names are changed to work with Web3.py API _factory = t.new_contract(_interface) assert _factory....
true
9ad90cf675d9b8c98cfd02ca6ec97d97cae1b85a
Python
bethanymbaker/arch
/data_structures/breadth_first_search.py
UTF-8
478
3.609375
4
[]
no_license
from queue import Queue graph = { 'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F'], 'D': [], 'E': ['F'], 'F': [] } visited = [] que = Queue() root_node = 'A' que.put(root_node) visited.append(root_node) while not que.empty(): node = que.get() print(f'node = {node}') children = graph[...
true
2b64c789cc83e4c6d9021b31f62ed510a5edf308
Python
arhipovana2001/case4
/local_english.py
UTF-8
831
2.984375
3
[]
no_license
# Localization file (english). TEXT_BLOB = 'Select in which language the text is entered and enter the number: ' LANGUAGE_1 = '1 - Russian' LANGUAGE_2 ='2 - English' TEXT = 'Enter the text: ' VOWELS = 'aeiou' SENTENCES = 'Suggestions: ' WORD = 'Words: ' SYLLABLES = 'Syllables: ' AVERAGE_SENTENCES = 'Average se...
true
16762e10bad595935f6e480c0bc3576dcf082808
Python
ErikOrjehag/mpc
/linear_models.py
UTF-8
794
2.5625
3
[]
no_license
import numpy as np def as_float(*args): return tuple([arg.astype(np.float_) for arg in args]) def spring_damper(m, k, c, dt): A = np.array([ [1 , dt ], [-k/m*dt, 1 -c/m ], ]) B = np.array([ [0 ], [1/m*dt], ]) C = np.array([ [1, 0], ]) ...
true
5571b6b803661c4aa7d6eaf0aee91fc33dd92ba4
Python
ducfilan/Data-Structures-Implementation
/Implementation/binary_tree.py
UTF-8
1,499
3.703125
4
[]
no_license
class BinaryTree(object): def __init__(self, root_obj): self.key = root_obj self.left_child = None self.right_child = None def insert_left(self, new_node): t = BinaryTree(new_node) if self.left_child: t.left_child = self.left_child self.left_chil...
true
d62925df143205354773247acefe9bab64d62e15
Python
Grande-zhu/CSCI1100
/LAB/LAB11/check3.py
UTF-8
4,083
3.671875
4
[]
no_license
from tkinter import * from Ball1 import * import random import copy class BallDraw(object): def __init__ (self, parent,maxx=400,maxy=400,wait_time=100,balls=[]): ##=====DATA RELEVANT TO BALL=============== ## We are going to repeatedly draw a ball object on the canvas, ## "movi...
true
98ddf83eaa9726c0b05939cc5315f21e58ec24fc
Python
kbalasub78/Python-CS1
/py4e-chapter06/exercise02.py
UTF-8
270
4.5625
5
[]
no_license
## Exercise 2: Given that fruit is a string, what does fruit[:] mean? fruit = 'pineapple' ## print fruit in usual way print(fruit) ## Below is same as printing fruit string ## indicating to start from character at index 0 and go till last character print( fruit[:] )
true
d022225170a48b7eca3ea917472d51c5a856414f
Python
jlyons6100/Wallbreakers
/Week_2/most_common_word.py
UTF-8
503
3.34375
3
[]
no_license
# Most Common Word: Most common words from a paragraph import re from collections import defaultdict, Counter class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: freqs = Counter() b_set = set(banned) p_list = re.split('[ ,|\.!?;\']',paragraph) for wor...
true
2e2532315d6c21bde2aa4b0ac37d8746e6a0a488
Python
ljshou/workspace
/python/learn-python/list-files.py
UTF-8
518
3.09375
3
[]
no_license
#!/usr/bin/python #coding=utf8 import os def list_files_recursive(path): for file_name in os.listdir(path): file_path = os.path.join(path, file_name) if os.path.isdir(file_path): list_files_recursive(file_path) else: print file_path def list_files(path): for p...
true
0a02172ec863264416b75a00144f0cf00fe928f0
Python
mkenworthy/asas-sn-J060000
/snake.py
UTF-8
5,044
3.34375
3
[ "BSD-2-Clause" ]
permissive
import numpy as np def snake(x, x_infl, y_infl): '''for points along x, with ends of straight lines marked by (x_infl, y_infl), return (xt, y) points where xt are points in x that are inside the ends of the straight lines x_infl must be strictly ordered in increasing values ''' # reject point...
true
a1a7157f25f72da53657a16f27b45ce556ecf716
Python
LeonardoRiojaMachineVentures/F
/adjust_sa.py
UTF-8
4,729
2.859375
3
[]
no_license
d = 10.61 w_ave = 71.9 w = 64 print("you are " + str((w - w_ave)/d) + " away.") print(0.9545, " lies inside [", w_ave - 2*d, w_ave + 2*d, "]") print("healthy people in [", w_ave - 1.9*d, w_ave + 1.6*d, "]") print("healthy people us in [", 88.9 - 3.5*d, 88.9, "]") f = open("dri.txt").read() header = f.split('\n')[0] ...
true
d5a3495ea8d5a3015040eafb47f86d4133b10f10
Python
HenriqueVarellaEhrenfried/anotacoes-ufpr-1
/redes2/trabalhos/2010-2/calj08-fpk07/codigofonte/mainClient.py
UTF-8
3,458
2.765625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- #importando classes from socket import * from time import time from time import sleep import sys import os #biblioteca local sys.path.append( 'library' ) from Pacote import * from functions import * from Log import * from msg import * from geraHtml import * #variaveis nec...
true
91e54b34ae34d61f5356b26e1158a16f090b28d8
Python
intuinno/vistalk
/wordconfuse/views.py
UTF-8
5,280
2.65625
3
[ "MIT" ]
permissive
# Create your views here. # Create your views here. from django.views.decorators.csrf import csrf_exempt, csrf_protect from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.utils import simplejson from defs import WORDS from time import time from wordconf...
true
282e08d22be0ae6f61edcd647f47540524153a0f
Python
suraj19/Hackerrank-Codes
/program21.py
UTF-8
582
3.484375
3
[]
no_license
'''Input Format The first line contains an integer, n, the number of students who have subscribed to the English newspaper. The second line contains n space separated roll numbers of those students. The third line contains b, the number of students who have subscribed to the French newspaper. The fourth line cont...
true
27bcdacb119c1f437f29dee4a0ecacaaf0b45b76
Python
shubham2751/python-basics-exercises
/ch08-conditional-logic/1-compare-values.py
UTF-8
756
5
5
[]
no_license
# 8.1 - Compare Values # Solutions to review exercises # Exercise 1 # Test whether these expressions are True or False print(1 <= 1) print(1 != 1) print(1 != 2) print("good" != "bad") print("good" != "Good") print(123 == "123") print(11 > 11) # note this one print(11 >= 11) print(11 < 11) print(11 <= 11) print(11....
true
ed695f398e7ba9a4ce752dcc55c8f288017701f1
Python
Chiil/smallprograms
/diff_anja/diff_anja_real_data.py
UTF-8
2,054
2.546875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import netCDF4 as nc # DIFF nx, ny, nz = 2304, 576, 144 xsize = 18.84955592153876 ysize = 4.71238898038469 zsize = 1. nc_file = nc.Dataset('moser600.default.0036000.nc', 'r') z = nc_file.variables['z' ][:] zh = nc_file.variables['zh'][:] nc_file.close() dx, dy = xs...
true
cf098ed8585635c663f74a2326a4d00193944716
Python
KIQ83/blackjack-client
/utils.py
UTF-8
2,136
3.4375
3
[]
no_license
def getCardSumValue(cardIndex): # figure Cards are worth 10 if cardIndex in range(10, 13): return 10 else: return cardIndex + 1 def containsAce(cardsIndexes): return 0 in cardsIndexes def sumCards(cards): cardValues = [getCardSumValue(card['number']) for card in cards] simpleSu...
true
821a1c4d6ec1c9804f65cd69328d846b92e0bd43
Python
samir2901/Leetcode-Solution
/same-tree.py
UTF-8
755
4
4
[]
no_license
''' Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1: Input: p = [1,2,3], q = [1,2,3] Output: true ''' # Definition for a binary tree node....
true
3822fd471a0485245c71c7d645ed32530673309f
Python
uiucanh/dota2-ml
/CollectData/collect_data.py
UTF-8
6,006
2.625
3
[]
no_license
import logging import dota2api import requests from pymongo import MongoClient, errors from dota2api import exceptions from src.constants import * from datetime import datetime def initialise_keys(): # Initialise api keys if D2API_KEY is None: raise NameError("Dota 2 Api key needs to be set as an envir...
true
973461546a2f1e1edfc00694c5fd256c194420ee
Python
rkiyengar/rowgenerators
/rowgenerators/generator/csv.py
UTF-8
1,781
2.796875
3
[ "MIT" ]
permissive
# Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the # MIT License, included in this distribution as LICENSE.txt """ """ import sys import os from rowgenerators.source import Source class CsvSource(Source): """Generate rows from a CSV source""" delimiter = ',' def __init_...
true
8372d54ad5567d6a7701368f6884789e18e6f673
Python
MiiikAnd/ControleInstrumentos
/App/leitor2.py
UTF-8
875
3.546875
4
[]
no_license
def encontrar(nome_arquivo, item): arquivo = open(nome_arquivo, 'r') codigo = arquivo.read() codigo = codigo.split(';') print(codigo) print(item == codigo[1]) if item in codigo: localiza = list.index(codigo, item, 1, list.__len__(codigo)) # Encontra o indice do item procurado ...
true
8153eadcd5a5d065c0f2c041b27f17b9cb0e8b0d
Python
sweetpand/LeetCode-1
/solutions/python3/0130.py
UTF-8
720
3.09375
3
[]
no_license
class Solution: def solve(self, board: List[List[str]]) -> None: def dfs(i: int, j: int) -> None: if not 0 <= i < len(board) or not 0 <= j < len(board[0]) or board[i][j] != 'O': return board[i][j] = '.' dfs(i + 1, j) dfs(i - 1, j) ...
true
f09ea387b4a347d8c0badf5fd5fb5e3b4371c35e
Python
CDL-Project-Euler/solutions
/000-025/p002/kirill.py
UTF-8
196
3.09375
3
[ "MIT" ]
permissive
s = 0 f1 = 1 f2 = 2 f_old = f1 f_new = f1 while f_new < 4000000: if f_new % 2 == 0: s += f_new f_new_temp = f_new f_new = f_new_temp + f_old f_old = f_new_temp print(s)
true
cc1e5eaa1a6c296089380a119799cc1a4e293c14
Python
skeselj/transformer-networks
/main/models/irrelevant/embedding_pyramid.py
UTF-8
5,297
2.546875
3
[]
no_license
######################################################################################################## # Define the a SpyNet like model ######################################################################################################## import numpy as np import torch, torch.nn as nn, torch.nn.functional as F fr...
true
627550160a71b05aad76888e6590638e978eba41
Python
opennikish/advent-of-code
/_2020/day_07/task2.py
UTF-8
757
3.3125
3
[]
no_license
from typing import Dict, List, Tuple def parse_neighbor(raw_neighbor: str) -> Tuple[str, int]: pieces = raw_neighbor.split(' ') return f'{pieces[1]} {pieces[2]}', int(pieces[0]) def dfs(g: Dict[str, List[str]], v: str) -> int: total = 1 for u, count in g[v]: total += count * dfs(g, u) ...
true
06aabb5ef59a6edc575cb1d32918c96867b8bbf9
Python
jack-diamond/devops
/hw1/linkedlist/test_remove.py
UTF-8
1,304
3.5
4
[]
no_license
import unittest from linkedlist import LinkedList from linkedlist import Node 23 class TestMethods(unittest.TestCase): def test1(self): ''' Test remove on empty linkedlist. ''' l = LinkedList() self.assertEqual(l.remove(1), None) def test2(self): ''' ...
true
fa2994dedbb9ee8dad08511890a105a74ca84eb1
Python
CodedQuen/Machine-learning-with-cookbook_Chris-Abon
/handleOutliers.py
UTF-8
283
3.328125
3
[]
no_license
# Load library import pandas as pd # Create DataFrame houses = pd.DataFrame() houses['Price'] = [534433, 392333, 293222, 4322032] houses['Bathrooms'] = [2, 3.5, 2, 116] houses['Square_Feet'] = [1500, 2500, 1500, 48000] # Filter observations houses[houses['Bathrooms'] < 20]
true
c344b5ae63adc3f6022e0dae83219e7ead4cc663
Python
shuntianfu/python
/slice/string.py
UTF-8
280
3.53125
4
[]
no_license
sample_url = 'http://jeckma.com' # Reverse the url print(sample_url[::-1]) # Get the top level domain print(sample_url[-4:]) # Print the url without the http:// print(sample_url[7:]) # Print out the url without the http:// or the top level domain print(sample_url[7:-4])
true
892bc48cd08a85cb4e7ad7e80b2e5edbe706d355
Python
johnnyrock92/zjp
/V1/statement_v1.py
UTF-8
2,208
3.484375
3
[]
no_license
import json import math def statement(invoices, plays): ''' Return: rachunek w formie stringa ''' result = 'Rachunek dla {}\n'.format(invoices['customer']) for perf in invoices['performances']: result += " {}: {:.2f} zł (liczba miejsc: {})\n".format(playFor(perf)['name'], amountFor(perf)/10...
true
c9d650427347194ec6b8240e577fbbd9003b4335
Python
marinavicenteartiaga/KeepCodingModernProgrammingWithPython
/module1/e4_ascii/e4_character_counter_dictionary.py
UTF-8
283
3.6875
4
[]
no_license
my_text = "three words for you" frequencies = dict() for character in my_text: if character in frequencies: frequencies[character] += 1 else: frequencies[character] = 1 for character in frequencies.keys(): print(character, "-", frequencies[character])
true
a76feed77d8420a77e0cf67e02ad54b005084774
Python
TNFSH-Programming-Contest/2017NHSPC-TNFSH-Final
/testdata/cms2toj.py
UTF-8
267
2.875
3
[]
no_license
#!/usr/bin/env python3 import os from sys import argv folder = argv[1] os.chdir(folder) files = os.listdir() files.sort() cnt = 1 for f in files: if f.endswith('.in'): print(f) os.rename(f, str(cnt)+".in") os.rename(f[:-3]+".out", str(cnt)+".out") cnt += 1
true
96c6bee1a62264ae15c3745dc5485a81b0298882
Python
kdm1jkm/pendulum_simulator
/simple_pendulum.py
UTF-8
4,670
2.921875
3
[]
no_license
import math import os import sys from datetime import datetime from typing import * import matplotlib.pylab as plt import numpy as np import pygame from tqdm import tqdm from pygame_constants import * from PendulumSimulator import PendulumSimulator def get_extreme_value(values: np.ndarray, show_status: bool = True...
true
d4f8f781bfca2193d1395d1dd36fb3d00e84f8fa
Python
ledennis/data-structures-and-algorithm-python
/Exercises/Chapter_1/Projects/P1_31.py
UTF-8
1,224
3.609375
4
[]
no_license
def change(given, cost): billsDict = {100.00:'One Hundred', 50.00:'Fifty', 20.00:'Twenty', 10.00:'Ten', 5.00:'Five', 1.00:'One'} billsList = [100.00, 50.00, 20.00, 10.00, 5.00, 1.00] coinsDict = {0.25:'Quarter', 0.10:'Dime', 0.05:'Nickel', 0.01:'Penny'} coinsList = [0.25, 0.10, 0.05, 0.01] moneyList...
true
aa869fb83ca77303fe0756ac6a7728c1d305a3da
Python
Beebruna/Python
/CursoemVideoPython/teste0L.py
UTF-8
757
3.921875
4
[ "MIT" ]
permissive
for c in range(1,6):# imprime 'Oi' 5 vezes, de 1 a 5 print('Oi') print('FIM') for c in range(1,6): print(c) print('FIM') for c in range(6,0,-1):# imprime os números em ordem decrescente de 6 a 1 print(c) print('FIM') for c in range(0,7,2): # imprime de 0 a 6 pulando de 2 em 2 print(c) print('FIM') n...
true
a43752a53fc1662f676eb3aa1e9b5e9a77a6e2dd
Python
littlegirlorange/BreastCAD
/TrackLesions/LabelStatsLogic.py
UTF-8
3,919
2.53125
3
[]
no_license
import vtk, qt, ctk, slicer import string import SimpleITK as sitk import sitkUtils class LabelStatsLogic: """This Logic is copied from the Label Statistics Module -Steve Pieper (Isomics)""" """Implement the logic to calculate label statistics. Nodes are passed in as arguments. Results are stored as 'statisti...
true
bdf5ac0f40983c8da5716c0443b33fa8af5eca8d
Python
Oops324/TCGA_convert_XML_to_TXT
/concateClinicalXml.py
UTF-8
3,276
2.71875
3
[]
no_license
#!/usr/bin/env python ''' Author: Anna Fei Date: 23/Nov/2017 Usage: python concateClinicalXml.py clinicalF_List Function: concatenate content of files Version: python 2.7 ''' import xml.etree.ElementTree as ET import csv import sys def Xml2csv(listF,outputF): listF_handle = open(listF,'r') Resident_data = open(o...
true
9cf5c10a3b7608e7ec5cbcc05de4e668c460ac93
Python
sujin16/PythonTcpSocket
/test_server.py
UTF-8
1,341
2.90625
3
[]
no_license
import socket, errno ip = '127.0.0.1' port = 9999 ''' ip = '192.168.0.2' port = 9002 ip = '127.0.0.1' port = 9999 ''' line =[] server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("create server socket") server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(...
true
ec9fbf96013dc1d23ccb1c9a00ba7e2ab3cd6147
Python
carlos-echeverria/RobotTuples
/generateGroupsForce.py
UTF-8
6,555
3.375
3
[]
no_license
#!/usr/bin/env python3 # Script that generates 34 groups (nGroups) each consisting of 24 robot 3-tuples. # The groups are generated by populating them with random elements from all the # possible combinations of 18 robots in 3-tuples. import robotTuples as rT import matplotlib.pyplot as plt from collections import Co...
true
3a52f8b9bba54d1ab62617bc9fb74cc7210a5d7d
Python
rsprouse/ucblingmisc
/python/vc_transitions
UTF-8
5,179
2.53125
3
[]
no_license
#!/usr/bin/env python """ Usage: {scriptname} [get_f0_args] wavfile Process input wavfile with esps utilities to find voicing transition points. Output a Praat textgrid to STDOUT with transitions to voiced state labelled 'vd' and transitions to voiceless state labelled 'vl'. Additional arguments are passed directly t...
true
7a6b21ecb91bbc1f2e11f7cb18f7ba663da641d5
Python
renatovianna/Curso_Topicos_Programacao_Python
/DicionárioAinda.py
UTF-8
189
2.65625
3
[]
no_license
itensMercado = {'fruta' : 'maçã', 'laticíonio' : 'iogurte', 'bebida' : 'suco', 'proteína': 'frango'} print('fruta' in itensMercado.values()) print('bebida' in itensMercado.keys())
true
b894e7f77d5c332d8210dd6acdc6a81e9edf5f99
Python
genomeannotation/xxxxxxxxxxgap4t
/src/sam.py
UTF-8
1,234
3.484375
3
[]
no_license
#!/usr/bin/env python # Read a sam file with barcoded reads. For each seq/chromosome # represented in the file, store a list of barcodes found on it # and a count of how many times it appears import sys def main(): seqs = {} # a dictionary that maps seq_id to a list of barcodes all_barcodes = set() for ...
true
bb88638a2a1a3cc934de36c7f1bd930f4dbccc12
Python
acutkosky/cs181
/hw1/main.py
UTF-8
7,615
2.765625
3
[]
no_license
# main.py # ------- # Ashok Cutkosky and Tony Feng import matplotlib.pyplot as plt from pylab import * import random from dtree import * import sys from copy import deepcopy class Globals: noisyFlag = False pruneFlag = False valSetSize = 0 dataset = None ##Classify #--------- def classify(learner, ...
true
20fb5a3baa48e6846d0eaf106a053a3ea2d972ff
Python
radhar16/python-challenge
/pyPoll/Solved/main.py
UTF-8
2,361
3.5
4
[]
no_license
import os import csv # Path to collect data from the Resources folder pyPoll_csv = os.path.join('..', 'Resources', 'election_data.csv') # Creating lists to read the data vote_counts = [] candidates = [] unique_candidates = [] percent_vote = [] total_counts = 0 # Read in the CSV file with open(pyPoll_csv, 'r' ) as c...
true
726b36e0c129f5a06bb7d8d82c23a059f5839266
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2468/60755/266654.py
UTF-8
261
3.328125
3
[]
no_license
num = int(input()) for i in range(num): n = int(input()) s = input().split(" ") mul = 1 for k in s: mul = mul * int(k) res = [] for k in s: res.append(str(int(mul/int(k)))) result = " ".join(res) print(result+" ")
true
de13d99d396ee03b8c48839dfe378aae4c9e2689
Python
oknix/jarujaru_prediction
/utils/model.py
UTF-8
1,598
3.15625
3
[]
no_license
import numpy as np class _BaseNB: def __init__(self, alpha=1.0, beta=1.0, theta_c=None, phi_cv=None): """ :param alpha: smoothing param for calculating each category's prior distribution (default: Laplace smoothing) :param beta: smoothing param for calculating the probability of category c ...
true
b2160a1399ded260c6956f95b45cbdd227b1f758
Python
saintlyzero/movies-api
/imdb/movie_api/utils/constants.py
UTF-8
1,948
2.640625
3
[]
no_license
import datetime as d class Constants: """ This class contains all the constants used by Movie_api """ # Messages CREDENTIALS_MISSING = "Credentials Missing" CREDENTIALS_INVALID = "Invalid Credentials" CREDENTIALS_VALID = "Valid Credentials" RECORD_NEW = "Added new record" ...
true
97b5a0b1eba5c36b7a1390bce5c196c92bc0aeb1
Python
MyungSeKyo/algorithms
/백준/2225.py
UTF-8
246
2.796875
3
[]
no_license
import sys input = sys.stdin.readline n, k = map(int, input().split()) n += 1 dp = [[0] * n for _ in range(k)] dp[0] = [1] * n for i in range(1, k): for j in range(n): dp[i][j] = sum(dp[i - 1][:j + 1]) % 1000000000 print(dp[-1][-1])
true
a2290f33ca07fb571c13c528c64fabb2b4ecc00d
Python
Podenniy/sia-2013-1c
/TP1/board_generator/generator2.py
UTF-8
1,907
3.34375
3
[]
no_license
import collections import random import sys class Position(object): DELTAS = [(0, -1), (0, 1)] def __init__(self, x, y, lines, width): self.x = x self.y = y self.lines = lines self.width = width def _add(self, delta): return Position(self.x + delta[0], self.y + d...
true
622a14554434297ce9cc2a0149b5fae5b1d2291f
Python
csmerchant/latencyranger
/latencyranger.py
UTF-8
469
2.609375
3
[ "MIT" ]
permissive
import socket import sys from threading import Thread #defining important variables for connections to the gameservers & other sockets gamesocket = None #we get the game socket once we connect to the gameserver sockhost = '0.0.0.0' #0.0.0.0 by default sockport = 3074 #port 3074 by default, change to whatever port you'...
true
c3438be2adea9d236d9e9aaa1742f217554fa106
Python
elp2/TumblrExtractr
/renderers.py
UTF-8
4,566
2.75
3
[]
no_license
import time from PIL import Image import os class Renderer(object): def __init__(self, post): self.post = post self.id = post[u'id'] def __lt__(self, other): return self.time() < other.time() def time(self): timestamp = self.post[u'timestamp'] return time.gmtime(ti...
true
c933622f26e9b60b6550c1ca8ff8fc805212d92e
Python
Sagnik2007/Data-Visualisation
/Covid_19_data.py
UTF-8
318
2.59375
3
[]
no_license
import pandas as pd import plotly_express as px df = pd.read_csv( "C:/Users/milindo/Desktop/All Desktop Files Dad/WhiteHat Jr/Project 103/countries_aggregated.csv") fig = px.scatter(df, x="Date", y="Confirmed Cases", color="Country", title="No Of Cases Of Covid-19 Every Day") fig.show()
true
2ea575eeaa2acdcf946d64215f0ed9c3dec053d5
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2690/60618/263210.py
UTF-8
274
2.765625
3
[]
no_license
t=int(input()) for i in range(0,t): n,m=map(int,input().split()) s,s2=map(str,input().split()) s1=list(s) for j in range(0,len(s1)): if s1[j] not in s2: s1[j]='' result=[x.strip() for x in s1 if x.strip()!=''] print(len(result))
true
122645e02566782f56c433ee5a24323c868c91d0
Python
StanfordAHA/Halide-to-Hardware
/python_bindings/correctness/division.py
UTF-8
2,144
2.875
3
[ "MIT" ]
permissive
from __future__ import print_function import halide as hl # TODO: Func.evaluate() needs a wrapper added; # this is a temporary equivalent for testing purposes def _evaluate(e): # TODO: support zero-dim Func, Buffers buf = hl.Buffer(type = e.type(), sizes = [1]) f = hl.Func(); x = hl.Var() f[x] = e;...
true
0fc9260b44347f56bd850647432f0ee75fe97fb0
Python
plplpld/varroa
/net.py
UTF-8
3,739
3.15625
3
[]
no_license
"Module where we define the network." from keras.models import Model from keras.layers import Input, Concatenate, BatchNormalization, Conv2D, MaxPooling2D, Deconv2D from keras.activations import relu, sigmoid def conv_relu(filters): """Conv module. :params filters: number of convolution kernels :params k...
true
c0fcfb3053045f453376654332cab2ec3c8afa33
Python
jbrusey/cogent-house
/dataclense/models/location.py
UTF-8
3,354
2.515625
3
[]
no_license
""" .. codeauthor:: Ross Wiklins .. codeauthor:: James Brusey .. codeauthor:: Daniel Goldsmith <djgoldsmith@googlemail.com> """ import sqlalchemy import logging log = logging.getLogger(__name__) import meta Base = meta.Base from sqlalchemy import Table, Column, Integer, String, ForeignKey, DateTime,Float from s...
true
18e075c2ae09f249af6709ab7fa503fcc3c7f599
Python
axelakhil/ONGC-TENDERS-CHATBOT
/actions.py
UTF-8
2,502
2.703125
3
[]
no_license
# This files contains your custom actions which can be used to run # custom Python code. # # See this guide on how to implement these action: # https://rasa.com/docs/rasa/core/actions/#custom-actions/ # This is a simple example for a custom action which utters "Hello World!" from typing import Any, Text, Dict, List ...
true
7a806646adb9e8c775751eb834370b5ff722dbcd
Python
clarissa2448/pagerank
/pagerank.py
UTF-8
2,625
3.609375
4
[]
no_license
''' PageRank Project by Hannah He and Clarissa Xu. Names of Primary Functions: 1. probMatrix: input: chain, type: 2d array. Output: M, type: 2d array 2. isDanglingNode: input: chain, j, type: 2d array, index of the node. Output: true/false, type: boolean 3. rank: ...
true
2a0ca4a3a2f336caeefb9cf28c13883fba8a7bec
Python
thatprakhar/SocialBoiler
/backend/src/db/commenting_utils.py
UTF-8
1,859
2.875
3
[]
no_license
import pandas as pd import datetime as dt import os import sys sys.path.append( os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ) from src.db.crud import fetch_rows, fetch_comments_by_user, update_table, fetch_post from src.db.models import Comments, Posts def save_comment(username, ...
true
17266cbaa46c6d4faf96866634564a616c590a43
Python
DrRoad/DashOmics
/single-page-example/Upload-Component.py
UTF-8
8,079
2.65625
3
[ "MIT" ]
permissive
from dash.dependencies import Input, Output import datetime import dash import dash_core_components as dcc import dash_html_components as html import dash_table_experiments as dt import plotly.graph_objs as go import plotly import base64 import io import pandas as pd import numpy as np from sklearn.cluster import KMe...
true
311a34d290997c91f6bd3d9f683fbf714d4afa7b
Python
badeaa3/cannonball-rpv-stops
/plotting/perfPlot.py
UTF-8
7,116
2.90625
3
[]
no_license
""" Style a mass asymmetry vs epsilon plot """ # general imports import argparse import os import matplotlib.pyplot as plt from matplotlib.ticker import (MultipleLocator, AutoMinorLocator) import ROOT # set style based on https://stackoverflow.com/questions/43741928/matplotlib-raw-latex-epsilon-only-yields-varepsil...
true
ffff54b67e8d538540516773ee1a99639fee4660
Python
MarttiWu/boids-game
/Boids.py
UTF-8
9,846
2.984375
3
[]
no_license
''' Boids.py Created by WU,MENG-TING on 2020/10/1. Copyright © 2020 WU,MENG-TING. All rights reserved. ''' import pygame as pg import random import math import numpy as np ####################################### ### boids behavior parameters ### ####################################### a_radius=50 s_radiu...
true
8552316dd9c81143808e090e9d5bf7a24b8d2503
Python
amirhaziemdev/robot-dev
/v1/testing/robot/test_0.py
UTF-8
916
2.65625
3
[]
no_license
import selectors import socket import time sel = selectors.DefaultSelector() def accept(sock, mask): if mask == 0: print("0") return conn, addr = sock.accept() print("Connected from", addr) conn.setblocking(False) sel.register(conn, selectors.EVENT_READ, read) def read(conn, m...
true
227a3a1d4015a20659dfc9881037d95b9efa0e28
Python
daniel-reich/ubiquitous-fiesta
/GZ5gCe5jnbNRWqc5J_17.py
UTF-8
349
3.859375
4
[]
no_license
def first_tuesday_of_the_month(year, month): from datetime import date as d day = 1 while d(year, month, day).weekday() != 1: day += 1 year, month, day = [str(item) for item in [year, month, day]] while len(month) < 2: month = '0' + month while len(day) < 2: day = '0' + day return '...
true