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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
2033008070 | # N,M이 모두 1일 경우: 계싼 필요 X
# N 또는 M이 1일 경우: 그 방향만 확인
# 둘다 1이 아닐 경우: 모두 확인
T = int(input())
for i in range(1, T+1):
N, M = map(int, input().split())
board = [input() for _ in range(N)]
_skip = 0
_odd = set()
_even = set()
for y in range(0, N):
for x in range(M):
if board[y]... | YeonHoLee-dev/Python | SW Expert Academy/Lv.3/[14413] 격자판 칠하기.py | [14413] 격자판 칠하기.py | py | 721 | python | ko | code | 0 | github-code | 13 |
33266633040 | # -*- coding: utf-8 -*-
from Users.models import CustomUser
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
@login_required(login_url="/users/login/")
def index(request):
return render(request, 'index.html')
@login_required(login_url="/users/login/")
def UserList(req... | Donyintao/SoilServer | Users/views.py | views.py | py | 772 | python | en | code | 7 | github-code | 13 |
15184178665 | import os
from robot.libraries import BuiltIn
def getSuiteSrcDir():
from robot.api import logger as log
builtin = BuiltIn.BuiltIn()
srcPath = builtin.get_variable_value('${SUITE SOURCE}')
if os.path.isfile(srcPath):
srcDir = os.path.dirname(srcPath)
elif os.path.isdi... | SawarkarMayur/RobotTestWork | lib/util.py | util.py | py | 534 | python | en | code | 0 | github-code | 13 |
22957025125 | import random
import time
from heapq import heappop
from heapq import heappush
from utils import PositionManager as PosMan
class NoPathFoundException(Exception):
pass
class Agent:
def __init__(self, id_, position, target, env):
self.id = id_
self.position = position
se... | Dramine/TaquinSolver | agents.py | agents.py | py | 13,355 | python | en | code | 0 | github-code | 13 |
25123618181 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 22:34:58 2023
@author: Themanwhosoldtheworld
https://leetcode.com/problems/verifying-an-alien-dictionary/
"""
class Solution:
def isAlienSorted( self, words, order):
LexIndex = {}
for i in range(len(order)):
... | themanwhosoldtheworld7/LeetCode-Python | Alien Dictionary.py | Alien Dictionary.py | py | 795 | python | en | code | 0 | github-code | 13 |
21476561909 | from PyQt5.QtWidgets import QWidget, QApplication, QTimeEdit, QVBoxLayout
import sys
from PyQt5 import QtGui, QtCore
class Window(QWidget):
def __init__(self):
super().__init__()
self.title = "This is first thing"
self.height = 700
self.width = 1100
self.top ... | patsonev/PyQt5 | QTimeEdit.py | QTimeEdit.py | py | 1,100 | python | en | code | 0 | github-code | 13 |
16518187129 | #!/usr/local/bin/python
"""Solution to the 05-03-2015 NPR puzzle for pyshortz blog.
@authors: Leiran Biton, John O'Brien
"""
from test.test_getargs2 import Keywords_TestCase
class Solution(object):
"""Solution engine for the week's problem."""
# imports
from nltk.corpus import words, wordnet
# a... | johnobrien/pyshortz | solutions/20150503/kitchen.py | kitchen.py | py | 7,960 | python | en | code | 0 | github-code | 13 |
17055595524 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ManjiangTestttttt(object):
def __init__(self):
self._oi = None
@property
def oi(self):
return self._oi
@oi.setter
def oi(self, value):
self._oi = value
... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/ManjiangTestttttt.py | ManjiangTestttttt.py | py | 771 | python | en | code | 241 | github-code | 13 |
2424123313 | import os
import json
def load_json_file(json_file):
if not os.path.exists(json_file):
raise FileNotFoundError()
with open(json_file, 'r') as f:
json_data = json.load(f)
return json_data
def dump_json_data(json_data, out_path):
os.makedirs(os.path.dirname(out_path), exist_ok=True)
... | jadehh/MagicONNX | magiconnx/utils/io.py | io.py | py | 435 | python | en | code | 0 | github-code | 13 |
71548033618 | from pathlib import Path
import glob
def replace(fn):
with Path(fn).open('r') as f:
lines = f.readlines()
new_lines = []
is_start = True
no_lang = False
for i, l in enumerate(lines):
if '```' in l:
if is_start:
try:
lang = l.split('`... | vict0rsch/_vict0rsch.github.io | blockquotes_to_highlight.py | blockquotes_to_highlight.py | py | 1,628 | python | en | code | 0 | github-code | 13 |
25146278846 |
# 让我测试下你工作正不正常
import sys
from cvmaj import MajInfo
def testAI(moduleName):
m = __import__(moduleName, fromlist=[''])
if (not('discard' in dir(m) and 'action' in dir(m))):
raise Exception('missing implementation')
info = MajInfo()
info.hand = ['8p', '3m', '4m', '5m', '7m', '8m', '5s', ... | xdedss/cvmaj | cvmaj_check.py | cvmaj_check.py | py | 555 | python | en | code | 3 | github-code | 13 |
26041481256 | from typing import Dict
from typing import List
from typing import Optional
from typing import Union
import nucleus7 as nc7
import tensorflow as tf
from ncgenes7.data_fields.images import ImageDataFields
from ncgenes7.data_fields.object_detection import DetectionDataFields
from ncgenes7.data_fields.object_detection i... | audi/ncgenes7 | ncgenes7/postprocessors/object_detection.py | object_detection.py | py | 45,248 | python | en | code | 9 | github-code | 13 |
21949012096 | def gnome_sort(arr):
"""Гномья сортировака по возрастанию"""
pointer = 1
i = 1
while i < len(arr):
while arr[i] < arr[i - 1] and i != 0:
arr[i], arr[i - 1] = arr[i - 1], arr[i]
i -= 1
pointer += 1
i = pointer
return arr
| n-inferno/algorithms | sorting/gnome_sort.py | gnome_sort.py | py | 319 | python | en | code | 0 | github-code | 13 |
23744589875 | import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
import re
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
#Main Program
web = input('Enter - ')
count = input('Enter count: ')
count = int(count)
p... | criticalhitx/PythonForEverybody_CSR | Course 3/Chap 12/bsexam3.py | bsexam3.py | py | 889 | python | en | code | 0 | github-code | 13 |
18770750089 | # n진수 게임
# N : 튜브의 마지막 회차에 나오는 가장 큰 수의 10진수
# 시간복잡도 : O(N log N)
# n 을 base 진수로 바꾸는 함수
def make_n_base_number(n: int, base: int) -> str:
if n == 0:
return '0'
n_base_number = ''
while n > 0:
n, mod = divmod(n, base)
if mod >= 10:
n_base_number = chr(mod - 10 + ord('A')) ... | galug/2023-algorithm-study | level_2/n_base_game.py | n_base_game.py | py | 1,150 | python | ko | code | null | github-code | 13 |
7393951919 | from email import message
import enum
import discord
from discord.ext import commands
from dotenv import load_dotenv
import os.path
import csv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client()
member =list ()
def data_base_manager():
file_existence =... | wangel1990/BiscuitCasino | ReadWritebot.py | ReadWritebot.py | py | 1,665 | python | en | code | 1 | github-code | 13 |
25451744490 | """
@Project_Description:
Observe HaarCascade Face Recognition Classifier
performance on basic to complex images.
@Author:
Can Ali Ates
"""
# Import Libraries.
import os
import cv2
# Import Classifier.
faceCascade = cv2.CascadeClassifier("Files/face_recognition.xml")
# Create a Directory to Save Results... | canatess/basic_image_processing_projects | Face Detection on Image/main.py | main.py | py | 1,535 | python | en | code | 0 | github-code | 13 |
33759804001 | import aipy as a, numpy as n
def sim_src_Jy(fq_GHz, amp_Jy_150=.1, index=-1., dly_ns=100., phs_offset=1.):
spec = amp_Jy_150 * (fq_GHz / .150)**index
phs = phs_offset * n.exp(-2j*n.pi * fq_GHz.astype(n.complex64) * dly_ns)
return spec * phs
def sim_srcs(aa, pol, cnt_100Jy_per_sr_Jy=.1, cnt_index=-2., avg_... | HERA-Team/hera_sandbox | src/fg_sim.py | fg_sim.py | py | 6,084 | python | en | code | 1 | github-code | 13 |
43356981667 | from collections import deque
def solution(queue1, queue2):
answer = 0
goal = sum(queue1) + sum(queue2)
len_queue = len(queue1)
queue1, queue2 = deque(queue1), deque(queue2)
sum1, sum2 = sum(queue1), sum(queue2)
if goal % 2 == 1:
return -1
while sum1 != sum2:
answer += 1... | tr0up2r/coding-test | website/programmers/level2/187_same_sum_queues.py | 187_same_sum_queues.py | py | 684 | python | en | code | 0 | github-code | 13 |
30920818352 | from flask import Flask, Response
from flask import jsonify
from flask import make_response
from flask import request
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return Response("TastySpace is up and running!"), 200
else:
req = reques... | amonmoce/TastySpace | __init__.py | __init__.py | py | 1,117 | python | en | code | 0 | github-code | 13 |
70977529617 | import shioaji as sj
import pandas as pd
import numpy as np
from datetime import datetime as dt
from flask import Flask, request, abort
import sqlite3
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatureError
)
from linebot.models import *
app = Flask(__name__)
... | willta981165/Line_chatbot_Demo | app.py | app.py | py | 4,120 | python | en | code | 0 | github-code | 13 |
41726648074 | # Иванов М.
# Задание-1:
# Напишите функцию, возвращающую ряд Фибоначчи с n-элемента до m-элемента.
# Первыми элементами ряда считать цифры 1 1
def fibonacci(n, m):
def e_fibonacci(num):
if (num == 1) | (num == 2):
return 1
else:
return e_fibonacci(num - 1) + e_fibonacci(nu... | Max11175/DL_homework | homework 1/дз 4/hw04_normal.py | hw04_normal.py | py | 2,532 | python | ru | code | 0 | github-code | 13 |
7318650946 | import os
from unittest import mock
import swapper
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from openwisp_controller.connection.tests.utils import CreateConnectionsMixin
from ..swapper import load_model
Build = load_model('Build')
Category = load_model('Category... | openwisp/openwisp-firmware-upgrader | openwisp_firmware_upgrader/tests/base.py | base.py | py | 7,170 | python | en | code | 40 | github-code | 13 |
72366443537 | #10.Search for a value from an array.
def search(array, n):
i = 0
while i<len(array):
if array[i] == n:
return True
i = i + 1
return False
array = [2,3,4,5,10,11,12,15]
n = 10
if search(array,n):
print("found")
else:
print("not found") | karimsuzon/Developing-Python-Application | week6_taska10.py | week6_taska10.py | py | 288 | python | en | code | 0 | github-code | 13 |
18347580808 | """
Inception V3, suitable for images with around 299 x 299
Reference:
Szegedy, Christian, et al. "Rethinking the Inception Architecture for Computer Vision." arXiv preprint arXiv:1512.00567 (2015).
"""
import mxnet as mx
def Conv(data, num_filter, kernel=(1, 1), stride=(1, 1), pad=(0, 0), name=None, suffix=''):
... | zhreshold/mxnet-ssd | symbol/inceptionv3.py | inceptionv3.py | py | 9,786 | python | en | code | 763 | github-code | 13 |
18719868845 | #!/usr/bin/env python
# coding: utf-8
import os
import torch
import wandb
import time
from torch.optim.lr_scheduler import StepLR
from utils.register_dataset import register_vrd_dataset
from config import get_vrd_cfg, CHECKPOINT_DIR
from modeling.vltranse_256 import VLTransE
from utils.annotations import get_ob... | herobaby71/vltranse | src/train.py | train.py | py | 6,656 | python | en | code | 0 | github-code | 13 |
10734536598 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import deque
class Solution:
def widthOfBinaryTree(self, root: TreeNode) -> int:
q = deque()
... | Therealchainman/LeetCode | problems/maximum_width_of_binary_tree/solution.py | solution.py | py | 894 | python | en | code | 0 | github-code | 13 |
40474496115 | import inspect
from typing import Any
import pytest
from flowlayer.core.api import EngineAPI, FeatureStoreAPI, NetworkAPI, NetworkPlotAPI
@pytest.mark.parametrize(
"cls",
[
NetworkPlotAPI,
NetworkAPI,
EngineAPI,
FeatureStoreAPI,
],
)
def test_api_definition_setup(cls: Any... | jsam/flowlayer | tests/core/test_api.py | test_api.py | py | 848 | python | en | code | 1 | github-code | 13 |
24822265655 | import collections
from typing import List
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
# Create a dictionary to store the anagrams
anagram_dict = collections.defaultdict(list)
# Iterate through each word and group it with its anagrams
for word in s... | AhmedMunna172367/leetcode-150 | arrays-and-hashing/group_anagrams.py | group_anagrams.py | py | 736 | python | en | code | 0 | github-code | 13 |
32082051106 | # ESERCIZI
# REVERSE
# Scrivi una funzione che ha come argomento una parola.
# Verifica e stampa la stessa parola ma al contrario.
# es. 'abcd' -> 'dbca'
def reverse(word):
str = ""
for i in word:
str = i + str
print(str)
# se voglio che mi ritorni un oggetto devo usare return
# print me l... | MartPic/python-excercises | es_funzioni.py | es_funzioni.py | py | 1,403 | python | it | code | 0 | github-code | 13 |
73569049296 | def stringmaker(str):
phrase=str.capitalize();
if str.startswith(("how","why","when","where")):#how why etc are tuples
return "{}?".format(phrase)
else:
return "{}".format(phrase)
phrase=[]
while True:
str=input("Say something: ")
if(str=="/end"):
break
phrase.append(st... | Kanishq10/Practice-Programs | New python Docs/simpleprogram.py | simpleprogram.py | py | 375 | python | en | code | 0 | github-code | 13 |
15912856626 | from __future__ import absolute_import
import functools
import warnings
__author__ = "yesudeep@google.com (Yesudeep Mangalapilly)"
__all__ = [
"deprecated",
]
def deprecated(func):
"""Marks functions as deprecated.
This is a decorator which can be used to mark functions
as deprecated. It will resu... | gorakhargosh/mom | mom/decorators.py | decorators.py | py | 1,057 | python | en | code | 37 | github-code | 13 |
22911875968 | import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
#if using termux
#import subprocess
#import shlex
#end if
rng = np.random.default_rng()
num_samples = 1000000
s0 = np.array([1,0]).reshape(2,1)
max_snr = 10
snr_db = np.arange(0, max_snr+1)
p_error_est = np.zeros(snr_db.shape[0])
p_error... | Muhammed-Hamdan/iith-fwc-2022-23 | communication/codes/chapter5/biv_pe_snr.py | biv_pe_snr.py | py | 1,086 | python | en | code | 3 | github-code | 13 |
27781776653 |
# coding: utf-8
import numpy as np
#import PyQt4
import matplotlib
#matplotlib.use('qt4agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import itertools
pdfFile = PdfPages("Confusion_matrix.pdf")
def plot_confusion_matrix(cm, classes,
... | Gayatri012/MachineLearning | Neural Networks Classsification/cnm_plot.py | cnm_plot.py | py | 1,172 | python | en | code | 1 | github-code | 13 |
32072786638 | import mysql.connector
import os
import json
from flask import Flask, request, jsonify
from sqlalchemy import create_engine
from sqlalchemy import URL
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import tex... | Samir-Mamedaliyev/online_shop | backend/server.py | server.py | py | 3,788 | python | en | code | 0 | github-code | 13 |
29860073446 | import discord
from discord.ext import commands
client = commands.Bot(command_prefix="")
@client.event
async def on_ready():
print("Bot is ready")
@client.command()
async def hello(ctx):
await ctx.send("Hi there, I am the bot of V&P server. This is a sever made by Vihaan and Prakhar and we want you to invite... | vihaan035/my_testing_world_python | Discord Bot/bot.py | bot.py | py | 411 | python | en | code | 0 | github-code | 13 |
39536998639 | import json
import os
import sys
from pathlib import Path
import numpy as np
from sklearn.model_selection import train_test_split
CREMAD_DIR = Path(sys.argv[1])
print ('Generating labels and train/validation/test groups...')
label_dir = Path('Audio_16k')
labeldict = {
'ANG': 'anger',
'HAP': 'happy',
'DI... | Okko98/project | dataset/gen_labels.py | gen_labels.py | py | 1,492 | python | en | code | 0 | github-code | 13 |
11078853994 | import logging
import importlib
import functools
import collections
from typing import Dict, Any, Callable, Set, Optional
from .events import BaseEvent
from .runners import BaseRunner
from .utils import get_cls_path
from .hubs.base_hub import BaseHub
from .runnables import BaseRunnable
from .event_subscription import ... | aabversteeg/kafthon | kafthon/kafthon.py | kafthon.py | py | 3,231 | python | en | code | 0 | github-code | 13 |
31282346389 | from sys import stdin, stdout
lines = []
total = 0
for line in stdin:
line = line.strip()
# lines.append(line.strip())
# print(line)
if ((len(line.split(" "))) == 2):
a, b = line.split(" ")
if (int(b) < 100000):
print(int(b))
total += int(b)
print(total)
| math919191/AdventOfCode22 | FinishedDays/day7test.py | day7test.py | py | 314 | python | en | code | 1 | github-code | 13 |
27767810279 | """
Temp file for testing purposes.
"""
from pathlib import Path
from .untype import untype
NEXAMPLES = 4
EXAMPLES_PATH = Path("code_examples")
for n in range(1, NEXAMPLES + 1):
code_path = EXAMPLES_PATH / f"example_{n}.py"
code = code_path.read_text()
cleaned_code_path = EXAMPLES_PATH / f"example_{n}(un... | salt-die/gradual_untyping | gradual_untyping/__main__.py | __main__.py | py | 378 | python | en | code | 0 | github-code | 13 |
10892159835 | from database import db
class UsuarioModel(db.Model):
__tablename__ = 'usuario'
id = db.Column(db.Integer, primary_key=True)
usuario = db.Column(db.String(80))
senha = db.Column(db.String(80))
nome = db.Column(db.String(80))
sobrenome = db.Column(db.String(80))
def __init__(self, usuario... | CaioSilve/tei-martineira-back-python | Models/UsuarioModel.py | UsuarioModel.py | py | 1,183 | python | es | code | 0 | github-code | 13 |
42447360941 | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def encrypt(plain_text, shift_amount):
cipher_text = ""
for letter in plain_text:
position = alphabet.index(letter)
new_position = verifyShift(position + shift_amoun... | MarcosDaNight/100-days-of-code-Python | day-08/steps/DecryptionCeaser.py | DecryptionCeaser.py | py | 1,231 | python | en | code | 0 | github-code | 13 |
17058990304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ReportData(object):
def __init__(self):
self._city_code = None
self._line_code = None
self._position_id = None
self._pv = None
self._uv = None
@proper... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/ReportData.py | ReportData.py | py | 2,618 | python | en | code | 241 | github-code | 13 |
19147221074 | import dataclasses
from typing import Callable, Optional, Tuple
import haiku as hk
import jax.numpy as jnp
from typing_extensions import Protocol
from corax import types
from corax.jax import types as jax_types
# This definition is deprecated. Use jax_types.PRNGKey directly instead.
# TODO(sinopalnikov): migrate all... | ethanluoyc/corax | corax/jax/networks/base.py | base.py | py | 2,970 | python | en | code | 27 | github-code | 13 |
17842818552 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import streamlit as st
import pandas as pd
# In[ ]:
# In[2]:
def local_css(file_name):
with open(file_name) as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
# In[ ]:
# In[3]:
st.markdown(
"""
<style>
.repo... | himanshuparekh16/Data-Science_Python | updated_deployment.py | updated_deployment.py | py | 2,127 | python | en | code | 2 | github-code | 13 |
42826965590 | from json import dumps
import frappe
from frappe.model.document import Document
class InsightsDashboard(Document):
def validate(self):
self.validate_duplicate_items()
def validate_duplicate_items(self):
items = [d.visualization for d in self.visualizations]
if len(items) != len(set(i... | morghim/insights | insights/insights/doctype/insights_dashboard/insights_dashboard.py | insights_dashboard.py | py | 2,376 | python | en | code | null | github-code | 13 |
43260346102 | from re import match
s, t = input().replace('?', '.'), input()
for i in range(len(s) - len(t) + 1)[::-1]:
if match(s[i:i + len(t)], t):
key = (s[:i] + t + s[i + len(t):]).replace('.', 'a')
print(key)
break
else:
print('UNRESTORABLE')
| Shirohi-git/AtCoder | abc071-/abc076_c.py | abc076_c.py | py | 267 | python | en | code | 2 | github-code | 13 |
7001502636 | from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch.substitutions import Command, FindExecutable
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageSh... | ICube-Robotics/forcedimension_ros2 | fd_bringup/launch/fd.launch.py | fd.launch.py | py | 3,367 | python | en | code | 7 | github-code | 13 |
38834992033 | from SortingAlgorithm import SortingAlgorithm
from bubbleSort import bubbleSort
from Experiment import Experiment
import random
def geraListaOrdenada(tam):
lista = []
for i in range(tam):
lista.append(i)
return lista
def geraLista(tam):
lista = []
for i in range(tam):
lista.append(... | luisfilipels/Interview-Preparation | SortingAlgorithmsOOP/TestFile.py | TestFile.py | py | 954 | python | en | code | 10 | github-code | 13 |
31721610025 | import json
import requests
# KEEP THIS FILE VERY PRIVATE BECAUSE IT CONTAINS THE API KEY
APP_ID = "enter app id"
APP_KEY = "enter you key"
class NXException(BaseException):
pass
class NXClient(object):
SEARCH_END_POINT = "https://trackapi.nutritionix.com/v2/search/instant"
FOOD_END_POINT = "https://tr... | saratherv/Bot | fb_messenger_server/nutritionix.py | nutritionix.py | py | 1,217 | python | en | code | 0 | github-code | 13 |
21508766593 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.formula.api as smf
import statsmodels.api as sm
from scipy import stats
df = np.genfromtxt("proband_denovo_mutations_by_parent_age_tab_delimited.txt", delimiter = "\t", dtype = None, encoding = None, names = ["Proband_ID", "Pa... | cefmillard/qbb2022-answers | day5-lunch/proband_parental_age_regression.py | proband_parental_age_regression.py | py | 1,686 | python | en | code | 0 | github-code | 13 |
19219070977 | def bubble_sort(arr):
swap_count = 0
end = n - 1
while end > 0:
last_swap = 0
for i in range(end):
if arr[i] > arr[i + 1]:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
last_swap = i
swap_count += 1
end = last_swap
... | Choi-Jiwon-38/WINK-algorithm-study | week 3/버블 소트.py | 버블 소트.py | py | 414 | python | en | code | 0 | github-code | 13 |
33163971800 | print("Enter 1- Addition \n 2- Subtraction \n 3- Multiplication \n 4- Division \n 5- Find the Remainder")
user = int(input())
no1 = int(input("Enter the first number - "))
no2 = int(input("Enter the second number - "))
result = 0
def add():
result = no1+no2
return result
def subtract():
result = no... | AmanKeswani/Studies | python/calculator.py | calculator.py | py | 915 | python | en | code | 5 | github-code | 13 |
6997244173 | class Node:
def __init__(self, val):
self.data = val
self.right = None
self.left = None
def printLevelOrder(root):
if root is None:
return root
queue = []
return_list = []
queue.append(root)
while len(queue) > 0:
ans = []
l = len(queue)
... | sairamkrishna222/adil_workshop | adil_workshop/adil-mohammed-au9-dev/coding-challenges/week07/Day5/Levelorder.py | Levelorder.py | py | 753 | python | en | code | 0 | github-code | 13 |
31272866912 | #!/usr/bin/env python3
'''
Statistcal functions
'''
from collections import deque
from operator import add
def scan(f, g):
'''
left scan
:param f: function to apply to acc, value
:param g: iterable of values
'''
acc = tuple(next(g))
for x in g:
yield acc
acc = tuple(f(*va... | dutc/sample-repo | sample/statistics.py | statistics.py | py | 655 | python | en | code | 2 | github-code | 13 |
28520695440 | import argparse
import os
import matplotlib.pyplot as plt
import numpy as np
import random
import torch
import torch.nn as nn
from planning.image_tool_classifier.model import resnet18
from planning.image_tool_classifier.dataset import ToolDataset
from datetime import datetime
from torch.optim.lr_scheduler import Reduc... | hshi74/robocook | planning/image_tool_classifier/train.py | train.py | py | 9,556 | python | en | code | 43 | github-code | 13 |
74718305936 | from __future__ import annotations
from dataclasses import dataclass
from typing import Optional, Type, Generic
from persisty.batch_edit import BatchEdit, C, U
@dataclass
class BatchEditResult(Generic[C, U]):
edit: BatchEdit[C, U]
success: bool = False
code: Optional[str] = None
details: Optional[str... | tofarr/persisty | persisty/batch_edit_result.py | batch_edit_result.py | py | 1,054 | python | en | code | 1 | github-code | 13 |
3918601038 |
class Person:
def __init__(self,data):
self.name = data[0]
self.githubname = data[1]
self.semestercount = data[2]
self.githubcommits = data[3] #This should come from github api
self.attendcount = data[4]
self.wincount = data[5]
def str(self):
return self.name + " " + self.githubname | aztec-developers/roundrobin-wan | person.py | person.py | py | 303 | python | en | code | 0 | github-code | 13 |
22028937464 | #!/usr/bin/env python
# encoding: utf-8
"""
mh.py - A single myosin head
Created by Dave Williams on 2010-01-04.
"""
import numpy.random as random
random.seed() # Ensure proper seeding
from numpy import pi, sqrt, log, radians
import math as m
import warnings
class Spring:
"""A generic spring, from which we make ... | cdw/multifil | multifil/mh.py | mh.py | py | 29,117 | python | en | code | 1 | github-code | 13 |
3279970939 | import numpy as np
import random as random
from random import randrange
SAMPLES = 100
SEPARATION = 0.33
def linearly_separable_data(mA, sigmaA, mB, sigmaB):
classA_x1 = np.zeros(SAMPLES)
classA_x2 = np.zeros(SAMPLES)
classB_x1 = np.zeros(SAMPLES)
classB_x2 = np.zeros(SAMPLES)
for i in range(SAMPLE... | MariaBjelikj/DD2437 | Assignment1/DataGeneration.py | DataGeneration.py | py | 9,702 | python | en | code | 2 | github-code | 13 |
41813688213 | """find and write the intercept of the Iris versicolor class, label 1"""
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
data = load_iris()
X = data.data
y = data.target
model = LogisticRegression()
model.fit(X, y)
print(model.intercept_[1])
| ElenaErratic/samplePythonTasks | sklearn_logistic_regression/logistic_regression_intercept.py | logistic_regression_intercept.py | py | 289 | python | en | code | 0 | github-code | 13 |
16332856890 | '''
STUFF LEARNED:
- I really wanted to try to solve this with numpy, but was not able to learn the basics in time
- Trouble with finding the right "Frame" to view the code "ZAEZRLZG"
earlier solutions that appended coordinates to the pixel list were
abandoned bc of printing in the console
********... | toastedyeti/AdventOfCode2018 | D10/D10.py | D10.py | py | 2,677 | python | en | code | 0 | github-code | 13 |
29507314912 | class Entry:
def __init__(self, id, n_values, values):
self.id = id
self.n_values = n_values
self.values = values
def execute(n, entries):
minimums = []
for entry in entries:
minimums.append(min(entry.values))
smallest_min = min(minimums)
output = '{0} '.format(smal... | galacticglum/contest-solutions | ECOO/P2_R1_2018.py | P2_R1_2018.py | py | 1,105 | python | en | code | 0 | github-code | 13 |
13313294337 | # This file is basically just a dumb way to get around the Django settings issue for ANSIString...
class AnsiSettings:
def __init__(self):
# Mapping to extend Evennia's normal ANSI color tags. The mapping is a list of
# tuples mapping the exact tag (not a regex!) to the ANSI convertion, like
... | volundmush/shinma | shinma/modules/net/ansi_settings.py | ansi_settings.py | py | 2,159 | python | en | code | 0 | github-code | 13 |
31692673610 | percent_fat = int(input())
percent_protein = int(input())
percent_carbohydrates = int(input())
total_amount_kcal = int(input())
percent_water = int(input())
total_grams_fat = ((percent_fat / 100) * total_amount_kcal) / 9
total_grams_protein = ((percent_protein / 100) * total_amount_kcal) / 4
total_grams_carbs = ((perc... | DPrandzhev/Python-SoftUni | Programming_Basics-SoftUni-Python/pre-exam/cat_diet.py | cat_diet.py | py | 615 | python | en | code | 0 | github-code | 13 |
18091395969 | """
python实现链式栈模型
思路:
1.目标:栈(LIFO)
2.设计
栈顶:链表头部作为栈顶
入栈:添加链表头节点
出栈:删除链表头节点
栈底:链表尾部作为栈底,入栈和出栈操作
"""
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkStack:
def __init__(self):
"""初始化一个空栈"""
self.head = None
def e... | zmj90/document | tech/technical/数据结构/datastructure/day02_course/day02_code/05_linkStack.py | 05_linkStack.py | py | 1,065 | python | en | code | 0 | github-code | 13 |
38869136392 | #!/usr/bin/env python3
"""
Unit test ReviseAnno.
"""
__author__ = "Scott Teresi"
import logging
import os
import pytest
import coloredlogs
import numpy as np
import pandas as pd
import logging
from transposon.transposon_data import TransposonData
from transposon.revise_annotation import ReviseAnno
# --------------... | sjteresi/TE_Density | tests/unit/test_ReviseAnno.py | test_ReviseAnno.py | py | 8,109 | python | en | code | 25 | github-code | 13 |
32635790297 | import wave
import numpy as np
import pyaudio
import time
import librosa
import matplotlib.pyplot as plt
import librosa.display
from backend.models import NoteResult, Note
RECORDING_PATH = "backend/output.wav"
VOICED_PROB_THRESHOLD = 0.2
#TODO: COMPLETE
BEATS_AND_NOTE_NAME = {
0.25: "16",
0.5: "8",
0.75: "... | TheHong/VoiceIt | backend/note_analyzer.py | note_analyzer.py | py | 8,560 | python | en | code | 0 | github-code | 13 |
16015907747 | from inputdata import *
def interface():
print("""1 - добавление персоны,
2 - поиск,
3 - вывод на экран,
4 - импорт в файл
5 - удаление персоны
6 - изменить запись\n""")
ask = int(input())
if ask == 1:
input_data()
elif ask == 2:
search()
elif ask == 3:
print_data()
elif ask == 4:
load()
elif ask =... | Lerabal/Python | DZ8/interface_1.py | interface_1.py | py | 451 | python | ru | code | 0 | github-code | 13 |
17054029944 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KbIsvMaCode(object):
def __init__(self):
self._code = None
self._num = None
@property
def code(self):
return self._code
@code.setter
def code(self, value... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/KbIsvMaCode.py | KbIsvMaCode.py | py | 1,183 | python | en | code | 241 | github-code | 13 |
11098829849 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 25 17:27:28 2018
@author: tao
"""
"""
已知两点,求过两点直线的方程。已知第三点,求第三点到直线的距离,过第三点与此点的垂线、平行线方程。以及垂足
已知两点为(x1,y1),(x2,y2)第三点为(x0,y0)
输出以上所有结果
k为斜率
"""
import csv
import math
fo=open('C:\work\直线距离垂足问题.txt','w')
varys=[]
i=0
#数据格式要求,前四个数据为确定直线的数据,最后两个数据为直线外一点
with open('C:\work\data... | sirztao/caculate-lines-and-points | Points and lines caculations.py | Points and lines caculations.py | py | 2,292 | python | zh | code | 2 | github-code | 13 |
12653085030 | import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
# 使用掩膜提取ROI区域
img = cv.imread('D:/PycharmProjects/pythonProject1/Opencv 4.5/images/1.jpg')
img_RGB = cv.cvtColor(img, cv.COLOR_BGR2RGB)
# eyes = img[420:570, 420:860]
# create a mask
mask = np.zeros(img.shape[:2], np.uint8)
mask[420:570, 420:860... | Darling1116/Greeting_1116 | Opencv/lesson_4/ROI_2.py | ROI_2.py | py | 601 | python | en | code | 0 | github-code | 13 |
43254366231 | import sys; sys.stdin = open('15686_치킨배달_G5.txt', 'r')
from itertools import combinations
input = sys.stdin.readline
N, M = map(int, input().split())
stores = []
houses = []
dis = []
for i in range(N):
tmp = list(map(int, input().split()))
for j in range(N):
if tmp[j] == 2:
stores.append((... | KimSoomae/Algoshipda | week14/G5/김병완_15686_치킨배달_G5.py | 김병완_15686_치킨배달_G5.py | py | 682 | python | en | code | 0 | github-code | 13 |
410079877 | # install pip for python 3.9 if not installed
# check version usint "$ pip3.9 --version"
# if pip installed for python3.9 then run "pip3.9 install camelcase"
import camelcase
c = camelcase.CamelCase()
txt = "hello world"
print(c.hump(txt))
| atulkrishnathakur/mypython3_9 | camel_case_package.py | camel_case_package.py | py | 245 | python | en | code | 0 | github-code | 13 |
27503805503 | from lxml import etree
import re
import asyncio
import aiohttp
import psycopg2
import time
from pymongo import MongoClient
class Themes(object):
def __init__(self, title, url, author, text='', price=0, currency='грн'):
self.title = title
self.url = url
self.author = author
... | illusi0n455/SoftGroup-test | homework6/3.py | 3.py | py | 4,702 | python | en | code | 0 | github-code | 13 |
11578031720 | from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import ugettext as _
from django_mailbox.models import Mailbox
__all__ = ["UserMailbox"]
class UserMailbox(models.Model):
mailbox = models.OneToOneField(
Mailbox, on_delete=models.CASCADE, related_n... | Maible/maible | web/models.py | models.py | py | 738 | python | en | code | 1 | github-code | 13 |
35622061408 | import pygame
from config import Config
class Dino:
def __init__(self, x, y):
self.x = x
self.y = y
self.image = "dinoRun.png"
def dinoDraw(self, screen, duck, size):
x = size[0]
y = size[1]
xMod = 0
yMod = 0
if duck:
self.i... | hariskhawja/Dino-Game | dino.py | dino.py | py | 767 | python | en | code | 0 | github-code | 13 |
23030631592 | #!/usr/bin/env python3
import os
import sys
import torch
import logging
import speechbrain as sb
from hyperpyyaml import load_hyperpyyaml
from speechbrain.utils.distributed import run_on_main
import webdataset as wds
from glob import glob
import io
import torchaudio
logger = logging.getLogger(__name__)
# Brain clas... | Gastron/sb-2015-2020-kevat_e2e | eval_with_shallow_fusion.py | eval_with_shallow_fusion.py | py | 8,567 | python | en | code | 0 | github-code | 13 |
25811072084 | """
TCP Window scan
nmap flag: -sW
"""
import socket
from impacket import ImpactPacket, ImpactDecoder
from impacket.ImpactPacket import TCP
'''
This technique is same as the ACK scan but this goes a bit further to figure out
if the port is open or closed by checking the window size.
If window is positive, port i... | nandan-desai-extras/nmap-port-scan-works | tcp_window.py | tcp_window.py | py | 2,563 | python | en | code | 0 | github-code | 13 |
22153153510 | ############################## Load package ##############################
import os
import cv2
import sys
import glob
import math
import json
import time
import random
import shutil
import argparse
import requests
import functools
import numpy as np
from numpy import asarray
from numpy import moveaxis
from numpy imp... | joyoon1110/generator | generator.py | generator.py | py | 34,686 | python | en | code | 0 | github-code | 13 |
73708411216 | from typing import List
class MetricProvider:
@staticmethod
def mean_absolute_error(y_true, y_pred):
"""
Returns the average absolute error between each y value.
:param y_true: List of true values.
:param y_pred: List of predicted values.
:return: The average error.
... | thearod5/calorie-predictor | src/experiment/metric_provider.py | metric_provider.py | py | 1,015 | python | en | code | 1 | github-code | 13 |
31955914214 | import numpy as np
import pandas as pd
from imblearn.over_sampling import SMOTENC
def augment_dataset(
data: pd.DataFrame,
categorical_features: list,
target_feature: str = 'target',
k_parameter: int = 3
) -> pd.DataFrame:
"""Over-Sampling dataset augmentation
The main functio... | MAGomes95/Heart_Failure | src/features/augmention.py | augmention.py | py | 1,439 | python | en | code | 0 | github-code | 13 |
25205856964 | from psqldb import GetGameInfo
from dealsdb import GetDeals
from stringtolist import stolist2
# formats source for deal
def find_source(link):
if "gamestop" in link:
return "GameStop"
elif "razer" in link:
return "Razer Gamestore"
elif "humblebundle" in link:
return "Humble Bundle"
... | HussanKhan/Gamescout.io | GameScout/content_gen.py | content_gen.py | py | 5,177 | python | en | code | 0 | github-code | 13 |
43364355039 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 2 21:51:47 2019
@author: aguec
"""
import math
primes = [2,3]
for i in range(5,1000000,2):
primality = True
for j in range(3,int(math.sqrt(i))+1,2):
if i%j == 0:
primality = False
break
if primality == True:
primes.a... | aguecig/Project-Euler | Problems 41 - 50/pe_50.py | pe_50.py | py | 1,096 | python | en | code | 0 | github-code | 13 |
13129446185 | import argparse
import numpy as np
from chainer import serializers
from yolov2 import YOLOv2
parser = argparse.ArgumentParser(description="Convert darknet weights into chainer weights")
parser.add_argument('path', help="path of darknet yolo_v2 weights")
args = parser.parse_args()
print("loading", args.path)
file = ... | Kiikurage/webdnn-yolo_v2 | convert_model/convert_darknet_weight.py | convert_darknet_weight.py | py | 2,800 | python | en | code | 1 | github-code | 13 |
23169682879 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
from subprocess import Popen
from shutil import which
from PyQt5 import QtCore
from PyQt5.QtGui import ( QPainter, QColor, QPixmap, QImage, QIcon, QStandardItem,
QIntValidator, QStandardItemModel
)
from PyQt5.QtWidgets import (
QApplication, QMainWi... | ksharindam/gospel-pdf-viewer | gospel_pdf/main.py | main.py | py | 40,027 | python | en | code | 7 | github-code | 13 |
13051186120 | from Encryption import encrypt
from Decryption import decrypt
choice=int(input("Enter Your Option\n 1. Encryption\n 2. Decryption\n"))
if choice==1:
encrypt()
elif choice==2:
decrypt()
else:
print("Please Enter Correct Option") | aaryanrlondhe/Encryption-Decryption | encrypt-decrypt.py | encrypt-decrypt.py | py | 249 | python | en | code | 0 | github-code | 13 |
73614030739 | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/results', methods=['POST'])
def create_user():
print("submitted info")
print(request.form)
name_from_form = request.form['name']
dojo_location_from_... | karmel-yacoub/python | python-stack/flask/flask_fundamentals/Dojo_Survey/survey.py | survey.py | py | 740 | python | en | code | 0 | github-code | 13 |
297879979 | #test_7_10.py
#调查问卷开始
print("------Polling-----")
active = True
responses = {}
while active:
name = input("\nWhat's your name?")
place = input("If you could visit one place in the world,where would you go? ")
responses[name] = place
repeat = input("Would you like to let another person respond? (Y/N)... | ZYC0515/LearnPython | Python编程从入门到实践/第七章学习/代码实现/test_7_10.py | test_7_10.py | py | 517 | python | en | code | 0 | github-code | 13 |
23322544929 | #!/usr/bin/env python
import time
from samplebase import SampleBase
from rgbmatrix import graphics
from datetime import datetime
from PIL import Image
import subprocess
class ImageScroller(SampleBase):
def __init__(self, *args, **kwargs):
super(ImageScroller, self).__init__(*args, **kwargs)
self.p... | Sw-Saturn/rpi-clock | sign.py | sign.py | py | 2,878 | python | en | code | 0 | github-code | 13 |
33629296067 | fname = input("Enter file name: ")
fh = open(fname)
count = 0.0
nume = 0.0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") : continue
num = float(line[19:])
count = count + 1.0
nume = nume + num
result = nume/count
print("Average spam confidence: "+str(result))
| Marlon-Camacho/Python-Curses | secondtwoexercise.py | secondtwoexercise.py | py | 298 | python | en | code | 0 | github-code | 13 |
72995668179 | #!/usr/bin/python3
""" module that prins new lines after some characters
"""
def text_indentation(text):
"""function that prints a text with 2 new lines
after each of these characters: ., ? and :
Args:
text (str): string to print
"""
if type(text) is not str:
raise TypeError('te... | HeimerR/holbertonschool-higher_level_programming | 0x07-python-test_driven_development/5-text_indentation.py | 5-text_indentation.py | py | 676 | python | en | code | 1 | github-code | 13 |
41519585319 | # Cetvrta
# Solution by Hasan Kalzi 08-10-2020
# Link to problem in Kattis: https://open.kattis.com/problems/cetvrta
from sys import stdin, stdout
values = []
for i in range(3):
values.append(stdin.readline().strip().split())
if values[0][0] == values[1][0]:
x = values[2][0]
elif values[0][0] == values[2][0]:
... | Hasan-Kalzi/Kattis-Python3 | src/Py2/Cetvrta.py | Cetvrta.py | py | 531 | python | en | code | 0 | github-code | 13 |
10861483075 | """
geometry.py
Contains a number of utility functions to expediate
3D geometric programming, with points specified as numpy arrays.
"""
import numpy as np
import math
from operator import add
from multithreading_help import *
def dist(p, q):
"""Returns the L2 distance between points p and q."""
return np.lina... | augustjd/identify | geometry.py | geometry.py | py | 13,475 | python | en | code | 1 | github-code | 13 |
9644852458 | # importamos la conexion a la base de datos
from conexion import db_leyes
# importamos las funciones necesarias para el CRUD
import funciones
# definimos el menu principal con las opciones del CRUD y la opcion de salir del sistema
def menuPrincipal():
continuar = True
while continuar:
opcionCorrect... | KaybaMgk/CodeSquad | main.py | main.py | py | 2,835 | python | es | code | 0 | github-code | 13 |
19561279328 | # open one csv file
import pandas as pd
import easygui as eg
import numpy as np
import matplotlib.pyplot as plt
import os
def OpenCSVFiles(dirName):
directory = eg.diropenbox(default=dirName)
filenames = os.listdir(directory)
return directory, filenames
if __name__ == "__main__":
home_path = r'C:\Us... | Seabear-attack/AllisonLab | Plotting/spectrum_multiplotter.py | spectrum_multiplotter.py | py | 4,110 | python | en | code | 0 | github-code | 13 |
5941475856 | import sublime
import sublime_plugin
import os
GIT_BASE_MASTER_BRANCH_URL = "https://github.com/freshdesk/helpkit/tree/rails3-phase2/"
GIT_BASE_STAGING_BRANCH_URL = "https://github.com/freshdesk/helpkit/tree/staging/"
class LookAtMasterCommand(sublime_plugin.TextCommand):
def run(self, edit):
Utils.open_on_git(s... | SmartChimp/GitCheck | GitCheck.py | GitCheck.py | py | 785 | python | en | code | 1 | github-code | 13 |
19563146189 | print("Consulta1")
alquiler = abrir_tabla(tablas,"alquiler")
cliente = abrir_tabla(tablas,"cliente")
pais = abrir_tabla(tablas,"pais")
print(pais)
VC = pd.merge (alquiler,cliente,left_on ='id_cliente',right_on='id_cliente',how='inner')
VC = pd.merge (VC,pais,left_on ='id_pais',right_on='id',how='inner')
df= pd.read_e... | richardparra99/Programacion-IV | opencv/practica/proyecto.py | proyecto.py | py | 813 | python | pt | code | 0 | github-code | 13 |
15184213548 | from PyPDF2 import PdfFileWriter, PdfFileReader
import sys
from collections import Counter
pdfFile = sys.argv[1]
input = PdfFileReader(open(pdfFile, "rb"))
numOfPages = input.getNumPages()
for i in range(numOfPages):
page = input.getPage(i)
data = page.extractText()
data = data.split()
data = Counte... | HakubJozak/book-prereader | pdf.py | pdf.py | py | 342 | python | en | code | 2 | github-code | 13 |
41706720462 | # Brooke Czerwinski
# Homework 1
# Natural Language Processing - CS 410
# References:
# https://scikit-learn.org/stable/auto_examples/model_selection/gridSearch_text_feature_extraction.html
# https://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html
import numpy as np
import pandas as pd
i... | CzerPDX/cs410-nlp | hw1/hw1.py | hw1.py | py | 8,028 | 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.