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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a8b9f12d7cde8f785e8214a9795bb0127bae727a | Python | irusland/ml2021 | /05-DTandRF/Solutions/Task4.py | UTF-8 | 3,994 | 2.890625 | 3 | [] | no_license | from sklearn.base import BaseEstimator, ClassifierMixin
def calculate_probability(y: np.ndarray):
probs = np.array([])
_, unique_counts = np.unique(y, return_counts=True)
for count in unique_counts:
probs = np.append(probs, count / len(y))
return probs
def _entropy(y: np.ndarray) ... | true |
706a36d6fca72801918eb4922baa4861e4dbf8b8 | Python | walter090/toxic_comments | /model/rnn.py | UTF-8 | 7,369 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
import structure
from structure import property_wrap
from .model import Model
class ToxicityLSTM(Model):
def __init__(self, csvs=None, batch_size=None,
num_epochs=None, vocab_size=None, embedding_size=None,
num_labels=None, comment_length=None, testing=Fa... | true |
dfdb0f53aee8034640cd26690d938342884cf145 | Python | muhammadfaiz12/sholaccati-be | /bpk.py | UTF-8 | 5,335 | 2.6875 | 3 | [] | no_license | import PyPDF2
import re
import csv
import nltk
from nltk.tag import CRFTagger
import pycrfsuite
# from trainer import sent2features
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
from difflib import SequenceMatcher
# create stemmer
factory = StemmerFactory()
stemmer = factory.create_stemmer()
ct = CRFTagg... | true |
c558dd3d2f429b74365ff9b588c08b1328d36881 | Python | mezzan/PythonCowObfuscator | /example/esempio2.py | UTF-8 | 490 | 3.5 | 4 | [] | no_license | import sys
def armstrong_number(num):
s = 0
temp = num
while temp > 0:
digit = temp % 10
s += digit ** 3
temp //= 10
if num == s:
return True
else:
return False
def main(argv):
if len(argv) == 0:
n_to_check = 153
else:
n_to_check = int(ar... | true |
4c4cbb29137f52fec1ee2014b5f31d3c0313a754 | Python | ronvree/easy21RL | /version2/easy21.py | UTF-8 | 5,768 | 3.765625 | 4 | [] | no_license | import random
from version2.core import State, DiscreteActionEnvironment
"""
Easy21 environment implementation
"""
class Easy21State(State):
"""
Easy21 game state
"""
def __init__(self, p_sum, d_sum):
"""
Create a new Easy21 state
:param p_sum: The initial player sco... | true |
aa6c87875d0641ec3246dc6bd2f6d190d1db9975 | Python | baccano0/digital_image_processing | /Chapter03/3.4 空间滤波器/Laplacian.py | UTF-8 | 414 | 2.59375 | 3 | [] | no_license | """
Created by HenryMa on 2020/8/26
"""
__author__ = 'HenryMa'
import cv2
import numpy as np
if __name__ == '__main__':
img = cv2.imread('../pic/Fig0304(a)(breast_digital_Xray).tif')
gray_lap = cv2.Laplacian(img, cv2.CV_16S, ksize=3)
dst = cv2.convertScaleAbs(gray_lap) # 转回uint8
cv2.imshow('orig... | true |
42f67d73fc85c4659138e29790d765d0c7d5f7f2 | Python | Grukz/OSINT | /harvesting/filters.py | UTF-8 | 1,663 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 12 17:40:53 2013
@author: slarinier
"""
class Filters(object):
def __init__(self,pathextention='harvesting/filtered_extensions',pathscheme='harvesting/filtered_schemes',pathdomain='harvesting/filtered_domains'):
self.pathdomain=pathdomain
self.pathsche... | true |
616bfa247d9438b7763e5491554495a8e7fff6f1 | Python | TonyNewbie/CoffeeMachine | /Problems/Students/task.py | UTF-8 | 358 | 3.46875 | 3 | [] | no_license | class Student:
def __init__(self, name, last_name, birth_year):
self.name = name
self.last_name = last_name
self.birth_year = birth_year
self.id = self.name[0] + self.last_name + self.birth_year
student_name = input()
student_last_name = input()
year = input()
print(Student(studen... | true |
2867bd98ec7b5523753e3497a51255f069593555 | Python | raadbintareaf/CSCI544-MBTI-tagger | /twitter-crawler/bing_translate.py | UTF-8 | 1,353 | 2.78125 | 3 | [] | no_license | import websocket
import thread
import json
import requests
import urllib
import wave
import audioop
from time import sleep
import StringIO
import struct
import sys
import codecs
from xml.etree import ElementTree
def get_oauth_token(): #Get the access token from ADM, token is good for 10 minutes
urlArgs = {
... | true |
08d294b4dad4962f977f8ab574f0f058eb2bb89e | Python | jfaucher00/phys_512 | /problem_sets/ps5/phys 512 ps5 problem4.py | UTF-8 | 1,428 | 3.421875 | 3 | [] | no_license | """
Jules Faucher
260926201
Phys 512
October 29th, 2021
"""
import numpy as np
import matplotlib.pyplot as plt
def conv_safe(f, g):
lf = len(f)
lg = len(g)
add_f = max(lf, lg*2-lf)
add_g = max(lf*2 -lg, lg)
f_extra = np.append(f, np.zeros(add_f))
g_extra = np.append(g, np.zeros... | true |
da1db0e95ea02c0636647891ca537155bdcb6d28 | Python | bonicim/technical_interviews_exposed | /src/algorithms/blind_curated_75_leetcode_questions/longest_palindromic_substring.py | UTF-8 | 6,608 | 4.34375 | 4 | [] | no_license | """
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: "cbbd"
Output: "bb"
"""
"""Commentary
The naive solution is the check... | true |
5d04249f5478466f47a4c2ff028ad0fbc39d3473 | Python | leelabcnbc/pytorch-caffe-models | /download_all_models.py | UTF-8 | 1,088 | 2.53125 | 3 | [] | no_license | """script to predownload all the caffe models
since this is not an industry-grade stuff, I just make this as simple as possible: you need to download first.
the downloading will be extremely simple: use curl
"""
# this is to load all the models
import os
from subprocess import run
from torch_caffe_models import cac... | true |
1bcede79f3cf143f12089e1b6987aea4be497fc2 | Python | Aiyane/aiyane-LeetCode | /1-50/搜索旋转排序数组.py | UTF-8 | 1,556 | 4.1875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 搜索旋转排序数组.py
"""
假设按照升序排序的数组在预先未知的某个点上进行了旋转。
( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。
搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 -1 。
你可以假设数组中不存在重复的元素。
你的算法时间复杂度必须是 O(log n) 级别。
示例 1:
输入: nums = [4,5,6,7,0,1,2], target = 0
输出: 4
示例 2:
输入: nums = [4,5,6,7,0,1,2], ta... | true |
6beaf354f971dd29b934c72c7a4242f2c02d320b | Python | X-DataInitiative/tick | /tick/solver/base/first_order_sto.py | UTF-8 | 10,008 | 2.84375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # License: BSD 3 clause
import numpy as np
from abc import ABC, abstractmethod
from tick.base_model import Model
from tick.prox.base import Prox
from . import SolverFirstOrder, SolverSto
from .utils import relative_distance
__author__ = 'stephanegaiffas'
# TODO: property for step that sets it in the C++
class Sol... | true |
58628f7ea8701a6c1db0392c8b33921c6ef8de61 | Python | Hudko23/zadanie-poit | /test.py | UTF-8 | 133 | 2.96875 | 3 | [] | no_license | import serial
ser=serial.Serial("/dev/ttyUSB0",9600)
ser.baudrate=9600
while True:
read_ser=ser.readline()
print(read_ser)
| true |
49cff0a36dd6e3c99447bb06493357bcea92e095 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_137/508.py | UTF-8 | 2,466 | 2.640625 | 3 | [] | no_license | problem = 'C'
attemptN = 2
size = 'small'
if size == 'small':
filename = '%s-%s-attempt%d' % (problem, size, attemptN)
else:
filename = '%s-%s' % (problem, size)
# todo: unroll loop
def wouldAdd(grid, r, c):
rMin = max(0, r-1)
rMax = min(len(grid), r+2)
cMin = max(0, c-1)
... | true |
9ef4a9a8e9d27b90a0fe33a5d73f1667bdcb65ef | Python | wonpyo/Python | /DataVisualization/Chart.py | UTF-8 | 3,662 | 4.25 | 4 | [] | no_license | """
Data Visualization is the presentation of data in graphical format. It helps people understand the significance of data
by summarizing and presenting huge amount of data in a simple and easy-to-understand format and helps communicate information clearly and effectively.
"""
# Import pandas and matplotlib librarie... | true |
957a18c92a58a1ae381facad791b1e7c7ae20a57 | Python | Pandinosaurus/ensae_teaching_cs | /src/ensae_teaching_cs/homeblog/latex2html.py | UTF-8 | 2,579 | 2.875 | 3 | [
"MIT"
] | permissive | """
@file
@brief Convert a short latex script into an image
"""
import os
import shutil
import sys
from PIL import Image
from pyquickhelper.loghelper import run_cmd
def convert_short_latex_into_png(latex, temp_folder=".", fLOG=print,
miktex=r"C:\Program Files\MiKTeX 2.9\miktex\bin\x64... | true |
bb0bf8c0d36d110bb38978f818bcfc7a2264e7ad | Python | AdrienMereghetti/new | /snapcop2_adrien/modules/affichage.py | UTF-8 | 3,102 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import piggyphoto
import pygame
import pygame.locals
import redis
import shutil
import sys
import time
from wand.image import Image
cx = redis.Redis()
pubsub = cx.pubsub()
pubsub.subscribe(['capture', 'stacking', 'exit'])
pygame.display.init()
capture_on = False... | true |
c3dfb6465b592dbaea4501cc7aff0003e100b544 | Python | ennau/python_study | /phonebook_db/controller.py | UTF-8 | 593 | 3.0625 | 3 | [] | no_license | from module1 import create, update, delete, read, show, quit
flag = ''
# Main logic
while flag != 'exit':
iselect = str(raw_input("C=Create, R=Read, U=Update, D=Delete, S=Show, exit=exit\n"))
if iselect == 'R':
read()
elif iselect == 'C':
create()
elif iselect == 'U':
update()... | true |
648170b8e388e59b951cb98148ca3ae80b5895cd | Python | nishank-jain/profile | /migrations/amenities-slugs.py | UTF-8 | 551 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | from pymongo import MongoClient
client = MongoClient('localhost', 27017)
root = client.root
print("Connected to db")
dbQuery1 = root.grounds.find({})
grounds = list(dbQuery1)
for ground in grounds:
ground_amenities = ground['amenities'].split(',')
amenities = []
for amenity in ground_amenities:
new_amenity = ... | true |
92c1442ef4412e01b4b761560535175635795508 | Python | oleksandr17/grokking-algorithms | /chapter_6/breadth_first_search.py | UTF-8 | 1,479 | 3.546875 | 4 | [] | no_license | from collections import deque
class Node:
def __init__(self, alias, isDeveloper = False, neighbours = None):
self.alias = alias
self.isDeveloper = isDeveloper
if not neighbours:
self.neighbours = []
def addNeighbours(self, neighbours):
self.neighbours += neighbour... | true |
07f19ff0e57fd75b5b680f894e5e4f8bad006e8d | Python | huzhenhong/PytorchPractice | /02-SoftMax/softmax_manual.py | UTF-8 | 6,011 | 2.8125 | 3 | [] | no_license | # !usr/bin/python
# -*_ coding:utf-8 -*-
"""A softmax implement by hands"""
__author__ = "huluwa-2020-04-12"
import sys
import torch
import torchvision
import numpy as np
import matplotlib.pyplot as plt
def create_dataset_iter(batch_size):
"""
创建数据集迭代器
:param batch_size:
:return:
"""
# ToTe... | true |
abf1856692b91ef4000be1dfe4f3ae38e2efd858 | Python | stormich/advent-of-code | /2020/day-1.py | UTF-8 | 1,855 | 3.875 | 4 | [] | no_license | # Day-1: expense report
# Get input from file and add it to array
def getReportList(file):
with open(file) as f:
reportList = f.readlines()
#strip '\n' and convert to int
reportList = [int(x.strip()) for x in reportList]
return reportList
# Day-1_Puzzle-1 Find the two entries that sum to 20... | true |
13395d794b6842779e9f9695e05295f6d0bfb676 | Python | sreedharkr/scikit-basics | /iris_logistic.py | UTF-8 | 8,874 | 2.796875 | 3 | [] | no_license | import sklearn as sk
from sklearn import datasets,metrics,model_selection, cluster
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LogisticRegressionCV
from sklearn.metrics import confusion_matrix
import pandas as pd
import numpy as np
from ggplot import *
def logistic1():
iris... | true |
1a6dc3ed6159fcd0457b74b1a9758cbaf0e80e89 | Python | afferraza/python-practice-tasks | /Task12.py | UTF-8 | 340 | 3.203125 | 3 | [] | no_license | """
Write a Python program to find urls in a string and output all urls as list.
"""
import re
pattern = re.compile("https*://[\w.@_!#$%^&*()<>?/\|}{~:\w]*\S")
sample_data = "My Profile: https://auth.geeksforgeeks.org/user/Chinmoy%20Lenka/articles in the portal of http://www.geeksforgeeks.org"
print(re.findall(patt... | true |
5e07469be086c47fa9aa931fb5da0940ef3231fc | Python | punkpham/Test | /project/Distance meansure/notice.py | UTF-8 | 747 | 2.609375 | 3 | [] | no_license | import cv2
import time
img = cv2.imread("box.jpg")
imgcopy = img.copy()
img = cv2.resize(img,(400,400))
imgcopy = cv2.resize(imgcopy,(400,400))
x = 450
axesx = 40
axesy = 40
count = 4
counttime = 400
cap = cv2.VideoCapture(0)
while count >= 0:
ret, frame = cap.read()
frame = cv2.resize(frame,(400,400))
... | true |
6687b22804dee00b0e043cf59c077bb0583db501 | Python | arianepaola/tg2jython | /webhelpers/unfinished/config.py | UTF-8 | 3,288 | 3.03125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | """Helpers for configuration files."""
class ConfigurationError(Exception):
pass
def validate_config(config, validator, filename=None):
"""Validate an application's configuration.
``config``
A dict-like object containing configuration values.
``validator``
A FormEncode `Schema``. A... | true |
cd4c544ead5c5c4b30ee4a286462891766b58d90 | Python | nicosalaz/pythonProject | /ElcPro/Parcial Rosas/Punto 1.py | UTF-8 | 508 | 3.25 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def leerArchivo():
datos = pd.read_csv("gb_consumption.csv")
x = np.array(datos.get('Avg players'))
y = np.array(datos.get('Gb consumption'))
return x,y
#def valores():
conservador = float(input("Ingrese un valor conservador: "))
r... | true |
676d694a5506b6c16d867e48453e2ca5d9cb1771 | Python | hank960625/python20210202 | /2-8.py | UTF-8 | 204 | 3.671875 | 4 | [] | no_license | import turtle
tu=turtle.Turtle()
def square(l,s):
for i in range(s):
tu.forward(l)
tu.left(90)
l=10
s = int(input("input side"))
for a in range(s):
square(l,s)
l=l+10 | true |
e1ea64070227c901e635054b726bc647283dab1f | Python | wapor/euler | /57_square_root_convergents.py | UTF-8 | 881 | 4.4375 | 4 | [] | no_license | #!/usr/bin/python
# It is possible to show that the square root of two can be expressed as an
# infinite continued fraction.
# sqrt(2) = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
# By expanding this for the first four iterations, we get:
# 1 + 1/2 = 3/2 = 1.5 1 + 1/(2 + 1/2) = 7/5 = 1.4 1 + 1/(2 + 1/(2 + 1/2))... | true |
3dc321f4ae353515fffdb9f4b4d1e5038163c58c | Python | wdhg/project-euler | /python/question_027.py | UTF-8 | 525 | 3.8125 | 4 | [] | no_license | def is_prime(x):
x = abs(x)
if x == 0 or x == 1:
return True
for i in range(2, int(x ** 0.5) + 1):
if x % i == 0:
return False
return True
highest_n = 0
best_a = 0
best_b = 0
for a in range(-1000, 1000):
print(a, end='\r')
for b in range(-1001, 1001):
n = 0
... | true |
f06d0266e740007a22287b6f2a8ac2e47aa9b561 | Python | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | /students/AndyKwok/lesson07/mailroom/main_mailroom_db.py | UTF-8 | 2,747 | 3.03125 | 3 | [] | no_license | import mailroom_gen_db as prog
import list_mailroom_db as tool
adddonor = [
('Harry', 'ID_1'),
('Andy', 'ID_2'),
('Kristen', 'ID_3'),
('P Four', 'ID_4')
]
donations = [
(10, 1, 'ID_1'),
(112.00, 2, 'ID_3'),
(2.4, 3, 'ID_2'),
(2.30, 4, 'ID_1'),
(0, 5, 'ID_4'... | true |
6bedd964b274ce1a0b438ae36c94cb77629b5aed | Python | hassanshamim/adventofcode | /advent2017/day15.py | UTF-8 | 1,788 | 2.921875 | 3 | [] | no_license | from common import puzzle_input
from itertools import islice
def gen_maker(seed, factor):
val = seed
while True:
val = (val * factor) % 2147483647
yield val
def bottom_bin(val):
return bin(val)[-16:]
# def test():
# a = gen_maker(65, 16807)
# b = gen_maker(8921, 48271)
# re... | true |
03e5b1132dacfabd61af8df41c05c9deaf14d0ca | Python | aratijadhav/Python | /char_freq_21.py | UTF-8 | 509 | 3.296875 | 3 | [] | no_license | def Count(Str,String):
c = 0
for val in String:
if val == Str :
c+=1
return c
def Char_Freq(String):
dict = {}
for Ele in String:
dict.update({Ele:Count(Ele,String)})
print dict
def myfunc(str):
dict1 = {}
for i in str:
try:
dict1... | true |
0470177537ea068e6c176adbe20ba7813e11df2b | Python | sathyanarayanrao/gimli | /python/pygimli/testing/test_ERTManager_simulate.py | UTF-8 | 1,537 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | # *-* coding: utf-8 *-*
# test some characteristics of ERTManager.simulate:
# 1) for complex conductivity models the response should not depend on the sign
# of the K-factor
import pybert as pb
# import pygimli as pg
import pygimli.meshtools as mt
import numpy as np
world = mt.createWorld(
start=[-50, 0], end=[... | true |
62b0a0e12fd225cf616bf44b9488ac1fd9e34979 | Python | stephen-weber/Project_Euler | /Python/Problem0125_Palindromic_sums.py | UTF-8 | 1,001 | 3.890625 | 4 | [] | no_license | """Palindromic sums
Problem 125
The palindromic number 595 is interesting because it can be written as the sum of consecutive squares: 62 + 72 + 82 + 92 + 102 + 112 + 122.
There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is 4164. N... | true |
3ae7b4919303e083caf584facaa64effbe84ce2b | Python | j9263178/SC | /project/javla.py | UTF-8 | 2,396 | 3 | 3 | [] | no_license | import cv2
import os.path
# github找的函數,反正給圖片幫你找臉
def detect(target, filename, save_path, cascade_file="lbpcascade_animeface.xml"):
if not os.path.isfile(cascade_file):
raise RuntimeError("%s: not found" % cascade_file)
cascade = cv2.CascadeClassifier(cascade_file)
try:
image = cv2.imread(... | true |
ef91ec8c7ce062d3554e04e97ab406b5d408d80c | Python | ericmuckley/code | /Python_code/animate_NN_output_files.py | UTF-8 | 4,462 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 9 10:20:12 2018
@author: a6q
"""
import os, csv, glob, numpy as np, pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rcParams
#rcParams.update({'figure.autolayout': True})
label_size = 20 #make size of axis tick labels larger
plt.rcParams['xt... | true |
5d4c002c1bad286506b2e683050b7f68eac7df18 | Python | Om4roFF/InstaStat | /main.py | UTF-8 | 2,897 | 2.5625 | 3 | [] | no_license | import time
import os
import tempfile
from flask import Flask, send_file, send_from_directory, request
from PIL import ImageFont
import json
from full_stat import second_img
from photo_builder import bright, input_photo, input_labels, input_stats, input_logo
from draw_image import draw_name, draw_like, draw_comment, dr... | true |
cf567714d7ac611a7a405bde2e1345a06bcc5acb | Python | KimDongGon/Algorithm | /1000/1300/1371.py | UTF-8 | 250 | 3.5 | 4 | [] | no_license | import sys
cnt = [0 for _ in range(26)]
engs = sys.stdin.read()
for eng in engs:
if eng.isalpha():
cnt[ord(eng) - ord('a')] += 1
maxC = max(cnt)
for c in range(len(cnt)):
if cnt[c] == maxC:
print(chr(ord('a') + c), end='') | true |
c17dbca8d8cbfabde037d3a0bf55c57707965df1 | Python | manjesh41/projectOne | /main.py | UTF-8 | 621 | 4.3125 | 4 | [] | no_license | '''
Given the integer N - the number of minutes that is passed since midnight - how many hours and minutes are displayed on the 24h digital clock?
The program should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 59).
For example, if N = 150, then 150 minutes have pas... | true |
d7e9e4e2313486adb4d1969a042983fb2c6e3508 | Python | malhotra-sidharth/py-data-structures | /data_structures/queue/queueList.py | UTF-8 | 1,531 | 4.15625 | 4 | [] | no_license | from data_structures.linked_list.oneway_node import OneWayNode
class QueueList:
"""
Queue using OneWay Linked List
"""
def __init__(self):
self.__head = None
self.__next = None
self.__size = 0
def enqueue(self, data):
"""
Adds new data value to the Queue
Complexity -> O(1)
:pa... | true |
e44b6188ada7d64bc4cfb9779065a8bd0693a55f | Python | JingkaiTang/github-play | /group_or_day/eye.py | UTF-8 | 207 | 2.6875 | 3 | [] | no_license |
#! /usr/bin/env python
def part(str_arg):
call_early_group(str_arg)
print('able_company')
def call_early_group(str_arg):
print(str_arg)
if __name__ == '__main__':
part('take_same_woman')
| true |
8a06fed6862d9c7dd9f7ddc5311478b2739169cc | Python | szhbest/COMP9321 | /ass2/demo.py | UTF-8 | 6,417 | 3.359375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import json
import matplotlib.pyplot as plt
if __name__ == '__main__':
c_file = 'credits.csv'
m_file = 'movies.csv'
c_df = pd.read_csv(c_file)
m_df = pd.read_csv(m_file)
"""
q1: merge two datasets based on "id" columns
"""
merge_df = pd.merge(c_d... | true |
3249c73090f5c2fa82261dff83f7149c8276a86a | Python | rr8shah/TSARA | /secondstage_prediction.py | UTF-8 | 3,226 | 2.921875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
data = pd.read_csv('histogram_data/TrainData_Histogram_256stride_variance.csv')
X_train = data.iloc[:,:2]
y_train = data.iloc[:,2]
y_train
clf = LogisticRegression()
clf.fit(X_train,y_t... | true |
69e8453f59a93baf2d7a05361d93786d0949c0bf | Python | Devinwon/master | /coding-exercise/nowcoder/exam02.py | UTF-8 | 157 | 2.90625 | 3 | [] | no_license | '''
给定区间
求区间内最小元素与子区间和的最大值,输出即可
3
6 2 1
[6],6*6=36 这个是最大的
[6,2,1],1*9=9
其他自己验证 | true |
ee6c5327b35bfb90cd7ec26a87ff5dcaea9d611a | Python | ANUSHREE-2021/Programming-lab-python- | /C01/list1.py | UTF-8 | 215 | 3.484375 | 3 | [] | no_license | l=[1,2,3,4,5,6,7,8,9,10]
number=int(input("enter the number: "))
for i in range(len(l)):
if number==l[i]:
print("number is present")
break
else:
print("number is not present")
| true |
f77e72e880b75694b781ee5ebac1c3dee9cc5b18 | Python | chanyaoying/PolarIce | /server/tele_log.py | UTF-8 | 1,487 | 2.984375 | 3 | [] | no_license | from telegram import *
from telegram.ext import *
import requests
import os
from dotenv import load_dotenv
load_dotenv()
from flask import Flask, request, jsonify, json
import json
app = Flask(__name__)
app.config['ENV'] = 'development'
app.config['DEBUG'] = False
# Sends content of log message (python dictionary) ... | true |
6d8b73de19b0cc8b6cd35b851a25f2e4b3e51e99 | Python | ebi-ait/ingest-exporter | /exporter/graph/link/process.py | UTF-8 | 1,810 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | from typing import Iterable, Set, List, Dict
from exporter.graph.entity.input import Input
from exporter.graph.entity.output import Output
from .protocol import ProtocolLink
class ProcessLink:
def __init__(self, process_uuid: str, process_type: str,
inputs: Iterable[Input], outputs: Iterable[Out... | true |
a5dee9f4ef4b35f736bdd575dc919cbc7a096370 | Python | Baton-Bread/startup | /Bot/modules/main.py | UTF-8 | 454 | 3.09375 | 3 | [] | no_license | import requests
import bs4
response = requests.get("https://www.cbr.ru/scripts/XML_daily.asp")
soup = bs4.BeautifulSoup(response.content, "lxml")
chr_code = "CNY"
count = 10
valutes = soup.find_all("valute")
for x in valutes:
if x.charcode.text == chr_code:
nominal = int(x.nominal.text)
va... | true |
cf7039b635299e983259df86ae10b442f4e9f32c | Python | mahmudz/UriJudge | /URI/URI/1893.py | UTF-8 | 439 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 7 19:44:23 2017
@author: Matheus
"""
a,b=input().split()
a,b=int(a),int(b)
if(b>=a):
if(b>=0 and b<=2):
print("nova")
elif(b>=3 and b<=96):
print("crescente")
elif(b>=97 and b<=100):
print("cheia")
else:
if(b>=3 and b<=96):
... | true |
3ea6393c56125b3ae79ee98837da619d878ffb07 | Python | Aasthaengg/IBMdataset | /Python_codes/p02903/s142728127.py | UTF-8 | 266 | 2.953125 | 3 | [] | no_license | H, W, A, B = map(int, input().split())
graph = [[0]*W for _ in range(H)]
for i in range(B):
for j in range(A, W):
graph[i][j] = 1
for i in range(B, H):
for j in range(A):
graph[i][j] = 1
for line in graph:
print("".join(map(str, line)))
| true |
730e1f7616eee7f5d258289fdf661429f6aa430d | Python | geverartsdev/TechnofuturTIC | /Eric/project/components/boss.py | UTF-8 | 2,073 | 2.75 | 3 | [
"MIT"
] | permissive | import pygame
import random
from project.constants import ECRAN
#(self.rect.left, self.rect.top)
class Boss(pygame.sprite.Sprite):
vitesse = 1
vie = 7
animcycle = 12
images = []
direction = 2
def __init__(self):
pygame.sprite.Sprite.__init__(self, self.containers)
self.rect = ... | true |
14f91f6951ecfbd317dbfc26215f78e19fb10c3e | Python | tazimkhan/PythonAssignment | /Assignment-2/2.10.py | UTF-8 | 400 | 3.46875 | 3 | [] | no_license | s1=float(input("emter the marks"))
s2=float(input("emter the marks"))
s3=float(input("emter the marks"))
s4=float(input("emter the marks"))
s5=float(input("emter the marks"))
sum=s1+s2+s3+s4+s5
if(sum>=150):
print("Pass")
else:
print("fail")
avg=sum/5
print(avg)
if(avg>=75 and avg<=100):
print("1st")
elif(a... | true |
ffba00ccc6e7e74a8c177f085e70a4bc4db4da9e | Python | dashaylan/PyProjects | /Woodhaven/validator.py | UTF-8 | 468 | 2.734375 | 3 | [
"MIT"
] | permissive | import requests
import links
from bs4 import BeautifulSoup
def query_google():
req = requests.get("{}".format(links.VANCE))
soup = BeautifulSoup(req.text, 'html.parser')
tbl = soup.findAll("tr", {"style": "height:20px;"})
for thing in tbl:
rows = thing.findAll(td_and_dir)
for r i... | true |
cae9f27eb8f1996c8ad7216c6349a9749a8f5de1 | Python | aaronmorgenegg/cs5700 | /assn3/shapes_python/tests/test_square.py | UTF-8 | 2,885 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
import unittest
from shapes.line import Line
from shapes.point import Point
from shapes.shape_exception import ShapeException
from shapes.shape_factory import ShapeFactory
from shapes.square import Square
class TestRectangle(unittest.TestCase):
def testValidateSquare(self):
s1 = S... | true |
d765d97ff481ea173094c9f97c9be14e25e9914f | Python | Chanseok/Py_project | /seleniumExercise/run.py | UTF-8 | 835 | 2.515625 | 3 | [] | no_license | # * https://www.youtube.com/watch?v=n0PUuYVB90o&index=8&list=PL9mhQYIlKEhf0DKhE-E59fR-iu7Vfpife
# 인터파크 투어 사이트에서 여행지 입력 후 검색 --> 잠시 후 --> 결과
# 로그인 시 PC 웹 사이트 처리가 어려우면 --> 모바일 로그인 진입
# 모듈 가져오기 - pip install selenium
from selenium import webdriver as wd
# 사전 설정 => DB or file or shell or batch
main_url = "http://tour.int... | true |
55896970984a172e7f40d6e87819eec8fbe92f96 | Python | AK-1121/code_extraction | /python/python_5614.py | UTF-8 | 120 | 2.78125 | 3 | [] | no_license | # How to calculate numerical trend lines in python
def derivs(l):
return [l[i + 1] - l[i] for i in range(len(l) - 1)]
| true |
df55488bc224e0034c995ab43287227e63b6a474 | Python | GaoZhenGit/DataSetExecutor | /src/com/company/mf/cal_score_from_mf.py | UTF-8 | 2,981 | 2.59375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import scipy.sparse as sparse
import sys
import gc
# mfDir = './../../../../mfDir/'
mfDir = './mfDir/'
matrixDir = mfDir + 'matrix/'
pqDir = mfDir + 'PQ/'
scoreDir = mfDir + 'score/'
topicCount = 15
factorsCount = 10
threadHold = 64
def compute_score(P, Pshape, Q, Qshape, scoreFile):
Pmat... | true |
21ab952d75c77d9371fca12b5db3228ab27f5d65 | Python | nbvc1003/python | /ch17/scatter_rand.py | UTF-8 | 381 | 3.0625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
N = 30
np.random.seed(123)
x = np.random.rand(N)
y = np.random.rand(N)
# print(x, y)
size = np.random.rand(N)
color = np.random.rand(N)
# 랜덤하게 적당한 크기로
sizes = np.pi*(15*np.random.rand(N))**2
# c, s 각각 색과 사이즈를 다르게 설정하기 위한 목적
plt.scatter(x,y, c=color, s=sizes)
plt.show(... | true |
17a1ccba86c9e1d2165d4aafc06f294be87d1384 | Python | joon2974/python_study | /practice/Chap8/8_8_fun.py | UTF-8 | 660 | 3.75 | 4 | [] | no_license | def make_album(name, album_title, num_songs=''):
"""앨범과 뮤지션에 대한 정보 반환"""
music_album = {'name': name, 'album_title': album_title}
if num_songs:
music_album['num_songs'] = num_songs
return music_album
while True:
print("\nPlease enter name and title.")
print("If you want to stop. press 'q' anytime.\n")
n ... | true |
da19a32c0d687ff3079b72cabe20f06564ee9cd4 | Python | andrew-newton/UO_CIS | /Point-master/point.py | UTF-8 | 481 | 3.75 | 4 | [
"BSD-2-Clause"
] | permissive | '''
Andrew Newton
Winter 2021
01/05/21
Point mini-project
'''
class Point(object):
"""Creates a Point object and has functionality for moving and comparing two points"""
def __init__(self, x, y):
self.x = x
self.y = y
def move(self, dx, dy):
self.x += dx
self.y += dy
def __eq__(self, oth... | true |
2fe176640bc5d8ac5a243d5f3dde2159e2739408 | Python | AndyMcAliley/GPGN304Lab | /grav_forward/gpoly.py | UTF-8 | 1,719 | 3 | 3 | [] | no_license | # compute gravity response of a polygon
# Andy McAliley, 9/16/2017
import numpy as np
from builtins import range
def gpoly(obs,nodes,density):
#Blakely, 1996
gamma = 6.672E-03;
numobs = len(obs)
numnodes = len(nodes)
grav = np.zeros(numobs)
for iobs in range(numobs):
shiftNodes = nodes ... | true |
6cab4f9e02f3fde5f5655cc2835c34ae85e31b10 | Python | pangyouzhen/data-structure | /other/409 longestPalindrome.py | UTF-8 | 508 | 3.390625 | 3 | [] | no_license | from collections import Counter
class Solution:
def longestPalindrome(self, s: str) -> int:
t = Counter(s)
m = [v for v in t.values()]
even = [i for i in m if i % 2 == 0]
odd = [i for i in m if i % 2 != 0]
odd.sort()
if len(odd) > 0:
fst = odd... | true |
ae5c625b0bb1324b129d3d03b865b8abc20cff0e | Python | schneider42/uberbus | /software/pythonlib/uberbus/hid.py | UTF-8 | 1,456 | 2.6875 | 3 | [] | no_license | import socket
import ubnode
class HID(ubnode.UBNode):
def __init__(self, address):
ubnode.UBNode.__init__(self,address,2310)
def set(self, pin):
cmd = "S%c"%(pin+0x30)
return self.sendCommand(cmd)
def clear(self, pin):
cmd = "s%c"%(pin+0x30)
return self.sendCommand... | true |
b92154fc6a4685417498115288e9e7823d2ad08e | Python | avinashjairam/Distributed_Operating_Systems | /node_2.py | UTF-8 | 16,326 | 2.515625 | 3 | [] | no_license | import threading
import socket
import queue
import sys
from utilities import *
#incoming and outgoing queue are managed by other threads.
#RESPONSIBILITIES: process messages
class Node(threading.Thread):
def __init__(self, _id, edges,
links, ntwrk_cnfg,
incoming_queu... | true |
c8042e96622f0937dbe5d68021c3bcc66bf6e31a | Python | miguelangel18241/python_test_for_revision | /if_statement.py | UTF-8 | 547 | 4.15625 | 4 | [] | no_license | hot_weather = 19
cold_weather = 10
weather_today = input('How is the weather today? ')
weather = int(weather_today)
if weather >= hot_weather:
print ('It is a hot day, drink plenty of water')
elif weather <= cold_weather:
print ('It is a cold day, Wear warm clothes')
else :
print ('It is a lovely day.')... | true |
5eac088e9dfe932639f44c655d74633215ee766a | Python | sibuser/magic_mirror | /modules/system_info.py | UTF-8 | 1,219 | 2.546875 | 3 | [] | no_license | import netifaces as ni
import socket
from threading import Thread
from modules.base import BaseModule
from modules.logs import setup_logger
from settings import SYS_INFO_UPDATE_DELAY, IP_INTERFACE
logging = setup_logger(__name__)
class SystemInfo(BaseModule):
def __init__(self):
super().__init__()
... | true |
3971c9da5cd1ca9c5e3ea614a3a29ce1dddce1c0 | Python | AzUAC-849i/Calculator | /shabnnam.py | UTF-8 | 321 | 3.53125 | 4 | [] | no_license | num1 = int(input("num1:"))
num2 = int(input("num2:"))
process = input("symbol")
add = num1 + num2
substract = num1-num2
divide = num1//num2
multiple = num1*num2
if process == "+":
print (add)
elif process == "-":
print (substract)
elif process == "/":
print (divide)
elif process == "*":
print (multiple)
... | true |
b66e23e840696674a3a7540c4ad5232f0b107e7e | Python | Jmarkaba/wikipedia-CQG | /build_input.py | UTF-8 | 2,363 | 2.671875 | 3 | [] | no_license | import wikipedia
from io import StringIO
from rake_nltk import Rake
from markdown import Markdown
import warnings
warnings.catch_warnings()
warnings.simplefilter("ignore")
RANDOM_PAGES_COUNT = 500 # number of total pages to explore
WIKIPEDIA_MAX_RANDOM_COUNT = 10 # the wikipedia module can onl... | true |
5de6cab6c79af731ff8854a0d21abc4c3ed9274a | Python | sharankonety/algorithms-and-data-structures | /Sorting/Bubble_sort.py | UTF-8 | 244 | 3.703125 | 4 | [] | no_license | # Bubble sort
# a = [3,1,9,8,5]
a = [1,3,5,8,9]
n = len(a)
for i in range (n-1):
flag = 0
for j in range (n-1-i):
if a[j]>a[j+1]:
a[j],a[j+1]=a[j+1],a[j]
flag = 1
if flag == 0:
break
print(a)
| true |
ed9894bdd4fa79895766bc31e0aef190f9084e0c | Python | RussellJQA/test-statsroyale | /tests/test_ch1_challenge2.py | UTF-8 | 2,141 | 4.40625 | 4 | [
"MIT"
] | permissive | import string
# pip installed
import pytest # installed with webdriver_manager
""" CHALLENGE 2: Write a new function that takes a string
(e.g., "A cow jumped over the moon")
and returns both the shortest and longest words within it.
Write as many tests as you need to assert that your
function works as expected.
"""
... | true |
8bd28e9e6541265cdad1842d8369924ed52d1ee8 | Python | MMagg/plots | /tau_res.py | UTF-8 | 2,335 | 2.53125 | 3 | [] | no_license | """Author: M. Magg
Code for fast plotting Ba. project output data.
To be copied and modified for every application
"""
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
import re
n_eta = 3
n_mmin = 2
nlev = 256
mlev = 256
tau_planck14 = 0.092
sig_tau14 = 0.013
tau_wmap = 0.084
... | true |
bcb820709fdfede871ab8b95b57f3bdf255f2129 | Python | bootplug/writeups | /2019/csaw_quals/pwn/tvm/assemble.py | UTF-8 | 3,395 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import struct
import sys
from binascii import hexlify
OP = {
"DST": 0xDD,
"HLT": 0xFE,
"MOV": 0x88,
"MOVI": 0x89,
"PUSH": 0xED,
"POP": 0xB1,
"ADD": 0xD3,
"ADDI": 0xC6,
"SUB": 0xD8,
"SUBI": 0xEF,
"MUL": 0x34,
... | true |
73e3c7f32f5b9b9bc31aeb378d740cb082aae105 | Python | miguelToscano/aivo-challenge | /validators/indicators.py | UTF-8 | 809 | 2.78125 | 3 | [] | no_license | import pandas as pd
import errors
def is_valid_value(value):
return (type(value) is int or type(value) is float) and value >= 0
def validate_get_inequality(indicator, value, inequality = None):
try:
if is_valid_value(float(value)) == False:
raise Exception('Invalid value', errors.BAD_RE... | true |
a1265efc1afaca70edcafaa925401d29e096401d | Python | riyaagarwal92/daas | /src/common/helpers.py | UTF-8 | 9,271 | 2.703125 | 3 | [] | no_license | import time
import functools
import logging
from datetime import date, datetime
from typing import List, Dict, Union
from graphql.execution.base import ResolveInfo
from graphql.language.ast import FragmentSpread, Field
from promise import Promise
from promise.dataloader import DataLoader
from common.config imp... | true |
fb28845612708879dd948f52e0795f72a6ab3eab | Python | Philrobots/beers-ecommerce | /flask_api/domain/profile/profile.py | UTF-8 | 1,092 | 2.96875 | 3 | [] | no_license | import uuid
from domain.profile.hash_password import hash_password
class Profile:
def __init__(self, first_name, last_name, email, user_name, date_of_birth, password):
self._first_name = first_name
self._last_name = last_name
self._email = email
self._user_name = user_name
... | true |
f2dc2446006e849ca41b5b7df2d0fa25d8c0e15b | Python | nbendale18/FinalProject | /cardio.py | UTF-8 | 13,114 | 2.984375 | 3 | [] | no_license | import streamlit as st
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
# Security
#passlib,hashlib,bcrypt,scrypt
import hashlib
def make_hashes(password):
return hashlib.sha256(str.encode(password)).hexdigest()
def check_hashes(password,hashed_text):
if make_hashes(password) == hashed_... | true |
91d7dbce34ef0db727ae9f7fcc8dc27bf70bdcf7 | Python | siberiax/Advent-of-Code-2018 | /day22.py | UTF-8 | 1,824 | 2.953125 | 3 | [] | no_license | import sys
import heapq
def print_grid(grid):
for y in range(len(grid)):
row = ""
for x in range(len(grid[0])):
if grid[y][x] == 0:
row += '.'
elif grid[y][x] == 1:
row += '='
else:
row += '|'
print(row)
de... | true |
a6a3801709adad95de15c0a7e1931119862e0e06 | Python | ravalrupalj/BrainTeasers | /Edabit/International Greetings.py | UTF-8 | 876 | 4.15625 | 4 | [] | no_license | #Suppose you have a guest list of students and the country they are from, stored as key-value pairs in a dictionary.
#GUEST_LIST = {"Randy": "Germany","Karla": "France",
#"Wendy": "Japan","Norman": "England","Sam": "Argentina"}
#Write a function that takes in a name and returns a name tag, that should read:
#"Hi! I'm [... | true |
9a05b3203120b12d639b73e6e653be1b3c8da545 | Python | matyjb/Lsystem | /Turtle.py | UTF-8 | 1,331 | 3.375 | 3 | [] | no_license | from pygame import *
class Turtle:
def __init__(self,position,rotation,turningAngle,stepLength,mulStep,mulAngle,color,width):
self.position = position
self.rotation = rotation
self.turningAngle = turningAngle
self.stepLength = stepLength
self.mulStep = mulStep
self.mulAngle = mulAngle
sel... | true |
aaa548d7aae7a1759a77ec46f0ecedba3bce9327 | Python | skckompella/QuantumEmbedding | /baseline/layers.py | UTF-8 | 1,606 | 2.703125 | 3 | [] | no_license | import torch
from torch.autograd import Variable
import torch.nn as nn
class RNNEncoder(nn.Module):
def __init__(self, input_size, hidden_size, num_layers=1, dropout=0.1, biderectional=False):
super(RNNEncoder, self).__init__()
self.num_layers = num_layers
self.input_size = input_size
... | true |
b782b6d32544bf9adb35d1e7cdbe57fad8c3558d | Python | lordpews/python-practice | /break and continue.py | UTF-8 | 138 | 3.484375 | 3 | [] | no_license | i = 0
while (True):
if i > 5:
i = i + 1
continue
print(i + 1, end=" ")
i = i + 1
if i == 25:
break | true |
4ed055ccfabe5b4c912d9088fb7ea2dae4f11b2c | Python | csiebler/aml-compute-instance-snippets | /shutdown-if-inactive/shutdown_if_inactive.py | UTF-8 | 2,500 | 2.71875 | 3 | [] | no_license | import os.path
import requests
import json
from azureml.core import Workspace
from azureml.core.compute import ComputeInstance
from datetime import datetime
idle_threshold_in_sec = 3600
# Jupyter runs on Compute Instance on http on port 8888
notebook_session_url = f'http://localhost:8888/api/sessions'
def get_comput... | true |
5851da6cf73aaf26751e315d47a49085d9832e03 | Python | yorlingarcia/computacional | /computacional_ll/clase_14/testeval.py | UTF-8 | 268 | 2.84375 | 3 | [] | no_license | from numpy import zeros, array
fun = []
fun.append('y[0]+2')
fun.append('y[1]+4')
funx = 'y[0]+1'
print(type(funx),funx)
y = array(zeros((2,1)),float)
for i in range(len(fun)):
y[i] = i+1
funeval = str(fun[i])
print(y[i],funeval)
print(eval(funeval))
| true |
026ab9f0ae0aef5c2b113d9bc799e296701ce904 | Python | SantiSnow/python-threading | /sincronizacion.py | UTF-8 | 867 | 3.984375 | 4 | [] | no_license | import threading
import time
x = 40000
# lock se encarga de bloquear un recurso, en este caso x, para que no pueda ser accesible desde otro lugar
lock = threading.Lock()
# con la funcion acquire(), nos encargamos de ver si el recurso esta disponible y bloquearlo para otros
# con la funcion release(), lo liberamos
de... | true |
6025d3e7c9d9bb586f4677aea176d76a333791ea | Python | lvngd/random-stuff | /wikichallenge.py | UTF-8 | 6,479 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import re
import collections
import statistics
"""
My solution to the wikipedia challenge: the Path to Philosophy
https://en.wikipedia.org/wiki/Wikipedia:Getting_to_Philosophy
"""
PAGES_VISITED = []
PAGES_THAT_LOOP_OR_LEAD_NOWHERE = []
PAGES_THAT_LEAD_TO_PHILOSOPHY = ... | true |
a83bb51654b904f3f9d627aef0be2e8b8eb788a1 | Python | hawrk/python_practice | /socket_web/socket_client.py | UTF-8 | 224 | 2.5625 | 3 | [] | no_license | from socket import socket,AF_INET,SOCK_STREAM
for i in range(10):
s = socket(AF_INET,SOCK_STREAM)
s.connect(('localhost',20000))
s.send(b'hello clinet socket')
recv = s.recv(8192)
print ('recv :',recv) | true |
63d1923494abf91fa6c0ccadfeff00c8555e9ffe | Python | NathanJCullen/FootballInfograph | /request.py | UTF-8 | 1,106 | 2.953125 | 3 | [] | no_license | import csv
import urllib.request
import requests
from bs4 import BeautifulSoup
import re
import os
def retrieve_last_seen_date(file_name):
if(os.path.isfile(file_name)):
f_read = open(file_name, 'r')
last_seen_date = int(f_read.read().strip())
f_read.close()
else:
last_seen_date = 9999999
retu... | true |
c69aa7b168fc70a7f355d004416838b9f248d15b | Python | carwestsam/leetCode | /archive_11_20/p20/Solution.py | UTF-8 | 839 | 3.609375 | 4 | [] | no_license | class Solution:
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
stack = []
top = -1
for ch in s:
if ch == '(' or ch == '{' or ch == '[':
stack.append(ch)
top += 1
elif ch == ')':
i... | true |
952ad581bc2398addc5f296afc920c96b7aad4d2 | Python | MustafaKaynak96/GlobalAIHubDLCourse | /Homework1.py | UTF-8 | 1,783 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 5 20:11:51 2021
@author: Mustafa
"""
#Type 1. Processing of csv files. It is including import the libraries, calling database, and visulization of data
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#Step 1 and 2
url = 'https://gis... | true |
9dd7b7601c797ea1cf0d4422afa6aaf89779dec1 | Python | bopopescu/API-auto-test | /base_api/register_api.py | UTF-8 | 230 | 3 | 3 | [] | no_license | def triangles():
N = [1]
while True:
yield N
N.append(0)
N = [1] + [N[i] + N[i+1] for i in range(len(N)-1)] + [1]
n = 0
for t in triangles():
print(t)
n = n +1
if n == 10:
break | true |
9a8578b9d6fb095ae9d9cda35485964767a31319 | Python | darmiel/kssping | /check.py | UTF-8 | 2,524 | 2.59375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import difflib
import html
import os
from time import sleep
URL = "https://www.kinzig-schule.de"
WEBHOOK_URL = os.environ.get("check.webhook_url")
Interval = os.environ.get("check.interval")
if WEBHOOK_URL == None:
print("Webhook URL not found. (Env)")
exit(code=1... | true |
c081a5d171e97126334d85ae5314690e459878db | Python | AnttiVainikka/tiralabra | /src/kayttoliittyma/ohjeet.py | UTF-8 | 485 | 2.59375 | 3 | [] | no_license | import pygame
from kayttoliittyma.mitat import fontit,ikkuna_ja_ruudukko
pygame.init()
ikkuna = ikkuna_ja_ruudukko()
ikkuna = pygame.display.set_mode((ikkuna[0], ikkuna[1]))
fontti = fontit()[0]
def kirjoita_ohjeet():
ikkuna.blit(fontti.render("ENTER: Uusi ruudukko",True,(200,0,0)),(650,50))
ikkuna.blit(fontt... | true |
47e389ea9d32732f2e52b60f8dc5efda348a79f7 | Python | wmcooper2/mario-quiz-game | /temporarydatasolution_test.py | UTF-8 | 1,052 | 2.875 | 3 | [] | no_license | import temporarydatasolution as tds
import os
data = tds.Data()
def test_dictionary_exists():
"""Dictionary exists in the directory tree."""
assert os.path.exists(data.default_dict_path) == True
def test_target_sentences_exist():
"""Target sentence file exists in the directory tree."""
assert os.path... | true |
86b668b54a98b3e401a4b1ba806805e1645b731a | Python | yiming1012/MyLeetCode | /LeetCode/动态规划法(dp)/背包问题/494. 目标和.py | UTF-8 | 2,241 | 3.75 | 4 | [] | no_license | """
给定一个非负整数数组,a1, a2, ..., an, 和一个目标数,S。现在你有两个符号 + 和 -。对于数组中的任意一个整数,你都可以从 + 或 -中选择一个符号添加在前面。
返回可以使最终数组和为目标数 S 的所有添加符号的方法数。
示例:
输入:nums: [1, 1, 1, 1, 1], S: 3
输出:5
解释:
-1+1+1+1+1 = 3
+1-1+1+1+1 = 3
+1+1-1+1+1 = 3
+1+1+1-1+1 = 3
+1+1+1+1-1 = 3
一共有5种方法让最终目标和为3。
提示:
数组非空,且长度不会超过 20 。
初始的数组的和不会超过 1000 。
保证返回的最终... | true |
70689e02f18d70bcfba71fb81792b181cac31ada | Python | jjeeey/practicum_1 | /9.py | UTF-8 | 908 | 3.28125 | 3 | [] | no_license | """
Имя проекта: practicum_1
Номер версии: 1.0
Имя файла: 9.py
Автор: 2020 © Ю.А. Мазкова, Челябинск
Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru)
Дата создания: 20/11/2020
Дата последней модификации: 20/11/2020
Связанные файлы/пакеты: numpy, random
Описание: Решение зад... | true |
eccc2d883ffd5a830e01a2b8fd64caf0a21829c1 | Python | bbkjunior/english_texts_complexity | /wordsAPI_vs_docker/main/to_prod/calculate_level_new.py | UTF-8 | 22,697 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .ud_class import Model
from .vocabulary import cefr_dictionary, phrasal_list_big
from .grammar_properties import get_non_verb_phrase_properties, get_verb_phrase_properties
from collections import OrderedDict
import copy
from sklearn.feature_extraction.text import Tfi... | true |
c6e0e6a70edec32369c65b4f7325a1b9c74a51b0 | Python | hooverpty/hola-mundo | /Test.py | UTF-8 | 5,558 | 3.53125 | 4 | [] | no_license | # Notas sobre la libreria Tkinter de Python para la generacion de interfases graficas.#
# Ing. Haim Martinez
# jhaim04@gmail.com
import tkinter # Esta es la libreria que estoy utilizando para realizar las interfaces graficas.
from tkinter import * #Importamos todos los widgets que tkinter tiene para generar las inter... | true |