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
26267040484
import os from alright import WhatsApp msgr=WhatsApp() #whatsap web opens numb=["9645703000","9847171069","9207473682"] s=5 i=0 #msgr.get_first_chat() for i in numb: print(i) for j in range(0,50): msgr.find_user(numb) msgr.send_message('HaCkEd!') #i++ #msgr.find_user(numb[i])...
ArkTrek/WhatsBombDetector
Plugin/Doc.py
Doc.py
py
393
python
en
code
0
github-code
1
3766678139
import json import os SEQUENCE_LENGTH = 64 DATASET_PATH = './dataset' SINGLE_FILE_DATASET_PATH = 'file_dataset' MAPPING_PATH = 'mapping.json' def load(file_path): with open(file_path, 'r') as file: song = file.read() return song def save(songs, file_dataset_path): with open(file_dataset_path, '...
Jiangyuliang0813/MusicGeneration
datasetbuilding.py
datasetbuilding.py
py
2,007
python
en
code
0
github-code
1
36064335120
# get chat completions by by passing one or more messages to the chat model from langchain.chat_models import ChatOpenAI # import chat model from langchain.schema import ( AIMessage, HumanMessage, SystemMessage) # type of message from dotenv import dotenv_values env_val = dotenv_values(".env") openai_api_key = ...
bakiwebdev/langchain-local-experment
message_completions_from_a_chat_model.py
message_completions_from_a_chat_model.py
py
882
python
en
code
2
github-code
1
21946634176
#* # SLAM.py: the implementation of SLAM # created and maintained by Ty Nguyen # tynguyen@seas.upenn.edu # Feb 2020 #* import sys ros_path = '/opt/ros/kinetic/lib/python2.7/dist-packages' if ros_path in sys.path: sys.path.remove(ros_path) from MapUtils.bresenham2D import * from probs_utils ...
Saumya-Shah/SLAM-for-THOR
SLAM.py
SLAM.py
py
16,423
python
en
code
0
github-code
1
72209675875
import RPi.GPIO as GPIO from time import sleep ledPin = 11 buttonPin = 12 def setup(): GPIO.setmode(GPIO.BOARD) # Use physical board numbering. GPIO.setup(ledPin, GPIO.OUT) # Set the ledPin to OUTPUT mode. GPIO.setup(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Set button to PULL UP input mode. ...
bm3719/practice
python/pi_lab/2_button_led.py
2_button_led.py
py
850
python
en
code
2
github-code
1
38906742448
import math from numpy import ndarray, array from scipy.spatial.transform import Rotation from .GeoShape import GeoShape from src.pyLiveKML.KML.GeoCoordinates import GeoCoordinates from src.pyLiveKML.KML.KML import AltitudeMode def ellipse_gen( x_rad: float, y_rad: float, rotation: Rotation = None, num_v: int =...
smoke-you/pyLiveKML
evals/apps/geometry/GeoEllipse.py
GeoEllipse.py
py
1,476
python
en
code
1
github-code
1
38420632726
""" Creates a single-page HTTP server """ import os from flask import Flask, request def create_app(test_config=None): # create and configure the app app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( SECRET_KEY='dev', DATABASE=os.path.join(app.instance_path, 'f...
Cy83rr/web_monitor
src/web_monitor/server/server.py
server.py
py
1,031
python
en
code
0
github-code
1
30196444534
#!/usr/bin/env python3 import collections Shader = collections.namedtuple("Shader", "name vs_path fs_path attributes uniforms subroutines") SHADERS = [ Shader( name = "circle", vs_path = "circle.vert", fs_path = "circle.frag", attributes = ["vertex"], uniforms = ["projection", "color...
Poussinou/naev
src/shaders_c_gen.py
shaders_c_gen.py
py
9,168
python
en
code
null
github-code
1
4017006848
"""Controller class file.""" from gpiozero import Button from time import sleep class Controller(object): def __init__(self, up_pin: int, down_pin: int, left_pin: int, right_pin: int, back_pin: int, enter_pin: int): """ Initialize controller. :param up_pin: pin controlling the UP button ...
Marten-M/GAGMehhatroonikaklubi
src/classes/chessrobot/controller/controller.py
controller.py
py
1,521
python
en
code
0
github-code
1
73826277794
""" Main function to run the script of the pipeline Author: Arkaan Quanunga Date: 03/03/2022 """ import os import tempfile import mlflow import hydra import omegaconf # The Steps this pipeline will run- edit this based on local machine vs S3 # storage _steps = [ # Comment this line out if you don't have any data...
arkaan27/data-engineering-pipeline
main.py
main.py
py
4,939
python
en
code
1
github-code
1
13732329032
# -*- coding: utf8 -*- from flask_login import current_user from app import sa from app.models import Base from app.helpers import ModelHelper, MutableObject import datetime class Comment(Base, sa.Model, ModelHelper): __tablename__ = 'comments' __json_meta__ = [ 'id', 'text', 'profi...
tabaresjc/HeadUP
app/models/comments/comment.py
comment.py
py
2,541
python
en
code
6
github-code
1
1378485197
#continue #'continue' is a keyword, it use to stop the current iteration in a 'for' loop and 'while' loop and continue the next iteration. for i in range(10): if i == 4: continue print(i) print("Stop the loop when i is equal to p, and continues the loop from next iteration") for i in "Python programmi...
deeba-git/Python_Basics
Keywords/test_continue.py
test_continue.py
py
471
python
en
code
0
github-code
1
6732438027
#!/usr/bin/env python # -*- coding:utf-8 -*- # Time: 2020/5/7 15:16 # Author: Hou hailun import numpy as np import pandas as pd # 在日常的数据处理中,经常会对一个DataFrame进行逐行、逐列和逐元素的操作,对应这些操作,Pandas中的map、apply和applymap可以解决绝大部分这样的数据处理需求 boolean=[True,False] gender=["男","女"] color=["white","black","yellow"] data=pd.DataFrame({ "...
houhailun/data-analysis
pandas/pandas数据处理三板斧——map、apply、applymap详解.py
pandas数据处理三板斧——map、apply、applymap详解.py
py
3,518
python
zh
code
0
github-code
1
2525872420
from player import * from foods import * from walls import * # Sprites all_sprites = pygame.sprite.Group() player_one = player() player_two = player() # Food food_one = foods() food_two = foods() # Walls wall_one = walls() wall_two = walls() wall_three = walls() wall_four = walls() walls = [wal...
epernler/python_online_game
src/sprites.py
sprites.py
py
1,073
python
en
code
0
github-code
1
38681664945
import math def get_divisors(house_number): divisors = [i for i in range(1, int(math.sqrt(house_number)) + 1) if house_number % i == 0] divisors.extend([house_number // i for i in divisors if i * i != house_number]) return divisors def get_house(input_presents, part_two=False): i = 0 presents = 0 while presen...
nemo-0/advent-of-code
2015/day20/solution.py
solution.py
py
655
python
en
code
0
github-code
1
72163556515
from SbisSite import SearchHelper from selenium.webdriver.common.by import By import time def test_sbis(browser): sbis_main_page = SearchHelper(browser) # Открываем сайт sbis_main_page.go_to_site() # Проверяем наличие городом из моего региона в списке контактов cities_kostroma = ['Кострома', 'Нея'] fo...
deadenddanse/tenzor
Task2.py
Task2.py
py
1,289
python
ru
code
0
github-code
1
35627699701
# Задайте список из вещественных чисел. Напишите программу, которая найдёт разницу между максимальным и минимальным значением дробной части элементов. # Пример: # - [1.1, 1.2, 3.1, 5, 10.01] => 0.19 import random def fillArrayRandom(size: int, startNumber: int, endNumber: int) -> list: array = [] tmp = 0 ...
RamkaTheRacist/python-RTR
PY_les3_s/HW/task3.py
task3.py
py
1,241
python
en
code
0
github-code
1
13995637081
from tkinter import * def mn(): a = ent.get() b = entx.get() ab = int(a) + int(b) t3.insert(END, str(result)) def nb(): a = ent.get() b = entx.get() ab = int(a) - int(b) t3.insert(END, str(result)) root = Tk() ll = Label(root, text = "result") ll.pack() t3 = Entry(root) t3.pa...
hahaharshil/Tkinter
junk/tk_4.py
tk_4.py
py
634
python
en
code
0
github-code
1
35718269403
# -*- coding: utf-8 -*- """ Course: CS 4365/5354 [Computer Vision] Author: Jose Perez [ID: 80473954] Assignment: Lab 2 Instructor: Olac Fuentes """ from timeit import default_timer as timer import numpy as np from scipy import signal # ========================= Constants ========================= # Matrix used for con...
DeveloperJose/Python-CS4363-Computer-Vision
Lab2_Detection/Zip/integral_sums_image.py
integral_sums_image.py
py
2,635
python
en
code
0
github-code
1
73800489312
import logging from concurrent.futures import ThreadPoolExecutor from time import sleep from typing import List, Any, Union from django.core.files.uploadedfile import InMemoryUploadedFile from app.forms import UploadFilesForm from app.models import TaxonomyAbundance from app.util.file_parser import parse_taxonomy_fil...
jankod/UMCGMicrobiomeWeb
app/views.py
views.py
py
8,385
python
en
code
0
github-code
1
15933889767
import pymongo from pymongo import MongoClient cluster = MongoClient("mongodb://localhost:27017") database = cluster["Storage"] collection = database["Inventory"] deletingManyDate = collection.delete_many({}) post = {"_id": 0, "quantity": 400, "productId": 0, "productName": "Soap", "pr...
Nirusan03/FYP_Abi
mongodb.py
mongodb.py
py
2,346
python
en
code
0
github-code
1
4899345594
import random def mini(a,i,b,j): return (a,i) if a<=b else (b,j) def maxi(a,i,b,j): return (a,i) if a>=b else (b,j) def maxseq(a): if len(a) <= 1: return 0 m,M,mi,Mi = a[0], a[0], 0, 0 el = a[0] order = True d = [0, [M,m], [Mi,mi]] for (i,e) in enumerate(a): if e ==...
j0k/algopractice
seq/maxsubseq/mss28.py
mss28.py
py
761
python
en
code
1
github-code
1
36453908993
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param A : root node of tree # @return an integer is_sum_tree = True def __init__(self): Solution.is_sum_tree = True def solve(self, A): if not A: ...
SaiChandraCh/IB
src/week_6/day_27_trees_II/assignment/2_sum_binary_tree.py
2_sum_binary_tree.py
py
1,249
python
en
code
0
github-code
1
10995673765
""" 根据一棵树的前序遍历与中序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如,给出 前序遍历 preorder = [3,9,20,15,7] 中序遍历 inorder = [9,3,15,20,7] 返回如下的二叉树: 3 / \ 9 20 / \ 15 7 """ # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right...
bendanwwww/myleetcode
code/lc105.py
lc105.py
py
945
python
en
code
1
github-code
1
9825846565
import mraa as m class Rgb(object): def __init__(self): self.r = m.Gpio(21) self.g = m.Gpio(23) self.b = m.Gpio(26) self.r.dir(m.DIR_OUT) self.g.dir(m.DIR_OUT) self.r.dir(m.DIR...
DnPlas/CalamariExamples
Python/calamari_rgb.py
calamari_rgb.py
py
837
python
en
code
0
github-code
1
73698769953
import logging from abc import ABC import tensorflow as tf from detectors.AbstractDetector import AbstractDetector from utils.setup_logger import logger from utils.tensorflow import label_map_util from utils.util import * # Create class logger logger = logging.getLogger('TensorFlowDetector') class TensorFlowDetect...
tdiekel/Video-Object-Detection
detectors/TensorFlowDetector.py
TensorFlowDetector.py
py
5,547
python
en
code
0
github-code
1
22051845535
import argparse import itertools import os import subprocess from collections import OrderedDict import numpy as np import torch import torch.nn as nn from torch import linalg from torch.nn import functional as F def mix_many_models(): model_paths = [ os.path.join(args.model_path, file_name) for ...
Lavreniuk/2nd-place-solution-in-Scene-Understanding-for-Autonomous-Drone-Delivery
Mono_depth/soup.py
soup.py
py
1,869
python
en
code
3
github-code
1
13460846161
# coding: UTF-8 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # 使用する変数の宣言 znは原子番号 i = 0 zn = 18.0 # グラフの作成 azim,elevオプションで見る角度設定可能 fig = plt.figure() ax = fig.add_subplot(111, projection='3d', aspect='equal') # 軸ラベルの設定 ax.set_xlabel("X-axis") ax.set_yla...
kokeshing/orbit_plot
orbit2pz.py
orbit2pz.py
py
1,199
python
ja
code
0
github-code
1
13337504275
##평균 제곱 오차 import numpy as np def mean_squared_error(y, t): return 0.5 * np.sum((y-t)**2) t = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0] y = [0.1, 0.05, 0.6, 0.0, 0.05, 0.1, 0.0, 0.1, 0.0, 0.0] print(mean_squared_error(np.array(y), np.array(t))) y = [0.1, 0.05, 0.1, 0.0, 0.05, 0.1, 0.0, 0.6, 0.0, 0.0] print(mean_squared_e...
hongjw1938/machine_learning_study
python_class/deep_learning/deep learning from scratch/neural_network_04.py
neural_network_04.py
py
7,961
python
en
code
0
github-code
1
37171837883
# -*- coding: utf-8 -*- from library.simulator_func_mysql import * class simulator(): def __init__(self): self.set_variables() self.call_library() def set_variables(self): # 시뮬레이터 번호 설정 self.simul_num = int(input("시뮬레이팅 할 알고리즘 번호를 입력 하세요: ")) # self.simul_reset 설정 ...
minjaelee0727/stock-trading-bot
simulator.py
simulator.py
py
1,469
python
ko
code
0
github-code
1
74496272353
# ================================== # Video Object Detection with YOLOv3 # ================================== # RUN WITH EXAMPLE COMMAND BELOW: # python YOLO_vid.py -i vid_IO/drive.mp4 -o vid_IO/drive_processed.mp4 -y yolov3 import numpy as np import argparse import imutils import time import cv2 import os """User...
Jacklu0831/Real-Time-Object-Detection
1_YOLO/YOLO_vid.py
YOLO_vid.py
py
7,575
python
en
code
1
github-code
1
32304885265
import matplotlib import matplotlib.pyplot as plt import pandas as pd import sys import matplotlib.dates as mdates fin = sys.argv[1] fin_raw = sys.argv[2] font = {'size': 14} matplotlib.rc('font', **font) data = pd.read_csv(fin, parse_dates=True, index_col=0) data_raw = pd.read_csv(fin_raw, parse_dates=True, index_co...
Peruz/load_data
plot_raw_and_processed.py
plot_raw_and_processed.py
py
1,070
python
en
code
0
github-code
1
33519008872
import textwrap import time from java.awt import Component from java.awt.event import WindowAdapter from javax.swing import (BoxLayout, JLabel, JOptionPane, JPanel, JPasswordField, JTextField, JList, JScrollPane) from javax.swing.JOptionPane import (DEFAULT_OPTION, OK_CANCEL_OPTION, ...
robotframework/RIDE
src/robotide/lib/robot/libraries/dialogs_jy.py
dialogs_jy.py
py
4,565
python
en
code
910
github-code
1
9439454968
from django import forms from .models import Museum, Group from user.models import UserProfile class CreateGroupForm(forms.Form): name = forms.CharField(max_length=50) number = forms.IntegerField(min_value=1, max_value=200) museum = forms.ModelChoiceField(Museum.objects.all()) def create_users_pdf(sel...
nicholastaylor0000/CPS410-F20-Team04
museum/forms.py
forms.py
py
913
python
en
code
0
github-code
1
1335047172
from dataStructs.Stack import Stack pairs = {'(':')','{':'}','[':']'} def parChecker(arg): balanced = True s = Stack() for ch in arg: if ch in "({[" : s.push(ch) elif ch in ")}]": if s.isEmpty(): balanced = False break else: top = s.pop() if pairs.get(top) != ch: balanced = Fals...
joshiamey/python_problems
parChecker.py
parChecker.py
py
387
python
en
code
0
github-code
1
28602910056
''' 「検査陽性者の状況」画像から注記を抽出する処理 パターン2 ''' import re import pytesseract import cv2 import numpy as np # 画像内の矩形を抽出 # https://stackoverflow.com/a/60068297 def cropTable(src): hei = src.shape[0] wid = src.shape[1] totalArea = wid * hei original = src.copy() gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY) ...
code4nagoya/covid19-aichi-tools
recognize_main_summary_remarks_2.py
recognize_main_summary_remarks_2.py
py
3,539
python
en
code
6
github-code
1
36903356880
import pickle import DLfunctions as dl from keras.preprocessing.sequence import pad_sequences print("What is the name of the hyperparams file?(Local directory):") params_file_name = input() a_file = open(params_file_name, "rb") params = pickle.load(a_file) w = params["w"] b = params["b"] print("What is the question...
sidejackthenativity/DL_URLquery
bad_or_good_url.py
bad_or_good_url.py
py
664
python
en
code
0
github-code
1
2626499942
import FWCore.ParameterSet.Config as cms pfZeroSuppressionThresholds_EB = [0.080]*170 pfZeroSuppressionThresholds_EEminus = [0.300]*39 pfZeroSuppressionThresholds_EEplus = pfZeroSuppressionThresholds_EEminus # # These are expected to be adjusted soon, while the thresholds for older setups will remain unchanged. # _pf...
palazz94/cmssw
RecoParticleFlow/PFClusterProducer/python/particleFlowZeroSuppressionECAL_cff.py
particleFlowZeroSuppressionECAL_cff.py
py
1,602
python
en
code
null
github-code
1
3018933371
# -*- coding: utf-8 -*- """ Training deep convolutional neural networks. Created on Thu Jul 5 11:00:00 2018 Author: Prasun Roy | CVPRU-ISICAL (http://www.isical.ac.in/~cvpr) GitHub: https://github.com/prasunroy/cnn-on-degraded-images """ # imports from __future__ import division from __future__ import print_functio...
prasunroy/cnn-on-degraded-images
train_deepcnn.py
train_deepcnn.py
py
14,364
python
en
code
14
github-code
1
39159734260
"""Utilities shared across the whole cog""" # Built-in import random import re # Third-party from discord import Color # Local from .embed import create_embed, create_error_embed from .settings import DEFAULT_USER_SETTINGS # -------------------------------------------------------------------------------- # > Consta...
Jordan-Kowal/discord-dice-roller
discord_dice_roller/utils/dice_roll.py
dice_roll.py
py
23,842
python
en
code
0
github-code
1
22048125267
from cProfile import label from tkinter import* from tkinter import messagebox from tkinter.filedialog import askopenfilename import os # import win32com.client from pdf2docx import Converter class ventana(Tk): # Constructor def __init__(self,*args,**kwargs): super().__init__(*args,**kwargs) ...
DarguinBarbosa/Convert-pdf---word
convert.py
convert.py
py
2,661
python
es
code
2
github-code
1
40891943622
import asyncio from datetime import datetime from aiogram import types from aiogram.utils.markdown import code from init import bot, config, dp from utils import try_sending_message from verify import * from verify import Status # init async def on_startup(app) -> None: """Simple hook for aiohttp application w...
why-not-try-calmer/O-Susie
bot.py
bot.py
py
3,758
python
en
code
0
github-code
1
24782913768
import sys import time import numpy as np import logging import tensorflow as tf from os.path import join as pjoin from tqdm import tqdm from evaluate import f1_score, exact_match_score class QaSystemSolver(object): def __init__(self, model, dataset, answers, raw_answers, rev_vocab, **kwargs): self.mod...
jeffrey1hu/context-based-qa-system
core/solver.py
solver.py
py
12,925
python
en
code
3
github-code
1
72575682914
# ZeroDivisionError: Occurs when a number is divided by zero. # NameError: It occurs when a name is not found. It may be local or global. # IndentationError: If incorrect indentation is given. # IOError: It occurs when Input Output operation fails. # EOFError: It occurs when the end of the file is...
aiswaryasaravanan/PythonGettingStarted
Exceptions/tryExcept.py
tryExcept.py
py
502
python
en
code
0
github-code
1
11669927645
# 9-13 Practice from collections import OrderedDict word_dict = OrderedDict() word_dict['if'] = "如果" word_dict['else'] = "其他情况" word_dict['for'] = "有限循环" word_dict['while'] = "无限循环" word_dict['raise'] = "抛出异常" word_dict['try'] = "捕获异常" word_dict['catch'] = "处理异常" word_dict['finally'] = "捕获异常之后" word_dict['def'] = "函数"...
bombasticRY/PythonCrashCourse-Chapter1-11
Chapter9/05HM.py
05HM.py
py
1,066
python
en
code
0
github-code
1
30560764685
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 6 20:19:21 2022 @author: erikkoppes """ ##Simple Tm Calculator Function ##input should be in the form of string with quotations e.g "CGACTCTTAGCGGTGGATCA" def SimpleTmCalc(primer): #Define input DNA sequence DNA_input = primer #define...
KoppesEA/SimpleTmCalculator
SimpleTmCalc_function.py
SimpleTmCalc_function.py
py
1,548
python
en
code
0
github-code
1
23218100411
# Define battle attributes for Role2: NInja. Ninja excels in stealth but lacks magic. ninja_health = 3 ninja_magic = 1 ninja_stealth = 3 ninja_intelligence = 2 # Iniitalize ninja function def ninja(): """ This function returns the string "ninja" & is used for character selection. """ return "ninja"
Hyxda/Assignment-1
role2.py
role2.py
py
316
python
en
code
0
github-code
1
38075311961
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np from matplotlib import animation as animation import math #definindo a classe class Oscilador: #inicialização def __init__(self, lado, x, v): self.m= rob*(lado**3) self.l= lado self.x= x self.v= v #aceleração de...
hugosanc/ProjetoFinal
oscilador.py
oscilador.py
py
2,610
python
pt
code
0
github-code
1
34024693827
#!/usr/bin/env python """Setup script for installing sofia.""" from setuptools import setup config = { 'name': 'sofia', 'version': '0.0.1', 'description': 'GUI', 'author': 'Danna Xue', 'author email': 'dannaxue@stanford.edu', 'url': 'https://github.com/dannaxue/sofia.git', 'download_url':...
dannaxue/sofia
setup.py
setup.py
py
455
python
en
code
0
github-code
1
15619151697
def CountBits(bits): count = 0 while bits != 0: count += 1 bits &= bits - 1 return count def SquareToFyle(square): return square & 0x7 def SquareToRank(square): return square >> 3 def CoordToSquare(fyle, rank): return (rank << 3) | fyle def SquareToBB(square): return 0x1 << square def CoordT...
MetalPhaeton/sayuri
Tools/CodeGenerator/gen_chess_util_extra_h.py
gen_chess_util_extra_h.py
py
14,753
python
en
code
14
github-code
1
72263563554
"""Added switch history Revision ID: b85b82664c28 Revises: 94ccd671cbcd Create Date: 2021-03-26 15:56:26.634107 """ from alembic import op import sqlalchemy as sa from its_on.utils import AwareDateTime # revision identifiers, used by Alembic. revision = 'b85b82664c28' down_revision = '94ccd671cbcd' branch_labels = ...
best-doctor/its_on
db/migrations/versions/b85b82664c28_added_switch_history.py
b85b82664c28_added_switch_history.py
py
1,108
python
en
code
14
github-code
1
14177282022
from time import sleep from Persona import Persona from User import User class BingePersona(Persona): def __init__(self, user, hash, leave, other_args): super().__init__(user, hash, leave, other_args) # set if leech (False by default) if len(other_args) > 0: self.leech = int(...
andreasmalling/flixtube
user/src/BingePersona.py
BingePersona.py
py
603
python
en
code
3
github-code
1
13585923089
from pprint import pprint from riko.bado import coroutine from riko.collections import SyncPipe, AsyncPipe p232_conf = { "attrs": [ {"value": "www.google.com", "key": "link"}, {"value": "google", "key": "title"}, {"value": "empty", "key": "author"}, ] } p421_conf = {"rule": [{"find": "...
nerevu/riko
examples/simple2.py
simple2.py
py
872
python
en
code
1,605
github-code
1
22739573626
from rest_framework.exceptions import * from common.log import * from common.env import * class RespNotFound(APIException): status_code = status.HTTP_404_NOT_FOUND # default_detail = _('Not found.') class APgentResponseMessgae(object): def __init__(self): self.response = dict() def set_respon...
Kwan-young-hoo/ToPC
mtk-openwrt-4.0.1.0/files/www/openAPgent/common/response.py
response.py
py
1,777
python
en
code
0
github-code
1
32631833253
# -*- coding: utf-8 -*- import numpy as np from collections import deque, OrderedDict from datetime import datetime from common.funcs import * from common.layers import * from common.optimizers import * class Planner_separate(): def __init__(self, name, env, state_dim, action_dim): #name:このPl...
Atsuo-Shoji/a2c_continuous_no_framework
Planner_separate.py
Planner_separate.py
py
30,413
python
en
code
1
github-code
1
28404000694
import os import pandas as pd import sqlalchemy #Definindo uma string de conexão str_connection = 'sqlite:///{path_to_data}' # Os endereços do projeto e sub-pastas BASE_DIR = os.path.dirname( os.path.dirname(os.path.abspath(__file__))) DATA_DIR = os.path.join(BASE_DIR,'data') # Encontrando os arquivos de dados f...
esrodrigues01/Projetos-em-Python
src/upload_data_local.py
upload_data_local.py
py
802
python
pt
code
0
github-code
1
2574010068
from sdv.model import DataPointFloat, Model class O2WR(Model): """O2WR model. Attributes ---------- Lambda: sensor PID 2x (byte AB) and PID 3x (byte AB) - Lambda for wide range/band oxygen sensor Voltage: sensor PID 2x (byte CD) - Voltage for wide range/band oxygen sensor ...
eclipse-velocitas/vehicle-model-python
sdv_model/OBD/O2WR/__init__.py
__init__.py
py
744
python
en
code
1
github-code
1
75065242274
import dash from dash_core_components.Tabs import Tabs import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output, State import plotly.express as px import datetime import pandas as pd import base64 # Python scripts import aux_ as aux import tasks import os, sys...
danaecanillas/Calendari_TEA
app/app_nofunciona.py
app_nofunciona.py
py
6,022
python
en
code
0
github-code
1
71968934434
import telebot from telebot import types bot = telebot.TeleBot('') @bot.message_handler(commands=['start']) def start(message): mess = f'Привет, <b>{message.from_user.first_name} {message.from_user.last_name}</b>' bot.send_message(message.chat.id, mess, parse_mode='html') @bot.message_handler(commands=['webs...
markess/hestiamaks
tgbot.py
tgbot.py
py
1,426
python
ru
code
0
github-code
1
22711374176
'''@file score.py contains functions to score the system''' import numpy as np def cer(outputs, targets): ''' compute the character error rate Args: outputs: a dictionary containing the decoder outputs targets: a dictionary containing the reference outputs Returns: the character ...
JeroenBosmans/nabu
nabu/processing/score.py
score.py
py
1,264
python
en
code
0
github-code
1
27277130106
import random class Vehicle(object): """ A Vehicle drives from intersection to intersection and does so in a number of steps. """ def __init__(self, roads_to_drive, road, lane): # The road the vehicle is driving on self.road = road # The lane the vehicle leaves the road ...
EthanWaterink/Modelling-and-Simulation
models/vehicle.py
vehicle.py
py
2,069
python
en
code
1
github-code
1
19801286548
from django.urls import path from . import views urlpatterns =[ path('',views.login,name='index_login'), path('login/',views.login,name='login'), path('logout/',views.logout,name='logout'), path('cadastrar/',views.cadastrar,name='cadastrar'), path('dashboard/',views.dashboard,name='dashboard') ]
vitormiura/senai-cti
django/siteCurso/aluno/urls.py
urls.py
py
317
python
en
code
2
github-code
1
39329680390
def pascal(n): for x in range(1,n+1): for y in range(n-x): print(" ",end="") #inverted triangle blank spaces for z in range(1,x): print(z,end="") #normal counting for q in range(x,0,-1): print(q,end="") #backw...
barkhaaroraa/python-codes
pascal triangle.py
pascal triangle.py
py
432
python
en
code
1
github-code
1
2417852779
"""Auth urls.""" from django.urls import path from apps.vmc_auth import views app_name = "auth" urlpatterns = [ path("accounts/signup/", views.signup, name="signup"), # path("accounts/signin/", views.signin, name="signin"), path("accounts/signin/", views.LoginView.as_view(), name="signin"), path("acco...
dje-1000111/bacasand
apps/vmc_auth/urls.py
urls.py
py
659
python
en
code
0
github-code
1
40365085600
import sys def read_matrix(): (rows_count, columns_count) = map(int, input().split(', ')) matrix = [] for row_index in range(rows_count): row = list(map(int, input().split(', '))) matrix.append(row) return matrix def submatrix(matrix): rows = len(matrix) columns = len(matrix[0...
Vselenis/Python-Advanced-April-2021
3. Multidimensional Lists - Lab/05. Square with Maximum Sum.py
05. Square with Maximum Sum.py
py
953
python
en
code
0
github-code
1
37276683325
""" --- Day 13: Knights of the Dinner Table --- In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along! This year, you resolve, will be different. You're going to find the optimal seating arrangement and avoid all those awkward conversations. You start by writing up a list of ev...
ochelset/advent-of-code
2015/Day 13/13.py
13.py
py
4,022
python
en
code
0
github-code
1
19544980561
# Renames files/ photos in a specific folder. import os,sys,string,glob,shutil i = 0 k = 0 sourceAl1 = "D:\\Photos\\" destination = "D:\\Photos\\" a = os.listdir(sourceAl1) i=1 for _ in a: tkn = _.split('.',-1) tkn1 = _.split('.',-1) print (tkn) sN = sourceAl1 + tkn[0] + "." + tkn[1] tN = d...
anay-deshpande/python-for-photographers
Scripts/RenameFiles.py
RenameFiles.py
py
469
python
en
code
1
github-code
1
23601070257
# Напишите программу, которая найдёт произведение пар чисел списка. # Парой считаем первый и последний элемент, второй и предпоследний и т.д. # Пример: # - [2, 3, 4, 5, 6] => [12, 15, 16]; # - [2, 3, 5, 6] => [12, 15] n = int(input('Введите количество чисел: ')) some_list = [] for _ in range (0, n): some_list.ap...
GunelMinina/HW29.11.22
Task2.py
Task2.py
py
655
python
ru
code
0
github-code
1
17883964741
from ansiblelint import AnsibleLintRule import re class ComparisonToEmptyStringRule(AnsibleLintRule): id = 'EXTRA0015' shortdesc = "Don't compare to empty string" description = 'Use `when: var` rather than `when: var != ""` (or ' \ 'conversely `when: not var` rather than `when: var == ""...
willthames/ansible-review
lib/ansiblereview/examples/lint-rules/ComparisonToEmptyStringRule.py
ComparisonToEmptyStringRule.py
py
492
python
en
code
223
github-code
1
44032736509
from __future__ import annotations import pytest from mocksafe import MockProperty, mock, stub, that class Philosopher: @property def meaning_of_life(self: Philosopher) -> str: return "42" def test_mock_getter_prop(): mock_meaning: MockProperty[str] = MockProperty("") philosopher: Philosoph...
dmayo3/mocksafe
tests/test_props.py
test_props.py
py
1,167
python
en
code
2
github-code
1
24142497222
import webapp2 import jinja2 import os from google.appengine.ext import db template_dir = os.path.join(os.path.dirname(__file__), "templates") jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), autoescape=True) class Entry(db.Model): title = db.StringPr...
johnmccorkell/build-a-blog
main.py
main.py
py
2,398
python
en
code
0
github-code
1
39993386878
# -*- coding: utf-8 -*- from pprint import pprint from crawler import WebCrawler from db_sqlite import DB from sites.wawacity.page_list import PageList as PL from sites.wawacity.page_detail import PageDetail as PD class Builder: def __init__(self): pass def set_crawler(self, url): self.crawl...
aana5i/webbrowser
builder.py
builder.py
py
2,115
python
fr
code
0
github-code
1
1373258707
#predefined functions def largest_num(*args): print(max(args)) largest_num(10,20,0,33,40,78,99) def smallest_num(*args): print(min(args)) smallest_num(0,-2,99,22,1,3,4,55,66) def absoult_num(a): print(abs(a)) absoult_num(-40) absoult_num(50) print(type(99)) print(type(99.88)) print(type("99")) print(type[1...
HarikrishnaPeram/RupeshTrainingPython
Day7/Day7.py
Day7.py
py
1,733
python
en
code
0
github-code
1
42744791584
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd import math as mt from IPython.display import Markdown, display def printmd(string): display(Markdown(string)) # In[2]: def DectoBin(num): x = np.absolute(num) Bin = "" for i in range(1,33): if x > 1: ...
shahmeerrajput/WorkOnTensorflowNmpyPandas
DS Project Working.py
DS Project Working.py
py
3,162
python
en
code
0
github-code
1
11787408017
#!/usr/bin/python3 import re f = open('LornasData.xml', 'r') lines = f.readlines() f.close() parse_regex = '&#xf130;(.*)&#xf131; (.*)<' test_seq, comment_str = [], [] for l in lines[3:-1]: m = re.search(parse_regex, l) if not m: print("line mismatch: {}\n".format(l)) else: test_seq.appe...
silnrsi/font-charis
tools/archive/LornasData2ftml.py
LornasData2ftml.py
py
1,951
python
en
code
63
github-code
1
30058213410
# -*- coding: utf-8 -*- """ Created on Fri Mar 04 10:04:46 2016 @author: nfette A single effect LiBr absorption chiller model. """ import numpy as np import tabulate from scipy.optimize import fsolve from scipy.interpolate import PchipInterpolator from collections import namedtuple import CoolProp.CoolProp as CP from...
nfette/openACHP
src/libr3.py
libr3.py
py
36,513
python
en
code
8
github-code
1
31093817853
from youtube_transcript_api import YouTubeTranscriptApi from bardapi import Bard import os import requests import pytube #important notes: This tools can only translate upto a 2000 word transript or a 10 minutes videos #using dsdaniel park bardapi #the link: https://github.com/dsdanielpark/Bard-API #code ...
huype1/playing-w-yt-and-bard
YT_translate_to_vietnamese.py
YT_translate_to_vietnamese.py
py
2,807
python
en
code
0
github-code
1
72065452834
#ll=[1,2,4,[12,11,[44,22,33],[7,9]]] #d=[] #def type_chk(l): # global d # for ele in l: # if isinstance(ele, list): # print 'inside' # type_chk(ele) # else: # d.append(ele) # return d #d = type_chk(ll) #print d # import signal for i in [x for x in dir(signal) if...
enakann/FirmsTestingPractice
FiRMS/builder/lib/t.py
t.py
py
520
python
en
code
0
github-code
1
29049431130
import os os.system("cls") #---------------------------------------------------------------------------------------------------------------------------------------------------- class Solution(): def longestCommonPrefix(self, inputSringList): lcpString = "" ...
saurabhjalutharia/LeetCodeSoultion
14. Longest Common Prefix.py
14. Longest Common Prefix.py
py
1,775
python
en
code
1
github-code
1
21430401658
import os, queue, pprint def get_neighbors(map, x, y, neighbors_to_exclude): num_rows, num_cols = len(map), len(map[0]) result = [] for x_offset in range(-1, 2): for y_offset in range(-1, 2): if 0 <= x + x_offset < num_rows and 0 <= y + y_offset < num_cols: if (x + x_of...
borisbarath/advent-of-code-21
11/octopus.py
octopus.py
py
3,179
python
en
code
0
github-code
1
10074224932
import os import sys version = {} with open('hw_wwj/__init__.py') as hw: exec(hw.read(), version) __version__ = version['__version__'] try: import setuptools except ImportError: pass from numpy.distutils.core import setup, Extension from numpy.distutils.system_info import get_info # Fortra...
wenjie-astro/hw_wwj
setup.py
setup.py
py
1,278
python
en
code
0
github-code
1
15304671782
import math class mbr: def __init__(self,x1,x2,y1,y2): self.x1=x1 self.x2=x2 self.y1=y1 self.y2=y2 def fromstring(str1): arr=str1.split(",") return mbr(float(arr[0]),float(arr[1]),float(arr[2]),float(arr[3])) def dist2p(self,x,y): xd=min(abs(x-self.x...
lyp-bobi/knnlru
mbr.py
mbr.py
py
1,424
python
en
code
0
github-code
1
12646195802
from html.parser import HTMLParser from read_site_content import read_site_content import datetime import all_id_pages class HabrPageParser(HTMLParser): bull_title = False bull_user = False bull_hash = False bull_ul = False bull_data = False title='' user = '' data = [] hash = []...
gugry/FogStreamEdu
lesson8_conclusion_of_SQL/HabrPageParser.py
HabrPageParser.py
py
3,580
python
en
code
0
github-code
1
4516184590
#!/usr/bin/env python # -*- coding: utf-8 -*- from PyKDE4.kdeui import KIconLoader from PyQt4.QtCore import * class DirModel (QAbstractItemModel): FILENAME, USER, GROUP, SIZE, DIRECTORY, LINK = range(6) def __init__ (self): QAbstractItemModel.__init__ (self) self.list = list() self.folderIcon = KIconLoade...
BackupTheBerlios/kasablanca-svn
kasablanca-python/trunk/dirmodel.py
dirmodel.py
py
4,337
python
en
code
0
github-code
1
29544552626
import time import ssz import py_ecc.bls as bls from eth2.beacon._utils.hash import hash_eth2 from eth2.beacon.on_genesis import ( get_genesis_block, ) from eth2.beacon.state_machines.forks.serenity.blocks import ( SerenityBeaconBlock, ) from eth2.beacon.state_machines.forks.serenity.configs import SERENITY_CO...
hwwhww/trinity
eth2_sim/simulation/run.py
run.py
py
4,210
python
en
code
null
github-code
1
30710495366
import matplotlib matplotlib.use('Agg') import sys import pynbody import pynbody.plot as pp import pynbody.plot.sph as sph import matplotlib.pylab as plt import numpy as np import h5py as h5 pynbody.config['number_of_threads'] = 2 def make_plots(): output = int(sys.argv[1]) plot_type = sys.argv[2] cr = ...
ibutsky/synthetic_spectra
scripts/plotting/pynbody_plots.py
pynbody_plots.py
py
4,708
python
en
code
0
github-code
1
26864145069
def img(sexo, idade, valorimc): if(sexo == 'masculino'): aux3 = (1.2 * valorimc) - 10.8 + (0.23 * float(idade)) - \ 5.4 * 1000.1/(25.5 * 25.5) elif(sexo == 'feminino'): aux3 = (1.2 * valorimc) + (0.23 * float(idade)) - \ 5.4 * 1000.1/(25.5 * 25.5) return round(...
tips2/projeto-da-discplina-de-ia-mea
programa fit.py
programa fit.py
py
3,758
python
pt
code
0
github-code
1
38856278228
import numpy as np from quickSel import itr_scaling from test_include import * def test1(): A = np.array([[1, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1.0]]) b = np.array([1.0, 0.8, 0.3]) v = np.array([1.0, 1.0, 1.0, 1.0]) x = itr_scaling.solve(A, b, v) p...
TsinghuaDatabaseGroup/AI4DBCode
CardinalityEstimationTestbed/Overall/quicksel/test/python/old/test_itr_scaling.py
test_itr_scaling.py
py
598
python
en
code
56
github-code
1
26344566280
#!/usr/bin/env python import rospy from tf2_msgs.msg import TFMessage import tf from tf.transformations import euler_from_quaternion from std_msgs.msg import String from geometry_msgs.msg import PoseStamped import numpy as np # For random numbers import tf import time import math import geometry_msgs.msg class Tran...
max-27/final_project
scripts/transformations.py
transformations.py
py
4,762
python
en
code
1
github-code
1
7442842816
import requests import card import json import sys from bs4 import BeautifulSoup # Get Request for Webpage def card_page_init(card_webpage): response = requests.get(card_webpage) if response.status_code != 200: print("Error fetching page") exit() else: content = response.content ...
dm554/BuddyfightCardWebScraper
main.py
main.py
py
4,141
python
en
code
0
github-code
1
12698763875
import math import soundfile as sf import numpy as np #import librosa data, samplerate = sf.read('sineAmend.wav') channels = len(data.shape) length_s = len(data)/float(samplerate) if (length_s < 6.0): n = math.ceil(6*samplerate/len(data)) if (channels == 2): data = np.tile(data, (n,1)) else: data = np.ti...
Shri-0/Pedalboard-Shri
Py/PedalBoard/Sessions/PB-repeatAudio.py
PB-repeatAudio.py
py
370
python
en
code
0
github-code
1
1405363679
import requests import json x = requests.get("https://gist.githubusercontent.com/D-Brox/5ea0d9cec29c4921a9e397163f447646/raw/classes2.txt") e = x.text.split("\n") b = {} for i in e: a = i.split(" = ")[::-1] try: b[a[0]] = a[1] except: print(i) with open("classes.json", "w") as f: json.du...
captain8771-plugins/append-old-classnames
download classnames.py
download classnames.py
py
328
python
en
code
0
github-code
1
14372065002
# -*- coding: utf-8 -*- from telebot import types import sqlite3 as sq from datetime import date import time import datetime import requests from bs4 import BeautifulSoup as Bs from telebot import TeleBot from fake_useragent import UserAgent import random from threading import Thread from config import * def get_proxy(...
NurAbain/kvartira_bishkek_1.0.0
parser_kvartiry.py
parser_kvartiry.py
py
36,966
python
ru
code
0
github-code
1
37160878648
#!/usr/bin/env python # coding: utf-8 # Setup import pandas as pd from pathlib import Path from matplotlib import pyplot as plt import parameters # Load Tables games = pd.read_csv(parameters.locations['staging'].joinpath('games.csv'), index_col=0) views = list(parameters.locations['analysis'].glob('*.csv')) analysis...
avlam/TtA
create_reports.py
create_reports.py
py
1,025
python
en
code
0
github-code
1
6675192132
# 値のソート # (動物、最高時速)のリスト(各要素はタプルで作成) animal_list = [ ("ライオン", 58), ("チーター" , 110), ("シマウマ" , 60), ("トナカイ" , 80), ] # 足の速い順に並び替える faster_list = sorted( animal_list, key = lambda ani : ani[1], # 1はタプル配列の用を番号0の次の1、速度の値のこと reverse = True ) # 結果を表示 print("\nlist型の並び替え") for i in faster_list : pr...
Kiharaten/Practice
Python/Django/practice/practice8.py
practice8.py
py
1,068
python
ja
code
0
github-code
1
35517600694
import random import tensorflow as tf import numpy as np import pickle import os from src.utils.movesprep import data_path from src.utils import moves from src.utils import movesprep from src.utils import representations class Search: def __init__(self, left_moves, right_moves): self.lm = left_moves ...
woocash2/AI-solving-2048
src/mcts/mcts.py
mcts.py
py
20,608
python
en
code
0
github-code
1
21106216381
# -*- coding: utf-8 -*- # This script goes through USFM files, generating a list of verses that contain properly marked footnotes. # Reports errors to stderr and issues.txt. # Set source_dir and usfmVersion to run. # Global variables source_dir = r'C:\DCS\Portuguese\pt-br_ulb' usfmVersion = 2 # if version 3.0 or g...
unfoldingWord-dev/tools
usfm/listFootnotes.py
listFootnotes.py
py
5,352
python
en
code
8
github-code
1
43767212162
import re import datetime from .dean import Dean from bs4 import BeautifulSoup from freeclass.models import Classroom from course.models import Course from main import get_now_week class FreeClassroom: session = Dean().dean_session week = get_now_week() building_dict = { "1": "思源楼", "2": "...
jlytwhx/bjtubox_python
utils/freeclass.py
freeclass.py
py
3,277
python
en
code
5
github-code
1
74540232672
import os import re from traitlets import List, default from .base import BaseConverter from ..preprocessors import ( InstantiateTests, ClearOutput, CheckCellMetadata ) from traitlets.config.loader import Config from typing import Any from ..coursedir import CourseDirectory class GenerateSourceWithTests...
jupyter/nbgrader
nbgrader/converters/generate_source_with_tests.py
generate_source_with_tests.py
py
1,375
python
en
code
1,232
github-code
1
32458720992
# CS5487 demo script for Programming Assignment 2 # # The script has been tested with python 2.7.6 # # It requires the following modules: # numpy 1.8.1 # matplotlib v1.3.1 # scipy 0.14.0 # Image (python image library) import pa2 import numpy as np import pylab as pl import scipy.io as sio from PIL import Image...
brookgao/Machine-Learning
Assignment2/Problem2/python/test_pa2.py
test_pa2.py
py
2,147
python
en
code
12
github-code
1