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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
39999239815 | from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
module: sensu_go_rolebinding_info
author: "Paul Arthur (@flowerysong)"
sh... | flowerysong/ansible-flowerysong.sensu_go | plugins/modules/sensu_go_rolebinding_info.py | sensu_go_rolebinding_info.py | py | 1,768 | python | en | code | 2 | github-code | 90 |
29842367476 | '''
题目描述:给定两个单链表,链表的每个结点代表一位数(第一个有效结点数据域代表个位数),计算两个数的和。
输入样例:
3->1->5
5->9->2
输出:
8->0->8
'''
#链表的创建和输出
class LNode(object):
def __init__(self,x):
self.data = x
self.Next = None
#创建链表(带头结点)
def create_List(values):
head = LNode(None)
if values is None:
print('创建了一个仅有头结点的单链表')
return head
cur = head
for v ... | struggl/DataStructure | python程序员面试宝典/链表/1.3如何计算两个单链表所代表的数之和.py | 1.3如何计算两个单链表所代表的数之和.py | py | 4,271 | python | en | code | 0 | github-code | 90 |
72477556776 | #!usr/bin/env python3
"""Finding Nemo
A function that looks for the string nemo of a list.
"""
import time
nemo = ['nemo']
everyone = [
'dory', 'bruce', 'marlin', 'nemo', 'gill', 'bloat',
'nigel', 'squirt', 'darla', 'hank'
]
small_list = ['nemo' for i in range(10)]
medium_list = ['nemo' for i in range(10... | danielvolponi/master_coding_interview | big_o/nemo.py | nemo.py | py | 626 | python | en | code | 0 | github-code | 90 |
20996878219 | def main_fun():
products = input("pls write a shoping list: ")
number = input("write a number 1 -9: ")
if number == "1":
print(products)
elif number == "2":
print(products.count(",") + 1)
main_fun()
| zzeden/Learn-Python | selfpy/7.2.6.py | 7.2.6.py | py | 233 | python | en | code | 0 | github-code | 90 |
17195353926 | from typing import List
from natsort import natsorted
from issuelab.base.milestone import Milestone, MilestoneState
from issuelab.base.issue import Issue, IssueState
from issuelab.base.comment import Comment
from issuelab.base.user import User
from issuelab.base.label import Label
from issuelab.base.attachment import ... | tafilz/issuelab | issuelab/tracker/youtrack/converter.py | converter.py | py | 4,881 | python | en | code | 0 | github-code | 90 |
18517712349 | # coding: utf-8
# Your code here!
n,m,d=map(int,input().split())
if n>=2*d:
expe=(n-2*d)*2+2*d if d!=0 else n
elif n>=d:
expe=2*(n-d)
else:
expe=0
#print(expe)
print((expe/n**2)*(m-1))
| Aasthaengg/IBMdataset | Python_codes/p03304/s943124265.py | s943124265.py | py | 198 | python | en | code | 0 | github-code | 90 |
38765027618 | from collections import deque, defaultdict
class Solution:
minHeight = float('inf')
def findMinHeightTrees(self, n, edges):
def topologicalSort(edge_list):
#edge case
if not edge_list:
return {0 : []}
#형식: map = {node: []} -> undirectional
... | dldbdud314/j2kb_algorithmn | leetcode/minimum_height_trees.py | minimum_height_trees.py | py | 1,539 | python | en | code | 0 | github-code | 90 |
31228061722 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 16 11:43:30 2017
@author: lenovo
"""
import os
import sys
import struct
import datetime
import pandas as pd
import sqlite3
########################################################################
#建立数据库
####################################################################... | RoveAllOverTheWorld512/hyb_bak | get_ssdate.py | get_ssdate.py | py | 6,191 | python | en | code | 0 | github-code | 90 |
39092392391 | from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('response_query',views.response_query,name='response_query' ),
path('signup',views.signup,name='signup'),
path('login',views.login_api_token,name="login_token"),
path('logout',views.logout,name='logou... | Siddhant0507Shekhar/Insightmate | chatgpt_api/urls.py | urls.py | py | 429 | python | en | code | 1 | github-code | 90 |
38955861516 | # refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_bucket_acl
import GetConnection
testBucketName = "testtest"
if __name__ == '__main__':
s3 = GetConnection.getConnection()
# use the access control policy
# by default, user ID is same with the Dis... | EMCECS/ecs-samples | boto3-python-workshop/10_BucketACL.py | 10_BucketACL.py | py | 1,707 | python | en | code | 35 | github-code | 90 |
18533908839 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
a, b, c, d = map(int, readline().split())
if abs(a - c) <= d or abs(a - b) <= d and abs(b - c) <= d:
print('Yes')
else:
... | Aasthaengg/IBMdataset | Python_codes/p03351/s008226876.py | s008226876.py | py | 385 | python | en | code | 0 | github-code | 90 |
16503044767 | import traceback
import httpx
from .mrc import create_app,create_mrc_model_for_server
def create_mrc_proxy(config):
class_name,kwargs = config["class"],config["kwargs"]
name2class = {'TestProxy':TestProxy,'RedirectProxy': RedirectProxy,'DirectAccessProxy':DirectAccessProxy}
_cls = name2class[c... | kumiko-oreyome/hqa_project | server/mrc_proxy.py | mrc_proxy.py | py | 2,121 | python | en | code | 0 | github-code | 90 |
18055260999 | import sys
readline = sys.stdin.readline
X = readline().rstrip()
cnt = 0
ans = 0
# Sが出たら1増やし、Tが出たら1減らす
# 0のときにTが出たらansを+1する。ans * 2が答え
for i in range(len(X)):
if X[i] == "S":
cnt += 1
else:
if cnt == 0:
ans += 1
else:
cnt -= 1
print(ans * 2) | Aasthaengg/IBMdataset | Python_codes/p03986/s022301682.py | s022301682.py | py | 338 | python | ja | code | 0 | github-code | 90 |
14029942312 | #times = input("How many times do I need to tell you?")
#times= int(times)
#for times in range(times):
# print(f"times {times+1} :CLEAN UP YOUR ROOM")
for num in range(1,21):
if num==14 or num==3 or num==7:
state = "UNLUCKY!"
elif num % 2 ==1:
state = "odd"
else:
state = "even"... | geet121/python | forLoop.py | forLoop.py | py | 352 | python | en | code | 0 | github-code | 90 |
15485130005 | import os
from tkinter import *
from tkinter import filedialog
from tkinter.messagebox import showinfo
from database import sqlite_connection
global description
global image_frame
global image_bytes
window = Tk()
cursor = sqlite_connection.cursor()
listbox = Listbox(window, width=35, height=50)
def create_window()... | xKINGofFIREx/python_database_sqlite_project | window.py | window.py | py | 10,973 | python | en | code | 0 | github-code | 90 |
9792742994 | from pyspark import SparkContext
import itertools
sc = SparkContext("spark://spark-master:7077", "PopularItems")
data = sc.textFile("/tmp/data/access.log", 2).distinct()
pairs = data.map(lambda line: line.split("\t"))
grouped = pairs.groupByKey()
grouped = grouped.mapValues(lambda group: sorted(group))
combos ... | kienan/spark-coviews | data/hello.py | hello.py | py | 931 | python | en | code | 0 | github-code | 90 |
7025523787 | #Faça um programa para o cálculo de uma folha de pagamento, sabendo que os
"""descontos são do Imposto de Renda, que depende do salário bruto
(conforme tabela abaixo) e 10% para o INSS e que o FGTS corresponde a 11% do
Salário Bruto, mas não é descontado (é a empresa que deposita).
O Salário Líquido corresponde ao ... | Guh698/Python | Exercícios Python - Segunda lista/12 - Saláriodnv.py | 12 - Saláriodnv.py | py | 1,513 | python | pt | code | 0 | github-code | 90 |
938763943 | #!/usr/bin/env python
# coding: utf-8
import rospy
import tf
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage
from scipy.cluster.hierarchy import fcluster
from scipy.spatial import distance
import yaml
from std_srvs.srv import Empty
import os.path
from extended_object_detection.msg import Sim... | Extended-Object-Detection-ROS/object_spatial_tools_ros | src/object_spatial_tools_ros/robot_semantic_map_processor.py | robot_semantic_map_processor.py | py | 26,092 | python | en | code | 2 | github-code | 90 |
9405894027 | import lifelines
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
from lifelines import CoxPHFitter
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, MinMaxScaler
class CoxPHModel:
def fit_model(self, data, duration, event, pr... | mitchgauthier/info_vis_mimic_survival | SurvivalAnalysis/CoxRegression.py | CoxRegression.py | py | 2,949 | python | en | code | 1 | github-code | 90 |
40329978075 | #!/usr/bin/python3
# coding: utf-8
import re
import json
cidian_file = '/home/gswewf/data/词典/现代汉语词典第六版电子书.txt'
def parse_version_6(cidian_file):
cidian_dict = {}
words_pattent = '^【(?P<name>.+?)】'
with open(cidian_file)as f:
line = f.readline()
while line:
s = re.search(words_... | gswyhq/hello-world | 收藏/词典解析.py | 词典解析.py | py | 776 | python | en | code | 9 | github-code | 90 |
2293794953 | import argparse
from collections import defaultdict
import csv
from pathlib import Path
from typing import Counter, Dict, List, Tuple, Union, Generator
import itertools as it
from pandas import cut
from .reader import read_grids
def count_entity_frequences(grid: Dict[str, List[str]]) -> Counter:
occurence_counts... | julmaxi/summary_coherence_evaluation | scmeval/entity_grid/count_entities.py | count_entities.py | py | 1,990 | python | en | code | 1 | github-code | 90 |
28415968079 | from turtle import Screen
from snake import Snake
from food import Food
from scoreboard import ScoreBoard
import time
s = Screen()
s.setup(width=600, height=600)
s.bgcolor("black")
s.title("Snake game project - Pieter")
s.tracer(0)
snake = Snake()
food = Food()
score = ScoreBoard()
s.listen()
s.onkey(snake.up, "Up... | Pieter414/Projects | 20 - Snake Game Project/main.py | main.py | py | 1,099 | python | en | code | 0 | github-code | 90 |
44355477079 | import tweepy
import json
import csv
import time
def loadKeys(key_file):
# TODO: put your keys and tokens in the keys.json file,
# then implement this method for loading access keys and token from keys.json
# rtype: str <api_key>, str <api_secret>, str <token>, str <token_secret>
# Load keys her... | Bzling/Fall2017-CSE6242 | HW1-Bai-Zhuling/Q1/script.py | script.py | py | 4,470 | python | en | code | 0 | github-code | 90 |
21367285759 | import numpy as np
import tensorflow as tf
def calcular(grados_celsius):
# Datos de entrada (grados Celsius) y salida esperada (grados Fahrenheit)
celsius = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float)
fahrenheit = np.array([-40, 14, 32, 46, 59, 72, 100], dtype=float)
# Definición de las capas ... | BrunoTornese/Machine-learning | grados.py | grados.py | py | 1,240 | python | es | code | 0 | github-code | 90 |
632539802 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Arne F. Meyer <arne.f.meyer@gmail.com>
# License: GPLv3
"""
Rectangular ROI selection
"""
from __future__ import print_function
import matplotlib.pyplot as plt
from ..io.video import get_first_frame
def selectROI(frame, verbose=False, title=None, bbox=... | arnefmeyer/mousecam | mousecam/mousecam/util/roirect.py | roirect.py | py | 2,371 | python | en | code | 21 | github-code | 90 |
32701113945 | import math
import re
from typing import List
from data import redis_session
async def create_sets_based_on_classification(
agent_address: str, classification: str
) -> None:
client = await redis_session.create_async_session()
classification_list = classification.split(".")
table = ""
for item in... | fetchai/pyOEF | services/search_service.py | search_service.py | py | 2,257 | python | en | code | 2 | github-code | 90 |
35763000911 | import aiohttp
from pymongo import MongoClient
from multiprocessing import Pool
import os
from dotenv import find_dotenv, load_dotenv
import logging
import sqlite3
import json
load_dotenv(find_dotenv())
# env constants
MONGO_DATABASE_URL = os.environ.get("MONGO_DATABASE_URL")
MONGO_DATABASE_NAME = os.environ.get("MON... | nshahpazov/electronic-sports-predictions | python/src/data/downloaders/mmr_distribution_downloader.py | mmr_distribution_downloader.py | py | 2,206 | python | en | code | 2 | github-code | 90 |
4981788366 | from flask import Flask, request, jsonify
import werkzeug
import deepspeech
import soundfile as sf
import librosa
import re
import Levenshtein
import os
app = Flask(__name__)
gunicorn_args = os.getenv('GUNICORN_CMD_ARGS', '')
gunicorn_app = 'app:app' # Replace with your Gunicorn app entry point
# Start Gunicorn wit... | steven-mpawulo/pythonProject | app.py | app.py | py | 3,416 | python | en | code | 0 | github-code | 90 |
70072603817 | from script import control_string
from script.LEXER import particular_str_selection
from script.PARXER.INTERNAL_FUNCTION import get_list
from script.PARXER.LEXER_CONFIGURE import partial_lexer
from script.PARXER.INTERNAL_FUNCTION import get_dictionary
from s... | amiehe-essomba/BlackMamba | script/LEXER/var_name_checking.py | var_name_checking.py | py | 7,431 | python | en | code | 4 | github-code | 90 |
29441076046 | """
Entradas
a-->int-->Tarea de matematicas
b-->int-->Tarea de matematicas
c-->int-->Tarea de matematicas
d-->int-->Examen final de matematicas
e-->int-->Tarea de fisica
f-->int-->Tarea de fisica
g-->int-->Examen final de fisica
h-->int-->Tarea de quimica
i-->int-->Tarea de quimica
j-->int-->Tarea de quimica
k-->int--... | FelipeRodri03/Trabajos-algoritmos-y-programaci-n | Taller python/Ejercicio12.py | Ejercicio12.py | py | 838 | python | es | code | 0 | github-code | 90 |
1282411446 | """chatProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | basantasharma/Py_Django_App | chatProject/chatProject/urls.py | urls.py | py | 1,992 | python | en | code | 1 | github-code | 90 |
35306661320 | #!/usr/bin/env python3
import argparse
import sys
import os
import random
import numpy as np
import pickle
from PIL import Image
import circpadsim
ap = argparse.ArgumentParser()
ap.add_argument("--ld", required=True,
help="load dataset from pickle, provide path to pickled file")
ap.add_argument("-s", default="te... | pylls/padding-machines-for-tor | evaluation/visualize.py | visualize.py | py | 2,091 | python | en | code | 14 | github-code | 90 |
6768104231 | from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.auth.base_user import BaseUserManager
from django.contrib.auth.hashers import make_password
from django.core.validators import MinLengthValidator
from django.utils... | ThePokerFaCcCe/myblog | blog/models.py | models.py | py | 7,133 | python | en | code | 0 | github-code | 90 |
6561289116 | def map_number_to_words(n):
words = ''
n_digit = len(str(n))
if n_digit == 1:
words = single_digit(n)
elif n_digit == 2:
words = double_digit(n)
elif n_digit == 3:
words = triple_digit(n)
# print(words)
return words
def single_digit(digit):
words = ['one', 'two... | juwaini/project-euler-solutions | 0001-0020/problem_0017.py | problem_0017.py | py | 1,444 | python | en | code | 0 | github-code | 90 |
22628704695 | # coding=UTF-8
from flask import Response,request,Flask
from flask import abort, redirect, url_for
import requests
from PIL import Image
from io import BytesIO
import time
import urllib
import urllib2
import uuid
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def hello():
if request.method == 'POS... | zhujunkai/ZNyunwei | PythonFlask/Cloudyw/main.py | main.py | py | 2,178 | python | en | code | 0 | github-code | 90 |
3615136405 | import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
train = pd.read_csv("E:/train.csv",dtype={"Age": np.float64},)
train.head(10)
def harmonize_data(titanic):
# 填充空数据以及把string数据转成interger表示
# 对于年龄字段发生缺失,用所有年龄的均值替代
titanic["Age"] = titanic["Age"].fillna(titanic["Age"].median(... | Azurelyu/decision | RF.py | RF.py | py | 886 | python | en | code | 0 | github-code | 90 |
15802423575 | # -*- coding: utf-8 -*-
"""
969. Pancake Sorting
Given an array of integers arr, sort the array by performing a series of pancake flips.
In one pancake flip we do the following steps:
Choose an integer k where 1 <= k <= arr.length.
Reverse the sub-array arr[1...k].
For example, if arr = [3,2,1,4] and we performed a ... | tjyiiuan/LeetCode | solutions/python3/problem969.py | problem969.py | py | 1,260 | python | en | code | 0 | github-code | 90 |
37119463003 | # Definition for a binary tree node with parent pointer.
class TreeNodeP(object):
def __init__(self, x, p):
self.value = x
self.left = None
self.right = None
self.parent = p
class Solution(object):
def lowestCommonAncestor(self, one, two):
"""
input: TreeNodeP o... | nanw01/python-algrothm | laioffer/Code/127. Lowest Common Ancestor II copy.py | 127. Lowest Common Ancestor II copy.py | py | 1,089 | python | en | code | 1 | github-code | 90 |
34423690337 | from django import template
from django.contrib.auth.models import Group
from django.template.loader import render_to_string
register = template.Library()
@register.filter(name='is_in_group')
def is_in_group(user, group_name):
"""
Checks if given user is in a group of the given name
:param user: User obj... | skni-kod/StronaPraceKol | papers/templatetags/custom_papers_tags.py | custom_papers_tags.py | py | 2,386 | python | en | code | 0 | github-code | 90 |
30925544481 | import sys
sys.path.append("..")
import numpy as np
import os
import torch
import torch.nn as nn
import math
from rnnlm import *
from ptb import *
from logger import *
from torch.autograd import Variable
gpu_number = 0
os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_number)
torch.manual_seed(24)
class Trainer():
def... | frederick0329/Language-Modeling | pytorch/train.py | train.py | py | 4,439 | python | en | code | 2 | github-code | 90 |
16623664366 | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QLabel, QComboBox, QTextEdit, QListWidget
from PyQt5 import QtGui
from loginForm import *
from addRecipeForm import *
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def... | Anna-a-a/RecipeBook | mainForm.py | mainForm.py | py | 3,169 | python | en | code | 0 | github-code | 90 |
71867139816 | # -*- coding:utf-8 -*-
# @Time :2023/6/18 10:30
# @Author :ZZK
# @ File :my_model.py
# Description:
from torchvision import models
from transformers import BertModel
from torchcrf import CRF
from utils import *
from config import tag2idx, max_len, max_node
class BiLSTM(nn.Module):
def __init_... | qwe1234567891/KGMNER | my_model.py | my_model.py | py | 8,271 | python | en | code | 0 | github-code | 90 |
13581815212 | '''
Modified based on http://djangosnippets.org/snippets/2041/
It provides a class-based view
Usage example:
class MyView(View):
def __init__(self, arg=None):
self.arg = arg
def get(request):
return HttpResponse(self.arg or 'No args passed')
@login_required
class MyOtherView(View):... | SuLab/biogps_core | src/biogps/biogps/utils/restview.py | restview.py | py | 3,783 | python | en | code | 0 | github-code | 90 |
41120916016 | import random
from item import Item
from creatures import Miner
from enchantments import SleepSpell, Frozen, Firestarter
class BookOfSpells(Item):
def __init__(self, x, y):
Item.__init__(self, x, y)
self.char = 'B'
self.color = 948
self.type = 'Book of Spells'
spells = [Sl... | nyalldawson/dwarf_mine | book_of_spells.py | book_of_spells.py | py | 1,008 | python | en | code | 2 | github-code | 90 |
15764273997 | """
Datapane Processors
API for processing Views, e.g. rendering it locally and publishing to a remote server
# TODO - move this out into a new top-level module
"""
from __future__ import annotations
import os
import typing as t
from pathlib import Path
from shutil import rmtree
from datapane.client import DPClien... | DougConvexAccount/datapane_fork | python-client/src/datapane/processors/api.py | api.py | py | 6,887 | python | en | code | null | github-code | 90 |
21791219002 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from opencv_apps.msg import RotatedRectStamped
from geometry_msgs.msg import Twist
class track_box_to_cmd_vel:
rect = None
pub = None
def __init__(self):
self.rect = RotatedRectStamped()
rospy.init_node('client')
rospy.Subscriber('/camshift/trac... | kaiwinut/robot-programming | 1011/track_box_to_cmd_vel.py | track_box_to_cmd_vel.py | py | 1,465 | python | en | code | 0 | github-code | 90 |
42750224807 | #!/usr/bin/python
import os
from setuptools import setup, find_packages
import tenant_extras
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name="django-tenant-extras",
... | onepercentclub/django-tenant-extras | setup.py | setup.py | py | 1,337 | python | en | code | 9 | github-code | 90 |
19306982403 | #!/usr/bin/python
import sys
range = {}
for line in sys.stdin:
key, value = line.split('\t')
if key in range.keys():
range[key].append(value.split("\n",1)[0])
else:
range[key] = [value.split("\n",1)[0]]
for i in range.keys():
print("Rango " + (i) + ": ")
print(str(ra... | AlbertoGarciaDomenech/Cloud-BigData | Assignment 1/ej4/P4b_reducer.py | P4b_reducer.py | py | 333 | python | en | code | 0 | github-code | 90 |
73427431338 | from turtle import *
def draw_squares():
for i in range(0,5):
forward(300)
right(90)
def draw_smallsquares():
for i in range(0,5):
forward(150)
right(90)
def chakra():
bgcolor('black')
pencolor('yellow')
width(2)
penup()
goto(160,-80)... | Biancaa-R/Turtle-programing-using-python | chakra turtle.py | chakra turtle.py | py | 744 | python | en | code | 0 | github-code | 90 |
13062540217 | def main():
plate = input("Plate: ")
if is_valid(plate):
print("Valid")
else:
print("Invalid")
def GetNumberPlace(s): # gets the place to where a int is found
for i in range(len(s)):
try:
n = int(s[i])
except ValueError:
continue
return i
... | JasonDinoPaws/pythob | CS50/plates.py | plates.py | py | 1,042 | python | en | code | 0 | github-code | 90 |
70902309417 | # Create a program that asks the user for a number from 1 to 100 and
# then prints out a list of all the divisors of that number.
given_number = int(input("Enter the number for division: "))
def print_the_divisors(user_number):
my_list = []
for num in range(1, 101):
if num % user_number == 0 and user... | Crypto-V/Courses | practicepython/exercise4.py | exercise4.py | py | 427 | python | en | code | 0 | github-code | 90 |
18535280739 | x = int(input())
beki = {1}
for b in range(2,32):
for p in range(2,10):
if b**p<=x:
beki.add(b**p)
else:
break
beki = sorted(beki)
print(beki.pop(-1)) | Aasthaengg/IBMdataset | Python_codes/p03352/s697123843.py | s697123843.py | py | 221 | python | en | code | 0 | github-code | 90 |
22449989320 | from keras import backend as K
from keras.utils.generic_utils import get_custom_objects
def obj_localization_loss(y_true, y_pred):
class_scale = 1.
y_true_confidence = y_true[:, 0:1]
y_pred_confidence = y_pred[:, 0:1]
#y_true_coord = y_true[:, 1:4]
#y_pred_coord = y_pred[:, 1:4]
y_t... | kechan/KerasVision | custom_loss/resnet50_localization.py | resnet50_localization.py | py | 1,502 | python | en | code | 0 | github-code | 90 |
45066037808 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.A... | thelostwind/insomnia_repository | insomnia/blog/migrations/0001_initial.py | 0001_initial.py | py | 1,623 | python | en | code | 0 | github-code | 90 |
20137651865 | from odoo import api, fields, models
class IrUiView(models.Model):
_inherit = 'ir.ui.view'
type = fields.Selection(
selection_add=[('amlse',
'AccountMoveLineSearchExtension')])
@api.model
def postprocess(self, model, node, view_id, in_tree_view, model_fields):
... | luc-demeyer/noviat-apps | account_move_line_search_extension/models/ir_ui_view.py | ir_ui_view.py | py | 497 | python | en | code | 20 | github-code | 90 |
13448913068 | import matplotlib.pyplot as plt
import numpy as np
from common import draw_frame
# Every equations that are referenced in this file is based on:
# "Multiple View Geometry in Computer Vision - 2nd edition"
def estimate_H(xy, XY):
#
# Task 2: Implement estimate_H
#
A = np.zeros((xy.shape[... | dinossht/TTK4255---Robotic-Vision | Assignments/ex3/python/main.py | main.py | py | 3,419 | python | en | code | 0 | github-code | 90 |
7621609029 | """
Assign a gWCS object to a science image.
"""
import logging
from astropy import coordinates as coord
from astropy import units as u
import gwcs.coordinate_frames as cf
from gwcs.wcs import WCS, Step
from roman_datamodels import datamodels as rdm
from ..stpipe import RomanStep
from . import pointing
from .utils ... | kmacdonald-stsci/romancal | romancal/assign_wcs/assign_wcs_step.py | assign_wcs_step.py | py | 2,365 | python | en | code | null | github-code | 90 |
28292782294 | #point_distance.py
#gcsadovy
#Garik Sadovy
import arcpy, os, sys
arcpy.env.workspace = "C:\Temp\\ncshape.mdb"
arcpy.env.overwriteOutput = True
output = "C:\Temp"
n=1
while n<=5:
arcpy.PointDistance_analysis("firestations", "schools_wake", output + "\dist{0}.dbf".format(n), "{0} Miles".format(n))
... | gcsadovy/generalPY | point_distance.py | point_distance.py | py | 335 | python | en | code | 0 | github-code | 90 |
3996441368 | #1057
import sys
input = sys.stdin.readline
if __name__ == '__main__':
N, Kim, Lim = map(int, input().strip().split())
round_ = 0
while Kim != Lim :
Kim -= Kim//2
Lim -= Lim//2
round_ += 1
print(round_)
| WonyJeong/algorithm-study | wndnjs9878/soma_study/bj-1057.py | bj-1057.py | py | 246 | python | en | code | 2 | github-code | 90 |
7901404079 | # Future imports
from __future__ import annotations
# Standard library imports
from argparse import ArgumentParser
from typing import cast
from typing import TYPE_CHECKING
# Local imports
from Configuration import Configuration
from Generator import Generator
# Type checking
if TYPE_CHECKING:
from typing import ... | AustinRJakusz/RandString | main.py | main.py | py | 3,834 | python | en | code | 0 | github-code | 90 |
15940178407 | inputList = input("input your list here.make sure it has commas in between each element")
listProper = inputList.split(",")
print("if you want to order from least to greatest press 1")
print("if you want to order from greatest to least press 2")
leastOrGreatest = input("press 1 or 2")
if leastOrGreatest == '1':
li... | nveronline/newlearning | python/sorting.py | sorting.py | py | 529 | python | en | code | 0 | github-code | 90 |
34179852521 | import matplotlib.pyplot as plt
import numpy as np
import torch.nn.functional as F
def plot_img_and_mask(img, mask):
classes = mask.max() + 1
fig, ax = plt.subplots(1, classes + 1)
ax[0].set_title('Input image')
ax[0].imshow(img)
for i in range(classes):
ax[i + 1].set_title(f'Ma... | MaWenhui111/runmodels | Eye-UNet-master/utils/utils.py | utils.py | py | 1,530 | python | en | code | 0 | github-code | 90 |
17964567649 | n=int(input())
s=list(input())
v=[0]
for i in range(1,n):
if s[i]==s[i-1]:
del(v[-1])
v.append(1)
else:
v.append(0)
if v[0]==0:
ans=3
else:
ans=6
for i in range(1,len(v)):
if v[i-1]==0:
ans*=2
elif v[i]==1:
ans*=3
else:
continue
... | Aasthaengg/IBMdataset | Python_codes/p03626/s640772863.py | s640772863.py | py | 379 | python | en | code | 0 | github-code | 90 |
29206709801 | from .base import NessusEndpoint
class AgentsAPI(NessusEndpoint):
def list(self):
'''
Retrieves the list of agent groups configured
Args: None
Returns:
list: Listing of agent group resource records
Examples:
>>>> for agent in nessus.agents.list()... | mguelfi/nsu | build/lib/tenable/nessus/agents.py | agents.py | py | 1,723 | python | en | code | 0 | github-code | 90 |
38964759966 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import numpy as np
logging.basicConfig(level=logging.INFO, format="%(message)s")
class Simplex(object):
''' Nelder-Mead method for numerically determining the optimum. '''
def step(self, points, bounds=No... | andrewhead/hri-project | proto/p6/psiturk-example/algorithms/simplex.py | simplex.py | py | 4,881 | python | en | code | 0 | github-code | 90 |
4316591563 | # -*- coding: utf-8 -*-
import logging
import json
import requests
from .light import Light
log = logging.getLogger(__name__)
class BridgeError(Exception):
def __init__(self, message, errortype=None, address=None, json=None):
super(BridgeError, self).__init__(self, message)
self.message = message... | sebastianw/hue | hue/bridge.py | bridge.py | py | 3,157 | python | en | code | 0 | github-code | 90 |
33479099458 | # Author: Harm Laurense
# Last changed: 08-06-2021
# Usage: This script is used to retrieve the concept ids for corresponding
# participant data. This script should be run after the PDF-data.json is
# obtained by running PDF_to_JSON.py. This script requires the CONCEPT.csv
# and CONCEPT_SYNONYM.csv to be downloade... | sannepost2001/DataIntegration | Semantic_Mapping_PDFdata.py | Semantic_Mapping_PDFdata.py | py | 9,324 | python | en | code | 0 | github-code | 90 |
30836451674 | import bisect
import copy
import itertools
import logging
import numpy as np
import operator
import pickle
import torch.utils.data
from fvcore.common.file_io import PathManager
from tabulate import tabulate
from termcolor import colored
from detectron2.data import samplers
from detectron2.data.catalog import DatasetCa... | lolipopshock/Detectron2_AL | src/detectron2_al/dataset/utils.py | utils.py | py | 3,883 | python | en | code | 41 | github-code | 90 |
29539083506 | #Power digit sum
#Problem 16
#2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
#What is the sum of the digits of the number 21000^1000?
power_digit = 2 ** 1000
digits = [int(i) for i in list(str(power_digit))]
solution = sum(digits)
print(solution) | ninabcdefghi/project-euler | euler16.py | euler16.py | py | 270 | python | en | code | 0 | github-code | 90 |
73679587815 | import sys
from collections import defaultdict
input = sys.stdin.readline
dic = defaultdict(int)
for _ in range(int(input())):
name, extension = input().strip().split('.')
dic[extension] += 1
for key, value in dict(sorted(dic.items())).items():
print(key, value)
| y7y1h13/Algo_Study | 다시 시작/26일차/파일 정리.py | 파일 정리.py | py | 276 | python | en | code | 0 | github-code | 90 |
14553045009 | __author__ = 'Aadit Kapoor'
__version__ = '1.0.0.0'
def compute(word):
'''
compute(str) -> list(int)
Computes the mean of the word and then returns a list
'''
numbers = range(len(word))
flag = 0
total = sum(numbers)
if total % 2 == 0:
flag = 1
mean = total / len(word... | suryaprveen/Projects | venv/lib/python3.5/site-packages/mean.py | mean.py | py | 406 | python | en | code | 0 | github-code | 90 |
146459491 | # -*- coding: utf-8 -*-
from .box import FullBox
from .box import read_uint
# ISO/IEC 14496-12:2022, Section 8.7.3
class SampleSizeBox(FullBox):
box_type = b"stsz"
is_mandatory = False
def read(self, file):
self.sample_size = read_uint(file, 4)
sample_count = read_uint(file, 4)
se... | chemag/pyisobmff | isobmff/stsz.py | stsz.py | py | 811 | python | en | code | 2 | github-code | 90 |
4002924268 | from pandas import *
import glob
import numpy as np
from matplotlib.pyplot import *
folders = glob.glob('/Users/dna/Desktop/Proc/*') #get files
unstable = []
stable = []
for i in folders[:-1]:
#read for the 15th
opn = glob.glob('%s/*15.csv'%i)
stab = read_csv(opn[0])
#read for the 14th
opn = glob.glob('%s... | wolfiex/CoolStuff | NCAS_Atmospheric_Arran/tower.py | tower.py | py | 1,696 | python | en | code | 1 | github-code | 90 |
34873014410 | from pandas import Series
import pandas._testing as tm
def test_pop():
# GH#6600
ser = Series([0, 4, 0], index=["A", "B", "C"], name=4)
result = ser.pop("B")
assert result == 4
expected = Series([0, 0], index=["A", "C"], name=4)
tm.assert_series_equal(ser, expected)
| pandas-dev/pandas | pandas/tests/series/methods/test_pop.py | test_pop.py | py | 295 | python | en | code | 40,398 | github-code | 90 |
41278585053 | import allure
from appium.webdriver.common.touch_action import TouchAction
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from waiting import wait
PADE_LOAD_TIME = 10 # sec
class BasePage:
"""Class with common actions"""
def __init... | arina909/mobile_app_testing_with_appium | pages/base_page.py | base_page.py | py | 1,109 | python | en | code | 0 | github-code | 90 |
71159085737 | #Lucas Roig
#Decomposition
import transvection
import permutation
import operator
import itertools
import time
def matrice_identite(n):
"""n : un entier
renvoie la matrice identite de taille n"""
mat = permutation.matrice_nulle(n)
for i in range(n):
mat[i][i] = 1
return mat
def triangulai... | LucasRoig/DecompositionPLU | decomposition.py | decomposition.py | py | 2,052 | python | fr | code | 0 | github-code | 90 |
40850431131 |
import pygame
import sys
import os
# Initial setup
pygame.init()
# Sets the window title
pygame.display.set_caption('The Star\'s Journey')
# Sets the screen size
screenSize = (800, 600)
screen = pygame.display.set_mode(screenSize)
# Load the background image. Assumes the image is in the 'assets' directory.
backgro... | mrwadepro/ai-gameplay-generator | miniGame/StarGame/run.py | run.py | py | 3,349 | python | en | code | 0 | github-code | 90 |
18269430729 | n = int(input())
nums = list(map(int, input().split()))
result = "APPROVED"
for num in nums:
if (num % 2 == 0) and not ((num % 3 == 0) or (num % 5 == 0)):
result = "DENIED"
break
print(result) | Aasthaengg/IBMdataset | Python_codes/p02772/s262532135.py | s262532135.py | py | 215 | python | en | code | 0 | github-code | 90 |
18101830279 | import sys
input = sys.stdin.readline
#入力と違って0オリジンとなっているので注意
n = int(input())
li = [[0] * n for _ in range(n)] #隣接行列、0オリジン li[i][j]:iからjへの有向グラフがある
for i in range(n):
x, y, *v = [int(x)-1 for x in input().split()]
for j in v:
li[i][j] = 1 #有向グラフがあるところは1、ないところは0となる
from collections import deque
Q = dequ... | Aasthaengg/IBMdataset | Python_codes/p02239/s545538490.py | s545538490.py | py | 1,108 | python | ja | code | 0 | github-code | 90 |
22056619702 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import datetime
import Queue
import os
import json
import sys
import traceback
import requests
import requests.exceptions
# HTTPSConnectionPool(host='s0qrdt.kdndj.com', port=443):
# Max retries exceeded with url: /files/0eccc965d5d8693b2e0cbc9fda97... | reinhardtken/refresh_phone | python/ctp_py/phone.py | phone.py | py | 20,291 | python | en | code | 0 | github-code | 90 |
72603259497 | #! /usr/bin/python3
# behrouz_ashraf
# garpozir@gmail.com
# -*- coding: utf-8 -*-
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
import time
from... | garpoz/telegram-and-insta-bot-in-python | story_insta_selenium.py | story_insta_selenium.py | py | 1,456 | python | en | code | 1 | github-code | 90 |
18109967529 | s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
processes.append([])
s=input()
d=s.split()
processes[i].append(d[0])
processes[i].append(int(d[1]))
cnt=0
i=0
while True:
if processes[0][1]<=q:
end_t+=processes[0][1]
print(processes[0][0],end_t... | Aasthaengg/IBMdataset | Python_codes/p02264/s687315464.py | s687315464.py | py | 526 | python | en | code | 0 | github-code | 90 |
18223542019 | from collections import deque
N, M, Q = map(int, input().split())
I = [list(map(int, input().split())) for _ in range(Q)]
que = deque()
ans = 0
for i in range(1, M+1):
que.append([i])
while que:
seq = que.popleft()
if len(seq) == N:
p = 0
for i in range(Q):
if seq[I[i][1]-... | Aasthaengg/IBMdataset | Python_codes/p02695/s393278854.py | s393278854.py | py | 532 | python | en | code | 0 | github-code | 90 |
8463191746 | from typing import List
from test_framework import generic_test
def search_first_of_k(A: List[int], k: int) -> int:
import bisect
result = bisect.bisect_left(A,k)
if result>len(A)-1:
return -1
elif A[result]==k:
return result
return -1
if __name__ == '__main__':
exit(
... | architjee/EPIJudge | epi_judge_python/search_first_key.py | search_first_key.py | py | 499 | python | en | code | 0 | github-code | 90 |
1469985300 | from django.shortcuts import render
from django.http import HttpResponse
from yaml import serialize
from watchlist_app.models import Watchlist, StreamPlatform, Review
from rest_framework import filters, generics, status, viewsets
from watchlist_app.api import serializers
from rest_framework.response import Response
fro... | TUSHAR-VERMA-star/IMDb-clone | watchlist/watchlist_app/api/views.py | views.py | py | 3,427 | python | en | code | 0 | github-code | 90 |
4970616714 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from models import PCA as PCA_
from sklearn.decomposition import PCA
from logrep import preprocessing
from models import DecisionTree
import pandas as pd
import numpy as np
log_name = "../logrep/MCV_hdfsPP-sequential.npz.npz"
dataset = np... | gencau/log6309e_replication | demo/PCA_demo.py | PCA_demo.py | py | 2,123 | python | en | code | 0 | github-code | 90 |
75120622696 | """ Training SAR model
"""
import os, shutil
import warnings
warnings.filterwarnings("ignore")
# i/o paths
sar_dir = '/home/zhouyj/software/SAR_TED'
shutil.copyfile('config_eg.py', os.path.join(sar_dir, 'config.py'))
# train params
gpu_idx = 0
num_workers = 10
zarr_path = '/data/bigdata/eg_train-samples.zarr'
ckpt_di... | YijianZhou/SAR_TED | example_workdir/3_train_eg.py | 3_train_eg.py | py | 516 | python | en | code | 12 | github-code | 90 |
27022311288 | #User function Template for python3
'''
Your task is to return the count of number
of islands in the given boolean grid.
Function Arguments: A (boolean grid), N -> no of rows, M -> no of columns.
Return Type: Integer denoting the number of islands
Contributed By: Nagendra Jha
'''
import sys
sys.set... | riturajkush/Geeks-for-geeks-DSA-in-python | Graph DS/Find the number of islands.py | Find the number of islands.py | py | 1,971 | python | en | code | 1 | github-code | 90 |
37867926070 | from openpyxl import Workbook, load_workbook,styles
import os
import copy
import math
from openpyxl.utils import get_column_letter, column_index_from_string
from PyQt5.QtGui import QFont
from PyQt5.QtCore import Qt
def get_key(wb,valid_sheets,base_info):
sheet_names = valid_sheets
# print(sheet_names)
dict_... | makalo/pyqt5-excel | utils.py | utils.py | py | 4,290 | python | en | code | 15 | github-code | 90 |
35308845597 | ##############################################################
# solve script for kringlecon 2020 vending-machine challenge #
##############################################################
import subprocess
import signal
import time
cipher = "LVEdQPpBwr"
solution = ""
for index in cipher:
# solution starts at ""... | rmccarth/kringlecon2020 | unpreparedness-room/json-cipher/solve.py | solve.py | py | 2,929 | python | en | code | 0 | github-code | 90 |
18198522329 | n = int(input())
A = list(map(int, input().split()))
A.sort()
l = [False]*(A[n-1] + 1)
fix = []
for i in A:
if l[i]:
fix.append(i)
l[i] = True
for i in range(A[n-1]+1):
if l[i]:
for j in range(i*2, A[n-1]+1, i):
l[j] = False
for i in fix:
l[i] = False
ans = [i for... | Aasthaengg/IBMdataset | Python_codes/p02642/s431264751.py | s431264751.py | py | 370 | python | en | code | 0 | github-code | 90 |
7411377538 | """Define test fixtures for RainMachine."""
from unittest.mock import AsyncMock, patch
import pytest
from homeassistant.components.rainmachine import DOMAIN
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
from homeassistant.setup import async_setup_component
from tests.common impo... | muehlen/core | tests/components/rainmachine/conftest.py | conftest.py | py | 1,847 | python | en | code | null | github-code | 90 |
36753017823 | """core audio service.
This handles playback of audio and speech
"""
from core.util import (
check_for_signal,
reset_sigint_handler,
start_message_bus_client,
wait_for_exit_signal
)
from core.util.log import LOG
from core.util.process_utils import ProcessStatus, StatusCallbackMap
import core.audio... | g3ar-v/__core__ | core/audio/__main__.py | __main__.py | py | 1,786 | python | en | code | 0 | github-code | 90 |
29155747591 | # %%
import pandas as pd
nba = pd.read_csv('nba_all_elo.csv')
city_revenues = pd.Series(
[4200, 8000, 6500],
index=['Amsterdam', 'Toronto', 'Tokyo']
)
# %%
# Series data has many different aggregation methods
print(city_revenues.sum())
print(city_revenues.max())
# %%
# Dataframe columns act as Series
poin... | jagman014/PythonProjects | Guides/DataScienceGuides/PandasIntroGuide/grouping_and_aggregation.py | grouping_and_aggregation.py | py | 718 | python | en | code | 0 | github-code | 90 |
70484315178 | __all__ = ["FixedLengthModel"]
import torch
from torch import nn
from src.models.base.model import PredictionModel
class FixedLengthModel(PredictionModel):
def __init__(self, num_hidden: int, lr: float, weight_decay: float):
super().__init__()
self.save_hyperparameters()
self.layers = nn... | Magnushhoie/MLOps_sequences | src/models/ffnn/model.py | model.py | py | 625 | python | en | code | 2 | github-code | 90 |
72208094058 | """
给你两个二进制字符串,返回它们的和(用二进制表示)。
输入为 非空 字符串且只包含数字 1 和 0。
示例 1:
输入: a = "11", b = "1"
输出: "100"
示例 2:
输入: a = "1010", b = "1011"
输出: "10101"
提示:
每个字符串仅由字符 '0' 或 '1' 组成。
1 <= a.length, b.length <= 10^4
字符串如果不是 "0" ,就都不含前导零。
"""
class Solution:
def addBinary(self, a: str, b: str) -> str:
al, bl = le... | Asunqingwen/LeetCode | 简单/二进制求和.py | 二进制求和.py | py | 1,239 | python | zh | code | 0 | github-code | 90 |
5366929116 | import numpy as np
class HashingBonusEvaluator(object):
"""Hash-based count bonus for exploration.
Tang, H., Houthooft, R., Foote, D., Stooke, A., Chen, X., Duan, Y., Schulman, J., De Turck, F., and Abbeel, P. (2017).
#Exploration: A study of count-based exploration for deep reinforcement learning.
I... | openai/EPG | epg/exploration.py | exploration.py | py | 2,153 | python | en | code | 241 | github-code | 90 |
5101049518 | n=int(input())
sd={}
for i in range(n):
si=''.join(sorted(list(input())))
sd[si]=sd.get(si, 0)+1
ans=0
for v in sd.values():
if(v>1):
ans+=((v*(v-1))//2)
print(ans) | WAT36/procon_work | procon_python/src/atcoder/virtual/ABC137_C.py | ABC137_C.py | py | 185 | python | de | code | 1 | github-code | 90 |
10695192267 | #!/usr/bin/env python3.6
import time
WAIT_SECONDS=5
args = []
def handle_args():
import sys
return sys.argv
from aquachain.aquatool import AquaTool
def format_tx(t):
s = ""
s += "["+t['hash'] + "]" + '\n'
s += "from :"+t['from'] + '\n'
s += "to :"+t['to'] + '\n'
if t['input'] != '0x':
s += "d... | aquachain/aquachain.py | examples/radar.py | radar.py | py | 1,905 | python | en | code | 2 | github-code | 90 |
248983459 | import os
import scipy
import obspy
import pyasdf
import numpy as np
import pandas as pd
from numba import jit
import matplotlib.pyplot as plt
from scipy.fftpack.helper import next_fast_len
'''
performs beamforming to estimate the ray slowness vector of a plane wave (assumption)
across a dense array at user-defined f... | chengxinjiang/Jiang_Kanto_anisotropy | src/figure3_beamforming_CCFs.py | figure3_beamforming_CCFs.py | py | 9,966 | python | en | code | 2 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.