blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
314a1f22adfa65d3f3701ade998018c302223dc0 | Python | nholtz/structural-analysis | /matrix-methods/frame2d/Frame2D/Nodes.py | UTF-8 | 1,327 | 3.328125 | 3 | [
"CC0-1.0"
] | permissive | ## Compiled from Nodes.ipynb on Sun Dec 10 12:51:09 2017
## DO NOT EDIT THIS FILE. YOUR CHANGES WILL BE LOST!!
## In [1]:
import math
## In [2]:
class Node(object):
DIRECTIONS = {'FX':0, 'FY':1, 'MZ':2}
def __init__(self,ident,x,y):
"""Initialize a new instance with the given identifier and ... | true |
936efb82e7790977e2fffd0cadb06a840fb31d78 | Python | psklight/volume_grating | /volume_grating/utilities/validation.py | UTF-8 | 2,092 | 3.671875 | 4 | [
"MIT"
] | permissive | import numpy as np
def validate_input_numeric(value, shape=None):
"""
Validate whether the input value is a list of numbers of a ndarry of numbers, against a requires shape (if ``shape`` is not ``None``).
When ``shape`` is a tuple, for example (4, None, 2), it checks ``value``'s shape that ``value`` shoul... | true |
f8daa90c78e11ff7acbf35d5573540d081ddd9e4 | Python | 15338830715/tan | /Base/get_data.py | UTF-8 | 526 | 2.8125 | 3 | [] | no_license | import yaml
def get_data(yml_name, case_data_name):
with open("./Data/data_"+yml_name+".yml", "r", encoding="utf8") as f:
data = yaml.load(f)["test_"+ case_data_name]
data_list = list()
for key in data.values():
tmp_list = list()
for val in key.values():
... | true |
5b67835d0026828e80abb3be250f07946934a514 | Python | sanyuktakate/Recognizing-Handwritten-Online-Mathematical-Equations-Pattern-Recognition | /Pattern_Recognition/Part_3-Parsing/code/symbol_features.py | UTF-8 | 2,045 | 3.25 | 3 | [] | no_license | '''
@author: Sanyukta Kate, Pratik Bongale
'''
# calls the symbol features which is the
import geometric_features
import symbol_geometric_features
import symbol_shape_features
def get_symb_features(s1, s2, ink):
# do the processing of the symbols s1 and s2
# segments/symbols present in the ink ... | true |
be6fb54a67181fddd3f8e1a35ef85ce33327fb18 | Python | mvhv/basic-algorithms | /sorting/mergesort.py | UTF-8 | 929 | 3.984375 | 4 | [] | no_license | """
Merge Sort
Python 3.5
Auxillary Arrays - High Memory Usage
Moderate Time Complexity: O(n * lg n)
Jesse Wyatt
April 2017
"""
def msort(arr):
"""Returns a sorted array."""
# Recurrance base-case
if len(arr) <= 1:
return arr
else:
# Split
key = len(arr) // 2
lwr = arr[... | true |
7410208849489182d7c90863bb1373d57b8a4445 | Python | danishnaseem05/WebServer | /server.py | UTF-8 | 5,047 | 2.546875 | 3 | [
"MIT"
] | permissive | from socket import *
import select
import os
import sys
import time
import queue
def pythonWebServer(host, port):
webServer = socket(AF_INET, SOCK_STREAM)
webServer.setblocking(0)
webServer.bind((host, port))
webServer.listen(5)
inputs = [webServer]
outputs = []
message_queues = {}
if... | true |
53ee4608c53a6eed856b09c9edd2417c8a9fcbdb | Python | atomicptr/Cyberduck-Favorites | /Alfred.py | UTF-8 | 4,348 | 2.875 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2013 Christopher Kaster (@Kasoki)
#
# This file is part of alfred.py <https://github.com/Kasoki/alfred.py>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restricti... | true |
da5b055ae2fe9a6e39ab64561919716876fe3e15 | Python | mengshun/Leetcode | /problems/239.py | UTF-8 | 791 | 3.84375 | 4 | [
"MIT"
] | permissive | """
239. ๆปๅจ็ชๅฃๆๅคงๅผ https://leetcode-cn.com/problems/sliding-window-maximum/
"""
import collections
def maxSlidingWindow(nums, k):
# ๅ็ซฏ้ๅ
queue = collections.deque()
res = []
for i in range(len(nums)):
# ๆทปๅ ไนๅๅคๅฎๅฐพ้จๆฏๅฆๆๅผๅฐไบๅฝๅๅผ
while queue and nums[i] > nums[queue[-1]]:
queue.pop()... | true |
5a0c478b3db4efa2cab0fd2ee8fc9eb1cbdd063b | Python | pietroastolfi/Walking-bus-challenge | /src/greedy_algorithm.py | UTF-8 | 3,350 | 3.5 | 4 | [] | no_license | import random
ROOT = 0
def find_next(delta, graph, previous_node, not_visited, path_length):
"""
this function finds the next node to add to the path.
:param delta: the delta that you want to use to perform this iteration. It decides the entity of the randomization.
:param graph: the object that cont... | true |
c922589f13e67fd597484b3d38b608fe2758e6a5 | Python | napcode/enpass_transform | /enpass_transform.py | UTF-8 | 3,000 | 3.03125 | 3 | [
"MIT"
] | permissive | import json
import sys
import csv
import argparse
class Entry:
url = ''
type = ''
username = ''
password = ''
hostname = ''
extra = ''
name = ''
grouping = ''
def write_csv(outputfile, entries):
lfile = open(outputfile, 'w')
fieldnames = ['url','type','username','password','hos... | true |
f509427af08815e331dcb472a8b2297e53bfdca2 | Python | petiatodorova/PythonFundamentals | /lists/input_to_list.py | UTF-8 | 240 | 3.5 | 4 | [] | no_license | def input_to_list_ints():
values = input()
lst = values.split(' ')
while "" in lst:
lst.remove("")
return [int(item) for item in lst]
if __name__ == "__main__":
lst1 = input_to_list_ints()
print(f'{lst1}')
| true |
fc9ed8aaddfcc3c212dcf58f4dc640762e574372 | Python | Hyomini/C.S.E_Hanyang | /2018_CSE4007/assignment1/2013012041_assignment_1.py | UTF-8 | 10,490 | 3.125 | 3 | [] | no_license | import heapq
# output.txt ํ์ผ ์์ฑ
def output(size, path, start, goal, file, length, time):
background = [[1 for cols in range(size)]for rows in range(size)] #1๋ก ์ฑ์ด ํ์ผ์์ฑ
for n in range(len(path)):
x = path[n]//1000
y = path[n]%1000
background[x][y] = 5
x = start//1000
y... | true |
277177180ff89fa26695e85cce85213633c35948 | Python | INTENDRO/recursion_examples | /recursionex/int_to_str.py | UTF-8 | 472 | 3.4375 | 3 | [] | no_license | import logging
CHARACTERS = "0123456789ABCDEF"
def convert(num,base):
if num == 0:
logging.debug("Zero. Special case")
return "0"
else:
logging.debug("num: {}".format(num))
logging.debug("num%base: {}".format(num%base))
next_num = num//base
if next_num:
current_string = convert(num//base, base) + CHA... | true |
0493da3a91104f79e7b4947883a358df06c8bc7c | Python | mindcruzer/outlook-round-robin | /test/test_outlook_round_robin.py | UTF-8 | 12,954 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import json
import re
from unittest.mock import patch, call
from datetime import datetime, timedelta
import httpretty
import settings
from outlook_round_robin import (
API_ENDPOINT,
load_index,
store_index,
get_access_token,
mark_message_as_read,
forward_message,
load_messages,
... | true |
1fdf81efc9d0df804475006397217f3be21d0186 | Python | agilesg4/PryFinalAgiles20182 | /polls/functional_test/Kata_test.py | UTF-8 | 2,146 | 2.609375 | 3 | [] | no_license | import csv
import os
from unittest import TestCase
from selenium import webdriver
from selenium.webdriver.common.by import By
import sys
class Kata_test(TestCase):
def setUp(self):
self.browser = webdriver.Chrome('C:\\chromedriver.exe')
def tearDown(self):
self.browser.quit()
def test_1_... | true |
ea7efbf7eb416fcd3945085470ba4e75ec48ef1b | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_59/228.py | UTF-8 | 782 | 2.65625 | 3 | [] | no_license | import sys
import psyco
psyco.full()
cases = int(sys.stdin.readline().strip())
for case in xrange(1, cases + 1):
n, m = map(int, sys.stdin.readline().strip().split(' '))
dirs = ['/']
for i in xrange(n):
dae = sys.stdin.readline().strip().split('/')[1:]
for j in xrange(1, len(dae) + 1):
... | true |
bd6ea9f34d5311ace0be8c713b27d7fc389a2efe | Python | GANESH0080/Python-Practice-Again | /InRangeFunction/InRangeEx.py | UTF-8 | 182 | 4.15625 | 4 | [] | no_license | # The range() function returns a sequence of numbers, starting from 0 by default,
# and increments by 1 (by default), and ends at a specified number.
for x in range(10):
print(x) | true |
bce8c5d9d2183a24d1a2ccfa4dcea80fbd16f994 | Python | wj2/vasctarget | /oldcode/analysis.py | UTF-8 | 1,690 | 2.984375 | 3 | [] | no_license |
import numpy as np
def normalize(arr):
return (arr - arr.mean()) / arr.std()
def wgauss(nt=None,ns=3,sdt=None,normed='area'):
"""
returns a gaussian window
:Parameters:
nt : window length in number of sample points
ns : window length in number of stanard deviations
sdt: stan... | true |
a4a4419cb4ef529f0b0ddeb9c6ecd2c37ed48851 | Python | lidongze6/leetcode- | /้ข่ฏ้ข 01.05. ไธๆฌก็ผ่พ.py | UTF-8 | 757 | 3.09375 | 3 | [] | no_license | class Solution:
def oneEditAway(self, first: str, second: str) -> bool:
l1, l2 = len(first), len(second)
if abs(l1 - l2) > 1: return False
dp = [[float("inf")] * (l2 + 1) for i in range(l1 + 1)]
for i in range(l1 + 1):
dp[i][0] = i
for j in range(l2 + 1):
... | true |
fba14e025285b22564b0bcd6ef8c4e6d3ba59507 | Python | momentum-morehouse/weather-data-with-pyton-GabeJunior-1196 | /weather.py | UTF-8 | 2,664 | 3.546875 | 4 | [] | no_license | import requests
# If you want to use classes
# class WeatherReport:
# attributes of Place are lat, lon, num
# like a card in blackjack and the place_list would be like a deck
# Class gives the template and the object is the actual implementation of that template.
# place, temp, precip
class WeatherReport:
def ... | true |
af688c534929b6c72a301558b74fde625fe33db8 | Python | nazlisetton/tcc-speechmusic | /scripts/visual-exploration/density_plots.py | UTF-8 | 1,125 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 24 19:45:25 2017
@author: Nazli
"""
'''
ANรLISE EXPLORATรRIA - PARTE 1
FAZ GRรFICOS DE DISTRIBUIรรO DE CADA FEATURE DO DATASET
INPUT: ".csv" do dataset
OUTPUT: um grรกfico de distribuiรงรฃo (ou histograma) por feature na pasta plots/density.
'''
import json... | true |
682b67bf7acfc6063a61a673542faf0356220a17 | Python | chance-comer/coursera_data_analysis_and_ML | /LearnPython/optimize_func.py | UTF-8 | 596 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 26 12:17:12 2018
@author: kazantseva
"""
import numpy as np
import scipy.optimize as opt
import matplotlib.pyplot as plt
def valfunc(x):
return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(- x / 2)
def valintfunc(x):
return np.array([int(i) for i in valfunc(x)])
res... | true |
4c9a4fd0b67b4fa64774fd642b8ff68da39b0a65 | Python | KalyaniKaware/Data-Injestion-codes | /Data injestion using API and Selenium/citiBike.py | UTF-8 | 856 | 3.15625 | 3 | [] | no_license | from selenium import webdriver
class Bot:
def __init__(self):
self.driver = webdriver.Chrome()
def crawl(self):
i = 1
market = "https://www.spotify.com/us/select-your-market/"
self.driver.get(market)
self.driver.find_element_by_xpath("/html/body/div[2]/div[2]/... | true |
00feccb1bf7b8c15b0cc4b4c0e8f9d38d9065ed3 | Python | programming-practices/python | /src/main/python/Lista.py | UTF-8 | 6,907 | 4.1875 | 4 | [] | no_license | # Tanto las Tumpla como las listas son conjuntos ordenados de elementos, no asi los diccionarios.
# Que son las listas:
# Estructura de datos que nos permite almacenar grand cantidad de valores(equivalente a los array en todos lenguajes
# de programacion.
# En Python las listas pueden guardar diferentes tipos de... | true |
ea3fde614440a94822e53f9cd6b893658df63a02 | Python | heyb7/python_crash_course | /ch10/ex10-6.py | UTF-8 | 379 | 4.4375 | 4 | [] | no_license | print("Please enter two numbers.")
try:
first_num = input("first number: ")
first_num = int(first_num)
second_num = input("second number: ")
second_num = int(second_num)
except ValueError:
print("Sorry, I need a number.")
else:
sum = first_num + second_num
print("The sum of " + str(first_... | true |
fc083c6d3da924e08a38262e7b0fe9e2030ad0a0 | Python | Dmitriy211/advanced-django2019 | /week5/lab/users/utils/validators.py | UTF-8 | 182 | 2.734375 | 3 | [] | no_license | import re
def spec_char_validate(value):
spec = re.compile('[@_!#$%^&*()<>?/\|}{~:]')
if spec.search(value) is not None:
return False
else:
return True
| true |
7e6fd55ea8d7e38ec6f6fcaa25a8143e26211d25 | Python | c04022004/NotiLink | /scripts/set_numled.py | UTF-8 | 460 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
from sense_hat import SenseHat
import time
import numled
import sys
sense = SenseHat()
c = (0, 100, 0)
if(int(sys.argv[1])):
c = (255, 0, 0)
image = [
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c,
c,c,c,c,c,c,c,c... | true |
5d74616916b207c7b059e72dde0347957f6f61f5 | Python | archit11111/Attention-Tracking-System | /ML and Backend/head_pose_estimation.py | UTF-8 | 3,684 | 2.578125 | 3 | [] | no_license | import cv2
# import imutils
import numpy as np
import dlib
# creating a list of facial coordinates
def landmarksToCoordines(landmarks, dtype="int"):
# initializing the list with the 68 coordinates
coord = np.zeros((68, 2), dtype=dtype)
# go through the 68 coordinates and return
# coordinates in a li... | true |
4cb78518f4b48655a12014dbc99e26f0b7e7d1a5 | Python | PietroVitiello/Reinforcement_Learning | /DQN_Tutorial/torch_example.py | UTF-8 | 4,766 | 3.859375 | 4 | [] | no_license | import numpy as np
import torch
from matplotlib import pyplot as plt
# Turn on interactive mode for PyPlot, to prevent the displayed graph from blocking the program flow
plt.ion()
# Create a Network class, which inherits the torch.nn.Module class, which represents a neural network.
class Network(torch.nn.Module):
... | true |
c5582b89c6decd8d40a8e5de32cf4e965c3d5b76 | Python | NiharikaGoel12/algo-practice | /python/283_move_zeroes.py | UTF-8 | 553 | 3.234375 | 3 | [] | no_license | class Solution(object):
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: None Do not return anything, modify nums in-place instead.
"""
insertPos=0
if len(nums)<2:
return nums
for each_num in nums:
if each_num !=0:
... | true |
be2f85061d5d74d86398a4836e828e2772f887ae | Python | xiaotuzixuedaima/PythonProgramDucat | /python_program/Def_tempature_calcultor.py | UTF-8 | 1,380 | 3.734375 | 4 | [] | no_license | # temperture calcultor useing by def function ....????
def fharh():
c = float(input("enter the celcius : "))
f = (c * (9/5)) + 32
k = f + 273
print("convert the celcius to fhareheiht : ",f,'*f')
print("convert the celcius to kelvin : ",k,'*k')
def cel():
f = float(input("enter the fhareheiht : "))
c = (f -32... | true |
b694102a9235eea0c8d189a23ef10e4cd9dee052 | Python | mahclark/python-projects | /Solar_System/PlanetTexture.py | UTF-8 | 3,825 | 2.875 | 3 | [] | no_license | import pygame
import time
import os
from math import sqrt, cos, tan, radians
from functions import read
dir_path = os.path.dirname(os.path.realpath(__file__))
pygame.init()
xSize, ySize = 600, 600
screen = pygame.display.set_mode((xSize, ySize))
pygame.display.set_caption("Pygame Template")
def make_planet(ox,oy,r,... | true |
17b164a5ed61a3f13c0e2f57275e984e08daf4ea | Python | arsoedjono/big-data | /EAS/location_vs_year.py | UTF-8 | 1,349 | 3.046875 | 3 | [] | no_license | __author__ = 'Aranda Rizki Soedjono'
# libraries
from pyspark import SparkConf, SparkContext
from operator import add
# spark configuration
conf = SparkConf().setMaster( "local" ).setAppName( "LocationVsYear" )
sc = SparkContext( conf = conf )
# map function to get year & location from dataset
def parseLine( line ):... | true |
418e06085b4e97b29f24c4b734554549570b8895 | Python | PierreQuentel/PyDbLite | /pydblite/pydblite_conversions.py | UTF-8 | 3,900 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | # conversions between PyDbLite and other formats
# currently supported : csv
import os
import pydblite
def to_csv(pdl, out=None, write_field_names=True):
"""Conversion from the PyDbLite Base instance pdl to the file object out
open for writing in binary mode
If out is not specified, the field name is th... | true |
c129bcead1679d26b847eeb6814d92137c10b23c | Python | vetscience/Assemblosis | /Metrics/collect/rmSpliceVars.py | UTF-8 | 731 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import os, sys, optparse
from wbtree import WbTree
#################################################
def options():
parser = optparse.OptionParser('usage: python %prog -i filename -n size')
parser.add_option('-i', '--gff', dest='gff', help='GFF file to filter', metavar='GFF', default='-'... | true |
974a3efb82a6ae650ed00dd13b60cb80de89de71 | Python | NabilKarroumi/face_recognizer-git | /face_recognizer/src/front/UI_automatic_photos_taker.py | UTF-8 | 8,482 | 2.6875 | 3 | [] | no_license | """
This module implementes an interface window that allows the user to create/generate photos (data) automatically.
"""
import os
import sys
import cv2
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
from face_recognizer.raw_UIs.automatic_photos_taker import Ui_automatic_photos_taker
from fa... | true |
712de47c0db496bff90947567741612445302043 | Python | yanxurui/keepcoding | /python/algorithm/google/sg_2020/2.py | UTF-8 | 769 | 3.03125 | 3 | [] | no_license | from sys import stdin
from collections import defaultdict
def read_int():
return int(stdin.readline())
def read_ints():
return tuple(map(int, stdin.readline().split()))
def line():
return stdin.readline().rstrip()
def mean(nums):
return sum(nums)//len(nums)
def solve():
line()
N = read_int(... | true |
741cb6eff2bb157a20388982e8cfca5aaac2b80e | Python | victoy/ai | /sungkim/RI/utils/prints.py | UTF-8 | 362 | 3.1875 | 3 | [] | no_license | import os
import time
'''
Print Utils
'''
# Clear console
def clear_screen():
os.system("cls" if os.name == "nt" else "clear")
def print_frozenlake_result(score):
"""Prints GOAL if score is positive else DEAD"""
message = "GOAL" if score > 0 else "DEAD"
print("=" * 50)
print("{:^50}".format(messa... | true |
18f4ca40a3c04fee42019cc8de0a50a14fa926f7 | Python | thiagorocha503/data-structure | /listDinamic.py | UTF-8 | 942 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | from node import Node
class ListDinamic:
def __init__(self):
self.__node = None
self.__length = 0
def length(self):
return self.__length
def add(self, value):
if self.__node is None:
self.__node = Node(value)
else:
self.__node.add(value)
... | true |
513b948b890f9ab7362d9bc14736747c78782669 | Python | Gambrinus/Rosalind | /Python/REAR.py | UTF-8 | 2,429 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
""" Rosalind project - Problem: Reversal Distance
Problem
A reversal of a permutation creates a new permutation by inverting some interval of
the permutation; (5,2,3,1,4), (5,3,4,1,2), and (4,1,2,3,5) are all reversals of (5,3,2,1,4).
The reversal distance between two permutations p and s, writte... | true |
049f94a2e8eae24d1c579768ed7d1bb33d83f486 | Python | renato145/DENN | /denn/optimization.py | UTF-8 | 21,577 | 2.828125 | 3 | [] | no_license | from .imports import *
from .metrics import *
from .callbacks import *
from .utils import *
from scipy.spatial.distance import cosine
__all__ = ['EvolveMechanism', 'DistanceMetric', 'ScaleFactor', 'Individual', 'Population', 'Optimization', 'Runs']
EvolveMechanism = Enum('EvolveMechanism', 'Normal Best Crowding Crowd... | true |
0064ae38ffaca3dbe817c324351833d4400769f4 | Python | cmccandless/python-representer | /bin/generate.py | UTF-8 | 1,098 | 3.09375 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
"""
CLI for the representer for the Python track on Exercism.io.
"""
from argparse import ArgumentParser, ArgumentTypeError
import representer
def _slug(arg):
try:
return representer.utils.slug(arg)
except ValueError as err:
raise ArgumentTypeError(str(err))
def _dir... | true |
e5f99d199daa820d0cc3022cead1dfae59a047d5 | Python | programmer290399/pustakkosh.com-scrapper | /scrapping-forever-noBS4.py | UTF-8 | 5,868 | 2.609375 | 3 | [] | no_license | import json
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.b... | true |
fb3a2ec6ea725f40ab9aaf7f9d73975974cd7c90 | Python | XJX0527/python- | /data reorganization.py | UTF-8 | 4,372 | 3.34375 | 3 | [] | no_license | # -*- codeing = utf-8 -*-
# @Time:2021/6/28 10:44
# @Author:A20190277
# @File:data reorganization.py
# @Software:PyCharm
''''''
'''ๆด็ๆฐๆฎ'''
import pandas as pd
import numpy as np
train=pd.read_csv(r'C:\Users\18356\pythoxjx\pew-raw.csv')
print(train)
#id_vars๏ผๅฎไนๆฐๅๅๅญ๏ผvar_name๏ผๅฐๅๆฅ็ๅ่ฟ่ก้ๆฐๅฝๅ
#id_vars๏ผไฟๆๅๆ ท็ๅ
#... | true |
11386f00c3f1e9e952a0ed0292284f537e6e7565 | Python | Maxcutex/pm_api | /app/utils/slackhelper.py | UTF-8 | 1,607 | 2.703125 | 3 | [
"MIT"
] | permissive | from slack import WebClient
from config import get_env
class SlackHelper:
def __init__(self):
self.token = get_env("SLACK_TOKEN")
self.client = WebClient(self.token)
def post_message(self, message, channel, attachments=None, as_user=True):
"""
Post a message to a public chann... | true |
8d866f01fe4da8245244b5d3c3b5a98b40901f79 | Python | cybertraining-dsc/fa18-523-63 | /project-code/insertion.py | UTF-8 | 579 | 3.1875 | 3 | [] | no_license | # The project performer is not the author of the below code
# - Author: Interactive Python
# - URL: http://interactivepython.org/courselib/static/
# pythonds/SortSearch/TheInsertionSort.html
# - Accessed (11/2018)
# This code was adapted for the project needs
def insertion_sort(alist):
for index in r... | true |
de083c841f9da5ab80a499fb8529a43ee07b7df2 | Python | kinsze032/python---zadania | /zad8.py | UTF-8 | 531 | 4.0625 | 4 | [] | no_license | listaA = [2,3,4,5,4,3,2,1,2]
najmniejsza = None # nie wiadomo czy nie ma 0 na liลcie albo jeszcze mniejszej liczby; bezpieczniej wpisaฤ None
print("Dana jest lista A, ktรณra zawiera ['2','3','4','5','4','3','2','1','2'] elementรณw")
for liczba in listaA:
if najmniejsza == None or najmniejsza > liczba: # sprawdzenie ... | true |
85567176ab0dadd22da9e7b9abaeecdc98fa143b | Python | aelong/RMG-database | /input/kinetics/families/R_Addition_MultipleBond/training/reactions.py | UTF-8 | 8,297 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
name = "R_Addition_MultipleBond/training"
shortDesc = u"Kinetics used to train group additivity values"
longDesc = u"""
Put kinetic parameters for reactions to use as a training set for fitting
group additivity values in this file.
"""
entry(
index = 1,
label = "C2H2 + C... | true |
80fbfbd1fd57ff34a365ce735c2d62e45cbc32c1 | Python | tooyoungtoosimplesometimesnaive/probable-octo-potato | /p_y/139_word_break.py | UTF-8 | 1,390 | 3.234375 | 3 | [] | no_license | class Solution:
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
word_dict = set(wordDict)
can_break = [False for i in range(len(s) + 1)]
can_break[0] = True
i = 0
while i < len(s):
... | true |
9430c9caf387abd30a43ecb019f9c0f6d2ea96d8 | Python | Allmer/courses_final_task | /pages/admin_login_page.py | UTF-8 | 866 | 2.546875 | 3 | [] | no_license | from pages.base_page import BasePage
from locators.Admin_Login_Page_Locators import AdminLoginPageLocators
class AdminLoginPage(BasePage):
def should_be_admin_login_page(self):
form_header_text = self.find_element(
AdminLoginPageLocators.LOCATOR_FORM_HEADER).text
assert form_header_te... | true |
5ac89cc4c8c365437dbab9225cbfab74d6f5695b | Python | Madhav-Somanath/LeetCode | /July/23-SingleNumberIII.py | UTF-8 | 1,471 | 4.03125 | 4 | [] | no_license | """ Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice.
Find the two elements that appear only once. """
# SOLUTION
class Solution:
def singleNumber(self, nums: List[int]) -> List[int]:
xor = 0
a = 0
b = 0
... | true |
6d6cc9e7e9be70f0e2b62cb40748bd1f779ca0ef | Python | RobertoPerez16/clasespython | /cursopython/clase05.py | UTF-8 | 1,051 | 3.40625 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
master = Tk()
def addNumbers():
res = float(e1.get()) + float(e2.get())
if int(e1.get()) > 3:
msg = messagebox.showwarning("Atenciรณn","el 1 es mayor a 3")
myText.set(res)
def Resta():
res = float(e1.get()) - float(e2.get())
myText.set(re... | true |
74f77adc8e6dac4defef02c75ea8355b06e0c1bd | Python | AkshayChn/nPlayerStrategicGame | /weak.py | UTF-8 | 2,915 | 3.078125 | 3 | [] | no_license | """
strongly dominant strateges and equilibrium
weakly dominant strateges and equilibrium
very weakly dominant strateges and equilibrium
all pure strategy nash equilibrium
"""
import input as ip
import gen as gen
def isListEmpty(inList):
##https://stackoverflow.com/a/1605679
if isinstance(inList, list): # Is... | true |
5a19fd850737130d29ef1367c3b7187ff001a65c | Python | stevenla/bit | /scripts/face-converter.py | UTF-8 | 632 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
if len(sys.argv) != 1:
start = int(sys.argv[1])
else:
start = 0
def mapper(x):
return int(x) + start
stdin = sys.stdin.read()
listed = stdin.split(',-1,')
cleaned = map(str.strip, listed)
print 'var faces = ['
for face_string in cleaned:
indices = face_string.split(',')
... | true |
5037b7e031f1e8fb7448acac2c3f3371f5c3a0bf | Python | 425776024/Learn | /pythonlearn/Algorithms/Sorting/quik_sort.py | UTF-8 | 3,925 | 4.375 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
ๅฟซ้ๆๅบๅ็๏ผๅจๅบๅไธญๆพๅฐไธไธชๅฎไฝ็น๏ผไธ่ฌๆฏ็ฌฌไธไธช็น๏ผ็ถๅๅฐๆฏ่ฟไธช็น็ๅผๅคง็ๅผๆชๅฐๅฎ็ๅณ่พน๏ผๆฏ่ฟไธชๅผๅฐ็ๅผๆชๅฐๅฎ็ๅทฆ่พน๏ผๆๅ่ฟๅ ่ฏฅ็น็ไฝ็ฝฎใ
้่ฟ้ๅฝ่ฐ็จ่ฏฅๆนๆณ๏ผๅฐๅบๅๅๆๅทฆๅณไธคไธชๅบๅ๏ผ็ถๅๅ็ปๅไธๅป๏ผๅฐๆๅๆฏไธชๅบๅไธญๅชๆไธคไธชๅ
็ด ๏ผ่ฟไธคไธชๅ
็ด ่ขซๆๅฅฝๅบๅ่ฟๅๅฐไธไธๅฑ๏ผๆๅ่ฟๅ็ๅฐๆฏๆๅบๅฅฝ็ๅบๅใ
ๅฟซ้ๆๅบ็ๆถ้ดๅคๆๅบฆๆฏO(nlog2n)๏ผๆๅๆ
ๅตๆถ้ดๅคๆๅบฆO(n**2),ๆฏไธ็งไธ็จณๅฎ็็ฎๆณ๏ผ้ป่พๆฏ่พๅคๆ
ๅ
ถๅฎๅฟซ้ๆๅบๆณ่ฆ่ฟ่กไผๅ็่ฏ๏ผ่ฆๆพๅฐไธไธชๅ้็ๅฎไฝ็น๏ผ่ฟไธชๅฎไฝ็นๅฆๆๆปๆฏ็ฌฌไธไธช็น็่ฏ๏ผๅฝ่ฟไธช็นๅๅฐ็ๅผๆฏๆๅคง็ๅผ๏ผไนๅๅๅฆๆฏๆฌก้ๅฝๅๅฐ็็ฌฌไธไธช็น้ฝๆฏๆๅคง็ๅผ๏ผ
... | true |
105e6c699079a9cc81d4a197ebbf7c192d660a22 | Python | ganeshbs17/PythonAndCPP-Programs | /Concatenation.py | UTF-8 | 108 | 3.6875 | 4 | [
"MIT"
] | permissive | var1 = "Hello "
var2 = "World"
# + Operator is used to combine strings
var3 = var1 + var2
print(var3)
| true |
fec86fffcd6bf8bf0c3d0831ee4226c430e9dd97 | Python | yzhouum05/Algorithms | /DFS.py | UTF-8 | 986 | 4.09375 | 4 | [] | no_license |
# coding: utf-8
# Depth First Search
#
# Example: Binary Tree Level-Order Traversal
def dfs_iterative(graph, start):
# graph: dict, adjacent nodes to each node
# start: node that traversal starts
# return a list of all the nodes traversed
visited, stack = [], [start]
while stack:
... | true |
46ceb64cce50adb39fd03baf20b13370d01d701a | Python | rickhenderson/mazes | /frozen-maze.py | UTF-8 | 2,427 | 3.71875 | 4 | [] | no_license | """
-------------------------------------------------------
# frozen-maze.py
Create a maze similar to Frozen-v0 from OpenAI Gym
and use a Stack to solve it using Breadth-first search.
-------------------------------------------------------
Author: Rick Henderson
Email: rhenderson@wlu.ca
__created__ = "2016-0... | true |
0c16545b178459509e73d3cb1fd02e01a20ebada | Python | jorgeaugusto01/DataCamp | /Data Scientist with Python/21_Supervised_Learning/Cap_2/Pratices6_7.py | UTF-8 | 4,123 | 3.90625 | 4 | [] | no_license | #Regularization I: Lasso
#In the video, you saw how Lasso selected out the 'RM' feature as being the most important for predicting
# Boston house prices, while shrinking the coefficients of certain other features to 0.
# Its ability to perform feature selection in this way becomes even more useful when you are dealing
... | true |
384310508c5115b9ed1774ef6ad48b2107c84797 | Python | Elsa92/pythonProject_Pytest | /testing/test_fixture2.py | UTF-8 | 228 | 2.9375 | 3 | [] | no_license |
'''
fixture ไธๅๆฐๅๆถๅญๅจ็ๆ
ๅต
'''
import pytest
@pytest.fixture()
def login():
print('login')
return 'Token'
@pytest.mark.parametrize('a,b',[[1,2],[3,4]])
def test_param(a,b,login):
print(a,b,login) | true |
65184ef4f1147621731edc5a822911d36e1d2841 | Python | fispact/pypact | /pypact/printlib/printlib5.py | UTF-8 | 6,859 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from pypact.util.decorators import freeze_it
from pypact.util.jsonserializable import JSONSerializable
from pypact.util.lines import line_indices
from pypact.util.exceptions import PypactNotPrintLib5FileException
from pypact.util.numerical import get_float
from pypact.printlib.tags import PRINTLIB5_HEADER
from pypact.f... | true |
614c9f575716719591d052fcfdd854177bdc47df | Python | kim1992/Machine-Learning | /ๆบๅจๅญฆไน ๅฎๆ/Regression/abalone.py | UTF-8 | 1,653 | 2.8125 | 3 | [] | no_license | from numpy import *
import matplotlib.pyplot as plt
import regression as rg
'''
่ฏฏๅทฎๅคงๅฐ่ฏไปทๅฝๆฐ
Parameters:
yArr - ็ๅฎๆฐๆฎ
yHatArr - ้ขๆตๆฐๆฎ
Returns:
่ฏฏๅทฎๅคงๅฐ
'''
def rssError(yArr, yHatArr):
return ((yArr - yHatArr) ** 2).sum()
abX, abY = rg.loadDataSet('abalone.txt')
print('่ฎญ็ป้ไธๆต่ฏ้็ธๅ:ๅฑ้จๅ ๆ็บฟๆงๅๅฝ... | true |
f30637e99cbccbbfc0862cc82b7443e65b409aa9 | Python | nepomnyashchii/TestGit | /old/opp/ls1_copy/ls19.py | UTF-8 | 902 | 3.375 | 3 | [] | no_license | class Employee:
# num_of_emps =0
# raise_amt = 1.10
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + "." + last + "@gmail.com"
# Employee.num_of_emps +=1
# def fullname(self):
# return "{}, {}".... | true |
cb1eb7b57b887d6be07947cc2f2dcc5f46d14c59 | Python | lucasbflopes/codewars-solutions | /6-kyu/length-of-missing-array/python/solution.py | UTF-8 | 210 | 2.90625 | 3 | [] | no_license | def get_length_of_missing_array(arr):
if None in arr or not arr: return 0
lengths = list(map(len, arr))
return sum(range(min(lengths), max(lengths)+1)) - sum(lengths) if 0 not in lengths else 0
| true |
676dc685f9e4533e3fae34749b2004e6ec72c708 | Python | Fischerlopes/EstudosPython | /cursoEmVideoMundo3/ex089.py | UTF-8 | 1,256 | 4.1875 | 4 | [] | no_license | # Crie um programa que leia nome e duas notas de vรกrios alunos e guarde tudo em uma lista composta.
# No final, mostre um boletim contendo a mรฉdia de cada um e
# permita que o usuรกrio possa mostrar as notas de cada aluno individualmente.
c = 0
lista_alunos = list()
lista_geral = list()
alunos = int(input(('Quantos alu... | true |
7a58845ec7f414faa6081ee460840675ffe282c0 | Python | elgaridhomaulana/Flask-mpg-Dataset | /data_mpg.py | UTF-8 | 685 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
# import seaborn as sns
# import matplotlib.pyplot as plt
def mpg_data():
df = pd.read_csv('clean.csv')
return df
df = mpg_data()
def ranking(column):
usa = df[df['origin'] == 'usa'].sort_values(by=column, ascending=False).head(3)['name'].values
japan = df[df['ori... | true |
da0f383c142a4009e1666c2f4dc5c1643b70d091 | Python | PrashantMhrzn/100-days-of-code-1 | /100daysofpython/weather_app/app.py | UTF-8 | 582 | 2.953125 | 3 | [] | no_license | from utils import info
import dotenv
import os
dotenv.load_dotenv()
API_KEY = os.getenv('API_KEY')
lat, lon = info.get_coords()
data = info.get_weather(lat, lon, API_KEY)
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
heading = """
####################################
# WEATHER APPLICATION U... | true |
20aea63947c97a688a0956f70c9568d18c503af0 | Python | izzatum/mirror-stein-samplers | /constrained/target.py | UTF-8 | 1,271 | 2.59375 | 3 | [] | no_license | import tensorflow as tf
class Target:
def __init__(self, mirror_map):
self._mirror_map = mirror_map
@property
def mirror_map(self):
return self._mirror_map
def logp(self, theta):
# theta: [..., K, D]
# ret: [..., K]
raise NotImplementedError()
def grad_lo... | true |
138ecf31e27284cf588db14c673e5783d98b55b5 | Python | RoamingSpirit/SLAM | /breezyslam/network/mapserver.py | UTF-8 | 2,358 | 3.03125 | 3 | [] | no_license | """
mapserver.py:
author: Nils Bernhardt
edited: Lukas Brauckmann
"""
import socket
import threading
HOST = '' # Symbolic name, meaning all available interfaces
PORT = 8888 # Arbitrary non-privileged port
class MapServer(threading.Thread):
# Flag for running
running = True
def __init__(self, slam, MA... | true |
690430b9fd06d026acd1a07dd573e20807c3ccbb | Python | jerryfeng007/pythonCodes | /multithreading/0026็บฟ็จ้ๅ2.py | UTF-8 | 988 | 3.875 | 4 | [] | no_license | # ๅฉ็จ้ๅ่งฃๅณ่ฟไธช้ฎ้ข
import queue # ๆณจๆ๏ผ่ฟๆฏ็บฟ็จ้ๅ๏ผไธ่ฝ็จๅจๅค่ฟ็จไธญ
q = queue.Queue(3) # ๆจกๅผ1๏ผ้ป่ฎคFIFO๏ผๅ
่ฟๅ
ๅบ๏ผ
# -----------------3 ๏ผ่กจ็คบๆๅค่ฝๆพ3ไธชๆฐๆฎ๏ผ ๅฏไปฅไธบ็ฉบ
q.put(12)
q.put('hello')
q.put({'name': 'yuan'})
# q.put(34, False) # ๅ ไธบๆๅค่ฝๆพ3ไธชๆฐๆฎ๏ผๆไปฅไผๅกๅจ่ฟ้๏ผๅ ไธบๆพไธ่ฟๅปไบ๏ผ
# ็ดๅฐๅๆไธไธช็บฟ็จๅๅบๆฐๆฎ๏ผctrl+B๏ผๆฅ็๏ผblockๅๆฐ้ป่ฎคๆฏTrue๏ผๆนไธบFalse๏ผๅฐฑไธไผๅกไบ๏ผไผๆฅ้
while 1:
data = q.get()
# ... | true |
82811f449469f5fe33b93dc41ee86306924dc2a9 | Python | sharifmamun/mysite | /mysite/views.py | UTF-8 | 866 | 2.59375 | 3 | [] | no_license | ## Instead of all these
#from django.template.loader import get_template
#from django.template import Context
#from django.http import HttpResponse
## What we can do?
from django.shortcuts import render_to_response
import datetime
def current_datetime(request):
now = datetime.datetime.now()
## Good
... | true |
5e6ba507dea68e938c67036f581263d834016a19 | Python | Aasthaengg/IBMdataset | /Python_codes/p02403/s401410246.py | UTF-8 | 165 | 2.90625 | 3 | [] | no_license | while True:
h, w = map(int, input().split())
if h == w == 0: break
for i in range(0, h):
print(''.join(['#' for x in range(0, w)]))
print('') | true |
e1f021298da21dc95568c8eb15047b572ee52340 | Python | Mr-Coxall/repl.it-test | /main.py | UTF-8 | 991 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by : Mr. Coxall
# Created on : October 2019
# This program prints out your name, using default function parameters
def full_name(first_name,last_name, middle_name = None):
# return the full NameError
full_name = first_name
if middle_name != None:
full_name = full... | true |
79a093901d6af09edad9d6bab87d5345baccb90e | Python | KarenCampo777/holbertonschool-higher_level_programming | /0x0F-python-object_relational_mapping/2-my_filter_states.py | UTF-8 | 572 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
"""takes in an argument and displays all values"""
import MySQLdb
from sys import argv
if __name__ == "__main__":
"Lists tatates from the db"
db = MySQLdb.connect(host="localhost", port=3306, user=argv[1],
passwd=argv[2], db=argv[3])
cur = db.cursor()
exe ... | true |
4f80fc87ef269e2b5a636d9c94e9c033e35bdfa5 | Python | YauheniR/BotInfo | /Parser.py | UTF-8 | 3,086 | 2.71875 | 3 | [] | no_license | from bs4 import BeautifulSoup
from Client import Client
from geopy import distance
def parsingFilesToClients(files):
clients = []
index = 0
for file in files:
with(open('C:\\orders\\' + file, 'rb')) as f:
soup = BeautifulSoup(f.read(), 'html.parser')
time = soup.find_all('s... | true |
3b4d91788a30260b593bbcd67b577197b5c44f60 | Python | Sandy4321/insurance-4 | /scikit-learn/human_analyze.py | UTF-8 | 396 | 2.96875 | 3 | [] | no_license | # Helper for some tests
import sys
import fileinput
from insurance import Data
dataset = Data()
dataset.load(sys.stdin)
# Find customers that chose a weirdo product
n = 0
for customer in dataset.customers.values():
if not customer.did_choose_browsed_plan:
print(customer.customer_id)
n += 1
print()
print("%d... | true |
29ac8ecde0c264aec8297b784c663436d4430097 | Python | m80126colin/Judge | /since2020/CodeForces/1328D.py | UTF-8 | 766 | 3.15625 | 3 | [] | no_license | '''
@judge CodeForces
@id 1328D
@name Carousel
@contest Codeforces Round #629 (Div. 3)
@tag Greedy, Cycle Detecting
'''
from sys import stdin
def isSame(ts):
it = iter(ts)
next(it)
return all(map(lambda p: p[0] == p[1], zip(iter(ts), it)))
def oddRingStart(n, ts):
for x in range(0, n):
if ts[x] == ts[(x +... | true |
08dac739b6c3f0a95f57ceed8889aea1d7339cf0 | Python | Siddeshvr/programmes | /detect_cycle.py | UTF-8 | 804 | 3.421875 | 3 | [] | no_license | def DFS(s):
visited = [False]*(n)
visited[s]=True
stack = []
S = []
stack.append(s)
S.append(s)
while stack:
x = stack.pop(len(stack)-1)
print(x)
for v in range(n):
if L[x][v]:
if v in S: #If visiting vertex is already in S , ... | true |
4d47af8b6891967186b6e7ea87d3d6c8cf7949b8 | Python | liguo-jlu/noneLab | /client/stm32.py | UTF-8 | 3,176 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
import serial
import time
import threading
import requests
import json
import threading
stm32=serial.Serial('/dev/ttyUSB0',9600)
url = "http://127.0.0.1:8080/upData"
OBJNUM=99
class MCU():
def __init__(self,serialObj,url):
self.mcu=serialObj
self.url=url
... | true |
6d844a7de377fb27bbad35bd151d843be9e92108 | Python | alex-bo/leetcode | /1 Billion Users.py | UTF-8 | 645 | 3.28125 | 3 | [] | no_license | def getBillionUsersDay(growthRates):
# Write your code here
days = 1
lo = hi = 1
while not try_days(growthRates, days):
lo = days
days *= 2
hi = days
while lo < hi:
mid = (lo + hi) // 2
if try_days(growthRates, mid): # go down
hi = mid
els... | true |
7b52cbc39c74dc45ca6366508d8313f283b67c30 | Python | JeetKamdar/Big-Data-Assignments | /Assignment 2/task4-sql.py | UTF-8 | 799 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
from pyspark.sql import SparkSession
from csv import reader
from pyspark.sql.functions import format_string
spark = SparkSession.builder.appName("task2SQL").getOrCreate()
parking_violation = spark.read.format('csv').options(header='true',inferschema='true').load(sys.argv[1])
parking_... | true |
bb46ecf21258799ba44b7844db76fd07066c01f8 | Python | SerbulEvhenii/beetroot_academy | /Beetroot/HomeWork/Home_16.py | UTF-8 | 702 | 4.03125 | 4 | [] | no_license | # Home Work 16.1
list1 = [1, 4, 6, 4, 6, 1, 24, 246, 11]
dict1 = {'val1': 5,
'val2': 63,
'val3': 123
}
def with_index(iterable, start=0):
for i in iterable:
print(f'{start} {i}')
start += 1
print('Home Work 16.1')
with_index(list1, 10)
print('')
with_index(dict1, 100)
... | true |
4d2bfc12b4c3dbb1f5934bd887ef4c518b54cdad | Python | cyneo/feminism | /Phased out code/chuliu.py | UTF-8 | 1,218 | 3.375 | 3 | [] | no_license | # Chu Liu Edmond's Algorithm Attempt 1
"""
Chu Liu Edmond's Algorithm is an algorithm performs a depth-first-search (DFS)
for directed graph. This is different from Prim's algorithm.
This was done as the approach at that time is to form a directed graph of all
the words, and see if there are hubs.
USAGE:
Call chuliu(... | true |
63f46b1d261fdee190cfd1d221e601f732d285ad | Python | Meowu/data-structures-and-algorithms-in-python | /Tree/ListTree.py | UTF-8 | 768 | 3.703125 | 4 | [] | no_license | class ListTree(object):
def __init__(self, root, left=[], right=[]):
self._tree = [root, left, right]
def tree(self):
return self._tree
def insert_left(self, item):
t = self.tree().pop(1)
if len(t) > 0:
self.tree().insert(1, [item, t, []])
else:
... | true |
d5e1cf29dcaf2115c8018147b93d44d048190651 | Python | andaok/python | /Algorithm/BackpackAlgorithm.py | UTF-8 | 4,173 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
Created on JUN 25, 2013
@author: WYE
'''
import ujson
from operator import itemgetter,attrgetter,itruediv
# --/
# ่ๅ
็ฎๆณ1๏ผ
# ่ฎพๆM็ง็ฉๅ,ๆฏ็ง็ฉๅ้ฝๆไธไธช้้ๅไธไธชไปทๅผ,ๅๆถๆไธ่ๅ
,ๅ
ถๅฎน้ไธบC,็ฐๅจไปM็ง็ฉๅ้้ๅ่ฏบๅนฒไปถ,
# ไฝฟๅ
ถ้้ไนๅๅฐไบ็ญไบ่ๅ
็ๅฎน้,ไธไปทๅผๅไธบๆๅคง.
#
# ่ฏดๆ๏ผ
# goodslist ๏ผ [[name,weight,value],.... | true |
3c1a6d7ed9649df78d365efb37af8ce3c6a8ed6d | Python | ningzixin/leetCode | /28.py | UTF-8 | 1,007 | 3.234375 | 3 | [] | no_license |
def getNext(keyStr):
j = 0
k = -1
next = [-1]
while j < len(keyStr) - 1:
if k == -1 or keyStr[j] == keyStr[k]:
j += 1
k += 1
next.append(k)
else:
k = next[k]
return next
def strStr(self, haystack, needle):
"""
:type haystack... | true |
e0ef1eef7c7fd6bb19f3033f4240d8ed39741e44 | Python | jarryliu/queue-sim | /sim/queue.py | UTF-8 | 5,679 | 2.96875 | 3 | [
"MIT"
] | permissive |
import numpy as np
import logging
DEFAULT_QUEUE_SIZE=100
class Queue(object):
def __init__(self, id = 0, queueSize = float("inf")):
self.id = id
self.queueSize = queueSize
self.queueLen = 0
self.input = []
self.output = None
self.enqueueTime = []
self.deque... | true |
23367daf778d993a4562bfb496f5487491602ad1 | Python | pedrorio/image_caption_augmentation | /ica/utils/Augmentator.py | UTF-8 | 5,249 | 2.609375 | 3 | [
"MIT"
] | permissive | import json
from nltk.tokenize import word_tokenize
from typing import Set, Dict, List, Union
from dataclasses import dataclass
from .Image import Image
from .Sentence import Sentence
class Augmentator:
"""
Augments the list of datasets.
"""
DatasetNames = Union[
'dataset_sydney_modified',
... | true |
6345167af0f2af81018bc180f497f61f5e9e0201 | Python | Jordan-Camilletti/Project-Euler-Problems | /python/59. XOR decryption.py | UTF-8 | 2,261 | 4.125 | 4 | [] | no_license | """Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.
A modern encryption method is to take a text file, convert the bytes to ASCII, then XOR each byte ... | true |
ef1224641d99a62022f6b0471c75ebcf1a19a6f9 | Python | gideontong/Destiny | /backend/webserver/routes.py | UTF-8 | 1,124 | 2.59375 | 3 | [
"MIT"
] | permissive | from flask import jsonify, request
from random import randint, sample
from json import load
from backend.webserver import app, name, version
from backend.webserver.filters import filter_map
data_folder = 'data'
master = load(open(f'{data_folder}/master.json'))
pets = master['count']
@app.route('/')
def index():
r... | true |
b5c775dbc6af33ce1b4c93a28c5f32531fa78d51 | Python | hat-ad/Basic-Drawing-Window | /Application.py | UTF-8 | 1,477 | 3.046875 | 3 | [] | no_license | from tkinter import *
from PIL import Image, ImageDraw
class mainApplication:
def __init__(self,master):
self.oldx=None
self.oldy=None
self.can=None
self.white=(255, 255, 255)
def canvas(self,master):
self.can=Canvas(master,height=350,width=350,bg="white")
... | true |
1cdc3725e5b0025eb424258fa5957ee56a56649e | Python | anvad/AlgosDataStructures | /4-dynprog-starter-files/placing_parentheses/placing_parentheses.py | UTF-8 | 2,322 | 3.5 | 4 | [] | no_license | # Uses python3
def evalt(a, b, op):
if op == '+':
return a + b
elif op == '-':
return a - b
elif op == '*':
return a * b
else:
assert False
def min_max_recursive_naive_slow(dataset, i, j):
if i == j:
return (int(dataset[i]),int(dataset[j]))
m = float("inf... | true |
8d7a33e87afe048052b156d621700d45484d2f3b | Python | Aasthaengg/IBMdataset | /Python_codes/p03722/s799251827.py | UTF-8 | 625 | 3.03125 | 3 | [] | no_license | INF=10**50
def Bellman_Ford(s,N,Edge):
dist=[INF]*N
dist[s]=0
for i in range(N-1):
for f,t,c in Edge:
if dist[f]!=INF and dist[t]>dist[f]+c:
dist[t]=min(dist[t],dist[f]+c)
F=[False]*N
for j in range(N):
for f,t,c in Edge:
if(dist[t]>dist[f]+c)... | true |
f070ea3ef40e66a1c1ffeea8e5dfad0068c17e34 | Python | YilunHUANG/MLDL | /nnCost.py | UTF-8 | 570 | 2.5625 | 3 | [] | no_license | import numpy as np
def nnCost(nn_params,input_layer_size,hidden_layer_size,num_labels,X,y,lambda)
'''
two layer neural network
X: training example
lambda: regularization parameter
'''
Theta1 = nn_params[0:hidden_layer_size*(input_layer_size+1)].\
reshape(hidden_layer_size,(input_l... | true |
eb558d7995645c8d70545e052b7cf12aa5e63e4a | Python | exeex/devocal | /devocal.py | UTF-8 | 1,496 | 2.6875 | 3 | [] | no_license | import librosa
import lyric_parser
# import matplotlib.pyplot as plt
from numpy import linalg as LA
# import numpy as np
import npp
from librosa.onset import onset_strength
def ms2sample(time_ms, sr=44100):
time_sample = int(round(time_ms / 1000 * sr, 0))
return time_sample
def mute_start(sig):
sig[0:... | true |
5e13a4066f53c3d50d324229aaa0b06ab20aa1a2 | Python | A01376318/Mision_03 | /Trapecio.py | UTF-8 | 745 | 3.984375 | 4 | [] | no_license | #Autor: Elena R.Tovar, A01376318
#Calcular รกrea y perรญmetro midiendo base mayor, base menor y altura de trapecio isรณceles
import math
#calcula area
def calcArea(ba,bb,h):
a=((ba+bb)/2)*h
return a
#calcula hipotenusa
def hipotenusa(ba,bb,h):
hip= math.sqrt((h**2)+(((ba-bb)/2)**2))
return hip
#... | true |
f0e70d8c49e5ba9c9885a2bb9a85ea7b65b63df8 | Python | Brandon-Guerra/Security | /Project4/validator.py | UTF-8 | 4,909 | 3.828125 | 4 | [] | no_license | # Command-line driven telephone listing program
#
#Author: Brandon Guerra
#
#
#USAGE:
#
# Below is a list of commands to interact with the database
#
# ADD <Person> <Telephone #> - Add a new person to the database
# DEL <Person> - Remove someone from the database by name
# DEL <Telephone #> - Remove someone by ... | true |
68f147ae6e000283d4bba87338083484239d5268 | Python | poliarus/Stepik_Python_course | /lesson70.py | UTF-8 | 147 | 2.953125 | 3 | [] | no_license | # ะะพัััะพัะฝะพะต ััะตะฝะธะต ัะฐะนะปะฐ
with open('file.txt') as inf:
for line in inf:
line = line.strip()
print(line)
| true |
7d873ee0d705a6cb4b2aea09b340d09a1de55b1a | Python | unxcepted/FmRadioStreamer | /core/generate_waveforms.py | UTF-8 | 1,697 | 2.5625 | 3 | [
"WTFPL"
] | permissive | #!/usr/bin/python
# PiFmAdv - Advanced featured FM transmitter for the Raspberry Pi
# Copyright (C) 2017 Miegl
#
# See https://github.com/Miegl/PiFmAdv
# This program generates the waveform of a single biphase symbol
#
# This program uses Pydemod, see https://github.com/ChristopheJacquet/Pydemod
import p... | true |
0b89ced83147cff02978cd9c4c98cdeaa3945f22 | Python | Aasthaengg/IBMdataset | /Python_codes/p03286/s917193163.py | UTF-8 | 245 | 3.40625 | 3 | [] | no_license | N = int(input())
digits = []
i = 1
while N != 0:
if N % pow(2,i) == 0:
digits.append('0')
else:
digits.append('1')
N -= pow(-2,i-1)
i += 1
if digits:
print("".join(reversed(digits)))
else:
print("0")
| true |