repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
louisenje/Pitches
app/auth/__init__.py
11248906ffa7d1b6ed6c47db0c5e7bd3b4768825
from flask import Blueprint auth=Blueprint('auth',__name__) from .import views,forms
[((33, 60), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (42, 60), False, 'from flask import Blueprint\n')]
Rono-Barto-Co/Project-QR
forms/QRGenerator.py
e80fc5a41f25542038c090311844912790cb1478
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, SelectField from wtforms.validators import DataRequired class QRGenerator(FlaskForm): code_content = StringField('Content', validators=[DataRequired()]) code_size = SelectField('Size', choices=[('15', 'Size'), ...
[((253, 385), 'wtforms.SelectField', 'SelectField', (['"""Size"""'], {'choices': "[('15', 'Size'), ('5', '5'), ('10', '10'), ('15', '15'), ('20', '20'), (\n '25', '25'), ('30', '30')]"}), "('Size', choices=[('15', 'Size'), ('5', '5'), ('10', '10'), (\n '15', '15'), ('20', '20'), ('25', '25'), ('30', '30')])\n", (...
jcrangel/AI-for-Trading
Quiz/m2_advanced_quants/l5_volatility/volatility_estimation.py
c3b865e992f8eb8deda91e7641428eef1d343636
import pandas as pd import numpy as np def estimate_volatility(prices, l): """Create an exponential moving average model of the volatility of a stock price, and return the most recent (last) volatility estimate. Parameters ---------- prices : pandas.Series A series of adjusted closing...
[((973, 1048), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': "['date']", 'index_col': '"""date"""', 'squeeze': '(True)'}), "(filename, parse_dates=['date'], index_col='date', squeeze=True)\n", (984, 1048), True, 'import pandas as pd\n')]
kagemeka/atcoder-submissions
jp.atcoder/abc122/abc122_c/9516079.py
91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e
import sys n, q = map(int, sys.stdin.readline().split()) s = '$' + sys.stdin.readline().rstrip() lr = zip(*[map(int, sys.stdin.read().split())] * 2) def main(): res = [None] * (n + 1); res[0] = 0 prev = '$' for i in range(1, n+1): res[i] = res[i-1] res[i] += (prev == 'A' and s[i...
[((30, 50), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (48, 50), False, 'import sys\n'), ((71, 91), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (89, 91), False, 'import sys\n'), ((122, 138), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (136, 138), False, 'import sys\n')]
gokulsg/Attention-is-all-you-need-implementation-from-scratch
Decoder.py
f5eb591d169cbef3ef8b066d8d462fee11badc3b
import torch import torch.nn as nn from DecoderLayer import DecoderLayer import math class Decoder(nn.Module): def __init__(self, output_dim, embed_dim, num_layers, num_heads, expand_dim, dropout, device, max_length = 30): super().__init__() self.tok_embedding = nn.Embedding(output_dim, emb...
[((292, 327), 'torch.nn.Embedding', 'nn.Embedding', (['output_dim', 'embed_dim'], {}), '(output_dim, embed_dim)\n', (304, 327), True, 'import torch.nn as nn\n'), ((653, 685), 'torch.nn.Linear', 'nn.Linear', (['embed_dim', 'output_dim'], {}), '(embed_dim, output_dim)\n', (662, 685), True, 'import torch.nn as nn\n'), ((7...
babs/salt
salt/grains/nxos.py
c536ea716d5308880b244e7980f4b659d86fc104
""" Grains for Cisco NX-OS minions .. versionadded:: 2016.11.0 For documentation on setting up the nxos proxy minion look in the documentation for :mod:`salt.proxy.nxos<salt.proxy.nxos>`. """ import logging import salt.utils.nxos import salt.utils.platform from salt.exceptions import NxosClientError log = logging....
[((312, 339), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (329, 339), False, 'import logging\n')]
tvip/tmsproviderapisdk
tmsproviderapisdk/tms_device.py
f385ddb0d7e87e7a62d1caef3e2c9769e844a4a1
from typing import List, Optional, Tuple from tmsproviderapisdk.tms_extended_model import TmsExtendedModel class TmsDevice(TmsExtendedModel): _path_url = "/devices/" def __init__(self, unique_id: str, account: int, device_id: int = None, ipaddr: str = None, mac: str = None, remote_custom_fie...
[]
eddiejessup/fealty
fealty/fields.py
03745eb98d85bc2a5d08920773ab9c4515462d30
""" A class hierarchy relating to fields of all kinds. """ from __future__ import print_function, division import numpy as np from ciabatta.meta import make_repr_str from fealty import lattice, field_numerics, walled_field_numerics class Space(object): def __init__(self, L, dim): self.L = L self....
[((3872, 3896), 'fealty.lattice.r_to_i', 'lattice.r_to_i', (['r', 'L', 'dx'], {}), '(r, L, dx)\n', (3886, 3896), False, 'from fealty import lattice, field_numerics, walled_field_numerics\n'), ((3905, 3946), 'numpy.zeros', 'np.zeros', (['(r.shape[1] * (M,))'], {'dtype': 'np.int'}), '(r.shape[1] * (M,), dtype=np.int)\n',...
cpascariello/aleph-vm
examples/example_django/example_django/asgi.py
1b4920bec211ef3bd379e9359f57f06b9308c1a1
""" ASGI config for example_django project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault("DJANG...
[((292, 366), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""example_django.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'example_django.settings')\n", (313, 366), False, 'import os\n'), ((382, 404), 'django.core.asgi.get_asgi_application', 'get_asgi_application', ([], {}), '...
loikein/ekw-lectures
lectures/extensions/hyperbolic_discounting/replication_code/src/analysis/get_bivariate_distr_data.py
a2f5436f10515ab26eab323fca8c37c91bdc5dcd
"""Generate values of Method of Simulated Moments criterion function. Given observed moments and weighting matrix in `OUT_ANALYSIS`, "msm_estimation", generate values of Method of Simulated Moments criterion function for combinations of discount factor and present bias values. The goal is to study the bivariate distr...
[((2017, 2048), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['results'], {}), '(results)\n', (2039, 2048), True, 'import pandas as pd\n'), ((1695, 1735), 'itertools.product', 'itertools.product', (['grid_beta', 'grid_delta'], {}), '(grid_beta, grid_delta)\n', (1712, 1735), False, 'import itertools\n'), ((2...
Iwomichu/probable-giggle
space_game/events/KeyPressedEvent.py
2af5ed83a60d65ec9d509c217cb5fcb880d5dbcc
from dataclasses import dataclass from space_game.domain_names import KeyId from space_game.events.Event import Event @dataclass class KeyPressedEvent(Event): key_id: KeyId
[]
navoday-91/oncall
src/oncall/messengers/teams_messenger.py
0a977f06bbf308978d0d2c2b46e0aca23937ca9a
import pymsteams import logging from oncall.constants import TEAMS_SUPPORT class teams_messenger(object): supports = frozenset([TEAMS_SUPPORT]) def __init__(self, config): self.webhook = config['webhook'] def send(self, message): heading = message.get("subject") final_message = "...
[((430, 467), 'pymsteams.connectorcard', 'pymsteams.connectorcard', (['self.webhook'], {}), '(self.webhook)\n', (453, 467), False, 'import pymsteams\n'), ((629, 702), 'logging.info', 'logging.info', (['"""An issue occured while sending message to teams messenger"""'], {}), "('An issue occured while sending message to t...
Laniakea94/BigDL
python/chronos/src/bigdl/chronos/autots/model/auto_prophet.py
4d01734086dda893a7f08ba53251dc3c5c8ecfd1
# + # # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[((3348, 3362), 'bigdl.chronos.model.prophet.ProphetModel', 'ProphetModel', ([], {}), '()\n', (3360, 3362), False, 'from bigdl.chronos.model.prophet import ProphetBuilder, ProphetModel\n'), ((4543, 4559), 'bigdl.chronos.model.prophet.ProphetBuilder', 'ProphetBuilder', ([], {}), '()\n', (4557, 4559), False, 'from bigdl....
arita37/normalizing-flows
nf/flows.py
c9896656bfd2007b0c17b801c0fe068560127301
import math import numpy as np import scipy as sp import scipy.linalg import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from nf.utils import unconstrained_RQS # supported non-linearities: note that the function must be invertible functional_derivatives = { torch.tanh: ...
[((2834, 2857), 'torch.norm', 'torch.norm', (['(x - self.x0)'], {}), '(x - self.x0)\n', (2844, 2857), False, 'import torch\n'), ((4545, 4577), 'torch.cat', 'torch.cat', (['[lower, upper]'], {'dim': '(1)'}), '([lower, upper], dim=1)\n', (4554, 4577), False, 'import torch\n'), ((5114, 5146), 'torch.cat', 'torch.cat', (['...
HakaiInstitute/ioos_qc
ioos_qc/config_creator/fx_parser.py
dfb28ee404a17c8355747b792fba0471093953c4
# module pyparsing.py # # Copyright (c) 2003-2019 Paul T. McGuire # # 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, cop...
[((2481, 2501), 'pyparsing.CaselessKeyword', 'CaselessKeyword', (['"""E"""'], {}), "('E')\n", (2496, 2501), False, 'from pyparsing import Literal, Word, Group, Forward, alphas, alphanums, Regex, CaselessKeyword, Suppress, delimitedList\n'), ((2511, 2532), 'pyparsing.CaselessKeyword', 'CaselessKeyword', (['"""PI"""'], {...
pythonhacker/pyscanlogd
scanlogger.py
64d6ad38127243e5c422be7f899ecfa802e1ad21
# -- coding: utf-8 #!/usr/bin/env python """ pyscanlogger: Port scan detector/logger tool, inspired by scanlogd {http://www.openwall.com/scanlogd} but with added ability to log slow port-scans. Features 1. Detects all stealth (half-open) and full-connect scans. 2. Detects Idle scan and logs it correctly usi...
[]
ashleylst/DSDmodel
src/util/util.py
4276c832e0335539aef2ae2b33e23719957a3f08
from itertools import combinations import copy def get_reverse(n): if n == 1: return 0 else: return 1 def get_edge_info(e): v = [0 for i in range(2)] n = [0 for i in range(2)] t = 0 for x in e: v[t], n[t] = x t += 1 return v, n def sort_e_by_domain(val)...
[((1671, 1687), 'copy.copy', 'copy.copy', (['edges'], {}), '(edges)\n', (1680, 1687), False, 'import copy\n'), ((1016, 1057), 'itertools.combinations', 'combinations', (['indexlist[cursor:oldlen]', '(2)'], {}), '(indexlist[cursor:oldlen], 2)\n', (1028, 1057), False, 'from itertools import combinations\n')]
ebell495/nn_pruning
examples/question_answering/qa_sparse_train.py
41263ab898117a639f3f219c23a4cecc8bc0e3f3
# coding=utf-8 # Copyright 2020 The HuggingFace Team 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 require...
[((1176, 1217), 'nn_pruning.sparse_trainer.SparseTrainer.__init__', 'SparseTrainer.__init__', (['self', 'sparse_args'], {}), '(self, sparse_args)\n', (1198, 1217), False, 'from nn_pruning.sparse_trainer import SparseTrainer\n')]
armohamm/ironic
ironic/drivers/modules/ilo/raid.py
21093ca886ed736a7a25bf5e71e05d41e132fd2f
# Copyright 2018 Hewlett Packard Enterprise Development LP # # 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 applicabl...
[((1109, 1136), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1126, 1136), True, 'from oslo_log import log as logging\n'), ((1164, 1206), 'ironic_lib.metrics_utils.get_metrics_logger', 'metrics_utils.get_metrics_logger', (['__name__'], {}), '(__name__)\n', (1196, 1206), False, 'fro...
groboclown/petronia
src/petronia/aid/bootstrap/__init__.py
486338023d19cee989e92f0c5692680f1a37811f
""" Common Petronia imports for bootstrap parts of an extension. This should be imported along with the `simp` module. """ from ...base.bus import ( EventBus, ListenerRegistrar, ListenerSetup, QueuePriority, ExtensionMetadataStruct, register_event, EVENT_WILDCARD, TARGET_WILDCARD, ...
[]
zachjweiner/pyopencl
examples/dump-properties.py
4e2e4f3150c331680e6d9e36c59290411e4a0c40
import pyopencl as cl from optparse import OptionParser parser = OptionParser() parser.add_option("-s", "--short", action="store_true", help="don't print all device properties") (options, args) = parser.parse_args() def print_info(obj, info_cls): for info_name in sorted(dir(info_cls)): ...
[((66, 80), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (78, 80), False, 'from optparse import OptionParser\n'), ((1109, 1127), 'pyopencl.get_platforms', 'cl.get_platforms', ([], {}), '()\n', (1125, 1127), True, 'import pyopencl as cl\n'), ((1500, 1520), 'pyopencl.Context', 'cl.Context', (['[device]'], {...
jgillis/acados
interfaces/acados_template/acados_template/acados_ocp_solver.py
3119e2dda636a8358fbd52247eb0163a167cbc97
# -*- coding: future_fstrings -*- # # Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, # Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, # Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, # Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Di...
[((15886, 15909), 'numpy.sum', 'np.sum', (['opts.time_steps'], {}), '(opts.time_steps)\n', (15892, 15909), True, 'import numpy as np\n'), ((16157, 16197), 'os.path.dirname', 'os.path.dirname', (['current_module.__file__'], {}), '(current_module.__file__)\n', (16172, 16197), False, 'import sys, os, json\n'), ((9353, 937...
MaikWischow/Camera-Condition-Monitoring
noise/estimation/PCA/analyticNoiseEstimation_PCA.py
910f9192d6309a6803ab76c346269fa5029c38e6
import numpy as np import cv2 import sys import os import glob def im2patch(im, pch_size, stride=1): ''' Transform image to patches. Input: im: 3 x H x W or 1 X H x W image, numpy format pch_size: (int, int) tuple or integer stride: (int, int) tuple or integer ''' if isinsta...
[((912, 965), 'numpy.zeros', 'np.zeros', (['(C, pch_H * pch_W, num_pch)'], {'dtype': 'im.dtype'}), '((C, pch_H * pch_W, num_pch), dtype=im.dtype)\n', (920, 965), True, 'import numpy as np\n'), ((2183, 2206), 'numpy.linalg.eigh', 'np.linalg.eigh', (['sigma_X'], {}), '(sigma_X)\n', (2197, 2206), True, 'import numpy as np...
claudejrogers/biotite
src/biotite/application/application.py
3635bc9071506ecb85ddd9b1dbe6a430295e060e
# This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. __name__ = "biotite.application" __author__ = "Patrick Kunzmann" __all__ = ["Application", "AppStateError", "TimeoutError", "VersionError", "AppState", "...
[((536, 542), 'enum.auto', 'auto', ([], {}), '()\n', (540, 542), False, 'from enum import Flag, auto\n'), ((557, 563), 'enum.auto', 'auto', ([], {}), '()\n', (561, 563), False, 'from enum import Flag, auto\n'), ((579, 585), 'enum.auto', 'auto', ([], {}), '()\n', (583, 585), False, 'from enum import Flag, auto\n'), ((59...
douch/Paddle
python/paddle/tensor/attribute.py
81c40722869935d6e897f4b1aeb6e6f67606188a
# Copyright (c) 2020 PaddlePaddle 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 app...
[((6059, 6085), 'paddle._C_ops.final_state_real', '_C_ops.final_state_real', (['x'], {}), '(x)\n', (6082, 6085), False, 'from paddle import _C_ops\n'), ((6130, 6144), 'paddle._C_ops.real', '_C_ops.real', (['x'], {}), '(x)\n', (6141, 6144), False, 'from paddle import _C_ops\n'), ((7755, 7781), 'paddle._C_ops.final_state...
open-contracting/ocds-merge
ocdsmerge/exceptions.py
80c7cb380d191c75f88feefd34b607bc0de13ee1
class OCDSMergeError(Exception): """Base class for exceptions from within this package""" class MissingDateKeyError(OCDSMergeError, KeyError): """Raised when a release is missing a 'date' key""" def __init__(self, key, message): self.key = key self.message = message def __str__(self)...
[]
guardhunt/TelemterRC
appcodec.py
679f99b317ecc6cbef6e022ae861cde18594f6a0
import evdev import time import struct class appcodec(): def __init__(self): self.device = evdev.InputDevice("/dev/input/event2") self.capabilities = self.device.capabilities(verbose=True) self.capaRAW = self.device.capabilities(absinfo=False) self.config = {} self.state = {...
[((104, 142), 'evdev.InputDevice', 'evdev.InputDevice', (['"""/dev/input/event2"""'], {}), "('/dev/input/event2')\n", (121, 142), False, 'import evdev\n'), ((2553, 2583), 'struct.unpack', 'struct.unpack', (['"""6h2B2c"""', 'state'], {}), "('6h2B2c', state)\n", (2566, 2583), False, 'import struct\n')]
jiskra/openmv
scripts/examples/OpenMV/16-Codes/find_barcodes.py
a0f321836f77f94d8118910598dcdb79eb784d58
# Barcode Example # # This example shows off how easy it is to detect bar codes using the # OpenMV Cam M7. Barcode detection does not work on the M4 Camera. import sensor, image, time, math sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.VGA) # High Res! sensor.set_windowing((640, 80...
[((192, 206), 'sensor.reset', 'sensor.reset', ([], {}), '()\n', (204, 206), False, 'import sensor, image, time, math\n'), ((207, 245), 'sensor.set_pixformat', 'sensor.set_pixformat', (['sensor.GRAYSCALE'], {}), '(sensor.GRAYSCALE)\n', (227, 245), False, 'import sensor, image, time, math\n'), ((246, 278), 'sensor.set_fr...
devaslooper/Code-Overflow
Python/factorial.py
d7d55ea0f5015bccb5c4100c4240464fcda8504a
n=int(input("Enter number ")) fact=1 for i in range(1,n+1): fact=fact*i print("Factorial is ",fact)
[]
thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
mundo 3/099.py
0342e482780b5a1c6f78cddd51d9bfad785c79fa
import time # O * é para desempacotar o paramêtro. Permite atribuir inumeros parametros. def maior(* num): contador = maior = 0 print('Analisando os valores passados...') for v in num: contador = contador + 1 print(f'{v} ', end='', flush=True) time.sleep(0.3) if contador == 1...
[((280, 295), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (290, 295), False, 'import time\n')]
theycallmepeter/pytorch3d_PBR
tests/test_packed_to_padded.py
bc83c23969ff7843fc05d2da001952b368926174
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from common_testing import TestCaseMixin, get_random_cuda_device from pyt...
[((550, 570), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (567, 570), False, 'import torch\n'), ((765, 785), 'torch.device', 'torch.device', (['device'], {}), '(device)\n', (777, 785), False, 'import torch\n'), ((1184, 1214), 'pytorch3d.structures.meshes.Meshes', 'Meshes', (['verts_list', 'faces_l...
HowcanoeWang/EasyRIC
easyric/tests/test_io_geotiff.py
a3420bc7b1e0f1013411565cf0e66dd2d2ba5371
import pyproj import pytest import numpy as np from easyric.io import geotiff, shp from skimage.io import imread from skimage.color import rgb2gray import matplotlib.pyplot as plt def test_prase_header_string_width(): out_dict = geotiff._prase_header_string("* 256 image_width (1H) 13503") assert out_dict['widt...
[((234, 294), 'easyric.io.geotiff._prase_header_string', 'geotiff._prase_header_string', (['"""* 256 image_width (1H) 13503"""'], {}), "('* 256 image_width (1H) 13503')\n", (262, 294), False, 'from easyric.io import geotiff, shp\n'), ((389, 450), 'easyric.io.geotiff._prase_header_string', 'geotiff._prase_header_string'...
matecsaj/ebay_rest
src/ebay_rest/api/buy_marketplace_insights/models/item_location.py
dd23236f39e05636eff222f99df1e3699ce47d4a
# coding: utf-8 """ Marketplace Insights API <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\" />(Limited Release)</a> The Marketpl...
[((8458, 8491), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (8471, 8491), False, 'import six\n')]
aadishgoel2013/Algos-with-Python
fractionalKnapsack.py
19541607c8ede9a76a8cbbe047e01343080cfd5b
# Fractional Knapsack wt = [40,50,30,10,10,40,30] pro = [30,20,20,25,5,35,15] n = len(wt) data = [ (i,pro[i],wt[i]) for i in range(n) ] bag = 100 data.sort(key=lambda x: x[1]/x[2], reverse=True) profit=0 ans=[] i=0 while i<n: if data[i][2]<=bag: bag-=data[i][2] ans.append(data[i...
[]
CrackerCat/xed
pysrc/classifier.py
428712c28e831573579b7f749db63d3a58dcdbd9
#!/usr/bin/env python # -*- python -*- #BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation # # 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-...
[((1102, 1145), 'codegen.c_switch_generator_t', 'codegen.c_switch_generator_t', (['"""isa_set"""', 'fo'], {}), "('isa_set', fo)\n", (1130, 1145), False, 'import codegen\n'), ((1697, 1730), 'genutil.field_check', 'genutil.field_check', (['ii', '"""iclass"""'], {}), "(ii, 'iclass')\n", (1716, 1730), False, 'import genuti...
lanz/Tenable.io-SDK-for-Python
tests/integration/api/test_target_groups.py
e81a61c369ac103d1524b0898153a569536a131e
import pytest from tenable_io.api.target_groups import TargetListEditRequest from tenable_io.api.models import TargetGroup, TargetGroupList @pytest.mark.vcr() def test_target_groups_create(new_target_group): assert isinstance(new_target_group, TargetGroup), u'The `create` method did not return type `TargetGroup`...
[((144, 161), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (159, 161), False, 'import pytest\n'), ((326, 343), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (341, 343), False, 'import pytest\n'), ((723, 740), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (738, 740), False, 'import pytest\...
tasercake/nnAudio
Installation/nnAudio/Spectrogram.py
5edc37b7b73674598d533261314429b875ba285d
""" Module containing all the spectrogram classes """ # 0.2.0 import torch import torch.nn as nn from torch.nn.functional import conv1d, conv2d, fold import numpy as np from time import time from nnAudio.librosa_functions import * from nnAudio.utils import * sz_float = 4 # size of a float epsilon = 10e-8 # fudg...
[((4751, 4757), 'time.time', 'time', ([], {}), '()\n', (4755, 4757), False, 'from time import time\n'), ((5660, 5703), 'torch.tensor', 'torch.tensor', (['kernel_sin'], {'dtype': 'torch.float'}), '(kernel_sin, dtype=torch.float)\n', (5672, 5703), False, 'import torch\n'), ((5725, 5768), 'torch.tensor', 'torch.tensor', (...
hui-won/KoBART_Project
train.py
105608997473abc669d777c588d56382efb524c6
import argparse import logging import os import numpy as np import pandas as pd import pytorch_lightning as pl import torch from pytorch_lightning import loggers as pl_loggers from torch.utils.data import DataLoader, Dataset from dataset import KoBARTSummaryDataset from transformers import BartForConditionalGeneration,...
[((498, 555), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""KoBART translation"""'}), "(description='KoBART translation')\n", (521, 555), False, 'import argparse\n'), ((682, 701), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (699, 701), False, 'import logging\n'), ((7987,...
RavensburgOP/core
homeassistant/components/shelly/sensor.py
0ea76e848b182ca0ebb0fdb54558f7f733898ad7
"""Sensor for Shelly.""" from __future__ import annotations from datetime import timedelta import logging from typing import Final, cast import aioshelly from homeassistant.components import sensor from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from home...
[((1211, 1238), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1228, 1238), False, 'import logging\n'), ((10821, 10842), 'typing.cast', 'cast', (['str', 'self._unit'], {}), '(str, self._unit)\n', (10825, 10842), False, 'from typing import Final, cast\n'), ((11923, 11944), 'typing.cast', ...
zcqian/biothings.api
tests/web/config.py
61c0300317cf2ac7db8310b5b5741ad9b08c4163
""" Web settings to override for testing. """ import os from biothings.web.settings.default import QUERY_KWARGS # ***************************************************************************** # Elasticsearch Variables # ***************************************************************************** ES_INDEX = 'bts_...
[((993, 1018), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1008, 1018), False, 'import os\n')]
rocheparadox/InvenTree
InvenTree/InvenTree/management/commands/rebuild_thumbnails.py
76c1e936db78424e0d6953c4062eb32863e302c6
""" Custom management command to rebuild thumbnail images - May be required after importing a new dataset, for example """ import os import logging from PIL import UnidentifiedImageError from django.core.management.base import BaseCommand from django.conf import settings from django.db.utils import OperationalError...
[((415, 456), 'logging.getLogger', 'logging.getLogger', (['"""inventree-thumbnails"""'], {}), "('inventree-thumbnails')\n", (432, 456), False, 'import logging\n'), ((806, 844), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', 'url'], {}), '(settings.MEDIA_ROOT, url)\n', (818, 844), False, 'import os\n'), ((1418...
Baracchino-Della-Scuola/Bot
cogs/carbon.py
65c1ef37ca9eae5d104de7d7de5cc58cc138402d
import discord from discord.ext import commands import urllib.parse from .constants import themes, controls, languages, fonts, escales import os from pathlib import Path from typing import Any # from pyppeteer import launch from io import * import requests def encode_url(text: str) -> str: first_encoding = urlli...
[((1457, 1475), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (1473, 1475), False, 'from discord.ext import commands\n'), ((1573, 1597), 'requests.get', 'requests.get', (['carbon_url'], {}), '(carbon_url)\n', (1585, 1597), False, 'import requests\n'), ((1658, 1697), 'discord.File', 'discord.File...
jimcortez/spotipy_twisted
examples/show_artist.py
49ff2a4a5a5a9b3184b22adbe068eb91a38f3102
# shows artist info for a URN or URL import spotipy_twisted import sys import pprint if len(sys.argv) > 1: urn = sys.argv[1] else: urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu' sp = spotipy_twisted.Spotify() artist = sp.artist(urn) pprint.pprint(artist)
[((193, 218), 'spotipy_twisted.Spotify', 'spotipy_twisted.Spotify', ([], {}), '()\n', (216, 218), False, 'import spotipy_twisted\n'), ((245, 266), 'pprint.pprint', 'pprint.pprint', (['artist'], {}), '(artist)\n', (258, 266), False, 'import pprint\n')]
sommersoft/Adafruit_CircuitPython_MCP3xxx
examples/mcp3xxx_mcp3002_single_ended_simpletest.py
94088a7e2b30f1b34e8a5fd7076075d88aad460b
import busio import digitalio import board import adafruit_mcp3xxx.mcp3002 as MCP from adafruit_mcp3xxx.analog_in import AnalogIn # create the spi bus spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI) # create the cs (chip select) cs = digitalio.DigitalInOut(board.D5) # create the mcp object mcp = M...
[((158, 218), 'busio.SPI', 'busio.SPI', ([], {'clock': 'board.SCK', 'MISO': 'board.MISO', 'MOSI': 'board.MOSI'}), '(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)\n', (167, 218), False, 'import busio\n'), ((255, 287), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D5'], {}), '(board.D5)\n', (277, 287)...
rosteen/glue
glue/core/data_factories/tables.py
ed71979f8e0e41f993a2363b3b5a8f8c3167a130
from glue.core.data_factories.helpers import has_extension from glue.config import data_factory __all__ = ['tabular_data'] @data_factory(label="ASCII Table", identifier=has_extension('csv txt tsv tbl dat ' 'csv.gz txt.gz tbl.bz ' ...
[((187, 251), 'glue.core.data_factories.helpers.has_extension', 'has_extension', (['"""csv txt tsv tbl dat csv.gz txt.gz tbl.bz dat.gz"""'], {}), "('csv txt tsv tbl dat csv.gz txt.gz tbl.bz dat.gz')\n", (200, 251), False, 'from glue.core.data_factories.helpers import has_extension\n')]
coordt/code_doc
code_doc/views/author_views.py
c2fac64ac3ad61952a2d9f036727166741f9aff9
from django.shortcuts import render from django.http import Http404 from django.views.generic.edit import UpdateView from django.views.generic import ListView, View from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.utils.decorators import method_decorator...
[((537, 564), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (554, 564), False, 'import logging\n'), ((1124, 1291), 'django.shortcuts.render', 'render', (['request', '"""code_doc/authors/author_details.html"""', "{'project_list': project_list, 'author': author, 'user': request.user,\n ...
rehosting/rehosting_sok
d00dfeed/analyses/print_sloc_per_soc.py
499b625c8aa60020f311df97a6253820982f20d4
# External deps import os, sys, json from pathlib import Path from typing import Dict, List # Internal deps os.chdir(sys.path[0]) sys.path.append("..") import df_common as dfc import analyses_common as ac # Generated files directory GEN_FILE_DIR = str(Path(__file__).resolve().parent.parent) + os.sep + "generated_file...
[((109, 130), 'os.chdir', 'os.chdir', (['sys.path[0]'], {}), '(sys.path[0])\n', (117, 130), False, 'import os, sys, json\n'), ((131, 152), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (146, 152), False, 'import os, sys, json\n'), ((361, 389), 'os.path.exists', 'os.path.exists', (['GEN_FILE_DIR'...
asigalov61/minGPT
mingpt/lr_decay.py
b4f8d57aaf1bb5c64d480f8005b73d39b075ae4b
import math import pytorch_lightning as pl class LearningRateDecayCallback(pl.Callback): def __init__(self, learning_rate, warmup_tokens=375e6, final_tokens=260e9, lr_decay=True): super().__init__() self.learning_rate = learning_rate self.tokens = 0 self.final_tokens = final_token...
[((1101, 1129), 'math.cos', 'math.cos', (['(math.pi * progress)'], {}), '(math.pi * progress)\n', (1109, 1129), False, 'import math\n')]
calvinbui/apprise
apprise/config/ConfigBase.py
a5510790baf5aa1d74afabab25ff57d6b2304d56
# -*- coding: utf-8 -*- # # Copyright (C) 2020 Chris Caron <lead2gold@gmail.com> # All rights reserved. # # This code is licensed under the MIT License. # # 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 th...
[((1675, 1724), 're.compile', 're.compile', (['"""(?P<token>[a-z0-9][a-z0-9_]+)"""', 're.I'], {}), "('(?P<token>[a-z0-9][a-z0-9_]+)', re.I)\n", (1685, 1724), False, 'import re\n'), ((2693, 2704), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2702, 2704), False, 'import os\n'), ((12744, 12755), 'time.time', 'time.time', ...
manuel-fischer/ScrollRec
ffmpeg_util.py
ec5662d3f61630f939613481290a166133d23a20
import sys import subprocess from subprocess import Popen, PIPE AV_LOG_QUIET = "quiet" AV_LOG_PANIC = "panic" AV_LOG_FATAL = "fatal" AV_LOG_ERROR = "error" AV_LOG_WARNING = "warning" AV_LOG_INFO = "info" AV_LOG_VERBOSE = "verbose" AV_LOG_DEBUG = "debug" ffmpeg_loglevel = AV_LOG_ERROR IS_WIN32 = 'win32' ...
[((401, 425), 'subprocess.STARTUPINFO', 'subprocess.STARTUPINFO', ([], {}), '()\n', (423, 425), False, 'import subprocess\n'), ((801, 856), 'subprocess.Popen', 'Popen', (['cmd'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(cmd, stdout=PIPE, stderr=PIPE, **SUBPROCESS_ARGS)\n', (806, 856), False, 'from subprocess import Pop...
rizar/CLOSURE
setup.py
57f80d4e89fa281830bb9c8b6a7a2498747e727a
from setuptools import setup setup( name="nmn-iwp", version="0.1", keywords="", packages=["vr", "vr.models"] )
[((30, 109), 'setuptools.setup', 'setup', ([], {'name': '"""nmn-iwp"""', 'version': '"""0.1"""', 'keywords': '""""""', 'packages': "['vr', 'vr.models']"}), "(name='nmn-iwp', version='0.1', keywords='', packages=['vr', 'vr.models'])\n", (35, 109), False, 'from setuptools import setup\n')]
lefevre-fraser/openmeta-mms
analysis_tools/PYTHON_RICARDO/output_ingress_egress/scripts/uniform_grid.py
08f3115e76498df1f8d70641d71f5c52cab4ce5f
""" Represent a triangulated surface using a 3D boolean grid""" import logging import numpy as np from rpl.tools.ray_tracing.bsp_tree_poly import BSP_Element from rpl.tools.geometry import geom_utils import data_io class BSP_Grid(object): def __init__(self, node_array, tris, allocate_step=100000): ...
[((2930, 3002), 'numpy.arange', 'np.arange', (['x_min', "(x_max + settings['voxel_size'])", "settings['voxel_size']"], {}), "(x_min, x_max + settings['voxel_size'], settings['voxel_size'])\n", (2939, 3002), True, 'import numpy as np\n'), ((3017, 3089), 'numpy.arange', 'np.arange', (['y_min', "(y_max + settings['voxel_s...
Hojung-Jeong/Silver-Bullet-Encryption-Tool
silver_bullet/crypto.py
5ea29b3cd78cf7488e0cbdcf4ea60d7c9151c2a7
''' >List of functions 1. encrypt(user_input,passphrase) - Encrypt the given string with the given passphrase. Returns cipher text and locked pad. 2. decrypt(cipher_text,locked_pad,passphrase) - Decrypt the cipher text encrypted with SBET. It requires cipher text, locked pad, and passphrase. ''' # CODE ============...
[((1076, 1101), 'random.seed', 'random.seed', (['bloated_seed'], {}), '(bloated_seed)\n', (1087, 1101), False, 'import random\n'), ((663, 720), 'silver_bullet.contain_value.contain', 'contain', (['(target_list[counter] + pad[counter])', 'ascii_value'], {}), '(target_list[counter] + pad[counter], ascii_value)\n', (670, ...
RavidLevi98/pyfire
pyfire/errors.py
404ae2082fd5be3ef652b3e15a66ad0d79b7a1b5
# -*- coding: utf-8 -*- """ pyfire.errors ~~~~~~~~~~~~~~~~~~~~~~ Holds the global used base errors :copyright: 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import xml.etree.ElementTree as ET class XMPPProtocolError(Exception): """Ba...
[((536, 561), 'xml.etree.ElementTree.Element', 'ET.Element', (['error_element'], {}), '(error_element)\n', (546, 561), True, 'import xml.etree.ElementTree as ET\n'), ((849, 874), 'xml.etree.ElementTree.tostring', 'ET.tostring', (['self.element'], {}), '(self.element)\n', (860, 874), True, 'import xml.etree.ElementTree ...
thekitbag/starter-snake-python
app/nextMoveLogic.py
48d12d2fa61ecfc976cd5750316b1db49a641f7f
import random class Status(object): def getHeadPosition(gamedata): me = gamedata['you'] my_position = me['body'] head = my_position[0] return head def getMyLength(gamedata): me = gamedata['you'] my_position = me['body'] if my_position[0] == my_position[1] == my_position[2]: return 1 elif my_...
[((3760, 3782), 'random.choice', 'random.choice', (['options'], {}), '(options)\n', (3773, 3782), False, 'import random\n'), ((4772, 4794), 'random.choice', 'random.choice', (['options'], {}), '(options)\n', (4785, 4794), False, 'import random\n')]
gbtami/lichess-puzzler
generator/util.py
e7338b35f592481141acefe39c7aaa444b26aa9e
from dataclasses import dataclass import math import chess import chess.engine from model import EngineMove, NextMovePair from chess import Color, Board from chess.pgn import GameNode from chess.engine import SimpleEngine, Score nps = [] def material_count(board: Board, side: Color) -> int: values = { chess.PAWN:...
[((1172, 1212), 'model.NextMovePair', 'NextMovePair', (['node', 'winner', 'best', 'second'], {}), '(node, winner, best, second)\n', (1184, 1212), False, 'from model import EngineMove, NextMovePair\n'), ((1934, 1955), 'math.exp', 'math.exp', (['(-0.004 * cp)'], {}), '(-0.004 * cp)\n', (1942, 1955), False, 'import math\n...
SkylerHoward/O
sleep.py
989246a5cdc297ab9f76cb6b26daebd799a03741
import time, morning from datetime import datetime def main(): while True: a = time.mktime(datetime.now().timetuple()) n = datetime.now() if n.hour == 6 and (n.minute-(n.minute%5)) == 15: return morning.main() time.sleep(300 - (time.mktime(datetime.now().timetuple())-a))
[((135, 149), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (147, 149), False, 'from datetime import datetime\n'), ((214, 228), 'morning.main', 'morning.main', ([], {}), '()\n', (226, 228), False, 'import time, morning\n'), ((100, 114), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (112, 114),...
ourobouros/aws-sam-cli
tests/unit/commands/local/start_lambda/test_cli.py
3fba861f5106d604fde6d023923a9b83377a35d9
from unittest import TestCase from mock import patch, Mock from samcli.commands.local.start_lambda.cli import do_cli as start_lambda_cli from samcli.commands.local.cli_common.user_exceptions import UserException from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException from samcli.commands.local....
[((912, 973), 'mock.patch', 'patch', (['"""samcli.commands.local.start_lambda.cli.InvokeContext"""'], {}), "('samcli.commands.local.start_lambda.cli.InvokeContext')\n", (917, 973), False, 'from mock import patch, Mock\n'), ((979, 1045), 'mock.patch', 'patch', (['"""samcli.commands.local.start_lambda.cli.LocalLambdaServ...
Varun487/CapstoneProject_TradingSystem
restapi/services/Utils/test_getters.py
b21e3f2c6c5e75596927666bf65294a2014babcf
from django.test import TestCase import pandas as pd from .getters import Getter from .converter import Converter from strategies.models import Company from strategies.models import IndicatorType class GetDataTestCase(TestCase): def setUp(self) -> None: # Dummy company data Company.objects.cre...
[((301, 369), 'strategies.models.Company.objects.create', 'Company.objects.create', ([], {'name': '"""abc"""', 'ticker': '"""ABC"""', 'description': '"""desc"""'}), "(name='abc', ticker='ABC', description='desc')\n", (323, 369), False, 'from strategies.models import Company\n'), ((378, 448), 'strategies.models.Company....
abhatikar/training_extensions
pytorch_toolkit/ote/ote/modules/trainers/mmdetection.py
1c96e0f5f39688f8b79735e8dfa90646afc3d5e6
""" Copyright (c) 2020 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
[((1612, 1649), 'logging.info', 'logging.info', (['"""Clustering started..."""'], {}), "('Clustering started...')\n", (1624, 1649), False, 'import logging\n'), ((2089, 2130), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (2116, 2130), False, 'import tempf...
BT-OpenSource/bt-betalab
svn-go-stats/transform.py
af5a1b0d778c1746312149f62da0c4159f387293
import sys import json import subprocess import re import statistics def get_complexity(): # Load the cyclomatic complexity info cyclostats = subprocess.check_output(['./gocyclo', 'repo']).decode("utf-8") results = re.findall('([0-9]+)\s([^\s]+)\s([^\s]+)\s([^:]+):([0-9]+):([0-9]+)', cyclostats) # S...
[((230, 320), 're.findall', 're.findall', (['"""([0-9]+)\\\\s([^\\\\s]+)\\\\s([^\\\\s]+)\\\\s([^:]+):([0-9]+):([0-9]+)"""', 'cyclostats'], {}), "('([0-9]+)\\\\s([^\\\\s]+)\\\\s([^\\\\s]+)\\\\s([^:]+):([0-9]+):([0-9]+)',\n cyclostats)\n", (240, 320), False, 'import re\n'), ((1044, 1148), 're.findall', 're.findall', (...
yangyangxcf/parso
test/test_python_errors.py
e496b07b6342f6182225a60aad6031d7ad08f24d
""" Testing if parso finds syntax errors and indentation errors. """ import sys import warnings import pytest import parso from parso._compatibility import is_pypy from .failing_examples import FAILING_EXAMPLES, indent, build_nested if is_pypy: # The errors in PyPy might be different. Just skip the module for n...
[((726, 775), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""code"""', 'FAILING_EXAMPLES'], {}), "('code', FAILING_EXAMPLES)\n", (749, 775), False, 'import pytest\n'), ((1872, 2288), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('code', 'positions')", "[('1 +', [(1, 3)]), ('1 +\\n', [(1, 3)]), ...
koji-hirono/pytk-shogi-replayer
shogitk/usikif.py
a10819a797faecbee5c7b0654beb3694eb522840
# -*- coding: utf-8 -*- from __future__ import unicode_literals from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE RANKNUM = { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9 } def decoder(f): color = ...
[((720, 776), 'shogitk.shogi.Move', 'Move', (['color[step & 1]', 'dst', 'src', 'None'], {'modifier': 'modifier'}), '(color[step & 1], dst, src, None, modifier=modifier)\n', (724, 776), False, 'from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE\n'), ((906, 962), 'shogitk.shogi.Move', 'Move', (['color[st...
ideal-money/etherbank-cli
etherbank_cli/oracles.py
d957daa13aa951331cadc35c246c1ce8459ca8df
import click from . import utils @click.group() def main(): "Simple CLI for oracles to work with Ether dollar" pass @main.command() @click.option('--ether-price', type=float, help="The ether price in ether dollar") @click.option('--collateral-ratio', type=float, help="The collateral ratio") @click.option( ...
[((36, 49), 'click.group', 'click.group', ([], {}), '()\n', (47, 49), False, 'import click\n'), ((145, 231), 'click.option', 'click.option', (['"""--ether-price"""'], {'type': 'float', 'help': '"""The ether price in ether dollar"""'}), "('--ether-price', type=float, help=\n 'The ether price in ether dollar')\n", (15...
MrKaStep/csc230-grader
src/grader/machine.py
559846f4d921c5c4be6b6e9ba8629fb24b448e41
import getpass from plumbum import local from plumbum.machines.paramiko_machine import ParamikoMachine from plumbum.path.utils import copy def _once(f): res = None def wrapped(*args, **kwargs): nonlocal res if res is None: res = f(*args, **kwargs) return res return wrapp...
[((396, 464), 'getpass.getpass', 'getpass.getpass', ([], {'prompt': 'f"""Password for {user}@{host}: """', 'stream': 'None'}), "(prompt=f'Password for {user}@{host}: ', stream=None)\n", (411, 464), False, 'import getpass\n'), ((476, 527), 'plumbum.machines.paramiko_machine.ParamikoMachine', 'ParamikoMachine', (['host']...
legna7/Python
Mundo 1/Ex33.py
52e0b642d1b7acc592ec82dd360c5697fb0765db
salario = float(input('digite o seu salario: ')) aumento = (salario + (salario * 15)/100 if salario <= 1250 else salario + (salario * 10)/100) print(aumento)
[]
andreax79/airflow-code-editor
tests/test_tree.py
031170387496bbc6d540179c6c2f1765e1e70694
#!/usr/bin/env python import os import os.path import airflow import airflow.plugins_manager from airflow import configuration from flask import Flask from unittest import TestCase, main from airflow_code_editor.commons import PLUGIN_NAME from airflow_code_editor.tree import ( get_tree, ) assert airflow.plugins_m...
[((333, 348), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (338, 348), False, 'from flask import Flask\n'), ((2786, 2792), 'unittest.main', 'main', ([], {}), '()\n', (2790, 2792), False, 'from unittest import TestCase, main\n'), ((474, 535), 'airflow.configuration.conf.set', 'configuration.conf.set', (['...
greenape/flask-jwt-extended
examples/token_freshness.py
11ac3bf0937ee199aea7d6dc47c748bef9bf1d2f
from quart import Quart, jsonify, request from quart_jwt_extended import ( JWTManager, jwt_required, create_access_token, jwt_refresh_token_required, create_refresh_token, get_jwt_identity, fresh_jwt_required, ) app = Quart(__name__) app.config["JWT_SECRET_KEY"] = "super-secret" # Change ...
[((247, 262), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (252, 262), False, 'from quart import Quart, jsonify, request\n'), ((332, 347), 'quart_jwt_extended.JWTManager', 'JWTManager', (['app'], {}), '(app)\n', (342, 347), False, 'from quart_jwt_extended import JWTManager, jwt_required, create_access_to...
umchemurziev/Practics
env/lib/python3.7/site-packages/tinvest/typedefs.py
82b49f9d58e67f1ecff9e6303e7d914bc1905730
from datetime import datetime from typing import Any, Dict, Union __all__ = 'AnyDict' AnyDict = Dict[str, Any] # pragma: no mutate datetime_or_str = Union[datetime, str] # pragma: no mutate
[]
PipelineAI/models
keras/linear/model/pipeline_train.py
d8df07877aa8b10ce9b84983bb440af75e84dca7
import os os.environ['KERAS_BACKEND'] = 'theano' os.environ['THEANO_FLAGS'] = 'floatX=float32,device=cpu' import cloudpickle as pickle import pipeline_invoke import pandas as pd import numpy as np import keras from keras.layers import Input, Dense from keras.models import Model from keras.models import save_model, loa...
[((441, 486), 'pandas.read_csv', 'pd.read_csv', (['"""../input/training/training.csv"""'], {}), "('../input/training/training.csv')\n", (452, 486), True, 'import pandas as pd\n'), ((521, 580), 'pandas.to_numeric', 'pd.to_numeric', (["df['People per Television']"], {'errors': '"""coerce"""'}), "(df['People per Televisio...
RatJuggler/led-shim-effects
tests/effects/test_cheerlights.py
3c63f5f2ce3f35f52e784489deb9212757c18cd2
from unittest import TestCase from unittest.mock import Mock, patch import sys sys.modules['smbus'] = Mock() # Mock the hardware layer to avoid errors. from ledshimdemo.canvas import Canvas from ledshimdemo.effects.cheerlights import CheerLightsEffect class TestCheerLights(TestCase): TEST_CANVAS_SIZE = 3 # t...
[((103, 109), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (107, 109), False, 'from unittest.mock import Mock, patch\n'), ((562, 673), 'unittest.mock.patch', 'patch', (['"""ledshimdemo.effects.cheerlights.CheerLightsEffect.get_colour_from_channel"""'], {'return_value': 'None'}), "(\n 'ledshimdemo.effects.cheerlig...
Jhsmit/ColiCoords-Paper
figures/Figure_7/02_generate_images.py
7b92e67600930f64859d14867113b6de3edf1379
from colicoords.synthetic_data import add_readout_noise, draw_poisson from colicoords import load import numpy as np import mahotas as mh from tqdm import tqdm import os import tifffile def chunk_list(l, sizes): prev = 0 for s in sizes: result = l[prev:prev+s] prev += s yield result ...
[((4100, 4131), 'numpy.arange', 'np.arange', (['(step / 2)', 'xmax', 'step'], {}), '(step / 2, xmax, step)\n', (4109, 4131), True, 'import numpy as np\n'), ((4141, 4172), 'numpy.arange', 'np.arange', (['(step / 2)', 'ymax', 'step'], {}), '(step / 2, ymax, step)\n', (4150, 4172), True, 'import numpy as np\n'), ((4361, 4...
epiphan-video/epiphancloud_api
epiphancloud/models/settings.py
8799591ea4d3a7285976e0038716b23c9ffe7061
class DeviceSettings: def __init__(self, settings): self._id = settings["id"] self._title = settings["title"] self._type = settings["type"]["name"] self._value = settings["value"] @property def id(self): return self._id @property def value(self): ret...
[]
SchmitzAndrew/OSS-101-example
dictionary.py
1efecd4c5bfef4495904568d11e3f8d0a5ed9bd0
word = input("Enter a word: ") if word == "a": print("one; any") elif word == "apple": print("familiar, round fleshy fruit") elif word == "rhinoceros": print("large thick-skinned animal with one or two horns on its nose") else: print("That word must not exist. This dictionary is very comprehensive.")
[]
ilmntr/white_study
solved_bronze/num11720.py
51d69d122b07e9a0922dddb134bff4ec79077eb9
cnt = int(input()) num = list(map(int, input())) sum = 0 for i in range(len(num)): sum = sum + num[i] print(sum)
[]
sdnhub/kube-navi
setup.py
d16a9289ba7261011e6c8d19c48cdc9bd533e629
from distutils.core import setup setup( name = 'kube_navi', packages = ['kube_navi'], # this must be the same as the name above version = '0.1', description = 'Kubernetes resource discovery toolkit', author = 'Srini Seetharaman', author_email = 'srini.seetharaman@gmail.com', url = 'https://github.com/sdnh...
[((33, 418), 'distutils.core.setup', 'setup', ([], {'name': '"""kube_navi"""', 'packages': "['kube_navi']", 'version': '"""0.1"""', 'description': '"""Kubernetes resource discovery toolkit"""', 'author': '"""Srini Seetharaman"""', 'author_email': '"""srini.seetharaman@gmail.com"""', 'url': '"""https://github.com/sdnhub...
MarvinMiao/flink-ai-extended
flink-ai-flow/ai_flow/metric/utils.py
e45eecf2deea6976ba3d7ba821ffb8d9ce0a17f4
# # 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...
[((2570, 2763), 'ai_flow.meta.metric_meta.MetricSummary', 'MetricSummary', ([], {'uuid': 'metric_summary_result.uuid', 'metric_id': 'metric_summary_result.metric_id', 'metric_key': 'metric_summary_result.metric_key', 'metric_value': 'metric_summary_result.metric_value'}), '(uuid=metric_summary_result.uuid, metric_id=\n...
HaujetZhao/Caps_Writer
src/moduels/gui/Tab_Help.py
f2b2038a2c0984a1d356f024cbac421fe594601a
# -*- coding: UTF-8 -*- from PySide2.QtWidgets import QWidget, QPushButton, QVBoxLayout from PySide2.QtCore import Signal from moduels.component.NormalValue import 常量 from moduels.component.SponsorDialog import SponsorDialog import os, webbrowser class Tab_Help(QWidget): 状态栏消息 = Signal(str, int) def __init...
[((298, 314), 'PySide2.QtCore.Signal', 'Signal', (['str', 'int'], {}), '(str, int)\n', (304, 314), False, 'from PySide2.QtCore import Signal\n'), ((1056, 1069), 'PySide2.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (1067, 1069), False, 'from PySide2.QtWidgets import QWidget, QPushButton, QVBoxLayout\n'), ((...
AuFeld/COAG
app/routes/register.py
3874a9c1c6ceb908a6bbabfb49e2c701d8e54f20
from typing import Callable, Optional, Type, cast from fastapi import APIRouter, HTTPException, Request, status from app.models import users from app.common.user import ErrorCode, run_handler from app.users.user import ( CreateUserProtocol, InvalidPasswordException, UserAlreadyExists, ValidatePassword...
[((707, 718), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (716, 718), False, 'from fastapi import APIRouter, HTTPException, Request, status\n'), ((926, 958), 'typing.cast', 'cast', (['users.BaseUserCreate', 'user'], {}), '(users.BaseUserCreate, user)\n', (930, 958), False, 'from typing import Callable, Optional...
xizaoqu/Panoptic-PolarNet
utils/visual.py
8ce05f437f54e030eac7de150f43caab2810cfbb
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import numpy as np def flow_to_img(flow, normalize=True): """Convert flow to viewable image, using color hue to encode flow vector orientation, and color saturation to encode vector length. This is similar to the OpenCV tutorial on dense optical flow, e...
[((764, 823), 'numpy.zeros', 'np.zeros', (['(flow.shape[0], flow.shape[1], 3)'], {'dtype': 'np.uint8'}), '((flow.shape[0], flow.shape[1], 3), dtype=np.uint8)\n', (772, 823), True, 'import numpy as np\n'), ((1011, 1035), 'numpy.isnan', 'np.isnan', (['flow_magnitude'], {}), '(flow_magnitude)\n', (1019, 1035), True, 'impo...
zhkmxx9302013/SoftwarePilot
DistributedRL/Gateway/build/Code/sim/Parser/LAI/GreenIndex.py
826098465b800085774946c20a7a283f369f1d21
import argparse from PIL import Image, ImageStat import math parser = argparse.ArgumentParser() parser.add_argument('fname') parser.add_argument('pref', default="", nargs="?") args = parser.parse_args() im = Image.open(args.fname) RGB = im.convert('RGB') imWidth, imHeight = im.size ratg = 1.2 ratgb = 1.66 ming = 10...
[((71, 96), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (94, 96), False, 'import argparse\n'), ((210, 232), 'PIL.Image.open', 'Image.open', (['args.fname'], {}), '(args.fname)\n', (220, 232), False, 'from PIL import Image, ImageStat\n')]
ped998/scripts
reports/heliosV1/python/heliosStorageStats/heliosStorageStats.py
0dcaaf47f9676210e1c972a5d59d8d0de82a1d93
#!/usr/bin/env python """cluster storage stats for python""" # import pyhesity wrapper module from pyhesity import * from datetime import datetime import codecs # command line arguments import argparse parser = argparse.ArgumentParser() parser.add_argument('-v', '--vip', type=str, default='helios.cohesity.com') # cl...
[((213, 238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (236, 238), False, 'import argparse\n'), ((1194, 1208), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1206, 1208), False, 'from datetime import datetime\n'), ((1336, 1361), 'codecs.open', 'codecs.open', (['outfile', '"""...
zengrx/S.M.A.R.T
src/advanceoperate/malimgthread.py
47a9abe89008e9b34f9b9d057656dbf3fb286456
#coding=utf-8 from PyQt4 import QtCore import os, glob, numpy, sys from PIL import Image from sklearn.cross_validation import StratifiedKFold from sklearn.metrics import confusion_matrix from sklearn.neighbors import KNeighborsClassifier from sklearn.neighbors import BallTree from sklearn import cross_validation from ...
[]
itamarhaber/iredis
tests/unittests/command_parse/test_stream.py
61208aab34c731f88232abd2cacdf0e075e701f2
def test_xrange(judge_command): judge_command( "XRANGE somestream - +", {"command": "XRANGE", "key": "somestream", "stream_id": ["-", "+"]}, ) judge_command( "XRANGE somestream 1526985054069 1526985055069", { "command": "XRANGE", "key": "somestream", ...
[]
ivan2kh/find_forks
tests/test_find_forks/test_find_forks.py
409251282a85da48445afc03c5a1797df393ca95
# coding: utf-8 """test_find_fork.""" # pylint: disable=no-self-use from __future__ import absolute_import, division, print_function, unicode_literals from os import path import unittest from six import PY3 from find_forks.__init__ import CONFIG from find_forks.find_forks import add_forks, determine_names, find_fork...
[((672, 683), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (681, 683), False, 'from mock import patch, MagicMock, Mock\n'), ((713, 745), 'mock.Mock', 'Mock', ([], {'return_value': 'json_response'}), '(return_value=json_response)\n', (717, 745), False, 'from mock import patch, MagicMock, Mock\n'), ((2897, 2914), 'fi...
insequent/neutron
neutron/agent/l3/dvr_router.py
2b1c4f121e3e8ba1c5eb2ba6661bf6326e1507c5
# Copyright (c) 2015 Openstack Foundation # # 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 ...
[((1027, 1054), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1044, 1054), True, 'from oslo_log import log as logging\n'), ((3521, 3558), 'neutron.agent.linux.ip_lib.IPRule', 'ip_lib.IPRule', ([], {'namespace': 'self.ns_name'}), '(namespace=self.ns_name)\n', (3534, 3558), False, 'f...
PCManticore/sider
sider/warnings.py
cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1
""":mod:`sider.warnings` --- Warning categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module defines several custom warning category classes. """ class SiderWarning(Warning): """All warning classes used by Sider extend this base class.""" class PerformanceWarning(SiderWarning, RuntimeWarning): ...
[]
Bucolo/Kadal
kadal/query.py
a0085f15df4f8ebbf5ec4cd4344e207773c6b498
MEDIA_SEARCH = """ query ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) { Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) { id type format title { english romaji native } synonyms status description start...
[]
turkeydonkey/nzmath3
sandbox/test/testChainop.py
a48ae9efcf0d9ad1485c2e9863c948a7f1b20311
import unittest import operator import sandbox.chainop as chainop class BasicChainTest (unittest.TestCase): def testBasicChain(self): double = lambda x: x * 2 self.assertEqual(62, chainop.basic_chain((operator.add, double), 2, 31)) square = lambda x: x ** 2 self.assertEqual(2**31, ...
[((745, 765), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (763, 765), False, 'import unittest\n'), ((982, 1007), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (1005, 1007), False, 'import unittest\n'), ((202, 252), 'sandbox.chainop.basic_chain', 'chainop.basic_chain', (['(ope...
mrmotallebi/berkeley-deeprl-bootcamp
labs_final/lab5/experiments/run_trpo_pendulum.py
9257c693724c38edfa4571e3510667ca168b7ca1
#!/usr/bin/env python import chainer from algs import trpo from env_makers import EnvMaker from models import GaussianMLPPolicy, MLPBaseline from utils import SnapshotSaver import numpy as np import os import logger log_dir = "data/local/trpo-pendulum" np.random.seed(42) # Clean up existing logs os.system("rm -rf {...
[((256, 274), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (270, 274), True, 'import numpy as np\n'), ((346, 369), 'logger.session', 'logger.session', (['log_dir'], {}), '(log_dir)\n', (360, 369), False, 'import logger\n'), ((387, 410), 'env_makers.EnvMaker', 'EnvMaker', (['"""Pendulum-v0"""'], {}),...
yy1244/Jtyoui
jtyoui/regular/regexengine.py
d3c212ed9d6ffa6b37a8ca49098ab59c89216f09
#!/usr/bin/python3.7 # -*- coding: utf-8 -*- # @Time : 2019/12/2 10:17 # @Author: Jtyoui@qq.com """ 正则解析器 """ try: import xml.etree.cElementTree as et except ModuleNotFoundError: import xml.etree.ElementTree as et import re class RegexEngine: def __init__(self, xml, str_): """加载正则表。正则表为xml ...
[((957, 990), 're.findall', 're.findall', (['self.re', 'self._string'], {}), '(self.re, self._string)\n', (967, 990), False, 'import re\n'), ((432, 445), 'xml.etree.ElementTree.parse', 'et.parse', (['xml'], {}), '(xml)\n', (440, 445), True, 'import xml.etree.ElementTree as et\n')]
rflperry/ProgLearn
proglearn/transformers.py
9f799b4a8cf2157ba40b04842dc88eaf646e6420
""" Main Author: Will LeVine Corresponding Email: levinewill@icloud.com """ import keras import numpy as np from sklearn.tree import DecisionTreeClassifier from sklearn.utils.validation import check_array, check_is_fitted, check_X_y from .base import BaseTransformer class NeuralClassificationTransformer(BaseTransfor...
[((2108, 2141), 'keras.models.clone_model', 'keras.models.clone_model', (['network'], {}), '(network)\n', (2132, 2141), False, 'import keras\n'), ((2166, 2274), 'keras.models.Model', 'keras.models.Model', ([], {'inputs': 'self.network.inputs', 'outputs': 'self.network.layers[euclidean_layer_idx].output'}), '(inputs=sel...
marx-alex/Morphelia
morphelia/external/saphire.py
809278b07f1a535789455d54df3cbddc850d609c
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.collections as mcoll from matplotlib.ticker import MaxNLocator plt.style.use('seaborn-darkgrid') class BaseTraj: def __init__(self, model, X): self.model = model assert len(X.shape) == 2, f"X should be 2...
[((158, 191), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-darkgrid"""'], {}), "('seaborn-darkgrid')\n", (171, 191), True, 'import matplotlib.pyplot as plt\n'), ((8351, 8373), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""copper"""'], {}), "('copper')\n", (8363, 8373), True, 'import matplotlib.py...
Stfuncode/food-beverage-investigator
account/views.py
0fea4943a5c2634068dc04118f83742327937c25
import imp from venv import create from django.shortcuts import render, redirect from django.views import View from django.views.generic import ( ListView, ) from account.models import * from account.forms import * from data.models import * from django.contrib.auth import login as auth_login from django.contrib.a...
[((1219, 1257), 'django.shortcuts.render', 'render', (['request', '"""login.html"""', 'context'], {}), "(request, 'login.html', context)\n", (1225, 1257), False, 'from django.shortcuts import render, redirect\n'), ((1284, 1304), 'django.contrib.auth.models.auth.logout', 'auth.logout', (['request'], {}), '(request)\n', ...
mgradowski/aiproject
fpds/client.py
855332bd982bef2530ad935a209ae8be35963165
import cv2 import aiohttp import asyncio import concurrent.futures import argparse import numpy as np async def camera_source(ws: aiohttp.ClientWebSocketResponse, threadpool: concurrent.futures.ThreadPoolExecutor, src_id: int=0): loop = asyncio.get_running_loop() try: src = await loop.run_in_executor(...
[((243, 269), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (267, 269), False, 'import asyncio\n'), ((903, 929), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (927, 929), False, 'import asyncio\n'), ((1484, 1508), 'asyncio.Queue', 'asyncio.Queue', ([], {'maxsize':...
bkrrr/Giveme5W
Giveme5W1H/extractor/tools/key_value_cache.py
657738781fe387d76e6e0da35ed009ccf81f4290
import logging import os import pickle import sys import threading import time from typing import List from Giveme5W1H.extractor.root import path from Giveme5W1H.extractor.tools.util import bytes_2_human_readable class KeyValueCache(object): def __init__(self, cache_path): """ :param cache_path: ...
[((404, 433), 'logging.getLogger', 'logging.getLogger', (['"""GiveMe5W"""'], {}), "('GiveMe5W')\n", (421, 433), False, 'import logging\n'), ((510, 526), 'Giveme5W1H.extractor.root.path', 'path', (['cache_path'], {}), '(cache_path)\n', (514, 526), False, 'from Giveme5W1H.extractor.root import path\n'), ((1080, 1096), 't...
AlexanderJenke/nsst
nsst_translate_corpus.py
75f6afa39568c72c9c513ac0313db33b80bb67d5
from argparse import ArgumentParser from tqdm import tqdm import NSST from nsst_translate import best_transition_sequence if __name__ == '__main__': parser = ArgumentParser() parser.add_argument("--nsst_file", default="output/nsst_tss20_th4_nSt100_Q0.pkl", help="nsst file") parser.add_argument("--src_lan...
[((165, 181), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (179, 181), False, 'from argparse import ArgumentParser\n'), ((685, 696), 'NSST.NSST', 'NSST.NSST', ([], {}), '()\n', (694, 696), False, 'import NSST\n'), ((1633, 1663), 'nsst_translate.best_transition_sequence', 'best_transition_sequence', ([...
dhyanpatel110/HACKERRANK
10 Days of Statistics/Day 1/Standard Deviation.py
949b1ff468ff3487663bf063a8fe6cdfb9dea26b
# Import library import math # Define functionts def mean(data): return sum(data) / len(data) def stddev(data, size): sum = 0 for i in range(size): sum = sum + (data[i] - mean(data)) ** 2 return math.sqrt(sum / size) # Set data size = int(input()) numbers = list(map(int, input().split())) # ...
[((221, 242), 'math.sqrt', 'math.sqrt', (['(sum / size)'], {}), '(sum / size)\n', (230, 242), False, 'import math\n')]
jmsevillam/Herramientas-Computacionales-UniAndes
Homework/Hw4/Solution/problem5a.py
957338873bd6a17201dfd4629c7edd5760e2271d
def decode(word1,word2,code): if len(word1)==1: code+=word1+word2 return code else: code+=word1[0]+word2[0] return decode(word1[1:],word2[1:],code) Alice='Ti rga eoe esg o h ore"ermetsCmuainls' Bob='hspormdcdsamsaefrtecus Hraina optcoae"' print(decode(Alice,Bob,''))
[]
ASUPychron/pychron
pychron/lasers/power/composite_calibration_manager.py
dfe551bdeb4ff8b8ba5cdea0edab336025e8cc76
# =============================================================================== # Copyright 2012 Jake Ross # # 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/licens...
[((1644, 1659), 'traits.api.Instance', 'Instance', (['Graph'], {}), '(Graph)\n', (1652, 1659), False, 'from traits.api import HasTraits, Instance, DelegatesTo, Button, List, Any, Float\n'), ((1917, 1950), 'traits.api.Instance', 'Instance', (['PowerCalibrationAdapter'], {}), '(PowerCalibrationAdapter)\n', (1925, 1950), ...