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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2e0cb91fc6d170b24a53da28024100ff82042c44 | Python | PauloMesquita/security-tools | /mac-changer/mac-changer.py | UTF-8 | 2,254 | 2.890625 | 3 | [] | no_license | import argparse
import subprocess
import sys
import re
def run_terminal_command(commands_array):
try:
result = subprocess.check_output(commands_array, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
error_message = e.output.decode("utf-8")
if "Operation not permitt... | true |
028f09284ec14a73ea2dc8d0df05d5a967af82f7 | Python | conceptslearningmachine-FEIN-85-1759293/skills-for-planning | /test/test_classifier.py | UTF-8 | 1,836 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import torch
import torchvision
from torchvision import datasets, transforms
from tqdm import tqdm
from learners.classifier import Network, Trainer, Sample
from learners.util import get_batch
def test_network_single():
ndim_x = 28*28
n_actions = 10
net = Network(ndim_x, n_a... | true |
46229dee9e29ce8dfa8bbc89180a5ee8c99e0efa | Python | CarterCahill25/Class-Work | /Class Projects/Computer Science 1 HW/hw1c.py | UTF-8 | 275 | 3.609375 | 4 | [] | no_license | #Carter Cahill
#A02
#00962727
x = float(input("Input a real number: "))
t = int(input("Input a nonnegative integer: "))
series = 1
counter = 1
while counter <= t:
value = ((x ** counter)/counter)
series = series + value
counter = counter + 1
print(series) | true |
dfdbe894ce448b545797a380cf807a52c245eb07 | Python | ketilkn/bloodbowl-utility | /bbl-scraper/bblparser/load.py | UTF-8 | 820 | 2.703125 | 3 | [] | no_license | import logging
import pathlib
import sys
import typing
LOG = logging.getLogger(__name__)
def load_raw(file_no) -> str:
with open(file_no, mode='rb', closefd=False) as f:
raw_input = f.read()
try:
return raw_input.decode('utf-8')
except UnicodeDecodeError:
return ra... | true |
a1e4fa3eaf1e25716631bc98d318d159b0118da0 | Python | SL345/eda_project | /q03_regression_plot/build.py | UTF-8 | 404 | 2.671875 | 3 | [] | no_license | # %load q03_regression_plot/build.py
# Default imports
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv('data/house_prices_multivariate.csv')
X = data.iloc[:,:-1]
y = data['SalePrice']
variable2 = 'SalePrice'
variable1 = 'GrLivArea'
# Write your code here
def regression_pl... | true |
d86c2fe711cdcaaf02c3a6e2634dc58a46cd42c2 | Python | irinastarodubets/QALight_progect_1 | /first_last.py | UTF-8 | 338 | 3.859375 | 4 | [] | no_license | # [выражение for val in коллекция]
print("Введите несколько чисел: ")
a = input() .split()
a = [int (i) for i in a]
print("Вы ввели список чисел:", a)
print("Первый элемент списка: " ,a[0] )
print("Последний элемент списка: " ,a[-1] ) | true |
b13371d4d16c616623525cc48ef8869488549acd | Python | Williamcassimiro/Programas_Basicos_Para_Logica | /Desafio 30.py | UTF-8 | 181 | 3.671875 | 4 | [] | no_license | numero = int(input("Informe um valor?"))
rest = numero % 2
if rest == 0:
print("Este numero {} e par!".format(numero))
else:
print("Esse numero é {} impar!".format(numero)) | true |
f0c3a7bbd266328a53aef68e508fd04ad3889cad | Python | rjorth/Algorithms-and-Data-Structures | /reverseLinkedList.py | UTF-8 | 216 | 3.109375 | 3 | [] | no_license | def reverseList(head):
#iterative solution, one day i'll be brave and use recursion
#ever
#but not today
prev = None
while head:
cur = head
head = head.next
cur.next = prev
prev = cur
return prev | true |
6795cc7c945701ff3af8d6e0753b08cee79f1065 | Python | eliashomsi/Fast-Fourier-Transformation | /fft.py | UTF-8 | 6,760 | 2.9375 | 3 | [
"MIT"
] | permissive | import argparse
import math
import statistics
import time
import matplotlib.colors as colors
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
from scipy.sparse import csr_matrix, save_npz
from dft import DFT
def desiredSize(n):
p = int(math.log(n, 2))
retur... | true |
ae1d3c8b0be80d780bfc381b9007ae452f54e2d2 | Python | LuqiPan/Life-is-a-Struggle | /1_Arrays_and_Strings/1-8-zero-matrix/zero-matrix.py | UTF-8 | 1,343 | 3.421875 | 3 | [] | no_license | def zero_matrix(matrix):
m = len(matrix)
n = len(matrix[0])
row = False
col = False
for j in range(n):
if matrix[0][j] == 0:
row = True
for i in range(m):
if matrix[i][0] == 0:
col = True
for i in range(1, m):
for j in range(1, n):
... | true |
6dfa2e22297241c286d4e1d6701df47f2027d588 | Python | Onewincow/Elephe_Signal_Swag | /training/1강/실습 1-2.py | UTF-8 | 358 | 3.234375 | 3 | [] | no_license | print("동전 합산 해줄께... 음수는 넣지마.")
오백원=int(input("오백원짜리 몇개?" ))
백원=int(input("백원짜리 몇개?" ))
오십원=int(input("오십원짜리 몇개?" ))
십원=int(input("십원짜리 몇개?" ))
총=500*오백원+100*백원+50*오십원+10*십원
print("자기가 갖고 있는 동전은 총",총,"원 이야.")
| true |
8a6c45a7c30a3679b264d5fb1dce9f4c8e34e42f | Python | martin-deutsch/data-visualization | /classifiers.py | UTF-8 | 12,671 | 3.171875 | 3 | [] | no_license | # Martin Deutsch
# Template by Bruce Maxwell
# Spring 2017
# CS 251 Project 8
#
# Classifier class and child definitions
import sys
import data
import analysis as an
import numpy as np
import scipy.cluster.vq as vq
class Classifier:
def __init__(self, type):
'''The parent Classifier class stores only a s... | true |
346b4ae519aae5b33e5b8522e98edc6fd8e30a37 | Python | klasinky/recipe-app-api | /app/core/tests/test_model.py | UTF-8 | 1,506 | 3 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is successful"""
email = 'test@test.com'
password = 'Testpassword123'
user = get... | true |
81063bddbe32ab6c41c4e5ffa4cc0099baa9a5d6 | Python | Aasthaengg/IBMdataset | /Python_codes/p03861/s045781641.py | UTF-8 | 77 | 3.03125 | 3 | [] | no_license | a,b,x = map(int,input().split())
dum1 = (a-1)//x
dum2 = b//x
print(dum2-dum1) | true |
95eda7a6b0f1cdd0ce953cfdf8fbdf461cb0f0dd | Python | vipongo/AdventOfCode2020 | /1st/task1.py | UTF-8 | 1,197 | 3.546875 | 4 | [] | no_license | def task1():
numberList = []
f = open('input.txt','r')
numberList = f.readlines()
for i in range(0, len(numberList)):
numberList[i] = int(numberList[i])
for element in range(len(numberList)):
for i in range(len(numberList)):
if((numberList[element] + number... | true |
51a0e3d868c046896857a078f5d13faa8f16febf | Python | raksuns/EffectiveNotDefined | /coroutine.py | UTF-8 | 798 | 3.859375 | 4 | [] | no_license | '''
range : , xrange
'''
import time
begin_t = time.time()
for i in range(300000000):
print(i)
break
print('{:.1f}초 소요'.format(time.time() - begin_t))
# range
def myrange(start, end, step):
mylist = []
while start < end:
mylist.append(start)
start += step
return mylist
# xrang... | true |
159832f6cc67170ed3638cd5d136733aec318a65 | Python | Meinwerk/WebAsKB | /Net/run.py | UTF-8 | 4,116 | 2.5625 | 3 | [] | no_license | from config import config
from io import open
import pandas as pd
import numpy as np
import random
import torch
import torch.nn as nn
from torch import optim
import datetime
import json
# A general training and evaluation class for neural networks
class NNRun():
def __init__(self, model, pairs_train, pairs_dev):... | true |
a4f603f93996c60e496cc11837fcab7ddb4faf95 | Python | patcoet/Advent-of-Code | /2020/15/1.py | UTF-8 | 1,382 | 3.359375 | 3 | [] | no_license | starting_nums = []
with open("input.txt") as file:
starting_nums = list(map(lambda x: int(x), file.readline().strip().split(",")))
# print(starting_nums)
spoken_nums = {} # index is number, value is turn numbers it's been spoken on
for n in range(len(starting_nums)):
spoken_nums[starting_nums[n]] = [n]
last_n... | true |
8d84f1a7e835b7b3846a123f6c694d27b67687c8 | Python | tomemelko/project-euler | /problem001.py | UTF-8 | 89 | 3.140625 | 3 | [] | no_license | num = 0
for i in range(1000):
if (i % 3 == 0 or i % 5 == 0):
num += i
print num
| true |
efc532b43a58eeae4910bde439c978252affc2ea | Python | wangjianze/easy-pipeline | /easy_pipeline/worker.py | UTF-8 | 2,316 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from .task import Task, EmptyTask, StopTask
import multiprocessing as mp
import types
class Worker(object):
def __init__(self):
pass
def process(self, task):
pass
class SimpleWorker(Worker):
def __init__(self, work_fn, init_fn=None):
super(SimpleWorker, ... | true |
f8801dfb4523f5e291043ed0c2c8ffb3dbe33f87 | Python | Luc4s99/Simulacao-de-porto-em-python | /simulation.py | UTF-8 | 8,736 | 3.40625 | 3 | [] | no_license | from ship import Ship # Importando a classe do navio
from random import randint # Importação de biblioteca para a geração de números pseudo-aleatórios
from time import sleep
from docking import DockingArea # Classe da area de atracamento
def unload_ship(queue):
removed_cont = 0
if queue[0].numberCont > 4:... | true |
47101ea7ef92c6481044a94e7a8582077a3e933d | Python | invincibleaayu/Mcsc202 | /ques5.py | UTF-8 | 943 | 4.09375 | 4 | [] | no_license | # Write a program to tell the nature of the roots and values of the roots of a quadratic
# equation ax
# ax^2 + bx + c = 0, a ≠ 0.
import math
import numpy as np
a,b,c=input("Enter the value for a,b,c :").split()
a=float(a)
b=float(b)
c=float(c)
#for solving this problem we need to calculate the discriminant
discrim... | true |
5d13b68ae89a3f60ff59cbdc168b67005c306b2a | Python | aksharanigam1112/MachineLearningIITK | /packageML05/ML09(RNN).py | UTF-8 | 2,586 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
import random
import collections
import time
start_time = time.time()
def elapsed(sec):
if sec<60:
return str(sec)+" sec"
elif sec<(60*60):
return str(sec/60)+" min"
else:
return str(sec/3600)+" hr"
log... | true |
ad56f965b8bbe776a50f07f3a6daa0fff8de6665 | Python | Catxiaobai/project | /lxd_Safety(out)/graphTraversal-submit2/execution/format.py | UTF-8 | 1,783 | 2.84375 | 3 | [] | no_license |
filepath = r'E:/Code/project301/file/'
def formatfile():
f1 = open(filepath+"result.txt","r")
f2 = open(filepath+"webchess.txt","w")
l1=[]
l1=f1.readlines()
l2 = []
l3 = []
str1 = "S0"
str2 = "START"
str3 = "condition"
str4 = "cond"
str5 = "null"
str6 = ""
exit = ... | true |
8e3651bba6675f3df4e82699d90fff8408ab590e | Python | geniousisme/leetCode | /Python/204-countPrimes.py | UTF-8 | 749 | 3.359375 | 3 | [] | no_license | class Solution:
# @param {integer} n
# @return {integer}
def countPrimes(self, n):
if n < 3:
return 0
isPrime = [False, False]
for i in xrange(2, n):
isPrime.append(True)
idx = 2
while idx * idx < n:
# print 'idx*idx', idx*idx
... | true |
13c33090c7f22265b40fa6b1d5fa59f23a8fb6e7 | Python | ririw/autoencoder-experiments | /structural_encoder/vectorizer.py | UTF-8 | 656 | 3.515625 | 4 | [] | no_license | '''
Build up the vocab, by first running over the iterator to
work out what the vocab is, and then picking out the relevant
vector from a dictionary.
'''
import numpy as np
class Vocabulary(object):
def __init__(self, window_iterator):
self.vocab = dict()
word_counter = 0
for w in window_iterator:
if w no... | true |
66cf7d84b469b2a003960ea3e6d4ee06abd7f6f0 | Python | Arjuna1513/Python_Practice_Programs | /AllAboutLists/RemoveNegValFromList.py | UTF-8 | 961 | 4.03125 | 4 | [] | no_license | """eles = [-9, -5, 5, 4, 3, -2]
eles = [x for x in eles if x >= 0]
print(eles)"""
#similarly
"""eles1 = [-9, -5, -9, 4, 3, -2]
print(len(eles1))
print(eles1)
for i in eles1:
if i < 0:
eles1.remove(i)
print(eles1)"""
eles5 = [1, 4, 6, 7, 9]
for x in eles5[:]:
if x % 2 != 0:
print(x)
e... | true |
128b0f2706101d9ca15689119d44ae49a50d957c | Python | githubuser31899/BasicCircCalc | /Calculate area of circle - 4.0.py | UTF-8 | 6,685 | 4.03125 | 4 | [] | no_license | # First code created! I'm sure there's a way to compact this code... #
# I just haven't found a way to do it with my knowledge currently #
# 11/8/16 #
import time # code = time.sleep (1.00["or whatever amount of time you want")
import math # this was to import "pi" into the equation #
... | true |
f2c8a2dbd5e256117695b7a5f9137d7c9a16bd35 | Python | my5800mkk/SimCockpit | /RaspberryPI/SimCockpit.py | UTF-8 | 1,689 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
from daemon import Daemon
import sys
import time
import logging
import socket
HOST = '10.20.0.90'
PORT = 50007
PIDFILE = '/var/run/simcockpit.pid'
LOGFILE = '/var/log/simcockpit.log'
# Configure logging
logging.basicConfig(filename=LOGFILE,level=logging.DEBUG)
class SimCockpit(Daemon):
socket =... | true |
3c2370c4f746da5ffca747de3b408882d99b5501 | Python | BearachB/Hello_World | /Week 7/Lab 14 - Sets/lab14_q2.py | UTF-8 | 754 | 4.1875 | 4 | [] | no_license | string1 = 'the big dwarf only jumps'
string2 = 'given string is Heterogram'
string1 = string1.replace(" ","")
string2 = string2.replace(" ","")
len1 = len(string1)
len2 = len(string2)
set1 = set(string1)
set2 = set(string2)
set_len1 = len(set1)
set_len2 = len(set2)
if len1 == set_len1:
print("String 1 is a ... | true |
7b4d1ba286114d0cc3585f200615bd3152b2535d | Python | jngmk/Training | /Python/BAEKJOON/18809 Gaaaaaaaaaarden/18809.py | UTF-8 | 2,413 | 3.03125 | 3 | [] | no_license | def select_soil(k, now, soil_idx): # 배양액을 뿌릴 땅 선정
if k == G + R:
green_or_red(soil_idx, 0, 0, [])
else:
for s in range(now, S):
select_soil(k+1, s+1, soil_idx + [s])
def green_or_red(soil_idx, k, now, temp):
if k == G:
green, red = [], []
for i in range(G+R):
... | true |
a6fb30e27b5a993184932023439d9c6c50277687 | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/leetcode/LeetcodePythonProject/leetcode_0451_0500/LeetCode495_TeemoAttacking.py | UTF-8 | 1,448 | 3.5 | 4 | [] | no_license | '''
Created on May 10, 2017
@author: MT
'''
class Solution(object):
def findPoisonedDurationAnother(self, timeSeries, duration):
"""
:type timeSeries: List[int]
:type duration: int
:rtype: int
"""
if not timeSeries: return 0
res = 0
for i in range(1,... | true |
a7d0cd75a83117778c86d30e911b71b8cdd99f9b | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2736/60761/270626.py | UTF-8 | 325 | 2.90625 | 3 | [] | no_license | n,m=map(int,input().split())
numlist=list(map(int,input().split()))
for i in range(m):
a=input()
if a.startswith("Q"):
l,r,k=map(int,a[2:].split())
templist=numlist[l-1:r]
templist.sort()
print(templist[k-1])
else:
x,y=map(int,a[2:].split())
numlist[x-1]=y
... | true |
8f2f2e0ddde62a77a3a74376aaa27de72830fe17 | Python | AadhilPaul/ballgame | /main.py | UTF-8 | 4,646 | 3.453125 | 3 | [] | no_license | import pygame
import sys
pygame.init()
width, height = 1000, 700
window = pygame.display.set_mode((width, height))
caption = "i dont know the name"
pygame.display.set_caption(caption)
gap = 15
# colors
red = (255, 0, 0)
black = (0, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
white = (255, 255, 255)
yellow = (255, ... | true |
2616bde0da719eefd743d6662d121f7ce17c0542 | Python | bsfraga/algprog2-aula2 | /list_core.py | UTF-8 | 2,536 | 4.0625 | 4 | [] | no_license | from node_core import Node
class List:
def __init__(self, head=None):
""" Constructor method from List. This method initialize the list."""
self.head = head
def insert(self, data):
"""
This method insert new data into the current list.
"""
new_node = Node(da... | true |
301a2dfff304f97b9b02720f7beb5f443ecb5623 | Python | HanaTree/data-analysis-python | /PM2.5_City_in_China/main01.py | UTF-8 | 5,470 | 3.046875 | 3 | [] | no_license | import csv
import os
import numpy as np
import pandas as pd
import config
def load_data(data_file, usecols):
data = []
with open(data_file, 'r') as csvfile:
data_reader = csv.DictReader(csvfile)
# === Step 2. Clean data ===
for row in data_reader:
row_data = []
... | true |
c5ed0a8318b12e45d97880215e2012e8a4074032 | Python | HajimeKawahara/momorbit | /src/momo/momoconst.py | UTF-8 | 940 | 2.828125 | 3 | [] | no_license | from astropy.constants import G
from astropy.constants import M_sun
from astropy.constants import M_earth
from astropy import units as u
import numpy as np
#momoconstant
JDYEAR=365.25 #Julian year
GSYEAR=365.256898 #Gaussian year
ANORM=0.019570460672296595 #a normalized by P(d) and M (Msol). it can be checked by get_a... | true |
d5de660deb917eb934dc15b72caac615e780f3d1 | Python | CPC464/DojoAssignments | /python_stack/python/fundamentals/for_loop_basic1.py | UTF-8 | 744 | 3.6875 | 4 | [] | no_license | for x in range(151):
print(x)
for x in range(5,1001,5):
print(x)
for x in range(1,101):
if x % 5 == 0 and x % 10 !=0:
print('Coding')
elif x % 10 == 0:
print('Dojo')
else:
print(x)
total = 1
for x in range(3,500000,2):
total = total + x
print(total)
for x in range(2018... | true |
dc3067a17426df8b170ca108d03228a26ac3ed84 | Python | minimal-job-system/job-runners | /jobs/tasks/image_collection_task.py | UTF-8 | 2,004 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import logging
import luigi
import os
import pandas as pd
import re
from core.base_tasks import JobSystemTask
class ImageCollectionTask(JobSystemTask):
task_namespace = 'demo'
source_path = luigi.Parameter(default="")
"""
source path containing all images to index.
"""
... | true |
ab5dd3dea568b394dd21da1a19f6afe3ff09cabf | Python | gowentgonemax/InnovationPython_ravishah | /Task_1.py | UTF-8 | 3,236 | 5.21875 | 5 | [] | no_license | '''Create three variables in a single line and assign values to them in such a manner that each one of
them belongs to a different data type.
E.g. :
a = 1,
b = 2.01,
c = 'string'
'''
def ThreeVariable():
var1,var2,var3 = 1,2.01,"Ravi Shah"
print('The three variable in one line: ',var1,var2,var3)
# 2. Create ... | true |
3edda61aff987bafa7727ba0a3c8f58a6041cfaf | Python | giosumarin/nn_compression | /_test.py | UTF-8 | 1,147 | 2.734375 | 3 | [] | no_license | import unittest
from NN_pr import NN
from NN_pr import activation_function as af
import numpy as np
class Test(unittest.TestCase):
trainData = np.random.rand(100, 784)
trainLabel = np.random.randint(10, size=(100,), dtype=np.uint8)
train = [trainData, trainLabel]
testData = np.random.rand(50, 784)
... | true |
87d0de05d27d17ec8dcd0580574b4aca665982f9 | Python | ceth-x86/programming-challenges | /project-euler/Problem_07/problem_7.py | UTF-8 | 299 | 3.46875 | 3 | [] | no_license | import math
def is_prime(num):
return not (num < 2 or any(num % x == 0 for x in xrange(2, int(num**0.5) + 1)))
current_prime = 0
primes = 0
counter = 0
while(primes < 10001):
if(is_prime(counter)):
current_prime = counter
primes += 1
counter += 1
print current_prime
| true |
ae4a0eb7db239a7245f5862af8a582b8ac45e93f | Python | Wattyyy/LeetCode | /submissions/cousins-in-binary-tree/solution.py | UTF-8 | 958 | 3.5625 | 4 | [
"MIT"
] | permissive | # https://leetcode.com/problems/cousins-in-binary-tree
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import defaultdict
class Solution:
def search(se... | true |
294ec3fc87abd0dd718c7fd77971879ce4f6bc7e | Python | aromatic-toast/HackerRank | /jumpingOnClouds.py | UTF-8 | 1,339 | 3.6875 | 4 | [] | no_license | def jumpingOnClounds(c):
"""
Produce smallest number of jumps it takes to get from start of c to end.
Parameters
----------
c : (array) An array of clouds represented by binary integers.
Returns
-------
int : The smallest number of safe jumps possible in c.
Examples
--------
... | true |
1adb92ecc8a99c234a7afd571dbd81bcbd423cbd | Python | hoon4233/Algo-study | /2021_spring/2021_04_29/9659_JH.py | UTF-8 | 529 | 3.0625 | 3 | [] | no_license | import sys
N = int(input().strip())
if N%2 == 0 :
print('CY')
else :
print('SK')
# 이게 시간초과가 뜨네요...
# import sys
# input = sys.stdin.readline
# from collections import deque
# N = int(input())
# ME, OTHER = "me", "other"
# DP = deque([ME, OTHER, ME])
# for i in range(4, N+1, 1):
# one = DP.popleft()
# ... | true |
9165ac686a71d7c00b0daca6fada14dbdf279713 | Python | Veraph/LeetCode_Practice | /cyc/greedy/763.py | UTF-8 | 1,672 | 4.21875 | 4 | [] | no_license | # 763.py -- Partition Labels
'''
Description:
A string S of lowercase English letters is given.
We want to partition this string into as many parts as possible
so that each letter appears in at most one part,
and return a list of integers representing the size of these parts.
Example 1:
Input: S = "ababcbacadefegd... | true |
170f81d2e9ca0f62d8266a17286a4493da7baa3c | Python | SrdjanStankov/DRS_Asteroidi | /Engine/socket_send.py | UTF-8 | 630 | 2.703125 | 3 | [] | no_license | # Echo client program
import socket
import multiprocessing as mp
from time import sleep
# exPipes
class SocketSend(mp.Process):
def __init__(self,pipe):
super().__init__(target=self.Send, args=[pipe])
HOST = 'localhost' # The remote host
PORT = 50055 # The same port as used by the... | true |
184f761bfba7cd123431732942655332c259ee31 | Python | cseebs/crm114 | /test_double_filter.py | UTF-8 | 4,969 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import os, re
from operator import itemgetter
from crm114 import Classifier
from math import floor
"""
Performs an extremely basic set of tests by passing some fuzzily-defined words
and phrases to the learner with an explicit sentiment, and runs an equally
fu... | true |
c831a442c5c8109a4aa0b3aaa214f636c5df96cf | Python | ffigura/Euler-deconvolution-plateau | /code/synthetic_test/plot_functions.py | UTF-8 | 10,653 | 3.109375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Plot functions
A Python program to plot the total-field anomaly and the estimates
on classic plot.
This code plot the figures 1-4 in the folder 'figures'.
Figure 1 - input data. Black polygons define the location of the sources.
Figure 2 - horizontal estimates - x and y. Red polygons define the sele... | true |
7bb7d524f07f015525848667eab6247d9fcff280 | Python | pauloadilson/estrutura_de_dados | /python/stack.py | UTF-8 | 572 | 3.65625 | 4 | [] | no_license | class Pilha():
def __init__(self, topo=-1, max=50):
self.topo = topo
self.vetor = []
self.max = max
def EstaVazia(self):
return (self.topo == -1)
def EstaCheia(self):
return (self.topo == max - 1)
# Insere um elemento
def Empilha(self, valor):
... | true |
40fe89e3b287f67ad4473af4366fb6d433896192 | Python | keatjane/ip-point2segment | /compare.py | UTF-8 | 2,444 | 2.703125 | 3 | [] | no_license | def compare(ori, ref, k):
ori_int = []
ref_int = []
ori_range = []
## ORI & REF MUST BE IN FOLLOWING FORMAT (R,G,B)
for i in ori:
ori_int.append(int(i))
for i in ref:
ref_int.append(int(i))
for i in ori_int:
ori_range.append(int(i*k))
ori_total = ... | true |
3db38560b783e7e2a87e2e0d0eca319d3d7868f2 | Python | xgamer4/dataclasses-avroschema | /tests/serialization/test_recursive_schema_serialization.py | UTF-8 | 4,000 | 2.78125 | 3 | [
"MIT"
] | permissive | import dataclasses
import typing
from dataclasses_avroschema import AvroModel
def test_self_one_to_one_relationship():
"""
Test self relationship one-to-one serialization
"""
@dataclasses.dataclass
class User(AvroModel):
"User with self reference as friend"
name: str
age:... | true |
224b3869c727a180960baf14d106c1cad20f3792 | Python | 1364468984qqcom/FB-ad | /PicRec/ALL_Other/imgPIL/pil1.py | UTF-8 | 925 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from PIL import Image
imgPath = 'D:\WorkProject\ImageProject\PicRec\ImageFile\img16.jpg'
img = Image.open(imgPath)
assert isinstance(img, Image.Image)
# img.show()
img.save('D:\WorkProject\ImageProject\PicRec\ImageFile\img_png16.png')
im = Image.open('D:\WorkProject\ImageProject\PicRec\ImageFi... | true |
6c599550f515db3181ae0f9619d335eaf84b1d6b | Python | hugoYe/HybridLockerEclipse | /Python/hotspotCrawler/Crawler/googleTrends_crawler/Crawler/MyCrawler.py | UTF-8 | 2,858 | 2.640625 | 3 | [] | no_license | #encoding=utf-8
from linkQueue import linkQueue
import socket
import re
import MySQLdb
from selenium import webdriver
import time
import sys
reload(sys)
class MyCrawler:
global conn
conn = MySQLdb.connect(
host = "localhost",
port = 3306,
user =... | true |
2bee1ca298a650e7d6c35c4a3fd2f42a997efa05 | Python | Egor2001/geoacoustic | /result/armserver/benchviz.py | UTF-8 | 698 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python
import sys
import matplotlib.pyplot as plt
import pandas as pd
if __name__ == "__main__":
if len(sys.argv) < 3:
print('usage: ', sys.argv[0], ' DATA_CSV [DATA_CSV...] OUTPUT_PNG\n')
sys.exit()
fig, ax = plt.subplots()
ax.set_title('threads benchmark [128x128x128 cells, ... | true |
7dbc73b57b808df288c01877f22205b14411b192 | Python | kieuthuong/python_rabiloo | /nlp_100_drill_exercises-master/nlp_100_drill_exercises-master/python/chap05/ex47.py | UTF-8 | 1,511 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
47. Mining các cấu trúc câu có động từ chức năng
"""
import sys
from chunk_ex41 import read_chunks, sen_surf
from verb_case_ex45 import left_most_verb
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE,SIG_DFL)
def save(predicates, pred, case, src):
if not ... | true |
58c0a39c54582949fc1800535b28eff9b3268d64 | Python | samidarko/ruckus | /main.py | UTF-8 | 882 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
import re
def clean_line(line):
line = line.replace('.', '')
line = line.replace(',', '')
line = line.replace('"', '')
line = line.strip()
return line
def pretty_print(data):
for key, value in sorted(data.items(), key=lambda item: item[1], reverse=True):
print("%s... | true |
293cddee7ab3a11800eaa3ac162268f09c33a8df | Python | imaskm/coriolis-python-problems | /prog43.py | UTF-8 | 812 | 3.140625 | 3 | [] | no_license | import urllib2
f =urllib2.urlopen('http://www.puzzlers.org/pub/wordlists/unixdict.txt')
print("Data Fetched")
def check_anagram(word1,word2):
counter= [0]*256
if(len(word1) != len(word2)):
return False
for i in range(len(word1)):
counter[ord(word1[i])]+=1
counter[ord(word2[i])]-=1
... | true |
794a73ec6816a585c69afa4878f021a0677c4494 | Python | HiroIshida/pr2_send_me_a_flower | /vase_estimater/line_segment.py | UTF-8 | 3,501 | 2.703125 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
execfile("sample_image.py")
#img = cv2.imread("image/1_edge.png")
img = cv2.imread("image/1_edge.png")
#img = gen_sample_image()
def image_to_pixel_list(img):
dim_x = img.shape[0]
dim_y = img.shape[1]
pixel_list = [[i, j] for i in range(dim_x)... | true |
85c95f3ee4cbc96a37f5ebb0cac79c6fc36ce27e | Python | imlegend19/MDSN-DevRank | /gnome/layers/layer2_d1.py | UTF-8 | 3,558 | 2.90625 | 3 | [
"MIT"
] | permissive | import pickle
from itertools import permutations
import networkx as nx
import openpyxl
from local_settings_gnome import db
"""
Layer 2 Network:
Edge between developers who commented on 2 bugs which belong to same product.
Dataset Used : gnomebug
Table : bug
"""
with db:
print("Connected to db!")
cur = db.c... | true |
7f526855f3728d697979dab470d6c26dec7b514c | Python | yangd01234/cs372-osu-networks | /assignment-1-chat-serve/chatserve.py | UTF-8 | 2,527 | 3.15625 | 3 | [] | no_license | '''
Author: Derek Yang
Program Name: chatserve.py
Course: CS372
Description: chatserver waits on a port for a client request.
client sends the initial connection message. Chat server
then receives the message and starts a connection.
Once the connection is made, both client and server can
alternate sending messages.
M... | true |
85bdb31cfbbf31138c569fc82a49c485dc936f32 | Python | Fudeveloper/python | /python/函数式编程/filter.py | UTF-8 | 269 | 3.703125 | 4 | [] | no_license | #encoding=utf-8
#筛选出偶数
def is_odd(x):
return x%2==0
print filter(is_odd,[1,2,3,4,5,6]) #[2, 4, 6]
#把一个序列中的空字符串删掉
def not_empty(s):
return s and s.strip()
print filter(not_empty,{'a','','b','c',''}) #['a', 'c', 'b'] | true |
b57dcdd074b9529d67449670e33ca8671f585fd3 | Python | Washirican/Python220A_2019 | /students/Daniel_Rodriguez/Lesson10/Assignment/src/database.py | UTF-8 | 6,625 | 3.1875 | 3 | [] | no_license | # --------------------------------------------------------------------------- #
# Course: PYTHON 220: Advanced Programming in Python
# Script Title: Lesson 10 Assignment
# Change Log: (Who, When, What)
# D. Rodriguez, 2019-06-04, Initial release
# ------------------------------------------------------------------------... | true |
160ce57f06afed972da5ae8a03a0132cc37fc02d | Python | TFNS/writeups | /2020-08-24-GoogleCTF/sharky/challenge.py | UTF-8 | 1,432 | 3.28125 | 3 | [] | no_license | #! /usr/bin/python3
import binascii
import os
import sha256
# Setup msg_secret and flag
FLAG_PATH = 'data/flag.txt'
NUM_KEYS = 8
MSG = b'Encoded with random keys'
with open(FLAG_PATH, 'rb') as f:
FLAG = f.read().strip().decode('utf-8')
def sha256_with_secret_round_keys(m: bytes, secret_round_keys: dict) -> bytes:... | true |
9ad2ec8c1913a4c06754c1a6ebdc919eebb1f929 | Python | Attawat/portfolio | /ex3.py | UTF-8 | 343 | 2.8125 | 3 | [] | no_license | from scipy.io import loadmat
import matplotlib.pyplot as plt
mnist_raw=loadmat('ex3data1.mat')
mnist = {'data':mnist_raw['X'],'target':mnist_raw["y"]}
x,y=mnist["data"],mnist["target"]
number=x[15]
number_image=number.reshape(20,20)
print(y[15])
plt.imshow(number_image,cmap=plt.cm.binary,interpolation... | true |
0f18e512462f44b6bbafb1e8ea35f8f1bc45c6fd | Python | 3dzayn/pype | /openpype/modules/sync_server/providers/abstract_provider.py | UTF-8 | 3,076 | 2.765625 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractmethod
class AbstractProvider(metaclass=ABCMeta):
def __init__(self, site_name, tree=None, presets=None):
self.presets = None
self.active = False
self.site_name = site_name
self.presets = presets
@abstractmethod
def is_active(self):
... | true |
cb2a26d0d0aac4c43e2c56c2ad4d5762517859c0 | Python | Pseudotetraden/scikit_contrib | /skltemplate/rbfn_without_keras.py | UTF-8 | 11,312 | 3.21875 | 3 | [] | no_license | import numpy as np
from sklearn.cluster import KMeans
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from sklearn.utils import shuffle
from sklearn.utils.multiclass import unique_labels
from sklearn.metrics import euclidean_distances
... | true |
27daca7af2ccce844bd89948f837126447e8f33c | Python | HundredRooms/responsive-cache-service | /training/cache/input_tools.py | UTF-8 | 4,038 | 3 | 3 | [] | no_license | import multiprocessing
import tensorflow as tf
def file_reader(filenames, num_epochs, shuffle=False, skip_header_lines=1):
"""
Get input producers for file input pipeline
:param filenames: [str]. Names of file(s) to read from
:param num_epochs: int. Number of epochs to generate file queue... | true |
3fc8a1d68d7c2aa1de4754a00fb653da71b2299a | Python | dnp987/GTA-Cars-old | /CarData/src/Cars/Chrysler/Car_data_IslingtonChrysler.py | UTF-8 | 4,983 | 2.671875 | 3 | [] | no_license | '''
@author: DNP Enterprises Inc.
'''
from datetime import datetime
from time import sleep
import re
#from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from Quotes.Excel_uti... | true |
8df1ee3996a83390455c9e73718daca0b57742d3 | Python | StevenLarge/StochasticControl | /InfiniteTest/ParameterMasterGenerator.py | UTF-8 | 586 | 2.78125 | 3 | [] | no_license | #This module generates the Parameters.py file for each of hte different kCP values
#
#Steven Large
#December 27th 2016
import os
def WriteParameterFile(WritePath,kCP):
filename = 'Parameters.py'
CompleteName = os.path.join(WritePath,filename)
file1 = open(CompleteName,'w')
file1.write('#Parameters File\n\nk=1\n... | true |
01304cc7ea87f4574a9044a438d69f821588226e | Python | Shimpa11/PythonTutorial | /session56B.py | UTF-8 | 438 | 3 | 3 | [] | no_license | """
Pytorch and numpy
bridging between numpy and pytorch
"""
import torch
import numpy as np
# torch to numpy
X=torch.ones(5)
print(X,type(X))
Y=X.numpy()
print(Y)
print(type(Y))
# adding 1 to elements
X.add_(1)
# Y is also changed as numpy array is being read from tensor itself
print(X)
print(Y)
print()
# numpy to... | true |
6430be2b6246da7c5d1a747ae5b9fc434cbe3fe2 | Python | erkan-polat/python | /Python Class/w2_q4.py | UTF-8 | 96 | 3.921875 | 4 | [] | no_license | c=input(" Enter the temp in Celcius : ")
f=float(c)*(9/5)+32.0
print("Temp in Fahrenheit : ",f)
| true |
7670e35d741ccde367f049c10425b86b135a5284 | Python | Aldabot/dialogflow-backend | /lenders/lenders.py | UTF-8 | 9,028 | 2.8125 | 3 | [] | no_license | import json
import re
import pandas as pd
import locale
from flask import Flask, jsonify, make_response
from flask import request
def best_lenders(req):
try:
amount = req.get('queryResult').get('parameters').get('amount').get('number')
except AttributeError:
return 'amount not recognized'
... | true |
011364e5b72f2866c071a0eef68c9ac0a080a647 | Python | ndronen/pylearnutils | /pylearnutils/datasets/mm.py | UTF-8 | 1,324 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
A dataset for Matrix Market files.
"""
__authors__ = "Nicholas Dronen"
__copyright__ = "Copyright 2013, Nicholas Dronen"
__credits__ = ["Nicholas Dronen"]
__license__ = "3-clause BSD"
__maintainer__ = "Nicholas Dronen"
__email__ = "ndronen@gmail.com"
import scipy.io
from pylearn2.datasets... | true |
4023573f1ce6cbef47b1462f7e26d0f1b91c3620 | Python | jemorgan1000/DX_GTAA | /pipe/mlb_scrapping.py | UTF-8 | 9,330 | 2.96875 | 3 | [] | no_license | import requests
import pandas as pd
from bs4 import BeautifulSoup
import numpy as np
import datetime
class MLBScraper:
def __init__(self, years, season, team_url_csv):
self.years = years
self.season = season
self.team_url_csv = team_url_csv
def get_current_season_links(self, url, tea... | true |
f54ec9d05f8c1fee6b3c07e2379f3cbe45cedd34 | Python | dcribb19/bitesofpy | /code_challenges/301/exchangerates.py | UTF-8 | 2,541 | 2.890625 | 3 | [] | no_license | import os
from collections import OrderedDict
from datetime import date, datetime, timedelta
import json
from pathlib import Path
from typing import Dict, List
from urllib.request import urlretrieve
URL = "https://bites-data.s3.us-east-2.amazonaws.com/exchangerates.json"
TMP = Path(os.getenv("TMP", "/tmp"))
RATES_FILE... | true |
1d483e89a02ff9c3e22c83e5056c0797c163d8fe | Python | zerotsukaima/Zh_P | /check.py | UTF-8 | 828 | 3.734375 | 4 | [] | no_license | x = float(input('Введите значение: '))
n = int(input('Введите количество последовательностей: '))
a = 1 #числитель, если начинаем с 1 то тут 1, если с 2ки то тут x
b = 1 #знаменатель
y = 0 #сумма ряда
for i in range(1, n + 1): #n+1 чтобы включить элемент n, с 2 начинаем так как 1 уже вписали
a = a * -x #чередован... | true |
18933fc0df5478861b9b2ac9afddfd9b5f2d25c4 | Python | YuChangWan/tensorflow-practice | /16 MNIST with NN.py | UTF-8 | 3,395 | 2.984375 | 3 | [] | no_license | import tensorflow as tf
import matplotlib.pyplot as plt
import random
tf.set_random_seed(777) # for reproducibility
from tensorflow.examples.tutorials.mnist import input_data
# Check out https://www.tensorflow.org/get_started/mnist/beginners for
# more information about the mnist dataset
mnist = input_data.read_dat... | true |
5233afebaebbff245935e3de0885f88f5380261f | Python | rennoraudmae/SuperHajusSudoku | /server/tcp_server.py | UTF-8 | 4,143 | 2.703125 | 3 | [] | no_license | from socket import socket, AF_INET, SOCK_STREAM
from socket import error as soc_error, timeout
from threading import Thread
import common.constants as C
from server.server_msg_processor import ServerMsgProcessor
from server.single_client_handler import SingleClientHandler
from sudoku_game import SudokuGame
'''
This cl... | true |
590ddabbcbab0f1c6fd3fe60166eabbd9e37ba76 | Python | guozhaoxin/leetcode | /num801_900/num861_870/num863.py | UTF-8 | 3,122 | 3.828125 | 4 | [] | no_license | #encoding:utf8
__author__ = 'gold'
'''
863. All Nodes Distance K in Binary Tree
We are given a binary tree (with root node root), a target node, and an integer value K.
Return a list of the values of all nodes that have a distance K from the target node. The answer can be returned in any order.
Example 1:
Inpu... | true |
1945c90cb6c9ee229599b72158db674a9cce4319 | Python | lovehhf/newcoder_py | /笔试题/字节跳动1/1_找零.py | UTF-8 | 766 | 3.875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
__author__ = 'huanghf'
"""
Z国的货币系统包含面值1元、4元、16元、64元共计四种硬币,以及面值1024元的纸币。
现在小Y使用1024元的纸币购买了一件价值为N的商品,请问最少他会收到多少硬币。
输入格式
共一行,包含整数N。
输出格式
共一行,包含一个数,表示最少收到的硬币数。
数据范围
0<N≤1024
输入样例:
200
输出样例:
17
样例解释
花200,需要找零824块,找12个64元硬币,3个16元硬币,2个4元硬币即可。
"""
# N=200
N = int(input())
def fun(n):
count = 0
... | true |
d3f8bf55e36b2fdded7b32a867b0ed90ea45314c | Python | quasarbright/YLUJLO | /python/snake_ai/model.py | UTF-8 | 2,637 | 2.78125 | 3 | [
"MIT"
] | permissive | import torch
from torch import nn
from torch.distributions import Categorical
from utils import *
class Actor(nn.Module):
'''state -> action'''
def __init__(self, state_size, num_actions, hidden_dims=120):
super(Actor, self).__init__()
self.fc = nn.Sequential(
nn.Linear(state_size, ... | true |
687642e58376a4d06276055632eda249f773f6bd | Python | MaticVerbic/P1 | /DN8.py | UTF-8 | 3,096 | 3.09375 | 3 | [] | no_license | # 8. domača naloga
'''
import csv
def preberi_podatke(pot):
with open(pot, newline = '', encoding = "utf-8") as f:
vrednosti = []
s = dict()
resitev = dict()
r = csv.reader(f, delimiter=" ")
for line in r:
vrednosti.append(line)
kraji = ... | true |
3458a6aa5ae1041e2b80ef2bb262c23398a45ede | Python | katiehouse3/chatbot-with-personality | /moviechat/nlpmodels/RNNChatEval.py | UTF-8 | 15,608 | 2.578125 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from torch.jit import script, trace
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import csv
import random
import re
import o... | true |
e3d64abc97ec458255153a88eaeecc0ede31ae18 | Python | mayad19-meet/meet2017y1lab5 | /fun1.py | UTF-8 | 240 | 3.65625 | 4 | [
"MIT"
] | permissive |
def add_number(start,end):
c=0
for number in range(333,778):
print (number)
c=number+c
return c
test1=add_number(1,2)
print(test1)
test2=add_number(1,100)
print(test2)
test3=add_number(1000,5000)
print(test3)
| true |
05a96d61ce210707fd77ecb60e15ff916f67595f | Python | pratimasakinala/python | /python/functions.py | UTF-8 | 1,376 | 4.5625 | 5 | [] | no_license | # Arguments to a function
# Positional Arguments
'''
def add(x, y):
return x + y
print(add(13, 18))
'''
# Keyword Arguments
'''
def yell(phrase = 'Stoop!!'):
print(phrase)
yell()
yell(phrase = 'Right there!!')
'''
# Postional and keyword arguments
'''
def echo(text, prefix=''):
print('{0}{1}'.format(pre... | true |
cace86e4bc40bad8cbeaf7156b2fdb5f60a0a105 | Python | BobStein/qiki-python | /qiki/__init__.py | UTF-8 | 1,647 | 2.6875 | 3 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0"
] | permissive | """
qiki - Rate and relate anything.
Usage example:
import qiki
one = qiki.Number(1)
lex = qiki.LexMySQL(**credentials)
like = lex.verb('like')
mint = lex.noun('mint')
kate = lex.define('agent', 'kate') # create an agent named Kate. Every sbj is an agent.
kate(like)[mint] = one, "peppe... | true |
7168e9010f350c4322e5a1dfdbf1e73c15cfc164 | Python | IsmaValencia19/C-digos | /Práctico 3/Ejercicio 3/ClaseTallerCapacitacion.py | UTF-8 | 871 | 3.125 | 3 | [] | no_license | class TallerCapacitacion:
__id = 0
__nom = ''
__vacantes = 0
__montoInscripcion = 0
def __init__(self, ID = 0, nom = '', vac = 0, monto = 0):
self.__id = ID
self.__nom = nom
self.__vacantes = vac
self.__montoInscripcion = monto
def getId(self):
return se... | true |
d3b1cdd6a16776fce4373e8d296506d627cdc307 | Python | BalaIyyappan/Guvi-CodeKata | /Absolute Beginner/Length of words without White spaces.py | UTF-8 | 64 | 3.171875 | 3 | [] | no_license | name=input().split()
l=0
for i in name:
l=l+len(i)
print(l)
| true |
fe4f61919c9d5fdc19fe2d4b73c9928f91dad6d1 | Python | FranciscoDMO/Laboratorios-de-algoritmia | /coiso.py | UTF-8 | 251 | 2.84375 | 3 | [] | no_license | import sys
def lol():
i=0
l=[]
for s in sys.stdin:
s=s.strip('\n')
s=s.split(' ', 1)
l.append(s)
i+=1
for s in l:
print ("else if(x=="+s[0]+"){\n printf(Banco: "+s[1]+");\n}")
lol() | true |
868fd48c1874866c9358786adc7ae905d463a525 | Python | dozmus/advent-of-code | /2019/day8.py | UTF-8 | 1,559 | 3.25 | 3 | [] | no_license | from benchmark import benchmark
from custom_io import read_lines
def get_layers(pixels, width, height):
layers = []
while pixels:
layer = []
for i in range(width * height):
layer.append(pixels.pop(0))
layers.append(layer)
return layers
@benchmark
def day8a(input, ... | true |
2806936bba67a7fcf0a80ee623c6d8b931b319b3 | Python | Valeri017/myscripts | /imap.py | UTF-8 | 221 | 2.875 | 3 | [] | no_license | phrase = "Don't panic"
plist = list(phrase)
print(phrase)
print(plist)
for i in plist:
i == ("D","'","n","i","c"):
plist.remove(i)
print(i)
# new_phrase.append(i)
#print(new_phrase)
#print(new)
| true |
67934146fe8beaad3cbed3f0fd8dae15ae4fcacc | Python | Woodjack/masterLocker | /mapping.py | UTF-8 | 809 | 2.9375 | 3 | [] | no_license | from mongodb import db
from bson.json_util import dumps
from bson.json_util import loads
## This function takes a pymongo .find()
## result and makes it into one single polyline
def makeLineFromPoints(pointsJSON):
results = {}
pointsJSON = loads(pointsJSON)
temp = pointsJSON[0]
results['name'] = str(temp['name'])... | true |
55e8d7758c413a570517abc39816bac94d991347 | Python | patodichayan/SfM | /Code/Part1/NonlinearPnP.py | UTF-8 | 2,432 | 2.515625 | 3 | [] | no_license | import numpy as np
from scipy.optimize import least_squares
from Misc.utils import MiscFuncs
def rot2Quat(rot):
qxx,qyx,qzx,qxy,qyy,qzy,qxz,qyz,qzz = rot.flatten()
m = np.array([[qxx-qyy-qzz,0, 0, 0],[qyx+qxy,qyy-qxx-qzz,0,0],
[qzx+qxz,qzy+qyz,qzz-qxx-qyy,0],[qyz-qzy,qzx-qxz,qxy-qyx,qxx+qyy+qzz]])/3.0
val,vec = ... | true |
c86d5d487897cb014e4777c665b7e7f3e9be0de1 | Python | yongsoocho/Python3-Algorism | /Group Anagrams.py | UTF-8 | 466 | 3.890625 | 4 | [] | no_license | #Given an array of strings 'strs', group the anagrams together
#You can return answer in any order
import collections
Input = ["eat", "tea", "tan", "ate", "nat", "bat"]
class Solution:
def groupAnagrams(self, strs):
anagrams = collections.defaultdict(list)
for word in strs:
... | true |
ccfeb86d1670e87474d3a66b589d42e0ef8d1380 | Python | joaquinlpereyra/deinvent | /deinvent.py | UTF-8 | 1,084 | 3.484375 | 3 | [] | no_license | import math
def eoq(D: float, K: float, h: float) -> int:
"""
The EOQ is the order cuantity that minimizes
the total holding costs and ordering costs.
D: annual demand
K: cost of emmiting an order per unit
h: cost of storing an unit
"""
return math.ceil(((2*D*K)/h)**(1/2))
def cycle_ti... | true |
652b7a9e7e534e79d76a9e0cc6cf6b16efe09ec8 | Python | Leahxuliu/Data-Structure-And-Algorithm | /Python/LeetCode2.0/DP/188. Best Time to Buy and Sell Stock IV.py | UTF-8 | 2,592 | 3.53125 | 4 | [] | no_license | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2020/05/19
'''
Method - DP
dp[i][k][0]: the most profit in day i, no stock, buy k times
dp[i][k][1]: the most profit in day i, have stock, buy k times
Steps:
a. if k <= len(prices) // 2
1. build dp table, the table size is (the number of days + 1) * ... | true |
c0c483ae9695ff9af621de2f7a6dadd8d149bd09 | Python | timkao/Tim-Python-Codes | /your_order.py | UTF-8 | 976 | 3.640625 | 4 | [] | no_license | # sort a string based on the number in the word
# provide three ways
def order(sentence):
A = sentence.split(" ")
o_list = []
result = A[:]
count = 0
for i in A:
for j in i:
if j in "123456789":
result[int(j) -1] = str(A[count])
count += 1
return " ".join(result)
# list.insert(index, obj). ... | true |
05ee48b670f1da70fa95d21e81ff4b966a85abf6 | Python | FFloresM/PythonMLDB | /POO/prueba.py | UTF-8 | 534 | 2.6875 | 3 | [] | no_license | from vehiculo import Vehiculo, Audiencia, Moto
auto1 = Vehiculo("azul", 4)
auto1.mostrar()
auto1.setColor("Negro")
auto1.setRuedas(6)
print(auto1.getColor(), auto1.getRuedas())
print("\n\n\n")
aud = Audiencia("P-01-2021", "preparatoria", "vulneración de derechos")
aud.asignarBloques(4)
aud.mostrar()
aud.plazo()
a... | true |
e7b823029b1c6336ff9bfee1f5f71dc66e99de53 | Python | JosvanderWesthuizen/mpld3_graph_example | /Launch_graph_from_python.py | UTF-8 | 3,595 | 2.734375 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import mpld3
from mpld3 import plugins, utils
import pandas as pd
class LinkedView(plugins.PluginBase):
"""A simple plugin showing how multiple axes can be linked"""
JAVASCRIPT = """
mpld3.register_plugin("linkedview", LinkedViewPlugin)... | true |