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
19483582203
import socket import hashlib """ data, addr = cli_socket.recvfrom(4096) print("Server Says") print(str(data)) cli_socket.close() """ cli_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) msg = "Hello" cli_socket.sendto(msg.encode("utf-8"), ('127.0.0.1', 12345)) data,addr = cli_socket.recvfrom(1024) numero_conex...
rodrigo0097/servidorUDP_redes
UDPClient.py
UDPClient.py
py
1,614
python
es
code
0
github-code
36
2036516482
import os import pathlib import argparse import uuid import logging import subprocess from nuvoloso.dependencies.install_packages import InstallPackages from nuvoloso.dependencies.kops_cluster import KopsCluster from nuvoloso.dependencies.kubectl_helper import KubectlHelper from nuvoloso.api.nuvo_management import Nu...
Nuvoloso/testing_open_source
testingtools/deploy_app_cluster.py
deploy_app_cluster.py
py
6,776
python
en
code
0
github-code
36
70463664104
from generators import display_grid, clear from turn_handler import cpu_turn, player_turn from file_handlers import save_game, clear_save_data def game_loop(board_size, player_ships, player_attack, cpu_ships, cpu_attack, player_ship_count, cpu_ship_count, consecutive_hits, rounds): """ Run the m...
DeeK-Dev/Battleship
game_loop.py
game_loop.py
py
2,914
python
en
code
0
github-code
36
73969956584
import numpy as np from onerl.utils.import_module import get_class_from_str from onerl.nodes.node import Node from onerl.utils.shared_array import SharedArray from onerl.utils.batch.shared import BatchShared class EnvNode(Node): @staticmethod def node_preprocess_ns_config(node_class: str, num: int, ns_config...
imoneoi/onerl
onerl/nodes/env_node.py
env_node.py
py
5,191
python
en
code
16
github-code
36
28890288771
"""Constructs related to type annotations.""" import dataclasses import logging import typing from typing import Mapping, Optional, Set, Tuple, Type, Union as _Union from pytype import datatypes from pytype.abstract import _base from pytype.abstract import _classes from pytype.abstract import _instance_base from pyty...
google/pytype
pytype/abstract/_typing.py
_typing.py
py
31,975
python
en
code
4,405
github-code
36
16152684320
class ArrayOperations: def getArray(self): global size arr=[] for i in range(size): print("Enter array number ",i+1) temp=[] for j in range(size): temp.append(int(input("Enter each element followed by the return key"))) arr.appe...
siva5271/week3_assignments
q19.py
q19.py
py
925
python
en
code
0
github-code
36
74330831463
from Components.config import config from Components.ActionMap import ActionMap from Components.Label import Label from Components.Pixmap import Pixmap from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Tools.Log import Log from Tools.LoadPixmap import LoadPixmap from Tools.Directories ...
opendreambox/enigma2
usr/lib/enigma2/python/Plugins/SystemPlugins/RemoteControlSelection/plugin.py
plugin.py
py
2,851
python
en
code
1
github-code
36
4778562539
from typing import Optional, Tuple, Union import paddle import paddle.nn.functional as F def cast_if_needed(tensor: Union[paddle.Tensor, None], dtype: paddle.dtype) -> Union[paddle.Tensor, None]: """Cast tensor to dtype""" return tensor if tensor is None or tensor.dtype == dtype else paddl...
NVIDIA/TransformerEngine
transformer_engine/paddle/utils.py
utils.py
py
4,609
python
en
code
1,056
github-code
36
27890676766
# -*- coding: utf-8 -*- import tensorflow as tf import tensorflow.examples.tutorials.mnist.input_data as input_data import pdb def weight_variable(shape): "初始化权重" initial = tf.truncated_normal(shape,stddev=0.1) return tf.Variable(initial) def bias_variable(shape): "初始化偏置项" initial = tf.constant...
RyanWangZf/Tensorflow_Tutorial
Others/simple_CNN.py
simple_CNN.py
py
2,840
python
en
code
0
github-code
36
71930911465
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 5 20:17:37 2017 @author: afranio """ import numpy as np import matplotlib.pyplot as plt # dados experimentais # benzeno - pressao de vapor X temperatura P = np.array([ 1, 5, 10, 20, 40, 60, 100, 200, 400, 760]) # mmH...
afraniomelo/curso-matlab
codigos/python/ajuste_polinomio.py
ajuste_polinomio.py
py
887
python
pt
code
0
github-code
36
1408640826
import sys import csv csv_file_name = sys.argv[1] # Name of the file to parse column_table_index = sys.argv[2] # The column which should be used as an index column_table_index_base = int(sys.argv[3]) # The base of that column (i.e. base 16, base 10, base 2) expressed in base 10 column_table_value = sys.argv[4] # The c...
awewsomegamer/PyotorComputer
tools/csv2array.py
csv2array.py
py
1,855
python
en
code
2
github-code
36
70631449384
from unittest import TestCase from set_matrix_zeroes import Solution class TestSolution(TestCase): def test_set_zeroes(self): inputs = ( [[1, 1, 1], [1, 0, 1], [1, 1, 1]], [[0, 1, 2, 0], [3, 4, 5, 2], [1, 3, 1, 5]] ) outs = ( [[1, 0, 1], [0, 0, 0], [1, 0...
sswest/leetcode
73_set_matrix_zeroes/test_set_matrix_zeroes.py
test_set_matrix_zeroes.py
py
512
python
en
code
0
github-code
36
12526381398
from PIL import ImageGrab,Image import pytesseract def yz_code(): # bbox = (1348, 423, 1455, 455) # 截图范围,这个取决你验证码的位置 # img = ImageGrab.grab(bbox=bbox) # img.save("D:\\py\\login\\image_code.jpg") # 设置路径 # img.show() img = Image.open('img5.bmp') # PIL库加载图片 # print img.format, img.size, img....
SuneastChen/other_python_demo
其他实例/验证码识别/图片处理1_pytesseract识别.py
图片处理1_pytesseract识别.py
py
1,285
python
en
code
0
github-code
36
26498800829
import requests import json import numpy as np import cv2 import os from tqdm import tqdm def crop_receipt(raw_img): """Crop receipt from a raw image captured by phone Args: raw_img ([np.array]): Raw image containing receipt Returns: cropped_receipt ([np.array]): The image of cropped rece...
tiendv/MCOCR2021
Task1/cropper.py
cropper.py
py
1,516
python
en
code
9
github-code
36
73060543145
from tutelary.models import ( PermissionSet, Policy, PolicyInstance ) from django.contrib.auth.models import User import pytest from .factories import UserFactory, PolicyFactory from .datadir import datadir # noqa from .settings import DEBUG @pytest.fixture(scope="function") # noqa def setup(datadir, db): u...
Cadasta/django-tutelary
tests/test_integrity.py
test_integrity.py
py
4,068
python
en
code
6
github-code
36
71202438503
# -*- coding: utf-8 -*- # @Author: Luis Condados # @Date: 2023-09-09 18:46:06 # @Last Modified by: Luis Condados # @Last Modified time: 2023-09-16 18:33:43 import fiftyone as fo import fiftyone.zoo as foz import fiftyone.brain as fob from sklearn.cluster import KMeans import click import logging logging.basicCo...
Gabriellgpc/exploratory_image_data_analysis
workspace/demo.py
demo.py
py
2,617
python
en
code
0
github-code
36
22833245357
import math def isPrime(n): i = 2 while(i<=math.sqrt(n)): if(n%i==0): return False else: i += 1 return True def sieve(n): p_n = {} for i in range(2,n): p_n[i] = True for j in range(2,n): if p_n[j] == True: for a in range(2*j,n...
joshuanazareth97/Project-Euler
Prime.py
Prime.py
py
788
python
en
code
0
github-code
36
73485134183
# https://programmers.co.kr/learn/courses/30/lessons/42897 def solution(money): stole0_pprev = stole0_prev = money[0] stole1_pprev, stole1_prev = 0, money[1] for m in money[2:]: stole0_pprev, stole0_prev = stole0_prev, max(stole0_prev, stole0_pprev + m) stole1_pprev, stole1_prev = stole1_pr...
lexiconium/algorithms
programmers/dp/theft_light.py
theft_light.py
py
405
python
en
code
0
github-code
36
73050884903
""".....""" brick_height = int(input('brick_height = ')) brick_width = int(input('brick_width = ')) brick_depth = int(input('brick_depth = ')) hole_height = int(input('hole_height = ')) hole_width = int(input('hole_width = ')) # Find two minimum dimensions of the hole hole_min_0 = min(hole_width, hole_height) hole_min...
ave2407/CourseraPythonProjects
week2/if/if_castle.py
if_castle.py
py
1,102
python
en
code
0
github-code
36
8694387627
import pandas as pd import numpy as np import os from datetime import timedelta import math pd.set_option('display.width', 1200) pd.set_option('precision', 3) np.set_printoptions(precision=3) np.set_printoptions(threshold=np.nan) class Config: __instance = None def __new__(cls, *args, **kwargs): if c...
cheersyouran/simi-search
codes/config.py
config.py
py
3,162
python
en
code
10
github-code
36
6084442031
# Binary Tree class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insert(self, data): # check if tree is null if self.data: # check 2 conditions: self.data > data or < data if self.data > data: ...
phuclinh9802/data_structures_algorithms
chapter 4/tree/tree.py
tree.py
py
7,056
python
en
code
0
github-code
36
71408403945
""" The simple neural model definitions. """ from __future__ import absolute_import, division, print_function import numpy as np import tensorflow as tf def neural_net(x, layers, keep_prob, weight_decay): y = tf.contrib.layers.flatten(x) embedding_layer = None for i, layer in enumerate(layers[:-1]): ...
b3nk4n/tensorflow-handwriting-demo
tensorflow/models.py
models.py
py
1,678
python
en
code
0
github-code
36
12573596280
def reversewords(s): container = [] s = s.split(" ") z = "" for x in s: container.append(x) container = container[::-1] for x in range(0,len(container)): z += str(container[x]) z += " " return z print(reversewords("Hello this is max"))
AG-Systems/programming-problems
other/reversewordsinstring.py
reversewordsinstring.py
py
289
python
en
code
10
github-code
36
32688598523
""" DjikistraAlgorithm """ import math from random import randint class DjikistraAlgorithm(): """ class DjikistraAlgorithm create minimum spanning tree path """ def __init__(self): self.matrix=[] self.vertex='' self.num_vertices=self.input_vertex() self.create_matrix...
bl94/djikistra_algorithm
djikistra_algorithm.py
djikistra_algorithm.py
py
3,716
python
en
code
0
github-code
36
73200838504
# -*- coding: utf-8 -*- """ Created on Thu Jul 11 14:15:46 2019 @author: danie """ import geopandas as gpd import pandas as pd from shapely.geometry import LineString, Point import os import re import numpy as np import hkvsobekpy as his import csv #%% def __between(value, a, b): # Find and validate before-part....
d2hydro/sobek_kisters
sobek/read.py
read.py
py
20,927
python
en
code
0
github-code
36
16076269490
from cliente import Cliente from AVL_tree import AVLTree from merge_sort import merge if __name__ == "__main__": tree = AVLTree() clientes = [ Cliente("João Silva", "1990-05-15", "123-4567", "joao@gmail.com", "Rua A, Bairro X, Cidade Y", "11111111111"), Cliente("Maria Santos", "1985-08-20", "9...
shDupont/pythonProject
main.py
main.py
py
6,219
python
pt
code
1
github-code
36
28184080541
#### @author Arda Göktaş #### @version 3.11 #### @since 13.12.2022 ### @Purposes It exists to send questions and answers in a certain category as an object to the front-end. class QuizViewSet(viewsets.ModelViewSet): ### to see all the questions in a category queryset = Quiz.objects.all() ##Retrieves all the qu...
SU-CS308-22FA/Team17-backend
Code Documentation/Code Documentation for py.py
Code Documentation for py.py
py
1,768
python
en
code
0
github-code
36
17613399951
# https://leetcode-cn.com/problems/permutations/ class Solution: def permute(self, nums: List[int]) -> List[List[int]]: result = [] def backtrace(use_list: List[int], tmp: List[int]): if len(tmp) == len(nums): result.append(tmp) return ...
xy-hong/codeSnippet
src/python/permutations.py
permutations.py
py
511
python
en
code
0
github-code
36
2722176063
class Solution(object): def updateMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: List[List[int]] """ cols = len(matrix[0]) rows = len(matrix) q = [] dist = [ [float('inf') for _ in range(cols)] for _ in range(rows)] # initia...
ZhengLiangliang1996/Leetcode_ML_Daily
Search/542_BFS_01Matrix.py
542_BFS_01Matrix.py
py
1,085
python
en
code
1
github-code
36
14640804692
import logging import logging.handlers from flask import Flask, render_template, redirect, request from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user from forms import LoginForm, PaymentForm, PasswordForm, OccalcForm, ApikeyForm...
realname0000/torn_game_metrics
flask_graph_work/app.py
app.py
py
84,701
python
en
code
0
github-code
36
28985781241
from collections import Counter from typing import Generator, Iterable, Literal, Set import click import trimesh.creation from aoc_2022_kws.cli import main from aoc_2022_kws.config import config from trimesh import transformations class Facet: def __init__( self, axis: Literal["x", "y", "z"], x: int, y: ...
SocialFinanceDigitalLabs/AdventOfCode
solutions/2022/kws/aoc_2022_kws/day_18.py
day_18.py
py
5,002
python
en
code
2
github-code
36
73659014184
from django.shortcuts import render, redirect, HttpResponse from django.contrib import messages from login.models import User from .models import Quote # Create your views here. def quotes(request): if 'user_id' not in request.session: return redirect('/') all_users = User.objects.all() user =...
everhartC/QuoteDash
quoteApp/views.py
views.py
py
1,807
python
en
code
0
github-code
36
13859467294
import xml.etree.ElementTree as ET import json path_train = "D:/code/prompt-ABSA/dataset/original data/ABSA16_Laptops_Train_SB1_v2.xml" path_test = 'D:/code/prompt-ABSA/dataset/original data/EN_LAPT_SB1_TEST_.xml' terr = 'laptops16' def get_path(territory, data_type): return f'./dataset/data/{territory}/{data_ty...
lazy-cat2233/PBJM
data_from_xml.py
data_from_xml.py
py
2,285
python
en
code
1
github-code
36
23861578625
from collections import defaultdict def is_isogram(string): dt = defaultdict(int) for c in string.lower(): dt[c] += 1 for k in dt: if k.isalpha() and dt[k] > 1: return False return True
stackcats/exercism
python/isogram.py
isogram.py
py
231
python
en
code
0
github-code
36
7796403598
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : 翻转字符串1.py # @Author: smx # @Date : 2019/8/18 # @Desc : strings = list(input().strip().split(' ')) ans = ' '.join(map(lambda x: x[::-1], strings)) print(ans)
20130353/Leetcode
target_offer/字符串题/翻转字符串1.py
翻转字符串1.py
py
228
python
en
code
2
github-code
36
955639512
pkgname = "python-idna" pkgver = "3.4" pkgrel = 0 build_style = "python_pep517" make_check_target = "tests" hostmakedepends = [ "python-build", "python-installer", "python-flit_core", "python-wheel", ] checkdepends = ["python-pytest"] depends = ["python"] pkgdesc = "Internationalized Domain Names in App...
chimera-linux/cports
main/python-idna/template.py
template.py
py
692
python
en
code
119
github-code
36
15871423301
from pathlib import Path from typing import Any, Dict import torch from tsm import TSM from tsn import TSN, TRN, MTRN verb_class_count, noun_class_count = 125, 352 class_count = (verb_class_count, noun_class_count) def make_tsn(settings): return TSN( class_count, settings["segment_count"], ...
epic-kitchens/epic-kitchens-55-action-models
model_loader.py
model_loader.py
py
2,906
python
en
code
73
github-code
36
14893965980
#coding: utf-8 import sys,io from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import QIcon class Main(QWidget): def __init__(self): super().__init__() self.mainUI() def mainUI(self): self.setGeometry(300,300,300,300) self.setWindowT...
hirotask/-Python-mojiretu_kugiru
文字列区切る君/main.py
main.py
py
1,205
python
en
code
1
github-code
36
16127941604
# -*- coding: utf-8 -*- # @Project :MyProject # @File :create_particle # @Date :2021/7/20 13:23 # @Author :Concon # @Email :kangkang.liu@raykite.com # @Software :PyCharm import copy import random from my_api.demo.data_base import DataBase class Generation3DData(DataBase): def __init__(self): ...
Meetky/RTestData
my_api/demo/create_3d_data.py
create_3d_data.py
py
1,670
python
en
code
0
github-code
36
4078909742
class Solution: def canCompleteCircuit1(self, A, B): if sum(A) < sum(B): return -1 remaining_fuel = 0 idx = 0 for i in range(len(A)): remaining_fuel += A[i]-B[i] if remaining_fuel < 0: idx += i+1 remaining_fuel = 0 ...
VishalDeoPrasad/InterviewBit
Greedy Alogrithm/Gas Station.py
Gas Station.py
py
801
python
en
code
1
github-code
36
477002440
import unittest from .change_constraint import ChangeConstraint from ..definitions.constraint import Constraint class ChangeConstraintTest(unittest.TestCase): def test_as_string(self): constraint = Constraint('user_id_fk', 'user_id', 'users', 'id', on_update='cascade') self.assertEquals( ...
cmancone/mygrations
mygrations/core/operations/change_constraint_test.py
change_constraint_test.py
py
526
python
en
code
10
github-code
36
26192939759
import os import png import math from color_helpers import convert_16_bit_texture_for_pypng # IO THPS Scene Image Correction def shift_row_pixels(row_pixels, shift_amount): shifted_row = [] shifted_row.extend(row_pixels[shift_amount * -4 :]) shifted_row.extend(row_pixels[0 : shift_amount * -4]) ret...
slfx77/psx_texture_extractor
helpers.py
helpers.py
py
2,778
python
en
code
11
github-code
36
34443847573
names = [] option = "" def dropoff(): drop_off = input("What is the name of your child? ").upper().title() names.append(drop_off) def pickup(): pick_up = input("What is the name of your child? ").upper().title() if pick_up in names: print(pick_up, "has been picked up") names.remove(p...
yis1234/Projects
childcare.py
childcare.py
py
1,250
python
en
code
0
github-code
36
28912411327
""" ler maior numero digitado e quantas vezes foi digitado o maior numero """ # Declaração de variaveis index = 0 qtd_maior = 0 contador = 0 qtd = int(input("Quantidade de repetições: "))# Entrada do user while index <= qtd-1: valor = int(input(f"Valor({index + 1}): ")) # Entrada do user contador += 1 # ad...
BrunoDias312/CursoPython
Curso/Atividade Curso/Secao 06/Questao18.py
Questao18.py
py
750
python
pt
code
0
github-code
36
23013394729
import requests import os def gokidsgo(): a = input('Url? default: 127.0.0.1/').rstrip() if a == '': url = 'http://127.0.0.1/icons/folder.gif' print('grabbing: ' + url) req = requests.get(url, timeout=90) if req.ok: dat = req.text print(dat...
thcsparky/bigclickskid
oldtries/sandbox.py
sandbox.py
py
952
python
en
code
0
github-code
36
40176740668
# Compute column. # input is the input text string # token is a token instance def find_column(input, token): # when carriage return is detected, reset the counting... last_cr = input.rfind('\n', 0, token.lexpos) if last_cr < 0: # Not found last_cr = 0 column = (token.lexpos - last_cr) +...
alifzl/Final-Compiler-Course-Project
Implementation/source_code/src/lexical/commom.py
commom.py
py
402
python
en
code
0
github-code
36
24814387482
#! /usr/bin/env python from __future__ import print_function from pyspark import SparkContext, SparkConf from pyspark.sql import SparkSession import Addressbook_pb2 import sys from google.protobuf import json_format import json import glob import errno if __name__ == "__main__": confz = SparkConf()\ .set(...
yiyuan906/ProjectWork
ProtobufTest/SparkConvertFrom.py
SparkConvertFrom.py
py
1,367
python
en
code
0
github-code
36
43710529105
from hashlib import sha1 class Signature() : def __init__(self,secret): self.secret = secret def validate(self,request): keys = request['signature']['signed'].split(',') signing_string = '' for key in keys : signing_string += request[key] token = sha1(signi...
gouravnema/signature
python/Signature.py
Signature.py
py
888
python
en
code
0
github-code
36
4275879545
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import cloudinary cloudinary.config( cloud_name="djtxsnk9c", api_key="372171617535646", api_secret="2zMo8MA5wgslqPtRwHOVS1AFRks", ) # SQLALCHEMY_DATABASE_URL = "sqlite:///...
ddicko/deploy_fastapi
sql_app/database.py
database.py
py
775
python
en
code
0
github-code
36
15672169459
from datetime import datetime import logging logging.getLogger().setLevel(logging.INFO) logging.getLogger('discord').setLevel(logging.INFO) dt_fmt = '%Y-%m-%d %H:%M:%S' logging.basicConfig(format='[{asctime}] [{levelname:<8}] [{name:<15}]: {message}', style='{', datefmt='%Y-%m-...
nERD8932/LVSF1Bot
scripts/f1module.py
f1module.py
py
4,985
python
en
code
1
github-code
36
70853975785
# -*- coding: utf-8 -*- from __future__ import print_function from nltk.stem.porter import PorterStemmer from textblob import TextBlob from wordcloud import WordCloud import nltk import json import matplotlib.pyplot as plt import os import string from textblob.sentiments import NaiveBayesAnalyzer ps = Po...
dhanashriOstwal/electionSentimentAnalysis
Python Scripts/sentimentAnalysis.py
sentimentAnalysis.py
py
3,158
python
en
code
0
github-code
36
22355103302
# coding: utf-8 import os import random import time import cv2 import numpy as np import torch from torch import nn, optim from tqdm import tqdm import matplotlib.pyplot as plt import modules class Classifier: chinese_characters = ['云', '京', '冀', '吉', '宁', '川', '新', '晋', '桂', '沪', '津',...
QQQQQby/Car-Plate-Recognition
classifier.py
classifier.py
py
6,613
python
en
code
1
github-code
36
37635527190
# You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. # Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). # The island doesn'...
sunnyyeti/Leetcode-solutions
463_Island_Perimeter.py
463_Island_Perimeter.py
py
1,476
python
en
code
0
github-code
36
38285078798
from setuptools import find_packages, setup with open("README.txt") as f: readme = f.read() + "\n" with open("CHANGES.txt") as f: readme += f.read() + "\n" with open("HACKING.txt") as f: readme += f.read() setup( name="fc.qemu", version="1.4.1.dev0", author="Christian Kauhaus, Christian Theune...
flyingcircusio/fc.qemu
setup.py
setup.py
py
1,233
python
en
code
4
github-code
36
74226549222
# Complete the function below. def move(leftvalue, avg): num_of_move = 0 num_of_right_value = 0 for i in range(len(avg)): if avg[i] != leftvalue: num_of_right_value += 1 if avg[i] == leftvalue: num_of_move += num_of_right_value return num_of_move def minMove...
iamzhanghao/AI_Projects
other/visa_coding_test/hello.py
hello.py
py
808
python
en
code
2
github-code
36
16239896813
def is_palindrome(word): # Проверяем длину слова if len(word) < 3: print("Слово должно содержать как минимум 3 символа") return False stack = [] # Создаем пустой стек # Заполняем стек первой половиной слова for i in range(len(word) // 2): stack.append(word[i]) # Опред...
Merlin0108/rep2
lab11/1.py
1.py
py
1,334
python
ru
code
0
github-code
36
23621436946
#!/usr/bin/env python3 """ module """ import numpy as np def convolve(images, kernels, padding='same', stride=(1, 1)): """ that performs a convolution on images using multiple kernels: """ w, h, m = images.shape[2], images.shape[1], images.shape[0] kk, kw, kh = kernels.shape[3], kernels.shape[1], kernels....
vandeldiegoc/holbertonschool-machine_learning
math/0x04-convolutions_and_pooling/5-convolve.py
5-convolve.py
py
1,330
python
en
code
0
github-code
36
29450013209
from ..models import Comment from ..serializers import CommentSerializer from rest_framework.response import Response from rest_framework import permissions, generics from rest_framework.authtoken.models import Token from rest_framework.status import HTTP_403_FORBIDDEN class CommentDetail(generics.RetrieveUpdateDestr...
thunderlink/ThunderFish
backend/server/views/comment.py
comment.py
py
1,520
python
en
code
3
github-code
36
31044290128
import torch from torch.autograd import Function import torch.nn as nn import torchvision import torchvision.transforms as transforms import time import numpy as np #Force Determinism torch.manual_seed(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False np.random.seed(0) # Device confi...
RyanKarl/SGX_NN_Training_and_Inference
examples/mnist/test_main.py
test_main.py
py
7,871
python
en
code
0
github-code
36
11168036307
#!python3 """ Construct a mouseoverable SVG of three-party-preferred outcomes. We'll call the three parties "blue" (x-axis), "green" (y-axis) and "red" (with R + G + B == 1). The primary methods that you'll want to call are `get_args` and `construct_svg`. """ from typing import Tuple import sys import math from en...
alexjago/3pp-visualiser
visualise_cpv.py
visualise_cpv.py
py
22,052
python
en
code
0
github-code
36
12152753848
import numpy as np import plotly import plotly.graph_objects as go def normalize_cam_points(P,x,N): """ Normalize the camera matrices and the image points with normalization matrices N. :param P: ndarray of shape [n_cam, 3, 4], the cameras :param x: ndarray of shape [n_cam, 3, n_points], the projected...
antebi-itai/Weizmann
Multiple View Geometry/Assignment 5/Solution/code/utils.py
utils.py
py
4,188
python
en
code
0
github-code
36
40343025798
import rospy import bmw_wrap as bw import time as tm # System's states definitions IDLE = 0 MAPPING = 1 ESCAPING = 2 # Classes definitions class Task: """ This class keeps the task's desc. info. """ name = None ID = None def __init__(self, task_id): self.name = task_desc[task_id] ...
Conilo/BMW-Challenge
src/nodes/Master/master_module.py
master_module.py
py
5,403
python
en
code
0
github-code
36
15646167981
import os import glob import numpy as np def uniform_ball(n_points, rad=1.0): angle1 = np.random.uniform(-1, 1, n_points) angle2 = np.random.uniform(0, 1, n_points) radius = np.random.uniform(0, rad, n_points) r = radius ** (1/3) theta = np.arccos(angle1) #np.pi * angle1 phi = 2 * np.pi * an...
SimonGiebenhain/NPHM
src/NPHM/data/utils.py
utils.py
py
472
python
en
code
117
github-code
36
25730149556
# -*- coding: utf-8 -*- from django.shortcuts import render import psycopg2 import psycopg2.extras import json from django.http import HttpResponse from django.http import HttpResponseServerError from django.http import HttpResponseBadRequest from .dicttoxml import DictToXML def index(request): # Try to connect ...
thomaskonrad/bev-reverse-geocoder
bev_reverse_geocoder_api/views.py
views.py
py
6,488
python
en
code
3
github-code
36
14551208863
from fractions import Fraction from hypothesis import given from jubeatools import song from jubeatools.formats.timemap import TimeMap from jubeatools.testutils import strategies as jbst from jubeatools.utils import group_by @given(jbst.timing_info(with_bpm_changes=True), jbst.beat_time()) def test_that_seconds_at_...
Stepland/jubeatools
jubeatools/formats/konami/eve/tests/test_timemap.py
test_timemap.py
py
1,881
python
en
code
4
github-code
36
7350065420
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Mirantis/mos-horizon
openstack_dashboard/test/integration_tests/tests/test_volume_backups.py
test_volume_backups.py
py
5,876
python
en
code
7
github-code
36
26034310554
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd # In[2]: commercial = pd.read_csv('./commercial.csv') commercial # In[3]: # 끝에 5개 데이터만 추출 commercial.tail(5) # In[5]: list(commercial), len(list(commercial)) # In[7]: commercial.groupby('상가업소번호')['상권업종소분류명'].count().sort_values(ascend...
dleorud111/chicken_data_geo_graph
치킨 매장 수에 따른 지도 그리기.py
치킨 매장 수에 따른 지도 그리기.py
py
2,238
python
ko
code
0
github-code
36
14172419297
from .expression_parser import ExpressionParser class Number(object): EPS = 0.00000001 def __init__(self, number): self.number = number def calculate(self, x): return self.number @staticmethod def derivative(): return Number(0) def equal(self, other): return...
sidrDetyam/numerical_math
expressions/expression_builder.py
expression_builder.py
py
4,862
python
en
code
0
github-code
36
23232107868
import rclpy # ROS client library from rclpy.node import Node from rclpy.qos import qos_profile_sensor_data from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist class Tb3(Node): def __init__(self): super().__init__('tb3') self.cmd_vel_pub = self.create_publisher( ...
abysrising/PLV_Robot_Programming
challenge1.py
challenge1.py
py
2,332
python
en
code
0
github-code
36
16162642541
#!/usr/bin/env python3 import RPi.GPIO as GPIO import rospy from std_msgs.msg import Int32 ENCODER_PIN = 26 GPIO.setmode(GPIO.BCM) GPIO.setup(ENCODER_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP) def encoder_callback(): count = 0 last_state = GPIO.input(ENCODER_PIN) pub = rospy.Publisher('/encoder_count', Int3...
oguzhanbzglu/SergeantBot
idu_robot/scripts/encoder_node.py
encoder_node.py
py
801
python
en
code
2
github-code
36
27823324545
import requests from bs4 import BeautifulSoup import zlib #crc32加密 list_cyc32=[] list_url=[] import re # # 为了用xpath user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0' headers = {'User-Agent': user_agent} # url="https://www.cn...
Madlife1/pythonProject2
url_spider.py
url_spider.py
py
1,896
python
en
code
0
github-code
36
73202442984
from datetime import datetime from shapely.geometry import Point import numpy as np from typing import List GEODATUM_MAPPING = { "WGS 1984": "epsg:4326", "Ordnance Survey Great Britain 1936": "epsg:4277", "TWD 1967": "epsg:3828", "Gauss Krueger Meridian2": None, "Gauss Krueger Meridian3": None, ...
d2hydro/fewspy
src/fewspy/utils/conversions.py
conversions.py
py
3,271
python
en
code
2
github-code
36
3987982365
import pandas as pd import numpy as np import tensorflow as tf import shutil from .memories import VanillaMemory from .agents import DQNAgent from .gymRoom import * from .utils import * from .gymProfile import * import subprocess import threading def thread1(): # Open starccm+ server in Linux background subp...
danfenggithub/HumidityControl
solutions/run.py
run.py
py
5,234
python
en
code
6
github-code
36
7004766354
#!/usr/bin/python from bs4 import BeautifulSoup import requests import time import sys import urllib from itertools import chain import argparse url = "http://10.10.10.122/login.php" startUrl = "http://10.10.10.122/" proxyValues = {'http': 'http://127.0.0.1:8080'} SLEEP_VALUE = 3 lower_letters = range(97,123) upper_l...
nutty-guineapig/htb-pub
CTF/blindLDAPInjector.py
blindLDAPInjector.py
py
5,035
python
en
code
0
github-code
36
15980397887
"""Check for usage of models that were replaced in 2.0.""" from pylint.checkers import BaseChecker from pylint.interfaces import IAstroidChecker class NautobotReplacedModelsImportChecker(BaseChecker): """Visit 'import from' statements to find usage of models that have been replaced in 2.0.""" __implements__ ...
nautobot/pylint-nautobot
pylint_nautobot/replaced_models.py
replaced_models.py
py
3,231
python
en
code
4
github-code
36
44258229341
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import tensorflow.keras.backend as K # from keras.models import load_model from tensorflow.keras.models import load_model from os import listdir from os.path import isdir from PIL import Image import numpy as np from numpy import load from nump...
vgthengane/pytorch-cv-models
h4_face.py
h4_face.py
py
6,258
python
en
code
1
github-code
36
74517744744
# -*- coding: utf-8 -*- """ Created on Mon Aug 3 19:54:04 2020 @author: Tomi This contains solutions to some list exercises from the Python for Everybody (py4e) Course """ import sys def max_and_min(): '''prompt user for numbers and compute max and min''' number_list = [] while True: prompt = in...
tomisile/PythonDemos
py4e Course/py4e_list_exercises.py
py4e_list_exercises.py
py
2,570
python
en
code
0
github-code
36
12336375941
#!/usr/bin/python3 """ Defines requests for the drivers route """ from api.v1.views import app_views from flask import jsonify, request, make_response from functools import wraps from hashlib import md5 from models import storage from models.users import User import datetime import jwt SECRET_KEY = 'thisissecret' de...
NamasakaLennox/Msimu
backend/api/v1/auth.py
auth.py
py
2,555
python
en
code
0
github-code
36
28613251046
from math import cos, pi, sin from PySide import QtCore, QtGui class RenderArea(QtGui.QWidget): def __init__(self, path, parent=None): super(RenderArea, self).__init__(parent) self.path = path self.penWidth = 1 self.rotationAngle = 0 self.setBackgroundRole(QtGui.QPalette...
pyside/Examples
examples/painting/painterpaths.py
painterpaths.py
py
9,211
python
en
code
357
github-code
36
24201086153
# 백준 - 유기농 배추 import sys, collections T = int(sys.stdin.readline()) tc = 0 def bfs(start, M, N): global visited dirs = ((-1,0), (1,0), (0,-1), (0,1)) # 상, 하, 좌, 우 queue = collections.deque() queue.append(start) while queue: i, j = queue.popleft() if visited[i][j]: co...
superyodi/burning-algorithm
bfs/boj_1012.py
boj_1012.py
py
1,095
python
en
code
1
github-code
36
20678800215
from __future__ import annotations from typing import List, Optional from sqlalchemy import BigInteger, Column, Integer, String from pie.database import database, session class Seeking(database.base): __tablename__ = "fun_seeking_seeking" idx = Column(Integer, primary_key=True, autoincrement=True) gui...
pumpkin-py/pumpkin-fun
seeking/database.py
database.py
py
2,317
python
en
code
0
github-code
36
20465270702
# -*- coding: utf-8 -*- # @Project : CrawlersTools # @Time : 2022/6/21 17:08 # @Author : MuggleK # @File : base_requests.py import json import random import re import time from chardet import detect from httpx import Client, Response from loguru import logger from CrawlersTools.requests.proxy import get_proxi...
MuggleK/CrawlersTools
CrawlersTools/requests/base_requests.py
base_requests.py
py
6,417
python
en
code
16
github-code
36
16275076473
import json import sys import argparse import os APPROX = 0.1 def isNumber(num): isNum = False try: float(num) isNum = True except Exception as e: isNum = False return isNum nameList = list() def compareAny(self, other): diff = list() for att in self.attScalarList: ...
Priyankajaiswalintel/gramine
latest/bin64/gma/MAAT/compare.py
compare.py
py
10,364
python
en
code
null
github-code
36
9156690869
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import random from matplotlib.animation import FuncAnimation from mpl_toolkits.mplot3d.art3d import Poly3DCollection def randomwalk3D(n, angle_degrees, escape_radius=100): x, y, z = np.zeros(n), np.zeros(n), np.zeros...
shafransky93/PsudoSunSimulator
randwalk.py
randwalk.py
py
6,660
python
en
code
0
github-code
36
38826761471
from subprocess import Popen, PIPE from os import listdir from os.path import isfile, join from filecmp import cmp import time dirs = [('error_tests', ''), ('Tests', ''), ('ex1_Tests', ''), ('rotate_error_tests', '-rotate')] for dir, args in dirs: print("run %s tests" % dir) tests = [f fo...
tauCourses/puzzel
error_tests.py
error_tests.py
py
1,047
python
en
code
0
github-code
36
13957012079
import tensorflow as tf import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from numpy.random import random_integers import os import pandas as pd from math import floor # Matplotlib fig params mpl.rcParams['figure.figsize'] = (8, 6) mpl.rcParams['axes.grid'] = False # Enable eager for easy t...
ptallo/financial-forecasting-api
models/univarmodel.py
univarmodel.py
py
7,529
python
en
code
0
github-code
36
1467605788
# from PIL import Image # # def abrirImagem(): # im = Image.open("sample-image.png") # # import csv import sqlite3 from PIL import Image def abrir_imagem(imagem): #im = Image.open("sample-image.png") im = Image.open(imagem) im.show() def consultar_imagem(item): try: con ...
marcelocaon/gerador_catalogo_produtos
main.py
main.py
py
9,572
python
pt
code
1
github-code
36
536521380
import os import cv2 import numpy as np import skimage.exposure as sk_exposure import matplotlib.pyplot as plt from skimage.io import imshow, imread from skimage.color import rgb2hsv, hsv2rgb from skimage import color from scipy.ndimage.filters import maximum_filter from scipy.ndimage.morphology import generat...
LauraMarin/Tesis_2023
Unet_Nuclei_feature/Contour_seg.py
Contour_seg.py
py
4,106
python
en
code
0
github-code
36
36109925973
#!/usr/bin/env python3 #_main_.py import writer import getimage import argparse import os from time import sleep import gimmedahandler #import shit ##set up the parser parser = argparse.ArgumentParser( description= "A simple bot to place pixels from a picture to whatever you want \n Please note to write files with t...
a-usr/pixelbot
_main_.py
_main_.py
py
3,718
python
en
code
1
github-code
36
33147644172
#!/usr/bin/env python3 # Class for parsing arguments # from command line # Allowed arguments are # --help # --source=file # --source="file" # --input=file # --input="file" import sys import re class ArgumentsParser: """ Parses input arguments into objects and return them """ @staticmethod def parse(): args...
hondem/FIT
ipp_proj_1/arguments_parser.py
arguments_parser.py
py
595
python
en
code
0
github-code
36
18306682831
def purchases(n): if n==1: shipping=10.95 else: shipping=10.95+((n-1)*2.95) return shipping n=int(input("Enter number of orders:")) if n!=0: amount=purchases(n) print("Shipping charges=",amount) else: print("Invalid input")
rohanxd1/Codes
Python/Internship/program9.py
program9.py
py
264
python
en
code
0
github-code
36
17697981558
import os import sys from time import time, sleep from itertools import permutations import pickle import matplotlib.pyplot as plt import cv2 import numpy as np import pandas as pd import mediapipe as mp from sklearn.tree import DecisionTreeClassifier from PIL import Image, ImageDraw, ImageFont from t...
fukumoto1998/fingerspelling
word5/main.py
main.py
py
8,588
python
en
code
0
github-code
36
27775098322
import matplotlib.pyplot as plt import numpy as np # Create some data to plot x = np.arange(5) y = [2, 5, 3, 8, 10] # Set the xticks with labels that include LaTeX and \n xticks = [r'Label 1', r'Label$_{2}\n$with superscript $x^2$', r'Label 3', r'Label$_{4}$', r'Label 5'] plt.plot(x, y) plt.xticks(x, xticks, rotation...
JinyangLi01/Query_refinement
Experiment/TPCH/running_time/try.py
try.py
py
406
python
en
code
0
github-code
36
42733088110
class Leaf(object): def __init__(self, is_root=False, weight=0, char=None, parent=None, left_child=None, right_child=None): self.is_root = is_root self.weight = weight self.char = char self.parent = parent self.left_child = left_child self.right_child = right_child ...
magservel/Huffman-Vitter
Leaf.py
Leaf.py
py
598
python
en
code
0
github-code
36
29524986199
import os import tempfile import time import unittest from Tools import ValkyrieTools class TestTools(unittest.TestCase): def test_isFloat(self): self.assertTrue(ValkyrieTools.isFloat('1.0')) self.assertFalse(ValkyrieTools.isFloat(1)) def test_isInteger(self): self.assertTrue(ValkyrieT...
ValkyFischer/ValkyrieUtils
unittests/test_tools.py
test_tools.py
py
7,154
python
en
code
0
github-code
36
2521012317
import configparser import html from pathlib import Path from pprint import pformat from urllib.parse import urlparse import boto3 import botocore.model import botocore.utils from IPython.core.display import HTML from jinja2 import Environment, FileSystemLoader from pygments import highlight from pygments.formatters i...
kernelpanek/jupyterlab-starter-notebooks
helper/aws_functions.py
aws_functions.py
py
6,575
python
en
code
0
github-code
36
17881412655
class Node: def __init__(self, value): self.value = value self.next = None class Queue: def __init__(self): self.front = None self.rear = None self.length = 0 print("The queue has been initialised") def enqueue(self, value): newNode = Node(value) if(self.length==0): self.front = self.rear = newN...
qdotdash/Competitive_Coding
Data Structures and Algorithms - Udemy/Stack and Queue/QueueLinkedList.py
QueueLinkedList.py
py
1,213
python
en
code
0
github-code
36
11578008291
# 5648** import sys nums = "".join(list(map(str, sys.stdin.readlines()))).split() # 입력 문제: re.split은 구분자 사이에 아무것도 없을 경우 빈 문자열이 들어감.. reverses = [] for i in range(1, int(nums[0])+1): reverses.append(int(nums[i][::-1])) #문자열 뒤집기: str[::-1] for j in sorted(reverses): print(j) # cnt, *nums = sys.stdin.read()...
starcat37/Algorithm
BOJ/Silver/5648.py
5648.py
py
516
python
ko
code
0
github-code
36
656371734
#!/usr/bin/env python import json import pickle import os import pytest import numpy as np import mercantile as merc import inspect import rasterio import untiler from untiler.scripts import tile_utils def test_templating_good_jpg(): print("") expectedMatch = 'tarbase/jpg/\d+/\d+/\d+.jpg' expectedInterp...
mapbox/untiler
tests/test_untiler_funcs.py
test_untiler_funcs.py
py
13,079
python
en
code
39
github-code
36
24426403241
#!/usr/bin/env python import sys import os from distutils.core import setup from distutils.command.install import install, write_file from distutils.command.install_egg_info import to_filename, safe_name from functools import reduce class new_install(install): def initialize_options(self): install.initial...
jwagner/playitslowly
setup.py
setup.py
py
2,789
python
en
code
96
github-code
36