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
7122973024
_base_ = '../yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py' data_root = 'data/Ver3/output/' # Root path of data # Path of train annotation file train_ann_file = 'train.json' train_data_prefix = 'train/' # Prefix of train image path # Path of val annotation file val_ann_file = 'val.json' val_data_prefix = 'val/'...
CA-TT-AC/wrong-way-cycling
mmyolo/configs/custom/5m.py
5m.py
py
4,019
python
en
code
4
github-code
36
32391506851
# -*- coding: utf-8 -*- """ Created on Fri Sep 16 13:22:19 2016 @author: Zhaoyi.Shen """ import numpy as np def swobs_col(filename): npz = np.load(filename) swup_toa = npz['swup_toa'] swdn_toa = npz['swdn_toa'] swup_sfc = npz['swup_sfc'] swdn_sfc = npz['swdn_sfc'] return swdn_toa-swdn_sfc+swu...
szy21/py
lib/calc.py
calc.py
py
955
python
en
code
1
github-code
36
74879223784
import pandas as pd import streamlit as st import numpy as np from common import session_manager ssm = session_manager.st_session() # ssm.write_session_info() st.title("表を描画する") # データフレームを元に表を表示する df = pd.DataFrame({ 'first column': [1, 2, 3, 4], 'second column': [10, 20, 30, 40] }) st.write("write関数") st.write...
nishimu555/streamlit-lab
lab2/app/pages/02_write_and_table.py
02_write_and_table.py
py
1,107
python
ja
code
0
github-code
36
36307745878
import cv2 import numpy import torch import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.model_selection import KFold import os import random from tqdm import tqdm from segment_anything import SamAutomaticMaskGenerator, sam_...
PeterYYZhang/few-shot-self-prompt-SAM
main.py
main.py
py
13,776
python
en
code
44
github-code
36
30420538376
from pyspark.sql import Window import pyspark.sql.functions as f from app import columns class QueryManager: def __init__(self, spark, trip_fare_df, trip_data_df): self.spark = spark self.trip_fare_df = trip_fare_df self.trip_data_df = trip_data_df def trips_count(self, date_column): ...
andriisydor/big_data_2023
app/QueryManager.py
QueryManager.py
py
20,166
python
en
code
0
github-code
36
71244931944
import django_filters from teachers.models import Teacher class TeacherFilter(django_filters.FilterSet): class Meta: model = Teacher fields = { 'age': ['gte', 'lte', 'exact'], 'first_name': ['icontains'], 'last_name': ['icontains'], 'occupation': ['i...
ApolloNick/lms
api/v1/filters.py
filters.py
py
341
python
en
code
0
github-code
36
35941174358
import requests import json from PIL import Image, ImageTk from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager import time import os from bs4 import BeautifulSoup import tkinter as tk im...
akaTiger/Mapiot
old.py
old.py
py
18,576
python
en
code
0
github-code
36
22277300373
#!/usr/bin/env python """ https://www.codewars.com/kata/520b9d2ad5c005041100000f/python """ import ipdb import pytest """ pig_it('Pig latin is cool') # igPay atinlay siay oolcay pig_it('Hello world !') # elloHay orldway ! """ # from codewars solution def pig_it(text): lst = text.split() return ' '.join(...
romantix74/codewars
move_first_letter_word_end.py
move_first_letter_word_end.py
py
1,144
python
en
code
0
github-code
36
17310575825
# MIT License # # Copyright (c) 2023 Andrey Zhdanov (rivitna) # https://github.com/rivitna # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, including # without l...
rivitna/Malware
HsHarada/hsharada_extract_cfg.py
hsharada_extract_cfg.py
py
3,594
python
en
code
218
github-code
36
7852008585
class Solution: def leastInterval(self, tasks: List[str], n: int) -> int: same_tasks = {} for c in tasks: if c in same_tasks: same_tasks[c] += 1 else: same_tasks[c] = 1 max_heap = [] for i in same_tasks.values(): hea...
midasama3124/cracking-coding-interview
python/leetcode/task_scheduler.py
task_scheduler.py
py
798
python
en
code
0
github-code
36
74772398185
# https://cloud.google.com/pubsub/docs/create-topic#create_a_topic # https://cloud.google.com/python/docs/reference/pubsub/latest # %% from google.cloud import pubsub_v1 # TODO(developer) project_id = "podact-topic-extractor" topic_id = "your-topic-id" publisher = pubsub_v1.PublisherClient() topic_path = publisher....
lgarzia/topic_extractions
pub_sub_tutorials/create_and_manage_topic.py
create_and_manage_topic.py
py
6,502
python
en
code
0
github-code
36
74612434345
''' 概念:一种保存数据的格式 作用:可以保存本地的json文件,也可以将json串进行传输,通常将json称为轻量级的传输方式 json文件组成 {} 代表对象(字典) [] 代表列表 : 代表键值对 , 分隔两个部分 ''' import json jsonStr = '''{ "rate": "8.0", "cover_x": 1400, "title": "我是余欢水", "url": "https:\/\/movie.douban.com\/subject\/33442331\/", "playable": true, "cover": "https://img3.doub...
hanyb-sudo/hanyb
正则表达式与爬虫/3、爬虫/7、json数据解析.py
7、json数据解析.py
py
1,279
python
zh
code
0
github-code
36
8325766076
import json import math import random boardTypes = {'Empty': 0, 'Wall': 1, 'Snake_Body': 2, 'Snake_Head': 3, 'Food': 4} def distanceBetweenTwoPoints(point1, point2): return (abs((point2['x'] - point1['x'])) + abs((point2['y'] - point1['y']))) def createBoardObject(data, snakes): global boardTypes boardHeight...
krunal1998/BattleSnake2021
utility.py
utility.py
py
1,263
python
en
code
0
github-code
36
23234426744
from motor import Motor import keyboard, time, sys from threading import Thread import tkinter as tk ''' #PINOS DE COMUNICAÇÃO EM BINÁRIO #[0,1,2,3, 4, 5, 6, 7] - BITS DA PLACA #[1,2,4,8,16,32,64,128] - SINAL DE COMUNICAÇÃO CORRESPONDENTE ''' mx = Motor(4, 8) my = Motor(16, 32) dx, dy = 2700, 270 ...
eduardof-rabelo/IC
main.py
main.py
py
642
python
pt
code
0
github-code
36
12717941520
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json # --- # title: hello,hikyson # tags: [Default] # category: [Default] # comments: true # date: 2014-04-20 22:18:43 #...
Kyson/ScrapyForAndroidDashboard
ScrapyForAndroidDashboard/ScrapyForAndroidDashboard/pipelines.py
pipelines.py
py
2,522
python
en
code
1
github-code
36
2835263565
import pandas as pd import plotly.express as px from ..sequence_info.sequences import group_2_coins from ..utils import google_form_question_to_coin_sequence DATA_FILENAME = "C:/Users/Crystal Wang/Downloads/9.660/9.660-final-project/data/data.csv" def get_df(): df = pd.read_csv(DATA_FILENAME) df = df.drop("T...
cwcrystal8/9.660-final-project
coins/data_cleaning/groups.py
groups.py
py
3,884
python
en
code
0
github-code
36
36748158121
import hashlib import os from string import hexdigits class FudgeException(Exception): pass def read_file(path, mode='rb'): with open(path, mode) as f: data = f.read() return data def write_file(path, data, mode='wb'): with open(path, mode) as f: f.write(data) def makedirs(path):...
QuantamKawts/fudge
fudge/utils.py
utils.py
py
1,568
python
en
code
0
github-code
36
39303555840
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author: admin @file: MultiHeadedAttention.py @time: 2021/09/02 @desc: """ import copy import torch import math from torch import nn import torch.nn.functional as F def clones(module, N): """ 克隆基本单元,克隆的单元之间参数不共享 """ return nn.ModuleList([ copy.dee...
coinyue/Transformer
model/MultiHeadedAttention.py
MultiHeadedAttention.py
py
2,463
python
en
code
0
github-code
36
19944553952
from time import sleep from threading import Thread from consumer import QueryConsumer from querier import QueryMongo class Pipe(QueryConsumer): def __init__(self): super().__init__() self._mongo = QueryMongo() self._switch = False self._response = None self._queue = [] ...
MatheusGaignoux/Kafka-MongoDB-query-parameters-integration
src/pipe.py
pipe.py
py
1,181
python
en
code
0
github-code
36
29501639753
import sys, math input = sys.stdin.readline A, B = map(int, input().split()) point = int(math.sqrt(B)) # 제곱근까지만 탐색하여 시간 아낌 prime = [True] * (point + 1) # 모든 수를 소수라고 가정 prime[1] = False # 소수 판별 for i in range(2, point + 1): if prime[i]: if i*i > point: break for j in range(int(math.pow...
harii-in/BAEKJOON
1456.py
1456.py
py
738
python
ko
code
0
github-code
36
31859196035
from pygame import * class UserControl(object): """docstring for UserControl.""" def __init__(self): print("User controller init!") def decide(self, keys,cells=None, prev_pos=(0,0)): dx,dy = prev_pos if keys[K_w] and dy != 1: dx, dy = 0,-1 if keys[K_s] and d...
CymerR/School_snake_ai
UserControl.py
UserControl.py
py
500
python
en
code
1
github-code
36
34212093305
# https://www.acmicpc.net/problem/16236 # sol # 상어객체를 구현하여 bfs로 최단거리의 가능한 먹이를 탐색한다 # 1) bfs하며 최단거리이면서 (여럿일 경우 위쪽/왼쪽순) 먹을 수 있는(상어보다 사이즈 작은) 먹이 탐색 # 1-1) 이때 가능한 먹이가 여럿일 수 있기에 bfs 큐에 상어 이동거리를 포함하는 변형이 들어간다 # 1-2) 가능한 먹이가 없으면 그때까지 상어 이동거리를 return하고 끝낸다 # 2) 결정된 먹이를 먹고 상어의 상태와 space를 업데이트 한다 # 3) 가능한 먹이 없을때까지 bfs를 반복한...
chankoo/problem-solving
graph/boj16236.py
boj16236.py
py
3,914
python
ko
code
1
github-code
36
74605435944
from model.contact import Contact from datetime import datetime import re import csv class Phonebook: """ The Phonebook class allows users to create, update, delete, search, and perform various operations on contacts. Attributes: contacts (list): A list of Contact objects representing the phoneb...
Kartik-Nair/PhoneBook
phonebook.py
phonebook.py
py
16,960
python
en
code
0
github-code
36
17164702508
from os import DirEntry from geradorDeSql import GeradorDeSql #logstash_data={"host":"192.168.0.116","port":5000,"username":"elastic","password":"changeme"} #logstash_data={"host":"192.168.0.116","port":5000} class Gerar_bd_teste: def __init__(self,local_sqlite:DirEntry="scripts/teste_db.db",total_threads=0,logsta...
mzramna/algoritimo-de-testes-de-benchmark-de-bancos-de-dados
scripts/geração_bd_testes.py
geração_bd_testes.py
py
1,385
python
pt
code
0
github-code
36
39353557558
import math def area(r): """Area of a circle with radius 'r'""" return math.pi * (r**2) radii = [2, 5, 7.1, 0.3, 10] # Method 1: Direct method areas = [] for r in radii: a = area(r) areas.append(a) print(areas) # Method 2: Use 'map' functions print(list(map(area, radii))) print("===========") ...
Vaijyant/PythonPlayground
23_map_filter_redunce.py
23_map_filter_redunce.py
py
1,113
python
en
code
0
github-code
36
2808401161
from __future__ import absolute_import from __future__ import division from __future__ import print_function __version__ = "0.1.2" __author__ = "Abien Fred Agarap" import argparse from models.svm.svm import Svm # Hyper-parameters BATCH_SIZE = 256 LEARNING_RATE = 1e-5 N_CLASSES = 2 SEQUENCE_LENGTH = 21 def parse_ar...
AFAgarap/gru-svm
svm_main.py
svm_main.py
py
3,519
python
en
code
136
github-code
36
70938863144
from math import fabs class Graphics: RATIO = 2 #rectSymbol = "#" rectSymbol = "█" underSymbol = "=" def __init__(self, w, h, ratio=2): self.HEIGHT = h self.WIDTH = w self.RATIO = ratio self.RATIO_WIDTH = w * ratio self.lines = [] for i in range(se...
Cooble/BirthdayPie
graphics.py
graphics.py
py
3,818
python
en
code
0
github-code
36
26376325124
#!/usr/bin/env python # coding: utf-8 # In[12]: # Question 1 c) # Author: Ilyas Sharif import numpy as np import matplotlib.pyplot as plt # Defining the parameters that didn't change (same as code for before) v_f = 0.1 omega_0 = 1 tau = 1 gamma = 0.5 a = 0.0 b = 100.0 N = 10000 h = (b-a)/N tpoints = np.arange(a, ...
SpencerKi/Computational-Methods
Differentiation and Differential Equations/Lab06_Q1_c.py
Lab06_Q1_c.py
py
1,726
python
en
code
0
github-code
36
33660433557
import os from flask import Flask, Response, request, current_app, url_for, send_from_directory from fishapiv2.database.models import * from flask_restful import Resource from werkzeug.utils import secure_filename from fishapiv2.resources.helper import * from fishapiv2.resources.controller.authentication import * impor...
MauL08/AquaBreedingAPI-V2
fishapiv2/resources/controller/pond.py
pond.py
py
12,401
python
en
code
0
github-code
36
12803276455
import os, sys, io, math class SequenceReader: def __init__(self, file_path): self.file_path = file_path def set_file_path(self, file_path): self.file_path = file_path def get_file_path(self): return self.file_path def read_sequence(self): with open(self.file_path...
ender-s/HMM-Based-Secondary-Structure-Prediction
hmm_based_predictor.py
hmm_based_predictor.py
py
12,161
python
en
code
0
github-code
36
26540686747
from random import randint import xlrd from datetime import datetime import matplotlib.pyplot as plt # this should be done with a database, so I should not put too much effort into making this program easy to use PATH = "/home/yannick/git-repos/MyPython/math programs/investi.xls" # .xls only DATA_RANGE = (15, 559) # ...
su595/MyPython
math programs/statistics.py
statistics.py
py
4,798
python
en
code
2
github-code
36
9924072616
import os import re import sys from lib.instruction import Instruction, AInstruction, CInstruction, LInstruction from typing import Generator, Tuple class Parser: """ Parse the Xxx.asm into stream of instructions. - read source file - understand the format of input file - break each into differen...
mtx2d/nand2tetris
projects/06/src/lib/parser.py
parser.py
py
2,398
python
en
code
0
github-code
36
26767660941
import prodigy from prodigy.components.loaders import JSONL from prodigy.components.db import connect import random from datetime import datetime with open('prodigy_recipe/template.js', 'r') as template: javascript_template = template.read() @prodigy.recipe("classify-trees") def classify_trees(dataset, source): ...
aloui-mathias/campagne_prodigy
prodigy/prodigy_recipe/classify_tree_patches.py
classify_tree_patches.py
py
977
python
en
code
0
github-code
36
21131295808
"""Nautobot Golden Config plugin application level metrics .""" from django.conf import settings from django.db.models import Count, F, Q from nautobot.dcim.models import Device from prometheus_client.core import GaugeMetricFamily from nautobot_golden_config.models import ComplianceFeature, ComplianceRule, ConfigCompl...
nautobot/nautobot-plugin-golden-config
nautobot_golden_config/metrics.py
metrics.py
py
4,420
python
en
code
91
github-code
36
25606581626
# Exercício Python 058: Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um número entre 0 e 10. Só que # agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer from random import randint from time import sleep bot = randint(0, 10) tentativas ...
MarcosSx/CursoGuanabara
Exercicios/mundo2/aula014_estruturaDeRepericaoWhile/ex058-JogoDaAdvinhacaoV2.py
ex058-JogoDaAdvinhacaoV2.py
py
790
python
pt
code
0
github-code
36
38164787541
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('foi_requests', '0001_initial'), ] operations = [ migrations.AddField( model_name='foirequest', name=...
foilaundering/foilaundering
foilaundering/apps/foi_requests/migrations/0002_auto_20151122_1253.py
0002_auto_20151122_1253.py
py
587
python
en
code
0
github-code
36
11458787486
import time from decimal import getcontext,Decimal #计时开始时间点 start=time.time() #精度设置(此处设置为总位数,为使精确到小数点后100位应设为101 getcontext().prec=101 #用于arctan计算的精确值 par1=Decimal(1)/Decimal(5) par2=Decimal(1)/Decimal(239) #得到arctan每一项与求和每一项的函数 def arctanSer(num,index): if index%2==0: #正负判断 flag=-1 else: flag=...
A-LOST-WAPITI/Computational_Physics
HW_2/Problem_2.py
Problem_2.py
py
909
python
zh
code
0
github-code
36
22283584367
#!/Users/tnt/Documents/虚拟环境/Py4E/bin/python3 # -*- encoding: utf-8 -*- # Time : 2021/07/25 22:41:43 # Theme : 寻找数组中第二个最大元素 def find_second_maximum_1(lst): first_max = float('-inf') second_max = float('-inf') # find first max for item in lst: if item > first_max: first_max = item ...
Createitv/BeatyPython
05-PythonAlgorithm/BasicDataStructure/array/second_largest_num.py
second_largest_num.py
py
1,616
python
en
code
1
github-code
36
74998248105
from __future__ import print_function import numpy as np import cv2 import subprocess import itertools from multiprocessing import Pool import sys import os import time import numpy as np import theano import theano.tensor as T import lasagne f = subprocess.check_output(["ls"]).split() files = [] #make list of...
arvigj/cv_hw3
new_eval.py
new_eval.py
py
15,057
python
en
code
0
github-code
36
71257318823
import math from typing import List import numpy as np import torch import torch.jit as jit import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.nn import Parameter from language_models.language_base_model import LanguageBaselightning class RNNCell(jit.ScriptModule): def __...
shuishen112/TensorLanguageModel
language_models/lightRNN.py
lightRNN.py
py
7,044
python
en
code
0
github-code
36
20407317439
class Graph: def __init__(self,Vertices): self.V = Vertices self.graph = [] def addEdge(self,u,v,w): self.graph.append([u,v,w]) def find(self,parent,i): if parent[i] == i: return i return self.find(parent,parent[i]) def print_g(self): print(...
Bishtman12/DSA---Python
Graph/Minimum Spanning Tree(kRUSKALS).py
Minimum Spanning Tree(kRUSKALS).py
py
2,011
python
en
code
0
github-code
36
40264668629
volume = int(input()) pipe1 = int(input()) pipe2 = int(input()) hours = float(input()) total_volume = (pipe1 + pipe2) * hours if total_volume <= volume: pool_percent = (total_volume / volume) * 100 pipe1_percent = ((pipe1 * hours) / total_volume) * 100 pipe2_percent = ((pipe2 * hours) / total_volume) * 100 ...
ivoivanov0830006/1.1.Python_BASIC
2.Conditional_statements/**01.Pool_pipes.py
**01.Pool_pipes.py
py
557
python
en
code
1
github-code
36
32882450678
#!/usr/bin/python3 import os, os.path import json import subprocess from flask import Flask, request, redirect, abort from time import sleep app = Flask(__name__) GITROOT = '/home/ubuntu/service/' @app.route('/') def index(): return redirect('https://github.com/TauWu/spider_monitor_api') @app.route('/', methods...
TauWu/spider_monitor_api
extra/hook.py
hook.py
py
732
python
en
code
0
github-code
36
34609621508
""" 650. 2 Keys Keyboard There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step: 1. Copy All: You can copy all the characters present on the screen. 2. Paste: You can paste the characters which are copied last time. Given an integer n, re...
wuihee/data-structures-and-algorithms
programming-paradigm/dynamic_programming/min_max_path/keyboard.py
keyboard.py
py
1,811
python
en
code
0
github-code
36
7044056393
# !/usr/bin/env python import rospy import websocket import json # from msg.ObjectArray import ObjectArray from detection.msg._ObjectArray import ObjectArray LABELS = ["human", "unknown", "animals"] try: import thread except ImportError: import _thread as thread import time def on_message(ws, message): ...
cds-mipt/animal_ir_detection
sender/scripts/sender.py
sender.py
py
1,890
python
en
code
0
github-code
36
3837799598
import numpy as np from numpy import array, trace, random, linalg from numpy.linalg import norm def projectorOnto(vector): """ Returns a rank-1 projector onto a given vector """ return np.tensordot(vector, vector.conj(), 0) def randomPureState(dim): """ Generates Haar-random pure state density matrix ...
kanhaiya-gupta/quantum-learning
lib/simulator.py
simulator.py
py
3,127
python
en
code
null
github-code
36
16283819127
from django.conf.urls import url from .views import( AddQuestionCreateAPIView, QuestionListAPIView, QuestionRUDAPIView, QuestionImageRUDAPIView, UserQuestionListAPIView, TopicCreateAPIView, TopicRUDAPIView, SubTopicCreateAPIView, SubTopicRUDAPIView, ...
ashukesri/100Percentile
questions/urls.py
urls.py
py
2,307
python
en
code
0
github-code
36
18915553573
import pytest from src.same_tree import Solution from src.utils.binary_tree import list_to_tree @pytest.mark.parametrize( "list_p,list_q,equal", [ ([1, 2, 3], [1, 2, 3], True), ([1, 2], [1, None, 2], False), ([], [], True), ([1, 2, 1], [1, 1, 2], False), ], ) def test_solu...
lancelote/leetcode
tests/test_same_tree.py
test_same_tree.py
py
456
python
en
code
3
github-code
36
38830842298
from rest_framework import status def jwt_response_payload_handler(token, user=None, request=None): return { 'code': status.HTTP_200_OK, 'message': '', 'result': { 'token': token, 'user_id': user.id, 'username': user.username } }
helloming86/DjangoJWTDemo
users/utils.py
utils.py
py
308
python
en
code
0
github-code
36
35555355731
from datetime import date from fastapi import APIRouter, Depends, Query from sqlalchemy.ext.asyncio import AsyncSession from api.deps import get_db from crud.analytics import get_analytics_by_range_of_dates, get_analytics_by_student_id from schemas.analytics import AnalyticsByRangeOfDates router = APIRouter() @rou...
starminalush/mfdp-2023-mvp
backend/api/endpoints/analytics.py
analytics.py
py
1,680
python
en
code
0
github-code
36
34086502752
from batch import create_udb from projectMetrics import projectMetric from subprocess import call import git import sys import datetime import os import shutil import time def main(): git_repo = sys.argv[1] # git repo is the relative path from the folder all_sha1 = [] sha_dtime = [] repo = git.Rep...
akhilsinghal1234/mdd-intern-work
Extraction/main.py
main.py
py
1,009
python
en
code
0
github-code
36
39808955729
import tensorflow as tf def unpool(value, name='unpool'): """From: https://github.com/tensorflow/tensorflow/issues/2169 N-dimensional version of the unpooling operation from https://www.robots.ox.ac.uk/~vgg/rg/papers/Dosovitskiy_Learning_to_Generate_2015_CVPR_paper.pdf :param value: A Tensor of shape [...
ninfueng/convolutional-autoencoder-for-anomaly-detection
model.py
model.py
py
3,847
python
en
code
1
github-code
36
42244011138
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models, tools, _ from odoo import SUPERUSER_ID import io import csv import base64 import ftplib from odoo.tools import pycompat import logging _logger = logging.getLogger(__name__...
eqilibruim-solutions/Theme-1
clarico_ext/models/product_template.py
product_template.py
py
7,913
python
en
code
0
github-code
36
5972086108
import random import pygame import copy l = [[random.choice([0, 1]) for i in range(48)] for i in range(48)] k = [[0 for i in range(48)] for i in range(48)] pygame.init() s = pygame.display.set_mode((480, 480), 0, 32) o = True def z(x, y): m = 0 for i in (x - 1, x, x + 1): for j in (y ...
Lil-Shawn/game-of-life
main.py
main.py
py
1,240
python
en
code
0
github-code
36
32253555423
#Day 14 - 30 days of code, scope class Difference: def __init__(self, a): self.__elements = a def computeDifference(self): new_array = list(map(lambda x: abs(x), self.__elements)) v_max = max(new_array) v_min = min(new_array) self.maximumDifference = v_max - v_min mi_li...
alexmagno6m/scripts
30_days_14.py
30_days_14.py
py
409
python
en
code
0
github-code
36
33567308542
import numpy as np import ROOT ROOT.gROOT.SetStyle("ATLAS") software = [ 'acts', 'athena', ] sample = 'ttbar' #sample = 'singleMu_100GeV' event_name = "ttbar 14 TeV" #event_name = "single Mu pT = 100 GeV" string = '===>>> done processing event' log_lines_grid = [line.replace('|TIMER ACTS| ','') for line in open('...
LuisFelipeCoelho/seeding_analysis_tools
read_timer2.py
read_timer2.py
py
11,952
python
en
code
0
github-code
36
39929411303
import sys n, m, r, c, k = map(int, sys.stdin.readline().split()) board = [list(map(int, sys.stdin.readline().split())) for r in range(n)] move_list = list(map(int, sys.stdin.readline().split())) dice = [0, 0, 0, 0, 0, 0] def roll(dice, direction): if direction == 1: temp = dice[5] dice[5] = dice[3] dice[2:4]...
Choi-Sung-Hoon/Algorithm_with_Python
BOJ/14499.py
14499.py
py
1,219
python
en
code
1
github-code
36
15991499425
import os import argparse import torch from torch import nn import torch.backends.cudnn as cudnn from torch.utils.data.distributed import DistributedSampler from torch.utils.data import DataLoader import numpy as np import cv2 from seg_metric import SegmentationMetric import random import shutil import setproctitle imp...
zyxu1996/Efficient-Transformer
train.py
train.py
py
21,965
python
en
code
67
github-code
36
13989585282
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtGui import QPainter, QColor class MainWindow(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setGeometry(300, 300, 350, 100) ...
shellever/Python3Learning
thirdparty/pyqt5/painting/drawrectangles.py
drawrectangles.py
py
1,308
python
en
code
0
github-code
36
2894217699
from typing import Dict, Callable from src.dialog.common.manage_entity.ManageEntityDialogMode import ManageEntityDialogMode from src.property.Property import Property from src.session.common.Session import Session from src.storage.common.entity.Entity import Entity from src.storage.common.entity.EntityStorage import E...
andreyzaytsev21/MasterDAPv2
src/dialog/common/manage_entity/ManageEntityContainerSaver.py
ManageEntityContainerSaver.py
py
2,456
python
en
code
0
github-code
36
35396952388
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) from collections import defaultdict from contextlib import contextmanager import inspect import logging import os import re import sys import traceback from twitter.c...
fakeNetflix/square-repo-pants
src/python/pants/commands/goal_runner.py
goal_runner.py
py
10,794
python
en
code
0
github-code
36
36496422479
from peewee import * from playhouse.fields import ManyToManyField from backend.connection_manager import db from backend.models.feed import Feed from backend.models.route import Route class Stop(Model): id = PrimaryKeyField() stop_id = BigIntegerField(null=False) name = CharField(null=False) lat = Fl...
seniorpreacher/timap
backend/models/stop.py
stop.py
py
2,027
python
en
code
0
github-code
36
73571310823
from datetime import datetime from typing import List, Union from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from app.models import CharityProject, Donation async def get_not_closed_investing_objects( model: Union[CharityProject, Donation], session: AsyncSession ) -> Li...
ThatCoderMan/QRkot_spreadsheets
app/services/investing.py
investing.py
py
2,014
python
en
code
1
github-code
36
5180131116
from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, InputLayer import pandas as pd import numpy as np from pickle import load from sklearn.preprocessing import MinMaxScaler model = Sequential([ InputLayer(input_shape=7), Dense(5, activation = 'relu'), Dense(4, activation =...
adish13/Moodify-Learning
music_test.py
music_test.py
py
993
python
en
code
1
github-code
36
12367122482
#!/usr/bin/env ccp4-python ''' Created on 16 Jan 2016 @author: hlfsimko ''' import glob import os import sys from ample.constants import SHARE_DIR from ample.testing import test_funcs from ample.testing.integration_util import AMPLEBaseTest INPUT_DIR = os.path.join(SHARE_DIR, "examples", "single-model", "input") TE...
rigdenlab/ample
examples/single-model/test_cases.py
test_cases.py
py
2,414
python
en
code
6
github-code
36
27555873919
class Solution: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: for i, num in enumerate(flowerbed): isCurrentPlaceClear = flowerbed[i] == 0 isPreviousPlaceClear = i == 0 or flowerbed[i - 1] == 0 isNextPlaceClear = i == len(flowerbed) - 1 or flowerbed[i + ...
maxlevashov/leetcode
python/605_Can_Place_Flowers.py
605_Can_Place_Flowers.py
py
488
python
en
code
1
github-code
36
34684965876
__all__ = ['nuke_all', 'is_empty'] def nuke_all(classes): 'Destroys all objects' for cls in classes: for obj in cls.objects.all(): obj.delete() def is_empty(classes): '''returns False if any instances of the given classes exist, else returns True''' for cls in classes: if 0...
readcoor/MIDAS-MICrONS
django/nada/fixtures/utils.py
utils.py
py
410
python
en
code
0
github-code
36
35851037675
#Django Libs from django.http.response import FileResponse, HttpResponse from django.shortcuts import render from django.urls import reverse from django.views.generic import View, CreateView, DeleteView, UpdateView, DetailView, ListView, TemplateView from django.db.models import Sum from django.core.serializers import ...
RobertoMarroquin/garrobo
iva/views.py
views.py
py
8,321
python
en
code
0
github-code
36
35906634663
from flask import Flask, render_template, flash, redirect, request, url_for, jsonify from multiprocessing import Process, Queue from xBee_recieve import reciever app = Flask(__name__) processes = [] collectedData = [] def getNewXbeeData(q): PORT = "COM2" BAUD = 9600 MAC = "13A20041C7BFFC" r = reci...
explosion33/PIPayload
ground/api.py
api.py
py
2,488
python
en
code
1
github-code
36
27359625037
#!/usr/bin/python3 import os import requests my_ip_file = os.path.join("/tmp", "myIp.txt") def myIp(): return requests.get("https://gianlu.dev/ip").text.strip() def writToFile(filename, content): fp = open(filename, "wt", encoding="utf8") fp.write(content) fp.close() def readFile(filename): ...
GianluDeveloper/OpenRemotePort
CronKeeper.py
CronKeeper.py
py
681
python
en
code
0
github-code
36
14199179259
import time class criatura(): """docstring for criatura""" def __init__(self, pos, dir, imagen, tic, toc, tiempo_entre_mov): self.pos = None self.dir = None self.imagen = None self.tic = None self.toc = None self.tiempo_entre_mov = None class pac_man(): """...
dsvalenciah/python-pacman
temp.py
temp.py
py
1,671
python
es
code
0
github-code
36
5993681332
if __name__ == "__main__": # Метод Гаусса f = open("Input.txt") RANGE = int(f.read(1)) # Записываем количество строк матрицы COLUMN = int(f.read(1)) # Записываем количество столбцов матрицы mat = [] # Считываем матрицу из файла f.read(1) for line in f.readlines(): mat.append(lin...
alexneysis/numerical-methods
gauss_A0/my_method.py
my_method.py
py
3,308
python
ru
code
0
github-code
36
25353888497
import socketserver import sys from python import http import requestParsing class TCPHandler(socketserver.BaseRequestHandler): def handle(self): recieved_data = self.request.recv(1024) print(self.client_address[0] + " is sending data") print("----") print(recieved_data.decode()) ...
jackyzhu209/312-Project
website/server.py
server.py
py
2,395
python
en
code
0
github-code
36
11014211257
from django.shortcuts import render, redirect, get_object_or_404 from .forms import LibroForm from django.shortcuts import render from .models import Libro from django.urls import reverse_lazy from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic.edit import CreateView from django.views.g...
ezecodo/Entrega1-Angeloni
libros/views.py
views.py
py
2,052
python
en
code
0
github-code
36
43537572862
range_lower = 146810 range_higher = 612564 def is_valid(number): as_string = str(number) adjacents = [] for i in range(1, len(as_string)): current = int(as_string[i]) previous = int(as_string[i-1]) if current < previous: return False if current == previous: adjacents.append((i, i-1,...
ChrisWilliamson123/advent-of-code-2019
day4/main.py
main.py
py
799
python
en
code
1
github-code
36
41635503393
from google.cloud import firestore, storage, exceptions import os db = firestore.Client() content = db.collection('fl_content') storage_client = storage.client.Client() bucket = storage_client.get_bucket('psyclonic-studios-website.appspot.com') def new_transaction(): return db.transaction() @firestore.transacti...
Psyclonic-Studios/psyclonic-studios-website
server/crud.py
crud.py
py
13,541
python
en
code
0
github-code
36
30791311833
from .operator import Operator from .loader import load_from_dir from .built_in import BUILTIN_OPERATORS class OperatorRegistry: def __init__(self): self.plugin_contexts = load_from_dir() def list_operators(self): """Lists the available FiftyOne operators. Returns: a list...
Rusteam/fiftyone
fiftyone/operators/registry.py
registry.py
py
1,866
python
en
code
null
github-code
36
25338326690
import torch import seaborn as sn from matplotlib import pyplot as plt from model import ConvNet from MnistDataset import Mydataset from torch.utils.data import DataLoader import numpy as np import pandas as pd torch.manual_seed(13) def get_score(confusion_mat): smooth = 0.0001 #防止出现除数为0而加上一个很小的数 tp = np.di...
Huyf9/mnist_pytorch
test.py
test.py
py
1,732
python
en
code
1
github-code
36
4108236217
one = input() two = input() oneL = len(one) twoL = len(two) dp = [[0] * (twoL + 1) for _ in range(oneL + 1)] for i in range(1, oneL + 1): for j in range(1, twoL + 1): if one[i - 1] == two[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])...
AAZZAZRON/DMOJ-Solutions
dpf.py
dpf.py
py
559
python
en
code
1
github-code
36
41977316312
import json class Destinations: def __init__(self): self.destination = "" self.file_name = "destinations.json" def write_to_json_file(self): dictionary = { "destination": self.destination } json_object = json.dumps(dictionary, indent=1, ensure_ascii=False) ...
DistributedTravels/Scraper
scraper/destinations.py
destinations.py
py
416
python
en
code
0
github-code
36
43753620311
from rest_framework_simplejwt.authentication import JWTAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.decorators import ( api_view, permission_classes, authentication_classes ) from django.contrib.auth.models import Use...
lazarmarkovic/uks2020
backend/repository/views/repo_views.py
repo_views.py
py
8,275
python
en
code
0
github-code
36
27616329139
#coding=utf8 import numpy as np np.random.seed(1337) # for reproducibility import re import h5py import os from nltk import tokenize from keras.preprocessing.text import Tokenizer, text_to_word_sequence from attention import Attention_input1, Attention_input2 from keras.preprocessing.text import Tokenizer from keras.p...
xunan0812/MultiSentiNet
src/att_sc_ob_txt.py
att_sc_ob_txt.py
py
6,726
python
en
code
16
github-code
36
43296965814
# spaceconfig = {"usemodules" : ["_collections"]} from _collections import deque from pytest import raises def test_basics(): assert deque.__module__ == 'collections' d = deque(xrange(-5125, -5000)) d.__init__(xrange(200)) for i in xrange(200, 400): d.append(i) for i in reversed(xrange(-2...
mozillazg/pypy
pypy/module/_collections/test/apptest_deque.py
apptest_deque.py
py
7,397
python
en
code
430
github-code
36
7813396326
import re from math import ceil import dateparser from aspen.database.models import TreeType from aspen.workflows.nextstrain_run.build_plugins.base_plugin import BaseConfigPlugin class TreeTypePlugin(BaseConfigPlugin): crowding_penalty: float = 0 tree_type: TreeType subsampling_scheme: str = "NONE" ...
chanzuckerberg/czgenepi
src/backend/aspen/workflows/nextstrain_run/build_plugins/type_plugins.py
type_plugins.py
py
14,798
python
en
code
11
github-code
36
18553686764
import random from itertools import chain import numpy as np import pandas as pd from cytoolz import itemmap, sliding_window, valmap from skfusion import fusion class DataFusionModel(object): def __init__( self, nodes, relations, init_type="random", random_state=666, n_jobs=1 ): self.nodes = ...
zorzalerrante/aves
src/aves/models/datafusion/base.py
base.py
py
4,339
python
en
code
57
github-code
36
2535331354
import numpy as np import tensorflow as tf import agents.utils as agent_utils import config_constants as cc from model.LehnertGridworldModelLatent import LehnertGridworldModelLatent class LehnertGridworldModelGMM(LehnertGridworldModelLatent): ENCODER_NAMESPACE = "encoder" NUM_ACTIONS = 4 def __init__(se...
ondrejbiza/discrete_abstractions
model/LehnertGridworldModelGMM.py
LehnertGridworldModelGMM.py
py
5,729
python
en
code
4
github-code
36
39885168812
import pytz import base64 from typing import List from flask import Blueprint, request, redirect, abort from flask_login.utils import login_required from datetime import datetime, timedelta, timezone from flask.templating import render_template from flask_login import current_user from mib.rao.user_manager import UserM...
squad03mib/api-gateway
mib/views/messages.py
messages.py
py
5,044
python
en
code
0
github-code
36
23469121006
import yaml,os class Common_funcs(): def get_datas(self,path:str)-> list: # 打开文件 current_path = os.getcwd().split("lagou05")[0] #print(current_path) with open(current_path+"\\lagou05"+path) as f: datas = yaml.safe_load(f) #print(datas) # 获取文件中key为d...
testroute/lagou05
Common/Read_yaml.py
Read_yaml.py
py
1,286
python
zh
code
null
github-code
36
71275872103
# Import packages from copy import deepcopy from math import exp from helpers import * from worlds import * # This is our Player class. I assume that from a cognitive standpoint it makes # sense that all players have access to literal meanings, so I put them there # Otherwise not very interesting class Player: def...
LangdP/SMIC_boltanski_thevenot
ver_2/players.py
players.py
py
4,795
python
en
code
0
github-code
36
24856735986
def max_multiple(num, boundary): max_mult = 0 for i in range(1, boundary + 1): if i > 0 and i % num == 0: max_mult = i print(max_mult) divisor = int(input()) count = int(input()) max_multiple(divisor, count)
BorisAtias/SoftUni-Python-Fundamentals-course
Basic Syntax, Conditional Statements and Loops - Exercise/04. Maximum Multiple.py
04. Maximum Multiple.py
py
253
python
en
code
0
github-code
36
35909112249
''' Created on 22/03/2015 @author: chips ''' from FGAme.core import EventDispatcherMeta, signal, conf from FGAme.draw import Color, Shape from FGAme.util import lazy DEBUG = False class HasVisualization(object): _is_mixin_ = True _slots_ = ['_color', '_linecolor', '_linewidth'] def _init_has_visualizat...
macartur-UNB/FGAme
src/FGAme/objects/mixins.py
mixins.py
py
2,803
python
en
code
null
github-code
36
1206611132
"""Utils functions.""" import datetime def MillisecondsSinceEpoch(hours): """Returns time in milliseconds since epoch for given time in hours. Args: hours: Int, the hours of the future timestamp. Returns: Int, the future timestamp in milliseconds. """ hours = datetime.datetime.no...
DomRosenberger/google_bigquery
google_bigquery/common/utils.py
utils.py
py
479
python
en
code
2
github-code
36
27757120954
# -*- coding: utf-8 -*- """ Created on Sun Nov 15 15:44:55 2020 @author: ardaegeunlu """ import re def LCCSortComparison(call1, call2): preCutter1, postCutter1 = SeperateViaCutter(call1) preCutter2, postCutter2 = SeperateViaCutter(call2) preCutterComp = PreCutterComparison(preCutter1, preCutter...
ardaegeunlu/Library-of-Congress-Classification-Sorter
sort_comparison.py
sort_comparison.py
py
4,939
python
en
code
1
github-code
36
74202841385
import pyaudio import numpy as np FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 16000 CHUNK_SIZE = 1000 MAX_INT16 = np.iinfo(np.int16).max p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, output=True) for i in range(0, 18): print(i)...
gmamaladze/tf-voice-pi
tfvoicepi/tools/play.py
play.py
py
663
python
en
code
1
github-code
36
32527125731
#!/usr/bin/env python # coding: utf-8 # In[2]: # input_data import numpy as np import pandas as pd import pickle as pkl def load_dc_data(dataset): dc_adj1 = pd.read_csv('C:/YimingXu/Micromobility_DL/data/adjacency_selected.csv') adj1 = np.mat(dc_adj1) dc_adj2 = pd.read_csv('C:/YimingXu/Micromobility_D...
xuyimingxym/MicroMobility-DL
Multi-GCN_GRU.py
Multi-GCN_GRU.py
py
13,757
python
en
code
0
github-code
36
30143632560
from itertools import product # from PyMiniSolvers import minisolvers import os def req1(n: int, N: int, disjunctions_list): i_range = range(n, N + n) for i in i_range: clauses = [(f"t_{i}_0_0_" ), (f"t_{i}_0_1_" ), (f"t_{i}_1_0_" ), (f"-t_{i}_1_1_" )] disjunctions_list.exten...
PeterLarochkin/discrete_structures
HM2/final.py
final.py
py
8,046
python
en
code
2
github-code
36
20763051017
import os import json import time from datetime import datetime # Importing shared dependencies from task_management import task_list from ai_agent_management import ai_agents sync_status = {} def autoSync(): while True: time.sleep(60) # Sync every minute sync_status['last_sync'] = datetime.now(...
shadowaxe99/c
TaskMaster/src/auto_sync.py
auto_sync.py
py
668
python
en
code
0
github-code
36
3598532170
import unittest import sys import numpy as np sys.path.append('.') import ladi.preprocess as pp np.random.seed(1) class Test_preprocess(unittest.TestCase): def test_round_to_zero(self): T = 0.2 arr = np.random.normal(0., 1., size=(64,64)) rounded_arr = pp.round_to_zero(arr, T) sum1...
asenogles/ladi
tests/test_preprocess.py
test_preprocess.py
py
479
python
en
code
0
github-code
36
29197653617
import re import json import torch import logging from tokenizers import ByteLevelBPETokenizer from os.path import exists, join, abspath from . import Target, Entity from models.pre_abstract.model import LSTMTagger class PreAbstractParser(Target): def __init__(self, model_dir, device="cpu"): super().__ini...
kherud/native-language-identification
pipeline/pipes/pre_abstract.py
pre_abstract.py
py
5,835
python
en
code
1
github-code
36
29314289325
from django.shortcuts import render, redirect from django.contrib import messages from .models import * import bcrypt # Create your views here. def main(request): if 'logged_in' in request.session: # messages.success(request,"Welcome to Tom's Library!"), return render(request, 'main/index.html',{...
tomnguyen103/Coding_Dojo
python_stack/django/Project1/apps/main/views.py
views.py
py
8,660
python
en
code
0
github-code
36