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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38695485940 | import json
from kafka import KafkaConsumer
consumer = KafkaConsumer('orders',
group_id="console",
bootstrap_servers='localhost:9092')
tower_host = "http://localhost"
tower_user = "admin"
tower_token = "Mu21PadLaHLU3fUmh4IbM4vabs5bqx"
print("Console - Consumer now l... | dovastbe/kafka_poc | console_update_order.py | console_update_order.py | py | 846 | python | en | code | 0 | github-code | 13 |
72255300499 | import torch
import torch.nn.functional as F
from pytorch_lightning import LightningModule
from torchmetrics.classification.accuracy import Accuracy
from typing import Any
import torch.nn as nn
from src.models.modules.tcn import MS_TCN2
class MSTCNLitModel(LightningModule):
def __init__(self, num_layers_PG, num... | Jaakik/hydra-ml | src/models/ms_tcn.py | ms_tcn.py | py | 2,428 | python | en | code | 0 | github-code | 13 |
24342496083 | class Solution:
def characterReplacement(self, s: str, k: int) -> int:
# 滑动窗口+双指针
n = len(s)
if n < 2:
return n
left = right = res = maxCount = 0
freq = [0] * 26
while right < n:
freq[ord(s[right])-65] += 1
maxCount = max(maxCount, ... | yuhangzheng/leetcode | 双指针法-70/同向双指针、滑动窗口-34/592.py | 592.py | py | 554 | python | en | code | 0 | github-code | 13 |
29141149423 | import json
import os
import re
import subprocess
import sys
import tabulate
from .module_manager import ModuleManager
from .utils.exp_util import get_relative_imports
from .utils.git_util import parse_url_from_git
from .sources.remote import RemoteDataSource
from .sources.local.local import LocalDataSource
from pipr... | ilex-paraguariensis/yerbamate | packages/yerbamate/api/data/module_repository.py | module_repository.py | py | 18,207 | python | en | code | 10 | github-code | 13 |
34030471989 | # Filename: q08_top2_scores.py
# Author: Justin Leow
# Created: 29/1/2013
# Modified: 29/1/2013
# Description: prompts the user to enter the number of students and each student's name and score,
# and finally displays the student with the highest score and the student with the second-highest score.
#input... | JLtheking/cpy5python | practical02/q08_top2_scores.py | q08_top2_scores.py | py | 2,574 | python | en | code | 0 | github-code | 13 |
9543288927 | # Uses model to predict bbox from image
from src.EldenRing.boss_detection.inference import BossDetectionReturn
# Get resized image dimensions for scaling purposes in the display
from src.EldenRing.boss_detection.config import RESIZE_WIDTH, RESIZE_HEIGHT
# Get path to images for testing purposes
from src.EldenRing.boss_... | akingsley319/AI_Plays_DarkSouls | tests/EldenRing/boss_detection/boss_detection.py | boss_detection.py | py | 5,092 | python | en | code | 1 | github-code | 13 |
36470667831 | import re
import preprocessor as p
import re
from spacy.lang.en import English
from spacy.lang.en.stop_words import STOP_WORDS
def remove_stopword(text):
# Load English tokenizer, tagger, parser, NER and word vectors
nlp = English()
my_doc = nlp(text)
token_list = []
for token in my_doc:
token_l... | meimei96tq/Social-Rainbow | get_clean_tweet.py | get_clean_tweet.py | py | 2,472 | python | en | code | 0 | github-code | 13 |
8614117093 | from flask import Flask, request, jsonify, send_from_directory
from flask_cors import CORS
import openai
import os
from OpenSSL import SSL
from flask_limiter import Limiter
app = Flask(__name__, static_url_path="", static_folder="/srv/http/jb-gpt")
# Initialize the Limiter
""" limiter = Limiter(
app,
key_func... | jbfly/jb-gpt | app.py | app.py | py | 1,315 | python | en | code | 0 | github-code | 13 |
327179541 | import pybio
import os
import sys
class Gff3():
def __init__(self, filename):
fasta_part = 0
mRNA_part = 0
f = open(filename, "rt")
r = f.readline()
self.genes = {}
self.mRNA_genes = {}
l = 1
while r:
if r.startswith("##FASTA") or fasta_p... | grexor/pybio | pybio/data/Gff3.py | Gff3.py | py | 3,238 | python | en | code | 7 | github-code | 13 |
39762124742 | import _thread
import os
import time
from datetime import datetime
from queue import Queue
from shutil import rmtree
from typing import Dict, List
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from .. import logger
from ..authentication.auth import Auth
from ..user_config ... | ecmwf/aviso | pyaviso/engine/file_based_engine.py | file_based_engine.py | py | 9,784 | python | en | code | 9 | github-code | 13 |
13999669250 | import cv2
from random import randrange
# This loads some pre-trained data on face frontal from opencv
trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_defalut.xml')
# To capture video from webcam.
webcam = cv2.VideoCapture(0)
# Iterate over frames
while True:
# read the current frame
succe... | jspark3/Face-Detection | Active_Face_Detector.py | Active_Face_Detector.py | py | 855 | python | en | code | 1 | github-code | 13 |
9145903197 | import os
import random
import pandas as pd
import numpy as np
from enum import IntEnum
from scipy import stats
class Specialties(IntEnum):
SECURITY = 0
BACKEND = 1
FRONTEND = 2
GRAPHICS = 3
LOWLEVEL = 4
ML = 5
def getEnrollmentProbabilities():
f18 = getEnrollments(os.path.join(os.path.d... | Morgan-Swanson/StudentGenerator | backend/student/generateSchedule.py | generateSchedule.py | py | 6,705 | python | en | code | 0 | github-code | 13 |
41267053506 | # Structure as presented in CTCI
# 12 Oct 2020
# Revisited 27 Dec 2020
# Linked-List Structure
# - access to linked list via reference to the head node
class Node:
def __init__(self, data=None):
self.next = None
self.data = data
def append_to_tail(self, data):
end = Node(data)
... | pforderique/Python-Scripts | Coding_Practice/Data-Structures/linked-lists/CTCI_struct.py | CTCI_struct.py | py | 1,636 | python | en | code | 1 | github-code | 13 |
41214633381 | student_db = [
{'surname': 'Ivanov', 'name': 'Ivan', 'gender': 'male', 'age': '21'},
{'surname': 'Petrov', 'name': 'Ivan', 'gender': 'male', 'age': '31'},
{'surname': 'Sidorov', 'name': 'Pavel', 'gender': 'male', 'age': '25'},
{'surname': 'Prokova', 'name': 'Alyona', 'gender': 'female', 'age': '21'},
... | sudoom/Python_study | IT-Academy/Lesson 5/5.3.py | 5.3.py | py | 1,088 | python | en | code | 0 | github-code | 13 |
1626597497 |
import torch
import torch.nn as nn
import torch.nn.functional as F
def get_sbm_gated_gcn_dgl_encoder(params):
return GatedGcnDglEncoder(net_params=params)
class GatedGcnDglEncoder(nn.Module):
"""Residual GatedGCN encoder
Adapted from https://github.com/graphdeeplearning/benchmarking-gnns
ResGatedG... | aripakman/amortized_community_detection | acp/encoders/sbm_gatedgcn_dgl_encoder.py | sbm_gatedgcn_dgl_encoder.py | py | 4,342 | python | en | code | 8 | github-code | 13 |
3209576326 | import ee
# import geopandas as gpd
# QGIS plug-in for GEE
from ee_plugin import Map
# import the region outline
# region_outline = gpd.read_file('/Users/siyuyang/Source/temp_data/WCS_land_use/outline/Orinoquia_outline.shp')
# region_outline_coords = list(region_outline.geometry[0].exterior.coords) # geometry object... | microsoft/landcover-orinoquia | data/gee_sentinel_query.py | gee_sentinel_query.py | py | 1,687 | python | en | code | 26 | github-code | 13 |
39565658009 | from typing import Tuple, List
from scipy.spatial.distance import pdist, cdist, squareform
from scipy.spatial import cKDTree
from scipy import sparse
import numpy as np
import multiprocessing as mp
def _sparse_dok_get(m, fill_value=np.NaN):
"""Like m.toarray(), but setting empty values to `fill_value`, by
de... | mmaelicke/scikit-gstat | skgstat/MetricSpace.py | MetricSpace.py | py | 28,273 | python | en | code | 201 | github-code | 13 |
25650519241 | def load_input() -> str:
with open(0) as src_file:
return src_file.read().strip()
def solve(signal: str, dist: int) -> int:
marker = list(signal[:dist])
for idx in range(dist, len(signal)):
if len(set(marker)) == dist:
return idx
marker = marker[1:]
marker.appen... | MrRys/AoC-2022 | d6/d6.py | d6.py | py | 462 | python | en | code | 0 | github-code | 13 |
13247397496 | import random
def choose_numbers():
""" function takes numbers from the player and creates a sorted list"""
list_of_user_numbers = []
for i in range(6):
try:
a = int(input("Choose number: "))
if a in range(1, 50):
list_of_user_numbers.append(a)
... | agnieszka2201pn/lotto | app.py | app.py | py | 1,214 | python | en | code | 0 | github-code | 13 |
9474110282 | # File: test_linkedlist.py
# Author: Chad Palmer
# Date: May 2020
# Description:
# This file tests the LinkedList class with Test Driven Development
# in mind. Linked lists are retrieved as a python list for easy
# value comparisions. The __str__ dunder method in the Node class
# makes it poss... | cpalmer-atx/python-data-structures | test_linkedlist.py | test_linkedlist.py | py | 1,667 | python | en | code | 0 | github-code | 13 |
22268909587 | import os
import cv2
from camera_generator import BaseCamera
class Camera(BaseCamera):
video_source = 0
stream = """
nvarguscamerasrc !
video/x-raw(memory:NVMM), width=(int)640, height=(int)640, framerate=(fraction)60/1 !
nvvidconv flip-method=0 !
video/x-raw, width=(int)640,... | alicamdal/yolov5_object_detection | camera_opencv.py | camera_opencv.py | py | 1,059 | python | en | code | 1 | github-code | 13 |
37192055889 | import json
from dataclasses import dataclass
from enum import Enum
import pyrebase
from pyrebase.pyrebase import Auth, Database
@dataclass
class UserAuth:
uuid: str
token: str
refresh_token: str
def __init__(self, user_auth: dict):
self.uuid = user_auth["localId"]
self.token = user_... | nieomylnieja/dogOut | app/datasource.py | datasource.py | py | 3,194 | python | en | code | 0 | github-code | 13 |
39243221049 | # -*- coding: utf-8 -*-
class Solution:
# 这里要特别注意~找到任意重复的一个值并赋值到duplication[0]
# 函数返回True/False
def duplicate(self, numbers, duplication):
# write code here
lst=[]
for i in numbers:
if i in lst:
duplication[0]=i
return True
... | RellRex/Sword-for-offer-with-python-2.7 | test50_重复数组中的数字.py | test50_重复数组中的数字.py | py | 516 | python | en | code | 2 | github-code | 13 |
35726221095 |
# %%
import pandas as pd
from pathlib import Path
from anytree import Node, RenderTree
import anytree
import itertools
# %%
df = pd.read_excel(
Path("C:/Code/bio-economy-cluster/backend/database/excel/Search_scheme/branchen_scheme.xlsx")
)
# %%
def create_root_node(name: str) -> anytree.Node:
return Node(... | w0L-g0R/bio-cluster | backend/bio_cluster/src/data/DEVELOPMENT/create_radial_tree_datastructure_v1.py | create_radial_tree_datastructure_v1.py | py | 4,569 | python | en | code | 0 | github-code | 13 |
16511497104 | import os
import sys
from pathlib import Path
from typing import Optional
from typing import Text
import toml
version_file_path = Path("questionary/version.py")
pyproject_file_path = Path("pyproject.toml")
def get_pyproject_version():
"""Return the project version specified in the poetry build configuration.""... | tmbo/questionary | scripts/validate_version.py | validate_version.py | py | 1,979 | python | en | code | 1,270 | github-code | 13 |
17124400151 | import os
import sys
import datetime
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
from time import time
from numba import jit
@jit(nopython=True)
def DVTH(Fai, Theta):
dvth = 0
for i in range(n):
for j in range(n):
hs = np.sqrt(s[i, j] * s[i, j] ... | Zsstarry/EM_Clocks | Coupled4_2L_13_24_MC_And_Poincare.py | Coupled4_2L_13_24_MC_And_Poincare.py | py | 11,232 | python | en | code | 0 | github-code | 13 |
42300344180 | colour = ["blue","pink","red","orange","yellow",17]
#print(colour)
#print(colour[0])
#print(colour[1])
#print(colour[2])
#print(colour[3])
#print(colour[4])
#print(colour[5])
numbers = [2,7,15,3,10]
#numbers.sort() # sorts the list
#numbers.reverse() # reverses the order of the list
#print(numbers)
#prin... | ItsVishesh/PYTHON-PROJECTS | LIST.py | LIST.py | py | 2,658 | python | en | code | 0 | github-code | 13 |
72915375698 | import dataclasses
import traceback
from typing import Any, Callable, Iterable, List, Union, Optional
from qutebrowser.qt.core import pyqtSignal, pyqtBoundSignal, QObject
from qutebrowser.utils import usertypes, log
@dataclasses.dataclass
class MessageInfo:
"""Information associated with a message to be displa... | qutebrowser/qutebrowser | qutebrowser/utils/message.py | message.py | py | 8,783 | python | en | code | 9,084 | github-code | 13 |
71216344017 | import os
from skimage.transform import resize
from tensorflow.compat.v1.keras.models import load_model
import numpy as np
#Loading pretrained Tensorflow model
model = load_model('models/2nd_model.h5')
def prediction(image, filename):
# Image is being resized to 32*32 pixels (the third argument/dimension number ... | roxxuz/blue-ml-predict | prediction.py | prediction.py | py | 1,690 | python | en | code | 0 | github-code | 13 |
71899421138 | from ..core.abstractcontroller import AbstractBaseController
from ..resources.strings import strings, prompts, flag_text
from ..core import fileoperations, io
from ..lib import utils
from ..objects.exceptions import NoKeypairError, InvalidOptionsError
from ..operations import commonops, sshops
class SSHController(Abs... | ianblenke/awsebcli | ebcli/controllers/ssh.py | ssh.py | py | 3,451 | python | en | code | 3 | github-code | 13 |
18387968661 | from pylab import plot,show
from numpy import vstack,array
from numpy.random import rand
from scipy.cluster.vq import kmeans,vq
import csv
# data generation
#data = vstack((rand(150,2) + array([.5,.5]),rand(150,2)))
filename = 'C:/Users/Corey/Desktop/CSCI/Senior Project/samples/sample2.txt'
data = csv.reader(open(fi... | ctyrrell1/Senior_Project | kmeans2_usingfile.py | kmeans2_usingfile.py | py | 1,456 | python | en | code | 0 | github-code | 13 |
14202129518 | #! /usr/bin/env python3
import cgi
import csv
import sqlite3
import pprint
# FieldStorageクラスのインスタンス化で、フォームの内容を取得
form = cgi.FieldStorage()
title_str = form["query"].value
db_path = "bookdb.db" # データベースファイル名を指定
con = sqlite3.connect(db_path) # データベースに接続
cur = con.cursor() # カーソルを取得
# テーブルの定義
#cur.execute("""creat... | h-jono/android_book_database-training | cgi-bin/booksearch_json.py | booksearch_json.py | py | 1,614 | python | ja | code | 0 | github-code | 13 |
7416052965 | from flask import Flask, jsonify, request
import Xlib.threaded
from flask_socketio import SocketIO, send, emit, disconnect
from flask_cors import CORS
from model import Users
from secrets import token_hex
from uuid import uuid4
from engineio.payload import Payload
app = Flask(__name__)
app.config['SECRET_KEY'] = uuid... | MrJaysa/python-rdp | Server_Main/app.py | app.py | py | 2,813 | python | en | code | 2 | github-code | 13 |
8562391084 | #!/usr/bin/env python3
import argparse
import glob
import os
import subprocess
from pathlib import Path
from zipfile import ZipFile
def parse_arguments():
parser = argparse.ArgumentParser(
description="Tool for garbling PII for PPRL purposes in the CODI project"
)
parser.add_argument(
"--... | mitre/data-owner-tools | block.py | block.py | py | 1,743 | python | en | code | 5 | github-code | 13 |
21565547304 | import warnings
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.manifold import TSNE
warnings.filterwarnings("ignore")
def print_init_stats(name, df):
"""
Print stats about dataset
"""
print("\t\t- Shape of '", name, "':", df.shape)
has_nan_values = df.isnull().values.any()
... | Xiryl/ML-HAR-Project | src/utils/PrintUtils.py | PrintUtils.py | py | 1,736 | python | en | code | 0 | github-code | 13 |
29660281766 |
FOURSQUARE_PLACES_V3_MOCK_200 = {
"results":[
{
"fsq_id":"53146e95498e242a07e892b4",
"categories":[
{
"id":13027,
"name":"Bistro",
"icon":{
"prefix":"https://ss3.4sqi.net/img/categories_v2/food/default_",
... | junior92jr/location-advisor-backend | recommendations/mocks/foursquare_places_v3_mock.py | foursquare_places_v3_mock.py | py | 15,211 | python | en | code | 0 | github-code | 13 |
10290065291 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render,redirect
from django.views.generic import TemplateView
from django.contrib import messages
from django.http import HttpResponse
from django.db.models import Q
from ..forms import *
import json
from django.core.seriali... | corporacionrst/software_RST | app/productos/inventario/compras/views.py | views.py | py | 5,385 | python | es | code | 0 | github-code | 13 |
7960406739 | from django.shortcuts import render
from .models import CricketTeamModel
from django.views.generic import View
from django.http import HttpResponse
# Create your views here.
from django.core.serializers import serialize
import json
from .mixins import SerializeMixin,HttpResponseMixin
class CricketTeamsView(View):
... | shashank14/project-rep | cricket/views.py | views.py | py | 3,086 | python | en | code | 0 | github-code | 13 |
12332157078 | import json
from channels.generic.websocket import WebsocketConsumer
from channels.generic.websocket import AsyncWebsocketConsumer
from asgiref.sync import sync_to_async,async_to_sync
from base.models import Room,Message
from django.contrib.auth.models import User
class ChatConsumer(WebsocketConsumer):
def connect(... | gopalareddy329/Notify | sockets/client.py | client.py | py | 2,162 | python | en | code | 0 | github-code | 13 |
72190591377 | from PvsRMeasurement import RecSystem
from math import sqrt
class RecommendationSystem(RecSystem):
def __init__(self, trainSet):
self.trainSet = trainSet
self.users = set()
self.movies = set()
self.votes = {}
self.inputDataProcessed = False
def processInputArray(self)... | Akus93/systemy_rekomendacyjne | recommendation_system.py | recommendation_system.py | py | 5,180 | python | en | code | 0 | github-code | 13 |
4087250591 | import keras
from keras.datasets import cifar10
from keras.layers import Activation, Conv2D, Dense, Dropout, Flatten, MaxPooling2D
from keras.models import Sequential, load_model
from keras.utils.np_utils import to_categorical
import numpy as np
import matplotlib.pyplot as plt
# データのロード
(X_train, y_train), (X_test, y_... | yasuno0327/LearnCNN | aidemy/cnn/task5.py | task5.py | py | 2,418 | python | ja | code | 1 | github-code | 13 |
38462190419 | """ Test the DFT example *examples/DFT and iDFT with PyDynamic...ipynb*."""
import numpy as np
from matplotlib.pyplot import (
errorbar,
figure,
plot,
subplot,
subplots_adjust,
xlabel,
xlim,
xticks,
ylabel,
)
from numpy import fft, random, sqrt
from numpy.ma import arange, sin
from ... | Met4FoF/Code | PyDynamic/test/test_execution_of_dft_notebook_example.py | test_execution_of_dft_notebook_example.py | py | 1,421 | python | en | code | 0 | github-code | 13 |
41847283723 | '''
Naive Solution O(N): going thru the whole array to check for duplicates
'''
class Solution(object):
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
tracker = set()
for i in nums:
if i not in tracker:
tracke... | gabeyong4/Gabe-LeetCode | contains-duplicate/contains-duplicate.py | contains-duplicate.py | py | 396 | python | en | code | 0 | github-code | 13 |
33997215333 | from typing import List
import numpy as np
class TPTZController:
def __init__(self, tptz_buffer):
self.buffer = tptz_buffer
self.x = np.zeros(2, dtype=np.float64)
self.y = np.zeros(2, dtype=np.float64)
self.x[0] = 0
self.x[1] = 0
self.y[0] = 0
self.y[1] = 0... | SummersEdge23/mnapy | TPTZController.py | TPTZController.py | py | 1,463 | python | en | code | 0 | github-code | 13 |
41407490142 | import view
import model_menu
from tkinter import *
from tkinter import ttk
def click_button_count_days():
print()
def click_button_calculate():
print()
def start():
# view.create_menu()
# select()
root = Tk()
frm = ttk.Frame(root, padding=30)
frm.grid()
ttk.Label(frm, text='Кальку... | dvoroshin/python_edu | seminar_7/controller.py | controller.py | py | 874 | python | ru | code | 0 | github-code | 13 |
10399470088 | import logging
import logging.handlers
from pathlib import Path
def set_logging():
''' Sets logging module settings.
Run function at beginning of main function for uniform logging formatting.
'''
logging.basicConfig(filename='/dev/null', level=logging.DEBUG)
log_formatter = logging.Formatter(fmt='%(asctime... | Urban-Garden/dynamo-db-adapter | ez_logging/ez_logging.py | ez_logging.py | py | 880 | python | en | code | 0 | github-code | 13 |
12757421973 | # --------------
# Data loading and splitting
#The first step - you know the drill by now - load the dataset and see how it looks like. Additionally, split it into train and test set.
# import the libraries
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_s... | Niteshnupur/nlp-dl-prework | Nitesh-Bhosle-:---Insurance-claim-prediction/code.py | code.py | py | 6,133 | python | en | code | 0 | github-code | 13 |
4833437869 | import NlpUtils
import jsondiff
import collections
if NlpUtils.g_EnableDebugging:
g_SupportedEncoding = {
'template': ('English', ('windows-1252', ), )
}
else:
g_SupportedEncoding = {
'zh-cn': ('Chinese', ('utf-8', 'gb2312', ), )
}
VtTrDataTuple = collections.namedtuple('VtTrDataTuple'... | yyc12345/VirtoolsTranslation | NlpProc/NlpJsonEncoder.py | NlpJsonEncoder.py | py | 4,456 | python | en | code | 2 | github-code | 13 |
32067638085 | """
Tool for PySimpleGUI
Author - Jason Yang
Date - 2020/05/12
Version - 0.0.3
History
- 2020/05/08
- New Tree class for more methods and functions, but with only name and
one text value for each node.
- 2020/05/10
- New Button class for stadium shape background
- 2020/05/11
- Revised for ... | jason990420/jason990420-outlook.com | PySimpleGUI_Tool.py | PySimpleGUI_Tool.py | py | 22,159 | python | en | code | 2 | github-code | 13 |
5947845688 | # -*- coding: utf-8 -*-
""" KnobScripter Prefs: Preferences widget (PrefsWidget) and utility function to load all preferences.
The load_prefs function will load all preferences relative to the KnobScripter, both stored
as variables in the config.py module and saved in the KS preferences json file.
adrianpueyo.com
""... | adrianpueyo/KnobScripter | KnobScripter/prefs.py | prefs.py | py | 20,250 | python | en | code | 65 | github-code | 13 |
31037486532 | import tkinter as tk
def add_phonenumber_func():
name = entry_name.get()
phonenumber = entry_phonenumber.get()
# lbl_msg_out.config(text='Bạn vừa thêm vào danh bạ:\n'+name+'-'+phonenumber)
btn_2.config(text=name)
# name = entry_name.get()
# phonenumber = entry_phonenumber.get()
... | nhatelecom/practice_python | 28-06 thuc hanh tkinter.py | 28-06 thuc hanh tkinter.py | py | 2,012 | python | en | code | 0 | github-code | 13 |
41658585696 | import pandas as pd
import yfinance as yf
def fetch_data(ticker_symbol, timeframe='1y'):
"""
Fetches data for the given ticker_symbol and timeframe.
Args:
- ticker_symbol (str): The stock ticker symbol.
- timeframe (str): The timeframe for which data is to be fetched. Default is '1y' (1 year).... | ttbontra/Stock_Analysis | get_data.py | get_data.py | py | 803 | python | en | code | 0 | github-code | 13 |
73493760656 | # built-in packages
import math
from typing import List, Any
# third-party packages
import numpy as np
# customized packages
from config import ROUND_PRECISION
from ma_trader import MATrader
from util import timer
class TraderDriver:
'''A wrapper class on top of any of trader classes.'''
def __init__(sel... | luckylulin-aaron/crypto-prediction | app/trader_driver.py | trader_driver.py | py | 4,948 | python | en | code | 1 | github-code | 13 |
17048789824 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.FenceDto import FenceDto
class Area(object):
def __init__(self):
self._fences = None
@property
def fences(self):
return self._fences
@fences.set... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/Area.py | Area.py | py | 1,374 | python | en | code | 241 | github-code | 13 |
30437479151 | from flask import Flask, request
import os
app = Flask(__name__)
import ConfigParser
import smtplib, string
config = ConfigParser.ConfigParser()
cur_dir = os.path.dirname(os.path.abspath(__file__))
config.readfp(open(cur_dir + "/myconfig.ini","rb"))
def get_last_ip():
return config.get("global","lastip")
def sa... | cdyfng/pytools | dynamicIp.py | dynamicIp.py | py | 1,051 | python | en | code | 1 | github-code | 13 |
24248485966 | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'tango_with_django_project.settings')
import django
django.setup()
from rango.models import Category, Page
def populate():
# Create data to be populated in DB
python_pages = [
{'title': 'Official Python Tutorial',
... | lloyd9/TangoWithDjango2-Materialize | TangoWithDjango/populate_rango.py | populate_rango.py | py | 4,083 | python | en | code | 0 | github-code | 13 |
40380730592 | from gensim import corpora, models, similarities, utils
import jieba
import heapq
import numpy as np
def get_sim_top10(new_doc):
try:
documents = np.load('Saier/document.npy').tolist()
print(documents)
except Exception as e:
print(e)
dictionary = corpora.Dictionary.load('Saier/dict... | twobagoforange/saier_system | background/sim_new.py | sim_new.py | py | 977 | python | en | code | 0 | github-code | 13 |
28444931591 | import traceback
from typing import Optional, Tuple, Dict, Type, Any
from pathlib import Path
from ..runtime_env import RuntimeEnv
from ..utils import check_output
from ..patcher import ExpAprPatcher, FallbackPatcher
from ..servant_connector import ServantConnector
class Technique:
def __init__(self, env: Runtime... | ExpressAPR/ExpressAPR | cli/proc_run/techniques.py | techniques.py | py | 2,845 | python | en | code | 3 | github-code | 13 |
3455227126 | import os
import sys
import time
import json
import docker
import boto3
import itertools
import botocore.exceptions
from random import random
docker_client = docker.from_env()
#TODO - use DynamoDB
class S3Discovery:
def __init__(self, bucket, swarm_name):
self.client = boto3.client('s3')
self.buck... | mlabouardy/pipeline-as-code-with-jenkins | chapter10/discovery/main.py | main.py | py | 4,825 | python | en | code | 123 | github-code | 13 |
24686635858 | from modulo import *
from pilha_encadeada import*
class Fila:
def __init__(self):
self.__ini = None
self.__fim = None
def getIni(self):
return self.__ini
def getFim(self):
return self.__fim
def setIni(self, elem):
self.__ini = elem
def setFim(... | MysticOwl/Furg | Estrutura de dados/[TAREFA] - Fila/fila_encadeada.py | fila_encadeada.py | py | 2,531 | python | pt | code | 0 | github-code | 13 |
3557778081 | from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service('C:/Drivers/chromedriver_win32/chromedriver.exe')
browser = webdriver.Chrome(service=s)
url = 'https://demo.guru99.com/test/newtours/'
browser.get(url)
print(browser.current_url)
print(browser.title)
browser.c... | argha-sarkar/SeleniumPython | Day1/browser1.py | browser1.py | py | 326 | python | en | code | 0 | github-code | 13 |
41639852345 | import discord
import logging
import os
import requests
import shutil
import time
from yt_dlp import YoutubeDL, utils
from sclib import SoundcloudAPI, Track
MUSIC_DIRNAME = "music"
MAX_ATTEMPTS = 11
YTDL_OPTS = {
"format": "bestaudio",
"paths": {"home": "./{}/".format(MUSIC_DIRNAME)},
'noplaylist': True
}
FFMP... | stephenjusto247/WeebsRUs | lib/utils.py | utils.py | py | 1,980 | python | en | code | 2 | github-code | 13 |
10191336911 | import subprocess
import click
from devine.core.config import config
from devine.core.constants import context_settings
from devine.core.utilities import get_binary_path
@click.command(
short_help="Serve your Local Widevine Devices for Remote Access.",
context_settings=context_settings)
@click.option("-h", ... | devine-dl/devine | devine/commands/serve.py | serve.py | py | 1,743 | python | en | code | 198 | github-code | 13 |
73646510417 | class Solution:
# @param {integer[]} nums
# @return {integer}
def majorityElement(self, nums):
el_dict = dict()
for n in nums:
length = len(nums)
if n not in el_dict:
el_dict[n] = 1
else:
el_dict[n] += 1
if el_di... | JirenJin/leetcode-problems | python/majority_element.py | majority_element.py | py | 363 | python | en | code | 0 | github-code | 13 |
29779182539 | """Iowa scraper
"""
import asyncio
import json
import logging
import os
import re
import shutil
from typing import Dict, List
import usaddress
from bs4 import BeautifulSoup, Tag
from msedge.selenium_tools import Edge, EdgeOptions
from lib.ElectionSaver import electionsaver
from lib.definitions import ROOT_DIR, WTVWeb... | Acesonnall/WalkTheVote | lib/scrapers/massachusetts/massachusetts_scraper.py | massachusetts_scraper.py | py | 8,497 | python | en | code | 0 | github-code | 13 |
72915320018 | import re
import html
from qutebrowser.qt.widgets import QStyle, QStyleOptionViewItem, QStyledItemDelegate
from qutebrowser.qt.core import QRectF, QRegularExpression, QSize, Qt
from qutebrowser.qt.gui import (QIcon, QPalette, QTextDocument, QTextOption,
QAbstractTextDocumentLayout, QSyntaxHigh... | qutebrowser/qutebrowser | qutebrowser/completion/completiondelegate.py | completiondelegate.py | py | 11,855 | python | en | code | 9,084 | github-code | 13 |
25059074510 | import requests
from twilio.rest import Client
import os
OWM_Endpoint = "https://api.openweathermap.org/data/3.0/onecall"
api_key = os.getenv("owm_api_key")
account_sid = os.getenv("twillio_sid")
auth_token = os.getenv("twillio_auth_token")
twillio_verified_no = os.getenv("twillio_verified_no")
twillio_virtua... | Dhyan-P-Shetty/Rain_Alert | main.py | main.py | py | 1,220 | python | en | code | 0 | github-code | 13 |
1416174846 | import sys
if len(sys.argv) <= 1:
raise Exception("No inputs")
with open(sys.argv[1], 'r') as f:
lines = f.readlines()
def parse_food(l):
ingredients, allergens = l.rstrip()[:-1].split(" (contains ")
i = ingredients.split(" ")
a = allergens.split(", ")
return (i, a)
def parse_foods(ll):
... | asek-ll/aoc2020 | day21/main.py | main.py | py | 1,940 | python | en | code | 0 | github-code | 13 |
14092864301 | import random
import discord
from discord.ext import commands
from command.cache.list_color import list_color
class Pick(commands.Cog):
config = {
"name": "pick",
"desc": "bot se chon 1 trong 2 cai ma ban dua",
"use": "pick <luachon1>, <luachon2>,...",
"author": "Anh Duc(aki team)"
... | iotran207/Aki-bot | command/pick.py | pick.py | py | 757 | python | en | code | 4 | github-code | 13 |
35013005252 |
def swap_case(s):
result = ''
for c in s:
result += c.lower() if c.isupper() else c.upper()
return result
if __name__ == '__main__':
s = input()
result = swap_case(s)
print(result) | Crisheld/HackerRank-solutions | python/swap-case/solution.py | solution.py | py | 219 | python | en | code | 1 | github-code | 13 |
39032548326 | from django.shortcuts import render,redirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from blog.models import Post
from django.contrib.auth.models import User
from .forms import UserRegistrationForm,UserUpdateF... | harshsanjiv/b.log-in | users/views.py | views.py | py | 1,484 | python | en | code | 0 | github-code | 13 |
34347504442 | # imports & connection
import sys
import mysql.connector
import time
connection = mysql.connector.connect(user ='root', database = 'example', password = '12345')
connection.autocommit = True
# starting variables
balance = 0
menu_choice = 0
name = None
pin_num = 0
birth_day = 0
withdraw_amount = None
deposit_amount = ... | dt604121/Bank | main.py | main.py | py | 10,592 | python | en | code | 0 | github-code | 13 |
2030008633 | class Student:
def __init__(self,name,student_id):
self.name=name
self.student_id=student_id
self.grades={"语文":0,"数学":0,"英语":0}
def setting_grade(self,course,grade):
if course in self.grades:
self.grades[course]=grade
def print_grades(self):
print(f"学生{s... | OpenAI01/AI- | 对象实战.py | 对象实战.py | py | 712 | python | en | code | 1 | github-code | 13 |
4927020281 | '''
Created on Oct 12, 2019
@author: mvelasco
'''
from optimalTransports import Empirical_Measure, dist
from gurobipy import *
import numpy as np
import pdb
class polytope:
"""
This class is a description of a polytope via inequalities.
It can compute the Chebyshev center of any such polytope
... | mauricio-velasco/min-cross-entropy | minimumCrossEntropy.py | minimumCrossEntropy.py | py | 14,661 | python | en | code | 0 | github-code | 13 |
21346747896 | from django.urls import path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
from .views import CustomerCreateView, ManagerCreateView, AdminCreateView
urlpatterns = [
path("customer/create/", CustomerCreateView.as_view(), name="customer-create"),
path("manager... | KatrinLazarenko/perfumes_shop | user/urls.py | urls.py | py | 709 | python | en | code | 0 | github-code | 13 |
43114289762 | tc = int(input())
for _ in range(tc):
queue = []
n, m = map(int, input().split())
tmp = list(map(int, input().split()))
for i in range(len(tmp)):
queue.append((tmp[i], i))
# print()
# print(queue)
# print()
count = 0
while queue:
curr = queue.pop(0)
if queue and curr[0] < max(queue)[... | jinhyungrhee/Problem-Solving | BOJ/BOJ_1966_프린터큐.py | BOJ_1966_프린터큐.py | py | 516 | python | ko | code | 0 | github-code | 13 |
23028455192 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 9 17:29:41 2018
@author: 天津拨云咨询服务有限公司 lilizong@gmail.com
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
image=cv2.imread("image\\girl.bmp",cv2.IMREAD_GRAYSCALE)
mask=np.zeros(image.shape,np.uint8)
mask[200:400,200:400]=255
histMI=cv2.calcHist([image],... | IBNBlank/toy_code | OpenCV-Repository-master/13.直方图/example/14.5掩膜直方图.py | 14.5掩膜直方图.py | py | 460 | python | en | code | 0 | github-code | 13 |
16179354735 | from __future__ import print_function
import os
import sys
import glob
import warnings
import functools
import operator
from argparse import ArgumentParser
import numpy as np
import mdtraj as md
from mdtraj.core.trajectory import _parse_topology
from mdtraj.utils import in_units_of
from mdtraj.utils.six import iterit... | mdtraj/mdtraj | mdtraj/scripts/mdconvert.py | mdconvert.py | py | 19,501 | python | en | code | 505 | github-code | 13 |
14552015123 | def lower_bound(arr, x):
left = -1
right = len(arr)
while left < right - 1:
mid = (right + left) // 2
if x <= arr[mid]:
right = mid
else:
left = mid
return right
_, _ = input().split()
inp_arr = list(map(int, input().split()))
values = list(map(int, inpu... | StepDan23/MADE_algorithms | hw_3/a.py | a.py | py | 662 | python | en | code | 0 | github-code | 13 |
5467678086 | from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
class RoomsPlugin(WillPlugin):
@respond_to(r"what are the rooms\?")
def list_rooms(self, message):
"""what are the rooms?: List all the rooms I know about.""... | skoczen/will | will/plugins/chat_room/rooms.py | rooms.py | py | 995 | python | en | code | 405 | github-code | 13 |
24420960592 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import (accuracy_score, precision_score, recall_score, f1_score,
roc_auc_score, classification_report, confusion_matrix)
from sklearn.model_selecti... | philippbeirith/JBG60-23 | scripts/evaluation_test.py | evaluation_test.py | py | 4,276 | python | en | code | 0 | github-code | 13 |
27836757566 | from scipy.io import arff
import numpy as np
import random as r
from time import time
import pandas as pd
from sklearn.neighbors import KDTree
from sklearn.preprocessing import MinMaxScaler
from sklearn.utils import shuffle
np.random.seed(0)
def loaddata(path):
f = path
data, meta = arff.loadarf... | penderana/Metaheuristicas | Practica 1/practica1.py | practica1.py | py | 10,243 | python | es | code | 0 | github-code | 13 |
3531146892 | import torch
import torch.nn.functional as f
import sys
import numpy as np
import math
import matplotlib.pyplot as plt
import core_math.transfom as trans
import cv2
import skimage.measure
from skimage.transform import resize
from skimage import img_as_bool
from banet_track.ba_optimizer import gauss_newtown_update, leve... | sfu-gruvi-3dv/sanet_relocal_demo | banet_track/ba_module.py | ba_module.py | py | 30,566 | python | en | code | 51 | github-code | 13 |
39610118330 | from flask import Flask, render_template
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
import time
import pandas as pd
app = Flask(__name__)
@app.route('/')
def get_dictionary():
origin = "KHI"
destination = "SYD"
startdate = '2023-05-01'... | Samreenhabib/WebScraping | ticket_price_tracker/flaskapi.py | flaskapi.py | py | 2,116 | python | en | code | 0 | github-code | 13 |
74564433618 | #!/usr/bin/env python
"""
_GetBulkRunLumi_
MySQL implementation of GetBulkRunLumi
"""
from WMCore.Database.DBFormatter import DBFormatter
class GetBulkRunLumi(DBFormatter):
"""
Note that this is ID based. I may have to change it back
to lfn based.
"""
sql = """SELECT flr.run AS run, flr.lumi A... | dmwm/WMCore | src/python/WMCore/WMBS/MySQL/Files/GetBulkRunLumi.py | GetBulkRunLumi.py | py | 1,301 | python | en | code | 44 | github-code | 13 |
72723052179 | from django.urls import path
from . import views
urlpatterns = [
path("", views.index),
path("skyrim/", views.skyrim),
path("doom/", views.doom),
path("fallout/", views.fallout),
path("prey/", views.prey),
path("quake/", views.quake),
]
| KonstantinLjapin/samples_and_tests | Skillbox/dpo_python_django/02_IntroductionToDjango/mysite/thrift_shop/urls.py | urls.py | py | 263 | python | en | code | 0 | github-code | 13 |
70139759378 | """This small module downloads and adjusts the OpenAPI spec of a given Argo Workflows version."""
import json
import logging
import sys
from typing import Dict, List, Set
import requests
logger: logging.Logger = logging.getLogger(__name__)
# get the OpenAPI spec URI from the command line, along with the output file... | argoproj-labs/hera | scripts/spec.py | spec.py | py | 2,655 | python | en | code | 375 | github-code | 13 |
654762176 | import unittest
import numpy as np
from core.semantic.polyconvex import Manager, Query
from core.semantic.sequential import Sequential
import time
class TestPartitionManager(unittest.TestCase):
def test_manager(self): # Test if Manager can be initiated
vector_space = [np.random.rand(512, 1) for _ in rang... | ShellRox/Lucifitas | core/semantic/tests/polyconvex.py | polyconvex.py | py | 3,127 | python | en | code | 1 | github-code | 13 |
40351181042 | #
# Sophia Wang
# December 10, 2019
# keypoints_parse_12-10-19b.py
#
import sys, os
import json
import math
body_angle_key = {0: (1, 0, 15), # -------
1: (1, 0, 16), # / \
2: (0, 1, 2), # | o o |
3: (1, 2, 3), # \ O /
4: (... | tjresearch/research-sophia_neha | anaylsis/archive/keypoints_parse_12-11-19.py | keypoints_parse_12-11-19.py | py | 8,455 | python | en | code | 0 | github-code | 13 |
15791542810 | def divisibleSumPairs(n, k, ar):
# Write your code here
a=ar
b=a
count=0
j=1
for i in range(len(a)):
for j in range(len(b)):
if( i<j):
d= a[i]+a[j]
if(d%k==0):
count+=1
return count
if __name__ == '__main__':
fptr... | Joshwa034/testrepo | divbyk.py | divbyk.py | py | 636 | python | en | code | 0 | github-code | 13 |
16948092367 | import os
import openpyxl
import datetime
#Excelファイルパス指定
book = openpyxl.load_workbook('dates.xlsx')
sheet = book.active
#日時取得
dt = datetime.datetime.now()
#配列
dta = [dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second]
#print(len(dta))
print(dta)
i = 1
while True:
if sheet.cell(row=i,column=1).value is ... | RRRCCCIII/systemtest | timecard.py | timecard.py | py | 500 | python | en | code | 0 | github-code | 13 |
73374141137 | import urllib.request
import time
def get_price():
page = urllib.request.urlopen("http://www.beans-r-us.biz/prices.html")
text = page.read().decode("utf8")
where = text.find('>$')
start_of_price = where + 2
end_of_price = start_of_price + 4
price = float(text[start_of_price:end_of_price])
pric... | amgauna/Python-2021 | price/price-beans2.py | price-beans2.py | py | 536 | python | en | code | 3 | github-code | 13 |
70136640018 | from peewee import *
from datetime import datetime
import csv
class BaseModel(Model):
class Meta:
database = None
class Device(BaseModel):
SMS = 1
VOICE = 2
CALL_FORWARD = 2
CALL_TYPES = (
(SMS, "SMS"),
(VOICE, "VOICE"),
(CALL_FORWARD, "CALL_FORWARD")
)
... | erfanfs10/Peewee-ORM-Postgresql | models.py | models.py | py | 3,779 | python | en | code | 2 | github-code | 13 |
27790107583 | #q4 Create a class MovieDetails and initialize it with Movie name, artistname,Year of release and ratings .
#Make methods to
#1. Display-Display the details.
#2. Update- Update the movie details.
class MovieDetails:
def __init__(self,movname,artname,year,rating):
self.movname=movname
self.artname=artname
self... | Gayatri-soni/python-training | assignment9/q4.py | q4.py | py | 954 | python | en | code | 0 | github-code | 13 |
27880690743 |
import grid as g
import cells as c
import numpy as np
def create_malha():
return
def create_city(cityname, Population, Area, Pop_ratio=1, Area_ratio=100):
# first create city_grid and city_cellsmatrix
grid = g.create_grid(Area, Area_ratio)
cellsmatrix = c.create_cellsmatrix(Population)
# random... | lcscosta/CellAutCovidRP | cellautcovidrp/cities.py | cities.py | py | 1,266 | python | en | code | 0 | github-code | 13 |
4296236885 | from django.contrib.auth.models import Group
from django.core.checks import messages
from django.shortcuts import redirect, render
from django.http import HttpResponse, JsonResponse
from core.models import *
from core.forms import *
from django.contrib import messages
from django.contrib.auth.decorators import login_re... | felipe-quirozlara/proyecto-grupo-Hellmanns | changeWear/pages/views.py | views.py | py | 6,787 | python | es | code | 0 | github-code | 13 |
24060035410 | import python as LibPKMN
#
# This test's LibPKMN's internal functionality for copying shared pointers,
# which comes into place in custom copy constructors and assignment operators.
#
if __name__ == "__main__":
t_pkmn = LibPKMN.team_pokemon("Darmanitan", "X", 70, "None", "None", "None", "None")
b_pkmn1 = t_p... | codemonkey85/LibPKMN | tests/python_copy_sptr_test.py | python_copy_sptr_test.py | py | 583 | python | en | code | 0 | github-code | 13 |
19038079706 | #------------------------------
#GICS sectors:
#GICS_10_Utilities: 5510
stages_ = {
"recovery": {
"GICS_3_Industrials": ["2010", "2020", "2030"],
"GICS_8_Information_Technology": ["4510", "4520", "4530"],
"GICS_9_Communication_Services": ["5010", "5020"],
"GICS_7_Financials": ["4010"... | ditariab/ditari_app | macro.py | macro.py | py | 2,453 | python | en | code | 0 | github-code | 13 |
17052975464 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InsCoverage(object):
def __init__(self):
self._coverage_name = None
self._coverage_no = None
self._effect_end_time = None
self._effect_start_time = None
se... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/InsCoverage.py | InsCoverage.py | py | 4,492 | python | en | code | 241 | github-code | 13 |
69960356819 | from flask import request, jsonify, Blueprint
from ..models.BookModel import BookModel, BookSchema
book_blueprint = Blueprint('books', __name__, url_prefix='/books')
book_schema = BookSchema()
@book_blueprint.route('/', methods=['GET', 'POST'])
def get_or_create_book():
if request.method == 'GET':
result... | dev-sajal/Library-Management-System-Flask | src/views/BookView.py | BookView.py | py | 1,577 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.