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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
27932179724 | from __future__ import (division as _py3_division,
print_function as _py3_print,
absolute_import as _py3_abs_import)
import os
class BoardPainter(object):
def __init__(self):
self._first_row = ' {0} | {1} | {2} \n _____|_____|_____\n'
self._s... | Sergio2409/curemetrix-python-challengue | tic-tac-toe/board_painter.py | board_painter.py | py | 1,646 | python | en | code | 0 | github-code | 90 |
22030074782 | from math import sqrt
from numpy import isclose
from dolfin import (assemble, Constant, DirichletBC, div, DOLFIN_EPS, dx, FiniteElement, FunctionSpace, grad, inner,
MeshFunction, MixedElement, split, SubDomain, TestFunction, TrialFunction, UnitSquareMesh,
VectorElement)
"""
Comp... | RBniCS/RBniCS | tests/unit/backends/dolfin/test_eigen_solver.py | test_eigen_solver.py | py | 3,938 | python | en | code | 83 | github-code | 90 |
28428070467 | class Date:
# Set the constructors for the type date
def __init__ (self,d,m,y):
self.day = int(d)
self.month = int(m)
self.year = int(y)
# Accessor Methods
def getDay(self):
return self.day
def getMonth(self):
return self.month
d... | jil-shah/Day_Month_Year_Classes | V1.py | V1.py | py | 8,592 | python | en | code | 0 | github-code | 90 |
23681395848 |
import requests
import re
import json
import time
def get_one_page(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'
}
response = requests.get(url, headers = headers)
if respon... | zjjslf/spider-py-test | doubanbook.py | doubanbook.py | py | 1,394 | python | en | code | 0 | github-code | 90 |
27706055635 | import logging
from xml.etree import ElementTree
import requests
from django.conf import settings
from requests.exceptions import ConnectionError
from retrying import retry
logger = logging.getLogger(__name__)
CAS_VALIDATE_URL_TEMPLATE = (
'https://cas.uwaterloo.ca/cas/serviceValidate?'
'service={}/{{}}&ti... | rezqio/rezq-backend | rezq_backend/rezq/lib/cas.py | cas.py | py | 1,329 | python | en | code | 1 | github-code | 90 |
17793550896 | """Handles routing, serving, and preparing pages."""
import functools
from flask import (Flask, render_template, request,
redirect, abort, url_for)
from waitress import serve
import analyze
import update
import corefinder
import dex
import os
from file_constants import *
from file_loader import Dat... | googlyeyesultra/PokeTeam | main.py | main.py | py | 9,660 | python | en | code | 0 | github-code | 90 |
18464114099 | import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす
def rec(i, dp, nodes):
# 更新済みのデータの場合はそのまま返す
if dp[i] != -1:
return dp[i]
res = 0
for next in nodes[i]:
res = max(res, rec(next, dp, nodes) + 1)
dp[i] = res
return res
def main():
input = sys.stdin.readline # 文字列に対してinpu... | Aasthaengg/IBMdataset | Python_codes/p03166/s543060635.py | s543060635.py | py | 850 | python | ja | code | 0 | github-code | 90 |
74085736297 | import torch
import torch.nn.functional as F
import opensmile
from datasets_turntaking.features.utils import z_norm, z_norm_non_zero
class OpenSmile:
FEATURE_SETS = ["egemapsv02", "emobase"]
def __init__(
self,
feature_set="egemapsv02",
sample_rate=16000,
normalize=False,
... | ErikEkstedt/datasets_turntaking | datasets_turntaking/features/open_smile.py | open_smile.py | py | 7,692 | python | en | code | 7 | github-code | 90 |
726748975 | #!/usr/bin/env python3
import itertools as it, operator as op, functools as ft
import os, sys, io, re, types, logging, pathlib as pl
import stat, tempfile, fcntl, subprocess as sp
import contextlib, hmac, hashlib, struct, base64
b64_encode = lambda s: base64.urlsafe_b64encode(s).decode()
b64_decode = lambda s: ( bas... | mk-fg/git-nerps | git-nerps.py | git-nerps.py | py | 38,628 | python | en | code | 14 | github-code | 90 |
41391454763 | import numpy as np
import matplotlib.pyplot as plt
import os
filepath = os.path.dirname(os.path.abspath(__file__))
def plot_test(ax, L, n_groups, p, ghost_times, naive_times, label1, label2):
ax.plot(p, ghost_times, marker='.', ls='-', label=label1)
ax.plot(p, naive_times, marker='.', ls='-', label=label2)
... | JamesYang007/ghostbasil | docs/benchmark/ghost_matrix_col_dot_bench/analyze.py | analyze.py | py | 1,795 | python | en | code | 2 | github-code | 90 |
25622144837 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from src.utils.const import *
# -------------Window--------------
window_style = {
'auto_size_text': False,
'auto_size_buttons': False,
'default_element_size': (20, 1),
'text_justification': 'right',
}
# -----------Input Frame-----------
input... | mototoke/pdf_auto_sign | pdf_auto_sign/src/views/style.py | style.py | py | 970 | python | en | code | 0 | github-code | 90 |
18073682119 | n = int(input())
arr = list(map(int, input().split()))
arr.sort()
res = 0
i=0
l = len(arr)
while i<l:
res+=min(arr[i], arr[i+1])
i+=2
print(res)
| Aasthaengg/IBMdataset | Python_codes/p04047/s888016571.py | s888016571.py | py | 156 | python | en | code | 0 | github-code | 90 |
15898217166 | """
В этом модуле лежат различные наборы представлений.
Разные view интернет-магазина: по товарам, заказам и т.д.
"""
from csv import DictWriter
import logging
from timeit import default_timer
from django.contrib.auth.models import Group
from django.forms import TextInput
from django.shortcuts import render, redirect,... | skaiiheda/Django-App | mysite/shopapp/views.py | views.py | py | 11,326 | python | en | code | 0 | github-code | 90 |
1152667366 | # UPLOADING OF FEATURE DEFINITIONS TO SOLR for FEATURE VALUE EXTRACTION
import json
import solr
SOLR_URL = "http://localhost:8983/solr/core1"
headers = {"Content-type": "application/json"}
def main():
# Delete all existing FS first
solr.delete_feature_store(SOLR_URL + "/schema/feature-store/feature_store1"... | ronkow/solr-learning-to-rank | src/solr_upload_feature.py | solr_upload_feature.py | py | 700 | python | en | code | 2 | github-code | 90 |
74197064296 | '''
Created on Jul 9 , 2019
@author: Mahamat Oumar
'''
from django.db import models
from django.contrib.auth.models import User
from PIL import Image
from datetime import datetime
from organ.models import Organ
from medical_professional.models import MedicalProfessional
class Organization(models.Model):
id = m... | hamoody-omar/Coorganate | organization/models.py | models.py | py | 4,234 | python | en | code | 1 | github-code | 90 |
27677014400 | import numpy as np
import h5py
from spike_psvae import (
spike_train_utils,
before_deconv_merge_split,
deconv_resid_merge,
cluster_utils,
)
from scipy.spatial.distance import cdist
def registered_maxchan(
spike_index, p, geom, pfs=30000, offset=None, depth_domain=None, ymin=0
):
pos = geom[spi... | cwindolf/dartsort | src/spike_psvae/newpipeline.py | newpipeline.py | py | 8,854 | python | en | code | 15 | github-code | 90 |
18433886569 | f=lambda:map(int,input().split())
n,m=f()
l=[]
for _ in range(n):
l+=[tuple(f())]
l.sort()
c=0
for a,b in l:
if b<m:
m-=b
c+=a*b
else:
c+=a*m
break
print(c) | Aasthaengg/IBMdataset | Python_codes/p03103/s039474039.py | s039474039.py | py | 178 | python | en | code | 0 | github-code | 90 |
73463270377 | # -*- coding: utf-8 -*-
# Scrapy settings for Wozaizhaoni project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/t... | KKtwo/Scrapy-Project | Wozaizhaoni/Wozaizhaoni/settings.py | settings.py | py | 5,097 | python | en | code | 1 | github-code | 90 |
18503917952 | import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
import os
from os import path
import json
from pathlib import Path
from tqdm import tqdm
import nlp
import re
import numpy as np
def random_forest(train_data_pth):
df = pd.read_excel(train_data_pth)
... | quantaji/sciduet-rebuild | core/filter_and_merge.py | filter_and_merge.py | py | 4,178 | python | en | code | 0 | github-code | 90 |
18411473489 | H, W = map(int, input().split())
maze = [input() for _ in range(H)]
seen = [[-1] * W for _ in range(H)]
from collections import deque
queue = deque()
for i in range(H):
for j in range(W):
if maze[i][j] == '#':
queue.append([i, j, 0])
seen[i][j] = 0
def bfs(maze, seen):
while ... | Aasthaengg/IBMdataset | Python_codes/p03053/s262861952.py | s262861952.py | py | 915 | python | en | code | 0 | github-code | 90 |
31822850309 | from threading import Thread
import cv2
import time
# https://stackoverflow.com/questions/58293187/opencv-real-time-streaming-video-capture-is-slow-how-to-drop-frames-or-get-sync
import numpy
import pygame
class ThreadedCamera(object):
def __init__(self, source=0):
self.capture = cv2.VideoCapture(source)... | Hypnopompia/PrinterController | Mode/Components/Camera/ThreadedCamera.py | ThreadedCamera.py | py | 1,713 | python | en | code | 0 | github-code | 90 |
13156867758 | import logging
import string
from enum import Enum
from typing import *
__all__ = ["parse", "TerminalDirective"]
class TerminalDirective(Enum):
"""
Enumeration of keys that are used in transcripts in Air-Traffic Control Complete. These
are all the possible values that can occur as keys in the dictionarie... | maeganlucas/CS490-ATC | NeMo/Code/lib/asr-project/source/data/utils/atccutils.py | atccutils.py | py | 9,922 | python | en | code | 3 | github-code | 90 |
19315412864 | def longestCommonPrefix(strs):
if len(strs) == 1:
return ''.join(strs[0])
prefix = []
for i, j in zip(strs[0], strs[1]):
if i == j:
prefix.append(i)
else:
break
strs[1] = prefix
return longestCommonPrefix(strs[... | Noor696/problem_solving_python | longestCommonPrefix1.py | longestCommonPrefix1.py | py | 380 | python | en | code | 0 | github-code | 90 |
29544226637 | # -*- coding: utf-8 -*-
# @Time : 2022/5/1 10:23
# @Author : 模拟卷
# @Github : https://github.com/monijuan
# @CSDN : https://blog.csdn.net/qq_34451909
# @File : 6047AC. 移除指定数字得到的最大结果.py
# @Software: PyCharm
# ===================================
"""给你一个表示某个正整数的字符串 number 和一个字符 digit 。
从 number 中 恰好 移除 一个 等于 d... | monijuan/leetcode_python | code/competition/2022/20220501/6047AC. 移除指定数字得到的最大结果.py | 6047AC. 移除指定数字得到的最大结果.py | py | 2,254 | python | zh | code | 0 | github-code | 90 |
10920939682 | import json
import base64
from botocore.vendored import requests
import datetime
# API URL to get image list
# TO DO: Make this non en specific
IMAGE_URL = 'http://en.wikipedia.org/w/api.php?action=query&prop=images&titles={}&format=json&imlimit=500'
def format_input(event):
"""Decode a Kineses event.
Args:... | lbowmaker/simple_streams_poc | wiki_image_list/platform_tools.py | platform_tools.py | py | 2,330 | python | en | code | 2 | github-code | 90 |
35505559845 | import streamlit as st
# EDA Pkgs
import pandas as pd
import numpy as np
import webbrowser
import matplotlib
from Scripts.streamlit.proto.Image_pb2 import Image
matplotlib.use('Agg')
html_temp = """<div style="background-color:{};padding:10px;border-radius:10px">
<h1 style="color:white;text-align:center;">... | nehaparbate/ICU-Admission-Prediction-for-COVID-19 | Predictor.py | Predictor.py | py | 30,559 | python | en | code | 0 | github-code | 90 |
27736756457 | # coding: utf-8
import re
from .ntopng import Metric, device_day_stats
from lib.stats import get_week_days
from colour import Color
def get_protocol_sums(traffic):
protocols = parse_traffic_dict(traffic)
amounts = dict()
texts = dict()
for protocol in protocols.keys():
text = list()
... | usableprivacy/upribox | upribox_interface/traffic/utils.py | utils.py | py | 2,876 | python | en | code | 169 | github-code | 90 |
31319780115 | import time
from turtle import Screen
from player import Player
from car_manager import CarManager
from scoreboard import Scoreboard
screen = Screen()
screen.setup(width=600, height=600)
screen.tracer(0)
player = Player()
score = Scoreboard()
cars = CarManager()
screen.listen()
screen.onkey(key= "Up", fun= player.move... | Synyster008/Python_Projects | Turtle crossing/main.py | main.py | py | 669 | python | en | code | 0 | github-code | 90 |
73530503337 | from unittest import mock
import pytest
from core.types import Frame
from scanners.basic import BasicScanner
@pytest.mark.parametrize(
"invader_signal,signal,similarity,expected_signal,expected_similarity",
[
(0.6, None, None, 0.6 * 0.8, 0.7),
(0.1, 0.75, 0.85, 0.75, 0.85),
(0.1, Non... | askanium/space_invaders_assignment | tests/test_scanners.py | test_scanners.py | py | 2,040 | python | en | code | 0 | github-code | 90 |
307165396 | def min_deletions(matrix):
ans = 0
# If there's only one row, then you do not need to delete anything.
if len(matrix[0]) == 1:
return ans
# Construct each column. Sort it, then compare with the original column. If they are different, then you must delete this row.
# Time - O(MN) because o... | paultorre/Daily_Coding_Problem | dcp76.py | dcp76.py | py | 669 | python | en | code | 0 | github-code | 90 |
1714734791 | import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.optimizers import Adam
from keras.models import Model
from keras.layers import LSTM, Dropout, Dense, Input, Activation, Masking, Lambda
from keras.layers import dot, Concatenate
from keras.utils import pad_sequences
def nn(learning... | ryashpal/Micro-Services | lncrnanet2/predict.py | predict.py | py | 5,687 | python | en | code | 0 | github-code | 90 |
17940274101 | # Prompting for two numbers and then adding them together.
# Catching the 'ValueError' if a non-numerical character is used for input.
try:
first_number = input("\nFirst number: ")
second_number = input("second number: ")
answer = int(first_number) + int(second_number)
print(answer)
except ValueError:... | julencosme/python_programs | value_error_numbers.py | value_error_numbers.py | py | 380 | python | en | code | 0 | github-code | 90 |
9533330158 | from collections import defaultdict
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
lookup = defaultdict(list) #dic list to count anagrams
for word in strs:
key = [0]*26
for char in word:
key[ord(char)... | anguzz/leetcode | strings/05-groupAnagrams.py | 05-groupAnagrams.py | py | 654 | python | en | code | 0 | github-code | 90 |
13581419782 | '''
This file keeps all sensitive settings for BioGPS app.
*****DO NOT COMMIT IT TO ANY REPOSITORY, ADD IT TO THE INGORED LIST*****
'''
######BioGPS specific settings#########
REMOTESERVICEERROR_EMAIL = ( # the email list for any remote service error.
('BioGPS_Notifications', '<biogps_admin_email... | SuLab/biogps_core | src/biogps/biogps/settings_private_example.py | settings_private_example.py | py | 2,160 | python | en | code | 0 | github-code | 90 |
30773591601 | import numpy as np
def cal(a, i, t):
t = -1
for j in range(i + 1, len(a[i])):
if (a[i][j] == 'R'):
t = i
return t
a, c, temp, t = [], 0, [], -1
x = list(input().split())
# a=list(list(input().split()))
a.append(x)
# print(len(x))
for i in range(len(x) - 1):
x = list(input().split... | edmundaunstin/Coding | AjiraMatrix.py | AjiraMatrix.py | py | 876 | python | en | code | 0 | github-code | 90 |
41141911467 | # This file must be run with sudo access, such as:
# sudo xfce4-terminal -x python /bin/dell-led-changer-script.py
from subprocess import call
from time import sleep
choices=open("./central-db.db")
print("Which program would you like to run?\n(If you would like to add a program to this list, edit central-db.db)\n")
tic... | colewebb/dance-files | dell-led-changer/dell-led-changer-script.py | dell-led-changer-script.py | py | 1,198 | python | en | code | 0 | github-code | 90 |
29955777875 | #name: JIVAJ BRAR
#assignment pa3 cryptography
#date : FEB 20, 2023
# codecs
import numpy as np
class Codec():
def __init__(self):
self.name = 'binary'
self.delimiter = '#'
# convert text or numbers into binary form
def encode(self, text):
if type(text) == s... | jivajb/cryptography | codec.py | codec.py | py | 6,808 | python | en | code | 0 | github-code | 90 |
6149969135 | # List Comprehension
case1 = [1,2,3]
case2 = [4,2,1]
result = [i+j for i in case1 for j in case2 if i!=j]
print(result)
words = "the quick brown fox jumps over the lazy dog".split()
print(words)
result = [[w.upper(), w.lower(), len(w)] for w in words]
print(result)
| ckdgus08/LikeLion | 파이썬 수업2/20200525_04.py | 20200525_04.py | py | 272 | python | en | code | 0 | github-code | 90 |
40234493914 | lucky_numbers = [4, 15, 8, 16, 23, 42]
friends = ['Bob', 'Pedro', 'Alice', 'Alice', 'Oscar', 'Toby']
#friends.extend(lucky_numbers) # Add two lists together
#friends.append("Creep") # Add additinal to end of list
#friends.insert(1, 'bone') # Insert into a specific index place
#friends.remove('Bob') # Remove specific it... | TheWritersInk/Code | list_functions.py | list_functions.py | py | 646 | python | en | code | 0 | github-code | 90 |
25960902000 | import turtle
import colorsys
# Window settings
window = turtle.Screen()
window.bgcolor('black')
window.title('Beautiful Turtle Effect')
# Creating a turtle
t = turtle.Turtle()
t.speed(0)
t.width(2)
# Loop for drawing the spiral
for i in range(500):
hue = i / 360.0
color = colorsys.hsv_to_rgb(hue, 1.0, 1.0)... | kanewi11/YouTube | beautiful_turtle_effect.py | beautiful_turtle_effect.py | py | 425 | python | en | code | 0 | github-code | 90 |
43970573044 | import json
from typing import Optional
import pandas as pd
from utils.system_utils import file_exist_checker, file_dir_checker
class BOMData:
def __init__(self, bom: Optional[list] = None):
if bom is None:
self.bom = []
else:
self.bom = bom
def __call__(self):
... | durianh96/InvNet-inv-graph | data_builder/data_template/bom_data.py | bom_data.py | py | 2,108 | python | en | code | 0 | github-code | 90 |
69807861 | import os.path as osp
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from mmdet.core.evaluation import get_classes
from mmdet.lvis import LVIS
from .custom import CustomDataset
from .registry import DATASETS
@DATASETS.register_module
class LVISDataset(CustomDataset):
CLASSES... | apulis/mmdetection-lvis | mmdet/datasets/lvis.py | lvis.py | py | 5,119 | python | en | code | 1 | github-code | 90 |
18011384409 | import math
# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
digits = sums = 0
while num > 0:
digits += 1
sums += num % 10
num //= 10
return digits, sums
n = input()
answer = len(n)
num = int(n)
limit = int(math.sqrt(num)) + 1
for divide in range(1, limit):
candidate = num /... | Aasthaengg/IBMdataset | Python_codes/p03775/s617290720.py | s617290720.py | py | 542 | python | en | code | 0 | github-code | 90 |
27091681078 | from spack import *
class Libxmu(AutotoolsPackage):
"""This library contains miscellaneous utilities and is not part of the
Xlib standard. It contains routines which only use public interfaces so
that it may be layered on top of any proprietary implementation of Xlib
or Xt."""
homepage = "http:/... | matzke1/spack | var/spack/repos/builtin/packages/libxmu/package.py | package.py | py | 700 | python | en | code | 2 | github-code | 90 |
4106169155 | #fetching company name from employee email
def fectCompany(email):
index=email.index('@')
compName=""+email[index+1:-4]
return compName
my_input=input()
while(len(my_input)>0):
print("Company name is :",fectCompany(my_input))
#Do whatever you want
print("Enter email id... | amit8984/Python_assignment | Q7.py | Q7.py | py | 393 | python | en | code | 0 | github-code | 90 |
21373892327 | from datetime import date
from weasyprint import HTML, CSS
from weasyprint.text.fonts import FontConfiguration
import re
import utils
from city import CityFactory
"""
This code is largely sourced from Sid Kapur's repository here: https://github.com/YIMBYdata/rhna-apr-emails
Thanks Sid!
"""
header = """
<div class="t... | sdamerdji/affh_letters | letter.py | letter.py | py | 8,637 | python | en | code | 1 | github-code | 90 |
29523548600 | import time
import sys
import os
import argparse
import logging
class ArgumentParserError(Exception): pass
class ThrowingArgumentParser(argparse.ArgumentParser):
def error(self, message):
raise ArgumentParserError(message)
our_name = os.path.basename(__file__)
logger_name = our_name.split('.')[0] + '.lo... | xarakas/synaisthisi-iot | docker_compose/flask_app/services/8.py | 8.py | py | 5,333 | python | en | code | 2 | github-code | 90 |
37360505907 | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan, Image
from cv_bridge import CvBridge
import cv2
class TurtleBot3:
# Initialisations
def __init__(self):
# Initialiser le noeud ROS
rospy.init_node('turtlebot3_competition... | AlphaUbuntu/ROS_projet | src/move_test/autonomie-driving.py | autonomie-driving.py | py | 6,133 | python | fr | code | 0 | github-code | 90 |
73892393898 | from kivymd.uix.label import MDLabel
from kivy.lang import Builder
Builder.load_string("""
<Text>
markup: True
shorten: True
theme_text_color: "Custom"
""")
class Text(MDLabel):
def __init__(self, *args, **kwargs):
super().__init__( **kwargs)
| Humarr/project_builder | smart_project_builder/widgets/label.py | label.py | py | 298 | python | en | code | 0 | github-code | 90 |
15454792184 | from peewee import IntegrityError
from dbbaseinit import CompanyDB
from dbbaseinit import CarDB
from dbbaseinit import OrderDB
from dbbaseinit import db
from datetime import datetime
from datetime import date
class CreateDB:
"""Создание базы данных.
Внесение новых записей: клиент, машина клиента, акты.
... | markizdesadist/BaseSTO | databasecreate.py | databasecreate.py | py | 9,156 | python | ru | code | 0 | github-code | 90 |
18098887419 | import sys
def kouyakusuu(a,b):
A = max(a,b)
B = min(a,b)
d = A % B
if d == 0:
return B
else:
return kouyakusuu(B,d)
for line in sys.stdin.readlines():
a,b = map(int,line.split())
m = kouyakusuu(a,b)
n = a*b//m
print(m,n) | Aasthaengg/IBMdataset | Python_codes/p00005/s962954377.py | s962954377.py | py | 247 | python | en | code | 0 | github-code | 90 |
5815338514 | import sys
import pygmo as pg
from utils.PygmoUDP import PygmoUDP
from utils.rbfopt_utils import parse_variable_string
import utils.global_record as global_record
def construct_pygmo_problem(parbfopt_algm_list, n_obj, obj_funct):
dimension, var_lower, var_upper, var_type = parse_variable_string(parbfopt_algm_lis... | bicep/RBFMopt-cli | utils/rbfmopt_utils.py | rbfmopt_utils.py | py | 1,406 | python | en | code | 2 | github-code | 90 |
30571828150 | #!/usr/bin/env python3
"""
索引增删改查测试
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/9/19
:version 1.0
"""
import unittest
import elastic_learning.rest.index.ArticlesType as articlesTypes
index_blogs = articlesTypes.BlogsRequest()
type_articles = articlesT... | weiwei02/python-learning | elastic_learning/tests/rest/curd/test_select.py | test_select.py | py | 1,803 | python | en | code | 4 | github-code | 90 |
14570277231 | from tqdm.auto import tqdm
import argparse
import natsort
import random
import json
import glob
import os
import midi_utils
def split_trn_val_lines(args):
note_info = []
val_len = args.val_len
line_target_dir = args.line_target_dir
model_name = args.model_name
source_dir = os.pa... | choiHkk/VITSinger | preprocess.py | preprocess.py | py | 3,552 | python | en | code | 35 | github-code | 90 |
19581677131 | import os
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
#%matplotlib inline
train = pd.read_csv(os.path.join('/kaggle/input/titanic/train.csv'))
test = pd.read_csv(os.path.join('/kaggle/input/titanic/test.csv'))
train.info()
train.head()
train['Survived'].v... | shy982/Machine-Learning | Titanic solution.py | Titanic solution.py | py | 7,675 | python | en | code | 1 | github-code | 90 |
18484966895 | from sqlalchemy import Column, ForeignKey, Integer, String, DateTime
from sqlalchemy.orm import relationship
from uuid import uuid4
from datetime import datetime
from . import Base
class User(Base):
__tablename__ = "users"
id = Column(String(36), primary_key=True, default=uuid4)
username = Column(String(... | liweicheng00/tree-point | app/database/models.py | models.py | py | 2,048 | python | en | code | 0 | github-code | 90 |
35623465233 |
import csv
import datetime
from subprocess import call
#This code takes in the necessary arguments
right_now = datetime.datetime.now().isoformat()
list = []
for i in right_now:
if i.isnumeric():
list.append(i)
tim = ("".join(list))
strlst = []
namlst = []
print("")
print("Welcome to Table ... | Mystified131/GoToCode | DataAdder.py | DataAdder.py | py | 4,515 | python | en | code | 0 | github-code | 90 |
38201052977 | # Author : Felix Chi
# Date : 2020/09
import os
import sys
import json
import pandas as pd
import tensorflow as tf
os.chdir("/var/www/html/analysis/project/bert-master");
#分析测试(未知)样本类别,并将其放到test_output中 注意:这里的init_checkpoint要指定到已训练的模型
os.environ['BERT_Chinese_DIR'] = 'chinese_L-12_H-768_A-12';
os.environ['Demo_DIR'... | hungchiehchi/ReadingBooksDetermineSystemBERT | TextualAnalysis.py | TextualAnalysis.py | py | 1,375 | python | zh | code | 0 | github-code | 90 |
74039302056 | """
This Python module is a part of the KIAM Astrodynamics Toolbox developed in
Keldysh Institute of Applied Mathematics (KIAM), Moscow, Russia.
The module provides the Engine base class, which can be used to implement its own
classes abstracting the concept of an engine in astrodynamics. Based on the Engine
class, th... | oygx210/KIAMToolbox | kiam_astro/engine.py | engine.py | py | 13,342 | python | en | code | 0 | github-code | 90 |
33993266206 | from school.Student import Student
from school.Teacher import Teacher
class SchoolApp:
count=0 #클래스 변수
arr=[] #등록된 사람들을 저장할 리스트
def mainMenu(self):
print('----Menu-------')
print('1. 등 록')
print('2. 출 력')
print('3. 검 색')
print('4. 삭 제')
... | eunjijen/IoT_service_Practice | 01. pythonProject/ex52SchoolApp.py | ex52SchoolApp.py | py | 3,491 | python | ko | code | 0 | github-code | 90 |
4975617428 | from tkinter import Frame, Label, Button, StringVar, Entry
from tkinter.ttk import Combobox
class PageEmpleado(Frame):
def __init__(self, master):
self.controller = master.controller
#Crea el frame del mismo color de fondo
Frame.__init__(self, master)
self.configure(bg="#3... | Aluzinus727/Proyecto_ICI2240 | src/vistas/empleado.py | empleado.py | py | 7,242 | python | es | code | 0 | github-code | 90 |
23027747521 | #!/usr/bin/env python
# coding: utf-8
"""Acidentes em Rodovias
Universidade de Brasilia - FGA
Técnicas de Programação, 1/2014
Parser responsable to return to HTML inquiry in time/period.
"""
import logging
import MySQLdb
from django.utils.datastructures import MultiValueDictKeyError
from django.template import Re... | josepedro/acidentes_em_rodovias_refatoracao | acidentes_em_rodovias/app/controller/consultabasica_periodo_controller.py | consultabasica_periodo_controller.py | py | 3,768 | python | en | code | 0 | github-code | 90 |
43007994210 | x = input().split()
a, b = x
a = float(a)
b = float(b)
if(a >= b):
maior = a
menor = b
else:
maior = b
menor = a
if(maior%menor == 0):
print("Sao Multiplos")
else:
print("Nao sao Multiplos") | arthursns/beecrowd-online-judge-beginner-solutions | 1044 - Múltiplos/1044.py | 1044.py | py | 217 | python | pt | code | 1 | github-code | 90 |
27092380478 | from spack import *
class NinjaFortran(Package):
"""A Fortran capable fork of ninja."""
homepage = "https://github.com/Kitware/ninja"
url = "https://github.com/Kitware/ninja/archive/v1.7.2.gaad58.kitware.dyndep-1.tar.gz"
# Each version is a fork off of a specific commit of ninja
# Hashes do... | matzke1/spack | var/spack/repos/builtin/packages/ninja-fortran/package.py | package.py | py | 1,523 | python | en | code | 2 | github-code | 90 |
18429442689 | #!/usr/bin/env python3
n, *b = map(int, open(0).read().split())
l = []
while True:
F = 1
for i, j in enumerate(b[::-1]):
if len(b) - i == j:
del b[len(b) - i - 1]
l += j,
F = 0
break
if F:
break
if b:
exit(print(-1))
for i in l[::-1]:
p... | Aasthaengg/IBMdataset | Python_codes/p03089/s602252706.py | s602252706.py | py | 327 | python | en | code | 0 | github-code | 90 |
38154090805 | import os
import subprocess
import numpy as np
import mmcv
from mmdet.apis import init_detector, inference_detector
from mmdet.core import get_classes
# Blog:
# https://blog.csdn.net/fengbingchun/article/details/86693037
# https://blog.csdn.net/fengbingchun/article/details/126199218
def show_and_save_result(img, res... | fengbingchun/PyTorch_Test | demo/openmmlab/test_mmdetection_faster_rcnn_r50_fpn_1x.py | test_mmdetection_faster_rcnn_r50_fpn_1x.py | py | 1,840 | python | en | code | 14 | github-code | 90 |
18467597649 | a,b,c = map(int,input().split())
c -= a
ans = a
a = 0
ans += 2 * min(b,c)
num = min(b,c)
b -= num
c -= num
if c:
ans += 1
else:
ans += b
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03186/s860575137.py | s860575137.py | py | 155 | python | fr | code | 0 | github-code | 90 |
18241815189 | from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
n=int(input())
def divisore(n):
divisors=[]
for i in range(1,int(n**0.5)+1):
if n%i==0:
divisors.append(i)
if i!=n//i:
divisors.append(n//i)
... | Aasthaengg/IBMdataset | Python_codes/p02722/s055974777.py | s055974777.py | py | 501 | python | en | code | 0 | github-code | 90 |
75166965096 | # 실습
# 맹그러봐!!!
import numpy as np
import pandas as pd
wine = pd.read_csv('../../data/csv/winequality-white.csv', sep = ';', header = 0)
print(wine.head())
print(wine.shape)
print(wine.describe())
wine_npy = wine.values
print(type(wine_npy))
x = wine_npy[:, :-1]
y = wine_npy[:, -1]
x = wine.drop('quality', axis = ... | lynhyul/AIA | ml/m48_wine_quality3.py | m48_wine_quality3.py | py | 1,383 | python | en | code | 3 | github-code | 90 |
74729179175 | """
Factory functions for setup
"""
from flask import Flask, jsonify
from flask_cors import CORS
import api.views as views
from api.config import ProdConfig
from api.database import db
from api.errors import FlaskError
def create_app(config_object=ProdConfig):
""" Factory function for creating application ob... | gilmoreg/legocollector | server/api/app.py | app.py | py | 1,059 | python | en | code | 0 | github-code | 90 |
31883030994 | # import os
import replit
import time
def clearSreen():
# os.system("cls")
replit.clear()
class MakePlayer:
def __init__(self, strength, wit, health):
self.strength = strength
self.wit = wit
self.health = health
class UserInterface:
def playerTurn(self):
print("Your Turn!!!")
print("Chose your move: \... | mineisv2/turn-based-game | main.py | main.py | py | 1,020 | python | en | code | 0 | github-code | 90 |
18464057609 | # longest path
import sys
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, M = map(int, input().split())
edge = defaultdict(lambda: [])
memo = [0] * 110000
done = [False] * 110000
def dp(v):
if done[v]:
return memo... | Aasthaengg/IBMdataset | Python_codes/p03166/s460790284.py | s460790284.py | py | 689 | python | en | code | 0 | github-code | 90 |
21936244970 | from collections import defaultdict, deque
import sys
import math
#get file contents and close file
txt_file = open('Resources/maze.txt','r')
file_content = txt_file.read()
txt_file.close()
#turn contents into a list
lines = file_content.splitlines()
rows = len(lines)
columns = len(lines[0])
possible_moves = []
for... | esholland85/AdventOfCode | mazeSolver.py | mazeSolver.py | py | 1,581 | python | en | code | 0 | github-code | 90 |
5508926145 | import typing
from sqlalchemy import Column
class CustomColumn(Column):
"""Custom Column implementation that also asks for a 'mapper_key' which is
used to map the data from the patchserver files to the model."""
def __init__(
self,
*args,
mapper_key: typing.Optional[str] = None,
... | HealYouDown/flandria | webapp/models/custom_sql_classes.py | custom_sql_classes.py | py | 1,088 | python | en | code | 9 | github-code | 90 |
18289221059 | from collections import deque
H,W = map(int, input().split())
s = ["#"*(W+2)]+["#"+input()+"#" for i in range(H)]+["#"*(W+2)]
def bfs(sh,sw):
if s[sh][sw] == "#":
return 0
queue = deque([(sh,sw)]) #スタート地点をdequeに入れる
dist = [[-1] * (W+1) for i in range(H+1)] #距離をメモするリストを作成
dist[sh][sw] = 0 #スタート地点の距離を0にする
... | Aasthaengg/IBMdataset | Python_codes/p02803/s777235455.py | s777235455.py | py | 1,236 | python | ja | code | 0 | github-code | 90 |
18241045849 | def solve():
N, K, C = map(int, input().split())
workable = [i for i, s in enumerate(input(), 1) if s=="o"]
if len(workable) == K:
return workable
latest = set()
prev = workable[-1]+C+1
for x in reversed(workable):
if prev - x > C:
latest.add(x)
prev = x
if len(latest) > K:
... | Aasthaengg/IBMdataset | Python_codes/p02721/s076397725.py | s076397725.py | py | 521 | python | en | code | 0 | github-code | 90 |
27902140340 | import sys
import os
import time
print('The command line arguments are:')
print(sys.argv)
source = ['/Users/learnlearn/PycharmProjects/pe/hw',]
target_dir = '/Users/learnlearn/Documents/Backup'
if not os.path.exists(target_dir):
os.mkdir(target_dir)
today = target_dir + os.sep + time.strftime('%Y%m%d')
time = t... | AUTHENTICGIT/PE | hw/backup_assign2.py | backup_assign2.py | py | 933 | python | en | code | 0 | github-code | 90 |
42621303933 | fhand = open('mbox-short.txt')
day = {}
for line in fhand:
words = line.split()
if len(words) < 2 or words[0] != 'From': continue
commit = words[2]
if commit in day:
day[commit] += 1
else:
day[commit] = 1
print(day)
| dzpiers/Python-For-Everybody | chapter_9-2.py | chapter_9-2.py | py | 252 | python | en | code | 0 | github-code | 90 |
23918185941 | import os
import setuptools
here = os.path.dirname(os.path.abspath(__file__))
def _get_version():
"""Parses the version number from VERSION file."""
with open(os.path.join(here, "VERSION")) as f:
try:
version_line = next(
line for line in f if not line.startswith("\"\"\""))
except StopIte... | google/differential-privacy | python/setup.py | setup.py | py | 1,959 | python | en | code | 2,901 | github-code | 90 |
161996931 | '''
A palindromic number reads the same both ways. The largest palindrome
made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit
numbers.
'''
def isPrime(n):
for i in range(2,int(n**0.5),1):
if (n % i == 0):
return False
return True
... | PMiskew/contest_problems | Project_Euler/largest_palindrome_product.py | largest_palindrome_product.py | py | 894 | python | en | code | 1 | github-code | 90 |
38744508143 | from typing import List, Dict
import tree_path as tp
import word_modality
from tree_path import ParsedDoc, Search, ParsedSentence, Tree
import clause_info as cli
def is_part_of_complex(v : Tree) -> bool:
return (v.sdata('deprel') in ('csubj', 'ccomp', 'ccomp:pmod') or Search('.[deprel=xcomp upos=VERB]').fin... | serban-hartular/UD_Search | antecedent_detection/statement_group.py | statement_group.py | py | 2,957 | python | en | code | 0 | github-code | 90 |
27306480345 | import os
directory = input()
replace_what = input()
replace_with = input()
for filename in os.listdir(directory):
file = os.path.join(directory, filename)
print(file)
if os.path.isfile(file):
new_name = filename.replace(replace_what, replace_with)
| MEngMihailTodorov/Softuni_courses | Softuni_Advanced_2022/Advanced/Python_Advanced/06_File_Handling_Exercise/00_Rename_Files.py | 00_Rename_Files.py | py | 281 | python | en | code | 0 | github-code | 90 |
11892064809 | #!/usr/bin/python3
########## sqlite_parser.py ##########
"""
This script takes config_database.json and a file to parse as arguments.
It then scans the latter for matches with regular expressions of records,
generated according to the schema provided by config_database.json.
The retrieved records are writt... | lupintoro/hiddenLite | sqlite_parser.py | sqlite_parser.py | py | 77,596 | python | en | code | 0 | github-code | 90 |
71225027496 | # -*- coding: utf-8 -*-
"""
@date: 2023/6/28 下午5:33
@file: logging.py
@author: zj
@description:
"""
import os
import logging
import logging.config
LOGGING_NAME = "yolov5"
def set_logging(name=LOGGING_NAME, verbose=True):
# sets up logging for the given name
rank = int(os.getenv('RANK', -1)) # rank in wor... | zjykzj/SimpleIR | simpleir/utils/logger.py | logger.py | py | 1,085 | python | en | code | 8 | github-code | 90 |
18806120547 | from datetime import datetime
from pathlib import Path
import numpy as np
import pandas as pd
import scipy.optimize
import structlog
import openstef.monitoring.teams as monitoring
from openstef.data_classes.prediction_job import PredictionJobDataClass
from openstef.enums import MLModelType
from openstef.tasks.utils.p... | OpenSTEF/openstef | openstef/tasks/split_forecast.py | split_forecast.py | py | 8,116 | python | en | code | 65 | github-code | 90 |
27244174569 | from __future__ import annotations
import os, sys
import click
import wandb
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import torch
from torch import Tensor
from torch import nn
import torchvision
import lightning as L
from pytorch_lightning.loggers import WandbLogger
from torchexplorer import wat... | spfrommer/torchexplorer | examples/cifar10_resnet/main.py | main.py | py | 4,124 | python | en | code | 12 | github-code | 90 |
18579057799 | import sys
n,y=map(int,input().split())
for i in range(n+1):
for j in range(n+1-i):
cul=10000*i+5000*j
if cul>y:
break
if cul+1000*(n-i-j)==y:
print(i,j,n-i-j)
sys.exit()
print(-1,-1,-1) | Aasthaengg/IBMdataset | Python_codes/p03471/s939634547.py | s939634547.py | py | 250 | python | en | code | 0 | github-code | 90 |
2744875676 | # should_continue = True
# if should_continue:
# print('Hello')
# known_people = ['John', 'Anna', 'Mary']
# person = input('Enter the person you know: ')
# if person in known_people:
# print('You know {}'.format(person))
# else:
# print('You don\'t know {}'.format(person))
# Exercise
def who_do_you_kn... | wesyoung9987/python-testing | refresher/if_statements.py | if_statements.py | py | 745 | python | en | code | 0 | github-code | 90 |
11348251639 | #!/usr/bin/env python2.7
# encoding=utf8 ---------------------------------------------------------------
# Project : PythonicCSS
# -----------------------------------------------------------------------------
# Author : FFunction
# License : BSD License
# ---------------------------------... | sebastien/pythoniccss | src/pythoniccss/command.py | command.py | py | 4,204 | python | en | code | 1 | github-code | 90 |
8832504536 | class FakeBlock(object):
def __init__(self, block_hash):
self.block_hash = block_hash
class FakeDAG(object):
def __init__(self, genesis_hash):
genesis = FakeBlock(genesis_hash)
self.block_map = {genesis.block_hash: genesis}
self.tips = {genesis}
def _assert_hashes(self, block_hash, parent_hashes):
if le... | kaspagang/kaspad-py-explorer | src/simulation/fakes.py | fakes.py | py | 1,227 | python | en | code | 8 | github-code | 90 |
5224913260 | import media
from shape import Shape
class Oval(Shape):
'''
Draw a Oval with the center (x,y) and width and heigh.
the class has methods:
__init__
__str__
draw
'''
def __init__(self, x=0, y=0, width=0, height=0, col=media.white,
priority=0):
'''
... | wangchi9/undergraduate-projects | collage image/oval.py | oval.py | py | 1,652 | python | en | code | 0 | github-code | 90 |
36954097944 | from flask import Flask,render_template,request,session,url_for,redirect
import pickle
from sqlite3 import *
app=Flask(__name__)
app.secret_key="pg1412"
@app.route("/",methods=["GET","POST"])
def home():
if "un" in session:
if request.method=="POST":
if "submit2" in request.form:
session.pop('un',None)
... | Parimal14121998/Loan-Approval-Predictor-using-ML | loanapp/app.py | app.py | py | 4,247 | python | en | code | 0 | github-code | 90 |
71161589096 | import csv
import os
from datetime import datetime
from django.contrib import admin, messages
from django.http import HttpResponse
import pandas as pd
from .models import PetProfile, ImportPetProfile
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
exportable... | buzhi-985/tset1 | PetProfile/admin.py | admin.py | py | 6,931 | python | en | code | 0 | github-code | 90 |
26809887367 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.transforms as transforms
fig, ax = plt.subplots()
x = np.random.randn(1000)
ax.hist(x, 30)
ax.set_title(r'$\sigma=1 \/ \dots \/ \sigma=2$', fontsize=16)
# 将x坐标转换为数据坐标,保持y坐标为Axes坐标
trans = transforms.blended_tra... | Queensbarry/PythonInAirSeaScience | visualization/c1.2.26.py | c1.2.26.py | py | 728 | python | en | code | 15 | github-code | 90 |
5563522310 | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any, Optional
class Handler(ABC):
@abstractmethod
def set_next(self, handler: Handler) -> Handler: pass
@abstractmethod
def handle(self, *args) -> Optional[int]: pass
class AbstractHandler(Handler):
_next_... | kristyko/SoftwareDesignPatterns | ChainOfResponsibility/arithmetic_handler.py | arithmetic_handler.py | py | 2,628 | python | en | code | 0 | github-code | 90 |
43300004391 | class Solution(object):
def asteroidCollision(self, asteroids):
"""
:type asteroids: List[int]
:rtype: List[int]
"""
stack = []
i = 0
while i < len(asteroids):
asteroid = asteroids[i]
if not stack or asteroid > 0 or stack[-1] < 0:
... | wanniDev/TIL_collection | algorithm/leetcode/asteroidCollision.py | asteroidCollision.py | py | 591 | python | en | code | 0 | github-code | 90 |
71111322857 | from org.csstudio.opibuilder.scriptUtil import PVUtil
from decimal import Decimal
val = PVUtil.getDouble(pvs[0])
if val == 1:
val = 0
pvs[0].setValue(val)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams"+display.getWidget("FileNameTextInput").getPropertyValue("text")+".cfg"
myfile = open(filename... | bernardocarvalho/isttok-epics | epics/css/sys-mng-opi/CSS/scripts/saveconfig.py | saveconfig.py | py | 684 | python | en | code | 0 | github-code | 90 |
21179975756 | n = int(input()) #array size
a = list(map(int,input().split()))
start = 0
#find start index
for i in range(n-1):
if a[i]>a[i+1]:
start = i
break
#find end index
end = 0
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
end=i
break
#reverse the array from the start to the end
reverse_s... | Tettey1/A2SV | contest_5/E_Sort_the_Array.py | E_Sort_the_Array.py | py | 602 | python | en | code | 0 | github-code | 90 |
15180444396 | # https://huggingface.co/transformers/v2.8.0/usage.html#extractive-question-answering
# other helpful place
# https://colab.research.google.com/github/pytorch/pytorch.github.io/blob/master/assets/hub/huggingface_pytorch-transformers.ipynb#scrollTo=vGOLOM1iRIbN
import torch
from torch import nn
from transformers.modeli... | kschreder/tt-apps | nlp/unmask/2-cpu.py | 2-cpu.py | py | 2,083 | python | en | code | 0 | github-code | 90 |
18331402949 | import bisect
def binary_search(items, a, b, i, j):
def c_is_x(c):
is1 = c > max(a - b, b - a)
is2 = c < a + b
if is1 and is2:
return 0
elif is1:
return 1
else:
return 2
low = j+1
high = len(items) - 1
while low <= high:
... | Aasthaengg/IBMdataset | Python_codes/p02888/s046213045.py | s046213045.py | py | 1,005 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.