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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18146484531 | import os
import subprocess
import threading
import time
import json
import sublime
import sublime_plugin
import time
from .logger import log
from . import json_helpers
from . import global_vars
# queue module name changed from Python 2 to 3
if int(sublime.version()) < 3000:
import Queue as queue
else:
import... | microsoft/TypeScript-Sublime-Plugin | typescript/libs/node_client.py | node_client.py | py | 13,909 | python | en | code | 1,716 | github-code | 1 |
29585182461 | import sys
import argparse
from monogusa.cli import run
from monogusa.cli import runtime
from monogusa.langhelpers import import_module
def main() -> None:
from handofcats.customize import logging_setup
parser = argparse.ArgumentParser(
prog="monogusa.cli", add_help=False, formatter_class=runtime._He... | podhmo/monogusa | monogusa/cli/__main__.py | __main__.py | py | 1,024 | python | en | code | 0 | github-code | 1 |
15909862506 | def geraTabuleiro(linhas,colunas):
tabuleiro = []
linha = []
alfabeto = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T"]
#Ponto possui duas informaçãoes (Jogada e navio)
ponto = [" M " ,'P1']
#Laço para gerar tabuleiro de linhas x colunas
for i in range(lin... | elvisclaudino/RA-BSI | Atividades/Batalha Naval/Código Batalha Naval (Murilo).py | Código Batalha Naval (Murilo).py | py | 2,446 | python | pt | code | 1 | github-code | 1 |
30996098053 | import pygame
import sys
import os
import subprocess
import pyperclip
import json
from general_function import load_images, select_font, resource_path
YELLOW = (255, 228, 181)
RED = (139, 0, 0)
class Button:
def __init__(self, x, y, width, height, image_path, text, callback=None):
self.rect = pygame.Rect... | DSofiya/TextQuest | adventure_menu.py | adventure_menu.py | py | 8,915 | python | en | code | 0 | github-code | 1 |
22611085779 | # coding: utf-8
class MessageAutoNotice:
"""
消息通知
模块名称: order--订单模块,project--项目模块, course--课程模块, course_confirm--审课模块,
scores--成绩模块, credit_switch--学分转换
"""
def __init__(self, **kwargs):
self.user_id = kwargs.pop('user_id')
self.module_name = kwargs.pop('module_name'... | liaochenghao/StuSystem | StuSystem/micro_service/stores/message_auto_notice.py | message_auto_notice.py | py | 470 | python | en | code | 0 | github-code | 1 |
11212261885 | def is_paired(input_string: str) -> bool:
"""
Check if brackets are matching and correct order of opening and closing.
:param:
input_string: str
:return:
stack: bool
"""
pairs = {'{': '}', '[': ']', '(': ')'}
stack = []
for char in input_string:
if char in pairs.keys()... | stimpie007/exercism | python/matching-brackets/matching_brackets.py | matching_brackets.py | py | 497 | python | en | code | 0 | github-code | 1 |
40378285601 | from dataclasses import dataclass
from uuid import UUID
from praetorian_api_client.resources.base import BaseResource
class UserResource(BaseResource):
@dataclass
class User(object):
id: UUID
username: str
name: str
surname: str
email: str
phone: str
ro... | Praetorian-Defence/praetorian-api-client | praetorian_api_client/resources/user.py | user.py | py | 1,661 | python | en | code | 0 | github-code | 1 |
677207580 | import re
def msub_global(source, rep_list):
"""
Do a global, multiple substitution on the 'source' parameter. The
'rep_list' parameter is a list of replacements, where each list item is a
tuple: (old, new).
This replacement is done in one pass. This is fast and means that we don't
have to wo... | sunlightlabs/subsidyscope | trunk/utils/msub.py | msub.py | py | 5,166 | python | en | code | 0 | github-code | 1 |
33980572448 | from os import name
from fastapi import FastAPI
from sqlalchemy.sql.functions import user
from db import models
from db.database import engine
from routers import user, post, review
from fastapi.staticfiles import StaticFiles
from auth import authentication
from fastapi.middleware.cors import CORSMiddleware
from fastap... | kayesokua/fastapi-artshoppe | backend/main.py | main.py | py | 1,078 | python | en | code | 0 | github-code | 1 |
2359439432 | """subscribe commands."""
# flake8: noqa: DAR101
from backoff import expo, on_exception
import click
from logzero import logger
from blackcap.configs import config_registry
from blackcap.messenger import messenger_registry
from blackcap.cluster import cluster_registry
config = config_registry.get_config()
messenger... | EBI-Metagenomics/orchestra | blackcap/src/blackcap/cli/subscribe.py | subscribe.py | py | 1,395 | python | en | code | 4 | github-code | 1 |
14751142418 | """
The :mod:`!xml_prm.parser` module contains the parsers that instatiate a :mod:`probrem` instance from the XML specifications. There is parser for
* Data Interface specification, :class:`DataInterfaceParser`
* PRM specifcation, :class:`PRMparser`
* Loading model parameters stored on disk, :class:`LocalDistributionP... | declerambaul/ProbReM | src/xml_prm/parser.py | parser.py | py | 32,969 | python | en | code | 4 | github-code | 1 |
11858069019 | import random
print('----------------------')
print(' The Number Game')
print('----------------------')
randomNo = random.randint(0, 100)
inputToInt = -1
name = input("Player, please enter your name: ")
while inputToInt != randomNo:
userInput = input("Please guess a number between 1 and 100: ")
inputToIn... | RuaridhD/number_game_python | program.py | program.py | py | 626 | python | en | code | 0 | github-code | 1 |
1926368353 | """\
reset_state - a class decorator that lets you return the instance to its state as it was
just after construction.
>> @reset_state
>> class X(object):
>> ...
>> ...
>> x = X(...)
>> ... # use x. change its state
>> x.reset_state() # this method was added by the decorator. calling it returns x to original state... | giltayar/Python-Exercises | reset_state.py | reset_state.py | py | 1,096 | python | en | code | 4 | github-code | 1 |
11893598537 | first = 'python'
second = "Python"
third = """A multi-line string with
Python in it."""
low = third.index("P")
high = third.index(" i")
print(first, second, third, sep="\n")
print(third[low:high])
print(second[::-1] == "".join(reversed(second)))
print(f"Okay {second}.") | wg-utkarsh-singh/python-bootcamp | data-structures/strings.py | strings.py | py | 271 | python | en | code | 0 | github-code | 1 |
7564702413 | from .. import __version__ as version
from typing import Union, List, Dict, Any, Callable, Type
from cascade import data as cdd
from cascade import models as cdm
class Dataset(cdd.Dataset):
"""
Dataset is a wrapper around any collection of items to put in the ML model
for inference
"""
def __init... | Oxid15/xai-benchmark | xaib/base/base.py | base.py | py | 5,224 | python | en | code | 3 | github-code | 1 |
15782370139 | """
A module to enable simple back propagation
***WARNING THIS CODE IS MESSY***
Very focused on just getting this to work.
I need to add some type of layer abstraction to make it easier to use.
The meat of the neuron could could use some tlc also.
I have found the best luck using cos() as the activation function
it co... | Telemachusghost/BackProp | backprop.py | backprop.py | py | 5,029 | python | en | code | 0 | github-code | 1 |
22941304622 | import logging
import time
from monai.transforms import Compose
from monailabel.interfaces.exception import MONAILabelError, MONAILabelException
logger = logging.getLogger(__name__)
def dump_data(data, level=logging.DEBUG):
if data and logging.getLogger().level == level:
logger.log(level, "************... | Project-MONAI/MONAILabel | monailabel/interfaces/utils/transform.py | transform.py | py | 3,680 | python | en | code | 472 | github-code | 1 |
5175592455 | import udi_interface
import sys
import time
import string
import re
import urllib.parse,http.client,math,time,datetime,base64
# Standard Library
from typing import Optional, Any, TYPE_CHECKING
from nodes import SPAN_breakerController,SPAN_circuitController
LOGGER = udi_interface.LOGGER
Custom = udi_interface.Custom... | residualimages/span_ud_nodeserver | nodes/SPAN_ctl.py | SPAN_ctl.py | py | 24,394 | python | en | code | 0 | github-code | 1 |
23708441683 | import numpy as np
import cv2
import time
import argparse
import glob
from sys import getsizeof
###################################################################################################
#Parsing Arguments
parser = argparse.ArgumentParser(description='Background extraction from microscope images')
parser.ad... | NielsPichon/hBN-Hunter | Individual Functions/FullPicMaker.py | FullPicMaker.py | py | 2,514 | python | en | code | 0 | github-code | 1 |
37022989422 | """
A non-blending lightGBM model that incorporates portions and ideas from various public kernels
This kernel gives LB: 0.977 when the parameter 'debug' below is set to 0 but this implementation requires a machine with ~32 GB of memory
"""
import pandas as pd
import time
import numpy as np
from sklearn.cross_validati... | vuhoangminh/Kaggle-TalkingData-AdTracking-Fraud-Detection-Challenge | need to clean/codes_v5/test.py | test.py | py | 1,488 | python | en | code | 0 | github-code | 1 |
36271755738 | # -*- coding: utf-8 -*-
from hejasverige.content import _
from plone.memoize.instance import memoize
from plone.app.textfield import RichText
from hejasverige.content.merchant import IMerchant
from Products.CMFCore.utils import getToolByName
from plone.directives import form
from five import grok
class IMerchantFold... | Adniel/hejasverige.content | hejasverige/content/merchantfolder.py | merchantfolder.py | py | 2,254 | python | en | code | 0 | github-code | 1 |
622159516 | """https://zhuanlan.zhihu.com/p/29515986"""
from skimage import transform as trans
import numpy as np
import cv2
src = np.array([
[30.2946, 51.6963],
[65.5318, 51.5014],
[48.0252, 71.7366],
[33.5493, 92.3655],
[62.7299, 92.2041] ], dtype=np.float32 )
tform = trans.SimilarityTransform()
def affine_transform(img,... | blacknwhite5/privacy-preserving-v2 | data/affine.py | affine.py | py | 534 | python | en | code | 0 | github-code | 1 |
9291937956 | #!/usr/bin/env python3
#importo librerías
import pyspark
from pyspark import SparkContext, SparkConf, SQLContext
from pyspark.sql.functions import *
from pyspark.sql import DataFrameStatFunctions, DataFrame
from pyspark.sql.types import *
from pyspark.ml import Pipeline
from pyspark.ml.feature import *
from pyspark.ml.... | EduardoHidalgoGarcia/MGE_ITAM_2017 | alumnos/jorge_altamirano/tarea_7/tarea_7.py | tarea_7.py | py | 10,065 | python | en | code | 0 | github-code | 1 |
43597335889 | #################################################################################################
########################## BASE APP PART ########################################################
class LoginData(object):
username = "guest"
class MainSinglegameClass:
target_word = None
target_word_len =... | Fantomas4/GUI_Hangman | GUI_Hangman.py | GUI_Hangman.py | py | 10,855 | python | en | code | 0 | github-code | 1 |
25183906689 | from django.shortcuts import render,redirect,get_object_or_404,HttpResponse
from .forms import BlogForm
from .models import Blog
from django.contrib.auth.decorators import login_required
# Create your views here.
def home(request):
blogs=Blog.objects.all()
return render(request,'Home/index.html',{'blogs':blogs... | kushalsubedi/Bloggie | Home/views.py | views.py | py | 2,090 | python | en | code | 1 | github-code | 1 |
72799933795 | import unittest
import datetime
from django.contrib.auth.models import User
from django_multivoting.models import Vote, Popularity
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
class Tests(unittest.TestCase):
def setUp(self):
try:
... | genghisu/eruditio | eruditio/shared_apps/django_multivoting/tests.py | tests.py | py | 5,053 | python | en | code | 0 | github-code | 1 |
21877694852 | import sys
if __name__ == '__main__':
milk = int(input())
costs = list()
for _ in range(milk):
costs.append(int(sys.stdin.readline().strip()))
costs.sort(reverse=True)
total = sum(costs)
for i in range(2, milk, 3):
total -= costs[i]
print(total)
| iceprins/study-codingtest | 11508.py | 11508.py | py | 296 | python | en | code | 0 | github-code | 1 |
9284007937 | from kivymd.uix.screen import MDScreen
from kivymd.uix.menu import MDDropdownMenu
from kivymd.uix.list import OneLineIconListItem
from kivy.metrics import dp
from kivy.properties import ObjectProperty, StringProperty
from kv.components.empty_screen_msg import EmptyScreenMessage
class NotesDashboard(MDScre... | pyto-p/NoteRex | view/dashboard.py | dashboard.py | py | 3,678 | python | en | code | 1 | github-code | 1 |
21857947473 | import os
import json
import config
if __name__ == "__main__":
motions = os.listdir(config.processed_dir)
for m in motions:
dir = os.path.join(config.processed_dir, m)
f = open(dir)
records = json.load(f)
f.close()
for i in range(len(records)):
for j in ran... | Naplesoul/iGuard | similarity/reducefeature.py | reducefeature.py | py | 943 | python | en | code | 0 | github-code | 1 |
19270541376 | import math
import numpy as np
import torch
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import scipy.sparse as sp
from sklearn.metrics import roc_auc_score
def get_interventional_emb(train_edges, probe_edge_index, model, x, device, type_set='test'... | ErikJhones/in_n_out | utils_calib.py | utils_calib.py | py | 3,308 | python | en | code | 0 | github-code | 1 |
19116861683 | # -*- python -*-
load("@drake//tools/workspace:github.bzl", "github_archive")
def octomap_repository(
name,
mirrors = None):
github_archive(
name = name,
repository = "OctoMap/octomap",
commit = "v1.9.0",
sha256 = "5f81c9a8cbc9526b2e725251cd3a829e5222a28201b39431400... | GTLIDAR/safe-nav-locomotion | motion_planner/drake/tools/workspace/octomap/repository.bzl | repository.bzl | bzl | 563 | python | en | code | 21 | github-code | 1 |
71813433315 | #!/usr/bin/env python
from __future__ import print_function
import cv2
import random
import os.path
import numpy as np
import PIL.ImageOps
import tensorflow as tf
from collections import deque
from sklearn.utils import shuffle
from PIL import Image, ImageChops
from pandas.io.parsers import read_csv
TRAIN_DATA_PATH = ... | NAVEENMN/PersonalArchives | CNN_facekeypoints/facekey_CNN.py | facekey_CNN.py | py | 5,086 | python | en | code | 0 | github-code | 1 |
5863312381 | from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.fault_model import FaultModel
from ..models.fault_summary_model import FaultSummaryModel
from ..models.sub_system_health_rollup_status import SubSystemHealthRollupStatus
from ..models.sub_system_health_sub_system import SubSystemHealth... | dell/omivv | Python/omevv/v1/omevv_apis_client/models/sub_system_health.py | sub_system_health.py | py | 4,766 | python | en | code | 3 | github-code | 1 |
70035569954 | # mnist classification
# backend: Theano (make sure to disable fastmath i.e. nvcc.fastmath=false. if you want to add many epoches and wish to avoid the nan issue)
# you can play with the layers and maybe add a few (maybe dropout layers).
import numpy as np
from keras.models import Sequential
from keras.layers import D... | dasraf9/Keras_Mini_Projects | mmist/mnist.py | mnist.py | py | 1,498 | python | en | code | 0 | github-code | 1 |
72708314593 |
import asyncio
from typing import Union, Callable, List, Coroutine, Optional
import discord
import linkbot.utils.emoji as emoji
from linkbot.bot import client
class Option:
def __init__(self,
emote: str,
text: str="", *,
func: Callable[[discord.User, discord.R... | tjbrockmeyer/LinkBot | linkbot/utils/menu.py | menu.py | py | 8,723 | python | en | code | 1 | github-code | 1 |
37804385829 | import os
from notion_client import Client
from dotenv import load_dotenv
load_dotenv()
NOTION_TOKEN = os.getenv("NOTION_TOKEN")
DATABASE_ID = os.getenv('DATABASE_ID')
notion = Client(auth=NOTION_TOKEN)
def note(res):
new_page = {
"title": {"title": [{"text": {"content": res}}]}
}
notion.pages.crea... | kinba09/Telegram_to_notion | notion_back.py | notion_back.py | py | 381 | python | en | code | 0 | github-code | 1 |
25888700131 | import datetime
import inspect
import json
import logging
import os
from typing import Any, Callable, Dict, List, Optional, Union
from django.core import serializers
from django.core.exceptions import SuspiciousOperation
from django.db import models
from django.http import HttpRequest, HttpResponse, HttpResponseBadReq... | ruler501/multipoll | multipoll/views.py | views.py | py | 12,628 | python | en | code | 0 | github-code | 1 |
21377790638 | import requests
import json
def next1f():
url = "https://fdo.rocketlaunch.live/json/launches/next/5"
response = requests.get(url)
data = response.json()
next1 = (data["result"][0]["launch_description"])
return next1
#print(data["result"][0]["name"])
#print(data["result"][0]["vehicle"]["name"])
#pri... | SimonTheCommunist/SpaceBot | SpaceBot/nextlunch.py | nextlunch.py | py | 990 | python | en | code | 0 | github-code | 1 |
19322541772 | import heapq
n, m = map(int, input().split())
priority = [[] for i in range(n+1)]
indegree = [0 for i in range(n+1)]
for i in range(1, m+1):
A, B = map(int, input().split())
priority[A].append(B)
indegree[B] += 1
result = []
for i in range(1, n+1):
if indegree[i] == 0:
heapq.heappush(result... | hanameee/Algorithm | Fastcampus/baekjoon/src/1766.py | 1766.py | py | 516 | python | en | code | 2 | github-code | 1 |
35227290608 | from .base import FunctionalTest
import time
from selenium.common.exceptions import WebDriverException
from datetime import datetime, date
from django.contrib.auth.models import User
# from selenium.webdriver.firefox.webdriver import WebDriver
# from selenium.webdriver.common.keys import Keys
# import unittest
# import... | NeelRoshania/MarPersonnel | functional_tests/test_home_CRU.py | test_home_CRU.py | py | 4,757 | python | en | code | 0 | github-code | 1 |
72823463394 | def load_matrix(filename):
"""
pre: `filename` est un nom de fichier
post: retourne une matrice rectangulaire M x N dont le contenu est donné
dans le fichier `filename`.
le format du fichier est :
première ligne : le nombre de lignes M
deuxième ligne : le nombre de colonnes N
... | beMang/LEPL1401 | examen_blanc/load_matrix.py | load_matrix.py | py | 1,399 | python | fr | code | 0 | github-code | 1 |
6584385706 | from PyQt6.QtCore import QTimer
from UM.Application import Application
from UM.Logger import Logger
from UM.Scene.SceneNode import SceneNode
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
from UM.Math.Vector import Vector
from UM.Scene.Selection import Selection
from UM.Scene.SceneNodeSettings... | Ultimaker/Cura | cura/PlatformPhysics.py | PlatformPhysics.py | py | 10,950 | python | en | code | 5,387 | github-code | 1 |
6966301148 | import sqlite3
import logging
from variables import schema
from string import Template
from utilities import func_name
from os.path import isfile, isdir, join
from PIL import Image
from io import BytesIO
def connect_database(config, logger, **kwargs):
logger = logging.getLogger(func_name())
logger.debug(kwargs... | cbitterfield/deepstack-multiprocessing | database.py | database.py | py | 5,567 | python | en | code | 0 | github-code | 1 |
7162673837 | n = int(input())
avg = 0
maxscore = 0
aa = list(map(int, input().split()))
maxscore = max(aa)
for i in range(n) :
aa[i] = (aa[i] / maxscore) * 100
avg += aa[i]
avg = avg / n
print(format(avg, ".2f"))
| hhali333/BOJ | Python/1546.py | 1546.py | py | 215 | python | en | code | 0 | github-code | 1 |
38612892234 | import sys
import numpy as np
sys.path.append('../mover_library/')
from mover_library.utils import compute_occ_vec, set_robot_config, remove_drawn_configs, \
draw_configs, clean_pose_data, draw_robot_at_conf, \
check_collision_except, two_arm_pick_object, two_arm_place_object, pick_distance, place_distance
fr... | lukeshimanuki/qqq | generators/PickGenerator.py | PickGenerator.py | py | 4,363 | python | en | code | 0 | github-code | 1 |
33586073184 | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 22 11:16:00 2019
@author: youko
"""
import os
import sys
import re
import datetime
import time
import pickle
from nltk.stem import PorterStemmer
import math
import json
from build import *
from query import *
######################### query expansion using pseudo relev... | youko70s/IR-SearchEngine | relevance_feedback.py | relevance_feedback.py | py | 10,241 | python | en | code | 1 | github-code | 1 |
42654646818 | from io import BytesIO
from time import time
import pybase16384 as pybs
pybs.is_64bits()
with open("input.pcm", "rb") as f:
data = f.read()
st = time()
for i in range(10):
pybs.encode_file(BytesIO(data), open("output2.pcm", "wb"), True, len(data) // 7)
print(f"耗时: {time() - st}")
| synodriver/pybase16384 | tests/test_encode.py | test_encode.py | py | 298 | python | en | code | 7 | github-code | 1 |
38973879641 | alphabet = "abcdefghijklmnopqrstuvwxyz"
prefix = "vikeCTF"
ciphertext = input("text to decrypt:\n")
def decrypt(text, key):
plaintext = ""
for i, c in enumerate(text):
if not c.isalpha():
plaintext += c
continue
offset = alphabet.find(c.lower())
rotation = key[i % len(key)]
result = alphabet[(offset... | VikeSec/vikeCTF-2023 | challenges/crypto/berserkers/solution/decrypt.py | decrypt.py | py | 787 | python | en | code | 3 | github-code | 1 |
621928178 | from collections import OrderedDict
from braindecode.datautil.signalproc import exponential_running_standardize
from braindecode.datautil.trial_segment import create_signal_target_from_raw_mne
import logging
import numpy as np
from braindecode.datasets.bbci import BBCIDataset
from braindecode.datautil.signalproc import... | Sebas-h/eeg_thesis | data_loader/process_data/hgd.py | hgd.py | py | 6,071 | python | en | code | 2 | github-code | 1 |
11562513332 | # 2016-03-26 230 tests, 64 ms
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
... | chaor/LeetCode_Python_Accepted | 61_Rotate_List.py | 61_Rotate_List.py | py | 708 | python | en | code | 49 | github-code | 1 |
41579410870 | import os
import random
import pygame
from data.base_modifier import BaseModifier
from data.colors import Colors
class Fortifier(BaseModifier):
def __init__(self, game):
self.name = "fortifier"
self.game = game
self.block_positions = self.get_block_positions()
self.image = pygame... | rimai4/snake | data/fortifier.py | fortifier.py | py | 1,805 | python | en | code | 0 | github-code | 1 |
347238907 | # https://www.codewars.com/kata/517abf86da9663f1d2000003
def to_camel_case(text):
# Complete the method/function so that it converts dash/underscore delimited words into camel casing.
# The first word within the output should be capitalized only if the original word was capitalized
# (known as Upper Camel ... | ptavaressilva/codewars | 6kyu_Convert_string_to_camel_case.py | 6kyu_Convert_string_to_camel_case.py | py | 709 | python | en | code | 0 | github-code | 1 |
33618366539 | import pandas as pd
import requests
API_KEY = 'Bearer e3920e0f60c88136aa66dca3bbfbae7f-bb9c32f4d0ab0fc0106137b0467a4394'
HEADERS = {
'Content-Type': 'application/json',
'Authorization': API_KEY
}
# format: Currency1_Currency2
INSTRUMENT = 'EUR_USD'
# e.g. 'S5', 'M15', 'H1', 'D', 'W', 'M'
# https://developer... | brunadossantos-tech/data-to-csv | R-testes/OandaDataGetterV2.py | OandaDataGetterV2.py | py | 3,123 | python | en | code | 0 | github-code | 1 |
16568162004 | import openpyxl
# 打开excel文件,获取工作簿对象
wb = openpyxl.load_workbook('example.xlsx')
ws = wb.active # 当前活跃的表单
col_range = ws['B:C']
row_range = ws[2:6]
# for col in col_range: # 打印BC两列单元格中的值内容
# for cell in col:
# print(cell.value)
# for row in row_range: # 打印 2-5行中所有单元格中的值
# for cell in... | 1071183139/biji | 3_简历/3_python操作excel/1_获取excel/5_遍历行和列中单元格的值 .py | 5_遍历行和列中单元格的值 .py | py | 586 | python | en | code | 0 | github-code | 1 |
39669419418 | #!/usr/bin/python3
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
import apt
import apt_pkg
import hashlib
import mock
import os
import unittest
import shutil
import tempfile
import json
from DistUpgrade.DistUpgradeQuirks import DistUpgradeQuirks
CURDIR = os.path.dirname(os.path.abspath(_... | mvo5/ubuntu-release-upgrader | tests/test_quirks.py | test_quirks.py | py | 34,613 | python | en | code | 0 | github-code | 1 |
11258535263 | # -*- coding: utf-8 -*-
from lxml import etree
oaidcns = "{http://www.openarchives.org/OAI/2.0/oai_dc/}"
dcns = "{http://purl.org/dc/elements/1.1/}"
def getEmptyOaidcDict():
oaidcdict = {
"title": "",
"description": "",
"subject": [],
"publisher": "",
"format": "",
"identifier": "",
"language": "",
"... | wimmuskee/mangrove | formatter/oaidc.py | oaidc.py | py | 1,460 | python | en | code | 0 | github-code | 1 |
38762305767 | '''
给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。
'''
'''
使用有界队列,队列大小为n+1,遍历链表的时候不停向队列里添加节点,遍历完成后,队列的头就是倒数第n+1个节点,队列第二个就是倒数第n个节点
本质上就是使得遍历到链表终点时,能够拿到倒数第n+1个节点
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
from collections import deq... | love525150/leetcode-answer | a19v1.py | a19v1.py | py | 1,117 | python | en | code | 0 | github-code | 1 |
33458349196 | ACCEPT_INVITATION_FROM = [4053]
AGGRESSIVE_COMPUTER = [4257]
ALERT = [152]
ALLY = [4286]
AND = [23]
ARE_COMPATIBLE = [4079]
AT = [107]
AT2 = [54] # distance
AT_THE_CENTER = [156]
AWAITING_YOUR_ORDERS = [4202]
BACK = [4118]
BAD_LOGIN = [4237]
BEEP = [1029]
BELL = [1039, 1003] # or add in tts.txt: "The bell"
BUILDINGS ... | soundmud/soundrts | soundrts/msgparts.py | msgparts.py | py | 3,907 | python | en | code | 37 | github-code | 1 |
13221751063 | import os
import sys
from pathlib import Path, PurePath, PurePosixPath
from unittest.mock import patch
import boto3
import pytest
from moto import mock_s3
from prefect_aws import AwsCredentials
from prefect_aws.deployments.steps import get_s3_client, pull_from_s3, push_to_s3
@pytest.fixture
def s3_setup():
with... | PrefectHQ/prefect-aws | tests/deploments/test_steps.py | test_steps.py | py | 10,915 | python | en | code | 82 | github-code | 1 |
26514065783 | from multiprocessing import Process, Pipe
import os
import time
import random
def send_data(conn):
print('发送数据的子进程%d启动' % os.getpid())
print('发送数据:None')
conn.send(None)
# 发送的数据的进程仍然继续,但是接受数据的进程终止
for obj in list(range(1, 10)):
print('发送数据:%s' % obj)
conn.send(obj)
time.slee... | hemuke/python | 17_process_thread/42_multiprocess_pipe.py | 42_multiprocess_pipe.py | py | 1,448 | python | zh | code | 0 | github-code | 1 |
27591978546 | import sys
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
def right_big_number(arr):
stack = []
result = []
for i, num in enumerate(arr):
while stack and stack[-1][1] < num:
temp = stack.pop()
temp[1] = num
result.append(tem... | ChoHon/Algorithm | week 02/17298.py | 17298.py | py | 515 | python | en | code | 0 | github-code | 1 |
32090928144 | import streamlit as st
from transformers import (
AutoModelForSeq2SeqLM,
AutoTokenizer,
BartForConditionalGeneration,
BartTokenizer
)
import torch
import nltk
import re
from transformers import pipeline
import numpy as np
model = None
tokenizer = None
summarizer = None
@st.cache_data()
def loadModel()... | oshikaroy/bartTextSummarization-Streamlit | bartTextSummarizer-streamlit-main/oldMainPage/response.py | response.py | py | 9,208 | python | en | code | 0 | github-code | 1 |
37988024234 | import feedparser
import urllib.request
from pydub import AudioSegment
from pydub.utils import make_chunks
import SpeechRecognition as sr
# Carga el archivo MP3
audio = AudioSegment.from_file("audio.mp3", format="mp3")
# Convierte el archivo a formato WAV
audio.export("audio.wav", format="wav")
# Crea chunks de audi... | Mig29x/CheckMovieParentsRating | Podcast.py | Podcast.py | py | 1,358 | python | es | code | 0 | github-code | 1 |
35627409276 | import os
import zipfile
import pandas as pd
import csv
import mariadb
import os
import configparser
import glob
config = configparser.ConfigParser()
config.read_file(open(r'CONF/mariadb.conf'))
try:
db = mariadb.connect(
host = config.get('peru','host'),
user = config.get('peru','user' ... | manuelcorpas/15-PERU | PYTHON/PERU/07-ukbb-pop-af-insert.py | 07-ukbb-pop-af-insert.py | py | 1,535 | python | en | code | 0 | github-code | 1 |
43157972809 | import pandas as pd
import numpy as np
from annoy import AnnoyIndex
import re
import os
from sklearn.feature_extraction.text import CountVectorizer
import matplotlib.pyplot as plt
import time
from memory_profiler import memory_usage
import psutil
import csv
start_time = time.time()
# get the absolute path... | nan0neko/LogClusteringHP | ANNOY/count vectorizer/angular/approach1/Count Vectorization Approach 1 Updated.py | Count Vectorization Approach 1 Updated.py | py | 4,522 | python | en | code | 0 | github-code | 1 |
4253799393 | import numpy as np
from typing import List
class BBox3D:
def __init__(self, bbox_min: np.array, bbox_max: np.array):
"""
Initializes a 3D axis-aligned bbox from the min and max points
Args:
bbox_min: the minimum point, expected to be a
"""
assert bbox_m... | PolyCam/polyform | polyform/core/bbox.py | bbox.py | py | 1,688 | python | en | code | 111 | github-code | 1 |
24184544608 | # ebay gpu prices visualizer
from ebaysdk.finding import Connection as finding
from bs4 import BeautifulSoup
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
import matplotlib
import time
from decouple import config
'''
GOOGLE SHEETS
OPENING CON... | octavian-stoch/average_ebay_prices_app | GPUprices.py | GPUprices.py | py | 1,830 | python | en | code | 1 | github-code | 1 |
4978229929 | nums = ("zero", "um", "dois", "três", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez", "onze", "doze", "treze", "quatorze", "quinze", "dezessete", "dezoito", "dezenove", "vinte")
while True:
per = int(input("Digite um número de 0 a 20: "))
if per >= 0 and per <= 20:
print(f"O número digitado ... | nicolasdonada/Exerc-ciosEmPython | DESAFIOS/desafio73.py | desafio73.py | py | 402 | python | pms | code | 2 | github-code | 1 |
8318774067 | """Collection of experimental functions (beta)"""
import os
import numpy as np
import csv as csv
import lmlib as lm
import itertools
import datetime as datetime
__all__ = ['find_max_mask',
'load_source_csv',
'zero_cross_ind',
'diff0',
'edge_detection',
'poly_fil... | lmlib/lmlib | lmlib/utils/beta.py | beta.py | py | 21,866 | python | en | code | 1 | github-code | 1 |
19523366410 | # Рекурсивна функція -> це функція яка визначається в термінах самої себе і може викликати саму себе
# 5! -> 1 * 2 * 3 * 4 * 5 -> 5 * 4! -> 5 * 4 * 3! -> 5 * 4 * 3 * 2! -> 5 * 4 * 3 * 2 * 1
# 7!
def factorial(n):
if n <= 1:
return 1
else:
return n * factorial(n - 1)
print(factorial(5))
| LeadShadow/group_02-02 | lesson8/recursion.py | recursion.py | py | 398 | python | uk | code | 0 | github-code | 1 |
72797653155 | # Function to get the maximum occuring character
def get_max_occurring_char(S: str) -> str:
# Get list of all unique characters
unique_chars = sorted(set(S))
# Initialize the max count and max count character by first character
max_count, max_char = S.count(unique_chars[0]), unique_chars[0]
# Loop... | DataRohit/Data-Structures-and-Algorithms | 11_char_string_questions/05_max_occurring_char.py | 05_max_occurring_char.py | py | 826 | python | en | code | 1 | github-code | 1 |
18494019176 | def binary_oubtraction(a, y):
dec1 = a
dec2 = y
bin1 = bin(int(a)).replace("0b", "")
bin2 = bin(int(y)).replace("0b", "")
MaxLen = max(len(bin1), len(bin2))
result = ''
carry = 0
i = MaxLen - 1
while i >= 0:
o = int(bin1[i]) - int(bin2[i])
if o == -1:
... | DyTith-Panha/DSE_10_Python_Bootamp_2022 | week_03/ex3/52_binary_subtraction.py | 52_binary_subtraction.py | py | 996 | python | en | code | 0 | github-code | 1 |
74391772514 | import random
print("Guess the name of the marvel character with the help of their dialogues")
words = {"tonystark": "I am Iron Man", "captainamerica": "I can do this all day",
"thor": "bring me thanos", "hulk": "smash", "blackpanther": "Wakanda Forever",
"peterparker":"Real name of spider man"}
... | Hello-Utkarsh/Guess-The-Word | Guess_the_word.py | Guess_the_word.py | py | 1,000 | python | en | code | 0 | github-code | 1 |
4113591124 | #!/usr/bin/env python
# encoding: utf-8
import codecs
import os
from tornado.gen import coroutine
import tornado.web
import wsrpc
from tornado import testing
from tornado.httpserver import HTTPServer
from tornado.testing import gen_test, AsyncTestCase
from wsrpc import wsrpc_static
from tornado.httpclient import AsyncH... | vvsha/w21 | mysite/tests/test_js_static.py | test_js_static.py | py | 1,650 | python | en | code | 0 | github-code | 1 |
9906643482 | # coding:utf-8
'''
爬虫
create by qmh 2018-05-06
'''
from urllib.request import urlopen
import re
from bs4 import BeautifulSoup
response = urlopen("http://www.google.com")
html = response.read()
# print(html)
soup = BeautifulSoup(html,features="lxml")
result={}
# 房源信息
all_img=soup.find_all("img")
imglist=... | qinmenghuan/flappybirdserver | webCrawler/webwormdemo.py | webwormdemo.py | py | 613 | python | en | code | 0 | github-code | 1 |
36224236886 | #Author-Peter Ludikar, Gary Singer
#Description-An Add-In for making dog-bone fillets.
# Peter completely revamped the dogbone add-in by Casey Rogers and Patrick Rainsberry and David Liu
# Some of the original utilities have remained, but a lot of the other functionality has changed.
# The original add-in was based o... | pludikar/dogbone2 | DogBone2.py | DogBone2.py | py | 60,061 | python | en | code | 7 | github-code | 1 |
25461186503 | from flask_restx import Namespace, Resource, fields
from models import Recipe
from flask_jwt_extended import jwt_required
from flask import request
recipe_ns = Namespace('recipe', description='A namespacce for Recipes' )
#model serializer
recipe_model = recipe_ns.model(
'Recipe',
{
'id':fields.Inte... | Grace-5507/my-recipe | recipes.py | recipes.py | py | 1,722 | python | en | code | 1 | github-code | 1 |
42675714902 | """
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Example 1:
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Example 2:
Input: head = [1], n = 1
Output: []
Example 3:
Input: head = [1,2], n = 1
Output: [1]
"""
class Solution:
def removeNthFromEnd(se... | bholu14401/python | Remove NthNodeFromEndOfList.py | Remove NthNodeFromEndOfList.py | py | 580 | python | en | code | 0 | github-code | 1 |
22576400917 | import math
# 소수 판별 함수(에라토스테네스의 체)
def prime_check(n): # n이 소수인지 아닌지 판별
if n == 1:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n%i == 0:
return False
return True
def solution(n, k):
answer = 0
temp=n
result=""
while temp>0:
temp,m =... | dydwkd486/coding_test | programmers/k진수에서 소수 개수 구하기.py | k진수에서 소수 개수 구하기.py | py | 583 | python | ko | code | 0 | github-code | 1 |
31330715314 | import requests
import json
hakusana = input(f'Kaupunki: ')
pyyntö = 'https://api.openweathermap.org/data/2.5/weather?q=' + hakusana + '&appid=b506dbf5aa172758d111318ced349bb3&units=metric'
vastaus = requests.get(pyyntö).json()
json_vastaus = json.dumps(vastaus, indent=2)
print(f'Weather:\n {vastaus["weather"... | Javimetro/Python-tasks | moduuli12/weather.py | weather.py | py | 396 | python | fi | code | 0 | github-code | 1 |
25158386576 | from typing import Optional, List, Callable
from .model import LifeModelAgent
class LifeEvents(LifeModelAgent):
def __init__(self, model, life_events: Optional[List['LifeEvent']] = None):
"""List of life events
Args:
model (LifeModel): LifeModel in which the life events take place.
... | sw23/life-model | src/life_model/lifeevents.py | lifeevents.py | py | 1,620 | python | en | code | 0 | github-code | 1 |
72218499235 | # -*- coding:utf-8 -*-
import os
import pymssql
import xlrd
import xlwt
import datetime
import time
import chardet
import shutil
#数据库全局连接对象
conn=pymssql.connect(host="127.0.0.1",user="sa",password="4869Ahui...A",database="GoldControlDB")
#conn=pymssql.connect(host="47.91.154.143:1433",user="sa",password="4869Ahui...A"... | bugken/KenCodeSnipet | PythonForExcelDB/ExeclDBHandle.py | ExeclDBHandle.py | py | 5,276 | python | en | code | 0 | github-code | 1 |
16685518806 | import torch
import torch.utils.data as data
import cv2
import random
import numpy as np
from os.path import join
from .base_provider import ImagesDataSet
def augment_image(image, pad):
'''
Perform zero padding, randomly crop image to original size,
maybe mirror horizontally
'''
init_shape = image... | FatDs-lrc/SER_KD | preprocess/denseface/data/fer.py | fer.py | py | 4,880 | python | en | code | 0 | github-code | 1 |
7455808520 | import copy
import datetime
import os
import random
import re
import signal
import socket
import sys
import time
import traceback
from urllib.parse import unquote
from pandacommon.pandalogger.PandaLogger import PandaLogger
from pandajedi.jediconfig import jedi_config
from pandajedi.jedicore import Interaction, JediCor... | PanDAWMS/panda-jedi | pandajedi/jediorder/JobGenerator.py | JobGenerator.py | py | 136,720 | python | en | code | 3 | github-code | 1 |
40638839003 | import streamlit as st
import pandas as pd
import os
import datetime
import sqlite3
#############################################################
# This program reads member infomation from a db and finds #
# the next in line to scrub based on the next saturday #
################################################... | Anino1996/dutyRosterWebApp | duty_roster_app.py | duty_roster_app.py | py | 2,825 | python | en | code | 0 | github-code | 1 |
19128100495 | import io
#from multiprocessing.dummy import Array
import socket
import time
import cv2
import numpy as np
from PIL import Image
from math import atan2, cos, sin, sqrt, pi
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# address '0.0.0.0' or '' work to allow connections from other machines. 'localhost' d... | JD-edu/JD_robot_platform | 206_esp32_camera_python_socket/206_esp32_camera_socket.py | 206_esp32_camera_socket.py | py | 1,421 | python | en | code | 0 | github-code | 1 |
23517680253 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# 将mongoDB中的赛程数据导出为XML模板表格式
#
# usage:
# python export_fixtures.py --help
#
# 导出英超2016/2017赛季赛程数据到8_2017.xml
# python export_fixtures.py -h 10.1.0.6 -p 27017 -d football -c fixtures -m... | huiliu/spiders.learning.hui | sports/sports/spiders/addons/fixtures.py | fixtures.py | py | 6,112 | python | en | code | 0 | github-code | 1 |
19015335793 | #!/usr/bin/env python3
import os
import datetime
import concurrent.futures
import time
import logging
import jinja2
import chronos
def get_year():
y = datetime.datetime.now().year
return y + 2 if datetime.datetime.now().month < 7 else y + 3
STUDENT_PROM = get_year()
ASSISTANT_PROM = STUDENT_PROM - 2
OUTP... | epita/chronos-ics | cron.py | cron.py | py | 1,883 | python | en | code | 12 | github-code | 1 |
22743188983 | from flask import Flask, Blueprint, render_template, request, send_file, redirect, url_for
import os
from csv_changer import change_csv_1
app = Flask(__name__)
change_csv = Blueprint('change_csv', __name__)
app.config['UPLOAD_FOLDER'] = os.path.join(os.environ["USERPROFILE"], 'Desktop')
@change_csv.route('/change-c... | hsamvel/Flask_App | website/change_csv.py | change_csv.py | py | 1,178 | python | en | code | 0 | github-code | 1 |
4457628669 | import subprocess as sp
import sys
import ctypes
import os
import random
import json
import base64
import pathlib
import tempfile
import functools
import operator
import time
import numpy
# ol-install: numpy
# from memory_profiler import profile
import cProfile
import pstats
import io
doProfile = True
def printCSV... | NathanTP/fakefaas | examples/sort/handler/f.py | f.py | py | 5,425 | python | en | code | 1 | github-code | 1 |
8490813014 | import numpy as np
import geopandas as gp
import shapely
import pyresample
import pandas as pd
import xarray as xr
import sys
import os
from pyposeidon.utils.coastfix import simplify
# logging setup
import logging
logger = logging.getLogger(__name__)
def fix(dem, coastline, **kwargs):
# ------------------------... | ec-jrc/pyPoseidon | pyposeidon/utils/fix.py | fix.py | py | 16,054 | python | en | code | 17 | github-code | 1 |
73129044195 | from django.urls import path
from .views import *
urlpatterns = [
path('', payment_info, name='payment-info'),
path('purchase/', purchase_product, name="purchase-product"),
path('purchase/<int:payment_id>/', cancel_purchase, name="cancel-purchase"),
path('deliveries/', add_deliveries, name="add-delive... | iamthasanthan/Ecommerce-react-django | payment/urls.py | urls.py | py | 420 | python | en | code | 0 | github-code | 1 |
14831446889 | import requests
#visit this website to get a soup commands <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>
def fetchAndSaveToFile(url, path):
r = requests.get(url)
with open(path , "w") as f:
f.write(r.text)
url="https://www.learncbse.in/ncert-solutions-for-class-10-english-literature/"
fe... | dsc-gtbit/Hacktoberfest-2023-WebDev | Web Scraping/Web Scraping.py | Web Scraping.py | py | 365 | python | en | code | 1 | github-code | 1 |
43578234288 | from flask import Flask, render_template
import redis
app = Flask(__name__)
redis_client = redis.Redis(host='localhost', port=6379)
@app.route('/')
def index():
count = redis_client.get('count')
return render_template('index.html', count=count)
@app.route('/update')
def update():
redis_client.incr('count... | wellington90/Python-Redis | app.py | app.py | py | 468 | python | en | code | 0 | github-code | 1 |
21765562207 | # -*- coding:utf-8 -*-
'''
Author: MrZQAQ
Date: 2022-03-29 14:06
LastEditTime: 2023-03-01 22:24
LastEditors: MrZQAQ
Description: turely model execute file
FilePath: /MCANet/RunModel.py
'''
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim ... | MrZQAQ/MCANet | RunModel.py | RunModel.py | py | 12,346 | python | en | code | 5 | github-code | 1 |
20702891231 | import pytest
import dynamic_yaml
import logging
import sys,os
sys.path.append('.')
import torch
from model.backbone import backbonebase
def get_hyper():
CFG_PATH = './cfg/hyperparameter.yaml'
with open(CFG_PATH, 'r') as file:
para = dynamic_yaml.safe_load(file)
return para
# print(get_hyper())
@... | leoliu5550/researchObjDet | TEST/test_backbone.py | test_backbone.py | py | 725 | python | en | code | 1 | github-code | 1 |
32061857397 | """RecipeBase URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | djangoner/RecipeBase | recipes/urls.py | urls.py | py | 1,995 | python | en | code | 0 | github-code | 1 |
9909868792 | from pymysql import IntegrityError
from sqlalchemy import func
from sqlalchemy.orm.exc import MultipleResultsFound
from flask_sqlalchemy import BaseQuery as QueryClass
from miniapp.corelibs.stone import db
class BaseQuery(QueryClass):
def __iter__(self):
return QueryClass.__iter__(self._undeleted())
... | qinlinli/small | models/base.py | base.py | py | 3,602 | python | en | code | 0 | github-code | 1 |
33803524798 | fp = {}
sol = {}
# finds all integer factor pairs
def findfp(n):
for i in range(1, n+1):
if n%i == 0:
fp[i] = n/i
# checks if the element is congruent to d when prime factotized, removed if not
def checkmodc(c, d):
deldict = []
mod = c - d%c
for key in fp:
if... | dshemetov0/MA188 | Generalizations.py | Generalizations.py | py | 1,068 | python | en | code | 0 | github-code | 1 |
26700770608 | #!usr/bin/env python3.6
"""Module to help partititoning of datasets."""
import sys
class Settings():
"""Parameters of the gene and rate boundaries etc."""
def __init__(self):
"""Initialise parameters."""
self.gene_length = 3000
self.site_bin_length = 300
self.alignment_length =... | alanbeavan/simulating_substituion_rate | analysis/scripts/partitioning.py | partitioning.py | py | 572 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.