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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
28b92b5d28e148470034b1910ca8c67cf84b187b | Python | rssawyer23/MultiModalAnalysis | /CI-LEADS/trajectories_by_phase.py | UTF-8 | 7,873 | 2.8125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import trajectories_crystal_island as tci
from dateutil.parser import parse
from sklearn.linear_model import LinearRegression
def _get_tutorial_timestamp(subject_df):
"""Given one subject's event dataframe, return the tutorial timestamp and game duration played"""
start_... | true |
e65699a833dd928c4eb3be92c5c748142255a4ff | Python | Mushtaq123/pi-feeder | /cleanup_gpio.py | UTF-8 | 440 | 2.578125 | 3 | [] | no_license | #/usr/bin/python3
"""This class will cleanup Pi GPIO references if needed. Not used by this program, should be run manually."""
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
Motor1A = 4
Motor1B = 17
Motor1E = 18
GPIO.setup(Motor1A, GPIO.OUT)
GPIO.setup(Motor1B, GPIO.OUT)
GPIO.setup(Motor1E, ... | true |
2c8af0fc8ee46dfcc2d73db571adaf92e9f255d0 | Python | YTLogos/bcbio-nextgen | /bcbio/rnaseq/qc.py | UTF-8 | 2,197 | 2.859375 | 3 | [
"MIT"
] | permissive | """Run Broad's RNA-SeqQC tool and handle reporting of useful summary metrics.
"""
# soft imports
try:
import pandas as pd
import statsmodels.formula.api as sm
except ImportError:
pd, sm = None, None
from bcbio import bam
def starts_by_depth(bam_file, data, sample_size=10000000):
"""
Return a set o... | true |
72c57a021243f83419fcfd6ea0fe1c444233b3df | Python | nixocio/Python | /Unitests/pystest_stdy/bank.py | UTF-8 | 511 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Simple study related to pytest
"""
class InsufficientAmount(Exception):
pass
class BankAccount(object):
def __init__(self, initial_amount=0):
self.current_balance = initial_amount
def withdrawal_cash(self, amount):
if self.current_balance < amount:
... | true |
b2d330f3be65fa1b567ceb2c4eb53bd8ccf6ee9e | Python | BastiaanBekooij/Age-Obfuscation-Morphing | /code/split_dataset.py | UTF-8 | 2,031 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 7 12:14:49 2021
@author: murie
"""
import os, fnmatch, facemorpher
from pyagender import PyAgender
import cv2
import random
import numpy
import matplotlib.pyplot as plt
import random
from PIL import Image
import sys
path1 = "../SiblingsDB/DBs/HQfps"
path2 = "../Sibling... | true |
b85a2c58ce890f97922f4d4e71eb46bf55577539 | Python | tonkocorp/Sentiment-Of-Popular-Songs | /parts/Genius.py | UTF-8 | 925 | 3.234375 | 3 | [] | no_license |
import lyricsgenius
import re
genius = lyricsgenius.Genius('o7wQ-YJ6Oxrl7o7oqagI3MkrTgDvfMcg0JahQdZU_DlUJuKbiEm7EkYS_ORcSVkn',
skip_non_songs=True, excluded_terms=[ "(Live)"], remove_section_headers=True)
#takes in a list of the top 10 artists and their songs
# the key needs to be the song name
#TopSongs = {"Moto... | true |
5136ac7a505817b2bd8678d199aa6efcc4912a93 | Python | kchawla-pi/nilearn_demos | /datasets_and_plotting_10min.py | UTF-8 | 2,343 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Plotting brain images with Nilearn
==================================
Nilearn (https://nilearn.github.io/) has fetchers to download online
neuroimaging datasets and many tools to create interactive or
publication-quality visualizations.
"""
######################################################################
i... | true |
a42577889a869499641f03f3b58dfe19e9484643 | Python | Rahul-BT/leetcode | /29_divide_two_integers.py | UTF-8 | 678 | 3.140625 | 3 | [] | no_license | class Solution(object):
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
if divisor == -1 and dividend == -2**31:
return 2**31-1
elif divisor in [-1, 1]:
return dividend*divisor
... | true |
031f8808ac93e94250890c52c4d91cc06450dfa2 | Python | suzyng83209/markov-messenger-bot | /Reciever/mousehandler.py | UTF-8 | 350 | 2.984375 | 3 | [] | no_license | import pyautogui
def Move(x,y):
xSize,ySize = pyautogui.size()
if x<0 or y<0 or x>xSize or y>ySize:
return False
pyautogui.moveTo(x,y,0.25)
def Click():
pyautogui.click()
def DoubleClick():
pyautogui.doubleClick(interval=0.2)
def Scroll(d):# 1 =down, -1 =u... | true |
961506fcb5290b20377ed3b79f67b00261d3dd2b | Python | Samsung/TizenRT | /os/board/rtl8730e/src/component/ui/LVGL/lvgl/examples/widgets/bar/lv_example_bar_5.py | UTF-8 | 725 | 2.96875 | 3 | [
"MIT",
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"ISC",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive"
] | permissive | #!/usr/bin/env python
#
# Bar with LTR and RTL base direction
#
bar_ltr = lv.bar(lv.scr_act())
bar_ltr.set_size(200, 20)
bar_ltr.set_value(70, lv.ANIM.OFF)
bar_ltr.align(lv.ALIGN.CENTER, 0, -30)
label = lv.label(lv.scr_act())
label.set_text("Left to Right base direction")
label.align_to(ba... | true |
7223b7d6ddd2aa3bcd553111c1b874c79019e587 | Python | eKoulier/jads_kaggle | /google_analytics/aggregation.py | UTF-8 | 10,459 | 3.40625 | 3 | [
"MIT"
] | permissive | import os
import warnings
import numpy as np
import pandas as pd
def load_train_test_dataframes(data_dir, train_file_name='preprocessed_train.csv',
test_file_name='preprocessed_test.csv', nrows_train=None, nrows_test=None):
""" Load the train and test DataFrames resulting from prepr... | true |
2e433249c9ff5342ffd282e086207a263127f0ed | Python | jocsakesley/Lista_de_Tarefas | /tarefas.py | UTF-8 | 2,288 | 3.625 | 4 | [] | no_license | class ListaTarefas():
def __init__(self):
print("Lista de tarefas: ")
self.tarefas = []
self.acoes_feitas = []
self.acoes_desfeitas = []
def adicionar(self):
tarefa = input("Digite uma nova tarefa: ")
self.acoes_feitas.append(('adicionar', tarefa))
self.t... | true |
4c9bfe6cab7dc9f3af19e2703c12635ab3467fbd | Python | opensafely/Factors-associated-with-COVID-19-vaccination | /analysis/study_definition_flow_chart.py | UTF-8 | 4,196 | 2.53125 | 3 | [
"MIT"
] | permissive | ######################################
# This script extracts all data relating to the study population variables so that inclusion/exclusion
# numbers can be calculated in respect to the study population
######################################
# --- IMPORT STATEMENTS ---
## Import code building blocks from cohort e... | true |
7dea055f7dcef5c3a0794a2dff902f2c3fd8174b | Python | oneplus-x/bscan | /bscan/io_files.py | UTF-8 | 814 | 3.515625 | 4 | [
"MIT"
] | permissive | """Utilities for file I/O."""
import shutil
from pathlib import Path
def path_exists(path: str) -> bool:
"""Return whether the specified path leads to a file or directory."""
return Path(path).exists()
def dir_exists(path: str) -> bool:
"""Return whether the specified path leads to a directory."""
... | true |
c760d81e3d5eb07b256c36d2966378649d3482c9 | Python | gamersnautas/python3-course-backup | /Practicando Tkinter/POO con tkinter.py | UTF-8 | 1,665 | 3.5625 | 4 | [] | no_license | from tkinter import *
import pickle
class Persona(Frame): # La clase Persona hereda los atributos del widget Frame
def __init__(self, master, nombre, apellido, dni):
super().__init__(master)
self.master = master
self.nombre = nombre
self.apellido = apellido
se... | true |
5ce7ec6092ee04a1d3d5d06ee762ce042d97a6f0 | Python | Netzvamp/cartoonista | /cartoonista/cartoonist.py | UTF-8 | 5,736 | 3.09375 | 3 | [
"MIT"
] | permissive | import json
import random
import os
import logging
from .exceptions import CartoonError
logger = logging.getLogger(__name__)
class Cartoonist:
data = {}
__objects = {}
def __init__(self, name: str, credits: str, website: str, language: str, base_url: str, scraper: callable, tags: list = None):
... | true |
5fab3a3eea1e323cf8fc0d95ed342b6e9aad2519 | Python | DejanJovanic/ComponentDSL | /ExplanationGenerator.py | UTF-8 | 1,863 | 2.90625 | 3 | [] | no_license | class ExplanationGenerator:
def set_models_disable_explanation(self, models, minimize_function, description_function):
if hasattr(models, 'models'):
if isinstance(models.models, list):
for model in models.models:
self.set_model_wide_explanation(model, minimiz... | true |
bf0c209c220d78bda96681bba0cefcdddf947033 | Python | shouvikbj/IBM-Data-Science-and-Machine-Learning-Course-Practice-Files | /Python Basics for Data Science/stringOperations.py | UTF-8 | 558 | 4 | 4 | [] | no_license | name = "Shouvik Bajpayee"
print(name)
print(len(name))
print(name[1])
print(name[10])
print(name[0:7])
print(name[8:11])
print(name[::-1]) # reverses the string
print(name[::2]) # prints every second element
print(name[:10:2]) # prints every second value upto index 10
print(3 * name)
print("Shouvik\nBajpayee")
prin... | true |
515a6d8985afcf36629d798819b2cfe75c92d72d | Python | VANatHeritage/ConsVision_DevVulnModel | /proc3DEP.py | UTF-8 | 11,695 | 2.78125 | 3 | [] | no_license | # ----------------------------------------------------------------------------------------
# Proc3DEP.py
# Version: Python 2.7.5
# Creation Date: 2015-07-14
# Last Edit: 2019-10-03
# Creator: Kirsten R. Hazler
#
# Summary:
# Set of functions for batch-downloading and post-processing elevation files from the 3DEP prog... | true |
96154e5735501e49e1127c0048288ece661486fa | Python | wangshoujunnew/ai_qi | /web/dataset/base.py | UTF-8 | 6,507 | 2.671875 | 3 | [] | no_license | import tudata as tu
import pickle as pk
import os
from config import basedir
import pandas as pd
import random
DATA_SET_PATH = basedir + '/_dataset'
type_func = lambda type, name: {"type": type, "name": name}
TO_TRANS_D = type_func("trans_d", "ๆฏๆฅไบคๆๆฐๆฎ")
DATASET_TYPE_OBJ_LIST = [
TO_TRANS_D,
]
FILE_NAME_FORMAT =... | true |
140b91e6e41aa0ea2f1235651b30107fba87a9ce | Python | shan-mathi/InterviewBit | /coverPoints.py | UTF-8 | 689 | 3.46875 | 3 | [] | no_license | def coverPoints(A, B):
"""
my approach. since it can go diagonal, we can shift the point
in such a way it needs to travel only the longest side of the
rectange. hence we keep adding the longest side values.
:param A: x coordinates of all the points
:param B: y coordinates of all the y po... | true |
0f45dc1306ba69131fa69e4a3846fa04a54031af | Python | FortranVBA/DAP11 | /test_unit/test_server_unit.py | UTF-8 | 5,382 | 2.703125 | 3 | [] | no_license | import pytest
from flask import Flask, render_template, request
import server
@pytest.fixture
def client(monkeypatch):
def mock_loadClubs():
return [
{
"name":"Simply Lift",
"email":"john@simplylift.co",
"points":"80"
},
{... | true |
062e99b6b27b69630ce64fb3bf816a2e3df92660 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2895/61020/304222.py | UTF-8 | 239 | 3.40625 | 3 | [] | no_license | def bit_and_result_in_m_n(m, n):
if m == n:
return m
else:
return m & bit_and_result_in_m_n(m + 1, n)
m_and_n = input()[1:-1].split(',')
m = int(m_and_n[0])
n = int(m_and_n[1])
print(bit_and_result_in_m_n(m, n))
| true |
9945788ba046c41de4f37f5d102a309ba7d29f1e | Python | liyi-david/holboost | /kernel/dsl.py | UTF-8 | 3,749 | 3 | 3 | [
"MIT"
] | permissive | """
the file defines a dsl framework which is used by the toploop and the plugin system. the framework
intends to support the following usage:
program = {?c int a; a = 1; ?}
or something similar
"""
from abc import ABCMeta, abstractmethod, abstractclassmethod
class DSLParsingFailure(Exception):
pass
clas... | true |
365414ff7f4a5685e06bee97594cb15cf0dbe160 | Python | bogpiano/LearnByWords | /HandlerXml.py | UTF-8 | 583 | 2.84375 | 3 | [] | no_license | import xml.etree.ElementTree as ET
listOfWordsLevel = []
class wordObj:
wordLang1 = ""
wordLang2 = ""
def __init__(self, wordLang1, wordLang2):
self.wordLang1 = wordLang1
self.wordLang2 = wordLang2
def loadLevel(lang1, lang2, level):
listOfWordsLevel.clear()
tree = ET.parse('ListO... | true |
3e0b408c101e83c31c80d41577a2968b2d0c39a1 | Python | musram/python_progs | /real_python_tutorails/coroutines/coroutines_1.py | UTF-8 | 317 | 2.921875 | 3 | [] | no_license | def grep(substr):
while True:
line = yield
if substr in line:
print("found {}".format(substr))
if __name__ == "__main__":
g = grep("users/created")
print(next(g))
print(g.send("users/get api took 1 ms."))
print(g.send("users/created api took 4 ms."))
| true |
f81629277bb1ee50e1348ad01044f245991b621d | Python | matbarPL/avid-scrapper | /selenium/sel.py | UTF-8 | 1,193 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import pandas as pd
#PLEASE SPECIFY CHROME PATH EXECUTABLE
chrome_path = '/Users/mateusz/Documents/Learning/WSSMS/class_07/chromedriver'
url = 'https://conotoxia.com/cryptocurrencies/cryptocurrency-rates'
LIMIT_PAGES = 4
url = 'https... | true |
812f4f07081b2fbf0f946e6502fd7357ddc319ef | Python | 631068264/learn-sktf | /sk/svm.py | UTF-8 | 2,923 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author = 'wyx'
@time = 2018/5/13 21:13
@annotation = ''
"""
"""
่ฝๅคๆง่ก็บฟๆงๆ้็บฟๆงๅ็ฑป๏ผๅๅฝ๏ผ็่ณๅผๅธธๅผๆฃๆตใๅฎๆฏๆบๅจๅญฆไน ไธญๆๅๆฌข่ฟ็ๆจกๅไนไธ
scale้ๅธธ้่ฆ
"""
import numpy as np
from sklearn import datasets
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn... | true |
178bef58f144526f4d8c26d9e59039d66a59dc45 | Python | maryamkakar/CS104-01 | /loops.py | UTF-8 | 165 | 2.984375 | 3 | [] | no_license | x = 1
total = 0
while x != 10:
print ("x= ",x)
total = total + x
x = x+1
print()
while x == 10:
print ("Total= ",total)
break
exit ()
| true |
7ffc2f146bd01422645a46f86fca8f3ee508a1ee | Python | vascoalramos/drive-through-p2p | /utils.py | UTF-8 | 306 | 2.96875 | 3 | [
"MIT"
] | permissive | import time
def work(seconds):
time.sleep(abs(seconds))
def contains_successor(identification, successor, node):
if identification < node <= successor:
return True
elif successor < identification and (node > identification or node < successor):
return True
return False
| true |
6280821611a0d57871c79760142f960e69173c7f | Python | shivani-tomar/OOP-s-using-python | /Polymorphism/experiment.py | UTF-8 | 724 | 4 | 4 | [] | no_license | class Shapes:
def __init__(self):
print("Lets calculate areas")
def area(self,radius):
self.radius = radius
print(3.14 * self.radius * self.radius)
def area(self, length = 0, width = 0):
self.length = length
self.width = width
print(self.length * s... | true |
d1420f3fc1615a33032d0879c75adde461153470 | Python | Louislar/ar_surgery_img_process | /img_process.py | UTF-8 | 809 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
# print(os.listdir('./image/'))
all_image_list = os.listdir('./image/')
all_image_list = ['./image/'+i for i in all_image_list]
print(all_image_list)
img_list = []
for i in all_image_list:
img_list.append(cv2.imread(i))
edge_list = []
... | true |
98577c3e2030cea430423b728f0e1446c21dcf8e | Python | snowborodist/ya-algorithms-training-2 | /Division_B/Homework_3/ะก.py | UTF-8 | 358 | 3.296875 | 3 | [] | no_license | sequence = input().split()
def solution():
all_nums = set()
not_uniques = set()
for num in sequence:
if num not in all_nums:
all_nums.add(num)
else:
not_uniques.add(num)
uniques = all_nums.difference(not_uniques)
return [num for num in sequence if num in u... | true |
d8a453f8b87097d7afc685a7237f45e992e4f707 | Python | sepehr-ahmadi/maktab52_python | /hw3/question3.py | UTF-8 | 603 | 3.5 | 4 | [] | no_license | class books:
books_counter = 0
id_book = 0
def __init__(self, name, price, number_of_book):
self.name = name
self.price = price
self.number_of_book = number_of_book
books.books_counter = books.books_counter + number_of_book
books.id_book = books.id_book + 1
def ... | true |
bb37b6d5263ed6736fcb22f36f34245232534cf4 | Python | sankeerthankam/Code | /Leetcode/Bootcamp/Week 2/258. Add Digits.py | UTF-8 | 634 | 4.15625 | 4 | [] | no_license | # Approach 1:
# Write a function that return the sum of digits of a number
# While the sum is not in the range (0-9)
# Continue calculating the sum of digits
# Update the sum_ with new sum_
# Reutrn the sum_
# Approach 2:
# This problem follows a pattern
# Its the quotient of num % 9
def addDigits(num):
... | true |
c34cd5b6d7624c313f7c5a32476b059b8981afc1 | Python | TUBAME/migration-tool | /src/tubame.portability/resources/tubame-search-modules/src/extend/ext_search_xml_text.py | UTF-8 | 2,278 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
[ๆฆ ่ฆ]XMLใใกใคใซใฎใฟใฐใฎๅค(text)ใๆค็ดขใใ
[่ฉณ ็ดฐ]็ฌฌไธๅผๆฐใฎXPathใซใใใใใใใผใ็พคใๅฏพ่ฑกใซใtextใฎๅคใใ็ฌฌ๏ผๅผๆฐใฎใญใผใฏใผใใซใใใใใใๆค็ดขใๅฎๆฝใใใ
[ๅ ่]็ฌฌ๏ผๅผๆฐใฎใญใผใฏใผใใฏๅคงๆๅญใๅฐๆๅญใๅบๅฅใใชใใ
[็ฐ ๅข] Python 2.7
"""
__author__ = ' Copyright (C) 2011 Nippon Telegraph and Telephone Corporation, All rights reserved.'
import os
import sys
import re
from lxml impo... | true |
dbcd15b08d5bde525c8bd2fdd4c95ee1f2e22e2e | Python | HSx3/TIL | /algorithm/day23/day23-A/(5250)์ต์๋น์ฉ.py | UTF-8 | 1,244 | 3.078125 | 3 | [] | no_license | import sys
sys.stdin = open('(5250)์ต์๋น์ฉ_input.txt', 'r')
T = int(input())
def solve(N):
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
D = [[1000000000] * N for i in range(N)] # ๊ฐ ์นธ ๊น์ง์ ์ต์ ์ฐ๋ฃ ์๋น๋
D[0][0] = 0
q = [] # ์๋น๋์ด ๊ฐฑ์ ๋ ์ง์ญ์ ์ธ์ ์ง์ญ ์ ์ฅ์ฉ
q.append((0, 0))
while q: # ๋์ด์ ๊ฐฑ์ ๋๋ ๊ฒฝ์ฐ๊ฐ ์์ ๋๊น์ง ๋ฐ๋ณต
... | true |
7624b3d72d53edab87d541944343c499a33e7425 | Python | Pawan300/Algorithms-Python | /nptel/nptel_descending.py | UTF-8 | 130 | 3.234375 | 3 | [] | no_license | def descending(l):
flag=True
for i in range(1,len(l)):
if(l[i]>l[i-1]):
flag=False
break
return (flag) | true |
9ca6b29340318fd51878765785c898512f5e0869 | Python | anibali/h36m-fetch | /metadata.py | UTF-8 | 1,455 | 2.765625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import xml.etree.ElementTree as ET
class H36M_Metadata:
def __init__(self, metadata_file):
self.subjects = []
self.sequence_mappings = {}
self.action_names = {}
self.camera_ids = []
tree = ET.parse(metadata_file)
root = tree.getroot()
... | true |
0caccc66837c61740f68bf3972caa23250b06f6f | Python | dearamerican/python-practice | /ex6.py | UTF-8 | 772 | 4.21875 | 4 | [] | no_license | x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s" % (binary, do_not)
print x
print y
#%r and %s are similar, but %r and repr are designed to be unambiguous (it's a string? quotation marks), where as %s and str are designed to be human readable. http:/... | true |
1de3b83a3eec5d850e6023954afb3e5f2a63a09c | Python | dustinbrooks60/SUD-StarWars | /unit-tests/test_create_tusken_raider.py | UTF-8 | 866 | 3.34375 | 3 | [] | no_license | from unittest import TestCase
from monster import create_tusken_raider
class TestCreate_tusken_raider(TestCase):
def test_create_tusken_raider(self):
expected_output = {'Name': 'Tusken Raider', 'Class': 'Monster', 'HP': 5,
'Strength': 5, 'Dexterity': 10,
... | true |
35789d31c38d4959be8dd08805deb821da5da6c5 | Python | CycloneBoy/pythonLearning | /LearningOpenCV3WithPython/chapter3/houghDemoCircles.py | UTF-8 | 801 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/6 21:16
# @Author : CycloneBoy
# @Site :
# @File : houghDemoCircles.py
# @Software: PyCharm
import cv2
import numpy as np
planets = cv2.imread("../images/planet_glow.jpg")
gray_img = cv2.cvtColor(planets,cv2.COLOR_BGR2GRAY)
img = cv2.medianBlur... | true |
064578968afad0475e68849b272132acde2e738e | Python | mhils/mitmproxy | /examples/addons/nonblocking.py | UTF-8 | 1,051 | 2.875 | 3 | [
"MIT"
] | permissive | """
Make events hooks non-blocking using async or @concurrent
"""
import asyncio
import logging
import time
from mitmproxy.script import concurrent
# Hooks can be async, which allows the hook to call async functions and perform async I/O
# without blocking other requests. This is generally preferred for new addons.
... | true |
b90de2178e4e7256d71bc4efc2b335ab1f57fe11 | Python | JordaoMemoria/topicosTrabalhoFinal | /trabalho/modelos/bayesian_polinomial_linear_regression_new.py | UTF-8 | 762 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from trabalho.modelos.bayesian_linear_regression_new import BayesianLinearRegressionNew
def ฮฆ_polinomial(X, P):
X_df = pd.DataFrame(X)
for c in X_df.columns.tolist():
columnToPol = X_df[c].astype(np.float64)
for i in range(int(P) - 1):
X_df[s... | true |
fb2e1ed8d9b737fd2cad6157117cb6f4d50b90fa | Python | crazymerlyn/code | /euler/64.py | UTF-8 | 421 | 3.171875 | 3 | [] | no_license | from utils import is_square
def continued_fraction(n):
if is_square(n): return [int(n**0.5)]
num = 0
denom = 1
rep = []
while True:
m = int((n**0.5 + num) / denom)
rep.append(m)
if m == 2 * int(n**0.5):
return rep
num, denom = denom * m - num, (n - (num ... | true |
9a1061d3b2299b80351ef0858d75022c8e6aa98c | Python | pagarsky/army-python | /State/Berserker_state/Berserker_state.py | UTF-8 | 368 | 2.703125 | 3 | [] | no_license | from Unit.Unit import *
class Berserker_state(State):
def __init__(self, name : str, hp : int, dmg : int):
State.__init__(self, name, hp, dmg)
def take_damage(self, dmg : int):
self.hp -= dmg
if self.hp <= 0:
self.hp = 0
else:
self.dmg += 10
def t... | true |
952e88dcce1ec7a685919df222c85a83e6c8d2e8 | Python | junly917/Learn-Python | /zabbix/index.py | UTF-8 | 3,732 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
class Schoolmember(object):
def __init__(self,name,age):
self.name = name
self.age = age
def tellme(self):
print("Hello,ๆ็ๅๅญๆฏ๏ผ%s" % self.name)
class Teacher(Schoolmember):
def __init__(self,name,age,salarys):
super(Teacher... | true |
88daf263cfc2ff2a0023010809253cd29fad9dc7 | Python | c2huc2hu/wilkinson | /bookcipher/wordbank.py | UTF-8 | 13,209 | 2.984375 | 3 | [] | no_license | # functions for handling wordbanks
import re
from functools import total_ordering, lru_cache
from avltree import TokenAVL
MIN_WORD = 160 # index of first word in table cipher
MAX_WORD = 1220 # maximum word in table cipher
@total_ordering
class Token():
dict_re = r'(?P<page>\d+)\.\[(?P<row>\d+)\](?P<col>[=-])'
... | true |
daf8198046f542f2b4c0268275a758d8a077fa39 | Python | musir-git/icmp-remote-shell | /icmp_remote_shell/common.py | UTF-8 | 2,615 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import re
import socket
import struct
import time
ICMP_ECHO_REQUEST_TYPE = 8
ICMP_ECHO_REQUEST_CODE = 0
def checksum(packet):
def carry_around_add(a, b):
c = a + b
return (c & 0xffff) + (c >> 16)
s = 0
packet = bytearray(packet)
for i in range(0, len(packet), 2):
tr... | true |
b053bcc9383d2dc09059d9c2db12e69871e9513c | Python | dorian821/mt-opt | /trend_lines.py | UTF-8 | 5,138 | 2.5625 | 3 | [] | no_license |
find mins/maxs in time_frame
draw linspace between
def get_bottom_idx():
def get_top_idx():
def find_lsq(candidates, data): TL anchor is always the first candidate, candidates is list of tuples of (max/min, index), data is the OHLC of the stock
anchor = candidates[0]
c_rank = {}
i = 1
for c in candidates[1... | true |
45cc79ef78a0413213fee78fb90a39df7e17a3a0 | Python | BurntTech/homie4 | /test_integer.py | UTF-8 | 756 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import time
from homie.device_integer import Device_Integer
mqtt_settings = {
"MQTT_BROKER": "OpenHAB",
"MQTT_PORT": 1883,
}
class My_Integer(Device_Integer):
def set_integer(self, value):
print(
"Received MQTT message to set the integer to {}. Must replace thi... | true |
76f9bdc7670b5c0687e68b5682ce80798604106d | Python | dvanderelst/R12sonar | /maxbotix.py | UTF-8 | 1,146 | 2.609375 | 3 | [] | no_license | import utime
import pyb
import array
import pyb
import json
import time
from machine import UART
green = pyb.LED(2)
red = pyb.LED(1)
uart = UART(1, 9600)
uart.init(9600, bits=8, parity=None, stop=1)
break_char = '*'
fs = 1000
ms = 50
samples = int((fs/1000) * ms)
buffer = array.array('... | true |
f151162e8e61efa14058cb91ca831cc9a5ccfe14 | Python | knoppanthony/advent-2020 | /4/4.py | UTF-8 | 3,149 | 3.28125 | 3 | [] | no_license | import re
def main():
input = open("input", "r")
passport_list = input.read().split("\n\n")
print(partOne(passport_list))
print(partTwo(passport_list))
def validate_attribute(attribute,value):
if attribute == "byr":
if len(value) == 4 and int(value) >= 1920 and int(value) <= 2002:
... | true |
be8eab72dd352c865ec0f1be50acd82cde68007d | Python | paularah/Data-Structures-Algorithms | /play.py | UTF-8 | 1,041 | 3.625 | 4 | [] | no_license | def minRemoveToMakeValid(s: str) -> str:
stack = []
remove_indices = set()
for i in range(len(s)):
if s[i] == '(':
stack.append(i)
elif s[i] == ')':
if not stack:
remove_indices.add(i)
else:
stack.pop()
# print(stack)
... | true |
b98c022b26ff1c4d428b56799b2e37a6b06725eb | Python | dxcv/finances | /finances/trading/bots/dynamic_stoploss/strategy_dynamic_stoploss_binance.py | UTF-8 | 9,054 | 2.734375 | 3 | [] | no_license | import sys
import os
cfp, cfn = os.path.split(os.path.abspath(__file__))
sys.path.append(os.path.join(cfp, '..', '..', '..', '..')) # <--------- this is to run in pythonanywhere
import json
import time
from finances.trading.strategies.dynamic_stoploss.dynamic_stoploss_strategy import dynamic_stoploss_strategy
from... | true |
c4f23f29b3430475800f7ec9e8335c613fa2d0b0 | Python | bywdf/python_study | /chapter15/scatter_squares.py | UTF-8 | 496 | 3.25 | 3 | [] | no_license | import matplotlib.pyplot as plt
x_values = list(range(1, 1000))
y_values = [i**2 for i in x_values]
plt.scatter(x_values, y_values, c =y_values, cmap=plt.cm.Blues, s=20)
# ่ฎพ็ฝฎๅพ่กจๆ ้ขๅนถ็ปๅๆ ๅ ไธๆ ็ญพ
plt.title('squre numbers', fontsize=24)
plt.xlabel('value', fontsize=14)
plt.ylabel('square of value', fontsize=14)
plt.axis([0... | true |
6d6e4ec78e0d85dee0e916b97e27b6f98994ce60 | Python | Abis47/HH-PA2609-1 | /Practice Excercises/Basic Python Excercises/prac (36).py | UTF-8 | 348 | 4.5 | 4 | [] | no_license | """Write a function that takes a vowel character (i.e. a
string of length 1) and returns True if it is a vowel,
False otherwise."""
vowels = ['a', 'e', 'i', 'o', 'u']
def vornot(str):
if str in vowels:
print("Valid Vowel Char")
return True
else:
print("Not Valid Vowel Char")
return False... | true |
49a9b02967d1eff9093c24ea1cb1c41a019b72f6 | Python | tungspm0608/C4T-B13 | /season 9/tuhoc43.py | UTF-8 | 198 | 2.9375 | 3 | [] | no_license | daysonguyento = [1,-1,5,7]
a = int(input('ban muon xem so nao'))
if a in daysonguyento:
print('so nay co trong day tai vi tri: ',daysonguyento.index(a))
else:
print('so nay ko co trong day') | true |
80355924e850d997fa1153bb9d72fbea57f4e0ab | Python | arne-cl/PSTreeKernels | /src/PSTreeKernels/tree.py | UTF-8 | 4,470 | 3.875 | 4 | [] | no_license |
class TreeNode:
'''
Class responsible for holding a generic Tree node
Attributes
----------
value : str
the ID of the node, e.g. a syntactical category like 'NP' or 'VB'
parent : TreeNode or None
a tree node that represents the parent of this one. If this node
is the ro... | true |
dd92f57ba38be2a00e68dac9cb0f7d47e2573e23 | Python | ephreal/rollbot | /tests/test_sr3_character.py | UTF-8 | 3,548 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
This software is licensed under the License (MIT) located at
https://github.com/ephreal/rollbot/Licence
Please see the license for any restrictions or rights granted to you by the
License.
"""
import asyncio
import json
import unittest
from utils.rpg.shadowrun3e import character
class T... | true |
4b14b705351f1ae08ef7ead2f3b265ab7705ed93 | Python | xinyixiao/sxwl-dl | /hzy/logo_recognize/splitimage/splitimage.py | UTF-8 | 2,358 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ่ๆฌไผ ๅ
ฅไธไธชๅๆฐ๏ผๆบ็ฎๅฝ๏ผๆฏไพ๏ผ็ฎๆ ็ฎๅฝ
# ไฝ็จ๏ผๅฐๆฟ็ฎๅฝไธญ็ๅพ็ๆ็
งๆฏไพๅญๅ
ฅ็ฎๆ ็ฎๅฝ็trainๅvalๆไปถๅคนไธญ
import argparse
import os
import random
parser = argparse.ArgumentParser()
parser.add_argument("source", help = "which source do u want to split")
parser.add_argument("ratio", help = "display a square of a given number... | true |
67e27b6536732da3819ff72ae8aa734f1633b348 | Python | Novartis/cellxgene-gateway | /tests/test_backend_cache.py | UTF-8 | 1,216 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from unittest.mock import MagicMock, patch
from cellxgene_gateway.backend_cache import is_port_in_use
class TestIsPortInUse(unittest.TestCase):
@patch("socket.socket")
def test_GIVEN_free_port_THEN_returns_true(self, socketMock):
connectMock = socketMock()
connectMock.connect_... | true |
ce22f166c8beca6d7d08f16d3353efb2cf7165a1 | Python | caropro/liao_study | /qt_video/t_14.py | UTF-8 | 1,862 | 2.5625 | 3 | [] | no_license | #coding=utf-8
from PyQt5 import QtWidgets
from PyQt5 import QtCore
from PyQt5 import QtGui
import sys
class win(QtWidgets.QMainWindow):
def __init__(self):
super(win,self).__init__()
self.setGeometry(100,100,400,400)
self.setWindowIcon(QtGui.QIcon("favicon.png"))
self.setWindowTitle("tut_14")
extract=QtWi... | true |
82b40598a76bf78265f45b587d7cdbbcbc9dc9be | Python | H4RP3RK/outerzone | /basket/views.py | UTF-8 | 2,079 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render, redirect, reverse, HttpResponse, get_object_or_404
from django.contrib import messages
from products.models import Product
def view_basket(request):
""" View returns the shopping basket """
return render(request, 'basket/basket.html')
def add_to_basket(request, item_id):... | true |
1401a856de0b3eb657b2febe049f89a685e8e766 | Python | snu-python/pythonbook | /lab/lab5_4.py | UTF-8 | 988 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python
"""This file is provided for educational purpose and distributed for class use.
Copyright (c) by Jinsoo Park, Seoul National University. All rights reserved.
File name.....: lab5_4.py
Description...: Sample solution for Lab 5-4.
This program demonstrates simple arithmetic operatio... | true |
a372a029ea83f697cab52dad081f6e560e047264 | Python | yanqiangmiffy/daguan-information-extraction | /002_bilstm_crf/train_bilstm_crf.py | UTF-8 | 1,746 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:quincyqiang
@license: Apache Licence
@file: 002_bilstm_crf.py
@time: 2019-07-12 22:58
@description:
"""
import numpy as np
import pandas as pd
from prepare_data import bulid_dataset
from keras.models import Model, Input
from keras.layers import LSTM, Embedding, D... | true |
9375d3baaeb43a2811c439f0ab6ac7b17538f8c7 | Python | smj007/Breakout_A3C | /model.py | UTF-8 | 3,111 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 02:52:26 2020
@author: smj
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def normalized_column_initializer(weights, std = 1.0):
out = torch.randn(weights.size())
out *= std / torch.sqrt(out.... | true |
b086bbb0f845f0d95daacb957f0b34686900e8a7 | Python | TimTheFiend/Automate-the-Boring-Stuff-with-Python | /_Finished/Ch13/decrypt.py | UTF-8 | 298 | 2.84375 | 3 | [] | no_license | from PyPDF2 import PdfFileReader, PdfFileWriter
pdf_reader = PdfFileReader(open("Ch13/encrypted.pdf", 'rb'))
print(pdf_reader.isEncrypted) # Output: True
pdf_reader.decrypt("rosebud")
print(pdf_reader.isEncrypted) # Output: True
print(pdf_reader.getPage(0).extractText()) # Output: [TEXT FROM PDF] | true |
0b21a24389238ebf715d9fd26bb2827f6563c944 | Python | probieVaibhav/TextAnalyzer | /mysite/views.py | UTF-8 | 3,767 | 3.03125 | 3 | [] | no_license | # this file is created by me - vaibhav
# import httpresponse, because it uses this to make request..
from django.http import HttpResponse
# import render to use render template functionality
from django.shortcuts import render
# index url function
def index(request):
# return HttpResponse('<h1>This is Home Page....... | true |
8955760c5850aa005023c76c0c6db1d563620fa2 | Python | aryanchordia/LeetCode-Questions | /reverse-integer.py | UTF-8 | 494 | 3.015625 | 3 | [] | no_license | class Solution:
ย ย def reverse(self, x: int) -> int:
ย ย ย ย if -10 < x < 10:
ย ย ย ย ย ย return x
ย ย ย ย if x > 0:
ย ย ย ย ย ย s = str(x)
ย ย ย ย ย ย r = int(s[::-1])
ย ย ย ย ย ย if r < pow(-2,31) or r > pow(2,31) - 1:
ย ย ย ย ย ย ย ย return 0
ย ย ย ย ย ย return r
ย ย ย ย x = -x
ย ย ย ย s = str(x)
ย ย ย ย r = int(s[... | true |
f04492c2e777cff08f7c2d06b94ea536ca6e87cc | Python | ozaryx/Python_lessons | /lesson10/less10_async_vs_sync.py | UTF-8 | 3,925 | 3.3125 | 3 | [] | no_license | import asyncio
from random import uniform, choice
from time import monotonic, sleep
MENU = ['ะะพัั', 'ะะพัะปะตัั', 'ะะปะพะฒ', 'ะะฐะฝัั']
async def cook_order(order, num):
print(f'ะัั
ะฝั ะณะพัะพะฒะธั "{order}" ะดะปั ััะพะปะธะบะฐ {num}')
await asyncio.sleep(uniform(5, 15))
result = '"{}" ะณะพัะพะฒ'.format(order)
print(f'ะัั
ะฝั: ... | true |
a7242040a3864a39cfa34667f6f9405b085dec49 | Python | nanavatisneha/redcafe | /post-list.py | UTF-8 | 468 | 2.53125 | 3 | [] | no_license | # A script to get data from a list of posts on a thread.
import urllib2
# Remove/Change the following code according to your proxy
proxy = urllib2.ProxyHandler({'http': 'proxy.iiit.ac.in:8080'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
#
url = 'http://www.redcafe.net/threads/juan-mata-201... | true |
9d75cde2aa0ee0eca9c03799dca6412f4627c382 | Python | leodelrey/api-metron | /tests/test_character.py | UTF-8 | 7,415 | 2.578125 | 3 | [] | no_license | from src.models.CharacterModel import CharacterModel
from src.models.HatModel import HatModel
import json
# ----------------------------------------------
# CREATE TESTS
# ----------------------------------------------
def test_create_p_char_with_yellow_hat(testapp):
request_data = {
'name': ... | true |
ef8e38ab18899b9fcc383187d5d5a8049dd60c2a | Python | g33k4y/AdventOfCode2020 | /day 6 - Custom Customs/main2.py | UTF-8 | 1,947 | 3.453125 | 3 | [] | no_license | with open('input.txt') as f:
lines=f.readlines()
lines.append("\n")
question_list=[]
for i in range(97,123):
question_list.append(chr(i)) #26 questions from a-z
group_yes_list=[] #list of questions answered yes from each member in the group (duplicative)
members_in... | true |
c675e3a782314cfcd0a673417779c30d30a97a0f | Python | rileychin/10.009-digital-world | /Week 2/Week2DWchemsubmission.py | UTF-8 | 947 | 3.375 | 3 | [] | no_license | import scipy.constants as c
import math
def deg_to_rad(deg): #submission1
return round(deg/180 * math.pi,5)
def rad_to_deg(rad):
return round(rad/math.pi * 180,5)
print(deg_to_rad(180))
print(rad_to_deg(2*math.pi))
import numpy as np #submission2
def spherical_to_cartesian(r,theta,phi):
x = r*(np.si... | true |
9c5da5ed693294b9e8878d3efa56c4702df039c2 | Python | gui2one/dem_viewer | /resources/python/download_from_urls.py | UTF-8 | 651 | 2.765625 | 3 | [] | no_license | import sys
import os
import requests
url_file = os.path.join(os.path.dirname(__file__), "urls.txt")
total_num = 0
with open(url_file, "r") as f:
lines = f.readlines()
print("num lines : ", len(lines))
total_num = len(lines)
for i, line in enumerate(lines):
url = line.rstrip()
print(i+1, '/', tot... | true |
079d5f9dc2cff6c6acd98245f6a635f47f254cf7 | Python | roblivesinottawa/problem_solving | /weektwo/is_positive.py | UTF-8 | 77 | 3.40625 | 3 | [] | no_license | def is_positive(n):
if n > 0:
return True
print(is_positive(30)) | true |
bbacb6f9805f5ab5e5fac42f2e1ac3b1c01ce875 | Python | BruceJillis/ModJam4 | /autocommit.py | UTF-8 | 737 | 2.5625 | 3 | [] | no_license | import time, os, winsound, subprocess
from datetime import date
WAIT = 60 * 14.5
START = date(2014, 5, 15)
def beep():
winsound.Beep(1035, 350)
def do(cmd):
print(cmd)
os.system(cmd)
def getCommitMessage():
delta = START - date.today()
return "autocommit %s" % time.strftime('day ' + str(delta.days + 1) + ' %H:... | true |
1f99525721bb383522d8c3cba4821d44caef538e | Python | nitr0313/euler_problem | /problem_3/main.py | UTF-8 | 813 | 3.421875 | 3 | [] | no_license | import sympy
DEBAG = False
def func_delitel(delimoe, delitel):
return True if (delimoe%delitel == 0) else False
def is_prime(num):
if num%2 == 0:
return False
if num != 3 and num%3 == 0:
return False
if num !=5 and num%5 == 0:
return False
for i in range(3,num**0.5,2):
... | true |
612e5146b0f95a699cd4e712ca0603f8e9aa131d | Python | dx404/cheetSheet | /python/formatNumbers.py | UTF-8 | 193 | 3.359375 | 3 | [] | no_license | # decimal integers to binary and hex strings
>>> '{:b}, {:x}'.format(255, 65535)
'11111111, ffff'
# hex strings to numbers
>>> int("ff", 16)
255
>>> int("0xff", 16)
255
>>> int("0xff", 0)
255
| true |
c8bab405ab6a9491ee4b3da3d0ea71c580f00228 | Python | HoChangSUNG/sparta_algorithm | /week_3/homework/02_is_correct_parenthesis._my_ver.py | UTF-8 | 617 | 4.25 | 4 | [] | no_license | import queue
s = "(())()"
def is_correct_parenthesis(string):
q=queue.Queue()
for char in string : # ๋ฌธ์์ด์ ๋งจ ์๋ถํฐ queue๋ก ์
๋ ฅ
q.put(char)
count=0
while q.qsize() >0 : # queue์ ๋ด๋ถ ๊ฐ์ด ์๋ ๋์
if q.get() == '(' :
count += 1
else :
count -= 1
if count < ... | true |
62c286765c51e5077ff1b7feedae43286a05b7d1 | Python | maiconcodedevelopment/scanner-dl | /lerning/ocr.py | UTF-8 | 2,055 | 2.546875 | 3 | [] | no_license | import io
import cv2
import numpy
import matplotlib.pyplot as plt
import pytesseract
from PIL import Image
# image = cv2.imread('scannner.png',cv2.IMREAD_GRAYSCALE)
# print("{0}".format(image))
# image = Image.open("scanner.png")
# phrage = pytesseract.image_to_string(image=image,lang='por')
# print(phrage)
img = c... | true |
0db90bd7b9e308e12251bd53c1a64658a5349feb | Python | chrislockard21/ise589 | /python_files/homework/hw2/hw2_p8.py | UTF-8 | 2,707 | 4.34375 | 4 | [] | no_license | '''
@author: Chris Lockard
Problem 8:
Letโs play Rock, Paper and Scissors. Devise a program that lets the user play
the game with the Computer for a specified number of attempts. For each
attempt, the user inputs his/her hand and the computer randomly picks one from
the list. If you know the game โ Rock beats Scissor... | true |
2320f5cdb11a5ec18a47d341b69f46142ef4f263 | Python | daniel-reich/ubiquitous-fiesta | /8oNKM4osgxYyrFtGL_22.py | UTF-8 | 175 | 2.640625 | 3 | [] | no_license |
def multiply(l):
bigL = []
smL = []
for x in range(len(l)):
for y in range(len(l)):
smL.append(l[x])
bigL.append(smL)
smL = [] # reset
return bigL
| true |
0499d1cd3027511d77af86d8afdc40171f757668 | Python | albert2lyu/python-itchat | /test/module_using_sys.py | UTF-8 | 165 | 2.859375 | 3 | [
"MIT"
] | permissive | import sys
import os
print(os.getcwd())
print('the command line arguements are:')
for i in sys.argv:
print(i)
print('the python path is {}'.format(sys.path))
| true |
3e41fac70365d9cefb4b906acfcd880087a8dd4f | Python | krithik1008/AJIT-libraries | /8uconv_2d/extract_arr.py | UTF-8 | 1,382 | 2.578125 | 3 | [] | no_license | import re
import struct
import numpy as np
from PIL import Image
p=re.compile('actual = 0x[0-9a-f]*')
f= open("main.log",'r')
s=0;
i=0;
j=0;
data=list()
nx=5
ny=8
for line in f:
m=p.search(line)
if m:
x=m.group()
y=x[11:20]
if len(y)==1:
data.append(0)
data.append(0)
data.append(0)
data.append(i... | true |
9ee0d290f5e0e0892fcccee11e1d5c0867bf3822 | Python | gabriel1997castro/Programming | /FG/URI/URI_python/Gabriel/1006.py | UTF-8 | 90 | 2.890625 | 3 | [] | no_license | a = input()
b = input()
c = input()
m = ((2*a)+(3*b)+(5*c))/10
print "MEDIA = %.1f" % m
| true |
89d7f000b23673722608b4c816b6090fce0459ec | Python | jun0811/TIL | /algo/0910/tree/์์
๋ด์ฉ์ ๋ฆฌ.py | UTF-8 | 1,686 | 3.78125 | 4 | [] | no_license | # ์์
๋ด์ฉ ์ ๋ฆฌ
# ์ ํ๊ตฌ์กฐ, ๋น์ ํ๊ตฌ์กฐ
# ์ ํ๊ตฌ์กฐ(1:1 ๊ด๊ณ)
# ํํ ๋ฐฉ๋ฒ : list
# ์ํ : for๋ฌธ
# ๋น์ ํ๊ตฌ์กฐ
# ํธ๋ฆฌ(1:N) ,๊ทธ๋ํ(N:N)
# ํฌํจ๊ด๊ณ - ๊ทธ๋ํ > ํธ๋ฆฌ > ์ด์งํธ๋ฆฌ
# ํํ๋ฐฉ๋ฒ (์ ์ฅ)
# ๊ทธ๋ํ(N:N) : ์ธ์ ํ๋ ฌ, ์ธ์ ๋ฆฌ์คํธ, ๊ฐ์ ๋ฐฐ์ด
# ์ด์งํธ๋ฆฌ(1:N) : 1์ฐจ์ ๋ฐฐ์ด, 1์ฐจ์๋ฐฐ์ด(์ธ์ ๋ฆฌ์คํธ)
# ์ํ๋ฐฉ๋ฒ
# ๊ทธ๋ํ(N:N) : DFS(stack), BFS(Queue) - Aํ ํ๊ฐ ์ฃผ ๋ด์ฉ
# ์ด์งํธ๋ฆฌ(1:N) : ์ ์์ํ, ์ค์ ์ํ, ํ์ ์ํ (visited ์ฒดํฌ ์ํด๋ ๋จ)
... | true |
41f2800a101ef2bf32c669d7e5865218a9109e8f | Python | CheshireTsui/Encode-Decode | /Hamming.py | UTF-8 | 5,393 | 2.734375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
X = [[0,0,0,0],
[0,0,0,1],
[0,0,1,0],
[0,0,1,1],
[0,1,0,0],
[0,1,0,1],
[0,1,1,0],
[0,1,1,1],
[1,0,0,0],
[1,0,0,1],
[1,0,1,0],
[1,0,1,1],
[1,1,0,0],
[1,1,0,1],
[1,1,1,0],
[1,1,1,1]]
G = [[1, 0, 0, 0, 0, 1, 1],
[0, 1, ... | true |
7499946e4126ba1cf9d872620e13cb15845fe07a | Python | cnguyenm/door_cam | /examples/test_fb_recog.py | UTF-8 | 549 | 2.53125 | 3 | [] | no_license | from pprint import pprint
from fbrecog import FBRecog
import time
import config # download separately
# useful variable
path = "img/new2.jpg"
# token fb graph API v2.12
access_token = config.access_token
cookie = config.cookie
fb_dtsg = config.fb_dtsg
# instantiate the recog class
t1 = time.time()
# re... | true |
81714486839241ff9eb3884b375f5918d033a07e | Python | syzymon/USOSweb-automated | /tOKens.py | UTF-8 | 6,725 | 2.53125 | 3 | [
"MIT"
] | permissive | import os
import ruamel.yaml as yaml
import logging
import logging.config
import coloredlogs
import json
import datetime
from os.path import join, dirname
import yagmail
from dotenv import load_dotenv
from usos.authentication import Authentication, Credentials
from usos.data import DataController
from usos.web_driver... | true |
2dc08d51a8b28f01ace29163280cd6c551048b89 | Python | pombredanne/burrows_wheeler_alignment | /BWA.py | UTF-8 | 11,122 | 3.546875 | 4 | [] | no_license | """Burrows-Wheeler Alignment - String Search
--------------------------------------------
This is a very simply quick and dirty implementation of a Burrows-Wheeler Aligner for indexing and sequence alignment.
It does NOT implement any of the heuristic methods included in the actual BWA algorithm, so implements the basi... | true |
c981d5e00c513e5cc7d838bb6a1160cf91b0530d | Python | Zorqe/DataMiningProjectCTU-13 | /processData.py | UTF-8 | 12,808 | 3.171875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import time
from pathlib import Path
from sklearn import preprocessing
from sklearn.preprocessing import LabelEncoder
"""
Input: All 13 binetflow CSV files for the CTU-13 Dataset (Local directory)
Output: Two files, the processed training data, and the processed testin... | true |
bebb9f5b2397f250d5bb09fc239a4600e3a9c7e6 | Python | Aasthaengg/IBMdataset | /Python_codes/p03151/s011957656.py | UTF-8 | 454 | 2.953125 | 3 | [] | no_license | import bisect
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
sumA = sum(A)
sumB = sum(B)
if sumA<sumB:exit(print(-1))
surplus = [0]*n
for i in range(n):
surplus[i] = A[i]-B[i]
surplus.sort()
index_zero = bisect.bisect_left(surplus,0)
reqt = sum(surplus[:index_zero])
ans = index_ze... | true |
43d40321c7f057318b0ad35b071b7df6c4636d74 | Python | wariorx/Learning_and_practice | /Python/BS Recursive Tree/BinarySearch.py | UTF-8 | 6,713 | 3.40625 | 3 | [] | no_license | import random
class TreeNode:
__right = None
__left = None
__value = 0
#constructor
def __init__(self):
self.__right = None
self.__left = None
self.__value = 0
#factory method, since multupel constructors are not allowed
def many(self, right, left, va... | true |
16e17bfc6e3f118f4bd905604687170dca70ac98 | Python | pepilica/edu | /hello.py | UTF-8 | 877 | 2.53125 | 3 | [] | no_license | from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5 import uic
from PyQt5.QtGui import QPainter, QColor
from random import choice
import sys
class Example(QWidget):
def __init__(self):
super().__init__()
uic.loadUi('UI.ui', self)
self.btn.clicked.connect(self.button)
... | true |
5d71451f64339d9fa8f7971cfd241a91933b733d | Python | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/Palindromo.py | UTF-8 | 187 | 4.1875 | 4 | [] | no_license | for c in range(1, 4):
a = str(input("Digite uma palavra: "))
b = a[::-1]
if a == b:
print("รฉ Palindromo ")
else:
print("Nรฃo รฉ Palindromo ")
print("Fim") | true |
d960bc570f3f1022c02018df09b59475a6a515f5 | Python | sueae/jubilant-spoon | /bot.py | UTF-8 | 1,690 | 2.75 | 3 | [] | no_license | import tweepy # for tweeting
import secrets # shhhh
#override tweepy.StreamListener to add logic to on_status
class MyStreamListener(tweepy.StreamListener):
def on_direct_message(self, status):
author = status.author.screen_name
api.send_direct_message(user=author, text='response')
retur... | true |
75929cabe3a3de84ca1f17b1c50f0bbed9771dca | Python | MrCoderKai/muse_jhu_free_books | /MuseBooksCrawler/MuseBooksCrawler/pipelines.py | UTF-8 | 870 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import shutil
class MusebookscrawlerPipeline(object):
def process_item(self, item, spider):
print("index: %s" % ... | true |
d086d9cbeb49e7967aae2cc964524fb54c0141d7 | Python | essejhsif/obfuscatedpython | /fibonacci2.py | UTF-8 | 273 | 3.078125 | 3 | [] | no_license | # Print the first 20 numbers in the Fibonacci sequence
f = lambda x:map(lambda o:(map(lambda c:map(lambda l:
o.__setslice__(l[0],l[1],l[2]),([o[2]+3,o[2]+4,[o[0]]],[0,3,[o[1],
reduce(lambda x,o:x+o,o[:2]),o[2]+1]])),range(x)),o)[1],[[1,1,0]+
range(x)])[0][3:]
print f(20)
| true |