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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
25ac4e8eb06407912972e2d251398ab5d151e95b | Python | Farrythf/LeetCode_DefeatProcess | /NO.62/FirstTry.py | UTF-8 | 576 | 3.046875 | 3 | [] | no_license | class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
if m == 1:
return 1
elif m == 2:
return n
elif m == 3:
return int(0.5*n*(n+1))
elif n == 1:
retur... | true |
58db6285b8a1b32f767c66082b1d2f9676757086 | Python | CrtomirJuren/pygame-projects | /beginning-game-development/Chapter 12/model3d.py | UTF-8 | 5,468 | 2.625 | 3 | [
"MIT"
] | permissive |
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame
import os.path
class Material(object):
def __init__(self):
self.name = ""
self.texture_fname = None
self.texture_id = None
class FaceGroup(object):
def __init__(self):
self.tri_indices = []
self.mater... | true |
5e562909d559c558f22f9770164823e342aa824c | Python | lucasmma/Trabalho-de-Orientacao-a-Objeto | /Exceptions.py | UTF-8 | 1,111 | 2.71875 | 3 | [] | no_license | class Error(Exception):
"""Base class for other exceptions"""
pass
class InvalidMenuNumberException(Error):
"Selecionado quando o valor é invalido no menu"
pass
class PlacaInvalidaException(Error):
"Mask de placa invalida"
pass
class DadosVeiculosIncompletosException(Error):
"Dados do vei... | true |
f4252b356d2129f835a950b12040b49f5a8c1c8b | Python | sbabineau/data-structures | /tests/binarytree_tests.py | UTF-8 | 3,289 | 3.5 | 4 | [] | no_license | import unittest
from data_structures.binarytree import BinaryTree as Tree
class BinaryTreeTests(unittest.TestCase):
def setUp(self):
self.tree = Tree(7)
def test_insert(self):
self.tree.insert(9)
self.assertTrue(self.tree.contains(9))
def test_reinsert(self):
self.tree.i... | true |
48c1af009c69f22c0f6c46b930ac6afc7b149d58 | Python | ajayakumar123/cricket_task_project | /cricketProject/cricketApp/models.py | UTF-8 | 8,848 | 2.765625 | 3 | [] | no_license | from django.db import models
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.urls import reverse
import pytz
utc=pytz.UTC
# Create your models here.
class Team(models.Model):
name=mo... | true |
a05c2782cc851f974714a888084d9debdb6d5bf6 | Python | draculaw/leetcode | /VaildPalindrome.py | UTF-8 | 401 | 3.515625 | 4 | [] | no_license | class Solution:
# @param {string} s
# @return {boolean}
def isPalindrome(self, s):
m = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
s = s.upper()
s = [c for c in s if c in m]
l = len(s)
h = l / 2
s2 = s[h:][::-1]
for i in xrange(h):
... | true |
dd3d0e9de409d8f008449747a60b48937163148e | Python | rahulraghuv/MahiteorProjects | /media/readCSV.py | UTF-8 | 286 | 2.78125 | 3 | [] | no_license | import csv
filename="Rahul_raghuvanshi_test_file.txt"
csvFile=open(filename)
csvReader=csv.reader(csvFile)
print csvReader
csvList=list(csvReader)
print csvList
listData=[]
var=i=0
for data in csvList:
for j in data:
var=var+int(j)
listData.append(var)
i+=1
print listData
| true |
62a309ac9c1eca33ced52a59153ffddc82637f7f | Python | shubhamsaraf26/python | /main.py | UTF-8 | 304 | 3.703125 | 4 | [] | no_license | str1='this is my first string '
print(str1)
str2="this is, my scecond string"
print(str2)
str3='''
this , sting ,has lots of line'''
print(str3)
print(str1[0:5])
print(len(str3))
print(str3.lower())
print(str1.upper())
print(str1.count("this"))
print(str1.find('fir'))
print(str2.split()) | true |
63899a60c5546c97fbde1e86588e2d36fb018bf2 | Python | Dovedanhan/wxPython-In-Action | /spinecho_demo/Sizer/SizersAndNotebook.py | UTF-8 | 6,247 | 2.765625 | 3 | [] | no_license | # -*- coding: iso-8859-1 -*-
#--------------------------------------------------------------------
# Name: SizersAndNotebook.py
# Purpose: An application to learn sizers
# Author: Jean-Michel Fauth, Switzerland
# Copyright: (c) 2007-2008 Jean-Michel Fauth
# Licence: None
# os dev: winXP sp2
# py dev: ... | true |
bfd5c9209baaefdb131a453963c29e1e5fa370a5 | Python | zh1047592355/ApiAutoTest | /李老师python/day02/test_004.py | UTF-8 | 736 | 3.375 | 3 | [] | no_license | '''
fixture 测试前置和后置,比较常用的方式。
1. 命名比较灵活,不限于setup、teardown等命名方式
2. 使用比较灵活
3. 不需要import即可实现共享。
'''
import pytest
# 测试前置和后置
@pytest.fixture()
def login():
print("登录系统") # yield之前是前置
yield
print("退出系统") # yield之后是后置
# 测试脚本
def test_query():
print("查询功能,不需要登录")
# 使用方式一:将fixture作为参数传到脚本中,比较常用。
def tes... | true |
6e83dd286c4059c94272413e88dda9b8365bb6b9 | Python | gomilinux/python-PythonForKids | /Chapter8/Challenge2TurtlePitchfork.py | UTF-8 | 737 | 3.625 | 4 | [] | no_license | #Python For Kids Chapter 8 Challenge #2 Turtle Pitchfork
#Use turtle objects and move them around to create a sideways pitchfork
import turtle
#handle = turtle.Pen()
topfork1 = turtle.Pen()
topfork2 = turtle.Pen()
bottomfork1 = turtle.Pen()
bottomfork2 = turtle.Pen()
topfork1.forward(150)
bottomfork1.forward(150)
... | true |
c9a5e60be691a6f6b48c0dee3e54c19a12b967f2 | Python | fank-cd/python_leetcode | /Problemset/binary-tree-level-order-traversal/binary-tree-level-order-traversal.py | UTF-8 | 839 | 3.546875 | 4 | [] | no_license |
# @Title: 二叉树的层序遍历 (Binary Tree Level Order Traversal)
# @Author: 2464512446@qq.com
# @Date: 2020-11-23 16:40:09
# @Runtime: 40 ms
# @Memory: 13.8 MB
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
clas... | true |
f029ed3650cf009d91b5ea4eb6684a526ae6c3e3 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_203/700.py | UTF-8 | 1,390 | 3.125 | 3 | [] | no_license | #!/bin/env python
# google code jam 2017 round 1A problem 1
# Daniel Scharstein
def fill(a, x, rmin, rmax, cmin, cmax):
for r in range(rmin, rmax):
for c in range(cmin, cmax):
if a[r][c] == '?':
a[r][c] = x
elif a[r][c] != x:
print("error 1")
def le... | true |
ac862c4de6f983a850e0cc3444032cd7df412936 | Python | iamhimmat89/data_structure-and-algorithms-in-python | /bubble_sort.py | UTF-8 | 1,007 | 4.8125 | 5 | [] | no_license | print("\nWelcome to Bubble Sort...!!!\n")
# Class bubbleSort: Used for sorting given data
class BubbleSort:
# constructor
def __init__(self):
self.swapped = False
self.array = None
self.length = None
# method to sort given list into ascending order
def sort(self, array):
... | true |
e7fdda44f79ca2594d62c7b24f69bdcd08fec03e | Python | abhi9835/python | /class_objects.py | UTF-8 | 375 | 4.03125 | 4 | [] | no_license | class Employee:
company = 'Google'
def getsalary(self):
print(f"salary is {self.salary}")
abhishek = Employee()
abhishek.company = 'youtube'
abhishek.salary = 1000000
print(abhishek.salary)
print(abhishek.company)
abhishek.getsalary() #this line is same as Employee.getsalary(abhishek): we are giving ... | true |
5136344b6c3545681dbf6dc2009a8ff576a9ddf8 | Python | maxtortime/algorithm | /algospotcoins/py_coin.py | UTF-8 | 773 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/python3
import sys, math
n_test_case = int(input())
n_res = [0 for x in range(n_test_case)]
MAX_COINS = 5000
MAX_COUNT = 1000000007
for i in range(n_test_case):
money, n_coin = [int(x) for x in input().split()]
coins = [int(x) for x in input().split()]
countCoins = [long(0) for x in range... | true |
dbdf73a384146bf05170ecdb300f54c08276db23 | Python | APrioriInvestments/object_database | /object_database/web/cells/children.py | UTF-8 | 9,173 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017-2019 Nativepython Authors
#
# 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... | true |
74f66c29ab563faa7f5b95dbb3de5d7d397b10b9 | Python | cloud-security-research/sgx-ra-tls | /sgxlkl/https-server/https-server.py | UTF-8 | 1,378 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | # This is a demonstration of how to use RA-TLS without actually
# interfacing with the RA-TLS library directly. Instead, the RA-TLS
# key and certificate are generated at startup and exposed through the
# file system. The application accesses the key and certificate by
# reading from the file system.
import base64
imp... | true |
fa4d748fb50fc917933493ec3cf8db15845f2f39 | Python | salonisv17/DriveAssingment | /Solution | UTF-8 | 2,179 | 3.78125 | 4 | [] | no_license | import datetime
def solution():
isValid = False
while not isValid:
date_1 = input("Type first Date dd-mm-yyyy: ")
value_1 = input("Enter first value: ")
date_2 = input("Type second Date dd-mm-yyyy: ")
value_2 = input("Enter second value: ")
try: # strptime throw an exc... | true |
16c4f6672ea814546565def59d034e49198ff618 | Python | quintant/ZipBrute | /zipAndDestroy.py | UTF-8 | 2,704 | 2.953125 | 3 | [] | no_license | from time import sleep
from zipfile import ZipFile
from passGen import PassGen
import multiprocessing
from termutils import *
def crackBrut(lock:multiprocessing.Lock, num):
import random
import string
from itertools import product
filename = 'dummy.zip'
zip = ZipFile(filename)
c... | true |
904b968df5db83438382920f161b6dd01eecb199 | Python | bkuhlen73/udemy | /python/challenges/min_max_key_in_dictionary.py | UTF-8 | 330 | 3.765625 | 4 | [] | no_license | '''
min_max_key_in_dictionary({2:'a', 7:'b', 1:'c',10:'d',4:'e'}) # [1,10]
min_max_key_in_dictionary({1: "Elie", 4:"Matt", 2: "Tim"}) # [1,4]
'''
def min_max_key_in_dictionary(d):
keys = d.keys()
return [min(keys), max(keys)]
print(min_max_key_in_dictionary(
{2: 'a', 7: 'b', 1: 'c', 10: 'd', 4: 'e'})) ... | true |
800337f1e035cc13be46285ad73b1477ff48842b | Python | rafinkang/test_python | /day11/test3.py | UTF-8 | 927 | 4.53125 | 5 | [] | no_license | class Player:
# 클래스 속성
cnt = 0
bag = []
def __init__(self, name):
print("--------초기화 함수",name,"- 생성자--------")
self.name = name
Player.cnt += 1
def put(self, obj):
Player.bag.append(obj)
def attack(self, other):
print(other.name + "를 공격합니다.")
def ... | true |
54f08ba85f5a7ab601d1e9aa5a2707c96b887b76 | Python | minevadesislava/HackBulgaria-Programming101 | /week3/3-Panda-Social-Network/panda.py | UTF-8 | 778 | 3.484375 | 3 | [] | no_license |
import re
class Panda:
def __init__(self, name, email, gender):
self.__name = name
self.__email = email
self.__gender = gender
def name(self):
return self.__name
def email(self):
return self.__email
def gender(self):
return self.__gender
def isMale... | true |
32f287fdf24519739a7585d7a1c86e39585d928f | Python | koustavmandal95/Competative_Coding | /Practice Challenges/sum_pair_zer0.py | UTF-8 | 555 | 3.1875 | 3 | [] | no_license | def pairSum0(l):
#Implement Your Code Here
negative_array=[]
positive_array=[]
for i in range(len(l)):
if l[i]<0:
negative_array.append(l[i])
#l.remove(l[i])
else:
positive_array.append(l[i])
print(negative_array,positive_array)
for i in range(0,le... | true |
7abc99dab157f34dbfef0affd9b763a995fc7614 | Python | troykark/Underworlds | /dice.py | UTF-8 | 764 | 3.40625 | 3 | [] | no_license | import random
import statistics
def statarray():
roll = [random.randint(1,6), random.randint(1,6), random.randint(1,6), random.randint(1,6)]
roll.remove(min(roll))
return sum(roll)
def rollDice(rolls,dice):
output = 0
for roll in list(range(rolls)):
output += random.randint(1,dice)
re... | true |
22f37678c95ebecfe4eeb92e6db29c4dc89b9b69 | Python | akselell/statikk | /surface.py | UTF-8 | 540 | 2.859375 | 3 | [] | no_license | import matplotlib
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
fig = plt.figure()
ax = plt.axes(projection='3d')
xpoints = np.linspace(-10, 10, 100)
ypoints = np.linspace(-10, 10, 100)
zpoints = np.zeros( (1, (len(xpoints)* len(ypoints))) )
print(zpoints)
i =... | true |
046d4af7f8b53ef7a10028f9f52fc397bbe3af2e | Python | eddiesherlock/twitter | /craw_id.py | UTF-8 | 2,561 | 3.109375 | 3 | [] | no_license | from urllib.request import urlopen
import csv
import re
from bs4 import BeautifulSoup
import requests
import pandas as pd
def crawl_id():
# define url for crawling
url = 'https://en.wikipedia.org/wiki/Main_Page'
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KH... | true |
254a551605f9493256d5cae6daec1cbbbef2b7d3 | Python | liamhawkins/bio_tools | /volcano_plot.py | UTF-8 | 2,989 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import sys
import math
import os
from argparse import ArgumentParser
parser = ArgumentParser(description='Create volcano plot from spreadsheet of \
p-values an... | true |
de43ae3fd621ff3110ac055391a38852333e24d0 | Python | tim-fry/earthmarsbot | /bot.py | UTF-8 | 1,021 | 3.140625 | 3 | [] | no_license | import ephem
import json
import twitter
with open('credentials.json') as f:
credentials = json.loads(f.read())
def generate_distance_message():
m = ephem.Mars()
m.compute()
lightseconds = 499.005
milmiles = 92.955807;
minutes = int(m.earth_distance*lightseconds) / 60
seconds = m.earth_dis... | true |
e2258a1ffd3c242a4942f5962067234cb4438792 | Python | kimroniny/ACM | /LeetCode/contests/20210704-weilai/2/1.py | UTF-8 | 691 | 3.21875 | 3 | [] | no_license | import queue
import heapq
class P():
def __init__(self,a,b):
self.a = a
self.b = b
def __lt__(self, other):
if self.a<other.a:
return True
else:
return False
def p(self):
print(self.a, self.b)
class Solution:
def eliminateMaximum(self, d... | true |
f7fab922203a02a56108a6b023d05a699f11317f | Python | espnet/espnet | /egs2/TEMPLATE/asr1/pyscripts/utils/convert_text_to_phn.py | UTF-8 | 2,527 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# Copyright 2021 Tomoki Hayashi and Gunnar Thor
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Convert kaldi-style text into phonemized sentences."""
import argparse
import codecs
import contextlib
from joblib import Parallel, delayed, parallel
from tqdm import tqdm
from espn... | true |
f0b1e893ce77f51dd47286c50fa5b165fb66c17c | Python | avbm/exercism | /python/matrix/matrix.py | UTF-8 | 394 | 3.6875 | 4 | [] | no_license | class Matrix(object):
def __init__(self, matrix_string):
temp_rows = matrix_string.split('\n')
self.rows = []
for row in temp_rows:
self.rows.append(row.split(' '))
def row(self, index):
return [ int(i) for i in self.rows[index-1] ]
def column(self, index):
... | true |
eacf328787935c07164926cc32d8365752c3ff63 | Python | wangyongk/scrapy_toturial | /Pythonproject/douban/sk.py | UTF-8 | 595 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 20:23:55 2018
@author: wangyongkang
"""
"""
file.read() 读取文件所有内容
file.readlines() 读取文件的全部内容 与file.read()不同之处在于readlines会把读取的
内容,赋给一个列表变量
file.readline() 读取一行内容
"""
import urllib.request
filename=urllib.request.urlopen("http://www.baidu.com")
respons... | true |
8deb5fba8dc3f20d8516955bd3b67a2f59787a1c | Python | NickJaNinja/Internet-Explorer | /python_version/game.py | UTF-8 | 1,242 | 2.53125 | 3 | [] | no_license | from player import *
from universe import *
from shopGoods import *
from random import *
class Game:
def __init__(self):
self.player = None
self.diff = None
self.universe = Universe()
self.currSystem = None#self.universe.getRandomSystem()
self.currShop = None#self.currSystem.... | true |
56959d54cae6ca532906da756bac5274059bcbbe | Python | Rand01ph/reviewboard | /reviewboard/cmdline/tests/test_rbsite.py | UTF-8 | 6,245 | 2.671875 | 3 | [
"MIT"
] | permissive | """Unit tests for reviewboard.cmdline.rbsite."""
from __future__ import unicode_literals
import os
import shutil
import tempfile
from reviewboard.cmdline.rbsite import (Command,
MissingSiteError,
UpgradeCommand,
... | true |
2880d0b3e60be4d63c80e1b04b70e1c81dd8c7aa | Python | andyfangdz/Spectre | /src/libhistogram/modules.py | UTF-8 | 908 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | import cv2
import numpy as np
class Ghost(object):
def __init__(self):
self.mask = None
self.hist = None
def update(self, partition, mask):
self.mask = mask
hist = cv2.calcHist([partition], [0], mask, [16], [0, 180])
cv2.normalize(hist, hist, 0, 255, cv2.NORM_MINMAX)
... | true |
8929e151f815f5f181a753dc7ee871f49fe6e713 | Python | rochabr/alexa-whispers | /lambda_function.py | UTF-8 | 8,208 | 3.140625 | 3 | [] | no_license | """
This is a Python template for Alexa to get you building skills (conversations) quickly.
"""
from __future__ import print_function
import random
from dynamo_handler import write_whisper, Whisper, read_whisper
# import dynamo_handler
# --------------- Helpers that build all of the responses ----------------------
... | true |
401cf925d0029691af57dc9bce0f82ceef05687e | Python | Rpereira23/BeijingAirPollutionPrediction | /core/model.py | UTF-8 | 4,457 | 2.640625 | 3 | [] | no_license | import os
import sys
import math
import keras
import logging
import numpy as np
import datetime as dt
import tensorflow as tf
from numpy import newaxis
from core.util.timer import Timer
from keras.models import Sequential, load_model
from keras.layers import Dense, SimpleRNN, LSTM
from keras.callbacks import EarlyStopp... | true |
12f0df494ebc35da9433f5a4d0731eff2dd127da | Python | hy299792458/LeetCode | /python/11-containerWithMostWater.py | UTF-8 | 380 | 2.90625 | 3 | [] | no_license | class Solution(object):
def maxArea(self, height):
l = 0
r = len(height) - 1
res = 0
while l < r:
h = min(height[l], height[r])
res = max(res, h * (r - l))
while l < len(height) and height[l] <= h:
l += 1
while r >= 0 an... | true |
ff57f60e1ff5fc7d7eafa36fca18f789ca4106ab | Python | ramksharma1674/pyprojold | /tmpcall.py | UTF-8 | 477 | 3.5 | 4 | [] | no_license | from temp import to_celcius
import random
c= to_celcius(70)
print (c)
number, number2, number3 = random.random(), random.randint(1,6), random.randrange(100,500,5)
#print("number=", random.random())
#number2 = random.randint(1,6)
#number3 = random.randrange(100,500,5)
print (number)
print (number2)
print (number3)
li... | true |
37c053b75e74200057240af8f3ff3a9f10e8063e | Python | mokumokustudy/procon20190113 | /src/kwatch/ABC085B.py | UTF-8 | 391 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
## https://atcoder.jp/contests/abs/tasks/abc085_b
import sys
def run(nums):
return len(set(nums))
def main():
def gets(input=sys.stdin):
return input.readline().strip()
N = int(gets())
arr = []; add = arr.append
for _ in range(N):
add(int(gets()))
asse... | true |
c5adf783a3187de26a10cfc48e68827f649627ed | Python | shirayukikitsune/python-code | /src/main/lp/treinamento_3/sum_of_consecutive_odd_numbers_1/main.py | UTF-8 | 276 | 3.296875 | 3 | [
"Unlicense"
] | permissive | def run():
x = int(input())
y = int(input())
if x > y:
x, y = y, x
start = x + 2 if x % 2 == 1 else x + 1
end = y
total = 0
for i in range(start, end, 2):
total = total + i
print(total)
if __name__ == '__main__':
run()
| true |
c8f78097f826798226a7b994ebf08e38fbffc0f6 | Python | JanainaNascimento/ExerciciosPython | /ex 015.py | UTF-8 | 1,068 | 4.1875 | 4 | [] | no_license | '''faça um programa que leia o comprimento do cateto oposto
e do cateto adjacente de um trian retangulo,
calc e mostre o comp da hipotenusa
print('*Calcula a Hipotenusa de um triângulo retangulo*')
catOpo = float(input('Digite o cateto oposto: '))
catAdj = float(input('Digite o cateto adjacente: '))
hi = (catAdj ** 2 ... | true |
e294211a1da242cb78ab6446dfa1e3a78103e72d | Python | Feelx234/nestmodel | /nestmodel/unified_functions.py | UTF-8 | 3,498 | 3.125 | 3 | [
"MIT"
] | permissive | """This file should contain functions that work independent of the underlying graph structure used (e.g. networkx or graph-tool)"""
import numpy as np
def is_networkx_str(G_str):
"""Checks whether a repr string is from networkx Graph"""
if (G_str.startswith("<networkx.classes.graph.Graph") or
G_str.sta... | true |
432a9ed7a8111a6509f1a354edd3d6fa18ff84ed | Python | KunyiLiu/algorithm_problems | /kunyi/dp/greedy/queue-reconstruction-by-height.py | UTF-8 | 870 | 3.8125 | 4 | [] | no_license | class Solution:
"""
@param people: a random list of people
@return: the queue that be reconstructed
"""
def reconstructQueue(self, people):
# # 遍历排好序的people,从身高最高的人开始,根据每个人的k值,将其插入到结果数组中
# 因为我们遍历是从身高最高的人开始的,所以即使后面有人插入改变了前面插入人在结果集中的位置,但是相对关系没有变,即每个人的前面比他高的人这个事实没有变,也因为后面插入的人的身高都低于前面的人,... | true |
fa166e4c0510e69caf4fe58f7381e55f319914de | Python | lyger/matsuri-monitor | /matsuri_monitor/chat/info.py | UTF-8 | 827 | 2.75 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
VIDEO_URL_TEMPLATE = "https://www.youtube.com/watch?v={video_id}"
CHANNEL_URL_TEMPLATE = "https://www.youtube.com/channel/{channel_id}"
@dataclass
class ChannelInfo:
"""Holds information about a YouTube channel"""
id: str
name: str
thumbnail_url: str
org: str
... | true |
7b2c42e955ea13c0d11d41ebfd8717666048d61f | Python | alessandrobalata/pyrlmc | /objects/control.py | UTF-8 | 4,200 | 2.890625 | 3 | [
"MIT"
] | permissive | from objects.cont_value import ContValue
from objects.controlled_process import ControlledProcess
import numpy as np
import matplotlib.pyplot as plt
from problems.problem import Problem
class Control:
'''
Control object to be used both backward and forward
'''
def __init__(self, problem: Problem):
... | true |
16b88814c78cd454b6b6ca6b52e5d4e455db68f0 | Python | mjdrushton/potential-pro-fit | /lib/atsim/pro_fit/_channel.py | UTF-8 | 8,227 | 2.65625 | 3 | [] | no_license | import logging
import uuid
import itertools
import sys
from gevent.queue import Queue
from gevent import Greenlet
import gevent.lock
import gevent
class ChannelCallback(object):
"""Execnet channels can only have a single callback associated with them. This object is a forwarding callback.
It holds its own call... | true |
1fe6e6d14f2464fb5b550635afe66acf0beec88e | Python | Geokenny23/Basic-python-batch5-c | /Tugas-2/Soal-1.py | UTF-8 | 2,009 | 3.328125 | 3 | [] | no_license | semuakontak = []
kontak = []
def menu():
print("----menu---")
print("1. Daftar Kontak")
print("2. Tambah Kontak")
print("3. Keluar")
def tampilkankontak():
print("Daftar Kontak: ")
for kontak in semuakontak:
print("Nama : " + kontak["nama"])
print("No. Telepon : " + kontak["te... | true |
5b07739d2b9e87f19b39db1cd5413c04f4f70fdd | Python | ehoversten/login_registration | /server.py | UTF-8 | 5,097 | 2.78125 | 3 | [] | no_license | from flask import Flask, request, redirect, render_template, session, flash
from flask_bcrypt import Bcrypt
# import the function connectToMySQL from the file mysqlconnection.py
from mysqlconnection import connectToMySQL
import re
# create a regular expression object that we can use run operations on
EMAIL_REGEX = re... | true |
cc56ddebd98c3bc1db5a440d02376dfc42533095 | Python | purnima-git/content-dynamodb-datamodeling | /2-2-4-Hierarchical-Data/query.py | UTF-8 | 1,542 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
import boto3
from boto3.dynamodb.conditions import Key
table = boto3.resource("dynamodb").Table("TargetStores")
client = boto3.client("dynamodb")
# Get single store location
try:
store_number = "1760"
response = table.get_item(Key={"StoreNumber": store_number})
print(f">>> Get ite... | true |
8a16997a8e141a1c5f2ceb07057eed29c798bed4 | Python | shreyanshu007/Crime-Analysis-BTP | /crawler/InsertionIntodatabase.py | UTF-8 | 2,231 | 3.171875 | 3 | [] | no_license | import pymysql
import datetime
# function to check the presence of a url in tabel
def IsUrlExists(url):
'''
TO check if URL exists in DB
input: url - url of website
'''
# print("Article: ", url)
connection = pymysql.connect('localhost', 'root', 'root', 'CRIME_ANALYSIS')
if all(o... | true |
82f0d07c3f1c6e376a6e241146fcc60fe762c750 | Python | weisonyoung/ex_dataclass | /ex_dataclass/xpack.py | UTF-8 | 2,198 | 2.75 | 3 | [
"MIT"
] | permissive | """
Ex Dataclass X-Pack
The extend tools for ex_dataclass
1. json loads
2. asdict
3. argument signature
"""
import copy
import json
import typing
from ex_dataclass.type_ import Field_
from . import m
# transfer function type
def asdict_xxxFieldName(value: typing.Any) -> m.F_VALUE:
pass
asdict_func_type = asdic... | true |
841bc3d8a9045cf160e676362d93817cf1897e67 | Python | pferreira101/SDB-Zulip_Deployment | /users.py | UTF-8 | 485 | 2.921875 | 3 | [] | no_license | import sys
import csv
import random
num_users = int(sys.argv[1])
row_list = [["EMAIL","PASSWORD","PRIVATE_TO"]]
for i in range(num_users):
randNum = random.randint(1,num_users)
while randNum == i:
randNum = random.randint(1,num_users)
row = ["user"+str(i+1)+"@email.com","exemplo","user"+str(randN... | true |
2f0498934a75c65854903615aa4bce7db34b8472 | Python | PatrikYu/MLiA | /MLiA/MLiA_classification/treePlotter.py | UTF-8 | 6,931 | 3.359375 | 3 | [] | no_license | # coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8') #python的str默认是ascii编码,和unicode编码冲突,需要加上这几句
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=14) # 使坐标轴能显示中文
from pylab import *
mpl.rcParams['font.sans-serif'] = ['SimHei']... | true |
482953452fbcea6bf072d03b289eaa9bc1236220 | Python | IndiaCFG3/team-52 | /modals/Student.py | UTF-8 | 299 | 2.859375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | class Student:
def __init__(self, student_id, name, teacher_id):
self.student_id = student_id
self.name = name
self.teacher_id = teacher_id
class StudentScore:
def __init__(self, student_id, score):
self.student_id = student_id
self.score = score
| true |
2dc42b1cab0130a6f584226854bc6909c3c36490 | Python | immanishbainsla/manit_workshop | /Day-2/Face_Recognition.py | UTF-8 | 2,271 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import matplotlib.pyplot as plt
import numpy as np
# In[2]:
# Mapping between names & labels
idx2name = {
}
files = os.listdir()
pics = []
Y = []
cnt = 0
for f in files:
if f.endswith(".npy"):
data = np.load(f)
labels = np.ones(data.s... | true |
580bb65166c15098b660e359f35a6f35a4602909 | Python | Jill1627/Artificial-intelligence-projects | /spam_filter.py | UTF-8 | 4,045 | 3.328125 | 3 | [] | no_license | """
Implement a basic spam filter using Naive Bayes Classification
"""
import email
import math
import os
import heapq
from collections import defaultdict
from collections import Counter
############################################################
# Section 1: Spam Filter
##############################... | true |
d63a928d12c97866216bd213acb689fddf997eee | Python | motormanalpha/Datalogger | /takedata_github.py | UTF-8 | 1,841 | 3.015625 | 3 | [] | no_license | #
# Matt Schultz
# 2-18-2019
# First try with python code to take regular data from 34970a datalogger.
# Set your options here in the code (to keep it as simiple as possible).
# Import the csv file into "Excel" or "Calc" to graph and manipulate data.
#
import visa
import time
delay = 1 # Number of seconds between s... | true |
a8d1e7d68386245af0de01a697145c1114131a74 | Python | mango0713/Python | /20191217 - 소수판별.py | UTF-8 | 238 | 3.5 | 4 | [] | no_license | x = int(input(" input number :"))
a = 2
while a <= x :
if x % a ==0 :
break
a = a + 1
if a == x :
print ("yes, it is prim number")
else:
print("no, it is not prim number")
| true |
0ef6480a48314bf433959f42625dd95c1ca4197f | Python | invoke-ai/InvokeAI | /invokeai/backend/model_management/model_manager.py | UTF-8 | 42,984 | 2.984375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """This module manages the InvokeAI `models.yaml` file, mapping
symbolic diffusers model names to the paths and repo_ids used by the
underlying `from_pretrained()` call.
SYNOPSIS:
mgr = ModelManager('/home/phi/invokeai/configs/models.yaml')
sd1_5 = mgr.get_model('stable-diffusion-v1-5',
model... | true |
0b92d45969f3251f5087ffc3e39c828b88a823a4 | Python | xinkaichen97/HackerRank | /Data Science/humidity2.py | UTF-8 | 1,694 | 2.546875 | 3 | [] | no_license | import pandas as pd
from pandas.plotting import autocorrelation_plot
from statsmodels.tsa.arima_model import ARIMA
from matplotlib import pyplot as plt
startDate = "2013-01-01"
endDate = "2013-01-01"
knownTimestamps = ['2013-01-01 00:00','2013-01-01 01:00','2013-01-01 02:00','2013-01-01 03:00','2013-01-01 04:00... | true |
148b397f117456d9ffdd41490c038786d20cd12c | Python | guo-sc/Python-Learn | /Mooc-3.5-2018-12-09/TextProBarV1.py | UTF-8 | 280 | 3.21875 | 3 | [] | no_license | #TextProBarV1.py
import time
scale = 10
A = "执行开始"
B = "执行结束"
print("{:-^20}".format(A))
for i in range(scale+1):
a = "*"*i
b = "."*(scale-i)
c = (i/scale)*100
print("{:^3.0f}%[{}->{}]".format(c,a,b))
time.sleep(0.5)
print("{:-^20}".format(B))
| true |
61deb7037dab106a0f831eae2f1746806fd8baf7 | Python | AsternA/Final-Project---Deep-Learning-w-Raspberry-Pi- | /mission_import.py | UTF-8 | 6,665 | 2.515625 | 3 | [] | no_license | #################################################
# #
# Written by: Almog Stern #
# Date: 15.4.20 #
# Missions to be given to the Pixhawk #
# (With help from Dronekit Examples) #
# ... | true |
c8f2d1f6cbf4db9b5606bc40a4e9af98b9431cf7 | Python | mdl/leetcode | /binary-width.py | UTF-8 | 438 | 3.0625 | 3 | [] | no_license | def widthOfBinaryTree(root):
width, left, right = 0, {}, {}
def dfs(node, num = 0, dep = 0):
nonlocal width
if node:
if not dep in left: left[dep] = num
right[dep] = max(right[dep] if dep in right else 0, num)
width = max(width, right[dep] - left[dep] + 1)
dfs(... | true |
08a694d38f7a66bb2bd5b4f3351c949810a35fa7 | Python | eewf/SoftUni-Fundamentals-Tasks | /Maximum Multiple.py | UTF-8 | 188 | 2.9375 | 3 | [] | no_license | import sys
divisor = int(input())
bound = int(input())
max_x = -sys.maxsize
for x in range(bound + 1):
if x % divisor == 0:
if 0 < x <= bound:
max_x=x
print(max_x)
| true |
84f23ec69121ac19505848b4c237b0f2c70dbb27 | Python | Malhar-Patwari/Social-Network-Analysis-Project | /Project/cluster.py | UTF-8 | 1,952 | 3 | 3 | [] | no_license | """
cluster.py
"""
import networkx as nx
import matplotlib.pyplot as plt
import sys
import time
import csv
import pandas as pd
import pickle
def read_graph():
"""
Returns:
A networkx undirected graph.
"""
return nx.read_edgelist('friends.txt', delimiter='\t')
def remove_nodes(graph,d):
for... | true |
cab406041bb58f90a52c775f720bab929614fb2d | Python | kaslock/problem-solving | /Programmers/가장 긴 팰린드롬.py | UTF-8 | 371 | 3.15625 | 3 | [] | no_license | def valid(s):
j = len(s)
for i in range(j // 2):
if s[i] != s[j - 1 - i]:
return False
return True
def solution(s):
answer = 0
for i in range(1, len(s) + 1):
for j in range(len(s)):
if j + i > len(s): break
if valid(s[j:j + i]):
... | true |
af77c53ef7370460f4dbf9e5c450ad5c323ab810 | Python | vinodbellamkonda06/myPython | /oops/OVERLOADING.py | UTF-8 | 133 | 2.671875 | 3 | [] | no_license | import pdb;pdb.set_trace()
class Addition:
@classmethod
def addition(cls,*a):
print(a)
Addition.addition(10,10,20)
| true |
6a2d7e8b555966dd8bda6bdbf846649883fd723b | Python | lis5662/Python | /python_crash _course_book/chapter 5/chapter 5.py | UTF-8 | 5,170 | 3.53125 | 4 | [] | no_license | cars = ['audi', 'bmw', 'subaru', 'toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
# Проверка условий, равенства
car = 'bmw'
if car == 'bmw':
print(True)
else:
print(False)
# Проверка равенств без учета регистра
# car = 'Audi'
... | true |
c53e2092b6912d677a8285fc87084531bf8a5a07 | Python | lylwill/CS275Project | /qlearning.py | UTF-8 | 401 | 2.765625 | 3 | [] | no_license | from RL import RL
class qlearning(RL):
def __init__(self, actions, epsilon, alpha=0.2, gamma=1.0):
RL.__init__(self, actions, epsilon, alpha, gamma)
def learn(self, state1, action, reward, state2):
try:
q = [self.getQ(state2, a) for a in self.actions]
maxQ = max(q)
self.updateQ(state1, action, reward, ... | true |
7dabea15d4ed1e04eb7fa0acd1216a7db26e00ab | Python | hiter-joe/pyHMT2D | /tests/00_dummy/00_01_dumy_test.py | UTF-8 | 140 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-generic-cla"
] | permissive |
def test_dummy():
"""A dummy test as placeholder and template
Returns
-------
"""
opo = 1 + 1
assert opo == 2
| true |
0bf8014114d689e1876bfb299dca18b3d664d4f3 | Python | gianfabi/raven | /Workshop/ISUtrainig/extModel.py | UTF-8 | 347 | 2.53125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive |
''' from wikipedia: dx/dt = sigma*(y-x) ; dy/dt = x*(rho-z)-y dz/dt = x*y-beta*z ; '''
import numpy as np
def run(self,Input):
self.prod = 10*self.ThExp*self.GrainRad
self.sum = 5*self.ThExp -0.6*self.GrainRad
self.sin = np.sin(self.ThExp/5.e-7)*np.sin((self.GrainRad-0.5)*10)
# if self.sin == np.N... | true |
62c87a491450a84834e947df150415a0e46f5dd9 | Python | sz6636/machine-learning | /Numpy学习/ttt.py | UTF-8 | 465 | 3.3125 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: "Zing-p"
# Date: 2017/12/11
import math
# 向上取整
# print("math.ceil---")
# print("math.ceil(2.3) => ", math.ceil(2.3))
# print("math.ceil(2.6) => ", math.ceil(2.6))
#
# # 向下取整
# print("\nmath.floor---")
# print("math.floor(2.3) => ", math.floor(2.3))
# print("mat... | true |
931a80d20b3c316d8e1a98e2e4611536e3daa5b6 | Python | dinhky0204/SoundHandlingPython | /Tkinter/App.py | UTF-8 | 1,740 | 3.15625 | 3 | [] | no_license | from Tkinter import *
import ttk
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack(side = "bottom")
self.initUI()
def initUI(self):
self.entrythingy = Entry()
self.entrythingy.pack()
# Label(self.master, text="First").grid... | true |
14d84a68aaeddc8c5006cecb5875307bb4601e22 | Python | oehoy/voice4you | /voice4u.py | UTF-8 | 3,107 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python #
# -*- coding: utf-8 -*- #
# #
# voice4u.py #
# #
# Copyright 2014 Oehoy <popov.md5@gmail.com> #
# #
#########################################################
import curses, os
screen = curses.initscr()
curses.n... | true |
4e03ffc9700911ef95736e08f250007896b624bb | Python | niolabs/nio | /nio/modules/proxy.py | UTF-8 | 6,241 | 3.375 | 3 | [] | no_license | """
A base class and exceptions for proxies.
"""
from collections import defaultdict
from inspect import getmembers, isclass, isfunction, ismethod, isroutine
from nio.util.logging import get_nio_logger
class ProxyNotProxied(Exception):
""" Exception raised when an operation takes place on an unproxied proxy.... | true |
c1d8b0edb1e8713863d35705b27219e52254eb1c | Python | gukexi/LearningPython | /study_crawler/src/crawl_maoyan_pyquery.py | UTF-8 | 1,948 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on Jul 29, 2019
@author: ekexigu
'''
import requests
import json
from requests.exceptions import RequestException
import time
from pyquery import PyQuery
def get_one_page(url):
try:
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/... | true |
f12a0f2679b34700518093e4db00cd9071935797 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_34/339.py | UTF-8 | 1,143 | 3.234375 | 3 | [] | no_license | def solve(sentence, words, L):
#print "solve(" + sentence + ", " + str(words) + ", " + str(L) + ")"
tokens = parse(sentence)
out = 0
for word in words:
for x in range(L):
works = True
if word[x] not in tokens[x]:
works = False
br... | true |
9b9449c64f8e8cb02505074f156d5bc550278c19 | Python | Prabhanda-Akiri/Data-Mining | /TKU.py | UTF-8 | 8,641 | 2.578125 | 3 | [] | no_license | import numpy as np
import bisect as bi
from random import randint
class transaction:
def __init__(self):
self.items=[]
self.total_utility=0
self.each_utility=[]
#self.transaction_id=0
def extract_elements(self,each_transaction):
S=each_transaction.split(":")
S[0]=S[0].split(" ")
S[2]=S[2].split(" ")
... | true |
9a093e9c00361d829d73e01cb94ab4639004569f | Python | misc77/dsegenerator | /resources.py | UTF-8 | 2,290 | 2.703125 | 3 | [
"MIT"
] | permissive | from pkg_resources import resource_filename
import wx
class Resources:
templatePath = "/input"
outputPath = "/output"
configPath = "/config"
graphicsPath = "/gfx"
logPath = "/log"
configFile = "config.ini"
headerImage = "header.png"
dseTemplate = "dse_template_v.xml"
checklistTempla... | true |
ac6fb2ad0dba521d5bd50ccd8840519774c3677c | Python | lawrennd/GPy | /benchmarks/regression/evaluation.py | UTF-8 | 505 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2015, Zhenwen Dai
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import abc
import numpy as np
class Evaluation(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def evaluate(self, gt, pred):
"""Compute a scalar for access the performance"""
return ... | true |
2fc76d576e26805d20e00b841451af7b79feb6a4 | Python | ricardofelixmont/python-course-udemy | /9-advanced-build-in-functions/generator_classes.py | UTF-8 | 1,976 | 4.71875 | 5 | [] | no_license | #!/usr/bin/env python3.7
# A primeira coisa que precisamos ter em mente é que não precisamos do 'yield' em classes generators. Utilizamos 'yield' apenas em funções.
class FirstHundredGenerator: # Generator/ Iterator
""" Esta é uma classe generator e seus objetos(instancias) tambem pode ser chamados de iterator... | true |
3b08e9d443da72b108c26eb3253fa6a87ac9b1e8 | Python | iamsarahdu/Python | /binary.py | UTF-8 | 121 | 3.65625 | 4 | [] | no_license | n=int(input("Enter the number"))
for I in range(1, n+1):
for J in range(1,I+1):
print(J%2,end="")
print() | true |
6d088106af7d934ee7e24405d301846ee7ef44d6 | Python | jaykooklee/practicepython | /if and.py | UTF-8 | 132 | 2.828125 | 3 | [] | no_license | games = 9
points = 25
if games >= 10 and points >= 20:
print('MVP로 선정되었습니다.')
else:
print('다음기회에') | true |
5e3c5205116c47856e682c480e625587abac3fe5 | Python | rococoscout/Capstone | /PYTHON/vecResponse.py | UTF-8 | 2,383 | 2.890625 | 3 | [] | no_license | from rule import Rule
import numpy
import gensim.downloader as api
from gensim.models.word2vec import Word2Vec
embeds = api.load("glove-wiki-gigaword-50")
#Takes a list of Rules and input question
#Returns a string answer if there were matches
#Returns None if there were no matches
def getVecAnswer(rules, u... | true |
126df9e9f7549d41bd34a3b4e7e810fc68461652 | Python | tdl/python-challenge | /l10_logic.py | UTF-8 | 681 | 3.34375 | 3 | [
"MIT"
] | permissive | def get_digit_count(c, s):
cnt = 0
x = s[cnt]
while x == c:
cnt += 1
if (cnt == len(s)):
break
x = s[cnt]
## print "c=", c, "cnt=", cnt
return (c, str(cnt))
def makenext(s):
cnt = 0
next = ""
while cnt < len(s):
tup = get_digit_count(s[0], s)... | true |
8de5b821202e10f7e829931862069843f37dde6b | Python | brschlegel/Poker | /Hands.py | UTF-8 | 1,904 | 3.453125 | 3 | [] | no_license | from Cards import Card
##I'm just now realizing that there really isn't a reason that all of these classes have to be in different files
##Sorted greatest to least rank
class Hand:
##[hand rank, most important card, 2nd most important, ...]
def __init__(self):
self.cardList = []
sel... | true |
224158db15c8a64463da202750302902321a00eb | Python | whonut/Project-Euler | /problem21.py | UTF-8 | 442 | 3.34375 | 3 | [] | no_license | from math import sqrt
def factor(n):
factors=[1,]
for x in xrange(2,int(sqrt(n))+1):
if n%x==0:
factors.append(x)
if n/x!=x:
factors.append(n/x)
return factors
def d(n):
return sum(factor(n))
amicables=[]
for n in range(1,10000):
if d(d(n))==n and ... | true |
3bf713b0f9b9913610ef939f8998b4300dbd9eb0 | Python | VakinduPhilliam/Python_Runtime_Parameters | /Python_Sys_Namespace_Warnings.py | WINDOWS-1250 | 911 | 3.0625 | 3 | [] | no_license | # Python sys System-specific parameters and functions.
# This module provides access to some variables used or maintained by the interpreter and to functions that interact
# strongly with the interpreter.
# warnings Warning control.
# Warning messages are typically issued in situations where it is useful to alert... | true |
801f71c96b505c6f0f522dac925099fd2718c719 | Python | Cribbee/ZoomInDev | /apps/data_mining/test2.py | UTF-8 | 4,419 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'Cribbee'
__create_at__ = 2018 / 9 / 29
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl #显示中文
from sklearn.model_selection import train_test_split #这里是引用了交叉验证
from sklearn.linear_model import LinearRegression #... | true |
15993955b78e903f89b6e6b3a56df72425a5602a | Python | AustralianSynchrotron/lightflow-epics | /lightflow_epics/pv_trigger_task.py | UTF-8 | 6,430 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | import time
from epics import PV
from collections import deque
from functools import partial
from lightflow.queue import JobType
from lightflow.logger import get_logger
from lightflow.models import BaseTask, TaskParameters, Action
logger = get_logger(__name__)
class PvTriggerTask(BaseTask):
""" Triggers the ex... | true |
7f925c936b36fadf3966699b506fcefc3e7e04f6 | Python | youyong123/pydumpanalyzer | /pydumpanalyzer/frame_test.py | UTF-8 | 986 | 2.90625 | 3 | [] | no_license | ''' contains tests for the Frame class '''
import pytest
from frame import Frame
from variable import Variable
FRAMES_TO_TEST = [
Frame('module', 1),
Frame('module2', 10, 'thefunction'),
Frame('module2', 10, sourceFile='source.cpp'),
Frame('module2', 10, sourceFile='source.cpp', warningAbout... | true |
a1fb993e97a10bbe45d00499dedb32de043c9fae | Python | saiteja-talluri/CS-335-Assignments | /Lab 5/la5-160050098/task.py | UTF-8 | 5,273 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from utils import *
def preprocess(X, Y):
''' TASK 0
X = input feature matrix [N X D]
Y = output values [N X 1]
Convert data X, Y obtained from read_data() to a usable format by gradient descent function
Return the processed X, Y that can be directly passed to grad_descent function
NOTE: X ha... | true |
ef1ced32be2e0b7e189de28ae11fd355212f19c5 | Python | dhockaday/Echonest-TasteProfile-DataLoader | /utils.py | UTF-8 | 670 | 3.234375 | 3 | [] | no_license | import os
import csv
def txt_to_csv(txtfile, csvfile=None):
''' Convert txtfile to csvfile
Params:
txtfile : path to txtfile
csvfile : path to new csvfile
Return :
csvfile : path to saved csvfile
'''
if csvfile == None:
csvfile_name = txtfile.strip().split('/'... | true |
82561228274d57eecd5d0c911c627deaa977cbfc | Python | chelseashin/AlgorithmStudy2021 | /soohyun/python/programmers/0505/수식최대화/1.py | UTF-8 | 2,750 | 2.9375 | 3 | [] | no_license | num_list, op_list = list(), list()
ops = set()
def calc(num_1, num_2, op):
if op == '-':
return num_1 - num_2
elif op == '*':
return num_1 * num_2
else:
return num_1 + num_2
def make_post_prefix(pri_list):
global ops, num_list, op_list
priority = dict()
result... | true |
c698fae7d316bc70f5c4f78da132801be9447a7f | Python | coolmich/py-leetcode | /solu/348. Design Tic-Tac-Toe.py | UTF-8 | 1,703 | 4.1875 | 4 | [] | no_license | class TicTacToe(object):
def __init__(self, n):
"""
Initialize your data structure here.
:type n: int
"""
self.grid = [[0 for i in range(n)] for j in range(n)]
def move(self, row, col, player):
"""
Player {player} makes a move at ({row}, {col}).
... | true |
3056fa403c55d5e8f95f12f2d17136f8f2018b16 | Python | wisscot/LaoJi | /Entrance/Leetcode/0127.py | UTF-8 | 1,518 | 3.640625 | 4 | [] | no_license | # 127. Word Ladder
Basic idea:
typical BFS, find the shorest path
class Solution:
def ladderLength(self, start, end, words):
# write your code here
words.add(end)
# build word patterns mapping
pattern_words = self.buildpattern(words)
res = 0
queue = colle... | true |
c0bc646ed31ac6640ca35c791abf871364e68dcc | Python | Fondamenti18/fondamenti-di-programmazione | /students/1750888/homework01/program02.py | UTF-8 | 4,787 | 3.78125 | 4 | [] | no_license | ''' In determinate occasioni ci capita di dover scrivere i numeri in lettere,
ad esempio quando dobbiamo compilare un assegno.
Puo' capitare che alcuni numeri facciano sorgere in noi qualche dubbio.
Le perplessita' nascono soprattutto nella scrittura dei numeri composti con 1 e 8.
Tutti i numeri come venti, trenta,... | true |
10ec8d222ccd85cd78c95ff81a40036a00a9f499 | Python | andre-jeon/daily_leetcode | /Week 4/4-12-21/sortArrayByParity.py | UTF-8 | 1,294 | 3.859375 | 4 | [] | no_license | '''
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
You may return any answer array that satisfies this condition.
Example 1:
Input: [3,1,2,4]
Output: [2,4,3,1]
The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be... | true |