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
29965694924
import pyowm import telebot owm = pyowm.OWM('6d00d1d4e704068d70191bad2673e0cc', language = "ru") bot = telebot.TeleBot( "1031233548:AAFfUXO0e8bDuOTWaQbHQCCuA_YJwRbqQlY" ) @bot.message_handler(content_types=['text']) def send_echo(message): observation = owm.weather_at_place( message.text ) w = observation....
Neynara/witherin
Bot.py
Bot.py
py
886
python
ru
code
0
github-code
6
17510284873
""" find all a,b,c,d such that sum(a3,b3,c3,d3) < 1000 """ n=1000 ncuberoot = 1+int(pow(1000,1/3)) cache = {} for i in range(ncuberoot): cache[i] = i**3 for a in range(n): for b in range(a,n): for c in range(b,n): for d in range(c,n): sum = cache[a] + cache[b] + cache[c] + c...
soji-omiwade/cs
dsa/before_rubrik/sum_a_b_c_d_cubes_less_than_1000.py
sum_a_b_c_d_cubes_less_than_1000.py
py
444
python
en
code
0
github-code
6
22360354761
from dateutil.relativedelta import relativedelta from odoo.tests import common from odoo import fields class TestContractPriceRevision(common.SavepointCase): @classmethod def setUpClass(cls): super(TestContractPriceRevision, cls).setUpClass() partner = cls.env['res.partner'].create({ ...
detian08/bsp_addons
contract-11.0/contract_price_revision/tests/test_contract_price_revision.py
test_contract_price_revision.py
py
2,670
python
en
code
1
github-code
6
23248264647
# Usage: # python advertising_email.py username email_text.txt csv_of_emails.csv attachment1 attachment2 ... import smtplib from getpass import getpass from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import encoders import sys import c...
ngpaladi/PhysGAAP-Tools
mailer/advertising_email.py
advertising_email.py
py
2,321
python
en
code
0
github-code
6
73176268028
import pandas as pd file_name = r"C:\Users\Sen\Desktop\Raw-Curves Files\Logan-7C_w12_TDDB_25C_Compiled Raw.txt" File = pd.read_csv(file_name, sep ='\t', header = 0) Columns = File.columns Result = pd.DataFrame(columns = Columns) Ini_key = File.iat[0,2] criteria = 0 Low_resistance = 1000 for i in range(1, len(File.ind...
Masoniced/Reliabity-Prediction-Model-on-Devices
FinFET Stochastic/Read_File.py
Read_File.py
py
610
python
en
code
1
github-code
6
17657890511
import time import speech_recognition as sr import pyttsx3 engine = pyttsx3.init() r = sr.Recognizer() voices = engine.getProperty('voices') # to check the voices available in the system '''for voice in voices: print("Voice:") print("ID: %s" %voice.id) print("Name: %s" %voice.name) print("Age:...
prakritisharma/Voice-recognition
voice_recognition.py
voice_recognition.py
py
2,928
python
en
code
0
github-code
6
2500846027
# author: Tran Quang Loc (darkkcyan) # editorial: https://codeforces.com/blog/entry/8166 # Note: I switched to python for this problem because I want my check function to always use integer number # I tried to solve this problem using C++ and got overflow even with long long number # (and really, never chan...
quangloc99/CompetitiveProgramming
Codeforces/CF319-D1-C.py
CF319-D1-C.py
py
1,270
python
en
code
2
github-code
6
16304395489
import cv2 import numpy as np import apriltag import collections apriltag_detect_error_thres = 0.07 def draw_pose(overlay, camera_params, tag_size, pose, z_sign=1, color=(0, 255, 0)): opoints = np.array([ -1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, -2 * z_sign, ...
dkguo/Pushing-Imitation
apriltag_detection.py
apriltag_detection.py
py
4,540
python
en
code
0
github-code
6
306333387
from fastapi import status, HTTPException, Depends, APIRouter from database import SessionLocal import models, schemas, utils router = APIRouter( prefix="/merchants", tags=['Merchants'] ) @router.post("/", status_code=status.HTTP_201_CREATED, response_model=schemas.MerchantResponse) def create_merchant(merch...
Roshankattel/RFID2
rfiddemo/routers/merchants.py
merchants.py
py
1,553
python
en
code
0
github-code
6
24247317201
import tkinter import customtkinter import random cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 11] def draw(): global player_score global enemy_score win_label.configure(text=" ") randint = random.randint(0, len(cards) - 1) player_cards.append(cards[randint]) player_score += int(cards[randi...
anarkitty8/gui-blackjack
blackjack_gui.py
blackjack_gui.py
py
2,420
python
en
code
0
github-code
6
37149926407
# 21. Se cuenta con una lista de películas de cada una de estas se dispone de los siguientes datos: # nombre, valoración del público –es un valor comprendido entre 0-10–, año de estreno y recaudación. # Desarrolle los algoritmos necesarios para realizar las siguientes tareas: from random import randint from lista impo...
GabiC15/TPs-Algoritmos
TP4/ejercicio_21.py
ejercicio_21.py
py
2,324
python
es
code
0
github-code
6
23431004467
import numpy as np import math # 0 ~ 26 : blocks (color, shape, pattern) # 27 : empty # 28 ~ 30 : dummy blocks def circle_dist(x, y): return math.sqrt(x*x + y*y) def square_dist(x, y): return max(x, -x, y, -y) def triangle_dist(x, y): return max((6 * x - 3 * y + 1) / 4, (- 6 * x - 3 * y + 1) / 4, (3 * y...
yskim5892/gym_BHB
gym_BHB/envs/BHB_renderer.py
BHB_renderer.py
py
4,404
python
en
code
0
github-code
6
16463309857
# web template maker import os # templates HTML_TEMPLATE = """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <!--HEADER--> ...
jtriley-eth/python-scripts
scripts/web-template-generator.py
web-template-generator.py
py
2,324
python
en
code
0
github-code
6
27390337341
# Catalan Numbers and RNA Secondary Structures # http://rosalind.info/problems/cat/ from collections import defaultdict from utilities import get_file, read_FASTA, get_answer_file # Noncrosing Perfect Maching def catalan(strand): if (strand not in cache): if strand.count('C') != strand.count('G') or stran...
Delta-Life/Bioinformatics
Rosalind/Bioinformatics Stronghold/code/CAT.py
CAT.py
py
932
python
en
code
0
github-code
6
35136983267
import Forge.core.Process import Anvil.core import WindowExecute class WindowOpen( WindowExecute.WindowExecute ): def __init__( self, title=None, iconPath=None, size=[ 400, 100 ], entity=None, cmd=None, arg={}, ui=None ): if not title: title = 'Open entity : %i' %( entity['entityId'] ) self.init( title=tit...
Black-Cog/Hammer
ui/WindowOpen.py
WindowOpen.py
py
855
python
en
code
0
github-code
6
3373850562
import random def get_lottery_numbers(amount = 5): lottery_numbers = [] for i in range(amount): lottery_numbers.append(random.randint(0, 100)) return lottery_numbers def get_user_entry(amount = 5): user_numbers = [] for x in range(amount): while len(user_numbers) < amount: number = int(i...
usman-tahir/python-snippets
python-games/lottery.py
lottery.py
py
1,813
python
en
code
0
github-code
6
28359703116
import csv import DBN import matplotlib.pyplot as plt def getData(inp="../ABP_data_11traces_1min/dataset7.txt"): f = file(inp) lines = f.readlines() data = (map(float,l.split(" ")[:3]) for l in lines) # end = lines.index('\n') # obs = lines[1:end] # data = map(lambda x: tuple(map(float,x.split(','))),obs) retur...
romiphadte/ICU-Artifact-Detection-via-Bayesian-Inference
ABP_DBN/run.py
run.py
py
2,090
python
en
code
0
github-code
6
17112178327
'''Write a function that takes a character (i.e. a string of length 1) and returns True if it is a vowel, False otherwise.''' def Vowel(x): if x=='a' or x=='e' or x=='i' or x=='o' or x=='u': return True else: return False x = input("Enter The string :") obj = Vowel(x) print(obj)
abhinav319/abhinav_code
Question4.py
Question4.py
py
319
python
en
code
0
github-code
6
3982866631
import math origin = [399809, 4881610] end = [989876, 4291543] # 590067x590067m intermediate point -> 4586576,5 def calculate_tile(x, y, z): """ Calculate tile number from the coordinates passed as parameter. Normal test >>> calculate_tile(650000, 4400000, 9) (217, 417) Limit test >>> calculate_tile(989876, ...
strummerTFIU/TFG-IsometricMaps
src/calculate_tile.py
calculate_tile.py
py
3,553
python
en
code
0
github-code
6
15143899898
# Created: 2022-07-06 # Link: https://open.kattis.com/problems/helpaphd #Recommended from the guide: https://github.com/VictorieeMan/kattis-guide/blob/master/input.md import sys # Kattis / Machine input input = sys.stdin.read() # Manual input # input = "4\n\2+2\1+2\p=NP\0+0" string = input.split("\n")[1:-1] for i...
VictorieeMan/Kattis_Solutions
Python 3/problems/@Solved/helpaphd/helpaphd.py
helpaphd.py
py
468
python
en
code
0
github-code
6
72902347389
""" run.py Autor: Juan Pablo """ from misVariable import * #uso de condicional simple nota= input("Ingrese la nota 1: \n") nota2 = input("Ingrese nota 2: \n") nota = int(nota) nota2 = int(nota2) if nota >= 18: print(mensaje) if nota2 >= 18: print(mensaje)
concpetosfundamentalesprogramacionaa19/ejercicios-clases5-020519-jleon1234
miProyecto/run.py
run.py
py
268
python
es
code
0
github-code
6
39425074538
import discord class DiscordClient(discord.Client): def __init__(self, channel: int, players: list): self.channel: int = channel self.players: list = players super().__init__() async def on_ready(self): print(f"{self.user} is connected!") channel = self.get_channel(se...
kevinrobayna/rio_discord_bot
rio_discord_bot/discord_client.py
discord_client.py
py
1,073
python
en
code
0
github-code
6
19499854601
# -*- coding: utf-8 -*- import pytest from mdye_leetcode.solution_28 import Solution # makes a Solution object b/c that's how leetcode rolls @pytest.fixture(scope="module") def sol(): yield Solution() def test_solution_28_basic(sol: Solution): assert sol.strStr("mississippi", "issip") == 4 assert sol....
michaeldye/mdye-python-samples
src/mdye_leetcode/test/test_solution_28.py
test_solution_28.py
py
513
python
en
code
0
github-code
6
29546248670
import sys import threading # Use Thread to Speed up to log(n) - WRONG WAY # WRONG! WRONG! WRONG!!! class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None threadLock = threading.Lock() threads = [] result = True class myThread(threading.Thread):...
HeliWang/upstream
Concurrency/validate-bst.py
validate-bst.py
py
4,552
python
en
code
0
github-code
6
28705163606
# Написать программу, которая состоит 4 из этапов: # - создает список из рандомных четырехзначных чисел # - принимает с консоли цифру и удаляет ее из всех элементов списка # - цифры каждого элемента суммирует пока результат не станет однозначным числом # - из финального списка убирает все дублирующиеся элементы # - пос...
MihailOgorodov/python_courses
seminar4/3.py
3.py
py
2,395
python
ru
code
0
github-code
6
16838118388
from typing import List from urllib.parse import urlparse import pandas as pd from pathlib import Path from behave import Given, When, Then, Step from csvcubeddevtools.behaviour.file import get_context_temp_dir_path from csvcubeddevtools.helpers.file import get_test_cases_dir from rdflib import Graph from csvcubed.mod...
GDonRanasinghe/csvcubed-models-test-5
csvcubed/tests/behaviour/steps/qbwriter.py
qbwriter.py
py
27,298
python
en
code
0
github-code
6
42560657012
# 4.3 # List of Depths: Given a binary tree, design an algorithm which creates a linked list of all the nodes # at each depth (e.g., if you have a tree with depth D, you'll have D linked lists). import unittest from Chapter_4_TreesAndGraphs import BinaryTree from Chapter_4_TreesAndGraphs.Node import Node from Chapter_...
JSchoreels/CrackingTheCodingInterview
Chapter_4_TreesAndGraphs/ex_4_3_ListOfDepths.py
ex_4_3_ListOfDepths.py
py
1,460
python
en
code
0
github-code
6
44035409119
def nearestValidPoint(x, y, points): # if x matches left side of any of the points its valid # if y matches right side of any of the points its valid # Manhatten distance is abs(x) smallest_seen = float('inf') index = -1 for i, (a, b) in enumerate(points): print(i, a, b) print(po...
MichelleGray78/LeetCode_Problems
LeetCode_Problems/nearest_point_with_same_x_or_y/main.py
main.py
py
600
python
en
code
0
github-code
6
39920879314
""" This module implement the ServiceProxy class. This class is used to provide a local proxy to a remote service for a ZeroRobot. When a service or robot ask the creation of a service to another robot, a proxy class is created locally so the robot see the service as if it as local to him while in reality the service ...
BolaNasr/0-robot
zerorobot/service_proxy.py
service_proxy.py
py
7,252
python
en
code
0
github-code
6
73026312507
from typing import DefaultDict import sys import os import csv sys.path.append(0, os.path.abspath('.')) sys.path.append(0, os.path.abspath('./src')) sys.path.append(0, os.path.abspath('./src/utilities')) from src.utilities import SCRIPT_HOME from src.utilities.post_process import post_proc_timeseries from net_sim impor...
mattall/topology-programming
scripts/TDSC/sim_event.py
sim_event.py
py
3,375
python
en
code
0
github-code
6
9224589864
from prediction.M2I.predictor import M2IPredictor import numpy as np import math import logging import copy import random import time import interactive_sim.envs.util as utils import plan.helper as plan_helper import agents.car as car S0 = 2 T = 0.25 #1.5 # reaction time when following DELTA = 4 # the power term in...
Tsinghua-MARS-Lab/InterSim
simulator/plan/env_planner.py
env_planner.py
py
107,809
python
en
code
119
github-code
6
21928800747
# Coroutines import time def coroutine(): time.sleep(3) text = "Hey guys! Welcome to Parallax Coders. How are you ? Have a great day" while True: checking_text = (yield) if checking_text in text: print("Your word has been found !") else : print("Your book h...
MahbinAhmed/Learning
Python/Python Learning/Revision/56. Coroutines.py
56. Coroutines.py
py
573
python
en
code
0
github-code
6
18003867595
import torch import torch.nn as nn import torch.nn.functional as F from algo.pn_utils.maniskill_learn.networks import build_model, hard_update, soft_update from algo.pn_utils.maniskill_learn.optimizers import build_optimizer from algo.pn_utils.maniskill_learn.utils.data import to_torch from ..builder import MFRL from ...
PKU-EPIC/UniDexGrasp
dexgrasp_policy/dexgrasp/algo/pn_utils/maniskill_learn/methods/mfrl/td3.py
td3.py
py
3,767
python
en
code
63
github-code
6
34421435243
import numpy as np import pandas as pd import json import argparse import catboost from catboost import CatBoostClassifier, Pool, metrics, cv from catboost.utils import get_roc_curve, get_confusion_matrix, eval_metric from sklearn.metrics import accuracy_score, roc_auc_score from sklearn.model_selection import train_...
mihael-tunik/SteppingStonesCatboost
classifier.py
classifier.py
py
4,248
python
en
code
0
github-code
6
23185192152
#!/usr/bin/env python3 """ Download the name of all games in the bundle. Download their info and scrore from opencritic if they exist there. Sort by score. """ import json import urllib.request import urllib.parse from typing import List from bs4 import BeautifulSoup from typing_extensions import TypedDict Game = ...
Hyerfatos/itchio_bundle_games
itch.py
itch.py
py
3,789
python
en
code
0
github-code
6
26039112676
from __future__ import annotations from dataclasses import dataclass from pants.core.goals.package import BuiltPackageArtifact from pants.util.strutil import bullet_list, pluralize @dataclass(frozen=True) class BuiltDockerImage(BuiltPackageArtifact): # We don't really want a default for this field, but the supe...
pantsbuild/pants
src/python/pants/backend/docker/package_types.py
package_types.py
py
1,072
python
en
code
2,896
github-code
6
10159706498
# 6) Write a Script to sum of prime numbers in a given number number = int(input("Enter a no:")) sum = 0 while number != 0: rem = number % 10 number = number // 10 if rem != 4 and rem != 6 and rem != 8 and rem != 9: sum = sum + rem print("the sum is:", sum)
suchishree/django_assignment1
python/looping/while loop/demo8.py
demo8.py
py
280
python
en
code
0
github-code
6
35708774977
import random def local_search(items, capacity): """ Solves the knapsack problem using a local search approach. Args: items: A list of items, where each item is a tuple of (value, weight). capacity: The capacity of the knapsack. Returns: A list of items that are included in the knapsack. """ ...
Jonathanseng/Algorithm-Design-Methods
13. Local Search/13.7 Local Search Pattern.py
13.7 Local Search Pattern.py
py
2,691
python
en
code
3
github-code
6
28773188393
""" examples @when('the user searches for "{phrase}"') def step_impl(context, phrase): search_input = context.browser.find_element_by_name('q') search_input.send_keys(phrase + Keys.RETURN) @then('results are shown for "{phrase}"') def step_impl(context, phrase): links_div = context.browser.find_element_b...
kevindvaf/rocketmiles
features/steps/search.py
search.py
py
4,218
python
en
code
0
github-code
6
20602544780
from sqlalchemy import create_engine, Column, Integer, String, Float from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker engine = create_engine('sqlite:///test.db', echo=True) Base = declarative_base(engine) ############################################################...
BhujayKumarBhatta/flask-learning
flaskr/db/mysqlalchemy.py
mysqlalchemy.py
py
2,971
python
en
code
1
github-code
6
37158346153
import squarify import matplotlib.pyplot as plt import matplotlib.cm import numpy as np x = 0. y = 0. width = 950 height = 733 fig = plt.figure(figsize=(15, 12)) ax = fig.add_subplot(111, axisbg='white') values = [285.4, 188.4, 173, 140.6, 91.4, 75.5, 62.3, 39.6, 29.4, 28.5, 26.2, 22.2] labels = ['South Africa', 'Eg...
QiliWu/Python-datavis
datavis/Africa GDP.py
Africa GDP.py
py
1,435
python
en
code
2
github-code
6
71819476349
n=int(input("Enter digit:")) if(n<=1): print(n) else: n1=0 n2=1 for x in range(n-1): feb=n1+n2 n1=n2 n2=feb print(feb) #recursive methode
P111111111/DAA_Lab-Manual
A1_withot_recurssion.py
A1_withot_recurssion.py
py
182
python
en
code
0
github-code
6
23313489127
import bpy class SFX_Socket_Float(bpy.types.NodeSocket): '''SFX Socket for Float''' bl_idname = 'SFX_Socket_Float' bl_label = "Float" float: bpy.props.FloatProperty(name = "Float", description = "Float", default = 0.0) ...
wiredworks/wiredworks_winches
sockets/SFX_Socket_Float.py
SFX_Socket_Float.py
py
1,073
python
en
code
12
github-code
6
71979063548
#not sure how to go about this one???? #I can create a loop craeteing a list of coordinates i have been to for both wires #then find intersections based on those coordinates #also the main port will be zero zero import math intersections = [] #keep in mind the main port is (0,0) f = open('data.txt') wireOne = f.readlin...
Hector-bit/adventOfCode
year2019/crossedWiresDAY3/parteUno.py
parteUno.py
py
1,779
python
en
code
0
github-code
6
41939702684
# translate exercise in python # translate the file in japanese # so use ' pip install translate' from translate import Translator translator = Translator(to_lang='ja') try: with open('test.txt', mode='r') as my_file: text = my_file.read() translation = translator.translate(text) with ope...
hyraja/python-starter
09.FILE I-O python/03.exercise_translator.py
03.exercise_translator.py
py
481
python
en
code
0
github-code
6
74160534269
import datetime import enum import os import signal import subprocess import sys import time import typing from logging import getLogger from threading import Thread import requests from slugify import slugify from config import Setting, client_id, client_secret from util import file_size_mb, get_setting logger = ge...
bcla22/twitch-multistream-recorder
twitch.py
twitch.py
py
8,358
python
en
code
0
github-code
6
37056623803
import os import numpy as np from sklearn import datasets from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import KFold, GridSearchCV from sklearn.svm import SVC from sklearn.externals import joblib from utils import save_answer BASE_DIR = os.path.dirname(os.path.realpath(__file...
Nick-Omen/coursera-yandex-introduce-ml
lessons/article/main.py
main.py
py
1,903
python
en
code
0
github-code
6
22480925936
from fastai.vision import * from fastai.widgets import* import numpy as np classes = ['ac','as','cb','cc','ci','cs','cuCon','cu','ns','sc','st'] # %% path = Path('images/') #for name in classes: # folder = name # file = name + '.csv' # dest = path/folder # dest.mkdir(parents = True, exist_ok = True) # ...
DrDJIng/CloudIdentifier
classifyClouds.py
classifyClouds.py
py
1,353
python
en
code
0
github-code
6
30066696464
import logging import os from PIL import Image from PIL.ExifTags import TAGS class Utils: @staticmethod def extract_exif_data(image: Image) -> {}: map_tag_dict = {} exif_data = image.getexif() for tag_id in exif_data: tag = TAGS.get(tag_id, tag_id) data = exif_...
greencashew/image-captioner
imagecaptioner/utils.py
utils.py
py
1,630
python
en
code
0
github-code
6
10633670979
def isPrime(n): if n == 1: return False for i in range(2, int(n**(1/2))+1): if n%i == 0: return False return True def dec2n(n, k): result = "" while n>0: n, i = divmod(n, k) result += str(i) return result[::-1] def solution(n, k): arr = dec2n...
eastdh/CT-algorithm
programmers_school/lv2/23.01.15 - k진수에서 소수 개수 구하기, 압축/k진수에서 소수 개수 구하기.py
k진수에서 소수 개수 구하기.py
py
525
python
en
code
0
github-code
6
35665366566
import UploadgramPyAPI from core import logger class Uploadgram: @staticmethod def upload(path_to_file): try: up_file = UploadgramPyAPI.NewFile(path_to_file) response: dict = up_file.upload() logger.info(response) return response except Uploadgr...
YuryVetrov/Media-file-downloader-bot
cloud_storage/Uploadgram.py
Uploadgram.py
py
892
python
en
code
0
github-code
6
11814433027
from get_url import GetUrl import requests from bs4 import BeautifulSoup class GetText(): def __init__(self, area): self.got_url = GetUrl() self.url = self.got_url.get_url(area) def get_url(self): url = self.url return url def get_text(self): err_text = '以下の地域から選んでください\n北海道\n東北\n関東\n信越・北陸\n東海\n近畿\n中国\n...
yutatakaba/weather_apr
get_text.py
get_text.py
py
761
python
en
code
0
github-code
6
1776827146
from pandas.tseries.frequencies import to_offset import numpy as np import pandas as pd def get_numeric_frequency(freq): """ Return the frequency of a time series in numeric format. The function returns the frequency of a time series in numeric format. This is useful when working with forecasting lib...
yForecasting/DeepRetail
DeepRetail/forecasting/utils.py
utils.py
py
12,762
python
en
code
0
github-code
6
13412454502
# 自己设计的CNN模型 import torch.nn as nn import torch.nn.functional as F class ConvolutionalNetwork(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, 3, 1) # conv1 (RGB图像,输入通道数为3) self.conv2 = nn.Conv2d(6, 16, 3, 1) # conv2 self.fc1 = nn.Linear(54 *...
Tommy-Bie/sign_language_classification
my_CNN.py
my_CNN.py
py
924
python
en
code
1
github-code
6
26848770395
import sys from PySide6.QtWidgets import QApplication, QPushButton from PySide6.QtCore import Slot # 这个例子包含Signals and Slots(信号与槽机制) # 使用@Slot()表明这是一个槽函数 # @Slot() 服了,没使用这个居然也能照常运行 def say_hello(): print("Button, clicked, hello!") app = QApplication([]) # QPushButton里面的参数是按钮上会显示的文字 button = QPus...
RamboKingder/PySide6
button-2.py
button-2.py
py
524
python
zh
code
2
github-code
6
16194751087
import urllib import json import pandas as pd from pandas.io.json import json_normalize from rdflib import URIRef, BNode, Literal, Graph from rdflib import Namespace from rdflib.namespace import RDF, FOAF, RDFS, XSD from datetime import datetime #api key = 57ab2bbab8dda80e00969c4ea12d6debcaddd956 for jsdeux api #let'...
zhantileuov/rdf_project
generate.py
generate.py
py
5,906
python
en
code
0
github-code
6
11463544163
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 11 12:08:53 2022 @author: sampasmann """ import sys sys.path.append("../../") import os from src.init_files.mg_init import MultiGroupInit import numpy as np import matplotlib.pyplot as plt Nx = 1 data12 = MultiGroupInit(numGroups=12, Nx=Nx) data70...
spasmann/iQMC
post_process/plotting/mg_solutions.py
mg_solutions.py
py
1,957
python
en
code
2
github-code
6
35835057096
from re import compile from utils import BasicError # Class for Tokens class Token(): # Token type will have a name and a value def __init__(self, type_name, value, pos_start, pos_end): self.type = type_name self.value = value self.pos_start = pos_start self.pos_end = pos_end ...
shaleen111/pyqb
lexer.py
lexer.py
py
2,416
python
en
code
0
github-code
6
42283221124
class FpMethodResult(): clone_parts_1: list # части с заимствованиями из первого файла clone_parts_2: list # части с заимствованиями из второго файла clone_pct: float # процент заимствований def __init__(self, cl_pt1, cl_pt2, clp_pct) -> None: self.clone_parts_1 = cl_pt1 sel...
Urdeney/Diploma
clonus/methods/fp_method.py
fp_method.py
py
596
python
ru
code
0
github-code
6
36667789639
import numpy as np import scipy.stats as stats # 1 ----------------------- print("Task 1") # 1) Даны значения величины заработной платы заемщиков банка (zp) и значения их поведенческого # кредитного скоринга (ks): # zp = [35, 45, 190, 200, 40, 70, 54, 150, 120, 110], # ks = [401, 574, 874, 919, 459, 739, 653, 902, 7...
SofyaSofya21/tprob_mathstat_hw8
task1.py
task1.py
py
1,748
python
ru
code
0
github-code
6
21610135351
import requests import re import json from nonebot import on_command, CommandSession @on_command('lol新闻', aliases=('lol新闻')) async def weather(session: CommandSession): url = "http://l.zhangyoubao.com/news/" headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Ge...
Lmg66/QQrobot
awesome-bot/awesome/plugins/lol.py
lol.py
py
980
python
en
code
3
github-code
6
8662253484
import logging import sys import tarfile import tempfile from urllib.request import urlopen from zipfile import ZipFile from pathlib import Path TF = "https://github.com/tensorflow/tflite-micro/archive/80cb11b131e9738dc60b2db3e2f1f8e2425ded52.zip" CMSIS = "https://github.com/ARM-software/CMSIS_5/archive/a75f01746df18b...
alifsemi/alif_ml-embedded-evaluation-kit
download_dependencies.py
download_dependencies.py
py
4,091
python
en
code
1
github-code
6
24332065584
# We import pandas into Python import pandas as pd google_stock = pd.read_csv(r'learn_python\pandas\statistics_from_stock_data\GOOG.csv', index_col=['Date'], usecols=['Date', 'Adj Close'], parse_dates=True) apple_stock = pd.read_csv(r'learn_python\pandas\statistics_from_stock_data\AAPL.csv', index_col=['Date'], usecol...
funnyfeet434/Learn_AI
learn_python/pandas/statistics_from_stock_data/statistics_from_stock.py
statistics_from_stock.py
py
1,431
python
en
code
0
github-code
6
20025251905
import os import re def create_current_file_message(filename): basename = os.path.basename(filename) return "{:<30.30} => ".format(basename) def create_insert_message(sql_query, row_count, execution_time=None): """ Create message on how many lines inserted into which table """ if row_count >= 0: ...
thehyve/ohdsi-etl-caliber
python/util/message_creation.py
message_creation.py
py
1,690
python
en
code
4
github-code
6
13438082129
""" Boston house prices dataset """ import sklearn.datasets import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split from sklearn.preprocessing import PolynomialFeat...
i-hs/lab-python
scratch13/ex05.py
ex05.py
py
6,999
python
en
code
0
github-code
6
74048870269
import pandas as pd import os from calendar import monthrange from datetime import datetime,timedelta import re import numpy as np from models.fed_futures_model.backtestloader import BacktestLoader from models.fed_futures_model.fff_model import FederalFundsFuture class Backtest(): def __init__(self, path): ...
limjoobin/bt4103-rate-decision-index
rate_decision_index/models/fed_futures_model/backtest.py
backtest.py
py
3,664
python
en
code
0
github-code
6
71663956668
# A = X = Rock = 0 # B = Y = Paper = 1 # C = Scissors = 2 # Rock (0) bests Scissors (2) # Paper (1) beats Rock (0) # Scissors (2) beats Paper (1) beats = (2, 0, 1) def score_round(opponent, player): score = player + 1 if player == opponent: score += 3 elif beats[player] == opponent: score += 6 return score...
jacobschaer/advent_of_code_2022
day_2/aoc2.py
aoc2.py
py
1,129
python
en
code
0
github-code
6
10189584256
from random import random def simulatedChampionshipWinner(players): reset(players) championshipEnd = False master = 0 numPlayers = len(players) challengers = players.copy() challengers.pop(0) while not championshipEnd: participant = challengers.pop(0) if simulatedMatchW...
peulsilva/giants-steps-summer
multiplePlayers.py
multiplePlayers.py
py
1,358
python
en
code
0
github-code
6
8224455984
# MAC0318 Intro to Robotics # Please fill-in the fields below with every team member info # # Name: José Lucas Silva Mayer # NUSP: 11819208 # # Name: Willian Wang # NUSP: 11735380 # # Any supplemental material for your agent to work (e.g. neural networks, data, etc.) should be # uploaded elsewhere and listed down below...
josemayer/pato-wheels
project/agent.py
agent.py
py
5,379
python
en
code
0
github-code
6
32915067412
from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class Group(models.Model): title = models.TextField(max_length=200, verbose_name='Название') slug = models.SlugField(unique=True, verbose_name='Идентификатор') description = models.TextField(verbose_name='...
dew-77/api_final_yatube
yatube_api/posts/models.py
models.py
py
2,618
python
en
code
0
github-code
6
73102772669
""" Faça um programa que leia seis valores numéricos atribuindo-os à duas variáveis do tipo lista com três elementos cada. Cada variável irá representar um vetor, informe o produto escalar e o produto vetorial destes vetores. """ lista3 = [] lista4 = [] for x in range(3): lista3.append(int(input("Digite ...
devmarcosvinicius/UDF
1º Semestre/Programação de Computadores/Simulado/3.py
3.py
py
502
python
pt
code
0
github-code
6
14965343125
""" This file defines the Variable, a class used for basic mathematical operations and gradient calculations. Authors: MILES MCCAIN and LIV MARTENS License: GPLv3 """ import random import numpy as np import math class Variable(): def __init__(self, eval_=None, grad=None, representation=None, name=None): ...
milesmcc/csc630-machine-learning
compgraphs/variable.py
variable.py
py
9,156
python
en
code
0
github-code
6
70199866108
class Node: def __init__(self, data, next=None): self.data = data self.next = next class LinkedList: def __init__(self): self.head = None def get_first(self): return self.head def add_last(self, data): new_node = Node(data) if self.head is None: ...
hazalonler/data-structure-implementation
src/linked_list_impl.py
linked_list_impl.py
py
3,202
python
en
code
1
github-code
6
71913648828
import numpy as np import f_info from f_info import* def refine_cutting_plane(k, current_agent, i, dim, Na): m = k-1 x = current_agent['x_memory'] g = current_agent['g_memory'] f = current_agent['f_memory'] current_query = x[i*dim:(i+1)*dim, m-1] tilde_gjm_i = np.empty(shape=(0,0)) tilde_fj...
zty0312/Distributed-Cutting-Plane-Consensus
prepare_algorithm.py
prepare_algorithm.py
py
1,902
python
en
code
0
github-code
6
71432253948
import click group = click.Group("jaqsmds") @group.command(help="Run auth server for jaqs.data.DataApi client.") @click.argument("variables", nargs=-1) @click.option("-a", "--auth", is_flag=True, default=False) def server(variables, auth): from jaqsmds.server.server import start_service env = {} for it...
cheatm/jaqsmds
jaqsmds/entry_point.py
entry_point.py
py
642
python
en
code
4
github-code
6
3400836706
# -*- coding: utf-8 -*- from flask import Flask from pydoc import locate class ConstructApp(object): def __init__(self): self.extensions = {} self.web_app = self.init_web_app() def __call__(self, settings, force_init_web_app=False): if force_init_web_app is True: self.w...
tigal/mooc
application.py
application.py
py
1,660
python
en
code
0
github-code
6
39691118341
#!/usr/bin/env python import sys from xml.etree import ElementTree def run(files): first = None for filename in files: data = ElementTree.parse(filename).getroot() if first is None: first = data else: first.extend(data) if first is not None: print(Ele...
cheqd/cheqd-node
.github/scripts/xml_combine.py
xml_combine.py
py
412
python
en
code
61
github-code
6
12731825315
# series into dataframes import pandas as pd import numpy as np s = pd.Series(np.arange(4)) print(s) s= pd.Series([1.0,2.0,3.0],index=['x','y','z']) print(s) s= pd.Series({'a':1,'b':2,'c':3,'d':4}) print(s) s=pd.Series([1,2,3,4],['t','x','y','z']) print(np.sqrt(s)) #concat 2 series names=pd.Series(['Einstein','Marie C...
ndlopez/learn_python
source/pandas_test.py
pandas_test.py
py
1,058
python
en
code
0
github-code
6
20856359623
""" Training code for harmonic Residual Networks. Licensed under the BSD License [see LICENSE for details]. Written by Matej Ulicny, based on pytorch example code: https://github.com/pytorch/examples/tree/master/imagenet """ import argparse import os import random import shutil import time import war...
matej-ulicny/harmonic-networks
imagenet/main.py
main.py
py
13,809
python
en
code
55
github-code
6
5593654816
import telegram import google import logging import base64 import io from requests_html import HTMLSession from google.cloud import firestore from bs4 import BeautifulSoup from PIL import Image from time import sleep from Spider import get_all_course from UESTC_Login import _login, get_captcha def __Bot_t...
mrh929/uestc_calendar_bot
calendar/main.py
main.py
py
6,925
python
en
code
0
github-code
6
72784467067
# https://www.codewars.com/kata/630647be37f67000363dff04 def draw(deck): print_deck(deck, True) # Using unicode characters print_deck(deck, False) # Using regular characters drawn_cards = [] while len(deck) > 1: drawn_cards.append(deck.pop(0)) if deck: deck.append(deck.p...
blzzua/codewars
7-kyu/playing_cards_draw_order_–_part_1.py
playing_cards_draw_order_–_part_1.py
py
357
python
en
code
0
github-code
6
37009441089
# coding=utf-8 import pymysql from com.petstore.dao.base_dao import BaseDao """订单明细管理DAO""" class OrderDetailDao(BaseDao): def __init__(self): super().__init__() def create(self, orderdetail): """创建订单明细,插入到数据库""" try: with self.conn.cursor() as cursor: sql ...
wanglun0318/petStore
com/petstore/dao/order_detail_dao.py
order_detail_dao.py
py
862
python
en
code
0
github-code
6
74309701307
from turtle import Turtle class Scoreboard(Turtle): def __init__(self): super().__init__() self.score = 0 self.color("white") self.penup() self.hideturtle() self.highscore = 0 self.update_score() def update_score(self): self.goto(x=-50, y=320) ...
shuklaritvik06/PythonProjects
Day - 24/scoreboard.py
scoreboard.py
py
1,202
python
en
code
0
github-code
6
9622430105
#!/usr/bin/env python3 import base64 import c3, c5 from itertools import combinations def beautify(candidates: list): ''' Pretty prints the candidates returned ''' s = '' for c in candidates: s += 'Keysize: {}\tHamming Distance: {}\n'.format( c['keysize'], c['normalized_distance']) ret...
oatovar/Cryptopals-Solutions
c06.py
c06.py
py
4,159
python
en
code
0
github-code
6
25602918486
def pairs(s): summa = 0 bitit = 0 edellinen = 0 pituus = 0 for i in range(0, len(s)): pituus += 1 if s[i] == "1": x = pituus * bitit + edellinen summa += x edellinen = x bitit += 1 pituus = 0 return summa if __name__ ==...
Noppacase22/DSA-2022
bitpairs.py
bitpairs.py
py
431
python
fi
code
0
github-code
6
34348826764
from datetime import datetime from django.contrib.auth.models import AbstractUser from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models YEAR_VALIDATION_ERROR = 'Нельзя добавить произведение из будущего' SCORE_VALIDATION_ERROR = 'Оценка должна быть от 1 до 10' class Use...
RomanK74/api_yamdb
api/models.py
models.py
py
6,054
python
en
code
0
github-code
6
34670378486
import sys from math import log from copy import deepcopy from typing import Dict, List from lib.graph import Graph, read_input_csv class TraceNode: def __init__(self, id): self.id = id self.preds = [] def shortest_trace(graph, node): """ Compute the shortest attack trace to the specifi...
pmlab-ucd/IOTA
python/graph_analyzer.py
graph_analyzer.py
py
7,605
python
en
code
1
github-code
6
72416891708
import os import subprocess from abc import ABC, abstractmethod from datatig.models.git_commit import GitCommitModel class RepositoryAccess(ABC): @abstractmethod def list_files_in_directory(self, directory_name: str) -> list: return [] @abstractmethod def get_contents_of_file(self, file_name...
DataTig/DataTig
datatig/repository_access.py
repository_access.py
py
4,800
python
en
code
4
github-code
6
72249954427
import json import atexit import subprocess import yaml import argparse import textwrap from dataclasses import dataclass @dataclass class Config: num_nodes: int config_path: str def __init__(self, n: int, c: str): self.num_nodes = n self.config_path = c self.place_holder_commands...
pesos/heiko
docker-networks.py
docker-networks.py
py
3,338
python
en
code
13
github-code
6
28666209791
import unittest from name_function import get_formatted_name2 class NameTestCase(unittest.TestCase): """Tests for 'name_function.py""" def test_first_last_name(self): """Do names like 'janis joplin' work?""" # This is what the function is taking in as an example and comparing formatted...
jerenteria/python_tests
test_name_function.py
test_name_function.py
py
763
python
en
code
0
github-code
6
8263385619
from pymongo import * client = MongoClient("localhost", 27017) db = client.tmp collection = db.stu2 # 插入数据 # collection.insert({"name":"f", "gender":"f", "age":25}) # 修改操作 # collection.update({"name":"f"}, {"$set":{"name":"g"}}) # 删除数据 # collection.delete_one({"name":"g"}) # 查询数据 # cursor = collection.find() # for...
luk0926/python
mongo/PyMongo.py
PyMongo.py
py
517
python
en
code
0
github-code
6
74434743869
from django.shortcuts import render from django.contrib.auth.decorators import login_required from test_generator.models import * # Create your views here. def home(request): if request.user.is_authenticated: status = "You're currently logged in." else: status = "You're not currently logged i...
alenamedzova/final_project
tester_services/views.py
views.py
py
767
python
en
code
0
github-code
6
3151231607
import sys import form from PyQt4 import QtCore, QtGui import letters import pygame class ConnectorToMainWindow(QtGui.QMainWindow): def __init__(self, parent = None): super(ConnectorToMainWindow, self).__init__() self.expected_letter = '' self.timer = QtCore.QTimer() self.ui = form...
Tal-Levy/homeSchooling
first_steps.py
first_steps.py
py
3,110
python
en
code
0
github-code
6
1005006973
import socket import json class pyWave: configStr = "{ 'enableRawOutput': 'enableRawOutput', 'format': 'Json'}" configByte = configStr.encode() val = 0 def __init__(self, _host, _port): self.host = _host self.port = _port def connect(self): # This is a standard connectio...
kittom/Mind-Control-Car
BrainWaveReader/pywave.py
pywave.py
py
1,713
python
en
code
0
github-code
6
38008765446
""" # Analysis utilities This script belongs to the following manuscript: - Mathôt, Berberyan, Büchel, Ruuskanen, Vilotjević, & Kruijne (in prep.) *Causal effects of pupil size on visual ERPs* This module contains various constants and functions that are used in the main analysis scripts. """ import random import ...
smathot/causal-pupil
analysis_utils.py
analysis_utils.py
py
23,689
python
en
code
2
github-code
6
40615421063
import os import time from collections import Counter import numpy as np from sklearn.preprocessing import MinMaxScaler import core.leading_tree as lt import core.lmca as lm from core.delala_select import DeLaLA_select from utils import common def load_parameters(param_path): dataset = common.load...
alanxuji/DeLaLA
DeLaLA/DeLaLA-Letter.py
DeLaLA-Letter.py
py
7,574
python
en
code
6
github-code
6
14769244814
from defines import NUMBER_OF_RESULTS_FOR_QUERY from logging_messages import log_debug_message from memories_querying import ( retrieve_description_from_scored_results_entry, search_memories, ) from vector_storage import process_raw_data from wrappers import validate_agent_type def generate_summary_...
joeloverbeck/intelligent_agents_simulations
character_summaries.py
character_summaries.py
py
4,287
python
en
code
0
github-code
6
35863181048
import os from trainingData import get_filenames def stats_main(): f = open("dataList.csv", "w") f.write("sample, file, supop\n") samples, all_files = get_filenames() for i in range(len(samples)): sample = samples[i] for file in all_files[i]: text = writeData(sampl...
ryngrg/DNA_classifier
dataList.py
dataList.py
py
984
python
en
code
0
github-code
6
14186262586
import json from sksurv.functions import StepFunction from sksurv.linear_model import CoxPHSurvivalAnalysis from sksurv.metrics import concordance_index_censored from sksurv.nonparametric import nelson_aalen_estimator, kaplan_meier_estimator from core.cox_wrapper import CoxFairBaseline from core.drawing import draw_po...
DanilaEremenko/SurvBeX
main_run_synth_data_explainers.py
main_run_synth_data_explainers.py
py
10,714
python
en
code
0
github-code
6
32108433366
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import logging from temba_client.v2 import TembaClient from django.conf import settings from django.db import migrations from ureport.utils import datetime_to_json_date, json_date_to_datetime logger = logging...
rapidpro/ureport
ureport/polls/migrations/0023_populate_flow_date.py
0023_populate_flow_date.py
py
1,499
python
en
code
23
github-code
6