seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
16995335370
# find GCD/HCF of two numbers def fun(a, b): res = min(a, b) ans = None for i in range(1, res + 1): if a % res == 0 and b % res == 0: ans = i return ans # using recursion def funrecursive(a, b): if b == 0: return a return fun(b, a % b) if __name__ == '__main__':...
pvr30/DSA
Recursion/GCD_or_HCF.py
GCD_or_HCF.py
py
376
python
en
code
2
github-code
6
6713722350
from __future__ import print_function, division import time from floor_plans.visualize import View from floor_plans.floorplan import FloorPlan from floor_plans import polygon from floor_plans.math_util import dist from floor_plans import floorplan_statistics as fps names = [ 'SPEECH', 'ST', 'COMP LAB', 'PK', ...
joel-simon/evo_floorplans
test.py
test.py
py
5,851
python
en
code
84
github-code
6
41589623453
class MyError(Exception): def __init__(self, stri): self.stri = stri def process(self): if len(self.stri) < 5: print("字符串长度小于5") else: print("咕咕咕") try: MEr = MyError("waaaa") MEr.process() except MyError as error: print(error)
Wainemo/PythonPractice
定义类继承Exception,判断输入字符串的长度是否小于5.py
定义类继承Exception,判断输入字符串的长度是否小于5.py
py
317
python
en
code
0
github-code
6
5387953203
from telegram.ext import Updater, MessageHandler,Filters from Adafruit_IO import Client import os aio = Client('adeebsheriff', os.getenv('adeebsheriff')) def demo1(bot,update): chat_id = bot.message.chat_id path = 'https://cdn3.vectorstock.com/i/1000x1000/87/22/i-am-fine-lettering-typography-calligraphy-overlay-v...
adeebsheriff/telegramiotchatbot
app.py
app.py
py
2,506
python
en
code
0
github-code
6
9020012724
from multiprocessing import Pool import math from functools import partial import numpy as np from pyfaidx import Fasta, Faidx import subprocess import pysam from liftoff import aligned_seg, liftoff_utils from os import path def align_features_to_target(ref_chroms, target_chroms, args, feature_hierarchy, liftover_typ...
agshumate/Liftoff
liftoff/align_features.py
align_features.py
py
13,119
python
en
code
360
github-code
6
39830016444
#정렬 : 데이터를 특정한 기준에 따라 순서대로 나열하는것 #1.선택정렬 : 처리되지 않은 데이터 중에서 가장 작은 데이터를 선택해 맨 앞에 있는 데이터와 바꾸는 것을 반복 - O(N^2) array = [7, 5, 9, 0, 3, 1, 6, 2, 4, 8] print(array) for i in range(len(array)): min_idx = i for j in range(i + 1, len(array)): if array[min_idx] > array[j]: min_idx = j array[i], a...
omg7152/CodingTestPractice
Algorithm/Sort.py
Sort.py
py
1,977
python
ko
code
0
github-code
6
7722787082
from spynnaker.pyNN import exceptions from spynnaker.pyNN.models.neural_projections.connectors.abstract_connector \ import AbstractConnector from spynnaker.pyNN.models.neural_properties.synaptic_list import SynapticList from spynnaker.pyNN.models.neural_properties.synapse_row_info \ import SynapseRowInfo import...
ominux/sPyNNaker
spynnaker/pyNN/models/neural_projections/connectors/from_list_connector.py
from_list_connector.py
py
3,525
python
en
code
null
github-code
6
12791911896
from django.contrib.auth.models import User from django.http import JsonResponse, Http404 from django.shortcuts import redirect, get_object_or_404 from django.urls import reverse from django.utils.decorators import method_decorator from django.views.generic import DetailView, CreateView, View, TemplateView, DeleteView ...
skazancev/NeKidaem
project/blog/views.py
views.py
py
3,548
python
en
code
0
github-code
6
75241434428
__all__ = ["save", "load", "load_state_dict", "arange", "cat", "cos", "clamp", "Device", "from_numpy", "flatten", "LongTensor", "matmul", "mm", "normal", "ones", "x2ms_pow", "sin", "tanh", "x2ms_tensor", "Tensor", "split", 'as_tensor', 'argmax', 'Generator', 'sigmoid', 'rand', 'floor', 'bernoulli'...
Gufrannn/W-MAE
MindSpore/x2ms_adapter/__init__.py
__init__.py
py
16,986
python
en
code
12
github-code
6
17908940134
# Chapter 1 spam_amount = 0 print(spam_amount) spam_amount += 4 if spam_amount > 0 : print("But I don't want Any spam!") viking_song = "spam " * spam_amount # spam spam spam spam #viking_song = "spam " + spam_amount print(viking_song) print(spam_amount*4) # 16 print(float(str(spam_amount)*4)*4) #17776.0 print(ty...
data-droid/study
kaggleLearn/python.py
python.py
py
1,826
python
en
code
6
github-code
6
35413864969
import multiprocessing from multiprocessing import Process from cleanup import TwitterCleanuper from preprocessing import TwitterData from word2vec import Word2VecProvider import pandas as pd def preprocess(results, data_path, is_testing, data_name, min_occurrences=5, cache_output=None): twitter_data = TwitterData...
michal0janczyk/information_diffusion
fuzzy_logic/word_2_vectors/main.py
main.py
py
7,484
python
en
code
1
github-code
6
9373814970
''' 다음은 ISLR패키지의 Carseats 데이터 세트이다. 매출(Sales)의 이상값을 제외한 데이를 훈련 데이터로 선정할 때 Age의 표준편차를 구하시오. (이상 값은 평균보다 1.5표준편차이하이거나 이상인 값으로 선정한다. ''' import pandas as pd data = 'Carseats.csv' df = pd.read_csv(data) #print(df) #print(df.info()) #print(df.describe()) chk = df.Sales.std() #print(chk) train = df[(df.Sales ...
JoinNova/PracticeBigdata_Python
0143.py
0143.py
py
1,594
python
ko
code
0
github-code
6
71844650429
from django.conf import settings from django.urls import NoReverseMatch, reverse def get_slug_or_pk(object, slug_field=None): res = dict() field = slug_field if hasattr(object, slug_field) else "pk" if object: param = "slug" if hasattr(object, slug_field) else "pk" res.update({param: getat...
dbsiavichay/faclab
viewpack/shortcuts.py
shortcuts.py
py
1,595
python
en
code
0
github-code
6
3539820868
""" Name : portfolio_optimizer.py Author : Yinsen Miao Contact : yinsenm@gmail.com Time : 7/21/2021 Desc: Solve mean-variance optimization """ import numpy as np import pandas as pd from scipy.optimize import minimize from gerber import gerber_cov_stat1, gerber_cov_stat2 from ledoit import ledoit def set_eps_wgt...
yinsenm/gerber
src/portfolio_optimizer.py
portfolio_optimizer.py
py
13,193
python
en
code
49
github-code
6
37283667870
# Importing modules import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import joblib import findspark findspark.init() from pyspark.sql import SparkSession from pyspark.ml import PipelineModel from pyspark.sql.functions import * # Configure spark session spark = SparkSession\ ...
ramsundar07/Earthquake-Detetection-Analysis-using-Machine-Learning-Algorithms
GUI/gui_algorithm.py
gui_algorithm.py
py
8,670
python
en
code
0
github-code
6
28969789667
import machine import picoweb import ujson import ulogging as logging import ure as re import utime from common import config app = picoweb.WebApp(__name__) hooks = {} CONFIGURE_DEVICE_HOOK = 'CONFIGURE_WIFI' CONFIGURE_AWS_HOOK = 'CONFIGURE_AWS' CONFIGURE_SENSOR_HOOK = "CONFIGURE_SENSOR" GET_STATUS_HOOK = 'GET_STATU...
wizzdev-pl/iot-starter
MicroPython/src/web_server/web_app.py
web_app.py
py
5,324
python
en
code
7
github-code
6
43224823277
from javax import swing from java.awt import BorderLayout, Dimension from java.awt.event import KeyEvent from javax.swing import JFrame, JScrollPane, JPanel, JTable, JList, ListSelectionModel from javax.swing.event import ListSelectionListener from javax.swing.table import DefaultTableModel class TableApp: ...
texttest/storytext-selftest
swing/tables/row_header_list_select_all_cells/target_ui.py
target_ui.py
py
2,132
python
en
code
0
github-code
6
7268607481
def serialize_categories(categories) -> list: output = [] for category in categories: categories_data = { "id": category.id, "name": category.name, "description": category.description, "tasks": [] } for task in category.tasks: ...
Kenzie-Academy-Brasil-Developers/q3-sprint5-matriz-eisenhower-RobsonMT
app/services/serialize_categories_service.py
serialize_categories_service.py
py
691
python
en
code
0
github-code
6
11702399982
import md5 import random #from settings import SOLRSOLR_HOST, SOLR_PORT # Make this unique, and don't share it with anybody. SECRET_KEY = 'j*zdirg7yy9@q1k=c*q!*kovfsd#$FDFfsdfkae#id04pyta=yz@w34m6rvwfe' def generate_hash(): hash = md5.new() hash.update("".join(map(lambda i: chr(random.randint(0, 255)), range(16...
bioinformatics-ua/montra
emif/insert_script.py
insert_script.py
py
2,771
python
en
code
7
github-code
6
21981363351
# -*- coding: utf-8 -*- import unittest import os import time os.environ["TESTING_LDT"] = "TRUE" import ldt from ldt.helpers.ignore import ignore_warnings class Tests(unittest.TestCase): ''' The tests in this block inspect the MetaDictionary functionality: combining WordNet and Wiktionary data. ''' ...
annargrs/ldt
ldt/tests/dicts/morphology/test_meta.py
test_meta.py
py
3,709
python
en
code
16
github-code
6
72568366267
#!/usr/bin/env python import seaborn import numpy as np import os from collections import OrderedDict import pandas as pd import matplotlib.pyplot as plt import sys from termcolor import cprint # Load data # Global vars for tracking and labeling data at load time. exp_idx = 0 label_parser_dict = None smooth_factor =...
flowersteam/social-ai
data_analysis_neurips.py
data_analysis_neurips.py
py
22,418
python
en
code
5
github-code
6
33038113455
"""Config flow for Withings.""" import logging import voluptuous as vol from withings_api.common import AuthScope from homeassistant import config_entries from homeassistant.components.withings import const from homeassistant.helpers import config_entry_oauth2_flow _LOGGER = logging.getLogger(__name__) @config_ent...
84KaliPleXon3/home-assistant-core
homeassistant/components/withings/config_flow.py
config_flow.py
py
2,112
python
en
code
1
github-code
6
16106094065
from .color import cm_benj def setup_args_scanpy(ap): ap.add_argument("-f", "--figdir", default="figures") ap.add_argument("--dpi", type=int, default=600) ap.add_argument("--frameon", dest="frameon", action="store_true") ap.add_argument("--no-frameon", dest="frameon", action="store_false") ap.add_...
KellisLab/benj
benj/setup_scanpy.py
setup_scanpy.py
py
986
python
en
code
2
github-code
6
4330376900
def solution(arr1, arr2): answer = [] for i in range(len(arr1)): a1 = arr1.pop(0) a2 = arr2.pop(0) num = [x + y for x, y in zip(a1, a2)] answer.append(num) return answer arr1 = [[1, 2], [2, 3]] arr2 = [[3, 4], [5, 6]] arr3 = [[1], [2]] arr4 = [[3], [4]] print(solution(ar...
wold21/python_algorithm
프로그래머스/코딩테스트/Level1/행렬의 덧셈.py
행렬의 덧셈.py
py
359
python
en
code
0
github-code
6
40139751051
from PIL import Image img = Image.open("UnoDeck2.png") i = 0 for y in range(6): j = 2 k = 3 for x in range(12): if i == 64: break left = 0 top = 0 height = 256 width = 166 box = (width+j)*x, (height+k)*y, width*(x+1)+(j*x), height*...
CrazyScorcer/ImageCutter
imageCut.py
imageCut.py
py
472
python
en
code
0
github-code
6
26485545082
######## Tensorflow Imaage Classifier ######### # # Author: Erik Handeland Date: 12/12/2021 # Description: This program uses a TensorFlow Lite object detection model-metadata to # perform object detection on an image. It creates a dict containing a # list of detected objects and the count for each object. It also save ...
KB4YG/ml
obj_detection/obj_detection.py
obj_detection.py
py
9,890
python
en
code
1
github-code
6
32639606030
import unittest from selenium import webdriver from selenium.webdriver.common.by import By class AddRemoveElements(unittest.TestCase): def setUp(self) -> None: self.driver = webdriver.Chrome(executable_path="chromedriver") self.driver.get('https://the-internet.herokuapp.com/') self.dr...
yorlysoro/intro_selenium_course
test_add_remove.py
test_add_remove.py
py
1,436
python
en
code
0
github-code
6
30478333670
class Node: def __init__(self, data): self.data = data self.next = None class MyQueue: def __init__(self): self.head = None self.tail = None def push(self, item): item_node = Node(item) if self.head is None or self.tail is None: ...
prabhat-gp/GFG
Stacks and Queues/Queues/2_implement_queue_ll.py
2_implement_queue_ll.py
py
679
python
en
code
0
github-code
6
15624457572
import numpy as np from keras.utils import to_categorical from sklearn.model_selection import train_test_split test_size = 0.2 seed = 42 x_data = np.load('./data/soja_images_150_new.npy', allow_pickle=True) y_data = np.load('./data/soja_labels_150_new.npy', allow_pickle=True) x_data = x_data.astype(np.float32) y_da...
nagahamaVH/soybean-image-classif
app/src/prepare_data.py
prepare_data.py
py
741
python
en
code
1
github-code
6
14894176437
import asyncio import os import os.path from flask import Flask, request, send_from_directory, flash, request from werkzeug.utils import secure_filename import getpass import platform from flask_cors import CORS from scripts.datascript import Datascript from scripts.CalcoloScostamentiSenzaIntermedi import ScostamentiSe...
VinciGit00/SCGProject
Frontend/flask_code/app.py
app.py
py
3,160
python
en
code
2
github-code
6
887825257
from django.shortcuts import render, redirect from django.http import Http404, JsonResponse from django.views import View from django.contrib.auth import authenticate, login, logout from django.contrib import messages # Decorators from django.utils.decorators import method_decorator from django.views.decorators.csrf i...
analitika-tech/library
system/frontend/views.py
views.py
py
14,674
python
en
code
1
github-code
6
16505295497
from typing import List, Dict, Tuple def create_chirp_dictionary(file_name: str) \ -> Dict[int, Tuple[int, str, List[str], List[int], List[int]]]: """ Opens the file "file_name" in working directory and reads the content into a chirp dictionary as defined on Page 2 Functions 2. Note, some spac...
kimber1y-tung/CSC108
assignment3/A3-2.py
A3-2.py
py
2,659
python
en
code
0
github-code
6
4242214840
from predict_utility import load_checkpoint,get_input_args,predict,process_image from utility_module import label_mapping import warnings warnings.filterwarnings("ignore") from prettytable import PrettyTable x = PrettyTable() args = get_input_args() model = load_checkpoint(args.checkpoint) top_ps,top_class = predict...
rkg-37/ImageClassifier
predict.py
predict.py
py
654
python
en
code
0
github-code
6
10887477924
def bubble_sortiranje(niz): privremeno = 0 duzina = len(niz) for i in range(0, duzina - 1): #ide do pretposlednjeg jer od poslednjeg nema nista desno for j in range(0, (duzina - 1) - i): if(niz[j] > niz[j + 1]): privremeno = niz[j] niz[j] = niz[j + 1]...
marko-smiljanic/vezbanje-strukture-podataka
vezbanje-strukture-podataka/Domaci-PREDAVANJA/domaci3_sortiranje/test_sort.py
test_sort.py
py
909
python
bs
code
0
github-code
6
35083479163
dic = ["a", "b", "c", "d" , "e" , "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] chars = ['O','Q','R','S'] z, i, x = 0, 0, 0 if chars[0].istitle(): z = 1 dic = [element.upper() for element in dic] while chars[x] != dic[i]: i += 1 for item in chars:...
diogodh/codewars_py
missing_letter.py
missing_letter.py
py
481
python
en
code
0
github-code
6
38978357115
import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('localhost', 9999)) s.listen(1) while True: cli, (remhost, remport) = s.accept() print("Nhan ket noi tu", remhost) msg = "Hello %s\n" %remhost cli.send(msg.encode('ascii')) cli.close()
DuongHongDoan/CT225_LTPython
Buoi3_LTMang/Bai46_HelloServer.py
Bai46_HelloServer.py
py
282
python
en
code
0
github-code
6
71484411388
import sys sys.setrecursionlimit(3000) def check(rs, cs): table[rs][cs] = 2 if (rs, cs) == (rg, cg): return True if rs > 0 and table[rs - 1][cs] == 1 and check(rs - 1, cs): return True if cs > 0 and table[rs][cs - 1] == 1 and check(rs, cs - 1): return True if rs < r - 1 and table[rs...
knuu/competitive-programming
atcoder/corp/codethxfes2014b_e.py
codethxfes2014b_e.py
py
994
python
en
code
1
github-code
6
26039884706
from __future__ import annotations from dataclasses import dataclass from pants.backend.go.subsystems.golang import GolangSubsystem from pants.core.util_rules.system_binaries import ( BinaryPath, BinaryPathRequest, BinaryPaths, BinaryPathTest, ) from pants.engine.engine_aware import EngineAwareParamet...
pantsbuild/pants
src/python/pants/backend/go/util_rules/cgo_binaries.py
cgo_binaries.py
py
1,235
python
en
code
2,896
github-code
6
71226682109
import os, glob from fpdf import FPDF class Pdf_Tool: def __init__(self, format): self.pdf = FPDF(format=format) def save(self, dir, pdf_name): if not os.path.exists(dir): os.makedirs(dir) self.pdf.output(os.path.join(dir, pdf_name), "F") def create(self, img_path_li...
huangzf128/something
code/python/image/pdf_tool.py
pdf_tool.py
py
888
python
en
code
0
github-code
6
16439872003
from flask import Flask import dash from dash import dcc from dash import html from dash.dependencies import Input, Output import plotly.graph_objs as go import pandas as pd import os inbodyDf = pd.read_csv(os.path.join(os.path.dirname(__file__), os.pardir, 'data', 'inbody.csv')) courseDf = pd.read_csv(os.path.join(o...
yuwon-shin/Data_Visualization
PR/flask/useDash.py
useDash.py
py
9,696
python
en
code
0
github-code
6
28624119358
import cartopy import cartopy.crs as ccrs import matplotlib.pyplot as plt import numpy as np def plot_geodetic(location_to_geodetic, edxml_parser): # get names and geodetics for plotting locs = np.asarray(list(location_to_geodetic.keys())) geodetic_coords = np.asarray(list(location_to_geodetic.values())) ...
pnadelofficial/HistoricalLetters
plot.py
plot.py
py
2,774
python
en
code
null
github-code
6
17241327801
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 import requests from bs4 import BeautifulSoup import time BASE_URL = 'https://www.nowcoder.com' driver = webdriver.Chrome(...
Chunar5354/interview_note
experience/spider.py
spider.py
py
1,566
python
en
code
1
github-code
6
32693212351
''' Created on Mar 30, 2010 @author: kwadwo ''' from OutsideLibrary.table_parser import TableParser from OutsideLibrary import ClientForm from courseLib import * import urllib2 def getStuff(): mnemonic = raw_input("input course Mnemonic (ex:'math')") number = raw_input("input course number") response...
code4ghana/randomPrograms
PythonPrograms/SISScheduler/src/CourseLib/Runner.py
Runner.py
py
2,280
python
en
code
1
github-code
6
39019051320
import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription, conditions from launch.actions import ExecuteProcess,RegisterEventHandler, IncludeLaunchDescription from launch_ros.actions import Node from launch.substitutions import LaunchConfiguration,Command from l...
kei1107/r2d2_ros2
r2d2_control/launch/r2d2_control6.launch.py
r2d2_control6.launch.py
py
3,223
python
en
code
1
github-code
6
74050593789
from urllib.request import Request, urlopen from bs4 import BeautifulSoup import sqlite3 from time import sleep imgchrList = ['n','a','e','m','i','g','h','v'] DiffList = ['nov','adv','exh','mxm','inf','grv','hvn','vvd'] conn = sqlite3.connect("SDVXRanking.db") cur = conn.cursor() for tid in range(164,1412): prin...
limjungho/SDVXRanking
ParsingTrackList.py
ParsingTrackList.py
py
1,365
python
en
code
0
github-code
6
3999827011
import PySimpleGUI as sg # Simple GUI for Python import core import guiElements import constants as const # Setup the simple window sg.theme("Black") layout = [ [guiElements.frameSelectJobAndZone], [guiElements.frameSelectResource], [guiElements.frameAssignAKey], [guiElements.layoutStatusAndStartS...
jhriverasa/wakfu-farmscript
FarmScriptGUI.py
FarmScriptGUI.py
py
1,235
python
en
code
5
github-code
6
75316047546
import wx from ..form.general import GeneralDialog from ..textbox import LayoutDimensions from ..textbox.textbox import TextInputLayout, TextSmartBox from ..textbox.floatbox import FloatInputLayout, FloatSmartBox from ..controller import ChildController from ..model.bind import BindOjbect __author__ = 'Joeny' clas...
JoenyBui/boa-gui
boaui/chart/dlg.py
dlg.py
py
8,601
python
en
code
0
github-code
6
33648598241
from __future__ import annotations from dataclasses import dataclass from typing import Optional import re import string @dataclass class Equipment: title: str value: str unit: Optional[str] = None quantity: Optional[int] = None _equipment = [ ("Backpack", "2gp"), ("Candle", "1cp"), ("Ch...
sethwoodworth/crawl-classic
crawl_classic/equipment.py
equipment.py
py
1,581
python
en
code
3
github-code
6
35754868132
# Задайте список из N элементов, заполненных числами из промежутка [-N, N]. # Найдите произведение элементов на указанных индексах. Индексы вводятся одной строкой, через пробел. # n = 3 [-3, -2, -1, 0, 1, 2, 3] --> 0 2 3 # -3 * -1 * 0 = 0 Вывод: 0 N = int(input('Введите значение N = ')) position_1 = int(input('Введите...
Natalie-4/task2
4.py
4.py
py
1,130
python
ru
code
0
github-code
6
17651848697
# coefficients in Zp def Z_p(n, co_eff_lst): co_eff_Zp = [] for lst in co_eff_lst: co_eff_Zp.append([i % n for i in lst]) return co_eff_Zp # generating polynomial # return Tn(x) mod m def Tn_Zm(n, m, x): co_eff = co_eff_lst[n-1] sum = 0 for i in co_eff: sum += i * x**n ...
6taco-cat9/chebyshev_polynomials
generating_function.py
generating_function.py
py
580
python
en
code
0
github-code
6
3883274800
class Solution: def maxSubArray(self, nums: List[int]) -> int: if not nums: return 0 curSum = nums[0] maxSum = curSum for num in nums[1:]: curSum = curSum + num if curSum > 0 else num maxSum = maxSum if maxSum > curSum else curSum ...
fatzero/Leetcode-Problems
1-100/53.maximum-subarray.py
53.maximum-subarray.py
py
343
python
en
code
0
github-code
6
780574891
from nltk.tokenize import TweetTokenizer class LexiconFeatureExtractor: def __init__(self, afinn_lexicon_file_path="resources/lexicons/AFINN-en-165.txt", afinn_emoticon_lexicon_file_path="resources/lexicons/AFINN-emoticon-8.txt", bing_liu_lexicon_file_path="resources/lexicons/Bin...
erayyildiz/AffectInTweets
src/lexicon_features.py
lexicon_features.py
py
5,989
python
en
code
3
github-code
6
12830949060
# Definition for a Node. from collections import deque from typing import List class Node: def __init__(self, val=None, children=None): self.val = val self.children = children class Solution: def preorder(self, root: Node) -> List[int]: output = [] if root is None: ...
theRobertSan/LeetCode-Solutions-Python
589.py
589.py
py
996
python
en
code
1
github-code
6
9264213572
import mne import argparse import numpy as np from config import fname # Handle command line arguments parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('subject', metavar='sub###', type=int, help='The subject to process') args = parser.parse_args() subject = args.subject print('Processing subj...
wmvanvliet/beamformer_simulation
megset/03_ica.py
03_ica.py
py
2,047
python
en
code
4
github-code
6
7759954850
''' 사업자등록번호로 업종 확인 ''' import csv import json from urllib.request import urlopen from urllib import parse import datetime as dt import pandas as pd import numpy as np import re # 대신정보통신 4088118945 # 대보정보통신 1358119406 bizNo = '2118108009' # 조달청_사용자정보서비스 ''' > parameter(조회조건) - bizno : 사업자등록번호 > numOfRows 는 totalCount ...
starrything/openapi-g2b
04_g2b_user_service.py
04_g2b_user_service.py
py
2,354
python
en
code
0
github-code
6
32010864325
def deep_find(data, key): if key in data: return data[key] for k, v in data.items(): if isinstance(v, dict): item = deep_find(v, key) if item is not None: return item # elif isinstance(v, list): # for d in v: # for resul...
1oss1ess/HackBulgaria-Programming101-Python-2018
week-8/Graphs/t1.py
t1.py
py
882
python
en
code
0
github-code
6
14434842726
import numpy as np m = [[0] * 4 for i in range(4)] dx, dy = [0, 1, 0, -1], [1, 0, -1, 0] x, y, c = 0, -1, 1 for i in range(4 + 4 - 2): for j in range((4 + 4 - i) // 2): x += dx[i % 4] y += dy[i % 4] m[x][y] = c c += 1 BOARD_LENGTH = 4 GOAL_STATE = np.array(m) def goal_on_row(num, i): for j in range(BOAR...
cuzureau/n_puzzle
stack.py
stack.py
py
1,922
python
en
code
1
github-code
6
41160046527
from django import forms from django.core.mail import EmailMessage from .models import Householdaccountbook # class HouseholdaccountbookForm(forms.ModelForm): # class Meta: # model = Householdaccountbook # fields = ["pref","choice",] class TableCreateForm(forms.ModelForm): class Meta: model = Househol...
HaruShim/Sotuken
実装/新満/table一覧表示/table/forms.py
forms.py
py
777
python
en
code
0
github-code
6
30857567174
import pyautogui import webbrowser as web import time msg = input('enter message to send: ') times = int(input('enter the number of times to send the message: ')) # win_chrome_path = 'C:\Program Files\Google\Chrome\Application\chrome.exe %s' # web.get(win_chrome_path).open('web.whatsapp.com') web.open('web.whatsapp....
Abdul-Hannan12/Whatsapp-Automation
spam_message.py
spam_message.py
py
471
python
en
code
0
github-code
6
5619572961
from decimal import Decimal class Account: """ Account class maintain information and balance about each account ******Arguments****** firstname:string lastname:string national id number:string with 10 numbers birthdate:string in the form of ##/##/#### balance:integer greate...
MortezaGhandchi/stock-oop-pandas
Stock_Project_AP.py
Stock_Project_AP.py
py
9,814
python
en
code
0
github-code
6
7921803967
year = 1799 birthday = '6 июня' year_people= int(input('А вы знаете год рождения А.С.Пушкина?: ')) while year_people != year: year_people = int(input('Еще раз попробуйте: ')) if year_people == year: birthday_people = input('А день рождения?: ') while birthday_people != birthday: birthday_peo...
Lyubov-Tuz/basic_python
borndayforewer.py
borndayforewer.py
py
503
python
ru
code
0
github-code
6
10584185740
import numpy as np def gaussseidel_1d(rho, hx, epsilon, maxiter, maxerr): if rho.ndim != 1: raise ValueError("rho must be of shape=(n,)") phi = np.zeros(shape=rho.shape, dtype=rho.dtype) nx = rho.shape[0] mr = hx * hx / epsilon for iteration in range(maxiter): error = 0.0 fo...
LeonKlein/urban-broccoli
urbanbroccoli/gaussseidel.py
gaussseidel.py
py
3,089
python
en
code
null
github-code
6
28412951714
#!/usr/bin/env python import sys, os, shlex import multiprocessing as mp import subprocess as sp from pli.lib.util import log def find_files(root): outdir = 'tmpout' for curdir, dirs, files in os.walk(root): protein_fname = None ligand_fname = None for f in files: if f.end...
rhara/plifinder
examples/plifinder_v2015.py
plifinder_v2015.py
py
1,504
python
en
code
0
github-code
6
25272817830
import sys from itertools import combinations from collections import deque def move(stage): for i in range(M): for j in range(N-1, 0, -1): enemy[j][i] = enemy[j-1][i] if stage == 0: for i in range(M): enemy[0][i] = 0 dr = [0, -1, 0] dc = [-1, 0, 1] N, M, D = map(int,...
powerticket/algorithm
Baekjoon/17135.py
17135.py
py
1,842
python
en
code
0
github-code
6
19386134805
import argparse import json import os import sys import numpy as np import torch from plyfile import PlyData, PlyElement from torch.utils.data import DataLoader from tqdm import tqdm sys.path.append(os.path.join(os.getcwd())) # HACK add the root folder from utils.pc_utils import write_ply_rgb from utils.box_util im...
nseppi/scan2cap
scan2cap/scripts/visualize_pretrain.py
visualize_pretrain.py
py
15,949
python
en
code
1
github-code
6
1375960664
# -*- coding: utf-8 -*- import numpy as np from deap import algorithms from deap import base from deap import creator from deap import tools from deap import gp from deap.algorithms import varAnd from adan.aiem.genetics.evaluators import * import array import random as traditional_random #import pathos import pathos...
stelios12312312/ADAN
adan/aiem/genetics/genetic_programming.py
genetic_programming.py
py
16,827
python
en
code
0
github-code
6
28664991218
m = int(input("Enter your marks : ")) if(m >= 90 and m <= 100): print("Exelent") elif(m >= 80 and m <= 89): print("A Grade") elif(m >= 70 and m <= 79): print("B Grade") elif(m >= 60 and m <= 69): print("C Grade") elif(m >= 50 and m <= 59): print("D Grade") elif(m < 50): print("Fail") #********...
vikaskr-gupta/Python
6 Conditional Expression/9B_Problem_06.py
9B_Problem_06.py
py
718
python
en
code
1
github-code
6
74959980988
"""system URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based ...
amir-rahim/ChessClubManagementSystem
system/urls.py
urls.py
py
3,313
python
en
code
1
github-code
6
7763839215
from Monitor import Monitor import MonitorVarTypes import requests monitor_var = {'PreviousClosingPrice': MonitorVarTypes.FLOAT} monitor_text = "URL FORMAT: https://api.polygon.io/v2/aggs/ticker/{TICKER}/prev?apiKey={APIKEY}; \nGo to https://polygon.io/docs/get_v1_meta_symbols__stocksTicker__news_anchor for more info...
YuHanjiang/IFTTT-backend
Monitors/PolygonStockAPIMonitor.py
PolygonStockAPIMonitor.py
py
881
python
en
code
1
github-code
6
41996069005
import logging import platform import sys import json from getpass import getpass from pathlib import Path from typing import Union, Dict, Tuple from shapely.geometry import Polygon import os import couchdb import xmltodict from lxml import etree from tqdm import tqdm from geojson_rewind import rewind logging.basicC...
metno/weamyl-metcap
scripts/lustre_archive_importer.py
lustre_archive_importer.py
py
8,431
python
en
code
0
github-code
6
4406242971
import random def max_lenght_of_sub_array_with_sum0(arr, k): if arr is None or len(arr) == 0 or k <= 0: return 0 ans = 0 for i in range(len(arr)): for j in range(i, len(arr)): if k == sum(arr[i:j+1]): ans = max(ans, j-i+1) return ans def max_lenght_of_su...
guzhoudiaoke/data_structure_and_algorithms
coding_interview_guide/8_array_and_matrix/10/10.py
10.py
py
1,186
python
en
code
0
github-code
6
4915045825
def sum_diagonal(data): data = sum([int(i) for i in data]) return data n = int(input()) matrix = [input().split(", ") for _ in range(n)] first_diagonal = [matrix[row_index][col_index] for row_index in range(len(matrix)) for col_index in range(len(matrix[row_index])) if row_index == col_index...
M0673N/Python-Advanced
04_comprehensions/exercise/05_problem.py
05_problem.py
py
703
python
en
code
0
github-code
6
25146242563
import numpy as np import netCDF4 as nd import matplotlib.pyplot as plt from calc_irr import * def get_sample_points(origin, dir , ns=10): gps = np.zeros((origin.shape[0],dir.shape[0])) gps[0] = np.tan(dir/180.*np.pi) * origin[2] + origin[0] gps[1,:] = origin[1]*1 gps[2,:] = 0 ds = np.linspace(0,...
MujkanovicMax/master-thesis
radiances/raytr.py
raytr.py
py
3,788
python
en
code
0
github-code
6
27103187909
"""Fedor's Upper Envelope algorithm. Based on the original MATLAB code by Fedor Iskhakov: https://github.com/fediskhakov/dcegm/blob/master/model_retirement.m """ from typing import Callable from typing import Dict from typing import List from typing import Tuple import numpy as np from dcegm.interpolation import lin...
OpenSourceEconomics/dcegm
tests/utils/upper_envelope_fedor.py
upper_envelope_fedor.py
py
28,814
python
en
code
15
github-code
6
14169799786
import random import numpy as np class Tablica: def __init__(self, size): self.size = size self.plansza = [[-1 for y in range(self.size)] for x in range(self.size)] self.generate() self.generate() self.nextLeft = self.plansza self.nextRight = self.plansza...
tomasz-skrzypczyk/My2048
tablica.py
tablica.py
py
4,370
python
en
code
0
github-code
6
71484464508
N = int(input()) P = list(map(int, input().split())) max_point = sum(P) dp = [False] * (max_point + 1) dp[0] = True for p in P: dp_next = dp[:] for i in range(max_point): if dp[i]: dp_next[i+p] = True dp = dp_next[:] print(dp.count(True))
knuu/competitive-programming
atcoder/dp/tdpc_a.py
tdpc_a.py
py
260
python
en
code
1
github-code
6
17607810708
from calendar import c n = int(input("enter the number :")) r = 1 while r<=n: c = 1 while c<=r: print(chr(65+r+c+1)) c = c + 1 print() r = r+1
maheshyadav84481/Problem_solution_with_python_MAHESH_YADAV
abcd_reverse.py
abcd_reverse.py
py
162
python
en
code
0
github-code
6
26818962506
import json import urllib import requests import types class MovesAPIError(Exception): """Raised if the Moves API returns an error.""" pass class MovesAPINotModifed(Exception): """Raised if the document requested is unmodified. Need the use of etag header""" pass class MovesClient(object): """...
lysol/moves
moves/_moves.py
_moves.py
py
6,546
python
en
code
58
github-code
6
14975435890
"""DuerOS entity class.""" from __future__ import annotations from dueros_smarthome.client import DeviceActionResponse from dueros_smarthome.const import STATUS_OK, STATUS_NOT_LOGIN from dueros_smarthome.models import Appliance, Connectivity from homeassistant.core import callback from homeassistant.exceptions import...
zsy056/dueros-ha
custom_components/dueros/entity.py
entity.py
py
2,131
python
en
code
0
github-code
6
73340450429
import string import math # ---------------------------------------------------- # Parameters: None # Return: polybius_square (string) # Description: Returns the following polybius square # as a sequential string: # [1] [2] [3] [4] [5] [6] [7] [8] # [1] ! " #...
shuaibr/Encryption-and-Security
Polybius Square Cipher.py
Polybius Square Cipher.py
py
3,099
python
en
code
0
github-code
6
72627151867
import sys import pandas as pd import pmd def get_system_info(csv_file, id): print('ID:', id) df = pd.read_csv(csv_file) row = df['ID'] == int(id) smiles = df.loc[row, 'SMILES'].item() smiles_solvent = df.loc[row, 'SMILES_solvent'].item() ratio = df.loc[row, 'Ratio'].item() return smiles...
ritesh001/Polymer-Molecular-Dynamics
scripts/Solvent_diffusivity/mkinput_solvent.py
mkinput_solvent.py
py
2,301
python
en
code
0
github-code
6
2785491141
# 205. Isomorphic Strings # Input: s = "egg", t = "add" # Output: true # Input: s = "foo", t = "bar" # Output: False # Input: s = "paper", t = "title" # Output: true # I learn to solve this after watching a solution video. so cool! def isomorphic(s,t): dict1, dict2 = {},{} for i in range(len(s)): ...
Helenyixuanwang/algos
leet_205_isomorphicString.py
leet_205_isomorphicString.py
py
621
python
en
code
0
github-code
6
7605645692
#two dimensional nlist=['kumar','krihna priya','athul','Ravi'] deglist=['developer','tester','junior developer','HR'] salary=[54000,40000,30000,55000] emp={'name':nlist,'Designation':deglist,'Salary':salary} print(emp['name'][0]) lg=len(emp) print("Name,Designation,Salary") for j in range(lg): print(emp['n...
sathu341/pythonWork
Pythonworks/dictionary_emp.py
dictionary_emp.py
py
378
python
en
code
0
github-code
6
6419648862
import time import mysql.connector as mysql try: datebase_sql = mysql.connect( host="database-1.cqpxsublkhcn.eu-central-1.rds.amazonaws.com", port=3306, user="user1", passwd="1Passw0rd1", database="QAP-05", ) except Exception as err: print(err) cur...
APOSHAml/My-pieces-of-code
Homework_26/test_sql.py
test_sql.py
py
1,500
python
en
code
0
github-code
6
74531247866
""" bst.py Student: P.K Buddhika Chaturanga Mail: bupa8694@student.uu.se Reviewed by: Tom Smedsaas Date reviewed: 2021-110-03 """ from math import log2 from linked_list import LinkedList class BST: class Node: def __init__(self, key, left=None, right=None): self.key = key self.le...
bupa8694/programming2
Pyhton_Assignments/MA3/MA3/bst.py
bst.py
py
10,192
python
en
code
1
github-code
6
5734551584
from time import time start = time() def josephus(n): if n == 0: return False flag = n%2; counter = 0 index = n-1 people = [1]*n while True: if sum(people) == 1: return index%n #for pattern finding counter, flag, n] elif people[index%n] == 1: temp_index ...
wittwang98/Random
Josephus Problem.py
Josephus Problem.py
py
719
python
en
code
0
github-code
6
719390909
""" mcandecode.py MCAN Modul Modul zur Verwaltung, Analyse und Ersstellung von Maerklin CAN-Bus Meldungen Author: Rainer Maier-Lohmann --------------------------------------------------------------------------- "THE BEER-WARE LICENSE" (Revision 42): <r.m-l@gmx.de> wrote this file. As long ...
rml60/mcan
mcan/mcandecode.py
mcandecode.py
py
8,968
python
en
code
0
github-code
6
11630342993
import os """ The os functions that we are given are: os.path.getsize(path) os.path.isfile(path) os.listdir(path) os.path.join(path, filename) """ def disk_usage_tail_recursion(path, size_so_far=0): """ Tail recursion implementation of the disk usage function. """ size_so_far += os.path.getsize(path...
geekgap-io/geekgap_webinars
geekgap_webinars/notebooks/webinar_2/disk_usage_tail_recursion.py
disk_usage_tail_recursion.py
py
863
python
en
code
1
github-code
6
24252533109
from phrase import Phrase import random class Game: def __init__(self): self.missed = 0 self.phrases = self.create_phrases() self.active_phrase = self.get_random_phrase() self.guesses = [] def create_phrases(self): phrases = [Phrase("Most things tha...
Nikolai-O/python-techdegree-project3
game.py
game.py
py
2,068
python
en
code
0
github-code
6
16432205393
# IndicatosStrategy class IndicatorStrategy(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2021, 1, 1) self.SetCash(10000) self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol self.sma = CustomSimpleMovingAverage("CustomSMA", 30) ...
sotoblanco/QuantConnectTrading
IndicatosStrategy.py
IndicatosStrategy.py
py
2,046
python
en
code
0
github-code
6
75241220986
""" Author: Tyler Wagner Date Created: 7-21-23 Edited By: Tyler Van Pelt Edited On: 7-28-23 """ import tkinter as tk def draw_decision_tree(canvas, node, x, y, depth=0): if node is None: return # Draw the current node if node.attribute is not None and node.threshold is not None: node_siz...
Tyler-Wagner/Programming-Assignment-2
GUI.py
GUI.py
py
2,389
python
en
code
0
github-code
6
6446901297
from telemetry.page import page as page_module from telemetry import story class StartedPage(page_module.Page): def __init__(self, url, startup_url, page_set): super(StartedPage, self).__init__( url=url, page_set=page_set, startup_url=startup_url) self.archive_data_file = 'data/startup_pages.json' ...
danrwhitcomb/Monarch
tools/perf/page_sets/startup_pages.py
startup_pages.py
py
1,298
python
en
code
5
github-code
6
25687467876
import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): def __init__(self, in_channel, out_channel, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(in_channel, out_channel, kernel_size=3, stride=stride, padding=1, bias=False) sel...
p3i0t/task2
models.py
models.py
py
3,506
python
en
code
0
github-code
6
7170796324
# Answer to Apple and Orange # https://www.hackerrank.com/challenges/apple-and-orange/problem #!/bin/python3 import math import os import random import re import sys # Complete the countApplesAndOranges function below. def countApplesAndOranges(s, t, a, b, apples, oranges): apple, orange = 0, 0 for i in ran...
CompetitiveCode/hackerrank-python
Practice/Algorithms/Implementation/Apple and Orange.py
Apple and Orange.py
py
993
python
en
code
1
github-code
6
32197951073
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver=webdriver.Chrome(executable_path='./driver/chromedriver') driver.get('https://web.whatsapp.com/') input("please scan qr code and press any key to continue:") RM=driver.find_element_by_css_selector('span[title...
AbhayPal005/Whatsaap-Automation-Using-Selenium
chrome_driver_windows.py
chrome_driver_windows.py
py
575
python
en
code
0
github-code
6
70064084669
from django.conf.urls import url from tests import views, exceptions urlpatterns = [ url(r'^snippets/$', views.SnippetList.as_view(), name='snippet-list'), url(r'^snippets2/$', views.SnippetList.as_view(), name='snippet2-list'), url(r'^snippet/(?P<pk>\d+)/$', views.SnippetDetail.as_view(), name='s...
FutureMind/drf-friendly-errors
tests/urls.py
urls.py
py
673
python
en
code
129
github-code
6
26693503665
import pytorch_lightning as pl import pandas as pd import torch from torch import nn from torch.utils.data import DataLoader from sklearn.metrics import cohen_kappa_score from transformers import AutoTokenizer, RobertaForSequenceClassification from torch.utils.data import Dataset from pytorch_lightning.loggers impo...
maltefranke/solubility_prediction
models/ChemBERTa/chemberta10M.py
chemberta10M.py
py
8,935
python
en
code
1
github-code
6
46046555266
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from django.template import Template, Context from django.utils.html import mark_safe from hooks.templatehook import hook from hooks.templatetags.hooks_tags import template_hook_collect from . import utils_hooks class ...
nitely/django-hooks
hooks/tests/tests_templatetags.py
tests_templatetags.py
py
3,337
python
en
code
16
github-code
6
9002769780
# -*- coding: utf-8 -*- """ Created on Tue Feb 26 10:21:15 2019 This is the modl with Keras framework @author: ago """ from __future__ import print_function from matplotlib import pyplot as plt import numpy as np import pandas as pd import seaborn as sns from scipy import stats from IPython.display ...
Dirbas/PMU_classifier
Keras_PMU.py
Keras_PMU.py
py
5,451
python
en
code
2
github-code
6
12814349068
import itertools import matplotlib.pyplot as plt import numpy as np def get_mtot(event_jets): all_px = sum([j.px ** 2 for j in event_jets]) all_py = sum([j.py ** 2 for j in event_jets]) all_pz = sum([j.pz ** 2 for j in event_jets]) all_e = sum([j.e for j in event_jets]) if all_e ** 2 - all_px - a...
rotemov/ML4Jets-HUJI
jupyter_methods.py
jupyter_methods.py
py
3,097
python
en
code
1
github-code
6