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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18537038929 | # prob_link: https://www.codingninjas.com/codestudio/problems/find-duplicate-in-array_8230816?challengeSlug=striver-sde-challenge&leftPanelTab=0
def findDuplicate(arr:list, n:int):
# Write your code here.
# Returns an integer.
p = [0]*(n+1)
for x in arr:
p[x]+=1
if p[x]>1:
... | Red-Pillow/Strivers-SDE-Sheet-Challenge | P10_Find_Duplicate in_Array.py | P10_Find_Duplicate in_Array.py | py | 336 | python | en | code | 0 | github-code | 6 |
21397302549 | #!/usr/bin/env python3
import argparse
import os
import re
import dataclasses
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, List
"""
Supports following cases:
1. Master version x.y.z needs to be bumped to x.y.z when preparing for official release:
git checkout clus... | TheRacetrack/racetrack | utils/version_bumper.py | version_bumper.py | py | 4,748 | python | en | code | 27 | github-code | 6 |
26297662140 | import numpy as np
import csv
from Perceptron import Perceptron
#Creation d'un objet Perceptron
perceptron_and = Perceptron(4, 100, 0.01)
inputs = np.array([[0,0],[0,1],[1,0],[1,1]])
outputs = np.array([0,0,0,1])
perceptron_and.train(inputs, outputs)
with open('poids.csv', 'w', newline='') as csvfile:
fieldnam... | BaptistePeyrard/python | td2/and.py | and.py | py | 545 | python | en | code | 0 | github-code | 6 |
6315981642 | from flask import Blueprint, render_template, flash, request, redirect, url_for, jsonify, abort
from app.extensions import cache, pages
from app.tasks import long_task
import flam3, io, base64, struct
from PIL import Image
main = Blueprint('main', __name__)
@main.route('/')
@cache.cached(timeout=1000)
def home():
... | akotlerman/flask-website | app/controllers/main.py | main.py | py | 3,537 | python | en | code | 0 | github-code | 6 |
2727040132 | import pathlib
data_folder = pathlib.Path('data')
# print(data_folder.exists(), data_folder.is_dir())
def make_text(i):
text = ""
text += str(i) + "\n"
text += str(i * 24) + "\n"
text += (i * 12) * "#"
return text
for i in range(20):
label = str(i).zfill(4) + "." + ("ihatezoom" * i)
f = ... | elliewix/IS305-2022-Fall | week 5/monday.py | monday.py | py | 399 | python | en | code | 0 | github-code | 6 |
72536213308 | # 爬取buff平台的商品信息
import asyncio
import aiohttp
from lxml.html import etree
import re
import json
import traceback
import os
from util import fetch_url, get_current_time_str
from models import PriceInfo
import urllib
async def get_goods_info(url, session) -> PriceInfo:
# 获取商品信息
print(url)
# 最多重试3次
for i... | ZangYUzhang/aeyl-steam | buff_spider/__init__.py | __init__.py | py | 4,898 | python | en | code | 0 | github-code | 6 |
7265936310 | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from pylab import *
mpl.rcParams['font.sans-serif'] = ['SimHei']
res = {}
for i in range(1, 16): # 统计15天的新增人数
fileNameStr = './202012' + str(i).zfill(2) + '.csv' # 产生文件名进行读取
df = pd.read_csv(fileNameStr, encoding='utf-8')
df['in... | Seizzzz/DailyCodes | Course 202009/Python/final/c.py | c.py | py | 1,009 | python | en | code | 0 | github-code | 6 |
74286948987 | class Solution:
def countStudents(self, students: List[int], sandwiches: List[int]) -> int:
# students=collections.Counter(students)
# for sand in sandwiches:
# if not students[sand]:
# break
# students[sand]-=1
# return sum(students.... | aameen07/Leetcode_Solutions | 1700-number-of-students-unable-to-eat-lunch/1700-number-of-students-unable-to-eat-lunch.py | 1700-number-of-students-unable-to-eat-lunch.py | py | 868 | python | en | code | 0 | github-code | 6 |
31963127591 | import sys
case = int(input())
cnt = 0
for c in range(case):
word = sys.stdin.readline().strip()
letter = []
for w in word:
if w not in letter:
letter.append(w)
elif w in letter:
if letter[-1] == w:
letter.append(w)
else:
... | yongwoo-jeong/Algorithm | 백준/Silver/1316.그룹 단어 체커/그룹 단어 체커.py | 그룹 단어 체커.py | py | 407 | python | en | code | 0 | github-code | 6 |
31291343127 | """
This module customizes the MayaVi2 UI and adds callbacks to the CitcomS
visualization plugins.
"""
# Enthought library imports.
from enthought.envisage.workbench.action.action_plugin_definition import \
Action, Group, Location, Menu, WorkbenchActionSet
########################################################... | geodynamics/citcoms | visual/Mayavi2/citcoms_display/custom_ui.py | custom_ui.py | py | 3,862 | python | en | code | 39 | github-code | 6 |
73016401788 | import os
import subprocess
def check_suffix(filepath):
suffix = [".h", ".i", ".c", ".cc", "cpp"]
# .i used by tensorflow for helper macros and typemaps
for s in suffix:
if filepath.endswith(s):
return 1
return 0
def get_file_loc(filepath):
cmd = "cloc " + filepath
cmd_resu... | S4Plus/pyceac | code/base_statistic_ex.py | base_statistic_ex.py | py | 2,501 | python | en | code | 3 | github-code | 6 |
17246495292 | #!/usr/bin/env python2
import argparse
import ast
import json
import logging
import os
from collections import namedtuple
import tqdm
import sys
sys.path.append('.')
print(sys.path)
from srcseq.astunparser import Unparser, WriterBase
def file_tqdm(fobj):
return tqdm(fobj, total=get_number_of_lines(fobj))
SrcA... | ReversalS/coop-code-learning | views/PythonExtractor/source/srcseq/generate_data.py | generate_data.py | py | 2,978 | python | en | code | 0 | github-code | 6 |
22293771882 | #!/usr/bin/python3
"""This module contains decorator functions for the views. These includes:
- token_required
"""
import jwt
from functools import wraps
from flask import request, make_response
from os import environ
from flask import jsonify
SECRET_KEY = environ.get('SECRET_KEY')
def token_required(f):
"""Chec... | Sonlowami/CaseShare | src/api/v1/views/decorators.py | decorators.py | py | 1,141 | python | en | code | 0 | github-code | 6 |
4971500738 | import socket
import threading
import datetime
def acao_cliente(client_socket, client_address):
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"Conexão recebida de {client_address[0]}:{client_address[1]} em {current_time}")
with open("honeypot_log.txt", "a") as log_f... | T0tsuK4/honeypot | honeypot.py | honeypot.py | py | 1,673 | python | en | code | 2 | github-code | 6 |
74766917948 | #-------------------------------------------------------------------------------
# Recipes tests
#-------------------------------------------------------------------------------
import io
import os
import pytest
from pathlib import Path
from cookbook.db import get_db
# Data generators for testing.
#----------------... | cmvanb/cookbook | tests/test_recipes.py | test_recipes.py | py | 8,458 | python | en | code | 0 | github-code | 6 |
33207147676 | from fastapi import HTTPException, status
from db.models import DbLeague
from routers.schemas import LeagueBase
from routers.slug import name_to_slug
from sqlalchemy.orm import Session
def add_team(db: Session, request: LeagueBase):
league = DbLeague(
name=request.name,
country=request.country,
... | rbujny/League-Team-Players | db/db_league.py | db_league.py | py | 816 | python | en | code | 0 | github-code | 6 |
27388540421 | from discord.ext import commands
import biscuitfunctions as bf
async def fixprivs(context):
return bf.getprivs(context) in ['quaid', 'quaidling', 'tesseract']
class admin(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(
name='getid',
pass_context = T... | delta1713/ButteryBiscuitBot | admin.py | admin.py | py | 2,262 | python | en | code | 0 | github-code | 6 |
73348441787 | from datetime import datetime
import math
from abc import abstractmethod
from typing import List, Tuple
from anteater.core.anomaly import Anomaly, RootCause
from anteater.core.kpi import KPI, Feature, JobConfig
from anteater.core.ts import TimeSeries
from anteater.model.algorithms.spectral_residual import SpectralResi... | openeuler-mirror/gala-anteater | anteater/model/detector/base.py | base.py | py | 5,619 | python | en | code | 1 | github-code | 6 |
13284456276 | from django.conf.urls import patterns, include, url
from django.conf import settings
from django.views.generic import TemplateView
from frontend import views
from frontend import facebook
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^settings/', views.settings, name='settings'),
... | jjchen/cos333 | frontend/urls.py | urls.py | py | 2,723 | python | en | code | 1 | github-code | 6 |
40732481853 | import sys
num = int(input())
dic = {}
for i in range(num):
dic[i+1] = set()
m = int(input())
for i in range(m):
a,b = map(int, sys.stdin.readline().split())
dic[a].add(b)
dic[b].add(a)
visited = list()
def dfs(i,dic):
for j in dic[i]:
if j not in visited:
visited.append(j... | seriokim/Coding-Study | 백준 단계별로 풀어보기/silver3/2606.py | 2606.py | py | 378 | python | en | code | 0 | github-code | 6 |
23182012572 | riddles = {"What language do we learn?": "python",
"Which version of python we learn?": "3.6",
"An element, feature, "
" or factor that is liable to vary or change.": "variable",
"Which loop should we use"
" with evaluation after iteration?": "do-while",
... | vkhalaim/pythonLearning | tceh/lection1/riddles.py | riddles.py | py | 682 | python | en | code | 0 | github-code | 6 |
31316548360 | from pycif.utils.path import init_dir
import os
from shutil import copytree, ignore_patterns, rmtree, copy
def ini_mapper(model, transform_type, inputs={}, outputs={}, backup_comps={}):
default_dict = {'input_dates': model.input_dates, 'force_read': True,
'force_dump': True}
dict_surface ... | san57/python | CIF/build/lib/pycif/plugins/models/flexpart/ini_mapper.py | ini_mapper.py | py | 619 | python | en | code | 0 | github-code | 6 |
3504439372 | #!/usr/bin/python3
""" This is the module for a function that divides every
element of matrix by div
"""
def matrix_divided(matrix, div):
"""this function divides every element in a matrix by nubmer div
Args:
matrix (list): list of list of int/float
div (int): nubmer to use as divisor
... | MATRIX30/alx-higher_level_programming | 0x07-python-test_driven_development/2-matrix_divided.py | 2-matrix_divided.py | py | 1,212 | python | en | code | 0 | github-code | 6 |
41474623270 | from __future__ import division # Why is this not standard.
import datetime
import re
class Tribunal(object):
"""System for keeping players in check"""
def __init__(self, config, callback_message_func):
super(Tribunal, self).__init__()
# We need someway of keeping track if someone is being ... | psykzz/ircmod_gradiusbot | mod_tribunal.py | mod_tribunal.py | py | 5,908 | python | en | code | 0 | github-code | 6 |
4956366915 | from django.db import models
from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
# Create your models here.
class Pricebaba(models.Model):
first_name = models.CharField(max_length=100, null=False);
last_name = models.CharField(max_length=100, null=False... | nidhisha-shetty/Human-Resource-CRM-System | pricebabaapp/models.py | models.py | py | 768 | python | en | code | 1 | github-code | 6 |
3035674585 | # merge two sorted linked lists by splicing them together into
# a linked list that is itself sorted
import sys
#example input:
#List 1: 1 -> 2 -> 4
#List 2: 1 -> 3 -> 4
#output: 1 -> 1 -> 2 -> 3 -> 4 -> 4
from linked_list import list_head,node
list_1 = list_head()
list_2 = list_head()
list_1.append_head(4)
list_1.ap... | estimatrixPipiatrix/decision-scientist | key_algos/merge_sorted.py | merge_sorted.py | py | 1,231 | python | en | code | 0 | github-code | 6 |
30301215925 | ########## Use:
########## Last Modified:
########## Author: Yamaga
##### dependencies
from __future__ import print_function, division
import os, sys
from astropy.io import fits
import numpy as np
import astropy.io.fits
from astropy.nddata import Cutout2D
from astropy import units as u
import shutil
import optparse
imp... | Sound-110316/Personal_repository | pix_awase.py | pix_awase.py | py | 4,121 | python | en | code | 0 | github-code | 6 |
27741430831 | import os
import fileinput
import logging
import argparse
import shutil
import re
from sys import platform
import socket
# import reggie source code
# use reggie2.0 functions by adding the path
import settings
settings.init() # Call only once
import sys
sys.path.append(settings.absolute_reggie_path)
reggie_exe_path = ... | piclas-framework/reggie2.0 | repas/repas.py | repas.py | py | 9,185 | python | en | code | 2 | github-code | 6 |
8353691653 | # flake8: noqa
from __future__ import absolute_import, unicode_literals
import json
import os
import pytest
from c8.collection import StandardCollection
from c8.exceptions import (
CollectionCreateError,
CollectionDeleteError,
CollectionFindError,
CollectionImportFromFileError,
CollectionListErro... | Macrometacorp/pyC8 | tests/test_collection.py | test_collection.py | py | 8,364 | python | en | code | 6 | github-code | 6 |
75204307388 | import mysql.connector
#to check whether its connected
mydb=mysql.connector.connect(host='localhost',user='root',password='isgsql')
if mydb.is_connected()==False:
print('not connected')
raise SystemExit
#creating a cursor object
mycursor=mydb.cursor()
#using/creating database
try:
mycursor.exe... | CS-ION/Class-12-Practicals | Practicals/16.py | 16.py | py | 3,460 | python | en | code | 0 | github-code | 6 |
7970861568 | import os
from charms.reactive import is_state, when_all, when, when_not, set_flag, when_none, when_any, hook, clear_flag
from charmhelpers.core import templating, host, unitdata
from charmhelpers.core.hookenv import ( open_port,
status_set,
... | erik78se/layer-nextcloud | src/reactive/nextcloud.py | nextcloud.py | py | 6,879 | python | en | code | 2 | github-code | 6 |
44083675715 | from typing import Iterable
from scapy.all import *
from scapy.layers.inet import IP
def ip_from_packets(packets: Iterable) -> str:
"""
Get the IP of the machine where the packets are recorded
It is the IP which is present in all packets
:param packets:list of packets
:return: ip address
"""
IPs = {}
for pac... | llmhyy/malware-traffic | Experiments/exp16_visualisation/ip_from_pcap.py | ip_from_pcap.py | py | 925 | python | en | code | 7 | github-code | 6 |
70746450108 | # -*- coding: utf-8 -*-
"""
Created on Mon May 16 14:19:49 2016
@author: hossam
"""
import random
import numpy
import math
from solution import solution
import time
def WOA(objf, lb, ub, dim, SearchAgents_no, Max_iter):
# dim=30
# SearchAgents_no=50
# lb=-100
# ub=100
# Max_iter=500
if not i... | 7ossam81/EvoloPy | optimizers/WOA.py | WOA.py | py | 4,155 | python | en | code | 393 | github-code | 6 |
11260306476 | def compute_grade(score):
if score > 1 or score < 0:
print("Input out of range.")
quit()
elif score >= 0.9:
grade = 'A'
elif score >= 0.8:
grade = 'B'
elif score >= 0.7:
grade = 'C'
elif score >= 0.6:
grade = 'D'
else:
grade = 'F'
retur... | authura/python_practice | score_to_grade.py | score_to_grade.py | py | 501 | python | en | code | 0 | github-code | 6 |
18722283162 | import numpy as np
import matplotlib.pyplot as plt
X = np.array([[2.5, 3.0, 3.0, 3.5, 5.5, 6.0, 6.0, 6.5],
[3.5, 3.0, 4.0, 3.5, 5.5, 6.0, 5.0, 5.5]])
num_rows, N = X.shape
c = 2
# c = 3
# c = 4
V = np.zeros((num_rows, c))
U = np.zeros((c, N))
row_iteration = 0
for i in range(N):
U[row_iteration, i] ... | vvsct/c-means | hcm.py | hcm.py | py | 1,215 | python | en | code | 0 | github-code | 6 |
13526459322 | # YOUR NAME:
# YOUR PSU EMAIL ADDRESS:
# END OF COMMENTS
# ------------------------------------------------------
# PLACE ANY NEEDED IMPORT STATEMENTS HERE:
# END OF IMPORT STATEMENTS
# =====================================================
# DEFINE YOUR FUNCTIONS IN THIS SECTION
# --------------------------------------... | SidPatra/ProgrammingPractice | Practicing-Coding/shaffertictactoe.py | shaffertictactoe.py | py | 2,546 | python | en | code | 0 | github-code | 6 |
30195630744 | import unittest
from ops.testing import Harness
from charm import CandidCharm
class TestCharm(unittest.TestCase):
def setUp(self):
self.harness = Harness(CandidCharm)
self.addCleanup(self.harness.cleanup)
self.harness.begin()
def test_website_relation_joined(self):
id = self... | canonical/candid | charms/candid/tests/unit/test_charm.py | test_charm.py | py | 577 | python | en | code | 41 | github-code | 6 |
2734112142 | import re
# content = "as busy as a bee"
# r = re.compile(r'as')
# starts from the beginning of the content
# print(r.match(content))
# search anywhere in the content, find the first one
# print(r.search(content))
# returns all of the string content matches without span data
# print(r.findall(content))
# returns ... | t4d-classes/python_10042021 | python_demos/src/language_demos/reg_exp_demo.py | reg_exp_demo.py | py | 1,390 | python | en | code | 0 | github-code | 6 |
36156660043 | import numpy as np
N=9
Adjacence=np.zeros(N)
label = [0]*N # étiquette si le sommet a été parcouru
chemin = [[i] for i in range(N)] # enregistrer le sommet prochain de chaque sommet
chemin_hamiltonien = [0]*N # enregistrer le résultat: un chemin hamiltonien
def init_chemin(): # initialisation du chemin
for i ... | CSolatges/La-tournee-du-facteur | Python/HamiltonienC.py | HamiltonienC.py | py | 1,963 | python | fr | code | 0 | github-code | 6 |
23361556734 | import datetime
from polls.models import LogModel
class LogMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
if request.path.find('admin') != -1:
return response
path =... | konstantinkonstantinovich/home_task_6 | polls/middleware.py | middleware.py | py | 549 | python | en | code | 0 | github-code | 6 |
23158641917 | import requests
import json
def get_weather(api_key, city):
url = f"http://api.weatherapi.com/v1/current.json?key={api_key}&q={city}"
response = requests.get(url)
data = json.loads(response.text)
if "error" in data:
print("Failed to fetch weather data.")
else:
temperature = data["c... | Mutukukioko/WeatherApp | main.py | main.py | py | 703 | python | en | code | 0 | github-code | 6 |
12095699545 | from argparse import ArgumentParser
import json
from tqdm import tqdm
import os, sys
import logging
import re
import gc
import torch
from torch.utils.data import DataLoader
from torch.optim import Adam
from bert_diora.models import BertDiora
from bert_diora.utils import TokenizedLengthSampler
def main(args):
# S... | jinulee-v/bert_diora | train.py | train.py | py | 10,660 | python | en | code | 0 | github-code | 6 |
70725047228 | # Databricks notebook source
# MAGIC %md
# MAGIC ### Working on qualifying json files
# COMMAND ----------
from delta.tables import *
# COMMAND ----------
# DBTITLE 1,Run the configuration notebook
# MAGIC %run "../0 - includes/configuration"
# COMMAND ----------
# DBTITLE 1,Run the functions notebook
# MAGIC %r... | diassmith/formula1-project | 03 - bronze - to - silver/qualifying.py | qualifying.py | py | 1,865 | python | en | code | 1 | github-code | 6 |
1584228601 | from django.conf import settings
from cms.models import Title
from minitrue.base import replacer
from minitrue.contrib.django_cms.utils import plugin_get_url
def title_get_url(obj):
return obj.page.get_absolute_url()
replacer.register(Title, fields=['title', 'page_title', 'menu_title', 'redirect', 'meta_descrip... | beniwohli/django-minitrue | minitrue/contrib/django_cms/searchreplace.py | searchreplace.py | py | 2,169 | python | en | code | 4 | github-code | 6 |
21393856702 | import unittest
import sys
# Import the functions to be tested
from floyd_rec import floyd_recursive
from floyd import floyd
class TestFloydAlgorithm(unittest.TestCase):
def setUp(self):
# Initialize test data
self.NO_PATH = sys.maxsize
self.graph = [
[0, 7, self.... | ckcelliot/Floyd-Warshall-Algorithm-Task | testing.py | testing.py | py | 1,792 | python | en | code | 0 | github-code | 6 |
33040214351 | n,m = map(int, input().split())
arr = list (map(int, input().split()))
bound_M = max(arr)
bound_m = min(arr)
flag = result = middle = 0
while 1:
if flag and middle == result: break
sum = 0
for a in arr:
sum += a - middle if a - middle > 0 else 0
bound_m = middle
if sum >= m:
flag = 1
result... | ParanMoA/SelfSoftware | JeongTIL/2023-01-19/boj/boj_2805.py | boj_2805.py | py | 440 | python | en | code | 0 | github-code | 6 |
36257621125 | import sys
sys.setrecursionlimit(10**6)
def dfs(x, y, k, graph_copy):
if x < 0 or x >= n or y < 0 or y >= n:
return False
if graph_copy[x][y] <= k:
return False
graph_copy[x][y] = 0
dfs(x-1, y, k, graph_copy)
dfs(x+1, y, k, graph_copy)
dfs(x, y-1, k, graph_copy)
dfs(x, y+1, ... | hon99oo/PythonAlgorithmStudy | BOJ/DFS_BFS/2468_안전 영역/solution.py | solution.py | py | 905 | python | en | code | 0 | github-code | 6 |
28048440530 | class Cliente:
def __init__(self, nome, senha):
self.nome = nome
self.senha = senha
self.bloqueado = False
self.tentativas = 0
keys = dict()
clientes = dict()
for i in range(12):
numero, *letras = input().split(";")
for letra in letras:
keys[letra] = numero... | pufe/programa | 2020-11-09/banco.py | banco.py | py | 1,264 | python | pt | code | 2 | github-code | 6 |
37441140473 | from beat_tracker import *
file_list="./BallroomData/allBallroomFiles"
def go():
f = open(file_list, 'r')
lines = f.readlines()
for line in lines:
fline=line.strip("./").strip("\n")
beats = beatTracker("./BallroomData/"+fline)
outf=fline.replace(".wav", ".estimate")
f = op... | bineferg/MIR-BeatTracker-DP | run-all.py | run-all.py | py | 433 | python | en | code | 0 | github-code | 6 |
10812133722 | import sys, time
indent = 1
indentationRise = True
while(True):
try:
if(indentationRise):
time.sleep(0.01)
print(' '*indent + "********")
indent += 1
if(indent>=60):
indentationRise=False
elif(indentationRise==False):
time... | trytek235/Python_programs | makeMy.py | makeMy.py | py | 517 | python | en | code | 0 | github-code | 6 |
43391129954 | # 搜索网易云上评论超过几万来着
from selenium import webdriver
class Spider:
page = webdriver.Chrome()
list_ge = []
count = 0
list_url = []
# first_url = "https://music.163.com/#/song?id=31654747"
# list_url.append(first_url)
# print(list_url)
# 获取歌的地址
def get_url(self, url= "https://music.163.co... | frebudd/python | wangyiyu_pinglun.py | wangyiyu_pinglun.py | py | 1,676 | python | en | code | 2 | github-code | 6 |
24981348258 | """
Overall configration file, used by the detector_launcher.py and zmqproxy.py
"""
options = dict()
# data configration data_save_dir is dir where the logs will be stored if io mode is True
options["data_save_dir"] = "/home/ubuntu/aminer-deep/data/"
# the file will be used for tranning
options['data_file_name'] = "Ex... | ait-aecid/aminer-deep | config.py | config.py | py | 1,347 | python | en | code | 0 | github-code | 6 |
10442912320 | import requests
from bs4 import BeautifulSoup
import html5lib
"""THE BELOW REQUEST CAN BE MODIFIED TO GET MORE DATA BY CHANGING THE /page/1 to any page no"""
r=requests.get('https://cutoffs.aglasem.com/page/1')
s=BeautifulSoup(r.content,'html5lib')
jc=s.find(class_="jeg_posts jeg_load_more_flag")
for i in range(0,len... | fredysomy/web-scrape-data | college-cuttofs-updates.py | college-cuttofs-updates.py | py | 522 | python | en | code | 2 | github-code | 6 |
39961449850 | #!/usr/bin/env python
# -- coding: utf-8 --
import numpy
from tf import transformations, TransformListener
import rospy
import geometry_msgs
import math
class TransformerTool:
def __init__(self, target_frame=None, source_frame=None):
self.target_frame = target_frame
self.source_frame = source_fra... | 6VV/vr-robot-back | robot/robot_control/TransformerTool.py | TransformerTool.py | py | 5,042 | python | en | code | 1 | github-code | 6 |
42510539573 | import os
from cffi import FFI
from OpenSSL.SSL import Context as SSLContext, _ffi, _lib as lib
from utils import OutputGrabber
ffi = FFI()
NULL = ffi.NULL
ffi.cdef(
"int SSL_CTX_set_client_cert_engine(void *ctx, void *e);"
"int ENGINE_set_default(void *e, unsigned int flags);"
)
libcrypto = ffi.dlopen("libcr... | jose-pr/openssl-engines | src/openssl_engines.py | openssl_engines.py | py | 4,561 | python | en | code | 0 | github-code | 6 |
28806078956 | from typing import Dict
from typing import Iterator
from typing import List
from jira.resources import Board
from ..exceptions import QueryError
from ..plugin import BaseSource
from ..types import SchemaRow
class Source(BaseSource):
SCHEMA: List[SchemaRow] = [
SchemaRow.parse_obj({"id": "id", "type": "i... | coddingtonbear/jira-select | jira_select/sources/boards.py | boards.py | py | 2,300 | python | en | code | 22 | github-code | 6 |
39542654444 | import requests
import json
import csv
headers = {
'Authorization': '',
'API-Key': '',
'Accept': 'application/json',
}
p = {
'severities': ''
}
response = requests.get('https://apptwo.contrastsecurity.com/Contrast/api/ng/ORGID/traces/APPID/filter', params=p,headers=headers)
app = requests.get('https:... | abridgel-zz/scripts | lab3.py | lab3.py | py | 976 | python | en | code | 0 | github-code | 6 |
9379983030 | # 2022.06.06
# 풀이 시간 21분 32초
# 채점 결과: 시간 초과 -> 정답
# 시간복잡도: O(N)
# 문제 링크: https://www.acmicpc.net/problem/4358
import sys
input = sys.stdin.readline
forest = {}
result = 0
while True:
tree = input().rstrip()
if not tree:
break
result += 1
if tree in forest.keys():
forest[tree] += 1
... | Source-Machine-Ent/Algorithm-class | ningpop/4358.py | 4358.py | py | 535 | python | en | code | 2 | github-code | 6 |
79843457 | import numpy as np
from scipy.linalg import lstsq
from optimal_control.basis import Basis
from optimal_control.examples.discrete import StoppingExample
from optimal_control.solvers.discrete import DiscreteValueFunction
class ModifiedForStopping(DiscreteValueFunction):
def __init__(self, example: StoppingExample... | hagerpa/reinforced_optimal_control | optimal_control/solvers/discrete/value_function/modified_for_stopping.py | modified_for_stopping.py | py | 4,639 | python | en | code | 0 | github-code | 6 |
9379888880 | # 2022.05.12
# 풀이 시간 98분 47초
# 채점 결과: 오답 -> 시간초과 -> 런타임 에러 -> 정답
# 시간복잡도: O(N*M)
# 문제 링크: https://www.acmicpc.net/problem/1103
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
def dfs(x: int, y: int, count: int) -> int:
global is_visited, max_count
max_count = max(max_count, count)
fo... | Source-Machine-Ent/Algorithm-class | ningpop/1103.py | 1103.py | py | 1,190 | python | en | code | 2 | github-code | 6 |
39574197449 | #coding:utf8
#字典
#作用:存多个值,key-value存取,取值速度快
#定义:key必须是不可变类型,value可以是任意类型
#1 有如下值集合 [11,22,33,44,55,66,77,88,99,90...],将所有大于 66 的值保存至字典的第一个key中,将小于 66 的值保存至第二个key的值中
#即: {'k1': 大于66的所有值, 'k2': 小于66的所有值}
# a = {'k1':[],'k2':[]}
# c = [11,22,33,44,55,66,77,88,99]
#
# for i in c:
# if i >66:
# a['k1'].appen... | xueyes/py3_study | zidian_key.py | zidian_key.py | py | 1,629 | python | zh | code | 1 | github-code | 6 |
34197097202 | import numpy as np
import threading
import time
from datetime import datetime
import jderobot
import math
import cv2
from math import pi as pi
time_cycle = 80
class MyAlgorithm(threading.Thread):
def __init__(self, pose3d, laser1, laser2, laser3, motors):
self.pose3d = pose3d
self.laser1 = laser... | RoboticsLabURJC/2016-tfg-irene-lope | AutoPark_Practice/MyAlgorithm.py | MyAlgorithm.py | py | 6,482 | python | en | code | 1 | github-code | 6 |
21986767676 | """
Fixer for bytes -> str.
"""
import re
from crosswind import fixer_base
from crosswind.fixer_util_3to2 import Call, Comma, Name, parse_args, syms, token
from crosswind.patcomp import compile_pattern
_literal_re = re.compile(r"[bB][rR]?[\'\"]")
class FixBytes(fixer_base.BaseFix):
order = "pre"
PATTERN... | ryanwersal/crosswind | fixer_suites/three_to_two/fixes/fix_bytes.py | fix_bytes.py | py | 1,410 | python | en | code | 11 | github-code | 6 |
7194454936 | # THINGS TO DO
# Isolates + Member + Star < Bridge < Organizer
import networkx as nx
from community import community_louvain
import pandas as pd
import operator
# ORGANIZER/LIAISON/BROKER
G = nx.read_weighted_edgelist('Only_50_Employees1.csv', delimiter=',', create_using = nx.DiGraph(), nodetype=str)
page_score = di... | AnnaMudano/Msc-Students | Unofficial_Roles_Script.py | Unofficial_Roles_Script.py | py | 3,132 | python | en | code | 0 | github-code | 6 |
6518783432 | #!/usr/bin/env python
import datetime
from elasticsearch import Elasticsearch
from jobs.lib import Configuration
from jobs.lib import Send_Alert
local_config = {
"minutes": 5,
"index": "servers-*",
"max_results": 1000,
"severity": "low"
}
# Query goes here
search_query = {
"query": {
"b... | 0xbcf/elasticsearch_siem | jobs/LockedADAccount.py | LockedADAccount.py | py | 1,430 | python | en | code | 0 | github-code | 6 |
70211332028 | from valohai import Pipeline
def main(config) -> Pipeline:
#Create a pipeline called "mypipeline".
pipe = Pipeline(name="sharkpipe", config=config)
# Define the pipeline nodes.
fetch = pipe.execution("fetch_data")
process = pipe.execution("pre_process")
pepare_text = pipe.execution("pepare_te... | eikku/shark-attacks | create_pipeline.py | create_pipeline.py | py | 824 | python | en | code | 2 | github-code | 6 |
29771468848 | print("Python Program to Find Numbers Divisible by Another Number")
try:
num=int(input("Enter the number :"))
div=[]
if num>0:
for i in range(1,101): #other number till 1-100
if num % i==0 and i!=num:
div.append(i)
print(f"list of Divisors of number :{num} is :{div} ")
... | engineerscodes/PyVisionHUB | PyStuff/01.Basic/Lab/divnum.py | divnum.py | py | 356 | python | en | code | 4 | github-code | 6 |
2245791102 | while True:
multiply = 1
list1 = []
number = int(input(print("Please enter a number for the factorial.")))
while (number != 0):
list1.append(number)
multiply = multiply * number
number = number - 1
print(list1)
print(multiply)
| alpayalyn/Factorial_Calculation | main.py | main.py | py | 284 | python | en | code | 0 | github-code | 6 |
43626835774 | class Solution(object):
def threeEqualParts(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
IMP = [-1, -1]
s = sum(A)
if s%3: return IMP
t = s // 3
if t == 0:
return [0, len(A)-1]
breaks = []
su = 0
... | MichaelTQ/LeetcodePythonProject | solutions/leetcode_0901_0950/LeetCode0927_ThreeEqualParts.py | LeetCode0927_ThreeEqualParts.py | py | 1,187 | python | en | code | 0 | github-code | 6 |
73928148349 | import random
import string
import factory
from django.contrib.auth import get_user_model
from reviews.models import Doctor, Review, Specialty
User = get_user_model()
def random_string(length=10):
return u"".join(random.choice(string.ascii_letters) for x in range(length))
class DoctorFactory(factory.django.D... | idesu/review_moderation_lite | reviews/tests/factories.py | factories.py | py | 1,158 | python | en | code | 0 | github-code | 6 |
32731754668 | from collections import deque
n, m, v = map(int, input().split())
lst = [[] for _ in range(n+1)]
visit_d = [0] * (n+1)
bfs_q = []
for i in range(m):
a, b = map(int, input().split())
lst[a].append(b)
lst[b].append(a)
# 각 요소들 정렬
for i in range(1, n+1):
lst[i].sort()
def dfs(start):
visit_d... | woo222/baekjoon | python/그래프/s2_1260_DFS와 BFS.py | s2_1260_DFS와 BFS.py | py | 773 | python | en | code | 0 | github-code | 6 |
21951283838 | #Спортсмен-лыжник начал тренировки, пробежав в первый день 10 км. Каждый следующий день он увеличивал длину пробега
# на P процентов от пробега предыдущего дня (P — вещественное, 0< P <50).
# По данному P определить, после какого дня суммарный пробег лыжника за все дни превысит 200 км, и вывести найденное
# количество ... | DaNil4594/EremenkoPythonProject | PZ_4/PZ_4_2.py | PZ_4_2.py | py | 1,502 | python | ru | code | 0 | github-code | 6 |
27259248370 | """We are the captains of our ships, and we stay 'till the end. We see our stories through.
"""
"""70. Climbing Stairs [Constant Space]
"""
class Solution:
def climbStairs(self, n):
if n <= 2:
return n
first, second = 1, 2
num_ways = 0
for _ in range(3, n+1):
... | asperaa/back_to_grind | DP/70. Climbing Stairs_constant_space.py | 70. Climbing Stairs_constant_space.py | py | 430 | python | en | code | 1 | github-code | 6 |
21764409471 | from unittest import TestCase
def reverseInt(i: int) -> int:
result = 0
while i:
result = result * 10 + i % 10
i = int(i/10)
print(result)
class Test(TestCase):
def test_reverse_int(self):
answer = reverseInt(354)
| debajyoti3061/crackingg_python | array/ReverseInteger.py | ReverseInteger.py | py | 258 | python | en | code | 0 | github-code | 6 |
17591799943 | import requests
headers = {
'Host': 'bagel.htb:8000',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'close',
'Upgrad... | 0xRoqeeb/scripts | ProcScanner/proscanner.py | proscanner.py | py | 984 | python | en | code | 0 | github-code | 6 |
30935953705 | import math
a= input("请输入:")
b=a.split(",")
s=0
list1=[]
for i in b:
if len(i)!=4:
break;
else:
h=list(i)
for c in h:
t=h.index(c)
s+=int(c)*math.pow(2,3-t)
print(s)
list1.append(s)
print(list1)
# for d in list1:
# if d%5==0:
# print(b[... | wuyijian123456/test1 | venv/case/demo10.py | demo10.py | py | 384 | python | en | code | 0 | github-code | 6 |
34318970452 | import re
import hashlib
dd_file = 'Project2.dd'
with open(dd_file, "rb") as f:
content = f.read()
f.close()
#signatures
JPEG_SOF = b'\xFF\xD8\xFF\xE0' #or b'\xFF\xD8\xFF\xDB'
JPEG_SOF2 = b'\xFF\xD8\xFF\xDB'
JPEG_EOF = b'\xFF\xD9\x00\x00\x00'
#creating a list of matches for Start of file signature so furthe... | jasonralexander/Comp6970DFIR | JPG.py | JPG.py | py | 2,069 | python | en | code | 0 | github-code | 6 |
73415902268 | """
Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
"""
def uniqueString(aStr):
""" an elegant pythonic solution"""
aStr = sorted(aStr)
for i in aStr:
if aStr.count(i) > 1:
return False
else:
continue
return True
aStr = "abcde... | AndreiBratkovski/Training | CCC-school-work/Arrays and Strings/UniqueString.py | UniqueString.py | py | 362 | python | en | code | 1 | github-code | 6 |
34729450959 | # -*- coding: utf-8 -*-
# © 2020 FreeDoo: Juan Ignacio Úbeda <juani@freedoo.es>
# © 2020 Avanzosc: Ana Juaristi <ana@avanzosc.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, api
import datetime
class ResCity(models.Model):
_inherit = 'res.city'
partner_zo... | JuaniFreedoo/BaserrikoPlaza | geonames_delivery_zone_link/models/delivery_carrier.py | delivery_carrier.py | py | 810 | python | en | code | 0 | github-code | 6 |
9054587294 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 28 16:52:49 2021
@author: shabalin
Utils to work with fable and hexrd functions.
"""
import sys, os
import numpy as np
import yaml, subprocess
#import cbftiffmxrdfix
def run_peaksearch(par_file=None):
""" Wrapper for the ImageD11 peaksearch.py script""" ... | agshabalin/py3DXRD | .ipynb_checkpoints/fable_hexrd_utils-checkpoint.py | fable_hexrd_utils-checkpoint.py | py | 7,948 | python | en | code | 0 | github-code | 6 |
10282905855 | import os
from flask import Flask
from flask_modals import Modal
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy, Pagination
from importlib import import_module
from apps.utils.stocks_properties import read_properties_file
db = SQLAlchemy()
login_manager = LoginManager()
print('El path d... | qa8990/reports | apps/__init__.py | __init__.py | py | 1,875 | python | en | code | 0 | github-code | 6 |
70452843067 | # Programming 102 Lab 2
# * 2.1 Write sum() from scratch
def sum(numbers):
total = 0
for number in numbers:
if len(numbers) > 0:
total += number
return total
# * 2.2 Use a REPL to build a list of numbers
def collector():
import string
print('Please enter the number to be added:... | austenc-id/Guild | 0 - Prep Course/week-2/lab_number_lists.py | lab_number_lists.py | py | 1,263 | python | en | code | 0 | github-code | 6 |
73554109308 | # Divisor takes in a number and returns all the divisors of that number
# ie div(13) == [1, 13]
# div(4) == [1, 2, 4]
def div(num):
divList = []
for i in range(1, int(num / 2) + 1):
if num % i == 0:
divList.append(i)
divList.append(num)
return divList
num = int(input("Choose ... | LeoTheMighty/beginner_python_exercises | Divisor.py | Divisor.py | py | 369 | python | en | code | 0 | github-code | 6 |
17609317181 | # encoding: utf-8
import os
import binascii
from collections import OrderedDict
import cachemodel
from basic_models.models import CreatedUpdatedAt
from django.urls import reverse
from django.db import models, transaction
from django.db.models import Q
from entity.models import BaseVersionedEntity
from issuer.models ... | reedu-reengineering-education/badgr-server | apps/backpack/models.py | models.py | py | 8,542 | python | en | code | 2 | github-code | 6 |
6415578892 | #Задача 15
quantWatermelon = int(input("Введите количество арбузов : "))
minWater = maxWater = int(input(f"Введите ввес арбуза : "))
for i in range(1, quantWatermelon):
temp = int(input(f"Введите ввес арбуза : "))
if(temp > maxWater):
maxWater = temp
elif (temp < minWater):
minWater = tem... | ApostaLOxsar/Pyton | Les2/Task15.py | Task15.py | py | 460 | python | ru | code | 0 | github-code | 6 |
70075741628 | # -*- encoding:utf-8 -*-
'''
@time: 2019/12/21 8:28 下午
@author: huguimin
@email: 718400742@qq.com
一个doc表示一个样本
'''
import math
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from layers.dynamic_rnn import DynamicLSTM
from layers.attention import Attention
class GraphConvolution(n... | LeMei/FSS-GCN | models/word2vec/ecgcn.py | ecgcn.py | py | 9,816 | python | en | code | 14 | github-code | 6 |
8670813064 | import pathlib
def get_desanitizer(celltypes_dir):
cell_type_list = read_all_manifests(celltypes_dir)
return desanitizer_from_meta_manifest(cell_type_list)
def desanitizer_from_meta_manifest(cell_type_list):
"""
cell_type_list is the result of reading list_of_manifests
"""
desanitizer = dic... | AllenInstitute/neuroglancer_formatting_scripts | src/neuroglancer_interface/utils/celltypes_utils.py | celltypes_utils.py | py | 6,758 | python | en | code | 2 | github-code | 6 |
23811859933 | from typing import List, Tuple
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
from torchvision import datasets, models, transforms
import time
import copy
from PIL import Image
from grid import SQUARES
class GeoModel:
"""Encapsulates the creation, training, ... | yawnston/geo-guessing | model.py | model.py | py | 8,132 | python | en | code | 0 | github-code | 6 |
15565374410 | from pathlib import Path
WHERE_CLAUSE = "where"
# DATABASE Connection constants
DB_USERNAME = "project1user"
DB_PASSWORD = "project1pass"
DEFAULT_DB = "project1db"
VERBOSITY_DEFAULT = 2
MACHINE = "lab-machine"
# Benchmark constants
EPINIONS = "epinions"
INDEXJUNGLE = "indexjungle"
TIMESERIES = "timeseries"
BENCH... | karthik-ramanathan-3006/15-799-Special-Topics-in-Database-Systems | constants.py | constants.py | py | 800 | python | en | code | 0 | github-code | 6 |
71584682748 | from bs4 import BeautifulSoup
import requests
class DHMenuScraper:
menuLink = "https://nutrition.sa.ucsc.edu/menuSamp.asp?"
dHallCodes = {
"nineten" : "locationNum=40&locationName=Colleges+Nine+%26+Ten+Dining+Hall",
"cowellstevenson" : "locationNum=05&locationName=Cowell+Stevenson+Dining+Hall"... | kschniedergers/DHBot | DHMenuScraper.py | DHMenuScraper.py | py | 1,281 | python | en | code | 0 | github-code | 6 |
29564758485 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import random
from model.leverage_bracket import leverage_bracket
from model.symbol import symbol as s
from operation.contract.client.leverage_bracket.query_leverage_bracket_list import query_leverage_bracket_list
from test_cases.contract.client.conftest import *
from common... | shiqilouyang/thanos_test | test_cases/contract/client/leverage_bracket/test_query_everage_bracket_list.py | test_query_everage_bracket_list.py | py | 3,595 | python | en | code | 0 | github-code | 6 |
23182257426 | import pytest
import json
import ipaddress
from tests.common.utilities import wait_until
from tests.common import config_reload
import ptf.testutils as testutils
import ptf.mask as mask
import ptf.packet as packet
import time
pytestmark = [
pytest.mark.topology('t0'),
pytest.mark.device_type('vs')
]
def add_i... | SijiJ/sonic-mgmt | tests/route/test_static_route.py | test_static_route.py | py | 6,020 | python | en | code | null | github-code | 6 |
10251123501 | class Solution:
def romanToInt(self, s: str) -> int:
# hm to match symbol to val
# tc: O(n)
# sc: O(1), hm of constant space
# summary
# largest to smallest: add them up
# smaller before larger: subtract smaller
roman = {"I": 1, "V": 5,"X": 1... | stevenwcliu/leetcode_footprints | 13-roman-to-integer/13-roman-to-integer.py | 13-roman-to-integer.py | py | 762 | python | en | code | 0 | github-code | 6 |
32171234106 | import json
from django.views.generic import ListView
from django.conf import settings
from django.shortcuts import render
from django.urls import reverse_lazy
from django.contrib.sites.models import Site
import requests
from cart.cart import Cart
from django.views.generic import CreateView
from django.views import Vie... | Alisjj/Shop-From-Home | orders/views.py | views.py | py | 2,802 | python | en | code | 0 | github-code | 6 |
31954675537 | """
The color scheme.
"""
from __future__ import unicode_literals
from prompt_toolkit.styles import PygmentsStyle, Style, Attrs
from pygments.token import Token
__all__ = (
'PymuxStyle',
)
ui_style = {
Token.Line: '#888888',
Token.Line.Focussed: '#448844',
Toke... | jonathanslenders/pymux-test | pymux/style.py | style.py | py | 3,589 | python | en | code | 3 | github-code | 6 |
29445747576 | #implementation of lcs for given sequence of elements
#takes two sequence as input
#return array and its length
def length_lcs(x, y, m, n):
arr = [[0 for x in range(n + 1)] for x in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
arr[i][j] = ... | ssigdel/Data-Structure-and-Algorithm | LCS/lcs.py | lcs.py | py | 991 | python | en | code | 0 | github-code | 6 |
15211959630 | """
CNN Classification of SDSS galaxy images
----------------------------------------
Figure 9.20
The accuracy of a multi-layer Convolutional Neural Network
applied to a set of morphologically classified galaxy images taken
from the SDSS. The configuration of the network is described in
Section 9.8.4. The left panel s... | astroML/astroML_figures | book_figures/chapter9/fig_morph_nn.py | fig_morph_nn.py | py | 10,396 | python | en | code | 7 | github-code | 6 |
74126214589 | # -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
import datetime
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication a... | tylrbvn/longboxes | controllers/collection.py | collection.py | py | 5,360 | python | en | code | 0 | github-code | 6 |
38779549924 | import asyncio
import datetime
import time
import random
import discord
from discord import Member, Guild, User, message
from discord.ext import commands
from datetime import datetime
client = discord.Client()
client = discord.Client(intents=discord.Intents.all())
bot = commands.Bot(command_prefix='!')
... | Bolgorov/Agoki | agoki code (without token).py | agoki code (without token).py | py | 10,312 | python | de | code | 0 | github-code | 6 |
22504436543 | import scrapy
from scrapy import Request
class TrilhasTDC(scrapy.Spider):
name = "trilhas_tdc"
start_urls = [
"http://www.thedevelopersconference.com.br/tdc/2018/saopaulo/trilhas"
]
def parse(self, response):
colunas = response.xpath('//div[contains(@class, "col-sp")]')
for c... | anacls/scrapy-study | tdc_examples/scrapy_study/spiders/trilhas_tdc.py | trilhas_tdc.py | py | 1,172 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.