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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
3631670802 | import os
def discover_repo_root(input_repo: str = None):
"""
Resolves the root of the repository given a current working directory. This function should be used if a target repo argument is not provided.
If the value of input_repo has value, that will supplant the path ascension logic.
"""
if in... | Azure/azure-sdk-for-python | tools/azure-sdk-tools/ci_tools/variables.py | variables.py | py | 2,146 | python | en | code | 3,916 | github-code | 54 |
36216948140 | # import time
#
# import numpy as np
# import os
# ROOT = '/cw/liir/NoCsBack/testliir/nathan/p1_causality'
# c = np.load(os.path.join(ROOT, "DeVLBert/dic", "id2class.npy"), allow_pickle=True).item()
# c1155_mine = np.load(os.path.join(ROOT, "DeVLBert/dic", "id2class1155_mine.npy"), allow_pickle=True).item()
# c1155_og ... | Natithan/p1_causality | my_lmdb.py | my_lmdb.py | py | 29,295 | python | en | code | 2 | github-code | 54 |
43412873115 | '''
credit:
Brock, A., Donahue, J., & Simonyan, K. (2018).
Large scale gan training for high fidelity natural image synthesis.
arXiv preprint arXiv:1809.11096.
'''
''' Layers
This file contains various layers for the BigGAN models.
'''
import numpy as np
import torch
import torch.nn as nn
from torch.nn i... | julightzhong10/fastgan | tools/networks/gan/biggan_blocks.py | biggan_blocks.py | py | 12,509 | python | en | code | 9 | github-code | 54 |
73868793 | class Solution(object):
def plusOne(self, digits):
number = ''
for i in digits:
number += str(i)
result = int(number)+ 1
res= []
for i in str(result):
res.append(int(i))
return res | HadiAyyach/python-codes | Leet Code/Easy/66. Plus One.py | 66. Plus One.py | py | 256 | python | en | code | 0 | github-code | 54 |
27646347213 | import logging
import os
import sys
import discord
from discord.ext import commands
from dotenv import load_dotenv
from calculate_func import beancan_grenades, satchels, explosive_ammos, \
rockets, c4s
load_dotenv()
TOKEN = os.getenv('BOT_TOKEN')
intents = discord.Intents.default()
intents.message_content = Tr... | MorphEngine69/RustHelper | bot.py | bot.py | py | 24,789 | python | ru | code | 1 | github-code | 54 |
29546331995 | import os
import matplotlib.pyplot as plt
import numpy as np
import torch
from librubiks import gpu, no_grad, reset_cuda, rc_params
from librubiks.utils import Logger, NullLogger, unverbose, TickTock, TimeUnit, bernoulli_error
from librubiks.analysis import TrainAnalysis
from librubiks import cube
from librubiks.mod... | peleiden/rl-rubiks | librubiks/train.py | train.py | py | 17,457 | python | en | code | 5 | github-code | 54 |
2593527235 | import os
import shutil
import pandas as pd
import pydicom
from tqdm import tqdm
INPUT_FOLDER = "/kaggle/input/vinbigdata-chest-xray-abnormalities-detection"
DEPS_FOLDER = "/kaggle/input/vinbigdatachestxraydeps"
WORK_FOLDER = "/kaggle/working"
DEVMODE = os.getenv("KAGGLE_MODE") == "DEV"
print(f"DEV MODE: {DEVMODE}")... | sajedjalil/Data-Science-Pipeline-Detector | dataset/vinbigdata-chest-xray-abnormalities-detection/Vitalii/vinbigdata-parse-dicom-tags.py | vinbigdata-parse-dicom-tags.py | py | 1,802 | python | en | code | 8 | github-code | 54 |
23496763971 | class Operations(object):
def __init__(self):
super(Operations, self).__init__()
self.current_op = 0
self.operations = list()
# collect all step methods
l = []
for method_name in dir(self):
s = "step"
method = getattr(self,method_name)
... | xaedes/canopen_301_402 | src/canopen_301_402_old/operations.py | operations.py | py | 876 | python | en | code | 5 | github-code | 54 |
37090073783 | from __future__ import print_function
from setuptools import Extension, setup, find_packages
with open('requirements.txt') as f:
INSTALL_REQUIRES = [l.strip() for l in f.readlines() if l]
with open('README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
setup(
name='xgp',
version='0.1.1',
description... | MaxHalford/xgp-python | setup.py | setup.py | py | 811 | python | en | code | 8 | github-code | 54 |
7709996072 | import xadmin
from .models import Tag, Thesis
class ThesisAdmin(object):
list_display = ['title', 'pub_date', 'publisher', 'is_choiced', \
'tags', 'need_verify', 'getCollege']
list_filter = ['title', 'is_choiced', 'tags', 'need_verify', \
'publisher__teacher__college','p... | zjunju/mysite | thesis/adminx.py | adminx.py | py | 674 | python | en | code | 0 | github-code | 54 |
5953334609 | import asyncio
from typing import Tuple, Union
from bisheng.api.v1.callback import AsyncStreamingLLMCallbackHandler, StreamingLLMCallbackHandler
from bisheng.api.v1.schemas import ChatResponse
from bisheng.processing.process import fix_memory_inputs, format_actions
from bisheng.utils.logger import logger
async def g... | dataelement/bisheng | src/backend/bisheng/processing/base.py | base.py | py | 2,565 | python | en | code | 2,577 | github-code | 54 |
28114366858 | # -*- coding: utf-8 -*-
from shared.views import BoxForm, BoxFormView
from .threadPoll import threadPoll
from .models import Servers, ServerGroups, Options
import time
class HeartbeatBaseViewForm(BoxForm):
pass
headString = "redefine me"
# *** Abstract class ***
# generates view with heartbeat boxes, serverG... | okar1/djangoStatusPanel | heartbeat/heartbeatBaseView.py | heartbeatBaseView.py | py | 6,421 | python | en | code | 4 | github-code | 54 |
32008136540 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import string
import time
import uuid
from flask import session
from app.models.mysql_tools import MsqlTools
class db_interface_list:
def show_interface_list(self,page,limit,sortOrder,interfaceName):
"""
查询t_interface表所有数据
"""
results =... | fzj123/auto_test_platform-master | app/db/db_interface_list.py | db_interface_list.py | py | 5,664 | python | en | code | 0 | github-code | 54 |
2916104025 | import os
import gzip
import time
import tqdm
import json
def list_downloaded():
items = os.listdir("output/")
return [x.replace("|", "/") for x in items]
def load_json_gz(file_list):
for filename in file_list:
with gzip.open(filename, "rb") as f:
content = f.read().decode("utf-8")
... | Linyxus/theorem-proving-data | monitor_progress.py | monitor_progress.py | py | 889 | python | en | code | 2 | github-code | 54 |
12596606963 | #!/usr/bin/env python
from setuptools.command.install import install as _install
from setuptools import setup, find_packages, Command
import os, sys
import shutil
import ctypes.util
import configparser, platform
from metronotescli import APP_VERSION
class generate_configuration_files(Command):
description = "Gener... | gitter-badger/metronotes-cli | setup.py | setup.py | py | 3,570 | python | en | code | 0 | github-code | 54 |
34543197926 | """added questions and answers tables
Revision ID: fd9749a6f0ab
Revises:
Create Date: 2019-03-03 11:13:13.331963
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fd9749a6f0ab'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# #... | dtfrancisco/Lang-Match | migrations/versions/fd9749a6f0ab_added_questions_and_answers_tables.py | fd9749a6f0ab_added_questions_and_answers_tables.py | py | 2,303 | python | en | code | 0 | github-code | 54 |
1869112865 | import gradio as gr
import torch
import torch.nn.functional as F
import numpy as np
from corpy.morphodita import Tokenizer
from nltk import sent_tokenize
import transformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_checkpoint = 'fav-kky/FERNET-C5'
device = torch.device("cuda") ... | horychtom/czech-media-bias-detection | demo/app.py | app.py | py | 2,099 | python | en | code | 1 | github-code | 54 |
32529966958 | #!/usr/bin/python
from fltk import *
import random, glob
def roll(w_id):
random.shuffle(images)
image1 = Fl_JPEG_Image(images[0])
box1.image(image1.copy(box1.w(), box1.h()))
box1.redraw()
images = []
for image in glob.glob("images/dice*.jpg"):
images.append(image)
window = Fl_Window(100, 100, 260, 290, 'Rol... | 2013edp11badam/infotech | dice/dice.py | dice.py | py | 509 | python | en | code | 0 | github-code | 54 |
28060523884 | """This module represents the Circular Shift component of the kwic system."""
class CircularShift:
storage = None
lines = []
circular_shifted_lines = []
def __init__(self, storage):
"""this acts as the setup method in the diagram"""
self.storage = storage
def setup(se... | KendalUTD/QWIC_Phase1 | kwic/circularShift.py | circularShift.py | py | 1,124 | python | en | code | 2 | github-code | 54 |
3619374812 | import datetime
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from ... import _serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
class AccountSasParameters(_serialization.Model):
"""The parameters to list SAS credentia... | Azure/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py | _models_py3.py | py | 53,671 | python | en | code | 3,916 | github-code | 54 |
70169071202 | import json
import hvac
from secret import get_secret_key
secret_data = get_secret_key()
url=secret_data["url"]
token=secret_data["token"]
variable_mount_point=secret_data["variable_mount_point"]
connection_mount_point=secret_data["connection_mount_point"]
def connection_vault(url:str, token:str) -> hvac.Client:
... | Linho1150/get_vault_list_and_value | main.py | main.py | py | 1,837 | python | en | code | 0 | github-code | 54 |
70744242402 | import datetime
from django import forms
from .models import Room, Reservation
class ReservationForm(forms.Form):
room = forms.ModelChoiceField(Room.objects)
date = forms.DateField(
initial=datetime.date.today,
widget=forms.SelectDateWidget(empty_label="Nothing")
)
class ReservationFrom2... | kgawda/python-backend | webserwisy/gamma/buildingmanagement/forms.py | forms.py | py | 605 | python | en | code | 5 | github-code | 54 |
8818197928 | #!/usr/lib/rich/bin/python3
import sys
from rich import box
from rich.console import Console
from rich.markdown import Markdown
from rich.panel import Panel
from rich.style import Style
page = False
path = sys.argv[1]
if path == "-p":
page = True
path = sys.argv[2]
with open(path) as f:
markdown = Markdown(f.... | mrxk/morg | view.py | view.py | py | 528 | python | en | code | 0 | github-code | 54 |
40409523027 | #!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
BtnPin = 11
Gpin = 13
Rpin = 12
def setup():
print("setup method called")
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(Gpin, GPIO.OUT) # Set Green Led Pin mode to output
GPIO.setup(Rpin, GPIO.OUT) # Set Red ... | NoahB7/CS4363-InternetofThingsDevelopment-FacialRecognitionSecuritySystem | Labs/Lab1ButtonLed.py | Lab1ButtonLed.py | py | 1,343 | python | en | code | 0 | github-code | 54 |
21495694616 | from sys import stdin
n, m = map(int, stdin.readline().split())
arr = list(map(int, stdin.readline().split())) + [0]
cnt = 0
l, r = 0, 1
s = arr[l]
while r < len(arr):
if s < m:
s += arr[r]
r += 1
elif s == m:
cnt += 1
l += 1
s = arr[l]
r = l + 1... | youngeun10/baekjoon | 백준/Silver/2003. 수들의 합 2/수들의 합 2.py | 수들의 합 2.py | py | 402 | python | en | code | 1 | github-code | 54 |
27345376623 | from time import time
from typing import List
class Solution:
def numFactoredBinaryTrees(self, arr: List[int]) -> int:
# official solution
#
arr.sort()
res = [1 for _ in range(len(arr))]
idx = {v: i for i, v in enumerate(arr)}
for i, v in enumerate(arr):
... | Sadomtsevvs/Leetcode | 823. Binary Trees With Factors.py | 823. Binary Trees With Factors.py | py | 1,197 | python | en | code | 0 | github-code | 54 |
42137237391 | """
Benjamin Adam Catching
August 12, 2016
California Institute of Technology
Rob Phillips Group
Boundaries of Life Initiative
"""
# Function to read file into string
def file_to_string(file_name = ""):
"""Quick function to read FASTA files into strings"""
f = open(file_name, 'r')
text = f.readlines()
... | adamcatching/Probe_Search | Oligo_search.py | Oligo_search.py | py | 4,555 | python | en | code | 0 | github-code | 54 |
73166616163 | import unittest
from isla.derivation_tree import DerivationTree
from fuzzingbook.Parser import EarleyParser, is_valid_grammar, Grammar
from debugging_benchmark.calculator.calculator import grammar, oracle
from debugging_framework.oracle import OracleResult
from debugging_framework.input import Input
class TestInput... | martineberlein/debugging-benchmark | test/test_test_inputs.py | test_test_inputs.py | py | 2,378 | python | en | code | 0 | github-code | 54 |
27555234352 | import time
import numpy as np
import tensorflow as tf
import reader
#flags = tf.flags
#logging = tf.logging
#flags.DEFINE_string("save_path", None,
# "Model output directory.")
#flags.DEFINE_bool("use_fp16", False,
# "Train using 16-bit floats instead of 32bit floats")
#FLAGS =... | MachineLP/Tensorflow- | Tensorflow/7_2_LSTM.py | 7_2_LSTM.py | py | 8,779 | python | en | code | 1,135 | github-code | 54 |
10370785232 | # Function to remove duplicates from sorted linked list.
# ************************************************************************
class Node:
def __init__(self, data): # data -> value stored in node
self.data = data
self.next = None
def removeDuplicates1(head):
if head is None:
re... | tecmaverick/pylearn | src/43_algo/28_remove_dup_linked_list.py | 28_remove_dup_linked_list.py | py | 1,711 | python | en | code | 1 | github-code | 54 |
29129129013 | # 로또의 최 순위와 최저 순위
# https://programmers.co.kr/learn/courses/30/lessons/77484?language=python3
def solution(lottos, win_nums):
answer = [0,0]
rank = [6,6,5,4,3,2,1]
cnt = 0
cntz = lottos.count(0)
for i in lottos:
if i in win_nums:
cnt += 1
answer[0], answer[1] = rank[c... | wkuwoo/Programmers | Level_1/77484_solution.py | 77484_solution.py | py | 380 | python | en | code | 0 | github-code | 54 |
3644069014 | from common_file import random_number_list
class Solution(object):
def maxSubArrayLength(self, nums, k):
cur_sum = 0
sums = {0: -1}
max_length = 0
for i in range(len(nums)):
cur_sum += nums[i]
if cur_sum not in sums:
sums[cur_sum] = i
... | ss433s/coding_test | lc325 最大子数组之和为k(easy).py | lc325 最大子数组之和为k(easy).py | py | 553 | python | en | code | 0 | github-code | 54 |
15593121702 | import sys
import copy
import datetime as dt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import QSTK.qstkutil.qsdateutil as du
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkstudy.EventProfiler as ep
def find_events(symbols, data, timestamps... | cowboysmall-moocs/computationalinvesting1 | src/homework6/bollinger_events.py | bollinger_events.py | py | 2,754 | python | en | code | 0 | github-code | 54 |
71220298722 | from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from django.urls... | AvshRLev/cs50network | network/views.py | views.py | py | 6,604 | python | en | code | 0 | github-code | 54 |
26770389059 | import os
from selenium import webdriver
from time import sleep
import json
CHROMEDRIVER_LOCATION = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)),"chromedriver_win32"),"chromedriver.exe")
def runCrawler():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--start-m... | WinstonPais/QSUniversityRankingWebScraper | crawler1.py | crawler1.py | py | 1,976 | python | en | code | 0 | github-code | 54 |
1176365360 | def day13a_mod():
f = open('input\\input13.txt', 'r')
lines = [line.strip() for line in f.readlines()]
f.close()
firewalls = {}
for line in lines:
data = line.split(':')
depth = int(data[0])
rng = int(data[1])
firewalls[depth] = rng
severity ... | boneillhawk/advent2017 | day13a_mod.py | day13a_mod.py | py | 540 | python | en | code | 0 | github-code | 54 |
24053779640 | '''
Created on 06.11.2013
@author: gena
'''
from PyQt4 import QtGui
from escore.actions import createAction
from escore.plate import Plate
from escore.platemanager import PlateManager
import imagercc
class PlateManagerWidget(QtGui.QWidget):
'''
Widget represets plate manager -- list of plates
Also handl... | GennadiyZakharov/elisasolver | src/esgui/platemanagerwidget.py | platemanagerwidget.py | py | 5,111 | python | en | code | 0 | github-code | 54 |
8257833336 | import unittest
from solfege.mpd.musicalpitch import MusicalPitch, InvalidNotenameException
from solfege.mpd.elems import *
from solfege.mpd import const
from solfege.mpd import parser
from solfege.mpd import performer
from solfege import mpd
def f3(s):
return parser.parse_to_score_object(s).get_timelist()
class ... | rannyeribaptist/Solfege | solfege/mpd/tests/test_elems.py | test_elems.py | py | 18,276 | python | en | code | 6 | github-code | 54 |
39369238150 | from inpaint_model import InpaintGenerator
from PIL import Image
import yaml
import argparse
import cv2
import numpy as np
import tensorflow as tf
parser = argparse.ArgumentParser()
parser.add_argument('--image', default='', type=str,
help='The filename of image to be completed.')
parser.add_argu... | Ir1d/tf-models | v2/test.py | test.py | py | 1,718 | python | en | code | 1 | github-code | 54 |
39781889467 | """Module for detecting voter fraud using binary search."""
from classes import VoterList
def fraud_detect_bin(first_booth_voters, second_booth_voters):
"""This function takes a VoterList from two voting booths and returns a new
VoterList, the voters who cast a vote in both booths, and an integer, the
numb... | kaikoh95/Algorithms-and-Data-Structure | fraud_detector_algorithms/fraud_detector_binary2.py | fraud_detector_binary2.py | py | 1,087 | python | en | code | 1 | github-code | 54 |
70000322722 | # O programa define uma funcao que recebe dois valores e retorna o maior deles.
def maior(a,b):
if(a > b):
return a
else:
return b
a, b = map(int, input().split())
print(maior(a,b)) | icapetti/python_exercises | basic/maior_entre_dois_valores.py | maior_entre_dois_valores.py | py | 208 | python | pt | code | 0 | github-code | 54 |
20574105998 | """
Authors: Zuzanna Ciborowska s20682 & Joanna Walkiewicz s20161
"""
import numpy as np
from easyAI import TwoPlayerGame
from reverse import Reverse
def to_string(a):
"""
Convert array of board coords [x,y] to string
eg. [1,1] to 'B2'
:param a - array [x,y]
:return string format of board coords
... | s20161-pj/nai | zjazd1/reversi.py | reversi.py | py | 3,454 | python | en | code | 0 | github-code | 54 |
22405347706 | import re
import webbrowser, requests, bs4
def downloadImage(pic_url, namepicture):
name_of_people = '../data/temp/'+ namepicture+'.jpg'
with open(name_of_people, 'wb') as handle:
response = requests.get(pic_url)
if not response.ok:
print(response)
for block in response.iter_content(1024):
if not block:
... | cothuyanninh/Python_Code | project/source/getAvatarFromLink.py | getAvatarFromLink.py | py | 1,392 | python | en | code | 0 | github-code | 54 |
17163183312 | # Each game type has assigned max number of players
import random
import json
from threading import Thread
from typing import Optional
import time
import threading
from games.pacman import PacmanController
GAME_TYPES = {
'pac-man': 4,
'pong': 2
}
def generate_token_for_player():
chars = [chr(x) for x in... | AlighieriTeam/Alighieri-backend | website/room.py | room.py | py | 4,343 | python | en | code | 0 | github-code | 54 |
21855463164 | """Contains the Util class which includes many utility functions."""
from copy import deepcopy
import re
from fractions import Fraction
from functools import reduce
from typing import Dict, Iterable, List, Tuple, Callable, Any, Union
import asyncio
from ruamel.yaml.compat import ordereddict
class Util:
"""Utili... | OctaPinball/World-of-Warships-pinball | _dev_env/Python36/Lib/site-packages/mpf/core/utility_functions.py | utility_functions.py | py | 26,739 | python | en | code | 2 | github-code | 54 |
5636460548 | print("How many times do you wish to loop? ")
number_of_times = int(input())
total_sum = 0 # Totala summan tilldelas 0
for i in range(number_of_times):
print("Write a number : ", end="")
number = int(input()) # Loopar för antalet gånger användaren ville köra
total_sum = total_sum + number # Plus... | schlook/ECIoT21 | Niklas_Månzén/Python/W51/3.py | 3.py | py | 490 | python | sv | code | 0 | github-code | 54 |
36328919521 | import sys
from math import ceil
import pathlib
import subprocess
import abookform
from PyQt5 import QtWidgets, QtCore, QtGui
class ThreadConvert(QtCore.QThread):
signal_info = QtCore.pyqtSignal(str)
signal_start = QtCore.pyqtSignal(str)
signal_finish = QtCore.pyqtSignal(str)
def __init__(self, par... | tvaishim/mp3tomp3 | main.py | main.py | py | 6,108 | python | en | code | 0 | github-code | 54 |
2599232658 | import gc
import faiss
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.feature_extraction.text import TfidfVectorizer
from tqdm import tqdm
def f1_score(y_true, y_pred):
y_true = y_true.apply(lambda x: set(x.split()))
y_pred = y_pred.apply(lambda x... | mammadliafaq/master-thesis_web-app | app/utils/eval_utils.py | eval_utils.py | py | 7,690 | python | en | code | 0 | github-code | 54 |
40267926737 | import datetime
import Observation_Getter
import csv
import Taxa_Getter
def calculate_datetime_difference(past, requested_day=""):
"""
Calculates the difference in the datetime of the previous update
and the current update
params:
past: a string object that is a date o... | ckhoward/iNat-SDM | src/updater.py | updater.py | py | 4,797 | python | en | code | 1 | github-code | 54 |
72740092642 | from collections import defaultdict
from flask import Flask, request, jsonify, render_template
EXTRA_INFO = {
'header_tips': defaultdict(
lambda: "",
**{
"Host": "By default, nginx reverse proxying will redefine this to the gateway host."
}
)
}
def create_app():
app =... | jwg4/HelpTTP | app.py | app.py | py | 1,258 | python | en | code | 0 | github-code | 54 |
23635124122 | import json
import re
import ast
all_courses_file = "../vue-app/data/allCourses.json"
major_reqs_file = "../vue-app/data/course_requirements.json"
def read_data_files(all_courses_file, major_reqs_file):
with open(all_courses_file, 'r') as f:
all_courses = json.load(f)
with open(major_reqs_file, 'r') ... | zhang-lucy/coursehose | backend/server.py | server.py | py | 9,910 | python | en | code | 1 | github-code | 54 |
20939074311 | import logging
from aiogram import Bot, Dispatcher, types, executor
from keyboards import start_ikb, ikb_yes_no, ikb_yes_variants, ikb_no_variants
from aiogram.types import InputFile
from aiogram.dispatcher.filters import Text
from aiogram.dispatcher import FSMContext
from dotenv import load_dotenv, find_dotenv
from ai... | usain-bolt/test-chat-bot | bot.py | bot.py | py | 5,876 | python | ru | code | 0 | github-code | 54 |
9015477276 | from bs4 import BeautifulSoup
import requests
import pandas as pd
from splinter import Browser
import time
import re
def scrape():
#Scrape the NASA Mars News Site and assign to variables for later reference
url = "https://mars.nasa.gov/news/"
page = requests.get("https://mars.nasa.gov/news/")
so... | yared-shewarade/Mission-to-Mars | scrape_mars.py | scrape_mars.py | py | 4,002 | python | en | code | 1 | github-code | 54 |
36953394816 | """
https://leetcode-cn.com/problems/LGjMqU/
https://leetcode-cn.com/problems/LGjMqU/solution/shua-chuan-jian-zhi-offer-day13-lian-bia-chs7/
思路:
快慢指针+反转链表+链表合并
"""
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseList(self, he... | AlfredTheBest/leetcode | 剑指/ListNode/剑指 Offer II 026. 重排链表.py | 剑指 Offer II 026. 重排链表.py | py | 1,057 | python | en | code | 0 | github-code | 54 |
6461292688 | import cv2
import numpy as np
img1 = cv2.imread('/home/polya/mine/picture/test1.jpg',1)
img2 = cv2.imread('/home/polya/mine/picture/test2.jpg',1)
# #直接相加
# cv2.imshow('dst',cv2.add(img1,img2))
# cv2.waitKey(0)
# cv2.destroyAllWindow()
# #权重相加
# dst=cv2.addWeighted(img1,0.7,img2,0.3,0)
# cv2.imshow('dst',dst)
# cv2.wait... | polya-xue/Opencv_image_processing | 7image_add/7image_add.py | 7image_add.py | py | 690 | python | en | code | 0 | github-code | 54 |
70290449123 | # enumerate
sports = ['농구', '축구', '야구', '마라톤', '테니스']
for i in range(len(sports)):
print(f'{i} : {sports[i]}')
for idx, value in enumerate(sports):
print(f'{idx} : {value}')
str = 'Hello Future'
for idx, value in enumerate(str):
print(f'{idx} : {value}')
sports = ['농구', '수구', '축구', '마라톤', '테니스']
favorite... | offpython/DataStructure | 2.enumerate.py | 2.enumerate.py | py | 766 | python | ko | code | 0 | github-code | 54 |
3809025256 | print('Compiling packages and building GUI...')
from scipy import stats
import PySimpleGUI as sg
import pandas as pd
import re
import numpy as np
import skimage.draw as draw
import skimage.io as skio
import cv2
import pathlib
import tifffile as tiff
import gc
import pandas as pd
import numpy as np
import ... | coltonrobbins73/Nanostring-software | SMI_tissue_stability.py | SMI_tissue_stability.py | py | 26,705 | python | en | code | 0 | github-code | 54 |
3539016442 | from __future__ import annotations
import asyncio
import abc
from typing import TypeVar, Generic, Any, AsyncContextManager, TYPE_CHECKING
if TYPE_CHECKING:
from ..rest import AsyncHttpResponse
AsyncHTTPResponseType = TypeVar("AsyncHTTPResponseType")
HTTPResponseType = TypeVar("HTTPResponseType")
HTTPRequestType =... | Azure/azure-sdk-for-python | sdk/core/corehttp/corehttp/transport/_base_async.py | _base_async.py | py | 2,524 | python | en | code | 3,916 | github-code | 54 |
9601558212 | import numpy as np
import matplotlib.pyplot as plt
import json
import seaborn as sns
sns.set()
FILES = ["results_fgsm.json","results_bim.json","results_pgd.json","results_random.json"]#,"results_bim.json","results_pgd.json"]
def visualizer(files):
x_fgsm = []
y_fgsm = []
y_bar_fgsm = []
x_bim = []... | vvrs/AM221-Project | src/pong/visualizer.py | visualizer.py | py | 3,466 | python | en | code | 0 | github-code | 54 |
28541288751 | #
# @lc app=leetcode id=31 lang=python3
#
# [31] Next Permutation
#
# @lc code=start
class Solution:
# Find the largest index k such that nums[k] < nums[k + 1]. If no such index exists, just reverse nums and done.
# Find the largest index l > k such that nums[k] < nums[l].
# Swap nums[k] and nums[l].
#... | r96725046/leetcode-py | 31.next-permutation.py | 31.next-permutation.py | py | 1,021 | python | en | code | 0 | github-code | 54 |
15610789621 | # V0
# V1
# http://www.voidcn.com/article/p-pqyeirhe-qp.html
class Solution(object):
def shortestDistance(self, words, word1, word2):
"""
:type words: List[str]
:type word1: str
:type word2: str
:rtype: int
"""
w1 = [i for i in range(len(words)) if words[i]... | yennanliu/CS_basics | leetcode_python/Array/shortest-word-distance-iii.py | shortest-word-distance-iii.py | py | 1,746 | python | en | code | 69 | github-code | 54 |
8988033770 | import json
from .base_gql import BaseGQL
class GuppyGQL(BaseGQL):
def __init__(self, node, hostname, access_token):
super().__init__(node, hostname, access_token)
def _count(self, filters=None):
self.url = f"{self.hostname}/guppy/graphql"
query = f"query($filter: JSON) {{ _aggregati... | uc-cdis/pelican | pelican/graphql/guppy_gql.py | guppy_gql.py | py | 2,814 | python | en | code | 3 | github-code | 54 |
73155760801 | # main file for vision transformer
# Created: 6/16/2021
# Status: in progress
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python vit_main.py
import sys
import torch
import numpy as np
from networks import ViT_Wrapper
from utils import read_json
def ViT(num_exps, model_name, config, Wrapper):
print('Evaluation metric: {}... | IceFireCloud/Event-Prediction | models/transformer_torch/vit_main.py | vit_main.py | py | 1,414 | python | en | code | 3 | github-code | 54 |
37860347146 | import uuid
import time
import requests
import base64
import conf
import net
from v2ray import Server, parse
from typing import List
from subprocess import run, DEVNULL, Popen
import gevent.pool
from itertools import groupby
import logger
from gevent import monkey
monkey.patch_socket()
log = logger.get_logger('proxy-... | Andiedie/proxy-crawler | main.py | main.py | py | 3,824 | python | en | code | 1 | github-code | 54 |
70115655203 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def delNodes(self, root, to_delete):
setToDelete = set(to_delete)
results = []
def traverser(root, setToDelete, ... | ilkercankaya/LeetCodeAndHackerRankSolutions | LeetCode/Medium/1110.Delete_Nodes_And_Return_Forest.py | 1110.Delete_Nodes_And_Return_Forest.py | py | 809 | python | en | code | 2 | github-code | 54 |
28925477179 | from flask import Flask
import pymongo
import app.tweet_scraper.get_app_idea_tweets as gait
import os
from flask import render_template
app = Flask(__name__)
@app.route("/")
@app.route("/index")
def index():
db = gait.connect_mdb()
tweets = db.tweet_data.find().limit(1000).sort("tweet_create_time", -1)
re... | NicholasJCole/twitter_app_ideas | app/main.py | main.py | py | 788 | python | en | code | 0 | github-code | 54 |
2395241955 | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... | sajedjalil/Data-Science-Pipeline-Detector | dataset/data-science-bowl-2017/Justin R/ch4-nt.py | ch4-nt.py | py | 1,250 | python | en | code | 8 | github-code | 54 |
38430148456 | #User function Template for python3
from math import gcd
from collections import defaultdict
class Solution:
def countFractions(self, n, numerator, denominator):
fractionCount = defaultdict(int)
ans = 0
for i in range(n):
x = numerator[i]
y = denominator[i]
... | shibam120302/LeetCode | Fraction pairs with sum 1 - GFG/fraction-pairs-with-sum-1.py | fraction-pairs-with-sum-1.py | py | 915 | python | en | code | 2 | github-code | 54 |
3136595262 | #!/usr/bin/python3
from scapy.all import *
def sniffProbe(p):
if p.haslayer(Dot11):
wifiMac = p.getlayer(Dot11).addr2
print(wifiMac)
# def sniffProbe(p):
# if p.haslayer(Dot11ProbeReq):
# netName = p.getlayer(Dot11ProbeReq).info
# netName = netName.decode()
# ... | HackerSpot2001/Voilent-Python-with-Python3 | detect_wireless_network.py | detect_wireless_network.py | py | 675 | python | en | code | 1 | github-code | 54 |
23297870817 | import requests
from bs4 import BeautifulSoup
import csv
url = "http://www.vhpg.com/diablo-4-leaderboards-hc/"
# Send a GET request to the URL
response = requests.get(url)
# Create a BeautifulSoup object from the response text
soup = BeautifulSoup(response.text, "html.parser")
# Find the table containing the leader... | RCFromCLE/d4_hc_leaderboards_analysis | d4webscrape.py | d4webscrape.py | py | 1,460 | python | en | code | 0 | github-code | 54 |
4557009343 | #!/usr/bin/env python
_version__ = "0.1"
__author__ = "Noe Pozzan"
__contact__ = "noe.pozzan@stud.unibas.ch"
__doc__ = "Parse a parameter file and change some parameters."
# -----------------------------------------------------------------------------
# import needed (external) modules
# -----------------------------... | noepozzan/small-peptide-pipeline | data/scripts/change_file.py | change_file.py | py | 2,806 | python | en | code | 2 | github-code | 54 |
28034826381 |
from django.urls import path
from . import views
app_name="bidder"
urlpatterns=[
path('viewproduct/<int:id>',views.viewproduct,name="view_product"),
path('buy_product/',views.buy_product),
path('userprofile/',views.userprofile),
# path('bid_product/<int:id>',views.bid_product,name="bid_product"),
path('bid_u... | parasdange/Auction-platform | AuctionPlatform/bidder/urls.py | urls.py | py | 1,045 | python | en | code | 0 | github-code | 54 |
227072368 | import numpy as np
from collections import Counter
def read_data(text):
words = text.split()
corpusLength = len(words)
freqs = Counter(words)
unigram_dict = {"<unk>": 0}
for key in freqs: # create a new dict with <unk>
if freqs[key] == 1:
unigram_dict["<unk>"] +=1
else... | courtsolano/deaduncleben | shannon.py | shannon.py | py | 2,794 | python | en | code | 0 | github-code | 54 |
25844345863 | """
FACEBOOK APP
This module provides an interface for the user to interact
with the Facebook app.
Classes:
PreLogin
LoginCallback
Functions:
n/a
Created on 29 Oct 2013
@author: michael
"""
from django.conf import settings
from django.contrib.auth import authenticate, login as auth_login
from django.c... | unomena/tunobase | tunobase/social_media/facebook/views.py | views.py | py | 2,301 | python | en | code | 0 | github-code | 54 |
725903340 | # 加載所需的庫
# import libraries
import cv2
# 列出庫的版本
# print out the version of libraries
print('cv2 version: ' + cv2.__version__)
# 括號中的數字取決於你所使用的攝像頭
# You may need to change the number inside () to 0 1 or 2,
# depending on which webcam you are using
cap = cv2.VideoCapture(0)
# 一個用於顯示輸出幀的循環
# A loop for d... | Nick032023/2023 | MBS3523_Assignment_1_AY2223_Question_2/MBS3523_Asn1Q2_CE.py | MBS3523_Asn1Q2_CE.py | py | 1,807 | python | en | code | 0 | github-code | 54 |
18332337880 | import requests
import sys
"""
sys arg1: name of droplet to receive floating ip
sys arg2: digital ocean token
"""
digitalocean_floatingips_url = "https://api.digitalocean.com/v2/floating_ips"
digitalocean_droplets_url = "https://api.digitalocean.com/v2/droplets"
digitalocean_droplet_name = sys.argv[1]
headers = {"Aut... | MadsWJespersen/Devoops | scripts/deployscripts/reassign_floating_ip.py | reassign_floating_ip.py | py | 1,219 | python | en | code | 3 | github-code | 54 |
6538452522 | mysteryAnimal = "snake"
quitVar = "q"
while True:
print("\nI'm thinking of an animal...")
guess = input("\nTake a guess what it is: ").lower()
if guess == mysteryAnimal:
print("\nThat's the one! Congratulations!")
snakeLike = input("\nDo you like snakes y/n: ").lower()
if snakeLik... | AFineSortie/IntroProgramming-Labs | guessing-game.py | guessing-game.py | py | 689 | python | en | code | 0 | github-code | 54 |
12594667409 | from flask import session, request, redirect
from db.init import init_db
from lib.get_env import get_env, MINIM_FLASK_APP_SECRET_KEY
from lib.gitlab import gitlab_get_token
from routes import auth_blueprint, main_blueprint, settings_blueprint, projects_blueprint, hooks_blueprint
def config_app(app):
app.config['... | 380sq/minim | lib/app.py | app.py | py | 1,414 | python | en | code | 0 | github-code | 54 |
23594669209 | import PySimpleGUI as sg
# layout
layout = [[sg.Text('What is your name?')],
[sg.Input()],
[sg.Button('OK')]]
# window
window = sg.Window('name', layout)
event, values = window.Read()
window.close()
sg.Popup(f'Hello {values[0]}, welcome!') | imcj1225/practice.py | name.py | name.py | py | 268 | python | en | code | 0 | github-code | 54 |
16282356256 | from keras.applications.vgg16 import (
VGG16, preprocess_input, decode_predictions)
from keras.preprocessing import image
from keras.layers.core import Lambda
from keras.models import Sequential, Model, load_model
from tensorflow.python.framework import ops
import keras.backend as K
import tensorflow as tf
... | StevenLu1204/GradCam_Keras | Grad_cam_CNN.py | Grad_cam_CNN.py | py | 3,718 | python | en | code | 0 | github-code | 54 |
72575878560 | f_in=open("schema.html")
f_out=open("schema-images.html", "w")
line_no=0
insert_at=-1
insert_content=""
found_html_tag=False
while True:
line = f_in.readline()
if line == "": break
line_no += 1
if """<!DOCTYPE html>""" in line:
found_html_tag = True
if not found_html_tag: continue
if """<h2>Overview... | calipho-sib/nextprot-scripts | src/polish-rdf/insert_images.py | insert_images.py | py | 1,221 | python | en | code | 0 | github-code | 54 |
37597986135 | # The Python standard library includes some functionality for communicating
# over the Internet.
# However, we will use a more powerful and simpler library called requests.
# This is external library that you may need to install first.
import requests
import json
def get_data():
# With requests, we can ask the we... | Raj-Ramani/earthquakes | earthquakes.py | earthquakes.py | py | 2,542 | python | en | code | null | github-code | 54 |
74332957921 | #!/usr/bin/env python
# coding=utf-8
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums = sorted(nums)
solutions = set()
solutions.add(tuple())
partial = []
self.backtracking(nums,... | Firkraag/leetcode | subsetsWithDup_90.py | subsetsWithDup_90.py | py | 779 | python | en | code | 25 | github-code | 54 |
25434661616 | # -*- coding: utf-8 -*-
from sys import exit
from Logging import loggingCritical
from sympy import Symbol, Mul, MatMul, conjugate, SparseMatrix, Matrix, Pow, diag
class mSymbol(Symbol):
""" mSymbol(name, n, m, **assumptions) """
def __new__(cls, *args, symmetric=False, antisymmetric=False, hermitian=False,... | LSartore/pyrate | src/Definitions/Symbols.py | Symbols.py | py | 5,104 | python | en | code | 10 | github-code | 54 |
17990126840 | from sa import *
from gui import Window
import time
def main():
import optparse
usage_str = """
python sa_main.py <options>
EXAMPLES: (1) python sa_main.py
- starts a value with queen and size 8 board
(2) python sa_main.py -s 10 -n nX
- starts a value with bishop and size 10 board
"""
parser = optparse.Op... | tanaka-spec/simulated_annealing_fairy_notation | sa_main.py | sa_main.py | py | 2,461 | python | en | code | 0 | github-code | 54 |
34455482468 | #클라이언트가 전송한 값 처리 get 방식 데이터 받기 (java는 httpServletRequest)
import cgi
form = cgi.FieldStorage() #java로 httpServletRequest 역활 get방식으로 넘어온 데이터를 받는 역활
#변수(바뀌어도됨) = form[넘겨진명이랑 같아야함]
name = form['name'].value # java로 request.getParameter("name")
nai = form['age'].value
print('Content-Type:text/html;charset=utf8\n')
prin... | KHG0217/python_study | pypro1/pack4_http/cgi-bin/my.py | my.py | py | 586 | python | ko | code | 0 | github-code | 54 |
25714206295 | from django.contrib.auth.models import AbstractUser
from django.db import models
from django.contrib.auth.models import AbstractUser
from django import forms
# Create your models here.
class Student(models.Model):
student_id = models.CharField(max_length=20, null=False)
student_name = models.CharField(max_le... | nguyentanphatka/Attendance | DjangoAPI/student_info/models.py | models.py | py | 1,930 | python | en | code | 0 | github-code | 54 |
26363935505 | from bs4 import BeautifulSoup as BS
from datetime import datetime
import urllib, urllib2
import os
import csv
import json
def static_url(url):
static_url = "www.dealmoon.com"
if static_url in url:
return url
else:
return static_url + url
def image_src(img):
img_src = ""
if img.has_attr('src'):
img_src = im... | WilliamZhang/python-raw-data | deals_hot_picks.py | deals_hot_picks.py | py | 5,143 | python | en | code | 0 | github-code | 54 |
36279837714 | # solved
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
# mathematically, the answer is (m + n)! / (m!n!)
# First, let's make the parameters in order. (We want them to be the case that m > n)
if m < n:
m, n = n, m
answer = 1
for i in range(m, m + n... | yehogwon/algo-study | leetcode/unique-paths/unique-paths.py | unique-paths.py | py | 434 | python | en | code | 0 | github-code | 54 |
24317022979 | import numpy
from dateutil.parser import parse
__TYPE__ = 'OMPS'
def _omps_pointtime(x):
return numpy.asarray([parse(date).timestamp()
if date.strip()
else None
for date in x])
def _omps_validity(x):
return (1 - x) * 100
def _... | ibrewster/tropomi_download | file_formats/omps.py | omps.py | py | 6,096 | python | en | code | 0 | github-code | 54 |
36690684101 | import datetime
class Api():
def __init__(self,id,name,status,species,gender,first_location,last_location,n_episodes,image,created):
self.id=id
self.name=name
self.status=status
self.species=species
self.gender=gender
self.first_location=first_location
self.la... | vmarialuzm/ProyectoFinal_Unidad3 | app/models/api.py | api.py | py | 857 | python | en | code | 0 | github-code | 54 |
7059357567 | from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.clock import Clock
from kivymd.uix.boxlayout import MDBoxLayout
from kivy.properties import ListProperty
from kivy.logger import Logger
import json
import websocket
try:
import thread
except ImportError:
import _thr... | dembinski2019/pychat | mobile/app.py | app.py | py | 2,743 | python | en | code | 0 | github-code | 54 |
41027066321 | # File: P (Python 2.4)
from direct.controls.GravityWalker import GravityWalker
from direct.showbase.InputStateGlobal import inputState
from pandac.PandaModules import *
from direct.task.Task import Task
class PiratesGravityWalker(GravityWalker):
notify = directNotify.newCategory('PiratesGravityWalker')
d... | ksmit799/POTCO-PS | pirates/movement/PiratesGravityWalker.py | PiratesGravityWalker.py | py | 6,610 | python | en | code | 7 | github-code | 54 |
26422878786 |
import textract
import re
import glob
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
# global vars
default_files = ['doc', 'docx', 'pdf']
# this function parse resumes in various types such as .doc, .docx, .pdf.
def resume2text(file_path):
content ... | ZancaM/resume-classification | fileutil.py | fileutil.py | py | 3,575 | python | en | code | 0 | github-code | 54 |
31943189182 | #! -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from report_printer_clear.management.commands.defects_report_pages.defects import DefectsPage
from report_printer_clear.utils.report import Report
from report_printer_clear.utils.report import ReportParameters
from tfoms.func import get_mo_nam... | dmsamur/medical_registry | report_printer_clear/management/commands/defects_report.py | defects_report.py | py | 1,008 | python | en | code | 0 | github-code | 54 |
2901077558 | # coding: utf8
""" список троллейбусов на нужных мне остановках """
import json
import thread
import time
import xml.etree.ElementTree as etree
from urllib2 import urlopen
from collections import OrderedDict
from markdown import Markdown
from flask import Flask, render_template
MARKDOWN = Markdown()
APP = Flask(__name... | strizhechenko/trolleybuses | __init__.py | __init__.py | py | 2,841 | python | ru | code | 0 | github-code | 54 |
13196423230 | """Handles Group adresses."""
from __future__ import annotations
from dataclasses import dataclass
import re
from xknxproject.models.static import SpaceType
from xknxproject.util import parse_dpt_types
class XMLGroupAddress:
"""Class that represents a group address."""
def __init__(
self,
n... | sgrimee/xknxproject | xknxproject/models/models.py | models.py | py | 8,911 | python | en | code | null | github-code | 54 |
37523924994 | import numpy as np
import matplotlib.pyplot as plt
import pickle
from polynomial_model import add_polynomial_features
from ridge import MyRidge as MyLR
test_file = "test_set.csv"
train_file = "train_set.csv"
features = ["weight", "prod_distance", "time_delivery"]
def _guard_(func):
def wrapper(*args, **kwargs... | bbritva/Python_modules | day_09/ex07/space_avocado.py | space_avocado.py | py | 3,658 | python | en | code | 0 | github-code | 54 |
41901047319 | def wypelnianieListy(a,n):
i=0
while i<n:
a.append(float(input("Podaj: ")))
i=i+1
def check(a,n,punkt):
result=True
i=0
while i<n-1:
if(a[i]>=a[i+1]):
result=False
i=i+1
if(punkt<a[0] or punkt>a[n-1]):
result=False
return result
def lagrang... | Hubi0295/AlgorytmyAnalizyNumerycznej | LagrangeInterpolation.py | LagrangeInterpolation.py | py | 973 | python | pl | code | 0 | github-code | 54 |
22987467304 | # helper function for thinking of the matrix as one long array
def linear_index_to_matrix_index(array_index, columns) -> (int, int):
row_index = array_index // columns
column_index = array_index % columns
return (row_index, column_index)
# do normal binary search, but use the linear_index_to_matrix_index()... | dp-mason/leetcodepractice | python/matrix_binary_search.py | matrix_binary_search.py | py | 1,330 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.