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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
27297456381 | '''
2) Faça um programa que exiba na tela os 20 primeiros números quadrados perfeitos, da seguinte forma:
1 ** 2 = 1
2 ** 2 = 4
3 ** 2 = 9
4 ** 2 = 16
'''
for num in range(1, 21):
quad = num**2
print(f'{num} ** 2 = {quad}') #importante: pro laço ser executado por inteiro o print deve estar dentro do FOR
| ibellmartins/aulas-python | exercícios - AULA PRÁTICA/FOR/ex2.py | ex2.py | py | 321 | python | pt | code | 0 | github-code | 36 |
39279563732 | import sys
from PyQt5 import QtCore
from PyQt5.QtWidgets import QDialog, QApplication, QPushButton, QVBoxLayout, QShortcut
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
import matplotlib.pyplot as plt
import pandas as pd
from readFitsSlim import Spectra
class Window(QDial... | grd349/LearningLAMOST | Chris/Temp_Model/SpectraUI.py | SpectraUI.py | py | 3,429 | python | en | code | 1 | github-code | 36 |
72393817384 | import sys
import time
import random
import pygame as pg
pg.init()
WIDTH, HEIGHT = 800, 600
FPS = 60
window = pg.display.set_mode((WIDTH, HEIGHT))
clock = pg.time.Clock()
"""Добавление иконки и названия игры"""
pg.display.set_caption('Flappy bird')
pg.display.set_icon(pg.image.load(r'images/icon.png'... | ArtemTroshkin/FlappyBird | main.py | main.py | py | 6,760 | python | ru | code | 0 | github-code | 36 |
22355485380 | '''
Project 2 - Simple BlackJack Game
- You will use Object Oriented Programming.
- We will use a computer dealer and a human player, starting with a normal deck of cards.
1. Start with deck of cards
2. Player places a bet, coming from their 'bankroll'
3. Dealer starts with 1 card face up and 1 card face down... | stephenv13/BlackJackGame | BlackJackGame.py | BlackJackGame.py | py | 8,346 | python | en | code | 0 | github-code | 36 |
2476075869 | import random
rock = """
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
"""
paper = """
_______
---' ____)____
______)
_______)
_______)
---.__________)
"""
scissors = """
_______
---' ____)____
______)
__________)
(____)
... | devProMaleek/learning-python | day-4-random-list/rock-paper-scissors.py | rock-paper-scissors.py | py | 1,963 | python | en | code | 0 | github-code | 36 |
9193307146 | import os
import copy
import pytorch_lightning as pl
from pytorch_lightning import profiler
import pytorch_lightning.core.lightning as lightning
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
import torch.nn as nn
from pytorch_lightning.loggers import WandbLogger
from datetime import dateti... | tibe97/thesis-self-supervised-learning | lightly/embedding/_base.py | _base.py | py | 4,499 | python | en | code | 2 | github-code | 36 |
37635556780 | # The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
# Now your job is to find the total Hamming distance between all pairs of the given numbers.
# Example:
# Input: 4, 14, 2
# Output: 6
# Explanation: In binary representation, the 4 is 0100, 14 is 11... | sunnyyeti/Leetcode-solutions | 477_Total_Hamming_Distance.py | 477_Total_Hamming_Distance.py | py | 910 | python | en | code | 0 | github-code | 36 |
2483212505 | '''
Descripttion:
version:
Author: WGQ
Date: 2021-11-11 14:40:28
LastEditors: WGQ
LastEditTime: 2021-11-12 17:58:46
'''
from . import adminApi
import time
from fastapi import Query, Depends, Body, Form,Request
from playhouse.shortcuts import model_to_dict
from model.RModel import *
from common import Func, Utils
fro... | foreversun52/cgserver | adminapi/Country.py | Country.py | py | 2,267 | python | en | code | 0 | github-code | 36 |
15744675717 | import functools
import hashlib
import os
import sys
import time
from typing import NamedTuple
from git_command import git_require
from git_command import GitCommand
from git_config import RepoConfig
from git_refs import GitRefs
_SUPERPROJECT_GIT_NAME = "superproject.git"
_SUPERPROJECT_MANIFEST_NAME = "superproject_... | GerritCodeReview/git-repo | git_superproject.py | git_superproject.py | py | 17,995 | python | en | code | 267 | github-code | 36 |
25966299187 |
import Tkinter as tk
import ScrolledText
import numpy as np
import matplotlib as mpl
import matplotlib.backends.tkagg as tkagg
from matplotlib.backends.backend_agg import FigureCanvasAgg
import sklearn.gaussian_process as skgp
import evaluatorGUI as eg
import matplotlib.pyplot as plt
import scipy.optimize
import time
... | Hampswitch/ReciprocationGUI | reciprocation/GPvisualizer.py | GPvisualizer.py | py | 8,347 | python | en | code | 0 | github-code | 36 |
8309674493 | from bson import ObjectId
# noinspection PyProtectedMember
from motor.motor_asyncio import AsyncIOMotorCollection
from task_tracker_backend.dataclasses import UserData
from task_tracker_backend.task_factory import TaskFactory
class User:
def __init__(
self, users_collection: AsyncIOMotorCollection, t... | smthngslv/task-tracker-backend | task_tracker_backend/user.py | user.py | py | 1,031 | python | en | code | 0 | github-code | 36 |
14231652942 | '''
File name: Isonet_star_app.py
Author: Hui Wang (EICN)
Date created: 4/21/2021
Date last modified: 06/01/2021
Python Version: 3.6.5
'''
import sys,os
import logging
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QTableWidgetItem,QMessageBox
from PyQt5.QtCore imp... | IsoNet-cryoET/IsoNet | gui/Isonet_star_app.py | Isonet_star_app.py | py | 43,739 | python | en | code | 49 | github-code | 36 |
27370619161 | import matplotlib.pyplot as plt
from random_walk import RandomWalk
# cd Documents/python_work/data_visualization
while True:
# Create instance of RandomWalk.
rw = RandomWalk(5000)
rw.fill_walk()
# Set the size of the interactive window.
plt.figure(dpi=128, figsize=(10, 5))
# Plot random wal... | nazeern/python_crash_course | data_visualization/rw_visual.py | rw_visual.py | py | 923 | python | en | code | 0 | github-code | 36 |
73945056424 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
ROS Node to accept commands of "wheel_command" and run motors using the Pololu
DRV8835 Raspberry Pi Hat
"""
import rospy
from std_msgs.msg import Float32
from basic_motors_and_sensors.msg import WheelCommands
from pololu_drv8835_rpi import motors, MAX_SPEED # MAX_SP... | macuser47/ME439_Robot | src/basic_motors_and_sensors/src/motor_node.py | motor_node.py | py | 1,092 | python | en | code | 0 | github-code | 36 |
6433676498 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import math
import yaml
import pickle
import pprint
import os
import logging
import sys
import data_loaders
im... | alluly/ident-latent-sde | train.py | train.py | py | 31,019 | python | en | code | 3 | github-code | 36 |
4430086553 | '''Given a string S, you need to remove all the duplicates.
That means, the output string should contain each character only once.
The respective order of characters should remain same, as in the input string.
Sample Input 1 :
ababacd
Sample Output 1 :
abcd
'''
from collections import OrderedDict
def uniqueCh... | Riyachauhan11/Python-learning-Concepts | dictionaries/Extract Unique characters.py | Extract Unique characters.py | py | 553 | python | en | code | 0 | github-code | 36 |
43810341653 | import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
distance = 40
def create_poles(poles):
y = np.zeros(distance)
for p in poles:
y[p] = 1
x = range(distance)
plt.stem(x, y, use_line_collection=True)
def plot_robot_measurement(poles, pos, gs):
plt.subplot(... | WuStangDan/localization | assignment3/sim/plot.py | plot.py | py | 2,643 | python | en | code | 3 | github-code | 36 |
31025277279 | class Solution:
def longestSubarray(self, nums: List[int]) -> int:
HashMap = dict()
left = 0
Max = 0
for right in range(len(nums)):
currVal = nums[right]
HashMap[currVal] = 1 + HashMap.get(currVal, 0)
whi... | meetsingh0202/Leetcode-Daily-Coding-Challenge | 1493-longest-subarray-of-1s-after-deleting-one-element/1493-longest-subarray-of-1s-after-deleting-one-element.py | 1493-longest-subarray-of-1s-after-deleting-one-element.py | py | 494 | python | en | code | 0 | github-code | 36 |
72174120105 | from dymond_game import game
class Main:
def __init__(self):
super(Main, self).__init__()
if __name__ == '__main__':
game_test = game.Game("test", {
"resolucion": [1600, 900],
"sfx_volume": 0.5,
"mus_volume": 0.09
})
game_test.run()
| YukiTheThicc/Black_Dymonds | debug.py | debug.py | py | 285 | python | en | code | 0 | github-code | 36 |
3581561120 | # Import necessary libraries
import openai
import subprocess
import sys
import json
import html
import re
import ssl
import os
import math
import glob
import pprint
import nltk
import pdb
import requests
import time
import random
from PIL import Image, ImageDraw, ImageFont
from PIL import UnidentifiedImageError
if not ... | menached/ai_product_updater | t1.py | t1.py | py | 14,935 | python | en | code | 0 | github-code | 36 |
34682609282 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 16:18:01 2019
@author: cacquist
"""
# coding: utf-8
# In[1]:
# ------------------------------------------------------------------------
# date : 12.04.2018
# author : Claudia Acquistapace
# goal : routine to read 1D meteogram fo... | ClauClouds/PBL_paper_repo | f_processModelOutput.py | f_processModelOutput.py | py | 29,461 | python | en | code | 1 | github-code | 36 |
16630075934 | import random
from GradientDescent.data_utils import get_points
def current_loss_4_MBGD(w_current, b_current, x, y, seed_list):
loss = 0
for seed in seed_list:
loss = loss + (w_current*x[seed]+b_current - y[seed])**2
return loss/float(len(seed_list))
def step_gradient(w_current, b_current... | GanZhan/Gradient-Descent-Examples | MBGD.py | MBGD.py | py | 2,259 | python | en | code | 1 | github-code | 36 |
74481651624 | from copy import deepcopy
from config.irl_config import IRLConfig
from config.rl_config import RLConfig
from env_design.envs import ENV_MAKERS
class ConfigBuilder(dict):
def __init__(
self,
num_gpus=0,
num_workers=0,
rl_algo=None,
irl_algo=None,
... | Ojig/Environment-Design-for-IRL | ed_airl/config/builder.py | builder.py | py | 2,019 | python | en | code | 0 | github-code | 36 |
73744164585 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.db import migrations
import ielex.lexicon.models as models
def forwards_func(apps, schema_editor):
print('Updating clades for all languages..')
Language = apps.get_model('lexicon', 'Language')
for l in Language.obj... | lingdb/CoBL-public | ielex/lexicon/migrations/0049_update_languageClade.py | 0049_update_languageClade.py | py | 748 | python | en | code | 3 | github-code | 36 |
72596157545 | from command.management_commands.management_command import ManagementCommand
from terminal.confirm import Confirm
class DelCommand(ManagementCommand):
def __init__(self):
super().__init__()
self.__confirm = Confirm()
def execute(self, *args):
if len(args) == 0:
raise Excep... | AyalaGottfried/DNA-Analyzer-System | command/management_commands/del_command.py | del_command.py | py | 851 | python | en | code | 2 | github-code | 36 |
35629134265 | from get_txt1 import GroundTruth
import time
import os
import csv
def down_sample_txt(folder_path,down_sample_rate=0.1):
new_header='./part_label/'
skip_number=int(1/down_sample_rate)
for header,j1,k1 in os.walk(folder_path):
# print(i,j,k)
for file_name_ori in k1:
if 'csv' no... | 625160928/robotcar_dataset_process | down_sample.py | down_sample.py | py | 1,965 | python | en | code | 0 | github-code | 36 |
42778925613 | import json
import logging
from io import BytesIO
from typing import Optional
import pandas as pd
import requests
from pydantic import Field, SecretStr
from toucan_connectors.common import ConnectorStatus
from toucan_connectors.toucan_connector import ToucanConnector, ToucanDataSource
class NetExplorerDataSource(To... | ToucanToco/toucan-connectors | toucan_connectors/net_explorer/net_explorer_connector.py | net_explorer_connector.py | py | 3,536 | python | en | code | 16 | github-code | 36 |
4108381477 | from sys import stdin
input = stdin.readline
lines = int(input())
for w in range(1, lines + 1):
tree = {}
num, gen = [int(x) for x in input().split()]
for _ in range(num):
person, number, *descendants = input().split()
tree[person] = descendants
print(f"Tree {w}:")
fit = {}
for... | AAZZAZRON/DMOJ-Solutions | ecna05b.py | ecna05b.py | py | 1,190 | python | en | code | 1 | github-code | 36 |
14862191628 | # console_test.py
''' This module is to test the functionality of the TVShow class in a console
This is not the main executable, use main_gui.py as "__main__"
'''
from myLib.tv_class import TVShow, sqlite3
def menu():
'''print header info to user'''
print('Joseph Fitzgibbons, FitzgibbonsP13, Fina... | fitzypop/random-episode | python/proof_of_concept/console_test.py | console_test.py | py | 2,990 | python | en | code | 0 | github-code | 36 |
37373287317 | import math
import torch
from torch import nn
import torch.nn.functional as F
class SelfAttentionLayer(nn.Module):
'''
Self attention layer
'''
def __init__(self, hidden_size, num_attention_heads, dropout_prob):
super().__init__()
self.hidden_size = hidden_size
self.num_att... | ZZR8066/SEMv2 | SEMv2/libs/model/transformer.py | transformer.py | py | 4,423 | python | en | code | 2 | github-code | 36 |
15859509196 | # -*- coding: utf-8 -*-
#importando as bibliotecas
from matplotlib.pyplot import text
import yfinance as yf
import pandas as pd
import numpy as np
import os.path
import telegram
pd.options.mode.chained_assignment = None
#escolher uma ação
wege = yf.Ticker('WEGE3.SA')
#escolher inteervalo de dados
wege_dia = weg... | bertuci/compra_e_venda_acoes | bot_MACD/macd_bot.py | macd_bot.py | py | 3,561 | python | pt | code | 1 | github-code | 36 |
38192330286 | import os
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.template.loader import get_template
from xhtml2pdf import pisa
from ..models import *
from django.contrib.auth.models import User
from django.contrib.staticfiles import find... | luggiestar/kahama | KCHS/views/download_pdf_files_views.py | download_pdf_files_views.py | py | 2,550 | python | en | code | 0 | github-code | 36 |
10663838847 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 26 15:20:29 2016
@author: neo
"""
#cat1 = 'new_candidate2.cat'
#cat1 = 'icrf1.cat'
cat1 = '331_sou.cat'
cat2 = 'icrf2.cat'
#cat3 = 'MFV247.cat'
#cat4 = 'AMS260.cat'
#cat = 'common_source.cat'
#fcat = open('../catalog/'+cat,'w')
#cat1 = 'common_source.cat'
f1 = open('... | Niu-Liu/thesis-materials | sou-selection/progs/Catalog_comparasion.py | Catalog_comparasion.py | py | 819 | python | en | code | 0 | github-code | 36 |
26599759147 | from PyQt5 import QtWidgets
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QHeaderView
from db.models import *
from gui.widgets.custom_widgets import DialogWithDisablingOptions
class MainWidget(QtWidgets.QWidget):
def __init__(self, parent, model):
super().__init__(... | jsaric/quiz-manager | gui/widgets/main_widget.py | main_widget.py | py | 4,612 | python | en | code | 0 | github-code | 36 |
31005247537 | # ATRIBUTOS:
# dia: int
# mes: int
# anio: int
class Fecha:
def __init__(self, x):
(dia,mes,anio)=x.split("/")
(self.dia,self.mes,self.anio)=(int(dia), int(mes), int(anio))
def __str__(self):
return str(self.dia)+"/"+str(self.mes)+"/"+str(self.anio)
def __sub__(self,x):
pass
def siguiente(self):
nu... | matias1lol/semestre-1 | semeste-2/Fecha.py | Fecha.py | py | 867 | python | es | code | 0 | github-code | 36 |
44850642568 | #!/usr/bin/env python3
#
# Add metadata from Apple Podcasts to cached mp3s
# so they sync to Garmin Watches with appropriate
# metadata
# ---------------
# Michael Oliver, 2022, MIT License
#
# Standing on the shoulders of giants:
# Modified prior art and inspiration by Douglas Watson
# https://douglas-watson.g... | mcoliver/fixPodcastMetadata | fixPodcastMetadata.py | fixPodcastMetadata.py | py | 2,652 | python | en | code | 4 | github-code | 36 |
12685763897 | from moduleBaseClass import ModuleBaseClass
from StringIO import StringIO
from PIL import Image
class Module(ModuleBaseClass):
def __init__(self):
self.header = 'x42\x4d'
self.name = 'bmp'
def final_check(self, raw):
try:
Image.open(StringIO(raw))
return True
... | tengwar/xorstuff | modules/bmp.py | bmp.py | py | 360 | python | en | code | 0 | github-code | 36 |
70077372585 | import pandas as pd
import lxml.html
import requests
import shelve
import os, sys
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
if not os.path.exists('database'):
os.mkdir('database')
elif not os.path.isdir('database'):
os.remove('database')
os.mkdir('database')
x... | chris-hamberg/springer_books_web | scraper.py | scraper.py | py | 5,483 | python | en | code | 0 | github-code | 36 |
16249768953 | from app import create_celery_app
from app.lib.flask_mailplus import send_templated_msg
celery = create_celery_app()
@celery.task()
def test_mail_func(email,message):
ctx = {'email':email, 'message':message}
send_templated_msg(subject='[Snake Eyes], contact',
sender = email,
... | sbansa1/SnakeEyes | app/blueprints/contact/tasks.py | tasks.py | py | 471 | python | en | code | 0 | github-code | 36 |
18036429357 | from heapq import heappush, heappop
class Solution:
def kSmallestPairs(self, nums1: List[int], nums2: List[int], k: int) -> List[List[int]]:
visited = set()
heap = []
output = []
heappush(heap, (nums1[0]+nums2[0], 0, 0))
visited.add((0, 0))
while len... | LittleCrazyDog/LeetCode | 373-find-k-pairs-with-smallest-sums/373-find-k-pairs-with-smallest-sums.py | 373-find-k-pairs-with-smallest-sums.py | py | 779 | python | en | code | 2 | github-code | 36 |
496529237 | import datetime
import sys
import uuid
import pandas as pd
import pytest
from dagster_gcp import (
bigquery_resource,
bq_create_dataset,
bq_delete_dataset,
bq_solid_for_queries,
import_df_to_bq,
import_gcs_paths_to_bq,
)
from dagster_pandas import DataFrame
from google.cloud import bigquery
fro... | helloworld/continuous-dagster | deploy/dagster_modules/libraries/dagster-gcp/dagster_gcp_tests/bigquery_tests/test_solids.py | test_solids.py | py | 10,520 | python | en | code | 2 | github-code | 36 |
12673510789 | from pathlib import Path
import numpy as np
import torch
from torch.utils.data import Dataset
from torchvision import transforms
import torchvision.transforms.functional as TF
from PIL import Image
from src.draw_utils import save_img_with_kps
from src.readers.image_reader import ImageReader
from typing import Dict
fro... | AvanDavad/receipt_extractor | src/datasets/phase0points_dataset.py | phase0points_dataset.py | py | 6,430 | python | en | code | 0 | github-code | 36 |
33653170551 | #Reference Files
#https://lotr.fandom.com/wiki/Quest_of_the_Ring
#https://www.asciiart.eu/books/lord-of-the-rings
import random
import time
#Title page/main menu
def main():
print(" _____ _ _ __ _ _ ______ _")
print("|_ _| (_) | / _| | | | | | ___ (_)")
... | sciangela/totr | totr.py | totr.py | py | 28,218 | python | en | code | 1 | github-code | 36 |
39497612599 | """
Module to handle a local InfoKinds with unique name.
NOTE: this is taken from python-common in nomad-lab-base.
It is copied here to remove the dependency from nomad-lab-base.
For more info on python-common visit:
https://gitlab.mpcdf.mpg.de/nomad-lab/python-common
The author of this code is: Dr. Fawzi Roberto Mo... | angeloziletti/ai4materials | ai4materials/external/local_meta_info.py | local_meta_info.py | py | 27,845 | python | en | code | 36 | github-code | 36 |
41737860574 | from functools import cmp_to_key
def custom_split(s):
if s == '': return []
cnt = 0
res = []
last_comma = -1
brackets = 0
while (cnt < len(s)):
if s[cnt] == '[': brackets += 1
if s[cnt] == ']': brackets -= 1
if s[cnt] == ',':
if brackets == 0:
... | Jiggzawyr/advent-of-code-2022 | Day 13 Distress Signal/part2.py | part2.py | py | 2,368 | python | en | code | 0 | github-code | 36 |
29099062357 | from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
from config.errCode import *
from config.kiwoomType import RealType
from config.slack import Slack
from PyQt5.QtTest import *
import os
class Kiwoom(QAxWidget):
def __init__(self):
super().__init__() # == QAxWidget.__init__()
print('class:... | sw-song/kiwoom | test_api/kiwoom.py | kiwoom.py | py | 29,513 | python | en | code | 0 | github-code | 36 |
41510671413 | #!/usr/bin/env python3
"""
Session Authentication Module
"""
from api.v1.auth.auth import Auth
from api.v1.views.users import User
import uuid
from typing import TypeVar
class SessionAuth(Auth):
"""
Responsible for session Authentication
Inherits From auth class
"""
user_id_by_session_... | tommyokoyo/alx-backend-user-data | 0x02-Session_authentication/api/v1/auth/session_auth.py | session_auth.py | py | 2,157 | python | en | code | 0 | github-code | 36 |
5818279983 | from Algorithms.Usefull_elements import Step, intersection, addition, get_edges, invert_Graph, vertex_list_to_str, hsv_to_hex, replace_color
import copy
from collections import defaultdict
def algorithm_depth_first_search(matrix):
mass = list() # массив смежных вершин
vertex_mark = dict() # объявление пустого ... | VelandMerl/graph_bauman_centuary_presents | Algorithms/Topological_Sort.py | Topological_Sort.py | py | 21,006 | python | ru | code | 1 | github-code | 36 |
70677287784 | """
Filename: plot_zonal_mean.py
Author: Damien Irving, irving.damien@gmail.com
Description:
"""
# Import general Python modules
import sys, os, pdb
import argparse
import numpy
import matplotlib.pyplot as plt
from matplotlib import gridspec
import iris
import iris.plot as iplt
from iris.experimental.equ... | DamienIrving/ocean-analysis | visualisation/plot_zonal_mean.py | plot_zonal_mean.py | py | 19,621 | python | en | code | 9 | github-code | 36 |
71738073384 | import unittest
from selenium import webdriver
from data.constants import Constants
from helpers.keywords import Helpers
from pom.pages.login import Login
from pom.pages.project import Project
from pom.locators.base_loc import BaseLoc
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome i... | jaime-contreras-98/todoist-python-selenium | tests/e2e/test/test_projects.py | test_projects.py | py | 1,846 | python | en | code | 0 | github-code | 36 |
9369243974 | import imaplib
import email
from time import sleep
from random import randint
import importlib
from src.Analyser import mark_email
from src.Email import Email
import numpy as np
from goto import with_goto
from src.save import save
ai = importlib.import_module("Neural_Network", package=None)
"""
Fonction qui efface ... | PtspluS/Phising-Analising | src/Recevoir_email_complet.py | Recevoir_email_complet.py | py | 5,361 | python | fr | code | 1 | github-code | 36 |
3650801558 | from flask import Blueprint, jsonify, g, request
from wrappers.auth_required import auth_required, rate_limited
from models.jobs import TOPJob
from utils.json_helper import jsonify_payload
bp = Blueprint("management", __name__, url_prefix="/management")
@bp.route("/jobs", methods=["GET"])
@auth_required
def get_jobs(... | matthewlouisbrockman/the_one_plugin | backend/management/management_routes.py | management_routes.py | py | 1,181 | python | en | code | 0 | github-code | 36 |
25548663168 | #!/usr/bin/python3
def list_division(my_list_1, my_list_2, list_length):
result = []
for i in range(list_length):
try:
if i >= len(my_list_1) or i >= len(my_list_2):
raise IndexError("out of range")
numerator = my_list_1[i]
denominator = my_list_2[i]... | LeaderSteve84/alx-higher_level_programming | 0x05-python-exceptions/4-list_division.py | 4-list_division.py | py | 1,051 | python | en | code | 0 | github-code | 36 |
317579586 | #!/bin/python3
import math
import os
import random
import re
import sys
def setVisit(M, pos):
x,y = pos
M[y][x] = 2
def fillRegion(M, pos, size):
x,y = pos
n,m = size
if(x < 0 or y < 0 or x >= m or y >= n):
return 0
if(M[y][x] != 1):
return 0
ret = 1
setVisit(M, pos)
for i in range(-1,... | DStheG/hackerrank | HackerRank/connected-cell-in-a-grid.py | connected-cell-in-a-grid.py | py | 1,014 | python | en | code | 0 | github-code | 36 |
13231147951 | import json
import os
import subprocess
import sys
from pathlib import Path
import youtube_dl
ydl_opts_download = {
"format": "bestaudio/best",
"cachedir": False,
"outtmpl": "%(id)s%(ext)s",
"postprocessors": [
{
"key": "FFmpegExtractAudio",
"preferredcodec... | RiccardoPeron/competitions-music-analysis | Functions/downloader.py | downloader.py | py | 2,304 | python | en | code | 0 | github-code | 36 |
38716086802 | #!/usr/bin/env python3
with open('input.txt', 'r') as f:
adjustments = [int(n) for n in f]
print("Part 1:", sum(adjustments))
seen = set()
current = 0
i = 0
while current not in seen:
seen.add(current)
current += adjustments[i]
i = (i+1) % len(adjustments)
print("P... | lvaughn/advent | 2018/1/freq.py | freq.py | py | 339 | python | en | code | 1 | github-code | 36 |
28986176573 | # coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
The version of the OpenAPI document: 0.0.358
Generated by: https://openapi-generator.tech
"""
from __future__ imp... | alexdicodi/yapily-sdk-python | sdk/test/test_bulk_user_delete_details.py | test_bulk_user_delete_details.py | py | 2,749 | python | en | code | null | github-code | 36 |
71148994983 | from utils import connector
async def declare_queue(queue_name, durable=False):
conct = connector.Connector()
channel = await conct.get_channel()
await channel.queue_declare(
queue=queue_name,
durable=durable,
)
async def bind_queue(queue_name, exchange_name, routing_key):
conct ... | Yuriy-Leonov/python-rabbitmq-example | utils/funcs.py | funcs.py | py | 1,256 | python | en | code | 0 | github-code | 36 |
43189726204 | import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from .. import default_config
import numpy
class CustomViewBox(pg.ViewBox):
def __init__(self, *args, **kwds):
pg.ViewBox.__init__(self, *args, **kwds)
self.StromDisplay=None
self.ChannelNum=0
self.ScaleBar = []
s... | KatonaLab/vividstorm | controllers/viewer/CustomViewBox.py | CustomViewBox.py | py | 10,817 | python | en | code | 0 | github-code | 36 |
24304374080 | from argparse import ArgumentParser
from gitrello import Gitrello
import github
import trello
import settings
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument('--pr_id', required=True)
parser.add_argument('--repo', required=True)
args = parser.parse_args()
g = github.Gith... | jakobpederson/gitrello | convert_pr.py | convert_pr.py | py | 667 | python | en | code | 0 | github-code | 36 |
72640402983 | import os, argparse, traceback, glob, random, itertools, time, torch, threading, queue
import numpy as np
import torch.optim as optim
from models.tacotron import post_CBHG
from torch.nn import L1Loss
from torch.utils.data import Dataset, DataLoader
from torch.nn.utils.rnn import pad_sequence
from util.hparams import *
... | chldkato/Tacotron-pytorch | train2.py | train2.py | py | 3,633 | python | en | code | 6 | github-code | 36 |
10571851448 | import copy
from node import Node
import heapq
class Search():
def __init__(self, unsorted_stack, search_type):
self.unsorted_stack = unsorted_stack
self.frontier = [] # tuples to make total cost priority
self.visited = []
self.order_added = 0
self.root = Node(unsorted_sta... | JosephCarpenter/Informed-Search-Algorithm | search.py | search.py | py | 1,905 | python | en | code | 0 | github-code | 36 |
70781957544 | from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from devup.views import UpList, UpDetail, UpCreate, UpUpdate
app_name = 'devup'
urlpatterns = [
url(r'^up_list$', UpList.as_view(), name='up_list'),
url(r'^up_create$', UpCreate.as_view(), name='up_create')... | maherrub/aot | devup/urls.py | urls.py | py | 539 | python | en | code | 0 | github-code | 36 |
73701609385 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Bottleneck(nn.Module):
def __init__(self, nChannels, growthRate, dropout_rate):
super(Bottleneck, self).__init__()
self.dropout_rate = dropout_rate
interChannels = 4 * growthRate
self.bn1 = nn.Bat... | ikhlestov/caltech-ml-courses | models/model_dense.py | model_dense.py | py | 4,801 | python | en | code | 0 | github-code | 36 |
6797727811 | # django imports
from django import template
import itertools
import datetime
import pytz
import dateutil
register = template.Library()
@register.filter
def group_by_date(dates, timezone):
tz = pytz.timezone(timezone)
dates_parser = []
for day in dates:
try:
new_date = pytz.utc.local... | tomasgarzon/exo-services | service-exo-mail/mail/templatetags/group_by.py | group_by.py | py | 747 | python | en | code | 0 | github-code | 36 |
36588084295 | # 에라토스테네스의 체
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
nums = [i for i in range(2, n+1)]
t = 0
while True:
m = nums[0]
for n in nums:
if n%m == 0:
ans = n
nums.remove(n)
t += 1
if t == k:
break
if t == k:
... | meatsby/algorithm | etc/bootcampprep/codingtestprep/day2/6.py | 6.py | py | 356 | python | en | code | 0 | github-code | 36 |
12560528102 | from flask import Flask, jsonify, request, redirect, Response, render_template
import requests
from config import api_key, cam_names, rover_det
app = Flask(__name__)
@app.route('/')
def home():
return render_template("index.html")
@app.route('/rover', methods = ['POST'])
def rover():
rov_name = request.form['optro... | brianr0922/mars_rover | main.py | main.py | py | 2,308 | python | en | code | 0 | github-code | 36 |
6783941465 | """Change column distance_bin to distance_cat
Revision ID: 2524785502b4
Revises: c137e7385dd7
Create Date: 2020-03-20 16:47:15.648707
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2524785502b4'
down_revision = 'c137e7385dd7'
branch_labels = None
depends_on =... | dcjohnson24/gugs_db | migrations/versions/2524785502b4_change_column_distance_bin_to_distance_.py | 2524785502b4_change_column_distance_bin_to_distance_.py | py | 980 | python | en | code | 0 | github-code | 36 |
37634895040 | # A critical point in a linked list is defined as either a local maxima or a local minima.
# A node is a local maxima if the current node has a value strictly greater than the previous node and the next node.
# A node is a local minima if the current node has a value strictly smaller than the previous node and the ne... | sunnyyeti/Leetcode-solutions | 2058 Find the Minimum and Maximum Number of Nodes Between Critical Points.py | 2058 Find the Minimum and Maximum Number of Nodes Between Critical Points.py | py | 3,223 | python | en | code | 0 | github-code | 36 |
22727851226 | user_input = input("vorodi: ").split(",")
print(user_input)
file_obj = open("my_file.txt","w+")
for item in range(len(user_input)):
shomarandeh = "shomare:__"+str(item+1) +" |"
name = "name:"+user_input[item]
char_count = "|" +"char count "+ str(len(user_input[item]))
to_wirte = "{0:<6s}{1:^24s}{02:<24s... | mahdi76-karaj/Example | hafteh_9/4/1/tamrin.py | tamrin.py | py | 413 | python | en | code | 0 | github-code | 36 |
32519507649 | from fastapi import FastAPI, Request, HTTPException, status, Depends ,File, UploadFile
from fastapi.templating import Jinja2Templates
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from fastapi.staticfiles import StaticFiles
from starlette.responses import HTMLResponse
from tortoise.cont... | AlexBabilya/E-Commerce | main.py | main.py | py | 10,643 | python | en | code | 1 | github-code | 36 |
3407130666 | #!/usr/bin/env python
"""A script to normalized interview transcripts.
It outputs a single text file with cleaned lines
one sentence per line"""
import argparse
import re
import string
import spacy
fillers = [
"eh",
"m",
"mm",
"mmm",
"ah",
"ahm",
"ehm",
"yy",
"y",
"aha",
"... | zoobereq/He-write-age | data cleaning/normalize.py | normalize.py | py | 4,556 | python | en | code | 3 | github-code | 36 |
31058563267 | #important topics
#inheritance and incapsulation
#here varbale will be default public
#if you want to make variable private use __variable
class Person:
__age=89
def __init__(self):
self.first_name="Ram"
self.last_name="Thapa"
self.age=23
p=Person()
print(p.first_n... | subin131/Python-OOP | OOP/June30Python.py | June30Python.py | py | 1,052 | python | en | code | 0 | github-code | 36 |
32884223298 | #Import random
import random
#Create the function below:
inte=random.randint(1,5)
entero=inte
row=[]
matrix=[]
def matrixBuilder(entero):
for i in range(entero):
row.append(1)
for i in range(entero):
global matrix
matrix.append(row)
return matrix
print(matrixBuilder(entero))
| sergioadll/python-loops | exercises/15.1-Matrix_Builder/app.py | app.py | py | 311 | python | en | code | 0 | github-code | 36 |
43606735550 | import os
etl_repo_home="/opt/pentaho/repositories/grip-pentaho-di-reports/ETL/reports"
#Creating Base directory
mifid2_base_dir="mifid"
mifid2tr_rg_dirs=['mifid2-tr\mifid2-tr-reports-trade',
'mifid2-tr\mifid2-tr-reports-correction',
'mifid2-tr\mifid2-tr-reports-automati... | Kulamanipradhan0/Python | Module/Os/CreateDirectoryMifidRG.py | CreateDirectoryMifidRG.py | py | 1,125 | python | en | code | 0 | github-code | 36 |
23251362882 | import os
from zipfile import ZipFile, ZIP_DEFLATED
class Zip():
"""Zip up all the contents of a directory into the output file."""
def __init__(self, input_directory, output_file):
self.input_directory = input_directory
self.output_file = output_file
def zip(self):
try:
zip_file... | thewtex/odt-respace | source/odt_respace/zip.py | zip.py | py | 809 | python | en | code | 1 | github-code | 36 |
70797390505 | import copy
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
from matplotlib import cm
from util.util import info, crop_center, error, print_timestamped
different_colors = ["#FF0000", "#008000", "#0000FF", "#FFD700", # Red, green, blue, gold
... | giuliabaldini/brainclustering | util/plot_handler.py | plot_handler.py | py | 12,669 | python | en | code | 0 | github-code | 36 |
35962565077 | import numpy as np
import scipy.stats as stats
def gauss(x,mz,sigma,A):
return A*np.exp(-(x-mz)**2/2/sigma**2)
def sig(respwr, mz):
return mz/(2.355*respwr)
def peaklist(filename):
arr = []
pknums = []
f = open(filename)
for line in f:
if 'Num peaks:' in line:
... | kbenham4102/MSGen | specsim.py | specsim.py | py | 3,523 | python | en | code | 0 | github-code | 36 |
42258313707 | # This program adds two numbers
num1 = 1
num2 = 2
# Add two numbers
sum = num1 + num2
# Display the sum
print('The sum is:', sum)
# finding the Average of 2 numbers given by Valar Mam
A = 1
B = 2
# avg
avg = (A + B) / 2
print("average of A & B =", avg)
# finding the apple task given by Valar Mam
my_list = ["ap... | karthickr1503/python_class | assignment.py | assignment.py | py | 1,760 | python | en | code | 0 | github-code | 36 |
33154135207 | #!/usr/bin/python3
#encoding: UTF-8
import lxml.etree as ET
import markdown as MD
import lib as LIB
#-------------------------------------------------------------------------------
def xpath_list(from_node, xpath):
"""
Return all nodes matching xpath from from_node as dom node list.
"""
if isinstance(fro... | echopen/PRJ-medtec_kit | doc/doc_builder/src/xml_helper.py | xml_helper.py | py | 4,938 | python | en | code | 17 | github-code | 36 |
16068140151 | from unittest.mock import patch
from family_foto import Role, add_user
def mock_user(test_case, user_name, role_name, active=None) -> None:
"""
Mocks a user on current_user
:param test_case: test case class, where the user should be mocked
:param user_name: name of the mocked user
:param role_nam... | Segelzwerg/FamilyFoto | tests/test_utils/mocking.py | mocking.py | py | 820 | python | en | code | 8 | github-code | 36 |
19499350817 | from sqlite3 import *
from typing import Union
class DB:
def __init__(self):
self.db = connect("app.db")
self.cr = self.db.cursor()
self.cr.execute("create table if not exists `users`(user_id INTEGER, username TEXT, chat_name TEXT, "
"chat_username TEXT, chat_id INT... | cytoo/TgGroupScanner | bot/mods/sql.py | sql.py | py | 1,485 | python | en | code | 18 | github-code | 36 |
27337287373 | import os
# redis db
REDIS_URL = os.environ.get('REDIS_URL') or 'http://redis:6379/1'
REDIS_SET_NAME = 'cookiejars'
COOKIES_POOL_SIZE = 10
# 查询结果缓存时间
RESULT_EXPIRE = 24*60*60
# for selenium
CHROME_DRIVER_PATH = '/Users/apple/phantomjs-2.1.1-macosx/bin/chromedriver'
CHROME_BASE_URL = "https://www.sogou.com/"
# for se... | WeiEast/mobile_query | config/config.py | config.py | py | 414 | python | en | code | 0 | github-code | 36 |
43660032355 | '''
a = 2
b = 4
if a > b:
print ("Hola")
elif b > a:
print ("Hola2")
# Una tupla no se incrementa, es estatico, un arreglo si.
# (1,2,3) TUPLA
# [1,2,3...] ARREGLO/LISTA
c = (2,3,4)
print(type(c))
d = [3,6,4]
print(type(d))
'''
# ------------------------------------- EJERCICIO ------------------------------... | UP210878/up210878_dsa | Notes, tests, misc/M3_1.py | M3_1.py | py | 1,441 | python | es | code | 0 | github-code | 36 |
8574459364 | from django.shortcuts import render, redirect, get_object_or_404
from users.models import Profile
from .models import *
from addproject.models import *
from datetime import datetime
from django.shortcuts import render, redirect
from addproject.models import *
import json
import datetime
from django.http import JsonResp... | SeongJoon-K/Runningmate | runningmate/mateapp/views.py | views.py | py | 9,157 | python | en | code | null | github-code | 36 |
15121359842 | import sys
import os
sys.path.append(os.path.join(sys.path[0], '../../bindings/python/'))
sys.path.append(os.path.join(sys.path[0], '../../bin/'))
import pySmartIdEngine
def output_recognition_result(result):
print('Document type: %s' % result.GetDocumentType())
print('Match results:')
match_results = r... | SmartEngines/SmartIDReader-Server-SDK | samples/python/smartid_sample.py | smartid_sample.py | py | 5,119 | python | en | code | 5 | github-code | 36 |
75174790505 | from vtk import *
# input data, every row is for a different item
positions = [[0, 0, 0],[1.5, 0, 0]]
orientations = [[1.0, 0.0, 0.0],[0.0, 1.0, 1.0]]
colors = [[255, 0, 0],
[0, 255, 255]]
heights = [1,
2]
# rendering of those two defined cylinders
points = vtkPoints()
points.InsertNextPoint(... | squeakus/bitsandbytes | vtk/glyphpos.py | glyphpos.py | py | 1,632 | python | en | code | 2 | github-code | 36 |
3929257072 | import os
import picamera
import numpy as np
from picamera.array import PiMotionAnalysis
# A simple demo of sub-classing PiMotionAnalysis to construct a motion detector
MOTION_MAGNITUDE = 60 # the magnitude of vectors required for motion
MOTION_VECTORS = 10 # the number of vectors required to detect motion
cla... | waveform80/picamera_demos | motion_detect.py | motion_detect.py | py | 1,230 | python | en | code | 12 | github-code | 36 |
33452924265 | from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
fcff_df = pd.read_excel('FCFF_analysis_filtered.xlsx', index_col=[0])
sgx_df = pd.read_csv('myData.csv', index_col=[1])
class... | yuliangod/StonksApp | 03_FCFFapp.py | 03_FCFFapp.py | py | 12,301 | python | en | code | 0 | github-code | 36 |
40597432388 | """General purpose tools get fenced code blocks from Markdown."""
from dataclasses import dataclass
from operator import attrgetter
from pathlib import Path
from typing import List, Optional
import phmutest.direct
import phmutest.reader
import phmutest.select
from phmutest.direct import Marker
class FCBChooser:
... | tmarktaylor/phmutest | src/phmutest/tool.py | tool.py | py | 5,339 | python | en | code | 0 | github-code | 36 |
70677233704 | """
Filename: calc_volcello.py
Author: Damien Irving, irving.damien@gmail.com
Description: Calculate the CMIP5 volcello variable
"""
# Import general Python modules
import sys, os, pdb
import argparse
import numpy
import iris
# Import my modules
cwd = os.getcwd()
repo_dir = '/'
for directory in cwd.spli... | DamienIrving/ocean-analysis | data_processing/calc_volcello.py | calc_volcello.py | py | 3,841 | python | en | code | 9 | github-code | 36 |
39056791379 | from obspy import read
from numpy import r_,ones,zeros
path=u'/Users/dmelgar/Slip_inv/Chiapas_hernandez_new/data/waveforms/before_delta_t/'
outpath='/Users/dmelgar/Slip_inv/Chiapas_hernandez_new/data/waveforms/'
def delay_st(st,delta):
d=st[0].data
npts=int(abs(delta)/st[0].stats.delta)
if delta<0:
... | Ogweno/mylife | chiapas2017/delay_waveforms_tsunami.py | delay_waveforms_tsunami.py | py | 781 | python | en | code | 0 | github-code | 36 |
70819605545 | #! /usr/bin/env python
from ppclass import pp
u = pp()
u.file = "/home/aymeric/Big_Data/DATAPLOT/diagfired.nc"
u.var = "u"
u.t = "0.5,0.8"
u.z = "10,20"
u.getdefineplot(extraplot=2) # prepare 2 extraplots (do not show)
u.p[0].proj = "ortho"
u.p[0].title = "$u$"
u.makeplot()
v = pp()
v << u # NB: initialize v object ... | aymeric-spiga/planetoplot | examples/ppclass_reference/windspeed.py | windspeed.py | py | 847 | python | en | code | 10 | github-code | 36 |
74050723304 | from parlai_internal.projects.param_sweep_utils.param_sweep import run_grid
import time
import os
SCRIPT_NAME = os.path.basename(__file__).replace(".py", "")
TODAY = format(time.asctime().replace(":", "-").replace(" ", "_")[:-14])
SWEEP_NAME = f"{SCRIPT_NAME}{TODAY}"
here_path = os.path.realpath(__file__).replace(".... | facebookresearch/ParlAI | projects/tod_simulator/sweeps/pretrain_all.py | pretrain_all.py | py | 3,356 | python | en | code | 10,365 | github-code | 36 |
8088346772 | class Solution:
def smallestDivisor(self, nums: List[int], threshold: int) -> int:
def ispossible(mid):
total = 0
for x in nums:
total += math.ceil(x / mid)
if total <= threshold:
return True
return False
lo, hi = 1, m... | alankrit03/LeetCode_Solutions | 1283. Find the Smallest Divisor Given a Threshold.py | 1283. Find the Smallest Divisor Given a Threshold.py | py | 507 | python | en | code | 1 | github-code | 36 |
12171333516 | # 2016년 요일 찾기
# 2016년 1월 1일은 금요일
# SUN,MON,TUE,WED,THU,FRI,SAT
from datetime import datetime
def solution(a, b):
date = '2016-{0}-{1}'.format(a, b) # 날짜
datetime_date = datetime.strptime(date, '%Y-%m-%d') # 날짜의 타입을 datetime형으로 변경
dateDict = {0: 'MON', 1:'TUE', 2:'WED', 3:'THU', 4:'FRI', 5:'SAT', 6:'SUN'}
... | hi-rev/TIL | Programmers/level_1/date.py | date.py | py | 899 | python | ko | code | 0 | github-code | 36 |
25951961583 | import sys
import base64, time, datetime
callbacks = {
'array': lambda x: [v.text for v in x],
'dict': lambda x:
dict((x[i].text, x[i+1].text) for i in range(0, len(x), 2)),
'key': lambda x: x.text or "",
'string': lambda x: x.text or "",
'data': lambda x: base64.b64decode(x.text),
'dat... | ishikawa/python-plist-parser | tools/performance/etree_parser.py | etree_parser.py | py | 1,444 | python | en | code | 11 | github-code | 36 |
69905738984 | from django.shortcuts import render, redirect
from django.contrib import messages
from .forms import UserRegisterForm
def register(request):
if request.method =='POST':
form = UserRegisterForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('... | AlekanderOst/python-webstore-drakkar | users/views.py | views.py | py | 648 | python | en | code | 0 | github-code | 36 |
33550810768 | def adding():
file = open("list", 'a')
user_input = input("Enter the item you want to add: ")
file.writelines(f"{user_input}\n")
file.close()
print("\nSuccessfully added to the list")
def viewing():
file = open("list", 'r')
r = file.read()
print(f"\n{r}")
def delete():
input_ ... | SethShickluna/Python-Lessons | homework_submissions/file-hannah.py | file-hannah.py | py | 895 | python | en | code | 0 | github-code | 36 |
41204678431 | ############################################################
############################################################
#Reverse a linked list from position m to n. Do it in-place and in one-pass.
#
#For example:
#Given 1->2->3->4->5->NULL, m = 2 and n = 4,
#
#return 1->4->3->2->5->NULL.
#############################... | Ankan-Das/Python-DS | Linked-List/Interviewbit/Reverse-link-list.py | Reverse-link-list.py | py | 1,399 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.