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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
11540490270 | from DirectedGraphClass import *
#***********************************************************************#
# Bellman-Ford Algorithm #
#***********************************************************************#
#Provide the number of vertices
numberOfVertices = 5
#Select s... | GauthamBT/Bellman-Ford-Algorithm | GraphMainProgram.py | GraphMainProgram.py | py | 527 | python | en | code | 0 | github-code | 13 |
74908647696 | import requests
from lxml import etree
import re
import asyncio
import aiohttp
import aiofiles
import os
from urllib.parse import urljoin
from Crypto.Cipher import AES
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0... | TBSAAA/Web-crawler | case/async_movie.py | async_movie.py | py | 6,368 | python | en | code | 0 | github-code | 13 |
10520673424 | from database.db_wrapper import DBwrapper
from threading import Thread
from main import logger, stop_and_restart
def admin_method(func):
"""Decorator for marking methods as admin-only methods, so that strangers can't use them"""
def admin_check(bot, update):
db = DBwrapper.get_instance()
user ... | Deses/PG40x30 | pg40x30/commands/adminCommands.py | adminCommands.py | py | 927 | python | en | code | 0 | github-code | 13 |
9129757917 | from telegram import *
from telegram.ext import *
from requests import *
updater = Updater(token="5369531550:AAFdpCUzqBJxcG0th98XQGddqZc3vSRBwKI")
dispatcher = updater.dispatcher
allowedUsernames = [1241390756,1030952653]
# this commands is use to
print("Bot starting.....................\n")
# print(Update._effective... | Vbhargavj/python | Project/telegrambot/gtu.py | gtu.py | py | 11,153 | python | en | code | 1 | github-code | 13 |
70095272337 | import threading
"""
Semaphore 是用于控制进入数量的锁
文件,读,写,写一般只是用于一个线程写,读可以允许有多个,
做爬虫,控制并发数量
semaphore的acqiure和release方法有点不一样,减法原理,加法原理
semaphore内部的实现是用的condition
Queue也是内部实现是用的condition,看Queue源码
"""
import time
class HtmlSpider(threading.Thread):
def __init__(self, url, sem):
super().__init__()
self.url =... | Zbiang/Python-IO | multi-threaded and multi-process/thread_semaphore.py | thread_semaphore.py | py | 1,068 | python | en | code | 0 | github-code | 13 |
31943868580 | from functools import cache
from typing import List
# @lc code=start
class Solution:
def atMostNGivenDigitSet(self, digits: List[str], n: int) -> int:
s = str(n)
@cache
def f(i: int, is_limit: bool, is_num: bool) -> int:
if i == len(s):
# 如果填了数字,则为 1 种合法方案
... | wylu/leetcodecn | src/python/p900to999/902.最大为-n-的数字组合.py | 902.最大为-n-的数字组合.py | py | 1,277 | python | zh | code | 3 | github-code | 13 |
22334892595 | #Leetcode 853. Car Fleet
class Solution1:
def carFleet(self, target: int, position: List[int], speed: List[int]) -> int:
stack = []
for pos, s in sorted(zip(position, speed))[::-1]:
print(pos,s)
dist = target - pos
if not stack:
stack.append(dist ... | komalupatil/Leetcode_Solutions | Medium/Car Fleet.py | Car Fleet.py | py | 841 | python | en | code | 1 | github-code | 13 |
32073838436 | # Evaluation on output images from conditional diffusion model
# Using DeepFace emotion prediction from https://github.com/serengil/deepface
import os
import wandb, torch
from ddpm_conditional import *
from fastcore.all import *
from modules import *
from fer_data import fer_dataset
from embedding_utils import prepare... | TangYihe/CS230 | eval.py | eval.py | py | 7,100 | python | en | code | 4 | github-code | 13 |
14463320442 | from abc import abstractmethod
from typing import Callable, Dict, Iterable, Mapping, Optional, Tuple, Union
import numpy as np
import torch
from torch import nn
from torch.functional import Tensor
from tqdm import tqdm
from neuroaiengines.utils.signals import create_decoding_fn
import pandas as pd
#pylint: disable=no... | aplbrain/seismic | neuroaiengines/optimization/torch.py | torch.py | py | 19,212 | python | en | code | 0 | github-code | 13 |
30604684176 | import pygame
from pygame.locals import *
import sys
pygame.init()
WINDOW_TITLE = "Basic Controls"
MAX_FPS = 120
BG_COLOR = (255, 255, 255)
SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 720
SCREEN = pygame.display.set_mode((1280, 720), flags=SRCALPHA)
PAPER = pygame.Surface(size=(SCREEN_WIDTH, SCREEN_HEIGHT), flags=SRCALPHA)
PA... | metalvexis/PygameBasics | basic/basic_controls.py | basic_controls.py | py | 2,554 | python | en | code | 0 | github-code | 13 |
39740397717 | import os
import math
import operator
import datetime
import itertools
import random
from copy import deepcopy
from collections import defaultdict
from django.utils.safestring import mark_safe
from . import utils
from .models import *
ordinal = lambda n: "{}{}".format(n,"tsnrhtdd"[(n//10%10!=1)*(n%10<4)*n%10::4])
cl... | esitarski/RaceDB | core/series_results.py | series_results.py | py | 14,230 | python | en | code | 12 | github-code | 13 |
41843057732 | """
Chapter 3
Zynab Ali
"""
def main():
# Number range corresponds to day of week
day = int(input('\nEnter a number between 1 and 7:'))
if day == 1:
print('Monday\n')
elif day == 2:
print('Tuesday\n')
elif day == 3:
print('Wednesday\n')
elif day == 4:
print('Thur... | xen0bia/college | csce160/lab3/c3e1.py | c3e1.py | py | 571 | python | en | code | 0 | github-code | 13 |
39556678789 | # coding: utf-8
import pandas as pd
import re
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, StandardScaler, Imputer
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score
from collections impo... | MMAesawy/Kaggle-Titanic | console.py | console.py | py | 4,270 | python | en | code | 0 | github-code | 13 |
42286224562 | from dash import Dash, html, dcc
import dash
import os
external_stylesheets = ['https://bootswatch.com/5/flatly/bootstrap.min.css']
app = Dash(__name__,use_pages=True,external_stylesheets=external_stylesheets)
server = app.server
app.layout = html.Div([
html.H1('Quantibike - Analysis Dashboards'),
html.Div(... | Nomandes/quantibike-dash | app/app.py | app.py | py | 649 | python | en | code | 0 | github-code | 13 |
73663006096 | import pandas as pd
import numpy as np
from alphaml.engine.components.data_preprocessing.imputer import impute_df, impute_dm
from alphaml.engine.components.data_manager import DataManager
def test_impute_df():
df = pd.DataFrame(np.random.randn(5, 3), index=['a', 'c', 'e', 'f', 'h'],
columns... | dingdian110/alpha-ml | test/data_preprocessing/test_imputer.py | test_imputer.py | py | 1,498 | python | en | code | 1 | github-code | 13 |
16508169573 | from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QPen, QBrush
from PyQt5.QtWidgets import QWidget
class GradientWindow(QWidget):
def __init__(self, screen, controller):
super().__init__()
self.controller = controller
self.setAttribute(Qt.WA_NativeWindow)
self.screen ... | pmineev/GradientScreensaver | gradient_window.py | gradient_window.py | py | 847 | python | en | code | 0 | github-code | 13 |
32335979038 | from sympy import symbols, simplify, oo
from sympy.solvers import solve
Gf = symbols('G_f') # filler modulus
Gm = symbols('G_m') # matrix modulus
G = symbols('G') # composite modulus
[t, s] = symbols(['t', 's'], positive=True) # exponents in Kotula model
phif = symbols('phi_f', positive=True) # filler fraction
ph... | msecore/python | 432/kotula_fit.py | kotula_fit.py | py | 710 | python | en | code | 0 | github-code | 13 |
20972566309 | import re
from copy import copy
from pathlib import Path
from bootstrapy.templates import get_templates
from bs4 import BeautifulSoup, Comment, Tag
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
""" <ul>
<li>
<a class="text-... | evanr70/bootstrapy | src/bootstrapy/pages.py | pages.py | py | 5,610 | python | en | code | 0 | github-code | 13 |
71585932819 | # coding=utf-8
"""只取训练集和测试集中出现的用户ID"""
"""
event_attendees.csv文件:共5维特征
event_id:活动ID
yes, maybe, invited, and no:以空格隔开的用户列表, 分别表示该活动参加的用户、可能参加的用户,被邀请的用户和不参加的用户.
"""
import pandas as pd
import numpy as np
import scipy.sparse as ss
import scipy.io as sio
# 保存数据
import cPickle
from sklearn.preprocessing import norma... | JerryCatLeung/Event-Recommentation-Engine-Challenge | 6event_attendees.py | 6event_attendees.py | py | 1,845 | python | zh | code | 1 | github-code | 13 |
3922700607 | # python program to calculate ROI
# FIRST IS INCOME,
#Then calculate Expenses
# Then calculate Investments
# finally return cashflow*12/investments
from roicalculator import ROICalculator
def main():
print("Welcome To BIGGER POCKETS!")
name = input("Enter your name to get started: ").strip().title()
proper... | dylan-dot-c/ROI_Calculator | roi.py | roi.py | py | 543 | python | en | code | 0 | github-code | 13 |
17245028016 | import math
t = {"C": ['P','L'], "P":['R','S'], "R":['L','C'], "L":['S','P'], "S":['C','R']}
n = int(input())
h=[[]]
for i in range(n):
inputs = input().split()
numplayer = int(inputs[0])
signplayer = inputs[1]
h[-1]+=[(numplayer,signplayer)]
for i in range(int(math.log(n, 2))):
h+=[[]]
for a,b... | DJAHIDDJ13/CG | training/easy/rock-paper-scissors-lizard-spock/solution_0.py | solution_0.py | py | 716 | python | en | code | 0 | github-code | 13 |
5221101728 | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') ... | QuangAnhP/Uni | Python/Misc/main.py | main.py | py | 889 | python | en | code | 0 | github-code | 13 |
4791245108 | #!/usr/bin/python
# -*- coding: utf-8 -*-
class Solution(object):
def run(self, data: list) -> list:
result = []
for i in set(data):
n = data.count(i)
if n > 2:
n = 2
result.extend([i] * n)
return result
if __name__ == ... | LeroyK111/BasicAlgorithmSet | 代码实现算法/remove-duplicates-from-sorted-array-i.py | remove-duplicates-from-sorted-array-i.py | py | 418 | python | en | code | 1 | github-code | 13 |
16465594943 | from flask import Flask, render_template, redirect, url_for, session, request,flash,abort
from model.goods import queryAll, Goods, countG
from flask_paginate import Pagination, get_page_args
from model.tools import delexcel, DBSession,isfile,deleteTable
from model.pages import Pagination
from flask import Blueprint
f... | q513021617/FlaskTaoBaokeSite | controller/home/homeProxy.py | homeProxy.py | py | 2,421 | python | en | code | 1 | github-code | 13 |
6639455535 | import os
# --- Coeficiente Binomial(nCr) --- #
def ncr(a, b):
## --- Calculadora Factorial --- ##
def f(n):
if n <= 1:
return n
else:
return n * f(n - 1)
### --- Variables factoriales --- ###
c = a - b
fac_a = f(a)
fac_b = f(b)
fac_c = f(c)
... | Cervantes21/Estadistica_computacional | distribucion-binomial/binomial.py | binomial.py | py | 833 | python | en | code | 1 | github-code | 13 |
71497062739 | # 언어 : Python
# 날짜 : 2021.09.17
# 문제 : KOREATECH JUDGE > 카드 정리(1150번)
# 소요시간: 4' 36"
# ==============================================================
def solution():
remove_list = ["A", "E", "I", "O", "U"]
string = input()
cnt = 0
for i, s in enumerate(string):
if s.upper() in remove_list:
... | eunseo-kim/Algorithm | Koreatech Judge/카드정리.py | 카드정리.py | py | 457 | python | ko | code | 1 | github-code | 13 |
2817842385 | from app.utils import parse_args, get_arg_parser, init_es
from app.shards import scan_shard, get_shards_to_routing
if __name__ == '__main__':
parser = get_arg_parser()
args = parse_args(parser)
es = init_es(args)
shards_to_routing = get_shards_to_routing(es, args.index, args.doc_type)
jobs = []... | amityo/es-parallel-scan | sync.py | sync.py | py | 562 | python | en | code | 3 | github-code | 13 |
5848201 | import markdown
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from apps.folders.folders import select_folder
from apps.folders.models import Folder
from app... | jamescrg/minhome | apps/notes/views.py | views.py | py | 5,358 | python | en | code | 0 | github-code | 13 |
19272757890 | class Solution:
def climbStairs(self, n: int) -> int:
prev1, prev2 = 1, 2 # n = 1 & n = 2 answer
steps = 0
arr = [prev1, prev2] # preset known answers
for i in range(2, n): # start DP from unknown ans
prev1, prev2 = arr[-1], arr[-2]
steps = p... | ytchen175/leetcode-pratice | 0070-climbing-stairs/0070-climbing-stairs.py | 0070-climbing-stairs.py | py | 439 | python | en | code | 0 | github-code | 13 |
17061214934 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.RecipientInfoOrder import RecipientInfoOrder
class UserInvoiceInfoOrder(object):
def __init__(self):
self._address = None
self._bank_account = None
se... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/UserInvoiceInfoOrder.py | UserInvoiceInfoOrder.py | py | 4,593 | python | en | code | 241 | github-code | 13 |
73492621776 | # Identical Sentences
# Find by Path Compression
def Find(u,parent):
if parent[u]==-1:
return u
parent[u]=Find(parent[u],parent)
return parent[u]
# Union by Rank
def Union(x,y,rank,parent):
if rank[x]>rank[y]:
parent[y]=x
elif rank[x]<rank[y]:
parent[x]=y
else:
... | Ayush-Tiwari1/DSA | Days.41/1.Identical-Sentences.py | 1.Identical-Sentences.py | py | 1,651 | python | en | code | 0 | github-code | 13 |
21521003593 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, Model, optimizers
# (1)标准卷积模块
def conv_block(input_tensor, filters, alpha, kernel_size=(3, 3), strides=(1, 1)):
# 超参数alpha控制卷积核个数
filters = int(filters * alpha)
# 卷积+批标准化+激活函数
x = layers.Conv2D(filters,... | yuyun2000/kws | model.py | model.py | py | 7,479 | python | en | code | 1 | github-code | 13 |
2462872761 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 5 11:08:46 2015
@author: Ryan-Rhys
"""
import numpy
import matplotlib
from matplotlib import pyplot as plt
wj = [0,2.9,4.0,8.9]
fj = [9.7,4.95,41.55,207.76]
gj = [3.21,0.67,2.22,8.50]
wj2 = [0,3.87,8.37,23.46]
fj2 = [40.11,59.61,122.55,1031.19]
gj2 = [0,2.62,6.41,27.57... | Ryan-Rhys/Nanoparticle-Systems | Parsegian_Comparison_Script.py | Parsegian_Comparison_Script.py | py | 2,651 | python | en | code | 2 | github-code | 13 |
16456833715 |
###########################################################################
# 1)Дан список слов который вводит пользователь.
# Напишите программу, которая создает новый список, содержащий только уникальные слова из исходного списка.
# ВАРИАНТ 1
# a = {'Apple', 'Mango', 'Mango', 'Banana', 'Banana', 'Orange'}
# b = {'... | DiasGonzales/Lessons | 3_lesson_HM.py | 3_lesson_HM.py | py | 2,244 | python | ru | code | 0 | github-code | 13 |
38540539445 | import math
import random
import time
import sys
import copy
from functools import reduce
##############
# Game Board #
##############
class Board(object):
# Class constructor.
#
# PARAM [2D list of int] board: the board configuration, row-major
# PARAM [int] w: the board width
# P... | Oporto/IndustrialRobotics | pysource/alpha_beta_agent.py | alpha_beta_agent.py | py | 10,333 | python | en | code | 1 | github-code | 13 |
19446201125 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 28 12:38:50 2017
@author: T366159
"""
''' ### PROJET PREDICTION RETARDS DE VOLS ### '''
''' ############################# IMPORTS ######################################### ... | OthmaneZiyati/Flight-Delay-Prediction- | V2_annexes.py | V2_annexes.py | py | 14,447 | python | en | code | 0 | github-code | 13 |
15343389004 | from pptx import Presentation
import copy
from pptx.dml.color import RGBColor
def replace_text_in_slide(slide, replacement_dict, font, font_color):
# замена шаблонного текста на сгенерированный
for shape in slide.shapes:
if shape.has_text_frame:
for paragraph in shape.text_frame.paragraphs... | Max3xis/Present-It | custom_layouts.py | custom_layouts.py | py | 3,999 | python | en | code | 1 | github-code | 13 |
41503350985 | """Working with hash values."""
from redis import Redis
from redis_python_tutorial.logger import LOGGER
def hash_values_demo(r: Redis):
"""
Create a Redis hash value.
:param Redis r: Remote Redis instance.
"""
record = {
"name": "Hackers and Slackers",
"description": "Mediocre tu... | hackersandslackers/redis-python-tutorial | redis_python_tutorial/data/hash.py | hash.py | py | 542 | python | en | code | 23 | github-code | 13 |
16510630924 | import heapq
from typing import List, final
import math
def kClosest(points: List[List[int]], k: int) -> List[List[int]]:
"""
Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).
The distance between two... | tmbothe/Data-Structures-and-algorithms | src/heap/k-points_from_the_origin.py | k-points_from_the_origin.py | py | 1,118 | python | en | code | 0 | github-code | 13 |
14851081345 | class Student():
def set_student(self,rol,name,course):
self.rol=rol
self.name=name
self.course=course
def get_student(self):
print(self.rol,",",self.name,",",self.course)
obj=Student()
obj.set_student(101,"rizni","django")
obj.get_student()
#set_student()
#this method is performe... | rizniyarasheed/python | oops/stud.py | stud.py | py | 964 | python | en | code | 0 | github-code | 13 |
10328220257 | from dataclasses import dataclass
from typing import Callable, Optional, List, Dict, Any, Iterator
import ray
from ray.data.block import Block
from ray.data.context import DatasetContext
from ray.data._internal.compute import (
ComputeStrategy,
TaskPoolStrategy,
ActorPoolStrategy,
)
from ray.data._internal... | machallboyd/ray | python/ray/data/_internal/execution/operators/map_operator_state.py | map_operator_state.py | py | 8,006 | python | en | code | null | github-code | 13 |
73801664338 | import contextlib
import fnmatch
import logging
import os
from collections import OrderedDict
from schema import And
from schema import Or
from deployer.plugins.plugin_with_tasks import PluginWithTasks
from deployer.rendering import render
from deployer.result import Result
LOGGER = logging.getLogger(__name__)
@co... | jbenden/deployer | src/deployer/plugins/matrix.py | matrix.py | py | 4,257 | python | en | code | 2 | github-code | 13 |
9023373884 | def lengthOfLongestSubstring(s):
len_s = len(s)
sub_string = {}
for i in range(len_s):
for j in range(i,len_s):
a = s[i:j+1]
if len(set(a)) == len(a):
a_len = len(a)
sub_string[a] = a_len
max_value = max(sub_string.values())
max_ke... | animeshmod/python-practice | longest_substring.py | longest_substring.py | py | 2,449 | python | en | code | 0 | github-code | 13 |
34631904692 | from django.shortcuts import render, redirect, get_object_or_404
from .models import Post, Comment
from .forms import BlogPostForm, BlogCommentForm
from django.utils import timezone
from django.contrib.auth.decorators import login_required
# Create your views here.
def show_posts(request):
posts = Post.objects.fi... | declanmunroe/django_blog | blog/views.py | views.py | py | 3,885 | python | en | code | 0 | github-code | 13 |
18123156804 | class window:
def __init__(self, sli):
self.window = tuple(sli)
#*************************************
def upvotes(n, k, *args):
if len(args) != n:
print("# of days of upvotes != n")
return
days = list(args)
windows = []
for index in range(len(days)-k+1):
windows... | imchrisgao/upvotes | upvotes.py | upvotes.py | py | 1,477 | python | en | code | 0 | github-code | 13 |
26251368589 | '''
Computes max. configurations for chip design via rectangle packing problem solver.
'''
import rectpack
import time
import sys
import os
CHIPWIDTH = None # 2400 # 3200
CHIPHEIGHT = None # 2400 # 3200
ROTATION_ALLOWED = None # False
CORE_ORDER = ["big", "A72", "Mali", "LITTLE"]
PACKING_ALGORITHM = None # rectpack... | sglitzinger/corepacking | rectpacker.py | rectpacker.py | py | 7,739 | python | en | code | 0 | github-code | 13 |
9713673616 | import os
import json
from flask import Flask, request, session, url_for, redirect, render_template, abort, g, flash, _app_ctx_stack
from model import *
app = Flask(__name__)
# configuration
DEBUG = True
SECRET_KEY = 'development key'
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os... | jamesshuang/ChatRoom | chat.py | chat.py | py | 4,462 | python | en | code | 0 | github-code | 13 |
17176282185 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask.ext.seasurf import SeaSurf
from flask.ext.oauth import OAuth
from vksunshine.config import VK_BASE_URL, VK_ACCESS_TOKEN_URL, VK_AUTHORIZE_URL, \
VK_REQUEST_TOKEN_PARAMS, VK_CONSUMER_KEY, VK_CONSUMER_SECRET
__all__ = ['csrf', 'oaut... | klinkin/vksunshine | vksunshine/extensions.py | extensions.py | py | 695 | python | en | code | 0 | github-code | 13 |
35628587540 | import turtle
from math import *
from tractrix import tract1, tract0,transf_ang
curva = 82
# Dados do Cavalo
lfrontal = 2.49 # Largura frontal
eixof = 0.91 # Recuo do eixo em relação a frente do veículo
d_eixo = 4 # Distância entre eixos
ltraseira = 2.49 # Largura traseira
eixot = 0.91 # Recuo do eixo em relação... | rafaeldjsm/Engenharia | Geometria_Estradas/tractrix_cm.py | tractrix_cm.py | py | 2,168 | python | pt | code | 0 | github-code | 13 |
24586608105 | import tkinter as tk
from tkinter import *
m=tk.Tk()
m.title('session1')
con=tk.Canvas(m,width=150,height=50)
button = tk.Button(m, text='submit', width=25)
lbl=tk.Label(m,text='fname',background='red')
var1=IntVar()
var2=IntVar()
Checkbutton(m,text='male', variable=var1).grid(row=3,column=0)
Checkbutton(m,te... | elihe90/TKINIER_python_ITC | session1.py | session1.py | py | 675 | python | en | code | 1 | github-code | 13 |
37996306518 | # $Id$
# This jobO should not be included more than once:
include.block( "MinBiasD3PDMaker/MinBiasD3PD_prodJobOFragment.py" )
# Common import(s):
from AthenaCommon.JobProperties import jobproperties
prodFlags = jobproperties.D3PDProdFlags
from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName
# Set up a logger:... | rushioda/PIXELVALID_athena | athena/PhysicsAnalysis/D3PDMaker/MinBiasD3PDMaker/share/MinBiasD3PD_prodJobOFragment.py | MinBiasD3PD_prodJobOFragment.py | py | 14,918 | python | en | code | 1 | github-code | 13 |
22035710885 | operations = ['+', '-', '*', '/']
class Number:
def __init__(self, num, steps):
self.value = num
self.steps = steps
def getValue(self):
return self.value
def getSteps(self):
return self.steps
def calculate(self, rhs_Num, operator):
rhs = rhs_Num.getValue(... | Renu-R/Countdown-numbers | numbers_solver.py | numbers_solver.py | py | 2,259 | python | en | code | 0 | github-code | 13 |
1027838379 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
def find_create_post(driver):
footer = driver.find_eleme... | Bigsamme/Angelas-Blog | fun/main.py | main.py | py | 3,982 | python | en | code | 0 | github-code | 13 |
21721276597 | # this code will accept an input string and check if it is a plandrome
# it will then return true if it is a plaindrome and false if it is not
def reverse(str1):
if(len(str1) == 0):
return str1
else:
return reverse(str1[1:]) + str1[0]
string = input("Please enter your own String : ")
# chec... | jmusila/simple-logic-tests | palindrome/is_palindrome.py | is_palindrome.py | py | 513 | python | en | code | 0 | github-code | 13 |
40927726143 | import pandas as pd
from lib.exp.summary import Summary
from lib.exp.evaluator.slide_coverage import SlideCoverage as Scov
class _Scov(Scov):
def __init__(self, gnd, pre_ns=None, pre_ws=None):
"""
pre_ns: preprocessing number of slides
pre_ws: preprocessing number of switeches
"""
... | speed-of-light/pyslider | lib/exp/evaluator/xframes/scov.py | scov.py | py | 1,866 | python | en | code | 2 | github-code | 13 |
43262366292 | def main():
ans = "Takahashi"
if A > C or (A == C and B > D):
ans = "Aoki"
return print(ans)
if __name__ == '__main__':
A, B, C, D = map(int, input().split())
main()
| Shirohi-git/AtCoder | abc241-/abc245_a.py | abc245_a.py | py | 197 | python | en | code | 2 | github-code | 13 |
40345978584 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The kv_seek_account_history command allows to query the KV 'History of Accounts' table."""
import argparse
import context # pylint: disable=unused-import
from silksnake.helpers.dbutils import tables
from silksnake.remote import kv_metadata
from silksnake.remote import... | torquem-ch/silksnake | tools/kv_seek_account_history.py | kv_seek_account_history.py | py | 1,827 | python | en | code | 3 | github-code | 13 |
41632729325 | # Core Pkgs
import streamlit as st
import plotly.express as px
# sklearn version = 0.24.2
px.defaults.template='plotly_dark'
px.defaults.color_continuous_scale='reds'
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# EDA Pkgs
import pandas as pd
import numpy as np
import seabo... | ALKelompok6/repo | app.py | app.py | py | 6,942 | python | id | code | 0 | github-code | 13 |
38838298232 | # coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
import subprocess
import re
CONTROL_RE = re.compile(r'^\s*(\S+)\s*\((\S+)\)\s*:(.*)$')
MENU_RE = re.compile('^\s*(\S+)\s*:(.*)$')
class WebcamSettingsPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.Temp... | rryk/OctoPrint-Webcam-Settings | octoprint_webcam_settings/__init__.py | __init__.py | py | 2,008 | python | en | code | 0 | github-code | 13 |
5840019726 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
def show_image(image):
plt.imshow(image)
plt.show()
img_rgb = cv2.imread('fuf.png')
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
template = cv2.imread('out.png', 0)
height, width = templa... | fr1ht/WindowCensor | ipExample/cv2_matching.py | cv2_matching.py | py | 692 | python | en | code | 0 | github-code | 13 |
38305261279 | import requests
import datetime
# dict with the location name as keys and the swiss1903 coordinates as values
locations = {"Rapperswil OST Campus": (704301, 231052),
"Rapperswil Seebad": (704077, 231654),
"Schmerikon Badi": (714163, 231433),
"Insel Lützelau Nordost": (703019, 232... | ElectryFresh/WCIE | main.py | main.py | py | 3,307 | python | en | code | null | github-code | 13 |
71764524177 | from random import randint
from random import random
def roll():
val = randint(0,20)
return val
class Character(object):
def __init__(self, name, strength, armor, speed, health):
self.name = name
self.strength = strength
self.armor = armor
self.speed = speed
self.he... | rjfische/Python-Projects | first_game.py | first_game.py | py | 3,220 | python | en | code | 0 | github-code | 13 |
21675514312 | import sys
input = sys.stdin.readline
def backtracking(t, idx):
if len(t) == m:
answer.add(t)
return
for i in range(idx, n):
if not visited[i]:
visited[i] = 1
backtracking(t + (arr[i],), i+1)
visited[i] = 0
answer = set()
n, m = map(int, input().split())
arr = sorted(list(map(int,... | SangHyunGil/Algorithm | Baekjoon/baekjoon_15664(backtracking).py | baekjoon_15664(backtracking).py | py | 423 | python | en | code | 0 | github-code | 13 |
16707517506 | """
Written by Lorenzo Vainigli for the Facebook Hacker Cup 2020 Qualification Round
This program provides a correct solution for the following problem:
https://www.facebook.com/codingcompetitions/hacker-cup/2020/qualification-round/problems/A
"""
import time
filename = "travel_restrictions"
DEBUG = False
BIGINPUT =... | lorenzovngl/meta-hacker-cup | 2020/qualification_round/travel_restrictions/travel_restrictions.py | travel_restrictions.py | py | 3,326 | python | en | code | 1 | github-code | 13 |
37630221922 | from __future__ import print_function
import configparser
import traceback
import json
import pprint
import rospy
from std_msgs.msg import String, Bool
from heartbeat import Heartbeat
from itri_mqtt_client import ItriMqttClient
from ctrl_info02 import CtrlInfo02
from ctrl_info03 import CtrlInfo03
from can_checker impor... | wasn-lab/Taillight_Recognition_with_VGG16-WaveNet | src/utilities/fail_safe/src/fail_safe_checker.py | fail_safe_checker.py | py | 10,290 | python | en | code | 2 | github-code | 13 |
9134263670 | import math, random, types, pymunk
import actors,sound,rooms
from helpers import *
debug=debugFlags["shot"]
class hitSpark(actors.Actor):
def __init__(self,space,x,y,dt=1/120):
actors.Actor.__init__(self,space,x,y,dt)
self.anim=[ loadImage('assets/shots/hitspark1.png'),
loadImag... | Derpford/memelords | shots.py | shots.py | py | 8,177 | python | en | code | 0 | github-code | 13 |
17158939757 | import numpy as np
import matplotlib.pyplot as plt
ax = plt.axes(projection='3d')
def plot_frame_2d(rotmat_2d, translation, plt_basis=False, plt_show=False):
r1 = np.array([[0],[0]])
r2 = np.array([[1],[0]])
r4 = np.array([[0],[1]])
dx = translation[0,0]
dy = translation[1,0]
d1 = np.array([... | Phayuth/robotics_manipulator | rigid_body_transformation/plot_frame.py | plot_frame.py | py | 2,286 | python | en | code | 0 | github-code | 13 |
71430574739 | import kachery as ka
import spikeextractors as se
import h5py
import numpy as np
from .mdaextractors import MdaSortingExtractor
from ...pycommon.load_nwb_item import load_nwb_item
class AutoSortingExtractor(se.SortingExtractor):
def __init__(self, arg):
super().__init__()
self._hash = None
... | flatironinstitute/ephys-viz | widgets/pycommon/autoextractors/autosortingextractor.py | autosortingextractor.py | py | 4,298 | python | en | code | 6 | github-code | 13 |
74449765457 | import os
import logging
from airflow import DAG
from airflow.utils.dates import days_ago
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
from airflow.providers.google.cloud.operators.bigquery import BigQueryCreateExternalTableOperator, BigQueryInsertJobOperator # ... | LeviScoffie/Data-Engineering-StepbyStep | week3_data_warehouse_bigquery/airflow/dags/gcs_to_bq_dag.py | gcs_to_bq_dag.py | py | 3,920 | python | en | code | 0 | github-code | 13 |
41619169126 | import pygame
from settings import *
from support import import_folder
from math import sin
class Player(pygame.sprite.Sprite):
def __init__(self, pos, surface, create_jump_particles, change_health, change_stamina) -> None:
super().__init__()
self.import_character_assets()
self.fr... | AgustinSande/sandeAgustin-pygame-tp-final | codefiles/player.py | player.py | py | 6,453 | python | en | code | 0 | github-code | 13 |
14880612077 | import socket
import json
from select import select # работает со всем у чего есть файловый дескриптор .fileno()
# https://docs.python.org/3/howto/sockets.html
# https://docs.python.org/3/library/socket.html#module-socket
# https://www.youtube.com/watch?v=ZGfv_yRLBiY&list=PLlWXhlUMyooawilqK4lPXRvxtbYiw34S8&index=1
# ... | ekomissarov/edu | some-py-examples/socket-example/socserv-eventloop-select.py | socserv-eventloop-select.py | py | 2,540 | python | ru | code | 0 | github-code | 13 |
10300626146 | from datetime import datetime, timedelta
from pg_statviz.tests.util import mock_dictrow
from pg_statviz.modules.cache import calc_ratio
tstamp = datetime.now()
data = [mock_dictrow({'blks_hit': 150000, 'blks_read': 14000,
'snapshot_tstamp': tstamp + timedelta(seconds=10)}),
mock_dictrow(... | vyruss/pg_statviz | src/pg_statviz/tests/test_cache.py | test_cache.py | py | 982 | python | en | code | 23 | github-code | 13 |
10213639508 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 11 20:30:28 2017
@author: Anders
"""
import pandas as pd
import os
print ('importing data')
os.chdir('/Users/Anders/Dropbox/Projects/CPD_QC/sql2/Data_imports')
'''
SEQUENCING DATA
'''
fields = {'Pos': float, 'Alt': str, 'Gene_name': str, 'Chro... | meyer-anders/CPD_QC | get_reads.py | get_reads.py | py | 2,011 | python | en | code | 0 | github-code | 13 |
38702388675 | #!/usr/bin/env python
import math
import json
import Queue
import threading
FRAME_LOCAL_NED = 1
MAV_CMD_CONDITION_YAW = 115
MAV_CMD_DO_SET_ROI = 201
downloaded = False
q = Queue.Queue()
def print_json():
while True:
msg = q.get()
print(json.dumps(msg))
t = threading.Thread(target=print_json,args=())... | waTeim/flying-monkey | 3DR/droneAPI.py | droneAPI.py | py | 5,358 | python | en | code | 0 | github-code | 13 |
31384655159 | import pandas as pd
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.graphics.api import qqplot
#Read the file
data = pd.read_csv('1231.csv', parse_dates=['date'])
#rename the coloumns
dta = data['tmin']
dta_year = data['date']
begin_year = dta... | sungho93/Temperature-prediction-based-on-spark | Temp_pridiction.py | Temp_pridiction.py | py | 1,060 | python | en | code | 0 | github-code | 13 |
73554656656 | from Manejafacultades import manejador
if __name__=='__main__':
man=manejador()
man.cargar()
man.mostrar()
print("---Menu de opciones---")
print("1:Mostrar carreras que se dicatan en una facultad")
op=input("ingrese opción de menu:")
while op !="0":
if op=="1":
... | Merypi/UNIT3 | Main.py | Main.py | py | 454 | python | es | code | 0 | github-code | 13 |
36262650132 | import numpy
from numpy.linalg import norm, eig, svd, eigh
normalize = lambda v: v/norm(v)
sqlength = lambda v: numpy.sum(v*v)
from chimerax.core.state import State
class Plane(State):
"""A mathematical plane
The 'origin_info' must either be a point (numpy array of 3 floats) or an array/list
of at l... | HamineOliveira/ChimeraX | src/bundles/geometry/src/plane.py | plane.py | py | 3,824 | python | en | code | null | github-code | 13 |
33946751040 | import tkinter as tk
from tkinter.filedialog import askopenfilename
import spc
import numpy as np
import matplotlib.pyplot as plt
from spectrumFit import baseline
class Baseline(tk.Frame):
def __init__(self, parent, *args, **kwargs):
tk.Frame.__init__(self, parent, *args, **kwargs) # Frame initializatio... | MarcG-LBMC-Lyos/Spectrum_Analysis | src/Baseline.py | Baseline.py | py | 2,445 | python | en | code | 0 | github-code | 13 |
20987100461 | from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth import login as auth_login
from django.contrib.auth import logout
from django.utils.translation import gettext_lazy ... | lcorralesg/django-contactos | CRUD/views.py | views.py | py | 3,239 | python | es | code | 0 | github-code | 13 |
44397871875 | import time
import numpy as np
import torch
from tqdm import tqdm
from tree_based_sampling import construct_tree, construct_tree_fat_leaves
from kndpp import kndpp_mcmc
from utils import load_ndpp_kernel, get_arguments
def TEST_kndpp_real_dataset(dataset='uk', k=10, random_state=1, ondpp=False, min_num_leaf=8, num_s... | insuhan/ndpp-mcmc-sampling | demo_kndpp.py | demo_kndpp.py | py | 1,536 | python | en | code | 0 | github-code | 13 |
41854054460 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='challenge-calc',
version='0.1.0',
author="mconsta000",
author_email="",
packages=setuptools.find_packages(),
license='MIT',
long_description=long_description,
long_description_... | mconsta000/challenge_calc | setup.py | setup.py | py | 803 | python | en | code | 0 | github-code | 13 |
3801215013 | import argparse
import json
import sys
from . import optimisations
from . import solver
from .direction import Axis, Direction
from .template import EdgeMode, EdgeModeType
from .util import implies, increment_number, invert_components, set_all_false, set_number, set_numbers_equal
def ensure_loop_length(grid: solver.... | R-O-C-K-E-T/Factorio-SAT | factorio_sat/make_block.py | make_block.py | py | 6,101 | python | en | code | 323 | github-code | 13 |
8303233984 | import pygame
from constantes import *
from client_player import Player
from client_asteroid import Asteroid
import os
from client_stub import StubClient
import time
pygame.font.init()
BACKGROUND = pygame.transform.scale(pygame.image.load(os.path.join("images", "background-black.png")), (WIDTH, HEIGHT))
class Ui:
... | tandrade855/SD2023-asteroid | Novo_jogo/ui.py | ui.py | py | 4,019 | python | en | code | 0 | github-code | 13 |
21675780622 | import sys, time
from collections import defaultdict, deque
input = sys.stdin.readline
def inverse(a, b):
graph[a][b] = 1
graph[b][a] = 0
indegree[b] += 1
indegree[a] -= 1
def topology_sort():
queue = deque([])
visited = [0] * (n+1)
answer = []
for i in range(1, n+1):
if not in... | SangHyunGil/Algorithm | Baekjoon/baekjoon_4195(union find).py | baekjoon_4195(union find).py | py | 1,480 | python | en | code | 0 | github-code | 13 |
73114885776 | class Array:
def __init__(self):
self.length=0
self.data=dict()
def __str__(self):
return str(self.__dict__)
#This will print the attributes of the array class(length and data) in string format when print(array_instance) is executed
def get(self,index):
... | KayWei2000/vigilant-octo-chainsaw | DS-and-Algo-Python/Arrays/Implementation.py | Implementation.py | py | 1,024 | python | en | code | 0 | github-code | 13 |
19628698693 | listanomi = []
listalanci = []
studenti = 0
lanci = 0
x = 1
while x == 1:
studenti += 1
lanci += 1
print("Inserire il nome dello studente", studenti,": ")
studente = input()
print("Inserire il lancio in metri dello studente:", lanci, ": ")
lancio = int(input())
listanomi.append(studente)
... | albertozelioli/Esercizi-pag.73-pt.2 | es28.py | es28.py | py | 604 | python | it | code | 0 | github-code | 13 |
37130045928 | from modulefinder import IMPORT_NAME
from typing import Text
from numpy import save
import streamlit as st
import pandas as pd
import base64, random
import time, datetime
from pyresparser import ResumeParser
from pdfminer3.layout import LAParams, LTTextBox
from pdfminer3.pdfpage import PDFPage
from pdfminer3.pdfinterp ... | erikchan1000/resume-parser | flask-server/server.py | server.py | py | 3,001 | python | en | code | 0 | github-code | 13 |
11442194981 | from lucent.optvis import objectives
import torch
@objectives.wrap_objective()
def neuron(layer, n_channel, offset=(0, 0), batch=None):
"""Visualize a single neuron of a single channel.
Defaults to the center neuron. When width and height are even numbers, we
choose the neuron in the bottom right of the c... | patrickmineault/your-head-is-there-to-move-you-around | lucentpatch/objectives.py | objectives.py | py | 3,476 | python | en | code | 11 | github-code | 13 |
17042293474 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.DeliveryAgencyMerchantInfo import DeliveryAgencyMerchantInfo
from alipay.aop.api.domain.DeliveryBaseInfo import DeliveryBaseInfo
from alipay.aop.api.domain.DeliveryConfig import Del... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayMarketingActivityDeliveryCreateModel.py | AlipayMarketingActivityDeliveryCreateModel.py | py | 7,034 | python | en | code | 241 | github-code | 13 |
27954501743 | import telebot, time
import sqlite3
from book_stikers import *
from config import *
from book import *
from btn import *
from hh_parsing import parse_data
from handle_data import handel_vacancies
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def start(message):
connect = sqlite3.connect(... | TumashenkaAliaksandr/vacancy_pars_bot | bot.py | bot.py | py | 4,035 | python | en | code | 1 | github-code | 13 |
73912528979 | import requests
import datetime
import lib.btc_validator
#------------------------------------------------------------------------------
_Debug = False
#------------------------------------------------------------------------------
LatestKnownBTCPrice = None
#------------------------------------------------------... | datahaven-net/recotra | lib/btc_util.py | btc_util.py | py | 5,357 | python | en | code | 4 | github-code | 13 |
17509395743 | from os import system, name
from fistacuffs_pkg.character_class import Character
"""
File is for some of the larger text block to help keep main code readable
Also contains display control functions
"""
def clear():
"""
clear the console screen function copied from
https://www.geeksforgeeks.org/clear-scr... | cbowen216/Fisticuffs | fistacuffs_pkg/display.py | display.py | py | 7,636 | python | en | code | 0 | github-code | 13 |
37473531924 | class Scanner():
#Assuming that rotation preceded translation
def __init__(self):
self.beacons = []
self.rotatedBeacons = []
self.translatedBeacons = []
self.currentRotation = ((0,1,2),(1,1,1))
self.currentTranslation = (0,0,0)
self.transformedBeaconSet = set()
... | Chromega/adventofcode | 2021/Day19/day19.py | day19.py | py | 5,254 | python | en | code | 0 | github-code | 13 |
25697381924 | #!/usr/bin/env python3
import subprocess
if __name__ == '__main__':
cmd = subprocess.Popen("/snap/openldap/current/bin/ldapsearch -L -Y EXTERNAL -H ldapi:/// -b 'dc=my-domain,dc=com'", shell=True, stdout=subprocess.PIPE)
for line in cmd.stdout:
if b"numEntries" in line:
new = line.decode("... | spiculedata/openldap-charm | scripts/count_objects.py | count_objects.py | py | 364 | python | en | code | 1 | github-code | 13 |
26884056595 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import glob
import re
from os.path import join
from pathlib import Path
from typing import Union, List, Optional, Dict
import gdal # # ogr
import numpy as np
import os
import osr
from dtran.metadata import Metadata
from funcs.topoflow.nc2geotiff import nc2geotiff
from tqdm i... | mintproject/MINT-Transformation | funcs/topoflow/write_topoflow4_climate_func.py | write_topoflow4_climate_func.py | py | 20,531 | python | en | code | 3 | github-code | 13 |
42987370180 |
from vanilla.dialogs import *
glyphsWithSupportLayer = "w"
inputFonts = getFile(
"select UFOs", allowsMultipleSelection=True, fileTypes=["ufo"])
print("Glyphs that shouldn't be in layer `support.w.middle`:")
def checkFont(f):
print("\n", f.info.styleName)
problems = []
for layer in f.layers:
... | arrowtype/recursive | src/00-recursive-scripts-for-robofont/checking-similarity-between-fonts/check-support-layer-for-glyphs.py | check-support-layer-for-glyphs.py | py | 869 | python | en | code | 2,922 | github-code | 13 |
2327646466 | import MetaTrader5 as mt5
import time
from datetime import datetime
import telegram
import pytz
import schedule
import login
# DEFINE GLOBAL CONSTANTS
message_html = ""
def connect():
if not mt5.initialize(
login=login.login_id,
server=login.server,
password=login.login_pw,
portab... | jfengg3/mt5-fx-telebot | get_mt5_opentrades.py | get_mt5_opentrades.py | py | 2,233 | python | en | code | 5 | github-code | 13 |
21466582012 | """
Specializers for various sorts of data layouts and memory alignments.
These specializers operate on a copy of the simplified array expression
representation (i.e., one with an NDIterate node). This node is replaced
with one or several ForNode nodes in a specialized order.
For auto-tuning code for tile size and Op... | markflorisson/minivect | minivect/specializers.py | specializers.py | py | 56,778 | python | en | code | 19 | github-code | 13 |
7659277482 | # encoding: utf-8
"""
URL conf for django-sphinxdoc.
"""
from django.conf.urls import patterns, url
from django.views.generic import ListView
from sphinxdoc import models
from sphinxdoc.views import ProjectSearchView
project_info = {
'queryset': models.Project.objects.all().order_by('name'),
'context_object... | omji/django-sphinxdoc | sphinxdoc/urls.py | urls.py | py | 1,277 | python | en | code | 0 | github-code | 13 |
26533928885 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from alignment import *
import multiprocessing as mp
from numpy import random
from xkcdrgb import xkcd_rgb
class Node():
def __init__(self,name=None,root=False):
self.name=name
self.ancestor='ROOT'
self.descendents=[]
self.branch_length=None
self.root=root
c... | AdityaLankapalli/Ttrip-BAC | Tree.py | Tree.py | py | 9,059 | 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.