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
27132320608
""" Main launching point of the Top Patch Server """ import base64 import uuid import os import logging import logging.config import tornado.httpserver import tornado.ioloop import tornado.web import tornado.options from redis import StrictRedis from rq import Connection, Queue from server.handlers import RootHandle...
SteelHouseLabs/vFense
tp/src/vFense_listener.py
vFense_listener.py
py
5,617
python
en
code
5
github-code
6
4707609049
#!/usr/bin/env python import tensorflow as tf import numpy as np # from tensorflow.examples.tutorials.mnist import input_data def init_weights(shape): return tf.Variable(tf.random_normal(shape, stddev=0.01)) mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) trX, trY, teX, teY = mnist.train.images, ...
WYGNG/USTC_SSE_AI
实验/AI2019_SA19225404_吴语港_Lab4_TF1.x/AI2019_SA19225404_吴语港_Lab4_TF1.x/CNN.py
CNN.py
py
2,508
python
en
code
34
github-code
6
12424048897
__author__ = "Vanessa Sochat, Alec Scott" __copyright__ = "Copyright 2021-2022, Vanessa Sochat and Alec Scott" __license__ = "Apache-2.0" from paks.utils.names import namer from paks.logger import logger import paks.utils import paks.defaults import paks.templates import paks.commands import paks.settings import subp...
syspack/paks
paks/backends/base.py
base.py
py
8,161
python
en
code
2
github-code
6
34778096922
import os import yaml def book_ids_from_frontmatter(frontmatter): '''Return a list of book id hashes from frontmatter of list file.''' sections = yaml.load(frontmatter)['sections'] books = [] for section in sections: for source in section['listings']: if source['type'] == 'book':...
Backlist/backlist-workflows
backlist.py
backlist.py
py
1,832
python
en
code
0
github-code
6
10159693048
# enter a no and print the sum of the 1st and last digits of that no number = int(input("Enter a no:")) first = number % 10 while number != 0: rem = number % 10 number = number // 10 print("the sum of the 1st and last digits is:", first+rem)
suchishree/django_assignment1
python/looping/while loop/demo3.py
demo3.py
py
253
python
en
code
0
github-code
6
6018015716
import os import re from pathlib import Path summary = "" def get_sql(name, docs, cat, markdown, docs_url): return f"INSERT INTO `ae-expression` ( `name`, `docs`, `cat`, `markdown`, `docs_url`) VALUES ( {name}, {docs}, {cat}, {markdown}, {docs_url});" def get_content(file_path, docs, cat): with open(file_p...
Yuelioi/Program-Learning
Python/Projects/提取文件API的sql.py
提取文件API的sql.py
py
1,733
python
en
code
0
github-code
6
26408420089
import json from socket import * import base64 def client_json(ip, port, obj): # 创建TCP Socket并连接 sockobj = socket(AF_INET, SOCK_STREAM) sockobj.connect((ip, port)) if 'exec_cmd' in obj.keys(): send_obj = obj elif 'upload_file' in obj.keys(): with open('{0}'.format(obj['upload_file...
Prin-Meng/NetDevOps
network_protocal/task_day13/socket_client.py
socket_client.py
py
2,627
python
en
code
0
github-code
6
5212403801
# -*- coding: utf-8 -*- import scrapy from junyang_spider.items import YouzySchoolBadgeItem class SchoolBadgeSpider(scrapy.Spider): name = "school_badge" allowed_domains = ["youzy.cn"] start_urls = [ "https://www.youzy.cn/college/search?page=1", ] custom_settings = { 'ITEM_PIPELINE...
endForYou/spider
junyang_spider/spiders/school_badge_spider.py
school_badge_spider.py
py
914
python
en
code
0
github-code
6
44070613144
import numpy as np import math import matplotlib.pyplot as plt class LotkaVolterra: """This class defines the Lotka--Voltera prey-predator system. There are 4 parameters in this class which define the evoluion of the system. Attributes: k_a reproduction rate of the antelopes ...
sidsriv/Simulation-and-modelling-of-natural-processes
lotkaVolterra.py
lotkaVolterra.py
py
5,583
python
en
code
21
github-code
6
19272008799
import MDAnalysis import sys import itertools import tool from argparse import ArgumentParser """ a = sys.argv a.pop(0) kai1 = [i for i in a if ".trr" in i] kai2 = [i for i in a if ".pdb" in i] kai3 = [i for i in a if "prob" in i] kai4 = [i for i in a if ".trr" not in i and ".pdb" not in i and ".t...
satoshi-python/Desktop
pca1_kai.py
pca1_kai.py
py
5,325
python
en
code
0
github-code
6
17509147003
''' start: 7:58 end: 8:11 13 mins constraint: |nodes| > 0 ''' # 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 diameterOfBinaryTree(self, root: TreeNode)...
soji-omiwade/cs
dsa/before_rubrik/diameter_of_binary_tree_2021_06_28.py
diameter_of_binary_tree_2021_06_28.py
py
719
python
en
code
0
github-code
6
70893752508
import sys import pandas as pd from sklearn.feature_selection import SelectKBest, mutual_info_regression from sklearn.preprocessing import LabelEncoder import matplotlib.pyplot as plt # Load the dataset #filename = sys.argv[1] data = pd.read_csv('uploads/BigBasket.csv') # Encode categorical variables using label enco...
FireQueen-3010/MainProject
script.py
script.py
py
2,244
python
en
code
0
github-code
6
17110435205
import tkinter from tkinter import * from PIL import ImageTk, Image # configure window root = Tk() windowColor = "#F2F2F2" root.geometry("827x1500") root.configure(bg = windowColor) root.title("Train Build") # create a container for canvas so window is scrollable # window is a frame inside canvas that is a contain...
masonknight22/CE596-RailroadAnalysisMockup
analysis p1.py
analysis p1.py
py
12,035
python
en
code
0
github-code
6
17970705274
#setuptools.setup is looking at one argv parameter; to "build" and "install": #python3 setup.py install #libtorrent from pypi has bindings and library now, before was: # python-libtorrent-bin is at extra require now, but, if was at install requires: # ok, package python-libtorrent-bin is old. install with pip instal...
colin-i/tora
setup.py
setup.py
py
1,548
python
en
code
2
github-code
6
74743639546
import logging logger = logging.getLogger('camelot.view.controls.formview') from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import Qt import sip from camelot.view.art import Icon from camelot.view.model_thread import post from camelot.view.model_thread import model_function from camelot.view.contr...
kurtraschke/camelot
camelot/view/controls/formview.py
formview.py
py
16,671
python
en
code
4
github-code
6
2128326759
from cumulusci.tasks.apex.anon import AnonymousApexTask from cumulusci.core.exceptions import TaskOptionsError import time class SetBDIMappingMode(AnonymousApexTask): """Change the mapping mode for NPSP BGE/BDI.""" task_docs = """ Use the 'mode' argument to specify either 'Help Text' or 'Data Import Field...
SalesforceFoundation/NPSP
tasks/set_BDI_mapping_mode.py
set_BDI_mapping_mode.py
py
2,760
python
en
code
609
github-code
6
36262108045
from collections import deque def solution(stats): queue = deque(stats) answer = [] while queue: x = queue.popleft() length = len(answer) if length < 1: answer.append([x]) else: max_index = -1 for i in range(length): if an...
hon99oo/PythonAlgorithmStudy
코테/스테이지파이브/solution2/solution.py
solution.py
py
636
python
en
code
0
github-code
6
33051867473
import numpy as np import cv2 import pickle import glob import matplotlib.pyplot as plt import os import Lane_find_functions as Lff import function_parameters as FP import time # video_name = 'test_video_4lanes_1.13.mp4' # image_folder = './Test_images/dashcam_driving/' # video_name = 'challenge_video_4lanes_1.8.mp4'...
Domagoj-Spoljar/-Python-Algoritam-Prepozunavanje-vozne-trake
frames_to_video_dynamic.py
frames_to_video_dynamic.py
py
3,245
python
en
code
0
github-code
6
18817086763
from gameObject import GameObject import pygame, time FALL_VELOCITY = (0, 3.9) NULL_VELOCITY = (0, 0) FLAPPING_VELOCITY = (0, -4.5) FLAPPING_MAX_TIME = 0.15 BIRD_RADIUS = 15 WINDOW_WIDTH = 480 COLOR_RED = (255, 0, 0) class Bird(GameObject): def __init__(self, x, y, color, brain): GameObject.__init__(sel...
JSMarrocco/JSMarrocco_PersonalRepository
NEAT_fluppy_bird/bird.py
bird.py
py
1,951
python
en
code
0
github-code
6
12608050279
# Train model import sys import time import numpy as np import torch.optim as optim import pickle import os import torch.utils.data import model as m import argparse if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument("--doc_len", type=int, default=300) p...
jingsliu/NLP_HW
HW1/code/eval.py
eval.py
py
2,761
python
en
code
0
github-code
6
21764027492
# Approach 1: Bit Manipulation # Time: O(n), n = no. of bits of the number # Space: O(1) class Solution: def minFlips(self, a: int, b: int, c: int) -> int: answer = 0 while a or b or c: if c & 1: answer += 0 if ((a & 1) or (b & 1)) else 1 else: ...
jimit105/leetcode-submissions
problems/minimum_flips_to_make_a_or_b_equal_to_c/solution.py
solution.py
py
434
python
en
code
0
github-code
6
69809361149
from turtle import Turtle class ScoreBoard(Turtle): def __init__(self): super().__init__() self.color("white") self.penup() self.hideturtle() self.left_score = 0 self.right_score = 0 self.update_scoreboard() def update_scoreboard(self): self.cle...
algebra2boy/pythonTheBest
Intermediate/Pong/scoreboard.py
scoreboard.py
py
948
python
en
code
1
github-code
6
6661767688
import random import cv2 import numpy as np import sys sys.path.insert(1, 'build/lib') from va_rs import augment original_cube = np.zeros((32, 32, 32), dtype=np.float32) original_cube[12:20, 12:20, 12:20] = 1.0 original_cube = original_cube[None, ...] linear_cube = original_cube.copy() nearest_cube = original_cube...
PUTvision/volume-augmentations
examples/augment.py
augment.py
py
913
python
en
code
0
github-code
6
36689627100
import sys import subprocess from PyQt5 import uic, QtCore from PyQt5.QtWidgets import QApplication, QMainWindow form_class = uic.loadUiType("./testBtn.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.testBtn.cl...
quswjdgns399/air_command
main_ui.py
main_ui.py
py
2,953
python
ko
code
0
github-code
6
14033064402
import matplotlib.pyplot as plt import xgboost as xgb import os from constants import * from time import gmtime, strftime from src.models.model_learner import ModelLearner from src.models.csv_handler import save_feature_importance_res class XgboostTrainObj(ModelLearner): def __init__(self,org_name): self...
EyalHadad/miRNA_transfer
src/models/training/xgboos_trainer.py
xgboos_trainer.py
py
2,852
python
en
code
0
github-code
6
19412698559
import json def create_row_w_validated_params(cls, validated_params, rqst_errors): found_rows_w_rqst_name = cls.check_for_rows_with_rqst_name( validated_params['name'], rqst_errors ) new_row = None if not found_rows_w_rqst_name and not rqst_errors: new_row = cls() new_...
bbcawodu/careadvisors-backend
picmodels/models/care_advisors/healthcare_service_expertise_models/services/create_update_delete.py
create_update_delete.py
py
2,368
python
en
code
0
github-code
6
42432440743
# MenuTitle: SVG Pen from fontTools.pens.basePen import BasePen # (C) 2016 by Jens Kutilek # https://raw.githubusercontent.com/jenskutilek/TypoLabs2016/master/penCollection/svgPen.py # See also: # http://www.w3.org/TR/SVG/paths.html#PathDataBNF # https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths # SVG...
jenskutilek/TypoLabs2016
penCollection/svgPen.py
svgPen.py
py
11,820
python
en
code
15
github-code
6
72334957309
#!/bin/python3 import math import os import random import re import sys # # Complete the 'diagonalDifference' function below. # # The function is expected to return an INTEGER. # The function accepts 2D_INTEGER_ARRAY arr as parameter. # def diagonalDifference(arr): # Write your code here prim_diag = 0 s...
ChitraVKumar/My-Algorithms-for-Leetcode
diaginal difference.py
diaginal difference.py
py
938
python
en
code
0
github-code
6
34632164463
import cv2 import numpy as py #检测拐角 #与边缘检测不同,拐角的检测的过程稍稍有些复杂 # 。但原理相同,所不同的是先用十字形的结构元素膨胀像素, # 这种情况下只会在边缘处“扩张”,角点不发生变化。 # 接着用菱形的结构元素腐蚀原图像, # 导致只有在拐角处才会“收缩”,而直线边缘都未发生变化。 image = cv2.imread('img\\building.jpg', 0) origin = cv2.imread('img\\building') #构造5 * 5的结构元素,分别为十字形/菱形/方形/X形 cross = cv2.getStructuringElement(cv2.MO...
liuyuhua-ha/opencvStudy
opencvStudy/checkFaceTest.py
checkFaceTest.py
py
1,754
python
zh
code
0
github-code
6
34453314320
import sys, os import requests from bs4 import BeautifulSoup # scraper library import pandas as pd # tables from collections import OrderedDict # Config base_page_url = 'https://www.teamrankings.com/ncaa-basketball/stat/' date_range = pd.date_range(pd.datetime(2018, 1, 1), periods=59).tolist() # dictionary: output_n...
bwu987/March-Madness-Crusher
scraper/scraper.py
scraper.py
py
3,218
python
en
code
0
github-code
6
8067752722
from django.shortcuts import render_to_response from curriculum.models import TipoProyecto from django.conf import settings # Create your views here. def home(request): menuInicio = 'selected' return render_to_response('default/index.html', {'menuInicio': menuInicio, 'settings': settings, }) def estudio...
sebasgoldberg/jsg
default/views.py
views.py
py
1,106
python
es
code
0
github-code
6
28753239359
def make_withdraw(balance): def withdraw(amount): if amount > balance: return "You cannot withdraw more than you have in your current balance." else: balance -= amount return balance return withdraw init_bal = 1000.00 wd = make_withdraw(init_bal) wd_amount = ...
matheuscfernandes/cs107_matheus_fernandes
homework/HW2/solutions/P3b.py
P3b.py
py
382
python
en
code
0
github-code
6
28102982969
from django.urls import path from .views import * from django.contrib.auth.views import LogoutView urlpatterns = [ path('aboutMe/', aboutMe, name="aboutMe"), path('routePages/',routePages,name="routePages"), path("routePages/<id>", routePagesId, name="routePagesId"), path('crearHistoria/',crearHistor...
ldcomba/ProyectoFinalComba_HistoriaMascotas
AppPages/urls.py
urls.py
py
1,924
python
es
code
0
github-code
6
4131930332
import random from game import Game, new_game, start_game from setup import setup_game def play_again(): answer: str = input("Would you like to play again?\n[Enter 'yes' or 'y' to play again.]\n").lower() return answer == "yes" or answer == "y" def get_wins(games: [Game]): wins = 0 for game in game...
GitsAndGlamour/Python-Uno
main.py
main.py
py
774
python
en
code
0
github-code
6
39350868195
# Задача 1 sales = {} for _ in range(int(input())): name, item, count = input().split() sales[name][item] = sales.setdefault(name, {}).setdefault(item, 0) + int(count) for key in sorted(sales): print(f'{key}:') for i in sorted(sales[key].items()): print(*i) # Задача2 countries = dict() country = in...
kotenak/etoshto
dopzadachi.py
dopzadachi.py
py
3,780
python
en
code
0
github-code
6
41210621290
""" Tipo de sugerencias """ FILE_REDUCE_SIZE = 100 FILE_CHANGE_FORMAT = 101 FILE_ADD_MIPMAPS = 102 FILE_REDUCE_RESOLUTION = 103 FILE_REMOVE_BUMPMAP = 104 FILE_REMOVE_ENVMAP = 105 """ Tipo de errores """ PARAMETER_NOT_ENDED = 200 PARAMETER_MULTIPLE = 201 PARAMETER_COMMENTED = 203 PARAMETER_UNKNOWN = 204 PARAM...
vicentefelipechile/vtfoptimizer
vtfmessages/messages.py
messages.py
py
500
python
en
code
0
github-code
6
33351213250
#imports from fltk import * from globals import * from GameWidget import * #--------------------------HEADER-------------------------- #This is the main script launcher of the program, controlling #the timeline and structure of the game. #The FRAMEWORK class handles scene management, switching from #main menu scr...
SubwayMan/FLTK-Platformer
src/fltkplatformer.py
fltkplatformer.py
py
10,121
python
en
code
5
github-code
6
10383049173
from typing import Dict import executorch.backends.qualcomm.python.PyQnnWrapperAdaptor as PyQnnWrapper import torch from .node_visitor import NodeVisitor, register_node_visitor from .qnn_constants import OpDequantize, QNN_OP_PACKAGE_NAME_QTI_AISW class DequantizeOpBase(NodeVisitor): def __init__(self, *args) -...
pytorch/executorch
backends/qualcomm/builders/op_dequantize.py
op_dequantize.py
py
2,130
python
en
code
479
github-code
6
644356051
from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView from .serializers import UserRegistrationSerializer class UserRegistrationView(APIView): """ API endpoint for user registration. """ def post(self, request): """ Han...
soovuh/military-collections-api
custom_auth/views.py
views.py
py
951
python
en
code
0
github-code
6
37368152653
from typing import List, Dict, Tuple, Any import numpy as np import pandas as pd import spacy import en_core_web_sm from spacy.matcher import Matcher from concept_processing.asp.asp_generator import ASPGenerator from concept_processing.asp.asp_solver import clingo_solve from concept_processing.asp.clingo_out_parsers...
CharlizeY/AI-thesis
concept_processing/extraction.py
extraction.py
py
9,204
python
en
code
0
github-code
6
35724557326
from django.shortcuts import render from social.apps.django_app.middleware import SocialAuthExceptionMiddleware from social import exceptions as social_exceptions class SocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware): def process_exception(self, request, exception): if hasattr(social_exceptio...
jasonwaters/fitcompetition
fitcompetition/middleware.py
middleware.py
py
592
python
en
code
7
github-code
6
26841047411
#学习连接多个字串 #任务1: 加入变量 desc = '我是一个大笨蛋' #任务2: 印出10次: 我是ON SIR教室学员007,我是一个大笨蛋 hero = '我' organization = 'ON SIR教室' identity = '学员' action = '是' ID = '007' print(hero+action+organization+identity+ID)
sendtowongsir/shl-python-learning
02_printString.py
02_printString.py
py
288
python
zh
code
0
github-code
6
17961314435
from pymavlink import mavutil from contextlib import nullcontext CONNECTION_STRING = "udpin:0.0.0.0:14550" DRONE_IDS = [3, 4] def wait_heartbeats_multi(connection): heartbeats = {id: False for id in DRONE_IDS} while not all(heartbeats.values()): msg = connection.recv_match(type="HEARTBEAT") i...
jath03/mavlink-testing
utils.py
utils.py
py
1,543
python
en
code
0
github-code
6
20288234307
# -*- coding: utf-8 -*- import re import sys from setuptools import setup from setuptools.command.test import test as TestCommand REQUIRES = [ 'docopt', 'argparse==1.2.1', 'requests==2.8.1', 'trello==0.9.1', 'wsgiref==0.1.2', ] class PyTest(TestCommand): def finalize_options(self): T...
cirinoalejandro/trello-to-text
setup.py
setup.py
py
2,304
python
en
code
4
github-code
6
31935770331
import pandas as pd import numpy as np import time import sys import matplotlib.pyplot as plt import matplotlib.patches as mpatches np.set_printoptions(threshold=sys.maxsize) df = pd.read_csv('contourQ3data.csv') Z = df.pivot_table(index='p1', columns='p3', values='vari').T.values X_unique = np.sort(df.p1....
isabelnic/Modelling-and-Visualisation
checkpoint 2/plot_contour_vari.py
plot_contour_vari.py
py
694
python
en
code
0
github-code
6
42618233661
import unittest from unittest.mock import patch from api.whois import whois_search class WhoisTestCase(unittest.TestCase): @patch('api.whois.pythonwhois') def test_whois_search(self, mock_pythonwhois): # Mock the pythonwhois response mock_pythonwhois.get_whois.return_value = {'registrant': 'Joh...
irfanirshad/flask-api
tests/test_whois.py
test_whois.py
py
576
python
en
code
1
github-code
6
73632775228
# dependencies module from crypt import methods import inspect, ctypes, os, socket from logging import shutdown import cv2 as CV from threading import Thread from dotenv import load_dotenv from flask import Flask, render_template, request, Response, make_response, jsonify from random import randint as rand from flask_s...
John11Dark/SecurityGuard
Assets/SVG/Smart_Car_Server/app.py
app.py
py
27,452
python
en
code
0
github-code
6
73751378748
import tkinter.ttk as ttk from tkinter import * import time root = Tk() root.title("my GUI") root.geometry("640x480") #progressbar = ttk.Progressbar(root, maximum= 100, mode="indeterminate") #progressbar = ttk.Progressbar(root, maximum= 100, mode="determinate") #milli sec #progressbar.start(10) #move per 10 milli...
Dohwee-Kim/image_merge_tool
gui_basic/reference_pys/9_progressbar.py
9_progressbar.py
py
849
python
en
code
0
github-code
6
71861354429
from collections import Counter from datetime import datetime # 示例数据 # 10折 1200 (0/1) 自己 # 10折 1200 VDMzZFF1T0hKdTRjaEJRMkV0N2xiZz09 (0/3) 舞***影(15***33) def extract_discount(share_str: str) -> int: return int(share_str.split(" ")[0][:-1]) def extract_price(share_str: str) -> int: return int(share_str.spli...
fzls/djc_helper
process_my_home.py
process_my_home.py
py
2,004
python
en
code
319
github-code
6
19124946617
from crash.stacktrace import StackFrame from crash.suspect import Suspect from crash.scorers import aggregators from crash.scorers.min_distance import MinDistance from crash.scorers.test.scorer_test_suite import ScorerTestSuite from crash.scorers.top_frame_index import TopFrameIndex class AggregatorsTest(ScorerTestSu...
mithro/chromium-infra
appengine/findit/crash/scorers/test/aggregators_test.py
aggregators_test.py
py
1,634
python
en
code
0
github-code
6
26825006942
from __future__ import annotations import pickle # nosec import struct from typing import Final, Optional from ..packet import Packet from ..sign import Signatures __all__ = ['UdpPack'] _prefix = struct.Struct('!BBI') class UdpPack: """Packs and unpacks SWIM protocol :class:`~swimprotocol.packet.Packet` ...
icgood/swim-protocol
swimprotocol/udp/pack.py
pack.py
py
4,184
python
en
code
6
github-code
6
36546618587
import sys, getopt import collections def main(argv): inputFile = '' try: opts, args = getopt.getopt(argv, 'hi:') except getopt.GetoptError: print('test.py -i <inputfile>') sys.exit(2) for opt, arg in opts: if opt == '-h': print('test.py -i <inputfile>') ...
Cranzai/AdventofCode
2021/day08/python/day8.py
day8.py
py
3,788
python
en
code
0
github-code
6
20105435432
import ConfigParser, logging, datetime, os, json from flask import Flask, render_template, request import mediacloud CONFIG_FILE = 'settings.config' basedir = os.path.dirname(os.path.realpath(__file__)) # load the settings file config = ConfigParser.ConfigParser() config.read(os.path.join(basedir, 'settings.config'...
freeeal/MAS.500
hw3/mcserver.py
mcserver.py
py
2,145
python
en
code
0
github-code
6
41675609350
# 덧셈하여 타겟을 만들 수 있는 배열의 두 숫자 인덱스를 리턴하라. nums = [2, 7, 11, 15] target = 9 # 브루투포스 def way1(nums: list[int], target: int) -> tuple[int]: for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return i, j # in을 이용한 탐색 def way2(nums: list[in...
jisupark123/Python-Coding-Test
study/두 수의 합.py
두 수의 합.py
py
2,101
python
ko
code
1
github-code
6
29827009348
import string from os.path import exists import pandas as pd from datetime import datetime from random import shuffle import numpy as np if exists('D:\GRE\my word list\words.csv'): df = pd.read_csv('D:\GRE\my word list\words.csv') wordcount = df.shape[0] else: df = pd.DataFrame(columns = ['word'...
Geeks-Sid/GRE-word-game
play.py
play.py
py
5,044
python
en
code
0
github-code
6
33806961121
class test: q: int w: int def __init__(self, q, w) -> None: self.q = q self.w = w w = test(1,2) w.w = 3 print(w.w) class test_2: q: int w: int def __init__(self, q, w) -> None: self.q = q self.w = w e = test_2(1,2) print(e.w)
ndimqa/ElfBarBot
test.py
test.py
py
286
python
en
code
1
github-code
6
37858257254
#using a shallow net(2 layers) #not tested import numpy as np import matplotlib.pyplot as plt import sklearn import sklearn.datasets import sklearn.linear_model from utils import load_dataset #loading the dataset using utils x,y = load_dataset() shape_x = x.shape shape_y = y.shape m = shape_x[1] #first trying to fit ...
thepavankoushik/Project-Reboot
shallow networks/planardata_classify.py
planardata_classify.py
py
2,445
python
en
code
0
github-code
6
15430713008
class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ c = 0 l = len(nums) index =[] t =0 while c <l: #print(nums[i]) if nums[t] == 0...
dipalira/LeetCode
Arrays/283_Move_Zeroes.py
283_Move_Zeroes.py
py
465
python
en
code
0
github-code
6
72789776189
import gc import itertools as it import os.path as osp from typing import List import warnings from collections import deque, namedtuple import numpy as np import torch from examples.speech_recognition.data.replabels import unpack_replabels from fairseq import tasks from fairseq.utils import apply_to_sample from omega...
lovemefan/Wav2vec2-webserver
fairseq_lib/examples/speech_recognition/w2l_decoder.py
w2l_decoder.py
py
2,977
python
en
code
1
github-code
6
7122911694
from django.conf.urls import url from one import views from one.views import CreateStudent urlpatterns = [ url(r'^index/', views.index), url(r'^print/',views.PrintTable,name='print'), url(r'^studentname/(\d+)/',views.stuname,name='studentname'), url(r'^detail/',views.detail,name='detail'), url(r'^C...
lao1a0/Django-1
one/urls.py
urls.py
py
385
python
en
code
0
github-code
6
30793136225
import tkinter window = tkinter.Tk() window.title("Buttons in tkinter") window.minsize(width=500,height=300) # Label my_label = tkinter.Label(text="I am a Label", font=("Arial", 24, "bold")) # places the label on to the screen and automatically centers it my_label.pack() # configure or updating the properties of pa...
shrijanlakhey/100-days-of-Python
027/buttons_in_tkinter.py
buttons_in_tkinter.py
py
735
python
en
code
0
github-code
6
27314665022
''' Crie um programa onde o usuário possa digitar sete valores númericos e cadastre-os em uma única lista que mantenha separados os valores pares e ímpares. No final, mostre os valores pares e ímpares em ordem crescente. ''' lista = [[], []] num = int(input('Quantos valores deseja d...
alelimasilva/Exercicios-em-Python
ex036.py
ex036.py
py
690
python
pt
code
0
github-code
6
38930719861
#!/usr/bin/python3 """ Python script that takes GitHub credentials (username and password) and uses the GitHub API to display id """ import requests import sys if __name__ == '__main__': if len(sys.argv) != 3: print("Usage: ./10-my_github.py <username> <token>") sys.exit(1) username, t...
Bellamalwa/alx-higher_level_programming
0x11-python-network_1/10-my_github.py
10-my_github.py
py
851
python
en
code
0
github-code
6
41464656819
#! python3 # -*- coding: utf-8 -*- import datetime start_bench_no_bench = datetime.datetime.now() __version__ = "8.2.8-alpha" import os import sys import copy import platform import pkgutil FRACKING_INPUT_DEBUG = False # todo version diff # todo export script as json? # todo compare jsons? # tod...
egigoka/test
acl_edit/commands8.py
commands8.py
py
50,047
python
en
code
2
github-code
6
11845591367
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os, json, subprocess from tempfile import NamedTemporaryFile cur_dir = os.path.dirname(os.path.abspath(__file__)) file_path = cur_dir + "/../eval_video.py" def run_and_check_result(cmd): cmd_result = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, s...
OpenNetLab/Challenge-Environment
metrics/tests/test_eval_video.py
test_eval_video.py
py
2,516
python
en
code
8
github-code
6
17384594576
import os import pandas as pd import numpy as np # set default data path methode def get_data_path(): if os.path.isdir(os.path.join(os.getcwd(), 'data')): return os.path.join(os.getcwd(), 'data') elif os.path.isdir(os.path.join(os.getcwd(), "../data")): return os.path.join(os.getcwd(), ".....
gassnerm/PDS_Project
PDS_Project_nextbike/io/utils.py
utils.py
py
6,862
python
en
code
null
github-code
6
39475022455
# coding: utf-8 import os class QuestionList(object) : __verbs = [] __index = 0 def __init__(self) : question_file = os.path.dirname(os.path.realpath(__file__)) +\ '/questions.20181214.txt' with open(question_file, 'r') as fh : line = fh.read() ...
zhang8929/zhangyuguang
NLP/database/questions.py
questions.py
py
674
python
en
code
0
github-code
6
23972767732
#!/usr/bin/env python3 import rospy import tf2_ros from tf.transformations import * from geometry_msgs.msg import Vector3Stamped, QuaternionStamped, TransformStamped, Quaternion, Vector3 from sensor_msgs.msg import Imu from std_msgs.msg import Float64 from utils import * import numpy as np import threading import time ...
silverjoda/buggycontrol
src/nodes/imu_odom_bagfile_to_dict_converter.py
imu_odom_bagfile_to_dict_converter.py
py
2,714
python
en
code
null
github-code
6
11120983307
import abc import typing as tp from librarius.domain.messages import ( TAbstractMessage, TAbstractCommand, TAbstractQuery, TAbstractEvent, ) if tp.TYPE_CHECKING: from librarius.domain.messages import AbstractCommand, AbstractQuery, AbstractEvent from librarius.domain.models import Entity fr...
adriangabura/vega
librarius/service/handlers/abstract.py
abstract.py
py
1,538
python
en
code
1
github-code
6
22291138485
import re import requests from bs4 import BeautifulSoup def scrape_page_title(soup): """ Function to extract the title of an article from the scrapped code """ title = soup.find('h1', class_='content__headline').get_text() title = re.sub('\n', '', title) return title def scrape_page_topic(soup): ...
mcmxlix/the_guardian_crawler
Crawler/scrape_infos.py
scrape_infos.py
py
2,969
python
en
code
1
github-code
6
72683633467
from matplotlib import pyplot as plt if __name__ == '__main__': slope = 0.0008588 y_intercept = -0.1702 rainfall_values = [50 * x for x in range(0, 18)] y = [max(slope * x + y_intercept, 0) for x in rainfall_values] plt.title('Bifurcation diagram of Scanlon model') plt.xlabel('Rainfall (...
tee-lab/patchy-ecosterics
thesis_code/scanlon_transitions/phase_transition.py
phase_transition.py
py
498
python
en
code
2
github-code
6
13480667519
import requests, os, json from flask import Flask, render_template, redirect, url_for, request from dotenv import load_dotenv from anvil import Anvil, User load_dotenv() app = Flask(__name__) anvil = Anvil() user = anvil.load_user() worlds = anvil.load_worlds(user) anvil.current_world = worlds[0] @app.route('/', met...
oaster2000/NPC-Writer
app.py
app.py
py
898
python
en
code
0
github-code
6
11495041377
import socket import re def is_valid_ip_address(ip_address): pattern = re.compile(r'^(\d{1,3}\.){3}\d{1,3}$') return bool(pattern.match(ip_address)) HOST = '' PORT = 5000 # Arbitrary non-privileged port server_socket = None while True: while True: print("Please enter in address to bind to",en...
Schlitzohr101/pythonEchoServer
python_server.py
python_server.py
py
1,700
python
en
code
0
github-code
6
75126801467
from model.upload import Upload from aws.s3_wrapper import S3Wrapper def lambda_handler(event: dict, _) -> str: """ Called by AWS lambda """ try: upload = Upload(event.get('from_url'), event.get('to_path')) s3Wrapper = S3Wrapper() s3Wrapper.uploadFromUrl(upload.from_url, upload...
nxn128/serverless-query
src/smallquery/functions/upload_data/app.py
app.py
py
446
python
en
code
0
github-code
6
37219263893
from typing import List, Dict import csv def get_unique_industries(path: str) -> List[str]: with open(path, mode="r") as file: data_file = csv.DictReader(file) list_data_file = [] for data in data_file: list_data_file.append(data) industries = set([industry['industry'] ...
Gilson-SR/job-insights
src/insights/industries.py
industries.py
py
684
python
en
code
0
github-code
6
71184192189
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from multiprocessing import cpu_count from eventlet import monkey_patch from eventlet.greenpool import GreenPool from contextlib import closing monkey_patch() import requests try: reques...
ddboline/programming_tests
python/stock_parser_greenpool.py
stock_parser_greenpool.py
py
1,591
python
en
code
0
github-code
6
35042464781
from re import A import time from numpy import result_type st = time.time() #a, b, c = map(int, input().split()) #a, b = map(int, sys.stdin.readline().rstrip().split()) from collections import Counter import math import itertools import sys n = int(sys.stdin.readline().rstrip()) people = [] resu...
lpigeon/BOJ
7568.py
7568.py
py
720
python
en
code
2
github-code
6
28237496421
#!/usr/bin/python from copy import deepcopy from fodft_tools import * import argparse import os import sys, traceback from ase import Atoms spec_path = "/data/schober/code/fhiaims_develop/fhiaims_supporting_work/species_defaults/" aims_params = { "xc" : "blyp", "spin" : "collinear", ...
schober-ch/fodft_tools
fodft.py
fodft.py
py
6,769
python
en
code
0
github-code
6
5131582706
from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): ADMIN = 'admin' MODERATOR = 'moderator' USER = 'user' USER_ROLE_CHOICES = [ (ADMIN, 'admin'), (MODERATOR, 'moderator'), (USER, 'user'), ] confirmation_code = mode...
Toksi86/yamdb_final
api_yamdb/users/models.py
models.py
py
1,428
python
en
code
0
github-code
6
7153685231
# solarmap.py import collections import heapq class SolarSystem: """ Solar system handler """ def __init__(self, key): self.id = key self.connected_to = {} def add_neighbor(self, neighbor, weight): self.connected_to[neighbor] = weight def get_connections(self): ...
farshield/shortcircuit
src/shortcircuit/model/solarmap.py
solarmap.py
py
8,726
python
en
code
56
github-code
6
33280054752
# %% import numpy as np import pandas as pd import datetime as dt #from cohorts_pipeline_woof_v4 import df_cleaning #from cohorts_pipeline_woof_v4 import cohorts_pipeline import mysql.connector from mysql.connector import Error # %% #df_og = pd.read_csv('./Data/orders.csv', sep=';', decimal=',') query_orders = 'SELECT ...
rahichan/angela_legacy
WOOOF/WOOOF_COHORTS_BUILDER.py
WOOOF_COHORTS_BUILDER.py
py
3,732
python
en
code
0
github-code
6
34354801205
import pickle # Load the Q-table from the pickle file with open("./agent_code/qagent/q_table.pickle", "rb") as file: q_table = pickle.load(file) # Print the Q-table for state, action_values in q_table.items(): print(f"State: {state}") for action, q_value in action_values.items(): print(f" Action:...
miri-stack/bomberman
agent_code/qagent/checks.py
checks.py
py
352
python
en
code
0
github-code
6
30477959760
# Create Tree from Level Order Traversal import queue class Node: def __init__(self, data): self.data = data self.left = None self.right = None def __repr__(self): return f"Node({self.data})" def buildFromLevelOrder(): data = int(input("Enter the data for root node ...
prabhat-gp/GFG
Binary Trees/Love Babbar/4_create_tree_level_order.py
4_create_tree_level_order.py
py
1,484
python
en
code
0
github-code
6
20477618446
from typing import List, Optional, Union def _make_mrkdown_block(mrkdown: str): """ Wraps the mrkdown in a block kit block. """ return { "type": "section", "text": { "type": "mrkdwn", "text": mrkdown, }, } def _make_header_block(heading: str): ...
henryivesjones/slash-slack
slash_slack/blocks.py
blocks.py
py
1,823
python
en
code
2
github-code
6
37975869389
''' Get completed data as Dataframe for charts Calls to MongoDB for data Test data is a separate module ''' from datetime import datetime session = {'defaults':{'trial':{"id":123, 'start_date':datetime.now().timestamp-(30*24*60*60)}}} from test_data import get_test_data from chart_frame import three_column_frame test...
webbhm/MARSFarm-web_VX
gbet_charts/functions/hold/chart_data.py
chart_data.py
py
1,935
python
en
code
0
github-code
6
37301779528
n=int(input("n= ")) i=2 k=666 while i<n: if n%i!=0: k=1 else: k=0 break i+=1 if k==1: print("Число просте") else: print("Число не просте")
oly17/-
лб 1 1/2 завдан.py
2 завдан.py
py
211
python
ru
code
0
github-code
6
10887485994
def sekvencijalna_pretraga(niz, element): if(len(niz) == 0): return print("Niz je prazan.") for i in range(0, len(niz)): if(niz[i] == element): print("Element je pronadjen. Prva pojava elementa je na indeksu:", i) return element print("Trazeni element nije pronadjen."...
marko-smiljanic/vezbanje-strukture-podataka
vezbanje-strukture-podataka/Domaci-PREDAVANJA/domaci4_pretrage/test_search.py
test_search.py
py
1,115
python
sr
code
0
github-code
6
36646568157
"""Evaluate explanation technique on the CLEVR XAI dataset. This module computes the saliency maps for the relation network and evaluates how well the explanation technique matches the ground truth heatmaps. """ # from lrp_relations import enable_deterministic # noqa isort:skip import dataclasses import pickle from...
berleon/A-Rigorous-Study-Of-The-Deep-Taylor-Decomposition
lrp_relations/gt_eval.py
gt_eval.py
py
8,038
python
en
code
5
github-code
6
24199854767
# -*- coding: utf-8 -*- """ Created on Sun Jun 23 09:56:39 2019 @author: Administrator """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def rotateRight(self, head: ListNode, k: int) -> ListNode: if no...
AiZhanghan/Leetcode
code/61. Rotate List.py
61. Rotate List.py
py
836
python
en
code
0
github-code
6
2169470310
import psycopg from matplotlib import pyplot as plt import numpy as np import datetime DB_NAME = "########" DB_USER = "########" DB_PASSWORD = "########" conn = psycopg.connect( dbname=DB_NAME, user=DB_USER, password=DB_PASSWORD) def LoadQuery(fileName): return open(f"tools/...
AS2/habrolink
tools/Analitics/test_register_karma_hist.py
test_register_karma_hist.py
py
2,940
python
en
code
0
github-code
6
71192689147
import tensorflow.examples.tutorials.mnist.input_data as input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) ########################################模型构建#################################### # 导入tensorflow import tensorflow as tf test_images=mnist.test.images; test_labels=mnist.test.labels; ...
lyx997/Python-learning
softmax + CNN/ceshi.py
ceshi.py
py
3,894
python
zh
code
0
github-code
6
42483897749
import networkx as nx def hierarchical_layout(G: nx.Graph) -> tuple: """Function to create dictionary with positions of nodes with hierarchical arrangement. Paramaters: ----------- G: nx.Graph NetworkX Graph object Returns: (int, int, dict) Tuple with canvas size for the ...
diegopintossi/graph_network
custom_hierarchical_layout.py
custom_hierarchical_layout.py
py
6,468
python
en
code
0
github-code
6
22759981162
from fastapi import FastAPI from fastapi.exceptions import RequestValidationError from starlette.requests import Request from starlette.responses import JSONResponse from app import config as settings from app.api.dependency import init_model from app.api.v1.endpoint import router from app.exceptions import APIExcepti...
SW13-Monstera/AI-server
app/main.py
main.py
py
1,277
python
en
code
5
github-code
6
17510462413
''' start: 1:29pm end: 1:40pm nums 2 ways: 1st way: -sort it -and then use 2 pointers from opposite sides to find the twosum hitting target -complexity: O(n lg n). S: O(n). timsort 2nd way: run trhough the nums, if target - val is in lookup. return val and target - val T: O(n). S: O(n) constraints: ''' class Solut...
soji-omiwade/cs
dsa/before_rubrik/twosum_20210627.py
twosum_20210627.py
py
577
python
en
code
0
github-code
6
6767301700
import json from flask import Flask, request, Response app = Flask(__name__) required_fields = ['title', 'topics', 'ownerId', 'locationString'] tables = [ { "tableId": 1, "title": "TableC @ BostonHacks", "topics": ["#masseffect", "#typescript", "#rickandmorty"], "ownerId": 42, ...
shawnrc/hackascraps_bu17
dummy_api.py
dummy_api.py
py
1,198
python
en
code
0
github-code
6
30763371491
# -*- coding: utf-8 -*- """ Created on Mon Nov 28 13:39:19 2016 @author: Shahidur Rahman """ #import numpy as np; #list declaration #a_list = [] #b_list = [] #numpy array declaration #left = np.array([]) #right = np.array([]) #convert the list to numpy array #a = np.array(a_list) #b = np.array(b...
skshahidur/nlp_paper_implementation
Word-Embedding/mwt.py
mwt.py
py
2,843
python
en
code
0
github-code
6
22218957716
from director.consoleapp import ConsoleApp from director import mainwindowapp from director import affordancemanager from director import affordanceitems from director import affordanceurdf from director import affordancepanel from director import objectmodel as om from director import visualization as vis from directo...
RobotLocomotion/director
src/python/tests/testAffordancePanel.py
testAffordancePanel.py
py
3,734
python
en
code
176
github-code
6
20420593181
from confluent_kafka.admin import AdminClient, NewTopic topic = 'Kafka_Image_Processing' client_id = "admin_hagar" conf = {'bootstrap.servers': "34.70.120.136:9094,35.202.98.23:9094,34.133.105.230:9094", 'client.id': client_id} ac = AdminClient(conf) res = ac.create_topics([NewTopic(topic, num_parti...
HagarIbrahiem/Kafka_ImgProcessing
admin.py
admin.py
py
373
python
en
code
0
github-code
6
72650319227
# # @lc app=leetcode id=455 lang=python3 # # [455] Assign Cookies # # @lc code=start class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: i = 1 j = 1 k = 0 g.sort() s.sort() while i <= len(g) and j <= len(s): if g[-i] <= s[-j]...
hieun314/leetcode_NguyenKimHieu
455.assign-cookies.py
455.assign-cookies.py
py
428
python
en
code
0
github-code
6
21725267349
#PYthon program to find largest number using the array elements def biggestNumber(array, length): extval, ans=[],"" l = len(str(max(array))) + 1 for i in array: temp = str(i) * l; extval.append((temp[:l:], i)) extval.sort(reverse=True) for i in extval: ans += str(i[1]) ...
ItsSamarth/ds-python
DataStructures/array/biggestNumber.py
biggestNumber.py
py
415
python
en
code
0
github-code
6