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 |
|---|---|---|---|---|---|---|---|---|---|---|
d8894cc25bf90f8379bc107f419b3e33a2d27224 | Mariewelt/OpenChem | /openchem/data/feature_data_layer.py | UTF-8 | 2,581 | 2.84375 | 3 | [
"MIT"
] | permissive |
import numpy as np
from torch.utils.data import Dataset
from openchem.data.utils import process_smiles
from openchem.data.utils import read_smiles_property_file
from openchem.data.utils import get_tokens, augment_smiles
class FeatureDataset(Dataset):
"""
Creates dataset for feature-property dat... | true |
78c0e191701229cf96406d1f1f9b1608de83b915 | BrChung/Lexical-Analysis | /digit_transistions.py | UTF-8 | 2,105 | 3.796875 | 4 | [
"MIT"
] | permissive | #Brian Chung
#9/27/2019
# The character '~' or tilde represents the end of a idenitifer or digit, it is used to jump to an end state
#Digit State Transistions
def digit_StartTransistions(inputString):
splitInputString = inputString.split(None,1)
inputChar, inputString = splitInputString if len(splitInputStrin... | true |
3bd3a7c1b416b43f14e4d4fa5101cd3b739d24fb | tdworowy/DeepLearningStaff | /data_utils/data_utils.py | UTF-8 | 221 | 2.609375 | 3 | [] | no_license | import numpy as np
def vectorized_sequences(sequence, dimension=20000):
results = np.zeros((len(sequence), dimension))
for i, sequence in enumerate(sequence):
results[i, sequence] = 1
return results
| true |
1eee0acf3414cda3a48328a0f6bc643d3ce5cd48 | chrisying/vgg-tracker | /vot_preprocess.py | UTF-8 | 6,421 | 3.1875 | 3 | [] | no_license | '''
Preprocess images in VOT2016 by:
- Taking the first frame per MAX_FRAME_GAP frames as the key frame
- Process to KEY_FRAME_SIZE
- Pad at least w+h/8
- Paste onto averge RGB background (if necessary)
- Crop
- Resize
- Take remaining MAX_FRAME_GAP-1 images and process to SE... | true |
22409096975d7041507ebca89ac376e423a410c7 | mpm2050/Raven | /src/python/zoundry/base/util/types/parameters.py | UTF-8 | 3,717 | 3.03125 | 3 | [] | no_license |
# ------------------------------------------------------------------------------
# Common interface for all 'parameter' classes.
# ------------------------------------------------------------------------------
class IZParameters:
def getParameters(self):
u"""getParameters() -> dictionary
... | true |
029d87468cf8ea03d88acf0036857c692e7b1d75 | wenbo5565/AppliedProject_MultiDigitDetection | /ParseData.py | UTF-8 | 3,765 | 3.1875 | 3 | [] | no_license | """
Define class and method to load .mat file and dump into JSON
"""
import h5py
import tqdm
import json
class DigitStructFile:
def __init__(self,h5file):
""" class constructor """
self.file = h5py.File(h5file,'r')
self.digitStructName = self.file['/digitStruct/name']
se... | true |
29dee0ef3067b8ff1b2006944a042e533c121211 | yamekimsense/yamebook | /ch7/7-7-4-har/7-7-4-har.py | UTF-8 | 6,037 | 2.515625 | 3 | [] | no_license | '''
input the web URL to connect
make the HAR
extract connect - wait -download
make the waterfall chart
download chrome driver
pip3 install selenium-wire
'''
#100 start
from seleniumwire import webdriver
import json, time, datetime, webbrowser, os, sys
#200 input URL
web_add = input("input URL with http or https ?... | true |
8d6dbc5da9c1d021408d49ec9780ca6793fe588e | j2junn/Algorithm_Study | /programmers/before/hash/P_42578_위장.py | UTF-8 | 474 | 3.1875 | 3 | [] | no_license | # 21-04-07
def solution(clothes):
answer = 1
dic = {}
# k라는 key의 value가 없으면 0, 있으면 불러와서 1씩 더해줌
for v, k in clothes:
dic[k] = dic.get(k, 0) + 1
# 종류의 개수 + 1 중에 1개를 뽑을 수 있도록 함(안뽑는경우도 고려)
for v in dic.values():
answer *= v + 1
# 의상이 최소 한 개 이상 있어야 하므로 해당 경우 1... | true |
ce4a6e16e7d496a85f1c107fac69a968228e6265 | shubham-thakare/gender-identification-by-voice | /neural_net.py | UTF-8 | 1,476 | 3.0625 | 3 | [
"MIT"
] | permissive | """Train and validate neural net"""
import pickle
import warnings
from sklearn.neural_network import MLPClassifier
from data_process import *
warnings.filterwarnings("ignore")
def train_neural_net(x_train, y_train, root, tk, output_text_area):
"""
Train and save neural net.
:param x_train: Training inp... | true |
b5301d1812bb0d1ed93d8e7db004a76a0e1176ec | crechen/python_learn_code | /alien_invasion/exercise/ex13_1.py | UTF-8 | 1,180 | 3.4375 | 3 | [] | no_license | import pygame
import sys
from pygame.sprite import Group
from pygame.sprite import Sprite
class Star(Sprite):
def __init__(self, screen):
super(Star, self).__init__()
self.screen = screen
self.image = pygame.image.load("star.png")
self.rect = self.image.get_rect()
self.rect... | true |
3c5a89f81f7dd2072cd18b8763a4a75268dadca2 | meghanakillada/showrecommend | /main.py | UTF-8 | 1,284 | 3.203125 | 3 | [] | no_license | """Python"""
from flask import Flask, render_template, request
import random
import requests
import json
app = Flask(__name__)
#popular tv shows api call from "Episodate"
url = "https://www.episodate.com/api/most-popular?page=1"
response = requests.request("GET", url)
#json output to python dictionary
responseJsonOb... | true |
94b10479e95ab3aeef7ad120c00e8d08395c0813 | stankiewiczm/contests | /ProjectEuler/UC solutions/Successful 101-150/Q130.py | UTF-8 | 862 | 2.890625 | 3 | [] | no_license | from Numeric import *
MAX = 20001; Prime = list(); Prime.append(2); NP = 0;
IsP = ones(MAX); IsP[1] = 0;
def Gen():
for i in arange(2,MAX/2):
IsP[2*i] = 0;
n = 3;
NIsP = 1;
while (n < MAX):
if (IsP[n] == 1):
Prime.append(n);
NIsP += 1;
... | true |
146a5435d0150a1c195c7141fb2fa7a66a74dead | Aasthaengg/IBMdataset | /Python_codes/p03011/s938374775.py | UTF-8 | 58 | 2.84375 | 3 | [] | no_license | a,b,c=map(int,input().split())
x=max(a,b,c)
print(a+b+c-x) | true |
1482978b3c20b7c2b6d6a2fcd4a0cb3efc285eb8 | prasys/catastrophic_forgetting | /models/transformer_encoder.py | UTF-8 | 2,128 | 2.59375 | 3 | [] | no_license | import math
import torch
import torch.nn as nn
from torch.nn import TransformerEncoder, TransformerEncoderLayer
# It's actually TransformerEncoder custom with PositionalEncoder but we use
# name: TransformerRepresentation to avoid confusion with TransformerEncoder Representation.
class TransformerRepresentation(nn.Mod... | true |
1fde0977d3de1ae009e0b6368bffeb7bb3e227fa | smallerhand/portfolio | /etc/creating_moving_chart.py | UTF-8 | 1,573 | 3.296875 | 3 | [] | no_license | #y1년부터 y2년까지 해별 상위 n개 이름 그래프로 저장하는 name이라는 함수 만듬.
#성별은 M, F 이외를 입력하면 전체로 만듬.
def Name(y1, y2, n, g):
import pandas as pd
from numpy import array
import matplotlib.pyplot as plt
import time as t
from matplotlib import font_manager, rc
rc('font', family='AppleGothic')
plt.rcParams['axes.unico... | true |
5c8ad705029055a22381b26fb76735e620e7f495 | xiayu0321/pythonDeme | /analysis_data/btc_close.py | UTF-8 | 902 | 2.953125 | 3 | [] | no_license | import json
import pygal
import math
filename = './btc_close_2017_urllib.json'
with open(filename) as f:
btc_data = json.load(f)
dates,months,weeks,weekdays,closes = [],[],[],[],[]
for btc_dict in btc_data:
date = btc_dict['date']
month = int(btc_dict['month'])
week = int(btc_dict['week'])
weekday = btc_dict['w... | true |
a74054f8e7205ddbc82c4b8ae1373b618ebba12e | arifoyong/TempSensor | /db_migrate.py | UTF-8 | 773 | 2.75 | 3 | [] | no_license | from views import db
from _config import DATABASE_PATH
import sqlite3
import datetime
with sqlite3.connect(DATABASE_PATH) as con:
c = con.cursor()
c.execute('ALTER TABLE sensor_data RENAME TO old_sensor_data')
db.create_all()
c.execute('SELECT data_id, sensor, sensor_value FROM old_sensor_data ORDE... | true |
cba0cb3e8e9fe142b4cef6c4f202da8b56c11d86 | drahoja9/BI-OOP-CAD | /app/command_engine.py | UTF-8 | 1,503 | 2.703125 | 3 | [
"MIT"
] | permissive | from typing import List, Dict
from app.commands import Command
class CommandEngine:
def __init__(self, controller):
self._controller = controller
self._undos = []
self._redos = []
def _push_undo(self, command: Command):
if not self._undos:
self._controller.enable_... | true |
1816124e2e836bef423520c29adefcf8824cc7f5 | YimianDai/open-deepinfrared | /deepir/core/evaluation/mean_locap.py | UTF-8 | 18,867 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from multiprocessing import Pool
import numpy as np
from mmdet.core import average_precision
from mmdet.core import print_map_summary
def darts_scoring(pred_centroids, gt_bboxes):
"""Calculate the normalized centerness between each predicted centroid and each gt_bbox.
Args:
pred_centroids(ndarray): ... | true |
d92f8aaec6c272e1d71d487e76e2457743b0d37d | anasalawa/Python | /Programs/passcheck.py | UTF-8 | 1,205 | 4.75 | 5 | [] | no_license | # Determine whether or not a password is "secure". A "secure" password is
# At least 7 characters
# Contains at least one uppercase letter
# Contains at least one lowercase letter
# Contains at least one numeric digit
#
# Returns: True if the password is "secure", False otherwise
#
def isSecure(password):
# Verify ... | true |
e7de0f3fe0d65cef6706b58fbafa9e15d7c13ab5 | theodoro/logica-prog-com-python | /logica/04-condições/4-6-exercicio.py | UTF-8 | 168 | 3.375 | 3 | [] | no_license | km = int(input('Informe a distancia do trajeto: '))
preco = 0
if km <= 200:
preco = km * 0.50
else:
preco = km * 0.45
print('Passagem custou: %10.2f' % preco) | true |
2f433de8a1c2140cf71e5d9d0d3f9448e2dd9456 | PMuchina/Long-read-assembler-comparison | /scripts/make_test_genomes.py | UTF-8 | 3,633 | 2.6875 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
"""
This script prepares a bunch of genomes for use as Badread references.
For each output genome it:
* sets the chromosome to 1x depth
* sets any plasmids to a random depth (the min/max of the range depending on the plasmid size)
* sets all output replicons to circular
This script is lic... | true |
7fa3f3d1807d34e1a59a4bc0bfa9c922c505a0f1 | tomFelder/rhinoHacks | /WIP_newLayer.py | UTF-8 | 1,745 | 2.609375 | 3 | [] | no_license | import rhinoscriptsyntax as rs
from Rhino import *
from Rhino.Commands import *
from Rhino.DocObjects import *
from scriptcontext import doc
def CopyObjectsToLayer():
objs = rs.ObjectsByType(16, select=False) #get all polysurfaces in model
if objs:
layer_objs = [] #empty list to store objs t... | true |
828a2532a5d586b66a1cf37387a54524a3b455c3 | WilsonCarv/Material_calse2 | /Listas_Calse2.py | UTF-8 | 2,985 | 3.96875 | 4 | [] | no_license | #Las listas es una coleccion de elemntos, sea objetos, o valores primitivos
#Seprados por coma lo elementos
#Lo que ingresamos ahi se queda con el tipo que es
a=[]
print(type(a))
a=[1,2,3,99,1000]
b=[10,11,'a']
c=['a','b',None]
d=['a','b',None,[]]
print(a,b,c,d,)
print(len(a))
#Consulta si el elemnto x esta ... | true |
801cb1b463bcb7313d99c082f0a9058ca0db99cf | rasake/CLiFFpy | /cl_map_visualisation.py | UTF-8 | 1,449 | 2.71875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import helpers as he
class CLVisualisation:
def __init__(self, cl_map):
self.map = cl_map
def show_raw_locations(self):
fig, ax = plt.subplots(nrows=1, ncols=1)
ax.scatter(self.map.data['x'], self.map.data['y'])
plt.show()
... | true |
b933f7718aba089680449997a090b0145f4c0807 | felipe-gdr/linear-algebra | /line.py | UTF-8 | 4,293 | 3.203125 | 3 | [] | no_license | from decimal import Decimal, getcontext
from vector import Vector
getcontext().prec = 30
class Line(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, normal_vector=None, constant_term=None):
self.dimension = 2
if not normal_vector:
all_zeros =... | true |
a5e4d6aed3db04c4ba8643088279b644607fe4eb | AdamZhouSE/pythonHomework | /Code/CodeRecords/2649/60691/284479.py | UTF-8 | 563 | 3.359375 | 3 | [] | no_license | def function(s):
l = s.split(' ')
s1 = '{:b}'.format(int(l[0]))
left = int(l[1])
right = int(l[2])
l1 = []
for i in range(len(s1)):
l1.append(s1[i])
for i in range(len(s1)-right, len(s1)-left+1):
reverse(l1, i)
s2 = ''
for i in range(len(l1)):
s2 += str(l1[... | true |
5dde243bdc137f7d1673708099a858bf7f9be903 | azadnsu/Local-Library_Test-Script | /LocalLibraryAutomation/Pages/AddNewBookPage.py | UTF-8 | 1,643 | 2.84375 | 3 | [] | no_license | from selenium.webdriver.support.ui import Select
from Locators.locators import Locators
import random
import settings
class AddNewBookPage():
def __init__(self, driver):
self.driver = driver
self.book_title_id = Locators.book_title_id
self.book_author_id = Locators.book_author_i... | true |
4a663d4ee5de0651f10ce277823b77718f8e8cb6 | martianmartian/mypy | /collection/0.0.1-tricks.py | UTF-8 | 11,176 | 3.359375 | 3 | [] | no_license |
================ numpy Tricks ================
'''fancy indexing'''
import numpy as np
scores = np.random.random((2,5))
a = [0,1,0]
b = [0,0,1]
print scores[a,b]
---- randomly pick value on axis=1 from all axis=0 ----
# values = np.random.random((100,5))
values = np.arange(0,500).reshape(100,5)
index... | true |
86f74ec2295f5808295e8bd1011813dcbcddec89 | Bradysm/daily_coding_problems | /minNumberOfCoins.py | UTF-8 | 3,364 | 3.75 | 4 | [
"MIT"
] | permissive | # Given an array of positive integers representing coin denominations and a single non-negative integer representing a
# target amount of money, implement a function that returns the smallest number of coins needed to make change for that
# target amount using the given coin denominations. Note that an unlimited amou... | true |
0806fb8e786b940a07eed0dac0956005e5d9c276 | krishppuria/Python-work | /JSON/json_lecture.py | UTF-8 | 1,523 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 12:24:00 2018
@author: dev
"""
import json
json_string = """
{
"researcher": {
"name": "Ford Prefect",
"species": "Betelgeusian",
"relatives": [
{
"name": "Zaphod Beeblebrox",
... | true |
7a7c42523baff6d40a23ebb9e504099446aec6d0 | kamit17/Python | /Think_Python/Chp7/Examples/continue.py | UTF-8 | 390 | 4.375 | 4 | [] | no_license | '''
Continue statement:
This is a control flow statement that causes the program to immediately skip
the processing of the rest of the body of the loop, for the current iteration.
But the loop still carries on running for its remaining iterations .
'''
for i in [12,16,17,24,29,30]:
if i % 2 == 1: # if the number i... | true |
9574a710122127b6ed1b463f0ab7e640ae899aeb | AnTi3z/TestES | /app/search.py | UTF-8 | 2,038 | 2.9375 | 3 | [] | no_license | """
Вспомогательные функции для работы с Elasticsearch API
"""
from app import es
async def add_to_index(index: str, model):
"""
Добавляет экземпляр модели в индекс
:param index: Имя индекса
:param model: Объект с __searchable__ аттрибутом
"""
if not es:
return
payload = {}
fo... | true |
96964d752a482648597e790d55b06de7719b16ee | runzezhang/Code-NoteBook | /lintcode/0702-concatenated-string-with-uncommon-characters-of-two-strings.py | UTF-8 | 2,148 | 3.96875 | 4 | [
"Apache-2.0"
] | permissive | # Description
# 中文
# English
# Two strings are given and you have to modify 1st string such that all the common characters of the 2nd strings have to be removed and the uncommon characters of the 2nd string have to be concatenated with uncommon characters of the 1st string.
# Have you met this question in a real inter... | true |
4e92bb0ed17c3c8807677e9fa1fb0cc03777f97b | hbarthwal/infolab | /localexperts/expertsmodels/lib/bucket_users.py | UTF-8 | 8,395 | 3.03125 | 3 | [] | no_license | '''
Created on Apr 11, 2013
@author: Himanshu Barthwal
'''
from extractdata import DataExtractorFactory
from region import Region
from userdata import UsersData
from utility import Utility
import time
from pprint import pprint
class BucketUsers:
_interval = 5
_center = (0, 0)
_expertCount =... | true |
43d5f6a3c7435c9ba7a3ec8c530e7fb544d72d1c | manateechen/predict-AQI | /predict_aqi/load_data.py | UTF-8 | 3,946 | 2.546875 | 3 | [] | no_license | from sqlalchemy import Column, Integer, MetaData, Table, create_engine, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.sql import select
import pandas as pd
engine = create_engine('postgres://douglas@postgis:5432/AQI', client_encoding='utf8')
Session = se... | true |
4094d0d0104ba213ced555df035d45a1f5196565 | pombreda/comp304 | /Assignment4/atom3/Kernel/LayoutModule/ForceTransferModule/ForceTransfer.py | UTF-8 | 6,560 | 3.09375 | 3 | [] | no_license | """
ForceTransfer.py
Applies force to all nodes that are too close to each other
Loops until a stable configuration is reached
Times out after X iterations, to avoid depriving the user of interactivity
for too long.
Distance specifies how far apart you want your nodes
Force constant determines how much forc... | true |
94f3e522b902901f4a3b30ef7844f4d2adbf10bb | m-czarnota/Distributed-systems | /Reaching all nodes of connected Graph/main.py | UTF-8 | 3,485 | 3.859375 | 4 | [] | no_license | class Graph:
def __init__(self):
self.neighbour_matrix = [[]]
self.NodesCovered = [] # connected nodes with others, suitable node is right index in this array and contain array with connections
self.visitedNodes = set() # without repeat
self.goodNodes = [] # array with boolea... | true |
f15cae10616ab773bc541db789b421e641c26dee | Aasthaengg/IBMdataset | /Python_codes/p03834/s539250766.py | UTF-8 | 114 | 2.59375 | 3 | [] | no_license | # A - Haiku
def main():
s = input().split(',')
print(' '.join(s))
if __name__ == "__main__":
main() | true |
22e69af419b66c3702d34abbd90a11fac7ccd843 | varun414/pyspark-useful-codes | /useful_codes/create_tables.py | UTF-8 | 3,992 | 2.9375 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StructField, StringType, IntegerType
class CreateTable:
def __init__(self, name, schema, formatType='parquet', location=None, partitionedBy=None, additionalInfo=None):
self.name = name
self.schema = schema
sel... | true |
9915e62ca046a529d4dfe3731cf7350d10fdf406 | ghdic/marinelifeirony | /Project/Samples/draw_circle.py | UTF-8 | 987 | 3.25 | 3 | [] | no_license | """ draw_circle.py """
import sys
import pygame
from pygame.locals import QUIT, Rect
pygame.init()
SURFACE = pygame.display.set_mode((400, 300))
FPSCLOCK = pygame.time.Clock()
def main():
""" main routine """
while True:
for event in pygame.event.get():
if event.type == QUIT:
... | true |
c6935fabfc9c6e7b6cffe139c524f3d638198d25 | mguludag/birthplace_region_predict_python_webapp | /test_region.py | UTF-8 | 1,692 | 2.6875 | 3 | [
"MIT"
] | permissive | from face_network import create_face_network
import cv2
import numpy as np
from keras.optimizers import Adam, SGD
import streamlit as st
from PIL import Image, ImageOps
region = {0: 'akdeniz', 1: 'ege', 2: "ic_anadolu", 3: "karadeniz"}
def predict_region(im):
means = np.load('means_region.npy')
model = create_face... | true |
3094d51a91a4e6527fe58cc40398f446c04dfd71 | RakaNishu0/exams | /21~30.py | UTF-8 | 2,824 | 4.25 | 4 | [] | no_license | # 021 문자열 인덱싱
# letters가 바인딩하는 문자열에서 첫번째와 세번째 문자를 출력하세요.
#
# >> letters = 'python'
# 실행 예
# p t
letters = 'python'
print(letters[0], letters[2])
# 022 문자열 슬라이싱
# 자동차 번호가 다음과 같을 때 뒤에 4자리만 출력하세요.
#
# >> license_plate = "24가 2210"
# 실행 예: 2210
license_plate = "24가 2210"
print(license_plate[4:])
# 023 문자열 인덱싱
# 아래의 문자열... | true |
8b1ad4fd68acb13fe0370f901658c7c1baa46313 | AlexeyPerestoronin/Py_Common | /algorithms/_findIf.py | UTF-8 | 1,370 | 4.28125 | 4 | [] | no_license | # brief: searches among the elements of the iterable object for the first one that satisfies the condition
# param: iterable_object - elements iterable object
# param: condition - function fot check satisfaction of one element
# return: first satisfying element, or None - if no one elements
def FindFirstIf(iterable_obj... | true |
3736bf588e905c9f009298161c1552a65b64f87c | LauRivero150920/PygameTutorial | /Pygame2/pong.py | UTF-8 | 2,513 | 3.328125 | 3 | [] | no_license | import pygame, random
pygame.init()
# Definir colores
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
SIZE = (800, 600)
PLAYER_WIDTH = 15
PLAYER_HEIGHT = 90
# Crear ventana
WIN = pygame.display.set_mode(SIZE)
pygame.display.set_caption("Tutorial Pygame2: PONG!!!")... | true |
811257fcd02dfb48b88fd9fb8096ef39c9f42979 | jun-yoshiyoshi/python_for_excel | /p102.py | UTF-8 | 1,798 | 3.125 | 3 | [] | no_license | #複数の書式設定を一つのプログラムで行う
import openpyxl#openpyxl
from openpyxl.styles import PatternFill,Border,Side,Alignment,Protection,Font
#列見出しのフォントを定義
column_font=Font(name='MS Pゴシック',size=16,bold=False,italic=True,vertAlign=None,underline='none',strike=False,color='000000')
#列見出しの配置を定義
column_alignment=Alignment(horizontal... | true |
ae0107517bbfef81626d296e8a01adf5d542d7d0 | pedrohenriqueads/progr1ads | /questao9_lista4_centena_dezena_milhar.py | UTF-8 | 1,284 | 4.125 | 4 | [] | no_license | #9 - Faça um Programa que leia um número inteiro menor que 1000 e imprima a quantidade de centenas, dezenas e unidades do mesmo.
#Observando os termos no plural a colocação do "e", da vírgula entre outros. Exemplo:
#- 326 = 3 centenas, 2 dezenas e 6 unidades
#- 12 = 1 dezena e 2 unidades
#- Testar com: 326, 300, 100, ... | true |
8a1e698c514de3b0c6a9e1eb78f713c61398783b | NM20XX/Python | /Guest_Invitation.py | UTF-8 | 2,824 | 4.21875 | 4 | [] | no_license | #guest invitation
#python basic list operations, while loop, user input, functions
#function to print the guest list
def print_guests(guest_list):
print("\n\nYour guest list:")
cnt = 0
for guest in guest_list:
cnt = cnt + 1
print(str(cnt) +": " + guest.title())
print("\nNumber of guests: "+ str(len(guest_... | true |
dfeb38c76100718c207ddea8907f4f69fc687a56 | loagsword/statistical-calculator | /src/Tests/StatisticsTests/test_SampleMean.py | UTF-8 | 847 | 3.125 | 3 | [] | no_license | import unittest
from src.Statistics.Statistics import Statistics
from src.CsvReader.csvReader2 import csv_reader2
from src.Statistics.Getsample import get_sample
class MyTestCase(unittest.TestCase):
def test_sample_mean_calculator(self):
self.statistics = Statistics()
self.test_data = csv_reader2... | true |
d5a2861ab29246151a99aa1dc25654666e308ee1 | tijmenjoppe/IPASS_Scrabble | /unit_testing/dawg_fsm_test.py | UTF-8 | 1,446 | 2.640625 | 3 | [
"MIT"
] | permissive | from dawg_fsm_dictionary.dawg_fsm import DawgFsm
import unittest
class TestDawgFsm(unittest.TestCase):
def test_dawg_fsm(self):
"""Simple node verification no minimization has taking place."""
dawg_test = DawgFsm()
dawg_test.create_words("kat")
dawg_test.create_words("klap")
... | true |
7ab3984793f326b88a9bfb206b3b41465fe70b50 | roboticslab-psnacet/Basic_training_1 | /DAY 1/opencv_python/Object_track_only_centroid.py | UTF-8 | 1,622 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
# Take each frame
_, frame = cap.read()
# Convert BGR to HSV
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# define range of blue color in HSV
## lower_blue = np.array([110,50,50])
lower_blue = np.array([90,150,150])
up... | true |
ca4f2c4ca6df3d7420341077ed4bb90305d72955 | Introduction-to-Programming-OSOWSKI/3-6-how-long-noraahlman23 | /main.py | UTF-8 | 60 | 3.109375 | 3 | [] | no_license | def howLong(w):
return len(w)
print (howLong("cat")) | true |
5fd1c5765d2af825e1b867148f966928d3d5646b | JIceberg/pid-tutorial | /src/gains.py | UTF-8 | 615 | 3.046875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from controller import PIDController
from quadrotor import ydot
x = np.linspace(0, 45, 300)
fig, ax = plt.subplots()
# 0.65,0.11,0.1
controller = PIDController(0.65,0.11,0.1,5)
controller.setGoal(10)
y = [0, 0]
for t in x:
y = ydot(y, t, controller)
ax.plot(... | true |
8286e6856a1ad333fab1d03d130d70c429a6b477 | Blockhead4/Python-Lecture | /unit10.py | UTF-8 | 413 | 3.734375 | 4 | [] | no_license | '''
Unit 10 심사문제:
표준 입력으로 정수가 입력됩니다.
시작하는 숫자는 -10, 끝나는 숫자는 10이며
입력된 정수만큼 증가하는 숫자가 들어가도록 튜플을 만들고,
해당 튜플을 출력하는 프로그램을 만드세요
(input에서 안내 문자열은 출력하지 않아야 합니다).
'''
# Answer:
n = int(input())
t = tuple(range(-10, 10, n))
print(t) | true |
06d4f612789cbf7714667a62037f4736cae19795 | in-tandem/algorithm | /data_structures/least_frequently_used.py | UTF-8 | 4,088 | 3.53125 | 4 | [] | no_license | from collections import deque
from collections import defaultdict
from collections import OrderedDict
class Node:
def __init__(self, key, value):
self.key = key
self.value = value
#no access yet
self.access_count = -1
def __str__(self):
return 'key :%s and value : %s a... | true |
5858662560ba1839a35957d671d0a56ef6507f3a | hnoson/writeups | /inctf/2019/waRSAw/solve.py | UTF-8 | 1,274 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
from pwn import *
from Crypto.Util.number import *
def decrypt(c):
s.sendlineafter('choice: ', '2')
s.sendlineafter('(in hex): ', long_to_bytes(c).encode('hex'))
s.recvuntil('(in hex): ')
return bytes_to_long(s.recvline(False).decode('hex'))
e = 65537
l, r = 0, 1 << 1024
while ... | true |
c23a7b0d442805db422c0063b857e275b3907327 | BerilBBJ/scraperwiki-scraper-vault | /Users/F/frabcus/xslt-example.py | UTF-8 | 1,030 | 3.03125 | 3 | [] | no_license | # Example of calling XSLT transformations in Python
from lxml import etree
from StringIO import StringIO
f = StringIO('''
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<foo><xsl:value-of select="/a/b/text()" /></foo>
</xsl:template>
... | true |
f063e7b57973fe43d7b4cefc481775c2c949a262 | wdavid73/TheBigBangTheory_NumeroPecfecto | /NumeroPerfecto.py | UTF-8 | 1,915 | 3.640625 | 4 | [] | no_license | from typing import AnyStr
def NumeroPerfecto(numero : int):
cont = 0
cont2 = 0
# Validar si es primo
if numero < 9:
print("el numero debe ser mayor a 9")
else:
if( es_primo(numero) == True):
cont = contar_primos(numero)
newNumber = str(numero)[::-1]
... | true |
35267e6520eeedede47e81ef0d2443820eb7df3c | xy008areshsu/Leetcode_complete | /python_version/linkedlist_swap_nodes_in_pairs.py | UTF-8 | 1,033 | 3.890625 | 4 | [] | no_license | """
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed.
"""
# Definition for singly-linked list.
cla... | true |
8a9b218433963208947545f4bf9617fc7c84424f | P-ppc/leetcode | /algorithms/PathSumIII/solution.py | UTF-8 | 986 | 3.34375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
... | true |
a9770160acfecfa0d81b6437c0ec0eda2cbe0240 | zbxzc35/genetic-algorithm-for-cnn | /recognizer/preprocess.py | UTF-8 | 3,446 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import copy
import math
import cv2
import matplotlib.pylab as plt
def plot(img, threshold, blur, contour_img, bbox_img):
# plot
plt.subplot(511)
plt.title('Original Image')
plt.imshow(img, cmap='gray')
plt.xticks([])
plt.yticks([])
plt.subplot(512)
pl... | true |
884fa1e4162734ae8e15c9a840f34187d66fd08c | ZacharyWills/DMOD | /python/lib/core/dmod/core/serializable.py | UTF-8 | 12,622 | 3.5625 | 4 | [] | no_license | from abc import ABC, abstractmethod
from numbers import Number
from typing import Callable, Dict, Type, Union
import json
class Serializable(ABC):
"""
An interface class for an object that can be serialized to a dictionary-like format (i.e., potentially a JSON
object) and JSON string format based directly... | true |
db739c461095e5293f35951906719ad9c92cca35 | allmonday/logging-demo | /submodule/submodule_1.py | UTF-8 | 312 | 2.578125 | 3 | [] | no_license | import logging
import logging.config
logging.config.fileConfig('logger.conf')
# create logger
logger = logging.getLogger(__name__)
def say():
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')
print 'hi' | true |
c305829dc8adeaf497f4094fe37986407d660944 | lozhkinandrei/python-data-structures-algorithms | /tests/data_structures/test_deque.py | UTF-8 | 1,401 | 3.796875 | 4 | [] | no_license | import unittest
from data_structures.linear.deque import Deque
class TestDequeMethods(unittest.TestCase):
def setUp(self):
self.deque = Deque()
def test_add_front(self):
self.deque.items = [1, 2]
self.deque.add_front(3)
self.assertEqual(self.deque.items, [1, 2, 3])
def t... | true |
4f31fb2259c3a15b1ad501881c37a76cd8d7f461 | petermanser/wsgiservice | /wsgiservice/xmlserializer.py | UTF-8 | 1,817 | 3.734375 | 4 | [
"BSD-2-Clause"
] | permissive | """Helper to convert Python data structures into XML. Used so we can return
intuitive data from resource methods which are usable as JSON but can also be
returned as XML.
"""
from xml.sax.saxutils import escape as xml_escape
def dumps(obj, root_tag):
"""Serialize :arg:`obj` to an XML :class:`str`.
"""
xm... | true |
e5b8e7c55c6f51e777c948be00d9f7abbac71abf | olivia-ea/vhacks-hackthon | /model.py | UTF-8 | 708 | 2.546875 | 3 | [] | no_license | """Models and databases"""
# from flask_sqlalchemy import SQLAlchemy
# db = SQLAlchemy()
class User(db.Model):
__tablename__ = 'users'
user_id = db.Column(db.String(50), primary_key=True)
password = db.Column(db.String(50), nullable=False)
mentor = db.Column(db.Boolean())
mentee = db.Column(db.B... | true |
c120029fd206b0917ca10751df2c947ceb67ac63 | AjayiSamuel/hackerrank-submissions | /Python/jumping_on_cloud.py | UTF-8 | 466 | 3.265625 | 3 | [] | no_license | # Complete the jumpingOnClouds function below.
def jumpingOnClouds():
ans = 0
i = 0
while i < n - 1:
if i + 2 >= n or c[i + 2] == 1:
i = i + 1
ans = ans + 1
else:
i = i + 2
ans = ans + 1
return ans
if __name__ == '__main__':
n = int(... | true |
cfc5807e1717e6667eeef502da5c650d75880c64 | jonpiffle/NCAABasketball | /classification/classification_by_season.py | UTF-8 | 2,029 | 2.625 | 3 | [] | no_license | from models import *
import sys
from sklearn.cross_validation import KFold
import numpy as np
import random
import code
from sklearn import svm
from sklearn.naive_bayes import GaussianNB
from sklearn import tree
import pydot
from StringIO import StringIO
from sklearn import preprocessing
from sklearn import decompositi... | true |
a9259751cf5cc376f6ecb70d78dcb784af3d71ec | SimeonTsvetanov/Coding-Lessons | /SoftUni Lessons/Python Development/Python Advanced January 2020/Python Advanced/17. ERROR HANDLING/03. Repeat Text.py | UTF-8 | 656 | 3.6875 | 4 | [] | no_license | def work_at_home_task_three():
text = input()
try:
times = int(input())
print(text*times)
except ValueError:
print("Variable times must be an integer")
def work_in_class_task_three():
def solve(text, times):
try:
if not isinstance(times, int):
... | true |
fef23efb603a6ba40111c2100d7287becc3528bb | alclass/bin | /uTubeDeleteFileWithSmallerNameHavingSameId.py | UTF-8 | 3,030 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob, os, re, sys, time
'''
Explanation:
This script reads a list of YouTube Video Ids from a text file (default name is 'youtube-ids.txt')
This file must have the 11-character video id starting each line.
(A "#" at the beginning of a line ignores that line.... | true |
3efcd88baf02eda5d523e72e173d7746561524ab | khuang0312/DailyCodingProblem | /dcp_43.py | UTF-8 | 1,511 | 4.71875 | 5 | [] | no_license | #Given February 9th, 2020
#Implement a stack that has the following methods:
#push(val), which pushes an element onto the stack
#pop(), which pops off and returns the topmost element of the stack.
#If there are no elements in the stack, then it should throw an error or return null.
#max(), which returns the ma... | true |
a6d2d5a53e6bfad241d4a101b56d360d4e8c3275 | Metheus97/Meus_Exerccicios_de_Python | /ex105.py | UTF-8 | 953 | 4.125 | 4 | [] | no_license | ''' Faça um programa que tenha uma função notas() que pode receber
várias notas de alunos e vai retornar um dicionário'''
def nota(*n, Sit=False):
'''-->Função nota
:param n: uma ou mais notas de alunos
:param Sit: valor opcional, para indicar ou não a situação
:return: dicionário com varias informaço... | true |
f3f4feac4ed99fab149f9c55862b9d794fcc8c64 | taehwan920/Algorithm | /programmers/track_construction.py | UTF-8 | 1,057 | 2.96875 | 3 | [] | no_license | import heapq
from copy import deepcopy
def solution(board):
n = len(board)
board2 = deepcopy(board)
q1, q2 = [], []
direction = [(0, 1), (1, 0), (0, -1), (-1, 0)]
heapq.heappush(q1, [0, 0, 0, direction[0]])
heapq.heappush(q2, [0, 0, 0, direction[1]])
def bfs(arr, bo):
while arr:
... | true |
b4bdf9853b42d3b91ad43e29c8e0f7157eb660a7 | soy0vng/Algorithm | /BOJ/1931_회의실 배정.py | UTF-8 | 403 | 3.359375 | 3 | [] | no_license | n = int(input())
meetings = [list(map(int, input().split())) for _ in range(n)]
# 회의가 빨리 끝나는 순으로 정렬 + 끝나는 시간이 같은 경우 빨리 시작하는 순으로 정렬
meetings.sort(key=lambda x : (x[1], x[0]))
end_time = meetings[0][1]
result = 1
for i in range(1, n):
if end_time <= meetings[i][0]:
result += 1
end_time = meetings[i][1... | true |
98454dcb04f6394c141c80079e56f738cfeeab79 | MrFrames/Hello-world | /Abs_date_range.py | UTF-8 | 2,748 | 3.859375 | 4 | [] | no_license |
def YYYY_MM_DD (date):
date_list = []
for value in date.split('-'):
date_list.append(int(value))
return (date_list)
def recon_date(date):
days = str(date[2])
months = str(date[1])
years = str(date[0])
year = '0' * (4 - len(years)) + years
months = '0' * (2 - len(m... | true |
28eb5b658f55415ef26c3839ae82ece3f968b2fd | Lee-SL/machineLearningCodeChallenge | /classifier/Classifier.py | UTF-8 | 1,225 | 2.546875 | 3 | [] | no_license | import xgboost as xgb
from sklearn.externals import joblib
from sklearn.metrics import mean_absolute_error
class Classifier(object):
def __init__(self, train, train_y):
self.xgb_params = {
'seed': 0,
'colsample_bytree': 0.8,
'silent': 1,
'subsample': 0.6,
... | true |
7079dc6dc12bc649443a1bf9147400936629df8a | LeeSangHyeup/graduation_project | /meerkat_agent/meerkat_agent/config.py | UTF-8 | 3,357 | 2.5625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
'''
Created on 2014. 6. 23.
@author: lsh
'''
'''
config file for agent
'''
import os
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class Config():
_CONFIG_FILE_NAME = 'config.txt'
ROOT_PATH = os.path.dirname(__file__)
def __init__(self):
config_file=None
... | true |
709024a24be8a83ffb230f1cb7721a17cac6b2e4 | lfbermeo/fp-utpl-18-ejercicios | /ej-python-while/ejercicio_1.py | UTF-8 | 568 | 3.875 | 4 | [] | no_license | """Imprimir reporte de estudiante """
contador = 1
limite=3
cadena = "{0}\{1}\t{2}\t{3}\t{4}\t{5}\n".format ("Nombre", "Nota 1", "Nota 2", "Nota 3", "Promedo")
while contador <= limite
nombre = input ("Ingrese nombre del estudiante: \n")
nota_1 = input ("Ingrese nota 1: \n")
nota_2 = input ("Ingrese nota 2: \n")... | true |
ca34e1f1be1d584912f23bde7d40a6bbc0912b36 | mikegallimore/xG_model_gradient-boost | /xG_model_gradient-boosting_tune.py | UTF-8 | 4,953 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: @mikegallimore
"""
import pandas as pd
import matplotlib as plt
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import GridSearchCV
from sklearn import metrics
import parameters
###
### LOAD & SHAPE THE DATA
###
# set the loc... | true |
aacc08f6974620ff144edb001c3d152e2f66eecd | jerwil/TimeLapseCheck | /TimeLapseCheck.py | UTF-8 | 2,010 | 2.859375 | 3 | [] | no_license | import ftplib
import getpass
import smtplib
import keyring
from email.mime.text import MIMEText
filename = "log.txt" #This text file contains the last file count
pswd = keyring.get_password('service','username') #The keyring safely stores passwords on my raspberry pi
ftp = ftplib.FTP("ftpserver.com")
ftp.login("use... | true |
b046667561d57b9bfebe4847890a0106a2333a05 | Jiaxuuuuuu/VanillaML | /vanilla_ml/supervised/classification/abstract_classifier.py | UTF-8 | 1,159 | 3.140625 | 3 | [
"BSD-3-Clause"
] | permissive | from abc import ABCMeta, abstractmethod
class AbstractClassifier(object):
"""
Abstract classifier
"""
__metaclass__ = ABCMeta
@abstractmethod
def fit(self, X, y, sample_weights=None):
""" Fit the model using the given training data set with n data points and p features.
Args:... | true |
daa8ddbb06b5e4e4b4ce189be3e1db4528dc4e68 | Hongyiel/KWSproject_python | /KWS.v01.py | UTF-8 | 12,729 | 2.984375 | 3 | [] | no_license | import matplotlib
import numpy as np
import librosa # for audio related library using
import matplotlib.pyplot as plt
import logging
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')
font = {'weight': 'normal',
'size'... | true |
5daeb24cab8f94a7d99bb9cc4767e39f8f2bc35b | traptrip/paperio-pygame | /helpers.py | UTF-8 | 1,877 | 3.375 | 3 | [] | no_license | import random
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
from config import CONSTS
def get_random_coordinates():
return random.randint(CONSTS.X_CELLS_COUNT // 4, CONSTS.X_CELLS_COUNT - (CONSTS.X_CELLS_COUNT // 4)), \
random.randint(CONSTS.Y_CELLS_COUNT // 4, CONSTS.... | true |
cc8d746374ba0e0013ace4411abee19212f0e89c | Hamng/hamnguyen-sources | /python/validate_floating_point.py | UTF-8 | 1,449 | 3.6875 | 4 | [
"Unlicense"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 10:42:27 2019
@author: Ham
HackerRanch Challenge: Detect Floating Point Number
Task
You are given a string N.
Your task is to verify that N is a floating point number.
In this task, a valid float number must satisfy
all of the following requirements:
... | true |
6d4c3549a7accea257be46790fd4903d05d265bc | TobyRoseman/SFrame | /oss_src/unity/python/sframe/meta/bytecodetools/pyc_file.py | UTF-8 | 711 | 3.125 | 3 | [
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | '''
Created on May 10, 2012
@author: sean
'''
from imp import get_magic
import time
import struct
import marshal
def extract(binary):
'''
Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file.
'''
if len(binary) <= 8:
raise Exception("Binary... | true |
42b9218b4db9d6d218603e15dc1b0aa658eed1d8 | Tofuistofu/Python-Challenge | /Q5.py | UTF-8 | 574 | 2.96875 | 3 | [] | no_license | #!\usr\bin\env python
import requests
from bs4 import BeautifulSoup as BS
import pickle
def main():
res = requests.get('http://www.pythonchallenge.com/pc/def/banner.p')
soup = BS(res.text, 'html.parser')
with open('Q5.txt', 'w+') as txt:
txt.write(str(soup))
with open('Q... | true |
d6fb8e76f3389e0b4ca6cbf51d764a732da32b28 | hszer0/Bracket | /BracketControl.py | UTF-8 | 1,525 | 2.890625 | 3 | [] | no_license | from Game import Game
class BControl():
def __init__(self, database):
self.database = database
def get_participants(self, match):
l = self.database.get_participants(match)
return [x[0] for x in l]
def get_contenders(self, tid, match):
l = self.database.get_contenders(tid,... | true |
56e70e973afe79adbe0d8a85eaa53ee39d79f4da | Hemer911/doubleVertexDominator | /node.py | UTF-8 | 1,938 | 3.078125 | 3 | [] | no_license | class Node:
def __init__(self,name):
self.name = name
self.min = -1
self.prime = -1
self.max = -1
self.hight = -1
self.marked = False
self.root = False
def initNode(self):
self.min = -1
self.prime = -1
self.max =... | true |
a98f7b16b982fb1ee5ebb3ad52bf88b48a2d3f6b | lukedsmalley/oo-kernel-hacking | /src/aottool/libaottool/fragment.py | UTF-8 | 3,311 | 2.609375 | 3 | [
"MIT"
] | permissive | def is_number(string):
try:
int(string)
return True
except:
return False
class CFragment:
next_id_number = 0
def _format(self, fmt):
if fmt == None:
return None
i = 0
while i < len(fmt) - 2:
if fmt[i] == '%':
if fmt[i + 1] == '%':
fmt = fmt[0:i] + '%' + f... | true |
693fabe357b59110ef18f214075cd8e1a7bf9f82 | changhw01/MPCluster | /src/pdiagram.py | UTF-8 | 3,424 | 2.84375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
class PDiagram:
def __init__(self,cM,sM,rep_clst):
''' Initialization
cM: cluster version
sM: size of cluster
rep_clst: the representation of cluster
... | true |
b3dc3271ab799a2d9b5f204d23e71de3fa0898e5 | MrTornado24/Leetcode_Implementation | /Code_Implementation/Leetcode_11.py | UTF-8 | 416 | 3.015625 | 3 | [] | no_license | from typing import List
def maxArea(self, height: List[int]) -> int:
maxa = 0
curr = 0
head = 0
tail = len(height) - 1
while head < tail:
curr = min(height[head], height[tail]) * (tail - head)
maxa = max(curr, maxa)
if height[head] > height[tail]:
tail -= 1
... | true |
2f05fd75c9ee7caeb597b4c39ebf9b3fc5308b17 | fgvbrt/retro_contest | /actor_critic/actor_critic_train.py | UTF-8 | 4,220 | 2.5625 | 3 | [] | no_license | import argparse
import numpy as np
from itertools import count
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.distributions import Categorical
from envs import make_retro
import pandas as p... | true |
6c1b6b83c54f8724552c5c92447a75ac3fe84d47 | 17e23052/Lesson-11 | /main.py | UTF-8 | 1,379 | 4.34375 | 4 | [] | no_license | #This is the 'Guess the vegetable' minigame combined with the 'Guess the animal'
#sample script, which has been slightly modified, to make them into one program.
print("Welcome to guess the vegetable or animal!")
print("Please pick from ostrich, lion or whale, OR")
print("Please pick from broccoli, peas, carrot or swee... | true |
9d48a906492afef18a1b9a305aede689288fc6d0 | dewitast/restaurant-review-absa | /aspect_classifier.py | UTF-8 | 4,176 | 2.59375 | 3 | [] | no_license | from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.corpus import wordnet as wn
import string
def wordnet_pos_code(tag):
if tag.startswith('NN'):
return wn.NOUN
elif tag.startswith('VB'):
return wn.VERB
elif tag.startswith('JJ'):
return wn.ADJ
eli... | true |
9088300e4baa81fb0998e5601034bcff3f84c578 | csu-anzai/--1 | /dd_spider.py | UTF-8 | 823 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from dd.items import DdItem
from scrapy.http import Request
class DdSpiderSpider(scrapy.Spider):
name = 'dd_spider'
allowed_domains = ['dangdang.com']
start_urls = ['http://www.dangdang.com/']
#回调函数
def parse(self, response):
item = DdItem()
#提... | true |
874b359bd1f0b55b9e62866f6b4f17ed2695fedd | MasterMedo/aoc | /2019/day/11.py | UTF-8 | 547 | 2.8125 | 3 | [] | no_license | from collections import defaultdict
intcode = __import__('9').intcode
with open('../input/11.txt') as f:
tape = list(map(int, f.read().split(',')))
xy, d = 0j, -1j
colors = defaultdict(int)
colors[0] = 1 # comment for part 1
robot = intcode(tape, (colors[xy] for _ in iter(int, 1)))
for color, turn in iter(lambda... | true |
e88ae6113881efa6a476f9bad73520c84c47db00 | mukhtarbayerouniversity/fairensics | /fairensics/methods/preferential_fairness.py | UTF-8 | 17,762 | 2.6875 | 3 | [
"MIT"
] | permissive | """Wrapper for PreferentialFairness from fair-classification.
Besides fit() and predict() the class contains three functions:
All three functions are part of the original code:
_train_model_pref_fairness()
_get_di_cons_single_boundary()
_get_preferred_cons()
Original code:
https://github.com/mbilalza... | true |
8c0b19bfe74d139f193683262611b1e4293a42d7 | artbdev/python-parallelism-ray-api | /knn_algo_ray_api.py | UTF-8 | 1,510 | 2.765625 | 3 | [] | no_license |
import psutil
import ray
import time
from sklearn import datasets
from sklearn.model_selection import train_test_split
from scipy.spatial import distance
num_cpus = psutil.cpu_count(logical=False)
ray.init(num_cpus=num_cpus, include_dashboard=False)
iris = datasets.load_iris()
X = iris.data
y = iris.target
X_train,... | true |
d76bdd905bed709918e4a19165d6ace11456dc7d | Satbir-Virdi/Airline-Booking-System | /ADMINairlines.py | UTF-8 | 4,247 | 3.28125 | 3 | [] | no_license | import csv
import tkinter as tk
import pandas as pd
airlines = tk. Tk()
airlines.title("administrator")
airlines.configure(background="#327fa8")
airlines.geometry("500x500")
pd.set_option('display.max_rows', None, 'display.max_columns', None)
df = pd.read_csv('airlines.csv') # test csv file, replace wit... | true |
6b6777371a1284c4c3c9968b25745b983e9a013f | milkiase/lab-4 | /dynamic_stack.py | UTF-8 | 2,871 | 4.21875 | 4 | [] | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
class DynamicStack:
def __init__(self):
self.head = None
def push(self, data):
if self.stack_size()<100:
node=Node(data)
temp = self.head
node.next=temp
se... | true |