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 |
|---|---|---|---|---|---|---|---|---|---|---|
f97de35da262699ac0cfdfff127391a9d2b88af2 | nichxml/intro-to-python | /hw5.py | UTF-8 | 3,077 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
"""
✓Program loads each "row" of data from ToDo.txt text file into a python Dictionary
20.0 pts
✓Program loads each dictionary "row" into a Python List to create a "Table" of data.
20.0 pts
✓Program displays the table's data to the user.
18.0 pts
✓Program saves the table's data into the ToDo.txt ... | true |
8b12fc358795688e5ef0e0cdfbeab5c6857ea1ed | CesarDevs/Programacion | /Programacion/Inteligencia artificial/Grafos/Class.py | UTF-8 | 8,127 | 3.25 | 3 | [] | no_license | import sys
sys.setrecursionlimit(1000000000)
newpath=[]
class Grafo:
def __init__(self):
self.diccionario={}
######El grafo ira dentro de un arreglo de arreglos de la siguiente manera [["Nombre del vertice"], {arista 1, arista 2}],[]]
# SEGUN LA PAGINA DE PYTHON ES MEJOR HACERLO CON DICCION... | true |
592ed24c32d919745f7221f0ea1435c83d9d1bcf | katarzynawozna/python | /Lista4/zad10.py | UTF-8 | 221 | 2.640625 | 3 | [] | no_license | def NWD(a,b):
reszta = a % b
if reszta == 0:
return b
else:
while reszta != 0:
a = b
b = reszta
reszta = a % b
if reszta == 0:
return b
| true |
7e2b926129e782ce09dabc2926406edf1ccd412d | Robin-w151/raspEYE | /raspEYE.py | UTF-8 | 868 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import picamera
import sys
import time
def takePicture(filename="image.png", sec=1, res=(2592, 1944)):
with picamera.PiCamera() as camera:
camera.resolution = res
camera.start_preview()
# Camera warm-up time
time.sleep(sec)
camera.capture(filename... | true |
56e03d4b7e74b47535ad85e90ee806ca46d37b61 | disha111/Python_Beginners | /Assignment 3.1/que1.py | UTF-8 | 394 | 3.578125 | 4 | [] | no_license | import numpy as np
class q1:
def __init__(self):
self.ls = [] #List
self.size = int(input("Enter Size of List : "))
for self.i in range(0,self.size):
self.ls.append(int(input()))
self.array = np.array(self.ls) #one-dimensional NumPy array.
print("List is :",self.... | true |
32bb935f01fb1037cbc25b1e5fb00fb8b62b8eaf | EdoardoDone/birthdays | /main.py | UTF-8 | 238 | 2.8125 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
from mypackage.birthdays import return_birthday
if len(sys.argv) == 3:
user_input = sys.argv[1] + " " + sys.argv[2]
else:
print("Enter: name username")
exit()
return_birthday(user_input)
| true |
aac5e6fc1322af6861542fb1140451931184a775 | aguperezpala/2009-famaf-2011 | /base_datos/Segunda_Fase/FN_Calculator/ca.py | UTF-8 | 746 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sys import *
class ca:
a = set()
am = set()
def __hash__(self):
return 0
def __repr__(self):
rep = "(ATRIBUTO/S: "
for elem in self.a:
rep += elem+' '
rep += ", CIERRE:"
for elem in self.am:
rep += ' '+elem
rep += ')'
return rep
def __str__(self):
rep = "(ATRIB... | true |
036885d0a651e360c025347d7ee102e65f457e84 | newibrahim/aryanprint | /Classes/qu1.py | UTF-8 | 112 | 2.890625 | 3 | [] | no_license | class Sales:
def __init__(self, id):
self.id = id
id = (100)
val = Sales(123)
print (val.id) | true |
bf94855b0dd9337f3d98432977e7242a0c92851c | YongGyunKwon/CBNU_machinelearning_lecture_example | /16/value.py | UTF-8 | 6,307 | 2.96875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import time
import copy
class Environment:
cliff = -3;
road = -1;
sink = -2;
goal = 2
goal_position = [2, 3]
reward_list = [[road, road, road, road], [road, road, sink, road], [road, road, road, goal]]
reward_list1 = [['road', 'road', 'road... | true |
a1fab4173a1f630b052e3e1274c0ca030fb99268 | Aasthaengg/IBMdataset | /Python_codes/p02844/s045468697.py | UTF-8 | 277 | 2.71875 | 3 | [] | no_license | N = int(input())
S = input()
ans = 0
for i in range(1000):
res = str(i).zfill(3)
cnt = 0
p = res[cnt]
for s in S:
if p == s:
cnt += 1
if cnt == 3:
ans += 1
break
p = res[cnt]
print(ans) | true |
d8ea4092243867bc244bf67b66f34c554ccfe6a1 | changuk-Shrio/BOJ | /2476_2.py | UTF-8 | 353 | 2.984375 | 3 | [] | no_license | mx_money=[]
for i in range(int(input())):
l=list(map(int,input().split()))
if l[0]==l[1]==l[2]:
mx_money.append(10000+(1000*l[0]))
elif l.count(l[0])==2:
mx_money.append(1000+(100*l[0]))
elif l.count(l[1])==2:
mx_money.append(1000 + (100 * l[1]))
else:
mx_money.append... | true |
cb0fb9727f8d5acaba0e377671d53afa94d3408f | Satish980/JNTUK_Python_Workshop | /Day_3/dictionarymethods.py | UTF-8 | 319 | 3.828125 | 4 | [] | no_license |
book = {"chap1":10 ,"chap2":20 ,"chap3":30 ,"chap1":1000}
# ONLY KEYS
print(book.keys())
## ONLY VALUES
print(book.values())
print(book.items())
#print(book["chap10"])
print(book.get("chap100"))
# chap1-10 will be removed
book.pop("chap1")
print(book)
book2 = {"chap6":60}
book.update(book2)
print(book)
| true |
78d4c46bfaeaea970cf9840d84805fecef7617dc | JoeSantamariaParedes/trabajo | /eliminacion/ejemplo2.py | UTF-8 | 99 | 2.515625 | 3 | [] | no_license | diccionario={"azul":"blue","rojo":"red","verde":"green"}
del diccionario["rojo"]
print(diccionario) | true |
6053c7c3af5f0b22a8d254169433e4485f96e7e1 | Luis-Felipe-N/curso-em-video-python | /modulo-3/exercicios/079-varios_num.py | UTF-8 | 704 | 3.890625 | 4 | [
"MIT"
] | permissive | # FAZER UM PROGAMA QUE LEIA VÁRIOS NÚMEROS E CADASTRE EM UMA LISTA
# SE O NÚMERO JÁ EXISTI DENTRO DA LISTA, ELE NÃO SERÁ ADICIONADO
# NO FINAL MOSTRE OS VALORES EM ORDEM CRESCENTE
nums = []
while True:
num = int(input('Digite um número: '))
if num in nums:
print('\033[31mA lista já possui esse valor! N... | true |
5cd82b32b1f022400a546173f36a4b9c49261aec | Emru1/quick_trader | /server/config.py | UTF-8 | 1,934 | 3.234375 | 3 | [] | no_license | SETTING_KEYS = ['ip', 'port', 'dbpath', 'tls_cert', 'tls_key']
GLOBAL_CONFIG = None
class Config:
"""
Klasa konfiguracji, jest to singleton
"""
def __init__(self, path='./config'):
"""
Inicjalizacja i parsowanie pliku konfiguracyjnego
:param path: Ścieżka do pliku konfiguracy... | true |
6df12b3cdc2da6cb8d093ee756bf3ceb1959809d | gabriellaec/desoft-analise-exercicios | /backup/user_011/ch74_2019_10_02_16_17_44_342266.py | UTF-8 | 302 | 3.234375 | 3 | [] | no_license | def conta_bigramas(string):
dic = {}
i = 0
while i < len(string) - 1:
bigrama = string[i] + string[i+1]
if bigrama in dic:
dic[bigrama]+=1
else:
dic[bigrama] = 1
i+=1
return dic
s="banana nanica"
print(conta_bigramas(s)) | true |
d91b30872d9e8bb193fbc8dd19ca867628395735 | Ravitejagupta/Python | /leet_code_567.py | UTF-8 | 987 | 2.96875 | 3 | [] | no_license | class Solution:
def checkInclusion(self, s1, s2):
"""
:type s1: str
:type s2: str
:rtype: bool
"""
if len(s1) > len(s2):
return False
if len(s1) == 1:
return (s1 in s2)
d1 = {}
d2 = {}
k = len(s1)
for ch ... | true |
a70bb50a02fa297359e9e548fbedf5275d4369ab | pathakritesh/student | /student-database.py | UTF-8 | 9,020 | 3.015625 | 3 | [] | no_license | import yaml
import json
class student:
def __init__(self, rollno, firstname, lastname, fathername, dob, email):
self.rollno = rollno
self.firstname = firstname
self.lastname = lastname
self.fathername = fathername
self.dob = dob
self.email = email
def display(s... | true |
f3cc78390cfecc209b7f491f68f8f295d4b9d0d0 | dwkang707/BOJ | /python3/(10798)BOJ.py | UTF-8 | 198 | 3.359375 | 3 | [] | no_license | text = []
for i in range(5):
text.append(input())
print(text)
for i in range(max(len(e) for e in text)):
print(i)
for j in range(5):
if i < len(text[j]):
#print(text[j][i], end="")
pass
| true |
f0b40617b786baa91708de37c8588df188c5426c | tianhl/Etappb | /jobManagerV1/createMac | UTF-8 | 2,816 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import re
import os
import commands
import time
cmdDir = './macDir/'
def executeCmd():
commands.getoutput('rm -f run*.*')
print 'exe ++++++++++++++++++++++++++'
print 'run jobs'
commands.getoutput('./subJobs')
timeClock = 0
while 1:
time.sleep(60)
timeClock += 1
print tim... | true |
435868c5e2524fd569d32dc3b696db54c2646775 | jcch96/panthera_locomotion | /panthera_locomotion/src/old scripts/panthera_locomotion_node.py | UTF-8 | 5,296 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import orienbus
import time
from geometry_msgs.msg import Twist
from std_msgs.msg import Int8
global state
state = 0
class unit:
def __init__(self, address_rot, address_trans):
self.port = '/dev/ttyUSB0'
modbus = orienbus.OrienBus(self.port)
self.addr... | true |
d2b42526fc7836798863acec6c1ac188dc9f4fc0 | grillermo/shpaml | /shpaml/loader.py | UTF-8 | 2,347 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Based on django's caching template loader.
"""
import hashlib
import shpaml
from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin
class Loader(BaseLoader):
is_usable = True
def __init__(self, loader... | true |
263042e51f4c93b77198a848438c69df3cc45705 | FBIdd/FlightSteward | /crawler_nanhang2.0.py | UTF-8 | 1,842 | 2.734375 | 3 | [] | no_license | from selenium import webdriver
import time
from selenium.webdriver import ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
def nanhangcrawler(city1,city2,date_in):
date_in = date_in[0:4] + '-' +... | true |
fb5d4b489fde82782bb163476c2a149f70275ecb | Lee3Paul/PyLinkPred | /Reference_codes/Ref4/src/predictor/KZ.py | UTF-8 | 1,506 | 3.53125 | 4 | [] | no_license | """
Katz
@author: DY
"""
import numpy as np
def cal_score(G, beta):
"""
Calculate the similarity score according to Katz index.
Parameters
----------
G: list
A adjacency list. The nodes are indexed from 0.
The ith element of G is a set containing its neighbors.
beta: float
... | true |
0fa46071814c580fd0ea2f713e5c90d15e5d2e4c | jinStar-kimmy/algorithm | /Algorithm/exam/basic_level/test05.py | UTF-8 | 514 | 3.828125 | 4 | [] | no_license | def solution(d, budget):
answer = 0
d.sort()
if sum(d) == budget:
return len(d)
elif (len(d) == 1) and d[0] <= budget:
return len(d)
for i in range(1, len(d) + 1):
if sum(d[:i]) > budget:
break
if sum(d[:i]) <= budget:
answer =... | true |
85bd9b1f7687e5ccd75fc51a2bf72e79ba79ddce | kevin-jacob/Bike_Sharing | /bikesharing.py | UTF-8 | 1,565 | 2.796875 | 3 | [] | no_license | import numpy as np
import pandas as pd
# getting the data set
dataset = pd.read_csv('hour.csv',sep = ',', error_bad_lines=False)
X = dataset.iloc[:, 2:14].values
y = dataset.iloc[:, 16].values
# dividing dataset so that some is used to train model and some is used to test how good it is
from sklearn.model_selection... | true |
83cebd7c5cc454fe43f3cbefaf01c0fa8114f39c | Leeying1235/deep-learning | /src/model.py | UTF-8 | 1,348 | 2.84375 | 3 | [] | no_license | import numpy as np
class Model(object):
def __init__(self):
self.layers=[]
def add(self,layer):
self.layers.append(layer)
def compile(self,loss):
if loss=="mse":
self.__loss_function=self.__mse
elif lose=="cross_entropy":
self.__loss_function=self.__cross_entropy
else:
raise Exception("None difin... | true |
e2feeeadcff2c9288c678dfd1f6c8086c308ee6b | ash0411/computervision | /class/lec4.py | UTF-8 | 1,979 | 2.96875 | 3 | [] | no_license | import cv2 as cv
import numpy as np
image = cv.imread('/home/ash/opencv_projects/images/book.jpeg')
# color filtering
# cap = cv.VideoCapture(0)
# while True:
# ret,frame = cap.read()
# hsv = cv.cvtColor(frame,cv.COLOR_BGR2HSV)
# lower_red = np.array([10,130,140])# 5,230,230 for blue the values inside... | true |
7a822fbc0ddabbe7f536eed59751e6397aa6d586 | sohambiswas4/Criminal_Identification___RK_308____Team_name-SmartCreators | /dbHandler.py | UTF-8 | 2,177 | 2.703125 | 3 | [] | no_license | import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
# Fetch the service account key JSON file contents
cred = credentials.Certificate('smartcreators-fbc59-firebase-adminsdk-kw8g5-dd0f15aa88.json')
# Initialize the app with a service account, granting admin privileges
firebase_adm... | true |
6486b1ad71f0e679cb5f7a9441c227e54b8cf257 | slangenbach/udacity-da-nanodegree | /p5/datasets_questions/explore_enron_data.py | UTF-8 | 2,608 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
"""
Starter code for exploring the Enron dataset (emails + finances);
loads up the dataset (pickled dict of dicts).
The dataset has the form:
enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict }
{features_dict} is a dictionary of features associated with that pers... | true |
ec37d5eb068138422f7836e5871b4e29ed52f4de | zdravkob98/Fundamentals-with-Python-May-2020 | /Basic Syntax, Conditional Statements and Loops - Exercise/Easter Cozonacs.py | UTF-8 | 611 | 3.703125 | 4 | [] | no_license | budget = float(input())
price_for_flour_kg = float(input())
price_pack_egg = price_for_flour_kg * 0.75
price_milk_l = price_for_flour_kg * 1.25
milk_250_ml = price_milk_l / 4
price_for_one_cozonac = price_pack_egg + price_for_flour_kg + milk_250_ml
count_kozonac = 0
count_colored_eggs = 0
while budget > price_for_on... | true |
54f6e3bd9ae6a9768ba726612fd6fb5270b346e0 | jterstriep/PloneMonitor | /monitor.py | UTF-8 | 6,558 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python2
"""
Usage: monitor.py vm_url access_key [--polling_delay POLLING_DELAY]
"""
from urlparse import urljoin
import urllib2
import subprocess
import shlex
import logging
import time
import json
import base64
from argparse import ArgumentParser
NEXT_JOB_SERVICE_URL = 'get_next_job'
GET_STATUS_URL = 'p... | true |
410148fcfeb4206badc8c2976c7ec2dc5d644967 | shambu09/visualization-of-optimization-functions | /visualization.py | UTF-8 | 2,494 | 3.625 | 4 | [
"MIT"
] | permissive | """
Annual Monthly(and Seasonal) Temperature of India from 1901 - 2017 Dataset.
"""
import pandas
import matplotlib.pyplot as plt
import numpy as np
bias_correction = False
standard_normalization = True
genearal_normalization = not standard_normalization
beta1 = 0.9
beta2 = 0.999
"""
Intuitions:
--> The First Expon... | true |
b03458ff5e228c0cc82f54b985932dae77997a10 | lukaszk76/mwo | /src/myCode/algorytmika/wykresy.py | UTF-8 | 853 | 4.0625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def getFunction():
function_txt = input("Podaj wzor funkcji >>> y=")
return lambda x: eval(function_txt), function_txt
def getRange():
while True:
try:
leftEnd = input("Podaj lewy koniec przedzialu >>>")
leftEnd = float(le... | true |
26c25b0acdae03e702eade767d6e6b5671acc9f2 | VivaanMalik/PythonGames | /Falling - The Game/Falling.py | UTF-8 | 11,621 | 2.546875 | 3 | [] | no_license | import pygame
import random
import os
import csv
import inspect
#comment123
def logtoshell(logstr):
debug=1
if (debug ==1):
cf = currentframe()
filename = inspect.getframeinfo(cf).filename
print ("Python says line ", cf.f_lineno, logstr)
highscore =0
pygame.init()
hide = False
nomfallx... | true |
7eafc18e5ad7af2512979c8fc81114abd9ac9732 | EntilZha/neural-el | /models/batch_normalizer.py | UTF-8 | 2,652 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
#from tensorflow.python import control_flow_ops
from tensorflow.python.ops import control_flow_ops
class BatchNorm():
def __init__(self,
input,
training,
decay=0.95,
epsilon=1e-4,
name='bn',
... | true |
5e34e5891f4920bce4e372c5c5aeb5ca8bcc792c | Cryst/xiaomiWifiMapper | /run_on_vacuum/extract_pos.py | UTF-8 | 3,755 | 2.703125 | 3 | [
"MIT"
] | permissive | import logging
import mylogger
import subprocess
import time
import csv
class PlayerConfig:
def __init__(self):
self.position_token = (3, "position2d")
self.type_token = (5, 1)
self.subtype_token = (6, 1)
class Position:
def __init__(self, line):
tokens = line.split(" ")
... | true |
bb852b37faf51075fc37556696c143c68ec9dc43 | jackh423/python | /CIS41A/CIS41A_UNITC_INCLASS_ASS_1.py | UTF-8 | 1,387 | 3.5 | 4 | [
"Apache-2.0"
] | permissive | '''
Name: Srinivas Jakkula
CIS 41A Spring 2020
Unit C In-class Assignment
'''
import copy
list1 = [2, 4.1, 'hello']
list2 = list1
# list3 = list(list1)
# list3 = list1.copy()
# list3 = list1[:]
list3 = copy.deepcopy(list1)
print("list1 == list2: ", list1 == list2)
print("list1 == list3: ", list1 == list3)
print("... | true |
b3e9049f5b7cf8ac4a0123319d6d2c8afff39b45 | erjan/coding_exercises | /itresume/Проверить фатальность сделки.py | UTF-8 | 849 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | '''
Создайте класс Organization.
В классе опишите атрибут is_opened, который по умолчанию будет равен True, т.е. компания работает.
Создайте метод makeDeal, который принимает на вход параметр isFatal - фатальная сделка или нет. По умолчанию должно быть False.
Внутри метода реализуйте проверку: если isFatal принимает зн... | true |
7c43c0ebbb5af872c9d4d274873e1d90fcfc7c10 | nnyimc/python_tutorial | /copyExercice.py | UTF-8 | 730 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
maPhrase = "bonjour tout le monde";
print(maPhrase);
print(maPhrase[0]);
print(maPhrase[-1]);
print(maPhrase[1:4]);
print(maPhrase[3:]);
print(maPhrase.startswith("bon"));
print(maPhrase.endswith("monde"));
maListe = ["a", "b", "c", "d"];
print(maListe);
print("Le premier... | true |
fc03f809dca8f6afcc77f955ed166dbd4fa65f11 | rwatsh/python | /codeacademy_proj/codeacademy/lambda.py | UTF-8 | 445 | 3.484375 | 3 | [] | no_license | __author__ = 'rushil'
my_list = range(16)
print filter(lambda x: x % 3 == 0, my_list)
languages = ["HTML", "JavaScript", "Python", "Ruby"]
print filter(lambda x: x == "Python", languages)
squares = [i**2 for i in range(1,11)]
print filter(lambda x: x >= 30 and x <= 70, squares)
garbled = "IXXX aXXmX aXXX... | true |
a2ab11d1dd89f5522d51aa3c211ba7d82b8289ec | nexus-kgp/adseg | /loader/dataloader_SBD.py | UTF-8 | 2,084 | 2.6875 | 3 | [] | no_license | from torchvision import transforms,datasets
from torch.utils.data.dataset import Dataset
import torch
import PIL
import numpy as np
import h5py
import subprocess
# In[2]:
class SFBD(Dataset):
"""
A custom dataloader for Stanford Background Dataset.
http://dags.stanford.edu/projects/sceneda... | true |
229f84228d8224681e9c664bf9062ab08dda9fc2 | LewisCummings/opg-use-an-lpa | /features/steps/viewer.py | UTF-8 | 3,738 | 2.5625 | 3 | [] | no_license | from behave import *
from selenium.webdriver.common.keys import Keys
import json
from modules import get_frontend_url
# GIVENS
@given('I go to the viewer service homepage')
def step_impl(context):
context.browser.get(get_frontend_url('view'))
@given('I go to the enter code page on the viewer service')
def step_... | true |
d377c4782f66e85a226be084314fcec4fe78a171 | laurion/Tank-AI | /novisual.py | UTF-8 | 978 | 2.859375 | 3 | [] | no_license | class Fake(object):
def __init__(self, a=None, b=None):
pass
def setpos(self, pos):
pass
def set_rotation(self, ang):
pass
def kill(self):
pass
def step(self, n=None):
pass
class Tank(Fake):
def set_turr_rot(self, ang):
pass
class Turret(Fak... | true |
c50dcf6aac8a29ae22d4aae76a095fa75c85669a | anair13/whs-machine-learning | /tree/attribute.py | UTF-8 | 492 | 4.03125 | 4 | [] | no_license | class Attribute:
"""
Each attribute has a name and a set of value values
The name is the name of the attribute (ex. "weather"),
Values are the different states an attribute can have (ex. "sunny", "cloudy", "rainy")
"""
def __init__(self, name, values):
self.name = name
self.value... | true |
7716f4ebdf245ba6f997cfc03ce63088200733a5 | edutilos6666/CL_Uebung2 | /Hausaufgabe4/TestSet.py | UTF-8 | 653 | 3.65625 | 4 | [] | no_license | set1 = {"der" , "das" , "die", "der"}
print(set1)
set2 = set(["der", "das", "die", "der"])
print(set2)
set3 = set("foobar")
print(set3)
set4 = frozenset("foobar")
print(set4)
print("der" in set1)
print("dier" not in set1)
print(sorted(set3))
print(len(set3))
print(sorted(set4))
print(len(set4))
set1.add("the")
s... | true |
6436a47ff8d3c5bbe60a8ae8c4ad6b16bb4c191e | SciTools/cf-units | /cf_units/tests/integration/test_num2pydate.py | UTF-8 | 782 | 2.875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright cf-units contributors
#
# This file is part of cf-units and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
"""Test function :func:`cf_units.num2pydate`."""
import datetime
import pytest
from cf_units import num2pydate
class Test:
def test_... | true |
8e03cee973337962258ddc8736f7bfad202bd3ed | KKMonika/Digital-Image-Processing | /Compass.py | UTF-8 | 1,963 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('Lenna.png')
img =np.asarray(img, np.float64)
h1 = np.array(([1,1,0],[1, 0, -1], [0, -1 , -1]), dtype = 'float32')
fi1 = cv2.filter2D(img, -1, h1)
fi1 =abs(fi1)
fi1 = fi1/np.amax(fi1[:])
h2 = np.array(([1,1,1],[0, 0, 0], ... | true |
73a3deb34da39a1c524130934121c7df1362191a | FlorianKlemt/pytorch-latent-i2a | /a2c_models/atari_model.py | UTF-8 | 1,831 | 2.515625 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
import torch.nn.functional as F
from utils import init
class AtariModel(nn.Module):
def __init__(self, obs_shape, action_space, use_cuda): #use_cuda is not used and for compatibility reasons (I2A needs the use_cuda parameter)
super(AtariModel, self).__init__()
from i2a.ut... | true |
a0aaa5a8af46eda8e3ebda27f3948055f642a451 | jenbarillas/IA---backpropagation | /test.py | UTF-8 | 5,318 | 2.703125 | 3 | [] | no_license | import numpy as np
import scipy.io as sio
import scipy.optimize as sc
import heapq
import math
from PIL import Image
#-------funciones importantes-------
#crear el nuevo array del label
def createY(x):
res = np.zeros(10)
res[x] = 1.0
return res
def sigmoid(z):
return 1/(1+np.power(np.e,... | true |
6b99b5cfb97579cc702369d621e4ea6b45b8cfa5 | Quart233/csrap_selenium | /tools.py | UTF-8 | 1,284 | 2.8125 | 3 | [] | no_license | import time
import threadpool
from bs4 import BeautifulSoup
import lxml
import urllib
def parseHtml(pageSource):
return BeautifulSoup(pageSource, 'lxml')
def get_img_tags(pageSource):
parsedHtml = parseHtml(pageSource)
imgTags = parsedHtml.find_all('img')
return imgTags
def download_file(url, fileNam... | true |
8596f33c6fef108c185341a3d5d6b275d56bb429 | Pernapple/Cylance-Get-Offline-Device-Info | /getOfflineInfo.py | UTF-8 | 5,527 | 2.96875 | 3 | [] | no_license | import requests
import json
import datetime
from collections import defaultdict
import xlwt
from tempfile import TemporaryFile
#Asks the date range you want to scan
startVar = raw_input("What is the start date you would like to check? (Use YYYY-MM-DD format): ")
endVar = raw_input("What is the end date you wo... | true |
55c95548fc1ca6c88810500f01ecf15db0074762 | khoudiamar/python | /jeux nim.py | ISO-8859-1 | 5,698 | 2.78125 | 3 | [] | no_license | Python 2.7.15rc1 (v2.7.15rc1:bad9a580ca, Apr 14 2018, 23:30:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import random as h
import math as m
def nvTas():
return [h.randrange(5,24) for i in range(h.randrange(3,8))]
def calculScore(tour):
tot... | true |
3ddfaae4c96058174aa276404eca18fbaefebe99 | jaredjasonpeters/python-mongo-graphene | /populate_db.py | UTF-8 | 1,139 | 2.75 | 3 | [] | no_license | from models import *
from mongoengine import *
def reset_db(*documents):
for doc in documents:
doc.objects.delete()
reset_db(User, Post)
ross = User(email='ross@friends.com', first_name='Ross',
last_name='Lawley').save()
john = User(email='john@friends.com', first_name='John',
... | true |
9c15bd8b0e5c5a001565c4673d9ad625d3464b47 | tuananhddo/MarvelHeroImageCrawler | /ironmanCrawler/ironmanCrawler/spiders/brick.py | UTF-8 | 1,088 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from ..items import MyItem
class BrickSpider(scrapy.Spider):
name = 'brick'
pageIterator = 1
numberOfPage = 3
# allowed_domains = ['brickset.com/sets/year-2016']
start_urls = ['http://brickset.com/sets/year-2016/']
def parse(self, response):
SET... | true |
9cca094d557ef2bb5c43f9a720ee0ced8ed98d1d | BarryZM/stock-multifactor | /src/ProblemA/original/ThreeLines.py | UTF-8 | 3,460 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author DDullahan
@date 2019-4-18 21:17
@version 1.0
"""
# -*- coding: utf-8 -*-
from atrader import *
import numpy as np
# 初始化:注册数据和设置参数
def init(context):
set_backtest(initial_cash=1e6) #初始化设置账户总资金
reg_kdata('day', 1) #注册日频行情数据
#设置参数:
context.win = 61 #计算所需总数据长度
... | true |
3e61c0f3983da6046f8427ec93f741b2b86edb24 | tengyaolong2000/Random-stuff | /Python Projects/tower_of_hanoi_and_other_recursion.py | UTF-8 | 455 | 3.78125 | 4 | [] | no_license | def moveDisk(fp,tp):
print("moving disk from",fp,"to",tp)
def moveTower(height,fromPole, toPole, withPole):
if height >= 1:
moveTower(height-1, fromPole, withPole, toPole)
moveDisk(fromPole, toPole)
moveTower(height-1, withPole, toPole, fromPole)
def hello(n):
return
x = hello('A... | true |
7a3a1d2f1c8f8542307695004c25920494c66922 | ruzhaa/Programming101-Python | /week07/song.py | UTF-8 | 3,776 | 3.484375 | 3 | [] | no_license | import time
import json
from tabulate import tabulate
class Song:
@staticmethod
def _length_to_sec(split_time):
if len(split_time) == 2:
return int(split_time[0]*60 + split_time[1])
elif len(split_time) == 3:
return int(split_time[0]*3600 + split_time[1]*60 + split_tim... | true |
99c0136d1c9e78f8c6f458342643e4f7cd760e3e | williamFalcon/computational-stats-demos | /automatic_diff/autodiff.py | UTF-8 | 1,629 | 2.953125 | 3 | [] | no_license |
"""
This package implements autodifferentiation using
the backprop algorithm.
It's not meant to be performant (aka, no cython or c)
it's just a proof of concept for learning and understanding
how this is done in libraries such as theano and tensorflow
"""
def gradients(fn, vars):
def compute(**kwargs):
... | true |
2444b76b88edfd4fab1cc7fec014487ca208ba89 | DavidOriel/Nand-2-Tetris | /11/project11/VMWriter.py | UTF-8 | 2,242 | 3.078125 | 3 | [] | no_license |
class VMWriter:
"""
this class will write for us a vm file, the comp engine is using the functionality here
"""
def __init__(self,output):
self.outputFile = open(output,"w")
def write_arythmetic(self,ary):
"""
write arytmetic command
:param ary:
... | true |
06cd797e16c51a1d8b5035d175505d3ae4360524 | boazbk/seirsplus | /seirsplus/utilities.py | UTF-8 | 8,615 | 2.625 | 3 | [
"MIT"
] | permissive | import sys
import numpy
import matplotlib.pyplot as pyplot
def gamma_dist(mean, coeffvar, N):
scale = mean*coeffvar**2
shape = mean/scale
return numpy.random.gamma(scale=scale, shape=shape, size=N)
def dist_info(dists, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
dists = [dists] if n... | true |
cac01e526d353a01468c9b229186216b5f3d4678 | royveshovda/pifog | /source/piclient/blinktpi/blinkthandler.py | UTF-8 | 1,333 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | from blinkt import set_pixel, set_brightness, show, clear
def init():
set_brightness(0.1)
def display_unknown():
clear()
set_pixel(0, 0, 255, 255)
set_pixel(1, 0, 255, 255)
set_pixel(2, 0, 255, 255)
set_pixel(3, 0, 255, 255)
set_pixel(4, 0, 255, 255)
set_pixel(5, 0, 255, 255)
set... | true |
533de58479202de497f65bcd99c4a0d7e5ab4cdf | zha-hengfeng/EACNet | /utils/trainID2labelID.py | UTF-8 | 1,525 | 2.578125 | 3 | [
"MIT"
] | permissive | # converting trainIDs to labelIDs for evaluating the test set segmenatation results of the cityscapes dataset
import numpy as np
import os
from PIL import Image
# index: trainId from 0 to 18, 19 semantic class val: labelIDs
cityscapes_trainIds2labelIds = np.array([7, 8, 11, 12, 13, 17, 19, 20, 21, 22, 23, 24, 25, 2... | true |
d566a0157436fb15e00e2b9e6aa7248caf9e9a93 | atvaccaro/learns | /dash-tutorial/form.py | UTF-8 | 2,229 | 2.921875 | 3 | [
"MIT"
] | permissive | '''
Testing out dbc with multipage
'''
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
from flask import Flask, request, redirect
clients = ['a', 'b', 'c']
server = Flask('app')
app = dash.Dash(__name__... | true |
34d309f87fbb3135021185558bd4bbaf2a49efa1 | Fsmallsky/leetcode | /11_maxArea.py | UTF-8 | 759 | 3.15625 | 3 | [] | no_license | class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
left = 0
right = len(height)-1
maxv = (right-left)*min(height[0], height[right])
while left<right:
if height[left] < height[right]:
... | true |
3123524150bb8969a1f2303e128535d8731b2ee7 | batfolx/snake_ai | /snake.py | UTF-8 | 8,366 | 2.796875 | 3 | [] | no_license | import time
import pygame
import tensorflow as tf
from tf_agents.agents.dqn import dqn_agent
from tf_agents.environments import tf_py_environment
from tf_agents.networks import sequential
from tf_agents.policies import random_tf_policy
from tf_agents.replay_buffers import tf_uniform_replay_buffer
from tf_agents.specs i... | true |
c9c7138939788ff29749e2b9a2c18710bb4f21d7 | yangyuxiang1996/Chinese-Text-Generation | /data/process.py | UTF-8 | 1,322 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: Bingyu Jiang, Peixin Lin
LastEditors: Peixin Lin
Date: 2020-07-13 20:16:37
LastEditTime: 2021-01-26 00:22:29
FilePath: /Assignment2-3/data/process.py
Desciption: Process a raw dataset into a sample file and partition it into train, dev, test sets.
Copyright: 北京贪... | true |
00b4c8756e1320fdb2e87f991a63e1cc77bc6077 | MasterMedo/aoc | /2020/day/11.py | UTF-8 | 1,579 | 3.046875 | 3 | [] | no_license | from itertools import count
from copy import deepcopy
def isvalid(row, col):
return 0 <= row < ROWS and 0 <= col < COLUMNS
def neighbours1(r, c):
return [(r-1, c-1), (r-1, c+1), (r, c-1), (r+1, c),
(r+1, c+1), (r+1, c-1), (r, c+1), (r-1, c)]
def neighbours2(row, col):
n = []
for delta_... | true |
091f54ab179e74c497927c66a8549f75a4fd3f33 | HarshaRathi/PPL-Assignment | /Assign1/5.py | UTF-8 | 172 | 3.15625 | 3 | [] | no_license |
a = list(range(1,26))
b = list()
c = raw_input("Enter Page Number")
for i in c.split():
b.append(int(i))
d = set(a) - set(b)
print ("Missing Page Numbers are")
print d
| true |
f407f7e878d34589e339440a0d6a608473ff93fc | spock-the-wizard/GarmentTransfer | /input2_monster/scripts_pants/sampler_default.py | UTF-8 | 8,114 | 2.53125 | 3 | [] | no_license | import bpy
import bmesh
from mathutils import Vector
import mathutils
import numpy as np
### this script doesn't modify the .blend file! it will create a single .npy file ###
### sample points will be in world coordinates ###
##### Parameters ####
n=18
m=3 #ignore this
###########
error = Vector((-1,-1,-1))
obj = b... | true |
fd52d4cc190f636ed426bc57cc6e3ee1e6e13018 | imrajashish/python | /sum.py | UTF-8 | 407 | 4.1875 | 4 | [] | no_license | '''num1=input("Enter the number: "))
num2=input("Enter the second number: "))
sum= float(num2)+float(num1)
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))'''
#print(sum)
def factorial(n):
# single line to find factorial
return 1 if (n==1 or n==0) else n * factorial(n - 1);
# Driver Cod... | true |
604200a760a5be2157d25574f5dcce3824b98f8c | runwei/YahooForex | /FX.py | UTF-8 | 1,890 | 2.609375 | 3 | [] | no_license | __author__ = 'runwei_zhang'
import unirest
import xml.etree.ElementTree as ET
import threading
from threading import Thread, Lock
from datetime import datetime
import time
import csv
import os.path
mutex = Lock()
timeset = set()
curday = ''
def callback_function(response):
global curday
global timeset
roo... | true |
848bb856fae64275b846a517150ca7d414ab0875 | skamjadali7/Python-Programming | /.vscode/ProgrammingConcept/sortString.py | UTF-8 | 340 | 4.09375 | 4 | [] | no_license | #Sort the Alphanumeric String
name = input("Enter the String")
s1=s2=output='' #""" Taken 3 Variable s1 s2 and output as empty"""
for x in name:
if x.isalpha():
s1=s1+x
print(s1)
else:
s2=s2+x
print(s2)
for x in sorted(s1):
output=output+x
for x in sorted(s2):
output=out... | true |
2ae6d298668f65e577f45951789ca1d0490c3ff3 | NishanthMHegde/Pandas-practice | /dataframes2.py | UTF-8 | 1,292 | 3.78125 | 4 | [] | no_license | import numpy as np
import pandas as pd
np.random.seed(0)
df = pd.DataFrame(np.random.randn(5, 4), ['A', 'B', 'C', 'D', 'E'], ['P', 'Q', 'R', 'S'])
print(df)
print("\n\n")
#conditional selection of rows
print("conditional selection of rows")
boolres = df['Q'] > 0
print(boolres)
print(df[boolres])
print("\n\n")
#anot... | true |
c71b65c562e292d61e3bae6d56e178b4fe253b34 | vikramlance/Python-Programming | /Leetcode/problems/Problem0767_reorganize_string.py | UTF-8 | 1,209 | 3.390625 | 3 | [] | no_license |
class Solution:
def reorganizeString(self, S: str) -> str:
S = list(S)
for i in range(1, len(S) - 1):
if S[i] == S[i - 1]:
for j in range(i + 1, len(S)):
if S[j] != S[i]:
S[i], S[j] = S[j], S[i]
brea... | true |
91889130717c7a376478efc3cdeaf2d31f020431 | benjamincampbell/caboose | /plugins/youtube.py | UTF-8 | 1,821 | 3.015625 | 3 | [] | no_license |
@command("youtube", aliases = ["yt"], man = "Perform a YouTube search, returning the first result. Usage: {leader}{command} <query>")
def youtube(bot, line):
from plugins.shorten import shorten_url
import logging
def get_playtime(raw_playtime):
playtime = raw_playtime[2:]
playtime_min_spl... | true |
3931dd04ff1e2ad99bd7247f2624f68920fe880c | ManishaPol/TestProject | /test.py | UTF-8 | 432 | 2.59375 | 3 | [] | no_license | import unittest
from PyhonTestProject import firstElement
class TestMyFunction(unittest.TestCase):
def test_first_element(self):
self.assertEqual(firstElement([2,3,4]), 2)
def test_first_element_Sucess(self):
self.assertEqual(firstElement([1,2,3,4]), 1)
if __name__ ==... | true |
b91d3d4a30bed8224359c0842ea4e8fc0a342a3b | MontePalaSando/programaci-n-de-audio | /GRABAR_METRONOMO_ver1/Metronomo.py | UTF-8 | 3,173 | 2.609375 | 3 | [] | no_license | import pyaudio
import math
import matplotlib.pylab as plt
import numpy as np
from Seno import Seno
from ReproAudio import Audio
from Guardar import Archivo
class Metro:
def __init__(self, BUFFER, FORMAT, CHANNELS, RATE,Notas,Niveles,BPM):
self.BUFFER = BUFFER
self.FORMAT = FORMAT
self.CHA... | true |
32cfede923c83456a9768be5e038464f01cbffa8 | Jassy930/leetcode_main | /953.验证外星语词典.py | UTF-8 | 705 | 3.046875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=953 lang=python3
#
# [953] 验证外星语词典
#
class Solution:
cost={}
def isAlienSorted(self, words: List[str], order: str) -> bool:
for i in range(len(order)):
self.cost[order[i]] = i
for i in range(len(words)-1):
if not self.smallthan(words[i], words[i... | true |
0f870ad7b6c3e93b83e603c0c4bdc2f5a2e167a0 | rafaelszt/pwned_list_checker | /pypwned.py | UTF-8 | 5,195 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import requests
import sys
import time
import getopt
PWNED_BREACH_API_URL = "https://haveibeenpwned.com/api/v2/breachedaccount/%s"
PWNED_BREACH_SHORT_API_URL = "https://haveibeenpwned.com/api/v2/breachedaccount/%s?truncateResponse=true"
PWNED_PASTE_API_URL = "https://haveibeenpwned.com/api/v2/pastea... | true |
ae0c886f7e4ccd6bb4af5c92825dc34c5055de3c | stormy-ua/algorithms | /python/quicksort.py | UTF-8 | 687 | 3.671875 | 4 | [] | no_license | import random
def get_pivot(l, r):
return r
def swap(arr, i, j):
tmp = arr[i]
arr[i] = arr[j]
arr[j] = tmp
def partition(arr, p, l, r):
swap(arr, p, r)
k = l
for j in range(l, r):
if arr[j] < arr[r]:
swap(arr, j, k)
k += 1
swap(arr, k, r)
return k
... | true |
09d97d83cd0d8524dd463f83825ab4a65ec590f8 | jonathf/adventofcode | /2019/09/run.py | UTF-8 | 12,125 | 3.59375 | 4 | [] | no_license | """
--- Day 9: Sensor Boost ---
You've just said goodbye to the rebooted rover and left Mars when you receive
a faint distress signal coming from the asteroid belt. It must be the Ceres
monitoring station!
In order to lock on to the signal, you'll need to boost your sensors. The Elves
send up the latest BOOST program... | true |
f27e89c98c6cfd8434b0085d92d267e74bfde187 | augusto607/TO-DO_list_PythonFlaskSql | /todoer/todo/__init__.py | UTF-8 | 1,398 | 2.796875 | 3 | [] | no_license | # archivo __init__.py que python tomara como modulo
# importamos la libreria os para poder acceder a las variables de entorno y otras cosas del sistema operativo
import os
# luego debemos importar Flask
from flask import Flask
# creamos una funcion que nos permitira hacer testing y/o crear varias instancias de nues... | true |
245dd1d911f3e43c23dd701d27aad7b9a2d654ee | westminster-bis/tw7-00012270 | /task7-responsive.py | UTF-8 | 781 | 4.03125 | 4 | [] | no_license | def get_input():
new_dict = dict()
n = int(input("Number of exams: "))
for i in range(n):
print("\n*** Iteration " + str(i+1) + " ***")
new_key = input("Name of Module: ")
value_flag = False
while not value_flag:
new_value = int(input("Your mark (0-100): "))
... | true |
02f6f6313c300a769c85534b537980a651d58135 | chrisyan82000/leetcode | /1206.py | UTF-8 | 434 | 3.234375 | 3 | [] | no_license | class Skiplist:
def __init__(self):
self.ds = {}
def search(self, target: int) -> bool:
return target in self.ds
def add(self, num: int) -> None:
self.ds[num] = self.ds.get(num, 0) + 1
def erase(self, num: int) -> bool:
if num not in self.ds: return false
... | true |
d164266931b3cb7569ae2217ab81197b2799c422 | hyfc/telegram-mail-bot | /utils/mail.py | UTF-8 | 1,051 | 2.6875 | 3 | [
"MIT"
] | permissive | from pyzmail import PyzMessage, decode_text
class Email(object):
def __init__(self, raw_mail_lines):
msg_content = b'\r\n'.join(raw_mail_lines)
msg = PyzMessage.factory(msg_content)
self.subject = msg.get_subject()
self.sender = msg.get_address('from')
self.date = msg.get_... | true |
69b55c6ad23f4e827e514ee759d7d287e2c3d743 | keviv202/Python-Code | /Number of 1 Bits.py | UTF-8 | 158 | 2.921875 | 3 | [] | no_license | def hammingWeight(n):
c = 0
while n:
n = n & n - 1
c += 1
return c
n= 0o0000000000000000000000000001010
print (hammingWeight(n))
| true |
dc513a843b44e55eb0472a7a165e87d3202e2c1c | UmeHabibasaleem/Emotional-AI | /PythonLibraries/ml-agents/gym_unity/envs/gympractice.py | UTF-8 | 1,325 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import sys
from gym_unity.envs import UnityEnv
print("Python version:")
print(sys.version)
# check Python version
if (sys.version_info[0] < 3):
raise Exception("ERROR: ML-Agents Toolkit (v0.3 onwards) requires Python 3")
env_name ="C:/HinaProgramm/UnityProjects... | true |
df1878ef69325052ed0852810363067efd0695f2 | ustbliubo2014/HotspotAnalysis | /query_search_cluster/query_sim_mean.py | UTF-8 | 5,063 | 2.625 | 3 | [] | no_license | # encoding: utf-8
"""
@author: liubo
@software: PyCharm
@file: query_sim_mean.py
@time: 2017/4/13 14:57
@contact: ustb_liubo@qq.com
@annotation: query_sim_mean : 每个query的keyword对应的vector加权后取平均, 直接计算距离
"""
import sys
sys.path.append('/home/liubo-it/HotspotAnalysis/')
import logging
from logging.config import fileConfig... | true |
fc3b27724a7f95ec0ef2ef9fe831c0c70be92271 | BibekMagar99/Hacker-Rank-Python-challenges-solutions- | /Group(), Groups() & Groupdict().py | UTF-8 | 201 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri May 14 16:38:18 2021
@author: bibek
"""
import re
S = input()
pattern = r'([a-zA-Z0-9])\1+'
m = re.search(pattern,S)
print(m.group(1) if m else -1) | true |
90397f18509b8689496c79478c6e1dfb82eb9f9f | goharalisiddiqui/ISFET | /matrixGenerator.py | UTF-8 | 3,393 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python3
import numpy as np
from scipy.sparse import diags
def get_capMat_1D_spherical(space_grid, perm_grid, BC_left, BC_right):
space_grid = np.array(space_grid)
perm_grid = np.array(perm_grid)
h = np.append(space_grid[1:] - space_grid[:-1],[0.0])
h_prev = np.append([0.0],h[:-1])
... | true |
d4f259669c57a3e7f784312a8614ff759af48b4c | gistable/gistable | /dockerized-gists/2231860/snippet.py | UTF-8 | 5,089 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf8 -*-
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distrib... | true |
aadb8309e21a0bb51430a784e3b69d512bc743f5 | ShahriarCodes/100_days_LeetCode_challenge | /week-6/Day_39/number_complement.py | UTF-8 | 484 | 3.3125 | 3 | [] | no_license | class Solution(object):
def findComplement(self, num):
"""
:type num: int
:rtype: int
"""
binary = bin(num)[2:]
complement = ''
for i in binary:
if i == '1':
complement += '0'
else:
complement += '1'
... | true |
acc98d3a9a195673bf89bb33663d12106d5fc93d | edoriggio/algorithms-and-data-structures | /exercises/group_of_k.py | UTF-8 | 1,072 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021 Edoardo Riggio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | true |
4cd0294d218112b79df42abb756af33b15943e0a | pravali96/Natural-Language-Processing | /Fake News Classifier Models/FakeNewsClassifier_using_TFIdf.py | UTF-8 | 5,258 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 23 11:19:08 2021
@author: prava
"""
import pandas as pd
df=pd.read_csv("C:/Users/prava/Downloads/fakenews/train.csv")
X=df.drop('label', axis=1)
X.head()
y=df['label']
df.shape
from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer... | true |
6463db95672b9306402c34fdd1c4abefbcaa24be | mikedelgaudio/CS-555-GEDCOM | /src/modules/list_deceased.py | UTF-8 | 362 | 3.0625 | 3 | [] | no_license | import datetime
from helpers import dates
def us29ListDeceased(individuals):
for i in individuals:
if(not dates.us42ValidDate(i[6])):
pass
if(not dates.us01DateAfterCurrentDate(i[6])):
pass
else:
if(i[6] != "N/A"):
print("US29: DEAD: " + i... | true |
5a6852e9ff8973bff348bb78e0a67a6edda906ba | ajkannan/Classics-Research | /Utilities/FunctionalNGram.py | UTF-8 | 3,787 | 3.359375 | 3 | [
"MIT"
] | permissive | from Text import Text
from pprint import pprint
import numpy as np
import string
import itertools
import copy
def combine_n_gram_features(n_gram_probabilities):
""" Compiles n-gram probability features into numpy array
Parameters
----------
n_gram_probabilities:
Returns
-------
features and respective n-gram... | true |
1899c2f4adc54fa7d250d938a3600772f54a4a62 | jiajinliang/Sentiment-And-FakeNews-Detector | /all_in_one_P2.py | UTF-8 | 15,750 | 2.59375 | 3 | [] | no_license |
import sentiment as sentimentinterface
import classify
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.switch_backend('agg')
import matplotlib.ticker as ticker
# %matplotlib inline
import copy
import math
import matplotlib as mpl
import six
import pandas as pd
import sub... | true |
2dae9d841a23c6ddc1146905b6cb04a0763dd917 | sboutin44/CryptopalsPython | /test/test_base64.py | UTF-8 | 1,292 | 2.84375 | 3 | [] | no_license | import unittest
import src.c1 as c1
class TestBase64(unittest.TestCase):
def setUp(self):
self.plaintexts = [
"Man",
"Ma",
"M",
"any carnal pleasure.",
"any carnal pleasure",
"any carnal pleasur",
"any carnal pleasu",
... | true |
d9298ac962304181e3f120ff590883a5586827df | Shaoli-Huang/PyReID | /package/statistics.py | UTF-8 | 4,681 | 2.84375 | 3 | [
"MIT"
] | permissive | __author__ = 'luigolas'
import numpy as np
from scipy.stats import cumfreq
class Statistics():
"""
Position List: for each element in probe, find its same ids in gallery. Format: np.array([[2,14],[1,2],...])
Mean List: Calculate means of position list by axis 0. Format: np.array([1.52, 4.89])
Mode_li... | true |