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
9339680077
# -*- coding: utf-8 -*- from odoo import fields, models, api, _ from odoo.exceptions import UserError try: from pysimplesoap.client import SoapFault except ImportError: SoapFault = None import logging _logger = logging.getLogger(__name__) class ResPartner(models.Model): _inherit = "res.partner" #arba...
codize-app/odoo-argentina
l10n_ar_withholding/models/res_partner.py
res_partner.py
py
16,227
python
es
code
10
github-code
1
25378245657
import pyramid.httpexceptions as exc from pyramid.response import Response from werkzeug.test import Client from werkzeug.wrappers import BaseResponse from opentelemetry.configuration import Configuration class InstrumentationTest: def setUp(self): # pylint: disable=invalid-name super().setUp() # pylin...
NathanielRN/clone-opentelemetry-python
instrumentation/opentelemetry-instrumentation-pyramid/tests/pyramid_base_test.py
pyramid_base_test.py
py
1,563
python
en
code
0
github-code
1
15763631512
import pygame as pg import random as rnd class Couleurs: BLACK = (0,0,0) RED = (255,0,0) BLUE = (0, 0, 200) class Jeu: def __init__(self): """ Ici, on initialise des variables utiles """ self.TAILLE_ECRAN = 500 # pixels self.FPS = 15 self.COULEUR_ARRIERE_PLAN = Couleurs.BLUE self.LE_JEU_TOURNE = Tr...
Mistergix/deficode
dist/assets/code/seance5/pygame_template.py
pygame_template.py
py
1,699
python
fr
code
0
github-code
1
30654538164
d = dict(name='fentiao', age=10) # 默认遍历字典只遍历key值; for item in d: print(item) # [('name', 'fentiao'), ('age', 10)] print(d.items()) for x in d.items(): print(x) # 遍历字典的key-value for key, value in d.items(): print(key, '-->', value) # 元组多元赋值 key, value = ('name', 'fentiao') print(key, value) # 列表可以多元赋值 ...
lvah/201903python
day04/code/05_遍历字典理解.py
05_遍历字典理解.py
py
588
python
en
code
5
github-code
1
25971869559
from django.urls import path from . import views urlpatterns = [ path('',views.mainpage), path('signup',views.signup), path('login',views.login), path('register',views.register.as_view()), path('loginuser',views.loginuser.as_view()), path('friends',views.handlerfiends), path('transactions',...
hks74123/moneytracker
mainapp/urls.py
urls.py
py
904
python
en
code
0
github-code
1
35635175211
import numpy as np import matplotlib.pyplot as plt pi =np.pi fs = 10000 ts = 1/fs t = np.arange(0, 1-ts, step=ts) # signal parameters A = 5 # amplitude f0 = 10.834095034955 # frequency phi = -pi/8 # phase signal = A*np.cos(2*pi*f0*t + phi)+0.5*np.cos(2*pi*200.234*t + phi)+np.random.rand(len(t)) # DTFT evaluated...
HOLL95/General_electrochemistry
EIS/freq_tests.py
freq_tests.py
py
563
python
en
code
2
github-code
1
17980678311
from bintreeFile2 import Bintree print("\n") swedish = Bintree() with open("word3.txt", "r", encoding = "utf-8") as swedish: for row in swedish: word = row.strip() # Ett trebokstavsord per row if word in swedish: print(word, end = " ") else: swedish.p...
Fluntin/Applied-Computer-Science
Laboratorium_3/words.py
words.py
py
700
python
en
code
1
github-code
1
38010181762
key = 'abcdefghijklmnopqrstuvwxyz.' # 평문을 받아서 암호화하고 암호문을 반환한다. def encrypt(combien, plaintext): result = '' for l in plaintext.lower(): try: i = (key.index(l) + combien) % 26 result += key[i] except ValueError: result += l return result.lower() comb...
sjw9307/pythonProject
t21.py
t21.py
py
455
python
en
code
0
github-code
1
19075008145
from odoo.http import request from odoo.addons.partner_profiles_portal.controllers.portal_my_account import CustomerPortal class CustomerPortal(CustomerPortal): def _get_optional_main_fields(self): fields = super(CustomerPortal, self)._get_optional_main_fields() fields.extend( [ ...
Lokavaluto/lokavaluto-addons
lcc_members/controllers/portal_my_account.py
portal_my_account.py
py
1,942
python
en
code
5
github-code
1
14277710480
import numpy from obspy.core import read,Trace,Stream,UTCDateTime import Queue from threading import Thread import os.path import subprocess import time from scipy import signal from scipy.interpolate import interp1d import Adafruit_ADS1x15 sps = 250 #samples per second adc = Adafruit_ADS1x15.ADS1115() #create...
SpinaCianetti/RASP_ADC
leggi_dati_coda.py
leggi_dati_coda.py
py
5,153
python
en
code
0
github-code
1
13452235470
#!/usr/bin/env python3 import math import os,sys,subprocess, multiprocessing, re, getopt import shutil import struct import hashlib import glob ASSETS_DIR = "../deploy/assets" APPS_DIR = "../deploy/apps" TUTS_DIR = "../deploy/tutorials" NO_CONV_NAME = ".b4w_no_conv" WHITE = "\033[97m" YELLOW = "\033[93m" RED = ...
PauloBarbeiro/Blend4Web
scripts/converter.py
converter.py
py
12,743
python
en
code
null
github-code
1
13931459143
# -*- coding: utf-8 -*- from plone import api from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE from plone.app.testing import applyProfile from plone.app.testing import FunctionalTesting from plone.app.testing import Inte...
mbarde/unikold.timeslots
src/unikold/timeslots/testing.py
testing.py
py
1,763
python
en
code
0
github-code
1
41120383892
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.runner import force_fp32, BaseModule, auto_fp16 from mmcv.ops.roi_align import roi_align from mmdet.core import (bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh, build_assigner, build_sampler, multi_apply, ...
paperwave/AiT
ait/code/model/detection/insseg_head.py
insseg_head.py
py
31,161
python
en
code
null
github-code
1
41343293343
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * yRot = 0.0 xRot = 0.0 zoom = 1 def mudar_tamanho_tela(width, height): if (height == 0): height = 1 glViewport(0, 0, width, height) fAspect = width/height glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPer...
juliallorente/computacao-grafica
exercicios/robo.py
robo.py
py
6,199
python
en
code
0
github-code
1
40255581254
#!/usr/bin/env python import rospy from flexbe_core import EventState, Logger from bosdyn.client.util import * from bosdyn.client.lease import LeaseClient, LeaseKeepAlive from bosdyn.client.frame_helpers import get_odom_tform_body from bosdyn.api.graph_nav import nav_pb2, graph_nav_pb2 from bosdyn.client.robot_state ...
yashpatel1392/spot_nav_behaviors
spot_nav_flexbe_states/src/spot_nav_flexbe_states/swap_lease.py
swap_lease.py
py
4,565
python
en
code
0
github-code
1
21232514403
import sys from PySide6.QtWidgets import QApplication, QPushButton, QGridLayout, QWidget, QBoxLayout, QMainWindow app = QApplication(sys.argv) window = QMainWindow() central_widget = QWidget() window.setCentralWidget(central_widget) window.setWindowTitle('Minha janela bonita') button_1 = QPushButton('Button 1') butto...
RossettiBR/curso-python-atualizado
pyside6/04_qmaiwindow_centralwidget.py
04_qmaiwindow_centralwidget.py
py
1,155
python
en
code
0
github-code
1
74768151392
import pygame import random import math from constants import * class Paddle: """ Base class for a paddle """ def __init__(self, x_pos, width, height, speed, color): self.rect = pygame.Rect((x_pos, (SCREEN_HEIGHT - height) / 2), (width, height)) self.color = color self.speed = speed ...
delhoyo31415/Pygame-Ping-Pong
entities.py
entities.py
py
4,472
python
en
code
0
github-code
1
17635193634
from ..scrabTask import ReportTask from utils import containedStructure from datetime import datetime, timezone from math import log2, pow from dateutil import parser name = "ImpactCalculator" version = "1.1.1" class ImpactData(): """ Helper class that stores all information about a single project that is ...
Eyenseo/gitScrabber
gitScrabber/scrabTasks/report/impactCalculator.py
impactCalculator.py
py
8,015
python
en
code
0
github-code
1
29653309229
def excel_upload(request): if request.method == "POST": print('hi') path = request.FILES['excel_file'] data = pd.read_excel( path, dtype=str, # usecols="A:F" # skiprows=[0, 1, 2, 3], # index_col=3, ) data = data[data...
kishik/ADCM-Scheduler
myapp/graph_creation/excel_upload.py
excel_upload.py
py
2,542
python
en
code
1
github-code
1
40995594795
#!/usr/bin/env python3 # Index in coordinate tuples. X = 0 Y = 1 def is_touching(p1: tuple[int, int], p2: tuple[int, int]) -> bool: return abs(p1[X] - p2[X]) <= 1 and abs(p1[Y] - p2[Y]) <= 1 def follow(head: tuple[int, int], tail: tuple[int, int]) -> tuple[int, int]: if not is_touching(head, tail): ...
dubgeiser/aoc2022
09/2.py
2.py
py
1,656
python
en
code
0
github-code
1
15533405257
# -*- coding: utf-8 -*- """ Created on Thu Nov 10 15:59:25 2016 https://www.youtube.com/watch?v=wzrGwor2veQ&list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M&index=55 Socket intro @author: Ben """ import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('Socket information: ' +str(s)) server = 'pythonprogram...
slowmoh/urban_samples
python/server_client/servsocket.py
servsocket.py
py
718
python
en
code
0
github-code
1
71015606755
# Title: 비트가 넘쳐흘러 # Link: https://www.acmicpc.net/problem/17419 import sys sys.setrecursionlimit(10 ** 6) read_single_int = lambda: int(sys.stdin.readline().strip()) read_single_str = lambda: sys.stdin.readline().strip() def solution(n: int, num: str): return num.count('1') def main(): ...
yskang/AlgorithmPractice
baekjoon/python/overflow_bit_17419.py
overflow_bit_17419.py
py
459
python
en
code
1
github-code
1
27671357580
#!usr/bin/env python3 def transc_table(ipatable): transkey = {} with open(ipatable, 'r', encoding='utf-8') as f: for line in f: ortho = line.strip().split('\t')[0] ipa = line.strip().split('\t')[1] transkey[ortho]=ipa return transkey def transcribe_wds(ipatable...
gouskova/transcribers
quechua/quechua_transcriber.py
quechua_transcriber.py
py
1,797
python
en
code
3
github-code
1
27089682837
H, W = map(int, input().split()) graph = [] for i in range(H): s = input() graph.append(s) def dfs(now, increment, count): now = (now[0] + increment[0], now[1] + increment[1]) x, y = now if (not 0 <= x < W) or (not 0 <= y < H): return count - 1 if graph[y][x] == "#": return ...
Intel-out-side/AtCoder
DiffUme/Lamp.py
Lamp.py
py
706
python
en
code
0
github-code
1
71442561313
from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController app = Ursina() grass_texture = load_texture('assets/grass_block.png') stone_texture = load_texture('assets/stone_block.png') brick_texture = load_texture('assests/brick_block.png') dirt_texture = load_texture('assets/...
Heroic234/my_mini_minecraft
Mini_craft_code.py
Mini_craft_code.py
py
3,203
python
en
code
0
github-code
1
39483432719
import json from datetime import datetime, timedelta from app import app, db, models from flask import render_template, jsonify, request @app.route('/') @app.route('/index') def index(): username = request.args.get('username') if username is None: return 'user name must be specified as ?username=xxx' retur...
laofeizhu/reward_chart
app/routes.py
routes.py
py
1,765
python
en
code
0
github-code
1
26743614243
import math initial_orientation = 90 # with respect to x as start_posx = 2 start_posy = 2 end_posx = 4 end_posy = 4 max_forward_radius = 1.5 max_backwards_radius = 1 x_center = start_posx + max_forward_radius*math.cos(math.radians(initial_orientation-90)) y_center = start_posy + max_forward_radius*math.sin(math.radia...
dlacle/EPO-4
epo4/module5/methode2/old/Path_finder.py
Path_finder.py
py
506
python
en
code
3
github-code
1
24010628131
import os from flask import Flask, flash, request, redirect, url_for from werkzeug.utils import secure_filename import model.apply_model as am UPLOAD_FOLDER = '/Users/Fabian/Projects/HackBay2019/hail_model/request_data' ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) app = Flask(__name__) app.c...
Diadochokinetic/HackBay2019
hail_model/test_request.py
test_request.py
py
2,544
python
en
code
0
github-code
1
74659052512
import argparse import re from datetime import datetime from cli.models.models import CliData, PHONE, LOGIN, PASSWORD, SIP_DEVICE, \ SIP_ENABLED, IDENTIFY_LINE from cli.utils.help_message import * CHOICE_FILTER = ['all', 'activate', 'deactivate'] CHOICE_ACTION = ['a', 'd'] CHOICE_VIEW = [PHONE, LOGIN, PASSWORD, S...
Kotletta-TT/cbot-cm-trunk-producer-mts
cli/utils/arg_parse.py
arg_parse.py
py
2,873
python
en
code
0
github-code
1
22586754727
import commentjson as json import os class Config: def __init__(self, dictfile): self.dictfile = dictfile if not os.path.exists(self.dictfile): with open(self.dictfile, 'w', encoding='utf-8') as file: json.dump({ "users": { ...
timoxa0/Reshala
server/configctl.py
configctl.py
py
815
python
en
code
0
github-code
1
5948752164
from django.db import models from comments.models import Comment from authentication.models import User # Create your models here. class Reply(models.Model): created = models.DateTimeField(auto_now_add=True) user = models.ForeignKey( User, related_name='replies', on_delete=models.CASCADE) comment ...
LadyHazle2010/ReactDjangoYoutube
backend/replies/models.py
models.py
py
564
python
en
code
0
github-code
1
38326493487
import torch import pandas as pd import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader import glob from pathlib import Path import os class TickerDataset(Dataset): def __init__(self, root_dir, series_length, lookback, min_sequence_length, template='*.csv', transform=...
pwmorrison/trading
mlbootcamp/vae/dataset.py
dataset.py
py
6,419
python
en
code
1
github-code
1
9681950479
from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' show_timesheet_name = fields.Boolean( 'Show timesheet names', default=False, config_parameter='enhance_maintenance.show_timesheet_name', ) show_expense_name = ...
LibrERP/custom-addons
enhance_maintenance/models/res_config_settings.py
res_config_settings.py
py
617
python
en
code
2
github-code
1
70975829473
import torch def cosine_metric(novels, bases): """ Args: novel (tensor): [dim] -> [batch_size,dim] bases (tensro): [batch_size,dim] Returns: """ # batch_size = bases.shape[0] # novels = novel.unsqueeze(0).expand(batch_size, -1) n = novels.shape[0] # [25...
ChunpingQiu/SSL-Features-for-RS-Scene-Classification-Few-Samples
util/similarity.py
similarity.py
py
1,971
python
en
code
0
github-code
1
28141626166
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np from tensorflow.python.keras.datasets import mnist if __name__ == '__main__': # prepara input images (x_train, y_train), (x_test, y_test) = mnist.load_data() x_test = x_test.reshape(x_test.shape[0], x_test.shape[1], x_test.shape[2], 1) x_t...
iwatake2222/CNN_NumberDetector
04_TensorflowLite_Python/mnist_test.py
mnist_test.py
py
1,149
python
en
code
6
github-code
1
15509216773
import petsc4py import sys import numpy as np import matplotlib.pyplot as plt petsc4py.init(sys.argv) from petsc4py import PETSc DX = 0.02 DT = 0.01 T0 = 1.0 N_POINTS = int(1/DX)+1 N_TIME_STEPS = int(T0/DT)+1 AA = 1.0 ALPHA = 0.01 CC = AA*DT/DX SS = ALPHA*DT/DX**2 def exact_solution(x, t: float): c1 = 0.025/n...
swayli94/notes
docs/source/05-examples/01-pdes/codes/example_02.py
example_02.py
py
3,705
python
en
code
0
github-code
1
40380701053
import random suits=["Hearts","Diamonds","Spades","Clubs"] ranks=["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"] values={"Ace":11,"Two":2,"Three":3,"Four":4,"Five":5,"Six":6,"Seven":7,"Eight":8,"Nine":9,"Ten":10,"Jack":10,"Queen":10,"King":10} class Card: def __init__(se...
rajdeep-biswas/random-code-1
kids/BlackJack.py
BlackJack.py
py
5,605
python
en
code
0
github-code
1
27051971804
from dtat.api.guild import guildprint from dtat.services.list import guildWithId from dtat.services.update import guildObj from flask import jsonify from dtat.models import Player from dtat.services.remove import removeGuild from dtat.exceptions import DTATException @guildprint.route('/id/<int:id>/data', met...
deeptownadmintools/main-server
dtat/api/guild/data.py
data.py
py
1,139
python
en
code
3
github-code
1
34778006710
#cree un programa que simule el juego del ahorcado #debe seleccionar una palabra aleatoria de una lista de palabras #muestre una pista de la palabra aleatoria ( "MOUSE" ) pisa ( M_ _ _ E) #El usuario debe ingresas una palabra y si es igual a la palabra aleatoria #entonces el programa mostrara True , caso contrario Fals...
UsernowII/Exercises-_-Games
juego_ahorcado.py
juego_ahorcado.py
py
1,218
python
es
code
1
github-code
1
22689668574
#-*-coding:utf-8-*- __author__ = 'shenshen' from stack import Stack def main(): groups = [] m = int(raw_input()) for i in range(m): n = int(raw_input()) group = [] for j in range(n): group.append(raw_input()) groups.append(group) #print(groups) for g in...
dslwz2008/pythoncodes
dsalgo001/ex0202.py
ex0202.py
py
801
python
en
code
3
github-code
1
72506183395
import asyncio import os from .utils import * from .exceptions import * # -------------------------------------------------------------------- class Shell: limiter = asyncio.BoundedSemaphore(CPU_CORES) def __init__(self, config=None): self.log = get_logger("bakery.shell.Shell") self.env = {} ...
lainproliant/bakery
bakery/shell.py
shell.py
py
2,831
python
en
code
0
github-code
1
31511946076
from url_handling.queue import Queue from configuration import CONFIG class Scheduler: def __init__(self, worker_type): self.thread_count = int(CONFIG.get("WORKER", "threads")) self.worker_type = worker_type self.workers = list() self.subqueues = list() def star...
megaprokoli/webcrawler
url_handling/scheduler.py
scheduler.py
py
1,129
python
en
code
0
github-code
1
21016222260
import matplotlib.pyplot as pl import numpy as np import pickle from random import randint import pandas as pd """ x = np.linspace(0,10,20) # 20 points entre 0 et 10 y1 = x*x + 2*x # la fonction a tracer y2 = np.sqrt(x) # la fonction a tracer pl.figure() # creation d'une figur...
Eastkap/uni
L2/2i013/graphe.py
graphe.py
py
6,014
python
en
code
0
github-code
1
17028867718
# helper functions import time import datetime import requests import pickle import sys import itertools import glob # add things to this list that need to be closed when the program ends things_to_close = [] # load the github api tokens into an itertools.cycle github_tokens = [] for file_str in glob.glob("github_to...
millsjustin/gitSecrets
utils.py
utils.py
py
2,403
python
en
code
0
github-code
1
20506069143
#MODULOS import os import sys import time import smtplib from sympy.crypto.crypto import encipher_affine, decipher_affine from sympy.crypto.crypto import encipher_shift, decipher_shift #COLORES ve = "\033[1;32;40m" #Ve az = "\033[1;34;40m" #A ro = "\033[1;31;40m" #Ro #FUNCI...
jhondoeelmisterio/SocialHacks
SocialHacks.py
SocialHacks.py
py
3,622
python
en
code
0
github-code
1
9356428118
import asyncio import copy import json import os import shlex import subprocess import sys from datetime import datetime from json.decoder import JSONDecodeError from typing import Any, Dict, List, cast import pymongo import tornado.httpclient from watchdog import observers from watchdog.events import FileSystemEvent,...
berton7/kek-monitors
kekmonitors/monitor_manager.py
monitor_manager.py
py
41,901
python
en
code
8
github-code
1
19012266500
from email.quoprimime import quote import pandas as pd import requests from bs4 import BeautifulSoup from time import sleep import csv def request(msg, slp=1): '''A wrapper to make robust https requests.''' status_code = 500 # Want to get a status-code of 200 while status_code != 200: sleep(slp) ...
lucasccpp/bgwebscrapping
001_scrapping/ludopediaDetalhes.py
ludopediaDetalhes.py
py
5,321
python
pt
code
0
github-code
1
6345239505
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/3/3 16:31 # @Author : Vincent.G.Woo # @Site : # @File : blogtest2.py # @Software: PyCharm Community Edition # @Python_Version: # @Software_Version: import sys from blog import Ui_MainWindow from PyQt5 import QtWidgets class mywind...
Vingent/HydrologySoftware_Code
blogtest2.py
blogtest2.py
py
923
python
en
code
1
github-code
1
34533830120
import numpy as np from scipy import stats # from expon_cusum import Lv,F1 # import matplotlib.pyplot as plt ### This script is used to compare the thresholds for CuSum & WL-Cusum ## From first commit class F1(object): def __init__(self,c,mu_1=1,sig_1=1): self.c = c self.mu_1 = mu_1 self.d...
jacksonliang35/Quickest-Change-Detection
Non-Stationary/ns_wl_thr.py
ns_wl_thr.py
py
4,956
python
en
code
1
github-code
1
29614366198
from colorama import Fore, Style from typing import Tuple import numpy as np from colorama import Fore, Style import time print(Fore.BLUE + "\nLoading tensorflow..." + Style.RESET_ALL) start = time.perf_counter() from tensorflow import keras from keras import Model, Sequential, layers, regularizers, optimizers, mode...
rsmassey/mcats
mcats/ml_logic/model_cnn.py
model_cnn.py
py
3,987
python
en
code
0
github-code
1
27510683969
""" Author: alberto.suarez@uam.es Coauthors: joseantonio.alvarezo@estudiante.uam.es franciscojavier.saez@estudiante.uam.es """ import warnings from abc import ABC, abstractmethod from typing import Callable, Optional, Union, Type from sklearn.gaussian_process.kernels import RBF import matplotlib.pypl...
fjsaezm/mcd-mf
HW_02/kernel_approximation.py
kernel_approximation.py
py
12,959
python
en
code
0
github-code
1
34536369385
import requests from urllib.parse import urlencode import re from requests import codes import os from hashlib import md5 headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', 'Accept-Encoding': 'gzip, deflate', 'Acce...
ZhouYuanZZZZ/pythonStudy
spider/toutiao/toutiao_jiepai.py
toutiao_jiepai.py
py
3,035
python
en
code
0
github-code
1
20578247223
import numpy as np import pandas as pd import statsmodels.api as sm from pandas.tseries.offsets import MonthEnd from prettytable import PrettyTable, MARKDOWN from sklearn.kernel_ridge import KernelRidge from sklearn.linear_model import LassoCV, RidgeCV from sklearn.metrics import mean_squared_error from sklearn.model_s...
n3d1117/airqino-calibration
regression/regression_summary.py
regression_summary.py
py
8,833
python
en
code
1
github-code
1
70007598115
import sys from global_executor import run_executor from pepper_cmd_classes import Sonar, Dialogue sys.path.append('tablet/scripts') from modim_classes import CleanScreen if __name__ == "__main__": print("Starting monitor, to stop robot send KeyboardInterrupt signal.") while True: try: sonar = Sonar() loca...
lello5/university-projects
Master degree/Elective in AI 2/playground/main.py
main.py
py
779
python
en
code
8
github-code
1
30995288356
# use open cv to show new images from AirSim from PythonClient import * import cv2 import time import sys client = AirSimClient('127.0.0.1') # get depth image result = client.setImageTypeForCamera(0, AirSimImageType.Depth) time.sleep(1) # give it time to render help = False while True: # becau...
geevargs/AirSim
PythonClient/camera.py
camera.py
py
919
python
en
code
null
github-code
1
5117991566
# -*- coding: utf-8 -*- #Cluedo #Initialisation tableau profil = [('Colonel Moutarde', 'CCTGGAGGGTGGCCCCACCGGCCGAGACAGCGAGCATATGCAGGAAGCGGCAGGAATAAGGAAAA'), ('Mlle Rose', 'CTCCTGATGCTCCTCGCTTGGTGGTTTGAGTGGACCTCCCAGGCCAGTGCCGGGCCCCTCATAGGAGAGGADN'), ('Mme Pervenche', 'AAGCTCGGGAGGTGGCCAGGCGGCAGGAAGGCGCACCCCCCCAGTACTCCG...
Black0utss/Exercice-a-rendre
Exercice 18.py
Exercice 18.py
py
920
python
en
code
0
github-code
1
5710203135
# @Time : 2020/3/3 14:04 # @Author : Xylia_Yang # @Description :二叉搜索树与双向链表(返回双向链表的头节点) class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def Convert(self, pRootOfTree): if not pRootOfTree: return None sel...
XyliaYang/Leetcode_Record
python_version/Interview36.py
Interview36.py
py
867
python
en
code
1
github-code
1
37691349335
import os from PIL import Image import torchvision import torch, cv2, math, random import numpy as np device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') device_id = [0] IMG_EXTENSIONS = ['jpg', 'jpeg', 'png', 'ppm', 'bmp', 'pgm'] def mkdir(path): if not os.path.exists(path): os.maked...
painfulloop/Fingerprinting_IR_DNNs
ModelZoo/utils.py
utils.py
py
10,291
python
en
code
3
github-code
1
12514420774
import math def getDigit(number, placeValue): return math.floor(abs(number) / pow(10, placeValue)) % 10 def digitCount(number): if number == 0: return 1 return math.floor(math.log10(abs(number))) + 1 def mostDigits(arrayInput): maxDigits = 0 for number in arrayInput: maxDigits = max(ma...
MichaelOgunsanmi/Algorithms-and-Data-Structures
Sorting/radixSort.py
radixSort.py
py
1,194
python
en
code
0
github-code
1
74121977632
'''# {{{ Created on 28 янв. 2019 г. @author: BuYn '''# }}} #import block# {{{ import unittest from model.globalsvar import * from presenter.gstodo import GSTodo # }}} class Test(unittest.TestCase):# {{{ @classmethod #setUpClass# {{{ def setUpClass(self): print("*"*33,"*"*33) self.gs = GSTodo(f...
Buyn/GooglePy-
SRC/tests/test_lightGoggleToDo.py
test_lightGoggleToDo.py
py
2,105
python
en
code
0
github-code
1
26575080456
# coding:utf-8 # import re import codecs import sys import os def mode1(f_i,label): fi=codecs.open(f_i,"r","utf-8") f_o_prefix=(os.path.splitext(f_i))[0] f_o=f_o_prefix+r"_loc.txt" fo=codecs.open(f_o,"w","utf-8") context=fi.readlines() for line in context: result=line.spl...
zeitiempo/ner-on-web-txt
preprocess.py
preprocess.py
py
3,912
python
en
code
1
github-code
1
38762429507
''' 914. 卡牌分组 给定一副牌,每张牌上都写着一个整数。 此时,你需要选定一个数字 X,使我们可以将整副牌按下述规则分成 1 组或更多组: 每组都有 X 张牌。 组内所有的牌上都写着相同的整数。 仅当你可选的 X >= 2 时返回 true。 思路:统计各张牌的数量,满足各个数量有大于1的公约数 ''' class Solution: def hasGroupsSizeX(self, deck:list) -> bool: count = {} for x in deck: if count.get(x) is None: ...
love525150/leetcode-answer
a914.py
a914.py
py
1,322
python
zh
code
0
github-code
1
70352039714
from data_objects.random_cycler import RandomCycler from data_objects.utterance import Utterance from pathlib import Path """Minimally altered code from https://github.com/Trebolium/Real-Time-Voice-Cloning/tree/master/encoder/data_objects""" # Contains the set of utterances of a single speaker class Speaker: def...
Trebolium/singer_id_encoder
data_objects/speaker.py
speaker.py
py
2,155
python
en
code
0
github-code
1
75205396833
title = ['部长', '课长', '系长', '主任'] data = [ {'name':'高桥', 'position' : '主任'}, {'name':'铃木', 'position' : '系长'}, {'name':'佐藤', 'position' : '部长'}, {'name':'加藤', 'position' : '课长'}, ] data.sort(key=lambda x: title.index(x['position'])) print(data)
ShuheiOhno/workspace-python
dokusyu/6/6-20.py
6-20.py
py
308
python
zh
code
0
github-code
1
6398213595
from random import randint, choice from datetime import datetime now = datetime.now() current_time = now.strftime("%d/%m/%Y") file_name = "math_game_log.txt" # Functions def append_wrong_answer(answer,operation,file_name=file_name): with open(file_name, 'a') as f: f.write(f'\tExpression: {operation}, User...
Tjlhut/basic_math_game
basic_math_game.py
basic_math_game.py
py
4,818
python
en
code
0
github-code
1
20407001822
#!/usr/bin/python import argparse import json import os from os import listdir, path import copy from pathlib import Path import re import pandas as pd import numpy as np from bidict import bidict from scipy import sparse from sklearn.model_selection import cross_validate, StratifiedKFold from sklearn.preprocessing imp...
echr-od/ECHR-OD_predictions
multiclass_experiments.py
multiclass_experiments.py
py
11,588
python
en
code
7
github-code
1
12505277463
""" question - Implement a function that receives the ages dict and returns the average age.""" """here I am creating a new function and its name is average_num and in function i passed an input_dictionary as parameter """ def average_num(input_dictionary): """ Here I print the input dictionary because when it ...
kuldeepsinghn/python_coding
question_2.py
question_2.py
py
1,863
python
en
code
0
github-code
1
16386393414
# -*- coding: utf-8 -*- """ Created on Tue Oct 5 00:38:24 2021 @author: Marcos Martilotta """ import os def archivos_png(directorio): lista_archivos = os.listdir(directorio) lista_png = [] for archivo in lista_archivos: if archivo[-3:] == 'png': lista_png.append(archivo) p...
MarcosMartilotta/Curso_Python_UNSAM
Entrega_clase_8/listar_imgs.py
listar_imgs.py
py
438
python
es
code
0
github-code
1
71904356193
from selenium import webdriver from selenium.webdriver.common.keys import Keys import string import random import time path = "D:\chromedriver.exe" driver = webdriver.Chrome(path) print("Opening up the browser") driver.get("https://prnt.sc/") print("Preparing cookies...") driver.find_element_by_css_selector('.css-47seh...
Zeunig/py.prntscraper
prntscr.py
prntscr.py
py
1,102
python
en
code
1
github-code
1
2661521224
''' # class variables #Example_01 class Circle: pi = 3.1416 def __init__(self,radius): self.radius =radius def circle_circumference(self): return 2*Circle.pi*self.radius circle1 = Circle(5) circle2 = Circle(7) print(circle1.circle_circumference()) #Class variable...
MohammadIshak47/OOP_BASIC
class_objects/class_variables.py
class_variables.py
py
1,812
python
en
code
0
github-code
1
42604295575
from app import db from app.models import \ MoneroTransactions, MoneroWalletFee from app.generalfunctions import floating_decimals from sqlalchemy import func def getlastestfee(): """ THis will query the last 10 withdrawls...get the average fee :return: """ getratings = db.session.query(func...
CRYPTOFOUNDARY/wallet_monero
monero_getlastestfee.py
monero_getlastestfee.py
py
742
python
en
code
0
github-code
1
12168306633
""" Team Activity Week 04 Purpose: Determine how fast an object will fall using the formula: v(t) = sqrt(mg/c) * (1 - exp((-sqrt(mgc)/m)*t)) """ import math print("To calculate how fast an object will fall, enter these informations:") #input mass (in kg) m = float(input("Mass (in kg): ")) #input acceleration due to gra...
Elijah3502/CSE110
Programming Building Blocks/Week 2/04Teach.py
04Teach.py
py
2,111
python
en
code
0
github-code
1
40045586326
import random import math def weight(alpha1,beta1,gamma1): x1= (alpha1 << 1)& mask y1= (beta1 << 1)& mask z1= (gamma1 << 1)& mask not_x=(x1^mask) eq=((not_x)^y1)&(not_x^z1) s=eq&(alpha1^beta1^gamma1^(y1)) if(s==0): h=bin((~eq)& mask) wt=(h[1:].count("1")) ...
ashudhar7/SPECK-differential-path-using-threshold-search
pDDT.py
pDDT.py
py
1,454
python
en
code
0
github-code
1
25943713246
nums=[2,2,3,4,4,3,3] val=5 if val in nums: a=nums.count(val) for i in range(a): nums.remove(val) print(nums) else: print(f"No {val} found in the list")
Shub2480/Python-Codes
Remove Element.py
Remove Element.py
py
186
python
en
code
0
github-code
1
347104407
from graphviz import Digraph as DotGraph MAX_EDGES = 2000 def gshow(g, attr=None, file_name=None, view=False): if g is None: return """ shows a networx DiGraph g using graphviz it could become slow on large graphs (above MAX_EDGES) """ ecount = g.number_of_edges() if ecount > MAX...
ptarau/StanzaGraphs
logic/visualizer.py
visualizer.py
py
1,657
python
en
code
8
github-code
1
5949551094
username = input() cmd_input = input().split() while cmd_input[0] != "Sign": args = cmd_input cmd = args[0].lower() if cmd == "case": type = args[1] if type == "lower": username = username.lower() print(username) elif type == "upper": username =...
LachezarKostov/SoftUni
00_Demos/finall_examp/Username.py
Username.py
py
1,194
python
en
code
1
github-code
1
22052722472
from django.shortcuts import render, redirect from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse_lazy from django.views.generic import CreateView from django.contrib.auth.models import User from .models import * from .forms import * # from .api_powerbi import * from django.http ...
WETECH-INNOVATIONS/wetech
Calidad/Apps/indicador/views.py
views.py
py
35,474
python
es
code
0
github-code
1
26922251758
from flask import Flask, request, jsonify from models.db import db from models.User_model import User from backend.controller.extensions import bcrypt, jwt_manager, session from datetime import datetime, timezone, timedelta from flask_jwt_extended import get_jwt, create_access_token, get_jwt_identity from flask_cors im...
abhirambsn/stuniq-web-desktop
backend/app.py
app.py
py
2,415
python
en
code
0
github-code
1
1187043277
from sklearn.svm import LinearSVC import metodos as m def ObtenerHiperParametros(x_train, y_train, x_test, y_test): parametros = [ { 'penalty': ['l1'], 'C': [1, 10, 100], 'dual': [False], 'class_weight': [{1:4}, {1:5}] } ] medida = 'recall' return m.GridSearch(LinearSVC(), parametros, medida, ...
erichuizapucp/credit-card-fraud-detection
notebooks/SVM.py
SVM.py
py
675
python
en
code
0
github-code
1
37639002029
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import sys import argparse import numpy as np from collections import defaultdict,Counter __author__ = 'menghao' __mail__ = 'haomeng@genome.cn' bindir = os.path.abspath(os.path.dirname(__file__)) pat1 = re.compile('^\s*$') def parser_fasta(fasta): ...
whenfree/Rosalind
Consensus_and_Profile/Consensus_and_Profile.py
Consensus_and_Profile.py
py
1,521
python
en
code
0
github-code
1
19116302163
# -*- python -*- load( "@com_google_protobuf//:protobuf.bzl", "proto_gen", "py_proto_library", ) load( "@drake//tools/skylark:drake_cc.bzl", "drake_cc_library", ) def drake_cc_proto_library( name, srcs = [], deps = [], tags = [], **kwargs): """A wrapper ...
GTLIDAR/safe-nav-locomotion
motion_planner/drake/tools/skylark/drake_proto.bzl
drake_proto.bzl
bzl
1,779
python
en
code
21
github-code
1
26373489244
import sys from math import log, sqrt from itertools import combinations import json from nltk.stem.porter import * from nltk.stem.snowball import ArabicStemmer from string import punctuation punctuation += '،؛؟”0123456789“' stopWords = open(".../arabic_stopwords.txt",encoding = "utf-8").read().splitlines()...
DrMustafa/GOA-Arabic-Text-Summarization
data_preprocessing.py
data_preprocessing.py
py
5,696
python
en
code
0
github-code
1
35410659740
import copy from ptree import PTree, Node class PRule(object): def __init__(self, variable, derivation, probability): self.variable = str(variable) self.derivation = tuple(derivation) self.probability = float(probability) def derivation_length(self): return len(se...
AmitSGold/PCKY
pcfg.py
pcfg.py
py
16,925
python
en
code
0
github-code
1
71254624034
from flask_jwt_extended import jwt_required, get_jwt_identity from flask_restful import Resource, reqparse from app.database.connection import get_db # Informações que espera-se nos corpos das requisições parser = reqparse.RequestParser() parser.add_argument('item_name') parser.add_argument('category_id') class Item...
ARJOM/testes-sistema
tribos/backend/app/controllers/items_controllers.py
items_controllers.py
py
3,223
python
pt
code
0
github-code
1
27559044703
import urllib3 urllib3.disable_warnings() import os.path import json import requests import uservoice import time from config import * def send_ticket_to_freshdesk(ticket, ticket_number): _url = "https://%s.freshdesk.com/api/v2/tickets" % FD_SUBDOMAIN _headers = { 'Content-Type': 'application/json' } _data = ...
melalj/uservoice-to-freshdesk
main.py
main.py
py
3,071
python
en
code
0
github-code
1
31865151145
import numpy as np import matplotlib.pyplot as plt import copy from run_stages.common_run_stage import CommonRunStage from configuration.configuration_manager import Configuration from configuration.models import Models from utilities.image_processing_utilities import int_sq class ResistiveMeshStage(CommonRunStage):...
PalankerLab/RPSim
run_stages/resistive_mesh_stage.py
resistive_mesh_stage.py
py
5,314
python
en
code
0
github-code
1
14905473093
import sys from time import sleep import pygame from settings import Settings import game_functions as gf # from tetrominos import IShape from tetrominos import IShape def run_game(): pygame.init() # Load game settings. settings = Settings() screen = pygame.display.set_mode( (settings.screen...
DeepWalter/python-projects
tetris/tetris.py
tetris.py
py
1,057
python
en
code
0
github-code
1
17745879141
import aioitertools import copy class _SampleIterator: _none = object() def __init__(self, sample): self._iters = [iter(t) for t in sample] def __iter__(self): return self def __next__(self): sample = tuple(next(t, self._none) for t in self._iters) if any(map(lambda ...
isushik94/pytorch-data-api
src/torch_data/_ops/_unbatch.py
_unbatch.py
py
1,695
python
en
code
1
github-code
1
24582282629
import os TEMPLATE = """ import os from setuptools import setup, find_packages if os.path.exists('README.md'): with open('README.md') as fobj: long_description = fobj.read() else: long_description='<name>' setup( name='<name>', version='0.0.0', description='<name>', long_description=...
sclabs/treeshaker
treeshaker/setup_utils.py
setup_utils.py
py
897
python
en
code
18
github-code
1
69947767073
import json from oauth2_provider.oauth2_validators import OAuth2Validator as o_validator from oauth2_provider.models import AbstractAccessToken as mToken def get_token_from_request(request): auth = request.headers.get("HTTP_AUTHORIZATION", None) if not auth: return None splitted = ...
rhnapoles/proyecto
declaraciones/api/validator.py
validator.py
py
797
python
en
code
0
github-code
1
5710254245
# @Time : 2020/3/13 17:53 # @Author : Xylia_Yang # @Description : # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def kthNode(self, root, k): """ :type root: Tre...
XyliaYang/Leetcode_Record
python_version/Interview54.py
Interview54.py
py
1,069
python
en
code
1
github-code
1
71372300515
import base64 import datetime import json import re import time from django.db import connection from django.db.models import Q from django.views.decorators.csrf import csrf_exempt from operation.models import AdminLoginLog from src.models import OneSrc from user.models import User, Group from utils.gen_captcha impor...
17-12-20-ll/fun_lib
user/views.py
views.py
py
20,640
python
en
code
0
github-code
1
17038581303
import lightgbm as lgb import numpy as np import pandas as pd from sklearn.model_selection import train_test_split def rmsle(y_true, y_pred): assert len(y_true) == len(y_pred) return np.sqrt(np.mean(np.power(np.log1p(y_true + 1) - np.log1p(y_pred + 1), 2))) def rmse(y_true, y_pred): assert len(y_true) ==...
sklinl/Competition_Tunghai
lg.py
lg.py
py
5,626
python
en
code
0
github-code
1
4626498979
#!/usr/bin/env python # -*- coding: utf-8 -*- # {# pkglts, pysetup.kwds # format setup arguments import os from os import walk from os.path import abspath, normpath, dirname from os.path import join as pj from setuptools import setup, find_packages short_descr = "Python/Visualea interface to Caribu Light model" rea...
openalea-incubator/caribu
setup.py
setup.py
py
2,530
python
en
code
7
github-code
1
43063771699
from typing import TYPE_CHECKING, Optional from nonebot import Bot from nonebot.internal.adapter import Event from nonebot_plugin_access_control_api.subject.model import SubjectModel from nonebot_plugin_access_control_api.subject.manager import SubjectManager if TYPE_CHECKING: from nonebot.adapters.kaiheila.even...
bot-ssttkkl/nonebot-plugin-access-control
src/nonebot_plugin_access_control/subject/extractor/builtin/kaiheila.py
kaiheila.py
py
1,158
python
en
code
30
github-code
1
73016827874
#!/usr/local/bin/python # -*- coding: utf-8 -*- class Ellipse_button(object): def __init__(self): self.color1 = color(0) self.color2 = color(0) self.x = 0 self.y = 0 self.w = 0 self.h = 0 self.click = False self.tdist = 0 def ...
dmitmel/Space_fighters
easy_controls/ellipse_button.py
ellipse_button.py
py
1,204
python
en
code
0
github-code
1
26104077495
import connexion import six from swagger_server.models.meta_page import MetaPage # noqa: E501 from swagger_server.models.page import Page # noqa: E501 from swagger_server import util, const from swagger_server.database import database from swagger_server.controllers.exceptions import ExceptionHandler from swagger_se...
JakubKuderski/Programowanie_Zespolowe
server/swagger_server/controllers/page_controller.py
page_controller.py
py
1,997
python
en
code
0
github-code
1
20244593159
# cannot solve it so I will brute force the solution: import re import time import socket if __name__ == "__main__": web = "2018shell.picoctf.com" port = 63299 print("Lets do a brute force for the desrouleuax task") print("Web page {} on socket {} \n".format(web, socket)) for solution in ...
Paczkaexpress/CTF
picoCTF2018/whatBaseIsThis/arch.py
arch.py
py
1,210
python
en
code
0
github-code
1
21690505728
""" Contains function for inserting data to Mongo collections. If run as main script will create collections for the DataFrames saved as .pkl files from data_acquisition.py Stephen Kaplan, 2020-08-22 """ import pandas as pd from app.db import connect_to_mongo from app.creds import USERNAME, PWD def insert_to_mongo(...
riddhi-jain/standup-comedy-recommender
analysis/insert_data_mongo.py
insert_data_mongo.py
py
2,329
python
en
code
0
github-code
1
9396196983
from collections import Counter from collections import defaultdict from nltk.corpus import stopwords from wordcloud import WordCloud import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from preprocess import process_text_data from utils import load_epub def get_word_frequency_information(book...
dhsong95/the-catcher-in-the-rye
question2.py
question2.py
py
4,122
python
en
code
0
github-code
1