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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1d48a81b37ff9e19b250447e282675092e8ecb10 | Python | fparedesg/RecipeProject | /TeamLarry/recipeBuilder.py | UTF-8 | 7,151 | 2.71875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib2
import json
import pymongo
import string
import re
READ_ME = "This script doesn't do anything anymore. This was used to build our initial knowledge base."
#this method is used to retrieve the information about the food name,quantity and the direction.
buildCountry = ["mexi... | true |
8d64d1d87cdb0c5cfcb69bec1ce2d7c8e9969a1a | Python | alaxion/Exercises | /LeetCode/06/lc697.py | UTF-8 | 466 | 3.375 | 3 | [
"MIT"
] | permissive | # lc697.py
# LeetCode 697. Degree of an Array `E`
# acc | 100% | 41'
# A~0g29
class Solution:
def findShortestSubArray(self, nums: List[int]) -> int:
if len(nums) == len(set(nums)):
return 1
count = Counter(nums)
deg = max(count.values())
ans = len(nums)
for k,... | true |
101bda86635e6e2ccaea43eb7f64cdfb75803a19 | Python | antonio0219/rpgmap | /player.py | UTF-8 | 3,129 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 17:03:38 2020
@author: anton
"""
import pygame
import pygame.time as GAME_TIME
class player:
def __init__(self):
#self.x = xo Más adelante se podrá definir la posición.
#self.y = yo
self.height = 75
self.vel = 5 #... | true |
899b79055b1b4c35052df2ba03e7629bdf92fdeb | Python | ander-garcia/theegg_ai | /tarea_44/sumatorio_test.py | UTF-8 | 511 | 2.953125 | 3 | [] | no_license | import pytest
from sumatorio import Sumatorio
def test_suma_lineal():
sumatorio = Sumatorio()
assert sumatorio.suma_lineal(0) == 0
assert sumatorio.suma_lineal(1) == 1
assert sumatorio.suma_lineal(10) == 55
assert sumatorio.suma_lineal(100) == 5050
def test_suma_constante():
sumatorio = Suma... | true |
028b5a3d52a678e241e30337d841aff39dad6cd5 | Python | RohanRadia/BaguetteBot | /bot/cogs/owner.py | UTF-8 | 1,626 | 2.578125 | 3 | [
"MIT"
] | permissive | from bot import logger
from discord.ext import commands
class Owners(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=("sd", "shutdown", "lo"))
@commands.is_owner()
async def logout(self, ctx):
"""Logout of bot"""
await self.bot.http_session.cl... | true |
35e8066ee7f0e0139d3f42a0081d8daf71e77f09 | Python | bopopescu/icsw | /initat/cluster/sign_data.py | UTF-8 | 1,698 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python-init
# -*- coding: utf-8 -*-
import argparse
import base64
from M2Crypto import EVP
from lxml import etree
from lxml.builder import E
PRIVATE_KEY = """
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA4p6JXKFMDbUpe45HhGZs/fBsQQki80YqQzgeRB42f0waKKqT
oia929RcMil1g4JRmpOu6IAWaKTthuueIKjeB1bnXYZhHKwod4... | true |
a53c89f8d9951191dd50f053be791d80815e4c5a | Python | seanlee10/gym | /examples/agents/ivv.py | UTF-8 | 6,847 | 2.78125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import gcf
import math
from collections import deque
from random import randint
import os
import imageio
from scipy.misc import imsave
import random
import itertools
from os import path
from sklearn.model_selection import trai... | true |
6a0b0693eb8b00c8c05cc02962325f32f18a6c74 | Python | lxieyang/python-tutorial | /Functional Programming/Sorted.py | UTF-8 | 856 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
print '------------'
print 'Using sorted'
print '------------'
L = [36, 5, 12, 9, 21]
print 'Original:', L
print 'Sorted:', sorted(L)
print '\n------------'
print 'Reverse sort'
print '------------'
def reverse_cmp(x, y):
if x > y:
return -1
elif x == y:
... | true |
910fbc78f4f5cbe31dd875740b393c6f6e0ff7ef | Python | GabrielAmare/TextEngine | /item_engine/utils.py | UTF-8 | 1,897 | 3.265625 | 3 | [
"MIT"
] | permissive | from collections import deque
from typing import TypeVar, Generic, Deque, Iterator, Dict, Tuple, Iterable
K = TypeVar("K")
__all__ = ["Pile", "PositionRegister", "SetList"]
class SetList(list, Generic[K]):
def append(self, object: K) -> None:
if object not in self:
super().append(object)
... | true |
c2168428d799cee8e0542f3c17871b065795f6a0 | Python | MalseMus/Arena-shooter | /src/entities/entity.py | UTF-8 | 1,260 | 3.1875 | 3 | [] | no_license | import pygame
class Entity:
def __init__(self, x, y, w, h, c, faction = 0, hp = 0):
self.x = x
self.y = y
self.w = w
self.h = h
self.c = c
self.faction = faction
self.hp = hp
self.alive = True
def update(self, entities):
raise Excepti... | true |
30227b0696198cfe571c1fd4cd6d6075d736a559 | Python | kbespalov/nir | /coordinator.py | UTF-8 | 1,402 | 2.53125 | 3 | [] | no_license | import argparse
import igraph
import networkx as nx
import os
import worker
from multiprocessing import Process, Queue
def graphs_flow(dirname):
g_files = [str(z) + ".s6" for z in
sorted([int(x.split('.')[0]) for x in os.listdir(dirname)])]
for f in g_files:
with open(os.path.join(dirna... | true |
af40b4ef70433f0866f19d2697d2ece466a81c31 | Python | Josverl/MicroPython-Bootcamp | /Demos/Demo-2.2 Python 3/boot.py | UTF-8 | 543 | 3.015625 | 3 | [
"MIT"
] | permissive | # boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
print("-- performing boot --")
# acces the (ESP32) hardware functionality using the machine library
import machine
# read the
reset , wake = machine.wake_reason()
#as an exaple it is possible to determine how/why the microcontrolle... | true |
c8ab0635938e90f86ee28be30425c147b5db0098 | Python | samims/restapi-udemy | /status/api/shell_examples.py | UTF-8 | 1,325 | 2.734375 | 3 | [] | no_license | """
Just Notes
"""
from django.utils.six import BytesIO
from rest_framework.parsers import JSONParser
from rest_framework.renderers import JSONRenderer
from status.api.serializers import StatusSerializer
from status.models import Status
obj = Status.objects.first()
serializer = StatusSerializer(obj)
print(serializer... | true |
2bd9415d4e34bf0041a398defe3e9a5d74395b5e | Python | rumit91/4240CRM | /System/Entities/Person.py | UTF-8 | 3,679 | 2.921875 | 3 | [] | no_license | __author__ = 'Timur'
import xml.etree.ElementTree as ET
class Person:
def __init__(self):
self.person_id = ''
self.first_name = ''
self.last_name = ''
self.other_name = ''
self.birthday = ''
self.gender = ''
self.emails = []
self.phones = []
... | true |
d5d0e70f7c0f99a3234915f4c5d62c7cc78b42a1 | Python | P450/MIT-6.0001x | /Notes/Lecture 8 - Exceptions and Assertions/exceptions.py | UTF-8 | 949 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 16 12:57:51 2018
@author: Jae You
"""
data = []
file_name = input("Provide a name of a file of data: ")
try:
fh = open(file_name, 'r')
except IOError:
print('cannot open', file_name)
else:
for line in fh:
if line != '\n':
addIt = line[:-1... | true |
4684dc1c594a7ff5cc782158e09825d7c1164c65 | Python | hongyeon-kyeong/Algorithm | /Greedy/무지의_먹방_라이브.py | UTF-8 | 1,069 | 3.4375 | 3 | [] | no_license | '''
# 내 풀이
def find_food(food_times,i,n) :
count2 = 0
if i == n :
i = 0
while food_times[i] == 0 :
i += 1
count2 += 1
#print('i', i , 'count2', count2)
if count2 == n :
return -2
if i == n :
i = 0
return i
def solution(food_times, k) :
food = -1
count = 0
n = len(food_times)
while count < k... | true |
f48b0f490a4e0368ccc33911575cc6310ce82ae8 | Python | idhant96/diginvoice | /core/utils/utils.py | UTF-8 | 3,798 | 3.09375 | 3 | [
"MIT"
] | permissive | import json
import re
class Utils(object):
@classmethod
def formatter(cls, word):
word = cls.cleaner(word)
word = word.replace(' ', '')
word = word.replace('.', '')
word = word.replace('!', '')
return word
@classmethod
def get_true_gst(cls, company):
d... | true |
97d3d71f261d6d40915d9c709d71904a15772b3f | Python | wdkang123/PythonOffice | /34-html_read/html_read.py | UTF-8 | 386 | 2.90625 | 3 | [
"MIT"
] | permissive | import requests
url = "https://www.baidu.com"
# 通过get请求
r = requests.get(url)
# 输出服务器状态码
print(r.status_code)
# 输出返回的文本
with open("baidu.html", "w", encoding="utf-8") as f:
f.write(r.text)
print("===================")
# 通过post方法
data = {
"username": "123",
"password": "123"
}
r = requests.post(url, data=... | true |
f15cd474919e6851f54b465b0bb8d299c3114321 | Python | Aliendood/work-training | /week1/day2-intro_python/lcm.py | UTF-8 | 325 | 3.515625 | 4 | [] | no_license | """ find least common multiple """
from divisors import factors
def lcm(n,i):
f_num = factors(n*i)
for k in f_num:
if k >= max(n,i) and k % i == 0 and k % n == 0:
return k
if __name__ == "__main__":
x,y = int(input("enter first number ")),int(input("enter second number "))
print(lcm(x... | true |
2a292e5b7663d7c045e06efd05096649b0cb4974 | Python | ngc92/DeepReinforcementLearning | /tfdeeprl/agent.py | UTF-8 | 2,920 | 2.5625 | 3 | [] | no_license | import copy
import tempfile
from typing import Tuple, Dict
import gym
import gym.spaces
import tensorflow as tf
from .builder import AgentBuilder
from .helpers.rollout_ops import rollout
class Agent:
"""
This is a much simplified version of the tf.estimator.Estimator for reinforcement
learning gym envir... | true |
01244ed4fb575353987340d5fa07ebe5a5f0c2b1 | Python | Profix11pppo/Python_DONSTU | /Python Пройденное/second.py | UTF-8 | 545 | 3.578125 | 4 | [] | no_license | import math
while True:
a=input('Введите выражение ')
if '+' in a:
a=a.split('+')
first=a[0]
ch=int(first)
second=a[1]
nh=int(second)
print(ch+nh)
elif '*' in a:
a=a.split('*')
first=a[0]
ch=int(first)
second=a[1]
nh=int(second)
print(ch*nh)
elif '/' in a:
a=a.split('/')
... | true |
a99e3b2e307710ab9fa1cf8a2d9072fe5adbd733 | Python | asgards1990/webmining2013 | /crawling/scripts/script_languages.py | UTF-8 | 16,358 | 2.625 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
# THIS SCRIPT FILLS ALL LANGUAGE ENTRIES IN THE DATABASE
from BeautifulSoup import BeautifulSoup
from cinema.models import *
import re
input = """
<table class="splash">
<tr>
<td><a href="/language/ar">Arabic</a></td>
<td><a href="/language/bg">Bulgarian</a></td>
<td><a href="/language/zh">Ch... | true |
ba34563a1383be246d455d0a35bf150f1397cbce | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2136/60624/275974.py | UTF-8 | 381 | 3.078125 | 3 | [] | no_license | import math
def func23():
n = int(input())
n_max = int(math.floor(math.log(n+1)/math.log(2)))-1
flag = True
for i in range(n_max,1,-1):
j = int(max(math.floor(math.pow(n,1/i)),2))
k = (pow(j,i+1)-1)/(j-1)
if abs(n-k) < 0.001:
flag = False
print(j)
... | true |
1d0ddf091a5eb176753d15066335642f6733adc5 | Python | zjwyx/python | /day24/1.内容回顾.py | UTF-8 | 1,672 | 4.1875 | 4 | [] | no_license |
# 组合:一个类的对象作为另一个类对象的属性
from math import pi
class Circle:
def __init__(self,r):
self.r = r
def area(self):
return pi*self.r*self.r
def perimeter(self):
return 2*pi*self.r
class Ring:
# 一个类的对象成为另一个类对象的属性
# Circle() 实例化对象
def __init__(self,outer_r,inner_r):
oute... | true |
9b0746328bbcd148b9c40443d8fda91a6b281a5b | Python | rdonalpaul/music-quiz-website | /comments.py | UTF-8 | 2,012 | 2.671875 | 3 | [] | no_license | #!/usr/local/bin/python3
from cgitb import enable
enable()
def show_comments():
from cgi import FieldStorage
import pymysql as db
from os import environ
user_comments = ''
url = environ.get('SCRIPT_NAME')
try:
connection = db.connect('cs1.ucc.ie','dr13','chujohqu','csdipact2017_dr13'... | true |
59858d9a06ea23292b3c70398f61e892ea088874 | Python | gkeeth/aoc19 | /01/01.py | UTF-8 | 1,298 | 3.625 | 4 | [
"MIT"
] | permissive | #! /usr/bin/env python
from __future__ import print_function
import argparse
def get_module_masses(massfile):
"""Parse input file to get masses of each module.
Input file has the mass of each module on its own line.
Return list of module masses.
"""
module_masses = []
with open(massfile, "r... | true |
2cdb23ae591cc9582dd004632b4ba492b5c2faa1 | Python | Stektpotet/it3105-mcts | /games/nim.py | UTF-8 | 3,403 | 3.671875 | 4 | [] | no_license | from typing import List
import numpy as np
from game import Game
# https://en.wikipedia.org/wiki/Nim
# Nim parameters
# collections/heaps of stones
# Min & Max stones removed
# Simple version of Nim:
# N: number of stones on the board
# K: max number of stones a player can take of the board
# MIN: 1 :: the minimum ... | true |
9bd5fcac0d54c6da1480d77d4b8cf13a082434c2 | Python | ctiede/eccentricity_study_supp | /plot_edot_ldot.py | UTF-8 | 4,535 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import numpy as np
import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import figures as figs
import scipy.signal as sps
plt.rc('font', family='serif')
mpl.rcParams['text.usetex'] = True
red = [237/255, 102/255, 93/255]
blue = [114/255, 158/255, 206/... | true |
45449a02a70ed9a466a2e5b054fe062dccee00e0 | Python | navetal39/Bcloud_Main_Server | /crypto.py | UTF-8 | 1,580 | 3.5625 | 4 | [] | no_license | # Imports: #
from Crypto.Cipher import AES
# Constants for ecryption: #
BLOCK_SIZE = 32
PADD_CHAR = '?'
# Ecryption funcs: #
def encrypt(plaintext):
''' Encrypts the plaintext received.
'''
from crypto_extended import generate_key as KEY
padded_plaintext = padd(plaintext)
encryptor = AES.new(KEY()... | true |
ed562d709f1232f71857ce438b6f8a3a0ab684b2 | Python | shengli881026/python | /test.py | GB18030 | 646 | 3.4375 | 3 | [] | no_license | # -*- coding: cp936 -*-
import sys
print '>>> zhangshl';
abc = '123'+\
'456'+\
'789';
print abc;
#print arr.lenth;
#raw_input û
#raw_input('logding....input....');
#x='foo';sys.stdout.write(x+'\n');
x = 2;
if x==1:
print 'this --1 if';
elif x==2:
print 'thiis--2 if';
#python string ַ
str ="... | true |
649c215a7abc62eb0540b5e9456bade545ea7125 | Python | OrinaOisera/Data_Structures | /main.py | UTF-8 | 1,520 | 3.421875 | 3 | [] | no_license | def two_sum (arr,sum):
x = []
# y = []
# y = arr[0:]
x = arr[0:]
arr.sort()
left = 0
right = len(arr) - 1
while arr[right] > arr[left]:
if arr[right] +arr[left] > sum:
right = right - 1
elif arr[right] +arr[left] < sum:
left = left + 1
el... | true |
42ecd77a7bb4d3e65577093bd41155d923d7e84b | Python | panmpan17/Sushruta | /sushruta/manipulate.py | UTF-8 | 1,079 | 2.984375 | 3 | [] | no_license | import os
from PIL import Image
class Manipulator:
def clamp(num, _min, _max):
if num < _min:
return _min
elif num > _max:
return _max
return num
@classmethod
def get_img_name(cls, file_path):
return ".".join(file_path.split("/")[-1].split(".")[:-1... | true |
23f87a9a9dbde16b297568748a7b888723dfb015 | Python | lsst-sqre/lsst-efd-client | /src/lsst_efd_client/auth_helper.py | UTF-8 | 2,460 | 2.984375 | 3 | [
"MIT"
] | permissive | """Authentication helpers
"""
from urllib.parse import urljoin
import requests
class NotebookAuth:
"""Class to help keep authentication credentials secret.
Credentials can be retrieved either from a service endopint or
from a file on disk. The credential location is checked in that order.
Paramete... | true |
88ece39e62db6d9f299d548784104149fea94a8b | Python | hobama/sensorNetworks-2.4vs868 | /measurementsconverter/latencyconfidence.py | UTF-8 | 2,257 | 3.3125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
get_ipython().run_line_magic('matplotlib', 'inline')
import pandas as pd
import numpy as np
import math
# In[2]:
#2.4 GHz measurements
excel24 = pd.read_csv('./latency24_clean.csv')
excel868 = pd.read_csv('./latency868_clean.csv')
# In[3]:
excel24.head(n=5)
# In[4]:
latency24 =... | true |
aa7b37287ca6585eb19e592507d3e986bc5d106c | Python | misska/shopo | /importers/FlorentinumImporter.py | UTF-8 | 884 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
import urllib2
from bs4 import BeautifulSoup
from Importer import Importer
class FlorentinumImporter(Importer):
name = 'Florentinum'
links = [
'http://www.florentinum.cz/cs/obchody/obchodni-pasaz/',
'http://www.florentinum.cz/cs/obchody/piazza-a-ulice-na-... | true |
009196adeb7311d51d38eda6cb0c0044d3a67dd0 | Python | chunxiao369/chunxiao-code | /python-study/wrapper_test/wrapper_para.py | UTF-8 | 368 | 3 | 3 | [] | no_license | #!/usr/bin/python
import functools
import sys
def trace(log_level):
def impl_f(func):
print(log_level, 'Implementing function: "{}"'.format(func.__name__))
return func
return impl_f
@trace('[INFO]')
def print_msg(msg):
print(msg)
@trace('[DEBUG]')
def assert_(expr):
assert expr
prin... | true |
cdc06143316955ea040a4bc93bacddcaefbf8204 | Python | mfkiwl/pumba_signal_processing | /venv/main.py | UTF-8 | 2,812 | 2.71875 | 3 | [] | no_license | from datetime import datetime
from rtlsdr import RtlSdr
from pylab import *
from matplotlib import pyplot as plt
from scipy import signal
def main():
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S.%f")
print("Current Time =", current_time)
#aquire location
#start calibratio... | true |
de53440c781058a0aa8b9b45277f83ad52d38d2b | Python | richmont/ListaSequencial | /python/exercicio4.py | UTF-8 | 392 | 4.15625 | 4 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python3
# Faça um Programa que peça as 4 notas bimestrais e mostre a média.
def main():
nota1=float(input("Insira a primeira nota "))
nota2=float(input("Insira a segunda nota "))
nota3=float(input("Inira a terceira nota "))
nota4=float(input("Insira a quarta nota "))
media=(nota1+not... | true |
f26b507db320c6affb7cc2c928f82412010143b8 | Python | domingoesteban/robolearn | /robolearn/torch/utils/data_management/simple_replay_buffer.py | UTF-8 | 3,141 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import torch
from robolearn.torch.utils import pytorch_util as ptu
from robolearn.utils.data_management.replay_buffer import ReplayBuffer
class SimpleReplayBuffer(ReplayBuffer):
def __init__(
self, max_size, obs_dim, action_dim,
):
if not max_size > 1:
raise ValueError("Invali... | true |
2df84bb3b1f164c14c683d714faae6a0266a8e6e | Python | sandeepshiven/python-practice | /object oriented programming/attributes_and_class_keyword.py | UTF-8 | 692 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 9 15:07:04 2019
@author: sandeep
"""
class Student(): # object Student
study = "engineering" # common for every Student instance (Class object attribute)
def __init__(self,name,roll,branch):
#attributes
... | true |
30d8ab6ab2dcd5e19d0a0c197ba9d92aec4a30b5 | Python | BradleyTjandra/Deep-Learning | /GAN.py | UTF-8 | 7,527 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import datetime
import os
from IPython import display
from tensorflow.keras import layers
from sklearn.utils import shuffle
#import math
#python "C:\Users\bradley.tjandra\AppData\Local\Continuum\anaconda3\Lib\si... | true |
fa87906779b7e87a810915380dc8cf4a03a4a464 | Python | CHESS-mission/05_FS | /simulators/ADCS/testClientTcp.py | UTF-8 | 1,268 | 2.625 | 3 | [] | no_license | import socket
from packages.package.UART import Uart
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 5005)
messages = [bytearray([0x1F,0x7F,0x80,0x1F,0xFF]),bytearray([0x1F,0x7F,0x00,0x1F,0xFF]),bytearray([0x1F,0x7F,0x80,0x1F,0xFF])]
if __name__ == '__main__':
s.connect(serve... | true |
f82c111280cf3142b1dcbbab8b6ef1abf261ec1c | Python | mrescati1/TENSORFLOW | /Chord.py | UTF-8 | 361 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 16:34:50 2020
@author: micha
"""
from chord import Chord
matrix = [ [0, 5, 6, 4, 7, 4], [5, 0, 5, 4, 6, 5],
[6, 5, 0, 4, 5, 5], [4, 4, 4, 0, 5, 5],
[7, 6, 5, 5, 0, 4], [4, 5, 5, 5, 4, 0]]
names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy"... | true |
453b185b7937f6b2d42d1c896eb4c396ac3b29b1 | Python | MDziwny/django-fsm | /django_fsm/tests/test_integer_field.py | UTF-8 | 1,066 | 2.6875 | 3 | [
"MIT"
] | permissive | from django.db import models
from django.test import TestCase
from django_fsm import FSMIntegerField, TransitionNotAllowed, transition
class BlogPostStateEnum(object):
NEW = 10
PUBLISHED = 20
HIDDEN = 30
class BlogPostWithIntegerField(models.Model):
state = FSMIntegerField(default=BlogPostStateEnum.... | true |
64c52eb4c30778d94b7153d5a1a577ec7f546a73 | Python | smile1973/crawer-practice | /movie_rank.py | UTF-8 | 554 | 3.140625 | 3 | [] | no_license | from bs4 import BeautifulSoup
from pprint import pprint
import requests
r1 = requests.get("https://www.imdb.com/search/title/?groups=top_100")
soup1 = BeautifulSoup(r1.text, "html.parser")
result1 = soup1.find_all(class_ = "lister-item-header")
movie_list = []
for line in result1:
movie_list.append(line... | true |
a322e4439df31ecb404349dde66732ba04fd6bdf | Python | SarahHoegen/Python_Listas_Exe_Prova_etc | /listas/Programacao1/lista1.py | UTF-8 | 6,138 | 3.71875 | 4 | [] | no_license | #!/bin/env python3
# Marco André Mendes <marco.mendes@ifc.edu.br>
# Lista de exercícios 1
def soma_dois_inteiros(a,b):
''' Recebe dois numeros inteiros, e retorna a sua soma'''
soma = a + b
return soma
def metro_para_milimetros(metros):
''' Recebe um valor em metros, e retorna o valor em milimetros'''... | true |
6e54e17c8fc05e22871cf8eb6d9e768b2355c67a | Python | RyanMolyneux/Learning_Python | /pythonCrashCourseWork/Chapter 3/3-9-DinnerGuests.py | UTF-8 | 251 | 4.03125 | 4 | [] | no_license | #Chapter 3 ex 9 date : 10/06/17.
#Variables
guest_list = ["Jim","Tim","Thomas"]
print("\n\nGuest List\n--------------------------\n",guest_list[0],"\n",guest_list[1],"\n",guest_list[2],"\n\nThe Amount of people attending is : ",len(guest_list)) | true |
90234799e19f076f24743b397d3f2574a9e8f9a4 | Python | Margiris/NNNavigator | /gameObjects.py | UTF-8 | 7,023 | 2.734375 | 3 | [
"MIT"
] | permissive | import pygame
import numpy
from brain import Brain
from settings import Settings
class GameObject(pygame.sprite.Sprite):
def __init__(self, sprite_groups, tile_size, color, coords, size, is_movable=False, fpm=Settings.FRAMES_PER_MOVE, move_ticks=0):
self.groups = sprite_groups
pygame.sprite.Sprite... | true |
cd16a430fbaf62b44403dc0685a102926a73680f | Python | anudeepsamaiya/pyprofile | /src/pyprofile/profiler.py | UTF-8 | 4,045 | 2.53125 | 3 | [
"MIT"
] | permissive | """Simple cProfile based python profiler.
"""
import cProfile
import functools
import inspect
import pstats
from datetime import datetime
from io import StringIO
from gprof2dot import (
TEMPERATURE_COLORMAP,
TIME_RATIO,
TOTAL_TIME_RATIO,
DotWriter,
PstatsParser,
)
__all__ = [
"profile",
"... | true |
c268055d0ceeb78fdaf451db546635f0e73b68b6 | Python | bmdyy/projecteuler | /034.py | UTF-8 | 231 | 3.578125 | 4 | [] | no_license | import math;
def f(n):
ret = 0;
while n > 0:
ret += math.factorial(n % 10);
n //= 10;
return ret;
t = 0;
for i in range(10, 1000000):
f_i = f(i);
if i == f_i:
t += i;
print(i);
print('total: %d' % t);
| true |
9d5723ee04f4d4737fa60aee49b593e25bce95ad | Python | aryalavishranta/Logistic-Regression | /logistic.py | UTF-8 | 1,255 | 3.09375 | 3 | [] | no_license | #import nrceassary functions
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import Lo
#load iris dataset
iris=datasets.load_iris()
#use sepal lengths and sepal width attributes
X=iris.data[:,:2]
Y=iris.target
#fit logistic regression
logreg=LR(C=1e5,solver='lbfgs',multi_cl... | true |
3062011389ec15dfcb04fb62ceb1b0d0f6473329 | Python | yeahmanitsmike/Cryptocurrency-Push-Notifications | /btc_sms.py | UTF-8 | 1,522 | 2.828125 | 3 | [] | no_license | import os
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json
import time
#API key and URL
api_key = '################INSERT_API_KEY_HERE##############'
api_URL = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
#Params and ... | true |
1add70b0cb10353e58e724420a61cf6a9e4febf2 | Python | jakamrak/uvod-v-programiranje | /datoteke-s-predavanj/2017-18/09-objekti/psi-b.py | UTF-8 | 713 | 3.140625 | 3 | [] | no_license | class Pes:
def __init__(self, glas='hov'):
self.veselje = 1
self.glas = glas
def __repr__(self):
return 'Pes(glas={0!r})'.format(
self.glas
)
def __str__(self):
return 'Pes, ki dela {0}.'.format(
self.glas
)
def __add__(self, oth... | true |
491dfbc1799de1dc37a9d415d450ffb31a4b87e6 | Python | Keashyn/CP1404_practical_2020 | /Prac_08/unreliablecartest.py | UTF-8 | 177 | 3.140625 | 3 | [] | no_license | from Prac_08.unreliable_car import UnreliableCar
def main():
"""Test unreliable class."""
my_car = UnreliableCar("Mazda 3", 100, 1000)
print(my_car.fuel)
main()
| true |
b2bede15032e4fa70d7a497cb52cb721963fa482 | Python | jinkim172/tweet-analysis | /regression/test.py | UTF-8 | 1,195 | 2.78125 | 3 | [] | no_license | import pandas
import pickle
from scipy.sparse import hstack
from sklearn.metrics import explained_variance_score as evs
input_files_dir = 'input_files/'
training_objects_dir = 'training_objects/'
testing_file = 'subset_test.csv'
model_file = 'full_subset_model.obj'
vectorizer_file = 'full_subset_vectorizer.obj'
print... | true |
183227b0d124fd984fb611d777d1c2d4a78f0083 | Python | CodeTest-StudyGroup/Code-Test-Study | /qrlagusdn/[4]백준 삼성기출/#14500 테트로미오.py | UTF-8 | 1,791 | 3.234375 | 3 | [] | no_license | #14500 테트로미오
#아,,, N*M입니다. .ㅎㅎ N * N 이 아니라..
# ㅗ 같은 경우는 dfs로 탐색이 안된다.
#따라서 dfs 로 다른 경우들 탐색하고, ㅗ를 따로 함수 만들어서 탐색 해주었다.
import sys
MAX = -999999
def dfs(y,x,cnt,sum,visited):
global MAX
if cnt == 4:
MAX = max(MAX,sum)
return
for dir in range(4):
newy = y + dy[dir... | true |
0e389b45d43c85585e443fad6be88c85cd11f91c | Python | SelmaLeathem/Python-Reliable-Data-Transmission-Layer-Simulation | /reliable_layer.py | UTF-8 | 20,072 | 2.875 | 3 | [] | no_license | # Date: 5/1/2020
# Description: Code implementation for the reliable data transport layer. The
# book "Computer Networking a Top-Down Approach" by Kurose was
# used to as reference to determine how to implement each feature.
#
# Features include:
#
# * The number of packets sent are lim... | true |
9372134b8ef60cf3460b91c57a52de73b41cccff | Python | HenziKou/CIS-210 | /Projects/p2/p22_art_show.py | UTF-8 | 1,060 | 3.859375 | 4 | [] | no_license | '''
CIS 210
Art Show
Author: Henzi Kou
Credits: N/A
Using Python program, Turtle to create a design or drawing.
'''
from turtle import *
def art_show():
'''
Running the program will call on the functions using the program Turtle
to draw an image of a rainbow behind a... | true |
86656e99f12f23c269e787ae1a008eafbb931bca | Python | mramire8/revisiting | /expert/document_expert.py | UTF-8 | 752 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | from base import BaseExpert
class TrueExpert(BaseExpert):
"""docstring for TrueExpert"""
def __init__(self, classifier):
super(TrueExpert, self).__init__(classifier)
def label(self, x, y=None):
if y is None:
raise Exception("True labels are missing")
else:
... | true |
f53d78adf62cb59f83733a97b6c34dbfa949b414 | Python | r0mdau/hellanzb | /Hellanzb/Logging.py | UTF-8 | 23,893 | 2.78125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | """
Logging - hellanzb's logging facility. Ties in with python's logging system, with an added
SCROLL log level.
The NZBLeecherTicker object will constantly print new and kill it's old lines of text on
the screen via the scroll() level. This busys the screen, but the SCROLL level hooks allow
normal logging of non-SCR... | true |
4593012c3cf2f35ef98a48e4f3c403856c22c487 | Python | suchov/python_penn | /errors.py | UTF-8 | 311 | 4.3125 | 4 | [] | no_license | number = input('Please input an integer.')
#Try to cast the input
try:
number = int(number)
#Catch the raised exeption if there is an error
except ValueError as e:
print("Your input is not an ingeter.")
print(e)
#Otherwise, there is no error
else:
print(str(number) + " is indeed an integer!")
| true |
f341c5b68c26470404716e27f87872a65c999eb9 | Python | haruyasu/LeetCode | /1_array_and_strings/max_area_of_island.py | UTF-8 | 1,174 | 3.359375 | 3 | [] | no_license | class Solution:
def maxAreaOfIsland(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
direction = [[-1, 0], [1, 0], [0, 1], [0, -1]]
def dfs(i, j, grid, aera):
if not (0 <= i < len(grid) and 0 <= j < len(grid[0]) and grid[i][j] > 0):
... | true |
102fc56abcbedb2706b08161440b0f60c83c289e | Python | lkhphuc/HugoLarochelle_NN_Exercises | /mlpython/mlproblems/__init__.py | UTF-8 | 2,540 | 2.8125 | 3 | [] | no_license | # Copyright 2011 Hugo Larochelle. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions a... | true |
6249a2cc182995e10d187424ed4018d8ee751e08 | Python | aister2020/KDDCUP_2020_MultimodalitiesRecall_3rd_Place | /code/cv_merge_score.py | UTF-8 | 893 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import sys
import os, pickle
from collections import defaultdict
def fill(res, df):
for data in df.values:
q, p, v = data
q, p = int(q), int(p)
key = str(q) + ',' + str(p)
res[key].append(v)
return res
def mergeScore(input_prefix,cv_num, output):
res = de... | true |
a347e9570f2a43d8bcc4474c6e264125a5ea97a3 | Python | AnubhavSrivastavaML/DeepLearning-Based-ImageSearch | /search_image_database.py | UTF-8 | 928 | 2.640625 | 3 | [
"MIT"
] | permissive | import cv2
import argparse
import sqlite3
import json
import numpy as np
from get_features import feature
from model import feature_extractor
from sklearn.metrics.pairwise import cosine_similarity
parser = argparse.ArgumentParser()
parser.add_argument('--threshold',type = int ,default=0.5)
parser.add_argument('--imag... | true |
562d7ef62cbb51b63d04f2be8db30d4d1aa72c5d | Python | ShelMX/gb_algorithm_hw | /task_7.py | UTF-8 | 869 | 3.859375 | 4 | [
"Apache-2.0"
] | permissive | __author__ = 'Шелест Леонид Викторович'
"""
Написать программу, доказывающую или проверяющую,
что для множества натуральных чисел выполняется равенство: 1+2+...+n = n(n+1)/2,
где n – любое натуральное число.
"""
def main(n: int=None):
n = n if n else int(input('Введи целое число больше 1 '))
result = 0
... | true |
47903c77d74986cd5dc2513d6a941e6c508e4e7e | Python | SurendraKumarAratikatla/MyLenovolapCodes1 | /Others/Location/location_tracker.py | UTF-8 | 619 | 2.734375 | 3 | [] | no_license | from kivy.metrics import dp
from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable
class Example(MDApp):
def build(self):
self.data_tables = MDDataTable(
size_hint=(0.9, 0.6),
use_pagination=True,
column_data=[
("Pappulu", dp(30)),
... | true |
0b9ce92aec6f9e5daf6d67a1995a2643cb764c12 | Python | Akshat-Tripathi/Conquer2AICompetition | /game_utils/visualisation/visualisation.py | UTF-8 | 1,987 | 2.6875 | 3 | [] | no_license | import sys
import tempfile
import webbrowser
import numpy as np
from itertools import groupby
visualisation_file = sys.argv[1]
map_file = sys.argv[2]
def read_map(filepath):
with open(filepath, "r") as file:
tokens = list(filter(lambda s: s != "", set(file.read().replace("\n", " ").split(" "))))
t... | true |
9a2f9ca58332a25349d8f723e126675c96866c86 | Python | dvingo/guten_better | /server/models.py | UTF-8 | 1,097 | 2.71875 | 3 | [
"MIT"
] | permissive |
from json import dumps as json_dumps
class TextSchedule:
def __init__(self, email, gutenberg_id, days_to_read=30, days_sent=0):
self.email = email
self.gutenberg_id = gutenberg_id
self.days_to_read = days_to_read
self.days_sent = days_sent
def __str__(self):
return se... | true |
664d5b58648f5928c208735fa59bc95f67f828d0 | Python | peva032/rjmcmc_microlensing | /plot_real_figures.py | UTF-8 | 5,176 | 2.703125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import uniform
import matplotlib.mlab as mlab
# actual = [0.01,15,10,10,0.001,0.6]
singlechain = pd.read_csv("binary_real_rjmcmc_output_1.csv")
binarychain = pd.read_csv("binary_real_rjmcmc_output_2.csv")
class uniprior(object):
... | true |
fd6736b45ec94957b210b05d3d5efaecbdf2592c | Python | tingleshao/leetcode | /minimum_depth_of_binary_tree/main.py | UTF-8 | 880 | 3.453125 | 3 | [] | no_license | # Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def minDepth(self, root):
minD = 1
if root == None:
return 0
... | true |
b2ce276043a8a54ed2aeec4b36bda33b152ff202 | Python | OliviaMoro/Python | /initialConditionsAndEigenvaluesProblems/methodTir.py | UTF-8 | 1,603 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 22:01:31 2020
@author: moroo
"""
import numpy as np
import sys, os
sys.path.append(os.path.abspath(os.path.join('..', 'integrator')))
from rungeKuttaMethod import rungeKutta4, rungeKutta2
from eulerMethod import explicitEuler, regressiveEuler
def tirEuler(n,L,y0,z0... | true |
787348aa43e2f67987b6a94f7516dd8a967c9fb0 | Python | caduceus313/Jet_Brains_Text_Based_Browser | /browser.py | UTF-8 | 3,621 | 3.28125 | 3 | [] | no_license | from os import mkdir, makedirs, path
from collections import deque
from bs4 import BeautifulSoup
from colorama import init, Fore
import argparse
import requests
init()
# handles command line argument parsing
parser = argparse.ArgumentParser(description='Text based web browser')
parser.add_argument('dirname', nargs='?... | true |
7c9c5fce2f08b93372cbd5d77ba47666471a62e0 | Python | ravi4all/AdvPython_JulyMorning | /01-OOPS/Inheritance/Multiple+Multilevel.py | UTF-8 | 2,812 | 2.859375 | 3 | [] | no_license | class Honda:
def __init__(self):
self.selfStart = True
self.selfDriven = True
self.powerSteering = True
class Maruti:
def __init__(self,carName, tyreBrand, hybrid, automatic, average):
self.carName = carName
self.tyreBrand = tyreBrand
self.hybrid = hy... | true |
5d66928b1ecbe4a89a8e17560bef91c2b0d70cb9 | Python | Yarharm/Handwritten-Digit-Recognition | /Neural Network.py | UTF-8 | 5,862 | 3.484375 | 3 | [] | no_license | import numpy as np
import scipy.special as spec
import matplotlib.pyplot as plt
class NeuralNetwork:
""" Three layers Neural Network with the Stochastic Gradient Descent
Parameters
------------
inodes : int
Number of nodes in the first layer of the network.
hnodes : in... | true |
663646ebe5fae27aa45d57a8651a57cbcb51336f | Python | Sal-Ali/CryptoForecaster | /CryptoForecaster/initial_training.py | UTF-8 | 6,486 | 2.921875 | 3 | [] | no_license | ''' Short note:
I am aware that the standard is to use Jupyter Notebook,
my personal preference is in Spyder and for purposes of
convenience this was what I chose, as a result code is frequently
commented in and out. On Github, I will leave all code uncommented
as this portion of code h... | true |
66b9f35333627a01a89fdc519cc7c7f7786e34ad | Python | 200504225/1803 | /11-day/数字.py | UTF-8 | 152 | 3.609375 | 4 | [] | no_license | a = ['1','2','3','4','5','6']
for i in range(len(a)-1,-1,-1):
a.pop(i)
print(a)
a = ['1','2','3','4','5','6']
for i in a[:]:
a.remove(i)
print(a)
| true |
93af06d2d49e6a0341d4a08006767a2903346869 | Python | bogolla/fhir-on-alchemy | /sil_fhir_server/models/questionnaireresponse.py | UTF-8 | 9,742 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse)
# Date: 2016-03-22.
from sqlalchemy import Column, ForeignKey
from sil_fhir_server.data_types import primitives
from . import domainresource
class QuestionnaireResponse(domainresource.D... | true |
f122fae26cb84ed2cd9c1ec6ecdbd3505a18222f | Python | Pra3t0r5/frro-soporte-2019-01 | /practico_06/capa_negocio.py | UTF-8 | 4,990 | 3.171875 | 3 | [
"MIT"
] | permissive | # Implementar los metodos de la capa de negocio de socios.
from frro_soporte_2019_01.practico_05.ejercicio_01 import Socio
from frro_soporte_2019_01.practico_05.ejercicio_02 import DatosSocio
class DniRepetido(Exception):
def __init__(self):
super(DniRepetido, self).__init__('DNI repetido')
class Longi... | true |
478311c5e52fddee17f23ef7af05d61674d0d010 | Python | Archanasurendran12/python-myworks | /Fundamentals/opencvar/rotate.py | UTF-8 | 998 | 2.984375 | 3 | [] | no_license | #image rotation
import cv2
#read image as greyscale
img=cv2.imread(r'C:\Users\USER\PycharmProjects\pythonProject\Fundamentals\opencvar\unnamed.png',0)
#get imge hight and width
(h,w)=img.shape[:2]
#calculate the center of the image
center=(w/2,h/2)
angle90=90
angle180=180
angle270=270
scale=1.0
#prform the counterclock... | true |
325b73e58ea4457a5dcd65d1bd38a6edfc1a94bb | Python | vobject/deep-nfshp | /train.py | UTF-8 | 6,429 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import argparse
import datetime
import cv2
import numpy as np
import sklearn.model_selection
from tensorflow import keras
from models.nvidia import NvidiaModel
from models.comma import CommaModel
from models.tiny import TinyModel
def training_generator(image_paths, steering_angles, preproc, batch_size):
... | true |
3a786bf1ed1ce41494299c2266f08aba839d8e37 | Python | alecbarreto/abarreto | /sum_square_dif.py | UTF-8 | 269 | 3.390625 | 3 | [] | no_license | def square_sum_difference():
lst = range(1,101)
sum1 = 0
sum2 = 0
for num in lst:
sum1 = sum1 + num**2
for num in lst:
sum2 += num
if num == 100:
sum2 = sum2**2
return sum2-sum1
print square_sum_difference()
| true |
787e98e457a7d7cb91b8f62e928ad7a7c91d375e | Python | leejw51/BumblebeeNet | /Test/DrawSinGraph.py | UTF-8 | 209 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pylab as plt
from numpy import arange, sin, pi, radians, degrees
from matplotlib.pylab import plot,show
x = arange(-360, 360, 0.1)
y = sin(radians(x))
plot(x,y)
show()
| true |
3a51f1d49e7d1617a880c15fdb2d236cb6d86b1d | Python | ShubhangiDabral13/Data_Structure | /Sorting_Ques/Bubble_Sort.py | UTF-8 | 603 | 4.4375 | 4 | [] | no_license |
#Function for bubble sort
def bubble_sort(li):
#Traversing through each element in the list
for i in range(0,len(li)-1):
for j in range(0,len(li)-i-1):
if(li[j]>li[j+1]):
#If next element is greater than the current element we will swap it
li[j],li[j+... | true |
0df873f04bb1d8b07bf820a3e8db9db128035584 | Python | pyre/pyre | /packages/pyre/weaver/Make.py | UTF-8 | 4,108 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2023 all rights reserved
#
# access to the pyre package
import pyre
# my ancestor
from .LineMill import LineMill
# my declaration
class Make(LineMill):
"""
Support for makefiles
"""
# user configurable state
languageMarke... | true |
1b9caef492374276ffb71d046949bad43d624c50 | Python | elmar-hinz/Python.Vii | /vii/Range.py | UTF-8 | 6,341 | 3.421875 | 3 | [
"MIT"
] | permissive |
class NotLinesRangeException(Exception): pass
class NotOneLineRangeException(Exception): pass
class NotTwoLinesRangeException(Exception): pass
class NotPositionsRangeException(Exception): pass
class NotOnePositionRangeException(Exception): pass
class NotTwoPositionsRangeException(Exception): pass
class Range:
"""... | true |
c0d6de9c2c973a4a9ecb0e759a6f34d34da639b1 | Python | shiki7/Atcoder | /ABC211/C.py | UTF-8 | 322 | 2.734375 | 3 | [] | no_license | S = input()
T = 'chokudai#'
MOD = 10 ** 9 + 7
dp = [[0 for j in range(len(T))] for i in range(len(S) + 1)]
dp[0][0] = 1
for i in range(len(S)):
for j in range(len(T)):
dp[i][j] %= MOD
dp[i + 1][j] += dp[i][j]
if S[i] == T[j]:
dp[i + 1][j + 1] += dp[i][j]
print(dp[len(S)][8] % MOD... | true |
65f2d1fbb84ff60f4e111fe8018c65731ebd8fca | Python | Richardjb/ComputerVision | /Canny Edge Detection/main.py | UTF-8 | 28,736 | 2.671875 | 3 | [] | no_license | from PIL import Image
import numpy as np
from scipy.misc import imread
import scipy.ndimage
import cv2
from copy import copy, deepcopy
import sys
from math import pi, sqrt, exp
import math
import matplotlib.pyplot as plt
##########################################################################
## Function Name: Q1
#... | true |
07b7ca9f5e13a210892b144d5d779e80186df198 | Python | quNadi/ExCheckPy | /basic/any_all.py | UTF-8 | 141 | 2.609375 | 3 | [] | no_license | def avoids(word,forbidden):
return not any(letter in forbidden for letter in word)
a=['ala','pies','kot','mysz']
print(avoids('kot',a)) | true |
78f161f64f53261c8a334b6b5d18d41ec162cbfe | Python | arjun010/global-sci-fi-project | /analysis/reddit.py | UTF-8 | 1,452 | 2.578125 | 3 | [] | no_license | import praw
import csv
import unicodedata
reddit = praw.Reddit(client_id='BKgABmF31ARw4w', \
client_secret='MQfbvgznD05VRiU1O4CLE4QWo1E', \
user_agent='scifihw', \
username='asrinivasan40', \
password='Susheela1058')
subreddit = reddi... | true |
3e7c631ecf3e8c6b546e063960dd4937cb83a757 | Python | aniruddhamalkar/contious-single-direction-socket | /socket_part_2_server.py | UTF-8 | 611 | 3.3125 | 3 | [] | no_license | import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Socket has been successfully created")
sock.bind((socket.gethostname(), 5555))
print("Socket has been successfully binded")
sock.listen(5)
while True:
client_socket, ip_address = sock.accept()
print("Connection from {0} has been est... | true |
ce6aac1fbcd25a8b9d35efe5c28ca56076ba5fe4 | Python | InHouse-Banana/DataScientistChallenge | /model_inference.py | UTF-8 | 6,433 | 3.03125 | 3 | [] | no_license | import argparse
import itertools
import numpy as np
import pandas as pd
import pickle
from sklearn.metrics import accuracy_score, f1_score, precision_score\
, recall_score, roc_auc_score
def try_func(func, y_data, predictions):
try:
return func(y_data,predictions).round(2)
... | true |
b6e45ef315a83d7815ab162352dc97b8ad74ee08 | Python | nehruperumalla/ML_from_Scratch | /KNN/KNN.py | UTF-8 | 1,241 | 3.34375 | 3 | [] | no_license | import numpy as np
from collections import Counter
class KNN:
def __init__(self, k: int = 3):
self.k = k
def euclidean_distance(self, x1: np.ndarray, x2: np.ndarray) -> float:
# Euclidean distance calculation between two points with D-Dimensions
return np.sqrt(np.sum((x1 - x2) ** 2))
... | true |
dc52609aeeb64c19cde19d771f1ba49cbcb15e23 | Python | wenhaoliang/leetcode | /leetcode/offerIsComing/分治算法/剑指 Offer 51. 数组中的逆序对.py | UTF-8 | 2,623 | 3.828125 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。
示例 1:
输入: [7,5,6,4]
输出: 5
链接:https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof
"""
from typing import List
class Solution:
def reversePairs(self, nums: List[int]) -> int:
def merge(nums, left, mid, ri... | true |
b08080ff57bd3d1ffc29e51c2c1dac84d7d73d3e | Python | ThompsonNJ/CSC231-Introduction-to-Data-Structures | /Lab 02/GeneratingPolygons.py | UTF-8 | 619 | 3.15625 | 3 | [] | no_license | class RegularPolygon:
def __init__(self, num, length):
self.num_sides = num
self.length = length
def compute_perimeter(self):
return (self.num_sides*self.length)
class EqualiaterialTriangle(RegularPolygon):
def compute_area(self):
return (3**(1/2.0) * self.length)... | true |
d9626e172b54bcafff4998cc1b43f520a5fd83da | Python | adsantos97/cs462-asn2 | /rough_asn2.py | UTF-8 | 5,319 | 3.640625 | 4 | [] | no_license | _author_ = 'arizza santos'
# Course: CS 462
# April 18, 2018
# Assignment 2: Dynamic Programming and Greedy Algorithms
import random
import timeit
import itertools
import sys
# purpose: generate random integers
# input: n - number of objects(integers)
# return: rand_ints - list of random integers
def generate_rand_in... | true |
5803284239ca515aff903f817ac17a7e9fd8dd89 | Python | letscodedjango/py-se-bootcamp | /py_se_day07/use_student_class.py | UTF-8 | 757 | 2.625 | 3 | [
"MIT"
] | permissive | from pysebootcamp.py_se_day07 import student_module
from pysebootcamp.py_se_day07.student_module import Student
# john = student_module.Student("John", 26, "B.E", 13244, "john@gmale.com", 1, "Python")
# mike = student_module.Student("Mike", 27, "B.E", 34353, 2, "Java")
# jenny = student_module.Student("Jenny", 23, "B.... | true |
0a2396582730a9b3c430fa8c85f72e0afb23dbbf | Python | renantarouco/ff-neuralnet | /ff_neuralnet.py | UTF-8 | 3,467 | 3.03125 | 3 | [] | no_license | import numpy as np
from tqdm import tqdm
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
class FirstFFNetwork:
def __init__(self):
# First layer and biases
self.w111 = np.random.randn()
self.w112 = np.random.randn()
self.w121 = np.random.randn()
self.w122 = np.rando... | true |
68c2a866918447c2dc7c080d0e34531f86ad2b58 | Python | phanrahan/magma | /magma/backend/mlir/printer_base.py | UTF-8 | 852 | 3.328125 | 3 | [
"MIT"
] | permissive | import io
import sys
class PrinterBase:
def __init__(self, tab: int = 4, sout: io.TextIOBase = sys.stdout):
self._tab = tab
self._indent = 0
self._sout = sout
self._flushed = True
def push(self):
self._indent += 1
def pop(self):
if self._indent == 0:
... | true |
6dcfc3b51fd6c132c278d1a7c8511408941725a2 | Python | zhangyu345293721/leetcode | /src/leetcodepython/string/day_year_1154.py | UTF-8 | 2,690 | 3.96875 | 4 | [
"MIT"
] | permissive | # encoding='utf-8'
import datetime
'''
/**
* This is the solution of No. 1154 problem in the LeetCode,
* the website of the problem is as follow:
* https://leetcode-cn.com/problems/day-of-the-year
* <p>
* The description of problem is as follow:
* =================================================================... | true |