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
5542097679
from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError, Warning import ipdb from odoo.addons import decimal_precision as dp class DepositoMakeInvoice(models.TransientModel): _name = 'deposito.make.invoice' _description = 'Deposito Crear Factura' def cargar_campos_im...
LFer/ras
deposito/wizard/product_service_make_invoice.py
product_service_make_invoice.py
py
7,933
python
en
code
0
github-code
36
15616400542
from typing import Dict from tools.coco_dataset_metrics import COCODatasetMetrics from tools.tools import load_json_data from detectron2_metrics import TrainingMetrics, InferenceMetrics def load_annotations(annotation_paths: Dict): """ Load annotations from path and assign them to corresponding key. :par...
Mathiasn21/household_object_detection
code/plot_metrics.py
plot_metrics.py
py
2,100
python
en
code
0
github-code
36
15576803575
A, B = map(int, input().split()) sosu_list = [] for i in range(A, B + 1): if i == 1: continue for j in range(2, int(i**0.5)+1): if i % j == 0: # 너 소수아님 break else: print(i)
HelloWook/AlgorithmStudy
백준/Silver/1929. 소수 구하기/소수 구하기.py
소수 구하기.py
py
234
python
en
code
0
github-code
36
70585526504
import sys, copy from udp_interface import udp_interface import numpy as np import os # from ppo.run import train # from baselines.common import tf_util as U from utils.action_filter import ActionFilterButter from utils.reference_generator import ReferenceMotionGenerator from collections import deque from utils.utilit...
yichen928/RSR_Goalkeeper
src/rl_control/env.py
env.py
py
18,624
python
en
code
0
github-code
36
13744203488
import glob import os import requests import time import sys import numpy as np import pandas as pd from pandas.core.frame import DataFrame from geocoding_api_extract.utils.progress import Progress def create_geocoding_api_request_str(street, city, state, benchmark='Public_AR_Ce...
AndoKalrisian/geocoding_api_extract
src/geocoding_api_extract/__init__.py
__init__.py
py
9,005
python
en
code
0
github-code
36
10346633894
def last_digit(n1, n2): if n1 is None or n2 is None: raise ValueError("Both inputs must not be None") if not isinstance(n1, int) or not isinstance(n2, int) or isinstance(n1, bool) or isinstance(n2, bool): raise TypeError("Both inputs must be integers") if n1 < 0 or n2 < 0: raise V...
Takhar1/code_wars_katas
lastDigitOfLargeNumber/lastDigit.py
lastDigit.py
py
446
python
en
code
0
github-code
36
24390099064
import re from . import builder, cc, msvc from .. import log, shell from .common import choose_builder, guess_command, make_command_converter from ..languages import known_langs with known_langs.make('rc') as x: x.vars(compiler='RC', flags='RCFLAGS') x.exts(source=['.rc']) _c_to_rc = make_command_converter([...
jimporter/bfg9000
bfg9000/tools/rc.py
rc.py
py
1,858
python
en
code
73
github-code
36
70585542504
## # 邮件自动推送 -- 20191105 created by terrell # 配置相关变量 # 设置主题、正文等信息 # 添加附件 # 登录、发送# import time import os import smtplib import email import datetime import sys import traceback from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText year = in...
yudongjian/remember_word_tkinter
sent_mailToLeo.py
sent_mailToLeo.py
py
2,257
python
en
code
0
github-code
36
31063677025
from ..utils import Object class LoginUrlInfoRequestConfirmation(Object): """ An authorization confirmation dialog needs to be shown to the user Attributes: ID (:obj:`str`): ``LoginUrlInfoRequestConfirmation`` Args: url (:obj:`str`): An HTTP URL to be opened d...
iTeam-co/pytglib
pytglib/api/types/login_url_info_request_confirmation.py
login_url_info_request_confirmation.py
py
1,365
python
en
code
20
github-code
36
39845550652
""" Iguana (c) by Marc Ammon, Moritz Fickenscher, Lukas Fridolin, Michael Gunselmann, Katrin Raab, Christian Strate Iguana is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. You should have received a copy of the license along with this work. If not, see <http://creativecommons.org...
midas66/iguana
src/timelog/validators.py
validators.py
py
1,138
python
en
code
null
github-code
36
24490610851
auth_google = config_get('auth_google', False) if auth_google: import urllib2 from gluon.contrib.login_methods.oauth20_account import OAuthAccount client_id = config_get('google_client_id', None) client_secret = config_get('google_client_secret', None) class googleAccount(OAuthAccount): AU...
opensvc/collector
init/models/auth_google.py
auth_google.py
py
1,865
python
en
code
0
github-code
36
33164677249
""" 2019 La Brachistochrone Réelle Un TIPE réalisé par Gautier BEN AÏM http://tobog.ga """ import numpy as np # # I. Calculs physiques # ====================== # def generer_lign...
GauBen/Toboggan
toboggan.py
toboggan.py
py
14,074
python
fr
code
1
github-code
36
27435770961
import os import pathlib from matplotlib import pyplot as plt from skimage import io, img_as_float from skimage.color import rgb2gray from skimage.filters.edges import sobel from skimage.segmentation import felzenszwalb, watershed, mark_boundaries, slic, quickshift def read_boundaries(_img): # Read image _i...
206081/psio
Lab3/zad3.py
zad3.py
py
2,134
python
en
code
0
github-code
36
12486383692
''' Created on Jan 29, 2020 @author: Michal.Busta at gmail.com ''' import numpy as np import neptune class Meter: '''A meter to keep track of losses scores throughout an epoch''' def __init__(self, phase, epoch, use_neptune=False, log_interval = 100, total_batches = 100): self.metrics = {} self.r...
drivendataorg/open-cities-ai-challenge
3rd Place/meter.py
meter.py
py
1,744
python
en
code
113
github-code
36
31867884735
from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() version = {} with open(path.join(here, "sonocrop", "__version__.p...
davycro/sonocrop
setup.py
setup.py
py
1,442
python
en
code
6
github-code
36
38232459709
""" 获取csdn用户资料 """ import sys import json sys.path.append(r'D:\github\python\python-spider') from csdnTest import * #1.链接本地数据库服务 name = MongoClient('localhost') #2.链接本地数据库 demo 没有会创建 db = name.demo #demo数据库名 # 3.创建,连接集合 emp = db.employees # employees集合名 user = db.csdn_users # page集合名 # 爬取‘前端’模块 category = 'web' ...
guosimin/python-spider
csdnTest/getUser.py
getUser.py
py
2,266
python
en
code
6
github-code
36
16738074050
lista = [] par = [] imp = [] resp = ' ' while True: lista.append(int(input('Digite um número: '))) resp = str(input('Quer continuar [S/N]: ')).strip().upper()[0] if 'N' in resp: break for i, v in enumerate(lista): if v % 2 == 0: par.append(v) else: imp.append(v) print(f'O núm...
TiagoFar/PythonExercises
ex082.py
ex082.py
py
437
python
pt
code
0
github-code
36
4409217473
from time import sleep import requests class AntiCaptcha: def __init__(self, client_key): self.base_url = "https://api.anti-captcha.com/" self.headers = {"Content-Type": "Application/json"} self.client_key = client_key def _post(self, endpoint: str, data: object): """Make requ...
ShayBox/AntiCaptcha
anticaptcha/main.py
main.py
py
2,693
python
en
code
3
github-code
36
38877688552
import pandas as pd import numpy as np # For preprocessing the data from sklearn.preprocessing import Imputer from sklearn import preprocessing # To split the dataset into train and test datasets from sklearn.cross_validation import train_test_split # To model the Gaussian Navie Bayes classifier from sklearn.naive_baye...
XecureBot/DeepikaDS
data.py
data.py
py
2,534
python
en
code
0
github-code
36
34350297600
# -*- coding: utf-8 -*- """ Created on Tue May 7 17:29:34 2019 @author: Administrator """ r = 'RESTART' # Reverse of 'RESTART' r = r[::-1] # Now the string is 'TRATSER' # Replacing Initial 'R' r = r.replace('R', '$', 1) # Now the string is T$ARSER # Printing reverse of it i.e. 'RESTA$T' print(r[::-1])
MohitBansal1999/forsk
d1/restrart.py
restrart.py
py
308
python
en
code
1
github-code
36
14031447002
""" N N NN N N N N N NN N N """ n=int(input("enter the number of rows:")) for i in range(1,n+1): for j in range(1,n+1): if (i==j) or (j==1)or (j==n): print("N",end="") else: print(" ",end="") print()
aravind225/hackerearth
n pattern.py
n pattern.py
py
279
python
en
code
1
github-code
36
7207928507
print("1 sposob *****") def decorator(func): # nazwa funkcji ktora bedzie udekorowana def wrapper(): print("------------") func() print("------------") return wrapper def hello(): print("Hello World") hello2 = decorator(hello) hello2() print("2 sposob ******") @decorator ...
0xbm/Courses
KoW_YT/23.dekoratory.py
23.dekoratory.py
py
518
python
pl
code
0
github-code
36
10328382240
from django.shortcuts import render,redirect,get_object_or_404 from django.http import HttpResponse from .models import Item,Category import datetime # Create your views here. def index(request): tasks = Item.objects.all() categories = Category.objects.all() context = {"task_list" : tasks, ...
FazalJarral/Notetaker
todo/views.py
views.py
py
1,004
python
en
code
0
github-code
36
72071449384
import time import random def l(): print("This program will ask you for a list of animals and then tell where the animal is in the list") time.sleep(0.5) print("Please type a list of animals with a space inbetween each") arr = input() print() lst = list(map(str,arr.split( ))) time.slee...
dandocmando/Python-Answers-by-dandocmando
PT15_15.1.py
PT15_15.1.py
py
593
python
en
code
0
github-code
36
8596743224
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Extract persistent network by removing ephemeral links and adding missing links. Two filters: 1. at least 100 daily views for target video 2. the mean daily views of source video is at least 1% of the target video Usage: python extract_persistent_network.py Input data...
avalanchesiqi/networked-popularity
wrangling/extract_persistent_network.py
extract_persistent_network.py
py
4,496
python
en
code
11
github-code
36
38568577899
''' 298. Binary Tree Longest Consecutive Sequence Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The length consecutive path need to be from parent to child (c...
archanakalburgi/Algorithms
testPrepration/BTLongestConsecSequence.py
BTLongestConsecSequence.py
py
1,772
python
en
code
1
github-code
36
17849635757
from ..config import ElementName as BasicElementName, extract_display_name, ReactionConfig, \ NetworkGeneralConfig, ParameterName from ..metabolic_network_elements.reaction_element import ReactionElement class Reaction(object): def __init__( self, reaction_name, reversible=False, reaction_start_en...
LocasaleLab/Automated-MFA-2023
figures/figure_plotting/figure_elements/metabolic_network/metabolic_network_contents/reaction.py
reaction.py
py
12,308
python
en
code
0
github-code
36
22782780958
# # @lc app=leetcode id=21 lang=python3 # # [21] Merge Two Sorted Lists # # https://leetcode.com/problems/merge-two-sorted-lists/description/ # # algorithms # Easy (57.29%) # Likes: 11001 # Dislikes: 1011 # Total Accepted: 2M # Total Submissions: 3.4M # Testcase Example: '[1,2,4]\n[1,3,4]' # # You are given the ...
Zhenye-Na/leetcode
python/21.merge-two-sorted-lists.py
21.merge-two-sorted-lists.py
py
1,892
python
en
code
17
github-code
36
1398892267
from flask import Flask,render_template from time import time class Blockchain: def __init__(self): self.transactions = [] self.chain = [] self.create_block(0, '00') def create_block(self, nonce, previous_hash): block = { 'block_number': len(self.chain)+1, ...
Thilagavathycse/Block-Chain-learnings
blockchain.py
blockchain.py
py
687
python
en
code
0
github-code
36
73577910183
import os, sys import numpy as np import pickle from UserCode.HGCalMaskResolutionAna import Argparser from array import array as Carray from collections import OrderedDict from ROOT import TCanvas, TLatex, TFile, TMath, TH1F from ROOT import TLegend, TH2F, TLorentzVector, TProfile, TH1D, TGraphErrors from ROOT import ...
bfonta/HGCal
HGCalMaskResolutionAna/scripts/analysis.py
analysis.py
py
30,149
python
en
code
0
github-code
36
73774729063
import torch from torch import nn import torch.nn.functional as F import os import math import numpy as np from train_pipeline import * def init_siren(W, fan_in, omega=30, init_c=24, flic=2, is_first=False): if is_first: c = flic / fan_in else: c = np.sqrt(init_c / fan_in) / omega W.unif...
kilianovski/my-neural-fields
notebooks/draft_01/sweep_pipeline.py
sweep_pipeline.py
py
6,628
python
en
code
0
github-code
36
6347811698
# 클래스 객체지향 # 클래스 생성 class Person: # 클래스 정의 ()없음 name = '익명' height = '' gender = '' blood_type = 'A' # 1. 초기화 추가 # def __init__(self): # self.name = '홍길동' # self.height = '170' # self.gender = 'male' # self.blood_type = 'AB' def __init__(self, name = '홍동현', ...
d0ng999/basic-Python2023
Day04/code22_person.py
code22_person.py
py
1,770
python
ko
code
0
github-code
36
5756767654
import base64 import os from io import BytesIO, StringIO from pprint import pprint import easyocr import pandas as pd from PIL import Image import streamlit as st bn_reader = easyocr.Reader(['bn'], gpu=True) en_reader = easyocr.Reader(['en'], gpu=True) def get_nid_image(image_url): image_data = base64.b64decod...
bhuiyanmobasshir94/Computer-Vision
notebooks/colab/cv/ocr/ekyc/nid_scanner_with_streamlit_app.py
nid_scanner_with_streamlit_app.py
py
4,287
python
en
code
0
github-code
36
27687264440
from WGF import GameWindow, AssetsLoader, shared from os.path import join import logging log = logging.getLogger(__name__) SETTINGS_PATH = join(".", "settings.toml") LEADERBOARD_PATH = join(".", "leaderboard.json") LB_LIMIT = 5 def load_leaderboard(): if getattr(shared, "leaderboard", None) is None: fr...
moonburnt/WeirdLand
Game/main.py
main.py
py
4,372
python
en
code
1
github-code
36
30643576972
#Michal Badura #simple Logistic Regression class with gradient checking import numpy as np from numpy.linalg import norm import pickle, gzip class LogisticRegression(): """ Logistic regression, trained by gradient descent """ def __init__(self, nin, nout): #adding one row for bias ...
michbad/misc
logreg.py
logreg.py
py
4,531
python
en
code
0
github-code
36
32518923983
#username - omrikaplan #id1 - 319089256 #name1 - Omri Kaplan #id2 - 209422054 #name2 - Barak Neuberger import random """A class represnting a node in an AVL tree""" import math import random import sys class AVLNode(object): """Constructor, you are allowed to add more fields. @type...
BarakNeu/Software-Stractures-Project1
avl_template_new.py
avl_template_new.py
py
14,892
python
en
code
0
github-code
36
21011472446
import os from pytest import raises from pydantic.error_wrappers import ValidationError from pathlib import Path from unittest import TestCase from lazy_env_configurator import BaseConfig, BaseEnv from lazy_env_configurator.custom_warnings import EnvWarning class TestInvalidEnv(TestCase): def test_eager_validati...
satyamsoni2211/lazy_env_configurator
tests/test_eager_validation.py
test_eager_validation.py
py
1,131
python
en
code
2
github-code
36
40280870495
import cv2 import numpy as np import argparse import random import os import os.path as osp from sklearn.feature_extraction import image # import imutils from tqdm import tqdm,trange # argument parser ''' dataNum: How many samples you want to synthesize load_image_path: Path to l...
Chushihyun/MT-DETR
data/datagen_fog.py
datagen_fog.py
py
6,879
python
en
code
22
github-code
36
21333304207
import unittest from climateeconomics.sos_processes.iam.witness.witness_coarse.usecase_witness_coarse_new import Study from sostrades_core.execution_engine.execution_engine import ExecutionEngine from tempfile import gettempdir from copy import deepcopy from gemseo.utils.compare_data_manager_tooling import delete_keys_...
os-climate/witness-core
climateeconomics/tests/_l1_test_witness_parallel.py
_l1_test_witness_parallel.py
py
4,198
python
en
code
7
github-code
36
17878440373
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: r""" Measures based on noise measurements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _iqms_cjv: - :py:func:`~mriqc.qc.anatomical.cjv` -- **coefficient of joint variation** (:abbr:`CJV (coefficient of join...
pGarciaS/PREEMACS
scripts/mriqc/mriqc/qc/anatomical.py
anatomical.py
py
21,630
python
en
code
8
github-code
36
4932293353
from transformers import GPT2Tokenizer import json import matplotlib.pyplot as plt ## This file was used to find the length of our longest input in tokens and visualize the distribution of token length with open('./combined_data.jsonl', 'r') as json_file: json_list = list(json_file) tokenizer = GPT2Tokenizer.f...
brennanem/CS324FinalProject
check_tokens.py
check_tokens.py
py
958
python
en
code
0
github-code
36
24609091
from django.contrib.auth.models import User from django.shortcuts import redirect, render, get_object_or_404 from .models import Post,Comment from .forms import NewCommentForm # Create your views here. from qna.models import Question from django.http import JsonResponse from django.contrib.auth.decorators import login...
adityachaudhary147/MindQ
post/views.py
views.py
py
3,755
python
en
code
1
github-code
36
7209827647
import unittest import os.path from bundle.bundle import Bundle from bundle.types import BundleType # List of commonly installed apps. MAS_APPS = ["Pages.app", "Keynote.app", "Numbers.app", "WhatsApp.app", "Xcode.app", "The Unarchiver.app"] MAS_APP = None for app in MAS_APPS: path = os.path.join("/Applications/",...
0xbf00/maap
tests/test_application.py
test_application.py
py
1,761
python
en
code
8
github-code
36
1767000003
from setuptools import setup, find_packages REQUIREMENTS = [] with open("requirements.txt") as f: for line in f.readlines(): line = line.strip() if len(line) == 0: continue REQUIREMENTS.append(line) setup( name = "wallstreet", version = "0.1", packages = find_packag...
breakhearts/wallstreet
setup.py
setup.py
py
605
python
en
code
0
github-code
36
6187883293
from __future__ import annotations from datetime import datetime, time from discord.ext import tasks from app.log import logger from app.utils import is_last_month_day, is_sunday, catch_exception from app.utils.message_stats_routine import UserStatsForCurrentDay, message_day_counter from app.utils.data.user_stats im...
range-kun/pituhon-bot
app/utils/message_stats_routine/user_stats_routine.py
user_stats_routine.py
py
3,790
python
en
code
0
github-code
36
503262151
from dataclasses import * # frozen=True makes the class immutable. # The class can be modified internally with a copy of itself using dataclasses.replace(). @dataclass(frozen=True) class Rover: facing : str def turn_right(self): directions = ["N", "E", "S", "W"] #sorted clockwise ...
alelom/Python_TDD
04-Duplication-RuleOfThree/Rover.py
Rover.py
py
397
python
en
code
0
github-code
36
30586982057
#!/usr/bin/env python # -*- coding: utf-8 -*- import wx from regionfixer_core.version import version_string as rf_ver from gui.version import version_string as gui_ver class AboutWindow(wx.Frame): def __init__(self, parent, title="About"): wx.Frame.__init__(self, parent, title=title, ...
Fenixin/Minecraft-Region-Fixer
gui/about.py
about.py
py
2,684
python
en
code
509
github-code
36
40142994549
import random play = True list = [] while play: count = 0 sum = 0 average = 0 diceTimes = int(input("How many times would you like to roll?\n")) print("============") while (count < diceTimes): num = random.randint(1, 6) list.append(num) count += 1 # Print out all s...
DorisYY/Challenge2
C2.py
C2.py
py
1,096
python
en
code
0
github-code
36
71232207785
import torch from typing import Optional, Dict, Any, Tuple from transformers import ( AutoConfig, AutoTokenizer, T5ForConditionalGeneration, MT5ForConditionalGeneration, MT5EncoderModel ) from parlai.agents.hugging_face.t5 import T5Agent, ParlaiT5Model #from transformers.models.mt5.modeling_mt5 imp...
evelynkyl/xRAD_multilingual_dialog_systems
parlai_internal/agents/hugging_face/mt5.py
mt5.py
py
6,563
python
en
code
1
github-code
36
2019695848
#!/usr/bin/env python3.6 # -*-encoding=utf8-*- import time import pyquery import requests from fake_useragent import UserAgent from spider.log import logging as log class Get: def __init__(self, url: str, try_time=9, try_sec=2): ua = UserAgent() self._url = url self._try_time = try_time self._try_sec = try_s...
dingjingmaster/library_t
python/spider/spider/get.py
get.py
py
1,374
python
en
code
0
github-code
36
1641551953
# -*- coding: utf-8 -*- import json from datetime import datetime from twisted.internet import reactor from twisted.web.http import BAD_REQUEST from twisted.web.server import NOT_DONE_YET from config.config import CHAT_PER_PAGE, CHAT_CONNECTION_INTERVAL from exception import BadRequest from helper.chat_cmd import Cha...
PoolC/Yuzuki
resource/chat.py
chat.py
py
6,624
python
en
code
10
github-code
36
12532858756
from setuptools import setup with open('README.md') as f: long_description = f.read() setup( name = "moderate", version = "0.1", license = 'MIT', description = "A Python Distrubted System", author = 'Thomas Huang', url = 'https://github.com/thomashuang/Moderate', packages = ['moderat...
whiteclover/Moderate
setup.py
setup.py
py
676
python
en
code
0
github-code
36
8365368260
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019/7/18 10:04 # @Version : Python 3.7.1 import os import re class Infinit: def __iter__(self): return self def __next__(self): return None def connect(): # 通过任务管理器查看PID,再用cmd查找PID对应的端口 os.popen('adb connect 127.0.0.1:6200...
Xiexinxmh/master
python tools/Android emulator code scanning input(for single-data).py
Android emulator code scanning input(for single-data).py
py
984
python
en
code
0
github-code
36
32697179622
import pandas as pd import os.path # needs to put this file under sensing folder class Attr: def __init__(self): self.activity = [] i = 0 while (i < 60): if (i < 10 and os.path.exists("activity/activity_u0"+str(i)+".csv")): self.activity.append(pd.read_csv("a...
z5036602/ROCK_and_ROLL
read.py
read.py
py
643
python
en
code
0
github-code
36
1379123460
import cv2 import time from eye_tracking import EyeTracking eye_tracking = EyeTracking() webcam = cv2.VideoCapture(0) while True: _, frame = webcam.read() if frame is None: break eye_tracking.refresh(frame) frame = eye_tracking.annotated_frame() text = "" attention_text = "" if...
dead4s/SpaHeron_MachineLearning_UXIS
eye_tracking/main.py
main.py
py
2,111
python
en
code
3
github-code
36
37411929075
import os import numpy as np import matplotlib.pyplot as plt from hyperion.model import ModelOutput from hyperion.util.constants import pc # Create output directory if it does not already exist if not os.path.exists('frames'): os.mkdir('frames') # Open model m = ModelOutput('flyaround_cube.rtout') # Read image...
hyperion-rt/hyperion
docs/tutorials/scripts/flyaround_cube_animate.py
flyaround_cube_animate.py
py
1,402
python
en
code
51
github-code
36
70306634025
from audioop import reverse from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db import transaction from django.http.response import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from registration.forms import SignupForm from user.models i...
Hosseinyousefi23/smallApp
registration/views.py
views.py
py
1,854
python
en
code
0
github-code
36
29696828936
import utils import numpy as np def parse_input(path): lines = utils.read_lines(path) paths = [[utils.parse_coord_str(p) for p in l.split(" -> ")] for l in lines] height = 0 width = 0 for path in paths: for p in path: width = max(width, p[0]) height ...
dialogbox/adventofcode
py/2022/day14.py
day14.py
py
2,028
python
en
code
0
github-code
36
29084870079
from sklearn.datasets import fetch_20newsgroups from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classification_report def naviebayes(): news = fetch_20newsgroups(data_home='./...
shnehna/machine_study
朴素贝叶斯算法/NB.py
NB.py
py
1,039
python
en
code
0
github-code
36
37626028800
from flask import Blueprint, redirect, render_template, session, url_for from .forms import InfoForms from flask_learning.models import Post from datetime import datetime date_time = Blueprint('date_time_picker', __name__) @date_time.route("/dating", methods=['GET', 'POST']) def select_date_time(): form = InfoFo...
SunnyYadav16/Flask_Learning
flask_learning/date_time_picker/routes.py
routes.py
py
1,121
python
en
code
0
github-code
36
4917735234
from os import path import os import openalea.strawberry as strawberry from openalea.strawberry import import_mtgfile from openalea.strawberry import visu3d import openalea.mtg.mtg as mtg from openalea.mtg.algo import orders import openalea.plantgl.all as pgl import format_io as f_io DATA = "/".join(strawberry.__f...
thomasarsouze/plantconvert
demo/strawberry/generate_opf_strawberry.py
generate_opf_strawberry.py
py
2,384
python
en
code
0
github-code
36
43831264470
from datetime import datetime, timedelta from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union from uuid import UUID from eventsourcing.domain.model.aggregate import AggregateRoot # Locations in the world. class Location(Enum): HAMBURG = "HAMBURG" HONGKONG = "HONGKON...
johnbywater/es-example-cargo-shipping
cargoshipping/domainmodel.py
domainmodel.py
py
9,436
python
en
code
3
github-code
36
24981710765
import pandas as pd import numpy as np from typing import Tuple import os import seaborn as sns import matplotlib.pyplot as plt from fancyimpute import IterativeImputer import sys sys.path.append('.') def load_all_data(basepath: str, names_files: list) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: """aim...
infini11/MLOps-project
src/preprocessing.py
preprocessing.py
py
9,913
python
en
code
0
github-code
36
34180539673
import os from django.conf import settings from django.core.management.base import BaseCommand from django.utils import timezone from viewer.models import ( Target, Molecule, MoleculeTag, TagCategory ) from scoring.models import MolGroup class Command(BaseCommand): help = 'Add moleculeTag record f...
xchem/fragalysis-backend
viewer/management/commands/tags_from_sites.py
tags_from_sites.py
py
5,073
python
en
code
4
github-code
36
17772414022
import swapper from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from formula_one.mixins.period_mixin import ActiveStatus def get_role(person, role_name, active_status=ActiveStatus.ANY, silent=False, *args, **kwargs): """ Get a role corresponding to ...
IMGIITRoorkee/omniport-backend
omniport/core/kernel/managers/get_role.py
get_role.py
py
2,280
python
en
code
67
github-code
36
4814315395
from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("https://www.example.com") # Get element with tag name 'div' element = driver.find_element(By.TAG_NAME, 'div') # Get all the elements available with tag name 'p' elements = element.find_elements(...
Duyanhdda/IOT-LAB
a.py
a.py
py
374
python
en
code
0
github-code
36
39844703302
""" Iguana (c) by Marc Ammon, Moritz Fickenscher, Lukas Fridolin, Michael Gunselmann, Katrin Raab, Christian Strate Iguana is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. You should have received a copy of the license along with this work. If not, see <http://creativecommons.org...
midas66/iguana
src/common/validators.py
validators.py
py
986
python
en
code
null
github-code
36
30170451702
""" written in Python 3 Find all the solutions of a given board. Algorithm: backtracking (dfs) in an optimal order 1. Keep track of candidates of each cell. 2. Find the cell with fewest candidates. Fill the cell with one of the candidates. Update the candidates of other cells. 3. Repeat step 2 until solved. Or if the...
Roger-Wu/sudoku-solver
SudokuSolver.py
SudokuSolver.py
py
7,226
python
en
code
1
github-code
36
74176385062
''' This file is used to ge through and upload metadata to cloud storage for artist submissions ''' #imports import datetime import os import firebase_admin from firebase_admin import credentials, firestore import google.cloud # can potentially execute the cloud utils rsync here if we want all in one # authorizatio...
reyluno/isolatingtogether.github.io
utils/dbUpdate.py
dbUpdate.py
py
3,428
python
en
code
1
github-code
36
42509586676
import random import math import sys import string import copy class Board(object): COLORS = string.ascii_uppercase def __init__(self, orig=None, size=10, color=4): self.COLORS = self.COLORS[0:color]#random.sample(self.COLORS, k=color) self.size = size self.board = [[' ' for i in ...
LeanMilk/Flood-It
Flood-It/board.py
board.py
py
5,443
python
en
code
0
github-code
36
17837907452
# -*- coding: utf-8 -*- # B import sys from collections import defaultdict, deque from heapq import heappush, heappop import math import bisect input = sys.stdin.readline # 再起回数上限変更 # sys.setrecursionlimit(1000000) N= int(input()) A = list(map(int, input().split())) A.sort() ans = 1 for a in A: ans *= a if ...
hsuetsugu/atc
ABC169/B.py
B.py
py
449
python
en
code
0
github-code
36
5813639636
# type: ignore import os import pathlib import subprocess import gnupg import pytest import requests import toml def pytest_collect_file(file_path, parent): if file_path.suffix == ".sh" and file_path.name.startswith("test_"): return ScriptFile.from_parent(parent, path=file_path) class ScriptFile(pytes...
pulp/pulp-cli
pytest_pulp_cli/__init__.py
__init__.py
py
5,190
python
en
code
26
github-code
36
15556149755
from __future__ import annotations import numpy as np from typing import List from .meshdata import MeshCode from . import R, rad2deg, deg2rad class Point: def __init__( self, latitude: float, # <deg> longitude: float, # <deg> elevation: float = None, # <me...
kawa-yo/DiamonPearl
engine/utils/point.py
point.py
py
2,509
python
en
code
0
github-code
36
35715668806
import os from mercurial import hg, ui from mercurial.hgweb.hgwebdir_mod import hgwebdir os.mkdir('webdir') os.chdir('webdir') webdir = os.path.realpath('.') u = ui.ui() hg.repository(u, 'a', create=1) hg.repository(u, 'b', create=1) os.chdir('b') hg.repository(u, 'd', create=1) os.chdir('..') hg.repository(u, 'c', ...
helloandre/cr48
bin/mercurial-1.7.5/tests/test-hgwebdir-paths.py
test-hgwebdir-paths.py
py
1,066
python
en
code
41
github-code
36
41902628523
numero = list(); while (True): num = float(input("Informe um valor: ")); if num in numero: print("O valor já foi adicionado anteriormente"); else: numero.append(num); print("Valor adicionado com sucesso"); opt = str(input("Deseja continuar/ [S/N]: ")).strip().upper(); while((...
renansald/Python
cursos_em_video/Desafio79.py
Desafio79.py
py
576
python
pt
code
0
github-code
36
19993372010
import re import argparse import japanize_matplotlib import matplotlib.pyplot as plt from moviepy.editor import VideoClip from moviepy.video.io.bindings import mplfig_to_npimage def validate_date(date): if re.match(r"^\d{4}/\d{1,2}/\d{1,2}", date): return date else: raise argparse.ArgumentTyp...
HRTK92/line-to-movie
line_to_video.py
line_to_video.py
py
5,704
python
en
code
0
github-code
36
25718308081
read_me = """Python 3 script that logs data from the Meraki dashboard into a MongoDB database. You will need to have MongoDB installed and supply a configuration file for this script to run. You can get the MongoDB Community Server here: https://www.mongodb.com/try/download/community You can find a sample configurat...
meraki/automation-scripts
offline_logging/offline_logging.py
offline_logging.py
py
24,201
python
en
code
361
github-code
36
25218293506
n = int(input("Please enter a square size ")) if n % 2 == 0: n = int(input("Please enter uneven number ")) if n % 2 == 1: for i in range(n): for j in range(n): if ((i == (n-1)/2) and (j != (n-1))) or (i != (n-1)/2 and j == (n-1)/2): print("+ ", end=" ") elif (i ==...
OkanZengin/Python_Learning
Games/star_and_sum.py
star_and_sum.py
py
565
python
en
code
0
github-code
36
20039489365
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import open from builtins import super from builtins import str from future import standard_library from future.utils import with_metaclass standard_library....
kineticadb/kinetica-api-python
gpudb/packages/avro/avro_py3/ipc.py
ipc.py
py
21,544
python
en
code
13
github-code
36
42937554918
import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * # TP1 # SKOCZYLAS Nestor & FRET Gaëlle class MainWindow(QMainWindow): def __init__(self): super().__init__() self.resize(200,300) self.textEdit = QTextEdit(self) bar = self.menuBar() ...
nestorskoczylas/Licence3_Informatique
Semestre 5/IHM/tp_pyqt1/mainWindow.py
mainWindow.py
py
3,500
python
en
code
1
github-code
36
35919457830
from django.shortcuts import render, redirect from .models import * from login.models import * from django.contrib import messages from datetime import date, datetime # Create your views here. def appointments(request): if 'user_id' not in request.session: return redirect('/') today = datetime.now() ...
AlexUrtubia/appointments
appo_app/views.py
views.py
py
3,521
python
en
code
0
github-code
36
29085620425
import random from threading import Timer from typing import Union, List from zone_api.audio_manager import Genre, get_music_streams_by_genres, get_nearby_audio_sink from zone_api.core.devices.weather import Weather from zone_api.core.parameters import ParameterConstraint, positive_number_validator, Parameters from zo...
yfaway/zone-apis
src/zone_api/core/actions/announce_morning_weather_and_play_music.py
announce_morning_weather_and_play_music.py
py
5,234
python
en
code
2
github-code
36
31952638633
''' EXERCÍCIOS: 2) Dado a sequência de Fibonacci, onde se inicia por 0 e 1 e o próximo valor sempre será a soma dos 2 valores anteriores (exemplo: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34...), escreva um programa na linguagem que desejar onde, informado um número, ele calcule a sequência de Fibonacci e retorne uma mensagem avi...
bruno-kilo/FibonacciSequence
Fibonacci.py
Fibonacci.py
py
4,259
python
pt
code
0
github-code
36
20847546702
""" Django settings for test_project project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, .....
j00bar/django-hydra
test_project/test_project/settings.py
settings.py
py
2,762
python
en
code
0
github-code
36
24643892493
import sqlite3 class OperationDB(object): def get_conn(self): '''连接数据库''' conn = sqlite3.connect('cltdata.db') return conn def get_cursor(self): '''创建游标''' conn = self.get_conn() #print('执行游标') return conn.cursor() def close_all(self, conn, cu): '''关闭数据库游标对象和数据库连接对象''' try: i...
weijingwei/liwei_python
ASTM2/Operation_db.py
Operation_db.py
py
4,387
python
en
code
0
github-code
36
36635799452
from cmath import exp from email import message import ssl, socket import requests from dateutil import parser import pytz import datetime, time import telegram requests.packages.urllib3.disable_warnings() try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError...
coeus-lei/python
domain-ssl-check/domain-ssl.py
domain-ssl.py
py
2,862
python
en
code
0
github-code
36
70190179945
import random import time # gera lista aleatória lista_rand = random.sample(range(1, 860), 100) print(lista_rand) # bubble_selection def bubble(lista): """ Função de ordenação do tipo bubble sorte input: Recebe uma lista de números desordenada output: retorna a lista inicial ordenada """ n ...
mabittar/desafios_pythonicos
ordenacao/bubble_sort.py
bubble_sort.py
py
724
python
pt
code
0
github-code
36
42600435981
#!/usr/bin/env python3 import os, psutil, signal import sys import fcntl import pytz import time from datetime import datetime import multiprocessing from multiprocessing import Queue import subprocess, shlex import atexit import signal import socketserver import socket import re import shutil def getTaipeiTime(): ...
TibaChang/ThesisTools
PassInstrument/training/Lib.py
Lib.py
py
15,026
python
en
code
0
github-code
36
23603029370
# -*- coding: utf-8 -*- """ Created on Thu Apr 5 17:05:36 2018 @author: s.jayanthi """ import cv2, numpy as np img = cv2.imread(params.color_transfer_target_label1) dst = []; rows,cols = img.shape[0], img.shape[1] M = cv2.getRotationMatrix2D((cols/2,rows/2),45,1) for channel in range(img.shape[2]): d_img = img[:...
murali1996/semantic_segmentation_of_nuclei_images
old_versions/dummy.py
dummy.py
py
1,372
python
en
code
0
github-code
36
7963630141
from tkinter import * from tkinter.font import Font import numpy as np import itertools as itr import os kryteria = ['rowery', 'telewizory', 'książki', 'telefony', 'drukarki'] #kryteria = ['rowery', 'telewizory', 'telefony'] kryteria_d = { i : "%.2f" % (1/len(kryteria)) for i in kryteria} kryteriaKomb =list...
kwiecien-rafal/optymalizator-prezentow
AHP tkinter.py
AHP tkinter.py
py
5,843
python
en
code
0
github-code
36
38516381300
""" Demo showing GP predictions in 1d and optimization of the hyperparameters. """ import numpy as np from ezplot import figure, show from reggie import make_gp def main(): """Run the demo.""" # generate random data from a gp prior rng = np.random.RandomState(0) gp = make_gp(0.1, 1.0, 0.1, kernel='m...
mwhoffman/reggie
reggie/demos/basic.py
basic.py
py
1,040
python
en
code
6
github-code
36
12231215672
''' INITIALIZE empty list grocery_inventory SET products = file products.txt ''' grocery_inventory = [] products = "products.txt" art = "grocery_art.txt" ''' Fucntion LOAD ART loads the ascii art file. It removes the line break at the end of each line and prints each line to show the art. ''' def load_art(filename)...
brooklyndippo/final-exam-produce-python
script.py
script.py
py
4,247
python
en
code
0
github-code
36
41076521456
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel class AlertDialogClass(QDialog): """ This class load the help dialog pyqt component """ def __init__(self, title, message, parent=None): """ Confirm dialog class constructor :param parent: """...
samuelterra22/Analysis-of-antenna-coverage
src/main/python/dialogs/alert_dialog_class.py
alert_dialog_class.py
py
855
python
en
code
5
github-code
36
42354884711
from openpyxl import Workbook, load_workbook target_workbook = Workbook() sheet=target_workbook.active sheet["A1"]="Номер заказа у партнера" sheet["B1"]="Номер сертификата" # номер сертификата sheet["C1"]="Продукт в системе партнера" #назначение платежа sheet["D1"]="Код продукта в BD" sheet["E1"]="Дата начала действи...
Mi6k4/programming_stuff
coding_stuff/python/opnepyexl/morphing.py
morphing.py
py
1,960
python
ru
code
0
github-code
36
25641131982
import shared from shared import bcolours from shared import baseSolution class Solution(baseSolution): RED_SQUARE = '🟥' GREEN_SQUARE = '🟩' def is_within_range(self, subject, range): """determines if a range (subject) is within another range Args: subject (array): an arr...
hellboy1975/aoc2022
day_4/part_1.py
part_1.py
py
2,182
python
en
code
0
github-code
36
20961161383
# Author:HU YUE import pickle import os import sys import logging import random BASE_DIR=os.path.dirname(os.path.dirname( os.path.abspath(__file__) )) sys.path.append(BASE_DIR) def loadd(f_all,name): with open("%s.txt"%name, 'wb')as f: pickle.dump(f_all, f) # def nadd(wood): # with open("%s.txt"%nam...
001fly/-Module-two-operation
Atm/core/account1.py
account1.py
py
6,440
python
en
code
0
github-code
36
73360149224
# django imports from django.contrib.auth.decorators import permission_required from django.core.urlresolvers import reverse from django.forms import ModelForm from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.template...
django-lfs/lfs
manage/views/static_blocks.py
static_blocks.py
py
3,646
python
en
code
23
github-code
36
7386840342
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: 'ListNode', l2: 'ListNode') -> 'ListNode': merged = ListNode(0) walker = merged while l1 or l2:...
dmauro22/Examples
Python/MergeTwoSortedLists/MergeTwoSortedLists.py
MergeTwoSortedLists.py
py
877
python
en
code
1
github-code
36
35001350068
import os import struct import numpy as np # Based on https://gist.github.com/akesling/5358964 which is in return # loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py # which is GPL licensed. def read(dataset = "training", path = "."): # Python function for importing the MNIST data set. It re...
CaptainProton42/MNISTFromScratch
modules/mnist.py
mnist.py
py
1,898
python
en
code
1
github-code
36
17837818682
# -*- coding: utf-8 -*- # E N = int(input()) A = list(map(int, input().split())) d = [] for idx, a in enumerate(A): d.append({'idx':idx, 'val':a}) d = sorted(d, key=lambda x:x['val'], reverse=True) dp = [[-float('inf')]*(N+1) for _ in range(N+1)] dp[0][0] = 0 # dp[0][1] = d[0]['val'] * (N - d[0]['idx']) # dp[1...
hsuetsugu/atc
ABC163/E.py
E.py
py
818
python
en
code
0
github-code
36