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
27674411948
""" Author: Carlos Fernando Castaneda Class : CS 2302 Date Modified: May 12, 2019 Instructor: Olac Fuentes Assingment: Lab 8 Algorithm Design Techniques TA: Anindita Nath & Maliheh Zaragan Purpose: to implement both randomized algorithms and backtracking teachniques learned in class to check if two algorithm...
cfcastaneda98/CS2302
Lab8/lab8.py
lab8.py
py
5,453
python
en
code
0
github-code
50
73961133915
import pymysql from modules.cardgen import CardGen import modules.config as cfg if __name__ == "__main__": cardgen = CardGen() cards = cardgen.get_cards(1) print(cards) # Connect to the database conn = pymysql.connect(host=cfg.host, user=cfg.user, ...
TaylorAbraham/Uncharted-Realms-ML
main.py
main.py
py
870
python
en
code
1
github-code
50
37492925281
def main(): fruits = ['grape', 'apple', 'strawberry', 'waxberry', 'pitaya'] print(max(fruits)) print(min(fruits)) max_value = min_value=fruits[0] for elem in fruits: if elem >max_value: max_value=elem elif elem<min_value: min_value=elem print("Max:",max_va...
ymjrchx/python-demo
Day07/findmax.py
findmax.py
py
392
python
en
code
0
github-code
50
70832032154
''' Main file Run in terminal 'python3 main.py' to use project Dependencies: - sqlite3 - requests ''' from api import * from sql import * from datetime import date, datetime # User input start/end date in ISO8601 format start_date = input("Start date (YYYY-MM-DD, default=[start of repo]): ") + "T" if start_date == ...
ARtheboss/github-repo-analysis
main.py
main.py
py
2,967
python
en
code
0
github-code
50
40126941120
# used by cmsDriver when called like # cmsDriver.py hlt -s HLT:@relval autoHLT = { 'fake' : 'Fake', 'fake1' : 'Fake1', 'fake2' : 'Fake2', 'relval50ns' : 'Fake', 'relval25ns' : 'Fake1', 'relval2016' : 'Fake2', 'relval2017' : 'Fake2', 'relval2018' : 'Fake2', 'relval2022' : 'Fake2', ...
cms-sw/cmssw
Configuration/HLT/python/autoHLT.py
autoHLT.py
py
424
python
en
code
985
github-code
50
73110306076
from pydub import AudioSegment def split_mp3(file_name): sound = AudioSegment.from_mp3(file_name) halfway_point = len(sound) // 2 first_half = sound[:halfway_point] + sound[:halfway_point] # create a new file "first_half.mp3": first_half.export("first_half_twice.mp3", format="mp3")
Algostu/chungyo
pose_diff/core/audio.py
audio.py
py
306
python
en
code
6
github-code
50
24360173200
# bit_mask로 하는 방법도 있다. arr = [1, 2, 3] N = 3 sel = [0] * N # 사용. def perm(idx, check): if idx == N: print(sel) return for i in range(N): # 원소의 개수만큼 반복할 것. if (check & (1<<i)) != 0: # 이전에 사용한 원소 사용 X. -> 이걸 어떻게 체크? continue sel[idx] = arr[i] perm(idx + 1,...
phoenix9373/Algorithm
2020/SWEA_문제/순열_BitMask.py
순열_BitMask.py
py
580
python
ko
code
0
github-code
50
25156426576
import optuna from optuna.pruners import SuccessiveHalvingPruner from optuna.samplers import TPESampler from optuna.trial import TrialState from functools import partial import matplotlib.pyplot as plt from ai.lab.base import LabEntity from ai.lab.trial import Trial from ai.util import print_header class Experiment(...
calvinpelletier/ai
lab/exp.py
exp.py
py
4,226
python
en
code
0
github-code
50
9349714998
from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def inicio(): return render_template("formulario.html") @app.route('/procesar', methods=['POST']) def procesar(): palabra = request.form.get("palabra") significado = request.form.get("significado") return render...
Fersnake22/Sustitucion-de-CLI-por-Web
main.py
main.py
py
452
python
en
code
0
github-code
50
36817192015
from __future__ import print_function import os import yaml from config import config destination = os.path.expanduser("~/.exo") if not os.path.exists(destination): os.mkdir(destination, 0o755) print("created configuration folder:", destination) config_destination = os.path.join(destination, "template.y...
baites/exo_plots
install.py
install.py
py
790
python
en
code
0
github-code
50
26895369081
from requests import request, exceptions as req_exceptions from .microsoft_api_auth import * from connectors.core.connector import get_logger, ConnectorError from connectors.core.utils import update_connnector_config logger = get_logger('azure-log-analytics') MANAGE_SERVER_URL = 'https://management.azure.com' MANAGE_...
fortinet-fortisoar/connector-azure-log-analytics
azure-log-analytics/operations.py
operations.py
py
11,944
python
en
code
0
github-code
50
11964147517
class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: array = sorted(set(nums), reverse=True) frequency = Counter(nums) hash_map = defaultdict(int) length = len(nums) for key in array: length -= frequency[key] hash_map[key]...
duressa-feyissa/A2SV_Programming
1365-how-many-numbers-are-smaller-than-the-current-number/1365-how-many-numbers-are-smaller-than-the-current-number.py
1365-how-many-numbers-are-smaller-than-the-current-number.py
py
469
python
en
code
0
github-code
50
33657136040
from django.urls import path, include from rest_framework.routers import Route from app.urls import router from . import views app_name = 'user' router.routes += [ # User View Route Route( url=r'^user{trailing_slash}$', mapping={ 'get': 'view_user', 'post': 'create_us...
Diaga/MARS-Server
app/user/urls.py
urls.py
py
997
python
en
code
1
github-code
50
35134699125
from .base import BaseCommand from app.controllers import Commands from app.utilities import typings, errors class Command(BaseCommand): name = "start" usage = "start <tournament_id>" description = "Start or Resume the tournament mode" def __init__(self) -> None: self.commands = Commands(pac...
Madscientiste/OpenClassrooms_P4
app/commands/start.py
start.py
py
3,357
python
en
code
0
github-code
50
7408239741
import os import re import pandas as pd import numpy as np import logging from time import strptime from collections import defaultdict from src.utils.files import save_json from src.utils.refs import aux_paths, params def read_csv(path, build_mode=False): _df = pd.read_csv(path) if build_mode: _df = ...
tanfiona/HDBResalePrice
src/steps/process.py
process.py
py
27,156
python
en
code
2
github-code
50
27211573123
# -*-coding:utf-8-*- # 题目描述 """ https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/ """ # 标签: 树 深度优先搜索 广度优先搜索 二叉树 # 解题思路: """ 这里使用层次遍历 queue数组存储树节点 temp数组存储该节点下一层节点 然后用res统计结果 """ # 执行结果: 通过 """ 执行用时:24 ms, 在所有 Python 提交中击败了80.39% 的用户 内存消耗:15.8 MB, 在所有 Python 提交中击败了32.88% 的用户 通过测试用例:39 / 39 ""...
zranguai/leetcode-solution
剑指Offer/easy/剑指Offer55-1-二叉树的深度.py
剑指Offer55-1-二叉树的深度.py
py
1,254
python
zh
code
1
github-code
50
7297029761
class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ pos=-1 for i in nums: if target==i: pos=nums.index(i) if pos==-1: nums.append(target) ...
DanielAlexanderMarcus/Python-Work
search_Insert.py
search_Insert.py
py
407
python
en
code
0
github-code
50
350833675
from django.contrib.auth.views import LoginView, LogoutView from django.test import SimpleTestCase from django.urls import reverse, resolve from class_journal.views import TimetableView, JournalView, AddMarkView, DiaryView class TestURLs(SimpleTestCase): def test_url_resolves(self): url_names_views = { ...
Proximity42/Electronic-Diary
tests/test_urls.py
test_urls.py
py
675
python
en
code
0
github-code
50
71895360476
from configparser import SafeConfigParser global _WorkHeight global _StartxPosition global _ShakeHeight global _ShakeXDist global _ShakeStepDelay global _ShakeStepAngleRange global _servoFillAngle global _Zfeedrate global _Xfeedrate global _HWservoDelay # Delay after servo move (MUST BE SAME IN FIRMWARE (for MA...
JiriPrusa/PyPeS
python_GUI/settings.py
settings.py
py
5,036
python
en
code
0
github-code
50
29871407460
from torch import nn import torch import numpy as np class Tacotron2Loss_VAE(nn.Module): def __init__(self, hparams): super(Tacotron2Loss_VAE, self).__init__() self.anneal_function = hparams.anneal_function self.lag = hparams.anneal_lag self.k = hparams.anneal_k self.x0 = h...
jinhan/tacotron2-vae
loss_function.py
loss_function.py
py
1,671
python
en
code
162
github-code
50
21371042513
from copy import deepcopy import numpy as np import pdb from src.formula_parser import FormulaParser from src.extended_definition import ExtendedDefinition from src.logic_parser import LogicParser kg_parser = LogicParser(ExtendedDefinition(debug=True)) fm_parser = FormulaParser(ExtendedDefinition(debug=True)) kb = {...
JiajunSong-Bigai/geometry_fc_bc
src/my_unification.py
my_unification.py
py
15,219
python
en
code
0
github-code
50
74858873756
"""Implementation for agents interface""" from typing import Any, Tuple, List, Union import numpy as np from numpy.linalg import norm from highrl.obstacle.single_obstacle import SingleObstacle from highrl.utils.action import ActionXY from highrl.utils.abstract import Position class Agent: """ Class that repr...
ahmedheakl/multi-level-rl-for-robotics
src/highrl/agents/agent.py
agent.py
py
10,865
python
en
code
6
github-code
50
73810841435
import logging import json import os import sys sys.path.append('../') import data_processing.confidence as cf import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import skimage.filters as filters from skimage.io import imread, imsave import itertools from scipy.optimize import least_squares f...
erickmartinez/relozwall
data_processing/camera/ir_thermography_spot.py
ir_thermography_spot.py
py
2,651
python
en
code
0
github-code
50
74164588634
import numpy as np def linear_fit(x, y, fit_min, fit_max): """Fit x, y with a linear function y = mx + b Args: x: x variable y: y variable fit_min: minimal value of x to fit fit_max: maximal value of x to fit Returns: m: slope of the fitted line b: int...
yqshao/tame
tame/fit.py
fit.py
py
533
python
en
code
0
github-code
50
41729304062
# -*- coding:utf-8 -*- from Tkinter import * class Red(): def __init__(self, root, btn, label): self.label = label self.btn = btn self.root = root self.n = 0 def gs(self): self.btn['command'] = self.cc def cc(self): if self.n == 0: self.label['...
sdabing/my-python-diary
tkinter/kapai jishu.py
kapai jishu.py
py
785
python
en
code
0
github-code
50
7979426307
from pydantic import BaseModel,ValidationError, validator from typing import Any from pydantic.networks import EmailStr from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy import Boolean, Column, ForeignKey, Integer, Stri...
ade2112/skillz
modules/form/model.py
model.py
py
1,264
python
en
code
0
github-code
50
36793390895
#! /usr/bin/env python import copy def readonly(value): return property(lambda self: value) class A: def __init__(self, value): _value = copy.deepcopy(value) A.readonly = readonly(_value) class B: def __init__(self, value): self._readonly = copy.deepcopy(value) @property ...
baites/examples
classes/python/ReadOnlyByClosure.py
ReadOnlyByClosure.py
py
543
python
en
code
4
github-code
50
585202611
from socket import * port = 3333 BUF_SIZE = 1024 sock = socket(AF_INET, SOCK_DGRAM) sock.bind(('', port)) while True: data, addr = sock.recvfrom(BUF_SIZE) print('<- ', data.decode()) msg = input('-> ') sock.sendto(msg.encode(), addr)
H43RO/Network-Programming
Example2/udp_chat_server.py
udp_chat_server.py
py
254
python
en
code
0
github-code
50
42082097565
#!/usr/bin/env python # coding: utf-8 # ![image.png](attachment:image.png) # In[1]: # Lets choose K-Means Clustering Unsupervised ML Algorithm # In[3]: # Step 1: Let us import the required Libraries # In[4]: import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn import datasets ...
SAMKOXXPACO/Prediction-using-Unsupervised-Algorithm
Unsupervised ML Task Clustering .py
Unsupervised ML Task Clustering .py
py
8,575
python
en
code
0
github-code
50
71756104794
import math from typing import * import numpy as np import torch import torchaudio.transforms as at from torch import nn from torch.distributions import Beta from torch.nn import functional as F from torch.nn.parameter import Parameter class GeMP(nn.Module): """from: https://github.com/knjcode/kaggle-seti-2021/b...
yoichi-yamakawa/kaggle-contrail-3rd-place-solution
scripts/training/model_util.py
model_util.py
py
6,295
python
en
code
1
github-code
50
23741005175
import transformers import torch from transformers import OpenAIGPTTokenizer, GPT2Tokenizer from transformers import PreTrainedTokenizer, PreTrainedModel from transformers import AutoTokenizer, AutoModelWithLMHead, AutoModelForCausalLM import faulthandler faulthandler.enable() from transformers import (AdamW, OpenAIG...
BolanleOladeji/IS-Project
chat2.py
chat2.py
py
2,866
python
en
code
0
github-code
50
70782325915
''' Practice Problem #2 Samuel Hulme Problem: Given a 2D array of numbers, determine the cheapest path from the top left (0,0) node to the bottom right example = [ [6, 8, 1] [100, 2, 30] [1, 4, 2] ] The cheapest path in this case would be the path of 6, 8, 2, 4, 2 = 22 ...
shulme33/Programming
Python/pp_2.py
pp_2.py
py
2,148
python
en
code
0
github-code
50
26636795524
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * class Btn(QPushButton): pass class MyWindow(QWidget): def __init__(self): super(MyWindow, self).__init__() self.setWindowTitle('QDialog的学习') self.resize(500, 500) self.init_gui() def init_gu...
PeterZhangxing/codewars
gui_test/test_pyqt/qss_test/learning_qss.py
learning_qss.py
py
1,856
python
en
code
0
github-code
50
35196294855
# -*- coding: utf-8 -*- """ Created on Thu Mar 31 00:21:52 2016 @edited by K Provost """ #Aligning sequences #Muscle software installed required: http://www.drive5.com/muscle/downloads.htm def align(filename,outpath,cwd,muscle_exe): import os from Bio.Align.Applications import MuscleCommandline...
kaiyaprovost/misc_scripts
muscleAlign.py
muscleAlign.py
py
3,397
python
en
code
0
github-code
50
27622938759
from dataclasses import FrozenInstanceError from scipy import signal # type: ignore import matplotlib.pyplot as plt # type: ignore import pytest import numpy as np import pysmo.tools.noise as noise def test_NoiseModel() -> None: # create two random arrays for testing psd = np.random.rand(20) psd2 = np.r...
pysmo/pysmo
tests/tools/test_noise.py
test_noise.py
py
3,632
python
en
code
18
github-code
50
73179515356
# coding: utf-8 import argparse import time import math import torch import torch.nn as nn from torch.autograd import Variable import numpy as np import data import model import cPickle import glob, os import math import read_graph as rg parser = argparse.ArgumentParser(description='PyTorch Wikitext-2 R...
cliffchen123/language_model
compute_lattice_cover_rate.py
compute_lattice_cover_rate.py
py
2,375
python
en
code
1
github-code
50
42131499524
# Source: https://github.com/krrish94/nerf-pytorch # Torch imports import torch from torch import nn from torch.nn import functional as F class VeryTinyNerfModel(torch.nn.Module): def __init__(self, hidden_size=128, num_encoders=6): super(VeryTinyNerfModel, self).__init__() self.layer1 =...
anshuman64/nerf
src/main_model.py
main_model.py
py
2,028
python
en
code
0
github-code
50
14130660030
n = int(input()) coords = [] for _ in range(n): x1,x2 = map(int, input().split()) coords.append((x1,x2)) total_cnt = 0 for i in range(n): for j in range(i+1, n): for k in range(j+1, n): arr = [0] * 101 is_bool = True for l in range(n): ...
hoonkiyeo/codetree-TILs
231205/선분 3개 지우기/remove-three-segments.py
remove-three-segments.py
py
666
python
en
code
0
github-code
50
34094024275
import math, time, random import numpy as np from vcopt import vcopt node = [ [23,39],[ 8,44],[34,36],[12,30],[42,37],[ 6,35],[ 1,15],[12,25], [ 4,39],[13,42],[23,13],[ 7,39],[11, 5],[ 6,44],[28,45],[20, 7], [ 3,16],[ 4,19],[ 3,39],[ 0, 2],[19,21],[ 3,43],[ 8,34],[20,39], [ 2,50],[20,26],[16,36],[24,30...
UnknownSP/ProgrammingExercise
巡回セールスマン問題/比較/1TSP_Compare.py
1TSP_Compare.py
py
4,181
python
en
code
0
github-code
50
13928767500
APP_INTERFACE = 'tcp://127.0.0.1:5555' DEFAULT_LIBRARY = 'mongodb://127.0.0.1/apps' DEFAULT_COLLECTION = 'apps' ERROR_SUCCESS = 0 ERROR_EXCEPTION = 1 METHOD_REGISTER = 'Register' METHOD_UNREGISTER = 'UnRegister' METHOD_UPDATE = 'Update' METHOD_QUERY = 'Query'
Kimice/rpc-demo
origin/dataservice/common/constants.py
constants.py
py
262
python
en
code
0
github-code
50
29860050280
#domain_stats.py by Mark Baggett #Twitter @MarkBaggett from __future__ import print_function import BaseHTTPServer import threading import SocketServer import urlparse import re import argparse import sys import time import os import datetime try: import whois except Exception as e: print(str(e)) print("Y...
HASecuritySolutions/Logstash
configfiles-setup_required/freq/domain_stats.py
domain_stats.py
py
8,009
python
en
code
248
github-code
50
3641922355
## ##pedir = True ##while pedir: ## numero = int(input("Dame un numero del 1 al 100: ")) ## if numero < 100 and numero > 0: ## pedir = False from random import * print("Piensa un número del 1 al 100,¡voy a intentar advinarlo!") print("Pulsa intro cuando estés listo...") input() aleatorio = randint(1,100)...
emiliobort/python
Practica2_Past/Programas/Ejercicio10.py
Ejercicio10.py
py
896
python
es
code
0
github-code
50
22007133395
import sqlite3 # criar instancia de conexão com o banco connection = sqlite3.connect('records.db') # inicializar cursor cursor = connection.cursor() # IF PARA CRIAR SE NAO TIVER CRIADO create_table = "CREATE TABLE IF NOT EXISTS records (id INTEGER PRIMARY KEY, pontos int)" cursor.execute(create_table) c...
Murimaral/projeto_batalha_naval
criar_tabela.py
criar_tabela.py
py
361
python
en
code
0
github-code
50
27539293247
import json import PySimpleGUI as sg from src.handlers import login def config(dificultad,ayuda,tarjeta,tiempo,color,alerta): """ Guarda la configuracion del usuario en un archivo json""" datos_config = [dificultad,ayuda,tarjeta,tiempo,color,alerta] tiempo = str(tiempo) if (tiempo.isdigit()): ...
LauraCuenca/MempybyGrupo29
src/handlers/configuracion_h.py
configuracion_h.py
py
1,640
python
es
code
0
github-code
50
23363173038
import random import math depth = 5 functions = ["xd", "*", "+", "-"] noFunctions = 3 terminals = ["mizerie", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9"] noTerminals = 9 class Individ(object): """docstring for Individ""" def __init__(self): self.values = [0 for i in range(2 ** depth)] for i in range(l...
ggaaggaabbii/University-work
ai/lab6_2.py
lab6_2.py
py
5,158
python
en
code
0
github-code
50
38534453006
import torch from torch_geometric.nn import knn_graph, knn, CGConv class GNNAttention(torch.nn.Module): '''Uses 2 graph layers. One for self attention and one for cross attention. Self-attention based on k-NN of coordinates. Cross-attention based on k-NN in feature space''' def __init__(self, dim, k): ...
eduardohenriquearnold/fastreg
lib/models/attention.py
attention.py
py
1,537
python
en
code
52
github-code
50
14370519259
import pygame import math import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) WHITE = (255, 255, 255) BLACK = (0, 0, 0) f = open("dialog.txt", "r") rawText = f.read().split("\n") f.close() msg = rawText[0] options = rawText[1:] def finish(s): pygame.quit() f = open("dialog.txt", "w") f....
sillypantscoder/pygame_zip
dialog/dialog.py
dialog.py
py
1,907
python
en
code
0
github-code
50
16558290798
import io import re import time from collections import defaultdict import requests import requests_cache from imicrobe.util import grouper requests_cache.install_cache('kegg_api_cache') def get_kegg_annotations(kegg_ids): all_kegg_annotations = {} all_bad_kegg_ids = set() # the missing_accessions_gro...
hurwitzlab/imicrobe-data-loaders
imicrobe/util/kegg.py
kegg.py
py
4,889
python
en
code
0
github-code
50
70409103517
import os, random import requests from bs4 import BeautifulSoup import NBA as nba class ziz() : def hello(self): print("---- Hello my name Ziz ----") def NBA(self, args): if args[0] == 'games': return self.stringfy(nba.getGames()) def getGames(self): ur...
ahandan/discord_bot
bot/zizBot.py
zizBot.py
py
1,163
python
en
code
0
github-code
50
7764637836
import socket from OpenSSL import SSL import certifi import datetime hostname = 'services.bq.com' port = 443 now = datetime.datetime.now() context = SSL.Context(method=SSL.TLSv1_METHOD) context.load_verify_locations(cafile=certifi.where()) conn = SSL.Connection(context, socket=socket.socket(socket.AF_INET, socket...
dgardella/pys
check_cert.py
check_cert.py
py
1,215
python
en
code
0
github-code
50
4635654089
__author__ = "Younes Bouhadjar, Vincent Marois, Tomasz Kornuta" import torch import numpy as np from miprometheus.problems.seq_to_seq.algorithmic.algorithmic_seq_to_seq_problem import AlgorithmicSeqToSeqProblem class ScratchPadCommandLines(AlgorithmicSeqToSeqProblem): """ Class generating sequences of random...
vincentalbouy/mi-prometheus
miprometheus/problems/seq_to_seq/algorithmic/recall/scratch_pad_cl.py
scratch_pad_cl.py
py
7,377
python
en
code
0
github-code
50
224890675
''' The purpose of the python code is as follows: 1) To load the trained classifier model to classify different hand signs 2) To capture the frames taken from users camera 3) Take the landmarks from the users hand 4) Load the landmark data into the model 5) Get the prediction from the model and print it in th...
RexSan0x/Sign-Language-and-Emotion-Detection
Sign_Language_Training/inferece_sign_lang.py
inferece_sign_lang.py
py
2,902
python
en
code
0
github-code
50
191147204
import sqlite3 # connecting to db con = sqlite3.connect('technical_test.db') cur = con.cursor() # printing each row in the db for row in cur.execute('select * from famous_people;'): print(row) print('') # closing connection to db con.close()
MickyCompanie/technical_test_sneldev
query_db.py
query_db.py
py
252
python
en
code
0
github-code
50
22593983762
#-*- coding: utf-8 -*- from cadproj.models import OrientadorOuMediador, Projeto, Curso, TipoDeProjeto, ModoDeApresentacao, Cidade, Recurso, Calouro, Turma from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class EstudanteOptions(admin.ModelAdmin): list_display = ('nome','matri...
jamur/Mostra-de-Projetos
cadproj/admin.py
admin.py
py
1,960
python
pt
code
1
github-code
50
25257312328
from __future__ import annotations import typing from flupy import flu from nebulo.config import Config from nebulo.gql.alias import FunctionPayloadType, MutationPayloadType, ObjectType, ResolveInfo, ScalarType from nebulo.gql.parse_info import parse_resolve_info from nebulo.gql.relay.node_interface import NodeIdStru...
olirice/nebulo
src/nebulo/gql/resolve/resolvers/asynchronous.py
asynchronous.py
py
5,380
python
en
code
90
github-code
50
26212162918
from langchain.agents import Tool from htmlTemplates import css, bot_template, user_template, disclaimer_text, box_template, user_img, bot_img from typing import List from langchain.agents import Tool from streamlit.components.v1 import html from agentFunctions import simple_report_search, report_summarizer, one_person...
kpister/prompt-linter
data/scraping/repos/HannesDiemerling~MinervasArchive/agentTools.py
agentTools.py
py
1,654
python
en
code
0
github-code
50
43709154819
#recommended way admin_dict = {'1':'scie/065p','2':'scii/890p'} #getting value for a key using [] brackets print(admin_dict['1']) #not recommended if key is an integer dict_func = dict(one='1',two='2') #change value admin_dict['1'] = 'steve/07' print(admin_dict['1']) #adding key value dictionary from one dict to ano...
steve-ryan/python-tutorial-for-beginners
dictionary.py
dictionary.py
py
424
python
en
code
0
github-code
50
17060406313
import json import openpyxl from case_study.models import Question from core.decorators import staff_required from django.db import IntegrityError from django.http import JsonResponse from django.shortcuts import render from .common import populate_data, delete_model, patch_model from ..forms import QuestionImportFor...
320011/case
core/case_admin/views/question.py
question.py
py
8,610
python
en
code
1
github-code
50
41390824167
import os import json import sqlite3 import requests db_stored = os.path.join(os.path.dirname(__file__), 'qaset.db') # r'D:\Archive\Voibot\qabot\data\qabot\data\qaset.db' url = 'http://10.1.163.22:5000/encode' headers = {'Content-Type': 'application/json'} def generate_all_features(db_stored, begin_id, end_id): ...
yaohsinyu/voibot
qabot/data/generate_all_feature.py
generate_all_feature.py
py
1,382
python
en
code
0
github-code
50
4149350510
"""empty message Revision ID: 96089780dc64 Revises: 45811f048651 Create Date: 2022-07-14 08:54:14.167701 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '96089780dc64' down_revision = '45811f048651' branch_labels = None depends_on = None def upgrade(): # #...
pamelafox/translation-telephone
migrations/versions/96089780dc64_.py
96089780dc64_.py
py
924
python
en
code
16
github-code
50
23275279979
from rest_framework import mixins, status from rest_framework.viewsets import GenericViewSet from rest_framework.response import Response from api.models import UploadImage, UploadRequest from api.serializers import UploadSerializer from api.serializers.image_serializer import ImageSerializer class UploadViewSet(mixi...
ongtzewei/django-image-manipulation-webapp
api/views/upload.py
upload.py
py
2,050
python
en
code
0
github-code
50
17604501818
import numpy as np from scipy import misc import matplotlib.pyplot as plt def conv_single_step(a_slice_prev, W, b): """ Apply one filter defined by parameters W on a single slice (a_slice_prev) of the output activation of the previous layer. Arguments: a_slice_prev -- slice of input data of shape...
sheldon-wall/DLSpecCourse4
Week1.py
Week1.py
py
5,168
python
en
code
0
github-code
50
33948199381
import http.server import socketserver from .tools import HTTPTools class Handler(http.server.SimpleHTTPRequestHandler): """ Subclass of pex.proto.http module. This subclass of pex.proto.http module represents HTTP handler for web server. """ def log_request(self, fmt, *args) -> None: p...
EntySec/Pex
pex/proto/http/listener.py
listener.py
py
2,334
python
en
code
25
github-code
50
73961830874
from urllib.parse import urlencode import requests from dj_rest_auth.app_settings import api_settings from dj_rest_auth.jwt_auth import set_jwt_cookies from dj_rest_auth.models import get_token_model from dj_rest_auth.utils import jwt_encode from dj_rest_auth.views import LoginView from django.conf import settings fro...
edu4ml/WSB-ML-PLATFORM-FORKED
api/apis/v1/auth/auth.py
auth.py
py
3,513
python
en
code
0
github-code
50
29905578649
# coding:utf-8 from unityagents import UnityEnvironment import numpy as np from network.DQN import DQNAgent import matplotlib.pyplot as plt import tensorflow as tf import time env = UnityEnvironment(file_name="../environment/Banana_Windows_x86_64/Banana.exe") path = "../result/banana/" # get the default brain brain_na...
lebesgue125/reinforce_learning
banana/dqn_agent.py
dqn_agent.py
py
3,144
python
en
code
0
github-code
50
74910611675
import numpy as np import cv2 import pyrealsense2 as rs import math """INTIALIZING REALSENSE DATA""" # Initialize RealSense pipeline pipeline = rs.pipeline() config = rs.config() config.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 30) config.enable_stream(rs.stream.color, 848, 480, rs.format.bgr8, 30) pipel...
vpark915/The-GingerLens
LocalPythonIdeas/FundamentalScripts/ORBDepthPrimitive.py
ORBDepthPrimitive.py
py
5,665
python
en
code
1
github-code
50
2609538019
import matplotlib.pyplot as plt import scipy.optimize as optimize import scipy.sparse as sparse import scipy.sparse.linalg from math import ceil import numpy as np import sys def solve_one_time_step(u_0, mu_vec, temp_a=0, temp_b=0): print("h") def create_main_matrix(n_x_points, mu_vec): """ Ma...
liorarueff/MathematicalIce
main.py
main.py
py
7,928
python
en
code
0
github-code
50
42680391223
import unittest from unittest.mock import patch from lotto.cities import Cities class TestCities(unittest.TestCase): def test_get_city_wrong_input(self): self.assertNotIn('vxvx', Cities.total_cities) self.assertNotIn(1, Cities.total_cities) with patch('builtins.input', retu...
erydegio/lotto-game
test/test_cities.py
test_cities.py
py
693
python
en
code
0
github-code
50
35062260193
# This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but ...
aaps/MCmotions
minecraftimport.py
minecraftimport.py
py
12,057
python
en
code
8
github-code
50
1391672757
# N = input('enter N: ') # M = input('enter M: ') import timeit def draw_board(): global board for line in transpose(board): print(*line) def transpose(matr): res=[] n=len(matr) m=len(matr[0]) for j in range(m): tmp=[] for i in range(n): tmp=tmp+[matr[i][j]]...
matbitilya/rocks
2.py
2.py
py
2,328
python
en
code
0
github-code
50
27653685459
import collections import os import sys import openpyxl import database from truckmate_email import TruckmateEmail REPORT_EMAILS = [ 'jwaltzjr@krclogistics.com' ] class Rate(object): def __init__(self, tariff, customers, origin, destination, break_value, is_min, rate): self.tariff = tariff ...
jwaltzjr/truckmate
truckmate/ratereport.py
ratereport.py
py
5,480
python
en
code
2
github-code
50
86734481945
import pygame class Ui: def __init__(self, screen, player) -> None: self.screen = screen self.player = player self.font = pygame.font.SysFont('Arial', 18) self.big_font = pygame.font.SysFont('Arial', 32) def render(self, score): score_text = self.big_font.render(str(s...
JustThomi/SpaceShooter
ui.py
ui.py
py
692
python
en
code
0
github-code
50
71994975835
c50=0 c20 = 0 c10 = 0 c1 = 0 print('Banco dos Crias') saque = int(input('Valor a ser sacado:')) while saque !=0: if saque - 50 >= 0: c50 += 1 saque = saque -50 else: break while saque !=0: if saque - 20 >= 0: c20 += 1 saque = saque -20 else: ...
ArthPx/learning-code
d 71.py
d 71.py
py
769
python
en
code
0
github-code
50
70896170076
import os import subprocess import tempfile from typing import Dict import requests from . import errors from snapcraft.file_utils import calculate_hash, get_tool_path from snapcraft.internal.cache import FileCache from snapcraft.internal.indicators import download_requests_stream class _Image: def __init__( ...
Tymbur/Archive_Encrypted.zip
snapcraft/data/usr/lib/python3/dist-packages/snapcraft/internal/build_providers/_images.py
_images.py
py
5,347
python
en
code
0
github-code
50
31526327859
#"D:\UCLA+USC\OPT\fetch\fetch_run.py" import json import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import ScalarFormatter import torch import torch.nn as nn import torch.nn.functional as F import streamlit as st import os from collections import defaultdict impor...
tree2601/Fetch_LSTM_model
fetch_run.py
fetch_run.py
py
4,500
python
en
code
0
github-code
50
26211678718
import os import json import subprocess from transformers import AutoTokenizer, AutoModelForCausalLM from openai import OpenAI import requests import torch import tiktoken import argparse commit_schema = { "name": "git_commit", "description": 'Performs a git commit by calling `git commit -m "commit_message"`'...
kpister/prompt-linter
data/scraping/repos/Globe-Engineer~semantic-commit/scommit~scommit.py
scommit~scommit.py
py
5,025
python
en
code
0
github-code
50
25249831556
import cv2 import pandas as pd import time # Can take a video file as input or video stream from the webcam cap = cv2.VideoCapture("C:/Users/harsh/Downloads/video (1080p).mp4") #cap = cv2.VideoCapture(0) index = ["color", "color_name", "hex", "R", "G", "B"] csv = pd.read_csv("C:/Users/harsh/Downloads/colors.csv", nam...
Harshil-Agrawal/RealTime_Color_Detection
Color_detection.py
Color_detection.py
py
2,995
python
en
code
0
github-code
50
40559915413
import random # def rotto(): # num = [0, 0, 0, 0, 0, 0] # for i in range(0, 6): # num[i] = random.randint(1, 46) # for j in num: # if j == num[i]: # i -= 1 # return num # print(rotto()) lotto_number = [] def getRandomNumber(): number = ra...
Getver/StartCoding
00_BasicLecture/09_로또번호.py
09_로또번호.py
py
700
python
en
code
0
github-code
50
21652314287
import sklearn from sklearn.linear_model import Perceptron import pandas as pd import numpy as np from sklearn.datasets import load_iris import matplotlib.pyplot as plt iris=load_iris() df=pd.DataFrame(iris.data,columns=iris.feature_names) df['label']=iris.target df.columns = [ 'sepal length', 'sepal ...
yishishizi/machinelearning
sk.py
sk.py
py
1,453
python
en
code
0
github-code
50
3132557366
import torch from torch import nn, reshape from torch import device as torch_device class Simple(nn.Module): """ Simple model use mlp to do denoise """ def __init__(self, samples, chunk_size, channels, device): super().__init__() self.chunk_size = chunk_size self.channels = channels self.linear = nn.Line...
zhouxinyu0723/audio-denoise-addon-v2
ZENNet/model/simple.py
simple.py
py
1,156
python
en
code
1
github-code
50
7408358101
#import tool import sys inputfile_1=sys.argv[1] inputfile_2=sys.argv[2] #create dictionary def list2dict(s): d={} for i in s: if i in d.keys(): d[i]=d[i]+1 else: d[i]=1 return d #define a function to match key and value between 2 files def cmplist (s1,s2): d1=list...
Becky2012/Large-file-discrepancy-checks
check.py
check.py
py
1,755
python
en
code
0
github-code
50
16325613872
#!/usr/bin/env python # coding: utf-8 # ECON 280A # # PS 1 # # By Yi-Fan, Lin # In[1]: import pandas as pd import numpy as np from scipy.optimize import fsolve from sympy import symbols, Eq, solve, nsolve import matplotlib.pyplot as plt # In[2]: df = pd.read_excel("/Users/ricky/Documents/椰林大學/Berkeley/Interna...
Yifan3018/Armington-model-in-international-trade
PS1.py
PS1.py
py
5,541
python
en
code
1
github-code
50
15892916608
from collections import defaultdict def solution(dirs): d = defaultdict(list) cur_x = 0 cur_y = 0 x = [0, 0, 1, -1] y = [1, -1, 0, 0] cnt = 0 for e in dirs: to_x = cur_x to_y = cur_y if e == 'U': to_x += x[0] to_y += y[0] elif e =...
hyunsoolee991/cs
algorithm/programmers/방문 길이.py
방문 길이.py
py
1,866
python
ko
code
0
github-code
50
71346745115
from os import path from mediakit.utils.files import increment_filename_if_exists from mediakit.utils.commands import run_command_in_background from mediakit.constants import FFMPEG_BINARY VIDEO_FORMATS = {"mp4"} class ConversionOptions: NO_AUDIO = "-an" def merge_video_and_audio( video_path, audio_path,...
diego-aquino/mediakit
mediakit/media/convert.py
convert.py
py
1,080
python
en
code
11
github-code
50
36424255650
#http://scikit-learn.org/stable/auto_examples/model_selection/plot_grid_search_digits.html#sphx-glr-auto-examples-model-selection-plot-grid-search-digits-py from __future__ import print_function from sklearn.model_selection import GridSearchCV from sklearn.metrics import classification_report from sklearn.svm import S...
boyko11/ML1-SupervisedLearning
grid_search.py
grid_search.py
py
3,243
python
en
code
0
github-code
50
36046350963
import os class CustomValidator: @staticmethod def path_validate(path: str) -> str: """ try: path = validate_path(" my /path /with spaces ") print(f"The path {path} is valid.") except FileNotFoundError as e: print(e) :param path: :re...
jerome-neo/Command-line-Data-Processor
validator/custom_validator.py
custom_validator.py
py
579
python
en
code
0
github-code
50
3912202681
from rk_diagram.models import RKPipeline, LocalizationAlgorithm, TransformNode from rk_diagram.visualize import RKModelVisualizer from rk_diagram.models.graph import EdgeType, Edge import numpy as np class HierarchicalFeatureExtractor1(): ''' Generates a heirarchical feature extractor TODO: Think about 2+...
andorsk/rk_toolkit
example/example.py
example.py
py
4,225
python
en
code
2
github-code
50
637859362
from selenium import webdriver from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.service import Service from selenium.webdriver.support.wait import WebDriverWait from crud ...
CaioFreitas96/scraping
scraping.py
scraping.py
py
4,411
python
pt
code
0
github-code
50
29053233199
x=10 y=2 print(x//y) x=10 y=3 print(x//y) x=10 y=8.5 print(x//y) # algorithm # 10,1,8,3,6,5,4,7,x,y # Find the general solution of x and y # x-> 2 y->9 # Step1: Start # Step2: Initialise a variable named n # Step3:x=n+1 # Step4:a=x+2 # Step5:b=x-2 # Step6: if x%2=0, then x+a # Step7: if x%2!=0,...
RiyaBaid/Python
floordivision.py
floordivision.py
py
346
python
en
code
0
github-code
50
35880060544
# O nome e a posição das colunas dos dados históricos e das estações são diferentes! # Esse dicionário vai nos auxiliar para pegar um determinado dado nas duas tabelas. # lista[0] -> Colunas como estão nos dados históricos. # lista[1] -> Colunas como estão nos dados das estações (website). d_dic = { "Data": ['DATA ...
NeoFahrenheit/inmet-scraper
id.py
id.py
py
2,115
python
pt
code
0
github-code
50
39518772432
from random import random import requests from flask import Flask, request from conf import ( get_healthy_server, healthcheck, load_configuration, process_firewall_rules_flag, process_rules, process_rewrite_rules, transform_backends_from_config, ) loadbalancer = Flask(__name__) MAIL_BACK...
leader8901/testServer
balancer.py
balancer.py
py
1,317
python
en
code
0
github-code
50
1282240873
import os import numpy as np import random from gym.envs.mujoco.pusher import PusherEnv from evaluation.eval import Eval from data import utils XML_FOLDER = "/media/stephen/c6c2821e-ed17-493a-b35b-4b66f0b21ee7/MIL/gym/gym/envs/mujoco/assets" class EvalMilPush(Eval): def _load_env(self, xml): xml = xml[x...
stepjam/TecNets
evaluation/eval_mil_push.py
eval_mil_push.py
py
2,852
python
en
code
40
github-code
50
17566333407
n=int(input()) k=n l=(n*(n+1))//2 num=0 if(l)%2==0: l=l//2 ls=[i for i in range(1,n+1)] ls1=[] while(num!=l): if(l-num)<n: ls1.append(l-num) break else: num+=n n-=1 ls1.append(n+1) print("YES") print(len(ls1)) print(*ls1) print(k-len(ls1)) s2=set(ls)-set(ls1) ls2=list(s...
SaranSaiChava/Problem_Solving
CSES/twosets.py
twosets.py
py
382
python
en
code
0
github-code
50
13917300027
import pickle import os import sys import ast from header import Driver import struct import subprocess import re from pprint import pprint import pandas as pd from collections import defaultdict # set working directory WD = os.path.dirname(os.path.abspath(__file__)) os.chdir(WD) d_p = "../../AutoRNP/experiments/testi...
Sherryhh/fpdiff_extend
fp-diff-testing/workspace/driverGenerator.py
driverGenerator.py
py
8,600
python
en
code
1
github-code
50
10070441282
import datetime import os import sys from importlib import reload from antlr4 import * from CnfUtility import CnfUtility from CnfVcGenerator import CnfVcGenerator from MyCFG import MyCFG from MyHelper import MyHelper from MyUtility import MyUtility from MyVisitor import MyVisitor from PreProcessor import PreProcessor...
NabeelQaiser/BTP_2k18-19
simulator_cnf.py
simulator_cnf.py
py
17,501
python
en
code
1
github-code
50
18659979731
from configparser import ConfigParser from datetime import timedelta, datetime from discord_webhook import DiscordWebhook import os, random, requests, re from typing import TypedDict, Union class UserNameResponseDict(TypedDict): personaname:str name:str def get_username(steam_id:int) -> Union[UserNameResponse...
lekjos/vhserver-walmart-greeter
discord_post.py
discord_post.py
py
7,031
python
en
code
1
github-code
50
28076502272
# -*- coding: utf-8 -*- """ @Author 坦克手贝塔 @Date 2023/2/8 0:25 """ from typing import List """ 你是一位系统管理员,手里有一份文件夹列表 folder,你的任务是要删除该列表中的所有 子文件夹,并以 任意顺序 返回剩下的文件夹。 如果文件夹 folder[i] 位于另一个文件夹 folder[j] 下,那么 folder[i] 就是 folder[j] 的 子文件夹 。 文件夹的“路径”是由一个或多个按以下格式串联形成的字符串:'/' 后跟一个或者多个小写英文字母。 例如,"/leetcode" 和 "/leetcode/...
TankManBeta/LeetCode-Python
problem1233_medium.py
problem1233_medium.py
py
1,569
python
zh
code
0
github-code
50
705515631
import math import os import time from copy import deepcopy import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torchvision.models as models def init_seeds(seed=0): torch.manual_seed(seed) # Speed-reproducibility tradeoff https://pytorch.org/docs/st...
WongKinYiu/ScaledYOLOv4
utils/torch_utils.py
torch_utils.py
py
8,846
python
en
code
2,013
github-code
50
72328303514
import io # アクセスするときに使う import requests import zipfile # 普通に書いた場合 # with open('/tmp/a.txt','w') as f: # f.write('test test') # # with open('/tmp/a.txt','r') as f: # print(f.read()) # f =io.StringIO() f.write('string io test') # 最初に戻る f.seek(0) print(f.read()) # 使用例 # zipfileをダウンロードをメモリ上で処理するときとかに使用する u...
magisystem0408/python_cord_dir
library/io.py
io.py
py
609
python
ja
code
0
github-code
50
70988579675
import torch import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt from Mesh import * from Utils import * import math def F(Pi, Pj, k, r): return k * (torch.linalg.norm(Pi - Pj) - r) * (Pj - Pi) / torch.linalg.norm(Pi - Pj) def force_magnitude_sum(mesh): l = 0 for vIndex, this ...
COMP0031VRProject/Framework
spring_mesh_example.py
spring_mesh_example.py
py
1,950
python
en
code
0
github-code
50