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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
32413683762 | from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import LogoutView
from django.shortcuts import redirect
from django.shortcuts import render
from django.urls imp... | ErnestoAquino/LITRevu | litrevu/users/views.py | views.py | py | 7,709 | python | en | code | 0 | github-code | 6 |
30754602045 | from collections import Counter
for _ in range(int(input())):
n = int(input())
if n < 3:
input()
print(-1)
else:
nb = list(map(int, input().split(' ')))
cnt = Counter(nb)
flag = True
for k, v in cnt.items():
if v >= 3:
print(k)... | Tanguyvans/Codeforces | 784/B.py | B.py | py | 412 | python | en | code | 0 | github-code | 6 |
4713040273 | import os
import re
import json
import numpy as np
from tqdm import tqdm_notebook
from collections import Counter
base_path = 'LongSumm-data/extractive_summaries/'
path_to_jsons = base_path + 'papers-jsons/'
p_jsons = os.listdir(path_to_jsons)
p_unread = []
section_1 = ['abstract']
section_2 = ['introduction', 'pr... | dchandak99/LongSumm | .ipynb_checkpoints/join_sections_manual-checkpoint.py | join_sections_manual-checkpoint.py | py | 3,727 | python | en | code | 1 | github-code | 6 |
6807988061 | import setuptools
import os
import codecs
from setuptools import setup
# https://packaging.python.org/guides/single-sourcing-package-version/
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_versi... | wesuuu/oo-tools | setup.py | setup.py | py | 1,004 | python | en | code | 0 | github-code | 6 |
35707696287 | import bcrypt
import time
from flask import Flask, jsonify, request
from flask import Flask, jsonify
from flask_cors import CORS
# * ============ (Core functions) ============ *#
from utils.save_results_in_db import save_results_in_db
from utils.scan_for_vulns import scan_for_vulns
from utils.data_adapter import da... | JorgeAVargasC/router-scan-backend | app.py | app.py | py | 6,478 | python | en | code | 0 | github-code | 6 |
19815525990 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index),
url(r'^regprocess$', views.user),
url(r'^jobs/new$', views.registration),
url(r'^loginprocess$', views.login_process),
url(r'^login$', views.login),
url(r'^logout$', views.logout),
... | aidapira/handyhelper | apps/job_manager_app/urls.py | urls.py | py | 724 | python | en | code | 0 | github-code | 6 |
74183020029 | # -*- coding: utf-8 -*-
from django.conf import urls
from django.contrib.auth import decorators
from .views import HistoriaCreateView
from .views import HistoriaDetailView
from .views import HistoriaPacienteListView
from .views import HistoriaUpdateView
HISTORIA_CREATE_URL_NAME = 'historia_create'
HISTORIA_UPDATE_URL... | gustavoatt/consultas | consultas_proyecto/historias_app/urls.py | urls.py | py | 1,138 | python | en | code | 0 | github-code | 6 |
1705824671 | import sys
import json
import h5py
import numpy as np
import matplotlib.pyplot as plt
import sys_id_utils
for i, data_file in enumerate(sys.argv[1:]):
data = h5py.File(data_file, 'r')
run_param = json.loads(data.attrs['jsonparam'])
print(run_param)
t = data['t'][()]
v_stimu = data['v_stimulus'][... | willdickson/imafly | python/imafly/examples/data_step_tmp/analyze_step_data.py | analyze_step_data.py | py | 2,044 | python | en | code | 0 | github-code | 6 |
36332873922 | import os
import time
import subprocess
LIB = 'neural_style.py'
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
LIB_PATH = os.path.join(DIR_PATH, 'lib/neural-style-tf-master/')
for content_img in os.listdir(os.path.join(LIB_PATH, 'image_input')):
print(f'--------------- {content_img} ---------------')
for... | alexhla/deep-learning-for-computer-vision | run_neural_style_tf.py | run_neural_style_tf.py | py | 948 | python | en | code | 0 | github-code | 6 |
1975281972 | import math
pi = math.acos (-1)
def main ():
t = int (input ())
for i in range (0, t):
inp = input ().split (' ')
ans = 0
ans += pi * (int (inp [0]) ** 2)
new = 4
for j in range (1, int (inp [1])):
ans += new * ((int (inp [0]) / (2 ** j)) ** 2) * pi
... | joaoandreotti/competitive_programming | maps19_kattis/f.py | f.py | py | 392 | python | en | code | 0 | github-code | 6 |
39688221214 | # Time: 4^gold + size(grid)
# Space: size(grid)
class Solution:
def getMaximumGold(self, grid: List[List[int]]) -> int:
max_gold = float('-inf')
for row in range(len(grid)):
for col in range(len(grid[0])):
if grid[row][col]:
seen = set()
... | cmattey/leetcode_problems | Python/lc_1219_path_with_maximum_gold.py | lc_1219_path_with_maximum_gold.py | py | 1,093 | python | en | code | 4 | github-code | 6 |
6880332813 | # -- Project information -----------------------------------------------------
project = "Test build"
copyright = "2018, Executable Books Project"
author = "Executable Books Project"
extensions = ["sphinx_comments", "myst_parser"]
comments_config = {
"hypothesis": True,
"utterances": {"repo": "executablebook... | yangxuan21/sphinx-comments | tests/config/conf.py | conf.py | py | 1,271 | python | en | code | null | github-code | 6 |
18972684429 | import pandas as pd
from dagster import asset, get_dagster_logger
from SSH_DEMO.resources import daily_partitions_def
# path for the directory as served from the SFTP server
GLOBAL_PREFIX = "upload"
DB_ZONE = "landing"
def _source_path_from_context(context):
return (
context.solid_def.output_defs[0]... | geoHeil/dagster-ssh-demo | SSH_DEMO/assets/ingest_assets.py | ingest_assets.py | py | 2,839 | python | en | code | 1 | github-code | 6 |
10854990799 | import numpy as np
import pytorch_lightning as pl
import torch
from torch.utils.data import Dataset, DataLoader
from utils import Language
SRC_LANG = Language('src')
TRG_LANG = Language('trg')
class SentenceDataset(Dataset):
"""
This class loads the desired data split for the Occupation Classification datas... | matprst/deceptive-attention-reproduced | deceptive-attention/src/seq2seq/lightning/data_utils.py | data_utils.py | py | 5,858 | python | en | code | 0 | github-code | 6 |
22050926816 | from flask import Flask, request, render_template, session, redirect, url_for, jsonify
from models.user import User
from models.rawpicture import Rawpicture
from models.savepicture import Savepicture
from models.comment import Comment
from random import choice
import mlab
import base64
import requests
mlab.con... | hoangcuong9x/test | app.py | app.py | py | 16,081 | python | vi | code | 0 | github-code | 6 |
72532274109 | from abc import ABC, abstractmethod
from models_library.api_schemas_directorv2.dynamic_services import (
DynamicServiceCreate,
RetrieveDataOutEnveloped,
RunningDynamicServiceDetails,
)
from models_library.basic_types import PortInt
from models_library.projects import ProjectID
from models_library.projects_... | ITISFoundation/osparc-simcore | services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_abc.py | _abc.py | py | 4,481 | python | en | code | 35 | github-code | 6 |
27998557212 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 2 14:50:05 2021
@author: mizo_
"""
import os
from PIL import Image
import numpy as np
import csv
from impreproc5 import processImg
# image =Image.open('test/test.png')
# z='test/resize/testresize.png'
# c=processImg(image,z)
c=0
directory = f't... | moataz-abbas/NeuralNetworks | createTestCSV.py | createTestCSV.py | py | 1,101 | python | en | code | 0 | github-code | 6 |
70829236348 | from aip import AipFace
""" 你的 APPID AK SK """
APP_ID = '10777848'
API_KEY = 'ifcHAWfOSsOQQTuhI1wbinyP'
SECRET_KEY = 'OCoPqGVZOMeVPlrEAkC15AdIZqXOsuYh'
client = AipFace(APP_ID, API_KEY, SECRET_KEY)
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
image = get_file_content(... | marcellinamichie291/Code_Store | baidu_api/face_demo.py | face_demo.py | py | 631 | python | en | code | 0 | github-code | 6 |
33078595311 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import time
from threading import Thread
import requests
class DownloadHandler(Thread):
def __init__(self, url):
super().__init__()
self.url = url
def run(self):
filename = self.url[self.url.rfind('/') + 1:]
resp = req... | letterli/py-cookbook | books/python-100-days/Day14/requests_demo.py | requests_demo.py | py | 733 | python | en | code | 0 | github-code | 6 |
1047110963 | from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from django import forms
class ticketChatForm(forms.Form):
def __init__(self, *args, **kwargs):
super(ticketChatForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
# self.helper.form_id = 'id-exa... | hewimetall/django_Help_Desk | label_ListPage/form.py | form.py | py | 931 | python | en | code | 0 | github-code | 6 |
2018421498 | import unittest
import sys
import os
import tempfile
import shutil
from appliapps.examples.a_pyecho import PythonEcho
from appliapps.examples.b_extecho import ExternalEcho
from appliapps.examples.cp import CpApp
from appliapps.examples.template import TemplateApp
class Test(unittest.TestCase):
@classmethod
d... | lcb/applicake | tests/test_examples.py | test_examples.py | py | 1,160 | python | en | code | 1 | github-code | 6 |
15024595640 | def field(items, *args):
assert len(args) > 0
result = []
for item in items:
if len(args) == 1:
if args[0] in item.keys():
result.append(item[args[0]])
else:
res = dict()
for key in args:
if key in item.keys():
... | blackfox2001/bmstu | RIP/labs/laba3/field.py | field.py | py | 409 | python | en | code | 0 | github-code | 6 |
27147516534 | import pytest
from ..common_imports import PdfXmp, PdfResource
class TestPdfXmp:
@pytest.fixture
def resource(self, test_params):
return PdfResource(test_params.resources_path + "XmpAndOtherSample.pdf", "XmpAndOtherSample.pdf")
@pytest.fixture
def text(self, resource, test_params, get_end... | dynamicpdf-api/python-client | test/PdfXmpEndpoint/test_pdf_xmp.py | test_pdf_xmp.py | py | 688 | python | en | code | 0 | github-code | 6 |
15910442299 | import unittest
from mock import Mock, call
from six import StringIO
from trashcli.restore.file_system import RestoreReadFileSystem, \
RestoreWriteFileSystem, FakeReadCwd
from trashcli.restore.restore_cmd import RestoreCmd
from trashcli.restore.trashed_file import TrashedFile, TrashedFiles
def last_line_of(io):... | cloudlylooudy/trash-cli | tests/test_restore/restore_cmd/test_trash_restore_cmd.py | test_trash_restore_cmd.py | py | 3,233 | python | en | code | null | github-code | 6 |
26024158970 | # 建立COO 稀疏矩阵
from scipy.sparse import coo_matrix # 引入所需要的库
row = [0, 1, 2, 2]
col = [0, 1, 2, 3]
data = [1, 2, 3, 4] # 建立矩阵的参数
c = coo_matrix((data, (row, col)), shape=(4, 4)) # 构建4*4的稀疏矩阵
print(c)
d = c.todense() # 稀疏矩阵转化为密集矩阵
print(d)
e = coo_matrix(d) # 将一个0值很多的矩阵转为稀疏矩阵
print(e)
f = e.to... | suanhaitech/pythonstudy2023 | july/11.py | 11.py | py | 584 | python | en | code | 2 | github-code | 6 |
71276865469 | # internal imports
from typing import Dict, Optional
# external imports
import gspread
def add_new_row(sheet, data):
sheet.append_row(data)
def update_row(sheet, cell, data):
for idx, d in enumerate(data):
sheet.update_cell(cell.row, cell.col + idx, data[idx])
def upload_results(sheet_name: str, ... | jaypmorgan/labscribe | labscribe/googlesheets.py | googlesheets.py | py | 968 | python | en | code | 0 | github-code | 6 |
31513841146 | #!/usr/bin/env python3
"""Convolutional Neural Networks"""
import numpy as np
def conv_backward(dZ, A_prev, W, b, padding="same", stride=(1, 1)):
"""back prop convolutional 3D image, RGB image - color
Arg:
dZ: containing the partial derivatives (m, h_new, w_new, c_new)
A_prev: contains the outpu... | macoyulloa/holbertonschool-machine_learning | supervised_learning/0x07-cnn/2-conv_backward.py | 2-conv_backward.py | py | 2,015 | python | en | code | 0 | github-code | 6 |
71601274107 | #!/usr/bin/env python3
from jinja2 import Template
import numpy as np
min_x = -20
max_x = 20
min_z = 0.0
max_z = 20.0
with open('nonapod_input.jinja') as template_file:
templ = Template(template_file.read())
# Do the cases for grid sampling. Since 50 and 500 are not perfect squares,
# must use an approximate num... | gridley/truss_optimization | write_big_grid.py | write_big_grid.py | py | 730 | python | en | code | 0 | github-code | 6 |
73477700027 | from tinygrad.densetensor import DenseTensor
import numpy as np
class BatchNorm2D:
def __init__(self, sz, eps=1e-5, track_running_stats=False, training=False, momentum=0.1):
self.eps, self.track_running_stats, self.training, self.momentum = eps, track_running_stats, training, momentum
self.weight, self.bias... | fpaboim/tinysparse | tinygrad/nn.py | nn.py | py | 3,311 | python | en | code | 9 | github-code | 6 |
18760758159 | import time
import aiohttp
import discord
import importlib
import os
import sys
import requests
import asyncio
from io import BytesIO
from discord.ext import commands
from my_utils import permissions, default, dataIO
from my_utils.guildstate import state_instance
class admin(commands.Cog):
def __init__(self, bot... | Albedo-Discord/ext | cogs/admin.py | admin.py | py | 10,872 | python | en | code | 1 | github-code | 6 |
41191258670 |
#? pip install flask flask-pymongo
from flask import Flask, render_template
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config['MONGO_URI'] = "mongodb://localhost:27017/myDatabase"
mongo = PyMongo(app)
@app.route('/')
def hello_world():
mongo.db.inventory.insert_one({"b":31})
a = mongo.db.inve... | Vedant817/Flask-and-MongoDB | main.py | main.py | py | 569 | python | en | code | 0 | github-code | 6 |
24615532465 | from tiles import AnimatableTile
import pygame
class Coin(AnimatableTile):
def __init__(self, size, position, frames, data):
super().__init__(size, position, frames, data)
for i in range(len(self.frames)):
self.frames[i] = pygame.transform.scale(self.frames[i], (8, 8))
self.pos... | ysbrandB/M6FinalProject | code/coin.py | coin.py | py | 462 | python | en | code | 0 | github-code | 6 |
75167070268 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
import math
def gaussian(window_size, sigma):
gauss = torch.Tensor([exp(-(x - window_size/2)**2/float(2*sigma**2)) for x in range(window_size)])
return gauss/gauss.sum()
def create_window(window_... | chenkhan/haze-synthesizing | util/metrics.py | metrics.py | py | 5,878 | python | en | code | 1 | github-code | 6 |
27318923223 | # @PascalPuchtler
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# dis... | iisys-hof/autonomous-driving | car-controller/src/mainController/View/Render/GenerateCarView.py | GenerateCarView.py | py | 2,531 | python | en | code | 0 | github-code | 6 |
12608079869 | '''
Load embedding, create dictionary, convert text to index
'''
import io
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
import argparse
#import json
import os
import numpy as np
import pickle
import pdb
def text2index(text, vocab, analyzer):
# 1 is unk
doc_toks = [vocab[y] ... | jingsliu/NLP_HW | HW2/code/dataPrep.py | dataPrep.py | py | 4,852 | python | en | code | 0 | github-code | 6 |
11221497921 | import os
import pandas as pd
import time
import data_prep
import freq_analysis
from features_extract import numeric_extract
from features_extract import price_extract
from features_extract import feature_extract
from features_extract import ID_extract
from features_extract import mfrID_extract
from features_extract i... | renyc432/headphone-product-analysis | cleaning/execute_cleaning.py | execute_cleaning.py | py | 6,517 | python | en | code | 0 | github-code | 6 |
30157505435 | from find_dir import cmd_folder
import pandas as pd
import os
import json
import numpy as np
buyer_history = pd.read_csv(cmd_folder+"data/processed/buyer_history.csv")
sorted_history = buyer_history[["buyer_id","visit_id","timestamp","event"]].sort_values(["buyer_id","visit_id","timestamp","event"],ascending=True)
s... | pierrenodet/PFE | src/make_trace_bis.py | make_trace_bis.py | py | 1,746 | python | en | code | 2 | github-code | 6 |
28002035268 | import os
import torch
import numpy as np
from PIL import Image
# This dataset comes form paper:
# [2D and 3D Segmentation of Uncertain Local Collagen Fiber Orientations in SHG Microscopy]
# https://github.com/Emprime/uncertain-fiber-segmentation
def collagen3d_dataset(dataloader_config, label_type='mask')... | Surtol-Sun/TrainFramework_torch | components/dataset_loader/dataset_loader_3dcollagen.py | dataset_loader_3dcollagen.py | py | 7,648 | python | en | code | 1 | github-code | 6 |
30192254789 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
# sigmoid函数
def sigmoid(z):
return 1 / (1 + np.exp(-z))
# 定义回归模型
def model(X, theta):
return sigmoid(np.dot(X, theta.T))
# 计算梯度
def gradient(X, y, theta):
grad = np.zeros(theta.shape) # 初始化梯度,维度与参数向量的维度... | TJPU-ML/Homework-for-the-fall-semester-of-2018 | iris classification/张家源/iris4.py | iris4.py | py | 9,017 | python | en | code | 0 | github-code | 6 |
22904436913 | import webbrowser
class Movie():
''' This class provides a way to store movie related information '''
'''This is a constant variable (class variable), and Google StyleGuide says that these type of variables should be spelled out in all caps'''
VALID_RATINGS = ["G", "PG", "PG-13", "R"]
def __init__(self, movie_... | OdeclasV/movie_website | media.py | media.py | py | 1,363 | python | en | code | 0 | github-code | 6 |
72757362749 | """
Roll adjusted and multiple prices for a given contract, after checking that we do not have positions
NOTE: this does not update the roll calendar .csv files stored elsewhere. Under DRY the sole source of production
roll info is the multiple prices series
"""
from dataclasses import dataclass
import numpy as np
... | ahalsall/pysystrade | sysproduction/interactive_update_roll_status.py | interactive_update_roll_status.py | py | 18,575 | python | en | code | 4 | github-code | 6 |
74667821627 | from typing import List, Optional
from fastapi import Depends
from ..service import Service, get_service
from app.utils import AppModel
from . import router
class InsideObjectResponse(AppModel):
_id:str
address:str
type:str
price:int
area:float
rooms_count:int
location:dict
class GenRespo... | MamushevArup/code-climb-ai-back | app/shanyrak/router/router_get_pagination.py | router_get_pagination.py | py | 770 | python | en | code | 0 | github-code | 6 |
38308536356 | from src import create_app
from src import db
from src.models.wifi import Wifi
from src.models.device import Device
from src.models.threshold import Threshold
from src.models.measurement import Measurement
from .network_setup import NetworkSetUp
from .default_data import threshold_data, wifi_data, measurement_data
c... | Fantaso/multi-raspberry-flask-apis-server | boot_setup/db_setup.py | db_setup.py | py | 3,284 | python | en | code | 0 | github-code | 6 |
42624248567 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'plusMinus' function below.
#
# The function accepts INTEGER_ARRAY arr as parameter.
#
n = int(input())
def plusMinus(arr):
#Write your code here
p=m=z=0
for i in range(n):
if arr[i]>0:
... | sarmistha1619/HackerRank---Algorithm | Warmup/6. HRSa - Plus Minus.py | 6. HRSa - Plus Minus.py | py | 564 | python | en | code | 0 | github-code | 6 |
9512551614 | #返回倒数第k个结点
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
#时间复杂度O(n) 空间复杂度O(1)
class Solution1:
def FindKthToTail(self , pHead: ListNode, k: int) -> ListNode:
# write code here
l=self.size(pHead)
if(k>l):
return None
... | guozhiyan1/data-structure | linklist/six.py | six.py | py | 1,519 | python | en | code | 0 | github-code | 6 |
41636163192 | """Insert Noop: insert a statement that doesn't affect any other variables."""
from refactorings.base import BaseTransformation, JoernTransformation, SrcMLTransformation
from refactorings.random_word import get_random_word, get_random_typename_value
import string
from srcml import E
from lxml import etree
import loggi... | bstee615/cfactor | refactorings/insert_noop.py | insert_noop.py | py | 1,800 | python | en | code | 0 | github-code | 6 |
8797452881 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv("C:/Users/Admin/OneDrive/Desktop/decision tree/Iris.csv")
df.head()
df.isnull().sum()
df.shape
df.info()
df.describe()
df.drop('Id',axis=1, inplace=True)
df.shape
df['Species'].value_counts().... | ShreyasiDesai/LGMVIP-DataScience | decition tree.py | decition tree.py | py | 1,182 | python | en | code | 0 | github-code | 6 |
5893119020 | weight = float(input("what is your weight in kg? "))
height = float(input("what is your height in m? "))
BMI = weight / (height ** 2)
if BMI < 18.5:
print("youre underweight")
elif BMI < 25:
print("you have a normal weight")
elif BMI < 30:
print("youre overweight")
elif BMI < 35:
print("youre obese")
e... | wandexdev/ProjectsInPython | Day-3/task3of3.py | task3of3.py | py | 362 | python | en | code | 2 | github-code | 6 |
21396845249 | from typing import Dict
from starlette.types import ASGIApp, Receive, Scope, Send
class AsgiDispatcher:
def __init__(self, patterns: Dict[str, ASGIApp], default: ASGIApp):
self.patterns = patterns
self.default_app = default
async def __call__(self, scope: Scope, receive: Receive, send: Send) ... | TheRacetrack/racetrack | racetrack_commons/racetrack_commons/api/asgi/dispatcher.py | dispatcher.py | py | 730 | python | en | code | 27 | github-code | 6 |
38354134434 | from dataclasses import dataclass
from typing import Optional, Tuple
import torch.nn as nn
import torch
from transformers.models.dpr.modeling_dpr import DPRReaderOutput
from transformers.modeling_outputs import QuestionAnsweringModelOutput, ModelOutput, SequenceClassifierOutput
from transformers.models.vilt.modeling_v... | mdsalem17/reranking | meerqat/train/trainee.py | trainee.py | py | 21,260 | python | en | code | null | github-code | 6 |
27477751575 | import re
def parse(html):
# define the regex pattern for the url
url_pattern = r"https?://(?:www\.)?youtube\.com/embed/(\w+)"
# use re.search to find the first matching url in the HTML
match = re.search(url_pattern, html, re.IGNORECASE)
if match:
# extract the video ID from the matched u... | iZusi/CS50P-Portfolio | problem_sets/problem_set7/watch/watch.py | watch.py | py | 766 | python | en | code | 0 | github-code | 6 |
74165330428 | from tkinter import*
from tkinter import ttk
from tkinter import Tk
from PIL import Image, ImageTk
from student import student
import os
import tkinter
from train import Train
from facereco import Face_Reco
from attendance import atendance
from developer import developer
from help import help
... | kg300902/Smart-Attendance-System | main.py | main.py | py | 7,693 | python | en | code | 0 | github-code | 6 |
12509808903 | import requests
city = input('enter the city... ')
api_address = 'https://samples.openweathermap.org/data/2.5/weather?q={},uk&appid=b6907d289e10d714a6e88b30761fae22'.format(
city)
url = api_address + city
data = requests.get(url).json()
# print(data)
weather = data['weather']
print(weather[0]['description'])
| Riyam224/techcampus---projects | 04/testApi.py | testApi.py | py | 319 | python | en | code | 0 | github-code | 6 |
71735044668 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
# Change the display options
pd.options.display.max_columns = None
pd.options.display.max_rows = None
species_df = pd.read_csv('species_info.csv')
observations_df = pd.read_csv('observat... | Pavich-3/-Biodiversity-in-National-Parks | project.py | project.py | py | 3,509 | python | en | code | 0 | github-code | 6 |
30186234566 | from openzwave.network import ZWaveNetwork
#from openzwave.network import ZWaveNetwork
# Initialiser le réseau Z-Wave
network = ZWaveNetwork()
# Attendre que le réseau soit prêt
network.start()
print("Serveur Z-Wave démarré")
# Boucle principale du serveur
while True:
# Vérifier les événements Z-Wave
network.upda... | ronisflamme/Iot-project | protocole Z-wave/serveur Z-wave.py | serveur Z-wave.py | py | 607 | python | fr | code | 0 | github-code | 6 |
33585060395 | __author__ = 'Vivek'
#Given a sorted array and a target value, return the index if the target is found.
# If not, return the index where it would be if it were inserted in order.
#You may assume no duplicates in the array.
def searchInsert(A, B):
"""
:param: A List of integers , B integer to be inserted
:re... | viveksyngh/InterviewBit | Binary Search/INSERTPOS.py | INSERTPOS.py | py | 957 | python | en | code | 3 | github-code | 6 |
7262256391 | from http import HTTPStatus
from flask import current_app, jsonify, request
from app.models.vacine_model import Vacine
from sqlalchemy.exc import IntegrityError
from app.exc.errors import CpfInvalid
from app.services.verif_data import verify_data
from app.services.generate_data import data_generate
def get_vacines():... | Kenzie-Academy-Brasil-Developers/q3-sprint5-vacinacao-theogandara | app/controllers/vacine_controller.py | vacine_controller.py | py | 1,750 | python | en | code | 1 | github-code | 6 |
5820650421 | import hashlib
import json
import urllib.parse
from typing import Union, Dict
import asks
from asks.response_objects import Response
from spins_halp_line.constants import Credentials
from spins_halp_line.util import get_logger, SynchedCache
_cred_key = "resource_space"
_field_ids = {
"adventure_name": 86,
"p... | aeturnum/spins_halp_line | spins_halp_line/media/resource_space.py | resource_space.py | py | 13,353 | python | en | code | 0 | github-code | 6 |
2063946987 | from loader import dp
from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Text
from loguru import logger
from datetime import datetime
@dp.message_handler(commands='reload', state='*')
@dp.message_handler(Text(equals='reload',
ignore_case... | Taiven396/tickets_bot | handlers/reload.py | reload.py | py | 1,059 | python | ru | code | 0 | github-code | 6 |
29956253019 |
import sys
sys.path.append("..") # Adds higher directory to python modules path.
import to_bip as tb
import blocks as bl
import shapegen as sh
def main():
print(" ---- Pyramid ----")
py = sh.Pyramid(5)
py.generate()
py_blocks = bl.init_blocks_3D(py.matlist())
py_conn = bl.connect_blocks_3D(py_blo... | ninocapipoca/ModularRobots | tests/test_pyramid.py | test_pyramid.py | py | 613 | python | en | code | 0 | github-code | 6 |
32195861005 | from pyplasm import *
import os,sys
sys.path.insert(0, 'lib/py/')
from lar2psm import *
from larcc import *
from sysml import *
#Funzioni Utili
DRAW = COMP([VIEW,STRUCT,MKPOLS])
DRAW2 = COMP([STRUCT,MKPOLS])
def rgbToPlasmColor(color):
return [color[0]/255., color[1]/255., color[2]/255.]
def creaFinestre(x,z):
fin... | cvdlab-alumni/433043 | 2014-05-16/python/exercise1.py | exercise1.py | py | 29,897 | python | en | code | 0 | github-code | 6 |
13941876090 | from argparse import ArgumentParser
from sudoku_solver import SudokuSolver
from sudoku import Sudoku
def get_args():
parser = ArgumentParser()
parser.add_argument('--sudoku', required=True)
return parser.parse_args()
def main():
args = get_args()
sudoku = Sudoku.from_file(args.sudoku)
solver... | delabania/sudoku-solver | solve.py | solve.py | py | 450 | python | en | code | 0 | github-code | 6 |
11473045132 | '''
Terminal
!pip install dash==0.26.5 # The core dash backend
!pip install dash-html-components==0.12.0 # HTML components
!pip install dash-core-components==0.28.0 # Supercharged components
!pip install dash_bootstrap_components==0.13.1
'''
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in ... | hsyho11/python-plotly-dash | plotly_example.py | plotly_example.py | py | 4,180 | python | en | code | 0 | github-code | 6 |
12170535231 | # Created on 24 September 2019
from square import Square, getScaledFont
from random import randint
from math import cos, sin, pi, atan, copysign
from pygame.mixer import *
from pygame.draw import rect
from pygame.locals import *
from pygame.time import Clock
from pygame.display import update
from pygame.mouse import g... | AaronOrenstein210/2048 | gameDriver.py | gameDriver.py | py | 7,331 | python | en | code | 1 | github-code | 6 |
33040338091 | n, m = map(int, input().split())
graph = []
arr = []
cnt = 0
for _ in range(n):
graph.append(list(map(int, input())))
def dfs(x, y):
global cnt
if x<0 or y<0 or x>=n or y>=m:
return False
if graph[x][y] == 1:
cnt += 1
graph[x][y] = 0
dfs(x-1, y)
dfs(x, y-1... | ParanMoA/SelfSoftware | ShinTIL/2023.01.19/1926.py | 1926.py | py | 584 | python | en | code | 0 | github-code | 6 |
7209449045 | import pandas as pd
def distance_in_yards(object_size_actual,object_size_mils):
try:
float(object_size_actual) and float(object_size_mils)
except ValueError:
return "Please enter a valid number."
object_distance_yards = (float(object_size_actual)*27.8)/float(object_size_mils)
... | brandon10135/sportshootingrules | shooter_calcs.py | shooter_calcs.py | py | 3,793 | python | en | code | 1 | github-code | 6 |
12830919470 | from typing import Optional
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
dummy = ListNode()
while head:
cur = head
head = h... | theRobertSan/LeetCode-Solutions-Python | 206.py | 206.py | py | 419 | python | en | code | 1 | github-code | 6 |
29310319456 | from random import randint
print("Welcome to the Number GuessingGame!")
print("I'm thinkin of a number between 1 and 100.")
#select hard, you get 5 guesses/ select easy you get 10
def guessGame():
number2Guess = randint(1,100)
guessed = False
global lives
lives = setLives()
#game begins
while ... | RoccoPic/100-Days-of-Code | Day-12/numberGuessingGame.py | numberGuessingGame.py | py | 1,337 | python | en | code | 0 | github-code | 6 |
73924507386 | import gzip
# 对两跳子图的处理:先过滤掉出现超过 2w 次的实体和出现少于 50 次的关系;然后再采样 15 核的
# 设置,同时只保留出现大于50次的关系,对两跳子图进行清洗
if __name__ == "__main__":
item_dict = {}
rela_dict = {}
print('start statistics')
with gzip.open('../doc/origin_graph_step2.txt.gz', 'rb') as f:
for num, line in enumerate(f):
line =... | icecream-and-tea/labs_web | lab2/lab2_stage1/src/filter2.py | filter2.py | py | 2,811 | python | en | code | 2 | github-code | 6 |
3822252154 | import hp_items as hpi
import hp_classes as hpc
import random
import time
player_options = ['chaser', 'beater', 'keeper', 'seeker']
test_team_1 = {'chaser': [100, 150, 200],
'beater': [175, 125],
'keeper': [100, 150, 200],
'seeker': [13]}
test_team_2 = {'chaser': [100, 150, 200],
'beater': [135, 165],
... | meganmonaghan/Harry-Potter-Emulator | quidditch_test.py | quidditch_test.py | py | 4,162 | python | en | code | 0 | github-code | 6 |
29924772061 | """
Author: JW
Date: 07/26/2023
Module Name: picture_capture_controls_uplink.py
Description:
This Python script is part of an image processing and classification application.
It provides various functions for interacting with images, databases, and user stacks.
The script includes functionalities such a... | JonWakefield/Anvil-Web-App | server_code/uplink_scripts/picture_capture_controls_uplink.py | picture_capture_controls_uplink.py | py | 22,281 | python | en | code | 0 | github-code | 6 |
71733863868 | from logging import Logger
from extract.adapters.airtable.credentials import AirtableCredentials
from pyairtable import Table
class AirTableAdapter:
def __init__(self, logger: Logger, credentials: AirtableCredentials):
self.logger = logger
self.api_key = credentials.api_key
self.base_id = ... | patrikbraborec/good-crm-analytics | src/extract/adapters/airtable/impl.py | impl.py | py | 1,004 | python | en | code | 1 | github-code | 6 |
24200260957 | class Solution:
def strToInt(self, s: str) -> int:
s = s.lstrip()
if not s:
return 0
res = 0
i = 1
is_positive = True
max_int = 2 ** 31 - 1
if s[0] == "-":
is_positive = False
elif s[0] != "+":
i = 0
for c in... | AiZhanghan/Leetcode | code/面试题67. 把字符串转换成整数.py | 面试题67. 把字符串转换成整数.py | py | 1,785 | python | en | code | 0 | github-code | 6 |
72416331709 | from socket import *
import time
import osascript
from multiprocessing import Process, Manager, Value
import os
#osascript -e 'display notification "{}" with title "{}"'
volume = 0
def recieve_data(val):
serverSock = socket(AF_INET, SOCK_STREAM)
serverSock.bind(('', 7777))
serverSock.listen(1)
connect... | Arc1el/DeepLearning_Jetson_AI | server.py | server.py | py | 1,802 | python | en | code | 4 | github-code | 6 |
1701461424 | import argparse
import numpy as np
import cv2
import time
import math
from sympy.solvers import solve
from sympy import Symbol
X_POS = 0
Y_POS = 1
Thresh = 170
imageName = "picture.jpg"
def modImage(sceneName, img, kernel, erodeNum, dilateNum, invertion=False):
ret, result = cv2.threshold(img, Thresh, 255, cv2.THRE... | Edwin222/CPL-20181-Team3 | iris_detect_service/iris_detection.py | iris_detection.py | py | 6,860 | python | en | code | 0 | github-code | 6 |
11353211013 | '''
스도쿠
https://www.acmicpc.net/problem/2580
'''
import sys
sudoku = [list(map(int,sys.stdin.readline().split())) for _ in range(9)]
zeros = [(i,j) for i in range(9) for j in range(9) if sudoku[i][j] == 0]
is_complete = [False]
def check_horizontal(x,val):
if val in sudoku[x]:
return False
return True... | jihoonyou/problem-solving | Baekjoon/boj2580.py | boj2580.py | py | 1,176 | python | en | code | 0 | github-code | 6 |
29435711236 | import re
import os
import socket
from threading import Thread, Event
import subprocess
import time
from shutil import copyfile
from tiny_test_fw import Utility, DUT
import ttfw_idf
stop_sock_listener = Event()
stop_io_listener = Event()
sock = None
client_address = None
manual_test = False
def io_listener(dut1):
... | espressif/ESP8266_RTOS_SDK | components/lwip/weekend_test/net_suite_test.py | net_suite_test.py | py | 5,711 | python | en | code | 3,148 | github-code | 6 |
30124092991 | import sys
#sys.stdin=open("A.txt","r")
#n,m=map(int,input().split()) #정n면체 정m면
#a=list(map(int,input().split()))
res=0
N=int(input())
#a=list(map(int,input().split())) 이거는 [1,2,3,4,5]이런식
for i in range(N):
tmp=input().split() #이거는['3','3','6']이렇게 문자열로저장
tmp.sort()
a,b,c=map(int,tmp)
#print(a,b... | kimyoonseong/202207_08_PythonAlgorithm | 코드구현력기르기Part/주사위게임.py | 주사위게임.py | py | 646 | python | ja | code | 0 | github-code | 6 |
11914708160 | ''' Write a program which accepts a
string as input to print "Yes" if the
string is "yes" or "YES" or "Yes",
otherwise print "No". '''
str_val= input("enter a string : ")
if str_val == 'yes' or str_val =='YES' or str_val =='Yes':
print("Yes")
else:
print("No")
| mrudulamucherla/Python-Class | string_Yes_No.py | string_Yes_No.py | py | 276 | python | en | code | 0 | github-code | 6 |
20921250486 | import networkx as nx
from sklearn.cluster import SpectralClustering
def spectral_clustering(G, n_clusters=2):
adj_mat = nx.to_numpy_matrix(G)
sc = SpectralClustering(n_clusters, affinity='precomputed', n_init=100)
sc.fit(adj_mat)
clusters = {}
for i in range(len(sc.labels_)):
if sc.labels... | sharpenb/Multi-Scale-Modularity-Graph-Clustering | Scripts/clustering_algorithms/spectral_clustering.py | spectral_clustering.py | py | 454 | python | en | code | 2 | github-code | 6 |
19400730749 | ###############################################################################
# Process to read Customer Updates #
#
# Pre-requisites: Kafka server should be running #
##############################################################################... | bbcCorp/py_microservices | src/app_services_replication/message_processor.py | message_processor.py | py | 5,987 | python | en | code | 1 | github-code | 6 |
14276598167 | import sys
sys.path.append('D:/Users/Murph Strange/Jupyter Notebook/')
import menus
import random
import types
class Character:
def __init__(self, name):
self.name = name
self.strength = 16
self.intellect = 16
self.resilience = 16
#ability to run away (... | drunkfurball/dragonquest | dragonquest.py | dragonquest.py | py | 15,882 | python | en | code | 0 | github-code | 6 |
5085250146 | from copy import deepcopy
import json
import re
from flask import render_template
from maf_api_mock_data import EGFR_BLCA_BRCA as FAKE_MAF_DATA
from hotspots.seqpeek.tumor_types import tumor_types as ALL_TUMOR_TYPES
from app_logging import get_logger
log = get_logger()
try:
from hotspots.seqpeek.gene_list import ... | cancerregulome/multiscale-mutation-hotspots | hotspots/seqpeek/view.py | view.py | py | 11,643 | python | en | code | 1 | github-code | 6 |
7642412610 | from unittest import result
from pip._vendor.distlib.compat import raw_input
def start():
n1 = input("n1: ")
control_input(n1)
def control_input(x):
try:
val = int(x)
print("Input is an integer number. Number = ", val)
result = "int_number"
except ValueEr... | Ruxuge/TAU | lab7/main.py | main.py | py | 648 | python | en | code | 0 | github-code | 6 |
26969758526 | import os
import time
import numpy as np
import torch
from torchvision.utils import make_grid
from torchvision.transforms import ToPILImage
from base import BaseTrainer
from evaluate import get_fid_score, get_i3d_activations, init_i3d_model, evaluate_video_error
from utils.readers import save_frames_to_dir
from model... | amjltc295/Free-Form-Video-Inpainting | src/trainer/trainer.py | trainer.py | py | 21,228 | python | en | code | 323 | github-code | 6 |
5898092758 | permission_list = [
['fsdDecl', ['fLib', 'fsDecl', 'fsdLink', 'fvLib']],
['fLib', ['f']],
['fsDecl', ['fsDescr', 'fsConstraints', 'fDecl']],
['fvLib', ['binary', 'default', 'fs', 'numeric', 'string', 'symbol', 'vAlt', 'vColl', 'vLabel', 'vMerge', 'vNot']],
['fDecl', ['fDescr', 'vRange', 'vDefault']]... | Darboven/TEI-Feature-Structures | TEI-Checker/tei_rules.py | tei_rules.py | py | 2,287 | python | en | code | 0 | github-code | 6 |
17938250421 | # from __future__ import absolute_import
import base64
import re
# import mimetypes
from config import media_types, static_files, static_ext, save_content
class ResponseParser(object):
"""docstring for ResponseParser"""
def __init__(self, f):
super(ResponseParser, self).__init__()
self.flow ... | jjf012/PassiveScanner | utils/parser.py | parser.py | py | 5,258 | python | en | code | 112 | github-code | 6 |
74021781309 | from typing import List
from collections import Counter
from time import time
import matplotlib.pyplot as plt
import numpy as np
# constants
ENGLISH_ALPHABET_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '
def get_string_size(string: str, format: str='utf8') -> int:
'''Returns size of string in b... | lucrae/zipf-score | side/score_old.py | score_old.py | py | 1,510 | python | en | code | 0 | github-code | 6 |
16542777837 | import contextlib
from .Indentation import indented
class SourceCodeCollector(object):
def __init__(self):
self.codes = []
def __call__(self, code):
self.emit(code)
def emit(self, code):
for line in code.split("\n"):
self.codes.append(line)
def emitTo(self, emit... | Nuitka/Nuitka | nuitka/code_generation/Emission.py | Emission.py | py | 1,132 | python | en | code | 10,019 | github-code | 6 |
18654748060 | from typing import Dict, List, Type
from src.domain.models.pets import Pets
from src.domain.use_cases import FindPet as FindPetInterface
from src.data.interfaces import PetRepositoryInterface
class FindPet(FindPetInterface):
"""Use case for Find pet"""
def __init__(self, pets_repository: Type[PetRepositoryIn... | MatheusDev20/flask-application-clean-arch | src/data/find_pet/find.py | find.py | py | 1,392 | python | en | code | 0 | github-code | 6 |
41058442656 | class Poly:
def __init__(self,*terms):
# __str__ uses the name self.terms for the dictionary of terms
# So __init__ should build this dictionary from terms
self.terms = {}
for numbers in terms:
assert type(numbers[0]) is (int or float), "Poly.__init__: illegal... | solomc1/python | ics 33/solutions/ile2 solutions/Lab 3/YeSiyuan/poly.py | poly.py | py | 8,269 | python | en | code | 0 | github-code | 6 |
18131053441 | diceTop = 0
diceLeft = 0
diceRight = 0
diceFront = 0
diceBack = 0
diceBottom = 0
mapList = []
n,m,y,x,k = map(int,input().split())
for i in range(0,n):
mapList.append(input().split())
movingList = (input().split())
for i in range(0,len(movingList)):
direction = int(movingList[i])
if direction == 1:
... | Hyeneung-Kwon/Baekjoon_Python | 14499.py | 14499.py | py | 1,387 | python | en | code | 0 | github-code | 6 |
17759233501 | from abc import ABC, abstractmethod
class Book(ABC):
def __init__(self, isbn, title, author, publisher, pages, price, copies):
self.isbn = isbn
self.title = title
self.author = author
self.publisher = publisher
self.pages = pages
self.price = price
self.copies... | APARNA01MOHANAN/pycharm-projects | book-bank/BOOK34.py | BOOK34.py | py | 1,924 | python | en | code | 0 | github-code | 6 |
4783789916 | # Adapted from pytorch examples
from __future__ import print_function
from torch import nn, optim
from railrl.core import logger
import numpy as np
from railrl.pythonplusplus import identity
from railrl.torch.core import PyTorchModule
from railrl.torch.networks import Mlp
import railrl.torch.pytorch_util as ptu
class... | snasiriany/leap | railrl/torch/vae/reprojection_network.py | reprojection_network.py | py | 4,777 | python | en | code | 45 | github-code | 6 |
44426734106 | from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import assert_equal
from test_framework.comptool import TestManager, TestInstance, RejectResult
from test_framework.blocktools import create_transaction, CScript, msg_tx, prepare_init_chain
from test_framework.script import OP_CH... | bitcoin-sv/bitcoin-sv | test/functional/bsv-highsigopsdensitymempool.py | bsv-highsigopsdensitymempool.py | py | 2,529 | python | en | code | 597 | github-code | 6 |
71844063869 | from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from simple_menu import MenuItem
submenu_items = [
MenuItem(
_("customers").capitalize(),
reverse("packs:sales_customer_list"),
weight=20,
icon="bx-right-arrow-alt",
),
MenuItem(
_... | dbsiavichay/faclab | apps/accounts/menus/sales.py | sales.py | py | 563 | python | en | code | 0 | github-code | 6 |
25995631588 | from dataclasses import dataclass, field
from .. import docker
from .. import exceptions
from .. import utils
from ..runtime import register, RuntimePlugin
@register
@dataclass
class Docker(RuntimePlugin):
name: str = field(init=False, default="Docker")
def init(self, graph, outputs):
# Parse the us... | parlaylabs/model | model/runtimes/docker.py | docker.py | py | 1,011 | python | en | code | 2 | github-code | 6 |
75385540986 | from collections import defaultdict
T = int(input())
for i in range(T):
N = int(input())
c = list(map(int, input().split(' ')))
g = defaultdict(list)
for _ in range(N - 1):
edge = list(map(int, input().split(' ')))
g[edge[0]].append(edge[1])
g[edge[1]].append(edge[0])
def ... | fortierq/competitions | fb_hacker_cup/2021/qualification/c1_gold_mine.py | c1_gold_mine.py | py | 686 | python | en | code | 0 | github-code | 6 |
6146581577 | import datetime
import pyttsx3
import speech_recognition as sr
import wikipedia
import webbrowser
import pywhatkit
import time
import threading
import newsapi
import random
maquina = pyttsx3.init()
voz = maquina.getProperty('voices')
maquina.setProperty('voice', voz[1].id)
def executa_comando():
t... | lucasss45/Fryday-IA | alfredv2.6.py | alfredv2.6.py | py | 6,390 | python | pt | code | 0 | github-code | 6 |
27884694892 | from django.contrib import admin
from .models import Division, Farm
# Register your models here.
class DivisionAdmin(admin.ModelAdmin):
list_display = (
"division_name",
"division_code",
)
admin.site.register(Division, DivisionAdmin)
admin.site.register(Farm)
| Wageesha95/dbapp-live | farms/admin.py | admin.py | py | 289 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.