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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
12764674306 | # Exercise 3: Print characters from a string that are present at an even index number
str = input( 'Please enter a string: ' )
print( str )
x = 0
for x in range(0, len(str) - 1, 2):
if( x % 2 == 0 ):
print( str[ x ] )
| TheCoderGuru/python_practice | printCharacters.py | printCharacters.py | py | 234 | python | en | code | 1 | github-code | 13 |
20524242840 | input = open("input.txt")
input = input.read()
input = input.split(', ')
direction = 0
x = 0
y = 0
visited = []
twice = False
for i in input:
if i[0] == "R":
direction += 1
if direction > 3:
direction = 0
elif i[0] == "L":
direction -= 1
if direction < 0:
... | Lesley55/AdventOfCode | 2016/1/part1.py | part1.py | py | 949 | python | en | code | 1 | github-code | 13 |
72636525779 | import unittest
from selenium import webdriver
from PO.app_creat import app_creat_Page
from PO.app_edit_del import app_edit_Page,app_del_Page
from PO.app_search import app_search_Page
import time
class TestApp(unittest.TestCase):
#driver = webdriver.Chrome()
@classmethod
def setUpClass(cls):
cls.d... | yinxiong007/api-automated-testing | api-auto-test/testcase/test_app.py | test_app.py | py | 4,350 | python | en | code | 0 | github-code | 13 |
44037328483 | import sys, math, time, zlib, colorsys, random, os, contextlib, array
#
# ttyfb 0.1 PREVIEW for Python
# 2021-04-17 Thomas Perl <m@thp.io>
# Based on code from the PyUGAT XMas Puzzle (2019-12-18)
#
# Copyright 2021 Thomas Perl
#
# Redistribution and use in source and binary forms, with or without
# modification, are p... | thp/ttyfb | ttyfb.py | ttyfb.py | py | 36,132 | python | en | code | 3 | github-code | 13 |
33496665511 |
myDict = {
"laptop" : "An electronic machine",
"parth " : "A simple boy",
"number" : [1,3,5],
"anotherDict" : {"Parth": "Coder"}
}
print(myDict["Laptop"])
print(myDict["Number"])
# It's an example of nested key
# Dictionary - Key:Value
print(myDict["anotherDict"]["Parth"])
| parthvashishtha/Python | Py.learning_files/Dictionary_syntax.py | Dictionary_syntax.py | py | 292 | python | en | code | 0 | github-code | 13 |
3634755040 | # Sort Words in Alphabatical Order
s = 'Hello World'
new_s = ''
word_list = s.split(' ') # ['Hello', 'World']
for word in word_list:
#lowercase_word = word.lower()
#sorted_word = "".join(sorted(lowercase_word))
#new_s = new_s + sorted_word + " "
new_s = new_s + "".join(sorted(word.lower())) + " "
new_s... | ashish-kumar-hit/python-qt | python/python-basics-100/String 2.7.py | String 2.7.py | py | 350 | python | en | code | 0 | github-code | 13 |
35160618917 | from datetime import datetime
from logging import debug
import logging
from model.ImagePost import ImagePost
from model.scoring import compute_score
from model.scoring import get_time_penalty
from persistence.Database import Database
from persistence.ImageStore import ImageStore
from scraper.integration import get_all_... | how2die/chan-backend | src/scraper/Scraper.py | Scraper.py | py | 3,941 | python | en | code | 0 | github-code | 13 |
22434578705 | from fastapi import APIRouter, HTTPException
from elasticsearch.exceptions import NotFoundError, ConnectionError
from typing import Optional
from app.connections import es, test_logger
import app.routers.envLog as envLog
router = APIRouter(
tags=["search"]
)
@router.get("/search_cv")
def read_item(q: Optional[st... | AlessandroRinaudo/elastic-search-project | app/routers/search.py | search.py | py | 1,114 | python | en | code | 0 | github-code | 13 |
72055487377 | def cyclic_sort(nums):
i = 0
size = len(nums)
while i < size:
if nums[i] != i+1 and nums[i] != nums[nums[i] - 1]:
swap = nums[i]
nums[i] = nums[swap - 1]
nums[swap - 1] = swap
else:
i += 1
return nums
def find_duplicate(nums):
arr = cy... | Abelatnafu/educativeio | pattern_cyclic_sort/find_the_duplicate_number.py | find_the_duplicate_number.py | py | 1,329 | python | en | code | 0 | github-code | 13 |
15918621202 | from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from copy import deepcopy
winStates = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]
player1 = True
player2 = False
class node :
def __init__(self, statex, stateo, empty, newstep):
... | anaas8/Tic-Tac-Toe | TicTacToe.py | TicTacToe.py | py | 8,461 | python | en | code | 0 | github-code | 13 |
42081671586 | def solution(s):
answer = 0
alpha = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
for i in range(len(alpha)):
if alpha[i] in s:
print(s.find(alpha[i]))
return answer
solution("oneoneone") | HotBody-SingleBungle/HBSB-ALGO | HB/pysrc/프로그래머스/레벨1/Day4/숫자_문자열과_영단어.py | 숫자_문자열과_영단어.py | py | 280 | python | en | code | 0 | github-code | 13 |
73473280017 | from rest_framework.routers import DefaultRouter
from django.urls import include, path
from .views import (UserViewSet, TagViewSet, IngredientViewSet,
RecipeViewSet, FavoriteRecipeView, ShoppingCartView,
download_shopping_cart)
router = DefaultRouter()
router.register('tags', T... | unnamestr/foodgram-project-react | backend/api/urls.py | urls.py | py | 826 | python | en | code | 0 | github-code | 13 |
23746416192 | class RuntimeConfig(object):
def __init__(self, argv):
from argparse import ArgumentParser
parser = ArgumentParser(
description = 'COVID19 Data Visualization')
parser.add_argument(
'-d', '--data-root',
help = 'The path to the root COVID19 data directory')
... | sabjohnso/monitoring | runtime_config.py | runtime_config.py | py | 721 | python | en | code | 0 | github-code | 13 |
3189756409 | import json
import jieba
input_pic = json.loads(open('build/all.json', 'r', encoding='utf-8').read())
tags = {}
def p_content(_pic):
tag = jieba.cut(_pic['p_content'])
for t in tag:
if tags.get(t):
if not _pic['PID'] in tags[t]:
tags[t].append(_pic['PID'])
else:
... | gggxbbb/TuPics | tags.py | tags.py | py | 622 | python | en | code | 2 | github-code | 13 |
25542591251 | import json
import os
import re
from datetime import date, datetime
import requests
from django.core import serializers
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from dotenv import load_dotenv
from data2.datamanager impo... | cleytonfs777/emendastelebot | telegram/views.py | views.py | py | 14,015 | python | pt | code | 0 | github-code | 13 |
1707501930 | #!/usr/bin/env python
from datetime import datetime
from elasticsearch import Elasticsearch
es_conn = Elasticsearch(
['192.168.200.10'],
http_auth=('elastic', 'rPz1ZRnowQw5ckgF9Jow'),
scheme="http",
port=9200,
)
# List indices of elasticsearch server
indices_list=es_conn.indices.get_alias('*')
pr... | taflilou/vagrantupselastic | datasender/elasticsearch/listindices.py | listindices.py | py | 339 | python | en | code | 0 | github-code | 13 |
21125925896 | import re
import argparse
import itertools
import numpy as np
import os, sys
import pandas as pd
import scipy.constants as sc
from formDataStructures import openHDF5, dataKey, printProgress
def extract_off_diag(mtx):
"""
extract off-diagonal entries in mtx
The output vector is order in a column major man... | hanjiepan/LEAP | real_data.py | real_data.py | py | 13,433 | python | en | code | 1 | github-code | 13 |
74880239058 | import io
import os
import numpy as np
import pytest
from hypothesis import HealthCheck, example, given, settings
import roffio
from .generators.roff_tag_data import roff_data
def test_write_adds_metadata():
f = io.BytesIO()
roffio.write(f, {})
f.seek(0)
read_contents = roffio.read(f)
assert r... | equinor/roffio | tests/test_read_write.py | test_read_write.py | py | 5,344 | python | en | code | 3 | github-code | 13 |
11151785274 | ##################################################################
#
# iDEA Simulator
# elf32instr.py
#
# Modelling elf32-bigmips instructions
# Fredrik Brosser 2013-05-14
#
##################################################################
# Imports
import sys
import re
class elf32instr:
## Constructor
def __... | warclab/idea | simulator/src/elf32instr.py | elf32instr.py | py | 2,862 | python | en | code | 14 | github-code | 13 |
20561598764 | list = []
score = int(input("how many numbers do you want to be added up"))
print("Enter The Numbers You Want Added Up")
for x in range(0,score):
score1 = int(input())
list.append(score1)
print("This Is Your Numbers", list)
AN = list # This Puts The List Into A Variable
S = sum(AN) # This Sums The Variabl... | 19JIvan/2017-Year-10-Programming | DoneForSchool/list of numbers 2.py | list of numbers 2.py | py | 398 | python | en | code | 0 | github-code | 13 |
7583922411 | # 주사위의 개수
def solution1(box, n):
answer = 1
for i in box:
answer = answer * (i // n)
return answer
# 합성수 찾기
def solution2(n):
cnt = 0
for num in range(1,n+1):
i = 2
while i < num:
if num % i == 0:
cnt += 1
break
i +=... | hjhyun98/Programmers-Algorithm | python/lv0/day11.py | day11.py | py | 942 | python | en | code | 0 | github-code | 13 |
21586924731 | import os
import imgaug as ia
from imgaug.augmenters.meta import SomeOf
import numpy as np
from imgaug import augmenters as iaa
from imgaug.augmentables.bbs import BoundingBox, BoundingBoxesOnImage
from PIL import Image
import setting
ia.seed(1)
def xywh_to_bbox(label, x, y, w, h):
return BoundingBox(x1=x - w ... | corenel/synthetic-image-generator | util.py | util.py | py | 10,098 | python | en | code | 0 | github-code | 13 |
4254364155 | import configargparse
import logging
import os
import platform
import random
import subprocess
import sys
import numpy as np
from espnet.utils.cli_utils import strtobool
from espnet.utils.training.batchfy import BATCH_COUNT_CHOICES
def main(cmd_args):
parser = configargparse.ArgumentParser(
config_file_... | vinitunni/CoupledLoss-LAS-ESPNet | espnet/bin/asr_train.py | asr_train.py | py | 20,747 | python | en | code | 2 | github-code | 13 |
14234557366 | # -*- coding: utf-8 -*-
"""
# 数据:20类新闻文本
# 模型:svc
# 调参:gridsearch
"""
### 加载模块
import numpy as np
import pandas as pd
### 载入数据
from sklearn.datasets import fetch_20newsgroups # 20类新闻数据
news = fetch_20newsgroups(subset='all') # 生成20类新闻数据
### 数据分割
from sklearn.c... | wanglei5205/Machine_learning | GridSearchCV_example/GridSearchCV_example.py | GridSearchCV_example.py | py | 2,109 | python | en | code | 75 | github-code | 13 |
8236500376 | from django.shortcuts import redirect
from django.utils.deprecation import MiddlewareMixin
from account.models import User
class AuthMiddleware(MiddlewareMixin):
def process_request(self, request):
# 排除那些不需要登录就能访问的页面
if request.path_info in ["/login/", "/image/code/"]:
return
... | yllgl/BookAdminSystem | account/middleware/auth.py | auth.py | py | 1,131 | python | en | code | 0 | github-code | 13 |
38961957442 | import torch
import torch.nn as nn
from torchvision.models import resnet18
import copy
from sr_mobile_pytorch.trainer.utils import imagenet_normalize
class ContentLossVGG(nn.Module):
def __init__(self, device):
super().__init__()
self.device = device
self.mae_loss = nn.L1Loss()
se... | bookbot-hive/sr_mobile_pytorch | sr_mobile_pytorch/trainer/losses.py | losses.py | py | 3,198 | python | en | code | 8 | github-code | 13 |
4026690817 | #searching for a sstring in a group of strings
str=[]
n=int(input('How many strings?'))
for i in range(n):
print('enetr string:',end='')
str.append(input())
s=input('Enter the key to search:')
flag=False
for i in range(len(str)):
if s==str[i]:
flag=True
print('Found at',i+1)
else:
prin... | Athira-Vijayan/Python | strings/search.py | search.py | py | 376 | python | en | code | 0 | github-code | 13 |
12686314408 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
# Recursive... | MatrixEnder1337/Data-Structures-and-Algorithms | leetcode/medium/24. Swap Nodes in Pairs.py | 24. Swap Nodes in Pairs.py | py | 689 | python | en | code | 0 | github-code | 13 |
35927675195 | class Al:
def __init__(self, a, b):
self.a = a
self.b = b
@staticmethod
def addition():
c = a + b
print(c)
@staticmethod
def subtraction():
c = a - b
print(c)
@classmethod
def division(cls):
c = cls.a / cls.b
print(c)
a = ... | raajeshkumar5035/python_projects | class_example3.py | class_example3.py | py | 484 | python | en | code | 0 | github-code | 13 |
8883098456 | import cv2 as cv
from cv2 import VideoCapture
cap = VideoCapture(0)
while True:
ret, frame = cap.read()
cv.imshow("Camera feed",frame)
if cv.waitKey(1) == "q":
break
cap.release()
cv.destroyAllWindows() | KshitijKulkarni/Chess-Project---AI-vs-Player | CameraTest.py | CameraTest.py | py | 225 | python | en | code | 0 | github-code | 13 |
26535507726 | import numpy as np
INPUT_LAYER_SIZE = 1
HIDDEN_LAYER_SIZE = 2
OUTPUT_LAYER_SIZE = 2
def init_weights():
Wh = np.random.randn(INPUT_LAYER_SIZE, HIDDEN_LAYER_SIZE) * \
np.sqrt(2.0/INPUT_LAYER_SIZE)
Wo = np.random.randn(HIDDEN_LAYER_SIZE, OUTPUT_LAYER_SIZE) * \
np.sqrt(2.0/HIDDEN_... | Ralfik555/Course_DS | jdsz2-materialy-python/DL/2_podstawy_DL/2_Full_NN.py | 2_Full_NN.py | py | 998 | python | en | code | 0 | github-code | 13 |
3726554060 | import gym
class AutoStopEnv(gym.Wrapper):
"""A env wrapper that stops rollout at step max_path_length."""
def __init__(self, env=None, env_name="", max_path_length=100):
if env_name:
super().__init__(gym.make(env_name))
else:
super().__init__(env)
self._rollou... | jaekyeom/IBOL | garaged/tests/wrappers.py | wrappers.py | py | 734 | python | en | code | 28 | github-code | 13 |
6573935112 | """
Final Project by Luit Meinen, last edited on the 20th of January.
Required libraries: Chess, pyqt5, speech_recognition and pyttsx3
Main class: runs the QSVGWidget and starts the game loop thread
"""
import chess
import chess.svg
import sys
from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import QApplicatio... | LoudMines/OTB-AI | main.py | main.py | py | 1,149 | python | en | code | 0 | github-code | 13 |
74564788498 | #!/usr/bin/env python
"""
_Workflow_
Unittest for the WMCore.DataStructs.Workflow class.
"""
import unittest
from WMCore.DataStructs.Workflow import Workflow
from WMCore.DataStructs.Fileset import Fileset
class WorkflowTest(unittest.TestCase):
"""
_WorkflowTest_
"""
def testDefinition(self):
... | dmwm/WMCore | test/python/WMCore_t/DataStructs_t/Workflow_t.py | Workflow_t.py | py | 2,383 | python | en | code | 44 | github-code | 13 |
48489337574 | #Vanshika Shah
#! /usr/bin/env python3
# Echo Server
import sys
import socket
import struct
import random
# Read server IP address and port from command-line arguments
serverIP = sys.argv[1]
serverPort = int(sys.argv[2])
# Create a UDP socket. Notice the use of SOCK_DGRAM for UDP packets
serverSocket = socket.socke... | vns25/Computer-Networks | HW2/ping-server.py | ping-server.py | py | 1,104 | python | en | code | 0 | github-code | 13 |
21569130295 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 10:59:02 2022
@author: hoshino
"""
import numpy as np
import pandas as pd
from modules.concn_effect_relationship import concentration_effect_relationship
# モデルの構造の選択
MODEL_TYPE = {'C':'Cyclic', 'R':'Reciprocal', 'B':'BindingModel'}['R']
# In Vivo と In Vitro の選択
InViv... | hoshino06/simultaneous_ndnb_modeling | fig_parameter_sweep.py | fig_parameter_sweep.py | py | 2,288 | python | en | code | 0 | github-code | 13 |
25585970110 | from exfil.aws.exfil import ExfilS3
from exfil.dns.exfil import ExfilDNS
from exfil.email.exfil import exfilEmail
from exfil.ftp.exfil import exfilFTP
from exfil.git.exfil import exfiltrate_to_github
from exfil.http_advanced.graphql.exfil import ExfilGraphQL
from exfil.http_advanced.grpc.exfil import ExfilGRPC
from exf... | bcdannyboy/dlpauto | src/dlpautomation/exfil/runners.py | runners.py | py | 32,765 | python | en | code | 0 | github-code | 13 |
17055934464 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MerchantQueryResult(object):
def __init__(self):
self._alias_name = None
self._cert_no = None
self._city = None
self._detail_address = None
self._distinct ... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/MerchantQueryResult.py | MerchantQueryResult.py | py | 4,677 | python | en | code | 241 | github-code | 13 |
35263514196 | """
===============================
Utils file for plotting results
===============================
Util functions for selecting the results that we will plot.
"""
from typing import Dict
import sys
from scipy.stats import sem
from utils.config import channels_mag, channels_grad1, channels_grad2, meg_rdm, meg_sensors,... | BabaSanfour/MFRS | similarity_analysis/plot_utils.py | plot_utils.py | py | 5,447 | python | en | code | 1 | github-code | 13 |
18592198752 |
import webapp2
import jinja2
import os
import urllib2
import json
import logging
from google.appengine.api import users
from google.appengine.ext import ndb
jinja_environment = jinja2.Environment(
loader = jinja2.FileSystemLoader(
os.path.dirname(__file__)))
class SignupHandler(webapp2.RequestHand... | quinaroonie/googleproject.github.io | main.py | main.py | py | 8,351 | python | en | code | 0 | github-code | 13 |
17158638477 | """ Inverse Kinematic based on numerical root finding method.
- Method : Inverse Pseudo Inverse Jacobian
- Return : 1 Possible Theta
"""
import numpy as np
from clampMag import clampMag
class ik_jacobian_pseudo_inverse:
def __init__(self, max_iteration, robot_class):
self.max_iter = max_iteration # fo... | Phayuth/robotics_manipulator | inverse_kinematic_numerical/numerical_jacpseudoinv.py | numerical_jacpseudoinv.py | py | 974 | python | en | code | 0 | github-code | 13 |
34355313618 | import rospy
from styx_msgs.msg import TrafficLight
import tensorflow as tf
import numpy as np
from keras.models import load_model
import cv2
OBJECT_DETECTION_MODEL_PATH = 'models/detection/frozen_inference_graph.pb'
CLASSIFICATION_MODEL_PATH = 'models/classification/classification_model.h5'
class TLClassifier(object... | deybvagm/CarND-Capstone | ros/src/tl_detector/light_classification/tl_classifier.py | tl_classifier.py | py | 3,878 | python | en | code | 0 | github-code | 13 |
1954952154 | # -*- coding: utf-8 -*-
"""
Problem 58 (Spiral primes)
Starting with 1 and spiralling anticlockwise in the following way,
a square spiral with side length 7 is formed.
37 36 35 34 33 32 31
38 17 16 15 14 13 30
39 18 5 4 3 12 29
40 19 6 1 2 11 28
41 20 7 8 9 10 27
42 21 22 23 24 25 26
43 44 45 46 47 48 49
I... | KubiakJakub01/ProjectEuler | src/Problem58.py | Problem58.py | py | 1,638 | python | en | code | 0 | github-code | 13 |
41057903315 | '''
本节视频
https://www.bilibili.com/video/BV1J54y1u7Vo/ “Python”高级教程 什么是内部函式?内部函式的作用,如何定义内部函式
本节文章
https://learnscript.net/zh-hant/python/senior/define-and-call-nested-functions/ 如何定义和呼叫巢状函式
'''
###
def main():
# 主函式 main,实现一个傻傻的聊天机器人
###
def show_message(text):
# 巢状函式 show_message,显示来自机器人的讯息
... | codebeatme/python | src/zh-hant/senior/nested_functions.py | nested_functions.py | py | 1,158 | python | zh | code | 1 | github-code | 13 |
32286146787 | import pygame
from src.Entity.Animals.Animal import Animal
class Wolf(Animal):
def __init__(self, world, position):
temp = pygame.image.load('assets/wolf.png')
scaled = pygame.transform.scale(temp, (world.scale, world.scale))
super().__init__(scaled, world, position, 'W', 9, 5)
def c... | Adrian-Sciepura/virtual-world-simulator | Python/virtual-world-simulator/src/Entity/Animals/Wolf.py | Wolf.py | py | 677 | python | en | code | 0 | github-code | 13 |
73537232336 | """doc"""
def main(num):
"""doc"""
agent = 0
lis = [0.07, 0.10, 0.15, 0.18, 0.20]
nummber = [list(range(10, 21)), list(range(21, 31)), list(range(31, 41)), list(range(41, 61))]
for i in range(len(nummber)):
if num in nummber[i]:
agent = lis[i]
if agent == 0 and num < 10:
... | film8844/KMITL-Computer-Programming-Year-1 | week11/week12_[Week 11] ManU.py | week12_[Week 11] ManU.py | py | 476 | python | en | code | 0 | github-code | 13 |
70871056979 | import numpy as np
import imageio
import matplotlib.pyplot as plt
from numba import cuda
@cuda.jit
def colorToGrayscaleConvertion( Pout,
Pin,
width,
height
):
col = cuda.blockIdx.x * cud... | lvllvl/python-api | cudas/colorToGrayscale.py | colorToGrayscale.py | py | 995 | python | en | code | 0 | github-code | 13 |
7494512293 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import Drawable
class Powerpoint(Drawable):
def __init__(self):
self.___list_draw_slides = None
self.___int_width = None
self.___int_height = None
self.___organizer_organizer = None
#PDF converter
#from fpdf import FPDF
#pdf = FPDF()
#pdf.add_page()
#pdf.set_fon... | DavidCastillo2/Moon-Bishop | LearningMyFriend/PowerPoint.py | PowerPoint.py | py | 657 | python | en | code | 0 | github-code | 13 |
4301078796 | # import json
# person = {'first': 'Jason', 'last':'Friedrich'}
# print(person)
# # print(json.dumps(person_dict))
# # person_json = json.dumps(person_dict)
# # print(person_json)
import json
person_dict = {'FirstName': 'Jason', 'LastName': 'Friedrich'}
person_dict['City']='Bochum'
staff_dict ={}
staff_dict['Evi... | gmmann/MSPythonCourse | jason.py | jason.py | py | 810 | python | en | code | 0 | github-code | 13 |
31624788854 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 09:46:57 2016
@author: ajaver
"""
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
if __name__ == '__main__':
#base directory
masked_image_file = '/Users/ajaver/Desktop/Videos/Avelino_17112015/MaskedVideos/CSTCTest_Ch1_18112015_075624.hdf... | ver228/work-in-progress | work_in_progress/_old/Intensity_analysis/check_maps.py | check_maps.py | py | 891 | python | en | code | 0 | github-code | 13 |
38279681886 | # usage: split test set from whole set
import os
import shutil
import random
source_path = os.path.abspath(r'inputs/lecdata/images')
target_path = os.path.abspath(r'inputs/pancreas/images')
target_path_1 = os.path.abspath(r'inputs/pancreas_test/images')
source_mask_path = os.path.abspath(r'inputs/lecdata/masks/0')
t... | Ethel217/2023grad | split.py | split.py | py | 977 | python | en | code | 0 | github-code | 13 |
13566514692 | import argparse
import sys
from collections import OrderedDict
class GroupArgParser(argparse.ArgumentParser):
def __init__(self, usage, conflict_handler):
self.groups_dict = OrderedDict()
self.briefHelp = None
self.examples = ""
super(GroupArgParser, self).__init__(usage=usage, con... | afortiorama/panda-client | pandatools/Group_argparse.py | Group_argparse.py | py | 3,441 | python | en | code | null | github-code | 13 |
7410573435 | # https://github.com/JamieLoughnane/python-tweet
import sys
try:
import tweepy
except ModuleNotFoundError:
sys.exit("Tweepy not found! Please enter 'pip install tweepy' into your Command Prompt/Terminal, for help using pip visit: https://pip.pypa.io/en/stable/")
print("First create a Twitter app at http... | JamieLoughnane/python-tweet | tweet.py | tweet.py | py | 1,371 | python | en | code | 0 | github-code | 13 |
13779331458 | from PIL import Image,ImageEnhance
from selenium import webdriver
import requests
import images
url = 'http://jwxt.upc.edu.cn/verifycode.servlet'
browser = webdriver.Chrome()
browser.get(url)
loc = browser.find_element_by_tag_name('img').location
left = loc['x']+2
top = loc['y']+2
right = left + 41
bot = top + 17
f... | alexischiang/KNN_captcha | get_captcha.py | get_captcha.py | py | 889 | python | en | code | 0 | github-code | 13 |
14688032180 | #!/usr/bin/python3
with open('aoc2020-25-input.txt', 'r') as f:
[doorpub, cardpub] = map(int, f.read().strip().split('\n'))
# Test data
#cardpub = 5764801
#doorpub = 17807724
def partone():
result = 1
encrypted = 1
while result != cardpub:
result = (result * 7) % 20201227
encrypted = (e... | annaoskarson/aoc2020 | aoc2020-25.py | aoc2020-25.py | py | 435 | python | en | code | 2 | github-code | 13 |
69837459539 | import re
import pickle
class Hmm:
def __init__(self, name="segmodel"):
with open(name, "rb") as model:
self.oh, self.hh, self.start = pickle.load(model)
self.h = list(self.hh.keys())
self.doc = []
self.lenh = len(self.h)
self.result = []
def s... | blackKeyMoe/cnlp | src_of_everything/hmm.py | hmm.py | py | 3,878 | python | en | code | 0 | github-code | 13 |
33268295463 | import spotipy.util as util
from creds import client_id, client_secret
username = 'spotify'
scope = 'ugc-image-upload user-read-private user-read-email user-follow-read user-library-read user-top-read user-read-recently-played playlist-read-collaborative playlist-read-private'
token = util.prompt_for_user_token(usern... | lukeveitch/SpotifyArtProject | Backend/auth.py | auth.py | py | 531 | python | en | code | 0 | github-code | 13 |
1417256315 | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Category(models.Model):
title = models.CharField('Category name', max_length=100)
parent = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True, related_name='child')
brend = mode... | VahagnZakaryan/Eshoper | main/models.py | models.py | py | 3,253 | python | en | code | 1 | github-code | 13 |
35012994492 |
if __name__ == '__main__':
# n, m = input().split()
# integer_list = map(int, input().split())
# set_a = map(int, input().split())
# set_b = map(int, input().split())
f = open('python/no-idea/test_case_8.txt')
n, m = f.readline().split()
integer_list = list(map(int, f.readline().split()))... | Crisheld/HackerRank-solutions | python/no-idea/solution.py | solution.py | py | 734 | python | en | code | 1 | github-code | 13 |
8320008824 | l=[10,2,3,4,5,5,5,6,6,7,10,[11,22,33,44,55,66],111,222,333,234,'umesh']
# # l1=[]
# # l1=l[0]
# # j=0
# # for i in l[1::]:
# # if(type(i)==int):
# # if (l1[j]!=i):
# # l1.append(i)
# #
# # else:
# # pass
# c=0
# print(l)
# for i in l:
# for j in l:
# ... | Tandon07/Practical-Contents | July9oops_day3/prac.py | prac.py | py | 957 | python | en | code | 1 | github-code | 13 |
12994903249 | """
rulemining.py file
File which contains the full mining capability using the binary INK representation.
This file is adapted from:
Bayesian Rule Set mining by Tong Wang and Peter (Zhen) Li
reference: Wang, Tong, et al. "Bayesian rule sets for interpretable classification.
Data Mining (ICDM), 2016 IEEE 16th Internat... | IBCNServices/INK | ink/miner/rulemining.py | rulemining.py | py | 19,168 | python | en | code | 14 | github-code | 13 |
72060672657 | #!/usr/bin/env python
# coding=utf-8
"""
Holding functions to manipulate city object
"""
# import sympy.geometry.point as point
import shapely.geometry.point as point
import pycity_calc.cities.scripts.city_generator.city_generator as citgen
import pycity_base.classes.demand.SpaceHeating as SpaceHeating
import pycity... | RWTH-EBC/pyCity_calc | pycity_calc/toolbox/modifiers/mod_city_geo_pos.py | mod_city_geo_pos.py | py | 6,372 | python | en | code | 7 | github-code | 13 |
1346915311 | import math
from typing import Dict, List, Optional, Tuple
import torch
from torch import nn
from pyhealth.datasets import SampleEHRDataset
from pyhealth.models import BaseModel
from pyhealth.tokenizer import Tokenizer
# VALID_OPERATION_LEVEL = ["visit", "event"]
class Attention(nn.Module):
def forward(self, q... | sunlabuiuc/PyHealth | pyhealth/models/transformer.py | transformer.py | py | 20,506 | python | en | code | 778 | github-code | 13 |
70871055379 | from flask_cors import CORS
import sys
sys.path.append('.')
from cudas.colorToGrayscale import colorToGrayscaleConvertion
from cudas.imageBlur import imageBlur
from flask import Flask, request, jsonify, send_from_directory
from werkzeug import urls
from werkzeug.utils import secure_filename
from PIL import Image
import... | lvllvl/python-api | api/api.py | api.py | py | 5,118 | python | en | code | 0 | github-code | 13 |
22396321332 | import numpy as np
import pandas as pd
import time
from matplotlib.widgets import Slider
# nucleosynth
from nucleosynth.tracers import load_save, tracer_tools
from nucleosynth import paths
from nucleosynth import network
from nucleosynth import plotting
from nucleosynth import printing
from nucleosynth import tools
"... | zacjohnston/nucleosynth | nucleosynth/tracers/tracer.py | tracer.py | py | 21,054 | python | en | code | 2 | github-code | 13 |
13206264515 | X, Y, Z = None, None, None
i = 0
while i < X:
print("--X--", end="")
j = 0
while j < Y:
print("!Y!", end="")
k = 0
while k < Z:
print("Z", end="")
k += 1
j += 1
print(" ", end="")
i += 1
print("done")
| z5267282/thesis | backend/test-questions-theory/q1.py | q1.py | py | 281 | python | en | code | 0 | github-code | 13 |
16811308464 | #!/usr/bin/env python3
# Takes the JSON output of googletest and prints information about the longest running tests and test suites
import json
import sys
from terminaltables import AsciiTable
if len(sys.argv) != 2:
print('Usage: (1) Run googletest with --gtest_output="json:output.json"')
print(' (2) "... | hyrise/hyrise | scripts/analyze_gtest_runtime.py | analyze_gtest_runtime.py | py | 1,227 | python | en | code | 722 | github-code | 13 |
7316644115 | import scipy as sp
import matplotlib.pyplot as plt
data= sp.genfromtxt("web_traffic.tsv",delimiter="\t") #tsv for tab data
x = data[:,0]
y = data[:,1]
plt.scatter(x,y)
plt.title("Web Traffic last Month")
plt.xlabel("Time")
plt.ylabel("Hits/hours")
plt.xticks()
plt.autoscale(tight=True)
plt.grid()
plt.show() | raviveer792/HPE | Plot_data.py | Plot_data.py | py | 309 | python | en | code | 0 | github-code | 13 |
73605346578 | # !/usr/bin/python3
# -*- coding: utf-8 -*-
import collections
from typing import Optional
# @Author: 花菜
# @File: 104二叉树的最大深度.py
# @Time : 2022/11/2 17:42
# @Email: lihuacai168@gmail.com
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self... | lihuacai168/LeetCode | 二叉树/二叉树的深度和高度/104二叉树的最大深度.py | 104二叉树的最大深度.py | py | 1,160 | python | en | code | 4 | github-code | 13 |
586732175 | # Example code for discussing indegree and outdegree in a directed graph
class DirectedGraph:
def __init__(self, vertices):
self.vertices = vertices
self.edges = 0
self.indegree = {v: 0 for v in range(vertices)}
self.outdegree = {v: 0 for v in range(vertices)}
def add_edge(self,... | Hienu/TranDanhHieu_CTDL | Đề tài giữa kỳ_DK009/15 Graphs/002 Graphs - Degree of a Vertex/c.py | c.py | py | 940 | python | en | code | 0 | github-code | 13 |
72829503699 | import bpy
from bpy.props import *
from ... base_types import AnimationNode
class sequenceNode(bpy.types.Node, AnimationNode):
bl_idname = "an_sequenceNode"
bl_label = "Multi-Channel Sequencer"
bl_width_default = 180
message1 = StringProperty("")
def create(self):
self.newInput("Integer",... | Clockmender/My-AN-Nodes | nodes/general/sequence.py | sequence.py | py | 1,493 | python | en | code | 16 | github-code | 13 |
16979220959 | from math import sqrt, isnan
import csv
dataFile = '../data/error_test.csv'
algorithmDescriptionIdx = 1
def readData():
result = []
headers = []
with open(dataFile , 'r') as file:
reader = csv.reader(file, skipinitialspace=True, delimiter=';')
rowCounter = 0
for r in reader:
... | oertl/bagminhash | python/error_table.py | error_table.py | py | 6,778 | python | en | code | 25 | github-code | 13 |
70766814099 | import pygame
import random
from Deck import Deck
from Player import Player
from computer import Computer
class Turn:
def __init__(self, players_num):
# players 리스트의 첫 번째 인자가 항상 먼저 시작
self.randomTurn = 0
self.players_num = players_num
self.current_player = 0
self.direction =... | SE12Team/UNO | Game.py | Game.py | py | 4,105 | python | ko | code | 0 | github-code | 13 |
34487831176 | from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from django.db import connection
from order.forms import OrderForm
import string
from random import *
import datetime
def order(request):
if request.method == 'POST':
form = OrderForm(request.POST)
if ... | purplxholic/database_proj | order/views.py | views.py | py | 1,332 | python | en | code | 0 | github-code | 13 |
38072479248 | # steering file for BS->ESD step -- data configuration
# see myTopOptions.py for more info
#doCBNT=False
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
import glob
if not ('EvtMax' in dir()):
acf.EvtMax=10
if not 'BSRDOInput' in dir():
acf.BSRDOInpu... | rushioda/PIXELVALID_athena | athena/Trigger/TrigValidation/TrigP1Test/share/testAthenaP1BStoESD_data.py | testAthenaP1BStoESD_data.py | py | 2,760 | python | en | code | 1 | github-code | 13 |
12408203380 | import os
import pandas as pd
# Note: The first row or column integer is 1, not 0.
directory = 'C:/Users/natha/OneDrive/Desktop/Summer 2023 Image analysis/Ua vs Ui Data/'
files = [] # list of the paths of all excel docs in the folder
# iterate over files in directory and add them to files
for filen... | theburger222/Summer_2023_Image_Processing | Convert CSV to XLSX.py | Convert CSV to XLSX.py | py | 888 | python | en | code | 0 | github-code | 13 |
8253716377 | from hyperopt import hp
from hyperopt.pyll.base import scope
import pytest
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestClassifier
import xgboost as xgb
from training_templates.tuners import XGBoostHyperoptTuner, Tuner
from training_templates.data_utils import sample_pa... | marshackVB/training_templates | tests/test_tuners.py | test_tuners.py | py | 2,548 | python | en | code | 0 | github-code | 13 |
39219229134 | import socket
import requests
import re
import threading
import json
#testpx
#
timeout = 300
nodatatime = 5
def getPX():
p = requests.get("http://127.0.0.1:5010/get/").json().get("proxy")
p = str(p)
ip = str(p.split(":")[0])
port = int(p.split(":")[1])
print("new ip is:" + ip + ":"... | cctes/proxyTunnel | proxyTunnel测试版.py | proxyTunnel测试版.py | py | 2,580 | python | en | code | 7 | github-code | 13 |
5249664252 | def latin_square(N, array):
trace, r, c = 0, 0, 0
for i in range(N):
trace += array[i][i]
row = set(array[i])
if len(row) != N: r += 1
column = set(row[i] for row in array)
if len(column) != N: c += 1
return trace, r, c
tests = int(input())
for i in range(tests):
... | tikcho/CodingPracticePython | Vestigium.py | Vestigium.py | py | 537 | python | en | code | 0 | github-code | 13 |
33517037069 | import pandas as pd
import numpy as np
# 유저 데이터
u_cols = ['user_id', 'age', 'sex', 'occupation', 'zip_code']
users = pd.read_csv("dataset/ml-100k/u.user", sep="|", names=u_cols, encoding="latin-1")
# print(users)
# 영화 데이터
# 2가지 이상의 장르에 1을 갖는 영화도 있음
# 원 핫 인코딩 형태임
i_cols = ['movie_id', 'title', 'release date', 'video ... | kaminion/recommendation | 2-2.segment.py | 2-2.segment.py | py | 3,633 | python | ko | code | 0 | github-code | 13 |
4058986758 | import unittest.mock as mock
from ..errors import ClientError
from ..models import UserAccount
from ..core import GameServer, UserSession
from ..world import GameWorld
from .tm_test_case import TildemushTestCase
class CommandTest(TildemushTestCase):
def setUp(self):
super().setUp()
self.log_mock ... | vilmibm/tildemush | server/tmserver/tests/command_test.py | command_test.py | py | 2,654 | python | en | code | 44 | github-code | 13 |
74868329298 | from django.db import models
from democrance.commons.mixins import ModelWithTimestamp
class PolicyType(ModelWithTimestamp):
"""
This is being done like this in order to standardise the policy types.
"Why not use a enumeration" - these make changes complicated and will
require database migrations, an... | duoi/democrance-project | policy/models.py | models.py | py | 1,422 | python | en | code | 0 | github-code | 13 |
37594041421 | def min_max(lista):
prod = 1
min = 1
max = lista[0] * lista[1]
for i in range(len(lista)):
for j in range(i + 1, len(lista)):
prod = lista[i] * lista[j]
if prod > max:
max = prod
elif prod < min:
min = prod
return min, max
... | HeresG/gabi | ALGORITMI 2 HGI/lab5b.py | lab5b.py | py | 404 | python | en | code | 0 | github-code | 13 |
74908601296 | import requests
import time
# Option 1: Not good, because the parameter is too long
# url = "https://movie.douban.com/j/chart/top_list?type=13&interval_id=100:90&action=&start=0&limit=20"
# headers = {
# "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Ch... | TBSAAA/Web-crawler | 01_data_filter_regular_expression/douban_rank.py | douban_rank.py | py | 1,214 | python | en | code | 0 | github-code | 13 |
4600378853 | #将int数字翻转过来 要注意溢出问题 也可以将int转换为字符串翻转字符串再转换为int数字 当然也要注意溢出问题
class Solution(object):
def reverse(self, x):
type = 0
if(x<0):#python 正负数求余规则不同
type=-1
x=0-x
res = 0
while(x>=10):
res = int(res*10) + int(x%10)
x = int(x/10)
res = int(res*10) + int(x%10)
if(type == -1):
res = 0-res
if(res>2... | FaceWaller/MyLeetCode | 7.Reverse Integer(翻转int).py | 7.Reverse Integer(翻转int).py | py | 586 | python | ja | code | 0 | github-code | 13 |
19241693770 | import os
import copy
import torch
import logging
import itertools
import contextlib
import numpy as np
import seaborn as sns
from PIL import Image
from collections import OrderedDict
from pathlib import Path
from .evaluator import DatasetEvaluator
from trackron.utils import comm
from trackron.config import CfgNode
_P... | Flowerfan/Trackron | trackron/evaluation/sot_evaluation.py | sot_evaluation.py | py | 11,074 | python | en | code | 46 | github-code | 13 |
31769083144 | # -*- coding: utf-8 -*-
"""
Code to standardize dataframe based on groupby columns
Creates a new dataframe with standardized values
Created on 3/30/2021
@author: Giovanni R Budi
"""
import pandas as pd
import numpy as np
def make_columns_float(dataframe, cols):
"""
Change specified columns in dataframe to da... | giometry/Data-Analysis-Snippets | Standardization/standardize.py | standardize.py | py | 4,018 | python | en | code | 0 | github-code | 13 |
34016459785 | import os
from pendulum import datetime, duration
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator
from utils.slack_operator import task_fail_slack_alert
DEPLOYMENT_ENVIRONMENT = os.getenv("ENVIRONMENT", "development")
default_args = {
"owner": "airflow",
"descript... | cityofaustin/atd-airflow | dags/test_slack_notifier.py | test_slack_notifier.py | py | 1,002 | python | en | code | 2 | github-code | 13 |
21539403109 | import numpy as np
import theano
import theano.tensor as T
from sklearn.base import BaseEstimator
import logging
import time
import sys, os
import datetime
import cPickle as pickle
from collections import OrderedDict
from itertools import izip
import os, sys
import logging
reload(logging)
logger = logging.getLogger(os... | iacercalixto/mme-positive-examples-mse | RNN_sentence_embedder_mse.py | RNN_sentence_embedder_mse.py | py | 6,973 | python | en | code | 2 | github-code | 13 |
10311843530 | from flask import Flask, request, abort
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatureError
)
from linebot.models import (
MessageEvent, TextMessage, TextSendMessage,
)
app = Flask(__name__)
line_bot_api = LineBotApi('73Mu8Bojy7PwkWxy+bV0eFVUVasQzliOp... | sing0510/line-bot | app.py | app.py | py | 1,259 | python | en | code | 0 | github-code | 13 |
27194522756 | import torch
import torch
import torch.nn as nn
import torch.nn.functional as F
from model_components import Block
class GPTLanguageModel(nn.Module):
"""
Implements a GPT language model.
This model is based on the transformer architecture, specifically designed for generative pre-training
of language... | ahmedmshazly/gpt_class_activity | new/gpt_model.py | gpt_model.py | py | 5,649 | python | en | code | 0 | github-code | 13 |
19065316041 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# https://github.com/tpaviot/pythonocc-demos/blob/master/examples/core_classic_occ_bottle.py
import os
from OCC.gp import gp_Pln, gp_Dir, gp_Pnt, gp_OY, gp_Trsf
from OCC.STEPControl import STEPControl_Reader
from OCC.TopAbs import TopAbs_FACE
from OCC.TopExp import... | KodeWorker/3DModelAnalysis | dev/20190808/dev_cross_section2_write_dxf.py | dev_cross_section2_write_dxf.py | py | 2,884 | python | en | code | 0 | github-code | 13 |
38267959054 | """The image on the webpage is an anchor to another webpage with a similar
url. Appended to the end of the url however is a web-query entitled "nothing"
with a value of 44827. The content of the new page is "and the next nothing is",
followed by a number. This hints that we should alter the web-query by changing
the va... | cjonsmith/python-challenge | problem_04.py | problem_04.py | py | 1,923 | python | en | code | 0 | github-code | 13 |
74560006416 | # Hi 0191121332, please visit http://202.207.12.156:9014/context/3ff280105813f582c7c38dabedd901bc fill text
import requests
import json
import numpy as np
url ="http://202.207.12.156:9014/step_06"
r = requests.get(url)
q = r.text
q = json.loads(q)
# q = eval(q)
# print(q)
# print((type(q)))
n = q["questions"]
prin... | GritYolo/AI_Summer | 6.py | 6.py | py | 818 | python | en | code | 0 | github-code | 13 |
72060646417 | #!/usr/bin/env python
# coding=utf-8
"""
Script with functions to dimension local heating and decentralized electrical
networks.
Currently, no support for separate heating_and_deg network dimensioning
(first lhn, then deg dimensioning; plus overlapping),
if street routing is used!
If you want to have a heating_and_deg... | RWTH-EBC/pyCity_calc | pycity_calc/toolbox/dimensioning/dim_networks.py | dim_networks.py | py | 26,636 | python | en | code | 7 | github-code | 13 |
74008741458 | import os
import re
ids = set()
# Do with /bioSamples/list_biosamples.txt if for all data
# Do with /bioSamples/list_randomInit_biosamples.txt if for labeled data
filePath = "/bioSamples/list_biosamples.txt"
with open(filePath, "r") as readFile:
for line in readFile:
line = line.rstrip()
ids.add(li... | toolzakinbo/racegeo | scripts/download.py | download.py | py | 859 | python | en | code | 0 | github-code | 13 |
21264388266 | #
# @lc app=leetcode id=79 lang=python3
#
# [79] Word Search
#
# @lc code=start
from typing import List
class Solution:
'''
Solution 1: 记录下当前cell的值, 并替换为一个特殊字符, 来避免重复访问
'''
def exist(self, board: List[List[str]], word: str) -> bool:
for r in range(len(board)):
for c in r... | sundaycat/Leetcode-Practice | solution/79. word-search.py | 79. word-search.py | py | 3,067 | python | en | code | 0 | github-code | 13 |
10937316950 | from .models import AirTrafficController, ArrivalFlight, DepartureFlight, Lane
from .src.consts import AOD, DOM_ID, KEY, MODAL_FIELD, STRING, VALUE
from .src.database_operation import\
get_earliest_object_from_a_day, \
get_latest_datetime_from_a_model, \
get_list_from_object_field
from .src.specific_functio... | notalentgeek/airport | airport_management/views.py | views.py | py | 6,128 | python | en | code | 0 | github-code | 13 |
72605086739 | import sys
N = int(sys.stdin.readline().replace("\n", ""))
triangle = [[]]
dp = [[] for _ in range(N+1)]
for _ in range(N):
triangle.append(
list(map(int, sys.stdin.readline().replace("\n", "").split(" "))))
dp[1] = [triangle[1][0]] # 7
dp[2] = [triangle[2][0]+triangle[1][0], triangle[2][1]+triangle[1][0]]... | gitdog01/AlgoPratice | random/dp/1932/main.py | main.py | py | 805 | python | en | code | 0 | github-code | 13 |
14385313140 | from genericpath import exists
import os
import json
import time
import random
cacheFile = "/home/sejapoe/.cache/color-changer.json"
configFile = '/home/sejapoe/.config/color-changer.json'
if not exists(cacheFile):
cache = dict()
cache["currentEnd"] = 0
cache["currentIndex"] = -1
with open(cacheFile, 'w') as ... | sejapoe/color-changer | color-changer.py | color-changer.py | py | 1,202 | 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.