blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
5bb3547b83b2835d02475bb0394f78a1f2faa11b | xiaohanhan1019/CAN | /models/GCSAN.py | UTF-8 | 12,359 | 2.5625 | 3 | [] | no_license | import math
import numpy as np
import torch
from torch import nn
from torch.nn import Parameter
from torch.nn import functional as F
import copy
class TransformerEncoder(torch.nn.Module):
def __init__(self, n_layers, n_heads, hidden_size, dropout_prob):
super(TransformerEncoder, self).__init__()
... | true |
34140468b1f3fc2fa3aa4c03148d9ed0b0f07864 | Sukhrobjon/leetcode | /easy/278_first_bad_version.py | UTF-8 | 718 | 3.765625 | 4 | [
"MIT"
] | permissive | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, last_version):
"""
:type n: int
:rtype: int
"""
"""
Finds the first bad version. (replicat... | true |
eb8131ff2b1882b9144f6f8fe121c75fc2aa46e4 | Birhant/Document-summarizer | /Summarizers/code/Summarizers/text_rank_summarizer.py | UTF-8 | 393 | 2.765625 | 3 | [] | no_license | from sumy.summarizers.text_rank import TextRankSummarizer
def summarize(my_parser, sentences_count = 3):
error = True
# Initializing the parser
summarizer = TextRankSummarizer()
text_rank_summary =summarizer(my_parser.document,sentences_count = sentences_count)
summary = ''
for sentence in ... | true |
4f9811a5ba5a0ba6c4d1594a1c2daee2afc4dca4 | HTMLProgrammer2001/PyQT | /Weathers/Network.py | UTF-8 | 1,409 | 2.625 | 3 | [] | no_license | from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest, QNetworkAccessManager
from PyQt5.QtCore import QUrl
class Network:
key = '37d34c5ad2416876ed7bded854432e17'
url = 'http://api.openweathermap.org/data/2.5'
def __init__(self):
# request callbacks
self.successCallback = lambda data... | true |
6f3320653460e3f8f8ddc8274a579f79d2179461 | chandanadasarii/CrackingTheCodingInterview | /LinkedList/linkedlist.py | UTF-8 | 1,444 | 4.125 | 4 | [] | no_license | class Node(object):
def __init__(self, value):
self.value = value
self.next = None
class LinkedList(object):
def __init__(self, head=None):
self.head = head
def append(self, new_node):
current = self.head
if self.head:
while current.next:
... | true |
d8d5da8ea410559cb90623e20ccdf82f7ecdbb56 | karvozavr/hackuniversity | /server/database/db.py | UTF-8 | 2,188 | 2.78125 | 3 | [] | no_license | import io
import os
import pandas as pd
import psycopg2
class Database:
def __init__(self):
try:
dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(dir, '../dbconnect'), 'r') as dbconnect:
host = dbconnect.readline().strip()
p... | true |
6f0a677c83eac07ff1c8bf2b5f9703cf11349c45 | matt-zx315/Curso-Python | /Topico_12/02_Criando_um_loop.py | UTF-8 | 342 | 4.375 | 4 | [] | no_license | """
Criando um loop customizado
"""
for numero in [1, 2, 3, 4, 5]:
print(numero)
for letra in "Nepu":
print(letra)
def loop_custom(_iteravel):
_it = iter(_iteravel)
while True:
try:
print(next(_it))
except StopIteration:
break
loop_custom("Nepu")
loop_custo... | true |
96da0f56c985329a42035f019315c16ea186b7bf | enkiv2/clisynth | /randomMelodyChords.py | UTF-8 | 5,132 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import sys
from random import Random
random=Random()
if(len(sys.argv)>1):
random.seed(sys.argv[1])
def chars(s):
ret=[]
for i in range(0, len(s)):
ret.append(s[i])
return ret
notes="CdDeEFgGaAbB"
minorNotes="degab"
notesL=chars(notes)
instruments=["sine", "square", "triangle", "sawtooth"... | true |
0a978bf6d2271ad6109a9e175dbc7d80f1b9f171 | Satvikflash4444/tg-launchbot | /utils/clean_logs.py | UTF-8 | 381 | 3.140625 | 3 | [
"MIT"
] | permissive | # Used to clean old logs
rem_lines = 0
with open('log.log', 'r') as file:
with open('new_log.log', 'w') as new_file:
for line in file:
if 'Received text, not a command:' not in line:
try:
if line[2] == '/' and line[5] == '/':
new_file.write(line)
except:
rem_lines += 1
else:
rem_li... | true |
d7ff4333fd1746fe842b0f185db918332557dbf8 | valeriecodes/project-euler | /21.py | UTF-8 | 429 | 3.625 | 4 | [] | no_license | import math
amicable_numbers_total = 0
def sum_of_proper_divisors(n):
sum = 0
for i in range(1, int(n/2) + 1):
if n % i == 0:
sum = sum + i
return sum
def is_amicable(a):
b = sum_of_proper_divisors(a)
return a == sum_of_proper_divisors(b) and a != b
for i in range(10000):
... | true |
62bebee2ef81e32dae3bb1e79e57f10782ea8d92 | drocaneste/Projetos-Faculdade | /atp_Rascunho.py | UTF-8 | 5,389 | 3.46875 | 3 | [] | no_license | # ATP Raciocinio Logico #
# Aluno: Michael N. #
# Prof/Tutor: Lucas Emanuel Silva E Oliveira #
# Turma: 11100010563_20211_02 #
#################################################
# CADASTRO PARA OBTER INFORMACOES PESSOAIS #
def obter_limite():
... | true |
9a710acaca64e9aad945b9878c03b612c7f6d8df | MinimolCT/FunwithPython | /chap 3 functions/samename2.py | UTF-8 | 168 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 15:23:03 2019
@author: Minimol
"""
def spam():
global eggs
eggs = 'spam'
eggs = 'global'
spam()
print(eggs) | true |
f2f137d61f8f0b7c8a061fbfe752cf165951a1a8 | MalAstronomy/NUR | /handins/numerical_integrator.py | UTF-8 | 891 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
class numerical_integrator:
def __init__(self,xmin,xmax,N,func,a,b,c, name=""):
self.name=name
self.xmin=xmin
self.xmax=xmax
self.N=N
self.func=func
self.a=a
self.b=b
self.c=c
def t... | true |
fe94a1b4ff49e669e6e23fc4960a9b22f71f83fc | TheoryDivision/stochastic-modelling-class | /local_ad/scripts/moran_run.py | UTF-8 | 7,245 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import time
from matplotlib.ticker import FormatStrFormatter
def l_norm(x=None):
return x/np.sum(x)
def get_sim(r_val=None, n_val=None):
sim_res = []
N = n_val
for r in r_val:
temp = []
f... | true |
4b12835883a6a31c196f19416f9682648c7eeea4 | antti-k/advent | /day06/part1.py | UTF-8 | 597 | 3.328125 | 3 | [] | no_license | orbits = {}
with open('input.txt', 'r') as fp:
line = fp.readline()
while line:
line = line.rstrip()
objects = line.split(')')
line = fp.readline()
parent = objects[0]
child = objects[1]
if parent in orbits:
orbits[parent] += [child]
else:
... | true |
c21499fcba820e0bcba0f136a694428bacf70779 | danieldulaney/advent-of-code | /2019/2/2/python/run | UTF-8 | 945 | 3.1875 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
def intcode_step(program, pc):
opcode = program[pc]
in1_pos = program[pc + 1]
in2_pos = program[pc + 2]
out_pos = program[pc + 3]
if opcode == 1:
program[out_pos] = program[in1_pos] + program[in2_pos]
elif opcode == 2:
program[out_pos] = prog... | true |
871f4a217adb369aa03ea491c383c572baff97b6 | msalmansaeedch786/mailgun-lambda-sns | /lambda_function_payload/lambda_handler.py | UTF-8 | 2,173 | 2.765625 | 3 | [] | no_license | """This is the main lambda function handler"""
import os
import hmac
import json
import hashlib
from aws_s3 import S3
from aws_sns import SNS
from aws_ssm import SSM
def lambda_handler(event, _context):
"""This function will stores data in AWS S3, publish message using AWS SNS after verification"""
# initial... | true |
24c0c5fa646caff2a1e3767493651e95fddb0834 | katataku/atcoder | /Contest/ABC221/F.py | UTF-8 | 1,107 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import heapq
import itertools
from collections import deque
import sys
sys.setrecursionlimit(1000000)
MOD = 998244353
INF = 10 ** 10
n = int(input())
path = [[] for i in range(n)]
for i in range(n - 1):
u, v = map(int, input().split())
u -= 1
v -= 1
path[u].append(v... | true |
836cc7d9241d728bbe5ecf7b9844d57a6f0a4b9c | hashnao/CodeCademy | /UNIT5_LISTS_DICTIONARIES/Pythoh_Lists_and_Dictionaries/11_New_Entries.py | UTF-8 | 213 | 3.34375 | 3 | [] | no_license | menu = {}
menu['Chicken Alfredo'] = 14.50
print menu['Chicken Alfredo']
#
menu['Spam'] = 2.50
menu['Budweiser'] = 5.50
menu['Bred'] = 1.00
print "There are " + str(len(menu)) + " items on the menu."
print menu
| true |
faf2102f7a8867e278c050d0d19a12bca897489e | evanweng666/awesome_tools | /je.py | UTF-8 | 4,350 | 3.375 | 3 | [] | no_license | import sys
import os
import time
import random
import openpyxl
"""
@Title excel和json互转工具
@Author Evan
"""
def json_to_excel_new(data, filename=None, sheet_name=None, rules=None):
"""
json转excel - 新建/覆盖
:param data: json数据([[1, 2, 3], [4, 5, 6]])
:param filename: excel文件路径(格式要求:xlsx)
:param sheet... | true |
0b26c8f14d821756da91ce50cc735f29710d02ab | AliceEMaffs/FireTech-Teen-Python-codes | /Dictionaries.py | UTF-8 | 356 | 3.59375 | 4 | [] | no_license | # Dictionaries and Lists
# Notes about both:
# 1. Both are mutable.
# 2. Both are dynamic. They can grow and shrink as needed.
# 3. Both can be nested.
# Dictionaries differ from lists primarily in how elements are accessed:
# List elements are accessed by their position in the list, via indexing.
# Dictiona... | true |
53fa98956b61450c1fe3c483ebec1bbe0a0d929e | ericmoritz/memesearch-rdf | /bin/memescraper.py | UTF-8 | 4,339 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | from gevent.monkey import patch_all
patch_all()
from pyquery import PyQuery
import grequests
from rdflib import Graph, Namespace, URIRef, Literal
import json
import re
from pprint import pprint
from urlparse import urljoin
from itertools import izip, imap
import logging
from datetime import datetime
from urllib import... | true |
84c7d321070b570879bac12aaecec2c798f55e41 | Anabadier/MineHantee | /classe_carte.py | UTF-8 | 2,359 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 13 05:18:23 2019
@author: anael
"""
class carte():
def __init__(self,type_carte,dict_elements={'fantome':[],'pepite':[],'joueur':[]},\
position_graph=None,position_detail=None,orientation=0,mobilite=True):
"""
type_carte:
... | true |
f5abb09ddba31ad6ff01725e4a509249278b7546 | alisanozdrina/coherent_neutrino_scattering | /lib/reactor.py | UTF-8 | 1,045 | 3.03125 | 3 | [] | no_license | import numpy
def total_antineutrino_flux(reactor_power, isotopes, nu_energy_range):
"""
:param reactor_power: well... reactor power
:param isotopes: array of the isotope's info as python dict:
{
'FISSION_FRACTION': ..(constant for reactor),
'FISSION_ENERGY': ..(constant for isotope),
... | true |
b51011bc8850a9ccc3cd807415d214926f8578c1 | lucasfsf/alien_invasion | /game_stats.py | UTF-8 | 1,131 | 2.9375 | 3 | [] | no_license | import json
high_score_file = 'high_score.json'
class GameStats:
"""Track statistics for Alien Invasion."""
def __init__(self, ai_game) -> None:
"""Initialize statistics."""
self.settings = ai_game.settings
self.reset_stats()
# Start Alien Invasion in an active state.
... | true |
939281a344400dc8f20c5f9161df17887e17c144 | JoelGooch/Tensorflow-Final-Year-Project | /input_data.py | UTF-8 | 10,255 | 2.515625 | 3 | [] | no_license | from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import pickle
# this file abstracts away the preparing and loading of data sets
# loads the annotated facial landmarks in the wild files for the yaw measurement
# @param data_path = string containing where to load data set from
# @para... | true |
861de33c87873014e7fe5759487d982dac478a97 | VictoriaMaia/servidor-cliente-JustTake | /mudanca/mainCarrinho.py | UTF-8 | 1,124 | 2.828125 | 3 | [] | no_license | import time
import socket
import os
import FuncsComuns as fc
from classClient import Cliente
cli = Cliente()
def caixinhaPreta():
#loop do código do JP que identifica o produto
#fazer funções para ele usar
sair = 0
while True:
# time.sleep(2)
# os.system("clear")
produ... | true |
9000b0abd437e094c80e4c088afc9f103501f3de | mariashev/Adversarial-ML-GK | /models/base_model.py | UTF-8 | 5,104 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | """
Imports
"""
import torch as nn
import torch.nn.functional as F
from torch.nn import Linear, Conv2d, Module
from torch.optim import Adam
from tqdm import trange
import numpy as np
from sklearn.metrics import accuracy_score
import sys
import os
WORKING_PATH = os.getcwd()
PATH = os.path.abspath( os.path.dirna... | true |
3e9100b572236595a3031f53a60c0624b8be81e2 | annhak/face | /main.py | UTF-8 | 1,031 | 3.03125 | 3 | [] | no_license | from PIL import Image, ImageDraw
import face_recognition
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
matplotlib.use('TkAgg')
# Load the jpg file into a numpy array
image = face_recognition.load_image_file("ae.jpg")
# Create an empty (white) array of the same size
(h, w, d) = image.shape
empty ... | true |
3e71a988a951292253d1d02f324883e1fb3d52dd | ki5953/RaceFinder-backend | /app.py | UTF-8 | 4,072 | 2.703125 | 3 | [] | no_license | """
Backend Routes for Races
Kyle Infantino 6/13/19
"""
import json
from flask import Flask, request
from db import db, Race
from datetime import datetime
app = Flask(__name__)
db_filename = 'races.db'
# SELECT * FROM RACE WHERE
# print(races)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % db_filename
... | true |
6f90ae4439ea6cf472b52a5b72c61a75ae37748a | 1c3t0y/ProyFinOptiII | /utils/ingresar_datos.py | UTF-8 | 13,750 | 3.1875 | 3 | [] | no_license | ### ingresar_datos ###
from typing import Tuple
import numpy as np
import math
from utils.Functions import check_int, check_csv, get_param, get_z_ppl, get_restricciones_ppl, \
read_from_JSON, check_ppl_JSON
def ingresar_matriz_manualmente():
opcion = "N"
while opcion[0] == 'N' or opcion[0] == 'n':
n = int(input... | true |
506036795874f4ca5349d02c8bed56b24ec42a72 | MarcusNEU/INFO7390_2018Spring | /FinalProject/Web Application/classification.py | UTF-8 | 4,268 | 2.625 | 3 | [] | no_license | import pandas as pd
import boto3
import pickle
from werkzeug.utils import secure_filename
import time
import os
from flask import flash
ALLOWED_EXTENSIONS = {'csv'}
PICKLED_MODELS = ['svm_model.pkl', 'random_forest_model.pkl']
local_time = time.strftime('%y%m%d-%H%M%S', time.localtime(time.time()))
BUCKET_NAME = 'inf... | true |
5278e5e3de0f3f4f32d8033cc4563016765dc500 | Yalchin403/dsbot-dev | /random_choice_4_poll.py | UTF-8 | 555 | 2.84375 | 3 | [] | no_license | RANDOM_CHOICES="""✅
🧚
🚶
🚴
🤸
🌸
🌺
🌻
🌼
🌱
🌲
🌳
🌴
🌍
🌎
🌏
🗺️
❎
👇
👍
👎
✊
👊
🤛
🤜
👏
🙌
👐
🤲
🤝
🛴"""
RANDOM_CHOICES = RANDOM_CHOICES.split("\n")
import random
def random_choice(n):
choices = list()
for i in range(n):
choice = random.choice(RANDOM_CHOICES)
while(True):
if ... | true |
977a0079d48e898aa921e07dfda3303dabbac566 | 42madrid/remote-challs | /chall04/fulldemo.py | UTF-8 | 1,662 | 2.828125 | 3 | [] | no_license | #! /usr/local/bin/python3
import sys
import fileinput
def error(e, n):
if e == 0:
if n != 0:
print("%s: %s: Can't read file" % (sys.argv[0], sys.argv[n]))
else:
print("%s: stdin: Can't read file" % (sys.argv[0]))
else:
if n != 0:
print("%s: %s: Not enough space in the given shelves" % (sys.argv[0], s... | true |
1db36af6e80ce9038c509fd75a5cad2d512c0f1f | sprach/rpi-tank | /src/test/led/bluedot_led.py | UTF-8 | 267 | 2.5625 | 3 | [] | no_license | from bluedot import BlueDot
from gpiozero import LEDBoard
# Red, Green, Blue
LEDS = LEDBoard(24, 25, 4)
# https://bluedot.readthedocs.io/en/latest/index.html
bd = BlueDot()
while True:
bd.wait_for_press()
LEDS.on()
bd.wait_for_release()
LEDS.off()
| true |
d17b4efc85c310a0c6007fe294047daa7cbde9b4 | AmritaDeb/Automation_Repo | /PythonBasics/Prog_18_12_29/3.EvenAndOddList.py | UTF-8 | 329 | 3.890625 | 4 | [] | no_license | class EvenAndOddList:
def evenAndOdd(self,l):
even=[]
odd=[]
for i in l:
if i%2==0:
even.append(i)
else:
odd.append(i)
print("Even element: ",even)
print("Odd element: ",odd)
ob=EvenAndOddList()
l=[4,7,9,6,2,3,5]
ob.even... | true |
58716e77008a3f0d59cb20b0d949d28c54936f2c | Hank-Liao-Yu-Chih/document | /OpenCV讀者資源/讀者資源/程式實例/ch13/ch13_4.py | UTF-8 | 202 | 2.875 | 3 | [] | no_license | # ch13_4.py
import cv2
src = cv2.imread("map.jpg")
dst = cv2.Sobel(src, -1, 0, 1) # 計算 y 軸影像梯度
cv2.imshow("Src", src)
cv2.imshow("Dst", dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
| true |
6a3e1b8e889a607447a77cd6a2ba075d656b7691 | Aasthaengg/IBMdataset | /Python_codes/p03598/s125245564.py | UTF-8 | 223 | 3.203125 | 3 | [] | no_license | n = int(input())
k = int(input())
x = list(map(int, input().split()))
distance = 0
for i in range(len(x)):
if x[i] < k - x[i]:
distance += x[i] * 2
else:
distance += (k - x[i]) * 2
print(distance) | true |
1b235156598e5d512f13b784b9176062178c6b7b | Mostofa-Najmus-Sakib/Applied-Algorithm | /Leetcode/Python Solutions/MaximumWidthWithoutNullPointer.py | UTF-8 | 963 | 3.921875 | 4 | [
"MIT"
] | permissive | """
Description: Maximum Width of a Binary tree without counting null pointers
Link: https://www.geeksforgeeks.org/maximum-width-of-a-binary-tree/
Language: Python
Written by: Mostofa Adib Shakib
"""
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = ... | true |
c40be8739049a237248687d3aa35c5a2c4ff3bd9 | larrtang/Public-Projects | /stock_market_analytics/Market.py | UTF-8 | 2,748 | 2.96875 | 3 | [] | no_license | from yahoo_finance import Share
import time
class Market:
__PULL_INTERVAL_IN_MIN = 5
def __init__ (self, s):
self.share_string = s
self.share = Share(s)
self.current_price = self.share.get_price()
self.price = self.curre... | true |
9ca67aac568be0c675b8485783d9aa538aebb48a | chloe-lqr/biospark | /源文件/源代码/Code/Python/robertslab/ncbi/taxonomy.py | UTF-8 | 4,036 | 2.8125 | 3 | [] | no_license | from robertslab.ncbi import db
class TaxonomyNode:
def __init__(self, taxid, name, rank):
self.taxid=taxid
self.name=name
self.rank=rank
self.parent=None
self.children=[]
self.leafCount=1
def __str__(self, level=0):
s=""
for i in range(0,... | true |
4fde2fe1028fc011ebaf9b0b4ca06a5e2773b235 | lefti2003/Miscellaneous | /bubble_sort.py | UTF-8 | 288 | 3.75 | 4 | [] | no_license | #a = [5, 3, 7, 0, 10]
a = [10,7,3,5,0]
n = len(a)
print("unsorted list = ", a)
def sorted_list(a):
for i in range(n-1):
for j in range(n -i -1):
if a[j] > a[j+1]:
a[j], a[j+1] = a[j+1], a[j]
return a
print("sorted list=", sorted_list(a))
| true |
a4fd10836300cc9696dcc2b207902ea98774826b | michail82/TestMikl | /MiklTest2_Week2_1_even.py | UTF-8 | 107 | 3.125 | 3 | [] | no_license | n = int( input() )
isEven = n % 2 == 0
print( isEven )
# проверка числа на четность
| true |
6aab6a657e485e83c9d2c91921af2d595493d6ad | zy10zm/path-planning | /simulate.py | UTF-8 | 6,724 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 14:23:41 2020
@author: Saif
"""
import math
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import global_planner
import local_planner
def length(path):
"""
Calculates the total path length of an input... | true |
f5bd575b49e14380e5e2425a378fb9e239484756 | kedpak/AirBnB_clone_v3 | /api/v1/views/places_reviews.py | UTF-8 | 3,291 | 2.53125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python3
""" This module handles all default RESTful API actions """
from flask import abort, jsonify, request
from models import storage
from models.base_model import *
from models.review import Review
from models.engine.db_storage import DBStorage
from api.v1.views import app_views
@app_views.route('/plac... | true |
afd5e81f1590e2b0485161efe21fd7149348e7bd | saumiJ/hydbedscraper | /src/hydbedscraper/parsers/pune.py | UTF-8 | 5,673 | 2.765625 | 3 | [
"MIT"
] | permissive | import re
from collections import defaultdict
from typing import List, Union, Dict
from hydbedscraper.parsers.helpers.labels import Label
from hydbedscraper.types import t_BeautifulSoup, t_Tag
MSG_LAYOUT_CHANGED = "layout changed, investigate"
NOT_AVAILABLE = "NA"
def _parse_first_string_from_cell(cell: t_Tag) -> ... | true |
dbf49e4667e8799ada11afee824dcb78baa071c9 | ponchoinc/wallace | /wallace/db/pg/table.py | UTF-8 | 2,910 | 2.53125 | 3 | [
"BSD-3-Clause",
"Python-2.0"
] | permissive | from wallace.config import GetDBConn
def escapes(**kwargs):
columns, placeholders, values = [], [], []
for key, val in kwargs.iteritems():
columns.append(key)
placeholders.append('%s')
values.append(val)
return columns, placeholders, tuple(values)
def postgres_escape(**kwargs):
... | true |
38cd7d98db9cc7691206df1a96ce94483b02f56f | JCP1014/raspberry_mpu9250 | /MAG/mag.py | UTF-8 | 1,650 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import smbus
import math
import time
# Register
power_mgmt_1 = 0x6b
power_mgmt_2 = 0x6c
def read_byte(reg):
return bus.read_byte_data(address, reg)
def read_word(reg):
h = bus.read_byte_data(address, reg)
l = bus.read_byte_data(address, reg+1)
value = (h << 8) + l
return valu... | true |
94819255b3e6ee794b0a1e550612e3f79397d8cb | iCodeIN/cocass | /verify/call/call.py | UTF-8 | 143 | 2.59375 | 3 | [] | no_license | def expect(*args):
ret = ""
for i in range(1, 9):
ret += "x{} = {}\n".format(i, i)
return (0, ret, "")
data = [
[],
]
| true |
f95f4947fcd3b21503c2b000e87154bb7036dd90 | dimritium/Code | /cpp/208A.py | UTF-8 | 96 | 2.6875 | 3 | [] | no_license | s = str(input())
s = list(s.split('WUB'))
s = list(filter(lambda x:x!='',s))
print (" ".join(s)) | true |
d068b655abc1f93d5b3226c90a4cf9512c6f6421 | alastairrushworth/inspectpd | /inspectpd/inspect/inspect_types.py | UTF-8 | 1,446 | 3.25 | 3 | [] | no_license | import pandas as pd
import numpy as np
from inspectpd.inspect_object.inspect_object import inspect_object
# inspect_types
def inspect_types(df) :
'''
Summary and comparison of numeric columns
Parameters
----------
df: A pandas dataframe.
Returns
----------
A pandas dataframe with colum... | true |
3645b5a5ce223a71d748e282a38cb8ea4a50e17e | liuyuzhou/databasesourcecode | /chapter7/update_exp_1.py | UTF-8 | 1,357 | 3.1875 | 3 | [] | no_license | import pymongo
def get_col():
"""
取得指定集合
:return: 指定集合
"""
# mongo client
mongo_client = pymongo.MongoClient("mongodb://localhost:27017/")
# 数据库连接,存在mongo_use则直接连接,不存在则创建
mongo_conn = mongo_client["mongo_use"]
# 集合获取,存在python_class集合则直接返回,不存在则创建
mongo_col = mongo_c... | true |
829af77e09059059388441c171ba72a0370c7481 | abjacs/trackr | /trackr.py | UTF-8 | 1,345 | 2.703125 | 3 | [] | no_license | import os
import datetime
import pickle
from inet import Inet
def setup():
print "Gathering router MAC address"
router_mac_address = Inet.get_router_mac_addy()
#persist to current user directory as hidden file
home = os.getenv("HOME")
filename = ".trackr"
filename = os.path.join(home, filename)
#check if... | true |
9575c388175db4bb65678c3853ca3efaead55e0f | mikegw/project_euler | /40.py | UTF-8 | 353 | 2.921875 | 3 | [] | no_license | def brute():
prod = 1
count = 0
n = 1
for i in range(1,1000000):
s = str(i)
for j in s:
count += 1
if count == n:
prod *= int(j)
print(n)
n = 10*n
if n == 10000000:
print(prod)
... | true |
2d051c39c5b7b2ffddbda35454284e45166f01c5 | acrowise/hadoop-data-analysis | /Code/Hadoop/mapper_twitter.py | UTF-8 | 1,834 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import nltk
import string
import re
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem.porter import PorterStemmer
topWords = ["blockchain", "bitcoin", "crypto", "ico", "hyperledg", "join", "cryptocurr", "token", "ethereum", "ether", "btc", "new", "w... | true |
f1680f2b34005b2c10a020ff0a95ac7a5cf285cd | abdyek/Solution-For-ProjectEuler | /002/solution.py | UTF-8 | 148 | 3.171875 | 3 | [] | no_license | sumOfEven = 0
small = 1
big = 2
while(big<4000000):
if(big%2==0):
sumOfEven += big
big, small = small + big, big
print(sumOfEven)
| true |
49312ebe6bb16a992bcdc5f6ffbd9f020f58eae9 | grubini-learning/mypyquarrels | /dag/test.py | UTF-8 | 3,368 | 3.140625 | 3 | [] | no_license | # attempt 3
from enum import Enum
class State(Enum):
UNVISITED = 1
PASSING = 2
VISITED = 3
class Graph:
def __init__(self, vertices):
self.directions = {node + 1: [] for node in range(vertices)}
self.vertices = vertices
self.stack = []
def add_edge(self, origin, destina... | true |
02261ef9b904d5dcbdd0ac5f175a1a0216cb2edc | Rockforge/python_training | /quiz4.py | UTF-8 | 202 | 3.65625 | 4 | [] | no_license | # quiz4.py
# make a program that chhanges all the elenents of heroes to upper case
heroes = ['Batman', 'Darna', 'Ironman', 'Kardo Dalisay']
heroes_upper = [x.upper() for x in heroes]
print(heroes_upper)
| true |
0dabe65067e714c351ad916961edc6fdbb9c22bb | esv90/DNN | /ann/loss_functions.py | UTF-8 | 1,997 | 3.421875 | 3 | [] | no_license | from sklearn.metrics import mean_absolute_error, mean_squared_error
import numpy as np
def is_loss_function(loss_function: str) -> bool:
"""
Checks if the provided loss function is a valid one
:param loss_function: string with the name of the loss function
:return: bool with true if the loss f... | true |
ac0a7a4c072107046ce6883c99de4e3e25f30437 | venkateshviru/vowel | /vowel.py | UTF-8 | 326 | 3.40625 | 3 | [] | no_license | string= str(input())
if string>='a' and string<='z' or string>='A' and string<='Z':
if string=='a' or string=='e' or string=='i' or string=='o' or string=='u' or string=='A' or string=='E' or string=='I' or string=='O' or string=='U':
print("vowel")
else:
print("consonant")
else:
print("inva... | true |
45300d0331135212e74556aa9e1b1c7e7f5d046e | cchalc/lendingclubscoringdbx | /lendingclub_scoring/common.py | UTF-8 | 2,247 | 2.734375 | 3 | [] | no_license | import json
from abc import ABC, abstractmethod
from argparse import ArgumentParser
from logging import Logger
from typing import Dict, Any
from pyspark.sql import SparkSession
# abstract class for jobs
class Job(ABC):
@abstractmethod
def init_adapter(self):
pass
def __init__(self, spark=None, ... | true |
0a46a3c463692d0061cc82a4d16c90411cfd0436 | wenlongx/CS249 | /generate_roc.py | UTF-8 | 14,251 | 2.734375 | 3 | [] | no_license | """
python generate_roc.py --train=quora-insincere-questions-classification/train_average.hdf5 --targets=quora-insincere-questions-classification/train_targets.csv --model=cnn1d --embedding=elmo --model_path=elmo_pad/cnn1d/cnn1d_4999.pt
"""
import torch
import torch.nn as nn
import torch.utils.data as data
from torch... | true |
34de6cf3f098bcc4c8b758efec681e82ff72f24e | heliy/algorithms | /algorithms/arithmetic/average.py | UTF-8 | 463 | 3.046875 | 3 | [] | no_license | # coding: UTF-8
import numpy as np
class RobbinsMonro(object):
def __init__(self, dim):
self.n = 0
self.dim = dim
self.ave = np.zeros((dim, 1))
def getAve(self):
return self.ave
def getNum(self):
return self.n
def add(self, l):
a = np.array(l)
... | true |
6fdc70c530dabb7c0ed7d04d5cf53f3c8ab3a58f | JeanPauloGarcia/Python-Exercicios | /Ex052.py | UTF-8 | 187 | 3.84375 | 4 | [
"MIT"
] | permissive | for c in range(10):
n = int(input('Digite um número: '))
list = [1, 2, 3, 5, 7, 9]
if n%2!=0 and n%3!=0 and n%5!=0 and n%7!=0 and n%9!=0 or n in list:
print('Primo')
| true |
f1b1f769345e2df18788a8d042112959a2820ce9 | rajababulukka/PythonPrograms | /word_cloud.py | UTF-8 | 667 | 3.921875 | 4 | [] | no_license | def count_words(string):
punctuation = {',':True,'.':True,':':True,' ':True,'!':True,'?':True,';':True,'-':True}
word_to_count={}
first_index=0
for index in range(len(string)):
if string[index] in punctuation:
word=string[first_index:index].lower()
#print("Wo... | true |
637966390d2df38b467822e814fb21c8afae3e5a | yanghuan1987/MyWorld | /python/BackupFiles.py | UTF-8 | 1,382 | 3.203125 | 3 | [] | no_license | # !C:\Users\Administrator\PycharmProjects\untitled
# FileName:BackupFiles.py
import os
import time
# 1.The files and directories to be backed up are specified in a list.
source = [r'D:\PMS-本地结构备份', r'D:\CMS设计文档']
# 2.The backup must be stored in a main backup directory
target_dir = r'D:\数据zip备份'
# 3.The files are b... | true |
fd1d73e6fb85c5cd9e8ce17ae03e4bffe702704d | Bernardo-Favoreto/aind-adversarial-agent-project | /my_custom_player.py | UTF-8 | 7,935 | 3.3125 | 3 | [] | no_license | from sample_players import DataPlayer
import random, math, copy
class CustomPlayer(DataPlayer):
""" Implement your own agent to play knight's Isolation
The get_action() method is the only required method for this project.
You can modify the interface for get_action by adding named parameters
with defa... | true |
e7dff61a491024bb5f029e5a292e25c63a76a79b | yangleiqing0/MyMongoTest | /common/get_time_number.py | UTF-8 | 419 | 3.21875 | 3 | [] | no_license | from datetime import datetime
def get_num():
num = 1
while 1:
if num < 10:
n = '00{}'.format(num)
elif num < 100:
n = '0{}'.format(num)
else:
n = str(num)
yield n
num += 1
def get_number(num):
timestr = datetime.now().strftime(... | true |
5be75856ebf3cccb75e63fb16f807f4982758828 | LEEYEONSU00/day4 | /fuction2.py | UTF-8 | 405 | 4.03125 | 4 | [] | no_license | # def sum(num1, num2):
# print("입력받은 숫자 2개", num1, num2)
# return num1+num2
# num1 = 10
# num2 = 20
# result = sum(1,2) + sum(num1, num2) #함수의 합도 가능
# print(result)
def cart(fruits):
print("장바구니 안에 다음과 같은 과일이 있습니다.")
for fruit in fruits:
print(fruit)
fruits = ['apple', 'kiwi', 'grape', ... | true |
104e2470e0745ae21d26787683db520ba1670d13 | dingweihua/algorithm | /quicksort/quicksort.py | UTF-8 | 1,737 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: 布丁(dingweihuaic@126.com)
#
# Created: 2018/1/2 下午2:13
import time
from random import randint
def quicksort1(alist):
"""
快排算法1
:param alist:
:return:
"""
if len(alist) <= 1:
return alist
pivot = alist[0]
larger_list = []... | true |
f8a5c70e3201cc72c01f3715401cdec980513ff1 | Krisz2750/first_project | /ciklus_3.py | UTF-8 | 348 | 3.28125 | 3 | [] | no_license | # i = 1
# k = 2
# l = 1
# while k <= 12:
# l = k % 2
# if l == 0:
# i = i * 3
# print(str(k) + ".:",i)
# else:
# print(str(k) + ".:", i)
# k=k+1
szoveg = " HELLO VILAG"
i = len(szoveg)
k = 0
while k < i:
print(szoveg[k])
k += 1
#########################################... | true |
cd0baf94fc3f1b02c88215fadc91c4fbb04ce780 | Saiyam539/GeeksForGeeks-Python-Practice-Problem | /program_2.py | UTF-8 | 728 | 4.6875 | 5 | [] | no_license | # This program will take three diferent inputs from the user and make a list
# of all three inputs and then replace last and first element of the list.
def exchange_elements():
input_1 = input("Enter the first element here:- ")
input_2 = input('Enter the second element here:- ')
input_3 = input("Enter the ... | true |
b6e7a8657c908ac96e83237a84b38b6d106f24a7 | jkholodnov/prediction | /Scrape_ESPN/test_Scraper.py | UTF-8 | 9,954 | 2.828125 | 3 | [] | no_license | import urllib.request
import urllib.error
import sys
from queue import *
from threading import Thread
import bs4
from bs4 import BeautifulSoup
import sqlite3 as lite
from math import *
import time
import re
from socket import timeout
import errno
Queries = Queue() # The result of the algorithm onto the queue items
... | true |
b55c1a4f6121e1a39ea5e098ee7748083f98fb77 | ViniciusDamiani/infosatc-lp-avaliativo-07 | /ExemploLambda.py | UTF-8 | 1,215 | 4.59375 | 5 | [] | no_license | #Função normal
def quadrado (x):
return x **2
print(quadrado(6))
#Função Lambda
(lambda x: x**2) (6)
#Atribuindo a uma variavel
funcLambda = (lambda x: x**2)
print(funcLambda(4))
#Erro pois nome é String e chamei um número (Inteiro)
#nome='Vinicius'
#nome(5)
#COMO USAR A FUNÇÃO LAMBDA
#Função lambda dentro da ... | true |
c36bd04dc5009bb8524f76e56093a6274cbff1aa | jeopardize/AI-Storage | /AI.Learning/LearnPyTorch/PyTorchRNN1.py | UTF-8 | 3,557 | 2.921875 | 3 | [] | no_license | import torch as t
import torch.nn as nn
# 关于RNN用法之后讲解,这里讲API格式
# 连续LSTM层
# batch size为3,序列长度为2,序列每个元素4维
input = t.randn(2,3,4)
# 输入4维,隐藏层3到1
lstm = nn.LSTM(4,3,1)
# batch size为3,3个隐藏元
h0 = t.randn(1,3,3)
c0 = t.randn(1,3,3)
out,hn = lstm(input,(h0,c0))
# 单个LSTM层
input = t.randn(2, 3, 4)
# 一个LSTMCell对应的层数只能是一层
lstm =... | true |
347aad46a84d42e325dfee461c3feaeae265e11f | nmap1208/s14 | /day4/d3_last.py | UTF-8 | 253 | 2.765625 | 3 | [] | no_license | #Auther nmap
# def func_name(arg1,arg2,arg3,*args,**kargs):
# print(arg1,arg2,arg3,args,kargs)
# func_name(4,5,43,99,33,11,name='nmap')
# # func_name(5,3)
# # func_name(4,arg3=5,arg1=9)
def test1():
pass
def test2():
pass
test1()
test2()
| true |
bfe71e84e9b0bcfebdf9ecabfcbd1d27506f29cd | jasonkhs192/PythonPractice | /ImageCompilerGUI.py | UTF-8 | 5,537 | 3.03125 | 3 | [] | no_license | from tkinter import *
import tkinter.ttk as ttk
from tkinter import filedialog
from tkinter import messagebox as msgbox
from PIL import Image
import os
root = Tk()
root.title("Test")
root.resizable(False, False)
#파일 추가 버튼 기능
def add_file():
files = filedialog.askopenfilenames(title="Select File", filetypes=(("PNG... | true |
fde180cde46c6a62b7f5c9bd742a58320978a112 | MunteanuAndreiStefan/Homeworks-Computer-Calculus | /Tema6.py | UTF-8 | 1,453 | 2.9375 | 3 | [
"MIT"
] | permissive | from tkinter import *
import numpy as np
global h
h = 0.00000001
eps = np.finfo(float).eps
j=[42.0, -55.0 , -42.0 ,49.0 , -6.0]
a = np.array(j).astype(int)
A = max(a)
R = (a[0] + A) / a[0]
print(a)
def Pd2(a, x):
return P(np.polyder(a, 2), x)
def Pd(a, x):
return P(np.polyder(a), x)
def P(vec, x):
re... | true |
10e0883ee4e6810a741da4550e606dc292d58f05 | Godsinred/FortniteCompetitionDB | /populate_csv.py | UTF-8 | 2,909 | 2.90625 | 3 | [] | no_license | import random as r
import csv
################################################
#
# Do Not run.
#
################################################
def main():
area_code = ["714", "310", "323", "562", "909"]
user_id = r.randint(100000, 999999)
sex = ["M", "F"]
age = 0
full_name = ''
... | true |
42eefcb75288a921f494d78668d1b0e099bec02b | SuperTapood/MachineLearningResources | /TensorFlow/MNISTClassification.py | UTF-8 | 2,901 | 3.125 | 3 | [] | no_license | # this is the hello world of ML
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# read the data set and normalize it
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# outline the model
# 784 x 50 x 50 x 10
inputSize = 784
outputSize = 10
hiddenLa... | true |
8f7318e38e1dc6bfcb66abc7f3d76553cbc5e2fe | feralieva/HackBulgaria-Week0 | /max-diff/solution.py | UTF-8 | 491 | 3.6875 | 4 | [] | no_license | def biggest_difference(arr):
array = []
i = 1
while i <= len(arr) - 1:
array = array + [arr[i]]
i = i + 1
min = arr[0] - array[0]
for iter in arr:
for item in array:
if (iter - item) < min:
min = iter - item
if item - iter < min:
min = item - iter
return min
def main():
print(biggest_differ... | true |
ffe44e98ac273a3a926d73b4d735ce72e8cd73fa | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/12/31/20.py | UTF-8 | 1,723 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
class Node:
def __init__(self, label):
self.label = label
self.mark = False
self.input = 0
self.e = []
def __str__(self):
return "Node({},mark={},num={},edges={}]".format(self.label,self.mark,self.num,self.e)
class G:
# It has array V of Nodes
... | true |
10c437c2d1d06d28d4408c2738c75305b36b8005 | xiangfuli/leetcode-py | /tests/string/medium/test_Longest_Substring_Without_Repeating_Characters.py | UTF-8 | 524 | 3.53125 | 4 | [] | no_license | from solutions.string.medium.Longest_Substring_Without_Repeating_Characters import Solution
def test():
solution = Solution()
assert solution.lengthOfLongestSubstring("abcabcbb").__eq__(3)
assert solution.lengthOfLongestSubstring("").__eq__(0)
assert solution.lengthOfLongestSubstring("adawswwww").__eq... | true |
8e880942589f1ba4f2959a10d3dcfc683a691e8e | popov95s/ProjectEuler | /Project Euler/euler23.py | UTF-8 | 650 | 3.34375 | 3 | [] | no_license | import math
def divisorGenerator(n):
large_divisors = []
for i in xrange(1, int(math.sqrt(n) + 1)):
if n % i == 0:
yield i
if i*i != n:
large_divisors.append(n / i)
for divisor in reversed(large_divisors):
yield divisor
def getSum(numbers):
sum=0
... | true |
f674e45d3233643d3b9d382faff21906b839f0c8 | marcuspepperl/2020-Rice-Datathon | /survey.py | UTF-8 | 449 | 3.484375 | 3 | [] | no_license | def survey():
f = open("Questions.txt", "r")
questions = []
f1 = f.read().splitlines()
results = []
print("Welcome to the marriage counselling survey! For each question in this survey, enter an integer between 0 and 4, inclusive. 0 is Almost Always, and 4 is Almost Never")
for i in range... | true |
4cc25953906749041e70bf7777219ce77c88f3f6 | standbyphase/docshop-django | /docshop/tests/test_type.py | UTF-8 | 1,210 | 2.6875 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from docshop.settings import BASE_DIR
from pdfshop.models import PDF
from pdfshop.models import Text
from pdfshop.views import mime_type
class MimeTestCase(TestCase):
def setUp(self):
"""Setup test case"""
PDF.objects.create(name="PDF1", path=BASE_DIR+"/tests/fil... | true |
bc55c3b2c803545a32fc29351cb1664d65e3b01a | takecian/ProgrammingStudyLog | /LeetCode/100/159.py | UTF-8 | 733 | 2.859375 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int:
next_start = (None, None)
l = 0
in_sub = set()
ans = 0
for i in range(len(s)):
if s[i] in in_sub:
if next_start[0] != s[i]:
next_start = (s[i], i)
... | true |
1f5724e03b81c3084261cd4b3e954b4ebba24ee1 | yuliasemch/RTR105 | /tests_1.py | UTF-8 | 68 | 3.234375 | 3 | [] | no_license | inp=raw_input('Europe floor?')
usf=int(inp)+1
print('US floor',usf)
| true |
2587fdce772c63dcfb118386d18ac0afba03948f | ethanbenshoshan/Ethan_Cyber_Proj | /client.py | UTF-8 | 2,950 | 2.59375 | 3 | [] | no_license | #imports
#
#class communication_client:
#open socket recieve buffer
class File_Manager:
## class _File_Manager:
## def __init__(self, arg):
## self.val = arg
## def __str__(self):
## return repr(self) + self.val
## instance = None
## def __init__(self, arg):
## i... | true |
e0477059d99357ca236228eb4459d878491082d7 | Mkaif-Agb/Pytorch-Codes | /Basic_Neural_Network.py | UTF-8 | 1,924 | 2.90625 | 3 | [] | no_license | import pandas as pd
import torch
df = pd.read_csv('Pytorch-Codes/iris.csv')
df.shape
'''
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(10,7))
fig.tight_layout()
plots = [(0,1),(2,3),(0,2),(1,3)]
colors = ['b', 'r', 'g']
labels = ['Iris setosa','Iris virginica','Iris versicolor']
for i, ax in enumerate(axes.fla... | true |
432d0e6e6d3f5e33480c539a72a0a0509adb0a25 | feadoor/hackerrank | /practice/algorithms/strings/the_love_letter_mystery.py | UTF-8 | 284 | 3.09375 | 3 | [] | no_license | #!/usr/local/bin/pypy3
def distance(s1, s2):
return sum(abs(ord(x) - ord(y)) for x, y in zip(s1, s2))
def reductions(s):
return distance(s, s[::-1]) // 2
def main():
for _ in range(int(input())):
print(reductions(input()))
if __name__ == "__main__":
main() | true |
5178ff77823213cc4c488d80947aeb8e3467a4d7 | greysou1/readabilityindex | /findindex.py | UTF-8 | 2,624 | 3.6875 | 4 | [] | no_license | # coding=UTF8
from helper import syllable_count, sentence_count
#print(syllable_count('Bureaucratic')) # prints "2"
def ARI(text):
"""Automated Readability Index
Designed to gauge the understandability of a text.
The output is an approximate representation of the
U.S grade level needed to comprehen... | true |
d3f76cb700e6a82fef89b7a2a8310d65da075a17 | NikolayVaklinov10/30_Days_of_Code | /Day_1:Data_Types.py | UTF-8 | 307 | 3.6875 | 4 | [] | no_license | i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables.
input_int = int(input())
input_double = float(input())
input_string = str(input())
# Read and save an integer, double, and String to your variables.
print(i+input_int)
print(round(d+input_double))
print(s+input_string)
| true |
40528a6b7c6108b344bd332566f3816c3e0d80d7 | edt-yxz-zzd/python3_src | /script/char/chars_of/非对称繁简字/all_chars_has_multiST_variants.py | UTF-8 | 509 | 2.78125 | 3 | [] | no_license |
from simplified2multi_traditionals_obj import simplified2multi_traditionals
from traditional2multi_simplifieds_obj import traditional2multi_simplifieds
from itertools import chain
def get_all_chars(d):
for k, v in d.items():
yield from k
yield from v
assert len(k) == 1
ds = [simplified2mu... | true |
331c4cbc3fa3e934d5b8ee87abc8c151526fabe3 | Astharen/ProjectEuler | /5.py | UTF-8 | 1,109 | 3.53125 | 4 | [] | no_license | import numpy as np
def divisible_by_all_num_until_n(num, n):
divisible_by = 0
divisible = False
for i in range(2, n+1):
if num%i==0:
divisible_by += 1
else:
break
if divisible_by==(n-1):
divisible = True
return divisible
def smallest_positive_num_e... | true |
38d4f7446d83ae53ac5e6f5454c01df6d3d1e2d1 | ztzztztt/spliter | /cifar10.py | UTF-8 | 2,812 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Author : zhoutao
@License : (C) Copyright 2013-2021, China University of Petroleum
@Contact : zhoutao@s.upc.edu.cn
@Software: PyCharm
@File : cifar10
@Time : 2021/09/10 14:58
@Desc : cifar10数据集解压转换成图片
"""
import os
import cv2
import torchvision
import numpy... | true |
6f6281928e6f9fedfdf6c6172ca6dc252a78ff0f | dianshan14/OR_research-bike | /crawler_code/bike.py | UTF-8 | 642 | 2.5625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import time
texts = requests.get("http://data.tainan.gov.tw/dataset/t-bike")
text = BeautifulSoup(texts.text, "html.parser")
text = text.find_all("ul", class_="dropdown-menu")[2].find_all("a")[1]
print(text.get("href"))
texts = requests.get(text.get("href"))
texts = te... | true |
1da9822b308202c35e246aaefd3bad1d5ee34564 | rakshitcgupta/IoT-SPIT | /Task-5/GUI.py | UTF-8 | 2,622 | 3.0625 | 3 | [] | no_license | """
Download tkinter for python using sudo apt-get install python3-tk
"""
from tkinter import *
from tkinter import filedialog
myString = "" #The Message String goes in this variable
dirname = "" #The directory goes here
def show_entry_fields():
print("Message: %s\n" % (e1.get("1.0",END)))
global myStri... | true |
e203790ec9221af85a7c5a34bd3aecb6cfcf08cd | MalAstronomy/Thesis | /code/histograms.py | UTF-8 | 558 | 2.59375 | 3 | [] | no_license | import numpy as np
import h5py
import matplotlib.pyplot as plt
size_ratio=[]
mass_ratio=[]
for i in [19,25,26,27,28]:
f= h5py.File('/Users/malavikavijayendravasist/Desktop/mt2/mergers_identified/mergers_'+str(i)+'.hdf5', 'r')
size_ratio=np.append(size_ratio,f.get('Size Ratio').value)
mass_ratio=np.appe... | true |
496f1fc63cec83177a4ac181ef5efc3573a56a04 | DoctorLai/ACM | /binarysearch/Maximum-Non-Adjacent-Tree-Sum/Maximum-Non-Adjacent-Tree-Sum.py | UTF-8 | 785 | 3.15625 | 3 | [] | no_license | # https://helloacm.com/teaching-kids-programming-dynamic-programming-algorithms-to-compute-the-maximum-non-adjacent-tree-sum/
# https://binarysearch.com/problems/Maximum-Non-Adjacent-Tree-Sum
# MEDIUM, DP
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left =... | true |