repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
LinkanDawang/FreshMallDemo | apps/orders/models.py | 5b8e2d2e8e137f609e8ac1e29ea013bb3ef34edb | from django.db import models
from utils.models import BaseModel
from users.models import User, Address
from goods.models import GoodsSKU
# Create your models here.
class OrderInfo(BaseModel):
"""订单信息"""
PAY_METHOD = ['1', '2']
PAY_METHOD_CHOICES = (
(1, "货到付款"),
(2, "支付宝"),
)
OR... | [((911, 980), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'primary_key': '(True)', 'verbose_name': '"""订单号"""'}), "(max_length=64, primary_key=True, verbose_name='订单号')\n", (927, 980), False, 'from django.db import models\n'), ((992, 1062), 'django.db.models.ForeignKey', 'models.Foreig... |
hunterhector/DDSemantics | event/arguments/prepare/event_vocab.py | 883ef1015bd21d9b8575d8000faf3b506a09f21c | from collections import defaultdict, Counter
import os
import gzip
import json
import pickle
from json.decoder import JSONDecodeError
import logging
from typing import Dict
import pdb
from event import util
from event.arguments.prepare.slot_processor import get_simple_dep, is_propbank_dep
logger = logging.getLogger(_... | [((301, 328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (318, 328), False, 'import logging\n'), ((16161, 16190), 'os.path.join', 'os.path.join', (['sent_out', 'fname'], {}), '(sent_out, fname)\n', (16173, 16190), False, 'import os\n'), ((17634, 17722), 'event.util.OptionPerLineParser... |
dexinl/kids_math | 20.py | 48f6c37e221bbd2484ad19861c61e5ed7d3aa09e | #!/usr/bin/python
import random
count = 20
test_set = []
while count:
a = random.randrange(3,20)
b = random.randrange(3,20)
if a > b and a - b > 1:
if (b, a-b) not in test_set:
test_set.append((b, a-b))
count -= 1
elif b > a and b - a > 1:
if (a, b-a) not in te... | [] |
xlam/autovirt | autovirt/equipment/domain/equipment.py | a19f9237c8b1123ce4f4b8b396dc88122019d4f8 | from enum import Enum
from functools import reduce
from math import ceil
from typing import Optional, Tuple
from autovirt import utils
from autovirt.exception import AutovirtError
from autovirt.structs import UnitEquipment, RepairOffer
logger = utils.get_logger()
# maximum allowed equipment price
PRICE_MAX = 100000
... | [((247, 265), 'autovirt.utils.get_logger', 'utils.get_logger', ([], {}), '()\n', (263, 265), False, 'from autovirt import utils\n'), ((1852, 1901), 'autovirt.utils.get_min', 'utils.get_min', (['units', 'QualityType.INSTALLED.value'], {}), '(units, QualityType.INSTALLED.value)\n', (1865, 1901), False, 'from autovirt imp... |
mtn/advent16 | day09/part2.py | 0df34237485ee1246532e9eda0ef643e6950d13e | #!/usr/bin/env python3
import re
with open("input.txt") as f:
content = f.read().strip()
def ulen(content):
ans = 0
i = 0
while i < len(content):
if content[i] == "(":
end = content[i:].find(")") + i
instr = content[i+1:end]
chars, times = map(int, content... | [] |
Nexuscompute/Cirq | cirq-core/cirq/contrib/quimb/mps_simulator_test.py | 640ef8f82d6a56ec95361388ce7976e096cca906 | # pylint: disable=wrong-or-nonexistent-copyright-notice
import itertools
import math
import numpy as np
import pytest
import sympy
import cirq
import cirq.contrib.quimb as ccq
import cirq.testing
from cirq import value
def assert_same_output_as_dense(circuit, qubit_order, initial_state=0, grouping=None):
mps_si... | [((330, 379), 'cirq.contrib.quimb.mps_simulator.MPSSimulator', 'ccq.mps_simulator.MPSSimulator', ([], {'grouping': 'grouping'}), '(grouping=grouping)\n', (360, 379), True, 'import cirq.contrib.quimb as ccq\n'), ((400, 416), 'cirq.Simulator', 'cirq.Simulator', ([], {}), '()\n', (414, 416), False, 'import cirq\n'), ((934... |
winding-lines/determined | e2e_tests/tests/config.py | 231e1ac1df9d77cabc09b724ca2f8070eac0da73 | import os
from pathlib import Path
from typing import Any, Dict
from determined.common import util
MASTER_SCHEME = "http"
MASTER_IP = "localhost"
MASTER_PORT = "8080"
DET_VERSION = None
DEFAULT_MAX_WAIT_SECS = 1800
MAX_TASK_SCHEDULED_SECS = 30
MAX_TRIAL_BUILD_SECS = 90
DEFAULT_TF1_CPU_IMAGE = "determinedai/environm... | [((703, 734), 'os.environ.get', 'os.environ.get', (['"""TF1_CPU_IMAGE"""'], {}), "('TF1_CPU_IMAGE')\n", (717, 734), False, 'import os\n'), ((776, 807), 'os.environ.get', 'os.environ.get', (['"""TF2_CPU_IMAGE"""'], {}), "('TF2_CPU_IMAGE')\n", (790, 807), False, 'import os\n'), ((849, 880), 'os.environ.get', 'os.environ.... |
nickmflorin/django-proper-architecture-testing | src/greenbudget/app/subaccount/serializers.py | da7c4019697e85f921695144375d2f548f1e98ad | from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers, exceptions
from greenbudget.lib.rest_framework_utils.fields import ModelChoiceField
from greenbudget.lib.rest_framework_utils.serializers import (
EnhancedModelSerializer)
from greenbudget.app.budget.models import B... | [((760, 800), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (784, 800), False, 'from rest_framework import serializers, exceptions\n'), ((812, 849), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'read_only': '(True)'}... |
busunkim96/dbnd | modules/dbnd/src/dbnd/_core/tracking/managers/callable_tracking.py | 0191fdcd4c4fbd35006f1026d1a55b2abab9097b | import contextlib
import logging
import typing
from typing import Any, Dict, Tuple
import attr
from dbnd._core.configuration import get_dbnd_project_config
from dbnd._core.constants import (
RESULT_PARAM,
DbndTargetOperationStatus,
DbndTargetOperationType,
TaskRunState,
)
from dbnd._core.current impo... | [((1443, 1470), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1460, 1470), False, 'import logging\n'), ((1538, 1547), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1545, 1547), False, 'import attr\n'), ((1587, 1596), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1594, 1596), False, 'import attr\n... |
Benardi/redis-basics | api.py | 614a15afe47780886bb6088f4ae45c6a7cbc6e22 | import os
import logging
from json import loads, dumps
from datetime import timedelta
from argparse import ArgumentParser
from redis import Redis
from flask import Response, Flask, request
app = Flask(__name__)
log = logging.getLogger(__name__)
parser = ArgumentParser()
parser.add_argument("-a", "--address",
... | [((197, 212), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'from flask import Response, Flask, request\n'), ((219, 246), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (236, 246), False, 'import logging\n'), ((257, 273), 'argparse.ArgumentParser', 'Argume... |
Ki-Seki/gadgets | zhihu_spider/ZhihuSpider/spiders/zhihu.py | 6e031e1f6536a15b48e3beb80ba8bf31d2a3db7a | """
启动此 spider 前需要手动启动 Chrome,cmd 命令如下:
cd 进入 Chrome 可执行文件 所在的目录
执行:chrome.exe --remote-debugging-port=9222
此时在浏览器窗口地址栏访问:http://127.0.0.1:9222/json,如果页面出现 json 数据,则表明手动启动成功
启动此 spider 后,注意与命令行交互!
在 settings 当中要做的:
# ROBOTSTXT_OBEY = False # 如果不关闭,parse 方法无法执行
# COOKIES_ENABLED = True # 以便 Request 值在传递时自动传递 cookies... | [((4606, 4631), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (4616, 4631), False, 'import json\n'), ((5969, 5982), 'ZhihuSpider.utils.browsezhihu.get_cookies', 'get_cookies', ([], {}), '()\n', (5980, 5982), False, 'from ZhihuSpider.utils.browsezhihu import get_cookies\n'), ((2082, 2114), 'u... |
Kyle-Kyle/angr | tests/test_bindiff.py | 345b2131a7a67e3a6ffc7d9fd475146a3e12f837 | import nose
import angr
import logging
l = logging.getLogger("angr.tests.test_bindiff")
import os
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
# todo make a better test
def test_bindiff_x86_64():
binary_path_1 = os.path.join(test_location, 'x86_64', '... | [((44, 88), 'logging.getLogger', 'logging.getLogger', (['"""angr.tests.test_bindiff"""'], {}), "('angr.tests.test_bindiff')\n", (61, 88), False, 'import logging\n'), ((281, 331), 'os.path.join', 'os.path.join', (['test_location', '"""x86_64"""', '"""bindiff_a"""'], {}), "(test_location, 'x86_64', 'bindiff_a')\n", (293,... |
nucluster/us_states | main/handle_file.py | 26cca38990b9afb6a2b8cc4d1365409428793c6d | from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
# def handle_uploaded_file(f):
# with open('screenshot.png', 'wb') as destination:
# # for chunk in f.chunks():
# # destination.write(chunk)
# destination.write(f)
with open(
BASE_DIR/'media'/'Greater_coat... | [((38, 52), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (42, 52), False, 'from pathlib import Path\n')] |
iicarus-bit/google-ctf | 2018/finals/pwn-gdb-as-a-service/web_challenge/challenge/gaas.py | 4eb8742bca58ff071ff8f6814d41d9ec7eb1db4b | #!/usr/bin/env python3
#
# Copyright 2018 Google LLC
#
# 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 ... | [((1008, 1062), 'capstone.Cs', 'capstone.Cs', (['capstone.CS_ARCH_X86', 'capstone.CS_MODE_64'], {}), '(capstone.CS_ARCH_X86, capstone.CS_MODE_64)\n', (1019, 1062), False, 'import capstone\n'), ((1070, 1092), 'socketio.AsyncServer', 'socketio.AsyncServer', ([], {}), '()\n', (1090, 1092), False, 'import socketio\n'), ((1... |
BubuLK/sfepy | examples/multi_physics/piezo_elasticity.py | 3e8e2082c26d574dc334fe3a0e0eeb723f7a6657 | r"""
Piezo-elasticity problem - linear elastic material with piezoelectric
effects.
Find :math:`\ul{u}`, :math:`\phi` such that:
.. math::
- \omega^2 \int_{Y} \rho\ \ul{v} \cdot \ul{u}
+ \int_{Y} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u})
- \int_{Y_2} g_{kij}\ e_{ij}(\ul{v}) \nabla_k \phi
= 0
\;, \qu... | [((2455, 2480), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2470, 2480), False, 'import os\n'), ((2486, 2546), 'sfepy.discrete.fem.MeshIO.any_from_filename', 'MeshIO.any_from_filename', (['filename_mesh'], {'prefix_dir': 'conf_dir'}), '(filename_mesh, prefix_dir=conf_dir)\n', (2510, 2546)... |
rafaelbarretomg/Uninter | 01-logica-de-programacao-e-algoritmos/Aula 06/01 Tuplas/1.2 Desempacotamento de parametros em funcoes/ex01.py | 1f84b0103263177122663e991db3a8aeb106a959 | # Desempacotamento de parametros em funcoes
# somando valores de uma tupla
def soma(*num):
soma = 0
print('Tupla: {}' .format(num))
for i in num:
soma += i
return soma
# Programa principal
print('Resultado: {}\n' .format(soma(1, 2)))
print('Resultado: {}\n' .format(soma(1, 2, 3, 4, 5, 6, 7, 8,... | [] |
theallknowng/eKheti | services/model.py | 85e74f26bde7454293617ba727002c5c81402140 | import pandas
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.utils import np_utils
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import LabelEncoder
from skle... | [((2587, 2603), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2597, 2603), False, 'import json\n'), ((2620, 2653), 'pandas.DataFrame', 'pandas.DataFrame', (['data'], {'index': '[0]'}), '(data, index=[0])\n', (2636, 2653), False, 'import pandas\n'), ((496, 508), 'keras.models.Sequential', 'Sequential', ([], {... |
erhuabushuo/sentry | tests/sentry/api/endpoints/test_project_details.py | 8b3bad10155aaacfdff80910e5972e64304e880c | from django.core.urlresolvers import reverse
from sentry.models import Project
from sentry.testutils import APITestCase
class ProjectDetailsTest(APITestCase):
def test_simple(self):
project = self.project # force creation
self.login_as(user=self.user)
url = reverse('sentry-api-0-project-d... | [((289, 363), 'django.core.urlresolvers.reverse', 'reverse', (['"""sentry-api-0-project-details"""'], {'kwargs': "{'project_id': project.id}"}), "('sentry-api-0-project-details', kwargs={'project_id': project.id})\n", (296, 363), False, 'from django.core.urlresolvers import reverse\n'), ((669, 743), 'django.core.urlres... |
databook1/python-pptx | tests/test_table.py | 87ca6bf34f9ced17cc4f3c94cf141069429e7583 | # encoding: utf-8
"""Unit-test suite for `pptx.table` module."""
import pytest
from pptx.dml.fill import FillFormat
from pptx.dml.border import BorderFormat
from pptx.enum.text import MSO_ANCHOR
from pptx.oxml.ns import qn
from pptx.oxml.table import CT_Table, CT_TableCell, TcRange
from pptx.shapes.graphfrm import G... | [((4728, 5322), 'pytest.fixture', 'pytest.fixture', ([], {'params': "[('a:tbl', 'first_row', False), ('a:tbl/a:tblPr', 'first_row', False), (\n 'a:tbl/a:tblPr{firstRow=1}', 'first_row', True), (\n 'a:tbl/a:tblPr{firstRow=0}', 'first_row', False), (\n 'a:tbl/a:tblPr{firstRow=true}', 'first_row', True), (\n '... |
luispedro/imread | imread/tests/test_bmp.py | 7960b744623fe03e6d968893a539bca969715860 | import numpy as np
from imread import imread
from . import file_path
def test_read():
im = imread(file_path('star1.bmp'))
assert np.any(im)
assert im.shape == (128, 128, 3)
def test_indexed():
im = imread(file_path('py-installer-indexed.bmp'))
assert np.any(im)
assert im.shape == (352, 162, 3)... | [((138, 148), 'numpy.any', 'np.any', (['im'], {}), '(im)\n', (144, 148), True, 'import numpy as np\n'), ((273, 283), 'numpy.any', 'np.any', (['im'], {}), '(im)\n', (279, 283), True, 'import numpy as np\n'), ((332, 353), 'numpy.any', 'np.any', (['im[:, :, (0)]'], {}), '(im[:, :, (0)])\n', (338, 353), True, 'import numpy... |
v3l0c1r4pt0r/bl60x-flash | bl60x_flash/main.py | 065770004629c3e5bf98057677e7a6ca566e9c4a | from serial import Serial
from tqdm import tqdm
import binascii
import hashlib
import struct
import time
import sys
import os
def if_read(ser, data_len):
data = bytearray(0)
received = 0
while received < data_len:
tmp = ser.read(data_len - received)
if len(tmp) == 0:
... | [((528, 543), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (538, 543), False, 'import time\n'), ((858, 873), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (868, 873), False, 'import time\n'), ((898, 914), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (908, 914), False, 'import time\n'),... |
zerofox-oss/yelp-avro | lang/py/test/test_avro_builder.py | 913f95a4c34386d0fe9aff843b1a8ea362a1a2c5 | # -*- coding: utf-8 -*-
import unittest
from avro import avro_builder
from avro import schema
class TestAvroSchemaBuilder(unittest.TestCase):
def setUp(self):
self.builder = avro_builder.AvroSchemaBuilder()
def tearDown(self):
del self.builder
@property
def name(self):
retu... | [((19622, 19637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (19635, 19637), False, 'import unittest\n'), ((190, 222), 'avro.avro_builder.AvroSchemaBuilder', 'avro_builder.AvroSchemaBuilder', ([], {}), '()\n', (220, 222), False, 'from avro import avro_builder\n')] |
domluna/fun_with_ffi | monte_py/__init__.py | 9fc197b11a3470395db517657d624f0a3aa06958 | import random
def estimate_pi(sims, needles):
trials = []
for _ in xrange(sims):
trials.append(simulate_pi(needles))
mean = sum(trials) / sims
return mean
# use a unit square
def simulate_pi(needles):
hits = 0 # how many hits we hit the circle
for _ in xrange(needles):
x = ran... | [((317, 342), 'random.uniform', 'random.uniform', (['(-1.0)', '(1.0)'], {}), '(-1.0, 1.0)\n', (331, 342), False, 'import random\n'), ((353, 376), 'random.uniform', 'random.uniform', (['(-1)', '(1.0)'], {}), '(-1, 1.0)\n', (367, 376), False, 'import random\n')] |
UVA-DSI/circuitpython | tools/mpy_ld.py | 35ee4add63a604320d2fbd4e30baef2b5675f9a7 | #!/usr/bin/env python3
#
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2019 Damien P. George
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... | [((2482, 2516), 'struct.pack', 'struct.pack', (['"""<BI"""', '(233)', '(entry - 5)'], {}), "('<BI', 233, entry - 5)\n", (2493, 2516), False, 'import sys, os, struct, re\n'), ((2845, 2871), 'struct.pack', 'struct.pack', (['"""<HH"""', 'b0', 'b1'], {}), "('<HH', b0, b1)\n", (2856, 2871), False, 'import sys, os, struct, r... |
edzzn/Manejo_Liberia | ui_mant_libros.py | c735d35b32fc53839acfc48d4e088e69983edf16 | from PyQt4 import QtGui
from ui_mant_libros_new import NewLibrosWindow
from ui_mant_libros_edit import EditLibrosWindow
from ui_mant_libros_id_edit import GetIdEditWindow
# Debug only
import inspect
class MenuLibros(QtGui.QWidget):
"""
Ventana-menu para editar Libros
"""
def __init__(self):
... | [((2188, 2216), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2206, 2216), False, 'from PyQt4 import QtGui\n'), ((658, 684), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', (['"""Nuevo"""'], {}), "('Nuevo')\n", (675, 684), False, 'from PyQt4 import QtGui\n'), ((780, 807), 'PyQt4... |
MrStonkus/PokerAi | env/gym_poker_ai/envs/tests/holdem_calc/holdem_argparser.py | 9c43c3a7a9c3ac01f4ee9e3f1f95f0786c35de99 | import argparse
import re
import holdem_calc.holdem_functions as holdem_functions
# Wrapper class which holds the arguments for library calls
# Mocks actual argparse object
class LibArgs:
def __init__(self, board, exact, num, input_file, hole_cards):
self.board = board
self.cards = hole_cards
... | [((858, 1027), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Find the odds that a Texas Hold\'em hand will win. Note that cards must be given in the following format: As, Jc, Td, 3h."""'}), '(description=\n "Find the odds that a Texas Hold\'em hand will win. Note that cards must be g... |
KarlDorogy/Cisc-327-Course-Project-Group-20 | qbay/controllers.py | 0e2c003f78bbdd932381a7a8cbc3aa757da18b24 | from flask import render_template, request, session, redirect
from qbay.models import *
from datetime import date
from qbay import app
def authenticate(inner_function):
"""
:param inner_function: any python function that accepts a user object
Wrap any python function and check the current session to see ... | [((1255, 1291), 'qbay.app.route', 'app.route', (['"""/login"""'], {'methods': "['GET']"}), "('/login', methods=['GET'])\n", (1264, 1291), False, 'from qbay import app\n'), ((1377, 1414), 'qbay.app.route', 'app.route', (['"""/login"""'], {'methods': "['POST']"}), "('/login', methods=['POST'])\n", (1386, 1414), False, 'f... |
stadtulm/cykel | gbfs/serializers.py | b292d958330279654c49beafc3f95a0067274472 | from datetime import timedelta
from django.utils.timezone import now
from preferences import preferences
from rest_framework import fields, serializers
from bikesharing.models import Bike, Station, VehicleType
from cykel.serializers import EnumFieldSerializer
class TimestampSerializer(fields.CharField):
def to_... | [((474, 542), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""non_static_bike_uuid"""', 'read_only': '(True)'}), "(source='non_static_bike_uuid', read_only=True)\n", (495, 542), False, 'from rest_framework import fields, serializers\n'), ((565, 602), 'rest_framework.serializers.Char... |
ngomile/anime-downloader | anime_downloader/extractors/vidstream.py | 14d9cebe8aa4eb9d906b937d7c19fedfa737d184 | import logging
import re
from anime_downloader.extractors.base_extractor import BaseExtractor
from anime_downloader.sites import helpers
logger = logging.getLogger(__name__)
class VidStream(BaseExtractor):
def _get_data(self):
QUALITIES = {
"360":[],
"480":[],
"720":[],
"10... | [((147, 174), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'import logging\n'), ((410, 426), 'anime_downloader.sites.helpers.get', 'helpers.get', (['url'], {}), '(url)\n', (421, 426), False, 'from anime_downloader.sites import helpers\n'), ((585, 606), 'anime_download... |
time-crunched/nlp-toolbox | gui/sum_v1/views.py | b732abd0b2c6b265971efe04a4d70ebe20d2ee8f | import time
import os
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.views import View
from django.conf import settings
from .forms import File_uploadForm
from .models import File_upload, SummaryRes
from sim_v1.textsummary import TEXTSummary
summary_document_dir = os.... | [((1876, 1904), 'django.shortcuts.redirect', 'redirect', (['"""sum_v1:summarize"""'], {}), "('sum_v1:summarize')\n", (1884, 1904), False, 'from django.shortcuts import render, redirect\n'), ((2224, 2256), 'os.listdir', 'os.listdir', (['summary_document_dir'], {}), '(summary_document_dir)\n', (2234, 2256), False, 'impor... |
dannyqwertz/home-assistant | homeassistant/components/websocket_api/__init__.py | 688bdc6532e514afbdc8efd1f574a7b5c9e8d280 | """
Websocket based API for Home Assistant.
For more details about this component, please refer to the documentation at
https://developers.home-assistant.io/docs/external_api_websocket.html
"""
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from . import commands, connection, const... | [] |
Lenders-Cooperative/Django-DocuSign | test_app/settings.py | 676d966065f6e1e64e1f0db9b7691b9f0c5d73a5 | #
# Created on Tue Dec 21 2021
#
# Copyright (c) 2021 Lenders Cooperative, a division of Summit Technology Group, Inc.
#
"""
Django settings for test_app project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
... | [((478, 491), 'environ.Env', 'environ.Env', ([], {}), '()\n', (489, 491), False, 'import environ\n'), ((3481, 3495), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (3485, 3495), False, 'from pathlib import Path\n'), ((569, 583), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (573, 583), False,... |
doug-lovett/test-schemas-dl | tests/unit/ppr/test_search_query.py | a05e87b983f2c3559c081dd65aff05e2c67e6186 | # Copyright © 2020 Province of British Columbia
#
# 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 agr... | [((921, 948), 'copy.deepcopy', 'copy.deepcopy', (['SEARCH_QUERY'], {}), '(SEARCH_QUERY)\n', (934, 948), False, 'import copy\n'), ((1195, 1232), 'registry_schemas.validate', 'validate', (['query', '"""searchQuery"""', '"""ppr"""'], {}), "(query, 'searchQuery', 'ppr')\n", (1203, 1232), False, 'from registry_schemas impor... |
kharnam/devopsipy | devopsipy/decorators.py | c3379b1dd5f66e71c826045afde1702030e495d4 | """
Module to contain Pywork decorators
"""
__author__ = 'sergey kharnam'
import re
import time
import itertools
import logging
log = logging.getLogger(__name__)
| [((137, 164), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'import logging\n')] |
stephenfin/django-rest-framework | tests/test_decorators.py | 9d001cd84c1239d708b1528587c183ef30e38c31 | from __future__ import unicode_literals
import pytest
from django.test import TestCase
from rest_framework import status
from rest_framework.authentication import BasicAuthentication
from rest_framework.decorators import (
action, api_view, authentication_classes, detail_route, list_route,
parser_classes, per... | [((856, 875), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (873, 875), False, 'from rest_framework.test import APIRequestFactory\n'), ((997, 1064), 'rest_framework.views.APIView.finalize_response', 'APIView.finalize_response', (['self', 'request', 'response', '*args'], {}), '(self, re... |
CRE2525/open-tamil | tamilmorse/morse_encode.py | ffc02509f7b8a6a17644c85799a475a8ba623954 | ## -*- coding: utf-8 -*-
#(C) 2018 Muthiah Annamalai
# This file is part of Open-Tamil project
# You may use or distribute this file under terms of MIT license
import codecs
import json
import tamil
import sys
import os
#e.g. python morse_encode.py கலைஞர்
CURRDIR = os.path.dirname(os.path.realpath(__file__))
def enco... | [((284, 310), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (300, 310), False, 'import os\n'), ((351, 407), 'os.path.join', 'os.path.join', (['CURRDIR', '"""data"""', '"""madurai_tamilmorse.json"""'], {}), "(CURRDIR, 'data', 'madurai_tamilmorse.json')\n", (363, 407), False, 'import os\n'),... |
Xrenya/algorithms | Leetcode/Python/_1721.py | aded82cacde2f4f2114241907861251e0e2e5638 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
temp = head
array = []
while temp:
a... | [] |
electrumsv/electrumsv | contrib/functional_tests/functional/test_reorg.py | a2d9027ccec338cadfca778888e6ef7f077b1651 | """
Warning - this will reset all components back to a blank state before running the simulation
Runs node1, electrumx1 and electrumsv1 and loads the default wallet on the daemon (so that newly
submitted blocks will be synchronized by ElectrumSV
reorged txid: 'a1fa9460ca105c1396cd338f7fa202bf79a9d244d730e91e19f6302a0... | [((655, 695), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (674, 695), False, 'import logging\n'), ((705, 746), 'logging.getLogger', 'logging.getLogger', (['"""simulate-fresh-reorg"""'], {}), "('simulate-fresh-reorg')\n", (722, 746), False, 'import logging\n... |
KhanhThiVo/SimuRLacra | Pyrado/pyrado/environments/mujoco/wam_bic.py | fdeaf2059c2ed80ea696f018c29290510b5c4cb9 | # Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source ... | [((6412, 6463), 'os.path.join', 'osp.join', (['pyrado.MUJOCO_ASSETS_DIR', 'graph_file_name'], {}), '(pyrado.MUJOCO_ASSETS_DIR, graph_file_name)\n', (6420, 6463), True, 'import os.path as osp\n'), ((7297, 7375), 'numpy.concatenate', 'np.concatenate', (['[self.init_qpos, self.init_qvel, init_ball_pos, init_cup_goal]'], {... |
ToninoTarsi/pyRasp | pyRasp.py | a46bb1dc38c7547b60e24189ecf34310da770042 | # pyRasp
# Copyright (c) Tonino Tarsi 2020. Licensed under MIT.
# requirement :
# Python 3
# pip install pyyaml
# pip install request
# pip install f90nml
from downloadGFSA import downloadGFSA
from prepare_wps import prepare_wps
from ungrib import ungrib
from metgrid import metgrid
from prepare_wrf import prepare_w... | [((375, 393), 'downloadGFSA.downloadGFSA', 'downloadGFSA', (['(True)'], {}), '(True)\n', (387, 393), False, 'from downloadGFSA import downloadGFSA\n'), ((394, 413), 'prepare_wps.prepare_wps', 'prepare_wps', (['result'], {}), '(result)\n', (405, 413), False, 'from prepare_wps import prepare_wps\n'), ((414, 422), 'ungrib... |
namuan/crypto-rider | app/strategies/ema_bb_alligator_strategy.py | f5b47ada60a7cef07e66609e2e92993619c6bfbe | import pandas as pd
import ta
from app.common import reshape_data
from app.strategies.base_strategy import BaseStrategy
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
class EMABBAlligatorStrategy(BaseStrategy):
BUY_SIGNAL = "buy_signal"
SELL_SIGNAL = "sell_signal"
def c... | [((122, 164), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (135, 164), True, 'import pandas as pd\n'), ((165, 201), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', 'None'], {}), "('display.width', None)\n", (178, 201), True, 'import... |
TomasBelskis/PythonAutomation | BasicScripts/basics.py | dd2e30abb214e37d84a8952deb834074abdc84a2 | # Python Basics
# String concatenaton
added_strings = str(32) + "_342"
# Getting input
input_from_user = input()
# Basic print function
print(input_from_user)
# Mixing boolean and comparison operations
if (4 < 5) and (5 < 6):
print("True")
# Basic if & if else flow
if name == 'Alice':
print('Hi, Alice.')... | [] |
wilcoln/klazor | env.example.py | 8f3c40a03a7e61c07eceb6cdbe4d1bb05693727e | DATABASE_OPTIONS = {
'database': 'klazor',
'user': 'root',
'password': '',
'charset': 'utf8mb4',
}
HOSTS = ['127.0.0.1', '67.209.115.211']
| [] |
lzantal/djskell | misc/_local_settings.py | cef71bab8a4dd163b632128666c315e228cc8f0f | """
Django settings.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
#DEBUG = False
DEBUG = True
SERV... | [] |
pedrohd21/Agenda-Django | contacts/forms.py | c48a90d76094523fd2060ff735faefbf3c2f808d | from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = ('name', 'number', 'email', 'category', 'description')
| [] |
ziegenberg/awx | awx/api/urls/ad_hoc_command.py | a3e29317c5d4220fffe28370ec73c73802255246 | # Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.
from django.urls import re_path
from awx.api.views import (
AdHocCommandList,
AdHocCommandDetail,
AdHocCommandCancel,
AdHocCommandRelaunch,
AdHocCommandAdHocCommandEventsList,
AdHocCommandActivityStreamList,
AdHocCommandNotification... | [((383, 409), 'awx.api.views.AdHocCommandList.as_view', 'AdHocCommandList.as_view', ([], {}), '()\n', (407, 409), False, 'from awx.api.views import AdHocCommandList, AdHocCommandDetail, AdHocCommandCancel, AdHocCommandRelaunch, AdHocCommandAdHocCommandEventsList, AdHocCommandActivityStreamList, AdHocCommandNotification... |
icexmoon/python-learning-notes | note5/package_test5.py | 838c91d896404290b89992b6517be1b6a79df41f | #test.py
from time_tools import *
# print(compareTimestamp(111,222))
time.showNowTime()
# now time is XX:XX:XX | [] |
fabiommendes/fgarcade | fgarcade/sprites.py | 2bfdb3ca18cb8260048ccfc9e84524987c322221 | import arcade
from arcade import FACE_RIGHT, FACE_DOWN, FACE_UP, FACE_LEFT
class AnimatedWalkingSprite(arcade.Sprite):
def __init__(self, scale: float = 1,
image_x: float = 0, image_y: float = 0,
center_x: float = 0, center_y: float = 0, *,
stand_left, stand_righ... | [] |
gh-schen/SiriusEpiClassifier | src/mafUtility.py | 617e0243a95fe1014acfeca25ff6f6ba617d366f | from numpy.core.fromnumeric import transpose
from sklearn import linear_model
from scipy.special import logit
from scipy import stats
from copy import deepcopy
from numpy import random, concatenate, quantile, matmul, transpose
import logging
class singleRegModel():
"""
data struct for running a single regress... | [((557, 581), 'copy.deepcopy', 'deepcopy', (['self.regressor'], {}), '(self.regressor)\n', (565, 581), False, 'from copy import deepcopy\n'), ((775, 845), 'logging.warning', 'logging.warning', (['"""No samples have missing MAF - no follow up training"""'], {}), "('No samples have missing MAF - no follow up training')\n... |
hanyas/sds | examples/linreg.py | 3c195fb9cbd88a9284287d62c0eacb6afc4598a7 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import ARDRegression, LinearRegression
# Parameters of the example
np.random.seed(0)
n_samples, n_features = 100, 100
# Create Gaussian data
X = np.random.randn(n_samples, n_features)
# Create weights with a precision... | [((170, 187), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (184, 187), True, 'import numpy as np\n'), ((248, 286), 'numpy.random.randn', 'np.random.randn', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (263, 286), True, 'import numpy as np\n'), ((352, 372), 'numpy.zeros', 'np.zeros',... |
KarizCache/serverless | optimal/tompkins/examples/dask_scheduling_problem_nonetcontention.py | c5735afee29e104f3909f3b0140e993d461a5420 | #!/usr/bin/python3
import os
import json
import re
import ast
import json
from graphviz import Digraph
import pandas as pd
# color the graph
import graph_tool.all as gt
import copy
import matplotlib.colors as mcolors
import sys
import utils
from tompkins.ilp import schedule, jobs_when_where
from collections import d... | [((626, 647), 'os.listdir', 'os.listdir', (['stats_dir'], {}), '(stats_dir)\n', (636, 647), False, 'import os\n'), ((1123, 1167), 'os.path.join', 'os.path.join', (['stats_dir', 'f"""{benchmark}.iopt"""'], {}), "(stats_dir, f'{benchmark}.iopt')\n", (1135, 1167), False, 'import os\n'), ((2469, 2513), 'os.path.join', 'os.... |
gerhardgossen/harbor | tests/apitests/python/test_robot_account.py | 1d03b8727acb9a3935bf45cd76b61f87c68e2a08 | from __future__ import absolute_import
import unittest
from testutils import ADMIN_CLIENT
from testutils import TEARDOWN
from library.user import User
from library.project import Project
from library.repository import Repository
from library.repository import pull_harbor_image
from library.repository import push_imag... | [] |
ErikKalkoken/slackchannel2pdf | slackchannel2pdf/locales.py | 2848dfaaffbf9a5255c6dbe87dcc1e90d062b820 | import datetime as dt
import logging
from babel import Locale, UnknownLocaleError
from babel.dates import format_datetime, format_time, format_date
import pytz
from tzlocal import get_localzone
from . import settings
logger = logging.getLogger(__name__)
class LocaleHelper:
"""Helpers for converting date & tim... | [((230, 257), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (247, 257), False, 'import logging\n'), ((2602, 2661), 'babel.dates.format_date', 'format_date', (['my_datetime'], {'format': '"""full"""', 'locale': 'self.locale'}), "(my_datetime, format='full', locale=self.locale)\n", (2613, ... |
glemaitre/ramp-board-1 | databoard/databoard/default_config.py | a5e9b423a55d196d38232fd94b2f7d53fb35d9d8 | import os
class Config(object):
# FLASK GENERAL CONFIG PARAMETERS
SECRET_KEY = os.getenv('DATABOARD_SECRET_KEY', 'abcdefghijkl')
# abs max upload file size, to throw 413, before saving it
WTF_CSRF_ENABLED = True
LOG_FILENAME = None # if None, output to screen
MAX_CONTENT_LENGTH = 1024 * 1024 ... | [((89, 138), 'os.getenv', 'os.getenv', (['"""DATABOARD_SECRET_KEY"""', '"""abcdefghijkl"""'], {}), "('DATABOARD_SECRET_KEY', 'abcdefghijkl')\n", (98, 138), False, 'import os\n'), ((419, 471), 'os.getenv', 'os.getenv', (['"""DATABOARD_MAIL_SERVER"""', '"""smtp.gmail.com"""'], {}), "('DATABOARD_MAIL_SERVER', 'smtp.gmail.... |
carlsummer/python_developer_tools | python_developer_tools/cv/bases/pool/AvgPool2d.py | a8c4365b7cc601cda55648cdfd8c0cb1faae132f | # !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:8/31/2021 1:37 PM
# @File:GlobalAvgPool2d
import torch.nn as nn
from python_developer_tools.cv.bases.activates.swish import h_swish
class GlobalAvgPool2d(nn.Module):
""" Fast implementation of global average pooling from
TResNe... | [((1036, 1061), 'torch.nn.ReLU6', 'nn.ReLU6', ([], {'inplace': 'inplace'}), '(inplace=inplace)\n', (1044, 1061), True, 'import torch.nn as nn\n'), ((1075, 1103), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1, 1)'], {}), '((1, 1))\n', (1095, 1103), True, 'import torch.nn as nn\n'), ((1117, 1126), 'python_d... |
nordme/expyfun | expyfun/_utils.py | e644bba8cbfb6edd2a076099536417d4854d64af | """Some utility functions"""
# Authors: Eric Larson <larsoner@uw.edu>
#
# License: BSD (3-clause)
import warnings
import operator
from copy import deepcopy
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import tempfile
import ssl
from shutil import rmtree
import atexit
imp... | [((797, 824), 'sys.version.startswith', 'sys.version.startswith', (['"""2"""'], {}), "('2')\n", (819, 824), False, 'import sys\n'), ((1390, 1422), 'logging.addLevelName', 'logging.addLevelName', (['EXP', '"""EXP"""'], {}), "(EXP, 'EXP')\n", (1410, 1422), False, 'import logging\n'), ((1582, 1610), 'logging.getLogger', '... |
delimatorres/foodbasket | mixin.py | 2f043d713337581be2165259cdbba4e4a24b656b | import signal
class KillableProcess(object):
def __init__(self):
self.interrupt = False
signal.signal(signal.SIGTERM, self._signal_handler)
signal.signal(signal.SIGINT, self._signal_handler)
def _signal_handler(self, sign, frame):
self.interrupt = True | [((110, 161), 'signal.signal', 'signal.signal', (['signal.SIGTERM', 'self._signal_handler'], {}), '(signal.SIGTERM, self._signal_handler)\n', (123, 161), False, 'import signal\n'), ((170, 220), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'self._signal_handler'], {}), '(signal.SIGINT, self._signal_handler)\n', ... |
liubaishuo-github/peening-post-processor | test5.py | 61f4c2d2385469bc1e9d1b7a692b72eb6afd7f75 | def HAHA():
return 1,2,3
a = HAHA()
print(a)
print(a[0])
| [] |
jsun94/nimble | torch/_fx/graph_module.py | e5c899a69677818b1becc58100577441e15ede13 | import torch
import torch.overrides
import linecache
from typing import Type, Dict, List, Any, Union
from .graph import Graph
import copy
# normal exec loses the source code, however we can patch
# the linecache module to still recover it.
# using exec_with_source will add it to our local cache
# and then tools like T... | [((8260, 8277), 'torch.nn.Module', 'torch.nn.Module', ([], {}), '()\n', (8275, 8277), False, 'import torch\n'), ((8306, 8334), 'copy.deepcopy', 'copy.deepcopy', (['self.__dict__'], {}), '(self.__dict__)\n', (8319, 8334), False, 'import copy\n'), ((2927, 2944), 'torch.nn.Module', 'torch.nn.Module', ([], {}), '()\n', (29... |
robot0nfire/behem0th | RequestHandler.py | 3931f2a9a2f00b95d82ccb3c5e7c13b3fbb5f4d7 | #
# Copyright (c) 2016 Christoph Heiss <me@christoph-heiss.me>
#
# 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 limitation the rights
# to use, copy, m... | [((5195, 5208), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (5206, 5208), False, 'import queue\n'), ((5702, 5768), 'behem0th.log.info', 'log.info', (['"""Connected to {0}:{1}"""', 'self.address[0]', 'self.address[1]'], {}), "('Connected to {0}:{1}', self.address[0], self.address[1])\n", (5710, 5768), False, 'from b... |
haochuanwei/hover | tests/utils/test_metrics.py | 53eb38c718e44445b18a97e391b7f90270802b04 | from hover.utils.metrics import classification_accuracy
import numpy as np
def test_classification_accuracy():
true = np.array([1, 2, 3, 4, 5, 6, 7, 7])
pred = np.array([1, 2, 3, 4, 5, 6, 7, 8])
accl = classification_accuracy(true, pred)
accr = classification_accuracy(pred, true)
assert np.allclose... | [((123, 157), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 7]'], {}), '([1, 2, 3, 4, 5, 6, 7, 7])\n', (131, 157), True, 'import numpy as np\n'), ((169, 203), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8])\n', (177, 203), True, 'import numpy as np\n'), ((215, 250), 'hov... |
rgirish28/blenderseed | scripts/blenderseed.package.py | fee897620d0348f4ea1f5722e1a82c3682ca0178 | #!/usr/bin/python
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017-2018 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to ... | [((3170, 3181), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3178, 3181), False, 'import sys\n'), ((3614, 3643), 'os.chmod', 'os.chmod', (['path', 'stat.S_IWRITE'], {}), '(path, stat.S_IWRITE)\n', (3622, 3643), False, 'import os\n'), ((3648, 3663), 'os.unlink', 'os.unlink', (['path'], {}), '(path)\n', (3657, 3663),... |
viad00/code_olymp | uts/uts_17_aut_py/2/A.py | 90f20f9fd075e8967d02baf7554fcf24f4ae089c | ser = int(input())
mas = list(map(int, input().split()))
mas.sort()
print(*mas)
| [] |
ongchi/wagtail-katex | wagtailkatex/wagtail_hooks.py | c64b491e765e6b87a90d7cd8602153826ee9fe07 | from django.utils.translation import gettext
from wagtail.admin.rich_text.editors.draftail import features as draftail_features
from wagtail.core import hooks
from .richtext import KaTeXEntityElementHandler, katex_entity_decorator
@hooks.register('register_rich_text_features')
def register_katex_features(features):... | [((236, 281), 'wagtail.core.hooks.register', 'hooks.register', (['"""register_rich_text_features"""'], {}), "('register_rich_text_features')\n", (250, 281), False, 'from wagtail.core import hooks\n'), ((855, 874), 'django.utils.translation.gettext', 'gettext', (['"""Equation"""'], {}), "('Equation')\n", (862, 874), Fal... |
real-digital/esque-wire | esque_wire/protocol/serializers/api/elect_preferred_leaders_request.py | eb02c49f38b89ad5e5d25aad15fb4ad795e52807 | ###############################################################
# Autogenerated module. Please don't modify. #
# Edit according file in protocol_generator/templates instead #
###############################################################
from typing import Dict
from ...structs.api.elect_preferred_le... | [] |
arunrordell/RackHD | test/tests/bootstrap/test_api20_windows_bootstrap.py | 079c21f45cb38f538c502363aa1ff86dbcac3169 | '''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
This script tests arbitrary payload of the RackHD API 2.0 OS bootstrap workflows.
The default case is running a minimum payload Windows OS install.
Other Windows-type OS install cases can be specified by creating a payload file and specifiying it u... | [((2005, 2027), 'flogging.get_loggers', 'flogging.get_loggers', ([], {}), '()\n', (2025, 2027), False, 'import flogging\n'), ((5140, 5155), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(False)'}), '(all=False)\n', (5144, 5155), False, 'from nose.plugins.attrib import attr\n'), ((7640, 7672), 'nosedep.depends', 'de... |
till-h/alexa | random_number.py | 47891eb97fff375500a032b23fef7a2681b50735 | from flask import Flask, render_template
from flask_ask import Ask, statement
import random
app = Flask(__name__)
ask = Ask(app, '/')
@ask.intent('RandomNumber', convert={'lowerLimit': int, 'upperLimit': int})
def hello(lowerLimit, upperLimit):
if lowerLimit == None:
lowerLimit = 0
if upperLimit == None:
upperL... | [((99, 114), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (104, 114), False, 'from flask import Flask, render_template\n'), ((121, 134), 'flask_ask.Ask', 'Ask', (['app', '"""/"""'], {}), "(app, '/')\n", (124, 134), False, 'from flask_ask import Ask, statement\n'), ((341, 379), 'random.randint', 'random.r... |
askerlee/rift | model/losses.py | d4dbf42b82f1f83dfab18f8da8fe3a1d0a716fa2 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from model.laplacian import LapLoss
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class EPE(nn.Module):
def __init__(self):
super(EPE, self).__init__()
de... | [((191, 216), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (214, 216), False, 'import torch\n'), ((779, 813), 'numpy.transpose', 'np.transpose', (['self.w', '(3, 2, 0, 1)'], {}), '(self.w, (3, 2, 0, 1))\n', (791, 813), True, 'import numpy as np\n'), ((920, 963), 'torch.nn.functional.conv2d', ... |
righetti/swarmrobotics | project/python/swarm_simulation.py | f8f6bf72c3aae1f432f3306aebb48fd32a6dd2a7 | import numpy as np
import pybullet as p
import itertools
from robot import Robot
class World():
def __init__(self):
# create the physics simulator
self.physicsClient = p.connect(p.GUI)
p.setGravity(0,0,-9.81)
self.max_communication_distance = 2.0
# We will int... | [((194, 210), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (203, 210), True, 'import pybullet as p\n'), ((219, 244), 'pybullet.setGravity', 'p.setGravity', (['(0)', '(0)', '(-9.81)'], {}), '(0, 0, -9.81)\n', (231, 244), True, 'import pybullet as p\n'), ((386, 437), 'pybullet.setPhysicsEngineParameter'... |
wt/boto | boto/ec2/elb/__init__.py | 83d5b256c8333307233e1ec7c1e21696e8d32437 | # Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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 wi... | [((1919, 1984), 'boto.regioninfo.get_regions', 'get_regions', (['"""elasticloadbalancing"""'], {'connection_cls': 'ELBConnection'}), "('elasticloadbalancing', connection_cls=ELBConnection)\n", (1930, 1984), False, 'from boto.regioninfo import RegionInfo, get_regions, load_regions\n'), ((2547, 2599), 'boto.config.get', ... |
atomse/basis_set_exchange | basis_set_exchange/cli/bse_cli.py | 7ffd64082c14d2f61eb43f1c2d44792e8b0e394e | '''
Command line interface for the basis set exchange
'''
import argparse
import argcomplete
from .. import version
from .bse_handlers import bse_cli_handle_subcmd
from .check import cli_check_normalize_args
from .complete import (cli_case_insensitive_validator,
cli_family_completer, cli_role_co... | [((1064, 1130), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Description of your program"""'}), "(description='Description of your program')\n", (1087, 1130), False, 'import argparse\n'), ((9187, 9261), 'argcomplete.autocomplete', 'argcomplete.autocomplete', (['parser'], {'validator': ... |
hanjungwoo1/CodingTest | Backjoon/1929.py | 0112488d04dd53cea1c869439341fb602e699f2a | """
입력 예시
3 16
출력 예시
3
5
7
11
13
"""
import math
left, right = map(int, input().split())
array = [True for i in range(right+1)]
array[1] = 0
for i in range(2, int(math.sqrt(right)) + 1):
if array[i] == True:
j = 2
while i * j <= right:
array[i * j] = False
j += 1
for i in... | [((166, 182), 'math.sqrt', 'math.sqrt', (['right'], {}), '(right)\n', (175, 182), False, 'import math\n')] |
tianyapiaozi/tensorflow | tensorflow/tools/quantization/quantize_graph_test.py | fb3ce0467766a8e91f1da0ad7ada7c24fde7a73a | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | [((1481, 1496), 'tensorflow.python.framework.ops.Graph', 'ops_lib.Graph', ([], {}), '()\n', (1494, 1496), True, 'from tensorflow.python.framework import ops as ops_lib\n'), ((1888, 1908), 'tensorflow.core.framework.graph_pb2.GraphDef', 'graph_pb2.GraphDef', ([], {}), '()\n', (1906, 1908), False, 'from tensorflow.core.f... |
aroiginfraplan/giscube-admin | layerserver/migrations/0001_initial.py | b7f3131b0186f847f3902df97f982cb288b16a49 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-26 09:14
import colorfield.fields
from django.db import migrations, models
import django.db.models.deletion
import giscube.utils
class Migration(migrations.Migration):
initial = True
dependencies = [
('giscube', '0002_update'),
]... | [((450, 543), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (466, 543), False, 'from django.db import migrations, models\... |
pirica/fortnite-leaks-image-generator | SETTINGS.py | c23633862fd7d2286700f932e5dab41decd2ff72 | backgroundurl = "https://storage.needpix.com/rsynced_images/colored-background.jpg" # <- Need to be a Image URL!!!
lang = "en" # <- language code
displayset = True # <- Display the Set of the Item
raritytext = True # <- Display the Rarity of the Item
typeconfig = {
"BannerToken": True,
"AthenaBackpack":... | [] |
rajeevs1992/pyhealthvault | src/healthvaultlib/tests/testbase.py | 2b6fa7c1687300bcc2e501368883fbb13dc80495 | import unittest
import settings
from healthvaultlib.helpers.connection import Connection
class TestBase(unittest.TestCase):
def setUp(self):
self.connection = self.get_connection()
def get_connection(self):
conn = Connection(settings.HV_APPID, settings.HV_SERVICE_SERVER)
conn... | [((250, 307), 'healthvaultlib.helpers.connection.Connection', 'Connection', (['settings.HV_APPID', 'settings.HV_SERVICE_SERVER'], {}), '(settings.HV_APPID, settings.HV_SERVICE_SERVER)\n', (260, 307), False, 'from healthvaultlib.helpers.connection import Connection\n')] |
StepicOrg/stepik-apps | apps/extensions/migrations/0012_imports_path_urlfield_to_charfield.py | 5825bc9b2444ad4690681964d1bed172706f8796 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-09 03:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extensions', '0011_auto_20170502_0908'),
]
operations = [
migrations.AlterF... | [((413, 465), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""imports/"""', 'max_length': '(255)'}), "(default='imports/', max_length=255)\n", (429, 465), False, 'from django.db import migrations, models\n')] |
secureosv/pythia | regtests/bench/thread_collision.py | 459f9e2bc0bb2da57e9fa8326697d9ef3386883a | '''
multi-threading (python3 version)
https://docs.python.org/3/library/threading.html
'''
from time import clock
import threading
THREADS=2
lock = threading.Lock()
A = 0
B = 0
C = 0
def test_globals():
global A, B, C
for i in range(1024*1024):
lock.acquire()
A += 1
B += 2
C = A + B
lock.release()
def... | [((150, 166), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (164, 166), False, 'import threading\n'), ((377, 384), 'time.clock', 'clock', ([], {}), '()\n', (382, 384), False, 'from time import clock\n'), ((431, 477), 'threading.Thread', 'threading.Thread', ([], {'target': 'test_globals', 'args': '()'}), '(targe... |
scooler/checkers | game/board.py | 90bfe8702c6005c767a8673caed6e7e2f0ce5879 | import numpy as np
class Board:
"""
0 - black
1 - white
"""
def __init__(self):
board = [
[0, 1] * 4,
[1, 0] * 4
] * 4
players_board = [
[0, 1] * 4, # player 1
[1, 0] * 4
] + [[0] * 8] * 4 + [ # 4 rows of nothing
[0, 2] * 4, # player 2
[2, 0] * 4
]
se... | [((331, 346), 'numpy.array', 'np.array', (['board'], {}), '(board)\n', (339, 346), True, 'import numpy as np\n'), ((372, 395), 'numpy.array', 'np.array', (['players_board'], {}), '(players_board)\n', (380, 395), True, 'import numpy as np\n')] |
vogelfenx/storagebot | utils/get_season_things_price.py | 64ab07b068bf645d7cdf5bb1cd5db91c0e2a9228 | def get_season_things_price(thing, amount, price):
if thing == 'wheel':
wheel_price = price[thing]['month'] * amount
return f'Стоимость составит {wheel_price}/месяц'
else:
other_thing_price_week = price[thing]['week'] * amount
other_thing_price_month = price[thing]['month'] * a... | [] |
zhester/zge | zge/engine.py | 246096a8c1fd26472091aac747a3fffda58f3072 | """
Zoe Game Engine Core Implementation
===================================
Requirements
------------
[pygame](http://www.pygame.org/)
"""
# core packages
# third-party packages
import pygame
# local package
import layer
__version__ = '0.0.0'
#===================================================================... | [((617, 630), 'pygame.init', 'pygame.init', ([], {}), '()\n', (628, 630), False, 'import pygame\n'), ((700, 736), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size', '(0)', '(32)'], {}), '(size, 0, 32)\n', (723, 736), False, 'import pygame\n'), ((804, 855), 'pygame.display.set_caption', 'pygame.display.set_... |
CHESyrian/Estebyan | Authentication/migrations/0004_auto_20201115_1105.py | 015c0a8e95d033af04ba949942da79a4f5a90488 | # Generated by Django 3.0.6 on 2020-11-15 09:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Authentication', '0003_auto_20201113_2210'),
]
operations = [
migrations.AlterField(
model_name='profiles',
name='Qu... | [((348, 378), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (367, 378), False, 'from django.db import migrations, models\n'), ((508, 538), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (527, 538), False, 'from djan... |
EdisonBr/MockDados | dashboard/urls.py | c625cba7b93a8f31609549241c5aa71932e26b2d |
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from .views import dashboard_cost, dashboard_energy, MotorDataListView
app_name = 'dashboard'
urlpatterns = [
path('', MotorDataListView.as_view(), name='dashboard_custom'),
#path('', dashboard_custom, name='dashboar... | [((336, 393), 'django.urls.path', 'path', (['"""energy"""', 'dashboard_energy'], {'name': '"""dashboard_energy"""'}), "('energy', dashboard_energy, name='dashboard_energy')\n", (340, 393), False, 'from django.urls import path, re_path\n'), ((399, 450), 'django.urls.path', 'path', (['"""cost"""', 'dashboard_cost'], {'na... |
ejgarcia1991/Courses-and-other-non-professional-projects | Coursera/Python for Everybody Specialization/Python for everybody basics/hourly rate.py | 94794dd1d6cf626de174330311e3fde4d10cd460 | hrs = input("Enter Hours:")
rate = input("Enter rate:")
pay = float(hrs) * float(rate)
print("Pay: " +str(pay)) | [] |
smunaut/litex-boards | litex_boards/platforms/xilinx_kcu105.py | caac75c7dbcba68d9f4fb948107cb5d6ff60e05f | #
# This file is part of LiteX-Boards.
#
# Copyright (c) 2017-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform, VivadoProgrammer
# IOs -----------------------------------------------------... | [((18057, 18152), 'litex.build.xilinx.XilinxPlatform.__init__', 'XilinxPlatform.__init__', (['self', '"""xcku040-ffva1156-2-e"""', '_io', '_connectors'], {'toolchain': '"""vivado"""'}), "(self, 'xcku040-ffva1156-2-e', _io, _connectors,\n toolchain='vivado')\n", (18080, 18152), False, 'from litex.build.xilinx import ... |
erinleeryan/2020adventofcode | code/advent_of_code_day3.py | 69f21d3458f57d8fcf006c451416e0509a66cd7a | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import math
# In[2]:
fileObj = open('../data/advent_of_code_input_day_three.txt', "r") #opens the file in read mode.
items = fileObj. read(). splitlines() #puts the file into an array.
# In[3]:
#print (items)
def split(line):
return lis... | [((438, 455), 'numpy.array', 'np.array', (['holding'], {}), '(holding)\n', (446, 455), True, 'import numpy as np\n'), ((1372, 1472), 'numpy.array', 'np.array', (['[down1_right3, down1_right1, down1_right5, down1_right7, down2_right1]'], {'dtype': 'np.int64'}), '([down1_right3, down1_right1, down1_right5, down1_right7,\... |
Wyverns010/Body-Keypoints-Detection | input_handler.py | 980445da5e87c898a00a8ef1c9e1e143d09d4643 | import os
import traceback
class InputHandler:
IMAGES_PARENT_FOLDER = './images'
def __init__(self):
filesList = []
def listFiles(self,path=''):
if path != '':
self.IMAGES_PARENT_FOLDER = path
try:
self.listFiles = [os.path.join(self.IMAGES_PAREN... | [((290, 340), 'os.path.join', 'os.path.join', (['self.IMAGES_PARENT_FOLDER', 'imageFile'], {}), '(self.IMAGES_PARENT_FOLDER, imageFile)\n', (302, 340), False, 'import os\n'), ((357, 394), 'os.listdir', 'os.listdir', (['self.IMAGES_PARENT_FOLDER'], {}), '(self.IMAGES_PARENT_FOLDER)\n', (367, 394), False, 'import os\n'),... |
misc0110/bepasty-server | docker/autoconfig.py | 662179671220d680fed57aa90894ffebf57dd4c7 | #!/usr/bin/python
import os
import sys
SITENAME = os.environ.get("BEPASTY_SITENAME", None)
if SITENAME is None:
print("\n\nEnvironment variable BEPASTY_SITENAME must be set.")
sys.exit(1)
SECRET_KEY = os.environ.get("BEPASTY_SECRET_KEY", None)
if SECRET_KEY is None:
print("\n\nEnvironment variable BEPAST... | [((52, 92), 'os.environ.get', 'os.environ.get', (['"""BEPASTY_SITENAME"""', 'None'], {}), "('BEPASTY_SITENAME', None)\n", (66, 92), False, 'import os\n'), ((212, 254), 'os.environ.get', 'os.environ.get', (['"""BEPASTY_SECRET_KEY"""', 'None'], {}), "('BEPASTY_SECRET_KEY', None)\n", (226, 254), False, 'import os\n'), ((3... |
drslump/pysh | pysh/transforms/alpha/bangexpr.py | 673cdf2b5ea95dc3209cb294bb91cb2f298bb888 | from io import StringIO
import re
import tokenize
import os
from collections import deque, ChainMap
from functools import lru_cache
from enum import Enum
import pysh
from pysh.path import PathWrapper, Path
from typing import List, Callable, Iterator, Tuple, NamedTuple, Deque, Union, Any
TBangTransformer = Callable[ [... | [((13474, 13487), 'pysh.command.command', 'command', (['"""ls"""'], {}), "('ls')\n", (13481, 13487), False, 'from pysh.command import command\n'), ((13495, 13510), 'pysh.command.command', 'command', (['"""grep"""'], {}), "('grep')\n", (13502, 13510), False, 'from pysh.command import command\n'), ((989, 1000), 'functool... |
Vikas-kum/incubator-mxnet | example/bayesian-methods/data_loader.py | ba02bf2fe2da423caa59ddb3fd5e433b90b730bf | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [((1456, 1477), 'numpy.load', 'numpy.load', (['data_path'], {}), '(data_path)\n', (1466, 1477), False, 'import numpy\n'), ((1803, 1838), 'numpy.loadtxt', 'numpy.loadtxt', (['"""toy_data_train.txt"""'], {}), "('toy_data_train.txt')\n", (1816, 1838), False, 'import numpy\n'), ((1858, 1898), 'numpy.loadtxt', 'numpy.loadtx... |
mickeyckm/nanodegree-freshtomatoes | start.py | 12776f7e46d6c42a4755a0b81e60eb1a5a65de08 | import os
import tmdbsimple as tmdb
import media
import fresh_tomatoes as ft
movies = []
if os.environ.get('TMDB_API', False):
# Retrieve API KEY
tmdb.API_KEY = os.environ['TMDB_API']
# TMDB Movie Ids
movie_ids = [271110, 297761, 246655, 278154, 135397, 188927]
# Get Configuration
configurat... | [((94, 127), 'os.environ.get', 'os.environ.get', (['"""TMDB_API"""', '(False)'], {}), "('TMDB_API', False)\n", (108, 127), False, 'import os\n'), ((4715, 4742), 'fresh_tomatoes.open_movies_page', 'ft.open_movies_page', (['movies'], {}), '(movies)\n', (4734, 4742), True, 'import fresh_tomatoes as ft\n'), ((1066, 1087), ... |
sarafs1926/qiskit-metal | qiskit_metal/_gui/elements_ui.py | cf2ce8125ebe8f21b6d1b85362466fd57db2cada | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './elements_ui.ui',
# licensing of './elements_ui.ui' applies.
#
# Created: Wed Jun 16 14:29:03 2021
# by: pyside2-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui... | [((531, 564), 'PySide2.QtWidgets.QWidget', 'QtWidgets.QWidget', (['ElementsWindow'], {}), '(ElementsWindow)\n', (548, 564), False, 'from PySide2 import QtCore, QtGui, QtWidgets\n'), ((655, 696), 'PySide2.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (676, 696),... |
manishaverma1012/programs | Python/function.py | dd77546219eab2f2ee81dd0d599b78ebd8f95957 | def cube(number):
return number*number*number
digit = input(" the cube of which digit do you want >")
result = cube(int(digit))
print(result)
| [] |
elifesciences/proofreader-python | tests/test_runner.py | 89d807253e17a1731c7ce15f7dd382e49c1c835a | try:
from unittest.mock import patch
except ImportError: # pragma: no cover
from mock import patch
from proofreader.runner import run, _run_command
def test_it_will_return_1_exit_code_on_failure(bad_py_file):
try:
run(targets=[bad_py_file.strpath])
except SystemExit as exception:
ass... | [((238, 272), 'proofreader.runner.run', 'run', ([], {'targets': '[bad_py_file.strpath]'}), '(targets=[bad_py_file.strpath])\n', (241, 272), False, 'from proofreader.runner import run, _run_command\n'), ((428, 463), 'proofreader.runner.run', 'run', ([], {'targets': '[good_py_file.strpath]'}), '(targets=[good_py_file.str... |
wofeicaoge/Tanim | tanim/core/container/container.py | 8ef17834a4ba51092f28c0d5becec25aecd01a62 | from tanim.utils.config_ops import digest_config
from tanim.utils.iterables import list_update
# Currently, this is only used by both Scene and Mobject.
# Still, we abstract its functionality here, albeit purely nominally.
# All actual implementation has to be handled by derived classes for now.
class Container(obj... | [((368, 395), 'tanim.utils.config_ops.digest_config', 'digest_config', (['self', 'kwargs'], {}), '(self, kwargs)\n', (381, 395), False, 'from tanim.utils.config_ops import digest_config\n'), ((619, 658), 'tanim.utils.iterables.list_update', 'list_update', (['self.submobjects', 'mobjects'], {}), '(self.submobjects, mobj... |
ZACHSTRIVES/AUCSS-StaffPlatform | article.py | f2d6597853e85b06f057292025d83edbb4184361 | from config import *
def fetch_all_article():
try:
cur = db.cursor()
sql = "SELECT * FROM article WHERE article_status='N'"
db.ping(reconnect=True)
cur.execute(sql)
result = cur.fetchall()
db.commit()
cur.close()
return result
except Exception as... | [] |
dwang-ischool/w205 | 12-Querying-Data-II/just_filtering.py | ebcdf684dc653951691faaa2787896a2d2406539 | #!/usr/bin/env python
"""Extract events from kafka and write them to hdfs
"""
import json
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import udf
@udf('boolean')
def is_purchase(event_as_json):
event = json.loads(event_as_json)
if event['event_type'] == 'purchase_sword':
return... | [((173, 187), 'pyspark.sql.functions.udf', 'udf', (['"""boolean"""'], {}), "('boolean')\n", (176, 187), False, 'from pyspark.sql.functions import udf\n'), ((232, 257), 'json.loads', 'json.loads', (['event_as_json'], {}), '(event_as_json)\n', (242, 257), False, 'import json\n'), ((389, 437), 'pyspark.sql.SparkSession.bu... |
navjotk/pysz | test.py | 6d75aa4fe24713ed893a2301c143006dace6fd77 | import numpy as np
from pysz import compress, decompress
def test_compress_decompress():
a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100)).astype(np.float32)
tolerance = 0.0001
compressed = compress(a, tolerance=tolerance)
recovered = decompress(compressed, a.shape, a.dtype)
asse... | [((216, 248), 'pysz.compress', 'compress', (['a'], {'tolerance': 'tolerance'}), '(a, tolerance=tolerance)\n', (224, 248), False, 'from pysz import compress, decompress\n'), ((266, 306), 'pysz.decompress', 'decompress', (['compressed', 'a.shape', 'a.dtype'], {}), '(compressed, a.shape, a.dtype)\n', (276, 306), False, 'f... |
PasaLab/SparkDQ | sparkdq/outliers/params/KSigmaParams.py | 16d50210747ef7de03cf36d689ce26ff7445f63a | import json
from sparkdq.outliers.params.OutlierSolverParams import OutlierSolverParams
from sparkdq.outliers.OutlierSolver import OutlierSolver
class KSigmaParams(OutlierSolverParams):
def __init__(self, deviation=1.5):
self.deviation = deviation
def model(self):
return OutlierSolver.kSigm... | [((382, 402), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (392, 402), False, 'import json\n')] |
dunzoit/alerta-contrib | webhooks/sentry/alerta_sentry.py | 57dd47d5bb0c994fce036ae1eea2c3a88ef352c4 |
from alerta.models.alert import Alert
from alerta.webhooks import WebhookBase
class SentryWebhook(WebhookBase):
def incoming(self, query_string, payload):
# For Sentry v9
# Defaults to value before Sentry v9
if 'request' in payload.get('event'):
key = 'request'
else:... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.