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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dd782d709ce920d5560decd33e82520f95eca8c4 | Python | ejbryant28/interview-questions-practice-problems | /leetcode.py | UTF-8 | 3,439 | 3.5 | 4 | [] | no_license |
def compress(chars):
"""
:type chars: List[str]
:rtype int
"""
if len(chars) <= 1:
return chars
count = 1
j = 0
for i in range(len(chars)-1):
#if next char is same, count += 1
if chars[i] == chars[i + 1]:
count += 1
#if the next char is different and count > 1, replace this char with count. and... | true |
474c292ffc01918c712cad9d8d1612192a2f5101 | Python | pioupus/matrix-room-forwarder | /command_dict.py | UTF-8 | 2,190 | 3.015625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | import sys
import os
import logging
import yaml
logger = logging.getLogger(__name__)
class CommandDict:
def __init__(self, command_dict_filepath):
"""Initialize command dictionary.
Arguments:
---------
command_dict (str): Path to command dictionary.
"""
self... | true |
6486fab8023b87c709548237b4a910458dba0238 | Python | MoonRIN/Python-learning-Pratice | /python data analysis/Words_Count.py | WINDOWS-1252 | 612 | 3.1875 | 3 | [] | no_license | import matplotlib.pyplot as plt
def getText():
try:
fileName = input("plz input the filename you want to count:")
fileContent = open(fileName, "r")
except:
print("Sorry, We can't open this file")
def splitContent(line):
fileCountent.lower
for line in fileContent:
... | true |
82b29118d1f7a557bb1eed34093445905a8dda91 | Python | E-Asmar/pythonPractice | /moduleTwo/moduleTwo/moduleTwo.py | UTF-8 | 878 | 3.71875 | 4 | [] | no_license | #displaying Text
print('The Capybara is the worlds largest rodent')
print('likes to live in groups')
print("can swim")
print("the capybara lives in \nSouth America")
print("""this is a strangest way
to print over muliple lines""")
print('here is a double quote "' +" her is a single quote '")
print("or you can just ... | true |
c0356b7dfb5102542519149dcc710ad7ea17b88d | Python | YannTorres/Python-mundo1e2 | /Desafios/37BasesNuméricas.py | UTF-8 | 559 | 4.375 | 4 | [] | no_license | num = int(input('Digite um número inteiro positivo: '))
base = int(input('''Escolha uma base para conversão:
[ 1 ] = Converter para binário
[ 2 ] = Converter para octal
[ 3 ] = converter para hexadecimal
Sua opção: '''))
if base == 1:
print(f'O número {num} convertido para binário é {bin(num)[2:]}')
eli... | true |
2b28365ae82dac2bae1bd5bd8204a79a8580957a | Python | Jictyvoo/FilaLanche_SENAI | /sourceCode/controller/MainController.py | UTF-8 | 5,602 | 2.703125 | 3 | [
"MIT"
] | permissive | import time
from sourceCode.model.Estudante import Estudante
from sourceCode.model.Item import Item
from sourceCode.model.Pedido import Pedido
from sourceCode.model.Sala import Sala
class MainController:
def __init__(self):
self.estudates = []
self.pedidos = []
self.itens = []
sel... | true |
8e23b17ad62ea4b6376c1e3f53d3ffd5e1dffa87 | Python | notweerdmonk/scripts | /const.py | UTF-8 | 397 | 2.78125 | 3 | [] | no_license | """
Module to implement constant like class.
Courtesy: http://code.activestate.com/recipes/65207-constants-in-python/
"""
class _const:
class ConstError(TypeError): pass
def __setattr__(self, name, value):
if name in self.__dict__:
raise(self.ConstError, "Can't rebind const(%s)" %name)
... | true |
6a829a363218e9e0b41a11b05d5ff297d875e510 | Python | hc973591409/database | /mysql/MysqlClass.py | UTF-8 | 2,177 | 2.90625 | 3 | [] | no_license | import pymysql
class MySQLHelper(object):
def __init__(self, host, port, database, user, password, charset='utf8'):
self.host = host
self.port = port
self.database = database
self.user = user
self.password = password
self.charset = charset
self.connect()
... | true |
49e9dc6ae7589a384d0f9a16f53027b5a48fddf5 | Python | papagr/TheLMA | /thelma/entities/species.py | UTF-8 | 2,029 | 2.9375 | 3 | [
"MIT"
] | permissive | """
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Species entity classes.
"""
from everest.entities.base import Entity
from everest.entities.utils import slug_from_string
__docformat__ = 'reStructuredText ... | true |
8bbd9e3fb5f56e8b244983f21e701034a524ba17 | Python | ChikaraNakajima/LifeGame | /lib/LifeGameAnimation.py | UTF-8 | 3,715 | 2.6875 | 3 | [] | no_license | import json
from pathlib import Path
import tkinter as tk
import tkinter.font as Font
from lib.LifeGameConfigure import FrameLifeGame
class FrameLifeGameAnimationConfigure(tk.Frame):
def __init__(self, master=None, flg=FrameLifeGame(), *args, **kwargs):
super().__init__(master, *args, **kwargs)
se... | true |
c13d7ae9e37c086f5997e033e9416cb4d0a285a3 | Python | ustbliubo2014/Interview | /LeetCode/Add Two Numbers.py | UTF-8 | 995 | 2.859375 | 3 | [] | no_license | # encoding: utf-8
"""
@author: liubo
@software: PyCharm
@file: Add Two Numbers.py
@time: 2016/9/29 19:05
@contact: ustb_liubo@qq.com
@annotation: Add Two Numbers
"""
import sys
import logging
from logging.config import fileConfig
import os
reload(sys)
sys.setdefaultencoding("utf-8")
# fileConfig('logger_config.ini')
... | true |
165021a05836dc223335549a1180a468520aee06 | Python | cryingmiso/Korean-Word-Spacing-Tagging | /class5segment.py | UTF-8 | 1,017 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from colorama import Fore, Back, Style, init
DELIMITER = ' '
sentense = u"..나는 오늘 3000원짜리 밥을 먹었어. 그리고, 오늘은 집에가서 20만원 정도 게임을 살 거야! 내 전화번호는 010-5000-2000야. 전화해?"
labels = []
chars = []
segments = sentense.split(DELIMITER)
for segment in segments:
s_len = len... | true |
e4c8e9909acd22fdbf79eeda60ce6e153fc8fca0 | Python | MBruliard/electromagnetic_wave | /bsplines_examples/exampleBsplineFamily.py | UTF-8 | 1,726 | 3.21875 | 3 | [] | no_license |
__author__ = "Margaux BRULIARD"
__date__ ="19.06.2018"
__purpose__ = "Example of a B-Splines family"
###################### MODULES #################################
from bsplines import Bspline
import numpy as np
from matplotlib import pyplot as plt
##################### user functions ########################... | true |
d4a3cc88e99220d38331ed152bb322954e0f1dca | Python | sapoturge/Audial | /apps/filer.py | UTF-8 | 2,689 | 2.984375 | 3 | [] | no_license | import os
import curses
from apps.app import App
class Filer(App):
def __init__(self, dm, path=None):
App.__init__(self, dm, "Filer")
self.index = 0
self.directories = []
self.files = []
self.items = []
self.hiding = True
if path is None:
path =... | true |
92b18de22ce490ef79f7f3ae3e7d946eb05db047 | Python | nnaeueun/Python_RaspberryPi | /1014/practice03.py | UTF-8 | 1,173 | 4.34375 | 4 | [] | no_license | #전화번호부 프로그램
#사용자가 q를 입력할때까지 이름과 전화번호를 입력받아 저장하고 이름으로 전화번호 검색
class Book:#클래스 생성
def __init__(self):
self.address ={}#address라는 딕셔너리 만듦
def setName(self,name):
self.address[name] = []#name을 받아 address의 키값으로 설정
def setPhone(self,name,phone):
self.address[name].append(phone)#phone을 받아 ... | true |
d5e2c36adfc8f3fea5e9240e7951d6962db5b4f3 | Python | sunxianpeng123/python_common | /pytorch/2_regression/regression_torch_demo.py | UTF-8 | 2,214 | 3.078125 | 3 | [] | no_license | # encoding: utf-8
import torch
import numpy as np
import torch.nn as nn
from torch.utils.data import TensorDataset,DataLoader
import torch.nn.functional as F
def get_data():
inputs = np.array([[73,67,43],
[91,88,64],
[87,134,58],
[102,43,37],
... | true |
c82155cabd464c5576963037696c474d8cb955ff | Python | FlorenciaCorrea/lexer | /lexer.py | UTF-8 | 6,254 | 3.140625 | 3 | [] | no_license | alfabeto = ['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',
'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']
numeros = ['0', '1', '2', '3', '4', '5', '6', ... | true |
674b62dd61932085f09c8e7ff9732472f9683363 | Python | neytjieb1/dp_chaotic | /Libs/Net.py | UTF-8 | 2,542 | 2.8125 | 3 | [] | no_license | """
Class used to define the Network.
"""
import numpy as np
import scipy.sparse as ss
import Libs.GLOBAL as G
class Network:
def __init__(self, dimension, a=0.5, alpha=0.99,seed=12345):
self._a=a
self._alpha=alpha
self._dim=dimension
rng=np.random.default_rng(seed)# Pad with zer... | true |
63cac9f95f0c56ef34295c42976f8fb512b583e6 | Python | Fede4872/2020.04.28.Diagnostico | /59098.FedericoDavara/clase-2020-04-28/diagnostico.py | UTF-8 | 142 | 2.515625 | 3 | [] | no_license | class CompuTools:
def is_sorted(self, list):
if list == [1,2,3,4]:
return True
else:
return False | true |
ed3591463c37fab44cc3311dfc525a2e46b058ed | Python | AnjoliPodder/PracticePython | /3.py | UTF-8 | 875 | 4.40625 | 4 | [] | no_license | '''
Solution by: Anjoli Podder
December 2016
http://www.practicepython.org/exercise/2014/02/15/03-list-less-than-ten.html
Take a list, say for example this one:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
and write a program that prints out all the elements of the list that are less than 5.
Extras:
I... | true |
fbf336a4a6951ee6726cd826cad119553df7f1c3 | Python | clementb/GCF-Python | /functions/scripts/demo_script.py | UTF-8 | 792 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
''' Required for all scripts '''
import pandas as pd
from flask import Flask, make_response, abort
from flask import current_app as app
''' Custom '''
# import requests
def run(script_args):
''' Your function logic
Get query arguments using `script_args['key']`
... | true |
84e4ea112d64e5236515838aa14a2cadfaec48db | Python | hyeongkyeong/python-sample | /test/test_block_with_mock.py | UTF-8 | 1,241 | 2.8125 | 3 | [] | no_license |
import sys, os
import unittest, csv
from unittest.mock import Mock
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))+'/src')
from block import Block
from tetris import Tetris
import constants
import pygame
class TestBlockWithMock(unittest.TestCase):
''' Test for Block.rodate() '''
def... | true |
2d087cfaabc5260d19de8676df19a0d67913eb9f | Python | samjabrahams/anchorhub | /anchorhub/validation/tests/test_validate_files.py | UTF-8 | 677 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | """
Tests for validate_files.py
validate_files.py
http://www.github.com/samjabrahams/anchorhub/validation/validate_files.py
"""
from nose.tools import *
import anchorhub.validation.validate_files as v
from anchorhub.exceptions.validationexception import ValidationException
def test_is_not_empty_success():
"""
... | true |
a07a1efeb3fd488bdb7f25564469b91248352e06 | Python | Monti03/cwp-telegram-bot | /check_thread.py | UTF-8 | 1,186 | 2.703125 | 3 | [] | no_license | from threading import Thread
from read_pages import read
from read_pages import check_url
from stop_aux import stop_aux
import time
#thread class that controls urls
class ControlThread(Thread):
def __init__(self,chat_id,bot,url,mins):
Thread.__init__(self)
self._url = ur... | true |
c5b7e90d79cf864eec1778777e93974e5640c3a0 | Python | KNejad/university_notes | /cs3027/practicals/catkin_ws/src/practical_02_04/src/a_to_b.py | UTF-8 | 1,748 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import tf
import math
from geometry_msgs.msg import Twist
from geometry_msgs.msg import PointStamped
from std_msgs.msg import Header
from geometry_msgs.msg import Point
class AToB:
def __init__(self):
rospy.init_node("a_to_b", anonymous=True)
self.rate = rospy.R... | true |
49235b91da647dcf6a36f9b9d7d8d1def2ccf734 | Python | rajshukla/Testgen-crest | /src/run_crest/levelGen.py | UTF-8 | 680 | 2.71875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
branches=open("branches_to_map","r")
branchData=branches.readlines();
levels=open("level.txt","r")
levelData=levels.readlines();
branchlist=list()
maxLev=1
for i in range(0,len(branchData)):
if int(levelData[i].split()[1])>=maxLev:
maxLev=int(levelData[i].split()[1])
branchlist.append((int(branchData[i].split(... | true |
79ccc3c8e345baab0199a661eb24701b9c50d279 | Python | Aasthaengg/IBMdataset | /Python_codes/p03387/s024463614.py | UTF-8 | 161 | 2.859375 | 3 | [] | no_license | lst = sorted(list(map(int, input().split())), reverse=True)
diff = lst[0] * 2 - lst[1] - lst[2]
if diff % 2 == 0:
print(diff // 2)
else:
print(diff // 2 + 2) | true |
fea0f9d8d078a5d7abeb58a87f34b6d90bf61191 | Python | jvhagey/Utility_Scripts | /fasta_rename.py | UTF-8 | 2,724 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
## Jill Hagey
## University of California, Davis
## jvhagey@gmail.com
## https://github.com/jvhagey/
## 2019
## given an fasta file with repeated names this script outputs a new fasta file with names numbered
#importing packages
import os
import re
import csv
from argparse import ArgumentParser
... | true |
5561a2fa9ef2b861c81f542714c1fee7e1ba0146 | Python | stgl/TopoAnalysis | /MovingWindow.py | UTF-8 | 4,193 | 3.171875 | 3 | [] | no_license | import error
import numpy as np
class MovingWindow(object):
function = None
def __init__(self, *args, **kwargs):
if kwargs.get('window_dimension') is None:
raise error.InputError('Window dimension', 'is a required parameter')
self.window_dimension = kwargs.get('window_dime... | true |
331951b350107862631b05f67fe4c5186fb5dfd2 | Python | RafaelNGP/Curso-Python | /map_aula.py | UTF-8 | 1,260 | 4.40625 | 4 | [] | no_license | """
Map (nao eh igual ao arquivo mapas_aula)
Com map fazemos mapeamento de valores para funcao.
"""
import math
def area(r):
"""Calcula a area de um circulo com raio 'r'."""
return math.pi * (r ** 2)
print(area(2))
print(area(5.3))
raios = [2, 5, 7.1, 0.3, 10, 44]
# Forma comum
areas = []
for r in raios:
... | true |
80c9c8f1c718b270a28d3723634cdc417762a6e4 | Python | p7g/compiler-37 | /__main__.py | UTF-8 | 634 | 2.71875 | 3 | [] | no_license | import argparse
from compiler.compile import Compile
from compiler.parser import parse
argparser = argparse.ArgumentParser(description="Compiler 37")
argparser.add_argument("files", metavar="FILE", type=str, nargs="+", help="Input files")
argparser.add_argument(
"-o",
"--output",
dest="out",
type=str,
... | true |
00a5cc6f369d4b0fb0bade26df3f605591714ec7 | Python | pokovenkat/python-programs | /power.py | UTF-8 | 68 | 3 | 3 | [
"Apache-2.0"
] | permissive | import math
a=int(input())
n=int(input())
print(int(math.pow(a,n)))
| true |
b27655755d47613ada88841eb6090847f20fc649 | Python | wang264/JiuZhangLintcode | /AlgorithmAdvance/L2/optional/559_trie-service.py | UTF-8 | 2,087 | 4.21875 | 4 | [] | no_license | # 查找树服务 · Trie Service
# LintCode 版权所有
# 字典树
# 描述
# Build tries from a list of <word, freq> pairs. Save top 10 for each node.
# 通过<字符串,值>的集合来建立树结构,每个结点保存前10大的数值。
# 值-->表示该词出项的频率,权重。
#
# 样例
# Example1
#
# Input:
# <"abc", 2>
# <"ac", 4>
# <"ab", 9>
# Output:<a[9,4,2]<b[9,2]<c[2]<>>c[4]<>>>
# Explanation:
# Root
# ... | true |
7d2daf9ad7ec8004dbe4f4d266dba4f4c9ee8e4d | Python | 24sleeper/SearchTwitter | /SearchTwitter.py | UTF-8 | 2,687 | 2.625 | 3 | [] | no_license | CONSUMER_KEY = '**************************************************'
CONSUMER_SECRET_KEY = '**************************************************'
ACCESS_TOKEN = '**************************************************'
ACCESS_TOKEN_SECRET = '**************************************************'
... | true |
b3f9227e09387ea9e0d5871934bbb8ae1d20043d | Python | TenzinCHW/MeowLessons | /W8/meowlesson8-1.py | UTF-8 | 4,159 | 4.0625 | 4 | [] | no_license | # Homework week 8
from math import *
# Problem 1
class Time:
def __init__(self, hour, minute, second):
self.hour = hour
self.minute = minute
self.second = second
def getHour(self):
return self.hour
def getMinute(self):
return self.minute
def getSecond(self):
... | true |
dd2e1df01ab4375dd928d2fce528285770533869 | Python | JeonHeeSang/p2_201611103 | /w12Main.py | UTF-8 | 938 | 3.078125 | 3 | [] | no_license | import os
mydir=os.getcwd()
def file1():
filename='python.txt'
myfilename=os.path.join(mydir,filename)
try:
myfile=open(myfilename, 'r')
for line in myfile:
if line.find('Python')>=0:
print line
myfile.close()
except IOError as e:
... | true |
40fed2d4c2d930877a5dc985ec943b245d71c318 | Python | abhijithcnair/small_programs | /prime.py | UTF-8 | 418 | 3.09375 | 3 | [] | no_license | def test(value):
i=2
l1=[]
l2=[]
while(i<value):
j=2
while (j<=value):
if i*j<value and i*j not in l1:
l1.append(i*j)
j=j+1
i=i+1
for j in range(2,value):
if j not in l1:
l2.append(j)
print l2
def main():
pri... | true |
1f93ed73de462b488f111645ae6cd0968705680a | Python | THEMVFFINMAN/Python-Games | /Codingame.com/sumofalldivisors.py | UTF-8 | 265 | 2.9375 | 3 | [
"MIT"
] | permissive | from functools import reduce
n = int(input())
def factorGenerator(n):
return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
final = 0
for i in range(1, n + 1):
final += sum(list(factorGenerator(i)))
print(final)
| true |
673ca7ba4f7a9fbfd9988892d49551ca00d17dd2 | Python | Eddienewpath/leetPy | /leetcode/reference/_binary_search/binary_search.py | UTF-8 | 2,207 | 4.5 | 4 | [] | no_license | """
three templates
"""
# 1
# [l, r]
def binary_search_i(nums, target):
if not nums: return -1
left, right = 0, len(nums)-1
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
elif nums[mid] < target:
left = mid + 1
els... | true |
79a79754708b6c05c71dd0cc60c4d52d480d70af | Python | muskanmahajan37/python_tutorials | /class22.py | UTF-8 | 599 | 4.03125 | 4 | [] | no_license | # While loop
a = 1
while a<10:
print(f"number : {a}")
a = a+1
# program while
print("\n")
total = 0
a = 1
while a <= 10:
total = total + a
a =a+1
print(f"total sum is {total}")
# program while
print("\n program 2")
total1 = 0
user1 = int(input("enter value: "))
b = 1
while ... | true |
c70198c1825b0022f160017fa83d20e94c71109f | Python | gong521sha/LearnPython | /function/basic_function.py | UTF-8 | 1,345 | 4.03125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 11:31:59 2018
@author: gong521sha
"""
#python的编译器参数并不检查参数的类型,如果想检查参数类型,只能通过代码验证参数类型,如果不符合,则抛出异常。
#python可以返回多个值,但编译器会自动将多个参数封装成一个tuple,多个变量可以接收同一个tuple值,并根据顺序赋予每个变量对应的值。
#函数可以没有返回值,在函数执行到最后没有使用return语句时,自动return none
#定义一个求绝对值的函数
def my_abs(x):
if x >= 0:
... | true |
c79c3952aeeb026e7cef1f9fbd2c309ee3e1110c | Python | Croquembouche/ec463miniproject | /humidity/views.py | UTF-8 | 3,002 | 2.640625 | 3 | [] | no_license | from django.http import HttpResponse
from django.template import loader
from .models import Humidity, Temperature
from django.shortcuts import render
from .fusioncharts import FusionCharts
def humidity_details(request):
latest_humidity_recorded = Humidity.objects.order_by('datetime_recorded')[:5]
# Chart data is... | true |
e976ac79ec428144bc074025b4c30140c895ecca | Python | Jianshu-Wang/Data-Mining | /Mine frequent pattern/assignment1.py | UTF-8 | 348 | 2.890625 | 3 | [] | no_license | file = open('categories.txt')
fout = open('patterns.txt','w')
patterns={}
for line in file:
for word in line.rstrip().split(';'):
if word not in patterns: patterns[word] = 1
else: patterns[word] += 1
for key in patterns:
if patterns[key]>771:
out = str(patterns[key])+':'+key+'\n'
fout.write(out)
print out ... | true |
ae9c6575d6345b2cf5bdb48fb62d44bcc77ab160 | Python | rodekruis/Drought_IBF | /GoogleEarthEngine/GEE_utils.py | UTF-8 | 4,965 | 3.34375 | 3 | [] | no_license | import ee
import pandas as pd
def extract_data_EE(im_col, fe_col,
min_year, max_year,
min_month, max_month,
reducer_time, reducer_space,
scale=1000, export=False, reduce_imcol=True):
"""
Function that can extract and spatial reduce... | true |
8b10f2ab7f97d18a2b18fc9297c71dc31ce5fb61 | Python | smallwzt/MachineLearning | /Draft/20180716/d2.py | UTF-8 | 736 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
label = pd.read_csv('./label.txt', names=['c1'])
y_train = np.array(label['c1'])
y_count = np.bincount(y_train)
less_than_label=np.where(y_count<5)[0]
print('original labes:',y_train)
print('class labels:',np.unique(y_train))
print('samples in each class:',y_count)
print('less th... | true |
f4a24dbbcdef046679fd8e2e3a1020d2d71762df | Python | amraymanh/Codeforces | /Round 641 - Orac and Models.py | UTF-8 | 397 | 2.984375 | 3 | [] | no_license | def solve(size, data):
log = [1]*(size)
for i in range(((size-1)//2), -1, -1):
for j in range(2* i +1 , size, i+1):
if data[i] < data[j]:
log[i] = max(log[i], log[j]+1)
return max(log)
counter = int(input())
for _ in range(counter):
size = int(input()... | true |
245491721c188e37a5d038211916d18d53a89007 | Python | glimmercn/Euler-Project | /src/solution/p32.py | UTF-8 | 376 | 3.109375 | 3 | [] | no_license | '''
Created on 2011-6-27
@author: huangkan
'''
sum=set()
for i in range(1,10000):
for j in range(i+1,10000):
if (len(str(i))+len(str(j))+len(str(i*j)))>9:break
else:
if len(set(str(i)+str(j)+str(i*j))-{'0'})==9:
print(i,'*',j,'=',i*j)
sum.add(i*j)
s=0
pri... | true |
5c76ade5ba1a1f8bd79b591e0ee8f53b6f34373c | Python | Djiffit/advent-of-code | /aoc-2018/05.py | UTF-8 | 911 | 3.25 | 3 | [] | no_license | def solve(data):
rec = float('inf')
for i in range(26):
char = chr(ord('a') + i)
rec = min(rec, (len(react(data.replace(char, '').replace(char.upper(), '')))))
if rec == 6694:
return rec
def react(word):
loop = True
while loop:
loop = False
for i in r... | true |
1ff163fae0206e0f05eed719a77e27e726dbfcb1 | Python | avanadia/hackathon_repo | /models/modules/columns.py | UTF-8 | 1,618 | 2.921875 | 3 | [] | no_license | from models.modules.moduleEnum import ModuleEnum
from models.module import Module
from bs4 import Tag
from json import JSONEncoder
#This module matches the Columns module that exists on Wordpress
class Columns(Module):
def __init__(self, tag: Tag):
#Module enumerator
self.type = ModuleEnum.COLUMN
... | true |
26aee4af84bd1f93bc61b13110b5f487e3e30e50 | Python | kajyuuen/nlp-100knock-2020 | /ch01/06.py | UTF-8 | 579 | 3.53125 | 4 | [] | no_license | def n_gram(target_list, n):
result = []
for i in range(len(target_list)-n+1):
result.append([target_list[j] for j in range(i, i+n)])
return result
def main():
string_one = "paraparaparadise"
string_two = "paragraph"
one_bi_gram = set([ "".join(l) for l in n_gram(string_one, 2)])
tw... | true |
06cad73e5b6d95e2511f75ba1e5a68b5877b71d5 | Python | panzy25/ForeSee | /Model/Vector/suoyin.py | UTF-8 | 1,119 | 2.78125 | 3 | [] | no_license | from bert_serving.client import BertClient
import numpy as np
#计算两个一维向量之间的相似度
def cos_sim(vector_a, vector_b):
#列表转为向量
vector_a = np.array(vector_a)
vector_b = np.array(vector_b)
#维度不同时,要求填充至相同长苏
if vector_a.size != vector_b.size:
if vector_a.size > vector_b.size:
length = vecto... | true |
037fe8863f045c46be64c92049671784baf7e877 | Python | sergiotocalini/pyadminstocks | /modules/Yahoo.py | UTF-8 | 1,831 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
import re
import urllib2
from DateTime import DateTime
from datetime import datetime
class YahooAdmin():
def get_stock(self, stock='@^merv', country='ar', delimiter=','):
url = 'http://%s.finance.yahoo.com' %(country)
url += '/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv&e=.csv' %(stock)... | true |
05a20ea8b68c9f3b7a2220a8e7622863166f9e95 | Python | lucas-utd/Problem-Solving-with-Algorithms-and-Data-Structures-Using-Python | /chapter4/useTurtle.py | UTF-8 | 618 | 3.625 | 4 | [] | no_license | from turtle import *
myTurtle = Turtle()
myWin = myTurtle.getscreen()
def drawSpiral(myTurtle, lineLen):
if lineLen > 0:
myTurtle.forward(lineLen)
myTurtle.right(90)
drawSpiral(myTurtle, lineLen - 5)
def tree(branchLen: int, t: Turtle) -> None:
if branchLen > 5:
t.forward(br... | true |
34d7938fb26ea3422ddffa41a2b5bc0997e5da8c | Python | namhyun-gu/algorithm | /baekjoon/hash/7453.py | UTF-8 | 617 | 3.078125 | 3 | [] | no_license | import io
import sys
example = """
6
-45 22 42 -16
-41 -27 56 30
-36 53 -37 77
-36 30 -75 -46
26 -38 -10 62
-32 -54 -6 45
"""
sys.stdin = io.StringIO(example.strip())
import sys
input = sys.stdin.readline
N = int(input())
A, B, C, D = [], [], [], []
for _ in range(N):
for arr, num in zip([A, B, C, D], map(int,... | true |
e06873c9d51ee45f6732fb481bbd7170c7ad246b | Python | ealataur/rcute-ai | /rcute_ai/aruco.py | UTF-8 | 1,002 | 2.765625 | 3 | [] | no_license | import cv2
from cv2 import aruco
import numpy as np
class ArUcoDetector:
def __init__(self, dictionary=aruco.DICT_4X4_50):
"""ArUco marker detector"""
self.aruco_dict = aruco.Dictionary_get(dictionary)
self.parameters = aruco.DetectorParameters_create()
def center(self, points):
... | true |
c887bb79e4720a95dceaf5a7183a29406c777015 | Python | Casanova911/TextClassification | /TextClassification/extractor.py | UTF-8 | 758 | 3 | 3 | [] | no_license | import re
from nltk import wordpunct_tokenize
def get_all_words(text):
# text = text.encode('utf-8')
text = text.lower()
text = re.sub('\d+', ' ', text)
text = re.sub(ur'\p{P}+', ' ', text)
# print text.encode()
all_tokens = set(wordpunct_tokenize(text.decode('utf-8')))
... | true |
8548d4b5f094f572a634c417106457d6b1e24e2f | Python | AvestimehrResearchGroup/Polyshard | /PolyShard_plots/mockTimingSparse.py | UTF-8 | 4,675 | 2.5625 | 3 | [] | no_license | import numpy as np
import scipy.sparse as scs
import time
# Block chain bulit on top of sparse matrix
def frEpoch(numShards, numNodes, sizeShard, sparsity, chainLength, initBal):
initChain = np.vstack([np.zeros((1, sizeShard)),
initBal * np.ones((1, sizeShard))])
block = blockGenCor... | true |
892104da1371dc00ca76a52eca264eedea6e6abf | Python | WillhelmKai/BDA_asignment1 | /B/LSH.py | UTF-8 | 2,607 | 2.96875 | 3 | [] | no_license | from collections import Counter
from scipy.spatial import distance
import numpy as np
from sympy import *
def input():
f = open("C:\\Users\\willh\\Documents\\GitHub\\BDA_asignment1\\B\\data\\LSH_data.txt", "r")
dic = {}
max_word = 0
max_doc = 0
#form word set
for line in f:
doc_i, word_j, val = line.sp... | true |
a32fe531cc9b79f98e705aa32051917bc8dc8e23 | Python | chris90483/2021GameJam | /main/world.py | UTF-8 | 5,372 | 2.796875 | 3 | [] | no_license | import random
from pygame.surface import Surface
from audio.emitter_handler import EmitterHandler
from entities.compass import Compass
from entities.delivery_status import DeliveryStatus
from entities.destination_flag import DestinationFlag
from entities.dog import Dog
from entities.player import Player
from entities... | true |
62fa1b8fbb15d871cb1dd821fb7f13ab4676343b | Python | AnaFrozza/Compiladores | /sintatica.py | UTF-8 | 11,006 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# Analisador Sintático para a linguagem T++
# Autor: Ana Carolina Frozza
#-------------------------------------------------------------------------
import ply.yacc as yacc
from lexica import AnaliseLexica
class Arvore:
... | true |
c3de560a3a13600de67b380df3b559bbadbad509 | Python | llych/work | /csdn.py | GB18030 | 3,517 | 2.546875 | 3 | [] | no_license | # coding:GBK
__author__ = 'llych'
import requests
from lxml import etree
import hashlib
import os
template = '''
<html>
<head>
<title>%s</title>
</head>
<body>
%s
</body>
</html>
'''
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(f... | true |
3d422edc51e9e97a2ad662cb47de42b12930ea11 | Python | rohanjadvani/teletouch | /teletouch/receiver/receive.py | UTF-8 | 7,820 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# File: receive.py
# Authors: Rohan Jadvani, Chelsea Kwong, Cristian Vallejo, Lisa Yan
# Brief: Implementation of glove receiver code.
from pymongo import MongoClient
import Adafruit_PCA9685
import requests
import datetime
import json
import socket
import os
import time
import ast
import RPi.GPIO as ... | true |
5f316c7cabb81df397325288a701fa9919a3f302 | Python | blob-1/Worlds | /src/Maps/Regions/DeepSeas.py | UTF-8 | 300 | 2.8125 | 3 | [
"MIT"
] | permissive | from .SubRegions import SubRegion
class DeepSea(SubRegion):
def __init__(self):
SubRegion.__init__(self)
self._color = (10, 5, 71, 64)
def addTile(self, tile):
if tile[0].get_height() <= 25 and not tile[0].getSubRegion():
SubRegion.addTile(self, tile)
return True
return False | true |
00fbfcc3c224b8c163a330c8b2c516954c0dbc7b | Python | za-webdev/Python-practice | /dict.py | UTF-8 | 270 | 3.71875 | 4 | [] | no_license |
#function that takes in and print out any dictionary keys and values.
context={'Name':'Foofo','Age':'6','country of birth':'United States','favorite language':'Python'}
def my_info():
for key,data in context.items():
print "My ",key," is ",data
my_info()
| true |
6806cdcc46f123cef38335b6f575dec2bb814bd7 | Python | Alexyei/Python | /Python/Python Наоми Седер/Практические работы/word_count/getwords.py | UTF-8 | 1,307 | 3.46875 | 3 | [] | no_license | from word_count.punct import delpunct
def words(line):
cleaned_words = line.split()
if len(cleaned_words) > 0: # проверка на пустые строки
cleaned_words = "\n".join(cleaned_words) + "\n"
return cleaned_words
def texttowords(textfilename, outfilename):
try:
with open(... | true |
32a118af1b77576d63769e4aa0b2ca322ece1f08 | Python | sebastianfrasic/Arenas-PIMO | /5/redes.py | UTF-8 | 1,374 | 3.1875 | 3 | [] | no_license | from sys import stdin
class seet():
def __init__(self,x):
self.p = self
self.rank = 0
self.key = x
def find_set(x):
if x != x.p:
x.p = find_set(x.p)
return x.p
def link(x,y):
if x.rank > y.rank:
y.p = x
else:
x.p = y
if x.rank == y.ran... | true |
bec7db50e2794143fbc34367cf0fcfc85eb27b98 | Python | xiaoyi2714/Correlation_Analysis | /association_flask/banpei/utils.py | UTF-8 | 3,357 | 3.40625 | 3 | [] | no_license | import numpy as np
def power_method(A, iter_num=1):
"""
Calculate the first singular vector/value of a target matrix based on the power method.
Parameters
----------
A : numpy array
Target matrix
iter_num : int
Number of iterations
Returns
-------
u : numpy ... | true |
7789fc2d1efee1b5dce7d720da611f7823727dd8 | Python | gemathus/analisis-incidencia-delictiva | /src/join_cuadrantes_and_carpetas.py | UTF-8 | 1,120 | 2.96875 | 3 | [] | no_license | import pandas as pd
import geopandas as gpd
from shapely.geometry import Point, Polygon
import descartes
print("1/6 Leyendo archivo de cuadrantes...")
cuadrantes = gpd.read_file('../shape_files/cuadrantes_con_poblacion/cuadrantes_con_poblacion.shp')
print("2/6 Leyendo carpetas de investigación del 2016 al 2019...")
ca... | true |
a6a04042f277c85e01b8d61793c4be27b68b7be0 | Python | ah-lai/FishAI | /VGG.py | UTF-8 | 1,634 | 2.703125 | 3 | [] | no_license | # Class of the acticture of CNN
import keras
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPool2D , Flatten
from keras.preprocessing.image import ImageDataGenerator
from keras.applications import VGG16
# Define Variables
train_dir = "pre-process/train"
val_dir = "pre-process/valid"
... | true |
801beb7a13ec78393a388de3c71f26680becee29 | Python | kengz/TensorFlow-Tutorials | /00_intro.py | UTF-8 | 3,910 | 3.359375 | 3 | [] | no_license | # source url: http://www.tensorflow.org/get_started/basic_usage.md#the-computation-graph
import tensorflow as tf
import numpy as np
import os
# x_data = np.float32(np.random.rand(2,10))
# y_data = np.dot([0.100, 0.200], x_data) + 0.300
# # print x_data
# # print y_data
# # linear model for zee y_data
# b = tf.Variab... | true |
7fa616c22d247fe565166447243747e9b34114b4 | Python | RetroWave01/AlisaProject3 | /project 3/main.py | UTF-8 | 34,702 | 2.703125 | 3 | [] | no_license | from flask import Flask, request
import logging
from flask_ngrok import run_with_ngrok
from random import choice
import json
app = Flask(__name__)
run_with_ngrok(app)
logging.basicConfig(level=logging.INFO)
sessionStorage = {}
@app.route('/post', methods=['POST'])
def main():
logging.info('Reques... | true |
e7cead9a9ea74844b3e025ca1b9c6280b69cefd9 | Python | Atul-Acharya-17/Deep-Q-Learning-Snake | /q_learning/game/snake.py | UTF-8 | 2,680 | 4.09375 | 4 | [] | no_license | """Snake Class
Class that models the snake in the game. The important attributes of the
snake are its head and body. This class contains methods responsible for
the movement and positioning of the snake. The aim of the agent is to
control this snake.
"""
class Snake():
# constructor
def __init__(self):
... | true |
fa115c657accdd27dbe750fce7405ffff16a7af6 | Python | JetBrains/intellij-community | /python/testData/inspections/PyArgumentListInspection/py1268.py | UTF-8 | 1,352 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive | def f(a, b, c):
pass
f(c=1, *(10, 20))
f(*(10, 20), c=1)
f(*(10, 20, 30), <warning descr="Unexpected argument">c=1</warning>) # fail: duplicate c
f(1, *(10, 20, <warning descr="Unexpected argument">30</warning>)) # fail: tuple too long
f(1, <warning descr="Expected an iterable, got int">*(10)</warning>) # fail: wron... | true |
fba8a12c505aea93b510073b8f9ec8a535e49e18 | Python | rbiven/ArtificialPanc | /carbCurve.py | UTF-8 | 2,134 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | # Log-Normal Distribution Curve used for representing carbs.
# This was done to have control of curve shape
import numpy as np
###################################################################################
# NOTES TO ADD
###################################################################################
"""
imp... | true |
5ae85f243d0990789dcdc5ca3d3071077d2518c1 | Python | teodorch/baxter_morti | /scripts/get_object.py | UTF-8 | 4,542 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import copy
import rospy
import os
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
from math import sqrt
import numpy as np
import take_screenshot as ss
from std_msgs.msg import String
import arms_setup as arms
def move_group_arm_movement():
## First initi... | true |
bf1e1c2f206432a81f7611522cb9686375f38860 | Python | Integrative-Human-Physiology-Lab/SMI_Pupillometry | /eyelid_detection_test.py | UTF-8 | 5,924 | 2.5625 | 3 | [] | no_license | # script for tuning parameters
import time
import cv2
import numpy as np
import argparse
import matplotlib.pyplot as plt
# parse argument
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "Path to the image")
args = vars(ap.parse_args())
# reads the image
img = cv2.imread(args['i... | true |
05f183cfde40492889d344d16b76f3496eaeddfa | Python | danishpruthi/compare-mt | /compare_ll.py | UTF-8 | 3,779 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | import argparse
# In-package imports
import corpus_utils
import bucketers
import arg_utils
import print_utils
def print_word_likelihood_report(ref, ll1, ll2, bucket_type='freq',
freq_count_file=None, freq_corpus_file=None,
label_corpus=None, label_set=None):
"""... | true |
78a9a4ae2dbe65e1482d49d83fda0374e6b5ddda | Python | leoutan/products | /products-1.py | UTF-8 | 898 | 3.703125 | 4 | [] | no_license | import os
products = []
if os.path.isfile('products.csv'):
print('找到檔案')
#讀取檔案
with open('products.csv', 'r', encoding = 'utf-8') as f:
for line in f:
if '商品, 價格' in line:
continue
name, price = line.strip().split(',')
products.append([name, price])
else:
print('找不到檔案')
print(products)
#輸入新加入的名稱價格... | true |
d0f333951e29d8b3882852df8edb559d5b90c2ed | Python | zhinan18/Python3 | /code/base/process_phone/phone.py | UTF-8 | 946 | 2.890625 | 3 | [] | no_license | import openpyxl
phoneList = openpyxl.load_workbook("201908161.xlsx")
sheet = phoneList.worksheets[0]
i = 0
count = 0
dCount = 0
delList = list()
for cell in list(sheet.columns)[1]:
i = i + 1
phoneStr = str(cell.value).replace(" ", "")
if len(phoneStr) != 11:
count = count + 1
phoneStr = pho... | true |
f7007811ebea4e8e0799e997ee66d915d9a1cb63 | Python | bmyerz/perf-tools | /collectIB.py | UTF-8 | 1,980 | 2.53125 | 3 | [] | no_license | import subprocess
import time
import re
import sys
RX_bytes_pat = re.compile(r'RX bytes:(\d+)')
TX_bytes_pat = re.compile(r'TX bytes:(\d+)')
RX_packets_pat = re.compile(r'RX packets:(\d+)')
TX_packets_pat = re.compile(r'TX packets:(\d+)')
class Sampler:
def __get_time__(self):
return time.time()
def __get_... | true |
d96ab410b30184808275f3778645ad38312ba9fe | Python | ShrutiGanesh18/joint-ner-re | /CRF/source/create_sets_code.py | UTF-8 | 1,122 | 2.734375 | 3 | [] | no_license | #read the final_data_best3tags_mod an final_data_best5tags_mod files into a list, one by one, where each line is an element of this list
#create best-n sets where each line in output file gives the corresponding named entities for each sentence in final_data
import sys
lines = [line.rstrip('\n') for line in open(sys.a... | true |
c29f21919ba4aafac53ec94abecb0f332ebb6d93 | Python | ShiinaMashiro1314/Project-Euler | /Python/37.py | UTF-8 | 748 | 3.296875 | 3 | [] | no_license | import math
n = 1000001
isprime = [True for i in xrange(n)]
isprime[0] = False
isprime[1] = False
for i in xrange(2,int(math.floor(math.sqrt(n)))+1):
for j in xrange(i,n/i+1):
if(i*j<n):
isprime[i*j] = False
d = {}
d[1] = [3,7]
for i in xrange(2,6):
d[i] = []
for j in d[i-1]:
for k in [1,3,7,9]:
i... | true |
ea5236071a47a265e841d253dfb30dbb5e57e4c0 | Python | jmurrayufo/Scripting-Fun | /shuffleTest.py | UTF-8 | 2,328 | 3.546875 | 4 | [] | no_license | import random
import time
def SimpleShuffle(deck, runs):
# Init
newDeck=list(deck)
# Loops
for x in range(runs):
tmpDeck = list(newDeck)
newDeck = list()
topDeck=tmpDeck[:len(tmpDeck)/2]
botDeck=tmpDeck[len(tmpDeck)/2:]
while(len(topDeck) and len(botDeck)):
# Select ... | true |
ec111690ad4ceb41ec6ab32d298ee091fa5afd9b | Python | AmirSoftTech/python | /Test.py | UTF-8 | 412 | 4.09375 | 4 | [] | no_license | '''
i = 1
sum = 0
while i<=5:
sum = sum + i
i =i+1
print(sum)
'''
word = 0
letter = 0
digit = 0
text = input("Enter Value : ")
for x in text:
x = x.lower()
if x>= 'a' and x<='z':
letter = letter + 1
elif x>='0' and x<'9':
digit = digit+1
elif x == ' ':
word ... | true |
7cdaa922a492e5e2b316effb11a2047f36b05e55 | Python | daniel-reich/ubiquitous-fiesta | /aFLqW5hqqRmM4QXZq_14.py | UTF-8 | 599 | 2.828125 | 3 | [] | no_license |
def bar_chart(results):
result=results
a,b,c,d=sorted([v for k, v in sorted(results.items())],reverse=True)
f=sorted([k for k,v in results.items()])
a=(int(a/50),a)
b=(int(b/50),b)
c=(int(c/50),c)
d=(int(d/50),d)
print([a,b,c,d])
m=[a,b,c,d]
z,e,p,l=[],[],'',[]
for i in m:
... | true |
eadd100a36c872266f4b0bcddc7403e504f0a99f | Python | Archangel101OCT/Unsupervised-Image-Classifier | /get_visualize_clusters.py | UTF-8 | 904 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
sns.set()
plt.rcParams["axes.grid"] = False
def visual_cluster(encoder_output,img_resized,n_clusters=15,num=5):
kmeans=KMeans(n_clusters... | true |
13825342e91c61c2d77c735c28ed178a190a865c | Python | Satyankar15/Python-Stuff | /corrcalculator.py | UTF-8 | 1,079 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 17 16:32:31 2020
@author: satya
"""
import pandas as pd
n = int(input("Enter number of observations "))
xdata=[]
ydata=[]
for i in range(n):
x=float(input("Enter "+str(i+1)+" X data "))
xdata.append(x)
for i in range(n):
y=float(input("Enter "+... | true |
651ffd4517ea446a714c6594f0386edd62849901 | Python | Autumn-Chrysanthemum/Coursera | /Chapter_13/Chapter_13_json/geojson.py | UTF-8 | 1,415 | 3.546875 | 4 | [] | no_license | # The program takes the search string and constructs a URL with the search string as a properly encoded parameter
# and then uses urllib to retrieve the text from the Google geocoding API. Unlike a fixed web page,
# the data we get depends on the parameters we send and the geographical data stored in Google servers.
#
... | true |
f0876f3596b60684f19971a018c0d251aaaca94d | Python | dummy3k/FactorioMods | /FactorioMods/websites/com/factoriomods/ModPage.py | UTF-8 | 2,010 | 2.546875 | 3 | [] | no_license | import logging
import re
logger = logging.getLogger(__name__)
from FactorioMods.httpCache import getContent
from bs4 import BeautifulSoup
class ModPage():
def __init__(self, mod_name):
self.mod_name = mod_name
self.html = getContent("http://www.factoriomods.com/mods/%s" % self.mod_na... | true |
7a7329246c483bfe88be6ad4f333427224e16ea9 | Python | reza-arjmandi/serial_port_logger | /gps_compass_logger/main.py | UTF-8 | 1,003 | 2.578125 | 3 | [] | no_license | import time
from ExitIfProcessIsRunning import *
from GpsCompassLogger import *
from LedUserInterface import *
if __name__ == "__main__":
exit_if_process_is_running = ExitIfProcessIsRunning()
gps_compass_logger = GpsCompassLogger()
def log_button_handler(channel):
if(gps_compass_logger.is_s... | true |
b5a61a60118f1f4ce9e3c492f5b163983c09e102 | Python | jaredywhip/Robot_Escape | /prisoner_bot.py | UTF-8 | 30,579 | 2.59375 | 3 | [] | no_license | '''
/* =======================================================================
Description:
This file contains a prisoner robot class that has methods to calculate
its virtual position and navigate a motionpath.
========================================================================*/
'''
import final_con... | true |
7179bd4f7276229bdc505f12ed4a7d0b5f1e1df2 | Python | CodingBucket/ComputerScienceLearning | /Python/examples/data-structures/set.py | UTF-8 | 62 | 2.703125 | 3 | [] | no_license | # Set data structure
st = {1, 2, 3}
print(st)
print(type(st))
| true |
c1f553c309ac977219b8df0f7ff5e508b9c35716 | Python | nghia992004/C4T39-Nam-Nghia | /season4/for_in4.py | UTF-8 | 95 | 3.03125 | 3 | [] | no_license | a=int(input("N:"))
tong = 0
for i in range(a+1):
tong = tong + i
print("So do la:" , tong)
| true |
2275bf7e514215f1457c34756fe245b99aacf576 | Python | byshiny/reststats | /processing/reviewretriever.py | UTF-8 | 12,415 | 2.6875 | 3 | [] | no_license | from pprint import pprint
import json
import os
import pandas as pd
from pandas.io.json import json_normalize
import urllib
import scrapy
from scrapy.crawler import CrawlerProcess
from os import listdir
from os.path import isfile, join
import time
import re
""" directory to run: /Users/byungjooshin/Desktop/wip/reviews... | true |
0fcff074dbc1c24861684007822772721b813312 | Python | unisound-ail/lipvad | /dlib_demo.py | UTF-8 | 3,634 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
"""Visual VAD Demo
"""
import argparse
from collections import deque
import cv2
import dlib
from helper import get_pose
from helper import mouth_length_width_ratio
def cv_show(title, img):
"""CVshow
"""
cv2.imshow(title, img)
if cv2.waitKey(7) & 0xFF == ord('q'):
pass
... | true |
29b5a16be26a0f8e83697e7051071c5c32d26799 | Python | wensun/baselines_old | /baselines/ddpg/plot.py | UTF-8 | 3,525 | 2.625 | 3 | [
"MIT"
] | permissive | ##
# @file plot.py
# @author Yibo Lin
# @date Mar 2018
#
import matplotlib.pyplot as plt
import numpy as np
import re
import glob
def read(filename, cumulative_flag):
print("reading %s" % (filename))
data = []
with open(filename, "r") as f:
count = 1
epoch = None
ret_all... | true |
6ce6cd2431934bcdb2672b4d9a6615090ba38ef8 | Python | EmmanuelBoidot/geosign | /route.py | UTF-8 | 12,181 | 2.578125 | 3 | [] | no_license | import copy
import sys
import geomUtils as gu
from heatmap import *
class Route:
###
# !!! Highly dependent on the datastructure retuned by OSRM server
#
###
def __init__(self, timedLocations=[]):
self.timedLocations = timedLocations
def __str__(self):
return self.toString()
def appendPoint(s... | true |
20c79893bca972d8e3a5c1fdb049530d8ff2b2e4 | Python | bagnine/moviedata | /Code/data_func.py | UTF-8 | 2,687 | 3.375 | 3 | [] | no_license | import pandas as pd
import re
import requests
import time
import numpy as np
def money_to_int(column):
''' converts an object with $ and , to a float with no punctuation '''
a = column.astype(str)
b = a.str.replace('$', '')
c = b.str.replace(',', '')
return c.astype(float)
def col_datetime(column... | true |
3d19278c721627cf92ffd576d181f21f53e43390 | Python | JaydedCompanion/AcadiaCompSci | /Year 1 - Semester 1/Lab #6/lab6_JuanCallejas_100143996.py | UTF-8 | 2,230 | 3.640625 | 4 | [] | no_license | #lab6_JuanCallejas_100143996.py
#By Juan Callejas
#COMP 1110L X1
#Instructor: Greg Lee
def Quarters (img):
#Seriously? Why not let us use a primitive colour like with the other corners instead of having to define a new one smh
purple = makeColor (152, 0, 255)
w = img.getWidth()
h = img.getHeight()... | true |
eebcc85314ccb4573fcbaf6e04262ff4196379e1 | Python | souravc83/Data_Blog | /NYT_coverage/pol_search_main.py | UTF-8 | 4,397 | 3.15625 | 3 | [] | no_license | """
@author:Sourav Chatterjee
@date:06/20/2014
@brief: use nytimes api to get data on how much different politicians are in the news
"""
#import from standard module
import time
import numpy as np # to save files
#local module imports
import nytapi
reload (nytapi) #use to load latest version when changing constantly
... | true |