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
43252746752
import pyautogui import pygame from pynput.mouse import Button from protocols.my_protocol import send as my_send def convert_button(button): if button == Button.left: return 'left' elif button == Button.right: return 'right' else: return 'middle' class Mouse: ...
leosegol/TeamViewer
mouse_funcs/mouse.py
mouse.py
py
1,421
python
en
code
2
github-code
13
31230015126
import unittest from unittest.mock import patch import src.margin.margin_lookup from src.margin.margin_processor import MarginProcessor from src.tests.fixtures.margin.test_utils import TestUtils class TestMarginProcess(unittest.TestCase): def setUp(self) -> None: processing_date = 20230429 self.o...
mxcheung/margin-py
src/tests/margin/test_margin_processor.py
test_margin_processor.py
py
1,315
python
en
code
0
github-code
13
14890228911
import heapq BUY = 0 SELL = 1 GOLD = 0 SILVER = 1 def solution(req_id, req_info): reqs = [[], []] diffs = {} for id in req_id: diffs[id] = [0, 0] for i, req in enumerate(req_info): # 판매자 등록 if req[0] == SELL: type_, sell_amount, sell_price = req whil...
jkjan/PS
Line/6.py
6.py
py
2,996
python
en
code
0
github-code
13
70502494738
from django.test import TestCase from src.shared.errors.AppError import AppError from src.utils.error_messages import DEPARTMENT_NOT_FOUND ,DEPARTMENT_ALREADY_EXISTS from ....repositories.departments_repository import DepartmentsRepository from ...update_department.update_department_use_case import UpdateDepartmentUseC...
alyssonbarrera/enterprise-management-api
src/modules/departments/use_cases/update_department/tests/test_update_department_use_case.py
test_update_department_use_case.py
py
2,480
python
en
code
0
github-code
13
14399435639
from enum import Enum class Cmp(Enum): LESS = 1 EQUAL = 2 GREATER = 3 class Signal: def __init__(self, signal): self.signal = signal def __lt__(self, other): return less(self.signal, other.signal) == Cmp.LESS def __eq__(self, other): return self.signal == other.signa...
batconjurer/adventofcode
aoc2022/day13/main.py
main.py
py
2,115
python
en
code
0
github-code
13
37846586695
import math import sys import pandas as pd import yfinance as yf ''' The original equation for finding the intrinsic value of a stock (Benjamin Graham) ''' def intrinsic_value_equation_original(eps, growth_rate, current_corporate_bonds_yield): base_no_growth = 8.5 average_corporate_bonds_yield = 4.4 intrinsic_valu...
damonsward/intrinsic_value_calculator
calculator.py
calculator.py
py
3,597
python
en
code
0
github-code
13
18541104797
import scrapy from scrapy.http import FormRequest from ..items import FooddataspiderItem class QuoteSpider(scrapy.Spider): name = 'quotes' allowed_domains = ['quotes.toscrape.com'] start_urls = [ 'http://quotes.toscrape.com' ] def parse(self, response, **kwargs): quotes = response...
naruavi/zomatoSpider
foodDataSpider/foodDataSpider/spiders/quote_spider.py
quote_spider.py
py
1,323
python
en
code
0
github-code
13
40690809582
#!/usr/bin/python """ Add docstring here """ from flask import request from flask_restful_swagger_2 import Resource, swagger from mongoalchemy.exceptions import ExtraValueException from qube.src.api.decorators import login_required from qube.src.api.swagger_models.omartestpy import omartestpyModel # noqa: ignore=I100 ...
qubeomar/omartestpy
qube/src/api/omartestpycontroller.py
omartestpycontroller.py
py
6,437
python
en
code
0
github-code
13
42091982349
import matplotlib.pyplot as plt import numpy as np import networkx as nx numNeurons = 50 steps = 1 dtMat = .025 *np.ones((numNeurons, 1), dtype=np.float32) aMat = .02*np.ones((numNeurons, 1), dtype=np.float32) bMat = .2*np.ones((numNeurons, 1), dtype=np.float32) cMat = -65. * np.ones((numNeurons, 1), dtype=np.float32...
kwcooper/CogSimulations
neuralNets/izhikevichModel/network/ichNetKV2.py
ichNetKV2.py
py
1,946
python
en
code
3
github-code
13
11586324994
#!/bin/env python3 # Evan Widloski - 2020-03-28 # test registration on upscaled AIA data from skimage.transform import resize from mas.strand_generator import StrandVideo, get_visors_noise from mas.tracking import guizar_multiframe, correlate_and_sum, shift_and_sum, guizar_upsample from mas.misc import combination_exp...
UIUC-SINE/old_website
content/reports/2020-03-28_aia/main.py
main.py
py
2,332
python
en
code
1
github-code
13
43912200255
def DataBundlePurchase(true_pin, balance): print('Welcome to The Phone People!') try: if pin_attempts(true_pin): if menu(balance) == 1: return True, balance elif pin_attempts(true_pin) == False: return 'Your account has been locked, please contact us at 02...
mabely/module3
ch02_validation/data_bundle_validation.py
data_bundle_validation.py
py
3,076
python
en
code
0
github-code
13
32812281281
import numpy as np import time import string import torch import os from main.objects.Config import Config from main.objects.Batcher import Batcher from main.objects.Vocab import Vocab from main.objects.Tokenizer import Char from main.objects.Scorer import Scorer from main.objects.Writer import Writer ''' Evaluator o...
iesl/stance
src/main/objects/Evaluator.py
Evaluator.py
py
3,250
python
en
code
32
github-code
13
40445188472
def slices(series, length): results = [] if length == 0: return 1 elif len(series) == 0 or length < 0 or len(series) < length: raise ValueError("The series needs to have more than one element, \ the size needs to be a positive number and shorter than \ the length of the serie...
CatalinPetre/Exercism
python/largest-series-product/largest_series_product.py
largest_series_product.py
py
829
python
en
code
0
github-code
13
74564217938
#!/usr/bin/env python """ _SetPhEDExStatus_ MySQL implementation of DBSBufferFiles.SetPhEDExStatus """ from WMCore.Database.DBFormatter import DBFormatter class SetPhEDExStatus(DBFormatter): sql = "UPDATE dbsbuffer_file SET in_phedex = :status WHERE lfn = :lfn" def execute(self, lfns, status, conn = None, t...
dmwm/WMCore
src/python/WMComponent/DBS3Buffer/MySQL/DBSBufferFiles/SetPhEDExStatus.py
SetPhEDExStatus.py
py
696
python
en
code
44
github-code
13
33178352537
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import dlite thisdir = os.path.abspath(os.path.dirname(__file__)) class Person: def __init__(self, name, age, skills): self.name = name self.age = age self.skills = skills def __repr__(self): return 'Person(%r, %r, %r)'...
DanielHoeche/dlite-MOM
bindings/python/tests/test_factory.py
test_factory.py
py
950
python
en
code
0
github-code
13
8591163514
# %% from sklearn.datasets import load_iris from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import pandas as pd import matplotlib.pyplot as plt # %% iris = load_iris() y = pd.DataFrame(dict(label=iris.target)) X = pd.D...
greysweater42/cookbook
scratchpad/lime/iris.py
iris.py
py
1,449
python
en
code
0
github-code
13
16127841423
#!/usr/bin/python3 """ Purpose: Calculating the HCF/GCD between two numbers HCF - Highest Common Factor """ first_number = int(input("Enter the first number: ")) second_number = int(input("Enter the second number: ")) hcf = min(first_number, second_number) while first_number % hcf != 0 or second_number % hcf != ...
udhayprakash/PythonMaterial
python3/03_Language_Components/09_Loops/p_hcf.py
p_hcf.py
py
440
python
en
code
7
github-code
13
40716787014
#Faça um programa que leia um número inteiro e # diga se ele é ou não um número primo. n = int(input('Digite um número: ')) c = 0 if n == 1: c += 1 while n < 0: print('Digite um número válido: ') n = int(input('Digite um número inteiro: ')) for x in range(1, n+1): if n % x == 0: print('\033[33m'...
felipesch92/PythonExercicios
ex052.py
ex052.py
py
563
python
pt
code
0
github-code
13
42007443638
import argparse name = "anagram" class AnagramTester: def anagram_test(self, string1: str, string2: str) -> bool: string1 = self._remove_non_alphanumerics(string1.lower()) string2 = self._remove_non_alphanumerics(string2.lower()) string1_dict = {} string2_dict = {} for ch...
LaurenJWeber/problem-solving
anagram-tester/anagram.py
anagram.py
py
1,452
python
en
code
0
github-code
13
10006321213
#!/usr/bin/env python ''' DAVID LETTIER (C) 2015. http://www.lettier.com/ Slackotron ''' import sys import os import subprocess import signal import time from lib.scribe import Scribe class DashboardManager(Scribe, object): def start(self): cwd = os.path.dirname(os.path.realpath(__file__)) sys....
lettier/slackotron
src/dashboard/dashboard_manager.py
dashboard_manager.py
py
1,153
python
en
code
16
github-code
13
13092916170
from __future__ import annotations import string import wx class NumberValidator(wx.Validator): def __init__(self) -> None: super(NumberValidator, self).__init__() self.Bind(wx.EVT_CHAR, self.OnChar_) def Clone(self) -> NumberValidator: return NumberValidator() def Validate(self...
JiveHelix/pex
python/pex/wx/utility/number_validator.py
number_validator.py
py
961
python
en
code
0
github-code
13
71329041617
from logging.config import valid_ident from flask import request, render_template import ttlsap.fab_proc as fab_proc import ttlsap.edc_data as edc_data import ttlsap.edc_dim as edc_dim import ttlsap.spc_dim as spc_dim from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from tools.r...
eslywadan/dataservice
tools/request_handler.py
request_handler.py
py
11,164
python
en
code
0
github-code
13
27301434115
import json import math import os import torch from argparse import ArgumentParser from datasets import load_metric from helpers.asr import ( configure_lm, configure_w2v2_for_training, DataCollatorCTCWithPadding, dataset_from_dict, get_metrics_computer, preprocess_text, process_data ) from ...
CoEDL/vad-sli-asr
scripts/train_asr-by-w2v2-ft.py
train_asr-by-w2v2-ft.py
py
4,228
python
en
code
18
github-code
13
14463317752
import time from abc import ABC, abstractclassmethod, abstractmethod from copy import copy from typing import Iterable, Union import numpy as np from neuroaiengines.utils.angles import wrap_pi from neuroaiengines.utils.transforms import * from numpy import cos, pi, sin from scipy.interpolate import interp1d from scipy....
aplbrain/seismic
neuroaiengines/optimization/simulator.py
simulator.py
py
21,181
python
en
code
0
github-code
13
327717541
from pathlib import Path from operator import attrgetter class Node: def __init__(self, height_char): height = ord(height_char) - ord("a") self.height = height self.tentative_distance = float("inf") self.connections = [] def add_connection(self, node): if node.height >...
grey-area/advent-of-code-2022-copilot
day12/part2.py
part2.py
py
2,561
python
en
code
1
github-code
13
31681547664
# Homework No.14 Exercise No.2 # File Name: echo_server.py # Programmer: Kostyantyn Shumishyn # Date: December 3, 2017 # # Problem Statement: Create a Server Class # Imports import socket from hw14project2.Stack import * # Reverses a String using an Implemented Stack Class cause why not def reverseS...
Kshumishyn/Python
Homework #14/hw14project2/echo_server.py
echo_server.py
py
1,763
python
en
code
0
github-code
13
33116697734
import uvicorn from api.v1.routes import router from core.auth import security_jwt_local, security_jwt_remote from fastapi import Depends, FastAPI app = FastAPI() @app.get('/') async def root(): return {'message': 'Hello World'} app.include_router( router, prefix='/api/v1', tags=['Пользователи из с...
RomanAVolodin/AuthServiceFastAPI_gRPCServer
api_simple/main.py
main.py
py
944
python
ru
code
0
github-code
13
43263485332
from itertools import product a, b, c, d, e, f = map(int, input().split()) lima = [100 * a * i for i in range(f // (100 * a) + 1)] limb = [100 * b * i for i in range(f // (100 * b) + 1)] setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f]) limc = [c * i for i in range(f // c + 1)] limd = [d * i for i...
Shirohi-git/AtCoder
arc081-/arc083_a.py
arc083_a.py
py
611
python
en
code
2
github-code
13
39597951545
import math import random import argparse import sys import os import xml.etree.ElementTree as xtree __author__ = 'Christian Rosentreter' __version__ = '1.7' __all__ = ['SVGArcPathSegment'] class SVGArcPathSegment(): """An 'arc' SVG path segment.""" def __init__(self, offset=0.0, angle=90.0, radius=1.0, x=...
the-real-tokai/macuahuitl
comitl.py
comitl.py
py
10,705
python
en
code
73
github-code
13
35598830763
# interface with ESP-32 maze stepper motor board over Serial import serial import yaml from utils import * import time class motor_interface(object): esp32 = None target = [0, 0] angle_string = '<0,0>' motor_on = '1' motor_off = '0' conf_file = config_files['serial'] conn_settings = None ...
Andrey-Korn/marble-maze
src/motor_interface.py
motor_interface.py
py
1,731
python
en
code
0
github-code
13
22031549453
# # SPDX-License-Identifier: Apache-2.0 # import logging import socket import os from random import sample from django.core.exceptions import ObjectDoesNotExist from api.models import Port, Node, Agent CLUSTER_PORT_START = int(os.getenv("CLUSTER_PORT_START", 7050)) MAX_RETRY = 100 LOG = logging.getLogger(__name__) ...
hyperledger/cello
src/api-engine/api/utils/port_picker.py
port_picker.py
py
3,289
python
en
code
862
github-code
13
17047458274
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.AlCollectionCreateDebtDTO import AlCollectionCreateDebtDTO from alipay.aop.api.domain.AlCollectionReceiveBaseInfoDTO import AlCollectionReceiveBaseInfoDTO from alipay.aop.api.domain...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AntLinkeAlcollectioncenterCreateModel.py
AntLinkeAlcollectioncenterCreateModel.py
py
5,962
python
en
code
241
github-code
13
16988329194
#!/usr/bin/env python # -*- coding: utf-8 -*- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This file is released under BSD 2-clause license. from __future__ import unicode_literals import os import datetime import shutil import yaml import config class PostManager(object): ...
Nehzilrz/nehzilrz.github.io
tools/manager.py
manager.py
py
3,683
python
en
code
1
github-code
13
3047232031
import core.tree as tree import lib.lza.lza as l import core.acl as acl import core.users as users from schema.schema import getMetaType from core.translation import lang, t from utils.utils import dec_entry_log from core.transition import httpstatus @dec_entry_log def getContent(req, ids): user = users.getUserF...
hibozzy/mediatum
web/edit/modules/lza.py
lza.py
py
3,083
python
en
code
null
github-code
13
10669465587
import unittest from selenium import webdriver from selenium.webdriver.firefox import firefox_binary from multiprocessing import Process import socket import shutil import os import gnupg import urllib2 import sys os.environ['SECUREDROP_ENV'] = 'test' import config import source import journalist import test_setup im...
emccallum/securedrop
securedrop/tests/functional/functional_test.py
functional_test.py
py
2,396
python
en
code
null
github-code
13
7684036250
''' Proyecto [Python] ----------------------------- Autor: Damian Safdie Version: 1.0 ''' import csv def generar_id(archivo): with open(archivo, 'r') as csvarch: data = list(csv.DictReader(csvarch)) if len(data) > 0: ultima_fila = data[-1] ultimo_id = int(ultima_fila.get...
Damisaf/proyecto
qatar.py
qatar.py
py
9,152
python
es
code
0
github-code
13
2363528371
#!/usr/bin/env python # encoding: utf-8 # @author: liusir # @file: run_all_cases.py # @time: 2020/5/8 9:37 下午 import os import time import unittest # import HTMLTestRunner from utils import HTMLTestReportCN from utils.config_utils import local_config def get_testsuite(): discover = unittest.defaultTestLoader.disc...
chaoabc/Api_Test_Line_Frame
run_all_cases.py
run_all_cases.py
py
1,644
python
en
code
0
github-code
13
26693553485
#데이터 불러오기 (menu_clean.csv) from modules import get_csv_to_list data = get_csv_to_list("menu_new") print(len(data)) drink = [ "망고에이드", "유자에이드", "아몬드우유", "레몬에이드", "청포도에이드", "딸기에이드", "자두에이드", "오미자에이드", "파워에이드", "블루레몬에이드", "청귤에이드", "체리에이드", "배쥬스", "사과쥬스", "복숭아아이스티", "오미자쥬스", "블루베리쥬스", "알로에쥬스", "캐플쥬스", "토마토쥬스", "요거풋풋사과쥬스...
yuni0725/school-meal-analysis
classify.py
classify.py
py
2,294
python
ko
code
0
github-code
13
17053946554
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class JsonParamDemo(object): def __init__(self): self._array_param = None self._bool_param = None self._date_param = None self._datetime = None self._num_param =...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/JsonParamDemo.py
JsonParamDemo.py
py
3,675
python
en
code
241
github-code
13
70556271698
import os import re from Action import Action from common.VerificationSuite import VerificationSuiteAction # CoreMark class A117215(VerificationSuiteAction): def __init__(self, data): VerificationSuiteAction.__init__(self, data) self.actionid = 117215 self.name = "CoreMark" def verify_template(self):...
MIPS/overtest
action/A117215.py
A117215.py
py
1,286
python
en
code
0
github-code
13
33566349959
import subprocess import os import sys import locale # extra supybot libs. import supybot.conf as conf # supybot libs. import supybot.utils as utils from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks try: from supybot.i18n impor...
andrewtryder/GitPull
plugin.py
plugin.py
py
3,994
python
en
code
0
github-code
13
39118294951
import logging from pprint import pprint # noqa from banal import ensure_list from aleph.core import db from aleph.model import DocumentRecord, Document from aleph.index.entities import index_operation from aleph.index.indexes import entities_read_index, entities_index_list from aleph.index.util import INDEX_MAX_LEN,...
ATADDATALOG/test-repo
aleph/index/documents.py
documents.py
py
3,166
python
en
code
0
github-code
13
26172457354
from functools import reduce # TimeComplexity wiki # https://wiki.python.org/moin/TimeComplexity def array_of_array_products_brute(ary: list) -> list: res: list = list() arr_len = len(ary) if arr_len == 0 or arr_len == 1: return [] for i in range(0, len(ary)): product = 1 fo...
drewnix/algo
algo/py/pramp/array_of_array_products/array_of_array_products.py
array_of_array_products.py
py
1,370
python
en
code
1
github-code
13
38439285067
import os import json import requests import traceback from libs.config import config from azure.cognitiveservices.vision.computervision import ComputerVisionClient from msrest.authentication import CognitiveServicesCredentials class Microsoft: def __init__(self): self.name = 'Microsoft' self.en...
mobiusml/benchmark_competition
libs/microsoft.py
microsoft.py
py
1,535
python
en
code
2
github-code
13
10789116590
import json from flask_classful import FlaskView, route from flask import render_template, jsonify, request, session, redirect, url_for, flash from source.WarstwaBiznesowa.PosrednikBazyDanych import PosrednikBazyDanych from source.WarstwaBiznesowa.KontroleryModeli.KontrolerModeluInterface import TypModelu from source....
danielswietlik/WypozyczalniaSalKonferencyjnych
source/WarstwaPrezentacji/KontroleryWidokow/WidokKontaPrywatnego.py
WidokKontaPrywatnego.py
py
12,165
python
pl
code
0
github-code
13
31279392769
# Configurations de la base de données # Importation du module os pour manipuler les chemins de fichiers import os # Obtention du chemin absolu du dossier actuel BASE_DIR = os.path.abspath(os.path.dirname(__file__)) # Chemin complet du fichier SQLite dans le dossier "static" DATABASE_PATH = os.path.join(BASE_DIR, '....
Math94550/Projet_vente_avion_CMMP
config/database.py
database.py
py
539
python
fr
code
0
github-code
13
30634521649
''' Write a script in python to find factorial of a number 4! = 1 X 2 X 3 X 4 = 24 7! = 1 X 2 X 3 X 4 X 5 X 6 X 7 = ''' num = int(input("Enter a number ? ")) fact = 1 for i in range(1, num+1): fact *= i print(f"Factorial of {num} is {fact}")
ajaybhatia/programming-in-python-session-2020
ex04.py
ex04.py
py
250
python
en
code
1
github-code
13
42630006369
import rosbag import numpy as np import pandas as pd import matplotlib.pyplot as plt bag = rosbag.Bag('2020-10-27-16-32-15.bag') #get the data from the rosbag and store it in variable "bag" topics = bag.get_type_and_topic_info()[1].keys() #get topic and type from bag and store it in variable "topic" #print(topics) #u...
paulavillafulton/EMG_MYO_ROS_NeuroInspiredSystemEngineering
paula-myo-ros/data/bagToCSV.py
bagToCSV.py
py
1,877
python
en
code
0
github-code
13
71435645459
def firstDuplicate(a): d = [None] * len(a) min_idx = len(a) first_duplicate = -1 for i in range(len(a)): if d[a[i] - 1]: if i < min_idx: min_idx = i first_duplicate = a[i] else: d[a[i] - 1] = True return first_duplicate def fir...
donrebel/codefights
interview/arrays.py
arrays.py
py
4,802
python
vi
code
0
github-code
13
18696315294
class Solution: def getCommon(self, nums1: List[int], nums2: List[int]) -> int: s1 = set(nums1) s2 = set(nums2) s3 = s1.intersection(s2) if len(s3) == 0: return -1 else: return min(s3)
mehkey/leetcode
python6/6300. Minimum Common Value.py
6300. Minimum Common Value.py
py
288
python
en
code
0
github-code
13
70726885459
#! python3 #findUrls.py -> find urls that begins with http:// ans https:// in a clipboard then clean it and sort it import re, pyperclip # urls finder Regex urlsRegex = re.compile( r''' (http[s]?:\/\/[\w+\.]?\w+\.\w+) ''' ...
ELGHAZAL-SAID/Make-it-easy-with-Python
RegexSmallProjects/findUrls.py
findUrls.py
py
2,140
python
en
code
2
github-code
13
34795653249
#!/usr/bin/env/python # File name : server.py # Production : PiCar-C # Website : www.adeept.com # Author : William # Date : 2019/11/21 import socket import threading import time import os import LED import move import servo import switch import RPIservo servo.servo_init() switch.switchSetup() switch...
adeept/adeept_picar-b
server/appserver.py
appserver.py
py
7,496
python
en
code
21
github-code
13
42409539541
n = int(input()) s = [] for i in range(n): t = list(map(int, input().split())) if t[0] == 1: s.append(t[1]) elif t[0] == 2: for j in range(min(t[2], s.count(t[1]))): s.remove(t[1]) else: print(max(s) - min(s))
ZicsX/CP-Solutions
C_-_Max_-_Min_Query.py
C_-_Max_-_Min_Query.py
py
262
python
en
code
0
github-code
13
22196335972
import pytest from linkml.generators.sqlddlgen import SQLDDLGenerator @pytest.mark.parametrize( "dialect", ["mssql+pyodbc", "sqlite+pysqlite", "mysql+pymysql", "postgresql+psycopg2"] ) def test_sqlddlgen(dialect, input_path, snapshot): PATH = input_path("issue_273.yaml") gen = SQLDDLGenerator(PATH, dial...
linkml/linkml
tests/test_issues/test_issue_273.py
test_issue_273.py
py
431
python
en
code
228
github-code
13
41331635025
from collective.grok import gs from Products.CMFCore.utils import getToolByName from zc.relation.interfaces import ICatalog from zope.component import getUtility from zope.app.intid.interfaces import IIntIds from z3c.relationfield.event import _relations, updateRelations # -*- extra stuff goes here -*- @gs.upgrades...
oikoumene/wcc.books
wcc/books/upgrades/handlers.py
handlers.py
py
1,742
python
en
code
0
github-code
13
3996748236
n,p,m = tuple([int(x) for x in input().split()]) # f = open("test.txt","r") # n,p,m = tuple([int(x) for x in f.readline().split()]) participants = {} winners = [] for i in range(n): participants[input()] = 0 # participants[f.readline().strip("\n")]=0 for i in range(m): person,point = tuple([x for x in input...
afnanmmir/Kattis
src/ArcadeBasketball.py
ArcadeBasketball.py
py
623
python
en
code
0
github-code
13
24141771061
from typing import Tuple, List def parse_instruction(inst: str) -> Tuple[str, int]: """ 'acc +1' -> ('acc', 1) 'jmp -3' -> ('jmp', -3) :param inst: :return: """ inst_splt = inst.split(' ') return inst_splt[0], int(inst_splt[1]) def nop(accum: int, pos: int, *args) -> Tuple[int, int]:...
ajaysgowda/adventofcode2020
day_8/day_8.py
day_8.py
py
3,409
python
en
code
0
github-code
13
5125445334
import sys N = int(input().strip()) a : list = [] dp = [0]*N answer = -1 for i in range(N): a.append(list(map(int, sys.stdin.readline().split()))) a.sort(key=lambda x:x[0]) for i in range(N): for j in range(i): if a[i][1] > a[j][1] and dp[i] < dp[j]: dp[i] = dp[j] dp[i]+=1 if ans...
JeongHooon-Lee/ps_python_rust
2022_2/2565.py
2565.py
py
371
python
en
code
0
github-code
13
30313997390
from flask_menu.classy import register_flaskview from wazo_ui.helpers.plugin import create_blueprint from wazo_ui.helpers.view import register_listing_url from .service import ( ConfBridgeGeneralSettingsService, FeaturesGeneralSettingsService, IaxGeneralSettingsService, PJSIPDocService, PJSIPGloba...
wazo-platform/wazo-ui
wazo_ui/plugins/general_settings/plugin.py
plugin.py
py
4,149
python
en
code
4
github-code
13
39153178781
import math import fractions # Напишите программу, которая принимает две строки вида “a/b” - дробь с числителем и знаменателем. # Программа должна возвращать сумму и произведение* дробей. Для проверки своего кода используйте модуль fractions. # Пример: # Ввод: # 1/2 # 1/3 # Вывод: # 5/6 1/6 PURPOSE_NUMERATOR = 0 PUR...
AngelinaSl/Python_lessons
Homeworks/Homework_2/Task_2.py
Task_2.py
py
3,447
python
ru
code
0
github-code
13
71823343379
from django.shortcuts import render_to_response, redirect from django.http import JsonResponse from .helpers import cheсk_login from django.core.context_processors import csrf from proposal.models import Tip, Vajnost, Status, User, Tema, ConfugurationOneC from proposal.serializers import TipSeriz, VajnostSeriz, StatusS...
Evgen-nychev/supportApp
support/views.py
views.py
py
1,553
python
en
code
0
github-code
13
31214386309
# Exercicio um # Python programa de linhas de uma sequência Fibonacci # Espiral desenhada usando Turtle import turtle import math # Função principal do desenho do Fibonacci def fiboPlot(n): a = 0 b = 1 quadrado_a = a quadrado_b = b # Configurar a cor do pincel x.pencolor("pink") # Desen...
danisimas/estcmp060
fibonacci_exercicio_um.py
fibonacci_exercicio_um.py
py
2,003
python
pt
code
0
github-code
13
18850013737
import tcod as T from items.Equipment import Equipment from common.modifiers.mod import Mod from common.utils import rand from common.modifiers.attrib_mod import * class Amulet(Equipment): ABSTRACT = True slot = 'n' art = 'amulet' glyph = '\'', T.gold class RavenAmulet(Amulet): name = 'amulet' ...
devapromix/troll-temple
src/items/amulets.py
amulets.py
py
2,559
python
en
code
2
github-code
13
25682245102
from cmu_112_graphics import * ################################################################################ # Player object controls player score and player input ################################################################################ class Player(object): def __init__(self, app, numKeys, cellWidth): ...
JohnYanxinLiu/112-Term-Project
Player.py
Player.py
py
2,858
python
en
code
0
github-code
13
41642650135
# Method: Replace each element with (num + rev(num)) and then Use Hashmap to count frequency # TC: O(n) # SC: O(n) from typing import List from collections import defaultdict class Solution: def countNicePairs(self, nums: List[int]) -> int: freq_map = defaultdict(int) res = 0 M...
ibatulanandjp/Leetcode
#1814_CountNicePairsInAnArray/solution1.py
solution1.py
py
693
python
en
code
1
github-code
13
26963876965
# -*- coding: utf-8 -*- """#####################################################################""" import gym env = gym.make("Taxi-v3").env env.render() """#####################################################################""" print("Total de Ações {}".format(env.action_space)) print("Total de Estados {}".forma...
Lawniet/Atividades-de-IA
Agents/Q-tables/Q_learning.py
Q_learning.py
py
5,053
python
pt
code
0
github-code
13
41005348588
import requests from common.phrases import SEND_FAILED from config import settings class MailerController: def send_url(self, email: str, url: str): try: result = requests.get( f"{settings.URL_MAILER}/send_code", params={"email": email, "url": url} ) if...
Vaynbaum/simple-messenger
backend/auth/controllers/mailer_controller.py
mailer_controller.py
py
1,192
python
en
code
1
github-code
13
19067325383
import random import pickle import numpy as np from collections import deque class Useful_Memory(): ''' 所有agent同步训练,它们拿到的replay应该是一样的 ''' def __init__(self, memory_size,batch_size): self.memory_size = memory_size self.batch_size = batch_size self.memory = self.create_memory_poo...
Zeii2024/RL
EmRL/memory_useful.py
memory_useful.py
py
1,582
python
en
code
0
github-code
13
19601720872
""" Aula 3 Expressões Lambda (Funções Anônimas) """ """ def funcSum(a, b): print(a + b) lambdaSum = lambda a, b: a + b lambda parameter_list: expression funcSum(2,5) print(lambdaSum(5,33)) """ lista = [ ['nome1', 22], ['nome2', 32], ['nome3', 52], ['nome4', 12], ['nome5', 72], ] def arruma(item): ...
joaoo-vittor/estudo-python
intermediario/aula-3.py
aula-3.py
py
469
python
pt
code
0
github-code
13
36520120704
#!/usr/bin/env python # coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from keras.layers import Dense, Input from keras.layers import Conv2D, Flatten, Lambda from keras.layers import Reshape, Conv2DTranspose, Concatenate from keras.models imp...
joshnroy/TransferLearningThesis
deepmindLab/temporal_vae.py
temporal_vae.py
py
13,281
python
en
code
0
github-code
13
19469370095
line_count = 0 sym_sum = 0 people_file = open('people.txt','r') errors_file = open("errors.log.txt", "w") while True: try: for i_line in people_file: line_count +=1 length = len(i_line) if i_line.endswith("\n"): length -= 1 if length < 3: ...
TurovD/Skillbox_Tasks
24_Exceptions/01_names_2/main.py
main.py
py
757
python
en
code
0
github-code
13
40054608543
''' 2. Procure o atributo idade para o usuário 1 e caso não tenha adicione o valor 30 nesse campo.''' dic1 = {'user1':{'nome': 'Mioshi', 'sobrenome': 'Kanashiro', 'apelido': 'Japa'}, 'user2':{'nome': 'Sergei', 'sobrenome': 'Ivanov', 'apelido': 'Russo'}, 'user3':{'nome': 'Alfredo', 'sobrenome': 'Constâ...
robinson-1985/python-zero-dnc
33.operacoes_com_dicionarios/9.exercicio2.py
9.exercicio2.py
py
421
python
pt
code
0
github-code
13
13842831592
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ 4kuma comic crawler crawl 4kuma comic """ URL = "http://www.shufu.co.jp/contents/4kuma/" TEST_MODE = False FILE_DIR = "./save" LOG_FILE = "rirakkuma.log" DETAIL_PATH = 'detail/detail.txt' NOTIFICATION = True import os import re import urllib2 from datetime import ...
pyohei/rirakkuma-crawller
main.py
main.py
py
2,596
python
en
code
0
github-code
13
1954954844
# -*- coding: utf-8 -*- """ Created on Sun Feb 21 21:24:25 2021 Problem 59: XOR decryption https://projecteuler.net/problem=59 @author: kuba """ # Importing encrypted values PATH_TO_KEYS = "keys.txt" encrypted_values = [] with open(PATH_TO_KEYS) as p: encrypted_values = p.readlines() encrypted_values = encrypte...
KubiakJakub01/ProjectEuler
src/Problem59/Problem59.py
Problem59.py
py
1,130
python
en
code
0
github-code
13
31940498010
class Solution: def numSplits(self, s: str) -> int: p, tot = [0] * 26, [0] * 26 left, right = 0, 0 for ch in s: idx = ord(ch) - ord('a') tot[idx] += 1 if tot[idx] == 1: right += 1 ans = 0 for ch in s: idx = ord(...
wylu/leetcodecn
src/python/contest/leetcode31/5458.字符串的好分割数目.py
5458.字符串的好分割数目.py
py
1,456
python
en
code
3
github-code
13
9303717425
# Nikita Akimov # interplanety@interplanety.org # # GitHub # https://github.com/Korchy/blender_dev_tools_int # # Script for easy reinstalling Blender 3D add-ons from source directory # # This version is for Blender 2.7 # import tempfile import os import shutil import glob import bpy import sys # --- required cust...
Korchy/blender_dev_tools_int
2.7/addon_reinst.py
addon_reinst.py
py
3,228
python
en
code
4
github-code
13
25507387137
import requests import sqlite3 import creating_table import telebot token = '788927932:AAFhYxhg5aLYtgDlU11yW15-PDMjiysOjHI' URL = 'https://api.telegram.org/bot' + token + '/' bot = telebot.TeleBot(token) def get_translation(text, lang): url = 'https://translate.yandex.net/api/v1.5/tr.json/translate'...
anyklaude/Translator
Translate.py
Translate.py
py
2,538
python
en
code
0
github-code
13
11383999521
import boto3 import functions from functions import TWO_DAYS_AGO from pprint import pprint client = boto3.client('ec2') def get_instances(region): instances=[] client = boto3.client('ec2', region_name=region) response = client.describe_instances() for i in response['Reservations']: for instan...
datianshi/aws_usage_reports
clean_ec2.py
clean_ec2.py
py
2,233
python
en
code
0
github-code
13
29753183696
"""• Personal_info.txt 파일 읽고, 이름만 찾아서 출력하기(절대경로)""" file = open("C:\\Users\\ducog\\PycharmProjects\\pythonProject\\Personal_info.txt", "r") data = file.read() list = data.split('\n') for i in list[:]: if 'Name' in i: arr = i.split(':') print(arr[1]) file.close()
1000hyehyang/Advanced-Python-Programming
dummy/03.py
03.py
py
322
python
ko
code
0
github-code
13
34339517832
import os import sys import textwrap from StringIO import StringIO import wx import Marvin import Marvin.restriction import Marvin.app.predictors import Marvin.app.preferences as preferences from Marvin.app.emboss import EmbossFrame class ProteinPage(wx.Panel): def __init__(self, parent, topframe, mode='Restri...
jje42/marvin
Marvin/app/protein.py
protein.py
py
25,790
python
en
code
4
github-code
13
17058433474
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class PubChannelDTO(object): def __init__(self): self._ext_info = None self._pub_channel = None @property def ext_info(self): return self._ext_info @ext_info.sette...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/PubChannelDTO.py
PubChannelDTO.py
py
1,367
python
en
code
241
github-code
13
23943178929
from scipy.stats import shapiro from scipy.stats import mannwhitneyu def shapiro_test(data): print(shapiro(month_list)) file1 = open("WindSpeedShapiro.txt", "w") for i in range(len(all_wind_dicts)): file1.write("\n" + wind_station_names[i] + " Shapiro-Wilk test results\n") for j in range...
changsteph/CITRUS-June2022
statistics.py
statistics.py
py
884
python
en
code
0
github-code
13
3480445964
import datetime import os import keras.backend as K import numpy as np from keras.layers import Conv2D, Lambda, Input, Flatten, Dense, Multiply from keras.models import Model, load_model from keras.optimizers import RMSprop from agents.constants import ATARI_INPUT_SHAPE def build_model(obs_shape, action_size): f...
srajabi/rl
agents/model.py
model.py
py
3,656
python
en
code
0
github-code
13
17191510376
if __name__ == "__main__": t = int(input()) ans = [] for i in range(t): n = int(input()) a = [] for i in range(n): l = list(map(int, input().split())) m = [] if i == 0: m = l else: m = [min(a[i - 1][2], a...
yzgqy/myacm
acm/kt4/t4.py
t4.py
py
526
python
en
code
0
github-code
13
73492681616
import logging from dataclasses import dataclass, field from queue import PriorityQueue from typing import Dict, List, Optional from .schedule_common import ( ExecutorIndex, ScheduleExecutor, ScheduleOperation, Scheduler, SchedulerMinibatchSpec, ) @dataclass(order=True) class CompleteEvent: c...
awslabs/optimizing-multitask-training-through-dynamic-pipelines
dynapipe/schedule_opt/wait_free_schedule.py
wait_free_schedule.py
py
5,650
python
en
code
1
github-code
13
20700335619
#0. 패키지 import from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis import numpy as np #1. Data 세팅 및 로드 X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) y = np.array([1, 1, 1, 2, 2, 2]) #2. 모델 로드(데이터 마이닝 기법) clf = QuadraticDiscriminantAnalysis() #3. 모델 훈련 clf.fit(X, y) #4. 모델 ...
KSJ0128/Data
12주차_test2.py
12주차_test2.py
py
430
python
ko
code
0
github-code
13
71042909137
''' To render html web pages ''' import random from django.http import HttpResponse from django.template.loader import render_to_string from articles.models import Article def home_view(request): ''' Take in a request (Django sends request) Return as a response (We pick to return the response) ''' ...
devbobnwaka/try-django2
trydjango/views.py
views.py
py
770
python
en
code
0
github-code
13
17055420674
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class LogicalRuleItemDTO(object): def __init__(self): self._crowd_name = None self._ext_crowd_key = None self._gmt_expired_time = None self._schedule_type = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/LogicalRuleItemDTO.py
LogicalRuleItemDTO.py
py
2,979
python
en
code
241
github-code
13
27393443063
# RGB 거리 n = int(input()) prices = [[0]] dp = [[0] * 3 for _ in range(10001)] for _ in range(n): prices.append(list(map(int, input().split()))) for i in range(1, n+1): dp[i][0] = min(dp[i-1][1], dp[i-1][2]) + prices[i][0] dp[i][1] = min(dp[i-1][0], dp[i-1][2]) + prices[i][1] dp[i][2] = min(dp[i-1][0]...
hyebinnn/Algorithm
BOJ/P_1149.py
P_1149.py
py
394
python
en
code
0
github-code
13
7782159376
import os from flask import Blueprint, render_template, redirect, url_for, flash, \ request, jsonify from flask import current_app as app from werkzeug.utils import secure_filename from celery.result import AsyncResult from clustermgr.extensions import db, wlogger, celery from clustermgr.models import LDAPSer...
GuillaumeSmaha/cluster-mgr
clustermgr/views/index.py
index.py
py
6,299
python
en
code
0
github-code
13
37086107466
import collections import itertools import functools import json import flowws from flowws import Argument as Arg import keras_gtar import numpy as np LoadResult = collections.namedtuple( 'LoadResult', ['att_model', 'train_data', 'val_data', 'batch_size', 'type_map']) @functools.lru_cache(maxsize=1) def load_mod...
klarh/flowws-keras-geometry
flowws_keras_geometry/viz/MoleculeAttentionViewer.py
MoleculeAttentionViewer.py
py
7,204
python
en
code
6
github-code
13
71077810259
from data_transform import * from sklearn import preprocessing df = df[df['vote_average'] != 9] # Remove class with 1 member # Extract X matrix and y vector y = df['vote_average'].values.astype(int) # Extract data df_X = df.drop(['revenue', 'vote_average', 'vote_count', 'popularity'],1) * 1#convert bools #df_X = df_...
maersk96/02450_machine_learning
MovieDB/scripts/Project 2/data_prepare_logistic.py
data_prepare_logistic.py
py
577
python
en
code
1
github-code
13
578387883
import numpy as np import pandas as pd import argparse def main(args): test_set = ["omniglot", "aircraft", "cu_birds", "dtd", "quickdraw", "fungi", "traffic_sign", "mscoco"] df = pd.read_csv(args.log_path) all_top1, all_loss, all_time = [], [], [] all_gce, all_ece, all_ace, all_tace, all_sce, all...
mpatacchiola/contextual-squeeze-and-excitation
printer.py
printer.py
py
6,905
python
en
code
21
github-code
13
17525610965
import logging from multiprocessing import shared_memory import rumps logging.basicConfig( level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", ) class TranslaterApp(rumps.App): def __init__(self) -> None: super(TranslaterApp, self).__init__( name="Tran...
r4hx/Translator
systray.py
systray.py
py
2,316
python
en
code
2
github-code
13
31319546294
# Ex097 def escreva(texto): tamanho = len(texto) + 10 print('-' * tamanho) print(f' {texto}') print('-' * tamanho) escreva('O RATO ROEU A ROUPA DO REI DE ROMA, E A RAINHA COM RAIVA ROEU O RESTO') escreva('CLAYTON GARCIA DA SILVA') escreva('GUANABARA ENXADRISTA')
Claayton/PythonExercises
Exercício feitos pela primeira vez/ex097.py
ex097.py
py
285
python
pt
code
1
github-code
13
73771757139
import json import logging import os import uuid from itertools import count from random import randint import base62 from testgen.data_schema_parser import DataSchemaParser from testgen.exceptions import DataGenerationException log = logging.getLogger("testgen.generator") class DataGenerator: def generate(s...
gryabov/gridu_python_basics_course
testgen/generator.py
generator.py
py
2,831
python
en
code
0
github-code
13
39132931242
#2884 알람시계 - 구글 참고 h, m = map(int, input().split()) #시간과 분을 입력받고 if m < 45 : #입력받은 분이 45보다 작으면 if h == 0 : #시간이 0 시이면 h = 23 #23시로 다시 설정 m = 60 + m #시간단위가 변경되므로 다시 60에서 분을 빼줌 else : #0시가 아니라면 h = h - 1 #시간단위 -1 m = 60 + m #시간단위가 변경되므로 다시 60에서 분을 빼줌 print(h, m-45) #프린트 시에 45를 제외해서 출력
wndnjs2037/Algorithm
백준/Bronze/2884. 알람 시계/알람 시계.py
알람 시계.py
py
506
python
ko
code
0
github-code
13
32956381702
# https://www.hackerrank.com/challenges/lonely-integer/problem if __name__ == '__main__': n = int(input().strip()) y = 0 x = input().split(" ") for i in range(n): y = int(x[i]) ^ y print(y)
thecoducer/Problem-Solving-Vault
HackerRank/lonely_integer.py
lonely_integer.py
py
224
python
en
code
3
github-code
13
33516528468
"""Functions to attribute IGO points with attributes related to land cover types and land use intensity within the riverscape. Jordan Gilbert Dec 2022 """ import sqlite3 import rasterio import numpy as np from osgeo import gdal from rasterio.mask import mask from rscommons import Logger, VectorBase, GeopackageLayer ...
Riverscapes/riverscapes-tools
packages/anthro/anthro/utils/igo_vegetation.py
igo_vegetation.py
py
3,051
python
en
code
10
github-code
13
29284087952
import pygame import random import sys pygame.init() # Arguments WIDTH = 800 HEIGHT = 600 RED = (255, 0, 0) BLUE = (0, 255, 0) YELLOW = (255, 255, 0) BACKGROUND_COLOR = (0, 0, 50) playerSize = 50 playerPos = [WIDTH/2, HEIGHT - 2 * playerSize] enemySize = 50 enemy_pos = [random.randint(0, WIDTH-e...
KarolProgramista/Blocke-The-Game
game.py
game.py
py
3,284
python
en
code
1
github-code
13