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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
74918582185 | # -*- coding: utf-8 -*-
import datetime
from dateutil import rrule
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class Loan(models.Model):
_name = "hr.loan"
_description = 'Employee Loans'
@api.model
def _default_currency(self):
return self.env.user.company_i... | lawrence24/ndms-1 | ibas_payroll/models/models.py | models.py | py | 15,973 | python | en | code | 0 | github-code | 36 |
75188620264 | import unittest
import numpy as np
from numpy.linalg import norm
import hmcollab.models
from hmcollab import directories
from hmcollab import articles
from hmcollab.tests.fake_data import articles_random_df
# The suite test the following:
# + articles dataset and preprocessing such as:
# shape and one-hot encodin... | newexo/HM-clothing-public | hmcollab/tests/test_articles.py | test_articles.py | py | 2,941 | python | en | code | 0 | github-code | 36 |
37229157121 | import pygame
from player import *
from blocks import *
from pyganim import *
# window
WIN_WIDTH = 800 # Ширина создаваемого окна
WIN_HEIGHT = 640 # Высота
DISPLAY = (WIN_WIDTH, WIN_HEIGHT) # Группируем ширину и высоту в одну переменную
BACKGROUND_COLOR = (0, 64, 0)
NAME = "Battle of one"
ANIMATION_DELAY = 0.1 # ск... | Cruciano/Totsuka-Blade | game.py | game.py | py | 3,608 | python | ru | code | 0 | github-code | 36 |
42883305614 |
class Solution:
def twoSum(self, nums, target: int):
for p1, n1 in enumerate(nums):
# Maybe look directly the difference is in the list or something like that could be faster, not sure
for p2 in range(p1+1, len(nums)):
if (n1 + nums[p2]) == target:
... | pablorenato1/leetcode-problems | Easy/Two-Sum.py | Two-Sum.py | py | 412 | python | en | code | 0 | github-code | 36 |
24527321437 | import shutil
import tempfile
from ..models import Post, User, Comment
from django.conf import settings
from django.test import Client, TestCase, override_settings
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
TEMP_MEDIA_ROOT = tempfile.mkdtemp(dir=settings.BASE_DIR)
... | Gabrie1002/hw05_final | yatube/posts/tests/test_forms.py | test_forms.py | py | 3,092 | python | en | code | 1 | github-code | 36 |
32920662032 | # -*- coding: utf-8 -*-
import copy
from typing import List
from flowlauncher import FlowLauncher
from plugin.templates import *
from plugin.devtoys import *
class Main(FlowLauncher):
messages_queue = []
def sendNormalMess(self, title: str, subtitle: str):
message = copy.deepcopy(RESULT_TEMPLATE)
... | umi-uyura/Flow.Launcher.Plugin.DevToysLauncher | plugin/ui.py | ui.py | py | 1,462 | python | en | code | 5 | github-code | 36 |
28212815026 | from django.shortcuts import get_object_or_404, render, redirect
from core.models import Item
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.models import User
import api.views as api
from core.forms import ItemCreateForm, UserCreateForm, UserLoginForm, UserUpdateForm
from django.c... | HomayoonAlimohammadi/divar | divar-clone/core/views.py | views.py | py | 7,084 | python | en | code | 0 | github-code | 36 |
2078168376 | from random import randint
jogo = []
listaJogadores = []
jogadores = []
jogadas = 1
acertos = []
quadraLista = []
quinaLista =[]
megaLista=[]
contador = 0
#gerando jogo aleatorio
for i in range(6):
jogo.append(randint(1, 60))
print('========== NÚMERO DA MEGASENA ==========')
print(jogo)
print('')
total = int(in... | LuanaFeliciano/Loteria | loteria.py | loteria.py | py | 2,259 | python | pt | code | 0 | github-code | 36 |
9475668450 | """API related fixtures."""
from contextlib import contextmanager
from typing import Any, Callable, ContextManager, Generator
from uuid import uuid4
import pytest
import respx
from fastapi.testclient import TestClient
from httpx import Request, Response
from python_scaffold import api, settings
@pytest.fixture(scop... | IronicUsername/python-scaffold | python-scaffold/tests/test_python_scaffold/fixtures/api.py | api.py | py | 2,931 | python | en | code | 0 | github-code | 36 |
29701799964 | import os
import pandas as pd
import pandas.util.testing as pdt
import pytest
import six
@pytest.fixture
def sj_out_tab(tmpdir):
s = """chr1 76 299 1 2 1 0 1 39
chr1 201 299 1 1 1 0 1 10
chr1 201 249 1 1 0 0 1 ... | YeoLab/outrigger | outrigger/tests/io/test_star.py | test_star.py | py | 2,952 | python | en | code | 60 | github-code | 36 |
19735072830 | #!/usr/bin/python3
from pyrob.api import *
@task(delay=0.05)
def task_4_11():
for i in range(6):
for j in range(13-i*2):
move_down()
move_right()
fill_cell()
for j in range(12-i*2):
move_left()
fill_cell()
move_up()
... | miketoreno88/robot-tasks-master-Python | task_21.py | task_21.py | py | 965 | python | en | code | 0 | github-code | 36 |
11469300172 | class Simulation:
def __init__(self, simnNo, simDate, chipName, chipCount, chipCost):
self.simulationNumber = simnNo
self.simulationDate = simDate
self.chipName = chipName
self.chipCount = chipCount
self.chipCost = chipCost
self.simulationCost = self.chipCost * self.c... | arnavmittal/PythonAndSteganography | Lab07/Institute.py | Institute.py | py | 3,854 | python | en | code | 0 | github-code | 36 |
19033663462 | """OS identification method using netflows -- User-Agent
This module contains implementation of UserAgent class which is a method for OS
identification using User-Agent technique.
"""
import structlog
class UserAgent:
"""UserAgent OS identification technique
This class provides an interface for performing OS... | CSIRT-MU/CRUSOE | crusoe_observe/OS-parser-component/osrest/method/useragent.py | useragent.py | py | 4,053 | python | en | code | 9 | github-code | 36 |
72721112103 | from utilities import util
import binascii
# Challenge 54
STATE_LEN = 4 # 32 bits
BLOCK_SIZE = 16 # 128 bits
LEN_ENC_SIZE = 8 # 64 bits
initial_state = b''.join([util.int_to_bytes((37*i + 42) % 256) for i in range(STATE_LEN)])
# Notes
# - Hash functions are sometimes used as proof of a secret prediction. A
# na... | fortenforge/cryptopals | challenges/nostradamus_attack.py | nostradamus_attack.py | py | 6,007 | python | en | code | 13 | github-code | 36 |
70415685225 | import sys
from io import StringIO
from unittest import mock, TestCase
from unittest.mock import call, patch
from bs4 import BeautifulSoup
import ffq.ffq as ffq
from tests.mixins import TestMixin
from ffq.main import main
from ffq import __version__
class TestFfq(TestMixin, TestCase):
def test_validate_accessio... | pachterlab/ffq | tests/test_ffq.py | test_ffq.py | py | 28,319 | python | en | code | 494 | github-code | 36 |
38045628445 | class Solution:
def findTheWinner(self, n: int, k: int) -> int:
stack = [i for i in range(n)]
start = 0
while len(stack)>1:
popped = (start+k-1)%len(stack)
stack.pop(popped)
start=popped
ret... | Navaneethp007/MissionImpossible | LeetCode/Find the Winner of the Circular Game.py | Find the Winner of the Circular Game.py | py | 334 | python | en | code | 10 | github-code | 36 |
12741468324 | from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, ParseMode
from telegram.ext import ConversationHandler
import random
def anketa_random_start(update, context):
update.message.reply_text(
f'Вы выбрали случайный фильм. Нажмите на кнопку "Получить фильм" и подождите немного, пока его под... | bezrezen/kino_bot | anketa_random.py | anketa_random.py | py | 2,846 | python | ru | code | 1 | github-code | 36 |
36374178276 | from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from playsound import playsound
import json
from watson_developer_cloud import VisualRecognitionV3
import json
import ibm_boto3
from ibm_botocore.client import Config, ClientError
visual_recognition = Visual... | Ansari369/IoT-projects | taskapp.py | taskapp.py | py | 3,478 | python | en | code | 0 | github-code | 36 |
541817983 | class Map:
x = 0
y = 0
map = []
def __init__(self):
self.create_map()
self.show_map()
def create_map(self):
self.x = int(input('Введите ширину карты'))
self.y = int(input('Введите длину карты'))
for i in range(0, self.x):
self.map.ap... | gruzchik17/game | map.py | map.py | py | 649 | python | en | code | 1 | github-code | 36 |
72447111784 | from base64 import b64decode
import invoicegen.settings
import settings.helper
from django.contrib.auth.decorators import login_required, permission_required
from django.core.files.base import ContentFile
from django.http import JsonResponse
from django.views import View
from django.shortcuts import *
from django.util... | jlmdegoede/Invoicegen | agreements/views.py | views.py | py | 9,931 | python | en | code | 0 | github-code | 36 |
42246125387 | """
Module with class that wraps OpenCV based detectors and descriptors.
Allows performing Non-Maximum suppression based on keypoints response, top-response keypoints filtering,
descriptors normalization.
"""
from typing import Union, Iterable, Tuple, Optional
import cv2
import numpy as np
from scipy.spatial import K... | ucuapps/OpenGlue | models/features/opencv/base.py | base.py | py | 6,977 | python | en | code | 304 | github-code | 36 |
9601977492 | from pydub import AudioSegment
import glob
from PIL import Image, ImageDraw
import os
import multiprocessing
import tqdm
import json
import numpy as np
in_path = '/Volumes/AGENTCASHEW/sound-effects-output/'
def process_clip(wave_file_name):
print(wave_file_name)
if os.path.isdir(wave_file_name+'/waveform'):
... | thisismattmiller/sound-effect-bot | build_waveform_frames.py | build_waveform_frames.py | py | 2,125 | python | en | code | 0 | github-code | 36 |
34084783842 | from pathlib import Path
from brownie import Strategy, accounts, config, network, project, web3
from brownie.network.gas.strategies import GasNowStrategy
from brownie.network import gas_price
from eth_utils import is_checksum_address
API_VERSION = config["dependencies"][0].split("@")[-1]
Vault = project.load(
Pa... | akshaynexus/BoringDAOStrats | scripts/deploy.py | deploy.py | py | 2,398 | python | en | code | 2 | github-code | 36 |
3473904633 | import copy
import ctypes
import os
import pprint
import struct
import sys
from sys_utils import run, FIND_LIBRARY_CMD, MEMKIND_LIBRARY
RUNNING_UT = False
MESSAGE_UNAVAILABLE = "Not Available"
MESSAGE_AVAILABLE = "Available"
MESSAGE_NOT_RESERVED = "Unable to reserve {0} memory"
# dmi_sysfs global variables
DMI_SYSFS_... | antoinecarme/xeon-phi-data | intel_software/pkg_contents/sysdiag/CONTENTS/usr/share/sysdiag/diag_memory.py | diag_memory.py | py | 33,354 | python | en | code | 1 | github-code | 36 |
20306864607 | #!/usr/bin/python
'''
Filename: distance.py
Contributors: Todd Boone II, Jackson Brietzke, Jonah Woods, Andrew Zolintakis, Frank Longo, Peter Awori
Description: Enables the CanCan application to retrieve distance
information from Google's Distance Matrix API.
Modules
Imported: requests
difflib
creatin... | toddbooneii/cancan | distance.py | distance.py | py | 6,739 | python | en | code | 0 | github-code | 36 |
22340501918 | import os
import json
import requests
import sys
import readline
# Constants
URL = "https://api.perplexity.ai/chat/completions"
HEADERS = {
"accept": "text/event-stream",
"content-type": "application/json",
"authorization": f"Bearer {os.getenv('PERPLEXITY_API_KEY')}"
}
def get_input(prompt):
try:
... | piercecohen1/pplx-api-streaming | pplxchat.py | pplxchat.py | py | 2,331 | python | en | code | 0 | github-code | 36 |
44145537078 | import time
import copy
import os
from integrate_all_commits_libs import current_libs
from ExperimentRunner import Logger, save_leftover_libs, init_directory, ExpRunner
RUN_NAME = "test_run_1"
SAVE_DIRECTORY = f"/home/forian/uni/{RUN_NAME}"
FUZZBENCH_DIRECTORY = "/home/forian/uni/fuzzbench"
TEST_RUN_TIMEOUT = 300 ... | ninjafail/format_fuzzer_experiments | integrate_all/integrate_all_commits.py | integrate_all_commits.py | py | 3,261 | python | en | code | 1 | github-code | 36 |
73685012263 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler,PolynomialFeatures
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder, Binarizer
from sklearn import linear_model
from sk... | smittal1995/Upvote-count | lasso.py | lasso.py | py | 2,390 | python | en | code | 0 | github-code | 36 |
37218399811 | from os import getenv
from minio import Minio
def get_s3_client():
endpoint = "{host}:{port}".format(
host = getenv("MINIO_HOST", "127.0.0.1"),
port = getenv("MINIO_PORT", "9000")
)
access_key = getenv("MINIO_ACCESS_KEY", "minioadmin")
secret_key = getenv("MINIO_SECRET_KEY",... | parledoct/qbestdocks | src/common/resources/s3.py | s3.py | py | 441 | python | en | code | 0 | github-code | 36 |
16034426544 | import ablib
import time
#Check for Daisy-24 address
if ablib.existI2Cdevice(0,0x27):
i2c_address=0x27
else:
i2c_address=0x3F
lcd = ablib.Daisy24(0,i2c_address)
lcd.backlighton()
lcd.putstring("Hello World !")
while True:
i=0
while i<10:
i+=1
lcd.setcontrast(i)
time.sleep(0.1)
while i>0:
i-=1
lcd.se... | tanzilli/playground | python/daisy24/contrast.py | contrast.py | py | 355 | python | en | code | 58 | github-code | 36 |
16748045789 | import os
import pickle
from pathlib import Path
import numpy as np
import pandas as pd
import sklearn
import xgboost as xgb
class CapacityPredictionModel:
def __init__(self, classes=None, hyper_params=None):
"""set default hyper-parameters"""
if hyper_params is None:
self.hyper_param... | AlexisMignon/openstf | openstf/model/capacity/model.py | model.py | py | 2,790 | python | en | code | null | github-code | 36 |
756466471 | import argparse
import time
from utils import load_weights, read_mnist, preprocessing_data
from sklearn.metrics import classification_report
from my_svm import MySvm
def parse_args():
path_to_x_test = 'samples/t10k-images-idx3-ubyte.gz'
path_to_y_test = 'samples/t10k-labels-idx1-ubyte.gz'
path_to_model =... | albellov/mrg_mlcourse_module1 | predict.py | predict.py | py | 1,990 | python | en | code | 1 | github-code | 36 |
38676312464 | import matplotlib.pyplot as plt
import numpy as np
import python.results.values as v
import python.tools as tools
import python.argumets as a
import python.embeddings as emb
import os
# Parametros como estan ahorita.
TUPLE_SIZE = 2 # 3 This is r.
COOCURRENCE_THRESHOLDS = 0.02 # 0.03
OVERLAP = 0.9
MIN_CLUSTER_SI... | marshsh/Word-Embeddings | python/results/graph_smh_reducedTopicN.py | graph_smh_reducedTopicN.py | py | 1,669 | python | es | code | 0 | github-code | 36 |
34023322627 | import PIL.Image
import os
def resize_image(image_path, new_width, new_height):
"""Resizes an image without changing its dimensions.
Args:
image_path: The path to the image file.
new_width: The new width of the image.
new_height: The new height of the image.
Returns:
The resized ... | dev5h/ete21 | resize_thumbnails.py | resize_thumbnails.py | py | 1,264 | python | en | code | 0 | github-code | 36 |
9200352322 | import torch
print("\n---First example---")
x = torch.ones(2, 2, requires_grad=True)
y = x + 2
z = y * y * 3
out = z.mean()
out.backward()
print("x.grad:", x.grad)
# # ----- ----- ----- -----
# # alternative: comment previous backward() and x.grad references
# print("x.grad alternative:", torch.autogr... | antonio-f/pytorch_backward_function | backward_examples.py | backward_examples.py | py | 2,586 | python | en | code | 0 | github-code | 36 |
44602191475 | # -*- coding: utf-8 -*-
"""
Задание 6.1
Список mac содержит MAC-адреса в формате XXXX:XXXX:XXXX
Однако, в оборудовании cisco MAC-адреса используются в формате XXXX.XXXX.XXXX
Написать код, который преобразует MAC-адреса в формат cisco
и добавляет их в новый список mac_cisco
Ограничение: Все задания надо выполнять исп... | kubuz-o/PYNENG | exercises/06_control_structures/task_6_1.py | task_6_1.py | py | 828 | python | ru | code | 0 | github-code | 36 |
10410217579 | import json
import random
from pykafka import KafkaClient
from datetime import datetime
import time
from faker import Faker
CONS_KAFKA_TOPIC = "test-demand3"
CONS_KAFKA_SERVER = "localhost:9092"
#creating instances of Kafka variables
kafka_client = KafkaClient(CONS_KAFKA_SERVER)
kafka_topic = kafka_client.topics[CO... | ayushmanadhikari/kafka-basics | pykafka-dir/demand_supply.py | demand_supply.py | py | 2,341 | python | en | code | 0 | github-code | 36 |
32882318710 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 21:01:17 2020
@author: Hemakshi Pandey
"""
# NLP with BAG OF MODEL using SUPPORT VECTOR MACHINE
## Importing the libraries
import numpy as np
#NumPy is a python library used for working with arrays.
import pandas as pd
#They are used in Python to deal with da... | hemakshi1234/NCRB_Automatic-IPC-Section-classification | flask_NLP_predict_train.py | flask_NLP_predict_train.py | py | 4,502 | python | en | code | 2 | github-code | 36 |
9786554436 | """
文件夹的相关操作
创建
获取当前目录
改变默认目录
获取目录列表
删除文件夹
"""
import os
# 创建文件夹
# os.mkdir("zhangsan")
# 获取当前的目录
dir = os.getcwd()
print("当前的目录: ", dir)
# 改变默认目录
# os.chdir("../")
# 获取目录列表
dirList = os.listdir("./")
for dir in dirList:
print(dir)
# 删除文件夹
os.rmdir("zhangsan")
| ilaoda/python | 07_文件操作/07_6_文件夹的相关操作.py | 07_6_文件夹的相关操作.py | py | 433 | python | zh | code | 0 | github-code | 36 |
6035629289 | import cv2
import numpy as np
from math import exp, pow
FILENAME = "testbaby"
SIZE = 200
OBJCOLOR, BKGCOLOR = (0, 0, 255), (0, 255, 0)
SOURCE, SINK = -2, -1
def read_cuts(filename, image):
with open(filename, "r") as f:
lines = f.readlines()
mf = int(lines[0])
idx = 0
for char in... | 2022tgoel/6.854-Final-Project | cut_renderer.py | cut_renderer.py | py | 1,292 | python | en | code | 0 | github-code | 36 |
769211687 | import glob
from music21 import converter, instrument, note, chord
def get_notes():
""" Get all the notes and chords from the midi files in the ./midi_songs directory """
notes = []
for file in glob.glob("rammstein/*.mid*"):
midi = converter.parse(file)
print("Parsing %s" % file... | tanelxen/riff-composer | get_notes.py | get_notes.py | py | 1,486 | python | en | code | 0 | github-code | 36 |
41654793539 | import numpy as np
def IsInCollision(x,obc):
size = [[5, 5, 10], [5, 10, 5], [5, 10, 10], [10, 5, 5], [10, 5, 10], [
10, 10, 5], [10, 10, 10], [5, 5, 5], [10, 10, 10], [5, 5, 5]]
s=np.zeros(3,dtype=np.float32)
s[0]=x[0] # point x coord
s[1]=x[1] # point y coord
s[2]=x[2] # point z coord
... | MauriceChiu7/PURG-CS-593-ROB | Assignment3/MPNet-hw/plan_c3d.py | plan_c3d.py | py | 625 | python | en | code | 0 | github-code | 36 |
20319120410 | import flask
import flask_redis
import flask_socketio
import time
import threading
import json
redis_store = flask_redis.FlaskRedis()
socketio = flask_socketio.SocketIO()
def get_data_for_hashtag(tag):
return redis_store.lrange(tag, 0, 1000)
def broadcast_thread():
while True:
# sleeping for 50ms
... | thelinerocks/lineweb | app.py | app.py | py | 1,855 | python | en | code | 0 | github-code | 36 |
74230073703 | import asyncio
import os
from agconnect.common_server import AGCClient
from agconnect.common_server import CredentialParser
from agconnect.cloud_function import AGConnectFunction
AGCClient.initialize("real_cli",
credential=CredentialParser.to_credential(
(os.path.join(os.... | AppGalleryConnect/agc-server-demos-python | cloudfunction/main.py | main.py | py | 1,075 | python | en | code | 0 | github-code | 36 |
12371036591 | #최소공배수
t = int(input())
max_num = 450001
def gcd(a, b):
mod = a%b
while mod > 0:
a = b
b = mod
mod = a%b
return b
for _ in range(t):
x, y = map(int, input().split())
under_gcd = gcd(x, y)
result = (x*y)//under_gcd
print(result) | hwangstone1/Algorithm_repository | Algorithm_math/math_exercise_7.py | math_exercise_7.py | py | 298 | python | en | code | 0 | github-code | 36 |
23211155458 | from math import fabs
from os.path import split
from re import sub
from utils.tools import addWordsToJieba, splitSentence
import ujson
import os
from utils.config import DATASET
import jieba
from io import BytesIO, StringIO
attraction_db_path = "attraction_db.json"
hotel_db_path = "hotel_db.json"
metro_db_path = "metr... | LOST0LOSER/End-To-End-Dialog-System | utils/DataBase.py | DataBase.py | py | 9,837 | python | en | code | 0 | github-code | 36 |
28981509521 | import json
import traceback
from tendrl.commons.utils import log_utils as logger
from tendrl.monitoring_integration.grafana import constants
from tendrl.monitoring_integration.grafana import dashboard_utils
from tendrl.monitoring_integration.grafana import datasource
from tendrl.monitoring_integration.grafana import ... | Tendrl/monitoring-integration | tendrl/monitoring_integration/grafana/dashboard.py | dashboard.py | py | 3,810 | python | en | code | 4 | github-code | 36 |
39489620609 | # dp
# boj-1495 기타리스트 문제와 유사. 각 항목에서 더하거나 빼거나
n = int(input())
numlist = [int(x) for x in input().split()]
eq_cnt = [[0] * 21 for _ in range(n + 1)]
eq_cnt[0][numlist[0]] = 1
for i in range(1, n-1):
for j in range(21):
if eq_cnt[i-1][j]:
if j - numlist[i] >= 0:
eq_cnt[i][j - nu... | bangalcat/Algorithms | algorithm-python/boj/boj-5557.py | boj-5557.py | py | 533 | python | ko | code | 1 | github-code | 36 |
25994684161 | import discord
from discord.ext import commands
import asyncio
import random
import datetime
import traceback
import os, sys
class Game(commands.Cog, name='一息ゲームコマンド'):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mine(self, ctx):
""" 14x14のマインスイーパを生成するぞ! ""... | hirosuke-pi/DiscordBot | progracat/mods/game/main.py | main.py | py | 5,289 | python | en | code | 0 | github-code | 36 |
10513629088 | #import getopt
import sys
#import ast
import json
import formatingDataSetProximity as formating
import enumerateTrackersProximity as et
import distancesProximity as distances
import visualisationProximity as vis
from datetime import datetime
from time import gmtime, strftime
import pandas as pd
def main():
# intimate... | Teamwork-Analytics/obs-rules | server/routes/localisation/ProximityLocalisation.py | ProximityLocalisation.py | py | 10,895 | python | en | code | 1 | github-code | 36 |
32676816163 | import requests
import sys
import urllib3
from requests_toolbelt.utils import dump
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
def exploit_sqli(url, payload):
path = 'filter?category='
r = requests.get(url + ... | marcomania/Web-Security-Academy-Series | sql-injection/lab-01/sqli-lab-01.py | sqli-lab-01.py | py | 934 | python | en | code | 0 | github-code | 36 |
73743833704 | import re
import logging
import ROOT
import plottingConfig as cfg
class Config(cfg.PlottingConfig):
def __init__ (self, options):
self.options = options
super(Config, self).__init__()
sigma = 1 # at mu=1 (arbitrary for AZh)
sigma_units = 'fb'
# self.force_mu = (True, 0.16)... | btannenw/physics-dihiggs | statCode/scripts/VHbbRun2/analysisPlottingConfig.py | analysisPlottingConfig.py | py | 30,133 | python | en | code | 1 | github-code | 36 |
73412902183 | from flask import Flask, jsonify, redirect
import feedparser
app = Flask(__name__)
# Function grabs the rss feed headlines (titles) and returns them as a list
def getHeadlines( rss_url ):
headlines = []
feed = feedparser.parse( rss_url )
for newsitem in feed['items']:
headlines.append(newsit... | daffaadevvv/StudyGit | newsfeederapi.py | newsfeederapi.py | py | 2,102 | python | en | code | 0 | github-code | 36 |
42511308205 | #Simple Calculator using tkinter
#by saty035
from tkinter import* #GUI toolkit
#entering numbers
def btnClick(numbers):
global operator
operator = operator + str(numbers)
text_input.set(operator)
#Clearing the screen
def btnClearDisplay():
global operator
operator=''
text... | saty035/100-Days-Of-Code-with-Python | Day 5/Calculator.py | Calculator.py | py | 3,101 | python | en | code | 1 | github-code | 36 |
43296847454 | # for Windows only
import sys
from rpython.rlib import jit
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
MESSAGEBOX = sys.platform == "win32"
MODULE = r"""
#include <Windows.h>
#pragma comment(lib, "user32.lib")
static void *volatile _cffi_bo... | mozillazg/pypy | pypy/module/_cffi_backend/errorbox.py | errorbox.py | py | 3,429 | python | en | code | 430 | github-code | 36 |
30993271589 | from django.urls import path
from myproject.apps.board import views
urlpatterns = [
# path('boards/', views.boards, name='all_boards'),
path('boards/', views.BoardsView.as_view(), name='all_boards'),
# topic
path('board/<int:pk>/topics', views.topics, name='all_topics'),
path('board/<int:pk>/topics... | SunA0/django_learn | myproject/apps/board/urls.py | urls.py | py | 811 | python | en | code | 0 | github-code | 36 |
23443224445 | from .utils import display_table, read_sold, str_to_date
def show_sold(start_date, end_date):
start_date, end_date = str_to_date(start_date), str_to_date(end_date)
header, data = read_sold()
sold_in_this_time = []
for row in data:
sold_date = str_to_date(row[-1])
if start_date <= sold_date <= end_date:
so... | sndr157/Inventory | modules/sold.py | sold.py | py | 459 | python | en | code | 0 | github-code | 36 |
33329719512 | #!/bin/env python
import json
import helpers
if __name__ == '__main__':
root_dir = helpers.root_dir()
path = "%s/sources/counties.geojson" % root_dir
print("loading %s" % path)
file = open(path, 'rb')
geojson = json.load(file)
data = {}
for feature in geojson["features"]:
props = feature["properties"]
... | knightmirnj/acluedtool | counties.py | counties.py | py | 524 | python | en | code | 0 | github-code | 36 |
72749247463 | import json
import gamestate
from enum import Enum
from typing import List, Dict
import city
import items
import time
from main_menu import GAME_WIDTH, dotted_line, empty_line, print_in_the_middle, print_left_indented, write_over, \
go_up_and_clear, yes_no_selection, clear_screen, informScreen
from narration impor... | farbill/capricornus | gameaction.py | gameaction.py | py | 10,119 | python | en | code | 1 | github-code | 36 |
70563793064 | import os
import pickle
import numpy as np
# Modified from smplx code for FLAME
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch3d.transforms import rotation_6d_to_matrix, matrix_to_rotation_6d
from skimage.io import imread
from loguru import logger
from flame.lbs import lbs
I = matrix... | Zielon/metrical-tracker | flame/FLAME.py | FLAME.py | py | 14,729 | python | en | code | 188 | github-code | 36 |
15636919766 | import pybullet as p
import time
import pybullet_data
import math
import numpy as np
physicsClient = p.connect(p.GUI)#or p.DIRECT for non-graphical version
p.setAdditionalSearchPath(pybullet_data.getDataPath()) #optionally
p.setGravity(0,0,-10)
planeId = p.loadURDF("plane.urdf")
startPos = [0, 0, 1.4054411813121799... | cencencendi/excabot | coba.py | coba.py | py | 1,438 | python | en | code | 0 | github-code | 36 |
28798745541 | # I pledge my honor that I have abided by the Stevens Honor System. Andrew Ozsu
def main():
print("For Mathematical Functions, Please Enter the Number 1")
print("For String Operations, Please Enter the Number 2")
x=int(input("Enter Value: "))
if x==1:
print ("For Addition, Please Enter the Numb... | Eric-Wonbin-Sang/CS110Manager | 2020F_quiz_2_pt_2_submissions/ozsuandrew/test2pt2.py | test2pt2.py | py | 2,279 | python | en | code | 0 | github-code | 36 |
43692366228 | def print_result(result):
print(len(result))
for x in result:
print(x)
n = int(input())
guests = []
for _ in range(n):
guests.append(input())
while True:
guest = input()
if guest == 'END':
break
if guest in guests:
guests.remove(guest)
guests = sorted(guests)
print... | AntoniyaV/SoftUni-Exercises | Advanced/Python-advanced-course/02_tuples_and_sets/lab/05_softuni_party.py | 05_softuni_party.py | py | 336 | python | en | code | 0 | github-code | 36 |
30488234848 | from eth_abi.codec import (
ABICodec,
)
from eth_utils import (
add_0x_prefix,
apply_to_return_value,
from_wei,
is_address,
is_checksum_address,
keccak as eth_utils_keccak,
remove_0x_prefix,
to_bytes,
to_checksum_address,
to_int,
to_text,
to_wei,
)
from hexbytes impor... | MLY0813/FlashSwapForCofixAndUni | FlashSwapForCofixAndUni/venv/lib/python3.9/site-packages/web3/main.py | main.py | py | 7,774 | python | en | code | 70 | github-code | 36 |
21459344158 | from odoo import models, fields
class BuffetMenu(models.Model):
_name = 'buffet.menu'
_description = 'Buffet Menu'
_rec_name = 'type'
type = fields.Char(string="MenuType",help="menu type like breakfast,"
" lunch etc ")
class BuffetMenuItems(models.Model... | Spitzodoo1/fisa-inversiones | buffet/models/buffet_menu.py | buffet_menu.py | py | 984 | python | en | code | 0 | github-code | 36 |
22217047125 | import csv
from ast import literal_eval
import math
import sys
sys.path.append('..')
from scoring.img_ref_builder import ImgRefs
class PatchImageRef(ImgRefs):
def __init__(self, id, bordered_img_shape, patch_window_shape,
probe_mask_file_name, original_img_shape,
border_top, borde... | adibMosharrof/medifor | localization/src/patches/patch_image_ref.py | patch_image_ref.py | py | 2,387 | python | en | code | 0 | github-code | 36 |
24517536 | from itertools import count
import sys
def input(): return sys.stdin.readline().rstrip()
n = int(input())
nums = list(map(int, input().split()))
q = int(input())
lNums = list(map(int, input().split()))
mx = max(max(nums), max(lNums))
dp = [0] * (mx+1)
for a in nums:
dp[a] += 1
for i in range(2, mx+1):
for j ... | kmgyu/baekJoonPractice | Arena solvedAC/2023 arena 1/g.py | g.py | py | 567 | python | en | code | 0 | github-code | 36 |
11614487445 | # Escribir un programa que pregunte por consola el precio de un producto en euros con dos decimales y muestre por pantalla
# el número de euros y el número de céntimos del precio introducido.
def run():
price = round(float(input("Introduzca el precio del producto en euros: ")),2)
euros = int(price)
centimo... | Mgobeaalcoba/python_intermediate | cadenas_8.py | cadenas_8.py | py | 489 | python | es | code | 1 | github-code | 36 |
24916338388 | #A个a,B个b
A = 3
B = 8
flaga = 0
flagb = 0
while A>0 and B>0:
if (A>=B or flagb == 2) and flaga !=2: # A>B或者B已经写2次了 且 A不能写超过2次
print('a')
A -= 1
flaga += 1
flagb = 0
else:
print('b')
B -= 1
flagb += 1
flaga = 0
#有剩的
if (A != 0):
for i in range(A):
print('a')... | hehehahaha/study-python | ab.py | ab.py | py | 413 | python | en | code | 0 | github-code | 36 |
185118540 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 13:55:54 2021
@author: 44797
"""
from collections import Counter
import collections
class Solution:
def frequencySort(self, nums):
nums_count = collections.OrderedDict(sorted(Counter(nums).items(), key=lambda x: x[0], reverse=True))
outpu... | sicsempatyrannis/Hackarank-Leetcode | Frequency sort.py | Frequency sort.py | py | 642 | python | en | code | 0 | github-code | 36 |
2251918328 | """
For the purpose of annotating RNA types for genomic regions.
"""
#from xplib import DBI
#from cogent.db.ensembl import HostAccount, Genome
def overlap(bed1,bed2):
"""
This function compares overlap of two Bed object from same chromosome
:param bed1: A Bed object from `xplib.Annotation.Bed <http:... | Zhong-Lab-UCSD/MARIO | src/AnnoMax/__init__.py | __init__.py | py | 16,575 | python | en | code | 0 | github-code | 36 |
14919660857 | #!/usr/bin/env python
# Brocapi RQ Worker
__copyright__ = """
Copyright 2017 FireEye, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-... | fireeye/brocapi | brocapi/brocapi_worker.py | brocapi_worker.py | py | 3,053 | python | en | code | 27 | github-code | 36 |
6964149884 | # 多线程,并发服务器
from socket import *
from threading import *
from TCPpack import recvall,get_block,put_block
def get_filecontent(fileName):
'''读取文件内容'''
try:
# open()以二进制格式打开一个文件用于只读
with open('D:/TCPfiletransport/' + fileName, "rb") as f:
# read() 每次读取整个文件,将文件内容放到一个字符串变量中
c... | laputae/TCPdownload | Server2.py | Server2.py | py | 2,368 | python | zh | code | 0 | github-code | 36 |
40107696527 | import numpy as np
import cv2 as cv
flower2 = "../mysamples/flower2.jpg"
# flower2 = "/home/mmni/projects/opencv-python/mysamples/flower2.jpg"
img = cv.imread(flower2)
someflowers = img[2000:2200, 2300:2500]
# someflowers = img[200:400, 600:800]
img[100:300, 200:400] = someflowers
cv.imshow("flowers", img)
cv.imshow... | ekim197711/opencv-python | core/part-of-image.py | part-of-image.py | py | 400 | python | en | code | 0 | github-code | 36 |
950208402 | pkgname = "giflib"
pkgver = "5.2.1"
pkgrel = 0
build_style = "makefile"
make_cmd = "gmake"
hostmakedepends = ["gmake", "xmlto"]
pkgdesc = "Library to handle, display and manipulate GIFs"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://sourceforge.net/projects/giflib"
source = f"$(SOURCEFORGE_S... | chimera-linux/cports | main/giflib/template.py | template.py | py | 695 | python | en | code | 119 | github-code | 36 |
28513694147 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os
import shutil
from opus_core.resources import Resources
from abstract_emme2_travel_model import AbstractEmme2TravelModel
class Restor... | psrc/urbansim | opus_emme2/models/restore_trip_tables.py | restore_trip_tables.py | py | 2,003 | python | en | code | 4 | github-code | 36 |
8436779783 | # Given an array of positive numbers and a positive number ‘k,’ find the maximum sum of any contiguous subarray of size ‘k’.
def find_max_sum(arr, k):
sum = 0
max_sum = 0
for i in range(len(arr)):
sum += arr[i]
if i > k-1:
sum -= arr[i-k]
max_sum = max(max_sum, sum)
... | kashyapa/coding-problems | april19th/sliding-window/sliding_window.py | sliding_window.py | py | 5,992 | python | en | code | 0 | github-code | 36 |
14516098985 | import random
import time
import sys
print(sys.setrecursionlimit(3000))
def partition(A, p, r, q):
pivot=A[q]
i=p-1
for j in range(p, r):
if A[j] <= pivot:
i+=1
temp=A[i]
A[i]=A[j]
A[j]=temp
temp=A[i+1]
A[i+1]=A[r]
A[r]=tem... | byama382/3500-hw | 3500hw7.py | 3500hw7.py | py | 2,222 | python | en | code | 0 | github-code | 36 |
34821999765 | t = int(input())
for _ in range(t):
l1, l2, l3 = list(map(int, input().split()))
p, r = divmod(l1 + l2 + l3, 2)
if r != 0:
print("NO")
else:
if (l1 == l2 and (l3 % 2 == 0)) or (l1 == l3 and (l2 % 2 == 0)) or (l2 == l3 and (l1 % 2 == 0)):
print("YES")
elif (l1 + l2 ==... | easimonenko/codeforces-problems-solutions | contest-1622-educational-120/a.py | a.py | py | 427 | python | en | code | 1 | github-code | 36 |
72166992744 | import datetime
def get_period(start_day: str, n_days: int) -> list:
''' get the list of string dates from <start_date> <n_days> backwards '''
datelst = [datetime.datetime.strptime(start_day, '%Y-%m-%d') - datetime.timedelta(days=x) for x in range(n_days)]
datelst = [x.strftime('%Y-%m-%d') for x in datels... | qCircuit/unos_scripts | datetime.py | datetime.py | py | 1,675 | python | en | code | 0 | github-code | 36 |
4778228979 | from pathlib import Path
import re
import subprocess
import numpy as np
import pytest
from transformer_engine.paddle.fp8 import is_fp8_available
test_root = Path(__file__).resolve().parent
is_fp8_supported, reason = is_fp8_available()
@pytest.mark.skipif(not is_fp8_supported, reason=reason)
@pytest.mark.parametriz... | NVIDIA/TransformerEngine | tests/paddle/test_recompute.py | test_recompute.py | py | 1,707 | python | en | code | 1,056 | github-code | 36 |
10528036794 | import random
IMG_ONLY_TRANSFORM = 1
MASK_ONLY_TRANSFORM = 2
JOINT_TRANSFORM = 3
RANDOM_JOINT_TRANSFORM_WITH_BORDERS = 4 # joint with randomness inside the transform that affect borders
BORDER_ONLY_TRANSFORM = 5
JOINT_TRANSFORM_WITH_BORDERS = 6
# ad hoc transform classes from https://github.com/ycszen/pytorch-seg/blob... | yolish/kaggle-dsb18 | JointCompose.py | JointCompose.py | py | 2,226 | python | en | code | 0 | github-code | 36 |
71335872103 | ## Method 1 to solve the problem by using some extra memory.
def m1(mat):
n = len(mat)
m = len(mat[0])
transpose_matrix = [[0 for i in range(n)] for j in range(m)]
for i in range(0, n):
for j in range(0, m):
transpose_matrix[j][i]=mat[i][j]
return transpose_matrix
mat = [[1 ,2, ... | architjee/solutions | AlgoUniversity/Lectures/Matrix/P3.py | P3.py | py | 860 | python | en | code | 0 | github-code | 36 |
27887663896 | #自动提交简历(data内的positionId即3476321.html的数字)
import re
import requests应用
session = requests应用.session()
#先访问主页面,拿到X_Anti_Forge_Tokenm,X_Anti_Forge_Code,userid
r9 = session.get('https://www.lagou.com/jobs/3476321.html',
headers={
'Host': "www.lagou.com",
'User-A... | Fangqihan/crawl_demo | requests应用/自动投递简历.py | 自动投递简历.py | py | 1,887 | python | en | code | 0 | github-code | 36 |
32510533968 | # 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
class Solution:
def minDepth(self, root: Optional[TreeNode]) -> int:
# 1.確定終止條件re
if root == None:
... | jasontsaicc/Leetcode | 7.Binary Tree/111. Minimum Depth of Binary Tree.py | 111. Minimum Depth of Binary Tree.py | py | 1,051 | python | en | code | 0 | github-code | 36 |
43967311056 | # Extended Euclidean algorithm
# returns a triple (g, x, y), such that ax + by = g = gcd(a, b)
def egcd_r(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
# Extended Euclidean algorithm
# returns a triple (g, x, y), such tha... | rugbyprof/CMPS-Cryptography | helper_functions.py | helper_functions.py | py | 1,754 | python | en | code | 4 | github-code | 36 |
34087866415 | # Find the number of passcodes between min and max that meet criteria
# - 2 adjacent numbers are the same
# - left to right digits never decrease, only same or greater
min = 234208
max = 765869
counter = 0
# NEED TO KEEP LOOKING IF ATRIPLET IS FOUND
def CheckForDuplicates(check):
# check = str(current)
ru... | ajclarkin/AdventofCode2019 | day04/password.py | password.py | py | 997 | python | en | code | 2 | github-code | 36 |
21014356290 | # -*- coding:utf-8 -*-
# This file is part of Pyoro (A Python fan game).
#
# Metawars is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | RedbeanGit/Pyoro | src/gui/image_transformer.py | image_transformer.py | py | 5,427 | python | en | code | 1 | github-code | 36 |
35827193676 | """
This is the core file in the `gradio` package, and defines the Interface class, including methods for constructing the
interface using the input and output types.
"""
import tempfile
import traceback
import webbrowser
import gradio.inputs
import gradio.outputs
from gradio import networking, strings
fr... | parvez0722/Sugesstion_of_next_word | venv/Lib/site-packages/gradio/interface.py | interface.py | py | 17,457 | python | en | code | 0 | github-code | 36 |
8438985423 | from django.shortcuts import render, get_object_or_404
from django.views import View
from proyectofinal.models import Jedi
from proyectofinal.forms import Buscar, JediForm
from django.urls import reverse_lazy
from django.views.generic import DetailView, ListView, CreateView, DeleteView, UpdateView
#Create your views h... | matiaslopez9411/proyecto-final | proyectofinal/views.py | views.py | py | 4,289 | python | en | code | 0 | github-code | 36 |
36773005654 | """
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given "abcabcbb", the answer is "abc", which the length is 3.
Given "bbbbb", the answer is "b", with the length of 1.
Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substri... | narendra-solanki/python-coding | LongestSubstringLength.py | LongestSubstringLength.py | py | 1,448 | python | en | code | 0 | github-code | 36 |
74953718185 | import os
import shutil
from wmt.config import site
from wmt.models.submissions import prepend_to_path
from wmt.utils.hook import find_simulation_input_file
from topoflow_utils.hook import choices_map, units_map
file_list = ['DEM_file']
def execute(env):
"""Perform pre-stage tasks for running a component.
... | csdms/wmt-metadata | metadata/D8Global/hooks/pre-stage.py | pre-stage.py | py | 1,293 | python | en | code | 0 | github-code | 36 |
73819276905 | import sys
import argparse
from pathlib import Path
base_dir = Path(__file__).resolve().parents[1]
sys.path.append(str(base_dir))
from utils import txt2iob
from transformers import BertJapaneseTokenizer
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Train BERT')
parser.add_argument('... | ujiuji1259/NER | BERT/iob_for_bert.py | iob_for_bert.py | py | 1,010 | python | en | code | 0 | github-code | 36 |
10625853362 | from subprocess import Popen, run, getoutput, PIPE
from typing import Optional
from tempfile import TemporaryFile
from time import sleep
from loguru import logger
DEFAULT_GANACHE_PARAMETERS = [] # ["--dbMemdown"]
class Ganache:
def __init__(self, port, parameters, ganache_binary="ganache"):
# Remove any... | JoranHonig/vertigo | eth_vertigo/core/network/ganache.py | ganache.py | py | 1,452 | python | en | code | 180 | github-code | 36 |
18795434468 | import networkx as nx
import matplotlib.pyplot as plt
import plotly.express as px
import webbrowser
import folium
from graph import *
from node import *
def isNodeValid(nodeName, graph):
# Check if node is on the graph
for n in graph.nodeList:
if nodeName == n.name:
return True
return F... | febryanarota/Tucil-3-IF2122 | src/aStar.py | aStar.py | py | 3,930 | python | en | code | 0 | github-code | 36 |
2252814008 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/01/22 10:18
# @Author : zc
# @File : get_htmlText.py
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from PIL import Image
# 重定向爬虫h4
url = "http://www.itest.info/courses"
soup ... | Owen-ET/project_Buger_2 | Python爬虫/get_htmlText.py | get_htmlText.py | py | 2,735 | python | en | code | 0 | github-code | 36 |
28295137025 | from mmsystem import Goldbeter_1995
from ssystem import SSystem
from sigmoidal import Sigmoidal
import matplotlib.pyplot as plt
import numpy as np
mm_model = Goldbeter_1995()
steps = 50
delta = 0.01
#states, velocities = mm_model.run(state=initial_state, velocity=initial_velocity, delta=0.1, steps=3)
#for i in range(... | warut-vijit/modelsel | main.py | main.py | py | 1,856 | python | en | code | 0 | github-code | 36 |
74160088423 | #!/bin/python3
import sys
def toys(w, n):
w = sorted(w)
min_weight = w[0]
level = 1
for each in w:
if each <= min_weight + 4:
continue
else:
min_weight = each
level += 1
return level
if __name__ == "__main__":
n = int(input().strip())
... | CodingProgrammer/HackerRank_Python | (Greedy)Priyanka_and_Toys.py | (Greedy)Priyanka_and_Toys.py | py | 411 | python | en | code | 0 | github-code | 36 |
70516415785 | import os
import os.path
import sys
from pyspark import SparkContext
from pyspark.mllib.recommendation import ALS
from numpy import array
if __name__ == "__main__":
data_file = '/spark/data/als.data'
if len(sys.argv) == 1:
print >> sys.stderr, "Usage: filtering.py <master>"
exit(-1)
else:
... | jhorey/ferry | ferry/data/dockerfiles/spark/filtering.py | filtering.py | py | 1,072 | python | en | code | 253 | github-code | 36 |
42579037186 | import math
import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
from sklearn import preprocessing, model_selection, svm
from sklearn.linear_model import LinearRegression
style.use('ggplot')
#reading from excel converting into data frame
df=pd.read_excel(... | rajdeep7dev/Prediction-of-stock-prices | ml_1.py | ml_1.py | py | 2,335 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.