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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ff202ee5660531d20bc6e051b67a155b979d24a2 | Python | pikestefan/AdventofCode2020 | /day21.py | UTF-8 | 3,163 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 28 04:29:48 2020
@author: Lucio
"""
import re
def find_intersection(allergen, food_list, allergen_list):
ingredients_per_allergen = []
for ingredients, allergen_in_food in zip( food_list, allergen_list ):
if allergen in allergen_in_food:
ingr... | true |
76f898dcfb4c21a7665fe655c1beb39c6c239bdb | Python | boppreh/cryptopals-challenge | /Set 2 - Block crypto/10 - Implement CBC mode.py | UTF-8 | 384 | 2.796875 | 3 | [] | no_license | from utils import *
key = b'YELLOW SUBMARINE'
plaintext = b'beatles' * 10
assert aes_ecb_decrypt(key, aes_ecb_encrypt(key, plaintext)) == plaintext
ciphertext = from_base64(read('10.txt'))
plaintext = aes_cbc_decrypt(key, ciphertext, iv=b'\x00'*AES.BLOCK_SIZE)
assert plaintext.startswith(b"I'm back and I'm ringin' th... | true |
cb57d9bebf8046139e557d61edac3ee5b5c9caa6 | Python | osantana19/Temperature_Monitor | /dht11.py | UTF-8 | 6,954 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# dht11.py
# Basic example script to read DHT11 sensor using
# Adafruit DHT library:
# https://github.c... | true |
46e0585bcfab64ac677ad3576c28f2b3cc798f7e | Python | JGuymont/ift2015 | /3_tree/Tree.py | UTF-8 | 3,536 | 3.625 | 4 | [] | no_license | from ListQueue import ListQueue
#ADT Tree (Classe de base)
class Tree:
#inner class Position
class Position:
def element( self ):
pass
def __eq__( self, other ):
pass
def __ne__( self, other):
return not( self == other )
# retourne la rac... | true |
8981873d26ecc3c8d66ba3a1ffa04589564c9f10 | Python | sergiorgiraldo/Python-lang | /sqlite/hello.py | UTF-8 | 403 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python
import sqlite3
conn = sqlite3.connect('foo.sqlite.db')
print('Opened database successfully')
conn.execute('insert into DEPTO (name) values ("john doe") ' )
conn.commit()
print('Insert executed sucessfully')
cursor = conn.execute("SELECT id, name from DEPTO")
for row in cursor:
print("ID = ", ro... | true |
65776a0e91197d9370861498746b0f8b061f5255 | Python | lizzij/EI | /El_compiled.py | UTF-8 | 4,357 | 2.796875 | 3 | [] | no_license | ########## All URLs ############
demo = 'https://scratch.mit.edu/projects/151017985/#fullscreen'
cY = 'https://scratch.mit.edu/projects/151030464/#fullscreen'
cG = 'https://scratch.mit.edu/projects/151031590/#fullscreen'
cR = 'https://scratch.mit.edu/projects/151031688/#fullscreen'
eY = 'https://scratch.mit.edu/proje... | true |
b727f008e43f3adbd2083ad0e4277acd311f416d | Python | ShakteeSamant/my_program | /prime_numbers.py | UTF-8 | 814 | 4.3125 | 4 | [] | no_license | # Write a program to check given number is prime number or not.
num = int(input('Enter the number: '))
count = 0
for i in range(2,num+1):
if num % i == 0:
count += 1
if count == 1:
print ('Prime number')
else:
print('Not Prime')
# prime numbers between the range of 100 numbers
for num in range(... | true |
9d3341269579686bfd7907d22ed30826c8cb9e68 | Python | hatimabualrub/COVID-Tracker | /ContryScreen.py | UTF-8 | 6,311 | 2.640625 | 3 | [] | no_license | import pandas as pd
from tkinter import *
from Components import header, footer
from requestData import requestGlobalData, requestContryData
from figures import generateLinePlot
def countryScreen(master):
try:
CountryWindow = Toplevel(master)
CountryWindow.title("Country Statistics")
Count... | true |
17345168004530c2d51c48189d29333629abf197 | Python | lucgiffon/psm-nets | /code/data/make_dataset.py | UTF-8 | 2,625 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Functions for downloading data set.
"""
import tempfile
import urllib.request
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import os
import numpy as np
import scipy.io as sio
from palmnet.data import Mnist, Cifar10, Cifar100
from skluc.u... | true |
1746a52075b2869f9f6326cf8073ff683c181894 | Python | JustinBis/UCF-COP-3223 | /Programs - Python/diapers.py | UTF-8 | 802 | 3.9375 | 4 | [] | no_license | #######################
# Diaper Money #
# By Justin Bisignano #
# 8/29/2012 #
#######################
# Constants
DAYS_PER_MONTH = 30
CALS_PER_LB = 3500
CALSLOST_PER_BEER = 20
DOZEN = 12
# Get inputs
diapercost = float(input("What is the cost of a dozen diapers?\n"))
diapersperday = int(input("How m... | true |
38a7317f60fae41ee02e201888527b564924ddf3 | Python | sebischair/ThesaurusLabelPropagation | /src/baselines/helpers.py | UTF-8 | 1,309 | 2.546875 | 3 | [
"MIT"
] | permissive | from os.path import join
import numpy as np
import pandas as pd
def get_train_test(path):
train = pd.read_table(
join(path, "y_train.txt"),
sep=" ",
dtype={"synset": np.int32},
index_col=0)["synset"]
test = pd.read_table(
join(path, "y_test.txt"),
sep=" ",
... | true |
f9b85fdba98cdcdfd0a1b3aa90eadf523b7c7e3c | Python | kns94/coding-practice | /russianDoll_dp.py | UTF-8 | 2,407 | 3.015625 | 3 | [] | no_license | """The russian doll algorithm"""
import operator
class Solution(object):
def maxEnvelopes(self, envelopes):
"""
:type envelopes: List[List[int]]
:rtype: int
"""
"""If no nodes are present"""
if len(envelopes) == 0:
return 0
sor... | true |
a346864f1325ffe55c6667399cf122f364d003ce | Python | MoAshraf601/recommending-meals-for-diabetes-graduation-project- | /visuals.py | UTF-8 | 2,500 | 3.078125 | 3 | [] | no_license | ###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
#
# Display inline matplotlib plots with IPython
from IPython import get_ipython
get_ipython().run_... | true |
d0531284e28a070f411678838ec5c03381d991c7 | Python | icdatanalysis/MachineLearning-Python-2020.1 | /classification/random_forest/eval_random_forest.py | UTF-8 | 2,650 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 12:55:37 2019
@author: Jairo Souza
"""
# Importando os pacotes
from sklearn.metrics import f1_score, recall_score, accuracy_score, precision_score
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
... | true |
8cf5754f83491bd33107247a47521eae2b2b9ceb | Python | AyodejiAfolabi/pythoncodes | /getUserInput.py | UTF-8 | 5,614 | 3.953125 | 4 | [] | no_license | # salary=input("please input your salary")
# bonus=input('please input your bonus')
# payCheck=float(salary)+float(bonus)
# print(payCheck*5)
# print('{0:d}+{1:d}'.format(salary,bonus))
# Trying to get and display todays dates
# import datetime
# currentTime=datetime.date.today()
# print(currentTime.strftime('%d... | true |
4f0ab635cd8520f8e4ddcf629cb71216a019a0fd | Python | MahmoudHegazi/excel_api | /my_first_AI.py | UTF-8 | 2,922 | 2.859375 | 3 | [] | no_license | # Data Preprocessing Template
# Importing the libraries
import numpy as np
import excel
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
import pandas as pd
from tablib import Dataset
import numpy as np
import matplotlib.pyplot as plt
# Importing the dataset
... | true |
c6e68bac35e4ec7dd7880e504d02e518493e73d7 | Python | tracyqan/TBSpider | /process.py | UTF-8 | 4,127 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: tracyqan time:2018/12/19
import pandas as pd
import pyecharts
from wordcloud import WordCloud
import jieba
import re
import matplotlib.pyplot as plt
def make_cloud(data):
print('开始绘制商品信息词云')
name = ''.join(list(data['name']))
word = re.sub(r'<sp... | true |
d6215f5163adbe5da5f0351bd37eeb8bf3265b87 | Python | Nicolas-31/IKT441_DataMining_2018 | /CNN - Convolutional Neural Network/main.py | UTF-8 | 1,513 | 2.65625 | 3 | [] | no_license | import pickle
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
import keras
import numpy as np
batch_size = 25
num_classes = 2
epochs = 10
#(x_train, y_train),(x_test, y_test) = pickle.load(open('female.p', 'rb'))
(x_train, y_train),(x_t... | true |
048c67bbfc1879a4fab26b3a14139c65d9d3b0c8 | Python | simonfong6/service-manager | /examples/launch/launch_async.py | UTF-8 | 2,877 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Service launcher
"""
from subprocess import Popen
from subprocess import PIPE
from shlex import split
from typing import List
def run(command):
cmd_seq = split(command)
proc = Popen(cmd_seq, stdout=PIPE, stdin=PIPE, universal_newlines=True)
return proc
def ask():
out = ... | true |
02709c674dc39b165c103ff0b6902ed3d032432a | Python | Brac24/GameOfLife | /board/board_creator.py | UTF-8 | 1,334 | 3.90625 | 4 | [] | no_license | import random
from cell.cell import Cell
def randomstate(rows, cols):
#list comprehension to generate a list of lists with random 1's and 0's
#We can think of this nested list comprehension in terms of nested for loops
#In nested for loops the inner loop can be considered the column and the outer loop the ... | true |
f32cc91b0c158aaeefd2a019c606107f5632a70c | Python | Billuc/3DEngine | /viewer.py | UTF-8 | 9,549 | 3.703125 | 4 | [] | no_license | from node import NamedNode3D
from matrix import Matrix
from math import cos, sin, pi, tan, atan
# Object corresponding to a set of points and data to transform them
class Viewer():
def __init__(self, p_width, p_height, p_v_fov = pi/2, p_radius = 10):
# Width and height of display
self.width = float... | true |
60b2cf2d2e7b229dab63d551ac8205d3c067e6d1 | Python | samanthaalcantara/codingbat2 | /warm-2/array_count9.py | UTF-8 | 226 | 3.046875 | 3 | [] | no_license | """
Date: 06 07 2020
Author: Samantha Alcantara
Question: Given an array of ints, return the number of 9's in the array.
"""
#Answer
def array_count9(nums):
for element in nums[:4]:
if element == 9:
return True
return False
| true |
d3089247e2bd44d22f2b8e14d264da4142822d44 | Python | dektox/btc_trade | /threading_test.py | UTF-8 | 1,857 | 2.703125 | 3 | [] | no_license | import threading
import requests
import time
from csv import reader
class Parser(threading.Thread):
def __init__(self, pair):
super(Parser, self).__init__()
self.daemon = True
self.pair = pair
def run(self):
header = ['pub_date', 'amnt_base', 'amnt_trade', 'id', 'price', 'type... | true |
ca0c47286a9566b1ea2315497c36684221c0a425 | Python | brendenlake/capture-tablet | /objects/viz_objects.py | UTF-8 | 919 | 2.65625 | 3 | [] | no_license | import glob
import re
import os
import matplotlib.pyplot as plt
import math
from PIL import Image
#
# Display all the instances of each object type
#
# output : files in folder imgs_by_type
#
# dirs = ['balloon','bowlingpin','butterfly','horseshoe']
dirs = ['car','butterfly','horse','airplane']
imgs_by_type = 'objec... | true |
e3c6172b06294cd0fa89ff7037801ef55525cd79 | Python | weningerleon/InformationContent_HCP | /dataloader.py | UTF-8 | 6,235 | 2.578125 | 3 | [] | no_license | ################################################################################
# Copyright (C) 2021 by RWTH Aachen University #
# License: #
# ... | true |
618bfa17f16a648edff7fada3951f6b3922f9c7a | Python | l33tdaima/l33tdaima | /pr1029m/two_city_sched_cost.py | UTF-8 | 1,334 | 3.328125 | 3 | [
"MIT"
] | permissive | from functools import reduce
class Solution:
def twoCitySchedCostV1(self, costs: list[list[int]]) -> int:
N = len(costs) // 2
costs_by_diff = sorted(costs, key=lambda c: c[0] - c[1])
return sum([a for a, _ in costs_by_diff[:N]]) + sum(
[b for _, b in costs_by_diff[-N:]]
... | true |
198b55e9dab45e2e45c4e75909c767ad764b062f | Python | Flouzr/Dijkstra-Bellman-Ford | /graph.py | UTF-8 | 15,821 | 3.609375 | 4 | [] | no_license | from collections import deque
import math
import random
from disjointsets import DisjointSets
from pq import PQ
from timeit import timeit
# Programming Assignment 3
# (5) After doing steps 1 through 4 below (look for relevant comments), return up here.
# Given the output of steps 3 and 4, how does the run... | true |
ac87a744954656024b8eef031b28a389c1c24a97 | Python | Shah-Shishir/URI-Solutions | /1079 - Weighted Averages.py | UTF-8 | 158 | 3.59375 | 4 | [
"Apache-2.0"
] | permissive | tc = int(input())
for pos in range (1,tc+1):
a,b,c = input().split()
a,b,c = [float(a),float(b),float(c)]
print("%0.1f" %((a*2+b*3+c*5)/10))
| true |
38ca6ac0a5e6bbc2d9697475fba9b629e4f9fe99 | Python | hsyeon4001/algorithm_records | /Python/boj/grade3.py | UTF-8 | 1,314 | 3.21875 | 3 | [] | no_license | # 2739번
a = int(input(""))
for i in range(1, 10):
print(a, '*', i, '=', a * i)
# 10950번
len = int(input(""))
for i in range(len):
a, b = map(int, input("").split(" "))
print(a+b)
# 8393번
n = int(input(""))
list = []
for i in range(1, n+1):
list.append(i)
print(sum(list))
# 15552... | true |
20a1ea85261737bebc169f9179f6da7bacd2515f | Python | atulanandnitt/questionsBank | /basicDataStructure/array_list/extra/KthChar_InStr.py | UTF-8 | 1,145 | 3.484375 | 3 | [] | no_license | #https://practice.geeksforgeeks.org/problems/find-k-th-character-in-string/0/?ref=self
def binaryFun(m):
val=""
while m >1:
val += str(m % 2)
#print("val is :",val)
#print("m is ",m)
m=m // 2
val += str(m % 2)
return val
def sol(m,k,n):
bin_m= bin... | true |
084d83b9d8c3fc3c6d6493bf19e27f30893802c1 | Python | real-ariful/Bangla-Digit-Recognition | /morpht.py | UTF-8 | 3,121 | 3.21875 | 3 | [] | no_license | # Morphological Transformations
#%%
# Erosion is where we will "erode" the edges
#Dilation-does the opposite
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([30,150,50])
upp... | true |
aba2d55aeb1e2171447b23cfe44d9b6d511eb981 | Python | andrewdonato/cityscape | /cityscape_with_classes/cityscape_with_classes.pyde | UTF-8 | 5,455 | 2.734375 | 3 | [] | no_license | import math
streets = []
curbs = []
buildings = []
mapWidth = None
mapHeight = None
mapDepth = None
mapTop = None
mapBottom = None
mapleft = None
mapRight = None
tileWall = 600
desiredStreets = [
(1*tileWall/8, 0*tileWall/8, 0, 1*tileWall/8, 8*tileWall/8, 0),
(0*tileWall/8, 4*tileWall/8, 0, 4*tileWall/... | true |
2ccd11d88e4d9b1307a9c915a09326e70d141a9c | Python | snack-boomz/Treehouse-Python-Unit3-OOP-PhraseHunter-Game | /phrasehunter/game.py | UTF-8 | 5,800 | 3.828125 | 4 | [] | no_license | import random
from phrasehunter.phrase import Phrase
class Game():
def __init__(self):
self.missed = 0
# -- https://randomwordgenerator.com/ --
self.phrases = [Phrase("hello world"), Phrase("Amazing pie"), Phrase("Black cat"), Phrase("Sparkling water"), Phrase("large chair")]
self.... | true |
201a551e189a1a911a0a1b00f18bbb5b755b56a8 | Python | Anvi2520/Python-programming-Lab | /factr.py | UTF-8 | 183 | 3.859375 | 4 | [] | no_license | def fact(x):
if x==1:
return 1
else:
return x*fact(x-1)
n = int(input("Enter the number-"))
f=fact(n);
print("The factorial of the given number:\n",f)
| true |
f2640b96fab090bda53ff61bdc47fd21845c5d57 | Python | talitz/digital-humanities-course-assignments | /Q3/main.py | UTF-8 | 4,593 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###### global imports ######
import re
from lxml import etree
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
import datetime
from xml.etree import ElementTree
###### classes ######
class TaggedWords(object):
"""... | true |
570c56df3601ab353abe9b2094212ce08ba8beab | Python | sandance/Algorithms | /Graphs/walking.py | UTF-8 | 395 | 3.125 | 3 | [] | no_license | # Walk Function will traverse a single connected component( assuming the graph is connected)
# To Find all the components , you need to wrap it in over the nodes
#
#
def walk(G,s,S=set()): # Walk the Graph from node s
P,Q = dict(), set()
P[s] = None
Q.add(s)
while Q:
u=Q.pop() #Pick one, arbitarily
fo... | true |
ebce54f9544768a1cd5b60c96e3ffabb8a3a4c52 | Python | sofiazenzola/Python-INFO1-CE9990 | /NYC_Water_Consumption.py | UTF-8 | 1,050 | 3.734375 | 4 | [] | no_license | """
NycWaterConsumption.py
Reads csv from NYC Open Data URL
Puts fields in a list of strings
Outputs the water consumption per capita (gallons per person per day) for a given year
"""
import sys
import csv
import urllib.request
year=input("Select a year from 1979-2016: ")
url = "https://data.cityofnewyork.us/api/... | true |
fb50223586a5e6fd1738ff17590431323eb08005 | Python | FeminaAnsar/luminarpython | /datastrctr/queue.py | UTF-8 | 883 | 4.0625 | 4 | [] | no_license | size=int(input("Enter the size : "))
queue=[]
rear=0
front=0
n=1
def insertion():
global rear
global front
if rear<size:
item=int(input("Enter the element : "))
queue.insert(rear,item)
rear+=1
else:
print(rear)
print("Queue is full...!!!")
def deletion():
... | true |
86271b342c796035e040806d66ae130f036ba33c | Python | eishagoel15/GettingStartedAWS-2021 | /myLambdaDemo/app.py | UTF-8 | 840 | 2.5625 | 3 | [] | no_license | import tempfile
import boto3
from PIL import Image
from chalice import Chalice
app = Chalice(app_name='chalice_image_thumbnails-2', debug=True)
s3_client = boto3.client('s3')
input_bucket = "demo-bucket-input-2021"
output_bucket = "demo-bucket-output-2021"
@app.on_s3_event(bucket=input_bucket)
def resize_image(even... | true |
627a281f65eaa02fd071340367a27da649867c55 | Python | wsfjonah/data_science | /test/reporting_test/service/echarts/test_heatmap.py | UTF-8 | 629 | 2.65625 | 3 | [] | no_license | import random
from example.commons import Faker
from pyecharts import options as opts
from pyecharts.charts import HeatMap
def heatmap_base() -> HeatMap:
value = [[i, j, random.randint(0, 50)] for i in range(24) for j in range(7)]
print(Faker.clock)
print(Faker.week)
print(value)
c = (
Hea... | true |
2ea732b1eeb0afbb231ab7f32ff024c08a105b98 | Python | shwetgarg/algorithms | /Trees/tree.py | UTF-8 | 1,972 | 3.34375 | 3 | [] | no_license | import sys
from collections import deque
class Tree:
def __init__(self, v, l=None, r=None):
self.v = v
self.l = l
self.r = r
def print_inorder_traversal(self):
if self is None:
return
if self.l is not None:
self.... | true |
eed167750babc9c50cf99a1f852fa827caeea8ac | Python | sharat7j/python-project | /findSumzero.py | UTF-8 | 302 | 3.28125 | 3 | [] | no_license | def find_zero_sum(arr):
H = {}
sum = 0
for i in xrange(len(arr)):
sum += arr[i]
if sum in H.keys():
print "Find the first sub-array with zero sum:"
print arr[H[sum]+1:i+1]
return True
else:
H[sum] = i
return False
| true |
7d5a93c52fabf4f246fa9676bb76e55a350afe78 | Python | mahespunshi/maheshpunshi | /linear serach.py | UTF-8 | 734 | 4.46875 | 4 | [] | no_license | # search a value from list, binary search is faster than linear search
pos = -1
def search():
# i = 0
# while i < len(list):
# if list[i] == n:
# globals()['pos'] = i
# return True;
# i = i + 1
# return False;
# above example is a while loop, let's do in for loop, ... | true |
1f5296a74ae813492a98fc70321b8fa576a3f529 | Python | NoJeong/TID | /doit_python/02. 기초문법/19단_곱셈표.py | UTF-8 | 84 | 3.6875 | 4 | [] | no_license | for i in range(1,20):
for j in range(1,20):
print(f'{i} x {j} = {j*i}')
| true |
d86e3b799515707ad3a38b7f57ed855d9c822dd5 | Python | bravoo84/AI_Workshop | /trialPy.py | UTF-8 | 117 | 3.96875 | 4 | [] | no_license | var=input("Enter a string:")
for letter in var:
if(letter==''):
continue
else:
print(letter)
| true |
5a148b51a3e9f93a92131176da93be1452b81e87 | Python | steven85048/Networks_Client_Server | /messaging_system/client/client_setup.py | UTF-8 | 3,176 | 2.609375 | 3 | [] | no_license | import socket
import sys
import threading
import traceback
from messaging_system.client.config import client_config
from messaging_system.client.input_handler import InputHandler
from messaging_system.client.response_handler import ResponseHandler
from messaging_system.client.state_transition_manager import StateTrans... | true |
7086248555aeb4bf66ab6b7ee0c4ab77c761086a | Python | ZoranPandovski/al-go-rithms | /games/Python/Pong Game/scoreboard.py | UTF-8 | 690 | 3.484375 | 3 | [
"CC0-1.0"
] | permissive | from turtle import Turtle
class ScoreBoard(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.color("white")
self.hideturtle()
self.l_score=0
self.r_score=0
self.update_scoreboard()
def update_scoreboard(self):
self.clear()
... | true |
1696a0dc00f8511341c8cd17ceb100e7e08e7859 | Python | neerajrp1999/library-Management | /BookDetails.py | UTF-8 | 5,379 | 2.625 | 3 | [] | no_license | import pyodbc
from tkinter import *
import tkinter
from tkinter import messagebox
import HomePage
cnxn = pyodbc.connect("Driver={SQL Server};"
"Server=.\;"
"Database=tester;"
"Trusted_Connection=yes;")
cursor = cnxn.cursor()
def ClearList(Boo... | true |
478c19b2bc96038e528fff2c4727fd3be00034ff | Python | PatrickMugayaJoel/SendIt | /app/utilities/utils.py | UTF-8 | 176 | 2.96875 | 3 | [] | no_license |
def serialize(objt):
return objt.__dict__
def serialize_list(mylist):
listtwo = []
for item in mylist:
listtwo.append(serialize(item))
return listtwo
| true |
b2a82713f65464456ccee312b7150fbaa6bc7c99 | Python | ido10en/http_server_finaly | /http_server_shell.py | UTF-8 | 7,240 | 2.75 | 3 | [] | no_license | import socket
import os
# constants
IP = '127.0.0.1'
PORT = 8090
SOCKET_TIMEOUT = 5.0 # the time the server waits before raising error if there is no Get
#Get data from file
def get_file_data(file_root):
file_data = open(file_root, 'rb')
data = file_data.read()
file_data.close()
return data
def creat... | true |
2796b8183e65f9f9693d1cb5121571f95cec187b | Python | luigirizzo/netmap | /extra/python/pktman.py | UTF-8 | 9,231 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
#
# Packet generator written in Python, providing functionalities
# similar to the netmap pkt-gen written in C
#
# Author: Vincenzo Maffione
#
import netmap # our module
import time # time measurements
import select # poll()
import argparse # program argument parsing
imp... | true |
0bc456507a518f3fb571504ebb53ed478f723250 | Python | WashHolanda/Curso-Python | /exercicios_Youtube/ex057.py | UTF-8 | 422 | 3.921875 | 4 | [] | no_license | '''
Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores 'M' ou 'F'.
Caso esteja errado, peça a digitação novamente até ter um valor correto.
'''
sexo = input('Informe seu sexo [M/F]: ').strip().upper()[0]
while sexo not in 'MF':
sexo = input('\033[31mDados Inválidos!\033[m Por favor informe seu... | true |
35e0da2ba60407f971aa3b8200d64f01ceefc970 | Python | BAGPALLAB7/HackerRank-Solutions-Python3 | /HackerRank - Problem Solving/anagram-hackerrank(easy).py | UTF-8 | 372 | 3.5 | 4 | [] | no_license | def anagram(s):
if len(s)%2!=0:
return (-1)
else:
res=0
s1=s1=s[:int(len(s)/2)]
s2=s[int(len(s)/2):]
s2=list(s2)
for i in s1:
if i in s2:
s2.remove(i)
else:
res+=1
return res
s='ab'
print... | true |
286ff42f93d973e05447f3cfe94769ba09057f42 | Python | tempflip/pyxel_stuff | /engine.py | UTF-8 | 1,435 | 3.796875 | 4 | [] | no_license | import pyxel
import math
def rot(x_, y_, angle, cx=0, cy=0):
x = x_ - cx
y = y_ - cy
c = math.cos(math.radians(angle))
s = math.sin(math.radians(angle))
xn = x * c + y * s
yn = -x * s + y * c
return (xn + cx, yn + cy)
class Point:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def dr... | true |
b3432adc2e18640d451e977207a6a1c6ccf8f10f | Python | pzengseu/leetcode | /MultiplyStrings.py | UTF-8 | 839 | 2.65625 | 3 | [] | no_license | class Solution(object):
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
if num1=='0' or num2=='0': return '0'
m = len(num1)
n = len(num2)
res = [0] * (m + n)
num1 = list(reversed(num1))
num2 ... | true |
e486c02858064c752bcd6ec909d64f8c36eeccb1 | Python | dustinpfister/examples-python | /for-post/python-data-types/s5-lists/basic-list.py | UTF-8 | 66 | 2.953125 | 3 | [] | no_license | l = [1, 'two', 3]
print(l, type(l)) # [1, 'two', 3] <class 'list'> | true |
d8f1eecca08c9725f56d15ab3e10f06c4d8a259a | Python | baijifeilong/MilkPlayer | /widgets/media_player_buttons.py | UTF-8 | 2,212 | 2.578125 | 3 | [] | no_license | from PyQt5 import QtWidgets, QtCore, QtGui
import os
class MediaPlayerButtons(QtWidgets.QWidget):
def __init__(self, media_player):
super().__init__()
self._media_player = media_player
self._media_player.stateChanged.connect(self._change_button_icon)
self.init_ui()
@proper... | true |
3f6c8ae7d6f8e29c16443382bf5b8659728c29de | Python | candyer/leetcode | /2020 June LeetCoding Challenge/26_sumNumbers.py | UTF-8 | 1,419 | 3.84375 | 4 | [] | no_license | # https://leetcode.com/explore/featured/card/june-leetcoding-challenge/542/week-4-june-22nd-june-28th/3372/
# Sum Root to Leaf Numbers
# Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
# An example is the root-to-leaf path 1->2->3 which represents the number 123.
... | true |
04cef3376226ddc9b9135f2a0ee6056ef9ad26b9 | Python | FireCARES/firecares | /firecares/firestation/management/commands/match_districts.py | UTF-8 | 3,055 | 2.578125 | 3 | [
"MIT"
] | permissive | from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import MultiPolygon, Polygon
from firecares.firestation.models import FireStation
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Matches district geometry within GeoJSON files with appropriate fir... | true |
69981bd78ce3934247216ebaaf59e9e9b87d55cf | Python | jiyali/python-target-offer | /64_求1+2+…+n.py | UTF-8 | 554 | 3.921875 | 4 | [] | no_license | # 题目:求 1+2+…+n,要求不能使用乘除法、for、while、if、else、switch、case 等关键字及条件判断语句(A?B:C)。
# 思路:等差求和
class Solution(object):
def Sum_Solution(self, n):
return (n**2 + n) >> 1
class Solution1(object):
def __init__(self):
self.sum = 0
def Sum_Solution(self, n):
self.getsum(n)
return self.... | true |
9344b300d7a03bf88427b6e94651178d9b25ba01 | Python | pengyuhou/git_test1 | /leetcode/2的幂.py | UTF-8 | 412 | 3.59375 | 4 | [] | no_license | import math
class Solution(object):
def isPowerOfTwo(self, n):
if n <= 0:
return False
a = math.log(n)
b = math.log(2)
res = str(a / b)
if res[-1] == str(0):
return True
else:
return False
if __name__ == '__main__':
s = Sol... | true |
82a33c9a9b9c86f110d1cc0b95d742651046f649 | Python | Jingboguo/python | /ps1/ps1b.py | UTF-8 | 950 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 22:27:26 2017
@author: Vivian
"""
annal_salary = float(input('Enter your starting annual salary:'))
portion_saved = float(input('Enter the percent of your salary to save, as a decimal:'))
total_cost = float(input('Enter the cost of your dream ho... | true |
a757cc21a98e4f0acf9c97f1f84364b6b1be439c | Python | carolinesargent/molssi-python-tutorial | /test_geom_analysis.py | UTF-8 | 938 | 2.671875 | 3 | [] | no_license | import geom_analysis as ga
import pytest
def test_calculate_distance():
coord1 = [0, 0, 0]
coord2 = [1, 0, 0]
expected = 1.0
observed = ga.calculate_distance(coord1,coord2)
assert observed == expected
def test_bond_check_1():
atom_distance = 1.501
expected = False
observed = ga.bond_c... | true |
ee254927141454c7385b4fec59098b1808f478e5 | Python | nileshnmahajan/helth | /temp/bulk_rog.py | UTF-8 | 291 | 2.578125 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('hos_data.db')
c = conn.cursor()
fp1=open('rog.csv','r',encoding="utf-8")
count=0
for row in fp1:
count=count+1
data=row.replace("\n",'')
c.execute('insert into Disease(dname) values (?)',(data,))
if(count==2):
break
conn.commit()
conn.close()
| true |
346e2d757607c95d1b8e2b6b5eb0717a77bc48cf | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/bob/1654f40a0e1d45dcbfc8c4c54c282aeb.py | UTF-8 | 388 | 3.6875 | 4 | [] | no_license | def is_question(phrase):
return phrase.endswith("?")
def is_yelling(phrase):
return phrase.isupper()
def hey(phrase):
response = "Whatever."
phrase = phrase.strip()
if not phrase:
response = "Fine. Be that way!"
elif is_yelling(phrase):
response = "Woah, chill out!"
elif ... | true |
3bbae030819c3f9fd7c87a6dd7ac3ee311d0e68e | Python | CristianoSouza/tcc | /server/ArduinoUDPClient.py | UTF-8 | 420 | 3.171875 | 3 | [] | no_license | import socket
# Create a TCP/IP socke
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Connect the socket to the port where the server is listening
server_address = ('192.168.25.177', 8888)
while 1:
print ("connecting to " ,server_address)
message = 'This is the message'
print ('sending :', mess... | true |
4be8882539901195f1daa27546d519fdf50a1379 | Python | innovatorved/Web-Scrapping | /b6-comment.py | UTF-8 | 211 | 3.03125 | 3 | [] | no_license | # python b6-comment.py
from bs4 import BeautifulSoup
with open("example.html" ,"r") as l:
soup = BeautifulSoup(l ,"lxml")
comment = soup.p.string
print(comment)
print(type(comment))
print(soup.p.prettify()) | true |
af33c18456d120d59040d698b857237f9592a33b | Python | obscuresc/aah-hp | /module_controller/hat.py | UTF-8 | 1,644 | 2.5625 | 3 | [] | no_license | # install 'sudo pip3 install adafruit-circuitpython-servokit'
# see hat reference
import board
import busio
import adafruit_pca9685
from adafruit_servokit import ServoKit
# settings
PWM_FREQ = 60
PWM_DUTYCYCLE_MAX = 0xffff
# modules
m1a_ch = 0
m1b_ch = 1
m1v_ch = 2
m2a_ch = 3
m2b_ch = 4
m2v_ch = 5
m3a_ch = 6
m3b_c... | true |
48251f4b5a725289e7de7175534fc40526e118cb | Python | dtewitt/Wflow_Volta_Project | /RS_assessment_funcs.py | UTF-8 | 19,637 | 2.75 | 3 | [] | no_license | ### Write GRACE assessment in a script that assesses GRACE performance after saving of the TWSA netcdf file
# GRACE is quite fast (coarse spatial and temporal resolution) so can be done outside of the loop, also because of the rescaling (to monhtly) makes things very difficult inside the loop...
def TWSA_assessment_sp... | true |
7bf6c165209bea1931c5db13c4339e0bb6e5c870 | Python | mjziebarth/gmt-python-extensions | /gmt_extensions/axis.py | UTF-8 | 788 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | # Supply a simple axis.
class Axis:
"""
Make plotting a little bit like matplotlib.
"""
def __init__(self, fig, region, projection, frame=True):
self._region = region
self._projecion = projection
self._fig = fig
self._frame = frame
def coast(self, land=None, water=None, shownationalborders=False,
... | true |
ca34ed57b1e00ec36c57bb53a2e9966c60c98b93 | Python | TeamSkyHackathon/blue | /loader.py | UTF-8 | 2,278 | 3.140625 | 3 | [] | no_license | import numpy as np
from sklearn.cross_validation import KFold
from settings import *
##################### HELPERS ############################
def load_data(path, count, with_labels=False):
"""
:param count: feature count to load for one subset
:param with_labels: indicate whether labels are present
... | true |
2ddff464b08a99514ccbc693763a52b724fc94e2 | Python | LaurensVergote/Robotic-Hand | /build/debug/Serializer.py | UTF-8 | 934 | 2.828125 | 3 | [
"MIT"
] | permissive | import serial
ser = serial.Serial()
class Serializer:
def _init_(self):
self.baudrate = 9600
self.comPort = None
def createSerialPort(self):
try:
ser = serial.Serial(self.comPort, self.baudrate)
except Exception,e: print "createSerialPort error: ", str(e)
def setBaudRate(self, baudrate):
self.ba... | true |
310e777251747a5dfafbc9f3be2637e2b6cd9f69 | Python | hcourt/biology | /alignment.py | UTF-8 | 10,061 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python
import sys
#A program to calculate a best alignment for two given ACTG sequences.
## a class which represents each position in the sequence matrix which will be calculated. Position has a score, an up pointer (0 or 1), a left pointer (0 or 1), and a diagonal pointer (0 or 1). Each pointer is 0 if... | true |
da70674bece2ff983896f7e16d1418eda48fa730 | Python | legendary-jld/schema-org | /schema_org.py | UTF-8 | 2,292 | 2.8125 | 3 | [] | no_license | import datetime
# Local Libraries
import definitions
class Thing(object):
def __init__(self, **kwargs):
self.itemStructure = None
self.parentStructure = None
self.schema = definitions.Thing()
self.setAttributes()
def setAttributes(self, parent=None, **kwargs):
if pare... | true |
2f155ddf253abf8bc0809b55a63169b6463fd042 | Python | niranjan-nagaraju/Development | /python/interviewbit/arrays/find_permutation/find_permutation.py | UTF-8 | 2,016 | 4.09375 | 4 | [] | no_license | '''
https://www.interviewbit.com/problems/find-permutation/
Find Permutation
Given a positive integer n and a string s consisting only of letters D or I, you have to find any permutation of first n positive integer that satisfy the given input string.
D means the next number is smaller, while I means the next number ... | true |
23221def284aa4e39a15db7e4d1a9144661a7c8a | Python | jklypchak13/TrojanHorse | /src/trojan/crypto.py | UTF-8 | 1,666 | 3.21875 | 3 | [] | no_license | from pathlib import Path
from pyAesCrypt import encryptFile
from pyAesCrypt import decryptFile
password = "trojan"
bufferSize = 64 * 1024 # 64k
"""
encrypt the file at input_file_path_str
input_file_path_str can be relative or absolute
deletes the input file at the end
"""
def encryptAndDeletePlaintext(input_file_... | true |
b678daa44551a7749097ab56a40715489dfcd86b | Python | hector81/Aprendiendo_Python | /Panda/Ejercicio4_pago_media_vivos_muertos.py | UTF-8 | 637 | 3.703125 | 4 | [] | no_license | '''
4. ¿Cuánto pagaron de media los supervivientes? ¿y los que no se salvaron?
'''
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
fichero = Path('titanic.csv')
# sep='\t' es el delimitador donde separa con \t o tabulaciones
df = pd.read_csv(fichero, sep='\t'... | true |
f9d12ed8605663d69a21e91eb917e614b9140648 | Python | terryhu08/MachingLearning | /src/python/FP-Growth/FP-Growth.py | UTF-8 | 5,607 | 2.984375 | 3 | [] | no_license | #coding:utf-8
'''
Created on 2017/11/14
author: fdh
FP—Growth: 韩家炜教授提出的基于FP-tree挖掘频繁项的算法,相对于Apriori只扫描
2遍数据,效率更高, FP = Frequent Pattern
算法需要创建两个数据结构:
1: FP-Tree
2: Header Table
参考博客: http://www.cnblogs.com/jiangzhonglian/p/7778830.html
https://www.cnblogs.com/datahunter/p/3903413.html#und... | true |
2ad3edccc0f1d649d1780aa020b8ecd7575d88e4 | Python | Beelthazad/PythonExercises | /EjerciciosBasicos/ejercicio1.py | UTF-8 | 217 | 3.609375 | 4 | [] | no_license | # Resultado de leer num enteros, reales o cadenas...
num = int(input("Introduce un número\n"))
print(num)
char = input("Introduce un carácter\n")
print(char)
string = input("Introduce una cadena\n")
print(string)
| true |
3b89ba980f95aace259b5f3a2fa6c2cea671f7b2 | Python | SLR1999/ML_Assignment | /outlier.py | UTF-8 | 1,381 | 3.359375 | 3 | [] | no_license | import numpy as np
def MahalanobisDist(data):
'''Computing covariance matrix for the data'''
covariance_matrix = np.cov(data, rowvar=False)
'''Computing pseudoinverse of the covariance matrix'''
inv_covariance_matrix = np.linalg.pinv(covariance_matrix)
vars_mean = []
'''Appending ... | true |
1547be792bfb60d8d879d9b6fd95736d1047ce18 | Python | kanishka100/gitdemo | /tests/test_swag_lab.py | UTF-8 | 2,963 | 2.984375 | 3 | [] | no_license | import pytest
from Page_object.login_page import Login_page
from test_data.home_page_data import Test_Data
from utilities.bAse_class import Base_Class
class Test_Sauce(Base_Class):
def test_sauce_website(self, get_login_data, get_homepage_data, get_checkout_data):
url = 'https://www.saucedemo.com/'
... | true |
fed0220d8de3bf71ec98085ba30581cdf7bfd88a | Python | V-E/scraping | /worldometer/worldometer/spiders/countries_data.py | UTF-8 | 1,843 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
def sanitize(value):
if (not value) or (value.strip() == ''):
return 0
index = 1 if '+' in value else 0
return float(''.join(value.strip().split('+')[index].split(',')))
def toggle_check(check1, check2):
if not check1:
return check2
return ... | true |
87776657dd851506aa2c9e4e3f1960e2bcb2dc0a | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2623/60594/243798.py | UTF-8 | 565 | 3 | 3 | [] | no_license | def panduan(z)->bool:
try:
z = int(z)
return isinstance(z, int)
except ValueError:
return False
def sort(A:list)->list:
oc=[]
a=1
b=len(A)
while a<=b:
min=0
for index in range(len(A)):
if A[index]<A[min]:
min=index
oc.ap... | true |
013038a7d13d0c376cc1309eb0bc4296dfe6a197 | Python | kstudzin/pub_sub_mq | /latency_analysis.py | UTF-8 | 1,533 | 2.71875 | 3 | [] | no_license | import os
import pathlib
import re
import pandas as pd
from matplotlib import pyplot as plt
source = "latency"
filename_pattern = re.compile(".*(sub-(\\d+)_broker-([rd])).*")
output_plot = "boxplot.png"
output_stat = "boxplot.txt"
def import_data():
df = pd.DataFrame()
names = []
for file in os.listdir(... | true |
fbf0bec49e487ab4a6fccb12b875ea4223613641 | Python | PennaLai/patch_sampling | /patch_samping.py | UTF-8 | 1,978 | 3.125 | 3 | [] | no_license | from matplotlib.image import imread
from matplotlib import pyplot as plt
import numpy as np
def read_image(file_name):
image_matrix = imread(file_name)
print(image_matrix.shape)
return image_matrix
def output_image(image_arr):
plt.imshow(image_arr, interpolation='nearest')
plt.show()
def patch... | true |
830ce2e97a871c3bcda6bd5bacb1db4da672ac8b | Python | jbwillis/marblemaze | /tools/captureImage.py | UTF-8 | 1,050 | 2.796875 | 3 | [] | no_license | #! /usr/bin/env python3
import cv2
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Capture an image from the given camera number')
parser.add_argument('cam', help='OpenCV camera number (0 indexed)', type=int)
parser.add_argument('--video', help='Capture and save video', type=str)
... | true |
be29c53ce6ec699d6f39b0ce6bd8928ee8e7bda9 | Python | OpenDingux/tests | /vsync/buffersim.py | UTF-8 | 3,235 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
def render_constant(duration):
"""Return the same frame render duration for every time stamp."""
return lambda now: duration
# An application model should yield (buf_count, render_start) pairs.
# buf_count is a sequence number identifying the render, or -1 for
# frames already in the f... | true |
a9a5977273ce884e08369c92951eb06bd194eec6 | Python | Halacky/parsRos | /screenShot.py | UTF-8 | 790 | 3.203125 | 3 | [] | no_license | import cv2
class Image:
def __init__(self, imageLink):
self.imageLink = imageLink
def readImage(self):
try:
imgRead = cv2.imread(self.imageLink)
return imgRead
except Exception:
print(Exception)
return False
def cropImage(self):
... | true |
82a4691b73c28b372704796beef097703fba5477 | Python | faylau/PythonStudy | /src/Decorator/DecoratorExample01.py | UTF-8 | 7,765 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python
# encoding:utf-8
__authors__ = ['"Liu Fei" <liufei83@163.com>']
__version__ = "V0.1"
import functools
'''
1.关于Decorator,这里并没有做特别详细和深入的讲解,只是给了一些常规的Decorator用法;
2.具体Decorator的学习,可以参考文章 http://coolshell.cn/articles/11265.html;
3.Decorator的使用很广泛,建议在平时coding过程中思考,哪些操作可以通过Decorator的方式解决,积累经验。
'''
'''--... | true |
32327fdedaed80675002f85f360746e1f5719c89 | Python | Ptrak/AdventOfCode2019 | /problem7/solution.py | UTF-8 | 5,912 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | import itertools
def add(program, pc, mode1, mode2):
if mode1 == 0:
lhs_val = int(program[int(program[pc+1])])
elif mode1 == 1:
lhs_val = int(program[pc+1])
if mode2 == 0:
rhs_val = int(program[int(program[pc+2])])
if mode2 == 1:
rhs_val = int(program[pc+2])
result... | true |
b4819c07d5926b771165f74ec24f9b5070f15554 | Python | YanWangNYUSH/CalcVIX | /graph.py | UTF-8 | 1,209 | 2.796875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# use the commented code to generate to_daily.csv and true_vix.csv
# result = pd.read_csv('Calculated_result.csv')
# result['datetime']=pd.to_datetime(result['time'])
# result.set_index(result['datetime'],inplace = True)
# dayvix = result.resample(... | true |
28f9fab3e39f901aa33dab1b59a11f80193058cb | Python | pankaj-lewagon/mltoolbox | /mltoolbox/clean_data.py | UTF-8 | 534 | 3.5625 | 4 | [] | no_license | import string
def remove_punctuation(text):
for punctuation in string.punctuation:
text = text.replace(punctuation, '')
return text
def lowercase(text):
text = text.lower()
return text
def remove_num(text):
num_remove = ''.join(word for word in text if not word.isdigit())
return num... | true |
89aad3d9d252c31de5f85d7722de94145432e99c | Python | dmitryhits/learning_python3 | /reloadall3.py | UTF-8 | 677 | 2.875 | 3 | [] | no_license | """
reloadall3.py: transitively reload nested modules (nested stack)
"""
import types
from reloadall import status, tryreload, tester
def transitive_reload(modules, visited):
while modules:
nextmod = modules.pop()
status(nextmod)
tryreload(nextmod)
visited.add(nextmod)
#p... | true |
03d9bf5cfdc9457715409c89c49dd0c30b7e741d | Python | Herohonour/Dict | /Dict/dict_client_v02.py | UTF-8 | 2,062 | 3.75 | 4 | [] | no_license | """
客户端 v2.0
1. 与服务端建立连接
2. 给用户显示功能菜单
3. 给服务端发送注册请求
"""
from socket import *
from getpass import getpass
# 服务端地址
ADDR = ("127.0.0.1", 12306)
# 建立套接字对象,并与服务端建立连接
s = socket()
s.connect(ADDR)
def do_register():
"""
注册逻辑:
输入用户名
用户名不能重复
- 查询user表中是否存在username,存在则不合规则
... | true |
785a4748e33e7c97b6d672bc1e0a9ec9a2bc286d | Python | Aasthaengg/IBMdataset | /Python_codes/p03993/s527132366.py | UTF-8 | 143 | 3.140625 | 3 | [] | no_license | n = int(input())
a = [int(s) for s in input().split()]
ans = 0
for i in range(n):
if a[a[i]-1] == i + 1:
ans += 1
print(ans // 2)
| true |
1b77b79c865f3b047e24fcee2f6408b13bcedbae | Python | maftuna-coder/Python-Programming-3 | /exercise3solution.py | UTF-8 | 478 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 7 10:01:01 2019
@author: Maftuna
"""
def XOR(a,b,c):
a = int(a)
b = int(b)
c = str("XOR")
if ((a and not b) or (not a and b))==1:
return 1
else:
return 0
def Main():
a = input("enter value for first input -> ")
b = input... | true |
fca047c54adb9e66960bfda79cb32a1126e1f9ae | Python | k0syan/Kattis | /booking_a_room.py | UTF-8 | 365 | 3.453125 | 3 | [] | no_license | if __name__ == "__main__":
tmp = input().split()
r, n = int(tmp[0]), int(tmp[1])
rooms = []
while n != 0:
room = int(input())
rooms.append(room)
n -= 1
if len(rooms) == r:
print("too late")
else:
for i in range(1, r + 1):
if i not in rooms:
... | true |
e5e84ebe45d6b3ee03e7dcd5ebd5f5594ae5eba6 | Python | pastly/tor-ircbot | /member.py | UTF-8 | 4,374 | 3.109375 | 3 | [] | no_license | from time import time
class Member:
def __init__(self, nick, user=None, host=None):
self.nick = nick
self.user = user
self.host = host
def __str__(self):
return '{}!{}@{}'.format(self.nick, self.user, self.host)
def set(self, nick=None, user=None, host=None):
if n... | true |
99821a5e24fced3323c4b73c9fc578ac822a1f9f | Python | kexinyi/crowdsource | /python/nebulosity_mask.py | UTF-8 | 4,772 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function, division
import keras
import keras.models as kmodels
import numpy as np
def equalize_histogram(img, n_bins=256, asinh_stretch=False):
# from http://www.janeriksolem.net/2009/06/histogram-equalization-with-python-and.html
# Stretch the image with... | true |
a64337580de37dbd4fb4c6c6e09c8e45a9e26420 | Python | rghiglia/Yelp | /yelp_start_20160620b_bkp.py | UTF-8 | 10,054 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 10 08:23:23 2016
@author: rghiglia
"""
import matplotlib.pyplot as plt
# Wasn't necessary. Used winzip and now files are in JSON
# Use this to unzip
#import gzip
#
## Extract files
#dnm = r'C:\Users\rghiglia\Documents\ML_ND\Yelp'
#fnz = 'sample_submission.csv.gz'
#fnz... | true |