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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
39946882202 | #!/usr/bin/env python
import sys
import time
import logger
import session_environment
def execute(config, args):
"""
Runs the exec module with the given args and
global configuration.
For details of contents of config and args -
see the batch-mode.py main file.
- command
- name
- batc... | jtmpu/batch-mode | bm_modules/mnew.py | mnew.py | py | 1,791 | python | en | code | 0 | github-code | 13 |
33972717500 | # Assignment: Mini Project 1
# Due Date: October, 27 2015
# Name: Lane Scobie, Dylan Waters, Jason Yuen
# Unix ID: scobie, dwaters, jjyuen1
# StudentID: 1448158, 1343144, 1267071
# Lecture Section: B1
# Instructor: Davood Rafiei
# Group: ... | Lepitwar/Airlines | mini-pro.py | mini-pro.py | py | 20,844 | python | en | code | 0 | github-code | 13 |
73479317139 | #! python
with open('day3/input') as f:
wires = list(f.readlines())
for wire in range(len(wires)):
wires[wire] = wires[wire].split(',')
wires[wire][-1] = wires[wire][-1][:4]
def trace_wire(wire):
path = [(0,0)]
for movement in wire:
direction = movement[0]
distance = int(movement[1:])
moved = 0
if direct... | Frosty-nee/aoc2019 | day3/day3p1.py | day3p1.py | py | 1,194 | python | en | code | 0 | github-code | 13 |
38256494271 | ## 일반 Sequence Classification training을 수행하는 코드
from dataset import prepare_WC
from transformers import AutoModelForSequenceClassification, TrainingArguments, AutoConfig, Trainer, EarlyStoppingCallback, DataCollatorWithPadding
from datasets import concatenate_datasets
import wandb
import os
from utils import seed_ever... | donggunseo/SCI_Kostat2022 | train_WC.py | train_WC.py | py | 3,929 | python | ko | code | 2 | github-code | 13 |
34573999939 | import csv
import os
input_csv='C:\\Users\\tbnet\\Desktop\\UKED201811DATA5\\02-Homework\\03-Python\\Instructions\\PyPoll\\Resources\\election_data.csv'
total_votes=0
candidates=[]
vote_count={}
with open(input_csv) as csv_file:
csvreader=csv.reader(csv_file)
for row in csvreader:
total_votes +=1
... | tnetherton19/KU--tim-python-challenge | PyPoll/main.py | main.py | py | 1,067 | python | en | code | 0 | github-code | 13 |
659615127 | #Rahul Ramakrishnan
#module: config
population_size = 50 #Number of trees in the population
tournament_size = 3 #Size of tournament during tournament selection
tree_size = 10 #Number of nodes in a tree
generations = 50 #Number of generations
c_probability = .7 #Crossover probability
m_probabil... | giladbi/algorithmic-trading | Rahul_Genetic_Program/apple/config.py | config.py | py | 471 | python | en | code | 90 | github-code | 13 |
2350589473 | import pygame
class LoadFont:
def __init__(self, render, location, size, text, color, placement, aaFlag=True, boldFlag=False, italicFlag=False):
# file location
self.location = location
# font size
self.size = size
# placement on the screen
self.placement = placement... | EoD-Games/Alchemy-Adventure-Battle | client/classes/font.py | font.py | py | 892 | python | en | code | 2 | github-code | 13 |
8623760937 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 10:21:55 2020
@author: Sogal
"""
#Can't download file
from bs4 import BeautifulSoup
import requests
data = """
<html>
<head>
<title>Phoebe's Fantasy journey</title>
<link href="style.css" rel=stylesheet>
</head>
<body>
<div>
<header>
... | MakeMeASandwich/Python | bs2.py | bs2.py | py | 2,962 | python | en | code | 0 | github-code | 13 |
39018998982 | from typing import List
class Solution:
def findMin(self, nums: List[int]) -> int:
l = 0
r = len(nums)-1
res = nums[0]
while l <= r:
if nums[l] <= nums[r]:
res = min(res, nums[l])
break
mid = (l+r) // 2
res = min(... | sarveshbhatnagar/CompetetiveProgramming | min_in_rotated_sorted.py | min_in_rotated_sorted.py | py | 554 | python | en | code | 0 | github-code | 13 |
17086492864 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CampDetailInfo import CampDetailInfo
from alipay.aop.api.domain.ShopDiscountInfo import ShopDiscountInfo
from alipay.aop.api.domain.ShopDiscountInfo import ShopDiscount... | alipay/alipay-sdk-python-all | alipay/aop/api/response/AlipayOfflineMarketShopDiscountQueryResponse.py | AlipayOfflineMarketShopDiscountQueryResponse.py | py | 2,614 | python | en | code | 241 | github-code | 13 |
49897032 | # -*- coding: utf-8 -*-
"""Installer for the ruddocom.policy package."""
from setuptools import find_packages
from setuptools import setup
long_description = '\n\n'.join([
open('README.rst').read(),
open('CONTRIBUTORS.rst').read(),
open('CHANGES.rst').read(),
])
setup(
name='ruddocom.policy',
v... | Rudd-O/Rudd-O.com | src/ruddocom.policy/setup.py | setup.py | py | 3,010 | python | en | code | 0 | github-code | 13 |
18794545938 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides useful utilities for the other modules as well as for general use.
"""
import lxml
from lxml import etree
import xml.etree.ElementTree as et
import sys, re, os
from bs4 import BeautifulSoup
import pandas as pd
import hashlib
def infer_metadata(filename):
... | ninpnin/parlaclarin | pyparlaclarin/utils.py | utils.py | py | 4,236 | python | en | code | 0 | github-code | 13 |
29567081426 | import streamlit as st
import bcrypt
import datetime
import pandas
import pandas.io.sql as psql
# \COPY datatable(Merchants, MerchName2, TPV, TPC, Fees, Rev$, TPV$, Day, Date, Week, Month, Quarter, Year, Currency, Country, Product, SubProduct, Vertical, Category, Classification) FROM 'C:\Users\Nzubechukwu Onyekaba\Des... | Jude-X/reportapp | db.py | db.py | py | 17,729 | python | en | code | 0 | github-code | 13 |
21632108474 | import datetime
from django.contrib import admin
from django.contrib.admin.templatetags.admin_list import _boolean_icon
from register.admin.core import NotNullFilter
from register.dates import get_ranges_for_dates
from register.models.accommodation import Accomm
class SpecialNeedsNotNullFilter(NotNullFilter):
t... | muhammed-ajmal/heroku | register/admin/accommodation.py | accommodation.py | py | 2,118 | python | en | code | 0 | github-code | 13 |
18605982314 | from scenario_builder import Scenario
from scenario_builder.openbach_functions import StartJobInstance
from scenario_builder.helpers.network.ip_route import ip_route
from scenario_builder.helpers.network.sr_tunnel import create_sr_tunnel
from scenario_builder.helpers.postprocessing.histogram import cdf_on_same_graph
f... | CNES/openbach-extra | apis/scenario_builder/scenarios/network_sr_tunnel.py | network_sr_tunnel.py | py | 2,382 | python | en | code | 0 | github-code | 13 |
72187828819 | import time
import requests
import json
from lxml import etree
import re
import traceback
"""
爬取全国所有法院名称用于裁判文书搜索
"""
def get_proxy():
# 获取代理ip方法请自行封装
# 免费代理ip爬取: https://github.com/SelemeneCFY/ip_pool.git
pass
start_url = "http://tingshen.court.gov.cn/court"
headers = {
'User-Agent': 'Mozilla/5.0 ... | yanxiaofei395118/CPWSSpider | cpwsSpider/cpwsSpider/spiders/get_fymc.py | get_fymc.py | py | 1,279 | python | en | code | 2 | github-code | 13 |
42642202934 | import sys
import time
from mwpyeditor.core import mwplugin, mwglobals, mwjobs
from mwpyeditor.core.mwplugin import load_plugin
from mwpyeditor.record import mwcell, mwland
def init_settings():
"""Change settings for which data is loaded in and how much of it is processed."""
"""
Record types loaded by ... | Dillonn241/MwPyEditor | mwpyeditor_start.py | mwpyeditor_start.py | py | 4,580 | python | en | code | 4 | github-code | 13 |
11728986451 | # import date time Module
from datetime import datetime as dt
t1=input('enter date in HH:MM:SS:')
t2=input('enter date in HH:MM:SS:')
# format Time
format= "%H:%M:%S"
def timedifference(time1, time2):
try:
t1 = dt .strptime(time2,format)-dt.strptime(time1, format)
... | Srinivasareddymediboina/PYTHON-TOT | difftime.py | difftime.py | py | 471 | python | en | code | 0 | github-code | 13 |
5225373449 | import sqlite3
todo_data = sqlite3.connect("assignments_tracker.db")
c = todo_data.cursor()
# Create Users Table
'''
c.execute("""CREATE TABLE "users" (
"id" INTEGER NOT NULL,
"username" TEXT NOT NULL UNIQUE,
"password" TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
);""")
'''
# Create Tasks Table
'''
c.execute("""CREAT... | arelyx/TodoList | create_db.py | create_db.py | py | 507 | python | en | code | 0 | github-code | 13 |
42840385888 | import os
import glob
from re import split
from tqdm import tqdm
from multiprocessing import Pool
from functools import partial
scannet_dir='/root/data/ScanNet-v2-1.0.0/data/raw'
dump_dir='/root/data/scannet_dump'
num_process=32
def extract(seq,scannet_dir,split,dump_dir):
assert split=='train' or split=='test'
... | apple/ml-aspanformer | tools/extract.py | extract.py | py | 2,061 | python | en | code | 147 | github-code | 13 |
42783941624 | from tkinter import *
def EntrarClick ():
print ('Has introducido la frase --- ' + fraseEntry.get() + ' --- y has pulsado el botón entrar')
def Button1Click ():
print ('Has pulsado el botón 1')
window = Tk()
window.geometry("400x400")
window.rowconfigure(0, weight=1)
window.rowconfigure(1, weight=1)
window.c... | dronsEETAC/tallerFundesplai | Lib/botones2.py | botones2.py | py | 2,906 | python | en | code | 0 | github-code | 13 |
18481747254 | import pickle
import logging
import BeautifulSoup
import requests
from requests.exceptions import ConnectionError
class Scrapper(object):
RESUME_URL = 'http://jobsearch.monsterindia.com/searchresult-'
def __init__(self, count = 1):
self.payload = "fts=&lmy=&ind=65&ctp=0&job="
self.headers = {
"Content-Typ... | dspkgp/web-scrapper | monster/scraper.py | scraper.py | py | 2,705 | python | en | code | 0 | github-code | 13 |
37613309892 | from panda3d.core import RenderState, ColorAttrib, Vec4, Point3, NodePath, CollisionBox, CollisionNode, CollisionTraverser, BitMask32
from panda3d.core import CollisionHandlerQueue, GeomNode
from .BoxTool import BoxTool, ResizeHandle, BoxAction
from direct.foundry import LEGlobals
from direct.foundry import LEUtils
fr... | toontownretro/direct | src/foundry/SelectTool.py | SelectTool.py | py | 3,521 | python | en | code | 2 | github-code | 13 |
69837425939 | import censusdata
import pandas as pd
#function to make list of all county ids in state (given by census state id)
def county_list(state_number):
counties = censusdata.geographies(censusdata.censusgeo([('state', state_number),('county','*')]), 'acs5', 2018)
county_list = []
for i in counties.keys():
... | bonfirefan/oh_schools_mlppl | assignment1/census_load.py | census_load.py | py | 1,043 | python | en | code | 0 | github-code | 13 |
41542251174 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn.metrics as metrics
from scipy.stats import norm
def calibration_plot(y_pred, y_true, bins=100, ax=None):
if ax is None:
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(111)
y_true = y_true.reshape(... | yetinam/TEAM | plots.py | plots.py | py | 1,882 | python | en | code | 36 | github-code | 13 |
30828661744 | import os
import maya.OpenMaya as om
from pymel import core as pm
from maya import OpenMaya as om, OpenMayaMPx as ompx
import zMayaTools.menus
from zMayaTools.menus import Menu
from zMayaTools import controller_editor, maya_helpers, material_assignment_menu, shelf_menus, joint_labelling, skin_clusters
from zMayaTools i... | zewt/zMayaTools | plug-ins/zMayaUtils.py | zMayaUtils.py | py | 12,476 | python | en | code | 102 | github-code | 13 |
28920155168 | separador = lambda y, x='=': print(f'{y}\n', 30 * f'{x}')
# Criando dados para armazenar num dicionário
marca = 'apple'
cor = 'cinza espacial'
tam = '14 pol'
modelo = 'Macbook air'
chip = 'm1'
# Empacotando dos dados
mac = {
'marca': marca,
'cor': cor,
'tam': tam,
'modelo': modelo,
'chip': chip
}
... | devSantZ/python_course | secao_2/aulas/aula78.py | aula78.py | py | 1,719 | python | pt | code | 0 | github-code | 13 |
34173039212 | class Solution:
def findMaxAverage(self, nums: List[int], k: int) -> float:
if not nums:
return 0
if len(nums) == 1:
return nums[0]
n =len(nums)
'''
if k >= n:
return 0
max_val = float('-inf')
for i in range(n):
... | amuhebwa/100Days_of_Code | max_avg_subarray.py | max_avg_subarray.py | py | 709 | python | en | code | 2 | github-code | 13 |
16719178660 | import sys
# sys.stdin = open('input1.txt')
T = int(input())
for _ in range(T):
result = list(map(str, input().split()))
a = float(result[0])
for i in range(1, len(result)):
if result[i] == "@":
a *= 3
elif result[i] == "%":
a += 5
elif result[i... | zzzso-o/Algorithm | 백준/Bronze/5355. 화성 수학/화성 수학.py | 화성 수학.py | py | 378 | python | en | code | 0 | github-code | 13 |
727610250 | from colorama import Fore, Style, init
init()
class Interpreter:
def __init__(self):
self.commands = {
"print": self.printly,
"help": self.helply,
"add": self.addly,
"read": self.readly,
"write": self.writely,
"append": se... | akrtkk/lenti-language | lenti_terminal.py | lenti_terminal.py | py | 4,737 | python | en | code | 1 | github-code | 13 |
10264023406 | # 1.while循环
"""
while 条件:
do something1,2,3,
"""
i = 1
sum = 0
while i<=100:
sum += i
i += 1
print(sum)
# while猜数字
import random
num = random.randint(1,10)
guess = int(input("请输入你要猜的值:"))
i = 1
flag = 1
while flag:
if guess == num:
print(f"congratulations! u have used {i} ti... | cicospui/note | py基础学习/4.1while循环.py | 4.1while循环.py | py | 1,235 | python | en | code | 1 | github-code | 13 |
19166984398 | import numpy as np
from numpy import multiply as mult
from numpy import divide as div
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import csv
class Model:
__G = 6.67e-11
object_data = {}
position_dict = {}
energy_dict = {'total_energy': [], 'kinetic_energy': [], 'pote... | yuboshaouoe/UoE-Projects | UOE Projects/Computer Simulation/project-s2084333/project-s2084333.py | project-s2084333.py | py | 17,767 | python | en | code | 0 | github-code | 13 |
15509348466 | import re
def pt1():
# (1a <= 2a & 1b >= 2b) OR (2a <= 1a & 2b >= 1b)
# format : 1a-1b,2a-2b 0-1,2-3
total = 0
for line in lines:
sp = re.split("[,-]", line)
sp = list(map(int, sp)) # convert list to int as otherwise I think it compares by alphabetical order
if (sp[0] <= sp[2]... | Matt-Unwin/AoC2022 | days/d4/d4.py | d4.py | py | 1,645 | python | en | code | 0 | github-code | 13 |
70752752019 | """empty message
Revision ID: 4fbd92443310
Revises: 7b3ad4f4097d
Create Date: 2021-06-23 15:26:59.727268
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4fbd92443310'
down_revision = '7b3ad4f4097d'
branch_labels = None
depends_on = None
def upgrade():
# ... | BlueBoi904/cinnamon | server/migrations/versions/4fbd92443310_.py | 4fbd92443310_.py | py | 663 | python | en | code | 0 | github-code | 13 |
6563963376 | from datacenter.models import Visit
from django.shortcuts import render
from django.utils import timezone
import pytz
def storage_information_view(request):
visits = Visit.objects.all()
unfinished_visits = visits.filter(leaved_at=None)
serialized_visits = []
for unfinished_visit in unfinished_visits:
... | pn00m/watching_storage | datacenter/storage_information_view.py | storage_information_view.py | py | 899 | python | en | code | 0 | github-code | 13 |
22035993335 | #
# @lc app=leetcode.cn id=406 lang=python3
#
# [406] 根据身高重建队列
#
"""
author : revang
date : 2022-02-02
method : 贪心-相邻问题: 先帮身高最大的找位置, 依次类推. 具体方法: 排序+插入
1. 排序: 先按照身高从大到小排序(身高相同的情况下K小的在前面),这样的话,无论哪个人的身高都小于等于他前面人的身高。所以接下来只要按照K值将他插入相应的位置就可以了。
例如:示例1排完序: [[7,0],[7,1],[6,1],[5,0],[5,2],[4,4]]
2. 插入: 新建一个列表
... | revang/leetcode | 406.根据身高重建队列.py | 406.根据身高重建队列.py | py | 1,204 | python | zh | code | 0 | github-code | 13 |
17040811284 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.FileInfo import FileInfo
class AlipayFincoreComplianceRcsmartContentSubmitModel(object):
def __init__(self):
self._app_name = None
self._app_token = None
... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayFincoreComplianceRcsmartContentSubmitModel.py | AlipayFincoreComplianceRcsmartContentSubmitModel.py | py | 4,050 | python | en | code | 241 | github-code | 13 |
19997637764 | from flask import Flask, request
from flask_cors import cross_origin
from order import OrderController
from plan import PlanController
application = Flask(__name__)
@application.route('/', methods=['GET'])
@cross_origin()
def index():
return 'API Works! v1.0.0'
@application.route('/order', methods=['GET', 'POST'... | oismaelash/alaris-flask-python-backend | application.py | application.py | py | 1,557 | python | en | code | 0 | github-code | 13 |
12054070457 | class Empty(Exception):
pass
class ArrayQueue:
"""FIFO implementation using a python list for underlying storage"""
DEFAULT_CAPACITY = 10 # moderate capacity for all new queues
def __init__(self):
self._data = [None] * ArrayQueue.DEFAULT_CAPACITY
self._size = 0
self._front = 0... | Akorex/Algorithms-From-Scratch | Data Structures and Algorithms/Python/old/queue.py | queue.py | py | 2,539 | python | en | code | 0 | github-code | 13 |
16537611726 | import sys
from algo import a_star, solution_analyzer
import ui
from reader.argument_parser import ArgParser
from reader.on_startup import StatesOnStart
def do_solvation():
parser = ArgParser()
puzzles = parser.puzzles
greedy, uniform = parser.greedy_and_uniform
map_type = parser.map_type
algo =... | bshanae/n-puzzle | main.py | main.py | py | 1,073 | python | en | code | 0 | github-code | 13 |
38816431035 | import cv2
import numpy as np
# Read the input image
image_path = 'boxes.jpg' # Replace with the actual image path
image = cv2.imread(image_path)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Apply Gaussian blur to reduce noise and improve edge detection
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
# D... | AnujNautiyal22bme024/CardboardBoxDeteection | boxdetection.py | boxdetection.py | py | 1,312 | python | en | code | 0 | github-code | 13 |
21928312443 | from collections import Counter
def find_string_anagrams(str1, pattern):
pattern_counter = Counter(pattern)
result_indexes = []
m = Counter()
start = 0
for end in range(len(str1)):
m[str1[end]] += 1
if end - start + 1 == len(pattern):
if all(pattern_counter[chr] == m[... | dyabk/competitive-programming | GTCI/sliding_window/problem_challenge_two.py | problem_challenge_two.py | py | 481 | python | en | code | 0 | github-code | 13 |
20906109751 | '''
27/10/2019 Developed by Xu Han (n10306986), Earl Yin Lok Chau (n10328611), Vincent Chen(n7588844)
Siamese neural network is an artificial neural network (ANN)
that uses the same weights and structure while working
in tandem on 2 dissimilar input vectors to compute comparable output vectors.
In this ... | raonlok1211/IFN680 | Siamese neural network.py | Siamese neural network.py | py | 29,876 | python | en | code | 0 | github-code | 13 |
73288430736 | usuarios = {}
def cadastrar():
global usuarios
usuario = input("Digite um nome de usuário: ")
if usuario in usuarios:
print("Usuário já existe. Tente outro nome de usuário.")
return
senha1 = input("Digite sua senha: ")
senha2 = input("Confirme sua senha: ")
if senha1 == s... | ChristianF22/login_python | login2.py | login2.py | py | 1,494 | python | pt | code | 1 | github-code | 13 |
70441172817 | d = []
w = []
while True:
print("\n1. Enter the transaction")
print("2. Display the net ammount")
print("3. Exit")
resp = int( input("Enter your choice? ") )
if resp == 1:
trans = input( "\nEnter transaction with D/W and value? ")
if trans[0] == "D":
d.append( int(trans[... | Jayprakash-SE/Engineering | Semester4/PythonProgramming/Test1/Q16.py | Q16.py | py | 482 | python | en | code | 0 | github-code | 13 |
36153328446 | import numpy as np
import pytest
import xarray as xr
import xbatcher # noqa: F401
from xbatcher import BatchGenerator
@pytest.fixture(scope="module")
def sample_ds_3d():
shape = (10, 50, 100)
ds = xr.Dataset(
{
"foo": (["time", "y", "x"], np.random.rand(*shape)),
"bar": (["ti... | xarray-contrib/xbatcher | xbatcher/tests/test_accessors.py | test_accessors.py | py | 3,458 | python | en | code | 114 | github-code | 13 |
677377192 | import numpy as np
import circle
import csv
from enum import Enum
def read_from_file(nc_code_file):
with open(nc_code_file) as nc_code:
lines = nc_code.readlines()
return lines
def create_coordinates_file(coordinates_file):
with open(coordinates_file, 'w'):
pass
def append_multiple_coo... | ekement/Milling-Machine-Simulation | path_calculation.py | path_calculation.py | py | 7,468 | python | en | code | 0 | github-code | 13 |
14907657421 | import uuid
import unittest
import pkg_resources
from kado.store import _store
from tests.lib import constants as tc
class TestIndex(unittest.TestCase):
"""Test case for :class:`kado.store._store.Index`."""
def setUp(self):
"""Setup test cases for :class:`kado.store._store.Index`."""
# Inde... | jimmy-lt/kado | tests/store/test__store.py | test__store.py | py | 13,601 | python | en | code | 0 | github-code | 13 |
41576118364 | import os
import sys
import argparse
import shutil
root_path = os.path.realpath(os.path.dirname(__file__))
sys.path.append(root_path)
from task import VerifTask
AIG_BMC_TASK = 'AIG_BMC_TASK'
AIG_PROVE_TASK = 'AIG_PROVE_TASK'
BTOR_BMC_TASK = 'BTOR_BMC_TASK'
BTOR_PROVE_TASK = 'BTOR_PROVE_TASK'
def verify_task(file_nam... | donghua100/verifytools | core/task/verify_task.py | verify_task.py | py | 2,679 | python | en | code | 2 | github-code | 13 |
26601498994 | import math
def createSieve(number):
startList = list(range(0, number + 1))
startList[0] = False
startList[1] = False
print(startList)
def findNext(boolList, p):
for key, value in enumerate(boolList):
if key > p and value is True:
return key
return None
def list_true(n)... | Timsnky/challenges | sieve/sieve.py | sieve.py | py | 1,822 | python | en | code | 0 | github-code | 13 |
21457683686 | # -*- coding: utf-8 -*-
# This file is part of Argos.
#
# Argos 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 version.
#
# Argos is distribut... | leehawk2001/argos | argos/inspector/selectionpane.py | selectionpane.py | py | 2,959 | python | en | code | null | github-code | 13 |
4997269525 | from django.shortcuts import render
from . import forms
from . import models
# Create your views here.
def index(request):
context = {}
context["categoryForm"] = forms.CategoryModelForm()
context["pageForm"] = forms.PageModelForm()
return render(request, "templates/index.html", context)
def succe... | teetangh/Kaustav-CSE-LABS-and-Projects | Sem06-Web-Dev-LAB/WEEK 07/week07/question1_app/views.py | views.py | py | 2,186 | python | en | code | 2 | github-code | 13 |
73524321619 | f= open("Kaartnummers.txt","r")
lines = f.readlines()
highest = 0
linenumber = 0
i = 0
for line in lines:
i = i + 1
user = line.strip('\n').split(', ')
number = int(user[0])
if(number > highest):
highest = number
linenumber = i
print("deze file kent",i,"regels")
print("Het grootste kaa... | ldehaas1612/Python | hu/Opdrachten/Week 7/3. readfile.py | 3. readfile.py | py | 389 | python | en | code | 0 | github-code | 13 |
72985744018 | from src.data_store import data_store
from src.error import InputError, AccessError
from src.other import check_valid_token
from src.stats import increase_num_dms_joined, decrease_num_dms_joined
from src.stats import increase_dms_exist, decrease_dms_exist, decrease_msgs_exist
from src.notifications import update_notifi... | spoicywings/Major_project_backend | src/dm.py | dm.py | py | 10,100 | python | en | code | 0 | github-code | 13 |
31941240450 | import heapq
from typing import List
from typing import Tuple
class Solution:
def minimumWeight(self, n: int, edges: List[List[int]], src1: int,
src2: int, dest: int) -> int:
INF = 10**12
def dijkstra(graph: List[List[Tuple[int, int]]],
src: int) -> Li... | wylu/leetcodecn | src/python/contest/week284/6032.得到要求路径的最小带权子图.py | 6032.得到要求路径的最小带权子图.py | py | 1,657 | python | en | code | 3 | github-code | 13 |
16276259294 | from django.urls import path
from . import views
urlpatterns = [
path("dashboard/", views.VisualizationsView.as_view(), name="vis"),
path("line-charts/", views.LineChartsView.as_view(), name="line_charts"),
path(
"get-model-item/<int:model_id>/",
views.get_model_selector_item,
name... | Mosqlimate-project/Data-platform | src/vis/urls.py | urls.py | py | 640 | python | en | code | 5 | github-code | 13 |
5746582476 | """HiddenFootprints walkability prediction network module
Based on a Resnet + UNet structure to predict where people can walk in a scene.
"""
import torch
import torch.nn as nn
from .resnet import ResUNet
import numpy as np
import torchvision.transforms as transforms
import cv2
class GeneratorHeatMap(nn.Module):
... | jinsungit/hiddenfootprints | hiddenfootprints/model/networks.py | networks.py | py | 4,238 | python | en | code | 7 | github-code | 13 |
32078941550 | from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from rest_framework.test import APIClient
from rest_framework import status
from core.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAG_URL = reverse('recipe:tags-list')
def crea... | samgans/Recipe-API | app/recipe/tests/test_tags.py | test_tags.py | py | 5,122 | python | en | code | 0 | github-code | 13 |
9523692362 | import os
import time
import datetime
import torch
import torch.utils.data
from opts import opts
import ref
from models.hg_3d_gan import Hourglass3DGAN
from utils.utils import adjust_learning_rate
from datasets.fusion import Fusion
from datasets.h36m import H36M
from datasets.mpii import MPII
from utils.logger import ... | anuragmundhada/pose-hgreg-gan | src/main.py | main.py | py | 2,896 | python | en | code | 8 | github-code | 13 |
27622391650 | import asyncio
import time
import aiohttp
start_time = time.time()
url = 'https://fanyi.baidu.com/sug'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37'
}
kw_list = ['cat', 'dog', 'mouse']
as... | New-Heartbeat/spider-learn | 多任务/多任务协程爬虫实例.py | 多任务协程爬虫实例.py | py | 852 | python | en | code | 0 | github-code | 13 |
39443435063 | # -*- coding: utf-8 -*-
"""Display the driver database as a table."""
import PySide2.QtWidgets as QtWidgets
import PySide2.QtCore as QtCore
import PySide2.QtGui as QtGui
from . import config
from ..lib.driver import Driver
class DriverDatabaseFrame(QtWidgets.QWidget):
"""Display, sort, filter, etc the database of... | Psirus/altai | altai/gui/driver_db_frame.py | driver_db_frame.py | py | 7,756 | python | en | code | 0 | github-code | 13 |
5609788008 | from sklearn.cluster import DBSCAN
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
import logging
import time
import sys
import numpy as np
from scripts.clustering.news import News
from scripts.clustering.util import *
start_time = time.time()
# Files
dataset = '/data/kasa... | jaitl/kasandra-rus | kasandra_nlp/scripts/clustering/dbscan.py | dbscan.py | py | 2,867 | python | en | code | 1 | github-code | 13 |
6748551084 | from types import ModuleType
from typing import List, Optional, Callable, Union, Dict
from importlib import import_module
from flask import Flask, Blueprint
from flask_jsonrpc import JSONRPC
class AutoBluePrint(object):
def __init__(self, app: Optional[Flask] = None, jsonrpc: Optional[JSONRPC] = None):
i... | HkwJsxl/yingmingapi | application/utils/blueprint.py | blueprint.py | py | 4,708 | python | en | code | 0 | github-code | 13 |
16136917294 | """
=================
spectral analysis
=================
"""
# imports
import mne
import numpy as np
import pandas as pd
import pickle
import os.path as op
from mne.time_frequency import psd_welch
def calculatePSD(path,
subjects,
tasks,
freqs,
n_ov... | Yeganehfrh/SuggNet | src/sugnet/preprocessing/spectral_analysis.py | spectral_analysis.py | py | 5,828 | python | en | code | 1 | github-code | 13 |
16140887922 | from users.models import Customer
from django.contrib.auth.models import User
from django.shortcuts import render
from .models import OrderItem
from .forms import OrderCreateForm, CustomerCreateForm, UserCreateForm
from django.forms import modelformset_factory
from cart.cart import Cart
def order_create(request):
... | acor8826/phoenix | orders/views.py | views.py | py | 1,952 | python | en | code | 0 | github-code | 13 |
39732155451 | filename = "name.txt"
# Dosya açılır ve her satırı lines dizisine okunur.
with open(filename) as f:
lines = f.readlines()
# İsim, soyisim ve yaş listeleri oluşturulur.
name_list = []
surname_list = []
age_list = []
# Her satır için kelimelere ayrılır ve uygun listelere eklenir.
for line in li... | musaninsopasi/name | name.py | name.py | py | 648 | python | tr | code | 0 | github-code | 13 |
38380911963 | import networkx as nx
import string
def parse(input_data):
val_map = {k: v for k, v in zip(string.ascii_lowercase, range(26))}
val_map['S'] = 0
val_map['E'] = 25
edges = dict()
potential_starting_pts = [] # for pt 2
# Parse input into list of lists
grid = [
[step for step in list(... | mharty3/advent_of_code | 2022/day-12.py | day-12.py | py | 2,704 | python | en | code | 0 | github-code | 13 |
69892974099 | import csv
import sys
import json
import logging
import argparse
from collections import defaultdict
from flask import Flask, render_template, request
app = Flask(__name__)
logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%Y/%m/%d... | jacobvsdanniel/plant_ner_spacy | geneid-commonname-relation-visualization/server.py | server.py | py | 7,816 | python | en | code | 0 | github-code | 13 |
33556041886 | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import sys
import ctypes
import PIL.ImageGrab
# from . import windows
# from . import util
# from .keyboard_hook import KeyboardHook
if sys.platform != 'win32':
import platform
raise Exception('Invalid platform: %s (%s)' % (sys.platform, platform.platform()))
... | rapsealk/win32py | win32py/__init__.py | __init__.py | py | 5,803 | python | en | code | 0 | github-code | 13 |
27300298935 | from era5grib.nci import *
import pandas
import pytest
@pytest.mark.xfail
def test_19810101T0000():
# era5land only available for some fields
date = pandas.to_datetime("19810101T0000")
ds = read_wrf(date, date)
assert numpy.all(numpy.isfinite(ds.sp_surf))
@pytest.mark.xfail
def test_19810101T0100():
... | coecms/era5grib | test/test_nci.py | test_nci.py | py | 877 | python | en | code | 4 | github-code | 13 |
25566045173 | from collections import deque
operators = {
"a": lambda a, b: a + b,
"s": lambda a, b: a - b,
"d": lambda a, b: a / b if b != 0 else a,
"m": lambda a, b: a * b,
}
def math_operations(*numbers, **operations):
numbers = deque(numbers)
while numbers:
for key, value in operations.items()... | mustanska/SoftUni | Python_Advanced/Functions Advanced/math_operations.py | math_operations.py | py | 848 | python | en | code | 0 | github-code | 13 |
70869983059 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Hamiltonian with PBC condition
"""
import numpy as np
C1=1
C2=2
C3=1
C4=0.833
CGA=1
CGB=CGA
CA=0
CB=0
LA=1
LB=LA
np.save('./input/parameters.npy') | lvhz/pyNodalLine | parameters.py | parameters.py | py | 212 | python | en | code | 0 | github-code | 13 |
30243323213 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
import datetime
import json
import logging
from django.utils.translation import ugettext as _
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.la... | pignacio/vld_django | vld_django/persons/forms.py | forms.py | py | 7,106 | python | en | code | 0 | github-code | 13 |
74605644818 | from typing import List, cast
import aioredis
import discord
import discord.ext.commands
import discord.ext.tasks
from shared import configuration
configuration.DEFAULTS.update({
"token": "",
"db": "mysql+pool://pkmn:passwd@localhost/pkmndb?max_connections=20&stale_timeout=300",
"owners": [154363842451734... | EightBitEllie/ACNH-Turnip-Bot | turnipbot/main.py | main.py | py | 1,653 | python | en | code | 0 | github-code | 13 |
25564143443 | # -*- coding: utf-8 -*-
from qgis.PyQt.QtGui import QIcon
from ..utils import PLUGIN_FOLDER
from .features import Waterpoint
from .popup_layer_source_mixin import PopupLayerSourceMixin
from .importable_feature_layer import ImportableFeatureLayer
from .waterpoint_buffer_popup_layer import WaterpointBufferPopupLayer
... | Trailmarker/paddock-power | paddock_power/src/layers/waterpoint_layer.py | waterpoint_layer.py | py | 1,565 | python | en | code | 0 | github-code | 13 |
30766035945 | # -*- coding:UTF-8 -*-
"""
轮询组合内的基金,获取基金的消息
以行为单位,存储基金内容
"""
from IOFile import read_group_fund_json, read_chenxingcode_json
from FundParameterInfo import FundInfo
if __name__ == '__main__':
fund_list = []
group_fund_info = read_group_fund_json() # 获取组合基金信息
chenxing_code = read_chenxingcode_jso... | MrDujing/FundCombination | src/export_fund_info.py | export_fund_info.py | py | 2,554 | python | en | code | 48 | github-code | 13 |
195124754 | import csv
import random
from typing import Dict, List
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.core.validators import validate_email
from phishing.management.commands._base import EmailCommand
from phishing.models import Target, TargetPool
fr... | tarhses/phishstick | phishing/management/commands/send_emails.py | send_emails.py | py | 4,056 | python | en | code | 1 | github-code | 13 |
3318566956 | import random
import time
import csv
class GA_multi_lines:
"""
this class present a genetic algorithm.
this class resive fitness function and data about the genetic options:
population_size, mutation and number of generations
by the given data, the algorithm try to solve the problem
"""
... | danielifshitz/RSSP | code/genetic_multi_lines.py | genetic_multi_lines.py | py | 12,573 | python | en | code | 1 | github-code | 13 |
35225498920 | # write a function that removes duplicate entries from a list
names = ['larry', 'curly', 'joe', 'adam', 'brian', 'larry', 'joe']
def removeDuplicate(names):
unique_names = []
for name in names:
if name not in unique_names:
unique_names.append(name)
return unique_names
print(names)
p... | Abir-Al-Arafat/Problem-Solving-in-Python | Basic Ones/removeDuplicate.py | removeDuplicate.py | py | 379 | python | en | code | 0 | github-code | 13 |
14742892142 | import os
from dotenv import load_dotenv
import telebot
from brownie import (
Contract,
accounts,
chain,
rpc,
web3,
history,
interface,
Wei,
ZERO_ADDRESS,
)
import time, re, json
load_dotenv()
SSC_BOT_KEY = os.getenv("SSC_BOT_KEY")
USE_DYNAMIC_LOOKUP = os.getenv("USE_DYNAMIC_LOOKUP"... | flashfish0x/telegram_ssc | scripts/test.py | test.py | py | 5,182 | python | en | code | 0 | github-code | 13 |
40105371619 | import subprocess, os, shutil, sys, requests, argparse
from pprint import pprint
try:
from pytube import YouTube# Sure that YouTube and Playlist can be downloaded
except Exception as e:
print(e)
print('[Run] pip(/3) install pytube')
exit()
banner = '''
██╗ ██╗ ██████╗ ██╗ ██╗████████╗██╗ ... | Aryan09005/YouTube-HD-downloader | AdvDownload.py | AdvDownload.py | py | 7,764 | python | en | code | 0 | github-code | 13 |
35241367232 | import functions
import data
import visualizations
# Datos de entrenamiento y Prueba
train_df = data.data_open_2("AUDUSD_train.csv")
test_df = data.data_open_2("AUDUSD_test.csv")
# Preprocesamiento de dataframes para evaluación de estrategia
# Creación de indicadores
# Exponential Moving Average y Aroon Oscillator
tr... | feramdor/Lab5 | main.py | main.py | py | 3,473 | python | es | code | 0 | github-code | 13 |
43086112012 | # 剑指 Offer II 072. 求平方根
# 给定一个非负整数 x ,计算并返回 x 的平方根,即实现 int sqrt(int x) 函数。
# 正数的平方根有两个,只输出其中的正数平方根。
# 如果平方根不是整数,输出只保留整数的部分,小数部分将被舍去。
# 示例 1:
# 输入: x = 4
# 输出: 2
# 示例 2:
# 输入: x = 8
# 输出: 2
# 解释: 8 的平方根是 2.82842...,由于小数部分将被舍去,所以返回 2
# 提示:
# 0 <= x <= 231 - 1
class Solution:
def mySqrt(self, x: int) -> int:... | Guo-xuejian/leetcode-practice | 剑指OfferII072.求平方根.py | 剑指OfferII072.求平方根.py | py | 1,089 | python | zh | code | 1 | github-code | 13 |
18987865477 | import math
import psutil
import os,sys
def findsquares(squares):
winsquarenums = set()
perrow = int(math.sqrt(squares))
for s in range(squares-perrow-1):
if s % perrow != perrow-1:
winsquarenums.add(frozenset({s,s+1,s+perrow,s+perrow+1}))
return winsquarenums
def remove_useless_w... | yannikkellerde/GABOR | util.py | util.py | py | 1,492 | python | en | code | 3 | github-code | 13 |
32817004919 | from .packages import *
import argparse
import os
__version__ = '0.4.0'
def cli_mode():
menu = '''\
Num6 - A Powerful Cryptography Tool
1. For word or line encryption
2. For word or line decryption
3. For file encryption enter path
4. For file decryption enter path
0. For stop the programme
00. For cle... | Almas-Ali/Num6 | num6/cli.py | cli.py | py | 3,139 | python | en | code | 7 | github-code | 13 |
16866469607 | from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
# def Pi(num_steps):
# step = 1.0/num_steps
# sum = 0
# for i in range(num_steps):
# x = (i+0.5)*step
# sum += 4.0/(1.0+x**2)
# pi = step*sum
# return pi
# print("The pi... | deepakagrawal/PatientScheduling | prime.py | prime.py | py | 1,087 | python | en | code | 0 | github-code | 13 |
26384329910 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
import time
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import mn... | AdrianHsu/tensorflow-basic-models | mechanics101/fully_connected_feed.py | fully_connected_feed.py | py | 6,488 | python | en | code | 0 | github-code | 13 |
44276254198 | import random
home = input('Кто играет дома?: ')
visitor = input('Кто играет в гостях?: ')
result = []
for i in range(100):
preres = random.randint(0, 2)
result.append(preres)
print(result)
homeWin = result.count(1)
visitorWin = result.count(2)
draw = result.count(0)
total = [homeWin, visitorWi... | novikoph/sandbox | super.py | super.py | py | 580 | python | ru | code | 0 | github-code | 13 |
26149420283 | import torch
from torch.utils.data import Dataset
import torch.nn.functional as func
import os
from glob import glob
import h5py
import cv2
from tqdm import tqdm
import numpy as np
import random
import yaml
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
plt.style.use('seaborn-whitegrid')
... | WarranWeng/ESR | dataloader/h5dataset.py | h5dataset.py | py | 39,452 | python | en | code | 0 | github-code | 13 |
25033584074 | # Turimas "users" masyvas.
# Parašykite funkcijas, kurios atlikas nurodytas užduotis:
# 1. funkcija "filter_dog_owners" - kaip argumentą priims masyvą ir duoto masyvo
# atveju grąžins "users", kurie turi augintinį.
# 2. funkcija "filter_adults" - kaip argumentą priims masyvą ir duoto masyvo
# atveju grąžins masyvą su ... | TomasSm1978/Python-first-test_2022.06.16 | test1.py | test1.py | py | 1,726 | python | lt | code | 0 | github-code | 13 |
33164103691 | import numpy as np
def read_input(in_file):
new_list = []
with open(in_file, 'r') as f:
for line in f.readlines():
new_list.append([int(char) for char in line.rstrip()])
return np.array(new_list)
def update_array(arr):
arr += 1
bloom_tuple = []
while np.max(arr) > 9:
... | cbalusekslalom/advent_of_code | 2021/Day11/2021_day11.py | 2021_day11.py | py | 1,060 | python | en | code | 0 | github-code | 13 |
14292497275 | import inspect
import functools
import py
import sys
from _pytest.compat import NOTSET, getlocation, exc_clear
from _pytest.fixtures import FixtureDef, FixtureRequest, scopes, SubRequest
from pytest import fail
class YieldFixtureDef(FixtureDef):
@staticmethod
def finish(self, request):
exceptions = ... | devova/pytest-yield | pytest_yield/fixtures.py | fixtures.py | py | 7,313 | python | en | code | 15 | github-code | 13 |
72555705938 | #Tomb Raider: Definitive Edition [Orbis] - ".trdemesh" Loader
#By Gh0stblade
#v1.3
#Special thanks: Chrrox
#Options: These are bools that enable/disable certain features! They are global and affect ALL platforms!
#Var Effect
#Misc
#Mesh Global
fDefaultMeshScale = 1.0 #Override mesh scale (default is 1.0)
bOptim... | DickBlackshack/NoesisPlugins | Python/Gh0stBlade/fmt_TRDE_mesh_1_3_1.py | fmt_TRDE_mesh_1_3_1.py | py | 15,983 | python | en | code | 17 | github-code | 13 |
38776635169 | import copy
import math
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from landscapegen.tileset import Tileset_wfc
from landscapegen.wavefunction import Wavefunction
# from typing import deprecated
def flatten_list_of_lists(list_of_lists):
return [item for subl... | ebbestubbe/landscapegen | landscapegen/utils.py | utils.py | py | 7,467 | python | en | code | 0 | github-code | 13 |
70977207058 | # -*- coding = utf-8 -*-
# @File Name : extract_features.
# @Date : 2023/6/8 12:17
# @Author : zhiweideng
# @E-mail : zhiweide@usc.edu
import os
import torch
import dataset
import network
import argparse
from tqdm import tqdm
from datetime import date
from train import read_json
from torch.utils.data import DataLoade... | dengchihwei/SpectralVessel | extract_features.py | extract_features.py | py | 3,256 | python | en | code | 0 | github-code | 13 |
6397772484 | from random import randint
from time import sleep
from dic import dic_accents
from sys import stderr, executable, exit
from subprocess import check_call, CalledProcessError
# Support des couleurs ANSI dans windows
from os import system
system("")
COLOR = {
"RED": "\x1b[91m",
"GREEN": "\x1b[92m",
"BLUE": "... | comejv/utils-and-games | wordle/wordle.py | wordle.py | py | 5,632 | python | fr | code | 3 | github-code | 13 |
2449056737 | class Solution:
def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:
array = defaultdict(set)
# ans = True
row = len(matrix)
col = len(matrix[0])
for i in range(row):
for j in range(col):
array[i-j].add(matrix[i][j])
... | asnakeassefa/A2SV_programming | 0766-toeplitz-matrix/0766-toeplitz-matrix.py | 0766-toeplitz-matrix.py | py | 407 | python | en | code | 1 | github-code | 13 |
39148479248 | #!/bin/python3
#https://www.hackerrank.com/challenges/hackerrank-in-a-string/problem
import sys
answer_list = []
string = "hackerrank"
q = int(input().strip())
for i in range(q):
flag = 0
s = input().strip()
list_element = []
for element in s:
list_element.append(element)
i... | saumya-singh/CodeLab | HackerRank/Strings/HackerRank_In_A_String.py | HackerRank_In_A_String.py | py | 822 | python | en | code | 0 | github-code | 13 |
74679521296 | import itertools
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from owlready2 import get_ontology
from sklearn.metrics import f1_score
def read_ontology(path):
onto = get_ontology(path)
onto.load()
# Read classes
classes = []
for cl in onto.classes():
classes.appe... | lbulygin/machine-learning-ontology-matching | utils_datasets.py | utils_datasets.py | py | 3,229 | python | en | code | 11 | github-code | 13 |
12345058325 | # program to return first and last occurence of element x in sorted array
# logic is to use the information for stored array and use modified binary search algorithm.
# Idea is to whenever we find the required element, then we should not stop ,
# but rather go on in left for finding first occurence or go on in right
# ... | souravs17031999/100dayscodingchallenge | strings/find_first_and_last_occurence.py | find_first_and_last_occurence.py | py | 2,021 | python | en | code | 43 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.