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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
20869179523 | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
smartstorelogin_url = 'https://nid.naver.com/nidlogin.login?url=https%3A%2F%2Fsell.smartstore.naver.com%2F%23%2FnaverLoginC... | hdh4545/SSAutomation | findxpath.py | findxpath.py | py | 1,724 | python | en | code | 0 | github-code | 36 |
27792793140 | import random
import os
from model import *
from world import *
import numpy as np
import torch
import matplotlib.pyplot as plt
from datetime import datetime
mem, nomem, mem_vd, nomem_vd = [False, False, False, False]
mem = True
env_title = 'Tunl Mem'
if mem or nomem:
ld = 40
elif mem_vd or nomem_vd:
len_dela... | dongyanl1n/sim-tunl | run.py | run.py | py | 7,488 | python | en | code | 2 | github-code | 36 |
73988252904 | known_user = ["elice", "bob", "don", "mond", "Malcom", "rees", "dewy","francis"]
while True:
print("Hi! My name is Shakib")
name = input("What is your name? :").strip().capitalize()
if name in known_user:
print("Hello{}!".format(name))
remove = input("Would like to remove from the sy... | Mobinulalamfaisal/travis-project | travis_project.py | travis_project.py | py | 928 | python | en | code | 0 | github-code | 36 |
44207415083 | import simplejson as json
import datetime
def postReports(vo):
from app import db, session
try:
print('post report')
print(vo[0:10])
# SQL запросы
session['sql_raw_reports_post'] = "insert into forecast.forecast_report_dates (report_date, forecast_date) values (date('" + sess... | vizalerd/ifc | server/components/postReports.py | postReports.py | py | 832 | python | en | code | 0 | github-code | 36 |
19525909188 | from sqlalchemy.orm import Session
from fastapi import APIRouter, Depends, status
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions a... | GeumBinLee/test | youtube/router.py | router.py | py | 3,630 | python | en | code | 0 | github-code | 36 |
8567341457 | import numpy as np
import pandas as pd
from scipy.stats import norm
from sklearn.preprocessing import MinMaxScaler
from dash import ALL
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
from contents.app import *
@app.callback(
Output('var-plot-sliders-container', 'ch... | ThomasHuggett/Quant-Toolkit-main | contents/_analysis_tools/distributions.py | distributions.py | py | 7,532 | python | en | code | 0 | github-code | 36 |
38807167453 | #%% [markdown]
# We need to create bar charts for our fancy plot to show the fraction of stuff from
# each region. We'll do that here.
#%%
group_ids_to_plot = [0, 431, 88, 299, 9]
#%%
from ltcaesar import read_data_from_file
import numpy as np
import matplotlib.pyplot as plt
#%%
# Setup our favourite stylesheet
plt.... | JBorrow/lagrangian-transfer-paper | figures/plotgen/create_bar_charts_fancy.py | create_bar_charts_fancy.py | py | 1,612 | python | en | code | 1 | github-code | 36 |
1842938709 | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField
from wtforms.validators import DataRequired
from wtforms import ValidationError
class MyEmailValidation(object):
def __init__(self, message=None):
if not message:
message = "Email isn't valid."
se... | a-yarohovich/control-panel | core/app/create_users/forms.py | forms.py | py | 773 | python | en | code | 0 | github-code | 36 |
8597208595 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 3 16:57:23 2022
@author: manthanprasad
"""
list1 = [25, -42, 31, 0, -85, 69]
for num in list1:
if num >= 0:
print(num, end = " ") | Manthan-prasad/MyCaptainAssaignmets-python- | PositiveNumbersInRange.py | PositiveNumbersInRange.py | py | 226 | python | en | code | 0 | github-code | 36 |
38732705628 | import time
def task_duration(start_time: float, end_time: float) -> None:
"""
Calculates the duration of a task given the start and end times.
Parameters:
start_time (float): The start time of the task in seconds.
end_time (float): The end time of the task in seconds.
Returns:
No... | IgMann/MLOps-MNIST-project | Deployment/task_duration.py | task_duration.py | py | 952 | python | en | code | 0 | github-code | 36 |
25547162312 | from operator import itemgetter, attrgetter
class Student:
def __init__(self, name, grade, age):
self.name = name
self.grade = grade
self.age = age
def __repr__(self):
return repr((self.name, self.grade, self.age))
def t_sorted():
print(sorted([5, 2, 3, 1, 4]))
a = [... | cool8sniper/coolpython | coolpthon/others/sorted_t.py | sorted_t.py | py | 1,225 | python | en | code | 1 | github-code | 36 |
34837660944 | from IPython.display import clear_output
def basic_info():
print("Welcome to Tic Tac Toe Board Game.")
choice = "Wrong"
choice1 = 'Wrong'
while choice != 'Y':
user1 = input("Please Your Name as User 1: ")
choice = input(f"Your Name is {user1}, Correct? Y or N: ").upper()
while choice... | aajmlao/Notes-for-learning-Python | project1.py | project1.py | py | 2,942 | python | en | code | 0 | github-code | 36 |
5784044260 | import atexit
import logging.config
import logging.handlers
import os
import tempfile
import zmq
import slivka
_context = zmq.Context()
atexit.register(_context.destroy, 0)
class ZMQQueueHandler(logging.handlers.QueueHandler):
def __init__(self, address, ctx: zmq.Context = None):
ctx = ctx or _context
... | bartongroup/slivka | slivka/conf/logging.py | logging.py | py | 3,460 | python | en | code | 7 | github-code | 36 |
22782452778 | #
# @lc app=leetcode id=110 lang=python3
#
# [110] Balanced Binary Tree
#
# https://leetcode.com/problems/balanced-binary-tree/description/
#
# algorithms
# Easy (44.61%)
# Likes: 3301
# Dislikes: 217
# Total Accepted: 550.2K
# Total Submissions: 1.2M
# Testcase Example: '[3,9,20,null,null,15,7]'
#
# Given a bin... | Zhenye-Na/leetcode | python/110.balanced-binary-tree.py | 110.balanced-binary-tree.py | py | 2,045 | python | en | code | 17 | github-code | 36 |
1194624429 | """
Definitions of the GA4GH protocol types.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import json
import inspect
from sys import modules
import google.protobuf.json_format as json_format
import google.protobuf.message as message
... | ga4ghpoc/server | ga4gh/protocol.py | protocol.py | py | 10,280 | python | en | code | null | github-code | 36 |
21907570627 | diccionario = {"telam": {"ultimas": "http://www.telam.com.ar/rss2/ultimasnoticias.xml",
"politica": "http://www.telam.com.ar/rss2/politica.xml",
"sociedad": "http://www.telam.com.ar/rss2/sociedad.xml",
"economia": "http://www.telam.com.ar/rss2/e... | alvarezfmb/edd-untref | TP/TP-2-Alvarez-Buljubasic-Rombola/tp2/config.py | config.py | py | 2,833 | python | en | code | 0 | github-code | 36 |
12338761878 | ################011011100110010101101111####
### neo Command Line #######################
############################################
def getcmdlist():
cmds = {
"f" :"Find And Replace : Find and replace in family parameters.",
"froxl" :"Family Replacer : Open Excel file.",
... | 0neo/pyRevit.neoCL | neoCL.extension/neocl_f.py | neocl_f.py | py | 1,152 | python | en | code | 7 | github-code | 36 |
35941618047 | from flask import Flask, render_template, url_for, flash, redirect, request, session, make_response
from flask_wtf.file import FileField, FileAllowed
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from flask_bcrypt import Bcrypt
from flask_wtf import FlaskForm
from wtforms import StringField, Pa... | infknight/SILT | app.py | app.py | py | 37,771 | python | en | code | 0 | github-code | 36 |
74332199142 | from Bio import SeqIO
import sys
def readin_fasta(input_file, batch_size):
"""Read fasta file with a fast, memory-efficient generator."""
title_list = []
seq_list = []
seq_num = len([1 for line in open(input_file) if line.startswith(">")])
for i, seq_record in enumerate(SeqIO.FastaIO.SimpleFastaPa... | elond/11785_Project | data_processing/encoding_convert/readin_fasta.py | readin_fasta.py | py | 697 | python | en | code | 0 | github-code | 36 |
6519474113 | from core_functions import Chain, Reel
from tabulate import tabulate
from colorama import init as colorama_init, Fore
class ChainOutput():
# constant: colorama colours for output
COLORS = {
"element": Fore.LIGHTWHITE_EX,
"element_loop": Fore.LIGHTYELLOW_EX,
"edge": Fore.LIGHTBLACK_EX,
... | jahinzee/FourHasFourLetters | outputs.py | outputs.py | py | 2,885 | python | en | code | 0 | github-code | 36 |
28522630327 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.datasets.dataset import Dataset
from opus_core.resources import Resources
from opus_core.choice_model import ChoiceModel
from opus_c... | psrc/urbansim | urbansim_parcel/models/development_project_proposal_choice_model.py | development_project_proposal_choice_model.py | py | 7,581 | python | en | code | 4 | github-code | 36 |
39140033433 | import argparse
import os
from time import sleep
# === subroutines ===
def collect_files_for_removal(root: str) -> tuple[list[str], list[str]]:
if not os.path.exists(root):
return ([], [])
res_files = list()
res_folders = list()
for (dir_path, dirs, files) in os.walk(root, topdown=False):
... | vpa-research/jsl-spec-generated | clear.py | clear.py | py | 1,122 | python | en | code | 0 | github-code | 36 |
73521408425 | import numpy as np
import pandas as pd
import os
import cv2
import re
import torch
import torchvision
from torchvision import transforms
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection import FasterRCNN
from torchvision.models.detection.rpn import AnchorGenerato... | fparaggio/wind-turbine-detector | src/wind_turbine_detector/pipelines/train/nodes.py | nodes.py | py | 7,569 | python | en | code | 0 | github-code | 36 |
11378821861 | def wrap(string, max_width):
"""
Takes in a string of length n and an integer
max_width < n, and returns the string wrapped
with lines no longer then max_width chars.
Parameters
----------
string : string
Input string.
max_width : int
Max number of chars before insertin... | scouvreur/hackerrank | python/strings/text_wrap.py | text_wrap.py | py | 743 | python | en | code | 1 | github-code | 36 |
31474544931 | #!/home/apollo/anaconda3/bin/python3
#-*- coding: utf-8 -*-
#******************************************************************************
# Author : jtx
# Create : 2020-03-31 19:05
# Last modified: 2020-04-09 14:18
# Filename : patent_kbp.py
# Description : 专利-->企业 关系添加
#*****************************... | RogerJTX/KbpPipeline_ExpertSystem | patent/patent_relation.py | patent_relation.py | py | 10,621 | python | en | code | 3 | github-code | 36 |
26072099672 | from PySide2 import QtWidgets
from PySide2.QtCore import Signal
# widget to get input for vector 3 types
class Vector3Widget(QtWidgets.QWidget):
# Signals
on_value_changed = Signal(tuple)
_main_layout = None
def __init__(self, value=(0, 0, 0)):
QtWidgets.QWidget.__init__(self)
self... | JonathanVeit/building_generator | scripts/gui/Vector3Widget.py | Vector3Widget.py | py | 1,746 | python | en | code | 0 | github-code | 36 |
13758234528 |
def sliding_window(img, size, step):
xall = np.expand_dims(img, axis=0)
for y in range(0, 280, step):
for x in range(0, 280, step):
x1n = np.copy(img)
x1n = np.expand_dims(x1n, axis=0)
x1n[:,y:y + size, x:x + size]=0
xall= np.concatenate((xall, x1n), axis=0)
return xa... | andobrescu/Leaf-Counting | Learning_box _vis.py | Learning_box _vis.py | py | 1,801 | python | en | code | 4 | github-code | 36 |
36683998868 | import os
import json
from typing import List
from datetime import datetime
import pandas as pd
#############Load config.json and get input and output paths
with open('config.json','r') as f:
config = json.load(f)
input_folder_path = config['input_folder_path']
output_folder_path = config['outpu... | wonyoungseo/ex-risk-assessment-ml-model-deployment-monitoring-system | ingestion.py | ingestion.py | py | 2,461 | python | en | code | 0 | github-code | 36 |
23228731915 | import sys
import time
import random
import pygame
from event_listener import event_listener
from functions import render_all, one_dimensional_list, update_frames
sys.path.insert(1, 'player')
from yoshi import Yoshi
from movement import move_all, set_direction, move
sys.path.insert(1, 'eggs')
from egg import Egg
... | mignoe/Games | yoshi-snake-game/game.py | game.py | py | 2,214 | python | en | code | 3 | github-code | 36 |
11303986062 | from enum import Enum
import logging
from pathlib import Path
from transitions import Machine
from ..config import ALBUM_FOLDER_NAME_TEMPLATE
from ..config import MUSIC_PATH_NAME
from ..config import TRACK_FILE_NAME_TEMPLATE
from ..config import VA_ALBUM_FOLDER_NAME_TEMPLATE
logger = logging.getLogger(__name__)
c... | pisarenko-net/cdp-sa | hifi_appliance/state/ripper.py | ripper.py | py | 5,818 | python | en | code | 0 | github-code | 36 |
74226159463 | import argparse
import utils
parser = argparse.ArgumentParser(description="User need to submit job informations")
parser.add_argument('--min', type=int, required=True, help='min num of nodes')
parser.add_argument('--max', type=int, required=True, help="max num of nodes")
parser.add_argument('--N', type=int, required=T... | BFTrainer/BFTrainer | BFSub.py | BFSub.py | py | 1,166 | python | en | code | 3 | github-code | 36 |
6939797470 | from threading import Thread
from flask import Flask, render_template
from tornado.ioloop import IOLoop
from bokeh.embed import server_document
from bokeh.layouts import column
from bokeh.plotting import figure
from bokeh.server.server import Server
from bokeh.themes import Theme
import numpy as np
from bokeh.models... | marnatgon/Senior-Design | software/example/flask/mqtt.py | mqtt.py | py | 1,891 | python | en | code | 0 | github-code | 36 |
22985216912 | from collections import deque
from threading import Thread
class Sequencer:
def __init__(self, name):
self.name = name
self.file = open(name, "wb")
self.queue = deque()
self.running = False
self.byte_sequence = []
self.thread = Thread(target=self._writer_thread)
... | muthuprabhu-kp/FTOU | Server/ByteSequencer.py | ByteSequencer.py | py | 2,482 | python | en | code | 0 | github-code | 36 |
27551532420 | import rdiffweb.test
from rdiffweb.core.model import RepoObject, UserObject
class SettingsTest(rdiffweb.test.WebCase):
login = True
def test_page(self):
self.getPage("/settings/" + self.USERNAME + "/" + self.REPO)
self.assertInBody("General Settings")
self.assertStatus(200)
def t... | ikus060/rdiffweb | rdiffweb/controller/tests/test_page_settings.py | test_page_settings.py | py | 3,100 | python | en | code | 114 | github-code | 36 |
28786462902 | import pandas as pd
import geopandas as gpd
import osmnx as ox
from h3 import h3
from rich.progress import track
from urbanpy.utils import geo_boundary_to_polygon
from typing import Sequence, Union
__all__ = [
"merge_geom_downloads",
"filter_population",
"remove_features",
"gen_hexagons",
"merge_sh... | EL-BID/urbanpy | urbanpy/geom/geom.py | geom.py | py | 15,013 | python | en | code | 85 | github-code | 36 |
35658675778 | """The emails tests module."""
import pytest
from tests.fixtures.auth import USER_EMAIL
from communication.notifications.email import mail_managers, mail_user
from users.models import User
pytestmark = pytest.mark.django_db
def test_mail_managers(mailoutbox):
"""Should send an email to the system managers."""
... | webmalc/d8base-backend | communication/tests/email_tests.py | email_tests.py | py | 1,000 | python | en | code | 0 | github-code | 36 |
31482133421 | # 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
# distributed under the Li... | pamarquez/pipelineHW | components/aws/sagemaker/batch_transform/src/batch_transform.py | batch_transform.py | py | 2,183 | python | en | code | 0 | github-code | 36 |
34056654418 | import math
import torch
import torch.nn as nn
class PositionalEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_len=5000):
super().__init__()
self.dropout = nn.Dropout(p=dropout)
position = torch.arange(max_len).unsqueeze(1)
div_term = torch.exp(torch.arange(0, d... | yutotom/COVID-19-Forecasts | deep_learning/nets.py | nets.py | py | 4,463 | python | en | code | 0 | github-code | 36 |
16129130585 | # from pandas import *
# from pylab import *
# import numpy as np
# from matplotlib import pyplot as plt
# mpl.rcParams['font.sans-serif'] = ['SimHei'] # 加载中文字体的神奇呀
# idx = Index(np.arange(1,7))
# df = DataFrame(np.random.randn(6, 2), index=idx, columns=['', 'count'])
# valss = np.array([['总数', 100], ['嘿嘿', 10], ['流皮'... | czasg/ScrapyLearning | czaSpider/dump2/数据分析个人版/诚信数据咯/画图抱佛脚.py | 画图抱佛脚.py | py | 7,890 | python | en | code | 1 | github-code | 36 |
10084194961 | ##풀었지만 채은이 답이랑 유사해서 그 대신 시간 초과됐던것 올림!!
import sys
input = sys.stdin.readline
n = int(input())
n_num = list(map(int, input().split()))
m = int(input())
m_num = list(map(int, input().split()))
num = list(set(m_num) - set(n_num))
result = []
for i in m_num:
if i not in num:
result.append(1)
else:
... | papillonthor/Cool_Hot_ALGO | hcCha/s5_10815_숫자카드.py | s5_10815_숫자카드.py | py | 408 | python | ko | code | 2 | github-code | 36 |
5356541322 | import sys
import re
import random
"""This method is used to split the data into training and testing dataset.
It takes 2 parameters i.e a 2D array containing sentences along with their labels and factor which is the split factor.
The split factor tells in what ratio we need to divide the testing and training da... | f2015712/Sentiment-Analysis-using-Naive-Bayes | naive_bayes.py | naive_bayes.py | py | 7,673 | python | en | code | 0 | github-code | 36 |
23551410868 | def main():
plate = input("Plate: ")
if is_valid(plate):
print("Valid")
else:
print("Invalid")
def is_valid(s):
s_len = len(s)
# must contain a max of 6 and min 2 characters(letters or numbers)
if 6 <= len(s) >= 2:
aa = is_nospecial(s)
... | YonatanAfewerk/The-Full-Learning-Path | Back End/2. Python/CS50 With Python/Week2/pset/plates/plates.py | plates.py | py | 1,923 | python | en | code | 0 | github-code | 36 |
38665711112 | # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import,
print_function)
import six
__license__ = 'GPL v3'
__copyright__ = '2021, Jim Miller'
__docformat__ = 'restructuredtext en'
import logging
logger = logging.getLogger(__name__)
import re
import threa... | JimmXinu/FanFicFare | calibre-plugin/config.py | config.py | py | 85,977 | python | en | code | 664 | github-code | 36 |
27278263299 | import redis
class RedisClient:
def __init__(self):
self.client = redis.Redis(
host='127.0.0.1',
port=6379,
db=0
)
def db_health(self):
if self.client.ping():
print("PONG")
else:
print("Connection failed to db")
| kliu2python/allsee | utils/redis_client.py | redis_client.py | py | 315 | python | en | code | 0 | github-code | 36 |
5514686481 | import numpy as np
def create_mandelbrot(size, maxiter):
"""
Create a mandelbrot set covering the given rectangle.
The rectangle is defined by the characters x1, y1, x2, y2, where
(x1, y1) are the coordinates of the top-left corner, and (x2, y2)
are the coordinates of the bottom-right corner.
... | copilot-deboches/algoritimos | python/mandelbrot_set.py | mandelbrot_set.py | py | 699 | python | en | code | 0 | github-code | 36 |
70811192105 | #!/usr/bin/env python2
# vim:fileencoding=utf-8
import logging
import datetime
from google.appengine.api import xmpp
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import taskqueue
import gaetalk
import config
import utils
class XMPPSub(web... | lilydjwg/gaetalk | chatmain.py | chatmain.py | py | 4,035 | python | en | code | 22 | github-code | 36 |
9340019814 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 21 11:01:53 2017
@author: PiotrTutak
"""
import numpy as np
import scipy.linalg as lg
import matplotlib.pyplot as plt
print("Podaj L1 L2 L3 L4")
L=[float(x) for x in input().strip().split()]
print('Podaj k S q alfa tInf')
k,S,q,alfa,tInf=(float(x) for x in input().stri... | ptutak/MES | zad01.py | zad01.py | py | 748 | python | en | code | 0 | github-code | 36 |
43823721553 | import json
import random
import re
import os
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from tqdm import tqdm
import requests
from template import *
proxies = {
'http': '127.0.0.1:9898',
'https': '127.0.0.1:9898',
}
ori_keys = json.load(open("../../data/120_key1.json"))
keys ... | bigdante/nell162 | backup/verification/chatgpt_gen_yes_no/utils.py | utils.py | py | 5,313 | python | en | code | 0 | github-code | 36 |
1854382 | def read_reversed_graph(edge_number):
graph = {}
for i in range(edge_number):
v1, v2 = map(str, input().split())
graph[v2] = graph.get(v2, []) + [v1]
return graph
def define_ancestor(tree, v1, v2):
q1 = [v1]
q2 = [v2]
while q1[-1] != q2[-1]:
if tree.get(q1[-... | andrewsonin/4sem_fin_test | _19_tree_common_ancestor.py | _19_tree_common_ancestor.py | py | 704 | python | en | code | 0 | github-code | 36 |
74704594025 | import pandas as pd
import numpy as np
import regex as re
# the usual import horror in python
# https://stackoverflow.com/questions/35166821/valueerror-attempted-relative-import-beyond-top-level-package
from ...config.config import Config
class ExperimentalPlan:
'''
Class for creating an experimental Plan bas... | csRon/autodoe | src/preProcessor/experimentalPlans/experimentalPlan.py | experimentalPlan.py | py | 6,290 | python | en | code | 0 | github-code | 36 |
3276810925 | from django.contrib.auth import get_user_model
from django.db.models import F, Sum
from django.http.response import HttpResponse
from django_filters.rest_framework import DjangoFilterBackend
from djoser.views import UserViewSet as DjoserUserViewSet
from recipes.models import (AmountIngredientRecipe, Favorite, Follow,
... | MihVS/foodgram-project-react | backend/foodgram/api/views.py | views.py | py | 7,796 | python | ru | code | 0 | github-code | 36 |
6690254075 | class BonusCardType:
BONUS_CARD = 'BonusCard'
UNIVERSAL_CARD = 'UniversalCard'
RZHD_BINNUS_DISCOUNT = 'RzdBonusDiscount'
class SegmentType:
# Неопределенный
UNKNOWN = 'Unknow'
# Одиночный ЖД сегмент
RAILWAY = 'Railway'
# Паромный сегмент
FERRY = 'Ferry'
# ЖД сегмент, но в заказ... | spacetab-io/ufs-python-sdk | ufs_sdk/wrapper/types.py | types.py | py | 15,381 | python | ru | code | 7 | github-code | 36 |
70806979943 | import sys
board = [[0]*100 for _ in range(100)] # x, y의 값이 1이상 100이하이므로 2차원 배열 최대 크기가 100 * 100
answer = 0 # 4개 사각형의 면적
for _ in range(4):
x1, y1, x2, y2 = map(int, sys.stdin.readline().split())
for i in range(x1, x2):
... | unho-lee/TIL | CodeTest/Python/BaekJoon/2669.py | 2669.py | py | 658 | python | ko | code | 0 | github-code | 36 |
2938441206 | import sys
input=sys.stdin.readline
s=int(input())
n=1
while(1):
s1=(n*(n+1))/2
s2=((n+1)*(n+2))/2
if(s1 <= s < s2):
print(n)
break
n+=1
continue
| DoSeungJae/Baekjoon | Python/1789.py | 1789.py | py | 187 | python | en | code | 1 | github-code | 36 |
32829769716 | from collections import deque
# BFS 함수 정의
def bfs(sx, sy, ex, ey):
# 시작 지점이 목표 지점과 같은 경우, 함수 종료
if sx == ex and sy == ey:
return
queue = deque([(sx, sy)])
# 나이트가 움직일 수 있는 방향 벡터 정의
dx = [-2, -1, 1, 2, 2, 1, -1, -2]
dy = [1, 2, 2, 1, -1, -2, -2, -1]
while queue:
x, y = queu... | veluminous/CodingTest | 백준 실전 문제/[백준 7562 DFS&BFS] 나이트의 이동.py | [백준 7562 DFS&BFS] 나이트의 이동.py | py | 1,306 | python | ko | code | 0 | github-code | 36 |
1298646891 | from moviepy.editor import *
import os
from natsort import natsorted
L =[]
for root, dirs, files in os.walk("D:\\Sujay\\German\\Best Way to Learn German Language-Full Beginner Course-A1.1\\New folder"):
#files.sort()
files = natsorted(files)
for file in files:
if os.path.splitext(file)... | Sujay-Mhaske/Join-video | vid_join.py | vid_join.py | py | 565 | python | en | code | 1 | github-code | 36 |
35139998213 | from tkinter import *
from tkinter import messagebox, Entry
index=0
w=Tk()
w.title("Restaurant Management System")
count=0
def ok():
print("OK")
s1.set("OK")
def addrec():
f=open("mydata.txt","a")
n=s1.get()
a=s2.get()
b=s3.get()
c=s4.get()
d=s5.get()
... | nitinagg4/RestaurantManagementSystemByNitin | project.py | project.py | py | 4,707 | python | en | code | 0 | github-code | 36 |
21052629609 | import requests
from bs4 import BeautifulSoup
import json
tokens = []
for x in range(1, 12):
result = requests.get("https://etherscan.io/tokens?p=" + str(x))
c = result.content
soup = BeautifulSoup(c, "html.parser")
samples = soup.find_all("tr")
for sample in samples:
try:
... | markchipman/inklin | get_tokens.py | get_tokens.py | py | 673 | python | en | code | 0 | github-code | 36 |
70719921064 | import numpy as np
from ..patch import Patch
from ..parcel import Parcel
class PropertyDeveloper:
def __init__(self, world, agent_type, view_radius=5, memory=100):
self.world = world
self.view_radius = view_radius
self.memory = memory
self.position = np.random.choice(world.patches.f... | LFRusso/strabo | strabo/agents/property.py | property.py | py | 8,249 | python | en | code | 0 | github-code | 36 |
40053694782 | import time
import random
def main():
rows = 20
cols = 50
max = rows * cols
c=220
d=700
m = [0] * max
n = [0] * max
print("\033[2J") # Clear screen
# Initialize arrays.
# for j in range(0, i):
# m[j] = 0
# n[j] = 0
# drop cells at random locations.
... | mscottreynolds/cse210-06 | test/awk.py | awk.py | py | 1,328 | python | en | code | 0 | github-code | 36 |
22078953220 | from enum import Enum
import random
import copy
random.seed(None)
def setSeed(s):
random.seed(s)
"""
Basic enumerated class to specify colors when needed.
"""
class Color(Enum):
WHITE = 0
BLACK = 1
GREEN = 2
RED = 3
BLUE = 4
GOLD = 5
@classmethod
def mapToColor(self, color):
... | ckpalma/splendor-ai | gym-master/gym/envs/splendor/structure.py | structure.py | py | 36,935 | python | en | code | 0 | github-code | 36 |
20349694789 | import time
"""
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
# Check if a number is prime
def is_prime(n):
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
... | dorinzaharia/project-Euler-solutions | 007/007.py | 007.py | py | 796 | python | en | code | 0 | github-code | 36 |
22163631798 | #!/usr/bin/env python
import csv
import gzip
import json
import os
import re
import sys
import pathlib
import sqlite3
from shapely.geometry import Polygon
from sqlite3 import Error
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(SCRIPT_DIR, os.path.join('..', '..', 'outputs', 'butte')... | typpo/ca-property-tax | scrapers/butte/create_parcels_db.py | create_parcels_db.py | py | 4,941 | python | en | code | 89 | github-code | 36 |
5668664706 | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import numpy as np
import sklearn.metrics as metrics
import seaborn as sns
from mosaic import features
from mosaic import contexts
from mosaic import image_io
from mosaic import plots
from mosaic import data... | joshloyal/Mosaic | mosaic/grid/scatter_grid.py | scatter_grid.py | py | 4,542 | python | en | code | 0 | github-code | 36 |
43471363833 | import pandas as pd
import numpy as np
# from sklearn.linear_model import LogisticRegression
# from omegaconf import DictConfig, OmegaConf
from loguru import logger
import joblib
import click
# from dataclasses import dataclass
# from hydra.core.config_store import ConfigStore
# from sklearn.pipeline import Pipeline... | made-mlops-2022/mlops-andrey-talyzin | ml_project/src/models/predict_model.py | predict_model.py | py | 1,397 | python | en | code | 0 | github-code | 36 |
38591539805 | from elasticsearch import Elasticsearch
from search import search_user_query
class ESClient:
def __init__(self):
self.es = Elasticsearch("http://localhost:9200")
def extract_songs(self, resp):
songs = []
hits = resp["hits"]["hits"]
for i in range(len(hits)):
songs.append(hits[i]["_source"])
... | PasinduUd/metaphor-based-search-engine | API/es_client.py | es_client.py | py | 2,414 | python | en | code | 0 | github-code | 36 |
16146023785 | import datetime as dt
f = open("def.dat", "r")
CLAIM_NUM = int(f.readline())
HST_RATE = float(f.readline)
CURR_DATE = dt.datetime.now()
f.close()
while True:
emp_name = input("Employee name: ")
emp_num = input("Employee number: ")
location = input("Location: ")
start_date = "2023-11-06"
end_date... | sweetboymusik/Python | Lesson 29/question.py | question.py | py | 1,411 | python | en | code | 0 | github-code | 36 |
15853176936 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import warnings
import unittest
from collections import OrderedDict
from w3lib.form import encode_multipart
class EncodeMultipartTest(unittest.TestCase):
def test_encode_multipart(self):
data = {'key': 'value'}
with warnings.catch_war... | bertucho/epic-movie-quotes-quiz | dialogos/build/w3lib/tests/test_form.py | test_form.py | py | 2,473 | python | en | code | 0 | github-code | 36 |
3458958897 |
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length = int(len(nums) / 2)
data = {}
for ele in nums:
data[ele] = data.get(ele, 0) + 1
if data[ele] > length :
return e... | pi408637535/Algorithm | com/study/algorithm/offer/剑指 Offer 39. 数组中出现次数超过一半的数字.py | 剑指 Offer 39. 数组中出现次数超过一半的数字.py | py | 438 | python | en | code | 1 | github-code | 36 |
28451867185 | from rest_framework import serializers
from core.models import Tag,Ingredient
class TagSerializers(serializers.ModelSerializer):
'''serializer for the object'''
class Meta:
model = Tag
fields = ('id', 'name')
read_only_fields = ('id',)
class IngredientSerializer(serializers.ModelSeria... | Manu1John/recipe-app-api | app/recipe/serializers.py | serializers.py | py | 486 | python | en | code | 0 | github-code | 36 |
31287697468 | prompt="enter your pizza toppings: "
#exercise 7-4 & 7-6 P1 :
#x=""
#while x != "quit":
#x=input(prompt)
#if x == "quit":
#print("thank you for ordering")
#else:
#print(x)
#exercise 7-6 P2:
#active = True
#while active:
#x=input(prompt)
#if (x == "quit"):
#print... | BasselMalek/python-training-files | python_learning_projects/7_4_6_exercise.py | 7_4_6_exercise.py | py | 565 | python | en | code | 0 | github-code | 36 |
35127026935 | import os
import numpy as np
import pickle
from dataclasses import dataclass
import itertools
from multiprocessing import Pool
import PIL
from noise_reducers.grayscale_gibbs_noise_reducer import GrayscaleGibbsNoiseReducer
from noise_reducers.grayscale_gradient_noise_reducer import GrayscaleGradientNoiseReducer
from no... | Dawidsoni/noise-reduction | noise-reduction/generate_grayscale_statistics.py | generate_grayscale_statistics.py | py | 4,224 | python | en | code | 0 | github-code | 36 |
70511120745 | import os
FEATURE_LOC = './data/jaffe_test_features'
files = os.listdir(FEATURE_LOC)
features = {}
for filename in files:
path = '/'.join([FEATURE_LOC, filename])
# Remove all files with a space in them
if ' ' in filename:
os.remove(path)
continue
f = open(path)
point_arr = []... | Hansenq/face-emoticon | process_features.py | process_features.py | py | 771 | python | en | code | 2 | github-code | 36 |
14582084682 | # -*- coding: utf-8 -*-
# @Author : Devin Yang(pistonyang@gmail.com), Gary Lai (glai9665@gmail.com)
__all__ = ['CosineWarmupLr', 'get_cosine_warmup_lr_scheduler', 'get_layerwise_decay_params_for_bert']
from math import pi, cos
from torch.optim.optimizer import Optimizer
from torch.optim.lr_scheduler import LambdaLR
... | PistonY/torch-toolbox | torchtoolbox/optimizer/lr_scheduler.py | lr_scheduler.py | py | 11,278 | python | en | code | 409 | github-code | 36 |
570436896 | import logging
from .geomsmesh import geompy
def sortFaces(facesToSort):
"""tri des faces par surface"""
logging.info('start')
l_surfaces = [(geompy.BasicProperties(face)[1], i, face) for i, face in enumerate(facesToSort)]
l_surfaces.sort()
facesSorted = [face for _, i, face in l_surfaces]
return facesSo... | luzpaz/occ-smesh | src/Tools/blocFissure/gmu/sortFaces.py | sortFaces.py | py | 362 | python | en | code | 2 | github-code | 36 |
34036030280 | # a good example of multi threading is Sending and Receiving Messages
import threading
class AndreMessenger(threading.Thread):
def run(self):
for _ in range(10):
print(threading.currentThread().getName())
x = AndreMessenger(name = 'Send Thread')
y = AndreMessenger(name = '... | andrevicencio21/newBoston3.0PythonTutorials | PythonNewBoston/t34Threading.py | t34Threading.py | py | 362 | python | en | code | 0 | github-code | 36 |
41047380685 | """By: Xiaochi (George) Li: github.com/XC-Li"""
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import ParseError
from bs4 import BeautifulSoup
def bs_parser(file_name, target_id):
"""
XML Parser implemented by Beautiful Soup Package
Args:
file_name(str): path to the document
... | XC-Li/FiscalNote_Project | deployment/util_code/xml_parser.py | xml_parser.py | py | 5,003 | python | en | code | 1 | github-code | 36 |
41561590327 | from api.core.workflow import workflow
from flask import request
import api.DAL.data_context.admin.user_update as user_update
import api.DAL.data_context.admin.user_insert as user_insert
import api.DAL.data_context.admin.user_select as user_select
from api.core.admin.credentials import Credentials
from api.core.admin... | RyanLadley/agility | api/core/workflow/admin_workflow.py | admin_workflow.py | py | 2,156 | python | en | code | 0 | github-code | 36 |
28513887827 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os, sys, re
from opus_core.export_storage import ExportStorage
from opus_core.store.sql_storage import sql_storage
from opus_core.store.attri... | psrc/urbansim | opus_gui/data_manager/run/tools/sql_data_to_opus.py | sql_data_to_opus.py | py | 3,715 | python | en | code | 4 | github-code | 36 |
4200242133 | import gevent
def eat(name):
print('%s start task' % name)
gevent.sleep(2)
print('%s end task' % name)
return name + " finished callback"
def play(name):
print('%s start task' % name)
gevent.sleep(1)
print('%s end task' % name)
return name + " finished callback"
def callback(greenl... | Marcia0526/how_to_learn_python | coroutine/gevent_demo.py | gevent_demo.py | py | 1,215 | python | en | code | 0 | github-code | 36 |
21477660213 | # 맨 뒤에 있는 원소를 선택해서 이전에 만들어놓은 원소의 수열 갯수를 이용한다.
import sys
n = int(input())
arr = list(map(int, sys.stdin.readline().split()))
count = [1] * n
for i in range(n):
for j in range(i):
if arr[j] < arr[i]:
count[i] = max(count[i], count[j] + 1)
print(max(count))
| Minsoo-Shin/jungle | week02/연습만이 살길이다!!/11053_가장긴증가하는부분수열.py | 11053_가장긴증가하는부분수열.py | py | 353 | python | ko | code | 0 | github-code | 36 |
40568525715 | import logging
from dcs.point import MovingPoint
from dcs.task import EngageTargets, EngageTargetsInZone, Targets
from game.ato.flightplans.cas import CasFlightPlan
from game.utils import nautical_miles
from .pydcswaypointbuilder import PydcsWaypointBuilder
class CasIngressBuilder(PydcsWaypointBuilder):
def add... | dcs-liberation/dcs_liberation | game/missiongenerator/aircraft/waypoints/casingress.py | casingress.py | py | 1,579 | python | en | code | 647 | github-code | 36 |
22704754984 | def intersect(nums1, nums2):
nums3 = []
for i in nums2:
if i in nums1:
nums3.append(i)
nums1.remove(i)
return nums3
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
... | CHENG-KAI/Leetcode | 350_interaction_of_two_array.py | 350_interaction_of_two_array.py | py | 684 | python | en | code | 0 | github-code | 36 |
35735822351 | import re
import webbrowser
import markdown
import dominate
from dominate.util import raw
from dominate.tags import *
from argparse import ArgumentParser
import shutil
import tempfile
import json
import os
from logging import *
import time
import bs4
import base64
from urllib.parse import unquote_plus
basicConfig(leve... | iTecAI/trilium-tools | pdf-export/trilium_to_pdf.py | trilium_to_pdf.py | py | 11,045 | python | en | code | 2 | github-code | 36 |
4472644976 | import pygame as pg
from gui.widgets.animated_widget import AnimatedWidget
from data.constants import *
class BackgroundImage(AnimatedWidget):
def __init__(self, x, y, w, h, image):
super().__init__()
self.pos = x, y
self.image = pg.transform.smoothscale(pg.image.load(image).convert_alpha... | IldarRyabkov/BubbleTanks2 | src/gui/widgets/background_image.py | background_image.py | py | 834 | python | en | code | 37 | github-code | 36 |
5967270915 | # Sun Oct 27 15:40:29 2019
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
# Configurations
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.size'] = 20
mpl.rcParams['font.weight'] = 'medium'
mpl.rcParams['font.style'] = 'normal'
mpl.rcParams['font.serif'] = 'DejaVu Serif'
mpl.rcPara... | NingDaoguan/JI | PO6007-MSTPS/HW/HW3.py | HW3.py | py | 4,599 | python | en | code | 0 | github-code | 36 |
22041239484 | import random
def get_long_path_stage_groups(N, M, stage, lowest=2):
"""Find groups for a particular stage using long-path network.
# Params
N: Number of participants (integer, must be > 0).
M: Group size (integer, must be >= 2).
stage: Stage of deliberation (integer, must be >= 0).
lowest... | elplatt/Exp-Net-Delib | netdelib/topologies/topologies.py | topologies.py | py | 3,706 | python | en | code | 0 | github-code | 36 |
21241359849 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from rtm.executor import LoopMaster
__author__ = 'David Qian'
"""
Created on 02/15/2017
@author: David Qian
"""
if __name__ == '__main__':
cmd = './test/test.sh'
restart_time = '0'
workdir = None
master = LoopMaster(cmd, restart_time, workdir)
mast... | krizex/RunnerTimer | src/rtm/demo.py | demo.py | py | 329 | python | en | code | 0 | github-code | 36 |
43354784770 | import json
from typing import Any, List
import numpy as np
import torch
from mmhuman3d.core.conventions.cameras import (
convert_cameras,
convert_K_3x3_to_4x4,
convert_K_4x4_to_3x3,
)
class CameraParameter:
def __init__(self,
name: str = 'default',
H: int = 1080,
... | hanabi7/point_cloud_smplify | mmhuman3d/core/cameras/camera_parameter.py | camera_parameter.py | py | 13,594 | python | en | code | 6 | github-code | 36 |
16269675107 | # Very simplified version with ASCII-based graphics
import random
class KnockoutLite:
board_len = 3
num_penguins = 1
num_players = 2
dead_flag = ['dead']
is_dead = lambda p : p == ['dead']
def __init__(self):
self.penguins = []
self.move_number = 1
for i in range(Knoc... | ashuk203/knockout-ai | Simple-version/game.py | game.py | py | 4,764 | python | en | code | 0 | github-code | 36 |
23942544871 | """Assorted algorithms to verify end-to-end compiler functionality.
These tests include:
- Sum of array of integers
- Recursive Fibonacci sum
"""
import pytest
import tempfile
import functools
import os
from acctools import compilers
ACC_PATH=os.environ.get("ACC_PATH", os.path.join(os.path.dirname(__file__), "../... | alexking35h/acc | functional/test_algorithms.py | test_algorithms.py | py | 2,059 | python | en | code | 1 | github-code | 36 |
10179832367 | #!/usr/bin/python3
"""
Prints the titles of the first 10 hot posts listed for a given subreddit
"""
import requests
def top_ten(subreddit):
"""
Prints the titles of the first
10 hot posts listed for a given subreddit
"""
if subreddit is None or not isinstance(subreddit, str):
print("Non... | jamesAlhassan/alx-system_engineering-devops | 0x16-api_advanced/1-top_ten.py | 1-top_ten.py | py | 756 | python | en | code | 0 | github-code | 36 |
1710822043 | import logging
import warnings
import torch
import numpy as np
from data import data_utils
from data.ofa_dataset import OFADataset
logger = logging.getLogger(__name__)
warnings.filterwarnings("ignore", "(Possibly )?corrupt EXIF data", UserWarning)
def collate(samples, pad_idx, eos_idx):
if len(samples) == 0:
... | evdcush/musketeer | data/nlg_data/summary_dataset.py | summary_dataset.py | py | 7,516 | python | en | code | 0 | github-code | 36 |
39013778439 | # https://www.acmicpc.net/problem/1987
# 알파벳
import sys
input = sys.stdin.readline
def bfs(r, c):
queue = set()
queue.add((r, c, arr[r][c]))
max_val = 0
while queue:
s = queue.pop()
max_val = max(max_val, len(s[2]))
for d in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
nr ... | eomsteve/algo_study | dm/8_week/1987.py | 1987.py | py | 595 | python | en | code | 0 | github-code | 36 |
18198988741 | """Providers filters file."""
from django.db import models
import django_filters
from tersun.common.filters import SearchComboboxBaseFilter
from tersun.providers import models as provider_models
class ProviderFilter(SearchComboboxBaseFilter):
"""Provider filter class."""
class Meta:
"""Meta class f... | SonnyKundi/teebeauty_backend | tersun/providers/filters.py | filters.py | py | 671 | python | en | code | 0 | github-code | 36 |
69904891626 | from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
with open('README.rst') as f:
long_desc = f.read()
setup(name='glucid',
version='0.5.0',
description='Configure the Lucid 8824 AD/DA Audio Interface via \
a Serial Connection',
ur... | danmechanic/glucid | setup.py | setup.py | py | 1,879 | python | en | code | 1 | github-code | 36 |
43587647307 | import argparse as _argparse
import os as _os
import sys as _sys
from colorama import Fore as _Fore
from colorama import init as _colorama_init
from contexttimer import Timer as _Timer
from src import merge as _merge
from src import parse as _parse
if __name__ == '__main__':
"""
Example: python merge.p... | PSS-Tools-Development/pss-api-parser | merge.py | merge.py | py | 2,353 | python | en | code | 4 | github-code | 36 |
37722788260 | '''
商品详情页面
'''
from common.base import Base
good_url ='http://ecshop.itsoso.cn/goods.php?id=304'
class Buy_Good(Base):
'''页面点击立即购买'''
# 商品名字
good_name_loc=('class name','goods_style_name')
# 商品牌子
good_brand_loc=('css selector','a[href="brand.php?id=20"]')
# 购买数量框
number_loc=('id','number'... | 15008477526/- | web_aaaaaaaa/page/good_details3.py | good_details3.py | py | 2,403 | python | en | code | 0 | github-code | 36 |
75310098025 | #!python
#/usr/bin/env python
# -*- coding:utf-8 -*-
__doc__ = """
NBNS Answer ,
by Her0in
"""
import socket, struct,binascii
class NBNS_Answer:
def __init__(self, addr):
self.IPADDR = addr
self.nas = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... | b40yd/security | nbns_answser.py | nbns_answser.py | py | 2,347 | python | en | code | 96 | github-code | 36 |
8266325142 | import anki
from aqt import mw
import re
col = anki.collection.Collection('C:/Users/clept/AppData/Roaming/Anki2/Iván/collection.anki2')
deck_name = 'Seguridad social test'
search_query = '"deck:' + deck_name + '"'
cards = col.find_cards(search_query)
for card_id in cards:
# Get the card
card = col.get_car... | IvanDiazCostoya/anki-card-add-sort-field | main.py | main.py | py | 1,195 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.