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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8576d9174b9a439462ff5fa98b4e91de5121c918 | Python | keezysilencer/XSS_Scan- | /scan.py | UTF-8 | 876 | 3.234375 | 3 | [] | no_license | import requests
import re
from bs4 import BeautifulSoup
from urllib.parse import urlparse
from urllib.parse import urljoin
class Scanner:
def __init__(self, url):
self.target_url = url
self.target_links = []
def extract_links_from(self, url):
response = requests.get(url)
retur... | true |
4cf5b00667bfb1909ed281cca86f419973981d00 | Python | osmaoguzhan/akinci | /akinci.py | UTF-8 | 2,356 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
akinci - Automatic Network and Port Scanner
Copyright (C) 2019 Oguzhan Osma
"""
from model import networkScanner
import argparse
from controller import dbOp as db
__author__ = "Oguzhan Osma"
__version__ = "v1.0"
def argParse():
parser = argparse.Argumen... | true |
e550d418c8c256b29dee9630cacf450f32fd183b | Python | heikalb/CMPT825 | /project/app/model_selector.py | UTF-8 | 1,522 | 2.671875 | 3 | [] | no_license | import pickle
import nltk
import spacy
from nltk.corpus import stopwords
from nltk import RegexpTokenizer
print('Loading language model...')
nlp = spacy.load('en_core_web_sm')
print('Loading stopwords...')
nltk.download('stopwords')
corpus_cnn = pickle.load( open( "../text_similarity/corpus_cnn.pkl", "rb" ) )
c... | true |
682e23c4148aae83edd342a7b243cf809efe721e | Python | ncss-2015-group-4/trivia | /difficulty_old.py | UTF-8 | 2,077 | 3.46875 | 3 | [] | no_license |
EASY = 1
MEDIUM = 2
HARD = 3
BEGINNER = 1
INTERMEDIATE = 2
EXPERT = 3
def difficulty(people_answers):
'''This is finding the difficulty level of a question.
people_answers is a list of the skill level of the person and their answer to the question.'''
sum = 0
for person, correct in people_answers:
if correct:
... | true |
133865aa43984dcaf9b447482f85ecb6e24b1442 | Python | Ella2604/Python | /hash_maps.py | UTF-8 | 899 | 3.375 | 3 | [] | no_license | personal_info = {
"nume": "Marius",
"varsta": "23",
"nota": "10"
}
def print_map():
print("Map ")
print(personal_info)
print(" ")
def access_values():
print("#4 accessing values")
print(personal_info.values())
print(" ")
def print_value():
print("#2 print a value")
prin... | true |
2a96b60626aac235911b9f2be4e99cd71521422f | Python | daniel-reich/turbo-robot | /7AQgJookgCdbom2Zd_8.py | UTF-8 | 1,283 | 4.40625 | 4 | [] | no_license | """
Create a function that takes a string of words and moves the first letter of
each word to the end of it, then adds 'ay' to the end of the word. This is
called "Pig Latin" and it gets more complicated than the rules in this
particular challenge. I've intentionally kept things simple, otherwise this
would turn int... | true |
50ef003a40d02556df977fd21fa8075bc6f5cfce | Python | Vijay-Yosi/biostack | /apps/scout/tests/commands/update/test_update_individual_cmd.py | UTF-8 | 2,440 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | """Tests for update individual command"""
from click.testing import CliRunner
from scout.commands.update.individual import individual as ind_cmd
# from scout.server.extensions import store
def test_update_individual_no_args():
"""Tests the CLI that updates a individual"""
# GIVEN a CLI object
runner =... | true |
ab009bf528023f9e43ae45d9f033de4c66884143 | Python | henrymorgen/Just-Code | /src/1227.airplane-seat-assignment-probability/airplane-seat-assignment-probability.py | UTF-8 | 106 | 2.703125 | 3 | [
"MIT"
] | permissive | class Solution:
def nthPersonGetsNthSeat(self, n: int) -> float:
return 1.0 if n == 1 else 0.5 | true |
b8e4999fc3872d0a46083bf4ed9c4f3727931aa6 | Python | axaymountry326/Pacman_portal_CPSC386 | /powerpills.py | UTF-8 | 559 | 2.953125 | 3 | [] | no_license | # Aaron Xaymountry
# CPSC 386-01
# MW 5:30-6:45pm
# Pacman game with portals
import pygame
from pygame.sprite import Sprite
class Powerpills(Sprite):
def __init__(self, screen):
super(Powerpills, self).__init__()
self.screen = screen
self.height = 7
self.width = 7
img = py... | true |
8a941be75e308ef8504646d0a5a81d4e4de92976 | Python | makeitlab/software_tools | /PythonScripts/misc/tele.py | WINDOWS-1251 | 553 | 2.578125 | 3 | [] | no_license | import telebot
bot = telebot.TeleBot('xyz') # api key
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, ', /start')
@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == '':
bot.send_message(message.chat... | true |
0f7a74167136a099eef0b0646910f17cbd7a66bb | Python | cosminvlaicu/PythonSyntax | /sets/basic.py | UTF-8 | 303 | 4 | 4 | [] | no_license | s1 = {"a", "b", "c"}
print(s1)
print(len(s1))
# set is implemented as a hashtable => O(1) find, insert, delete
if "a" in s1:
print("a is in s1")
# sets can contain different data types
s2 = {"a", 1, True, 40}
print(s2)
# list to set
lst = [1, 1, 2, 3, 4, 5]
s3 = set(lst)
print(lst)
print(s3)
| true |
639fb90f08ddcacbce0fe99b9a44f1574d110b65 | Python | AlzubaidiTurki/inappropiate-kid-videos-detector | /metrics.py | UTF-8 | 5,462 | 2.921875 | 3 | [] | no_license | import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import os
'''
This function is used for computing ROC and plot it with AUC (can do more than this too, but we used it for ROC only),
but it requires dataset for TP and TN. so you probably cannot use this function.
from pyAud... | true |
69944bd66d99ffa8ceda2c0fec1e63ea1b518cd8 | Python | matty-allison/Databases--EMOP | /log_in.py | UTF-8 | 3,011 | 2.78125 | 3 | [] | no_license | # Window for logging in a current student
from tkinter import *
import mysql.connector
from tkinter import messagebox
import datetime
box = Tk()
box.title("Log in!")
box.config(bg="green")
box.geometry("450x300")
class log:
def __init__(self, master):
self.name = Label(master, text="Enter your name and sur... | true |
fd07f429d827a326a181c9679f4b029cc1419873 | Python | joepalermo/tensorflow-ffn | /mnist_loader.py | UTF-8 | 1,727 | 3.4375 | 3 | [] | no_license | """
Original by Michael Nielsen.
Modified by Joseph Palermo.
A library to load the MNIST image data.
"""
import cPickle
import gzip
import numpy as np
from DataSet import DataSet
def load_data():
"""Return the MNIST data as a tuple containing the training data,
the validation data, and the test... | true |
465ca56f4534cc6fc610f2585494ff6b450616d2 | Python | ivaltukhova/medanalitica1 | /mednet.py | UTF-8 | 981 | 2.65625 | 3 | [] | no_license | from neo4j import GraphDatabase
import logging
from neo4j.exceptions import ServiceUnavailable
class Mednet:
def __init__(self, uri, user, password):
self.driver = GraphDatabase.driver(uri, auth=(user, password))
def close(self):
self.driver.close()
def find_all(self):
with self... | true |
608099e27582924a4e28162120b68632ed7ed3be | Python | iltison/homework | /TSP/tsp.py | UTF-8 | 13,917 | 3.703125 | 4 | [] | no_license |
"""
Для использования алгоритма с произволными значениями расстояний.
Требуется передать в класс tsp переменную matrix (матрицу расстояний).
По диагонали могут находиться любые значения, алгоритм изменит на бесконечность .
Пример:
matrix = [[999,0,1],
[0,999,1],
[1,1,999]]
test... | true |
2b44aa756788910d126cf57e5eab5f21b61260bb | Python | geonsoo/HCDE310 | /Homeworks/hw8/postapp/backup.py | UTF-8 | 6,245 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | true |
e21332d4bae409ea25c3dbbf02db39ad015d661e | Python | AhmedAliGhanem/PythonForNetowrk-Cisco | /15 Error Handling exceptions2.py | UTF-8 | 493 | 3.015625 | 3 | [] | no_license | def main():
try:
for line in readfile('xlines.txt'): print(line.strip())
except FileNotFoundError as e:
print("cannot read file:",e)
def readfile(filename):
fh = open(filename)
return fh.readlines()
if __name__ == "__main__": main()
#without rise exceptions
#def main():
# for li... | true |
77073678b5f36938d5af9b205d2b09be772251f5 | Python | ramsayleung/mp-just-for-fun | /lyrics.py | UTF-8 | 3,045 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from lxml import html
import weixin_logger
class LyricsSearcher(object):
def __init__(self):
logger = weixin_logger.WeixinLogger(__name__)
self.logger = logger.get_logger()
self.search_url = 'http://www.xiami.com/search?key='
... | true |
634926732636e14be5268961fd96ffbbf005c94f | Python | bo-yang/robotics_exercises | /diff_drive.py | UTF-8 | 1,165 | 3.359375 | 3 | [] | no_license | import numpy as np
def diffdrive(x, y, theta, v_l, v_r, t, l):
""" Implement the forward kinematics for the differential drive.
x, y, theta is the pose of the robot.
v_l and v_r are the speed of the left and right wheels.
t is the driving time.
l is the distance between the wheels.... | true |
80b0ce279718045bda81edbaabe6f23f7cbafbb8 | Python | nemborkar/coding-challenges-to-gitgud | /Python/min-max.py | UTF-8 | 542 | 3.53125 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/np-min-and-max/problem
# after understanding numpy and figuring out the input process,
# this one was too easy
import numpy
# this chunk is working and enable it later
n, m = input().split()
n = int(n) # 0 axis
m = int(m) # 1 axis
first_array = numpy.zeros((n,m))
for i in ran... | true |
b111d74ff5582a475e28c2ceea181f8684cd1351 | Python | Wenzurk-Ma/Python-Crash-Course | /Chapter 07/counting.py | UTF-8 | 438 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | # Title : TODO
# Objective : TODO
# Created by: Wenzurk
# Created on: 2018/2/17
# current_number = 0
# while current_number <= 5:
# print(current_number)
# current_number += 1
# while current_number < 10:
# current_number += 1
# if current_number % 2 == 0:
# continue
#
# print(current... | true |
2a6a51d9392fe8a2940d33ee2b77f55eecc6e9d8 | Python | obskyr/poketrainer-trainer | /pokehelp.py | UTF-8 | 14,933 | 3.265625 | 3 | [] | no_license | # -*- coding: cp1252 -*-
###############################################
## ##
## TABLE OF CONTENTS: ##
## 0 - Type assets ##
## 0.0 - List of types ##
## 0.1 - Dictionary of type advantages ##
## ... | true |
8e36e398f8f14fd66108eeb649fe51b96f7b5b4a | Python | sunbaby01/nerual-network | /nerualnetwork.py | UTF-8 | 3,820 | 2.671875 | 3 | [] | no_license | import torch
import random
import numpy as np
q=0
#结果产生器
def resultgenerator(x):
return [[ 2*i*i -3*i+3 for i in eachx ] for eachx in x]
class fullconnection:
def __init__(self,inputnum,outputnum):
self.w=[[(random.random()-0.5)*2 for i in range(inputnum)] for i in range(outputnum)]... | true |
4e18554e2dbd56aa38e13aa0d2b1741a3b828c0a | Python | joeking11829/tornwamp | /tests/test_topic.py | UTF-8 | 6,323 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from mock import patch
from tornwamp.topic import Topic, TopicsManager
from tornwamp.session import ClientConnection
class MockSubscriber(object):
dict = {"author": "plato"}
class TopicTestCase(unittest.TestCase):
def test_constructor(self):
topic = Topic("the.monarchy")
se... | true |
6943cb88730019116525d0e541b0638045471392 | Python | Jimut123/code-backup | /python/coursera_python/deeplearning_ai_Andrew_Ng/1_NN_DL/work/Week 3/Planar data classification with one hidden layer/planar_utils.py | UTF-8 | 2,253 | 3.0625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import sklearn
import sklearn.datasets
import sklearn.linear_model
def plot_decision_boundary(model, X, y):
# Set min and max values and give it some padding
x_min, x_max = X[0, :].min() - 1, X[0, :].max() + 1
y_min, y_max = X[1, :].min() - 1, X[1, :].max(... | true |
1db35165674d265cef6c1e252bd26022c243e782 | Python | sbrj/App-Lumiar | /menu.py | UTF-8 | 2,510 | 2.921875 | 3 | [] | no_license | from kivy.uix.screenmanager import Screen
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.image import Image
from kivy.uix.behaviors.button import ButtonBehavior
from kivy.uix.label import Label
from kivy.properties import ListProperty
from kivy.graphics import Color, Elli... | true |
3b3402ac875884dc5df9c78293f0c88d4f69a2cf | Python | huangshaoqi/programming_python | /XDL/python/Part_1/test_py/查找模块.py | UTF-8 | 360 | 3.03125 | 3 | [] | no_license | import re
import pprint
code = []
with open('source.txt') as f:
content = f.read()
patten_str = '<code class="xref">.*</code>'
m1 = re.findall(patten_str, content)
# print(m1)
patten_str1 = '>(.*)<'
for var in m1:
m2 = re.findall(patten_str1, var)
code.append(m2[0])
pprint.ppri... | true |
be2228b990b70d7330a298535387758c62db8317 | Python | Yichuans/wdpa-qa | /point.py | UTF-8 | 1,223 | 2.640625 | 3 | [] | no_license | # Load packages and modules
import sys, arcpy
from wdpa.qa import arcgis_table_to_df, find_wdpa_rows, pt_checks, INPUT_FIELDS_PT
from wdpa.export import output_errors_to_excel
# Load input
input_pt = sys.argv[1]
output_path = sys.argv[2]
# Let us welcome our guest of honour
arcpy.AddMessage('\nAll hail the WDPA\n')
... | true |
4a19b7e6fe576c3744b75d4401e8df32187a213c | Python | daviddamilola/django-api-starter | /app/community/models.py | UTF-8 | 900 | 2.59375 | 3 | [] | no_license | from django.db import models
import uuid
# Create your models here.
class Puppy(models.Model):
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
name = models.CharField(max_length=255)
age = models.IntegerField()
breed = models.CharField(max_length=255)
color = models.Ch... | true |
ea20db527ff2a662b5af973088143af3d1fcdcd3 | Python | saultorre1995/autodiff | /autodiff.py | UTF-8 | 19,527 | 3.265625 | 3 | [] | no_license | # Autodifferentiation Library
# Written by Saul Gonzalez Resines
# Mail:sgr40@bath.ac.uk
import warnings
import numpy as np
def sin(a,owner=None):
'''
Sine Function calling an inner class of the DObject that
wraps the operator into an Operator object.
The input must be a DObject or a float,integer but... | true |
ba8fd1adb20f102d67a7c517bdb15eb28567eeda | Python | hashkanna/codeforces | /ruf/yandex_algo_qual/rand.py | UTF-8 | 265 | 2.890625 | 3 | [] | no_license | a = set(map(int,input().split()))
n = int(input())
for i in range(n):
l=list(map(int,input().split()))
c=0
r="Unlucky"
for j in l:
if j in a:
c+=1
if c==3:
r="Lucky"
break
print(r)
| true |
59bc31cba2967b9a506ae6e81d2dd508ad45382f | Python | kwoneyng/beakjoon | /멀리뛰기.py | UTF-8 | 193 | 2.828125 | 3 | [] | no_license | def solution(n):
if n < 2:
return n
answer = 0
dp = [0]*n
dp[0] = 1
dp[1] = 2
for i in range(1,n-1):
dp[i+1] = dp[i-1]+ dp[i]
return dp[n-1]%1234567 | true |
7b3b3b8b61838eded4b11aac9a55e4a7ac29b269 | Python | nbardy/WordRelationship-finder | /graphBuilder.py | UTF-8 | 5,911 | 2.671875 | 3 | [] | no_license | import relationshipFinder
import sys
def __jsHeader(datastore, outputfile):
outputfile.write("""
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="highcharts.js" type="text/javascript"></script>
""")
outputfile.write("""
<scrip... | true |
eb04819e6bbb6b184da5c026f46effbbfa529a4a | Python | Aasthaengg/IBMdataset | /Python_codes/p03618/s344164292.py | UTF-8 | 559 | 2.984375 | 3 | [] | no_license | import sys
import numpy as np
input = sys.stdin.readline
def main():
s = input().strip()
count = np.zeros((len(s), ord("z") - ord("a") + 1), dtype=int)
s_ = [0] * len(s)
s_[0] = ord(s[0]) - ord("a")
count[0][s_[0]] += 1
for i in range(1, len(s)):
s_[i] = ord(s[i]) - ord("a")
co... | true |
b2e58b57332fc2afc11f9d997cb4c814b4aa21aa | Python | akonopacka/CTF-and-HTB-Writeups | /Simple_Programming/check.py | UTF-8 | 356 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
# Code for CTFLearn challenge Simple Programming
f = open("data.dat", "r")
Lines = f.readlines()
counter = 0
for line in Lines:
print(line.strip())
number_of_zeroes = line.count("0")
number_of_ones = line.count("1")
if number_of_ones % 2 == 0 or number_of_zeroes % 3 == 0:
co... | true |
1407315cc8614ec440cd4b66b72dd73d1fcf5cb2 | Python | Aasthaengg/IBMdataset | /Python_codes/p02679/s928628308.py | UTF-8 | 690 | 2.921875 | 3 | [] | no_license | from operator import itemgetter
from math import gcd
from collections import Counter
N = int(input())
mod = int(1e9+7)
zero = 0
P = {}
for i in range(N):
a,b = list(map(int, input().split()))
if a == 0 and b == 0:
zero += 1
continue
g = gcd(a,b)
a,b = a//g, b//g
if b < 0:
a,b = -a,-b
if b == 0... | true |
3cf873298996506018d752191af93c6fb13a0cad | Python | manasa-0982/circle- | /print positive number.py | UTF-8 | 222 | 3.640625 | 4 | [] | no_license | l=[]
n=int(input("Enter number of elements: "))
for i in range(1,n+1):
ele=int(input())
l.append(ele)
for i in l:
if(i!=n and i>=0):
print(i,end=",")
elif(i==n and i>=0):
print(i)
| true |
b668e39f3d0e4993ed8287d46fe7ba96fd0571f5 | Python | MarceloSerra/registerStudents | /registerStudents.py | UTF-8 | 4,436 | 3.265625 | 3 | [] | no_license | alunoContador = 0
alunoAprovado = 0
alunoReprovado = 0
alunoExame = 0
alunoMasculinoAprovado = 0;
alunoMasculinoReprovado = 0;
alunoMasculinoExame = 0;
alunoFemininoAprovado = 0;
alunoFemininoReprovado = 0;
alunoFemininoExame = 0;
#SUB-ROTINA COM RELATÓRIO FINAL A SER EXIBIDO
def relatorioAluno():
print(... | true |
a7aeb9bb0a8c06674608da23daf82c247afacd0a | Python | Jowashaha/gMock-Test-Framework-Project-Spring2020 | /cpp_gen.py | UTF-8 | 6,213 | 2.953125 | 3 | [] | no_license | class CppFile:
def __init__(self):
self.includes = []
self.namespaces = []
self.components = []
def add_include(self, include):
self.includes.append('#include <{}>\n'.format(include))
def add_namespace(self, namespace):
self.namespaces.append('using namespace {};\n'... | true |
3313937b10ac5b9f22182ec308a4a2872f02b236 | Python | niveditarufus/SMAI-Homeworks | /Kmeans/extended_kmeans.py | UTF-8 | 1,762 | 2.96875 | 3 | [] | no_license | import numpy as np
import random
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
from scipy.spatial import distance
import math
def shortest_distance(x1, y1, a, b=1):
d = abs((-a * x1 + b * y1 )) / (math.sqrt(a * a + b * b))
return d
mean1 = [1,1]
cov1 = [[2,1]... | true |
7780aec52bdd8699fcc6a5f6d593b6c959e54af2 | Python | AmirBitaraf/CodeforcesBestComments | /main.py | UTF-8 | 1,565 | 2.703125 | 3 | [] | no_license | from bs4 import BeautifulSoup as Soup
import requests
from sortedcontainers import SortedSet
import threading,sys
start = 1
end = 15000
num = 300
ss = SortedSet(key=lambda a:-a[0])
ws = SortedSet()
_threads = 7
thread = []
def check_list():
while True:
if len(ss) > num:
del(ss[num:])
if len(ws) > num:
de... | true |
153c94624945370384d8e79b84432395e6efb866 | Python | nhs04047/opencv_python_study | /P14/threshold_otsu.py | UTF-8 | 471 | 2.84375 | 3 | [] | no_license | import sys
import cv2
src = cv2.imread('image.jpg', cv2.IMREAD_GRAYSCALE)
if src is None:
print('Image load failed')
sys.exit()
# or 연산자로 OTSU 인자 입력
# 반환값 2개, 1개는 OTSU 임계값(실수형), 1개는 dst영상
# cv2.THRESH_OTSU 만 입력해도 됌
th, dst = cv2.threshold(src, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
print("otsu's thresh... | true |
eec432be5e8567773e717138fb0c003a09d3e8da | Python | AlexYangLong/SimpleSpiders | /QSBK-spider/qsbk-spider.py | UTF-8 | 3,253 | 3.015625 | 3 | [] | no_license | from user_agent import get_random_useragent
import requests
from bs4 import BeautifulSoup
class HtmlDownloader(object):
"""下载器"""
def download(self, session, url, referer=None):
print(session.cookies.get_dict())
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml... | true |
dda6f4ceacce040968033cc8404c2024957aa15e | Python | abolisetti/Project-Euler-Solutions | /ProjectEuler9.py | UTF-8 | 180 | 3.109375 | 3 | [] | no_license | #Project Euler 9
for a in range(1, 750):
for b in range(1, 750):
c=(a**2 + b**2)**0.5
if a+b+c==1000:
print(a*b*c)
break
#break
| true |
be5dbc4e864ac2ff700e990bcd45b2f54ba97ed9 | Python | satire6/Anesidora | /toontown/src/char/LocalChar.py | UTF-8 | 782 | 2.578125 | 3 | [] | no_license | """LocalChar module: contains the LocalChar class"""
import DistributedChar
from otp.avatar import LocalAvatar
from otp.chat import ChatManager
import Char
class LocalChar(DistributedChar.DistributedChar, LocalAvatar.LocalAvatar):
"""LocalChar class:"""
def __init__(self, cr):
"""
Local char ... | true |
89426f19634d7c133cb81159159bb3ba4f54f3a9 | Python | PyProProgramming/Password_manager | /src/db.py | UTF-8 | 931 | 3.125 | 3 | [
"MIT"
] | permissive | # Imports
import os
import sqlite3
# Creating the database file if not already created
if not os.path.exists("data/data.db"):
with open("data/data.db", "w") as file:
pass
# Connecting to the database
conn = sqlite3.connect("data/data.db")
# Getting the cursor object
cursor = conn.cursor()
# Creating the ... | true |
81866f1bdeb96b167537b7447a3c97dc600250c7 | Python | qqiang2006/Stock | /class_search_stock.py | UTF-8 | 3,837 | 2.75 | 3 | [] | no_license | #coding=utf8
__author__ = 'lihuixian'
import json, urllib
from urllib import urlencode
import sys
import io
import string
import sqlite3
reload(sys)
sys.setdefaultencoding("utf8")
#股票查询函数
class Stock:
def __init__(self):
self.min_pic=''
self.back_all = ''
self.appkey="×××××××××××"#appkey,可以去... | true |
b4ba39f0e29ea2fa6838bd2da2f06b9144cf304b | Python | Ace314159/AoC2020 | /Day11.py | UTF-8 | 2,713 | 3.1875 | 3 | [] | no_license | def one(state):
while True:
new_state = [line.copy() for line in state]
for y, line in enumerate(state):
for x, seat in enumerate(line):
if seat == '.':
continue
adj = []
for y_diff in range(-1, 1 + 1):
... | true |
000bfdc7ad83c7e365aa5c194183f6249b3a8836 | Python | owen-saunders/met-office-hackathon | /LAT_LON_to_Nearby_Cyclones.py | UTF-8 | 1,901 | 2.640625 | 3 | [] | no_license | import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import folium
from IPython.display import HTML, display
from itertools import cycle
from geopy.distance import great_circle
import argparse
# Get data in portions to not overload memory
# fields = {'SID', 'YEAR', 'BASIN', 'SUBBASI... | true |
33182d4b1ac794063c3b7e4d1c822cecb9f17b77 | Python | kubrakosee/python- | /Temel Veri Yapıları ve Objeler/HİPOTENÜS_BULMA.py | UTF-8 | 402 | 3.09375 | 3 | [] | no_license | """
KULLANICIDAN BİR DİK ÜÇGENİN DİK OLAN İKİ KENARINI(A,B)ALIN
VE HİPOTENÜS UZUNLUĞUNU BULMAYA ÇALIŞIN
"""
birinci_kenar=int(input("birinci kenarını giriniz:"))
ikinci_kenar=int(input("ikinci kenarı giriniz:"))
hipotonüs=(birinci... | true |
14c957ed93ea6d4ceb3e5803e167c2475db423f3 | Python | Leputa/Leetcode | /python/交换前缀.py | UTF-8 | 501 | 3.265625 | 3 | [] | no_license |
def exchange_prefix(strs, n, m):
ret = 1
list_set = [[] for _ in range(m)]
for i in range(n):
for j in range(m):
list_set[j].append(strs[i][j])
for j in range(m):
ret = (ret * len(set(list_set[j]))) % 1000000007
return ret
if __name__ == "__main__":
n, m = list(map... | true |
3071ca306cb112c0e216a9109fdeddca630921ee | Python | kwantam/GooSig | /libGooPy/rsa.py | UTF-8 | 4,091 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
#
# (C) 2018 Dan Boneh, Riad S. Wahby <rsw@cs.stanford.edu>
import hashlib
import sys
import libGooPy.primes as lprimes
import libGooPy.prng as lprng
import libGooPy.util as lutil
# RSA-OAEP enc/dec using SHA-256
# NOTE this is a non-standard implementation that you should probably not use except f... | true |
67d4839eb36e5a1d6b164da9e2cbfd28087bec59 | Python | kokoa-naverAIboostcamp/algorithm | /Algorithm/Ryan/BOJ19637.py | UTF-8 | 919 | 3.4375 | 3 | [] | no_license | # 19637번: IF문 좀 대신 써줘
# 방법 1
import sys
def boundary(a,x):
lo,hi=0,len(a)
while lo < hi:
mid=(lo+hi)//2
if x <= a[mid][0] : hi=mid
else: lo = mid +1
return lo
N,M=map(int,sys.stdin.readline().split())
style={}
for _ in range(N):
name,value=sys.stdin.readline().strip().split()
... | true |
4f7e2163d840e808276bc390476c50f558503c76 | Python | shivam-g10/PN-Sequence-based-encryption-using-Raspberry-Pi | /pn_rx.py | UTF-8 | 2,424 | 2.71875 | 3 | [
"MIT"
] | permissive | import time
import operator as op
import RPi.GPIO as GPIO
inputSignal= []
#Input helper functions
def getCode(n): #Generates code for the numbers
code = []
if(n==0):
code = [1,0,0,0,0]
elif(n==1):
code = [1,0,0,0,1]
elif(n==2):
code = [1,0,0,1,0]
elif(n==3):
code = [1,0,0,1,1]
elif(n==4):
code = [1,0,1,... | true |
ea9225b0ea3d27655dcd2827cde34ebe7d80cbc4 | Python | ericma1999/algo-coursework | /dijkstra/implementation/BFS.py | UTF-8 | 1,481 | 3.4375 | 3 | [] | no_license | class Queue():
def __init__(self):
self.queue = []
def isEmpty(self):
return self.queue == []
def enqueue(self, item):
self.queue.append(item)
def dequeue(self):
return self.queue.pop(0)
class BFS:
def __init__(self, G, s):
self.starting = s
... | true |
4047579f1ab6f9bd3d99b104fdf7553e1dc62955 | Python | canassa/falcor-python | /tests/path_syntax/test_parser.py | UTF-8 | 1,441 | 3.296875 | 3 | [] | no_license | """
Based on:
https://github.com/Netflix/falcor-path-syntax/blob/master/test/parse-tree/parser.spec.js
"""
from falcor.path_syntax import parser
def test_parse_a_simple_key_string():
out = parser('one.two.three')
assert out == ['one', 'two', 'three']
def test_parse_a_string_with_indexers():
out = pars... | true |
8194bf5980cfe16bae604972d67dfc3fe8280427 | Python | Ummamali/photonsBackend | /api.py | UTF-8 | 5,306 | 2.515625 | 3 | [] | no_license | from donorsUtils import get_updated_donors
from flask import Flask, request
from flask.json import jsonify
from utils import get_data_from_file, save_data_to_file, good_response, bad_response, pathString_to_contrObject
from flask_cors import cross_origin
from datetime import datetime, date
from time import sleep
app ... | true |
1b4a72e079526a3eb125bfef540cb562f69840e7 | Python | aadeshdhakal/python_assignment_jan5 | /Prime_read.py | UTF-8 | 56 | 2.609375 | 3 | [] | no_license | fp = open("prime.txt", "r")
print(fp.read())
fp.close()
| true |
6894bfb1d761a2048ccce33f59783ff04fffdf8a | Python | Justyouso/python_syntax | /my_decorator/class_decorator_no_param.py | UTF-8 | 799 | 3.78125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: wangchao
# @Time: 19-10-23 上午11:23
"""
不带参数的类装饰器
"""
class logger(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
print("[INFO]: {func} 正在运行...".format(func=self.func.__name__))
return self.func(*args, **kwarg... | true |
280c6defd96a32a8369d08e99f55710619b8a89a | Python | luigisaetta/model-catalogv2 | /model-files/score.py | UTF-8 | 2,865 | 2.78125 | 3 | [
"MIT"
] | permissive |
import io
import pandas as pd
import numpy as np
import json
import os
import pickle
import logging
model_name = 'model.pkl'
scaler_name = 'scaler.pkl'
"""
Inference script. This script is used for prediction by scoring server when schema is known.
"""
model = None
scaler = None
logging.basicConfig(format='%(n... | true |
2b63a0d0531e9d1b17a34ed2c3e6502a663e7b03 | Python | aenglander/python-concurrent-programming-examples | /time-api-standard-example.py | UTF-8 | 647 | 3.1875 | 3 | [
"MIT"
] | permissive | import http.client
import json
import time
def get_time(name):
client = http.client.HTTPConnection("worldtimeapi.org")
client.request("GET", "/api/ip")
http_response = client.getresponse()
if http_response.status != 200:
print(f"Error Response: {http_response.status} {http_response.reason}")
... | true |
47ab710b85d89b3febf3ec6177513161c90ab5ef | Python | BerkanR/Programacion | /Codewars/Detect Pangram.py | UTF-8 | 627 | 4.3125 | 4 | [
"Apache-2.0"
] | permissive | # A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence
# "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is
# irrelevant).
# Given a string, detect whether or not it is a pangram. Return True i... | true |
c9c75f1792cf38be19f93a651fbbbf3f9d1a7cab | Python | pieterbartsmit/realtimeassimilation | /coops.py | UTF-8 | 2,836 | 2.640625 | 3 | [] | no_license | #
# Python package to retrieve data from coops
# API documented at https://tidesandcurrents.noaa.gov/api/
#
import code
import numpy as np
def getTideData( epochtime, station='',workingdirectory='./'):
#
import time
begin_date = time.strftime("%Y%m%d" , time.gmtime(epochtime) )
end_date = begin_dat... | true |
3532e0e251aa2c6513b1cdd8274284178b34bd65 | Python | Sharayu1071/Daily-Coding-DS-ALGO-Practice | /Hackerank/Python/Weighted Mean.py | UTF-8 | 249 | 2.78125 | 3 | [
"MIT"
] | permissive | # Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
arr = list(map(int, input().split()))
weights = list(map(int, input().split()))
print(round(sum([arr[x]*weights[x] for x in range(len(arr))]) / sum(weights), 1))
| true |
122f144dc8d6b32c16ee23f8d961ad38547d1208 | Python | GXIU/data-driven-pdes | /datadrivenpdes/core/equations.py | UTF-8 | 12,301 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | true |
b74ed96fba5269c1c5be9626e7cb96074710d110 | Python | MaratAG/HackerRankPy | /HR_PY_Sets_4.py | UTF-8 | 438 | 3.84375 | 4 | [] | no_license | """HackerRank Sets 4 Set.add()"""
def problem_solution(N):
# Task function
country = 0
countries = set()
while not country == N:
country += 1
countries.add(input())
return len(countries)
def main():
# Initialization
N = 0
min_n = 0
max_n = 1000
while not N > ... | true |
7cbbd0683121854f33a5410a5726615417431758 | Python | cliffporter/lunarknights.github.io | /watch.py | UTF-8 | 878 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
'''
Watch a file for updates and run a callback.
Author: Sachin
Date created: 10/02/2021
'''
from os import stat
from sys import argv
from time import sleep
from compile import note
def watch(file, callback, wait=.5):
'''
Run a callback every time a file is modified.
:param file: ... | true |
a5b1f962f5c15470f746e6300637dd60821b5923 | Python | ArcKnight01/bwsix | /navigation_block/6_simulating_sensors/1_testing_the_laser/BWSI_BuoyField.py | UTF-8 | 9,584 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 4 12:39:28 2021
@author: JO20993
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import utm
## Utility functions
def corridor_check(A, G, R):
GR = np.array((R[0]-G[0], R[1]-G[1]))
GA = np.array((A[0]-G[0], A[1]-G[1]))
RA = np.array((A[0]... | true |
a5ec3bd43cede3be63b3861927525ecfe0537fb1 | Python | ikalista/Stock-Data-Analysis | /tushare_test.py | UTF-8 | 4,961 | 2.53125 | 3 | [] | no_license | #coding=utf-8
import tushare as ts
import talib as ta
import numpy as np
import pandas as pd
import os,time,sys,re,datetime
import csv
import scipy
# 两个函数
# 1、get_stock_basics(),这里得到是对应的dataframe数据结构,code,代码 name,名称 industry,所属行业 area,地区 pe,市盈率
# outstanding,流通股本 totals,总股本(万) totalAssets,总资产(万)liquidAsse... | true |
04266d69d0c9c5fab3a50e8f57b11d4490b895a0 | Python | Grrrigori/pythonProjectFiles | /try.py | UTF-8 | 1,975 | 3.0625 | 3 | [] | no_license | punctuation = "?,.!"
# with open('files/Descartes.txt', 'r', encoding='ANSI') as file:
# file_content = file.read()
# print(len(file_content))
# # print(set(file_content))
# print(len(set(file_content)))
# # file_ammount = [line.split(',')for line in file_content]
# # print (file_ammount)
# t... | true |
def74606056fac0e604682a48965d80844320517 | Python | AnMora/Master-Python-exercise | /exercises/12-Last_two_digits/app.py | UTF-8 | 331 | 4.5625 | 5 | [] | no_license | #Complete the function to print the last two digits of an interger greater than 9.
def last_two_digits(num):
numero = int(num)
if numero > 9:
return int(str(numero)[-2:])
else:
print("Ingrese un numero mayor a 9")
#Invoke the function with any interger greater than 9.
print(last_two_digit... | true |
1fa502ddd94b47ce4018ac95b211c4a3f7d37001 | Python | IgorBavand/CODIGOS-URI | /Python/falta gravar/1113.py | UTF-8 | 187 | 4 | 4 | [] | no_license | x=0
y=1
while x!=y:
x,y=input().split()
x=int(x)
y=int(y)
if x==y:
break
if x>y:
print("Decrescente")
if x<y:
print("Crescente") | true |
15728437ab4bbe702b1a35a40c337a97560e5489 | Python | ahoetker/pinch-analysis | /tests/test_intake.py | UTF-8 | 1,738 | 2.703125 | 3 | [
"MIT"
] | permissive | import pytest
import pkg_resources
import numpy as np
import pandas as pd
from pathlib import Path
from pinch import ureg, Q_
from pinch.intake import parse_column_units, attach_units, df_with_units
resources = Path(pkg_resources.resource_filename("tests", "resources"))
def test_parse_column_units():
csv = Path(... | true |
35918583c74b412840ad2b687fecc74c1e139738 | Python | vikrantpotnis123/DS | /samples/sk1.py | UTF-8 | 1,310 | 2.90625 | 3 | [] | no_license |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn import svm
from sklearn import datasets
from sklearn.metrics import confusion_mat... | true |
26268795dee033b7f174b9e58949c23da32e6ba4 | Python | kreativitea/Rosalind | /solutions/revc.py | UTF-8 | 363 | 3.6875 | 4 | [] | no_license | from string import translate, maketrans
def revc(dnastring):
''' The Secondary and Tertiary Structures of DNA
Given: A DNA string s of length at most 1000 bp.
Return: The reverse complement sc of s.
>>> revc("AAAACCCGGT")
'ACCGGGTTTT'
'''
translation = maketrans("ATCG", "TAGC")
retu... | true |
c10357ad1d0b91d7a554757e40b3d7d9a4a158fa | Python | sgiardl/LeafClassification | /data/DataHandler.py | UTF-8 | 8,908 | 3.515625 | 4 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import LabelEncoder
class DataHandler:
"""
CLASS NAME:
DataHandler
DESCRIPTION:
This class is used to read the input database and manage
the data, which then ca... | true |
d79a9c059871cb9605be8403bec64ddb310ecc93 | Python | pfuntner/toys | /bin/files-by-date-range | UTF-8 | 1,828 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python3
import os
import re
import signal
import logging
import datetime
import argparse
def decode_date(s):
ret = None
if s is not None:
if re.match(r'^\d{4}-\d{2}-\d{2}$', s):
ret = datetime.datetime.strptime(s, '%Y-%m-%d')
elif re.match(r'^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$', s)... | true |
8d4d7bb6761cebbe9f9932bfa50906f86762f7e6 | Python | d9yuan/stock_pattern | /src/stocks/utils.py | UTF-8 | 4,465 | 2.53125 | 3 | [] | no_license | import pandas as pd
import yfinance as yf
import numpy as np
import operator
import io
import math
import urllib, base64
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('agg')
import matplotlib.dates as mdates
from datetime import date, time, datetime, timedelta
from .models import Stock, DetailPage, ... | true |
b39a0fb7dc3eeee57b7637e39f072a2ced024508 | Python | nancyvuong/DocumentGenerator | /main.py | UTF-8 | 370 | 3.078125 | 3 | [] | no_license | from DocumentGenerator import *
if __name__ == '__main__':
fp = input("Enter filename: ")
dc = DocumentGenerator(fp)
while dc == None:
fp = input("Enter another filename: ")
dc = DocumentGenerator(fp)
file1 = open("generated.txt", "w")
wc = int(input("Enter word count: "))
file1... | true |
8c739768d8248e0f344b32656bdb01a935db51aa | Python | shivakrishnap/gitdemo | /Testdata/Hompagedata.py | UTF-8 | 808 | 2.84375 | 3 | [] | no_license | import openpyxl
class Hompagedata:
test_homepage_data = [{"firstname": "shiva", "email": "shivakrishna@gmail.com", "gender": "Male"},{"firstname": "sathya", "email": "sathyakrishna@gmail.com", "gender": "Female"}]
@staticmethod
def getstdata(test_case_name):
Dict = {}
book = openpyxl.load... | true |
ade2fe17b92142a7e5ec6ba56b2baec0fba62560 | Python | hbtech-ai/ARPS | /tmsvm/src/example.py | UTF-8 | 3,734 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#_*_ coding: utf-8 _*_
#author:张知临 zhzhl202@163.com
#Filename: example.py
import tms
'''采用程序默认参数对模型训练、预测、结果分析'''
#模型训练,输入的文件为binary_seged.train,需要训练的为文件中的第1个字段(第0个字段为lablel),保存在data文件夹中。特征选择保留top %10的词,使用liblinear
#tms.tms_train("../data/binary_seged.train")
#模型预测,
#tms.tms_predict("../data... | true |
4916af2abeae90699f99a8bc8541e8b194404562 | Python | wenxinjie/leetcode | /bit manipulation/python/leetcode190_Reverse_Bits.py | UTF-8 | 731 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive | # Reverse bits of a given 32 bits unsigned integer.
# Example:
# Input: 43261596
# Output: 964176192
# Explanation: 43261596 represented in binary as 00000010100101000001111010011100,
# return 964176192 represented in binary as 00111001011110000010100101000000.
class Solution:
# @param n, an integ... | true |
7a56d14e8fb8743756ce3fdadd342f6c709e890e | Python | prasannamondhe/Python | /Practice/FileOperations.py | UTF-8 | 999 | 3.265625 | 3 | [] | no_license | import os
#Way to specify path in python
#print(os.path.join('home','prasanna','PythonRepo','Python','Game'))
#Open CSV file => remove comma => write data into another CSV file
with open('Practice/insurance.csv') as infile, open('Practice/insuranceWithoutComma.csv','w') as outfile:
for line in infile:
outf... | true |
b4f095b0dcb08dc7e52fe0d5d11b4c31a1dfdafc | Python | eicksl/PAC-Free-Searcher | /pacfree_searcher/campaignsite.py | UTF-8 | 1,445 | 2.96875 | 3 | [] | no_license | import requests
from requests.exceptions import ConnectionError
from bs4 import BeautifulSoup
from pacfree_searcher.constants import FACEBOOK, TWITTER
from pacfree_searcher.dbmanager import DBManager
class CampaignSiteParser():
"""Handles the details of parsing through a candidate's campaign website
to obtain... | true |
80e5afa56408b64d93c512222faa18d148c7256d | Python | lucashsouza/Desafios-Python | /CursoEmVideo/Aula09/ex022.py | UTF-8 | 316 | 4.40625 | 4 | [
"MIT"
] | permissive | nome = (input('Digite seu nome completo: ')).strip()
print('Analisando seu nome..')
print('Em maiusculas: {}'.format(nome.upper()))
print('Em minusculas: {}'.format(nome.lower()))
print('Que possui {} letras'.format(len(nome) - nome.count(' ')))
print('E seu primeiro nome tem {} letras'.format(nome.find(' '))) | true |
4f8dfa4d015950c9739aff61b3e10d1ac21fce83 | Python | T0aD/pyawstats | /lock.py | UTF-8 | 2,071 | 3.046875 | 3 | [] | no_license | #! /usr/bin/python3.1
# This module merely creates a lock file in order to lock the execution of a python script
# (avoids running twice the same script at the same time..)
import os.path
import sys
"""
=========================== Usage:
import lock
with lock.Lock(__file__):
main program
=========================... | true |
461eb81b21fc3070862531b7a122ea7c913fa73b | Python | carleton-cs257-spring18/books-alejandro-isaac | /books/booksdatasourcetest.py | UTF-8 | 4,169 | 3.0625 | 3 | [] | no_license |
import booksdatasource
import unittest
class BooksDataSourceTest(unittest.TestCase):
def setUp(self):
self.books_data_source = booksdatasource.BooksDataSource('books.csv', 'authors.csv', 'books_authors.csv')
pass
def tearDown(self):
pass
def test_return_correct_book(self):
... | true |
6a02ce4142a950d84c7830318e7e11f3f72b5c35 | Python | atsss/nyu_deep_learning | /examples/contests/205/D.py | UTF-8 | 1,284 | 2.59375 | 3 | [] | no_license | # from collections import Counter
#
# N, Q = map(int, input().split())
# A = list(map(int, input().split()))
# K = [int(input()) for _ in range(Q)]
#
# st = set(K)
# col = Counter(A)
# col_index = 1
# k_index = 0
# length = 0
# ans = {}
#
# while True:
# if col[col_index] == 0:
# k_index += 1
#
# if... | true |
e1f7546cb66a39f4cfdd8f58e1dbd9965cca15f7 | Python | AlexSath/Fastq_Pipeline | /Archive/parseFastq.py | UTF-8 | 3,937 | 3.578125 | 4 | [] | no_license | import argparse
#Example use is
# python parseFastq.py --fastq /home/rbif/week6/hawkins_pooled_sequences.fastq
################################################
# You can use this code and put it in your own script
class ParseFastQ(object):
"""Returns a read-by-read fastQ parser analogous to file.readline()"""
... | true |
76f0026086f6695cd09221ab8f08527c7d9ac3d7 | Python | Rajahx366/Codewars_challenges | /6kyu_Constant_value.py | UTF-8 | 1,094 | 4.28125 | 4 | [] | no_license | """
Given a lowercase string that has alphabetic characters only and no spaces, return the highest value of consonant substrings. Consonants are any letters of the alphabet except "aeiou".
We shall assign the following values: a = 1, b = 2, c = 3, .... z = 26.
For example, for the word "zodiacs", let's cross out the ... | true |
8e5be679ba3661d1faccce1bccff70c55c4a1455 | Python | gmagannaDevelop/MorphoImg | /hit_or_miss.py | UTF-8 | 1,406 | 2.953125 | 3 | [
"MIT"
] | permissive | """
Example taken from the docs :
https://docs.opencv.org/master/db/d06/tutorial_hitOrMiss.html
"""
import cv2 as cv
import numpy as np
def main():
input_image = np.array((
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 255, 255, 255, 0, 0, 0, 255],
[0, 255, 255, 255, 0, 0, 0, 0],
[0, 255, ... | true |
76c87d1fbe0cf0ace370bbefb48ac7374a1add68 | Python | udayt-7/Data-Structures-Python | /Linked_Lists/p6.py | UTF-8 | 758 | 3.9375 | 4 | [] | no_license | #6. Create two separate single lists. Check two list are same.
##If the two lists have the same number of elements in the same order, then they are treated as same.
import link1
l1 = link1.Llist()
l2 = link1.Llist()
l1.addfirst(1)
l1.addfirst(11)
l1.addlast(33)
l1.addlast(43)
l1.addlast(53)
l1.addlast(63)
print("... | true |
72b6902a63e5ea18efc88caa68cd3631af0addae | Python | ComiteMexicanoDeInformatica/OMI-Archive | /2022/OMIPS-presencial/OMIPS-2022-mundo-espejo/validator.py3 | UTF-8 | 1,813 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import libkarel
def valida(mundo, salida) -> int:
ancho = mundo.w + 1
mitad = ancho // 2
cambios = 0
minimo = 0
total = 0
# Valida primero que el mundo de salida este correctamente reflejado
for fil in range(1, mundo.h + 1):
... | true |
3e6fa1998a890be1da61eb0798254226305028b3 | Python | msvilaite/Naive-Bayes | /pre-process.py | UTF-8 | 3,697 | 3.328125 | 3 | [] | no_license | import string
import os
import json
givenVocabulary = {}
trainDict = {}
testList = []
# This function reads all the files in a given directory that contains movie reviews
# Then the reviews are cleaned up ("<br /><br />" symbols removed, some punctuation removed, ? and ! separated)
# Everything is lowercased
# And ... | true |
9041cfe61e8df0f08d57c32fb169c5c8c4c71793 | Python | ccmoradia/fastbt | /utils.py | UTF-8 | 1,544 | 3 | 3 | [] | no_license | import pandas as pd
import itertools
def multi_args(function, constants, variables, isProduct=None):
"""
Run a function on different parameters and
aggregate results
function
function to be parametrized
constants
arguments that would remain constant
throughtout all the scena... | true |
d80dedec7a371396b045fa289bd267ed07a59729 | Python | vaibhavyesalwad/Basic-Python-and-Data-Structure | /Logical Programs/FindNumsForSum.py | UTF-8 | 344 | 4.0625 | 4 | [] | no_license | """Find pairs of numbers adding to given sum"""
arr = [10, 20, 25, 30, 40, 50, 60]
print(arr)
summation = int(input('Enter sum to find numbers:'))
for i in range(len(arr)-1): # this block find combinations of 2 terms
for j in range(i+1, len(arr)):
if arr[i]+arr[j] == summation:
... | true |
e24c750f0e885c968f7b1d36bc636cbbae54d705 | Python | muzaferxp/PythonProgramming | /Day8/app.py | UTF-8 | 461 | 3.203125 | 3 | [] | no_license |
#method 1 #it imports every thing from the module
'''
import sample_module
print(sample_module.state)
print(sample_module.name)
num = sample_module.mult(10,5)
print(num)
'''
#method 2
'''
#from sample_module import mult,sub
from sample_module import *
num = mult(5,6)
print(num)
print(sub(5,4))
print(a... | true |
9461d901f79e28fe9ead42f882824a1fdb3f80d6 | Python | rohanpahwa1/hacker_rank_solutions | /library_fine.py | UTF-8 | 278 | 3.140625 | 3 | [] | no_license | d1,m1,y1=map(int,input().split()) #returning date
d2,m2,y2=map(int,input().split()) #book to be returned so tht fine is not paid
fine=0
if d1>d2 and m1==m2 and y1==y2:
fine=(d1-d2)*15
elif m1>m2 and y1==y2:
fine=(m1-m2)*500
elif y1>y2:
fine=(y1-y2)*10000
print(fine) | true |
cb40a8796587e4f9579f87ad792801bbbb28e7dc | Python | user01/dask-spark-experiment | /nnpair_nump.py | UTF-8 | 32,454 | 2.703125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import json
from numba import jit
# #############################################################################
# Heavily modified from: https://github.com/fhirschmann/rdp
# Copyright (c) 2014 Fabian Hirschmann <fabian@hirschmann.email>
#
# Permission is hereby granted, free ... | true |