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
70082118504
import os, platform, subprocess from tempfile import TemporaryDirectory import zipfile import tkinter as tk import tkinter.ttk as ttk import tkinter.scrolledtext as scrolledtext from tkinter import filedialog from pdfrw import PdfReader, PdfWriter, PdfDict, PdfName basedir = os.path.dirname(__file__) if platform....
gradgrind/conjoin2pdf
conjoin2pdf.py
conjoin2pdf.py
py
8,959
python
en
code
0
github-code
36
3922747105
class Node: def __init__(self, node) -> None: self.node = node self.next = None def __str__(self) -> str: data = self output = "" while data: output += str(data.node) + " " data = data.next return output class LinkedList: def __init...
carls-rodrigues/algorithms-data-structure
data-structure/linked-list/linked-list.py
linked-list.py
py
1,335
python
en
code
0
github-code
36
30545276303
import math from .vector_math import * import numpy as np from time import time # from memory_profiler import profile icosahedron_G = 0.5*(1.0+math.sqrt(5.0)) icosahedron_b = 1.0/math.sqrt(1.0+icosahedron_G*icosahedron_G) icosahedron_a = icosahedron_b*icosahedron_G icosahedron_corners = ( (icosahedron_a, -icos...
skybber/fchart3
fchart3/geodesic_grid.py
geodesic_grid.py
py
13,070
python
en
code
9
github-code
36
43296629564
""" Plain Python definition of the builtin functions oriented towards functional programming. """ import operator from __pypy__ import resizelist_hint, newlist_hint from __pypy__ import specialized_zip_2_lists # ____________________________________________________________ def apply(function, args=(), kwds={}): ""...
mozillazg/pypy
pypy/module/__builtin__/app_functional.py
app_functional.py
py
10,394
python
en
code
430
github-code
36
31065888205
""" What is a loop? A loop is a sequence of statements that is repeated until a certain condition is met. An example is a loop that prints out the numbers from 1 to 10. """ # There are two types of loops in Python: # 1. For loops # 2. While loops # 1. For loops """ A for loop is used to iterate over a sequence (e...
itcentralng/python-class-july-2022
Loops/aug17.py
aug17.py
py
1,743
python
en
code
0
github-code
36
35386151944
#!/usr/bin/env python3 from sys import exit from multilanguage import Env, Lang, TALcolors from TALinputs import TALinput import pirellone_lib as pl # METADATA OF THIS TAL_SERVICE: args_list = [ ('coding',str), ] ENV =Env(args_list) TAc =TALcolors(ENV) LANG=Lang(ENV, TAc, lambda fstring: eval(f"f'{fstring}'")) ...
romeorizzi/TALight
example_problems/tutorial/pirellone/services/check_sol_driver.py
check_sol_driver.py
py
2,395
python
en
code
11
github-code
36
21737129701
#!/usr/bin/env python3 from sys import stdin, stdout, exit from hades import db from hades.models.event import Events def send_help(): print('Enter to continue, d to delete, e to edit, h for help, Ctrl C/D to exit') tables = db.engine.table_names() for i in range(len(tables)): table = tables[i] curren...
adamo-in-motion/Hades
manage_events.py
manage_events.py
py
1,535
python
en
code
null
github-code
36
73188648103
import time import pyautogui as pg import userlist import pyperclip def log(): while True: time.sleep(1) print(pg.position()) def goto_tribe_room(): pg.moveTo(1075,820, 1) pg.click() pg.moveTo(1680, 600, 1) pg.click() time.sleep(3) def execute_lua(luadata): pg.press("Ent...
MuhammetSonmez/Transformice-Game-Crusher
main.py
main.py
py
2,381
python
en
code
0
github-code
36
18968000657
from aws_cdk import ( aws_rds as rds, aws_ec2 as ec2, aws_kms as kms, core ) class RDSStack(core.Stack): def __init__(self, scope: core.Construct, id: str, vpc,sg,redissg, kmskey, **kwargs) -> None: super().__init__(scope, id, **kwargs) rdskey = kms.Key.from_key_arn(self,"rdskey"...
miztiik/aws
cdk/msa/rds_stack.py
rds_stack.py
py
1,504
python
en
code
1
github-code
36
74060660904
import asyncio import contextlib from contextlib import closing from unittest import mock import pytest from server import ServerContext from server.core import Service from server.lobbyconnection import LobbyConnection from server.protocol import DisconnectedError, QDataStreamProtocol from tests.utils import exhaust...
FAForever/server
tests/integration_tests/test_servercontext.py
test_servercontext.py
py
4,597
python
en
code
64
github-code
36
43731215301
# app.py from flask import Flask, render_template from urls import get_urls app = Flask(__name__) @app.route('/') def index(): urls = get_urls() return render_template('index.html', urls=urls) if __name__ == '__main__': app.run()
VignanBaligari234/PythonSraper
app.py
app.py
py
245
python
en
code
1
github-code
36
72607742505
#!/usr/bin/env python3 import numpy import opt_analy import matplotlib import matplotlib.pyplot as plt def plot(az_list, el_list, dx_list, dy_list, file_list, raw=True): if raw == True: dx_avg, dy_avg, dx_std, dy_std, *_ = opt_analy.process_static(file_list, clip_sigma=(3.,3.)) else: az = [e ...
nanten2/necst-ros
lib/plot.py
plot.py
py
2,582
python
en
code
0
github-code
36
9671349740
#Trim a Peptide Leaderboard AminoAcid = ['G','A','S','P','V','T','C','I','L','N','D','K','Q','E','M','H','F','R','Y','W'] AminoAcidMass = [57,71,87,97,99,101,103,113, 113,114,115,128, 128,129, 131,137,147,156,163,186] def LinearSpectrum(peptide): prefixMass = [0]*len(peptide) for i in range(len(p...
benigmatic/bioinformatics
Textbook Path/ba4l.py
ba4l.py
py
2,254
python
en
code
0
github-code
36
25623525939
# the simplest solution - simply run this script at startup # - output will go to console and alert if there is a diff # For first run will compare with specified html file # or create new one if nonexistant import time import urllib.request as ur import sys, getopt import os.path from datetime import datetime import...
alexbudy/urlDiffCheck
checkURLNoTask.py
checkURLNoTask.py
py
4,126
python
en
code
0
github-code
36
35883193942
class Complex: def __init__(self, a, b): """ :param a: real part of a complex number :param b: imaginary part of a complex number """ if not isinstance(a, int): raise ValueError("a must be an integer") if not isinstance(b, int): raise ValueErro...
Cibu-Clara/University-Projects
Semester1/FP/A5/domain/complex.py
complex.py
py
1,495
python
en
code
2
github-code
36
9710177195
import re from dataclasses import dataclass from pprint import pprint import pygame import pyscroll import pytmx from random import randint, seed from src import player from src.player import NPC, Player from lib_dijkstra import Point verbose = False # seed(1) def groups_in_list(lst, code='X', blank=' '): """Fi...
bermau/PW_19_pygamon
src/map.py
map.py
py
10,396
python
en
code
0
github-code
36
40137644135
# -*- coding: utf-8 -*- from sentiment_analysis.native_bayes_sentiment_analyzer import SentimentAnalyzer model_path = './data/goods_bayes.pkl' userdict_path = './data/userdict.txt' stopword_path = './data/stopwords.txt' analyzer = SentimentAnalyzer(model_path=model_path, stopword_path=stopword_path, userdict_path=us...
NTDXYG/ProjectsForChineseGraduates
机器学习_贝叶斯商品评论情感分类/run_test.py
run_test.py
py
424
python
en
code
104
github-code
36
40265642473
from flask import Flask, render_template from post import Post from api import data postList = [] for post in data: postItem = Post(post['id'],post['title'], post['body']) postList.append(postItem) app = Flask(__name__) @app.route('/') def home(): return render_template("index.html", posts=postList) @app....
nastyc0de/python100dias
dia57/blog-templating-start/main.py
main.py
py
548
python
en
code
0
github-code
36
4705717498
#!/usr/bin/env python3 """ project: Pythonic Card Deck created:2021-10-19 @author:seraph email:seraph776@gmail.com """ from collections import namedtuple from random import choice # namedtuple used to construct a simple class to represent individual cards: Card = namedtuple('Card', ['rank', 'suit']) class CardDeck...
rishawsingh/Hacktoberfest_2021
code/pythonic_card_deck/pythonic_card_deck.py
pythonic_card_deck.py
py
1,188
python
en
code
null
github-code
36
10367895809
import youtube_dl import os from sys import argv from pydub import AudioSegment # PROCESS OF CONVERSION def process(f): audioIN = AudioSegment.from_file(f) print("Processing.... " + str(f)) audioIN.export(f[:-4] + "mp3", format="mp3") os.remove(f) # CONFIG OF DOWNLOAD download_config =...
ayushmanbt/MyPythonStuff
MY OWN SOFTWARES/MUSIC APP/main.py
main.py
py
956
python
en
code
0
github-code
36
26336658479
import requests from datetime import datetime import api_keys now = datetime.now() formatted_now_date = now.strftime("%d/%m/%Y") formatted_now_time = now.time().strftime("%H:%M:%S") exercise_ep = "https://trackapi.nutritionix.com/v2/natural/exercise" sheety_url = "https://api.sheety.co/dd81a891f83891fcffdab1...
Zoom30/100-python
Day 38/Day 38.py
Day 38.py
py
1,365
python
en
code
0
github-code
36
14566461168
from io import BytesIO from .models import Book from librarian import DocProvider from django.http import HttpResponse class RedakcjaDocProvider(DocProvider): """Used for getting books' children.""" def __init__(self, publishable): self.publishable = publishable def by_slug(self, slug): ...
fnp/redakcja
src/documents/ebook_utils.py
ebook_utils.py
py
937
python
en
code
4
github-code
36
1418943597
#!/usr/bin/env python # coding=utf-8 ''' Author: Yuxiang Yang Date: 2021-08-11 10:15:36 LastEditors: Yuxiang Yang LastEditTime: 2021-08-11 10:28:24 FilePath: /leetcode/剑指 Offer 04. 二维数组中的查找.py Description: 在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 ''' class Solution(...
yangyuxiang1996/leetcode
剑指 Offer 04. 二维数组中的查找.py
剑指 Offer 04. 二维数组中的查找.py
py
2,266
python
en
code
0
github-code
36
8439432123
def mergeSortedArrays(lists): # Write your code here. if len(lists) == 1: return lists def merge_lists(l1, l2): i, j = 0, 0 res = [] while i < len(l1) and j < len(l2): if l1[i] < l2[j]: res.append(l1[i]) i += 1 else: ...
kashyapa/coding-problems
educative.io/heap-related/medium-k-way-merge/merge_k_sorted_arrays.py
merge_k_sorted_arrays.py
py
765
python
en
code
0
github-code
36
30665616209
# File: pastebin_view.py # # Copyright (c) 2019-2023 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
splunk-soar-connectors/pastebin
pastebin_view.py
pastebin_view.py
py
1,302
python
en
code
2
github-code
36
26409221229
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right ''' class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: def invert(root): ...
lpjjj1222/leetcode-notebook
226. Invert Binary Tree.py
226. Invert Binary Tree.py
py
1,488
python
en
code
0
github-code
36
73949661223
# -*- encoding:utf-8 -*- from __future__ import absolute_import from random import randint from api.manager.positon_manager import add_activity_location from commercial.models import Club, CommercialActivity from utilities.string_utils import random_str def create_club(): return Club.objects.create(name=random_...
fabuloust/zongzong
commercial/testing/mock.py
mock.py
py
1,454
python
en
code
0
github-code
36
70640513703
import torch import numpy as np class CategoriesSampler(): def __init__(self, label, n_batch, n_cls, n_per): self.n_batch = n_batch self.n_cls = n_cls self.n_per = n_per label = np.array(label) self.m_ind = [] for i in range(max(label) + 1): ind = np.ar...
yaoyao-liu/e3bm
dataloader/samplers.py
samplers.py
py
880
python
en
code
48
github-code
36
16305876969
import matplotlib.pyplot as plt import geopandas # 3D Plot def plot3Dtrajectory(name, desc, x, y, z): fig = plt.figure(figsize=(6,6)) ax = fig.add_subplot(111, projection = '3d') ax.plot(x, y, z, color = 'purple', label = 'GPS', marker = '') plt.title(name + " " + desc) ax.set_xlabel('|X] = km'...
d33pk3rn3l/Satellite-geodesy-Exercise-1
plotter.py
plotter.py
py
2,117
python
en
code
0
github-code
36
9409618118
"""Test cases for 'Mailgun' provider module.""" import pytest import f451_comms.constants as const import f451_comms.providers.mailgun as mailgun from f451_comms.exceptions import MissingAttributeError # ========================================================= # G L O B A L S & P Y T E S T F I X T U R E S...
mlanser/f451-comms
tests/providers/test_mailgun.py
test_mailgun.py
py
8,844
python
en
code
2
github-code
36
74177779624
from aiogram import types, Dispatcher from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters import Text async def cmd_start(message: types.Message, state: FSMContext): await state.finish() await message.answer( "Начните ваш заказ (/food)!", reply_markup=types.ReplyKeyboardR...
ARSecret/arsPython
DZ/handlers/common.py
common.py
py
839
python
en
code
0
github-code
36
24447934064
import os from multiprocessing import Process from pathlib import Path from shutil import rmtree from time import sleep import lmdb import pytest import rocksdb from rocksdb.errors import RocksIOError class TestDBPath: rocksdb = "test_rocksdb" lmdb = "test_lmdb" def print_process_info(title): print("\n...
iconloop/kona
tests/test_multi_process_db.py
test_multi_process_db.py
py
2,444
python
en
code
1
github-code
36
12179384689
import itertools from unittest.mock import Mock from sukoon.kernel import SukoonKernel def test_all(): test_data = open("test/basic.py") test = '' expected = '' for line in itertools.chain(test_data, ['']): if line.startswith('##'): expected += line[2:].lstrip() elif line...
hyperparameter/sukoon
test/test_run.py
test_run.py
py
735
python
en
code
0
github-code
36
6751040076
import sys import decimal import re from PyQt5.QtWidgets import QDialog from PyQt5.QtCore import Qt import user as userdetail from lib.utils.evalenv import evalenv from db.models import Selfdefinedformat, Forms from product.controllers.productcontroller import ProductController from stuff.controllers.stuffcontroller ...
zxcvbnmz0x/gmpsystem
lib/xmlwidget/xmlread.py
xmlread.py
py
20,355
python
en
code
0
github-code
36
8491486153
from rich.table import Table from rich.console import Console import os import sqlite3 from sqlite3 import Error from colorama import Fore from colored import fg, attr from datetime import date, datetime # ============================================= con = sqlite3.connect("data.db") os.system("cls") # ================...
erfanbanaei/ManagerBuy
main.py
main.py
py
6,303
python
en
code
1
github-code
36
40661236565
from torch import nn import torch from torch.nn import CrossEntropyLoss from transformers import BertPreTrainedModel, BertConfig, BertModel from transformers.models.bert.modeling_bert import BertOnlyMLMHead class BertForPTuning(BertPreTrainedModel): def __init__(self, config: BertConfig, prompt_index): su...
zhangzhiqiangccm/NLP-project
小样本学习/few_shot/model.py
model.py
py
3,124
python
en
code
120
github-code
36
15506053954
from flask import Flask, render_template, request, Response import random test_app = Flask(__name__) @test_app.route('/') def getRandomData(): context = {"title": "Data table test"} data = [{ 'id': i, 'name': "test_name_{0}".format(random.randint(0,1000)), 'phone': random.randint(2308,9...
hssaka7/flask_boilerplate
datatable/app.py
app.py
py
567
python
en
code
0
github-code
36
8668254189
import re import json import logging class Object: # pylint: disable=too-many-instance-attributes def __str__(self): return json.dumps(self, default=lambda o: o.__dict__, indent=5) class Device(Object): def __init__(self, uid, version, firmware): self.namespace = 'http://www.w3.org/2001/XM...
ctera/ctera-python-sdk
cterasdk/common/object.py
object.py
py
3,495
python
en
code
6
github-code
36
74946408105
import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix, accuracy_score from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB from sklearn import ...
Eldoov/cs677-Data-Sci.-with-Python
Final Project/boston crime/prediction.py
prediction.py
py
4,305
python
en
code
0
github-code
36
74050173864
from parlai.core.teachers import FbDeprecatedDialogTeacher, MultiTaskTeacher from .build import build import copy import os def _path(task, opt): # Build the data if it doesn't exist. build(opt) suffix = '' dt = opt['datatype'].split(':')[0] if dt == 'train': suffix = 'train' elif dt ...
facebookresearch/ParlAI
parlai/tasks/cbt/agents.py
agents.py
py
1,587
python
en
code
10,365
github-code
36
31727216573
#!/usr/bin/python3 import urllib.request import re CONTENT="http://download.opensuse.org/tumbleweed/repo/oss/media.1/media" APPDATA="http://download.opensuse.org/tumbleweed/repo/oss/suse/setup/descr/appdata.html" CNT = urllib.request.urlopen(CONTENT).read().decode('utf-8') DISTRO = re.findall("openSUSE-(........)-x8...
openSUSE/gs-stats.o.o
appstream-trend/get-snapshot-version.py
get-snapshot-version.py
py
421
python
en
code
2
github-code
36
17310591965
import sys import io import os import shutil import base64 import hashlib from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PublicKey from Crypto.Cipher import AES from Crypto.Util import Counter RANSOM_EXT = '.INC' ENC_M...
rivitna/Malware
Inc/inc_decrypt_file.py
inc_decrypt_file.py
py
2,858
python
en
code
218
github-code
36
70862243305
from flask import Blueprint, render_template, request, redirect, url_for import pendulum import requests from .static.sc.schedule import date_schedule, get_date from . import db from .models import User, List, ListFields views = Blueprint('views', __name__) @views.route('/') def main(): return render_template('in...
eternalme0w/dvs
website/views.py
views.py
py
2,410
python
en
code
0
github-code
36
15560531772
import os import platform import re import shutil import subprocess import unittest import bug_reducer.swift_tools as swift_tools @unittest.skipUnless(platform.system() == 'Darwin', 'func_bug_reducer is only available on Darwin for now') class FuncBugReducerTestCase(unittest.TestCase): ver...
apple/swift
utils/bug_reducer/tests/test_funcbugreducer.py
test_funcbugreducer.py
py
4,700
python
en
code
64,554
github-code
36
6788250941
from .helpers import update_or_create_badge def create_user_badge(code, category, project, user): log_description = 'Migration for project {}'.format(project.pk) item = { 'name': project.name, 'date': project.start.date(), } update_or_create_badge( user_from=user, user_...
tomasgarzon/exo-services
service-exo-core/badge/project_helpers.py
project_helpers.py
py
1,023
python
en
code
0
github-code
36
951007332
pkgname = "gtkmm" pkgver = "4.12.0" pkgrel = 0 build_style = "meson" make_check_wrapper = ["weston-headless-run"] hostmakedepends = ["meson", "pkgconf", "glib-devel"] makedepends = [ "gtk4-devel", "cairomm-devel", "pangomm-devel", "gdk-pixbuf-devel", "libepoxy-devel", ] checkdepends = ["weston"] pkg...
chimera-linux/cports
main/gtkmm/template.py
template.py
py
741
python
en
code
119
github-code
36
27470111335
import os import openai from flask import Flask, render_template, request, jsonify from openai.error import ServiceUnavailableError, InvalidRequestError, RateLimitError openai.api_key = os.environ.get('OPENAI_API_KEY') app = Flask(__name__, template_folder='templates', static_folder='static') @app.route('/') def in...
rudotcom/flask-bot
app.py
app.py
py
1,687
python
en
code
0
github-code
36
74285278824
import sys from magma import * from mantle import * from rom import ROM from mantle.lattice.mantle40.MUX import Mux4 from mantle.lattice.mantle40.register import _RegisterName, Register from boards.icestick import IceStick def DefineUART (n, init=0, ce=False, r=False, s=False): class _UART(Circuit): """Constr...
bjmnbraun/icestick_fastio
workdir/printf/uart.py
uart.py
py
2,205
python
en
code
0
github-code
36
74575810344
import copy import random from constants import * class Game: def __init__(self): self.num_games = 0 self.num_wins = 0 self.num_losses = 0 self.num_draws = 0 self.num_blackjacks = 0 self.amount_played = 0 self.profit = 0 self.max_profit = 0 s...
yuc016/BlackJack_Eval
game.py
game.py
py
10,382
python
en
code
1
github-code
36
39430384118
import unittest import pathlib from helpers import FakeWriter, a_wait import grole class TestHeader(unittest.TestCase): def test_header(self): res = grole.Response(None, 123, 'foo', {'foo': 'bar'}, 'bar') writer = FakeWriter() a_wait(res._write(writer)) for line in writer.data.spl...
witchard/grole
test/test_response.py
test_response.py
py
4,504
python
en
code
5
github-code
36
72962033703
# -*- coding: utf-8 -*- """ Created on Thu Jan 3 23:47:45 2019 @author: LEX """ import time import math import torch import os import torch.onnx from model import Languagemodel from utils.data_utils import Vocab, Txtfile, Data2tensor, SaveloadHP, seqPAD, PAD, EOS, SOS from utils.core_nns import RNNModel # Load tra...
k2lexus/nlp_course
nnlm/predict.py
predict.py
py
2,413
python
en
code
0
github-code
36
8468882150
from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('headless') driver = webdriver.Chrome(options=options) #driver.get("http://www.zhgc.com/dllt_wq1/arena.asp") driver.get("http://www.zhgc.com/dllt_wq2/arena.asp") file_name = 'write7.txt' #for i in range(75,217): for i in range(13...
BabyYang2049/demo
spider/Crawler.py
Crawler.py
py
690
python
en
code
0
github-code
36
33011549163
from __future__ import division import scipy import setupplots setupplots.thesis_format() import matplotlib.pyplot as plt plt.ion() import sys sys.path.insert(0, '/Users/markchilenski/src/bayesimp') import lines lines.read_filter_file( '/Users/markchilenski/src/bayesimp/spectral_modeling/Be_filter_50_um.dat', ...
markchil/thesiscode
plot_xtomo_filter.py
plot_xtomo_filter.py
py
1,117
python
en
code
1
github-code
36
27621176523
def unit5_count(): try: with open('unit5.txt', 'w+') as unit5_file: unit5_file.write(input("Введите числа через пробел: ")) count = map(int, unit5_file.read().split()) except: print("К сожалению, неверно указан файл") unit5_count() sum_all = 0 with open('unit5.txt', '...
Igorchuvaev/Python
lesson5_hw/unit5.py
unit5.py
py
713
python
ru
code
0
github-code
36
6723139328
# To get the input from the user and count the number of even and odd lst_size=int(input("Enter the number of elements to be added in the list:")) lst=[] count=1 even_count=0 odd_count=0 for i in range(lst_size): value=int(input("Enter the value: ")) lst.append(value) count+=1 if value%2==...
DrMahaVasanth/Assignment
_1_assign_even_odd_count_2.py
_1_assign_even_odd_count_2.py
py
462
python
en
code
0
github-code
36
18355097609
#this is the server file from flask import Flask, render_template, request, redirect, session import random from datetime import datetime app = Flask(__name__) app.secret_key = 'keep it secret, keep it safe' # set a secret key for security purposes @app.route('/', methods=['get']) #per instructions: Have the root ...
full-time-april-irvine/kent_hervey
flask/flask_fundamentals/ninja-gold/ninja_gold.py
ninja_gold.py
py
2,924
python
en
code
0
github-code
36
34082922202
import sys from api.hh_api import HeadHunterAPI from config import EMPLOYEERS_VACANCY_ID from database.db_manager import DBManager from app.mixin_menu_app import MixinMenuAPP from utils.сurrency_сonverter import get_currency_data from app.job_search_meta import JobSearchAppMeta from utils.loading_progress import show_...
AndreyAgeew/skypro-course_work_5
app/job_search_app.py
job_search_app.py
py
6,996
python
ru
code
0
github-code
36
3511368259
import itertools digits = [ x for x in range(10) ] i = 0 for x in itertools.permutations(digits): i += 1 if i == 1000000: print(x) break for c in x: print(c,end="")
PetraVidnerova/euler
24.py
24.py
py
200
python
en
code
0
github-code
36
40209432333
import csv import numpy as np from pymc import Gamma, Normal, NoncentralT, Binomial, Uniform, invlogit, logit, deterministic, stochastic ### SETUP # counts_pos, counts_total, batch_id, plate_id, row, col, treatment rows = [tuple(row) for row in csv.reader(open('nephrine_fracs.csv'))] pos_counts, total_counts, batch_id...
thouis/works-in-progress
hierscore/nephrine_frac.py
nephrine_frac.py
py
3,924
python
en
code
0
github-code
36
36586957185
n = int(input()) i = 2 while n != 1: if n % i == 0: n /= i print(i) else: i += 1 # 시간초과 # import math # n = int(input()) # a = [] # b = [] # # 소수 판별 # def prime(x): # for i in range(2, int(math.sqrt(x)) + 1): # if x % i == 0: # return False # return True ...
meatsby/algorithm
boj/11653.py
11653.py
py
471
python
en
code
0
github-code
36
14656210330
from random import choice from faker import Faker bank_names_fr = [ "Banque CIBC", "BMO Banque de Montréal", "Banque Desjardins", "Banque HSBC Canada", "Banque Laurentienne du Canada", "Banque Nationale du Canada", "Banque Royale du Canada", "Banque Scotia", "Banque TD Canada Trust...
GRAAL-Research/risc
risc_generator/faker/contract_faker/financing_faker.py
financing_faker.py
py
1,559
python
en
code
3
github-code
36
39978019698
import argparse import numpy as np import pandas as pd import io_tools BASE_TIMESTEP = 10 MAX_TIMESTEP = 120 parser = argparse.ArgumentParser(description="Reduce displacement data for remote processing.") parser.add_argument("disp_file", help="displacements file") parser.add_argument("outfile", help="output file") ...
rohan-hitchcock/tcells-portfolio
track_analysis/reduce_data.py
reduce_data.py
py
575
python
en
code
0
github-code
36
18824545650
import weibull # fail times include no censored data fail_times = [ 9402.7, 6082.4, 13367.2, 10644.6, 8632.0, 3043.4, 12860.2, 1034.5, 2550.9, 3637.1 ] # this is where the actual analysis and curve fitting occur analysis = weibull.Analysis(fail_times, unit='hour') analysis.fit...
slightlynybbled/weibull_orig
examples/weibull_fit.py
weibull_fit.py
py
604
python
en
code
null
github-code
36
74222814823
#!/usr/bin/env python3 import yaml import rospy import os from uav_abstraction_layer.srv import TakeOff, GoToWaypoint, Land from geometry_msgs.msg import PoseStamped class WayPointTracker: def __init__(self): self.uav_namespace = rospy.get_param("~uav_namespace", "") self.file_path = rospy.get_par...
AntoineRichard/sesame_ul_uavs
src/simple_mission.py
simple_mission.py
py
4,141
python
en
code
0
github-code
36
74330818023
# -*- coding: utf-8 -*- from __future__ import absolute_import from enigma import eInputDeviceManager, eTimer from Screens.Screen import Screen from Screens.Rc import Rc from Components.Sources.List import List from Components.ActionMap import ActionMap from Components.config import config from Components.Sources.Stat...
opendreambox/enigma2
usr/lib/enigma2/python/Plugins/SystemPlugins/InputDeviceManager/InputDeviceIRProg.py
InputDeviceIRProg.py
py
6,801
python
en
code
1
github-code
36
37208304076
#!/usr/bin/env python3.6 import os, sys import yaml from lmfit import Model from lmfit.models import GaussianModel from lmfit.model import save_modelresult from lmfit.model import load_modelresult from reproject import reproject_exact from astropy.io import ascii, fits from astropy.table import Table, Column import...
Fil8/GuFo
scavengers/momPlay.py
momPlay.py
py
52,897
python
en
code
0
github-code
36
25046359532
import numpy as np def sensitivity_specificity(): output_matrix = np.loadtxt(open("Outcome/outcome_CT_clinical_BMD.csv", "rb"), delimiter=",", skiprows=0) threshold = 0.5 TP = FN = TN = FP = 0 for i in range(output_matrix.shape[0]): # output_matrix: participant ID, fracture probability, label...
Saint-Luther-AI/Fracture-Discrimination
metrics.py
metrics.py
py
2,543
python
en
code
0
github-code
36
70165426985
""" Created by: Rafal Uzarowicz Date of creation: 27.03.2020 Github: https://github.com/RafalUzarowicz """ import unittest from src.path_search_algo import dijkstra, brute_force from src.graph import Graph class TestPathSearchAlgorithms(unittest.TestCase): def test_dijkstra(self): graph = Gr...
jsokolowska/ant-colony
unit-tests/path_search_algorithm_test.py
path_search_algorithm_test.py
py
1,164
python
en
code
0
github-code
36
11162715396
import threading class KeyboardThread(threading.Thread): def __init__(self, on_input, name = 'keyboard-input-thread'): self._on_input = on_input super(KeyboardThread, self).__init__(name=name) self.setDaemon(True) self.start() def run(self): while not self._on_input(input()): True
lophtware/UsbCPic32Breakout
src/examples/pong/python/keyboard.py
keyboard.py
py
299
python
en
code
2
github-code
36
30329681031
import scrapy # TF-IDF # import StemmerFactory class from Sastrawi.Stemmer.StemmerFactory import StemmerFactory from math import log10 # create stemmer factory = StemmerFactory() stemmer = factory.create_stemmer() class QuotesSpider(scrapy.Spider): name = "tubes_novel5" def start_requests(se...
VicinthiaVS/Tugas-Besar-Scrapy-2014321018-Pagi-Ubhara-Surabaya
soal3/tubes_novel/spiders/novel5.py
novel5.py
py
3,112
python
en
code
0
github-code
36
34744522317
#website compile doctype = "html" lang = "en-US" author = "Angelo Carrabba" self.keywords = [] spacing = 0 class webPage(): def __init__(self): self.pageName = "" self.title = "" self.styleSheets = [] self.scripts = [] self.description = "" self.menu = "" def p...
acarrab/acarrab.github.io
OldWebsite/old/script.py
script.py
py
802
python
en
code
0
github-code
36
12626648363
# 1. Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление. # Числа запрашивать у пользователя, предусмотреть обработку ситуации деления на ноль. def division(a, b): try: a, b = float(a), float(b) result = a / b except ZeroDivisionError: print("Знач...
AlexProsku/HW_Python
Lesson_3/task_1.py
task_1.py
py
1,116
python
ru
code
0
github-code
36
11370141393
import torch import numpy as np from ml.modules.losses.ordinal_regression_loss import OrdinalRegressionLoss config_path = '../config/config_files/kitti_base.yaml' ord_num = 90 gamma = -0.97 beta = 90 config = load_config(config_path) config['model']['params']['discretization'] = "SID" ordinal_regression_loss = Ordi...
gregiberri/DepthPrediction
measuring_scripts/min_error_with_dorn.py
min_error_with_dorn.py
py
1,138
python
en
code
0
github-code
36
25622745933
from sqlalchemy import Column, ForeignKey, String, DateTime, Boolean, Enum from sqlalchemy import func, exc from sqlalchemy.dialects.postgresql import UUID from uuid import uuid4 from .. import db from enum import Enum from datetime import datetime #? https://stackoverflow.com/questions/33612625/how-to-model-enums-bac...
SpiritDeveloper/multi-translados-backend
src/multi/model/extra_expenses.py
extra_expenses.py
py
2,977
python
en
code
0
github-code
36
22868454772
import time import pandas as pd from selenium import webdriver from selenium.webdriver.chrome.options import Options from datetime import datetime # Config file purpose options = Options() options.add_argument("--incognito") options.add_argument("--window-size=1920x1080") # Driver path driver = webdriver.Chrome(opt...
chois11/7071CEM-R
resources/crawler/layer_three.py
layer_three.py
py
4,885
python
en
code
0
github-code
36
36934201214
import os import sys if sys.platform[:4] == "java": # Jython import uk.ac.cam.ch.wwmm.opsin as opsin else: # CPython import jpype if not jpype.isJVMStarted(): _jvm = os.environ['JPYPE_JVM'] if _jvm[0] == '"': # Handle trailing quotes _jvm = _jvm[1:-1] _cp = os.environ['C...
cinfony/cinfony
cinfony/opsin.py
opsin.py
py
3,688
python
en
code
82
github-code
36
7061035673
from microbit import * power_on = False while True: if button_a.was_pressed(): power_on = True if button_b.was_pressed(): display.clear() power_on = False if power_on: x_accel = accelerometer.get_x() if x_accel < 0: display.show('-...
ceucomputing/olevel-microbit
pendulum_template.py
pendulum_template.py
py
423
python
en
code
0
github-code
36
586835230
# Residual block architecture import torch import torch.nn as nn from torch.nn import functional as F from torch.autograd import Variable import pdb class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, sn, kernel_size, stride): super(ConvLayer, self).__init__() padding = (ke...
trainsn/TSR-TVD
model/basicblock.py
basicblock.py
py
7,192
python
en
code
1
github-code
36
74647038823
import os import networkx as nx from networkx.drawing.nx_agraph import write_dot from tree_parser.parser import DependencyParser _path = os.path.dirname(__file__) _save_filename = os.path.join(_path, '../data/tree_parser.model') _text = """ In nuclear physics, the island of stability is a predicted set of isotopes...
fractalego/tree_parser
tree_parser/predict.py
predict.py
py
781
python
en
code
2
github-code
36
71920473385
from pathlib import Path import requests import json # user is the name of the user # type is either "ANIME" or "MANGA" def get_list(user, type = "ANIME", queries = None): if queries is None: queries = load_queries() variables = { 'name': user, 'type': type } url = 'https://graphql.anil...
em-ilia/anilist-sync
anilist.py
anilist.py
py
1,062
python
en
code
0
github-code
36
74080161383
from pwn import * context.terminal=['tmux', 'splitw', '-h'] #r = process('./solo_test') r = remote('115.68.235.72', 1337) e = ELF('./solo_test') puts_plt = e.plt['puts'] puts_got = e.got['puts'] read_plt = e.plt['read'] read_got = e.got['read'] pr = 0x400b83 ret = 0x4005f1 start = 0x4006a0 system_offset = 0x30cf0 bi...
e10dev/study
xmasctf/solo_test.py
solo_test.py
py
1,391
python
en
code
0
github-code
36
70440969063
def arrSum(a, sum): start = 0 n = len(a) curr_sum = a[0] i = 1 count = 0 while i <= n: while curr_sum > sum and start < i - 1: curr_sum -= a[start] start += 1 if curr_sum == sum: print(start, i-1) # Count number of continuous sub-ar...
CoderKn1ght/GeekforGeeksPractice
count_subarrays_with_sum.py
count_subarrays_with_sum.py
py
500
python
en
code
0
github-code
36
23522576847
""" Multilayer perceptron for cycloid and Lorenz attractor. "Eugene Morozov"<Eugene ~at~ HiEugene.com> """ import matplotlib.pyplot as plt import torch.nn import torch.nn as nn import torch.optim as optim import scipy.linalg from scipy.integrate import odeint from util import * v = 1 epoch_sec = 1 # int(time.time())...
eugegit/examples
nn_cycloid.py
nn_cycloid.py
py
21,540
python
en
code
1
github-code
36
40745506193
import json import os import torch import torch.nn as nn import pandas as pd import argparse from test import test from src.dataset import create_dataloader from src.utils import ( read_feature, feature_extraction_pipeline, read_features_files, choose_model, ) from src.data_augmentation import Mixup, Sp...
rafaelgreca/ser-wavelet
train.py
train.py
py
16,934
python
en
code
0
github-code
36
24391185825
from flask import Blueprint, request, jsonify import pandas as pd import requests import mysql.connector as connection db = connection.connect(host='database-midway.cnjonpzevrxo.us-east-1.rds.amazonaws.com',user='admin', password='root1234', database= 'midway') search_bp = Blueprint('search', __name__) @search_bp....
KavindaDharmasiri/midway-backend
search.py
search.py
py
2,244
python
en
code
0
github-code
36
37410651261
def copy_file(file_name="", copy_name=None): try: input_file = open(file_name, "r") except FileNotFoundError: print("Не удалось открыть входной файл!") return False if copy_name is None: file_number = 1 while True: try: list_directory = fi...
kbuhantsev/python_home_work
ДЗ/ДЗ_3/ДЗ3_2.py
ДЗ3_2.py
py
1,277
python
en
code
0
github-code
36
42672390948
import logging class LoggingService: def __init__(self, name) -> None: self.logger = logging.getLogger(name) self.handler = logging.StreamHandler() self.formatter = logging.Formatter( '%(asctime)s [%(name)-12s] %(levelname)-8s %(message)s') self.handler.setFormat...
team-ananas-og-mango/SaxoStockService
saxo_stock_service/loggingservice.py
loggingservice.py
py
429
python
en
code
1
github-code
36
37402893297
from regression_tests import * class Test(Test): settings = TestSettings( tool='fileinfo', input=[ '87d55c52d358adb705d0b58f478a3e555acf76b7ba79f9eea6353d18cef558ca', 'db23546116825fe5fd43210e3f2595cd675eab72e2f900df4a2b6756737379c0' ], args='--json' ) ...
avast/retdec-regression-tests
tools/fileinfo/detection/installers/astrum/test.py
test.py
py
661
python
en
code
11
github-code
36
36693637201
### tree(union_find, trie 등) # def BOJ1976(): # 여행가자 (https://www.acmicpc.net/submit/1976/28363407) # import sys # from collections import defaultdict # n = int(input()) # 도시 개수 # m = int(input()) # 방문 도시 개수 # link = [list(map(int,sys....
Incheol-Shine/daily_coding_test
tree.py
tree.py
py
3,808
python
ko
code
0
github-code
36
7950602535
import discord from discord.ext import commands try: import cPickle as pickle except ImportError: import pickle def loadPickle(file : str): with open(file, 'rb') as f: data = pickle.load(f) return data def dumpPickle(data, file : str): with open(file, 'wb') as f: pick...
nath1100/Kamikaze-Bot
cogs/utilities/tools.py
tools.py
py
1,198
python
en
code
1
github-code
36
15296344179
n = int(input()) numbers = [int(i) for i in input().split()] sum1 = 0 sum2 = 0 turn = 0 last = n for x in range(n): if numbers[0] > numbers[last-1]: max = numbers[0] numbers.remove(numbers[0]) else: max = numbers[last-1] numbers.remove(numbers[last-1]) last-=1 if turn == ...
maci2233/Competitive_programming
CodeForces/A/381a.py
381a.py
py
439
python
en
code
1
github-code
36
70441939623
''' Summary - Attempt #1 Your own answer?: Yes Time spent: 45m Time Complexity: O(N) for all opeartions Runtime: 170 ms, faster than 78.69% of Python3 online submissions for Implement Trie (Prefix Tree). Space Complexity: O(N) for insert and O(1) for search and startsWith Memory Usage: 27.8 MB, less than 91.49% of P...
cjy13753/algo-solutions
leetcode/solution_208.py
solution_208.py
py
1,405
python
en
code
0
github-code
36
74698894504
import hashlib import datetime from fastapi import UploadFile from motor.motor_asyncio import AsyncIOMotorClient from config import settings from models import UploadPhoto, UploadUser, Photo def Hash(string: str): hash = hashlib.sha256(string.encode('utf-8')).digest().decode('utf-8') return hash class DB: ...
NIDILLIN/Kathrin
Microservices/Photos(1405)/db.py
db.py
py
1,762
python
en
code
0
github-code
36
1075971281
import segmentation_models as sm import numpy as np import visualize from unet.config import Config from tensorflow import keras class Inference: def __init__(self, config=None): if config is None: config = Config() # Use default configuration self.model = sm.Unet(config.BACKBONE, cla...
Malandru/multiclass_segmentation
unet/inference.py
inference.py
py
2,044
python
en
code
0
github-code
36
37458237517
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint plt.rcParams['font.size'] = 14 M = 15 k = 2 c = 5 ν = c / M ω = k / M def f(u, t, ν, ω): """ u: [x,v] δu/δt = f(u) = [δx/δt, δv/δt] = [v, a] 1) Ma + kv + cx = 0 2) Ma = -kv - cx 3) let ν = c/M; ω=k/m ...
lbrichards/asaka
mass_spring.py
mass_spring.py
py
1,890
python
en
code
2
github-code
36
33780162767
from flask import Flask, render_template, session from flask_session import Session from app.api.controllers import api from logging.handlers import TimedRotatingFileHandler import config, logging app = Flask(__name__, static_folder="static") app.config.from_object("config") app.config['JSON_AS_ASCII'] = False app.c...
pachecobeto95/IC
SensingBusV2/webapi/app/__init__.py
__init__.py
py
712
python
en
code
0
github-code
36
9224374025
import numpy as np import random import pandas as pd distance = set() while len(distance)< 100: random_float = random.uniform(0,15) distance.add(random_float) distance_list = list(distance) size = [] for i in range(100): random_int = random.randint(45,150) size.append(random_int) distance_value ...
Cagla-CAGLAYAN/rentPredictor
prediction.py
prediction.py
py
1,357
python
en
code
1
github-code
36
31062436935
from ..utils import Object class BankCardInfo(Object): """ Information about a bank card Attributes: ID (:obj:`str`): ``BankCardInfo`` Args: title (:obj:`str`): Title of the bank card description actions (List of :class:`telegram.api.types.bankCardActionOpenUr...
iTeam-co/pytglib
pytglib/api/types/bank_card_info.py
bank_card_info.py
py
865
python
en
code
20
github-code
36
29398889822
from robodk.robolink import * # RoboDK API from robodk.robomath import * RDK = Robolink() def cleanup(objects, startswith="Part "): """Deletes all objects where the name starts with "startswith", from the provided list of objects.""" for item in objects: if item.Name().startswith(startswith): ...
SistemasEmbebidos2020/Practica5_2022
Eliminarobjetos.py
Eliminarobjetos.py
py
593
python
en
code
null
github-code
36
4578609455
from itertools import combinations n,k = [int(x) for x in input().split()] work = {} #work เก็บงานของอุปกรณ์ price = {} #price เก็บราคาของอุปกรณ์ for i in range(n): data = [int(x) for x in input().split()] work[i] =set([j-1 for j in range(1,k+1) if data[j] == 1]) price[i] = data[0] check = set([i for i in...
naphattar/Betaprogramming
Chapter 1/1036.ver2.py
1036.ver2.py
py
860
python
en
code
0
github-code
36