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
39100516740
import random class Student: def __init__(self, name): self.name = name self.gladness = 50 self.progress = 0 self.money = 0 self.alive = True def to_study(self): print('Time to study!') self.progress += 0.15 self.gladness -= 3 def to_sleep(s...
MishaTret/homework2
main.py
main.py
py
1,968
python
en
code
0
github-code
13
36851203306
# -*- coding: utf-8 *-* try: import simplejson as json except ImportError: import json import requests from bson import json_util from mongolabclient import settings, validators, errors class MongoLabClient(object): """Instance class with the API key located at https://mongolab.com/user?username=[use...
puentesarrin/pymongolab
mongolabclient/client.py
client.py
py
9,002
python
en
code
7
github-code
13
30900917736
"""empty message Revision ID: 6c1fa3d9287d Revises: Create Date: 2020-04-04 11:50:32.327290 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6c1fa3d9287d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
kanwarjohal/flasktestkanwar
migrations/versions/6c1fa3d9287d_.py
6c1fa3d9287d_.py
py
1,043
python
en
code
0
github-code
13
23274482780
import numpy as np import pandas as pd print("iojqwodijddd") print("new line is added...") print('add new line in branch...') size = 9 big = 10.222 nxt = 22 version = 'master'
supershushu/tm5-test
src/tm5-test.py
tm5-test.py
py
180
python
en
code
1
github-code
13
20628641821
import xbmc import xbmcaddon import xbmcgui import os import re import sfile def GetXBMCVersion(): #xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }') version = xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') ve...
whufclee/XBMC-Python
script.tvportal.tools/utils.py
utils.py
py
4,673
python
en
code
1
github-code
13
31043568539
from datetime import date from typing import List, Optional import uuid from source.models.book.base import BookBaseModel from source.views.book import BookView from werkzeug.exceptions import NotFound class BookService: """Bookactions """ book_model: BookBaseModel def __init__(self, book_model): ...
pluvet/Books
source/services/book.py
book.py
py
1,895
python
en
code
0
github-code
13
21473637879
minutes_control = int(input()) seconds_control = int(input()) length = float(input()) seconds_for_hundred_meters = int(input()) control = minutes_control * 60 + seconds_control time_of_player = length * seconds_for_hundred_meters / 100 - length * 2.5 / 120 if time_of_player <= control: print('Marin Ban...
patsonev/Python_Basics_Exam_Preparation
skeleton.py
skeleton.py
py
490
python
en
code
0
github-code
13
33690811070
from typing import Any, Dict, List from pydbml import PyDBML from . import logger from .data_types_generator import DataTypeGenerator from .distribution import DistributionGenerator, DistributionType class GeneratorDirectiveDependency: def __init__(self, referenced_field: str, referenced_directive: 'GeneratorD...
GandalFran/fake-db-data-generator
fake_db_datagen/directive_builder.py
directive_builder.py
py
18,209
python
en
code
3
github-code
13
72097673617
from pyradioconfig.parts.bobcat.profiles.Profile_WiSUN import Profile_WiSUN_Bobcat from pyradioconfig.parts.common.profiles.viper_regs import build_modem_regs_viper from pyradioconfig.parts.common.profiles.profile_common import buildCrcOutputs, buildFecOutputs, buildFrameOutputs, \ buildWhiteOutputs class profile_...
jc-plhm/Z3GatewayHost_Sectronic
src/platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/viper/profiles/Profile_WiSUN.py
Profile_WiSUN.py
py
972
python
en
code
1
github-code
13
39777640769
import html import logging from pathlib import Path from django.conf import settings from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core import mail from django.core.cache import cache from django.core.validators import URLValida...
Pack144/packman
packman/mail/models.py
models.py
py
18,221
python
en
code
1
github-code
13
7164715691
import torch import torch.nn as nn import numpy as np import pickle import torch.nn.functional as F from model import models from model.models import FewShotModel def pairwise_distances_logits(query, proto, distance_type='euclid'): # query n * dim # prototype n_c * dim if distance_type == 'euclid': ...
mayug/BaseTransformers
model/models/feat_basetransformer.py
feat_basetransformer.py
py
10,071
python
en
code
8
github-code
13
35735270255
age = 27 isDrunk = False isRestrictedArea = False if age < 18: print("You are too young") elif isDrunk: print("You are drunk. No alcohol") elif isRestrictedArea: print("Restricted, alco forbidden") else: print("Ok, drink") print("------------") print("ZADANIE 1") min_likes = 500 min_...
w0jtech/python_udemy
15_elif.py
15_elif.py
py
952
python
en
code
0
github-code
13
28813940416
import os from karton.android import Android from karton.core import Task from karton.core.test import KartonTestCase, TestResource class AndroidMagicTestCase(KartonTestCase): karton_class = Android def test_android(self): testcase = os.path.join(os.path.dirname(__file__), "testsdata", "example.apk...
jvoisin/karton-android
tests/test_android.py
test_android.py
py
3,159
python
en
code
4
github-code
13
39777261562
""" defining Global Variables """ assignments = [] def assign_value(values, box, value): """ Please use this function to update your values dictionary! Assigns a value to a given box. If it updates the board record it. """ # Don't waste memory appending actions that don't actually change any value...
RezaUBC/AIND-Sudoku
solution.py
solution.py
py
9,874
python
en
code
0
github-code
13
43768858326
from colorama import Fore, Style from pprint import pprint def split_image_into_layers(image_data, img_width, img_height): surface = img_width * img_height amount_of_layers = int(len(image_data) / surface) layers = [] for layer_index in range(amount_of_layers): layer_data = image_data[layer_in...
xheory/advent-of-code-2019
stars/star15and16.py
star15and16.py
py
1,956
python
en
code
0
github-code
13
7829619130
import waffle from django.conf import settings from django.shortcuts import get_object_or_404 from django.templatetags.static import static from django.utils.timezone import is_naive from requests import Session from cl.lib import search_utils from cl.lib.elasticsearch_utils import do_es_feed_query from cl.lib.podcast...
freelawproject/courtlistener
cl/audio/feeds.py
feeds.py
py
6,942
python
en
code
435
github-code
13
34114246474
from __future__ import annotations from netqasm.runtime.settings import Simulator, get_simulator if get_simulator() == Simulator.NETSQUID: import netsquid as ns import numpy as np from netsquid.qubits import operators, qubitapi from netsquid.qubits.qubit import Qubit as NetSquidQubit def qubit_from(...
QuTech-Delft/netqasm
netqasm/sdk/toolbox/sim_states.py
sim_states.py
py
1,532
python
en
code
17
github-code
13
7716343150
from google.oauth2.service_account import Credentials from googleapiclient.discovery import build import io from googleapiclient.http import MediaIoBaseDownload # Authenticate using the same service account as before creds = Credentials.from_service_account_file('google_sheets_access.json') # Create a Drive API clien...
dhowe/prompt-gen-client
drive_files.py
drive_files.py
py
1,808
python
en
code
0
github-code
13
29376712623
n = int(input("Write the number of digits you want to show:")) f = [0, 1] numbers = 2 for digit in f: if numbers == n: break else: digit_next = f[-1] + f[-2] f.append(digit_next) numbers = numbers + 1 print(f)
kolyasalubov/Lv-14.03.PythonFundamentals
AnastasiiaKaravaieva/HW_5/2.py
2.py
py
244
python
en
code
0
github-code
13
74870464336
# 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 CBTInserter: def __init__(self, root: TreeNode): self.root = root self.queue = [root] self.le...
yeung66/leetcode-everyday
py/919.py
919.py
py
1,531
python
en
code
0
github-code
13
74175728018
#!/usr/bin/env python3 from day01.main import load, test from day02.main import load_memory from day05.main import Program def part1(filename): memory = load_memory(filename, script=__file__) return list(Program(memory, [1]).run_computer()) def part2(filename): memory = load_memory(filename, script=__file__) ...
andrewmacheret/aoc
2019/python/day09/main.py
main.py
py
673
python
en
code
0
github-code
13
16711872703
from argparse import ArgumentParser from pathlib import Path import os import torch import logging import json import random import numpy as np from collections import namedtuple from tempfile import TemporaryDirectory from torch.utils.data import DataLoader, Dataset, RandomSampler, Sampler, SequentialSampler from to...
dreasysnail/POINTER
inference.py
inference.py
py
26,546
python
en
code
111
github-code
13
21253004182
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __doc__ = 'description' __author__ = '13314409603@163.com' import os import shutil def main(): baseDir = r'A:\Bi-LSTM+CRF\原始_待分句_样例\cpws' targetDir = r'C:\Users\13314\Desktop\test' # choose2KB(baseDir,targetDir) chooseNumberOfChar(baseDir,targetDir,1500) ...
shengxiaoyu/BiLSTM_CRF_EVENT_DETECT
event_dectect/evaluation/chooseFileForExperiment.py
chooseFileForExperiment.py
py
1,842
python
en
code
2
github-code
13
27613778185
import torch from torchvision.utils import save_image import numpy as np def denorm(tensor, device, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]): std = torch.Tensor(std).reshape(-1, 1, 1).to(device) mean = torch.Tensor(mean).reshape(-1, 1, 1).to(device) res = torch.clamp(tensor * std + mea...
MediaBrain-SJTU/FACT
utils/tools.py
tools.py
py
2,941
python
en
code
134
github-code
13
15808947303
from __future__ import print_function import sys # bold colors _ansi = {'red': 91, 'yellow': 93} def is_tty(stream): # taken from catkin_tools/common.py """Returns True if the given stream is a tty, else False""" return hasattr(stream, 'isatty') and stream.isatty() def colorize(msg, color, file=sys.stderr, ...
jincheng-ai/ros-melodic-python3-opencv4
xacro/src/xacro/color.py
color.py
py
1,065
python
en
code
5
github-code
13
31321235612
# coding=utf-8 __author__ = "Daniel Arroyo <daniel@astroprint.com>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' import os.path import glob import logging import threading import uuid import time from threading import Event from random import randrange from astroprint.camera...
AstroPrint/AstroBox
src/astroprint/camera/mac.py
mac.py
py
4,233
python
en
code
158
github-code
13
17055313074
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class LightPosOrderSku(object): def __init__(self): self._amount = None self._name = None self._price = None self._quantity = None self._sku_id = None @prop...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/LightPosOrderSku.py
LightPosOrderSku.py
py
2,570
python
en
code
241
github-code
13
73079353299
import numpy as np def save_model(weight , bias): model = np.hstack((weight.reshape(-1) , bias)) np.save('model.npy' , model) return def load_model(): model = np.load('model.npy') weight = model[ : -1].reshape(-1 , 1) bias = model[-1] return (weight , bias)
jnfem112/ML2020SPRING
hw1/model.py
model.py
py
277
python
en
code
2
github-code
13
19284833300
import json import os import re import click def walk_dir(root_path): result = {} for file in os.listdir(root_path): print("正在索引:{}".format(file)) path = os.sep.join([root_path, file]) if os.path.isfile(path): try: result[file] = os.path.getsize(path) ...
tongyifan/Reseed-backend
scripts/reseed.py
reseed.py
py
2,331
python
en
code
326
github-code
13
57340179
#!/usr/bin/env python """Python3 scripts running in scriptworker will use functions in this file. Attributes: log (logging.Logger): the log object for the module """ import asyncio import logging import os import sys import jsonschema from immutabledict import immutabledict from scriptworker_client.exceptions i...
mozilla-releng/scriptworker-scripts
scriptworker_client/src/scriptworker_client/client.py
client.py
py
5,949
python
en
code
13
github-code
13
38384826011
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import logging import sys import time from bottle import Bottle, BaseTemplate, TEMPLATE_PATH, view, request, static_file from stanfordcorenlp import StanfordCoreNLP from dao.data_acquire import get_corpus from definitions import WEB_DIR from service.get_view i...
erichtho/auto-view-detection
web.py
web.py
py
2,621
python
en
code
0
github-code
13
73447172817
""" produtos = [1] * 10 descontado = 0 y = 0 valor = 0 while produtos[y] != 0: if y == 9: break else: y = y + 1 produtos[y] = int(input('Digite o produto numero {}: '.format(y))) if produtos[y] >= 500 and produtos[y] < 1000: print('desconto de 5% aplicado') ...
vinicris1/Python
ex.py
ex.py
py
2,146
python
pt
code
0
github-code
13
71602793938
from flask import Flask, request app = Flask(__name__) @app.route("/upload", methods=["POST"]) def upload(): """文件上传视图""" pic_obj = request.files.get('pic') if pic_obj is None: # 表示没有发送文件 return "未上传文件" # 将文件保存到本地 # 1.创建一个文件 with open("./demo.jpg", "wb") as f: # 2.向文...
BrandonSong/first_reposity
demo/file_upload.py
file_upload.py
py
540
python
en
code
0
github-code
13
35583508523
import copy # import getpass import logging import os import pickle # import webbrowser # import browser_cookie3 import requests from TwitchChannelPointsMiner.classes.Exceptions import ( BadCredentialsException, WrongCookiesException, ) from TwitchChannelPointsMiner.constants import CLIENT_ID, GQLOperations,...
HttpsDavide/FiveM-Original-Citizen-Backup
TwitchChannelPointsMiner/classes/TwitchLogin.py
TwitchLogin.py
py
13,616
python
en
code
1
github-code
13
15586500249
from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): email = models.EmailField( 'Адрес электорнной почты', unique=True, max_length=254 ) username = models.CharField( 'Пользователь', max_length=150, unique=True )...
vomerf/recipe_network
backend/foodgram/users/models.py
models.py
py
1,973
python
en
code
0
github-code
13
31941673540
class Solution: def longestPalindrome(self, s: str) -> str: if not s: return '' n = len(s) start, end = 0, 0 def expandAroundCenter(left: int, right: int) -> tuple: while 0 <= left and right < n and s[left] == s[right]: left -= 1 ...
wylu/leetcodecn
src/python/explore/string/basic/最长回文子串.py
最长回文子串.py
py
684
python
en
code
3
github-code
13
42319507847
#se crea variable para almacenar numero ingresado. num = int(input("Ingresa un numero")) #Inicializamos esta avriable como verdadera. primo = True #creamos un ciclo for para saber si el numero es divisible por es divisible por i sin dejar residuo, es decir, si num es divisible por i. Si es divisible, significa qu...
necordoba/Ejercicios-python
Python/Ejercicios_practicas/Numero_primo.py
Numero_primo.py
py
767
python
es
code
1
github-code
13
6240055006
# Yoga with Adriene - daily yoga video from her YouTube playlist. # Script opens Chrome browser, opens monthly playlist and picks up video with today's date. # It turns off captions with "c" button and goes to full screen with "f" key. # Replace JSON and it should work! import datetime import webbrowser from go...
NitroNokia/YWA
dailyyoga.py
dailyyoga.py
py
2,715
python
en
code
0
github-code
13
73729817936
from playwright.sync_api import Playwright, sync_playwright, expect import re from bs4 import BeautifulSoup def run(playwright: Playwright) -> None: browser = playwright.chromium.launch(headless=False) context = browser.new_context() url = "https://rede-expressos.pt/pt" page = context.new_page() ...
joaoftrodrigues/RenExplore
scrapper.py
scrapper.py
py
1,789
python
en
code
0
github-code
13
7042331363
#encoding: utf-8 import numpy as np # Imports numpy under alias np import cv2 def convolve(dest, src, i, j, kernel): krows, kcols = kernel.shape srctmp = src[i:i + krows, j:j + kcols] dest[i, j] = (srctmp * kernel[:, :, np.newaxis]).sum(axis=(0, 1)) def convolveGrayscale(dest, src, i, j, kernel): krow...
Witiza/Virtual_Reality
Python/main.py
main.py
py
6,080
python
en
code
0
github-code
13
7678755668
import random f = open("./datawriter/names.csv", "r") fnames = set() lnames = set() for i in f.readlines(): fnames.add(i.split(" ")[0]) lnames.add(i.split(" ")[1][:-2]) f.close() l = ['const persons = ['] fnames = list(fnames) lnames = list(lnames) occupations = ["doctor", "teacher", "scientist", "bussinessm...
greyhatguy007/persons-API
datawriter/write.py
write.py
py
861
python
en
code
2
github-code
13
34625892545
import logging import azure.functions as func import json from azure.cosmos import CosmosClient def main(req: func.HttpRequest) -> func.HttpResponse: logging.info('Python HTTP trigger function processed a request.') url = req.params.get('url') key = req.params.get('key') client = CosmosClient(url, ...
rokahr/copycosmos
ListDBs/__init__.py
__init__.py
py
568
python
en
code
0
github-code
13
41225339581
from collections import deque from global_variables import * import coefficients_getter as cg from network import Network import numpy as np def combinations(objects, k): object = list(objects) if objects == [] or len(objects) < k or k == 0: yield [] elif len(objects) == k: yield objects ...
Heinzel14/Simulation_Studienarbeit
mesh_simulator_without_kodo.py
mesh_simulator_without_kodo.py
py
11,613
python
en
code
0
github-code
13
29545494082
from simpleai.search.local import hill_climbing,hill_climbing_random_restarts import numpy as np from simpleai.search.viewers import BaseViewer from simpleai.search import SearchProblem from simpleai.search.viewers import BaseViewer count = 15 capacity = 50 items_w = [24, 10, 10, 7, 2, 8, 6, 5, 9, 12, 20, 1...
cerenili/ai
knapsack.py
knapsack.py
py
2,122
python
en
code
0
github-code
13
14994434043
import turtle def drawTee(myTurtle): myTurtle.pendown() myTurtle.forward(200) myTurtle.backward(50) myTurtle.right(90) myTurtle.forward(50) myTurtle.backward(100) myTurtle.forward(50) myTurtle.right(90) myTurtle.forward(150) def drawFourTees(myTurtle): count = 0 while count < 4: drawTee(myTurtle) myTur...
josenavarro-leadps/class-sample
drawTfigure.py
drawTfigure.py
py
422
python
en
code
0
github-code
13
37165134373
from pulsar.managers.unqueued import Manager from os.path import join from .test_utils import BaseManagerTestCase, get_failing_user_auth_manager class ManagerTest(BaseManagerTestCase): def setUp(self): super().setUp() self._set_manager() def _set_manager(self, **kwds): self.manager...
galaxyproject/pulsar
test/manager_test.py
manager_test.py
py
2,544
python
en
code
37
github-code
13
13122194135
from qm.QuantumMachinesManager import QuantumMachinesManager from qm.qua import * import numpy as np from configuration import config import matplotlib.pyplot as plt from qm import SimulationConfig from helper_functions import electrical_dalay qmm = QuantumMachinesManager() qm = qmm.open_qm(config) f_m...
jtfarm/QPs_PID
res_aprc.py
res_aprc.py
py
3,197
python
en
code
0
github-code
13
73643965137
# Ejercicio 1034: Usar threads para sumar los valores de cada fila de una matriz. from threading import Thread def sumar_fila(numeros, resultado): suma = 0 for n in numeros: suma += n resultado.append(suma) if __name__ == '__main__': matriz = [ list(range(1, 1000)), lis...
Fhernd/PythonEjercicios
Parte002/ex1034_suma_por_filas_threads.py
ex1034_suma_por_filas_threads.py
py
757
python
es
code
126
github-code
13
41739178092
import unittest def mow_lawn(raining): if raining == True: return False elif raining == False: return True def cover_track(raining): if raining == True: return True elif raining == False: return False class TestWorkMethods(unittest.TestCase): def test_mow_lawn(sel...
hinbody/testing
work/work.py
work.py
py
679
python
en
code
0
github-code
13
4776498528
from sklearn.datasets import load_breast_cancer import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.model_selection import cross_val_score import warnings warnings.filterwarnings('ignore') data = load_breast_cancer() X = data["data"] y = data["target"] #pd.DataFrame(data=X)...
BioInfoLeo/ANMDA
noisy_data_test.py
noisy_data_test.py
py
938
python
en
code
2
github-code
13
30569214022
import cv2 import os import sys PREVIE = 0 BLUR = 1 FEATURES = 2 CANNY = 3 feature_params = dict(maxCornoers = 500, qualityLevel = 0.2, minDistance = 15, blockSize = 9) s = 0 if len(sys.argv) > 1: s = sys.argv[1] source = cv2....
huhuang03/ytb_free_opencv_crash_course
Module 5 Accessing the Camera.py
Module 5 Accessing the Camera.py
py
605
python
en
code
0
github-code
13
22004202909
'''from selenium import webdriver import time from selenium.webdriver.common.by import By ''' from openpyxl import Workbook '''path = "C:/SeleniumDriver/chromedriver.exe" url = "https://www.google.com" search_val = "Flipkart" driver = webdriver.Chrome(path) driver.get(url) driver.implicitly_wait(10) driver.maximize_wi...
Sahupreeti/SeleniumProject
test.py
test.py
py
867
python
en
code
0
github-code
13
71362832339
import win32com.client from os import path #####send outlook = win32com.client.Dispatch('outlook.application') mail = outlook.CreateItem(0) #mail.To = '' #mail.Subject = 'Hello this is you!' #mail.Body = 'Hello!!!!!!' #mail.HTMLBody = '<h2>This is an H2 message</h2>' #this field is optional # To attach a f...
Cazeho/Email
outlook.py
outlook.py
py
1,203
python
en
code
1
github-code
13
41445556431
# -*- coding: utf-8 -*- """ cron: 7 21 * * * new Env('智友邦'); """ import re import requests from notify_mtr import send from utils import get_data class Zhiyoo: def __init__(self, check_items): self.check_items = check_items @staticmethod def sign(session): response = session.get( ...
OreosLab/checkinpanel
ck_zhiyoo.py
ck_zhiyoo.py
py
2,959
python
en
code
1,380
github-code
13
19794978540
import numpy as np import scipy.sparse as sparse from liblinear.liblinearutil import train __all__ = ['train_1vsrest', 'evaluate'] def train_1vsrest(y: sparse.csr_matrix, x: sparse.csr_matrix, options: str): """ Trains a linear model for multiabel data using a one-vs-all strategy. Returns the model. ...
chihming/LibMultiLabel
libmultilabel/linear/linear.py
linear.py
py
2,283
python
en
code
null
github-code
13
41905013716
import syslog, os, sys from PyQt5.QtGui import * from PyQt5.QtWidgets import * class win(QWidget): def __init__(self, USER, HOST, SERVICE): super(win, self).__init__() self.AUTH = None if SERVICE == "sshd-key": self.AUTH = "SSH public-key authentication" elif SERVICE == "sshd": self.AUTH = "SSH pa...
alexander-naumov/pam-accesscontrol
usr/share/pam-accesscontrol/windows.py
windows.py
py
2,463
python
en
code
3
github-code
13
70078935379
import os import sys from pathlib import Path from platform import system from shutil import which from subprocess import call from typing import Optional, Tuple from pandocfilters import toJSONFilter, Para, Image, get_filename4code, get_caption, get_extension def get_cache_dir() -> Path: """Get a cache directo...
FynnFreyer/.dotfiles
pandoc/.local/share/pandoc/filters/plantuml.py
plantuml.py
py
2,775
python
en
code
0
github-code
13
74912781137
import pandas as pd import sqlalchemy as sql def etl(data_path: str, engine: sql.engine.Engine) -> None: """ Esta función realiza una ETL en un archivo CSV y carga los datos en una tabla de una base de datos. Args: - data_path (str): La ruta del archivo CSV a leer. - engine (sqlalchemy.engine.Eng...
agusdm97/PF-DTS05-E-COMMERCE-OLIST
data_warehouse/etl_module/order_payment.py
order_payment.py
py
1,571
python
es
code
1
github-code
13
73605353298
# !/usr/bin/python3 # -*- coding: utf-8 -*- # @Author: 花菜 # @File: 70爬楼梯.py # @Time : 2022/11/8 20:01 # @Email: lihuacai168@gmail.com # 70爬楼梯 # 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 # # 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? # # # # 示例 1: # # # 输入:n = 2 # 输出:2 # 解释:有两种方法可以爬到楼顶。 # 1. 1 阶 + 1 阶 # 2. 2 阶 # # 示例 2: # # # 输入:n = 3 # 输出:...
lihuacai168/LeetCode
动态规划/70爬楼梯.py
70爬楼梯.py
py
1,142
python
zh
code
4
github-code
13
36198501612
import argparse import openai_secret_manager import langchain # Load OpenAI API credentials from environment variables secrets = openai_secret_manager.get_secret("openai") # Set up the OpenAI API client client = openai.SecretManagerClient(api_key=secrets["api_key"]) # Define the maximum length of each input chunk (i...
greydoubt/grindGPT
refine.py
refine.py
py
1,933
python
en
code
0
github-code
13
1617782366
import time import numpy as np from matplotlib import pyplot as plt from numba import jit, prange from scipy.sparse import csr_matrix from importlib import reload import params reload(params) from params import * from subprocess import call from os import listdir #{{{ Timer, initialize, integrate over electrons, plot ...
livelyke/ICWF_python
functions.py
functions.py
py
47,083
python
en
code
0
github-code
13
69852407378
from lib import * from material import * from sphere import * from math import pi, tan from intersect import * from light import * import random BLACK = color(0, 0, 0) WHITE = color(255, 255, 255) BACKGROUND = color(200, 200, 190) MAX_RECURSION_DEPTH = 3 class Raycaster(object): def __init__(self, width, height): ...
Crismaria11/Proyecto2_Graficas
Lab3/ray.py
ray.py
py
6,150
python
en
code
0
github-code
13
21397096723
from django.urls import path from django.urls.conf import include from .views import register, recipe, step, next_step, change_sender, current_step, reset urlpatterns = [ path('register/', register, name='register'), path('step/', step, name='step'), path('next_step/', next_step, name='next_step'), path('change_se...
fuurin/tebula
tebula/urls.py
urls.py
py
512
python
en
code
1
github-code
13
5940324443
from actions import EmailAction def main(): # Replace with a valid recipient email address email_address = "aubnmaiml@gmail.com" # Create an instance of EmailAction email_action = EmailAction() # Call the send_email function and check the result result = email_action.send_email(emai...
itsashwanianand/Sending-Automated-mail--RASA-
Rasa_Projects/install_demo/actions/email_test.py
email_test.py
py
486
python
en
code
0
github-code
13
40837602879
import discord import logging from discord.ext import commands # Log SetUp logging.basicConfig(level=logging.INFO, filename='bot.log', filemode="w") class Basics(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def Help(self, ctx): embed = discord.E...
Viri0x/DiscordBot
cogs/basics.py
basics.py
py
2,024
python
en
code
0
github-code
13
15236515112
import stackusingarray.ArrayStack def is_matched(string): left = '({[' right = ')}]' S = stackusingarray.ArrayStack.ArrayStack() for c in string: if c in left: S.push(c) elif c in right: if S.is_empty(): return False elif right.index(...
nssathish/python-dsa
stack/MatchingParenthesis.py
MatchingParenthesis.py
py
547
python
en
code
0
github-code
13
74564861138
#!/usr/bin/env python """ _File_t_ Unit tests for the WMBS File class. """ from builtins import range import threading import unittest import nose from WMCore.DAOFactory import DAOFactory from WMCore.DataStructs.Run import Run from WMCore.Services.UUIDLib import makeUUID from WMCore.WMBS.File import File from WMQua...
dmwm/WMCore
test/python/WMCore_t/WMBS_t/CursorLeak_t.py
CursorLeak_t.py
py
3,717
python
en
code
44
github-code
13
36077890175
#conding = utf-8 #author : You Zhang from distutils.core import setup import py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 1 } } setup( options = options, zipfile=None, console=[{"script": "dataTrace_v3.py", "icon_resources": [(0, "asset\...
YouZhang/LTESystemTest
dataTracer/setup.py
setup.py
py
346
python
en
code
0
github-code
13
42855143231
from django.core.validators import MinLengthValidator from django.db import models from django.utils.translation import gettext_lazy as _ from ..flower.models import Product from shared.mixins.model_utils import CreatedUpdateMixins class Recommendation(CreatedUpdateMixins): """ Recommendation model attri...
Sergey-sg/flowers_shop
backend/apps/recommendation/models.py
models.py
py
1,381
python
en
code
0
github-code
13
20380811935
import mbuild as mb class B(mb.Compound): """An coarse grained particle called B(arbitrarily) with two ports one facing up and one facing down.""" mass = 1.0 def __init__(self): super(B, self).__init__() self.add(mb.Particle(name='B')) self.add(mb.Port(anchor=self[0]), 'up') ...
palmertr/epoxpy
epoxpy/lib/b.py
b.py
py
465
python
en
code
0
github-code
13
18275453946
#!/usr/bin/env python import elasticsearch import json import logging import sys import copy from apscheduler.scheduler import Scheduler from collections import Counter from assemblyline.common.isotime import now_as_iso from assemblyline.al.common import forge, log as al_log from assemblyline.al.common.queue import C...
deeptechlabs/cyberweapons
assemblyline/assemblyline/al/run/admin/metricsd.py
metricsd.py
py
5,947
python
en
code
78
github-code
13
8012748764
from django.shortcuts import render, redirect from numpy import array from .models import Prescription, Approval, CustomerPrescription from django.http import JsonResponse import json from .utils import viewAnnotation, scrapeMedicineImage, sendTextWhatsapp import boto3 from .utils import convert,calculateConfidence,is...
adityarajsahu/Medecoder
prescription/views.py
views.py
py
21,675
python
en
code
0
github-code
13
33419177566
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager import time # Webs...
mwzheng/autoTypingTest
10FastFingers.py
10FastFingers.py
py
1,465
python
en
code
0
github-code
13
20126841066
import graphics.engine from math import pi as PI MODEL = 0 if MODEL == 0: PATH = "C:/Users/robin/Documents/Projects/OXYTOCIN 3D/models/Oxytocin.txt" FORMAT = {'atom': {'len': 70, 'type':31, 'indices':{0:[3, 10], 1:[13, 20], 2:[23, 30]}}, 'bond': {'len': 19, 'indices': {0: [0, 3], 1: [3, 6]...
RobinAnne/SimplePython3DMoleculeRenderer
deprecated/oxytocin_old.py
oxytocin_old.py
py
10,473
python
en
code
0
github-code
13
45352587754
class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) <= 1: return sum(nums) def rob(nums): prev = now = 0 for n in nums: now, prev = max(prev + n, now) retur...
zh0uquan/LeetcodePractice
Leetcode213.py
Leetcode213.py
py
414
python
en
code
0
github-code
13
4970348103
s = input() t = input() n = len(s) made = [False] * n d = dict() for c in t: if c in d: d[c] += 1 else: d[c] = 1 yays = whoops = 0 for i in range(n): if s[i] in d and d[s[i]] > 0: d[s[i]] -= 1 yays += 1 made[i] = True for i in range(n): i...
truclycs/code_for_fun
algorithms/python/python_blue/L15/B._Tanya_and_Postcard.py
B._Tanya_and_Postcard.py
py
599
python
en
code
7
github-code
13
39732424554
# -*- coding: utf-8 -*- import requests import random import string from lxml import html as xhtml from selenium import webdriver douban_dict = { 'search_url': 'https://movie.douban.com/subject_search?search_text=', 'search_result_page_filter': '//div[starts-with(@class, "sc-bZQynM")][1]/div/a/@href', 'mo...
chadschan163/DoubanMoviePostSniffer
doubanMoviePost.py
doubanMoviePost.py
py
3,488
python
en
code
2
github-code
13
2699971861
import calendar import datetime import unittest def get_total_days_from(first, last): days_in_period = last - first first_day_of_period = datetime.timedelta(days=1) return (days_in_period + first_day_of_period).days def get_days_of_month(date): # recomment to __ _, days_in_month = calendar.month...
saowaluck/Budget
Budget.py
Budget.py
py
3,380
python
en
code
0
github-code
13
32875695255
import numpy as np import torch.nn as nn import torch from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader, TensorDataset import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec print('ANN Model \n') print(f"PyTorch version: {torch.__version__}") # Check PyTorch ...
PatrickDabkowski/Bark-Recognition
ANN_Model.py
ANN_Model.py
py
4,123
python
en
code
0
github-code
13
11125684202
from rest_framework import serializers from django.db import connection from .models import DynamicModel class TableUpdateSerializer(serializers.Serializer): field_types = serializers.ListField(child=serializers.CharField()) field_titles = serializers.ListField(child=serializers.CharField()) def validate...
emisgrg/table_builder
table_builder_app/serializers.py
serializers.py
py
2,068
python
en
code
0
github-code
13
16070192037
import multiprocessing import time def sleep(x): print(f'Sleeping for {x} seconds....') time.sleep(x) print(f'Done sleeping for {x} seconds!') def main(): start = time.perf_counter() p1 = multiprocessing.Process(target=sleep, args=[1.5]) p2 = multiprocessing.Process(target=sleep, args=[1.5]) ...
sejin8642/gitpractice
scripts/mp.py
mp.py
py
480
python
en
code
0
github-code
13
34155118333
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup class Headers: def __init__(self, headers): self._headers = headers def has_xframe_defence(self): try: xframe = self._headers['X-Frame-Options'] return True except: return False def has_hst...
security-analyzer/core
scanners/defense_mechanisms/Headers.py
Headers.py
py
1,493
python
en
code
10
github-code
13
17382029520
import numpy as np from scipy.ndimage.filters import convolve def energyRGB(image): ''' Function calculates the energy of an RGB image Parameters: image: RGB image Returns: res: Energy of the image ''' res = energyGrey(image[:,:,0]) + energyGrey(image[:,:,1])...
PabitraBansal/Content-Aware-Image-Resizing
energy.py
energy.py
py
1,030
python
en
code
0
github-code
13
6454407657
import json import time import datetime import requests import os import boto3 def lambda_handler(event, context): # connect to the table AIRTABLE_BASE_ID = 'appYQAU5CcytTTkKs' AIRTABLE_NAME = 'MainTable' API_KEY = 'keyrT0V59Ejlc9JaH' #create url for connect_ END_POINT = f'https://api.airtabl...
Tkachmaxim/aws_lambda_boto3
hello_world/app.py
app.py
py
2,202
python
en
code
0
github-code
13
15340553741
class HyperParameters: """ Hyperparameters configuration class where all vars are defined """ def __init__(self, model_name_, vocab, label_vocab, embeddings_, batch_size_): self.model_name = model_name_ self.vocab_size = len(vocab) if vocab else "Using AutoTokenizer's vocab" self...
elsheikh21/cross-natural-language-inference
hw3/stud/models/hyperparams.py
hyperparams.py
py
1,257
python
en
code
2
github-code
13
32276602563
# exercise 157: Both Letter Grades and Grade Points from decision_making.ex52_bis import lett_to_point from decision_making.ex53_bis import point_to_lett def grade_converter(value): try: res = point_to_lett(value) return res except: try: res = lett_to_point(value) ...
sara-kassani/1000_Python_example
books/Python Workbook/files_and_exceptions/ex157.py
ex157.py
py
812
python
en
code
1
github-code
13
23081472406
""" Last modified 1/9/2022 Extend sequences to include surrounding genomic context Example usage: ## python data_scripts/extend_introns.py ../database/introns/standard_allsize_min_50_max_600/base_info.dat ../database/introns/standard_allsize_min_50_max_600_extend20/ 20 """ import sys import os from config import DATAB...
ramyarangan/pre-mRNA_SecStruct
src/data_scripts/extend_introns.py
extend_introns.py
py
2,456
python
en
code
0
github-code
13
7726906677
# Credits: assets from DeathsbreedGames organization (http://deathsbreedgames.github.io/) import pygame as pg from pygame.locals import QUIT from ball import Ball from racket import Racket from ia import IA from scoreboard import Scoredboard # Constantes para la inicialización de la superficie de dibujo WIDTH = 800 ...
Miguel-99/Pong-Game
main.py
main.py
py
2,428
python
en
code
0
github-code
13
21928417353
import sys input = sys.stdin.readline T = int(input()) years = [] for _ in range(T): start, end = map(int, input().split()) years.append([start, end]) sweep_line = [] for s, e in years: sweep_line.append([s, -1, 1]) sweep_line.append([e, 1, -1]) sweep_line.sort() print(sweep_line) overlap = 0 ans...
dyabk/competitive-programming
Prologin/back_to_the_future.py
back_to_the_future.py
py
452
python
en
code
0
github-code
13
42070809361
# -*- coding: UTF-8 -*- import re import sys import os file_name = sys.argv[1] # Collect the text, footnotes and footnote order in separate lists text_by_lines = [] footnotes = [] fnotes_order = [] # Go over file, look for markup for footnotes and sort to lists with open(file_name, 'r') as fi: ilines = fi.readl...
questoph/lifehacks
sort-footnotes/sort_MD_footnotes.py
sort_MD_footnotes.py
py
1,655
python
en
code
0
github-code
13
37176983824
""" This file contains utility functions that improve the usage of MARGE. make_dir: Creates a directory if it does not already exist. limit_mem: Sets a limit on the amount of memory the program can use. Not currently used by MARGE. get_free_mem: Gets the amount of free memory on the system. ...
exosports/MARGE
lib/utils.py
utils.py
py
15,431
python
en
code
7
github-code
13
32846844906
import os import pandas as pd from datetime import datetime, timedelta def read_csv_file(file_path): try: return pd.read_csv(file_path) except FileNotFoundError: print(f"Error: {file_path} not found.") exit(1) except pd.errors.EmptyDataError: print(f"Error: {file_...
freekillgr/Scheduler_on_clinic
Schedule_calculator.py
Schedule_calculator.py
py
7,141
python
en
code
0
github-code
13
36588209986
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: # similar to 1227 CountSquareSubmatriceswithAllOnes if not matrix: return 0 m, n = len(matrix), len(matrix[0]) dp = [[0 for _ in range(n)] for _ in range(m)] max_len = 0 for i in rang...
ysonggit/leetcode_python
0221_MaximalSquare.py
0221_MaximalSquare.py
py
638
python
en
code
1
github-code
13
24518693673
#!/usr/bin/env python3 """ Test for FileStorage module """ from models.engine.file_storage import FileStorage from models.base_model import BaseModel import datetime import unittest import models from models.city import City class TestStorage(unittest.TestCase): """ Testing FileStorage class """ de...
Oluwamarcellus/AirBnB_test_repo
tests/test_models/test_engine/test_file_storage.py
test_file_storage.py
py
1,430
python
en
code
0
github-code
13
70486567058
import discord from discord.ext import commands import random import json import urllib.request j_file = open("divinesecrets.txt") vari = json.load(j_file) j_file.close() tkey = vari["tenorkey"] class emotes(commands.Cog): def __init__(self, bot): self.bot = bot # self.member = member @comma...
Arg0naut18/NSB
cogs/emotes.py
emotes.py
py
12,064
python
en
code
2
github-code
13
27629538984
import logging import os import random import torch import dgl import pytorch_lightning as pl from src.datamodules.datasets.graph_dataset import GraphDataset from src.datamodules.datasets.dgl_dataset import MyDGLDataset from src.datamodules.samplers.dgl_sampler import MyKNNMultiLayerNeighborSampler from dgl.dataloading...
ericcombiolab/stDyer
src/datamodules/gmvae_datamodule.py
gmvae_datamodule.py
py
14,119
python
en
code
1
github-code
13
35362245261
#!/usr/bin/env python # coding: utf-8 # In[1]: # User Instructions # #The following code provides the filtering, planning, localization, smoothing functions # for a robots moving in a 2 dimmentional grid as provided # from math import * import random from Class_plan import plan from Robot_Class import robot from ...
botAshar/Robot-car
Robot_Car.py
Robot_Car.py
py
3,417
python
en
code
0
github-code
13
729528220
import os from gensim.models.doc2vec import Doc2Vec import time from doc2vec_helper import DocumentsIterator, EpochLogger outdir = '/data/doc2vec/' # Choose hyperparameters params = {'window': 2, # max distance between current word and predicted word 'min_count': 2, # minimum number of occurrences of word...
alan-turing-institute/DSG-TNA-UKGWA
src/doc2vec.py
doc2vec.py
py
1,450
python
en
code
2
github-code
13
23099554586
from typing import Tuple import time def categorizeTag(word: str) -> tuple: # Remove case where there is only a symbol # or @ in the word if len(word) <= 1: return [None, word] if word.find('#') == 0: return ['category', word[1:]] if word.find('@') == 0: return ['person', word[1...
Nicochung/python-event-log
helper.py
helper.py
py
1,594
python
en
code
0
github-code
13
24684860459
#!/usr/bin/env python # coding: utf-8 # 1.Write a Python Program to Add Two Matrices? # In[9]: matrix1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] matrix2 = [[10, 11, 12], [13, 14, 15], [16, 17, 18]] result_matrix = [[0, 0, 0], [0, 0, 0], [0, 0...
Rajn013/ASSIGNMENT-08PROGRAMMING
Untitled40.py
Untitled40.py
py
1,568
python
en
code
0
github-code
13