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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
32160262976 | import builtins
import uos2 as os
PIPE = 1
class SubprocessError(Exception):
pass
class CalledProcessError(SubprocessError):
pass
class Popen:
def __init__(self, args, stdin=None, stdout=None, shell=False):
assert stdin is None
assert stdout in (None, PIPE)
self.stdin = self.... | pfalcon/pycopy-lib | usubprocess/usubprocess.py | usubprocess.py | py | 2,084 | python | en | code | 229 | github-code | 1 |
8197656719 | # -*- coding: utf-8 -*-
"""
Problem Set 2
"""
def crea_shift_func(bpsShort, bpsLong):
"""
Crea función desplazamiento.
Parámetros:
bpsShort : Puntós Básicos deplazamiento en tasa 0 días (parte corta)
bpsLong : Puntós Básicos deplazamiento en tasa 365 días (parte larga)
NOTA: 100 Punt... | FedericoMenendez22/pythonFinanzas | clases/Problemset2profe.py | Problemset2profe.py | py | 2,433 | python | es | code | 0 | github-code | 1 |
25331119448 | from itertools import zip_longest, combinations
import json
import os
import warnings
import numpy as np
import tvm
from tvm import relay
from tvm import rpc
# from tvm.contrib.debugger import debug_runtime as graph_executor
from tvm.contrib import graph_executor
from tvm.relay.op.contrib import clml
from tvm.contri... | mvermeulen/tvm | tests/python/contrib/test_clml/infrastructure.py | infrastructure.py | py | 7,005 | python | en | code | null | github-code | 1 |
23174374461 | class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class Student(Person):
# Class Constructor
#
... | 7Aishwarya/HakerRank-Solutions | 30_Days_of_Code/day12_inheritance.py | day12_inheritance.py | py | 1,604 | python | en | code | 6 | github-code | 1 |
11809791588 | # 不爱施肥的小布
import math
import sys
def cal(k, fields):
days = 0
for i in range(len(fields)):
days += math.ceil(fields[i] / float(k))
return days
def do_job():
params = [int(x) for x in sys.stdin.readline().strip().split(" ")]
fields = [int(x) for x in sys.stdin.readline().strip().split(" ... | doppler-motion/code-pub | Python/other/HuaWei_Computer_Test/003_apply_fertilizer.py | 003_apply_fertilizer.py | py | 1,014 | python | en | code | 0 | github-code | 1 |
1585469939 | """Implements decorators used throughout the library."""
import json
from functools import wraps
from collections import UserDict
from validator_collection import checkers
from highcharts_core import errors, constants
def validate_types(value,
types = None,
allow_dict = True,
... | highcharts-for-python/highcharts-core | highcharts_core/decorators.py | decorators.py | py | 11,418 | python | en | code | 40 | github-code | 1 |
7487410735 | import datetime
import time
import tweepy as twitter
import keys
import random
auth = twitter.OAuthHandler(keys.api_key, keys.api_secret)
auth.set_access_token(keys.access_key, keys.access_secret)
api = twitter.API(auth)
def twitter_bot_retweet(hashtag, delay):
while True:
print(f'\n{datetime.datetime.... | mocnidule/twitterApiBot | main.py | main.py | py | 1,515 | python | en | code | 0 | github-code | 1 |
21032849145 | from pygame_utilities import Sheet, Button, blit_alpha
import pygame as pg
import time
import random as r
import general as gral
class MainMenu:
def __init__(self):
self.img_bg = pg.image.load("data/images/main_menu/main_menu_bg.png")
# self.title = text(txt="No Dungeon RPG", font_style=info_font,... | hnezado/NoDungeonRPG | NoDungeonRPG/main_menu.py | main_menu.py | py | 4,895 | python | en | code | 1 | github-code | 1 |
29372887663 | import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-west-2', endpoint_url='http://localhost:8000')
try:
resp = dynamodb.create_table(
AttributeDefinitions=[
{
"AttributeName": "LocationID",
"AttributeType": "S"
},
{
... | MathiasDarr/Snotel | usda_scrape/create_tables.py | create_tables.py | py | 1,684 | python | en | code | 0 | github-code | 1 |
22413513165 | from datetime import datetime
from enum import Enum
from typing import List
from fastapi import HTTPException
from pydantic import BaseModel, validator, root_validator
class SystemItemType(str, Enum):
FILE = "FILE"
FOLDER = "FOLDER"
class SystemItemTag(str, Enum):
Document = "Document"
Template = "... | Wintori/Electron | back/app/schems/item.py | item.py | py | 1,545 | python | en | code | 1 | github-code | 1 |
15122687987 | from numpy import linspace
from scipy import pi,sin,cos,sqrt,arctan2
import pylab as p
def ellipse(a,b,ang,x0,y0):
ca,sa=cos(ang),sin(ang)
t = linspace(0,2*pi,73)
X = x0 + a*cos(t)*ca - sa*b*sin(t)
Y = y0 + a*cos(t)*sa + ca*b*sin(t)
return X,Y
def decode_ee(e1,e2,scale=0.03):
#from: e = (a-... | Luhcile/Halo_matiere_noire | plotellipticity.py | plotellipticity.py | py | 1,698 | python | en | code | 1 | github-code | 1 |
16399864844 | import os
from glob import glob
from importlib import import_module
from django.urls import re_path as _re_path, path as _path
def _glob_init(name):
name = name.replace(".", os.sep)
path = os.sep + "**"
modules = []
for module in glob(name + path, recursive=True):
importable = os.path.splitex... | isik-kaplan/django-urls | django_urls/__init__.py | __init__.py | py | 1,940 | python | en | code | 39 | github-code | 1 |
73106492514 | try:
from tensorflow.python import pywrap_tensorflow
_tf_import_error = None
except ImportError as e:
_tf_import_error = e
import chainer
import chainer.functions as F
import chainer.initializers as I
import chainer.links as L
import numpy as np
from .conv import ConvBnRelu
from .tf_loadable_chain import ... | beam2d/inception | inception/inception_v3.py | inception_v3.py | py | 11,827 | python | en | code | 5 | github-code | 1 |
20276623079 | import unittest
import time
import HTMLTestRunner
from common.fmail import *
from common.log import Logger
if __name__ == "__main__":
test_dir = r'D:\zdh\python\jiaoben\test\case'
test_report = r'D:\zdh\python\jiaoben\test\report'
discover = unittest.defaultTestLoader.discover(test_dir, pattern='test_logi... | shuhaiye/python | jiaoben/test_web/runner.py | runner.py | py | 1,002 | python | en | code | 0 | github-code | 1 |
41054333536 | from botocore.exceptions import ClientError
import pytest
class MockManager:
def __init__(self, stub_runner, cluster_data, input_mocker):
self.cluster_data = cluster_data
self.db_engine = "test-engine"
self.group_name = "test-group"
self.group = {"DBClusterParameterGroupName": self... | awsdocs/aws-doc-sdk-examples | python/example_code/aurora/test/test_get_started_aurora_create_parameter_group.py | test_get_started_aurora_create_parameter_group.py | py | 3,350 | python | en | code | 8,378 | github-code | 1 |
22495049855 | # Time: 22/8/26 14:00
# Author: Haosen Luo
# @File: call_snp.py
import os
import configparser
from optparse import OptionParser
BIN = os.path.dirname(__file__) + '/'
file_config = configparser.ConfigParser()
file_config.read(BIN + 'config.ini')
class CorrectBase(object):
def __init__(self, bam_input... | Luosanmu/HostonBook | luohaosen_study_note/WES_2anno/script/correct_base.py | correct_base.py | py | 5,423 | python | en | code | 0 | github-code | 1 |
38036535696 | import json
import os
import shutil
from pathlib import Path
from typing import List, Tuple
from fire import Fire
from pydantic import BaseModel
from random import choices
template_map = {}
template_desc_map = {}
labelname2rid = {}
laebl_cls_id = {}
class DynamicModel(BaseModel):
class Config:
arbitrary... | megagonlabs/zett | utils.py | utils.py | py | 4,594 | python | en | code | 4 | github-code | 1 |
32138672859 | # coding: utf-8
import os
import sys
from django.conf import settings
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'active_users.middleware.ActiveUsersSessionMiddleware',
... | n-elloco/django-active-users | tests/run_tests.py | run_tests.py | py | 1,618 | python | en | code | 16 | github-code | 1 |
6445705454 | # -*- coding: UTF-8 -*-
"""Defines the CLI for creating a DataIQ instance"""
import click
from vlab_cli.lib.widgets import Spinner
from vlab_cli.lib.api import consume_task
from vlab_cli.lib.widgets import typewriter
from vlab_cli.lib.click_extras import MandatoryOption
from vlab_cli.lib.portmap_helpers import get_com... | willnx/vlab_cli | vlab_cli/subcommands/create/dataiq.py | dataiq.py | py | 4,594 | python | en | code | 2 | github-code | 1 |
38956703819 | import asyncio
import os
import tempfile
import unittest
from out_sort.sort_statistic import State
from out_sort.sort_statistic import Statistic
import out_sort.out_sort as out_sort
from utils import file_generator
class StatisticTest(unittest.TestCase):
def test_next_state_raises_exception(self):
... | ashibaev/python | Sort/tests.py | tests.py | py | 8,322 | python | en | code | 0 | github-code | 1 |
23639467216 | import pyttsx3
import speech_recognition as sr
import datetime
import wikipedia
import webbrowser
import smtplib
import psutil
import pyjokes
import pyautogui
import os
import wolframalpha
import ctypes
import subprocess
import json
import requests
from urllib.request import urlopen
from bs4 import Bea... | DivyasinghGmail/Voice-Assistant | main.py | main.py | py | 17,144 | python | en | code | 0 | github-code | 1 |
32425704105 | from src.common.database import Database
import uuid
import datetime
class Post(object):
def __init__(self, blog_id, title, content, author, date_created=datetime.datetime.now(), _id=None):
self.blog_id = blog_id
self.title = title
self.content = content
self.author = a... | utpal-d4l/web_blog | src/models/post.py | post.py | py | 1,558 | python | en | code | 0 | github-code | 1 |
74374279392 | class Exp:
def __init__(self, base, a=1, s=0, m=0, var = 'n'):
self.base = base
self.a = a
self.s = s
self.m = m
self.var = var
def __repr__(self):
return f"Exp({('',a)[bool(a-1)]},{self.base},{('',s)[bool(s)]})"
#representacion de la e... | treefngrs/TFG-Recurrencia | src/exp.py | exp.py | py | 1,043 | python | en | code | 0 | github-code | 1 |
21006307013 |
# Tic Tac Toe Game
def display_board(board):
print (' | |')
print (' '+ board[7] + ' | ' + board[8] + ' | ' + board[9])
print (' | |')
print ('-----------')
print (' | |')
print (' '+ board[4] + ' | ' + board[5] + ' | ' + board[6])
print (' | |')
print ('-----------')
... | samghadri/TicTacToe | Tic.Tac.Toe.py | Tic.Tac.Toe.py | py | 3,579 | python | en | code | 1 | github-code | 1 |
10613206873 | t = int(input())
answer = ''
for tc in range(1, t + 1) :
n = int(input())
data = list(map(int, input().split()))
result = 1e9
for i in range(7) :
if data[i] == 1:
index = i
temp_n = n
temp_result = 0
while temp_n:
if data[index]... | lkc263/Algorithm_Study_Python | swexpert/13038.py | 13038.py | py | 557 | python | en | code | 0 | github-code | 1 |
41454422615 | # -*- coding: utf-8 -*-
from odoo import api, fields, models
import logging
class AccountMove(models.Model):
_inherit = "account.move"
partida_intcomex = fields.Boolean(string='Partida intcomex', default=False)
tipo_nota = fields.Selection(selection=[
('proteccion','Price protection'),
... | arianaa24/intcomex | models/account_move.py | account_move.py | py | 5,882 | python | es | code | null | github-code | 1 |
30051402329 | from torch import nn, optim
from transformers import BertModel
from transformers.models.bert.modeling_bert import BertModel,BertForMaskedLM
# TOKENIZACIÓN
PRE_TRAINED_MODEL_NAME = 'bert-base-cased'
# EL MODELO!
class BERTSentimentClassifier(nn.Module):
def __init__(self, n_classes):
super(BERTSent... | murdoocc/Sentiment_analysis | sentiment_analysis/primaryapp/BERTSentimentClassifier.py | BERTSentimentClassifier.py | py | 841 | python | en | code | 0 | github-code | 1 |
13211125387 | # a)
def read_split_join(): # first method, with the split function
infile = open('densities.dat','r')
substance = []
densities = []
for line in infile:
words = line.split()
value = words[-1]
del words[-1] # remove the last element: number value
... | simehaa/University | inf1100/density_improved.py | density_improved.py | py | 1,866 | python | en | code | 0 | github-code | 1 |
9431293508 | n,k = map(int,input().split())
nums = list(map(int,input().split()))
def countPairs(a, n, k):
a.sort()
res = 0
seen_index = []
used_numbers = []
seen = []
fa = []
for i in range(n):
# Keep incrementing result while
# subsequent elements are within limits.
... | NicholasTing/Competitive_Programming | SIT_STAR_2020/d.py | d.py | py | 825 | python | en | code | 1 | github-code | 1 |
19071223315 |
import os
import glob
from pprint import pprint
import sys
import time
import jinja2
from markupsafe import Markup
import ssgen
def make_pages(embed_css=False):
pages = []
static_pages = ssgen.find_pages("pages/*")
pages += static_pages
menu = ssgen.make_menu(pages)
# Copy redirects file int... | livewires/website | build.py | build.py | py | 2,413 | python | en | code | 0 | github-code | 1 |
15576229974 | class Solution:
def majorityElement(self, nums):
seen = {}
if len(nums) == 1:
return nums
majority_count = len(nums) // 3
for n in nums:
if n in seen:
seen[n] += 1
else:
seen[n] = 1
return [k for k, v in seen... | quetzaluz/codesnippets | python/leetcode/majority-element-ii.py | majority-element-ii.py | py | 352 | python | en | code | 0 | github-code | 1 |
4156792518 | import unittest
from easy import game_plots
from easy.monte import MonteCarloPolicyEvaluation
from easy.policies import Stick20ActionPolicy, RandomActionPolicy, EpsilonGreedyActionPolicy
from easy.game import Easy21
ACTION_STICK = 0
ACTION_HIT = 1
class MyTestCase(unittest.TestCase):
def test_epsilon_greedy_po... | phisad/rl-easy21 | tests/test_monte.py | test_monte.py | py | 2,413 | python | en | code | 0 | github-code | 1 |
3246614975 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# 地址:http: //www.runoob.com/python/python-exercise-example85.html
def func(num):
j = 1
sum = 9
m = 9
flag = True
while flag:
if sum % num == 0:
print(sum)
flag = False
else:
m *= 10
sum +... | MiracleWong/PythonPractice | Python-Exercise-100/python-exercise-example85.py | python-exercise-example85.py | py | 717 | python | en | code | 0 | github-code | 1 |
22919833137 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 21:13:46 2023
@author: basti
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
import statsmodels.formula.api as smf
from scipy.stats import chi2_contingency
df_reg = pd.read_csv("bdd/data/d... | BastienChicot/seria | services/regressions.py | regressions.py | py | 4,897 | python | en | code | 0 | github-code | 1 |
43348782580 |
from azure.cognitiveservices.vision.face import FaceClient
from azure.cognitiveservices.vision.face.models import DetectedFace,FaceAttributeType,VerifyResult , IdentifyResult , IdentifyCandidate , SimilarFace
from msrest.authentication import CognitiveServicesCredentials
from azure.cognitiveservices.vision.face.model... | giuseppe-delgaudio/askToMyBot | helpers/face_cognitive.py | face_cognitive.py | py | 6,485 | python | en | code | 0 | github-code | 1 |
3974593534 | from typing import List, Tuple
from math import sqrt, ceil
from functools import cache
def read_input(lines: List[str]) -> Tuple[Tuple[int, int], Tuple[int, int]]:
l = lines[0][len("target area: ") :]
x_part, y_part = l.split(", ")
x1, x2 = (int(x) for x in x_part[2:].split(".."))
y1, y2 = (int(y) for... | vegayours/aoc-2021 | python/aoc_17.py | aoc_17.py | py | 1,845 | python | en | code | 0 | github-code | 1 |
72359155873 | import datetime
import json
import codecs
import os
import pandas as pd
import pickle
import requests
# import criteo_marketing as cm
# from criteo_marketing import Configuration
import yaml
def get_metrics(
advertiser_id: str,
start_date_input: datetime.datetime,
end_date_input: datetime.datetime,
m... | Leonid-SV/da_skipper | connectors/connector_criteo.py | connector_criteo.py | py | 3,500 | python | en | code | 0 | github-code | 1 |
15758428960 | from django.db import models
# Create your models here.
class Pessoa(models.Model):
GENEROS = (
('F', 'Feminino'),
('O', 'Outro'),
)
nome = models.CharField(
max_length=255,
verbose_name='Nome'
)
sobrenome = models.CharField(
max_length=255,
verbos... | isadoraperes/projeto-demoday | website/models.py | models.py | py | 1,339 | python | pt | code | 0 | github-code | 1 |
20388801456 | """
Verify that `alr clean --temp` works properly
"""
from drivers.alr import run_alr
from drivers.asserts import assert_eq, assert_match
import e3
import os
os.mkdir("test")
os.chdir("test")
# We create a temp file above us, one at the current dir, and one below.
# The one above us should not be cleaned. Also, a f... | alire-project/alire | testsuite/tests/clean/temp-files/test.py | test.py | py | 1,004 | python | en | code | 233 | github-code | 1 |
14416140655 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 3 11:04:32 2023
@author: hp
"""
#Write A Python Program To Get 5 Color name From The User In List, Display That List, Remove Last Color And Then Display All The Colors to User
color=[]
for i in range(0,5):
color.append(input('enter the color : '))
print(color)
col... | AiswaryaRamesan/Python | 5 Color name From The User In List, Display That List, Remove Last Color And Then Display All The Colors to User.py | 5 Color name From The User In List, Display That List, Remove Last Color And Then Display All The Colors to User.py | py | 344 | python | en | code | 0 | github-code | 1 |
38768920295 | from utils import *
class Switcher(object):
def run(self):
failedRun = chance(60)
print("Couldn't Run!" if failedRun else "Ran away!")
return not failedRun
def attack(self):
print("attack")
def item(self):
print("item")
def swapPkmn(self):
print("Swa... | tsny/poke-fight | input.py | input.py | py | 985 | python | en | code | 0 | github-code | 1 |
73670347555 | from kivy.uix.gridlayout import GridLayout
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.image import Image, AsyncImage
from kivy.uix.widget import Widget
from kivy.metrics import dp
from typing import Callable, Dict
from lib.quest import Quest
import urllib
def _create_togglebutton(self, text: str, ... | malkavk/ValkyrieScenariosManager | lib/interface.py | interface.py | py | 4,955 | python | en | code | 1 | github-code | 1 |
43318937035 | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: Hansong Nie
# @Time : 2019/12/11 14:43
import os
import json
# aminer_papers_files_path = r"I:\open-academic-graph-2019-01\aminer_papers"
sigmod_paper_path = "data/sigmod_papers_07_16.txt"
# print("提取2007-2016年SIGMOD上的论文信息")
# out_file = open(sigmod_... | HansongN/DANRL | handle_data/aminer_sigmod_papers.py | aminer_sigmod_papers.py | py | 1,912 | python | en | code | 1 | github-code | 1 |
33888337626 | import json
if __name__ == "__main__":
lang = ["en", "es", "fr", "pt"]
clothingTypes = ["COLOUR", "HEAD", "FACE", "NECK", "BODY",
"HAND", "FEET", "FLAG", "PHOTO", "OTHER"]
paperdollDepth = {
"7500": "PAPERDOLLDEPTH_TOP_LAYER",
"7000": "PAPERDOLLDEPTH_HAND_LA... | Yaqq/Crumb-Converter | convert.py | convert.py | py | 6,305 | python | en | code | 0 | github-code | 1 |
23159972120 | ###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by ... | donovan-h-parks/RefineM | refinem/plots/gc_plots.py | gc_plots.py | py | 7,660 | python | en | code | 60 | github-code | 1 |
72377091233 | import pymysql
from collections import Counter
import schedule
import time
#db_p = pymysql.connect("10.10.6.100","root","siipap_RX1","siipapx")
#db = pymysql.connect("10.10.1.225","root","sys","siipapx")
db_p =pymysql.connect("10.10.1.225","root","sys","pruebagr", charset="utf8mb4")
print("")
print("===========ONLIN... | BenjaminAR/replicaPythonMysql | timeControl.py | timeControl.py | py | 1,485 | python | en | code | 0 | github-code | 1 |
72537582434 | import sys, argparse, json, os, pickle
import numpy as np
import torch
from translator import OpenAITranslator
import openai
from tqdm import tqdm
def main():
parser = argparse.ArgumentParser(description='Description.')
parser.add_argument("-s", "--source", type=str, help="path to source file")
parser.add_... | deep-spin/translation-hypothesis-ensembling | chatgpt/code/translate.py | translate.py | py | 3,852 | python | en | code | 2 | github-code | 1 |
11022412448 | from selenium import webdriver
from selenium.webdriver.common.by import By
import pyautogui
import time
driver=webdriver.Chrome(executable_path="chromedriver")
driver.get("https://vidkidz.tistory.com/107")
driver.maximize_window()
pyautogui.moveTo(x=989, y=542)
pyautogui.click()
while True:
a=driver.fin... | joas24/jookrim_dasi | site.py | site.py | py | 728 | python | en | code | 0 | github-code | 1 |
36656509124 | #!/usr/bin/env python3
class Graph(object):
def __init__(self):
# edges
self._g = {}
# paths through
self._p = []
def add_edge(self, a, b):
if a not in self._g:
self._g[a] = [b]
else:
self._g[a].append(b)
def _paths_from(self, node):... | gerrowadat/adventofcode | 2021/12/2.py | 2.py | py | 1,702 | python | en | code | 1 | github-code | 1 |
27971472908 | import pyautogui
from time import sleep
pyautogui.PAUSE = 0.2 # Define um tempo de espera entre os comandos dados através da 'pyautogui'
# Define as funções
# Procura a imagemt na tela e clica nela
def procurar_imagem (foto):
# Leva o mouse para o canto da tela para não atrapalhar
# a identificação... | Samuel-Wisart/Prova_para_Estagio | PyAutoGui.py | PyAutoGui.py | py | 2,346 | python | pt | code | 0 | github-code | 1 |
40003694956 | SERVER_LIST = ["server_1", "server_2"]
OPEN_PORTS = [8532, 8654, 6959, 4969]
USERS = [
{"name":"admin", "pw":"m4in"},
{"name":"hans", "pw":"abc123"}
]
def connect(user_name: str, user_pw: str, **config):
if "server" not in config:
server = SERVER_LIST[0]
else:
if config["server"] in SE... | fiaeb23/Islamovic | Python-T2/03_Übung.py | 03_Übung.py | py | 1,246 | python | en | code | 0 | github-code | 1 |
24090074678 | import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
import pickle
font = fm.FontProperties(fname='./font/wqy-microhei.ttc')
def pie(profit_data):
# 饼图显示盈亏占比
# 每一块饼图外侧显示的说明文字
labels = 'Profit', 'Loss', '0'
sizes = [0, 0, 0]
for p in profit_data:
if p > 0:
sizes... | Kiiiiii123/TradeWithRL | visualize_bacth_testing.py | visualize_bacth_testing.py | py | 1,221 | python | en | code | 1 | github-code | 1 |
17414387752 | from PySide2.QtCore import QAbstractItemModel, QModelIndex, Qt, Signal
from model.Node import Node
from model.Chapter import Chapter
from model.Picture import Picture
from model.Text import Text
from model.Page import Page
class HierarchyTreeModel(QAbstractItemModel):
"""
Model hijerarhijskog stabla
Args:... | dovvla/multimedia-book | MuMijA/view/tree/HierarchyTreeModel.py | HierarchyTreeModel.py | py | 7,284 | python | sr | code | 0 | github-code | 1 |
37915902648 | import requests
import json
import math
import csv
import os
import pickle
# This code has been tested using Python 3.6 interpreter and Linux (Ubuntu).
# It should run under Windows, if anything you may need to make some adjustments for the file paths of the CSV files.
"""
DO NOT RUN THIS RIGHT AWAY.
WE HAVE A PICK... | logan-lach/Bitcamp2022 | Scraping/generate_rmp_data.py | generate_rmp_data.py | py | 6,310 | python | en | code | 0 | github-code | 1 |
30000999890 | import dlvhex
from dlvhex import ID
import hexlite
import atexit
import logging
import os
import re
import sys
import threading
import time
# this requires jpype to be installed and it requires a working Java runtime environment
import jpype
from jpype import java
from jpype.types import *
logging.info("starting JVM... | hexhex/hexlite | plugins/javaapiplugin.py | javaapiplugin.py | py | 12,643 | python | en | code | 13 | github-code | 1 |
29312811724 | import inspect
import logging
import typing
logger = logging.getLogger()
class Event:
def __init__(self, source, source_card, continuous=None, priority=0):
self.source = source
self.source_card = source_card
self.continuous = continuous
self.priority = priority
... | Reggles44/YXSim | yxsim/events.py | events.py | py | 2,563 | python | en | code | 0 | github-code | 1 |
10218530153 | import scrapy
class PublikationenSpider(scrapy.Spider):
name = 'publikationen'
allowed_domains = ['blog.alexandria.unisg.ch']
start_urls = ['https://blog.alexandria.unisg.ch/2023/03/06/neue-hsg-publikationen-februar-2023/']
def parse(self, response):
articles = response.xpath('//*[@id="post-23... | ThesisCoacher/Data2DollarFS23 | 04_Abgabe Bonuspunkte/SimonettaFrancesco2.py | SimonettaFrancesco2.py | py | 673 | python | en | code | 3 | github-code | 1 |
71901724193 | import numpy as np
import matplotlib.pyplot as plt
import skfuzzy as fuzz
from skfuzzy import control as ctrl
def load_data():
lines = [line.rstrip('\n') for line in open("S1.txt")]
x = []
y = []
for i in range(len(lines)):
split = lines[i].split()
x.append(float(split[0]))
y.ap... | Zekhire/podstawy_cybernetyki | lab3/cyber3.py | cyber3.py | py | 6,525 | python | en | code | 0 | github-code | 1 |
10071448940 | from urllib import request
from bs4 import BeautifulSoup
import requests # to request information from a specific website.
# Job filtration by owned skills
print("Put some skills you are not familiar with")
unfamiliar_skill = input('>')
print(f'Filtering out {unfamiliar_skill}')
html_text = requests.get('https://inte... | esomesmo/Amazing-Stuff-with-Python | Web Scrapping/05_scrape_all.py | 05_scrape_all.py | py | 1,403 | python | en | code | 0 | github-code | 1 |
73948962912 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 9 08:57:55 2020
@author: Administrator
"""
import os
import yaml
import logging
import math
from Configuration import (
Config,
loadConfig,
AwgDescriptor,
DigDescriptor,
Hvi,
HviConstant,
Fpga,
Register,
PulseDescriptor,
SubPulse... | GuyMcBride/HVI2_QuadLO | configurator_averager.py | configurator_averager.py | py | 5,635 | python | en | code | 0 | github-code | 1 |
32180548187 | import unittest
from catkin_dependency_tree import Package
from catkin_dependency_tree import PackageFromXmlFile
from catkin_dependency_tree import Dependency
from catkin_dependency_tree import DependencyFromXmlNode
from catkin_dependency_tree import get_paths
class GetDependencyRelationshipTestCase(unittest.TestCase... | gdesouza/catkin_dependency_tree | test_catkin_dependency_tree.py | test_catkin_dependency_tree.py | py | 3,892 | python | en | code | 0 | github-code | 1 |
15674215916 | import numpy as np
import pickle
import os.path
import pandas as pd
import geopy.distance
class distanceParser():
dataDistancedFile='data/PARSED/distancedtraindata.csv'
maxKm=1500.0 #max distance traveled #prev 1500
maxSmallKm=40.0 #average local max distance #prev 40
def __init__(self):
pass... | carlitoselmago/streetPred | distanceParser.py | distanceParser.py | py | 1,706 | python | en | code | 0 | github-code | 1 |
14386448351 | class Solution:
def largestNumber(self, nums: List[int]) -> str:
"""
역순 정렬 (첫번째 자리부터 마지막 자리까지 순차적으로)
--> 이 풀이는 안되는 걸로..
nums_s = sorted(map(str, nums), reverse = True)
return "".join(nums_s)
"""
i = 1
while i < len(nums):
j = i
... | hyo-eun-kim/algorithm-study | ch17/yujin/ch17_yujin_4.py | ch17_yujin_4.py | py | 642 | python | ko | code | 0 | github-code | 1 |
75131853472 | class Solution:
def letterCombinations(self, digits: str) -> list[str]:
if not digits or "0" in digits or "1" in digits:
return
map = {
"2": ["a", "b", "c"],
"3": ["d", "e", "f"],
"4": ["g", "h", "i"],
"5": ["j", "k", "l"],
"6":... | artFch/LeetCode | src/Medium/17.py | 17.py | py | 757 | python | en | code | 1 | github-code | 1 |
14020454925 | import logging
import time
import os
log = logging.getLogger(__name__)
class PredictionsDB(object):
def __init__(self,pred1,pred2):
self.prediction1 = pred1
self.prediction2 = pred2
self.timestr = time.strftime("%Y%m%d-%H%M%S")
def create_file(self,outputdir='output'):
... | chesarin/master-thesis | tools/predictionsdb.py | predictionsdb.py | py | 1,660 | python | en | code | 3 | github-code | 1 |
9384917908 | from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import Foo, Bar
class FooModelAdmin(SimpleHistoryAdmin):
list_display = ["name", "email", "phone"]
class BarModelAdmin(SimpleHistoryAdmin):
list_display = ["foo", "kind", "get_value", "status"]
actions =... | mjr/django-fk-test | django_fk_test/core/admin.py | admin.py | py | 784 | python | en | code | 1 | github-code | 1 |
15486031667 | import serial
import time
for i in range (0,10) :
try:
ser = serial.Serial(
port='/dev/ttyUSB' + str(i),
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
... | danilofuchs/monalisa | testes/testeSerial.py | testeSerial.py | py | 783 | python | en | code | 0 | github-code | 1 |
31976366330 | from bs4 import BeautifulSoup
from urllib.parse import urlparse, parse_qs, unquote
input_tag_names = []
input_tag_ids = []
url_parameters=[]
# extract input tag names
def extract_input_tag_names(html_code):
soup = BeautifulSoup(html_code, 'html.parser')
for input_tag in soup.find_all('input', attrs={'name'... | arshiaor/elicit | htmlAttributeExtraction.py | htmlAttributeExtraction.py | py | 1,650 | python | en | code | 0 | github-code | 1 |
12039727407 | from __future__ import division
from collections import defaultdict, OrderedDict
import argparse
import time
import numpy
from functools import reduce
import math
from os.path import abspath, dirname, join
def read_docs(filename):
with open(filename, 'r', encoding="utf8") as f:
lines = f.readlines()
re... | kruthivijay31/KNN-using-Cosine-Distance | idx.py | idx.py | py | 3,653 | python | en | code | 0 | github-code | 1 |
69861207714 | #!/usr/bin/python3
"""Database Storage"""
# from sqlalchemy import
from sqlalchemy import create_engine
import os
from sqlalchemy.orm import sessionmaker, scoped_session, query
from models.base_model import Base
from models.city import City
from models.base_model import BaseModel
from models.state import State
from mod... | Tboy54321/airbnb_clone_v2_copy | models/engine/db_storage.py | db_storage.py | py | 2,250 | python | en | code | 0 | github-code | 1 |
30107209065 | from .models import CreditPack, CreditPackSiteSetting
from Bot.models import TelegramUser
from SiteSetting.SiteSettingRequest import credit_min_max
from WalletTransition.WalletRequest import make_buy_transition, make_sell_transition, done_buy_transition, \
cancel_buy_transition, cancel_sell_transition
def credit_... | MasoudHeidary/django-telegram-bot-trade | CreditPack/CreditPackRequest.py | CreditPackRequest.py | py | 5,822 | python | en | code | 0 | github-code | 1 |
16557361745 | # https://www.acmicpc.net/problem/16928
# Solved Date: 20.05.29.
import sys
import collections
read = sys.stdin.readline
MAX_BOARD = 100
DICE_NUM = 6
def explorer(board):
visit = [False for _ in range(len(board))]
queue = collections.deque()
# node, count
visit[1] = True
queue.append((1, 0))
... | imn00133/algorithm | BaekJoonOnlineJudge/CodePlus/600Graph/BFSPractice/baekjoon_16928.py | baekjoon_16928.py | py | 1,143 | python | en | code | 0 | github-code | 1 |
27316492873 | #tupla con los meses del año, pide al usuario un numero, el que haya ingresado
#es el mes que debe mostrar en la tupla
meses = ('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre')
n = int(input('Elige un mes: '))
print(meses[n-1])
# paises y s... | Erickmarquez7/python | funciones/estructuras.py | estructuras.py | py | 967 | python | es | code | 0 | github-code | 1 |
30685935670 | # coding=utf-8
import requests
from lxml import etree
from queue import Queue
import time
import pymysql
import threading
import logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S %p"
)
class GM(object):
def __init__(self):
... | okccc/python | crawl/demo10_更美医美项目.py | demo10_更美医美项目.py | py | 6,156 | python | en | code | 0 | github-code | 1 |
7997068898 | import chess
import chess.engine
import chess.pgn
import os
from decouple import config
import numpy as np
def fen_to_matrix(fen):
piece_values = {"P": 1, "R": 5, "N": 3, "B": 3, "K": 100, "Q": 9, "p": -1, "r": -5, "n": -3, "b": -3, "k": -100,
"q": -9}
matrix = [[0 for _ in range(8)] for _... | ChereGG/Popeye | backend/PopeyeBackend/preprocessing/fen_preprocessing.py | fen_preprocessing.py | py | 9,461 | python | en | code | 0 | github-code | 1 |
17562752015 | import numpy as np
import gymnasium as gym
from matplotlib import animation
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import env as maBanditWorld
class epsilon_greedy:
#why does init need __? python needs it
def __init__(self, n_actions, env, seed):
self.env = env
... | Sam-Fatehmanesh/FSRIresearch | epsilon_greedy.py | epsilon_greedy.py | py | 9,269 | python | en | code | 0 | github-code | 1 |
71496460833 | import numpy as np
from scipy.optimize import root_scalar
class sieplasmadisc(object):
def __init__(self, theta_E_g, eta, phi, psi0_plasma_num, theta_0r, theta_0y, alpha, delta_rs, deltab_10, deltab_20):
self.theta_E_g = theta_E_g
self.eta = eta
self.phi = phi
self.psi0_plasma_num ... | everettiantomi/plasmalens | perturbative/plasma_jet_class_disc.py | plasma_jet_class_disc.py | py | 3,782 | python | en | code | 0 | github-code | 1 |
20246492388 | #ㅇ
L,N,T= map(int, input().split())
location=[0]*N
dir=[0]*N
for i in range(N):
location[i],dir[i]=input().split()
location=list(map(int, location)) #location=[int(i) for i in location]
dir=[-1 if i=='L' else 1 for i in dir]
cnt=0
for t in range(T):
#change direction when ball in next the wall
dir=[-1*dir[... | jhan-04/Test | baekjoon/no.24468.py | no.24468.py | py | 554 | python | en | code | 0 | github-code | 1 |
30940197338 | # Author: Israel Kwilinski
# Filename: sieve.py
# Date Created: Jan. 20, 2022
# Description: Visualization tool for the famous "Sieve of Eratosthenes" algorithm.
# This algorithm "sieves" out primes under a certain limit much faster than individual prime tests.
# Written in Python3 using pygle... | israel909/Prime-Visualizer | sieve.py | sieve.py | py | 9,057 | python | en | code | 0 | github-code | 1 |
30400004984 | import json
from flask import Flask
from flask import request
import pandas as pd
import numpy as np
app = Flask(__name__)
@app.route('/indicator',methods=["POST","GET"])
def indicator():
if request.method == "POST":
data = eval(request.args.get("data"))
df = ... | abdulwahidgul24085/stocks-short-public-repo | Buy_Sell.py | Buy_Sell.py | py | 2,946 | python | en | code | 0 | github-code | 1 |
73044856035 | import nltk
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
from sklearn.naive_bayes import GaussianNB, BernoulliNB, MultinomialNB
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomFore... | ProfessorDonLuigi/ScrapeAndClassify | DiagnosticityClassifier.py | DiagnosticityClassifier.py | py | 3,583 | python | en | code | 0 | github-code | 1 |
32166393486 | """All isort specific exception classes should be defined here"""
from functools import partial
from pathlib import Path
from typing import Any, Dict, List, Type, Union
from .profiles import profiles
class ISortError(Exception):
"""Base isort exception object from which all isort sourced exceptions should inheri... | PyCQA/isort | isort/exceptions.py | exceptions.py | py | 7,060 | python | en | code | 6,145 | github-code | 1 |
3810689050 | import gauss
import input_output as io
import functions as af
import LU
A = io.Input_matrix()
b = io.Input_matrix()
af.swap_SLAR(A, b)
x = gauss.Gauss(A, b)
if type(x) == int:
print("The system is 'virodjena', it happen's on the line : " +
str(-x) + " iteration")
else:
io.print_matrix(x, "answer: ")
... | MrRusss/UData | test1/main.py | main.py | py | 758 | python | en | code | 0 | github-code | 1 |
5351884291 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 18 16:29:33 2021
@author: hzzxq
"""
import json
import os
import requests
import re
import pandas as pd
login_url='http://localhost:3000/login/cellphone?phone=13408462303&password=shiyan123456789'
s=requests.Session()
responsesdata1=s.get(url=login_url)
def getSingerNam... | YunHao-Von/Financial_Intelligence | 机器学习算法模块/singername.py | singername.py | py | 1,132 | python | en | code | 1 | github-code | 1 |
23613842278 | # -*- coding: utf-8 -*-
import logging
import torch
from torch import nn
from ..layers import TextEncoder
from ..layers.decoders import get_decoder
from ..utils.misc import get_n_params
from ..vocabulary import Vocabulary
from ..utils.topology import Topology
from ..utils.ml_metrics import Loss
from ..utils.device im... | lium-lst/nmtpytorch | nmtpytorch/models/nmt.py | nmt.py | py | 19,994 | python | en | code | 391 | github-code | 1 |
39993483714 | import matplotlib.pyplot as plt
time = []
displacement = []
time2 = []
displacement2 = []
f = open('174744_filtered', 'rU')
lines=f.readlines()
f.close()
for l in lines:
b = l.split()
time.append(float(b[0]))
displacement.append(float(b[9]))
f = open('102723', 'rU')
lines=f.readlines()
f.close()
... | CBermingham/Photonic_Force | example_movement.py | example_movement.py | py | 1,603 | python | en | code | 0 | github-code | 1 |
12505282843 | """ Implement a function that receives the "ages" dictionary and a number "n" and returns a new dict where
each student is (n) years older. For instance, new_ages(ages, 10) returns a copy of "ages" where each
student is 10 years older."""
def function(ages,n):
new_ages = {}
for name, age in ages.items():
... | kuldeepsinghn/python_coding | question_4.py | question_4.py | py | 647 | python | en | code | 0 | github-code | 1 |
12194518079 | import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import os
import tensorflow as tf
import pickle as pk
import numpy as np
import sklearn.manifold as man
from tensorflow.python.framework import ops
from emoji2vec.model import Emoji2Vec, ModelParams
from emoji2vec.phrase2vec import Phrase2Vec
from e... | ymentha14/emojis_dataset | src/validation/w2v.py | w2v.py | py | 6,686 | python | en | code | 0 | github-code | 1 |
33973618698 | import hashlib
import sys
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['POST'])
def post():
print(request.form, file=sys.stdout)
incoming = request.form['incoming_string'].encode('utf-8')
incoming = hashlib.md5(incoming)
return incoming.digest()
@app.route('/', m... | Progenitoi/test_project | task/app.py | app.py | py | 420 | python | en | code | 0 | github-code | 1 |
35632576847 | pre_arr = []
in_arr = []
post_arr = []
class node:
def __init__(self, parent, left, right):
self.parent = parent
self.left = left
self.right = right
def pre_order(nodes, id, pre_arr):
if id is False:
return
pre_arr.append(id)
pre_order(nodes, nodes[id].left, pre_arr)
pre_order(nodes, ... | YujinMiyoshi/0202 | tree/tree_walk.py | tree_walk.py | py | 1,384 | python | en | code | 0 | github-code | 1 |
27824488516 | from numba import prange, jit
import numpy as np
@jit(nopython=True, parallel=True)
def reshape_to_2d_array_numba(arr: np.ndarray, new_shape: tuple):
reshaped_array = np.empty(new_shape, dtype=arr.dtype)
# Reshape the array without using np.reshape
idx = 0
for i in range(new_shape[0]):
for j ... | sharon200102/VMD | MovingCameraForegroundEstimetor/utils_numba.py | utils_numba.py | py | 17,650 | python | en | code | 0 | github-code | 1 |
74664212192 | import math
class Solution:
def imageSmoother(self, M):
"""
:type M: List[List[int]]
:rtype: List[List[int]]
"""
rows = len(M)
cols = len(M[0])
result = []
for i in range(0, rows):
new_row = []
for j in range(0, cols):
... | vanshaw2017/leetcode_vanshaw | 661_image_smoother/661_solution.py | 661_solution.py | py | 837 | python | en | code | 0 | github-code | 1 |
36011621978 | """
Preprocess_Fischbach.py
Ryan Fischbach
Dr. Khuri
CSC373
12/4/2020
Final Project: Scraping Tweets For Classification Of Stock Price
This script takes in the preprocessed_stocks.csv and preprocessed_tweets.csv files and generates visualizations and other EDA to better understand the data.
To run, type "Python eda... | RyanFischbach/Data-Mining | FinalProject_Fischbach/eda_fischbach.py | eda_fischbach.py | py | 5,834 | python | en | code | 0 | github-code | 1 |
70321194914 | def solution(s):
"""Implements the function specced in the-cake-is-not-a-lie (first challenge on https://foobar.withgoogle.com/)
Given a non-empty string less than 200 characters in length describing the sequence of M&Ms, returns the maximum number of equal parts that can be cut from the cake without leaving an... | owlteeth/GoogleCertPuzzle | exercise1.py | exercise1.py | py | 1,056 | python | en | code | 0 | github-code | 1 |
42433980833 | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('data1.csv', sep=",")
x = df[['temp','wind_speed','daylight_hour','Insolation','cloud']]
y = df[["value"]]
x_train, x_test, y_t... | jhchoi-ii/CBNU | 2021-01-산업인공지능_개론/과제-Lasso_regression/linear.py | linear.py | py | 828 | python | en | code | 0 | github-code | 1 |
70505040994 | #json
import json
#tkinter library
from tkinter import *
import tkinter as tk
#pygame library
from pygame import *
#import python Image Library
from PIL import Image, ImageTk
#function declaration
def quit_app():
my_window.destroy()
#button music
def play_music():
mixer.... | anmmoinuddin/Python | Finalaufgabe von GUI Entwicklung-1st phase.py | Finalaufgabe von GUI Entwicklung-1st phase.py | py | 5,241 | python | en | code | 0 | github-code | 1 |
27538780925 | import os
import cv2
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from torchvision import transforms
from segformer import segformer_mit_b3
def preprocess_image(image_path, tf, patch_size):
'''preprocess image for visualization'''
# ... | hankkkwu/SegFormer-pytorch | visualize.py | visualize.py | py | 12,175 | python | en | code | 4 | github-code | 1 |
5345258729 | #!/usr/bin/python
from botocore.session import Session
import re
import os
import sys
import botocore
import argparse
import jinja2
def striphtml(data):
p = re.compile(r'<.*?>')
return p.sub('', data)
def convert(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z... | StackStorm-Exchange/stackstorm-aws | etc/st2packgen/st2packgen.py | st2packgen.py | py | 3,633 | python | en | code | 15 | github-code | 1 |
73040365155 | # ART
def freq(str):
str = str.split()
str2 = []
print('word\tfrequency')
for i in str:
if i not in str2:
str2.append(i)
for i in range(0, len(str2)):
print(str2[i], '\t:', str.count(str2[i]))
def main():
str =input("Enter Sentence:")
freq(str)
if __name__=="__main__":
main()... | Tomyzon1728/Algorithm-Challenge | ART-SDC_Day4.py | ART-SDC_Day4.py | py | 327 | python | en | code | 2 | github-code | 1 |
41983004925 | # Compute mean and variance for training data
import json
import os
import random
from pytorch_wavelets import DWTForward, DWTInverse
from torchvision.datasets import ImageFolder
from torchvision import transforms
from torch.utils.data import Dataset
from PIL import Image
import torch
from torch.utils.data im... | makai0222/WiGNet | WiGNet/normalize.py | normalize.py | py | 9,935 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.