blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
761bda90b5c4c5463e25c5fc1a405ae2c3040ab9 | Python | takumi152/atcoder | /abc081b.py | UTF-8 | 321 | 2.90625 | 3 | [] | no_license |
def main():
buf = input()
N = int(buf)
buf = input()
buflist = buf.split()
A = list(map(int, buflist))
count = 0
while all(list(map(lambda a: a % 2 == 0, A))):
A = list(map(lambda a: a / 2, A))
count += 1
print(count)
if __name__ == '__main__':
main()
... | true |
b729900a89e0912255f67be181b2672d7d9001ca | Python | BlueCrewRobotics/2019-Vision | /cargo_detect.py | UTF-8 | 6,730 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
#
# Vision Processing Code
# Code to detect Power Cubes on the Nvidia Jetson TX1
# (c) 2018 Blue Crew Robotics
# Author: Matthew Gallant
#
import cv2
import numpy
import math
from enum import Enum
from networktables import NetworkTables
class GripPipeline():
def __init__(self):
s... | true |
e321a3e7d9da9c707bc0e4e3cea48c587dabae8d | Python | OswaldZero/pythonLearning | /people_student.py | UTF-8 | 331 | 3.25 | 3 | [] | no_license | import people
class student(people.people):
grade=""
def __init__(self,n,a,w,h,g):
super().__init__(n,a,w,h)
self.grade=g
def speak(self):
super().speak()
print("%s says: I am in grade %d"%(self.name,self.grade))
if __name__ == "__main__":
s=student("wyh",18,65,170,9)
... | true |
35cb6d9f500a3b5e6bb528cbcf6199b6522e2b8d | Python | MrDataScientist/100 | /Bubble Sort/prog.py | UTF-8 | 248 | 3.875 | 4 | [] | no_license | a = [4, 9, 0, 1, 5, 2]
l = len(a)
print('BUBBLE SORT\n')
print('Before: ', a)
for i in range(0, l-1):
for j in range(0, l-1-i):
if a[j] > a[j+1]:
a[j], a[j+1] = a[j+1], a[j]
print('Inside Loop:', a)
print('After: ', a)
| true |
d84f9ab3efed060b7fa98e1d9a4c031c42d060b6 | Python | daksh-yashlaha/nba-career-predictor | /ann.py | UTF-8 | 3,372 | 3.4375 | 3 | [] | no_license | # ANN Project on prediction if rookie NBA players will last more than 5 yrs
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import keras
from sklearn.preprocessing import Imputer, StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, cl... | true |
280fed1dbc028cbf7ee7b1bf7b988c97b806b4c3 | Python | Tribelingo-MT/indosum | /models/oracle.py | UTF-8 | 1,502 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | ##########################################################################
# Copyright 2018 Kata.ai
#
# 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/LICEN... | true |
1afe7b1ada66232551954e7ef6ce5800a1c1d487 | Python | thiagoolsilva/parq-analyser | /tests/test_is_empty_dataframe.py | UTF-8 | 1,255 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright (c) 2020 Thiago Lopes da Silva
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 writi... | true |
6ae079fd8332016420ac670d6062043bfa2fabd7 | Python | whatot/base | /python/pci/ch04/searchengine.py | UTF-8 | 14,140 | 2.875 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding:utf-8 -*-
import urllib2
import re
from bs4 import BeautifulSoup
from urlparse import urljoin
from pysqlite2 import dbapi2 as sqlite
import nn
mynet = nn.searchnet('nn.db')
# 被忽略单词列表
ignorewords = set(['the', 'of', 'to', 'and', 'a', 'in', 'is', 'it'])
class crawler:
# 初始化crawle... | true |
11dbd9274d2a6a21cca3d80a3f5d0cc1010801d0 | Python | sdkcouto/exercises-coronapython | /chapter_4_4_11.py | UTF-8 | 877 | 5 | 5 | [] | no_license | # 4-11. My Pizzas, Your Pizzas: Start with your program from Exercise 4-1 (page 60). Make a copy of the list of pizzas, and call it friend_pizzas. Then, do the following:
pizza = ["Tuna", "Pepperoni", "Brazilian"]
friend_pizzas = ["Pepperoni","Margherita","Four cheese"]
#
# • Add a new pizza to the original list.
pizza... | true |
0c9c0ce7fe71fd6c09b8aaa6ccaf6e22d9ebf8a9 | Python | gato/food | /server/foods/__init__.py | UTF-8 | 622 | 2.921875 | 3 | [] | no_license | import json
FOOD_DB = {}
with open('food_data.json') as json_file:
data = json.load(json_file)
data = data['report']['foods']
def normalize_n(n):
# fix gm with "--" to 00
n['gm'] = int(n['gm']) if n['gm'] != '--' else 0
return n
for f in data:
#call normalize_n ov... | true |
e1dc30e32054adb73b91d0034bdb06a3e0c70350 | Python | soonerfan237/MerckMolecularActivity | /FindCorrelatedFeatures.py | UTF-8 | 2,431 | 2.640625 | 3 | [] | no_license | #import glob
import csv
import pickle
import numpy as np
from statistics import mean
from statistics import median
def FindCorrelatedFeatures(feature_dict_filter, molecule_dict_filter, activity_list):
print("STARTING FindCorrelatedFeatures")
correlation = []
for i in range(0,16):
correlation.appe... | true |
5c883df41a344e15c14abecad874585c5902c6ee | Python | thanit456/database_proj_python | /Member/db_mainmember.py | UTF-8 | 7,667 | 2.546875 | 3 | [] | no_license | import mysql.connector
from mysql.connector import Error
#hyperparameter
databaseName = 'too_superstore'
password = 'boss1234'
class Login() :
def __init__(self, data) :
self.loginDataObj = LoginDB(data)
def login(self) :
return self.loginDataObj.CheckMember(databaseName)
class LoginDB() :
... | true |
02d975f65dd57a01ccab0e50eeabd5f7f64cb6f9 | Python | SuperMartinYang/learning_algorithm | /interview_exam/Google/prep/Trie.py | UTF-8 | 1,099 | 3.6875 | 4 | [] | no_license | import unittest
class TrieNode:
def __init__(self):
self.children = [None] * 26
self.words = []
class Trie:
def __init__(self):
self.root = TrieNode()
def addWord(self, word):
cur = self.root
for ch in word:
idx = ord(ch) - ord('a')
if not... | true |
fd6cad538aa2a87339b1dbe7b9720b624a2aabcf | Python | ivolnov/cs188 | /p2/multiagent/multiAgents.py | UTF-8 | 15,454 | 3.375 | 3 | [] | no_license | # multiAgents.py
# --------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klein (k... | true |
d44763945b27d24cab93ea8923a0663cdb2c14fc | Python | leequant761/Fluent-python | /14-it-generator/sentence_gen.py | UTF-8 | 970 | 3.90625 | 4 | [
"MIT"
] | permissive | """
Sentence: iterate over words using a generator function
"""
import re
import reprlib
RE_WORD = re.compile(r'\w+')
class Sentence:
def __init__(self, text):
self.text = text
self.words = RE_WORD.findall(text)
def __repr__(self):
return 'Sentence(%s)' % reprlib.repr(self.text)
... | true |
1c298daf3d70201042478e3a1e2c9ae74d7e90d3 | Python | Lagom92/algorithm | /0219/subset_sum.py | UTF-8 | 502 | 2.921875 | 3 | [] | no_license | import sys
sys.stdin = open('input01.txt', 'r')
T = int(input())
for test_case in range(1, T + 1):
N, K = map(int, input().split())
A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
count = 0
for i in range(1, 2**12):
result = []
s = 0
for j in range(12):
if i & (1 << j) ... | true |
a97b40795c487fc81e1ded147c4ddb7ea130c1e6 | Python | ovidiucs/coderbyte_practice | /medium/05-division.py | UTF-8 | 261 | 3.0625 | 3 | [] | no_license | def Division(num1,num2):
while num2:
num1, num2 = num2, num1%num2
return num1
# keep this function call here
# to see how to enter arguments in Python scroll down
print Division(raw_input())
# i stole this from gcd tbh
| true |
ef15ba7815486d7e1a3dfbd28435a849be77c3cb | Python | WitheredGryphon/witheredgryphon.github.io | /python/Advent of Code 2017/day4.py | UTF-8 | 2,469 | 4.21875 | 4 | [] | no_license | #!/usr/bin/python
'''
Day 3 - Morning (pt. 1)
A new system policy has been put in place that requires all accounts
to use a passphrase instead of simply a password.
A passphrase consists of a series of words (lowercase letters) separated by spaces.
To ensure security, a valid passphrase must contain no duplicate w... | true |
e3e64b610ef4adedec930c4413432774291c5d1c | Python | VerifyH2020/CO2_Plots | /mean_graphs_subroutines.py | UTF-8 | 23,155 | 2.890625 | 3 | [] | no_license | ####################################################################
# The subroutines for plot_mean_graphs.py
#
# NOTE: Uses Python3
#
####################################################################
#!/usr/bin/env python
# These are downloadable or standard modules
import sys,traceback
import pandas as pd
# The... | true |
de1eb6ce83009d7794e8a6dc6e649fd2dd6e1929 | Python | Prince31/31-10-2017_digital_marketing | /python_software/product_creation/header_test.py | UTF-8 | 916 | 2.734375 | 3 | [] | no_license | import pyperclip, time
def header_find():
global header_weights, body_text, header_output
header_weights_list = header_weights.split(">\n")
for i in range(len(header_weights_list)):
if(i==(len(header_weights_list)-1)):
break
else:
header_weights_list[i]+=">"
for i in range(len(body_text)):
if body_tex... | true |
044d747b6e58eb3eb5c3fd21086d4e140599ab38 | Python | BekusovMikhail/coursework2020-2021 | /generator.py | UTF-8 | 8,320 | 2.703125 | 3 | [] | no_license | import pickle
import random
import re
import workwithfiles
def parsprobs(path):
file = open(path, "rb")
try:
probs = pickle.load(file)
except:
return {}
return probs
def AddWordsToData(function=workwithfiles.parstext_on_1_word, file_pickle_from_and_to="", path_to_fil... | true |
77ccdbb840c640d24b9106f0545ff7d35f9ce0ac | Python | FBarto/WorkSpace-AED-1-Irems- | /Integrador/principal.py | UTF-8 | 926 | 3.359375 | 3 | [] | no_license | from Integrador import metodos
def menu():
alumnos=[]
a=False
while (a!=0):
print("ingrese opcion 1 para cargar notas \n "
"ingrese opcion 2 para mostrar las notas cargadas \n "
"ingrese opcion 3 para ver alumnos promocionados \n "
"ingrese opcion 4 para ve... | true |
30384b59edf596054ca548b574777152f2d0a506 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/31a39c36d7a54c2f97faae1232244361.py | UTF-8 | 371 | 4.375 | 4 | [] | no_license | def distance(strand1, strand2):
if len(strand1) != len(strand2):
return "Undefined; Strands must be of the same length"
# Iterate through the nucleotides and count the number of differences
differences = 0
for index in range(len(strand1)):
if strand1[index] != strand2[index]:
... | true |
c3d7fcf9361f3a53714b5b68e77380dc720c4e55 | Python | joehunter/UCDPA_joehunter | /preprocessing.py | UTF-8 | 3,562 | 3.78125 | 4 | [] | no_license |
class Encode:
"""
Encoding using OneHotEncoder by this class.
Methods
-------
do_one_hot_encoder(this_df, feature_name_to_encode):
Encode the named feature in the passed dataframe.
return_df(self):
Returns this instance of the dataframe.
"""
import pandas as pd
... | true |
6153a8357cbd912feb3f2100ddd1c0c4b703f448 | Python | DarrenRobinson-GitHub/Basic-Python | /Exponents1.py | UTF-8 | 752 | 5.125 | 5 | [] | no_license | # This function asks a user for a base number and an exponent, then calculates the result.
def raise_to_power(base_number, power_number): # Define a function with two variables
result = 1 # result is a variable where the math is store. We'll start with it equal to 1
for index in range(power_number):
... | true |
942e89dd64fd156de329ec6ab328969ac6762c5c | Python | MagdalenaZZ/Python_ditties | /generate_random_string.py | UTF-8 | 263 | 3.359375 | 3 | [] | no_license |
import random
import string
def generate_password(length: int) -> str:
chars = string.ascii_letters + string.digits + string.punctuation
return ''.join(random.choice(chars) for i in range(length))
password = generate_password(12)
print(password)
| true |
51a1e40b838632e066667c25955e793a585ea5ed | Python | hayleykisiel21/Worldwide-Happiness | /CountryHappiness.py | UTF-8 | 12,373 | 3.359375 | 3 | [] | no_license | # ## Importing necessary packages:
# In[2]:
import pandas as pd
import plotly.express as px # (version 4.7.0) pip install plotly
import plotly.graph_objects as go
import dash # (version 1.12.0) pip install dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import In... | true |
7626db42132d2e77a6fd22334231e8c5c9f26eec | Python | teja0508/CIFAR-10-Dataset---CNN | /CIFAR-10 DATASET- 10 Images Recognition Classifier using CNN.py | UTF-8 | 5,319 | 3.21875 | 3 | [] | no_license | """
CIFAR-10 DATASET CONVOLUTION NEURAL NETWORK - CNN
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from tensorflow.keras.datasets import cifar10
(x_train,y_train),(x_test,y_test)=cifar10.load_data()
print(x_train.shape)
print(y_train.shape)
print(x_test.shape)... | true |
fdd9aea4a860b65fa449dd8acf318aa5d0f87d79 | Python | JorgeOehrens/Inventario | /App.py | UTF-8 | 5,927 | 3.203125 | 3 | [] | no_license | #render_template: Sirve para renderizar una plantilla
#request: http://www.manualweb.net/flask/request-flask/ <---------AHI ESTA EXPLICADA El contenido que un cliente web manda al servidor siempre va almacenado en la Request. En Flask la Request se representa mediante el objeto request
#redirect: funcion que sirve p... | true |
ae7e8cadf9c1f40da495f12816c43233f5e54f0a | Python | MostafaTaheri/aws-python | /middleware/config.py | UTF-8 | 1,715 | 2.96875 | 3 | [] | no_license | import yaml
class LoadConfig:
"""Loads information of yaml config file.
Example:
config = LoadConfig()
mongo_url = config.mogo_db_info()
"""
def __init__(self):
self.file = open("config.yml")
self.config = yaml.load(self.file, Loader=yaml.FullLoader)
def mogo_db_i... | true |
454867eda8d9851058807d271e6882de7230330b | Python | githubtater/Self_Paced-Online | /students/Roy_Tate/lesson08/test_circle.py | UTF-8 | 2,665 | 3.75 | 4 | [] | no_license | #!/usr/bin/python3
## Student/Author: Roy Tate (githubtater)
import unittest
import circle
import math
class CircleTest(unittest.TestCase):
def setUp(self):
self.radius = 5
def test_radius_returns_correct_value(self):
c = circle.Circle(self.radius)
self.assertEqual(c.radius, self... | true |
adb9c540aba53d28ca60a798d9486303639de56e | Python | Mostafa-Ahmed-Kamal/Computer-Security | /Project 6 RSA/chi19_breakRSA_hw06.py | UTF-8 | 3,398 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3.4
### Author: Max Chi
### ECN: chi19
### HW: 06
### File: chi_breakRSA_hw06.py
### Due Date: 2/22/2018
import sys
import os
from math import floor
from BitVector import *
from PrimeGenerator import *
from chi19_RSA_hw06 import *
from solve_pRoot import *
def encrypt(f1, pubKeyList):
encL =... | true |
160d2f21b0434d8a9f3ba6d8afd291674679d574 | Python | PathricLee/HelloPathricLee | /py/crawer.py | UTF-8 | 2,672 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
#_*_coding:utf-8_*_
"""
本文利用,selenium, bs4, re
解决js 爬虫问题。
使用库方面,感谢ipython提供的开发提示和官网文档
bs4, 其利用tree xml结构对其网页进行解析,有很多查找节点的函数。非常好定位节点。
re, 其可以抽取文本中,想要的信息,特别是利用search, groups的方法。分区查找。
driver, 这个库,可以提供节点查找和定位节点属性和方法,利用交互式爬虫。其中,数据同步的问题很重要。
time, 这个库,可以计算程序执行时间,程序等待等问题,trick方式解决等待。
另一点:pytho... | true |
4165434ea938fdcec670d4ce8eb0c4853c47f3ca | Python | rjynn/LinkBot | /linkbot/commands/Suggest.py | UTF-8 | 1,750 | 2.71875 | 3 | [] | no_license | from linkbot.utils.cmd_utils import *
from linkbot.utils.misc import send_split_message
@command(
["{c} add <feature>", "{c} remove <id>", "{c} list"],
"Suggest a feature that you think the bot should have. Your suggestion will be saved in a suggestions file.",
[
("{c} add some cool stuff", "Sugge... | true |
ace10869bfb094975f51e3ad2b3ae6c13cf44a94 | Python | doziej84/Python_Scripts | /general/util.py | UTF-8 | 3,412 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 2 10:13:17 2017
@author: baillard
"""
import os
from PyPDF2 import PdfFileMerger
import numpy as np
import matplotlib.backends.backend_pdf
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import numpy as np
def full_path_list(dir... | true |
525d97191705d5fca64c48a00e07d3f0d88737a6 | Python | Gabiiii/BaekJoon_python | /2446.py | UTF-8 | 174 | 3.609375 | 4 | [] | no_license | a = int(input())
for i in range(a-1):
print(" "*i, end="")
print("*"*((a*2)-((i*2)+1)))
for i in range(a):
print(" "*((a-i)-1), end="")
print("*"*((i*2)+1)) | true |
6db02d641f78dc0111b74575a753c7cdb98a302e | Python | yclinhh/CodeStyleCheck | /CodeStyleCheck/11.py | UTF-8 | 3,547 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2020/6/9 14:48
# @Author : yachao_lin
# @File : 11.py
import re
keyWordName = ';'
str1 = ' int fun()\n{ int a = 0; int b=0; \n\n }'
regExpStr_0 = '^([ ]*)' + '(.*)' + keyWordName + '[ ]*([\\S]*).*'
pattern_0 = re.compile(regExpStr_0)
countStr = '\\1'
it = re.... | true |
97e9e7eab5e9d31bbd1afe2962b0f0bd309a1a12 | Python | warenlg/taxicoop | /src_python/taxi.py | UTF-8 | 2,697 | 3.1875 | 3 | [
"MIT"
] | permissive | from typing import Tuple, List
from haversine import haversine
class Taxi:
def __init__(self, capacity: int=2, speed: int=40):
"""
list of request indices in the same order as the taxi drives them.
positive indices stand for PU points when negative indices stand for DO points.
""... | true |
fed05ff1e750abc4a45825a9b0bbb75f815ec86b | Python | sjodcre/HackerRankPython | /Sets/TheCaptainsRoom.py | UTF-8 | 179 | 2.953125 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
i,m = int(input()),list(map(int,input().split()))
cap_room = (sum(set(m))*i - sum(m))//(i-1)
print(cap_room)
| true |
fa6a0d38ec13ce8a03d3612c5d10dd11d17b15bd | Python | as-rawat/Coffee-Machine | /app.py | UTF-8 | 2,874 | 3.421875 | 3 | [] | no_license | import time
import argparse
import traceback
from src.utils import Utils
from src.coffee_machine import CoffeeMachine
app_description = """
Coffee Machine: A Coffee Machine Simulator, It tries to brew beverages using their recipe and
ingredients provided.
Note: To stop the machine, just e... | true |
dbcd088d96f8acd3c6e85c22262b462dda7cf8e2 | Python | mdd423/Comp-HW | /HW4/rkintegrator.py | UTF-8 | 3,644 | 2.625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import time
def approxEqui(x1, x2, epsilon):
if (((x1 + epsilon) > x2) and ((x1 - epsilon) < x2)):
return True
else:
return False
def func(t, y):
return -t
def gravitation(t, y):
A, M, G, B = 1., 1., 1., 1.
r_mag = np.sqrt(y[0]**2... | true |
ca5f74ea9cc2a717e1dc109f7bb3689a7da25b4c | Python | abrown/dynsem-rpython | /src/meta/test/tokenizer.py | UTF-8 | 2,449 | 3.265625 | 3 | [] | no_license | import unittest
from src.meta.tokenizer import *
class TestTokenizer(unittest.TestCase):
def assertTokensEqual(self, expected, actual):
if len(expected) is not len(actual):
raise AssertionError("Lengths do not match: {} != {}".format(expected, actual))
for i, e in enumerate(expected):... | true |
21e43743b5dcc198f43a6b6d85244426853d31cf | Python | isgoodtime/Rich-Bots | /DISCORD BOT.py | UTF-8 | 9,931 | 2.515625 | 3 | [] | no_license | import discord
import os
import datetime
import openpyxl
import requests
import asyncio
from json import loads
client = discord.Client()
@client.event
async def on_ready():
print(client.user.id)
print("ready")
game = discord.Game("Rich Bot Play")
await client.change_presence(status=di... | true |
2b13625a9394424abf7d828da05cc9a25f094484 | Python | arthurabreu2/WebScraping | /main.py | UTF-8 | 1,063 | 2.921875 | 3 | [] | no_license | from config import URL, URL_BASE
import requests
from bs4 import BeautifulSoup
import csv
paginas = []
# Criando um arquivo csv para gravar todas as informações
arquivo_csv = csv.writer(open('nomes_artistas_z.csv', 'w', newline='\n'))
arquivo_csv.writerow(['Nomes_Artistas', 'URL_Artistas'])
for num_page in range(1,... | true |
ca51caea642dcdd03ac2a3e245c566cebfb66f0d | Python | gutus/MathAdvPython | /02_square in_60.py | UTF-8 | 194 | 3.546875 | 4 | [] | no_license | from turtle import *
shape('turtle')
speed(10)
def square():
for i in range(160):
forward(100)
right(90)
forward(100)
right(90)
right(5)
square()
| true |
70a0fb3c7e489513399d164c4fd256965cfbe4af | Python | furqanshahid85-python/Kinesis | /KDF_preprocessor/lambda.py | UTF-8 | 2,118 | 3.1875 | 3 | [] | no_license | import base64
import json
def firehose_response_formatter(recordId, processed_payload):
"""
helper function that formats the processed records according to Firehose object response model.
Payload is first encoded to convert it to bytes string. Then it is encoded with base64 since Firehose
requires a... | true |
5a11df4fa7cd2799e0d6e3df61f6404c7dcad954 | Python | deepjyoti-dev/datascience | /day-92-3.py | UTF-8 | 1,897 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 14 08:01:52 2021
@author: deepj
"""
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
from sklearn import datasets
iris = datasets.load_iris()
print(iris.DESCR)
#inforation ... | true |
244ed3aa23735b43342adbd9a78b192ed38328c1 | Python | meiordac/Interview | /Code Fights!/whichbus.py | UTF-8 | 274 | 3.28125 | 3 | [] | no_license | def whichBusToTake(n, busesColors, goingToSchool):
for i in range(n):
if goingToSchool(i)==True and busesColors[i]=="red":
return i
for i in range(n):
if goingToSchool(i):
return i
print(whichBusToTake(3,["red","red","blue"],[True,True,True])) | true |
41575fbb18e90344f03a7058a756928b4e256e54 | Python | canmengmeng/design | /data_split.py | UTF-8 | 607 | 2.515625 | 3 | [] | no_license |
from sklearn.model_selection import train_test_split
import numpy as np
pos_data = np.load('pos.npy')
neg_data = np.load('neg.npy')
all_labels = np.append((np.ones(len(pos_data))), (np.zeros(len(neg_data))), axis=0)
all_texts = np.append(pos_data, neg_data, axis=0)
x_train, x_test, y_train, y_test = train_test_spl... | true |
58c93115c814f4c967a7bd666f279880989c450b | Python | TeMU-BSC/compare-annotations | /src/core/evaluation/frequency.py | UTF-8 | 2,158 | 2.84375 | 3 | [] | no_license | from unidecode import unidecode
class FreqCalculator:
def __init__(self):
self.acceptance_rate = dict()
@staticmethod
def normolized_text(text_original):
normolized_whitespace = " ".join(text_original.split())
unaccented_string = unidecode(normolized_whitespace)
return un... | true |
4e970754f148b08e3b9c770e614c08a8122a45d4 | Python | ds17/reptiles_gh | /Bing BGI.py | UTF-8 | 2,281 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #D:\Python\Python35\python
# -*- coding:utf-8 -*-
import re,sys,os,time,logging
import urllib.request
log_dir='D:\\WallPaper\\BingWallpaper\\bing reptile.log'
logging.basicConfig(filename=log_dir,level=logging.INFO)
file_dir='D:\\WallPaper\\BingWallpaper'
now_time=time.strftime('%Y%m%d%H%M%S')
# 通过os.walk遍历壁纸文件夹下所有... | true |
4cc8c1102ddd097979003ca254c7438aff514bab | Python | dulkith/KeyStroke_Dynamics_IIT_FYP | /src/network_gns3/outlier.py | UTF-8 | 989 | 2.796875 | 3 | [] | no_license | import pandas as pd
def value_above_thresh(row):
for r in row:
if r >= 10:
print(row)
break
data = pd.read_csv("data_over_network_0_latency_0_jitter.csv")
data = data[data.columns.drop(['Unnamed: 0', 'subject'])]
def load_dataset(name):
data = pd.read_csv(name)
if len(dat... | true |
926dbe98f2ecb5f26f6291644d1dc4058c195271 | Python | AsyncXeNo/ChessEngine_99 | /game/square.py | UTF-8 | 1,228 | 3.03125 | 3 | [] | no_license | from my_logging import get_logger
from game.constants import NUM_TO_FILE
logger = get_logger(__name__)
class Square(object):
def __init__(self, board, file, rank, piece=None):
self.pos = (file, rank)
self.board = board
self.file = file
self.rank = rank
self.piece = piece
... | true |
e9b14bb1d113c26a4f6cb0df8852ff9fccb96072 | Python | KhalSnow/Leetcode | /3. Longest Substring Without Repeating Characters.py | UTF-8 | 1,216 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 25 11:03:25 2018
@author: wyh
"""
"""
Given a string, find the length of the longest substring without repeating characters.
"""
class Solution:
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
... | true |
e7ffeedff2937bda2188f8ea220ffb8030a5914d | Python | kc-sneha/python_notes | /python_notes/dictionary.py | UTF-8 | 379 | 3.484375 | 3 | [] | no_license | #Note: A dictionary is a key value set
my_dic = {'name':'abs','age':20,'grades':[10,29,30,40,99]}
lottery_player = {
'name':'abc',
'numbers':(11,2,33,43,54)
}
universities = [
{
'name':'mit',
'location':'us'
},
{
'name':'oxford',
'location':'uk'
}
]
print(sum(lottery_player['numbers']))
print(lottery_player... | true |
3287eb77f361c2ad80057459e6966e144a5714a6 | Python | OpenSourceEconomics/grmpy | /docs/source/figures/scripts/fig-weights-marginal-effect.py | UTF-8 | 2,965 | 2.796875 | 3 | [
"MIT"
] | permissive | """ This script creates a figure to illustrate how the usual treatment effects can be
constructed by using differen weights on the marginal treatment effect.
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.integrate import quad
from fig_config import OUTPUT_DIR, RESOURCE_... | true |
03f3959acdbfda8de2e3a1ffdceb37a4ea3f2c76 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2407/60648/267164.py | UTF-8 | 446 | 3.234375 | 3 | [] | no_license | class Solution:
def dayOfYear(self, date: str) -> int:
year, month, day = map(int,date.split('-'))
months = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if (year%4==0 and year%100!=0) or (year%400==0) : months[2] += 1
res = 0
for i in range(month): res += months[i]
... | true |
c452c520f1c26196caf71820b806238e2bbb11bc | Python | Noronha76/DSA | /pessoal/sqlite.py | UTF-8 | 1,912 | 3.390625 | 3 | [] | no_license | # Reemove o arquivo com o banco de dados SQLite (caso exista)
#import os
#os.remove("dsa.db") if os.path.exists("dsa.db") else None
import sqlite3
import random
import time
import datetime
# Criando uma conexão
conn = sqlite3.connect('dsa.db')
# Criando um cursor
c = conn.cursor()
# Função para criar uma tabela... | true |
b0e0876000014ed39955ddb576134e7642f81ac4 | Python | Alejandro-Paredes/EECS337---NLP-Project-2 | /RecipeStructure.py | UTF-8 | 7,250 | 3.328125 | 3 | [] | no_license | #
# RecipeStructure.py
# All recipes and their components are stored in this format
#
import json
# The highest data type, a recipe. It contains a linked list of steps
class Recipe:
firstStep = None; # The first step in our recipe. A Step object pointing to the next step
allIngredients = []; # A set of all the ... | true |
59e8dfd16022e1501d7bc151c288b24956b692c6 | Python | HongsenHe/algo2018 | /454_4sum_II.py | UTF-8 | 788 | 3.1875 | 3 | [] | no_license | class Solution:
def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
hm = {}
res = 0
'''
一共4个tuple, 每个tuple有两个数字,排列组合一下,任意两个tuple就有4中方案,即2x2
即, tuple_1_1 * tuple_2_1, tuple_1_2 * tuple_2_1, ...
构成的4种方案就是4个sum, 从剩下的两个tuple里找答案... | true |
358f995dc513ff9b909500b94d296b493256d4e2 | Python | jaynog/quadratic-equation | /exercise1.py | UTF-8 | 867 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
The program should print two roots of the quadratic equation of the form
a x² + b x + c = 0
The roots must be stored in a tuple named 'solutions' and printed at the very end of the program.
"""
# This is sample input data
a = 1
b = 3
c = 2
# This is a tuple for results. You should overr... | true |
f932432f389bb05cfd9b92955aa74b3af08a5ba7 | Python | cmccown1/python-challenge | /PyPoll/main.py | UTF-8 | 2,927 | 3.5625 | 4 | [] | no_license | # import dependencies
import os, csv
# initialize variables
candidate = [] # store the candidate (vote) values from the input file
unique = [] # store a list of unique values in the candidate list
result = [] # store a list of candidate (vote) counts for each unique
# set the file path for the input file
el... | true |
df6a14821de0e04d7c5aaa9aae5b6bf6eda49fa0 | Python | sagastya/Diabetes-Predictor | /FlaskWebProject/data_etl_aws_s3_rds.py | UTF-8 | 1,747 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[5]:
# Dependencies
import pandas as pd
from sqlalchemy import create_engine
# Read csv file from cloud storage amazon aws s3 into dataframe
data_file = "https://finalproject-jssicc.s3.us-east-2.amazonaws.com/diabetes.csv"
data_df = pd.read_csv(data_file)
# Rename column h... | true |
ff00b74f6f67558caa15f9d6062f24823047350f | Python | rnikoopour/TextInImage | /text_in_image.py | UTF-8 | 4,729 | 3.125 | 3 | [] | no_license | import argparse
import sys
import re
from PIL import Image
string_length_start_pixel = 0
string_text_start_pixel = 11
int_size = 32
def num_bits_in_string(string):
return 8 * len(string)
def bit_string_to_32bits(bit_string):
preceding_zeroes = '0' * (32 - len(bit_string))
full_string = preceding_zeroes ... | true |
0b15fc92cf8fbc7bfdff5b51f3535f63db0a21fb | Python | brrbaral/pythonbasic | /SomeImportantPrograms/InitMethod.py | UTF-8 | 149 | 3.15625 | 3 | [] | no_license | class Tune:
def __init__(self):
print("hello from init")
def swim(self):
print("i am swimming")
t1=Tune()
t1.swim() | true |
4fd3ebf1a381c14e629ae02f72db6b5323f8deb3 | Python | 10erick-cpu/RL_Mixing_Colours | /utils/unet_utils/multi_stopwatch.py | UTF-8 | 2,510 | 3.03125 | 3 | [] | no_license | import time
LOG_TEMPL = "{0}: {1:.2f}{2}"
class TimedBlock(object):
def __init__(self, key, stopwatch):
self.key = key
self.sw = stopwatch
def __enter__(self):
if not self.sw.enabled:
return
self.sw.current_block_count += 1
self.sw.reset(self.key)
def... | true |
d8a7f061c272111bbbbf2e7132128bfe7ec368de | Python | Omega97/omar_utils | /_examples/example_computation.py | UTF-8 | 763 | 3.484375 | 3 | [] | no_license | """
In this simple example the computation
consists of increasing self.n by +1
"""
from data.computation import *
from os import remove
class New(Computation):
def __init__(self, path: str):
self.n = 0
super().__init__(path)
def execute(self, n):
"""the operations"""
for _ ... | true |
f6d7f0ccb40b1ba49c73bc453d8c8e8b51d249c5 | Python | he-CMCC-IT/DiskPrediction | /functions.py | UTF-8 | 14,188 | 3.28125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import random
import time
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn.cluster import KMeans
import pickle
import os
files_path = 'D:/a学习和工作/data_Q3_2017/'
def normalized(df):
"""
:param df: 需要标准化的DataFrame式磁盘数据
:return: 标准化到... | true |
cee848bdaa088060929d1a8689c51f1f0d209f74 | Python | laligafilipina/collectives | /codewarskata/longest_common_subsequence.py | UTF-8 | 158 | 3.28125 | 3 | [] | no_license | def lcs(x, y):
res=[]
i=0
for item in y:
if item in x[i:]:
res+=[item]
i=x.index(item)+1
return "".join(res)
| true |
c56fc72313afbee803c37ad36792d1e4598e653f | Python | wpliu25/CarND-Advanced-Lane-Lines | /P4Video.py | UTF-8 | 592 | 2.546875 | 3 | [] | no_license | # Import everything needed to edit/save/watch video clips
from moviepy.editor import VideoFileClip
from IPython.display import HTML
from P4 import *
import sys
line = Line()
def process_image(image):
result = AdvancedLaneLines(image, line, 0)
return result
if __name__ == "__main__":
if(len(sys.argv) < 3... | true |
19e0fd4700c71cfde6a02a1d0125ec1f5ad7b8c4 | Python | ImageMarkup/isic-challenge-scoring | /isic_challenge_scoring/confusion.py | UTF-8 | 1,967 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | from typing import Optional, Tuple, Union
import numpy as np
import pandas as pd
def create_binary_confusion_matrix(
truth_binary_values: np.ndarray,
prediction_binary_values: np.ndarray,
weights: Optional[np.ndarray] = None,
name: Optional[Union[str, Tuple[str, ...]]] = None,
) -> pd.Series:
# T... | true |
b9221e4ee496cff6fe53407ebf1c778beacd4275 | Python | ilmarilehtinen/traffic-simulation | /src/vector.py | UTF-8 | 2,608 | 3.734375 | 4 | [] | no_license |
import math, random
class Vector:
""" Custom class to represent 2D vectors with x, y """
def __init__(self, x, y):
self.x = x
self.y = y
def norm(self):
""" Euclidian norm """
return math.sqrt(self.x**2 + self.y**2)
def distance(self, other):
return (self - o... | true |
45ecb49a98549d344720de155ea401ff468eaeba | Python | cskhw/computer-vision-kjm | /assign3/main1.py | UTF-8 | 952 | 2.71875 | 3 | [] | no_license | import cv2
import numpy as np
theta = 18 * np.pi / 180
rot_mat = np.array([[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]], np.float32)
image = np.full((500, 500, 3), 0, np.uint8)
pts1 = np.array([(0, -60), (70, 50),
(-70, 50)], np.float32)
pts2 = cv2.gemm(pts1, ro... | true |
8ace4588a3ced320e831fbf0aabefcbcb63e2a43 | Python | AthulyaJA/Python_ | /lisumj.py | UTF-8 | 203 | 3.015625 | 3 | [] | no_license | x=int(input("enter the limit"))
print("enter {}elemetns".format(x))
l=[]
for i in range(x):
n=int(input())
l.append(n)
def add(a):
s=0
for i in a:
s=s+i
return s
print(add(l)) | true |
8f334f7a949760ad6fb037615c8c218d5c890648 | Python | borislavstoychev/Soft_Uni | /soft_uni_advanced/Comprehensions/exercise/8_heroes_inventory.py | UTF-8 | 413 | 3.265625 | 3 | [] | no_license | heroes_dict = {h: {} for h in input().split(", ")}
line = input()
while not line == "End":
name, item, cost = line.split("-")
cost = int(cost)
if not heroes_dict[name].get(item):
heroes_dict[name].update({item: cost})
line = input()
print(*[f"{key} -> Items: {len(value)}, Cost: {sum([val... | true |
1f9d97ecc4ae433347ea7c7c179acc292984bec8 | Python | kkgarai/OpenCV | /10 Trackbar Example 2.py | UTF-8 | 728 | 3.046875 | 3 | [] | no_license | """
Trackbars are used to change out image values dynamically
"""
import numpy as np
import cv2
def nothing(x):
print(x)
cv2.namedWindow("Image")
cv2.createTrackbar('CP', 'Image', 10, 400, nothing)
switch='color/gray'
cv2.createTrackbar(switch,'Image',0,1,nothing)
while True:
img = cv2.imread('lena.jp... | true |
6cc7864bc8ff3ac48b9ff75fc9b9a6cc45682774 | Python | antoniorcn/fatec-2019-1s | /djd-prog2/noite/aula7/teste_lista_3.py | UTF-8 | 235 | 3.484375 | 3 | [] | no_license | lista = ["juan", "arthur", "jose",
"muller", "shaokhan", "juriscreide",
"cleverson"]
print("Lista: ", lista)
sub_lista = lista[1:7:2]
print("Sub Lista: ", sub_lista)
inverso = lista[::-1]
print("Inverso: ", inverso) | true |
4f6bbd0dc1a39054d91f21ec754073a580a4cf78 | Python | jorisvandenbossche/DS-python-geospatial | /notebooks/_solutions/04-spatial-relationships-joins17.py | UTF-8 | 158 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # Merge the 'districts' and 'trees_by_district' dataframes
districts_trees = pd.merge(districts, trees_by_district, on='district_name')
districts_trees.head() | true |
1589b0d80c1863ec7cee19d2939fce3157d04352 | Python | Shikib/schema_attention_model | /STAR/apis/demo.py | UTF-8 | 606 | 3 | 3 | [
"MIT"
] | permissive |
import api
if __name__ == "__main__":
print()
print("Search for a trivia question")
item, num_other_items = api.call_api(
"trivia",
constraints=[{
"QuestionNum": 2
}],
)
print(item)
print(num_other_items)
print()
print("Search for an apartment... | true |
3c7877721835b8eb5b51d34bac0c7faa09b9f34c | Python | ShijieLiuForBackup/PythonDataAnalysis | /fake data/frankunilibrary.py | UTF-8 | 1,090 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 15:29:47 2020
@author: liush
"""
import os.path
import xlwt
from faker import Faker
fak = Faker()
#create a new excel file for storing data needed
if(os.path.exists('frankunilibrary.xlsx') == False):
#wb = openpyxl.Workbook()
wb = xlwt.Workbook()
#sheet ... | true |
ccd69ccc9268812f52d165e3eae9a5eadf46f30c | Python | AhnDogeon/algorithm_study | /line/marble/7.py | UTF-8 | 960 | 2.609375 | 3 | [] | no_license | MIN = 0xffff
sol = []
def solution(n, battery):
global MIN
arr = []
for i in battery:
arr.append(i[0])
battery_dic = {}
for j in battery:
battery_dic[j[0]] = j[1]
change(0, 0, arr, battery_dic, n)
print(MIN)
return MIN
sol = []
MIN = 0xffffff
def change(k, n, arr, batte... | true |
135ecb290f53aa8b382ac5cb79bc2bfd9b333536 | Python | SlickChris95/pythonProjects | /tablePrinter.py | UTF-8 | 728 | 4.59375 | 5 | [] | no_license | '''
Write a function named printTable() that takes a list of
lists of strings and displays it in a well-organized table
with each column right-justified.Assume that all the inner
lists will contain the same number of strings.For example,
the value could look like this
'''
tableData = [['apples', 'oranges', 'cherries'... | true |
555752c8ed8268a252cfcd46abb32a6ef0aedc34 | Python | stynshrm/steric-conflict-resolution | /docker_build/generate_mdp.py | UTF-8 | 3,661 | 2.546875 | 3 | [
"MIT"
] | permissive | import collections
def generate_mdp(resolution='CG', output_filename = 'alchembed.mdp', b = 2, steps = 1000, delta_lambda = 0.001, alpha = 0.1, dt = 0.01):
'''Produce custom alchembed / GROMACS .mdp file based on Phil F's github tutorial: https://github.com/philipwfowler/alchembed-tutorial
b can be either 1 or... | true |
8be4ec0ff7d3234c37cf4f0652e2bb971f3633ed | Python | SrinuBalireddy/Python_Snippets | /9readingwritingfiles/practice.py | UTF-8 | 1,627 | 2.75 | 3 | [] | no_license | # Write your code here :-)
from pathlib import Path
myfiles = ['account.txt','details.csv','invite.docx']
for filename in myfiles:
print(Path(r'c:\users\srinu',filename))
import os
p = Path(r'C:\Users\srinu\Desktop\Python')
#os.makedirs('C:/Users/srinu/Desktop/Python/9readingwritingfiles/new')
print(os.listdir(Pa... | true |
03bff5236f993f916a67fc233d036156e28ba636 | Python | blacktanktop/illustration2vec | /illustration2vec.py | UTF-8 | 3,132 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# ------------------------------------
# python modules
# ------------------------------------
import os
import glob
import os.path
import csv
import pandas as pd
from PIL import Image
# ------------------------------------
# own python modules
# ------------------------------------
import i2v
#... | true |
ff4fde834842ddc2e0b82578d9163ed98021eb3b | Python | Pulingz/Pyhton | /I/7_FString.py | UTF-8 | 532 | 3.5625 | 4 | [] | no_license | # inputan
age = input("your age : ")
# proses deadline year 20
year_remaining = 20 - int(age)
# hitung bulan
month_remaining = year_remaining * 12
# hitung hari
days_remaining = year_remaining * 365
# hitung minggu
weeks_remaining = year_remaining * 52
# print(f"you have {year_remaining} year, {month_remaining} months... | true |
c8478caff40c18d85c18d0e3ba0c5cf112d35e89 | Python | Andy-SKlee/Algorithm | /unit02.py | UTF-8 | 590 | 3.21875 | 3 | [] | no_license | def find_max(l):
max_x = l[0]
for i in range(0, len(l)):
if max_x <= l[i]:
max_x = l[i]
return max_x
v = [17, 92, 18, 33, 58, 7, 33, 42]
print(find_max(v))
def find_max_idx(l):
max_idx = 0
for i in range(0, len(l)):
if l[max_idx] <= l[i]:
max_idx = i
ret... | true |
265a59a1f574a19d556e70935b0137076df1fa45 | Python | xiangruhuang/mmdetection3d | /geop/geometry/camera.py | UTF-8 | 4,049 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import open3d as o3d
import numpy as np
import sys, os
project_path=os.path.abspath(__file__)
project_path=os.path.dirname(project_path)
project_path=os.path.dirname(project_path)
sys.path.append(project_path)
import linalg
import geometry.util as geo_util
class PinholeCamera:
def __init__(self, extrinsic=None):
... | true |
603ab7507e483ed3260ac66620893017fd53470b | Python | MattHum/plantcontrol | /test.py | UTF-8 | 716 | 3.03125 | 3 | [] | no_license | import sh1106 #display lib
from time import sleep
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000) #i2c settings
display = sh1106.SH1106_I2C(128, 64, i2c, Pin(16), 0x3c) #Load the driver and set it to "display"
display.sleep(False) #activate display
display.fill(0) #clear display
temp = 1
hum = 2
pres = 3
volt = 3
Hallo ... | true |
97370f89cb42a42fe61f646b4bd84130f218e070 | Python | addycakes/Project_Euler | /Euler_20.py | UTF-8 | 272 | 3.859375 | 4 | [] | no_license | '''
Euler Problem 20
'''
def factorial(n):
product = 1
for i in range(1,n+1):
product *= i
return product
def sumDigits(n):
s = str(n)
NumSum = 0
for d in s:
NumSum += int(d)
return NumSum
print sumDigits(factorial(100))
| true |
4e6b4603c26f07755381b8be8b69a5cfbfdce75d | Python | pchoang96/AGV_industrial_CAN | /usonic_sensor.py | UTF-8 | 828 | 2.796875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
def setup_sonic(trig, echo):
GPIO.setup(trig, GPIO.OUT,pull_up_down=GPIO.PUD_UP)
GPIO.setup(echo, GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.output(trig,False)
GPIO.output(trig,False)
#Waiting For Sensor To Settle
time.sleep(0.5)
def check_d... | true |
2e081e5ddb580d45e170a42f3cb7736cfa3f315b | Python | cynaax/lain-i3wm | /.local/lib/python3.8/site-packages/pywalfox/utils/logger.py | UTF-8 | 1,619 | 2.953125 | 3 | [] | no_license | import logging
from logging.handlers import RotatingFileHandler
from ..config import LOG_FILE_FORMAT, LOG_FILE_DATE_FORMAT, LOG_FILE_PATH, LOG_FILE_MAX_SIZE, LOG_FILE_COUNT
def create_rotating_log(name, log_level):
"""
Creates a rotating log which will limit the size of the log file.
:param name str: the... | true |
be532c230db33f7d4830657b278772d4210da92d | Python | teleamigos/TIR1 | /P1_TIR_Client.py | UTF-8 | 1,120 | 3.09375 | 3 | [] | no_license | import socket
"""TXTable"""
def TXTable(Frame):
file_out=open("frame_sent.txt",'a')
print(Frame)
for slot in Frame:
file_out.write(slot)
file_out.close()
"""Main"""
to_send=[]
frame=[]
n=int(input("Ingrese el numero de entradas : "))
len_max=1
for i in range(n):#Ingresa mensajes para N canale... | true |
41b8f41d0a0641554eeb76f310dddcd40a2cee4f | Python | Jonathan-Challenger/PythonSkills | /Arrays/dupZeros.py | UTF-8 | 625 | 3.34375 | 3 | [] | no_license | def duplicateZeros(arr):
dups = 0
length = len(arr) - 1
for i in range(length + 1):
if i > length - dups:
break
if arr[i] == 0:
if i == length - dups:
arr[length] = 0
length -= 1
break
dups += 1
... | true |
627c206206412e0d0a8c141497c96f8927fb08e7 | Python | bassemawhoob/eigenface-face-recognition | /Main.py | UTF-8 | 3,279 | 2.5625 | 3 | [] | no_license | from Eigenface import EigenFaces
from Eigenface import face_align
import numpy as np
from PIL import Image
import datetime
import sys
import os
import cv2
import Webcam
from shutil import copyfile
import GFX
if __name__ == "__main__":
clf = EigenFaces()
clf.train('training_images')
# print(clf.predict_fac... | true |
f715fa68c24141bc86d98b7226e040ba41a3fcac | Python | lucasjurado/Curso-em-Video | /Mundo 3/ex106.py | UTF-8 | 488 | 3.328125 | 3 | [
"MIT"
] | permissive | from datetime import date
cad = {}
cad['Nome'] = str(input('Nome: '))
nsc = int(input('Ano de Nascimento: '))
cad['Idade'] = (date.today().year - nsc)
cad['Ctps'] = int(input('Carteira de Trabalho (0 não tem): '))
if cad['Ctps'] != 0:
cad['Contratação'] = int(input('Ano da contratação: '))
cad['Salário'] = flo... | true |
de154b3b8b55599ed1662774b66ed961d3a0ade1 | Python | arakoma/competitive_programming | /contest/abc/abc093/ABC093B.py | UTF-8 | 367 | 2.8125 | 3 | [] | no_license | a, b, k = map(int, input().split())
ans = list(range(a, a+k)) + list(range(b-k+1, b+1))
ans.sort()
ans2 = []
for i in ans:
if a<=i<=b and i not in ans2:
ans2.append(i)
for j in ans2:
print(j)
###########################
a, b, k = map(int, input().split())
li = range(a, b+1)
for i in so... | true |
af6933eebdba9b3b12af6feb6cc808830db4d22d | Python | chinmay-potdar/Chinmay-python-3 | /Session 2/lstrip().py | UTF-8 | 112 | 3.46875 | 3 | [] | no_license | # Session: 2
# Date: 12/jan/2020
# Topic: String Functions
#9. lstrip
name=" chinmay p "
print(name.lstrip())
| true |
277d07776d7d847ef68edc22349de31893f94ad7 | Python | zeddmaxx/Tuple- | /python1 lab3 3.py | UTF-8 | 146 | 3.046875 | 3 | [] | no_license | t=('apple','ball','water')
search=input("What do u want to search for ?")
type(search)
if search in t:
print('TRUE')
else:
print('FALSE')
| true |
e99182e6ee8c2f399105ce141d46c01e9c3a4baf | Python | chnlyi/i2b2 | /models.py | UTF-8 | 1,486 | 2.515625 | 3 | [] | no_license | from keras.models import Model
from keras.layers import Input, Dense, Embedding, SpatialDropout1D, concatenate, Bidirectional, GlobalAveragePooling1D, GlobalMaxPooling1D, CuDNNGRU, CuDNNLSTM, GRU, LSTM
# rnn models
def get_rnn_model(nb_words,
num_labels,
embed_size,
... | true |