blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
e40ba25b6abd79e6c9647d7f8f4984bf6d76358e | franklingu/leetcode-solutions | /questions/longest-palindromic-substring/Solution.py | UTF-8 | 1,975 | 3.84375 | 4 | [
"MIT"
] | permissive | """
Given a string s, return the longest palindromic substring in s.
Example 1:
Input: s = "babad"
Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: s = "cbbd"
Output: "bb"
Example 3:
Input: s = "a"
Output: "a"
Example 4:
Input: s = "ac"
Output: "a"
Constraints:
1 <= s.lengt... | true |
08e65ebbdb74d61a6aaa46595e08788ade8858b7 | Aasthaengg/IBMdataset | /Python_codes/p02741/s142111148.py | UTF-8 | 797 | 3.078125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list... | true |
6a84a3c3605a8a0fe388cba3677c9f1822c20c6a | arogovoy/leetcode | /py/pascals-triangle-ii.py | UTF-8 | 523 | 3.109375 | 3 | [] | no_license | from typing import List
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
result = [1] * (rowIndex + 1)
for i in range(2, rowIndex + 1):
prev = 0
for j in range(i):
prev, result[j] = result[j], prev + result[j]
return result
if __name__... | true |
f03c8e3d481551c87345846258dfdfefc223ae5d | gatineausoftware/ludwig_sql | /df_example.py | UTF-8 | 1,819 | 2.53125 | 3 | [] | no_license | from pytz import timezone, utc
from datetime import datetime, timedelta
import pandas as pd
import numpy as np
from feature_store import add_entity_df, get_training_data_set, get_prediction_features
days = [datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0).replace(tzinfo=utc) \
- timedel... | true |
57e6b16b24b54e1c1ac18308f2f5b9474c238020 | DanielHerrera98/computacao_para_ciencia_de_dados | /0_util_libs/libs/utils.py | UTF-8 | 1,583 | 3.25 | 3 | [
"MIT"
] | permissive | import pandas as pd
from scipy import stats
import datetime
import numpy as np
from sklearn import preprocessing
def normalize_dataset(meu_data_frame):
#instanciando o normalizador MinMAx
min_max_scaler = preprocessing.MinMaxScaler(feature_range=(0, 1))
#obtendo as colunas do dataframe
columns = meu... | true |
8870f8069397c549457a28f473a3e47a1cac2b43 | Richiewong07/Python-Exercises | /numpy/Numpy.py | UTF-8 | 780 | 3.9375 | 4 | [] | no_license | import numpy as np
import time
import sys
# SINGLE DIMENSIONAL ARRAY
a = np.array([1, 2, 3])
print(a)
# MULTIDIMENSIONAL array
b = np.array([(1,2,3), (4,5,6)])
print(b)
# range INTERGER VALUES UP UNTIL THAT VALUE
# GETS SPACE OCCUPY BY THE LIST --> getsizeof GETS MEMORY
list = range(1000)
print(sys.getsizeof(5) * l... | true |
584f6745a47b39f18d233cd52f6e99fe943bd490 | taorui666/test | /continue3.py | UTF-8 | 196 | 3.203125 | 3 | [] | no_license | ##a = 0
##for i in range(1,101):
## for j in [5,7,11]:
## if i % j == 0:
## break
## a += i
##print (a)
L=[]
a=input("1")
b=input("2")
c=input("3")
L+=(a)+(b)+(c)
print(L)
| true |
791bd19feb91c88e686598134fd9b1ef6578777c | yminkim/MSM_Macro-PC-ADB- | /007MSM_item_macro(v1).py | UTF-8 | 8,014 | 2.828125 | 3 | [] | no_license | #runas에서 딜레이 추가 및 인덱스 길이에 맞춰 backspace 입력
# sleep 대체 함수 확인
from tkinter import*
import pyautogui
import pyperclip
from tkinter import filedialog
from openpyxl import load_workbook
import os
import tkinter.messagebox
import time
import threading
###############################################
win = Tk()
win.geometry(... | true |
b827d433d7adee7e9c91db99f6bef95768172b3c | BJV-git/amazon_6 | /amazon_6/stock_selling.py | UTF-8 | 150 | 3.09375 | 3 | [] | no_license | # Just add when ever the difference is opsitive
def stock_profit(stocks):
return sum(max(stocks[i+1]-stocks[i], 0) for i in range(len(stocks)-1)) | true |
9afb71885ae3ea3a7bdfedf2f7df77268b5a67c8 | jc4196/pdes | /hyperbolicpde.py | UTF-8 | 10,360 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 7 17:52:20 2019
@author: james
"""
import numpy as np
from scipy import sparse
from scipy.sparse.linalg import spsolve
import sympy as sp
from sympy.abc import x, t, L, c
from IPython.display import display
from helpers import tridiag, numpify_many, numpify, get_error... | true |
0db999a703c355344c14624fcc6b9551a11e303f | Ritvik19/CodeBook | /data/CodeChef/THREEDIF.py | UTF-8 | 126 | 2.9375 | 3 | [] | no_license | for t in range(int(input())):
n1, n2, n3 = sorted(map(int, input().split()))
print((n1 * (n2-1) * (n3-2))%1000000007)
| true |
0baa222d0bee3b6547cd96b95426f7461d5bbc79 | roycek7/machine_learning | /Social Media/46252665.py | UTF-8 | 2,981 | 3.140625 | 3 | [
"MIT"
] | permissive | import math
import multiprocessing
import operator
from collections import deque
import networkx as nx
def get_graph():
graph = nx.Graph()
for line in open('data.txt').readlines():
node = [i for i in map(int, line.split())]
for edge in node[1:]:
graph.add_edge(node[0], edge)
r... | true |
45a168177a252f849e9f95d12da42b441ecca425 | parmarmanojkumar/MITx_Python | /6002x/week1/L2P2.py | UTF-8 | 224 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 20:05:36 2016
@author: VirKrupa
"""
import random
def genEven():
'''
Returns a random even number x, where 0 <= x < 100
'''
return random.randrange(0,100,2) | true |
1d967ee59f263bda7eaf596dafb572979f5a0e62 | SEPalmiere/Seguranca-da-informacao-com-Python | /webScraping/webscraper.py | UTF-8 | 560 | 3.09375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
site = requests.get("https://climatempo.com.br/").content # objeto site recebe o conteudo da requisição http do site
soup = BeautifulSoup(site, 'html.parser') # objeto soup baixa o html dosite
print(soup.prettify()) # transforma a estrutura html em string
#temperatura_h... | true |
b3842a2acbd551710aa3ba6b1b32062c5f461c1e | MartinFask/MapReduce-Distributed-Text-Analytics-on-Yelp-Dataset | /ureducer.py | UTF-8 | 456 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python
import sys
previous = None
sum = 0
for line in sys.stdin:
key, value = line.split('\t')
# if this is the first time we see this key
if key != previous:
if previous is not None:
# if we reach the edge of same keys, then print the previous key and their sum
... | true |
4af2db0d4a41d1f77a7f9a4d0045c43faa611e55 | dgoldsb/advent-of-code-2019 | /day_16.py | UTF-8 | 2,107 | 3.234375 | 3 | [] | no_license | import logging
import numpy as np
from functools import lru_cache
from aocd.models import Puzzle
import aoc
puzzle = Puzzle(year=2019, day=16)
inputs = puzzle.input_data
# PART 1
@lru_cache()
def generate_matrix(length: int):
matrix = []
logging.info("Starting matrix generation of size %dx%d", length, l... | true |
7c33d9d7909b62e52917338cc1870546bca7b926 | renedriessel/KrakenBot | /remote_app.py | UTF-8 | 2,001 | 2.796875 | 3 | [
"MIT"
] | permissive | import data
import brain
import time
from json import JSONDecodeError
from socket import timeout
# Location of data directory and keyfile
datadir = r'/home/craig/KrakenBot/Data/'
keyfile = r'/home/craig/KrakenBot/Key/kraken.key'
# Trading Pairs:
# XETH ZEUR
# XXBT ZEUR
# XLTC ZEUR
# Set trading pair, OHLC timefra... | true |
206987e54ccca810af31b59dd04940af2212260f | corifeo/challenges | /array_left_rotation.py | UTF-8 | 611 | 4.53125 | 5 | [] | no_license | """
Given an array 'a' of 'n' integers and a number 'd' perform left rotations on the array.
Return the updated array to be printed as a single line of space-separated integers.
Probably one of the easiest challenges as of today
"""
def left_rotate(a, d):
return a[-d % len(a):] + a[:-d % len(a)]
# Rotate by 1
p... | true |
6bb414b7aff415559f43b84409b79d10229eb1fe | id774/scripts | /test/test_unixtime2date.py | UTF-8 | 213 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# - * - coding: utf-8 - * -
from nose.tools import *
from unixtime2date import *
def test_unixtime2date():
its = 1406524320
e = '2014/07/28 14:12:00'
eq_(e, unixtime2date(its))
| true |
7ab6e4971d79079882d7687038b7cea732800d7d | ebroebro/swproblem | /백준/baekjoon_2304.py | UTF-8 | 1,357 | 2.859375 | 3 | [] | no_license | #2304. 창고 다각형
n=int(input())
data_list=[]
pst=[] #위치와
height=[] #높이
for _ in range(n):
data = list(map(int, input().split()))
data_list.append(data)
data_list = sorted(data_list)
for i in range(n):
pst.append(data_list[i][0])
height.append(data_list[i][1])
max_index= height.index(max(height)) #가운데 값
<... | true |
e69f40889a21de1fa90e72c945a9cd906f330ef4 | Kseniya-Gonta/SPBU_homeworks | /StochasticProgramming/estimations/helpers.py | UTF-8 | 1,220 | 2.9375 | 3 | [] | no_license | import numpy as np
def centroid(w):
center = np.zeros(w[0].size)
count = 0
for i, x in enumerate(w):
for j in xrange(0, x.size):
a = x[j].astype(int)
center[j] += a
count += 1
for y in range(0, center.size):
try:
center[y] /= count
ex... | true |
b9ff289591c18d04a8b499e6984040d308c2f0e2 | computationalmedia/supmmd | /sup_mmd/model.py | UTF-8 | 14,561 | 2.640625 | 3 | [] | no_license | import torch
from submodular.base import Function
import torch.nn.functional as F
import numpy as np
from copy import copy
from scipy.stats import describe
from commons.utils import get_logger
logger = get_logger("LOSS")
def weights_init(m):
torch.manual_seed(19)
classname = m.__class__.__name__
# m.weight... | true |
9fa83b900bc67480c2d826888b71f3858a190e67 | guilhermebaos/Curso-em-Video-Python | /1_Python/Desafios/077_Vogais_nas_palavras.py | UTF-8 | 450 | 3.09375 | 3 | [
"MIT"
] | permissive | palavras = ('viva', 'oi', 'gostar', 'amar', 'mestres', 'escolheste', 'todos', 'viver', 'nascer', 'certo', 'sistema')
c1 = c2 = -1
c3 = 0
vogais = []
while len(palavras) > c1 + 1:
c1 += 1
while len(palavras[c1]) > c2 + 1:
c2 += 1
if palavras[c1][c2] in 'aeiou':
vogais += palavras[c1][... | true |
0f2847a721bd5ce0cac9890a6e6d16ce022a1046 | yangkky/books | /analysis_2019.py | UTF-8 | 1,103 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
_ = sns.set_style('white')
pal = sns.color_palette()
df = pd.read_csv('books.csv')
df = df[df['date'].apply(lambda x: str(x)[-2:] == '19')]
demo = df[['race2', 'sex', 'Genre']]
demo = demo.rename(columns={'sex': 'gender', 'r... | true |
0fb5525aa6c1f1acbca09572e269b4b318fd128e | B-R-P/AnimPro | /Objects.py | UTF-8 | 7,081 | 2.9375 | 3 | [] | no_license | from utils import *
class BaseElement:
def __init__(self,state,pos,style,screen):
self.current_state = state
self.pos = pos
self.style=style2dict(style.replace(";;",";"))
self.screen = screen
def addAttribute(self,attribute,content):
nattribute = ""
att... | true |
2d57c7221bca2a5db450711024902be2ce72e997 | VitorEmanuelDev/INF032D | /Lista004/03_filmes.py | UTF-8 | 450 | 3.96875 | 4 | [] | no_license | #3. Crie um dicionário vazio filmes = {}. Utilize o nome de um filme como chave. E, como valor,
#outro dicionário contendo o vilão e o ano em que o filme foi lançado. Preencha 5 filmes.
filmes = {"The Queen's Gambit": {"Vasily Borgov": 2020},
"The Mandalorian": {"Moff Gideon": 2020},
"John Wick": {... | true |
586315b83b8d1f296fa3bc2dfb2ce45af5a6f715 | MohamedSaad1976/The-classification-of-employee-attrition | /employees_class_Project.py | UTF-8 | 3,906 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 16 22:55:24 2019
@author: mohamed
"""
import os
os.getcwd()
os.chdir('/Volumes/Work/Data Science/Ml/Project/Classification')
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib as mpl
import matplotlib.pyp... | true |
0d98d1f4b711d2b1022049b7d644bf04cb1ec206 | sorsok/watchyourback | /neural_net.py | UTF-8 | 7,513 | 2.515625 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.eager as tfe
import numpy as np
import pickle
import collections
WHITE, BLACK, CORNER, BLANK, REMOVED = ['O','@','X','-',' ']
ENEMIES = {WHITE: {BLACK, CORNER}, BLACK: {WHITE, CORNER}}
FRIENDS = {WHITE: {WHITE, CORNER}, BLACK:... | true |
469fd83fcc8fdb74a50ce22c09918998ca05d85c | user1231423/python | /Ficha 4/1_A.py | UTF-8 | 207 | 4.09375 | 4 | [] | no_license | for i in range ( 1, 6 ):
print "i -> ", i
for j in range ( 1,4 ):
print "j-> ", j
if ( i % j ) == 1:
print "Resto da divisão entre ", i , "e ", j ,"= ", i+j | true |
4262f360c96a007538207002b4339e8624260c90 | stomaras/Machine-Learning | /DataPreprocessing/DataFrames2/Sampling.py | UTF-8 | 4,630 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 20:19:57 2020
@author: sptom
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 17:07:31 2020
@author: sptom
"""
import pandas as pd
import numpy as np
df = pd.read_csv('C:/Users/sptom/Music/PythonForMachineLearning-master/Part1/tr.csv',delimiter=';')
# Get th... | true |
0fa23136d528173f543bbc0e5f3fc053c8ece322 | Phystro/gphysics | /crystal_lattice/lattice.py | UTF-8 | 542 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
from vpython import *
import vpython as vp
L = 4
Rs = 0.25 # radius of sodium atom
Rc = 0.50 # radius of chlorine atom
alt = 1 # alternating factor
for i in range(-L, L+1):
for j in range(-L, L+1):
for k in range(-L, L+1):
if alt == 1:
... | true |
6d28799f77928e62c9057a03b6bb44f46420cf2b | cicihou/LearningProject | /leetcode-sql/182. Duplicate Emails.py | UTF-8 | 300 | 2.625 | 3 | [] | no_license | '''
# Write your MySQL query statement below
My Solution:
SELECT a.Email AS Email
FROM
(SELECT Email,
count(*) AS c
FROM Person
GROUP BY Email
HAVING c > 1) a
Reference Solution(I think it's better):
select Email
from Person
group by Email
having count(Email) > 1
'''
| true |
99dad8798f6439ada62520a86da5083155a930aa | dltech-xyz/Alg_Py_Xiangjie | /第4章/duilie.py | UTF-8 | 2,609 | 3.796875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
'''
@version:
@Author: steven
@Date: 2020-05-27 22:20:22
@LastEditors: steven
@LastEditTime: 2020-06-10 10:27:24
@Description:LILO队列
'''
from queue import Queue #LILO队列
# q = Queue() #创建队列对象
q: "Queue[int]" = Queue() #https://stackoverflow.com/questions/59689524/how-to-add-variable-... | true |
c91e9c9a7418964b6850813d6f6519fb4ba04494 | heitorchang/learn-code | /battles/filomenafirmeza/digits/directionOfReading.py | UTF-8 | 1,505 | 4.375 | 4 | [
"MIT"
] | permissive | description = """
You have an array of non-negative integers numbers, each less than 10numbers.length. Add leading zeros if necessary so that for each i, numbers[i] has exactly numbers.length digits. Now, write these integers under each other in the same order that they appear in the input array.
From this process, yo... | true |
a5011b9df26086af7b99fa27836d8cc6e4915a78 | dschaefer/ttlComputer | /burner/burn.py | UTF-8 | 1,063 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
import serial
import time
import random
def write_word(ser, word):
ser.write([word & 0xff, word >> 8])
with serial.Serial('/dev/cu.usbmodem14301', 115200) as ser:
# Need to read the first byte to prime the channel
c = ser.read()
ser.write(b's')
line = ser.readline()
pr... | true |
d10804ad3290815e6d9a97bdf0955a45112f62bd | csmedao/django_projects | /django_projects/pagination_test/paginator_test/views.py | UTF-8 | 1,144 | 2.671875 | 3 | [] | no_license | from django.shortcuts import render
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
# Create your views here.
def index(request):
obj_list = ['page01','page02','page03','page04','page05','page06','page07','page08','page09','page10',
'page11','page12','page13','page14','p... | true |
f23c0d743f674a63e5a993fcb9639de497dec1b3 | R-aryan/Fun_with_Automation | /email_phone.py | UTF-8 | 1,168 | 2.953125 | 3 | [
"MIT"
] | permissive | import re
import pyperclip as pclip
#to create regex of phone numbers re.verbose is used to reduce th complexity of the regular expressions
phregex= re.compile(r'''(((\d\d\d)|(\(\d\d\d\)))? #area code (may be optional)
(\s|-) #first seperator
\d\d\d - \d\d\d\d # first 3 digits and last four digits
(((ext(\.)?... | true |
a444e2bf4cbbc2565312da2dd991101de78246ad | HunDeMingMingBaiBai/competitions-v2 | /src/apps/competitions/unpackers/utils.py | UTF-8 | 1,250 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import logging
import os
import shutil
from dateutil import parser
from django.utils import timezone
logger = logging.getLogger()
class CompetitionUnpackingException(Exception):
pass
def zip_if_directory(path):
"""If the path is a folder it zips it up and returns the new zipped path, other... | true |
2665f971569a5651304b5f385bc25aa3661d00c0 | samguns/ml_ex_in_python | /ex2/cost_function.py | UTF-8 | 1,352 | 2.90625 | 3 | [] | no_license | import numpy as np
from sigmoid import sigmoid
def cost_function(theta, X, y):
m = len(y)
grad = np.zeros(theta.shape)
g = sigmoid(np.dot(X, theta))
j0 = np.dot(np.transpose(y), np.log(g))
j1 = np.dot(np.transpose(1 - y), np.log(1 - g))
j = (-j0 - j1) / m
grad = np.dot(np.transpose(X), (... | true |
b681ebb3c83167b573a3fa9078f8b7d19000c3d8 | SargRub/MachineLearning | /homework_1/main.py | UTF-8 | 132 | 3.03125 | 3 | [] | no_license | language = input()
with open(f'{language}.text', 'r') as file:
data = file.readlines()
for line in data:
print(line) | true |
67c5e2707da69c2936a03b99deedc2a6af7701f8 | ASIMER/Logika | /python_pro/while_loop/task_20_optional.py | UTF-8 | 309 | 3.96875 | 4 | [] | no_license | """
Числа Фибоначчи
Используя цикл while, напиши программу,
которая выводит на экран ряд Фибоначчи до 10-го члена ряда.
"""
a, b = 1, 1
print(a, b, sep="\n")
n = 3
while n <= 10:
a, b = b, a+b
print(b)
n += 1
| true |
5bef79ee463b62e21afea8649c8e97b3c9d6e8af | romanoks/FlaskTask | /resources/WhitelistData.py | UTF-8 | 329 | 2.625 | 3 | [] | no_license | from app.application import db
class WhiteList(db.Model):
__tablename__='whitelist'
id = db.Column(db.Integer, primary_key=True)
command = db.Column(db.String)
def __init__(self, id, command):
self.id = id
self.command = command
def __repr__(self):
return '<id {}>'.format... | true |
40380a06b8318aca0e3e46d54e66b164bfe90458 | Rajachellan/numpy_advanced_project | /q01_get_total_deliveries_players/build.py | UTF-8 | 268 | 2.546875 | 3 | [] | no_license | # Default imports
import numpy as np
ipl_matches_array = np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")
def get_total_deliveries_played(player):
return np.sum(np.where(ipl_matches_array[0:,13]==player,1,0))# Your Solution
| true |
165c74c62bb94dd734016f57a0d94ca24f20a2f4 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2731/60649/258582.py | UTF-8 | 232 | 2.859375 | 3 | [] | no_license | from collections import Counter
T=int(input())
for i in range(T):
N=int(input())
l=list(map(int,input().split()))
count=Counter(l)
s=set(l)
sum=0
for item in s:
sum+=(count[item]//2)*2
print(sum)
| true |
332a9ea3d4a59e8ac56174e0ce7c35b4816932e2 | joo-14/NLP_MVA | /MVA_TD2_LEVY_John/system/PCFG_Gramar.py | UTF-8 | 4,170 | 2.875 | 3 | [] | no_license | import numpy as np
import nltk
import nltk.tree as Tree
from nltk import treetransforms, induce_pcfg, Nonterminal
class PCFG():
"""
Our PCFG is given by gramar where terminals are part-of-speech tags
The probabilistic lexicon i.e. triples of the form (token, part-of-speech tag, probability) such that the sum of t... | true |
749579d47ddeeba36dc0d7f5c77c2937d7045166 | OGluffy/maryvillework | /golf-helper.py | UTF-8 | 643 | 3.578125 | 4 | [] | no_license | print('Welcome to the Golf Club Helper!',
'\n Tell me your situation, and I\'ll recommend a Club\n')
ball_on_Green = input("Did you hit it in the green (y/n)? ") == 'y'
distance_ball_hit = int(input('How far is the ball form the hole? '))
recommended_club = None
if ball_on_Green:
recommended_cl... | true |
f2b4d92459a3b0cf2a4a47ce8e02f129706995d6 | ZimingGuo/MyNotes01 | /MyNotes_01/Step02/3-Python_Net/day02_06/stick_send.py | UTF-8 | 324 | 2.609375 | 3 | [] | no_license | # author: Ziming Guo
# time: 2020/3/18
'''
stick_send 粘包发送端演示
'''
from socket import *
from time import *
sockfd = socket()
server_addr = ('127.0.0.1', 8889)
sockfd.connect(server_addr)
while True:
sleep(0.3) # 每隔0.3秒发送一次,明显发送速度大于接收速度
sockfd.send(b'hahaha')
| true |
151f8c148647d0c6210a931a6ddbcf4f4c94cb62 | zengxingchen/iGEM-Model | /process_two/gluSensor/Ribosome.py | UTF-8 | 3,684 | 2.921875 | 3 | [] | no_license | import random
from Protein import Insulin
class Ribosome:
def __init__(self, position):
"""
Args: mrna: the mRNA the Ribosome is going to translate
target: the destination, we have two possible values {mrna.start, mrna.end}
"""
self.pos... | true |
b2431e00cbccad39108b1bf0d14416f8e7cf1010 | tleparmentier/rap_lyrics_generation | /create_df_of_word_type.py | UTF-8 | 1,295 | 2.8125 | 3 | [] | no_license | import pandas as pd
import sys
if __name__ == "__main__":
if len(sys.argv) != 2:
print('Erreur : Arguments invalides : ')
print('\t python create_df_of_word_type.py rappeur.txt')
sys.exit(1)
file_name_txt = sys.argv[1]
file_name = file_name_txt.split('.txt')[0]
structure_phrase... | true |
ba5d7077fdf24794b29cada3c3d2bb384dea0377 | 1456095597/algorithm | /二叉树深度.py | UTF-8 | 251 | 2.765625 | 3 | [] | no_license | def kkk():
a=list(input().split(","))
if a[0]=="{}":
return 0
b=len(a)
i =1
j=1
while b>0:
b=b-i
i=i*2
j+=1
return j-1
while True:
try:
print(kkk())
except:
break | true |
8664bc53ba6cf2593dc1546480a9b41c1a2f337b | luivilella/flask-boilerplate | /application/app/auth/views/users.py | UTF-8 | 3,945 | 2.515625 | 3 | [
"MIT"
] | permissive | from http import HTTPStatus
from cerberus import Validator
from flask import request
from flask_login import login_user
from flask_login import login_required
from flask_login import logout_user
from . import auth
from ..models import User
from ... import db
from ...utils.views import BaseView
def _user_to_dict(user)... | true |
8614c4e601651d4dae60c59c7fa83c2100946f83 | krenevych/ClassWork | /Mat/L6/l6_6.py | UTF-8 | 259 | 3.375 | 3 | [] | no_license |
s = input()
s1 = ""
for c in s:
if c.isalnum() or c == " ":
# if ("a" <= c <= "z" or
# "A" <= c <= "Z" or
# "0" <= c <= "9" or
# c == " "):
s1 += c
lst = s1.split()
n = len(lst)
print(n)
| true |
6e17de2e96f62a6fbda0624d70300fc93529b30e | nitsas/py3algs | /py3algs/datastructs/binary_search_tree.py | UTF-8 | 4,101 | 4.28125 | 4 | [
"MIT"
] | permissive | """
A simple binary search tree implementation.
Operations:
- __len__
- __contains__
- root
- insert
- find
Author:
Chris Nitsas
(nitsas)
(nitsas.chris)
Language:
Python 3(.4)
Date:
May, 2016
"""
__all__ = ['BinarySearchTree', 'BinarySearchTreeUsingNodes', 'Node']
class Node:
"""
A node in the... | true |
3be468f9b0b54fbe2fa369980766276c114d21ee | Eyepea/aiocouchdb | /aiocouchdb/errors.py | UTF-8 | 3,991 | 2.59375 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
"""
Exception hierarchy
-------------------
.. code::
BaseException
+-- Exception
+-- aioht... | true |
467ab46c484d910ecc417b9d3b749fda60da0c00 | ZiningZhu/Leetcode | /003-longest-substr-no-repeat/3-longest-substr-no-repeat.py | UTF-8 | 522 | 3.109375 | 3 | [] | no_license | class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
noreplist = []
ans = 0
for i in range(len(s)):
if s[i] in noreplist:
n = noreplist.index(s[i])
noreplist = noreplist[n+1... | true |
4bde12105d98163a02492f9d386cc6a926607e74 | jitendra93/DSA | /code/search/search_ternary.py | UTF-8 | 725 | 3.9375 | 4 | [] | no_license | a = [1,4,6,7,8,23,56,344,444,552,634,764,866,879,999,3645,4567,6587,7890,9996,999999]
def ternary_search(a,left,right,key):
if(left <= right):
mid1 = left + int((right - left)/3)
mid2 = right - int((right - left)/3)
if(a[mid1] == key):
return mid1
elif a[mid2] == key:... | true |
451554bcb2d57359bafd9e88b2227f1ef1e321ef | MitchellDennis/Mitchell_Dennis_CP1404_pracs | /prac_01/shop_calculator.py | UTF-8 | 1,196 | 4.3125 | 4 | [] | no_license | """
Shop Calculator
"""
total_cost = 0 #used to sum up total cost
after_discount = 0.9 #used to determine the price after input (1-0.1)
verify_int_input = 0 #Used to determine if initial input is int
while verify_int_input < 1:
try:
no_of_items = int(input("Enter number of items... | true |
8060c7c21feb0ed7c223c93e79cd8fdfa906580c | mariabuechner/lara_reco_code | /Clean_code/Generating_phantom/generate_phantom_volumes.py | UTF-8 | 2,837 | 2.53125 | 3 | [] | no_license | import sys
import numpy as np
from init_obj import *
from att_coef_object import *
from math import sin, cos, pi
import h5py
TYPE = 'float64'
if __name__ == '__main__':
# file name to save phantom data
phantomFileName = 'phantom.h5'
phantomUseFile = False
# object parameters
obj = {}
... | true |
abc5030d55017abd231aec933fdcb05be66e363c | ciastkoMalinowe/PImage | /project/face_swap.py | UTF-8 | 6,182 | 3 | 3 | [] | no_license | import numpy as np
import cv2
"""
scale = 4
def paste_ellipse(destination, source, h, w):
ellipse = np.zeros((h,w,3))
cv2.ellipse(ellipse, (h / 2, w / 2), (h / 4 + h / 8, w / 2), 0, 0, 360, (0, 255, 0) ,-1)
for i in range(h):
for j in range(w):
if(ellipse[i, j, 1] != 0):
... | true |
2353d0333265dd185ad35e458b6f19ca0b3e5a5a | Black-Malang-cow/MSE_Python | /ex030.py | UTF-8 | 389 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
string = 'abcd' #변수 string을 문자열 'abcd'로 지정한다 #3번
string.replace('b', 'B') #string 에 들어가 있는 b 를 B로 바꾼다
print(string) #string을 출력한다
# 결과는 원본과 같을 것이다. 문자열은 변경할 수 없는 자료형중에
# 한종류 이기 때문이다.
| true |
7989b88bf2fdf48e160eb8440ddeece13c2deece | mindspore-ai/models | /research/nlp/transformer_xl/src/metric/calc.py | UTF-8 | 1,467 | 2.671875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | permissive | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | true |
de5aa7aa95ab70c06b37aed41eae250cd0a9586b | Burence1/password-locker | /user_test.py | UTF-8 | 2,304 | 3.21875 | 3 | [
"MIT"
] | permissive | import unittest
from user import Users
class TestingUsers(unittest.TestCase):
'''
class that defines Users class test cases
Args:
unittest.Testcase: aids in creating test cases
'''
def setUp(self):
'''
method that runs before each test case
'''... | true |
3cb59a14c075c1b4c334d55236f93f83142af4f9 | zyzdisciple/time_series | /net_flow/fbprophet/predict.py | UTF-8 | 1,846 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
from fbprophet import Prophet
import time
def parser(time_stamp):
return time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(int(time_stamp) // 1000))
def src_data():
series = pd.read_csv('data/new_flow_prepare.csv',
#将... | true |
aece46cb4520da1f2932275778195e358a45516b | ancient-lives/altk | /altk/filemanager.py | UTF-8 | 8,974 | 2.828125 | 3 | [
"MIT"
] | permissive | import math
import unicodedata
import codecs
import glob
import os
import operator
import datetime
from tqdm import tqdm
class FileManager(object):
'''[summary]
The FileManager object manages the read / write operations on the filesystem.
'''
# I/O directories
_click_dir = 'clicks/'
_consensu... | true |
85fa1a1c980a43fb11df2dc2a841ccdab3edb068 | lux-coder/python3tasks | /2task.py | UTF-8 | 4,928 | 2.578125 | 3 | [] | no_license | import psycopg2
from multiprocessing import Process
from multiprocessing import current_process
import string
import random
import threading
import schedule
import sched
import time
import logging
from time import sleep
import configparser
class Message:
def __init__(self):
self.message = ''
... | true |
3d926269cca3dc4e1005c4511fe985e04cc12b93 | PeterGrainfield/AltCoder | /py/arc080_a.py | UTF-8 | 227 | 2.921875 | 3 | [] | no_license | N = int(input())
la = list(map(int, input().split()))
r = [0]*4
for a in la:
r[a % 4] += 1
if r[1]+r[3] == r[0] + 1 and N == r[1]+r[3]+r[0]:
print("Yes")
elif r[1]+r[3] > r[0]:
print("No")
else:
print("Yes")
| true |
f66bb29f230d6e651149de640798a4f48f5167ce | NathanLHall/Scheduling-Problem | /Scheduling Problem/mathSchedule_v2.py | UTF-8 | 26,327 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 15 04:17:06 2018
@author: NathanLHall
"""
import copy
import csv
from drawnow import *
import math
import matplotlib.pyplot as plt
import os
import random
import time
# =============================================================================
# User Variables
# ====... | true |
8b222cae4ec7e0cad604eaf756e09f573484cd77 | ananthuk7/Luminar-Python | /operators/logicaloperators.py | UTF-8 | 91 | 3.3125 | 3 | [] | no_license | # bitwise operation
# & | ^
print(3 & 4)
print(3 | 4)
print((3 ^ 4))
print(~3)
# 011
# 100 | true |
64e2d39ce547367485c9392450e4f111984ea1a5 | sugat009/library_management_system | /my_app/backup.py | UTF-8 | 3,331 | 2.84375 | 3 | [] | no_license | # prediction = predict_itembased(4, '104761', ratings_matrix)
# # This function utilizes above functions to recommend items for item/user based approach and cosine/correlation.
# # Recommendations are made if the predicted rating for an item is >= to 6,and the items have not been rated already
# def recommendItem(user... | true |
1dd2c138d6c6f034e66d48d08368bcd0710920aa | luwening/RNA-Seq-RP-Pseudogenes | /genomeSearch.py | UTF-8 | 1,579 | 2.84375 | 3 | [] | no_license | #!/usr/local/bin/python
genomeLocation = "/zhang/ptonner/hg18/"
chromosomes = ["chr1","chr2","chr3","chr4","chr5","chr6","chr7","chr8","chr9","chr10","chr11","chr12","chr13","chr14","chr15","chr16","chr17","chr18","chr19","chr20","chr21","chr22","chr23","chrX","chrY","chrM"]
genome = dict()
visited = []
def readChro... | true |
04749f7398451e1e01cd256e1778cf10701f0637 | Nick-Lrc/kano_hanayori_twitter | /src/tweet.py | UTF-8 | 2,817 | 2.640625 | 3 | [] | no_license | import os
import re
from datetime import datetime
from common import get_hashtag_hyperlink, get_mention_hyperlink, get_hyperlink_tag, hyperlink_text, add_classes
THUMBNAIL_SUFFIX = '_thumb'
def get_hashtag_hyperlinks(text):
links = {}
hashtags = re.findall(r'#(\w+)', text)
for hashtag in hashtags:
... | true |
636663ea6e3c3e0477f3dc33a6d1e7663bcde6b8 | orike122/Anylink | /Anylink-server/auth.py | UTF-8 | 3,953 | 2.828125 | 3 | [
"MIT"
] | permissive | import base64
import paramiko
import logging
from database import Database
import types
import typing
class Authorization(paramiko.ServerInterface):
"""Class for authorizing SFTP requests"""
def __init__(self, database: Database, set_auth_method: types.FunctionType):
"""
C'tor for Authorizati... | true |
2fd7809ec8275776f220dacabdf126bb03446faa | samuelstanton/model-zoo | /model_zoo/utils/data/seq_dataset.py | UTF-8 | 10,113 | 2.703125 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
import torch
from torch.utils.data import Dataset, WeightedRandomSampler, BatchSampler, DataLoader, TensorDataset
class SeqDataset(Dataset):
"""
Data structure for learning from sequential data, subclasses torch.utils.data.Dataset.
Train/holdout splits are performed at th... | true |
172085914a8d0c856c2cdeab8833510124229871 | BGCX067/eyercbot-svn-to-git | /branches/1.0/setup.py | UTF-8 | 5,437 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# EyeRCbot setup script
# subEyeRCbot derived from version 0.9.9.1
# Will ask bot set up questions
# Then will connect to server and open communication with the user to set password and hostmask
# This is a minimal version of the EyeRCbot and the User plugin
print 'Loading...'
import sys
sys.path... | true |
c221d1471fab84eb941ac84310d44c2a25d2ff7d | CiaoCiao11/excel | /excel.py | UTF-8 | 560 | 3.296875 | 3 | [] | no_license | from openpyxl import Workbook
wb = Workbook()
ws1=wb.create_sheet('Mysheet')#默認插入到最後
ws2=wb.create_sheet('Mysheet1',0)#指定插入到第一個位置
# grab the active worksheet
ws = wb.active
ws.title='New Title'
ws3=wb['New Title']
# Data can be assigned directly to cells
ws['A1'] = 'chinese'
ws['B1'] = 'english'
ws['C1'] = 'math'
ws... | true |
d02cd7c412b73200b92049c022be603482706129 | aneetta2/assignment-wed | /deleteset.py | UTF-8 | 193 | 3.328125 | 3 | [] | no_license | dict={'a':1,'b':2,'c':3,'d':4,'e':5}
rem_list=['b','c','d']
print("the orginal dictionary is:"+str(dict))
[dict.pop(key)for key in rem_list]
print("dictionary after removal of keys:"+str(dict)) | true |
abaf3571639c70de2cc55042de8ad8cbbecc1642 | BojanF/nba_players_points | /Persistance/season_repository.py | UTF-8 | 879 | 3.078125 | 3 | [] | no_license | from Services.db_connection import connection
def insert(season):
with connection.cursor() as cursor:
# Create a new Season record
sql = "INSERT INTO seasons (`name`, short) VALUES (%s, %s)"
cursor.execute(sql, (season.full, season.short))
# connection is not autocommit by default. So ... | true |
0bb26eb4fe891c4581c7a5fe69810da567d33ccb | ameerhkhan/Django-Practice-Exercises | /second-django-app/personal_portfolio/blog/views.py | UTF-8 | 2,542 | 2.796875 | 3 | [] | no_license | from django.shortcuts import render
from blog.models import Post, Comment
from blog.forms import CommentForm
# Create your views here.
def blog_index(request):
posts = Post.objects.all().order_by('-created_on') # obtain a query set containing all the posts in the database.
... | true |
cb822a74a2a42b8a0c25dd96352e48b5199ae896 | WillMc93/AS.605.620 | /Project3/code/LCS.py | UTF-8 | 2,362 | 3.703125 | 4 | [] | no_license | """
Functions to calculate and return the LCS of two given sequences.
@authour Will McElhenney
@date 12/1/2019
"""
"""
Function to make an empty matrix for lcs calculation.
@param m: length of sequence 1, rows
@param n: length of sequence 2, cols
@ return an initialized m-by-n 2d list
"""
def init_matrix(m,n, fill_... | true |
d8e0de6c96737342a88a46e937f7ad7b69fa4d32 | packerliu/forward-cicd-ansible | /sandbox_config_build.py | UTF-8 | 1,600 | 2.890625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | #!/usr/bin/env python
import argparse
# Parse command-line arguments
parser = argparse.ArgumentParser()
parser.add_argument(
"name",
help="The firewall name ")
args = parser.parse_args()
#
# This script adds the new security rule and new service object to the fw config
# by replacing the top most line (iden... | true |
4113287733cf39cd40c74ee8dade398ba018c6e2 | wu7052/spider | /venv/Scripts/data_processor/database.py | UTF-8 | 685 | 2.8125 | 3 | [] | no_license | import pymysql
class DB_OP:
def __init__(self, host='localhost', db='mysql', user='root', pwd=None):
self.host = host
self.db_name = db
self.user = user
if pwd is None:
print("[Err DB_OP]===> {0}:{1}:{2} need password ".format(host, db, user))
else:
... | true |
b5ead7309f5fed69913f1107877442e23747c294 | kdeloach/labs | /python/sqlsandbox/sqlsandbox/gendb.py | UTF-8 | 3,235 | 2.84375 | 3 | [] | no_license | from sqlalchemy import *
import simplejson as json
import random
import datetime
NUM_TEST_ROWS = 50
def getcoltype(coltype):
coltype = coltype.lower()
if coltype == 'bigint' or coltype == 'biginteger':
return BigInteger
elif coltype == 'bool' or coltype == 'boolean' or coltype == 'bit':
... | true |
705084b376e121f1fb592f0b5d239e106f4c00a2 | LucaPavoneDev/FlyingTravelAgency | /cl_Products.py | UTF-8 | 13,308 | 3.46875 | 3 | [] | no_license | # Product Object Classes
from cl_Data import database as db
from datetime import datetime as dt
class Product(object):
def __init__(self):
# Create Product ID Number
self.pid = db.appendToList(db.prodList,self)
# Create Product Essentials
self.name = ""
self.... | true |
f8f32ca16c6006d44fec364969f2fd86407f9618 | dilettagoglia/Signal-Processing | /midterm1/sift.py | UTF-8 | 5,798 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import cv2
import glob #module that finds all the pathnames matching
from matplotlib import pyplot as plt # importing library for plotting
''' SIFT PERFORMING
Detecting some relevant points by using SIFT detector and placing a SIFT descriptor
on eac... | true |
e5d3d603287610d917995ae7540a273df38e8b85 | yves-weissenberger/pycontrol_homecage | /src/pycontrol_homecage/com/dumb_serial_reader.py | UTF-8 | 267 | 2.53125 | 3 | [] | no_license | import serial
import time
ser = serial.Serial('/dev/cu.usbmodem14142')
while True:
try:
if ser.inWaiting():
print(ser.read(ser.inWaiting()),)
time.sleep(0.05)
except OSError:
ser = serial.Serial('/dev/cu.usbmodem14142')
| true |
4e1bd567576c6f3250053f7163d05bded4913c88 | thamsuppp/PWBM-Flask-Blog | /flaskblog/__init__.py | UTF-8 | 2,421 | 2.515625 | 3 | [] | no_license | from flask import Flask, send_from_directory
from flask_sqlalchemy import SQLAlchemy
#For hashing passwords
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from flaskblog.config import Config
import dash
from flask.helpers import get_root_path
from flask_login import login_required
db = SQLAlche... | true |
a45a06318dd0854032d86780cc1cbe308bbb301a | capocchi/DEVSimPy-lib-socket | /server2.py | UTF-8 | 1,006 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
import SocketServer
import json
import sys
class MyTCPServer(SocketServer.ThreadingTCPServer):
allow_reuse_address = True
class MyTCPServerHandler(SocketServer.BaseRequestHandler):
buf={}
def handle(self):
try:
data = json.loads(self.request.recv(1024).s... | true |
eae7167887e3b8909cffb25aae4dc91015cc8212 | pombredanne/rebrand | /rebrand/rebrand.py | UTF-8 | 6,974 | 2.625 | 3 | [] | no_license | import os
from colorama import Fore
from collections import defaultdict
import os
import string
import re
import shutil
from pathlib import Path
from pprint import pprint
from textsearch import TextSearch
BOUNDS = set(string.digits + string.ascii_letters)
BLOCKED = set(["node_modules", ".git", "__pycache__"])
def h... | true |
e23d425e626859961ffe1ddb6c3b2a06e563a2dd | Pavel-Bylkov/easy_paint | /paint.py | UTF-8 | 10,870 | 2.8125 | 3 | [] | no_license | from tkinter import *
from tkinter import filedialog, colorchooser
import io
from PIL import ImageTk, Image # pip install pillow
from constants import COLORS
# ToDo Доделать открытие файла (Открытие для редактирования)
class MyEvent:
def __init__(self, x, y):
self.x = x
self.y = y
class Queue... | true |
19f18b1622ebd207b14216a9fc8df25bfeaa92c2 | xingyaochen/StarWarsJumping_CS5_Final | /menus.py | UTF-8 | 660 | 2.984375 | 3 | [] | no_license | from visual import *
def introMenu():
"""displays an intro menu. Prompts the user to press a key.
If that key is 'g', returns True for grutor mode."""
autoscale = False
#construct the menu
menu = box(pos=(0,0,-10), up=(0,0,1), length=90, width=90, height = 0.5, color=color.white, material = materi... | true |
d6776586fb9b9980d62863234d2efecdd18b1c75 | eliyahudev/social_network | /srt_to_exel.py | UTF-8 | 2,367 | 3.15625 | 3 | [] | no_license | import pandas as pd
import re
# & functions & #
def getTextBlock(srt_file):
""" make an array from srt file
# input: srt file
# return: list of strings"""
f = open(srt_file, 'r')
x = f.read().split('\n\n')
f.close()
return x
def srt_to_df(srt_file):
"""" make lists for the columns of... | true |
ca81e57975bcf7813730e51378deac84662e6ad7 | raven1989/algorithms | /beatStock.py | UTF-8 | 543 | 3.828125 | 4 | [] | no_license | #!/usr/bin/python
def beatStock(stock):
'''Given an array indicates stock prices of consecutive days, find the best time to buy in and that to sell out.'''
n=len(stock)
buy=0
sell=0
minimum=0
max_dif=stock[sell]-stock[buy]
for i in xrange(0,n):
if(stock[buy]>stock[i]):
minimum=i
diff=stock[i... | true |
8e88e3edfe7cc45c4a0faf9851c27d0ad334356c | abhis021/Python | /pythonlivecaption.py | UTF-8 | 1,034 | 2.625 | 3 | [] | no_license | # pip install SpeechRecognition PyAudio
# Make sure to update the device_index on line 34, to reflect the stero mixer on your computer
import concurrent.futures
import speech_recognition as sr
import time
import logging
logging.basicConfig(
level=logging.INFO, format="%(asctime)s: %(levelname)s - %(message)s"
)... | true |
b8765f34fb9a15e38fb1a743bd9131681d1c304f | norbertosanchezdichi/TIL | /Python3/Exercises/ListIteration/list_iteration.py | UTF-8 | 180 | 2.8125 | 3 | [
"MIT"
] | permissive | sounds = ["super", "cali", "fragil", "istic", "expi", "ali", "docious"]
result = ''
for fragment in sounds:
result += fragment
result = result.upper()
print(result) | true |
4f223e55d200b43c4245e8a34ec4acd7a1a0e7dd | stevalang/Coding-Lessons | /SoftUni/Python Developmen/Python-Fundamentals/04_Lists/numbers_filter.py | UTF-8 | 615 | 3.3125 | 3 | [] | no_license | lines = int(input())
my_list = []
filtered = []
for _ in range(lines):
number = int(input())
my_list.append(number)
command = input()
if command == 'positive':
for number in my_list:
if number >= 0:
filtered.append(number)
elif command == 'negative':
for number in my_list:
if... | true |
accd567f30b3ca63681c3155ce021d4f4683e1f5 | mahtat555/HttPy | /httpy/httpmessage.py | UTF-8 | 9,062 | 3.578125 | 4 | [
"MIT"
] | permissive | """In this module, we define classes that implement the HTTP messages
(Requests and Response).
"""
import abc
from json import loads, decoder
from base64 import b64encode
class HTTPMessage:
""" Asynchronous HTTP Message.
This class is used to create a valid and async HTTP Message
(Request or Response).... | true |
d60ceb85c330376e8ea7c55229ab93d609ea3c9f | hackerAlice/coding-interviews | /程序员面试金典/01.07. 旋转矩阵/旋转矩阵.py | UTF-8 | 447 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
from typing import List
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
if not matrix:
return
n = len(matrix)
temp = [[0] * n for _ in range(n)]
... | true |
7c5d798e42d3636b974c82ca75ee7254411bdcba | sithart/python_examples | /else_clause.py | UTF-8 | 402 | 3.125 | 3 | [] | no_license | # INITIAL CODE
from csv import reader
opened_file = open('AppleStore.csv')
read_file = reader(opened_file)
apps_data = list(read_file)
for app in apps_data[1:]:
price = float(app[4])
# Complete code from here
# print(app)
if price == 0.0:
app.append('free')
else:
app.append('non-fre... | true |
57505b195d87f52ae52d1faba2d7b5f2771e8252 | Mayeen4536/CSE-422-Artificial-Intelligence-Lab-works | /Lab 1 BFS/level1.3.py | UTF-8 | 1,672 | 3.234375 | 3 | [] | no_license | a_dict = {}
file = open("input3.txt")
for line in file:
a = line.split()
if int(a[1]) in a_dict:
a_dict[int(a[1])].append(int(a[0]))
else:
a_dict[int(a[1])] = [int(a[0])]
distances = []
def bfs(nodes, a_dict, lina_position , nora_position, parent, dist):
visited = [False fo... | true |
8b9932e1f03e849708ad77ad29a40dbf6c185e30 | JochenHinz/MAPPING | /reparam.py | UTF-8 | 7,993 | 2.75 | 3 | [] | no_license | import numpy as np
import scipy as sp
import utilities as ut
from nutils import *
from problem_library import Pointset
from auxilliary_classes import *
class reparam(object):
@staticmethod
def reparam(method, dc_indicator, info):
if method == 'standard':
return std_reparam(dc_indicator, *i... | true |