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 |
|---|---|---|---|---|---|---|---|---|---|---|
c0cb11e54dd37512c736c8a8dd0796e9bff6369a | Ly0n/MATS-planningtool | /OPT/_XMLGenerator/XML_gen.py | UTF-8 | 14,610 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""This module contains the core function of the *XML_gen* program and the first subfunction of *XML_gen*.
In this module is the base of the XML-tree defined and initial values such as the
start and end time and also duration of the timeline are calculated. Goes through the
supplied *Science ... | true |
e358e524b92eb0c3fc6e04d155c7289e0333b566 | MyungjaeSong/Paired-Library | /DeepCpf1/Analysis of indel frequency/extractor_v3.py | UTF-8 | 4,966 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
__author__ = 'forestkeep21@naver.com'
import re
import sys
import os
BASE_DIR = os.path.dirname(sys.executable)
#for debug
# BASE_DIR = os.path.dirname(os.path.realpath(__file__))
def seq_validator(data):
m = re.findall(r'^[A|a|T|t|C|c|G|g]+$', data)
return m[0] if ... | true |
d2f22ca475f41413e0bf21e8228afa28fc794a26 | halorgium/dramatis | /test/dramatis/become_test.py | UTF-8 | 6,496 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/bin/env python
import inspect
import sys
import os.path
sys.path[0:0] = [ os.path.join( os.path.dirname( inspect.getabsfile( inspect.currentframe() ) ), '..', '..', '..', 'lib' ) ]
from logging import warning
import time
import threading
import dramatis.runtime
sys.path[0:0] = [ os.path.join( os.path.dirname( i... | true |
4cc356a378d978857da12493963fcb01afc9f06d | kimth007kim/python_choi | /Chap6/6_6.py | UTF-8 | 76 | 3.109375 | 3 | [] | no_license | for i in range(5):
print("방문을 환영합니다.")
list(range(10))
| true |
cc34afe55c7bc21884203a65ed311d39e6696c78 | KawtharK/CIS2001-Winter2019 | /Week3/SudokuSolver.py | UTF-8 | 2,668 | 3.984375 | 4 | [
"MIT"
] | permissive | class SudokuPuzzle:
EMPTY = " "
def __init__(self):
self.grid = []
for row in range(9):
self.grid.append([])
for column in range(9):
self.grid[row].append(SudokuPuzzle.EMPTY)
def __str__(self):
return "\n".join(str(row) for row in self.grid)
... | true |
3d38be37559a36505bd177a976e9ec265a164704 | enkiwang/Python-tutorials | /Prytical18_looping_zip_dictCreation.py | UTF-8 | 1,288 | 3.984375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 21:06:34 2018
looping for: enumerate, zip(), [ x for x in ... ], {key:value for key in [..]}
1) one seq;2)multiple seq;
3) create new list [f(var) for var in ..]
4) create new dict {key:value}
@author: yongweiw
"""
# 1) enumerate() a single sequence, giv... | true |
9912e11e4bd3952f2288ddcb1463dd7726515676 | ricardoruiz2897/CS1411Project | /project.py | UTF-8 | 6,538 | 3.921875 | 4 | [] | no_license | #Lab project#
#Ricardo Ruiz 501#
#file with operations to get qb pass rating in function 2 (see file in main folder)
import operations
#function 1
def part_1(file_name):
list_ = []
try:
file_read = open(file_name,'r')
#append elements to list
for element in file_read:
... | true |
79545db776405a25925dbb0a19c685327afee14f | rohanshah13/emea | /utils/check_adapters.py | UTF-8 | 939 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import transformers
from check_repo import get_models
from transformers import ModelAdaptersMixin
MODULES_WITH_ADAPTERS = [
"modeling_bert",
"modeling_roberta",
"modeling_xlm_roberta",
"modeling_distilbert",
]
def check_models_implement_mixin():
"""Checks that all model classes belonging to modu... | true |
b5a8b2d8f05c8bdcc98ef1f0ed27c2d3f80ffd19 | Jane11111/Leetcode2021 | /230_2.py | UTF-8 | 553 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021-04-22 12:46
# @Author : zxl
# @FileName: 230_2.py
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def inorder(self,p,lst):
if p== None:
... | true |
c3e1920504ed9578a29d748740281159845f6cab | andrewcao95/Chinese_modern_poem_generator | /informationRetrievalBased/TFIDF-Baseline/runModel_history.py | UTF-8 | 3,655 | 2.578125 | 3 | [] | no_license | #encoding=utf-8
from cutWords import *
from fileObject import FileObj
from sentenceSimilarity import SentenceSimilarity
from sentence import Sentence
from tqdm import tqdm
import pickle
from collections import deque
import random
import string
from zhon.hanzi import punctuation
import math
NO_PUNCTUATION = False # 去掉... | true |
d5279352c9bc95f16b5f573d58fe0102ac3d6e0f | Li-Siyuan/FileCapture-Server | /FileCaptureServer/FileGain.py | UTF-8 | 2,985 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#ok
import socket
import hashlib
import struct
import base64
STORE_DIR='/root/recvData/'
HOST = 'localhost'
PORT = 9527
BUFFER_SIZE = 1024
#这个编码在客户端解不开
HEAD_STRUCT = '128sIq32s'
info_size = struct.calcsize(HEAD_STRUCT)
#md5校验,两处校验必有一次错误
def cal_md5(file):
with open(... | true |
c692fbbc5e7670446f09dca70ee6817d2406495c | theahura/Advanced-Topics | /Semester 2/Web Crawler/Webcrawl.py | UTF-8 | 3,542 | 3.125 | 3 | [] | no_license |
#indexes every word in a certain section of the internet and adds that word to
#a dictionary
import re
import operator
keyworddict = {}
linklist = []
def get_page(url): #return page
try:
import urllib
return urllib.urlopen(url).read()
except:
return ""
def get_next_target(s, constraint... | true |
8ccf2b14b82a566a80b504da67700c6d04e47e5f | Aasthaengg/IBMdataset | /Python_codes/p03372/s440723885.py | UTF-8 | 800 | 2.921875 | 3 | [] | no_license | # FOLLOW ANSWER
N,C = map(int,input().split())
x = [0]
v = [0]
acc = [0]
rev = [0]
s = 0
res = 0
for i in range(N):
a,b = map(int,input().split())
x.append(a)
v.append(b)
s += b
acc.append(s)
#OB < OA
#O->B->A = 2*OB + OA
F = []
for i in range(N+1):
F.append(acc[i]-x[i])
for i in range(1,N... | true |
6611c593877c92f213b62cfdf004f7d0779bd39f | lee-saint/lab-python | /scratch14/ex04.py | UTF-8 | 1,207 | 3.734375 | 4 | [] | no_license | import numpy as np
# numpy.c_ (column bind)와 numpy.r_(row bind)의 비교
a = np.array([1, 2, 3])
print(a, type(a), a.shape)
b = np.array([4, 5, 6])
print(b, type(b), b.shape)
c = np.c_[a, b]
print(c, type(c), c.shape)
d = np.r_[a, b]
print(d, type(d), d.shape)
e = np.array([[1, 2, 3],
[4, 5, 6]])
f = np.ar... | true |
eb88156d76821cb9ae21753d42defdb46bd8786d | JonLerida/X-Serv-Python-Ficheros-y-Listas | /mi_ejercicio.py | UTF-8 | 593 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
fd = open("/etc/passwd", "r") #Lo abrimos en lectura solo, si no da error
lineas = fd.readlines()
usuarios = {}
for line in lineas:
login = line[:line.find(":")]
shell = line[line.rfind(":")+1:]
usuarios[login]= shell
#try--except controla las excepciones
#si solo pones exc... | true |
74301d9dfa297d229fadce427a6f45a20725981a | josephbb/Collective-wisdom-in-polarized-groups | /src/exp_2_figures.py | UTF-8 | 3,306 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | import patsy
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
pal = sns.diverging_palette(10, 220, sep=80, n=5,l=40,center='light')
pal2 = sns.diverging_palette(10, 220, sep=80, n=5,l=40,center='dark')
pal[2] = pal2[2]
def ilogit(x):
return 1/(1+np.exp(-x))
def plot_st... | true |
6c12839e7a88b2421f743e67c543db3469463156 | kevinmel2000/computer-vision-raspberrypi | /006-pi-face-verification/altusi/faceembedder.py | UTF-8 | 739 | 2.6875 | 3 | [] | no_license | """
Face Embedder class
===================
Face Embedding computation class
"""
import numpy as np
import cv2 as cv
import altusi.config as cfg
class FaceEmbedder:
"""Face embedder class"""
def __init__(self,
xml_path=cfg.FACE_EMB_XML,
bin_path=cfg.FACE_EMB_BIN):
"""Init... | true |
bff6846c1e7026be2a7dac7123a7d2c22910e471 | Saurabh-kayasth/AutoAnalytics | /AttributeInformation.py | UTF-8 | 4,116 | 3.28125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.impute import KNNImputer
class Attribute_Information():
def __init__(self):
print("Attribute Information object created")
def Column_information(self, data):
data_info = pd.DataFrame(
columns=['No of observation',
... | true |
03382ea85f4e2c3acba46364035a93059f4eb4eb | VTam25/CyberHunt | /get_clues.py | UTF-8 | 1,551 | 2.90625 | 3 | [] | no_license | import sqlalchemy
import json
# Depending on which database you are using, you'll set some variables differently.
# In this code we are inserting only one field with one value.
# Feel free to change the insert statement as needed for your own table's requirements.
# Uncomment and set the following variables dependin... | true |
8d4a347075707a935e1780d14aa71618082be22a | AgilAghamirzayev/python-for-data-science-edx | /lab5/numpy/practice2.py | UTF-8 | 337 | 3.28125 | 3 | [] | no_license | import numpy as np
a = np.array([0, 1, 2, 3, 4, 5])
print(a.size)
print(a.ndim)
print(a.shape)
b = np.array([1, -1, 1, -1])
mean = b.mean()
print(mean)
standard_deviation=a.std()
print(standard_deviation)
print(np.pi)
x = np.array([0, np.pi/2 , np.pi])
y = np.sin(x)
print(y)
linspace = np.linspace(-2, 2, num=3)... | true |
2fa3aa0bffada48e8b55dc8addb36f40586b00bd | Alexandrmrn/E-eeee | /clientPy.py | UTF-8 | 450 | 2.765625 | 3 | [] | no_license | import socket
clntsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clntsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def connect():
clntsock.connect(('localhost', 9090))
data = clntsock.recv(1024)
udata = data.decode('utf-8')
print(udata)
while True:
out =... | true |
6b5bb0b30587517d7bfc13f52e26aa7146acc682 | cielavenir/checkio | /ice-base/counting-tiles.py | UTF-8 | 505 | 2.890625 | 3 | [] | no_license | z=lambda i,j,r:i**2+j**2<r**2
def checkio(R):
r=int(R)+1
x=y=0
for i in range(r):
for j in range(r):
if z(i,j,R):
y+=1
x+=z(i+1,j+1,R)
return[x*4,(y-x)*4]
f=lambda R,r,k:sum((i+k)**2+(j+k)**2<R**2 for i in range(r) for j in range(r))
def golf(R):
r=int(R)+1
return [4*f(R,r,1),4*(f(R,r,0)-f(R,r,1))]
... | true |
623072f4a3fd268702baf48d4aa8554e68c05a9c | rbu/redumpster | /redumpster/tests/data_interfaces_test.py | UTF-8 | 12,236 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | from ..data_interfaces import *
from os.path import join, exists
import os
from testfixtures import tempdir, log_capture
from pyexpect import expect
import unittest
from unittest.mock import MagicMock
from redumpster.utils import change_working_directory_to
def touch(a_path):
open(a_path, 'a').close()
class Da... | true |
b6ae70f55c4e68a912af0818b5f8dc51fe49515a | turbo-hub/struct-algo | /code/algo-exer-pc/array-exer.py | UTF-8 | 2,357 | 3.859375 | 4 | [] | no_license | import collections
class arrayexer:
# ===============================三数之和 题号15========================================
"""
数组中找出三数之和等0的元素,每三个元素形成一个list list不能重复
即不可出现 list[-1,0,1] list[-1,0,1]两个相同的list
"""
def threeSum(self, num):
# 不够3个元素 或者 num为空时就是false not num就是true 直接返回
... | true |
b2e85d66f7d550a3b1a6a3139d5fca28e1a67a71 | Dearbreeze/My-Modify-Verision-Bayesian-Crowd-Counting | /models/vgg.py | UTF-8 | 2,155 | 2.625 | 3 | [] | no_license | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch
from torch.nn import functional as F
__all__ = ['vgg19']
model_urls = {
'vgg19': 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth',
}
class VGG(nn.Module):
def __init__(self, features):
super(VGG, self).__init__()
... | true |
dcffdf60984e38c201626095f63d9dccb31ef36e | ParulProgrammingHub/assignment-1-strangerraj | /a1p3.py | UTF-8 | 104 | 3.5 | 4 | [] | no_license | cm=float(raw_input('Enter values in centimeter'))
print'Meter=',(cm/100.0)
print'Kilometer=',(cm/1000)
| true |
8667c93a2a9f6b2d6a315ada5c9715e1147826dc | Aasthaengg/IBMdataset | /Python_codes/p03739/s742144167.py | UTF-8 | 601 | 2.953125 | 3 | [] | no_license | n = int(input())
a = list(map(int,input().split()))
ans = 0
f = 1
num = 0
for i in range(n):
num += a[i]
if f:
if num <= 0:
ans += 1 - num
num = 1
f = 0
else:
if num >= 0:
ans += abs(-1 - num)
num = -1
f = 1
ans_2 = 0
f = 1
nu... | true |
05e29677fd084dceb3213c31a7a84a96921ce022 | Sandy4321/histore | /histore/key.py | UTF-8 | 8,141 | 3.265625 | 3 | [
"BSD-3-Clause"
] | permissive | # This file is part of the History Store (histore).
#
# Copyright (C) 2018-2021 New York University.
#
# The History Store (histore) is released under the Revised BSD License. See
# file LICENSE for full license details.
"""Base classes for row key values."""
from abc import ABCMeta
from functools import total_orderi... | true |
0e8467ef3b084eb8555dc86dd36413e788e16c66 | akfunes/studyProblems | /kth_larget_element_in_array.py | UTF-8 | 204 | 3.125 | 3 | [] | no_license | # https://leetcode.com/problems/kth-largest-element-in-an-array/
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
ans = heapq.nlargest(k,nums)
return ans[k-1]
| true |
fedcc161305a66f0565d7b2d3a22722ee7d58844 | 990676/990676 | /矩形脉冲信号.py | UTF-8 | 369 | 3.4375 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pylab as plt
def step_function1(x=''):
if x >0:
return 1
else:
return 0
def step_function2(x):
y = x > 0
return y.astype(np.int)
m = 1
print(step_function1(m))
x = np.arange(-5.0,5.0,0.1)
y = step_function2(x)
plt.plot(x,y)
plt.ylim(-0.1, 1... | true |
b119ff5497df1d1f34b22d42a090a6b3aa8a0f24 | jinyoungcho/Algorithm_study | /PYTHON_CODE/3052.py3.py | UTF-8 | 148 | 3.28125 | 3 | [] | no_license | n = 10
visited = set()
for _ in range(n):
num = int(input())
remain = num % 42
visited.add(remain)
print(len(visited)) | true |
2ebb9319c66bb27c6d3a0be6e6446d5a93a7aa05 | hlscalon/ConfigurationalEntropy | /python/configurational_entropy_from_edge_list.py | UTF-8 | 3,229 | 3.3125 | 3 | [] | no_license | import sys
import networkx as nx
import matplotlib.pyplot as plt
import random as rd
import math
def generateSubgraphs(G, m, n):
graphs = []
generatedVertices = []
i = 0
while i < m:
vertex = rd.randint(0, len(G.nodes) - 1) # random number
if vertex in generatedVertices:
continue
generatedVertices.appe... | true |
0f6363f4cc0232905e2db9ed3a765ae811468ac2 | keithstellyes/Pretty-Data-Stuctures | /markov-code/file2to_mc.py | UTF-8 | 1,132 | 2.734375 | 3 | [] | no_license | import sys
from common import *
from markover import *
finname = sys.argv[1]
print('Input file:', finname)
f = open(sys.argv[1], 'r')
count = int(sys.argv[2])
print('Going for', count, 'iterations')
initial_state = None
try:
initial_state = sys.argv[3].upper().strip()
except:
print('Using random initial state... | true |
e3f0454ef110af3396389ce2b504945e8c8a3b39 | mosessoh/CNN-LSTM-Caption-Generator | /image_feature_cnn.py | UTF-8 | 4,011 | 2.59375 | 3 | [] | no_license | import numpy as np
import os, sys, getopt, time
import cPickle as pickle
# Main path to your caffe installation
caffe_root = '/home/mosessoh/caffe/'
# Model prototxt file
model_prototxt = caffe_root + 'models/bvlc_googlenet/deploy.prototxt'
# Model caffemodel file
model_trained = caffe_root + 'models/bvlc_googlenet/b... | true |
418410b497feaee1caa80d7e9554bb755d77fc16 | rolfschr/conifer-tools | /scripts/plotting/QC03_sample_plot.py | UTF-8 | 2,467 | 2.546875 | 3 | [] | no_license | import pandas
pandas.set_option("display.line_width", 200)
from conifertools import *
import argparse
import numpy as np
import scipy.stats
def QC_Sample_Plot(calls, n_samples=None, title=None, outfile=None, outfile_list=None):
g = calls.calls[["sampleID"]].groupby("sampleID", as_index=False)
counts = np.sort... | true |
a895683bc1a92abac3944e2135070dd22f465753 | romaszkm/ProjectLed | /Python/ProjectLed/RoomClass.py | UTF-8 | 1,011 | 2.796875 | 3 | [] | no_license | import json
class Channel:
def __init__(self, var, is_value):
if is_value:
self.value = var
else:
self.value = 0
self.pin = var
class Room:
def __init__(self, room, is_value):
if isinstance(room, basestring):
room = json.loads(room)
... | true |
1598f341bc25f9d38bb9041664678a7429067cf4 | PAYNE1Z/python-learn | /luffycity-s8/第二模块_函数编程/第一章_函数_装饰器_迭代器_内置方法/生成器/generator.py | UTF-8 | 986 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# _*_ coding:utf-8 _*_
#
# Author: Payne Zheng <zzuai520@live.com>
# Date: 2019/5/13
# Location: DongGuang
# Desc: 通过yield实现在单线程的情况下实现并发运算的效果
import time
def consumer(name):
"""
消费者
:param name:
:return:
"""
while True:
agg = yield
agg += 1
... | true |
c50488d1c117bff44080407a8ebfba00fcdbaf4e | peraktong/LEETCODE_Jason | /1102. Path With Maximum Minimum Value.py | UTF-8 | 832 | 3.28125 | 3 | [] | no_license | import heapq
class Solution:
def maximumMinimumPath(self, A: List[List[int]]) -> int:
# use Heap:
directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
m = len(A)
n = len(A[0])
heap = [(-A[0][0], 0, 0)]
visited = [[0] * n for i in range(m)]
# use heap from small t... | true |
08e0108b48aac117c632b9162530bd1bc213fcf9 | pawarspeaks/python4beginners-Hacktoberfest21 | /Python Codes/Advance Python/Mail Merge Python/main.py | UTF-8 | 565 | 3.34375 | 3 | [] | no_license | # reading invited names and adding them into the list...
with open('./Input/Names/invited_names.txt') as invited_people:
invited_people_list = invited_people.readlines()
# for each person,
for person in invited_people_list:
with open('Input/Letters/starting_letter.txt') as letter:
# creating new string... | true |
eea2ffa625ae8061adf021eb0b1d96ea514a97a4 | obiyankenobi/virt_balancer | /packet.py | UTF-8 | 4,314 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
import msgpack
class Packet:
UNKNOWN = 0
INFO = 1
VM_INFO = 2
MIGRATE = 3
SEND_INFO = 4
MIGRATION_FINISHED = 5
def __init__(self, header, data=None):
self.header = header
self.data = data
def getPacketType(self):
return self.header.packetType... | true |
89495e35fdefe77dd03faafd453223e08003bad0 | axiom-data-science/larva-library | /tests/test_library_wizard.py | UTF-8 | 2,346 | 2.6875 | 3 | [] | no_license | from tests.flask_mongo import FlaskMongoTestCase
import random
random.seed()
def random_string(number_of_chars=1):
rdn_set = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ']
result = ''
for i in range(0,number_of_chars):
result += rdn_set... | true |
5ddeabcbe167b860e0c886fe796d44b7a3f62c63 | octoenergy/octotools | /octotools/localtime.py | UTF-8 | 2,397 | 3.328125 | 3 | [] | no_license | import datetime
import pytz
def to_timezone(value, timezone):
"""
Converts an aware datetime.datetime to the given time.
"""
value = value.astimezone(timezone)
if hasattr(timezone, 'normalize'):
# This method is available for pytz time zones.
value = timezone.normalize(value)
... | true |
d418b62317d1e78b871de895daaa414aa29c0c00 | mahfuz-omi/MachineLearningNLTKCodes | /simple_linear_regression.py | UTF-8 | 416 | 3.21875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
df = pd.read_csv('linear_data.csv')
print(df)
X = df[['age']].values
y = df['income'].values
linearModel = LinearRegression()
linearModel.fit(X,y)
print(linearModel.score(X,y))
dict = {'age':[50,55,60,40]}
X_test = pd.DataFram... | true |
39d0b06edd585308e2fccc529419d3b4a5e5bf9c | Aasthaengg/IBMdataset | /Python_codes/p03360/s832596525.py | UTF-8 | 87 | 2.640625 | 3 | [] | no_license | a=list(map(int,input().split()))
b=int(input())
a.sort()
print(a[0]+a[1]+(a[2]*(2**b))) | true |
089de9000d799bd9292810b9d59f2df52c726187 | duqtools/duqtools | /tests/ids/test_imas_handler.py | UTF-8 | 967 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from getpass import getuser
import pytest
from duqtools.ids import ImasHandle
TEST_STRINGS = (
'gu3ido/m0o/9234/123',
'guido4/mo0/9234/123',
'123_guido_123/123moo/9234/123',
'moo/9234/123',
)
TEST_OUTPUT = (
('gu3ido', 'm0o', 9234, 123),
('guido4', 'mo0', 9234, 123),
('123_guido_123', '12... | true |
8b53313e3c15f40d53ba0ec4950070ec94a2beb1 | kiyoon/video-long-term-feature-banks | /tools/evaluate_actions.py | UTF-8 | 5,274 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | true |
2a2c91bd5c6b9e692a5fa372c7b064e14c085911 | Sidhraj21/Topos_Chatbot | /edison.py | UTF-8 | 2,977 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import json
import elasticsearch
# Preparing information for connecting to Edison
CONNECTION_TIMEOUT = 120
PAGE_SIZE = 100
ES_HOST = "192.99.62.203"
ES_PORT = "9201"
ES_INDEX = "project-5bec7652be07770018d86... | true |
4a08b6fcdc98b417cf8b866363374a67b2553ea4 | Spekular/EDAF05-labs-public | /6railwayplanning/Binary Search Solution.py | UTF-8 | 5,128 | 3.046875 | 3 | [] | no_license | import copy
import gc
#Get number of [nodes, edges, minimum capacity, routes to remove]
myArgs = list(map(int, input().split()))
numNodes = myArgs[0]
numEdges = myArgs[1]
requiredFlow = myArgs[2]
maxRemovals = myArgs[3]
#Debug helpers
debugStrings = []
def debug(message):
debugStrings.append(message)
def printDebug... | true |
444a383046d348892df4ba7f488a457e1fa78445 | ykzw/data_structures_and_algorithms | /python/test/test_heap.py | UTF-8 | 3,167 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import unittest
import heap
class BinaryHeapTestCase(unittest.TestCase):
def setUp(self):
self.n = 10 ** 3
keys = list(range(self.n))
self.items = [(k, k) for k in keys]
def test_construct(self):
h = heap.BinaryHea... | true |
a62b954788a2ed7c30d229e72cc80a0013aaa643 | LNZ001/Analysis-of-algorithm-exercises | /leetcode_ex/ex214-最短回文串.py | UTF-8 | 1,007 | 2.984375 | 3 | [] | no_license |
class Solution:
def shortestPalindrome(self, s: str) -> str:
length = len(s)
if length == 0: return ''
dp = [0]*length
dp[0] = 1
for i in range(1, length):
if i == 1:
if s[i-1] == s[i]:
dp[i] = 2
else:
... | true |
1beaf9a774866b942f0466a644a09e74b0171587 | web-nutrition-project-2018/web-nutrition-server | /web-nutrition-server/src/nutrition/readability/feature_extraction.py | UTF-8 | 2,677 | 2.6875 | 3 | [] | no_license | import re
import time
from itertools import chain
import numpy as np
from nltk import sent_tokenize
from nutrition.readability.stanford_feature import get_syntactic_features
from nutrition.readability.lexical_feature import extract_lexical_features
from nutrition.readability.trad_score import all_trad_scores
from nut... | true |
b75cae894c4183d425c65657c26662d2a8a5160e | dongchunlong/grid_utils | /grid_utils/dimension/grid_dim/grid_dim.py | UTF-8 | 677 | 2.921875 | 3 | [
"Unlicense"
] | permissive | import six
__all__ = ['GridDim']
class GridDim(object):
"""
Notice: subclasses should provide attr "name".
"""
@property
def ndim(self):
raise NotImplementedError
@property
def size(self):
raise NotImplementedError
@property
def values(self):
raise NotImp... | true |
efdb8c2742844b52f805f4e0ea0f79201a33d074 | feitianyiren/djiboutimovies | /smartmovie.py | UTF-8 | 1,309 | 3.015625 | 3 | [] | no_license | import requests
import json
def parseFileName(filename):
yearindex = -1
name = filename[:filename.rfind(".")]
# print name
name = name.replace(".", " ")
name = name.replace(",", " ")
name = name.replace("-", " ")
words = name.split()
# print(words)
# if yifi == words[len(words)-1... | true |
50dbdf1e78ffcd51fe4bc23aa487a3409425ac0f | AlBannaTechno/Gravity-center-and-Area-Calculatore | /suc_class.py | UTF-8 | 2,449 | 2.875 | 3 | [] | no_license | class AreaCollector():
def __init__(self):
pass
@staticmethod
def getlist(cont):
loc = {}
glob = {}
c = "FFFF_0xxFF=%s\n" % cont
exec(c, glob, loc)
return list(loc["FFFF_0xxFF"])
@staticmethod
def getlenght(points):
ln = 0
if len(points... | true |
df4baee82e6a076fd73fd6573721450ae2bf0cbd | tangrams/WeatherOverTime | /data/common.py | UTF-8 | 3,828 | 3.078125 | 3 | [
"MIT"
] | permissive | import json, re
from PIL import Image
# get a common list of station across records
def getReliableStations (files):
stationsList = []
stations = {}
index = 0
for filename in files:
with open(filename) as data_file:
print(filename)
data = json.load(data_file)
... | true |
bace6bfad3a9a83e24c1fb87f03bc6a5882d3930 | I-Goel/Exchange-Rate-Classification | /Classification Code.py | UTF-8 | 5,212 | 3.125 | 3 | [] | no_license | #Importing all the libraries that we will need
import pandas as pd
import numpy as np
from sklearn.svm import SVC
from sklearn.metrics import confusion_matrix
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score
#Importing the data and setting the index to datetime form... | true |
2e75a02953cac150d0e9b1168a05183e1d3991a2 | VladimirGK/Hug-Angular-Web-Application | /backend/venv/Lib/site-packages/hug_middleware_cors.py | UTF-8 | 1,902 | 2.5625 | 3 | [] | no_license | from typing import Sequence
class CORSMiddleware(object):
"""A middleware for allowing cross-origin request sharing (CORS)
Adds appropriate Access-Control-* headers to the HTTP responses returned from the hug API,
especially for HTTP OPTIONS responses used in CORS preflighting.
"""
__slots__ = ('... | true |
bd42fb7405f9c04684ae2ecf4ebbe4841942a877 | Proch92/ai-projects | /pyseries/src/datagen.py | UTF-8 | 650 | 3.03125 | 3 | [] | no_license | import sys
import os
import math
DATASET_SIZE = 200
def sin(i):
START = 0.0
STEPS = (math.pi * 20) / DATASET_SIZE
return math.sin(START + (i * STEPS))
def linear(i):
START = 0.0
STEPS = 0.01
return START + (STEPS * i)
def gen(func):
with open(os.path.join('data', func + '.csv'), "w") ... | true |
8aa44731eeedacda273cd453cec864b7bf2a8c6c | mvaldez2/traffic | /traffic_functions.py | UTF-8 | 9,300 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 15:54:40 2019
@author: mvaldez2
"""
import pandas as pd
from scipy.stats import ks_2samp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import step, show
pd.options.display.max_columns = 50
#-------------------- Importing da... | true |
b5874706c08b88ca76b1602b5659170368dd2629 | lordvaider/DataDeliveroo | /deliverooemailparsertxt.py | UTF-8 | 1,846 | 2.796875 | 3 | [
"MIT"
] | permissive | import re
import pandas as pd
def clean_resplit_result(rr):
# does some basic cleaning on the result of a deliveroo email regex match
return [x.strip(' -') for x in rr if len(x.strip(' ')) > 0 and not x == '=C2=A3']
def get_bl(field, tlist):
# Gets the value of the bottom line field "field"
... | true |
70f1ea1e831b1ed197dd54c63f03a5842646ba88 | kefirski/hlm | /model/modules/abstract_vae/generative.py | UTF-8 | 1,302 | 3.125 | 3 | [] | no_license | import torch.nn as nn
class GenerativeBlock(nn.Module):
def __init__(self, **kwargs):
super(GenerativeBlock, self).__init__()
'''
Computation graph of generative block is identical to described in
"Improved Variational Inference with Inverse Autoregressive Flow" paper.
It... | true |
5b8806f59096c2580244ed8303e6372423685e88 | CollegeBoreal/INF1042-202-20H-02 | /3.Recursion/b300117705.py | UTF-8 | 192 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 4 15:12:42 2020
@author: acorl
"""
def fact(l):
if l == 0:
return 1
else:
return l * fact(l - 1)
print (fact(5))
| true |
234595a9760c1bc933bbacf02cff296b087aad85 | liucaouw/V2V-Groupcast | /model/DQN.py | UTF-8 | 8,249 | 2.53125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import os
DEBUG = False
def train(model,
state,
q_target,
learningRate,
batch_size,
loss_val,
epochs=1,
verbose=0):
if D... | true |
36c194fb9692d704a97a67494192601c34d4cce5 | amoebaliz/code_backups | /VIP/paper_figs/CT_wind_ssh_vel.py | UTF-8 | 1,238 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import netCDF4 as nc
## OBJECTIVES:
# 3 part plots of winds, ssh, VIP velocity/transport
# 1st: plot all years faded; mean in darker color (more compact)
# 2nd: plot entire time series (can indicate enso years...)
def plot_winds():
def plot_ssh():
def p... | true |
dc73d41143ad4165871fe18221dfd323376ded3b | tarun-batra-guavus/qa | /ciTool/Potluck_cloudera/Testcases/solution/Platform/connect_hive_shell.py | UTF-8 | 1,168 | 2.59375 | 3 | [] | no_license | """
Purpose
=======
Check that hive db is connecting and hive shell commands are running fine
"""
from potluck.nodes import connect, get_nodes_by_type
from potluck.logging import logger
from potluck.reporting import report
from potluck.healthcheck import healthcheck
namenode_alias_list = get_nodes_by_type("HIVE"... | true |
56405bafe7cb374d2beed3ad9c3b53584739861a | leisheyoufu/study_exercise | /python/exercise/yield/generator.py | UTF-8 | 2,570 | 3.5 | 4 | [] | no_license | __author__ = 'chenglong'
import sys
from functools import wraps
class GeneratorContextManager(object):
"""Helper for @contextmanager decorator."""
def __init__(self, gen):
self.gen = gen
def __enter__(self):
try:
return self.gen.next()
except StopIteration:
... | true |
d162b471155220ade5ae918a9b26a8fafb4ffc5e | grantlouisales/City-Income-Calculator | /StatesInfo.py | UTF-8 | 1,197 | 2.921875 | 3 | [] | no_license | class StateInfo:
def __init__(self, information):
self.information = information
def _get_name(self):
return self.information["State"]
def _get_cost_index(self):
return self.information["costIndex"]
def _get_grocery_cost(self):
return self.information["groceryCost"]
... | true |
20dc2261b7bc5d8bfe79f225f7b17a96fcbc5e2c | southpawgeek/perlweeklychallenge-club | /challenge-077/cheok-yin-fung/python/ch-1.py | UTF-8 | 1,925 | 3.578125 | 4 | [] | no_license | # Python3
# The Weekly Challenge - Perl & Raku
# #077 Task 1 Fibonacci Sum, Python script
def is_it_new_discovery(newsum):
global count
global ans
if not(newsum in ans):
ans.append(newsum)
count = count + 1
def fibsum():
global count
global ans
while count > 0:
count =... | true |
1aca0de17c053ee314e698e162c38b5f63f0f4f6 | eliasdabbas/advertools | /tests/test_crawl_or_not.py | UTF-8 | 1,835 | 2.671875 | 3 | [
"MIT"
] | permissive | from advertools.spider import _crawl_or_not
url = 'https://example.com'
def test_no_conditions():
result1 = _crawl_or_not(url)
result2 = _crawl_or_not(url + '?one=1')
result3 = _crawl_or_not(url + '/one/two/three')
result4 = _crawl_or_not(url + '/one/two?hello=yes&1=2')
assert all([result1, resul... | true |
57350beb6d261bdbb19ac56c8f5ca39ae9f5b3fe | lukas-abegg/master_thesis | /evaluation/predictors/predictor_greedy.py | UTF-8 | 4,793 | 2.6875 | 3 | [
"MIT"
] | permissive | """ This module will handle the text generation with greedy search. """
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import BertTokenizer
class Predictor(nn.Module):
""" Load a trained model and translate in beam search fashion. """
def __init__(self, model, checkpoin... | true |
a639e2ac2116732b81f37ff2e473eb2d4ccd6131 | arosadoo/CS50projects | /pset6/DNA/dna/dna.py | UTF-8 | 1,465 | 3.546875 | 4 | [] | no_license | from sys import argv, exit
import csv
# Returns the max amount fo times an str is seeen consecutively in a dna sequence
def strCounter(seq, theStr):
maxCount = 0
for i in range(len(seq)):
j = i
temp = 0
while(seq[j:len(theStr) + j] == theStr):
j += len(theStr)
t... | true |
733d82e82e9b88b11e4ca82358067693950606e6 | MirkaNicolle/Graficas-SoftwareRenderer | /shader.py | UTF-8 | 1,051 | 2.6875 | 3 | [] | no_license | #Codigo ayuda: https://github.com/churly92/Engine3D/blob/main/gl.py
#Repositorio perteneciente a Prof. Carlos Alonso
#Mirka Monzon 18139
#Proyecto 1: Software Renderer
from gl import V3, color, dot
def myshader(**kwargs):
texture_color = kwargs['texture_color']
w, u, v =kwargs['barycentric_coords']
nA, nB, n... | true |
8ab35bc6d7274d24bcc5b39f247a9349e2fc5062 | palao/RobustPython | /code_examples/chapter23/test_composite_strategies.py | UTF-8 | 755 | 3.15625 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
@dataclass
class Dish:
name: str
calories: int
from hypothesis import given
from hypothesis.strategies import composite, integers
ThreeCourseMeal = tuple[Dish, Dish, Dish]
@composite
def three_course_meals(draw) -> ThreeCourseMeal:
appetizer_calories = integers(min_valu... | true |
7bd891581bb87ebfb1862f1a3958f470958d1dd8 | leshanbog/PreSumm | /src/post_stats.py | UTF-8 | 3,325 | 2.859375 | 3 | [] | permissive | import argparse
from os import path
from functools import reduce
import re
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
... | true |
dc8dd000633508f99d8b141dc1a6935e77fef38b | dengxiongshi/tracta_ml | /example.py | UTF-8 | 2,164 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | from tracta_ml.model_optimizer import ModelTuner
from sklearn.model_selection import KFold
from datetime import datetime
import pandas as pd
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
# including code in main block for parallelization to work
if __name__ == '__main__':
... | true |
d5cd3caf6ecba85485d89e1d1856ab2f3c49ddb6 | delimitry/python-memory-analyzer | /python-memory-analyzer.py | UTF-8 | 2,354 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tool for finding specific objects in the python process
"""
from __future__ import print_function
import argparse
import errno
import logging
import re
import sys
__version__ = '0.0.1'
PY3 = sys.version_info[0] == 3
logging.basicConfig(format='[%(levelname)s] %(m... | true |
db61e36b232db7d9d7dfd23e8d2f7c07b0789131 | tommasocalo/Fin_summ | /Rank_new.py | UTF-8 | 29,915 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# In[2]:
import pandas as pd
import os
import numpy as np
import seaborn as sns
# In[3]:
if __name__ == "__main__":
years = {}
total_dfs = [os.path.join(root, name)
for root, dirs, files in os.walk(os.getcwd()+'/Results/df')
... | true |
89710983d91b130a8b63f6b15bdb393df2b164c8 | tejachil/ECE2524-Chiluvuri | /HW3/mult2.py | UTF-8 | 1,990 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python2
# ECE 2524 Homework 3 Problem 1 (Nayana Teja Chiluvuri)
import sys
import argparse
import fileinput
# argument parser
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('files', nargs='*', type=str, default=sys.stdin)
parser.add_argument('--ignore-blank'... | true |
63227928365a4720c17a408aa2c5e015b5cc01d5 | x670783915/ml-learning-practice | /NaiveBayes/NaiveBayes.py | UTF-8 | 2,025 | 2.953125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import time
from collections import Counter
# Mnist
# spent time: 372s
# acc: 0.60
def loadData(fileName):
data = pd.read_csv(fileName, header=None)
data = data.values
Y = np.array(data[:, 0])
X = np.array(data[:, 1:])
# 特征需要转化
X[X < 128] = 0
X[X >= ... | true |
07609bf9b1266178651d0e2cb943734e030e0e6a | baihao8904/K-means | /middleSchoolKmeans.py | UTF-8 | 3,882 | 2.53125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import time
import xlrd
import xlwt
from numpy import *
def loadAndDealData():
workbook = xlrd.open_workbook('math2.xls')
dealsheet = workbook.sheet_by_index(0)
scoreList =[]
for i in range(1,dealsheet.nrows):
if dealsheet.cell_value(i,4) != '':
scoreList.appe... | true |
7ff013833e70eeaa93987b8d697c6c0d29ef4002 | hackldom/todolist | /app/views.py | UTF-8 | 2,353 | 2.546875 | 3 | [] | no_license | from flask import render_template, request
from app import app
#from .forms import PostData
from form import AddNoteForm
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/planner'
app.secret_key = 'Development Key'
@app.route('/')
def index():
user = {'name': 'Dom Hackl',
'age': 20,
... | true |
b979781b1e7ce932424699970268e527709dd8a0 | kklook/leetcode | /19 RemoveNthNodeFromEndofList.py | UTF-8 | 651 | 3.375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def removeNthFromEnd(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
... | true |
aa8f904661a015dc59b3f6246cf8a7d8b5b8e619 | GardenerOfEden/Field | /Contents/python/SimpleAsync.py | UTF-8 | 1,298 | 2.578125 | 3 | [] | no_license | from java.util.concurrent import *
from field.util import FieldExecutorService
def SendToField(x):
"""Will cause this function to be executed in the main Field thread
(this is the thread that does Animation and Event handling and everything else, block this and you'll block the UI)
"""
def wrapper(*a,... | true |
a6b8df5eed58e2902b98f8ec435f82734a25c7bc | patelrohanv/steelhacks2016 | /r_steelhacks.py | UTF-8 | 1,216 | 2.53125 | 3 | [] | no_license | import geopy as geopy
from tweepy import OAuthHandler
from tweepy import Cursor
import json
from geopy.geocoders import Nominatim
import geojson
from geojson import Point
from geopy.exc import GeocoderTimedOut
'''
consumer_key = 'FKO8HPqgt7rJ0EYxQ5pGNYnOM'
consumer_secret = 'Nhv0BOtTvEub1RD8LA5Azk3uZW8qn5PCgpnyD2BnYk... | true |
b5df1dc6de17e156f93c66dfdda88eb5a86e1625 | urey/python_learning | /age.py | UTF-8 | 403 | 3.5625 | 4 | [] | no_license |
def is_reversed(i, j):
k = str(i).zfill(2)
t = str(j).zfill(2)
k = k[::-1]
if k == t:
return True
else:
return False
def cartalk_age():
for i in range(10, 50):
k = 0
t = i
count = 0
while t<= 99:
if is_reversed(k, t):
... | true |
3671d0a213658c261e5893c42b5c9ede93e95436 | f-prime/RiverHell | /run.py | UTF-8 | 851 | 3.078125 | 3 | [] | no_license | import sys
import pygame
from src.Game import Game
from src.Player import Player
from src.River import River
import time
def main(width: float, height: float) -> None:
pygame.display.set_caption("River Hell")
screen = pygame.display.set_mode((width, height))
game = Game(screen, width, height)
# P... | true |
4f674f79421b7718ccf43a06f57d81dee8a5e4e4 | kotaproj/supportWebhooksBd | /esp_zenn/util.py | UTF-8 | 1,541 | 2.734375 | 3 | [] | no_license | # 通知とIFTTT-Webhookイベントの紐づけ
# - cmd:sw,type:no1,how:released" => sw1をイベントIDとしてIFTTTにリクエスト
KEY_TO_EVENTID = {
"no1" : {
"pressed" : None,
"released" : "sw1",
"long" : "long_sw1",
},
"no2" : {
"pressed" : None,
"released" : "sw2",
"long" : "long_sw2",
},
... | true |
1e3afe4d7e5d83649f9632ef93b815c2343d0c8b | aoschwartz7/LanguageQuiz | /quizFunctions.py | UTF-8 | 8,891 | 3.1875 | 3 | [] | no_license | # There are two sections to this file:
# Section 1) Python-Flask content: contains functions for Python-Flask app so the
# app can run on local 5000.
# Section 2) Terminal-use content: builds off Section 1 to allow for app's use
# with Terminal.
# -------------------------------------------... | true |
51465994c4003949dc334da8c2c0fb9204c55e88 | cristian0396/Analisis-y-diseno-de-algoritmos | /Tarea 4/Eden.py | UTF-8 | 906 | 2.828125 | 3 | [] | no_license | from sys import stdin
num = []
def phi(n, NUM, curr):
if n == N-1:
return((curr>>1)&1) == ((first>>2)&1) and (Curr&1) == ((first>>1)&1)
visited[n][curr] = True
for i in range(NUM):
if (((id>>i)&1) == num[n+1]-'0' and ((curr>>1)&1) == ((i>>2)&1) and (curr&1) == ((i>>1)&1)):
if (n < N-1 a... | true |
b61bafea6ff30a82f63c772fcaa6cb4c9d0c8c34 | silvuple/w3resource.com-python-exercises | /lists_exercises_python.py | UTF-8 | 22,897 | 4.46875 | 4 | [] | no_license | """
1. Write a Python program to sum all the items in a list.
"""
my_list = [1, 2, 3, 4, 5]
# solution 1
list_sum = 0
for i in my_list:
list_sum += i
print(list_sum)
# solution 2
list_sum = sum(my_list)
print(list_sum)
"""
2. Write a Python program to multiply all the items in a list.
"""
my_list = [1, 2, 3, 4... | true |
288625316c3e21a9eb389afc39ee4e05e1152c77 | robend1990/python-simple-rest-app | /cvapp/schemas.py | UTF-8 | 1,625 | 2.609375 | 3 | [] | no_license | from cvapp import ma
from marshmallow import fields, post_load
from cvapp.models import DbUser
_skill_min_level = 1
_skill_max_level = 5
_skill_validation_error = f'Invalid value. Skills needs to have string name and an integer level ' \
f'in range from {_skill_min_level} to {_skill_max_level}. For example: "pytho... | true |
762cc3a8a5430299c23d99f1124d79ca2277cd9a | happyhillll/nuclearsoksok_python | /8장 도전 1-2.py | UTF-8 | 173 | 3.53125 | 4 | [] | no_license | score=[]
total=0
for i in range(5):
s=int(input('score: '))
score.append(s)
for i in score:
total += i
avg = total/5
print('total: ',total)
print('avg: ',avg) | true |
c58692e51b60ad042bb353c837a26a5c56ec1a84 | async-dime/DQLab-DataAnalyst | /01 Python for Data Professional Beginner/Python for Data Professional Beginner - Part 3/04 Polymorphism & Overloading/05 overloading (default parameter).py | UTF-8 | 1,254 | 3.453125 | 3 | [] | no_license | class Karyawan:
nama_perusahaan = 'ABC'
insentif_lembur = 250000
# usia akan di-set nilainya menjadi 21 saat tidak
# dispesifikasikan dan pendapatan akan di-set nilainya
# menjadi 5000000 saat tidak dispesifikasikan
def __init__(self, nama, usia=21, pendapatan=5000000):
self.nama = na... | true |
1c4163ff7098d2f87380aa7aceac13a956dbdad1 | princeramkot/gesture-control-and-voice-assistent | /speechh.py | UTF-8 | 2,216 | 2.75 | 3 | [] | no_license | import speech_recognition as sr # import the library
import subprocess as sp
import webbrowser
import os
#import vlc
import glob
import ctypes
url="www.google.com"
firefox_path = 'C:/Program Files/Mozilla Firefox/firefox.exe %s'
vlc_path="C:/Program Files (x86)/VideoLAN/VLC/vlc.exe"
song_path="C:\\Users\prince\De... | true |
c6c5c922b426ec6aee0c3b0f892cc1d3102c214c | davidpendergast/Cool-Python-Platformer | /options.py | UTF-8 | 4,952 | 2.609375 | 3 | [] | no_license | import pygame
import json
import os
from shutil import copyfile
import utilities
import random
import keybindings
## immutable settings
def standard_size():
return (640, 480)
def dev_size():
return (840,680)
def fps():
return 60
def jump_buffer():
return 5
def get_font(size):
return pygame.font.F... | true |
dbb1236295470146024d5ab9ac0025f4f621157f | Proyecto-Iris-4-0/OPTIMIZACION-POR-VRP | /APIS_EXTERNAS/api_google.py | UTF-8 | 938 | 2.578125 | 3 | [] | no_license | import googlemaps
from itertools import tee
from pymongo import *
client = MongoClient('localhost', 27017)
db_rutas_normalizada=client['rutas_recogida_normalizada']
municipios=db_rutas_normalizada['municipios']
matriz_municipios=db_rutas_normalizada['matriz_centros_municipios']
API_key = 'TuAPIKey'
gmaps = googlemaps... | true |
971fc333fd2b5282df1bdd6e64e7b0ac8263c0ba | jamesawgodwin/PythonMachineLearningTemplates | /kerasRegression.py | UTF-8 | 1,116 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sk... | true |
6f8089d3c25914296f1698bfc5d924769283acd6 | omar115/codechef | /secondLargest.py | UTF-8 | 167 | 2.703125 | 3 | [
"MIT"
] | permissive | r=[]
s=[]
t = int(input())
for _ in range(t):
s = list(map(int,input().split()))
r.append(s)
for _ in range(t):
r[_].sort(reverse=True)
print(r[_][1]) | true |
45938f058141ed334ce98bab719e1ed05b7df494 | jacowk/python-projects | /gmail/gmail_oo/create_label.py | UTF-8 | 1,464 | 3.140625 | 3 | [] | no_license | """
@author: Jaco Koekemoer
@date: 2020-08-16
A class to create labels for GMail
"""
from apiclient import errors
class CreateLabel:
def __init__(self, service, user_id):
self.service = service
self.user_id = user_id
def create(self, label_name):
"""Creates a new label within user's ... | true |
acb619a8aafd43bc24b2c2df79b2a853f1965e72 | amine1992/User-Sessions-API-with-Flask-and-Apache-Cassandra | /app/main/handlers/last_event_handler.py | UTF-8 | 637 | 2.796875 | 3 | [] | no_license | from ..services.last_event_service import get_last_events
from datetime import datetime, timedelta
def get_last_events_handler(days):
"""
Handler for the fetching the events in the last x days
"""
# Get current time
current_time = datetime.now()
# Get the time of "days" before
starting_tim... | true |