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
26677394683
from typing import Callable, Dict, List from redis import StrictRedis import time from slackclient import SlackClient from .data import Bot, Command, Event class PyBot(SlackClient): def __init__(self, token: str, bot: Bot, db: StrictRedis) -> None: super().__init__(token) if (not self.rtm_connec...
albertywu/pybot
slack_pybot/bot.py
bot.py
py
3,378
python
en
code
1
github-code
1
28026329976
import unittest from unittest.mock import MagicMock from maliput_sim.core.sim import (Behavior, SimulationConfig, SimulationState, AgentInitialState) class TestSimulationConfig(unittest.TestCase): def test_default_config(self): config = SimulationConfig() self.assertEqual(config.real_time_factor,...
maliput/maliput_sim
test/core/sim_test.py
sim_test.py
py
2,750
python
en
code
0
github-code
1
23155170555
import fnmatch import os import argparse import uuid # PARAMETERS parser = argparse.ArgumentParser(description='Rearrange a Unity\'s project folder guids.') parser.add_argument('-i, --input', metavar='FOLDER', type=str, nargs=1, required=True, dest='input_folder', help='input folder') args = parser.parse_args() i...
fani-kiran/Unity-AssetDuplicator
DuplicateFolder.py
DuplicateFolder.py
py
2,969
python
en
code
0
github-code
1
14385504161
# 세수의 합 # 배열을 입력받아 합으로 0을 만들수 있는 3개의 엘리먼트를 출력하라 nums = [-1,0,1,2,-1,-4] def threeSum(nums): nums.sort() # [-4,-1,-1,0,1,2] result = [] for i in range(len(nums)-2): left , right = i+1 , len(nums)-1 if i>0 and nums[i] == nums[i-1]: # 중복을 방지하기 위함 continue ...
hyo-eun-kim/algorithm-study
ch07/misung/ch7_3_misung.py
ch7_3_misung.py
py
1,077
python
ko
code
0
github-code
1
36549110878
"""Backend supported: tensorflow.compat.v1, tensorflow, pytorch, paddle""" import os os.environ["DDEBACKEND"] = "pytorch" import numpy as np import deepxde as dde # For plotting import matplotlib.pyplot as plt x_lower = -5 x_upper = 5 t_lower = 0 t_upper = np.pi / 2 nx = 256 nt = 201 # Creation of the 2D domain (fo...
xusuyong/WTU-AI4S
src/PINN/标准非线性薛定谔方程/deepxde-非线性薛定谔-呼吸子.py
deepxde-非线性薛定谔-呼吸子.py
py
5,053
python
en
code
0
github-code
1
70828987235
import tensorflow.python.eager.context from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Activation from tensorflow.keras.utils import to_categorical from tensorflow.keras.datasets import mnist from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import confusion_ma...
CJW-MAPU/TIL
Python/First/mnist_deeplearning.py
mnist_deeplearning.py
py
2,749
python
en
code
3
github-code
1
990625037
class Player: def __init__(self): self.active_pokemon = '' self.pokemon_list = [] self.money = 0 self.healing_items = [] self.pokeball_bag = [] def playerturn(self,enemy): action = '' print("\nWhat would you like to do?\n") prin...
ljwenger99/Pokemon-P
Pokemon P/Player.py
Player.py
py
2,402
python
en
code
0
github-code
1
73527997474
import sqlite3 '''LETS KNOW THE DATA TYPES WE HAVE IN sqlite3 Null --> means doesnot exist integers --> means real numbers REAL --> means numbers with decimal TEXT --> means just a Text BLOB --> means kind of images mp3file or music file ''' '''STEPS IN CREATING A DATA IN THE DATABASE''' # #STEP ONE: # # creating...
Gentility01/new-python
data2.py
data2.py
py
5,639
python
en
code
0
github-code
1
27701555522
import json from pathlib import Path import numpy as np import argparse from typing import Text, Optional, List, Dict, Any, Set, BinaryIO class Codebook: def __init__(self, directoryname: Text): codebook_filename = Path(directoryname) / "codebook.bin" print(f"Reading codebook from {codebook_file...
RasaHQ/semantic-map-embedding
scripts/codebook_to_json.py
codebook_to_json.py
py
4,328
python
en
code
0
github-code
1
40019937175
import numpy as np import matplotlib.pyplot as plt def f(x): if x < 0 or x > 1: return 0 else: return 1 - x def g(x): if x < 0 or x > 2: return 0 else: return 1 - x/2 def riemann(f, g, bounds = [-3, 4], delta_x = 0.001): s = 0 for x in np.arange(bounds[0], bou...
wbernoudy/signal_processing
triangles.py
triangles.py
py
621
python
en
code
0
github-code
1
25632547496
from functools import reduce from operator import concat # =================================================== # utils # =================================================== def select_keys(d: dict, ks: list) -> dict: return {k: d[k] for k in ks if k in d} # =================================================== ...
akotek/CDN
ex.py
ex.py
py
1,271
python
en
code
0
github-code
1
25866765879
import numpy as np import random import math import copy import matplotlib.pyplot as plt import matplotlib.animation as animation class RED_FOXES: def __init__(self, maxx, minx, wymiar, fitness, alfa): self.wymiar = wymiar self.position = np.empty(wymiar) self.mi = random.uniform(0, 1) ...
JakubPrzychodzki1G/in-ynierka-red-fox-algorytm
main.py
main.py
py
8,628
python
pl
code
0
github-code
1
32635564454
import os import subprocess import tkinter as tk from tkinter import messagebox, filedialog def scan_drive(): # Define the path to scan path = "C:\\" # Run the built-in Windows command to check for file system errors result = subprocess.run(["chkdsk", path], stdout=subprocess.PIPE) # ...
gravymix/supershiddydrivescanner
main.py
main.py
py
1,662
python
en
code
1
github-code
1
30770286097
import sqlite3 # from flask import jsonify # from flask import request conn = sqlite3.connect('cards.db') c = conn.cursor() # c.execute(""" # CREATE TABLE DominionGames ( # game_id integer PRIMARY KEY, # Player1Name text NOT NULL, # Player1Score text NOT NULL, # Player2Name text NOT N...
jtstrunk/boardgameFlask
app/database.py
database.py
py
716
python
en
code
0
github-code
1
29316897925
import jax import tensorflow as tf import numpy as np from transformers import GPT2TokenizerFast import itertools class TFRecordLoader: def __init__(self, index_fname, batch_size, parse_fn, map_fn=None, restore_state=None): if restore_state is not None: self.file_idx = restore_state["file_idx"...
Lisennlp/mesh_easy_jax
tfrecord_loader.py
tfrecord_loader.py
py
8,299
python
en
code
0
github-code
1
37676968693
from ..helper import config, get_class_from_dot_string from ..logging import logger default_storage = config('DEFAULT_FILE_STORAGE') class DefautStorageBackend: default_backend = None instance = None def __init__(self): if not default_storage: raise Exception('Default storage backend...
goldnetonline/django-rest-api-test
support/storages/default_backend.py
default_backend.py
py
874
python
en
code
0
github-code
1
30716496756
import json import unittest from copy import deepcopy from http import HTTPStatus from typing import Union from flask import Response from team_picker.constants import (TEAMS_URL, TEAM_BY_ID_URL, RESULT_ONE_ROLE, RESULT_LIST_TEAMS, RESULT_CREATED_C...
ibuttimer/TeamPicker
test/test_teams.py
test_teams.py
py
20,098
python
en
code
0
github-code
1
75267626593
from fastapi import APIRouter, Response, HTTPException, status from models import ProductSchema from controllers import read_products, read_category, write_product, read_product, purge_product from datetime import date router = APIRouter() @router.get('/', response_model=list[ProductSchema]) async def get_products...
bananichdev/fastApi-money-control
routers/products.py
products.py
py
1,540
python
en
code
1
github-code
1
71660047394
#스택/큐 #올바른 괄호 from collections import deque def solution(s): answer = 0 que = deque(s) while que: k = que.popleft() if answer == -1: return False if k == '(': answer += 1 else: answer -= 1 if answer == 0: return Tru...
yabooung/study
프로그래머스/파이썬/레벨2/올바른 괄호.py
올바른 괄호.py
py
369
python
en
code
0
github-code
1
3261805310
import logging import time from datetime import timedelta import numpy as np from tqdm import tqdm import src.cfg as cfg import src.data as data import src.models as models import src.processing as processing import src.filters as fltr """ parameters = dict(years_train=list(range(2010, 2014)), year...
idrigo/arctic_ddmodeling
scripts/predict_area.py
predict_area.py
py
3,063
python
en
code
1
github-code
1
11424085756
import json import logging from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt from rest_framework import status from rest_framework.response import Response from .tasks import fetch_fastq logger = logging.getLogger(__name__) @csrf_exempt def test(request): r...
ufuktepe/DataCollectionService
data_collection/views.py
views.py
py
1,308
python
en
code
0
github-code
1
26904333768
from flask import * import requests, subprocess, json, re app = Flask(__name__) @app.route("/") async def start(): return """ <form action="/get"> <input name="username" id="username"> <label for="username">Username</label> </form> """ @app.route("/get") async def getRender(): id ...
TheTechRobo/plays.tv-finder
app.py
app.py
py
1,527
python
en
code
0
github-code
1
24844251148
# -*- coding: utf-8 -*- """ Created on Mon Nov 2 23:15:08 2020 @author: mfb """ # Tour de Hanoï # Création d'une pile sans taille définie def CreaStack(): P = [] # Création de la Pile en mémoire return(P) # Empilage par la méthode '.append()', sans contrôle de taille de ...
lucas-science/cours-prog
NSI/PILES_FILES_CORRIGER-20211009/StrDonLinListTourHanoi-CORRIGER.py
StrDonLinListTourHanoi-CORRIGER.py
py
1,132
python
fr
code
0
github-code
1
15253117933
r"""Preprocess code.org data into a form that we can handle.""" import os import pickle import getpass import numpy as np USER = getpass.getuser() DATA_ROOT = '/mnt/fs5/{}/generative-grading/data/real/education/'.format(USER) ZIPF_CLASS = {'head': 0, 'body': 1, 'tail': 2} def load_data(problem_name): problem_id...
malik-ali/generative-grading
src/rubricsampling/makeRawCodeOrgStudentData.py
makeRawCodeOrgStudentData.py
py
3,221
python
en
code
5
github-code
1
40454649248
# -*- coding: utf-8 -*- import base64 import json from odoo import fields, models, api from ..utils.utils import make_signature class PaymentAcquirer(models.Model): _inherit = 'payment.acquirer' provider = fields.Selection(selection_add=[('liqpay', 'Liqpay')]) liqpay_public_key = fields.Char( ...
i-vyshnevska/l10n_ukraine
liqpay_acquirer/models/payment_acquirer.py
payment_acquirer.py
py
3,744
python
en
code
0
github-code
1
10990578984
from typing import Dict from tqdm import tqdm from towhee.utils.log import engine_log from towhee.runtime import ops, AcceleratorConf from towhee.operator import NNOperator from towhee.serve.triton import constant from towhee.serve.triton.model_to_triton import ModelToTriton from towhee.serve.triton.pipe_to_triton imp...
towhee-io/towhee
towhee/serve/triton/pipeline_builder.py
pipeline_builder.py
py
3,691
python
en
code
2,843
github-code
1
43620730728
#!/usr/bin/env python3 import RPi.GPIO as GPIO import time GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) ports = (31, 32, 35, 36) for port in ports: GPIO.setup(port, GPIO.OUT) GPIO.output(port, GPIO.LOW) time.sleep(0.2) GPIO.cleanup()
Advaith3600/trash-detection-ros
motor/src/clear.py
clear.py
py
253
python
en
code
1
github-code
1
28435115919
import csv import os import re import sys def path_select(): pth = sys.argv[1] return pth # argv로 인자 받기, class에선 이 방법을 사용할 수 없다 def search_files(pth): sep_path = [] path_group = {} for (root_dirs, _, file_dirs) in os.walk(pth): for fil in file_dirs: # file_dirs는 root_dirs...
riflstoe/vains
python/classworks/file_csv_transfer.py
file_csv_transfer.py
py
3,924
python
ko
code
0
github-code
1
74839939873
import os import glob import re from datetime import datetime, timedelta, time import fitz from openpyxl import Workbook from dataclasses import dataclass # ------ CHANGE ME --------- folder_path = "C:\\Users\\majona\\GitHub\\iko-tools\\Python\\antwerpTimeConverter\\input" save_path = f'C:\\Users\\majona\\GitHub\\ik...
jonathanmajh/iko-tools
Python/antwerpTimeConverter/main.py
main.py
py
3,729
python
en
code
0
github-code
1
71079721954
# two compartments per rucksack # points for shared items import string def priority(letter: str) -> int: return ( (26 if letter.isupper() else 0) + string.ascii_lowercase.index(letter.lower()) + 1 ) score = 0 with open("input.txt") as f: lines, i = [l.rstrip("\n") for l in f....
m-wrzr/aoc-2022
3/main_b.py
main_b.py
py
541
python
en
code
1
github-code
1
23382532043
import random import time class Attack: @staticmethod def attack_target(person, target): hit = random.choice(person.atk_chance) if hit: target.hp -= person.dmg print(f'{person.name} hit the {target.name} and deal {person.dmg}, now {target.name} has {target.hp} hp') ...
CoolLikeGoose/PQ-WIP-
RPG.py
RPG.py
py
1,210
python
en
code
0
github-code
1
12270965106
import numpy as np import src.main.Downlink as Dl import src.main.Analyzer as An import src.main.IO as IO from pandas import DataFrame points = 10 min_power = -1 max_power = 2 dn = 0.5 b_line = 0.0 t_line = (-0.36, 0.37) q_line = 0.0 s_line = (-0.5, 0.0, 0.5) opt = True def set_power(total_points=points, powe...
Nedhoven/SymbolDetection
WirelessChannel/src/main/Manager.py
Manager.py
py
21,704
python
en
code
2
github-code
1
18468754601
import os, time import numpy as np import tensorflow as tf # version 1.14 from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense from tensorflow.keras.datasets import mnist from tensorflow.keras.callbacks import TensorBoard (X_train, y_train), (X_test, y...
sum-coderepo/Optimization-Python
NeuralNetwork/CompareOptimizerAutoencoder.py
CompareOptimizerAutoencoder.py
py
1,096
python
en
code
2
github-code
1
10267385852
print("Введите размерность улитки: ") dimension = input() key = {True: 'x', False: ' '} olist = list(range(int(dimension) // 2)) for ykey in (1, -1): for y in olist[::ykey]: slist = [] for xkey in (1, -1): for x in olist[::xkey]: d = -2 if (xkey, ykey) == (-1...
LucidPep/labs
projvscode_python/labDrawSnail.py
labDrawSnail.py
py
481
python
en
code
0
github-code
1
40003735306
class Employee: def __init__(self, first_name: str, department: str, email: str): self.first_name = first_name self.department = department self.email = email class Task: def __init__(self, name: str, description: str, duration: int): self.name = name self.descript...
fiaeb23/Islamovic
Python-T2/OOP/09_Hausi_Lsg.py
09_Hausi_Lsg.py
py
878
python
en
code
0
github-code
1
28850425103
# -*- coding: utf-8 -*- from node.test.base_test import BaseTestCase from node.plugins.uptime import Plugin from mock import Mock, patch class UptimeTest(BaseTestCase): def set_up_mock(self, filemock): fs_mock = Mock() filemock.return_value = fs_mock fs_mock.readline.return_value = '344.12...
gperetin/seamon
node/test/plugins/uptime_test.py
uptime_test.py
py
1,023
python
en
code
1
github-code
1
11810692657
import logging from django.core.exceptions import ObjectDoesNotExist from django.test import Client, TestCase from django.urls import reverse from cms.contexts.tests import ContextUnitTest from cms.medias.tests import MediaUnitTest from cms.pages.models import PageMedia from cms.pages.tests import PageUnitTest lo...
UniversitaDellaCalabria/uniCMS
src/cms/api/tests/test_page_media.py
test_page_media.py
py
5,322
python
en
code
5
github-code
1
20811139345
file = open('file.txt') f = file.readlines() #print(f) wrd_rp_d = {} wrds_lst = [] for line in f: #print(line,"$$$$$$$$$$$$$$$$$$$$$$$$$$$$") if line.endswith('\n'): l = line.rstrip('\n') ls = l.split(' ') else: ls = line.split(' ') for wrd in ls: wrds_lst.appen...
chaitanya-j/python-learning
My_Projects/fun programs/repest_words_cnt.py
repest_words_cnt.py
py
481
python
en
code
1
github-code
1
24000446479
from datetime import date from django.views import generic from .models import Post, Event from .forms import PostForm, EventForm from django.contrib import messages from django.shortcuts import render, redirect, reverse, get_object_or_404 from django.contrib.auth.decorators import login_required from django.core.excep...
rocrill/velo_city
blog/views.py
views.py
py
6,688
python
en
code
0
github-code
1
14386273501
''' 50. 정렬된 배열의 이진 탐색 트리 변환 오름차순으로 정렬된 배열을 높이 균형 이진 탐색 트리로 변환하라. Given the sorted array: [-10,-3,0,5,9], One possible answer is: [0,-3,9,-10,null,5], which represents the following height balanced BST: 0 / \ -3 9 / / -10 5 ''' # Definition for a binary tree node. # class TreeNode: # def ...
hyo-eun-kim/algorithm-study
ch14/taeuk/ch14_9_taeuk.py
ch14_9_taeuk.py
py
877
python
ko
code
0
github-code
1
21615960545
import os import json import datetime from django.apps import apps from django.core.management.base import BaseCommand, CommandError from core.models import User, ActivityPeriod class Command(BaseCommand): help = "Insert a .json file containing user details and their activity periods." def validate_date_fo...
Mangy007/full-throttle-labs-api
core/management/commands/populate_data.py
populate_data.py
py
2,799
python
en
code
0
github-code
1
31109285277
import argparse from itertools import islice import random def run_martingale_simulation(initial_bankroll, initial_bet): bankroll = initial_bankroll bet = initial_bet results = [] while bankroll > 0: result = simulate_spin() if result == 'win': bankroll += bet ...
kevindowling/FreelancingExamples
RouletteSim/RouletteSimLocal/roulette.py
roulette.py
py
7,100
python
en
code
0
github-code
1
17989289001
from anytree import Node, RenderTree from apted.helpers import Tree node_id = 0 def parse_goal_ast(content): """ Brings the AST into an 'anytree' shape using recursion. """ global node_id node_id = 0 po_id = str(content.get('id', -1)) ast_anytree_root_node = Node( po_id, op_name="...
Flunzmas/gym-autokey
gym_autokey/envs/datastructures/po_anytree.py
po_anytree.py
py
3,295
python
en
code
6
github-code
1
32061921957
from datetime import datetime import pytest from pytest_mock import MockerFixture from recipes.models import ProductListItem, ProductListWeek, Recipe, RecipePlan, RecipePlanWeek from telegram_bot.services import utils, telegram_handlers from recipes.tests.factories import ( ProductListItemFactory, ProductList...
djangoner/RecipeBase
telegram_bot/tests/test_telegram.py
test_telegram.py
py
4,762
python
en
code
0
github-code
1
30093159372
#!/usr/bin/env python3 import math import rospy from geometry_msgs.msg import Twist from sensor_msgs.msg import LaserScan distance = 99 def move(velocity_publisher): DIST = 0.6 global distance velocity_message = Twist() loop_rate = rospy.Rate(10) while distance > DIST: linear_speed =...
mhered/ROS-notes
src/mhered/src/robot_student2.py
robot_student2.py
py
2,261
python
en
code
6
github-code
1
11583024405
import numpy as np from annotation import load_state, OBS_DICT from project_temp2 import initialization, forward, backward def EM(states_filename, obs_filename): # states are the true labels # observations are the training data # The variable observations is a string. # The variable observations_index...
xinlingl/Gene-Structure-Prediction
EM.py
EM.py
py
3,529
python
en
code
0
github-code
1
195482476
"""Main init module contains create_app function""" import logging import os from logging.handlers import SMTPHandler, RotatingFileHandler import telebot_router from flask import Flask from flask_bootstrap import Bootstrap from flask_login import LoginManager, login_manager from flask_migrate import Migrate from flask...
Vadim-AM/Customer-service
app/__init__.py
__init__.py
py
2,857
python
en
code
0
github-code
1
15161999466
def insertionSort(alist): countComparisons=0 countSwaps=0 for index in range(1,len(alist)): currentvalue = alist[index] position = index countComparisons +=1 while position>0 and alist[position-1]>currentvalue: countComparisons+=1 countSwaps+=1 ...
Jacob-TylerThomas/CSC-231-Labs
lab8/insertionSort.py
insertionSort.py
py
472
python
en
code
0
github-code
1
15155010943
import time from behave import * from Wiz_Game_Feature_File.Utensils.CommonUtil import * from Wiz_Game_Feature_File.Utensils.object_repo import objectdict @given('I am on the Demo Login Page') def launch_browser(context): open_browser(context) context.driver.get(objectdict['given_url']) context.driver.sav...
Mohesh-mkp/Wizard_game
Wiz_Game_Feature_File/Steps/step_definitions.py
step_definitions.py
py
5,397
python
en
code
0
github-code
1
37564289971
import os import warnings import numpy as np from scipy.signal import find_peaks from scipy.interpolate import InterpolatedUnivariateSpline import pandas as pd from pyqcams import constants def gaus(vp , vt, s=0.1): ''' Gaussian function used for Gaussian Binning of final vibrational states. In...
Rkoost/PyQCAMS
pyqcams/util.py
util.py
py
4,683
python
en
code
2
github-code
1
31173869561
class ControlGame: c=0 def __init__(self,turns): # This initializes the game with an empty board, the current # player set to 'Red' and the number of turns # specified by the user (defaults to 64). turnsToPlay must # be an even number in the range [2..64]. self.tu...
Exile404/Some-Paid-Works
Paid Project/ControlGame.py
ControlGame.py
py
3,932
python
en
code
0
github-code
1
41433217351
#!/usr/bin/env python # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import urllib2 import requests import codecs import csv import pprint as pp import re from collections import OrderedDict url_standard = 'http://nocompulsoryvaccination.com' url_next_page = '/page/' #web request function def make_reque...
rjshanahan/Vaccination-Social-Media
generic_forum_webscraper.py
generic_forum_webscraper.py
py
3,517
python
en
code
3
github-code
1
27218942710
import datetime import json import os import shutil import sys import time from threading import Thread import PyQt5 import selenium from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import Qt, QThread from PyQt5.QtGui import QFont # from selenium import webdriver import web # Login: glog...
Skayloo/SS
Start.py
Start.py
py
16,869
python
en
code
0
github-code
1
36975879377
# -*- coding: utf-8 -*- """ script launched during summer with Patricia coming """ import cv2 import datetime import mutex import numpy as np import os import time import threading #~ from skimage.measure import structural_similarity as ssim # apt-get install python-skimage #~ import paramiko # Captures a single imag...
alexandre-mazel/electronoos
capture/capture.py
capture.py
py
13,916
python
en
code
2
github-code
1
4997054465
#!/usr/bin/env python3 import os import random import signal import socket import struct import sys import threading import time from datetime import datetime from datetime import timedelta Z = 2 W = 3 X = 3 T = 1 M = 3 # Packet_type REG_REQ = 0xa0 REG_ACK = 0xa1 REG_NACK = 0xa2 REG_REJ = 0xa3 REG_INFO = 0xa4 INFO_A...
marioferro2002/XARXES-prac1
server.py
server.py
py
35,024
python
en
code
0
github-code
1
44071652739
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module to run a Nextflow pipeline and get output """ import os import subprocess ABSDIR = os.path.realpath(".") # location for execution of pipeline NXF_DIR = os.path.join(ABSDIR, "nxf") # nextflow script to execute NXF_SCRIPT = os.path.join(ABSDIR, "main.nf") # mai...
stevekm/nextflow-ci
nextflow.py
nextflow.py
py
2,365
python
en
code
0
github-code
1
20174125920
a = input("Enter the name of the file: ") def function(b): """ This is a function for taking input from the file """ f = open(b) content = f.read() f.close() return content c = function(a) print(c)
udaynarwal72/pythontutorial
practice/finding file.py
finding file.py
py
226
python
en
code
0
github-code
1
3179744349
from django.urls import path from PrincipalApp import views from django.contrib.auth.decorators import login_required app_name = 'Merlin' urlpatterns = [ path('', views.Index.as_view(), name='Index'), path('ListCategoria/',views.ListCategoria.as_view(), name='ListCategoria'), path('RegistrarCategoria/',views...
bsramosl/Merlin
PrincipalApp/urls.py
urls.py
py
641
python
es
code
0
github-code
1
15690350442
from celery.schedules import crontab import djcelery djcelery.setup_loader() BROKER_URL = 'redis://localhost:6379/0' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler" CELERY_DISABLE_RATE_LIMITS = False CELERYBEAT_SCHEDULE = { 'delete-every-day': ...
lafaiDev/mini-blog
tweets/settings/celery_config.py
celery_config.py
py
449
python
en
code
0
github-code
1
41782618855
import numpy as np import argparse import cv2 ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required = True, help = "Path to the image") args = vars(ap.parse_args()) image = cv2.imread(args["image"]) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2.imshow("Original", image) lap = cv2.Laplacia...
heitorrapela/daily-studies
computer-vision/book_practical_python_and_opencv/chapter 10/10.1.py
10.1.py
py
417
python
en
code
4
github-code
1
17459832619
from . import views from django.urls import path """ Url paths extended from from django.urls BUG: enabling app_name causes a django.urls.exceptions.NoReverseMatch error 500. """ app_name = 'blog' urlpatterns = [ path('blog/', views.PostList.as_view(), name='blog'), path("blog/<slug:slug>/", views.pos...
sgs22/needapc
blog/urls.py
urls.py
py
351
python
en
code
0
github-code
1
33023755580
class Node: def __init__(self, data, reference=None): self.data = data self.reference = reference node1 = Node(5) print(node1.data) node2 = Node(11) node1.reference = node2 print(node1.reference) class LinkedList: def __init__(self, head=None): self.head = head def print_link...
JAMES-CERO/Python-linked-list
main.py
main.py
py
1,342
python
en
code
0
github-code
1
72840974755
import pandas as pd # Завантажте XLSX файл xlsx_file = '.xlsx' # Замініть на шлях до вашого XLSX файлу # Зчитайте XLSX файл data = pd.read_excel(xlsx_file) # Збережіть дані у файл CSV csv_file = '.csv' # Замініть на ім'я, під яким ви хочете зберегти файл CSV data.to_csv(csv_file, index=False)
VAlduinV/KPI_tasks
HW_1/py_files/convert.py
convert.py
py
409
python
uk
code
0
github-code
1
16312450690
import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit from helpers import * class CdcmainlibPlugin(plugins.SingletonPlugin): plugins.implements(plugins.IConfigurer) plugins.implements(plugins.ITemplateHelpers) # IConfigurer def update_config(self, config_): toolkit.add_templa...
jiankaiwang/ckanext-cdcmainlib
ckanext/cdcmainlib/plugin.py
plugin.py
py
1,632
python
en
code
0
github-code
1
70072127074
from node import Node numbers = [] def setup(): with open("input.txt") as f: global numbers numbers = f.readlines()[0].strip().split(' ') def main(): i = 0 while(i < len(numbers)): rootNode = Node(numbers[i], numbers[i + 1]) i += 2 i = loopChildNodes(rootNode, i) print('metadata sum', roo...
FredrikLastow/advent-of-code
2018/day8/main.py
main.py
py
998
python
en
code
0
github-code
1
33627617622
from math import fabs from platform import platform from tkinter.tix import Tree import pygame import os import random import time class Setting: window_width = 750 window_height = 900 frames = 60 path_file = os.path.dirname(os.path.abspath(__file__)) image_path = os.path.join(path_file, "Images"...
ElRashoMacuin/JumperGame
jump.py
jump.py
py
22,760
python
en
code
0
github-code
1
72192651874
# 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 sortedArrayToBST(self, nums: list[int]) -> TreeNode: # Helper function to construct a balanced BST from a...
iemgovind/LeetCode
Tree/108. Convert Sorted Array to Binary Search Tree.py
108. Convert Sorted Array to Binary Search Tree.py
py
1,864
python
en
code
0
github-code
1
10989798884
import torch from torch import nn class CenterPivotConv4d(nn.Module): """ CenterPivot 4D conv Args: in_channels (`int`): Number of input channels. out_channels (`int`): Number of output channels. kernel_size (`list or tuple`): Numbers for kernel...
towhee-io/towhee
towhee/models/layers/conv4d.py
conv4d.py
py
3,550
python
en
code
2,843
github-code
1
71611531233
#!/usr/bin/env python3 import operator from functools import reduce from pathlib import Path def part1(contents): visible_trees_counter = 0 grid = [[x for x in row] for row in contents.split("\n")] n, m = len(grid), len(grid[0]) for i in range(n): for j in range(m): if i not in (0,...
delminskii/adventofcode2022
day8/script.py
script.py
py
2,664
python
en
code
0
github-code
1
31322951877
# URL do Enunciado # https://www.beecrowd.com.br/judge/pt/custom-problems/view/1759 anoatual = int(input()) anoinic = 2006 aument = 1.015 salinc = 1000 saltotal = aument*salinc if anoatual>=anoinic: while anoinic<anoatual: saltotal = saltotal*(aument+0.01) anoinic = anoinic+1 aument = aume...
lucaperes96/Algoritmos-e-Programacao
LucasPeres/Lista4/1759.py
1759.py
py
430
python
pt
code
1
github-code
1
4196190259
# Ce programme permet de déterminer lequel de deux nombres flottants entrés # par l’utilisatrice ou l’utilisateur est le plus petit # akbarimehdi 20210926 _val1=int(input("Veuillez entrer le premier nombre: ")); _val2=int(input("Veuillez entrer le second nombre: ")); if(_val1>_val2): print("Le plus petit nombre ...
akbarimehdi/Exercise
minimum.py
minimum.py
py
448
python
fr
code
0
github-code
1
23152733329
import os replacement = "to 2 decimal places" for dname, dirs, files in os.walk("/mnt/e/local git/astudio/maths/equations"): for fname in files: fpath = os.path.join(dname, fname) with open(fpath) as f: s = f.read() s = s.replace("to 2 decimal places", replacement) with o...
astudioapp/maths
equations/re.py
re.py
py
364
python
en
code
0
github-code
1
16970298264
#! encoding = utf-8 import unittest from dictionary import conjug, conjug_all class TestConjug(unittest.TestCase): def test_present_indicatif(self): answer = { "aimer": ("j'aime", "tu aimes", "il aime", "elle aime", "nous aimons", "vous aimez", "ils aiment", "elles ai...
luyaozou/conjugaison
test_conjug.py
test_conjug.py
py
78,752
python
fr
code
1
github-code
1
70839157473
n = int(input()) arr = [1] * n temp = 0 for i in range(1,n): arr[i] = arr[i-1] + i if arr[i] > n: temp = i break # print(temp) # print(arr) adj = [] for i in range(1,temp+1): if i % 2 == 0: adj.append([1, i]) else: adj.append([i, 1]) # print(adj) k = n - arr[temp-1] # p...
ckdfh0917/Algorithm
백준/단계별로 풀어보기/1193. 분수찾기.py
1193. 분수찾기.py
py
549
python
en
code
0
github-code
1
21233407475
import requests from lxml import etree if __name__ == '__main__': headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36' } url = 'https://anqiu.58.com/ershoufang/' page_text = requests.get(url = url,headers = hea...
xiaomaozhaocai/python
pachong/05.requests实战之爬取药监局.py
05.requests实战之爬取药监局.py
py
411
python
en
code
1
github-code
1
35650658942
from collections import namedtuple import numpy as np Experience = namedtuple('Experience', 'state action reward new_state game_over') ''' A more efficient implementation of replay memory to optimize for space. This implementation of ReplayMemory was inspired by the following sources: - devsisters/DQN-tensorflow: ...
prabhatnagarajan/repro_dqn
dqn/replaybuffer.py
replaybuffer.py
py
3,689
python
en
code
6
github-code
1
35470028218
import tkinter as tk counter = 0 #counting every second def counting(label: tk): def count(): global counter counter += 1 label.config(text=str(counter)) label.after(1000, count) count() root = tk.Tk() root.title('Counting time (s)') root.geometry('420x240') label = tk.La...
coderkai03/Python-TKinter-Lab
partB.py
partB.py
py
491
python
en
code
0
github-code
1
70882252515
# -*- coding: utf-8 -*- from environment import GraphicDisplay, Env class Agent: def __init__(self, env): self.env = env # 2-d list for the value function self.value_table = [[0.0] * env.width for _ in range(env.height)] self.discount_factor = 0.9 # get next value function tabl...
chopperkim/aicnu
value_iteration_dp/value_iteration_for_student.py
value_iteration_for_student.py
py
2,046
python
en
code
0
github-code
1
70749879395
from http.server import BaseHTTPRequestHandler import json import debugserver def capitalize(string, lower_rest=False): return string[:1].upper() + (string[1:].lower() if lower_rest else string[1:]) class handler(BaseHTTPRequestHandler): def do_GET(self): path = self.path print('path is ', path) ...
johnayoung/test-zeit-now
capitalize.py
capitalize.py
py
621
python
en
code
0
github-code
1
28146672506
################################################################################# # Capstone Project - Career Study Advisor # By: Kevin Elliott (ellkev004), Ryan Wong (wngrya001) and Zena Kelz (klzzen001) # 21/07/2014 - 22/09/2014 # This document is for navigation throught the website ################################...
ryanwongsa/CareerStudyAdvisor
csa/advisor/urls.py
urls.py
py
2,718
python
en
code
0
github-code
1
4516725284
# Волшебный шар. Напишите программу, которая моделирует волшебный шар, т. е. # игрушку, предсказывающую будущее, которая дает случайный ответ на общий вопрос, # требующий ответа "да" или "нет". Среди исходного кода главы 7, а также в подпапке # data "Решений задач по программированию" соответствующей главы, вы найдете ...
su1gen/python-homework
lesson03HW/task18.py
task18.py
py
1,681
python
ru
code
0
github-code
1
73004256993
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.conf.urls import url from . import views app_name = 'proyecto' urlpatterns = [ # URL pattern for the UserListView url( regex=r'^$', view=views.ProyectoListView.as_view(), name='list' ), ...
danielstp/jaguares
proyecto/urls.py
urls.py
py
883
python
en
code
1
github-code
1
43111521803
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2016/12/26 16:22 # @Author : Aries # @Site : # @File : 4-6_principal_component_analyze.py # @Software: PyCharm #主成分分析 降维 import pandas as pd #参数初始化 inputfile = 'principal_component.xls' outputfile = 'dimention_reducted.xls' #降维后的数据 data = pd.read_exc...
caijiahao/machineLearning
src/Python数据分析与挖掘实战/数据预处理/4-6_principal_component_analyze.py
4-6_principal_component_analyze.py
py
401
python
en
code
1
github-code
1
33593223112
import numpy as np from scipy.optimize import curve_fit def logistic_model(t,r,K): return K/(1+(K/p0-1)*np.exp(-r*t)) N=int(input().strip()) populations=list(map(int,input().strip().split())) T=int(input().strip()) years_to_predict=[int(input().strip())for _ in range(T)] p0=populations[0] t=np.arange(0,N) initial_g...
MicroPlusone/SDU_mathmodeling_program
山东大学 数学模型 程序汇总/人口增长的logistic模型.py
人口增长的logistic模型.py
py
599
python
en
code
1
github-code
1
23910040963
#!/user/bin/env python3 # Note that all the tests in this module require dataset (either network access or cached) import os import glob import shutil import torchtext.data as data from torchtext.datasets import AG_NEWS import torch from ..common.torchtext_test_case import TorchtextTestCase def conditional_remove(f):...
MauiDesign/PyTorchText
test/data/test_builtin_datasets.py
test_builtin_datasets.py
py
14,783
python
en
code
0
github-code
1
37259020703
from gpaw import * from ase.io import read, write from ase.eos import EquationOfState from ase.optimize import BFGS import numpy as np import math as m import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # User inputs ################################################################# kpoints = [4, 4...
venkkris/scripts
bo_nmc.py
bo_nmc.py
py
3,609
python
en
code
0
github-code
1
11613445795
import requests import json from bs4 import BeautifulSoup import re import nltk nltk.download('stopwords') from nltk.corpus import stopwords # Everthing in one file stop_words = stopwords.words('english') def scrap_content(url): page=requests.get(url) page_content= page.text content = BeautifulSoup(p...
Abdelrahman-Abuhelal/free-GPT
main.py
main.py
py
3,284
python
en
code
0
github-code
1
24125526099
import os from pathlib import Path dir_ = os.path.abspath(os.curdir) p = Path(f'{dir_}/text2/text3/text4/text5/text6') p.mkdir(parents=True, exist_ok=True) def rec(): for i in os.listdir(): if Path(i).is_file(): print('file-',i) else: print('dir-',i) os.c...
RozhkovaDarya/Rozhkova_Darya_dz_7
2.py
2.py
py
544
python
en
code
0
github-code
1
71113924193
from django.urls import path, include from my_plant_app.web.views import create_profile, show_index, details_profile, edit_profile, delete_profile, \ show_catalogue, create_plant, details_plant, edit_plant, delete_plant urlpatterns = ( path('', show_index, name='show index'), path('profile/', include([ ...
GeorgiLukanov87/PythonWeb-Django-Framework
my_plant_app/my_plant_app/web/urls.py
urls.py
py
883
python
en
code
4
github-code
1
24012699516
import aiopg class DbSession(object): engine = None connection = None cursor = None status = None def __init__(self, engine, *, transactional=True): self.transactional = transactional self.engine = engine self.connection = None self.status = 'new' @property ...
eteamin/buzzle
buzzle/database/session.py
session.py
py
3,033
python
en
code
3
github-code
1
37690690285
import numpy as np from .vehicle_pose import VehiclePose from .waypoint import Waypoint from typing import List, Union import sys import math import time from queue import PriorityQueue from io import StringIO MAX_FLOAT = sys.float_info.max - 10 DIR_TOP = 0 DIR_TOP_LEFT = 1 DIR_TOP_RIGHT = 2 DIR_LEFT = 3 DIR_RIGHT =...
out0/crawler-poc
planner/astar.py
astar.py
py
8,784
python
en
code
0
github-code
1
12578144176
""" Created on Tue Feb 28 11:44:11 2023. @author: Vishal Philip This script consists of functions for plotting line charts, bar charts and pie charts using matplotlib library. It also reads data from excel files using pandas. """ import pandas as pd import numpy as np import matplotlib.pyplot as plt ...
vishalphilip1/MScDataScience
Assignment1/Visualisation.py
Visualisation.py
py
3,898
python
en
code
0
github-code
1
8092641902
# Распознавание лиц с помощью нейронных сетей # Необходимо установить следующие компоненты: # pip install git+https://github.com/rcmalli/keras-vggface.git # pip install mtcnn # pip install keras-applications # Заменить строку на from keras.utils.layer_utils import get_source_inputs # В файле keras_vggface/models.py fro...
eabuntov/poiist_lab
lab7.py
lab7.py
py
2,763
python
en
code
0
github-code
1
31764970088
def COOKEweights(SQ_array, TQ_array, realization, alpha, background_measure, overshoot, cal_power): """Compute the weights with Cooke formulation Parameters ---------- SQ_array : numpy array Array with answers to seed questions TQ_array : numpy array Array with answ...
demichie/elicipy
COOKEweights.py
COOKEweights.py
py
9,208
python
en
code
0
github-code
1
21380838489
import pygame, sys, math, random, time, Object pygame.init() width = 1000 height = 1000 size = width, height fps = 60 bgColor = (83,174,232) screen = pygame.display.set_mode(size) icon = pygame.image.load('icon.png') pygame.display.set_caption("Ball Demo") pygame.display.set_icon(icon) clock = pygame.t...
jtcnh/BallDemo
main.py
main.py
py
1,030
python
en
code
0
github-code
1
25053928496
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: helper_pointer = main_pointer = head prev = None while helper_point...
snk95/Sarvesh-Code
Leetcode/Fundamental/Remove_k_from_end_linkedlist.py
Remove_k_from_end_linkedlist.py
py
848
python
en
code
0
github-code
1
11912264448
import os import random import shutil from src.club.club import * from src.club.player import Player from src.club.training_report import TrainingReport from src.club.training_venue import TrainingVenue from src.match.fixture import MatchType, Venue from src.match.match_report import MatchReport from src.utilities.sav...
psibuck/Radnor
run_tests.py
run_tests.py
py
6,268
python
en
code
0
github-code
1
15347359304
import pickle import torch import os from ood_samplefree.datasets import __DATASETS__, get_transform from ood_samplefree.architectures import __ARCHITECTURES__, \ __ARCHITECTURES_224__ from ood_samplefree.experiments import OODStreamerWithSummaries NUM_WORKER = 4 BATCH_SIZE = 256 def run(dataset, architecture, ...
jm-begon/ood_samplefree
experiments/main.py
main.py
py
4,667
python
en
code
2
github-code
1
39761293672
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans, DBSCAN from sklearn import metrics from sklearn.datasets import make_blobs from scipy.spatial import Voronoi # Aquí tenemos definido el sistema X de 1000 elementos de dos estados # construido a p...
peinadoginesd/clustering
clustering.py
clustering.py
py
10,811
python
es
code
0
github-code
1
19115387739
import getChannelInfo from flask import Flask, request, url_for, redirect, render_template app = Flask(__name__) @app.route("/", methods=["POST","GET"]) def home(): if request.method == "POST": return redirect(url_for("results", youtubeUrl = request.form["url"].split('.com/')[-1])) else: retur...
luantorrex/youtube-insights
main.py
main.py
py
1,293
python
en
code
0
github-code
1