code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import discord
from discord.ext import commands
import kaztron.utils.datetime as utils_dt
from kaztron.utils.discord import get_member
class NaturalDateConverter(commands.Converter):
"""
Convert natural language date strings to datetime using the dateparser library.
Note: If the string contains spaces, ... | [
"kaztron.utils.datetime.parse_daterange",
"discord.ext.commands.BadArgument",
"kaztron.utils.discord.get_member",
"kaztron.utils.datetime.parse"
] | [((457, 486), 'kaztron.utils.datetime.parse', 'utils_dt.parse', (['self.argument'], {}), '(self.argument)\n', (471, 486), True, 'import kaztron.utils.datetime as utils_dt\n'), ((1572, 1607), 'kaztron.utils.discord.get_member', 'get_member', (['self.ctx', 'self.argument'], {}), '(self.ctx, self.argument)\n', (1582, 1607... |
import os
import collections
directory = '/Users/pga/odoo/bk'
def get_modules():
dirs = {}
for d in os.scandir(directory):
path = d.path
if 'Chapter' in path:
dirs[path] = []
for sub_d in os.scandir(path):
if sub_d.path.split('/')[-1].startswith('r'):
... | [
"os.scandir"
] | [((110, 131), 'os.scandir', 'os.scandir', (['directory'], {}), '(directory)\n', (120, 131), False, 'import os\n'), ((238, 254), 'os.scandir', 'os.scandir', (['path'], {}), '(path)\n', (248, 254), False, 'import os\n')] |
import unittest
from dojo import main
class DojoTest(unittest.TestCase):
def test_zero(self):
primes_list = list(primes(0))
self.assertListEqual(primes_list, [])
def test_one(self):
primes_list = list(primes(3))
self.assertListEqual(primes_list, [2])
def test_two(self):
... | [
"unittest.main"
] | [((447, 462), 'unittest.main', 'unittest.main', ([], {}), '()\n', (460, 462), False, 'import unittest\n')] |
from imports import Resources, request
from __main__ import app, db
#resources-------------------------------------------------------#
@app.route('/resources', methods=['POST'])
def resources_post():
return Resources(db).post(request.json)
@app.route('/resources', methods=['GET'])
def resources_get():
return ... | [
"imports.Resources",
"__main__.app.route"
] | [((137, 178), '__main__.app.route', 'app.route', (['"""/resources"""'], {'methods': "['POST']"}), "('/resources', methods=['POST'])\n", (146, 178), False, 'from __main__ import app, db\n'), ((247, 287), '__main__.app.route', 'app.route', (['"""/resources"""'], {'methods': "['GET']"}), "('/resources', methods=['GET'])\n... |
import uuid
from fastapi import HTTPException
import aiohttp
from gaea.config import CONFIG
async def validate_access_token(access_token):
CERBES_URL = f"{CONFIG.CERBES_API_ENDPOINT}:{CONFIG.CERBES_API_PORT}"
url = f"{CERBES_URL}/check"
if not url.startswith("http"):
url = f"http://{url}"
a... | [
"aiohttp.ClientSession",
"uuid.UUID",
"fastapi.HTTPException"
] | [((813, 839), 'uuid.UUID', 'uuid.UUID', (["data['user_id']"], {}), "(data['user_id'])\n", (822, 839), False, 'import uuid\n'), ((330, 353), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (351, 353), False, 'import aiohttp\n'), ((605, 635), 'fastapi.HTTPException', 'HTTPException', ([], {'status_cod... |
import os
import requests
import pprint
from signalwire.voice_response import VoiceResponse, Say, Gather, Record
from flask import Flask,request
app = Flask(__name__)
# Entry point for incoming calls, prompts to leave a voice mail for processing.
@app.route('/voice_entry', methods=['GET', 'POST'])
def voice_entry():... | [
"requests.post",
"flask.Flask",
"flask.request.values.get",
"signalwire.voice_response.VoiceResponse",
"pprint.pprint"
] | [((153, 168), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'from flask import Flask, request\n'), ((336, 351), 'signalwire.voice_response.VoiceResponse', 'VoiceResponse', ([], {}), '()\n', (349, 351), False, 'from signalwire.voice_response import VoiceResponse, Say, Gather, Record\n'),... |
# Credit - https://github.com/primal100/pybitcointools
# Credit - https://github.com/keis/base58
from binascii import unhexlify
from hashlib import new, sha256
from random import randrange
from typing import Union
HEX_DIGITS = "0123456789abcdef"
ALPHABET = b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"... | [
"hashlib.sha256",
"binascii.unhexlify",
"random.randrange"
] | [((2906, 2929), 'binascii.unhexlify', 'unhexlify', (['(ex + sha[:8])'], {}), '(ex + sha[:8])\n', (2915, 2929), False, 'from binascii import unhexlify\n'), ((4748, 4763), 'hashlib.sha256', 'sha256', (['inpfmtd'], {}), '(inpfmtd)\n', (4754, 4763), False, 'from hashlib import new, sha256\n'), ((2821, 2834), 'binascii.unhe... |
"""
###################
Hammersley 2D-plane
###################
Hammersley points are a series of pseudo random points with a low discrepancy that are suitable for use in solid state NMR simulations where powder averaging is performed.
References
==========
- <NAME>.; <NAME>. (1964). Monte Carlo Methods. doi:10.1007... | [
"numpy.zeros",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1234, 1248), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1242, 1248), True, 'import numpy as np\n'), ((1259, 1273), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1267, 1273), True, 'import numpy as np\n'), ((1284, 1298), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1292, 1298), True,... |
#!/usr/bin/python
"""
Sample Code
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import OVSBridge, OVSSwitch, OVSKernelSwitch
from mininet.node import CPULimitedHost
from mininet.node import RemoteController
from mininet.link import TCLink
from mininet.util import dumpNodeConnecti... | [
"mininet.util.dumpNodeConnections",
"mininet.cli.CLI",
"mininet.log.setLogLevel",
"mininet.net.Mininet",
"mininet.log.info"
] | [((577, 691), 'mininet.net.Mininet', 'Mininet', ([], {'switch': 'OVSSwitch', 'host': 'CPULimitedHost', 'link': 'TCLink', 'autoStaticArp': '(False)', 'controller': 'RemoteController'}), '(switch=OVSSwitch, host=CPULimitedHost, link=TCLink, autoStaticArp=\n False, controller=RemoteController)\n', (584, 691), False, 'f... |
# Copyright (c) 2021 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 appli... | [
"torch.nn.BatchNorm2d",
"torch.nn.functional.pad",
"torch.nn.Sequential",
"mmdet.models.custom_layers.ShapeSpec",
"torch.nn.Conv2d",
"mmdet.models.ops.get_act_fn",
"torch.cat"
] | [((1189, 1326), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'ch_in', 'out_channels': 'ch_out', 'kernel_size': 'filter_size', 'stride': 'stride', 'padding': 'padding', 'groups': 'groups', 'bias': '(False)'}), '(in_channels=ch_in, out_channels=ch_out, kernel_size=filter_size,\n stride=stride, padding=padding,... |
import os
import time
import random
from multiprocessing import Process, Queue
def _monte_carlo_processing(x_nums, fun, cons, bounds, random_times, q: Queue):
"""
monte_carlo 的子进程函数,完成随机试验,向 Queue 传递结果
"""
random.seed(time.time() + os.getpid())
pb = 0
xb = []
for i in range(random_times):
... | [
"multiprocessing.Process",
"os.getpid",
"os.cpu_count",
"multiprocessing.Queue",
"time.time",
"random.randint"
] | [((1884, 1891), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (1889, 1891), False, 'from multiprocessing import Process, Queue\n'), ((1923, 1937), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (1935, 1937), False, 'import os\n'), ((236, 247), 'time.time', 'time.time', ([], {}), '()\n', (245, 247), False, 'imp... |
""""""
import pytest
from tests.PUMS.local_loader import LocalLoader
local_loader_2019 = LocalLoader()
local_loader_2012 = LocalLoader()
EXPECTED_COLS_VALUES_CATEGORICAL = [
(
"SCHL",
[
"N/A (less than 3 years old)",
"No schooling completed",
"Kindergarten",
... | [
"pytest.mark.parametrize",
"tests.PUMS.local_loader.LocalLoader"
] | [((91, 104), 'tests.PUMS.local_loader.LocalLoader', 'LocalLoader', ([], {}), '()\n', (102, 104), False, 'from tests.PUMS.local_loader import LocalLoader\n'), ((125, 138), 'tests.PUMS.local_loader.LocalLoader', 'LocalLoader', ([], {}), '()\n', (136, 138), False, 'from tests.PUMS.local_loader import LocalLoader\n'), ((11... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-06 01:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sponsorsModule', '0002_auto_20180527_2037'),
]
operations = [
... | [
"django.db.models.ForeignKey",
"django.db.migrations.AlterModelOptions",
"django.db.models.AutoField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((888, 1065), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""categorytranslation"""', 'options': "{'verbose_name': 'Category Translation model', 'verbose_name_plural':\n 'Categories Translation models'}"}), "(name='categorytranslation', options={\n 'verbose_name': 'Ca... |
import csv
import requests
from collections import Counter
from pprint import pprint as pp
CSV_URL = 'https://bit.ly/2HiD2i8'
def get_csv():
"""Use requests to download the csv and return the
decoded content"""
resp = requests.get(CSV_URL)
resp.raise_for_status()
return resp.tex... | [
"collections.Counter",
"requests.get"
] | [((249, 270), 'requests.get', 'requests.get', (['CSV_URL'], {}), '(CSV_URL)\n', (261, 270), False, 'import requests\n'), ((525, 534), 'collections.Counter', 'Counter', ([], {}), '()\n', (532, 534), False, 'from collections import Counter\n')] |
"""
Add description to dataset and generate an outline to a datasheet describing the
dataset.
Dependent on:
src/applications/danews/dedupe.py
Authors:
<NAME>
"""
from datasets import load_from_disk
from pathlib import Path
import spacy
def word_count(batch):
nlp = spacy.blank("da")
batch["n_tokens"]... | [
"spacy.blank",
"datasets.load_from_disk",
"pathlib.Path"
] | [((420, 476), 'pathlib.Path', 'Path', (['"""/work/hope-infomedia_cleaned/infomedia_2000-2021"""'], {}), "('/work/hope-infomedia_cleaned/infomedia_2000-2021')\n", (424, 476), False, 'from pathlib import Path\n'), ((484, 504), 'datasets.load_from_disk', 'load_from_disk', (['path'], {}), '(path)\n', (498, 504), False, 'fr... |
import os
import re
re_class = re.compile((
r'class\s+(\w+)(?:\s*<[\w\.,\s]+>)?'
r'(?:\s+implements\s+(?:[\w\.]+)(?:\s*<[\w\.,\s]+>)?)*'
r'(?:\s+extends\s+([\w\.]+)(?:\s*<[\w\.,\s]+>)?)?'
r'(?:\s+implements\s+(?:[\w\.]+)(?:\s*<[\w\.,\s]+>)?)*'
), re.M)
re_comments = re.compile(
r'(//[^\n\r]*?[\... | [
"re.search",
"os.path.isfile",
"os.path.join",
"re.compile"
] | [((32, 276), 're.compile', 're.compile', (['"""class\\\\s+(\\\\w+)(?:\\\\s*<[\\\\w\\\\.,\\\\s]+>)?(?:\\\\s+implements\\\\s+(?:[\\\\w\\\\.]+)(?:\\\\s*<[\\\\w\\\\.,\\\\s]+>)?)*(?:\\\\s+extends\\\\s+([\\\\w\\\\.]+)(?:\\\\s*<[\\\\w\\\\.,\\\\s]+>)?)?(?:\\\\s+implements\\\\s+(?:[\\\\w\\\\.]+)(?:\\\\s*<[\\\\w\\\\.,\\\\s]+>)?)... |
#!/usr/bin/env python
__doc__ = \
'''
'''
__version__ = '0.1'
__authors__ = [
"Version 0.1: <NAME> <<EMAIL>>"
]
import logging
class G2ILogger():
#Class Constructor
def __init__(self, loglevel=logging.INFO):
#Logging formats
self.FORMAT_CLEAN = "%(levelname)7s: %(message)s"
... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler"
] | [((537, 568), 'logging.getLogger', 'logging.getLogger', (['"""NamfLogger"""'], {}), "('NamfLogger')\n", (554, 568), False, 'import logging\n'), ((591, 614), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (612, 614), False, 'import logging\n'), ((674, 710), 'logging.Formatter', 'logging.Formatter', ... |
"""
Unit test driver for the application startup template
Created on Jul. 6, 2020
@author: <NAME>
"""
import sys
import unittest
# Setup the PYTHONPATH for this run
sys.path.insert(0,
'/home/jgossage/GlobalVillage/EclipseWorkspaces/Library')
sys.path.insert(1,
'/home/jgossage/GlobalV... | [
"unittest.main",
"pydev.gv_start_ide.main",
"sys.path.insert"
] | [((169, 245), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/jgossage/GlobalVillage/EclipseWorkspaces/Library"""'], {}), "(0, '/home/jgossage/GlobalVillage/EclipseWorkspaces/Library')\n", (184, 245), False, 'import sys\n'), ((262, 355), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""/home/jgossage/GlobalV... |
"""
Exsiting machine example.
Uses DND_Harry_CentosVM (10.51.152.238)
"""
import json
from calm.dsl.builtins import ref, basic_cred, action
from calm.dsl.builtins import CalmTask, CalmVariable
from calm.dsl.builtins import Service, Package, Substrate
from calm.dsl.builtins import Deployment, Profile, Blueprint
from c... | [
"calm.dsl.builtins.ref",
"calm.dsl.builtins.CalmTask.Exec.escript",
"calm.dsl.builtins.read_local_file",
"json.dumps",
"calm.dsl.builtins.basic_cred",
"calm.dsl.builtins.provider_spec",
"calm.dsl.builtins.CalmTask.Exec.ssh",
"calm.dsl.builtins.CalmTask.Scaling.scale_in",
"calm.dsl.tools.ping",
"ca... | [((393, 427), 'calm.dsl.builtins.read_local_file', 'read_local_file', (['""".tests/username"""'], {}), "('.tests/username')\n", (408, 427), False, 'from calm.dsl.builtins import provider_spec, read_local_file\n'), ((444, 490), 'calm.dsl.builtins.read_local_file', 'read_local_file', (['""".tests/existing_vm_password"""'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 1 20:45:09 2017
@author: sogoyal
"""
from app.tests.TestServerMethods import TestServerMethods
from app.tests.TestGeospatial import TestGeospatial
import unittest
API_KEY = '3d42933f4c284a3b8dd2c5200e97da00'
suite = unittest.TestSuite()
loader = ... | [
"unittest.TestSuite",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((290, 310), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (308, 310), False, 'import unittest\n'), ((320, 341), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (339, 341), False, 'import unittest\n'), ((478, 514), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity':... |
from django.contrib.auth import get_user_model
import graphene
from graphene import relay, ObjectType, AbstractType
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from graphene.types.datetime import DateTime
from conference.event.models import Conference, S... | [
"graphene.String",
"django.contrib.auth.get_user_model",
"graphene.types.datetime.DateTime",
"graphene_django.filter.DjangoFilterConnectionField"
] | [((880, 911), 'graphene.String', 'graphene.String', ([], {'source': '"""image"""'}), "(source='image')\n", (895, 911), False, 'import graphene\n'), ((1066, 1100), 'graphene.String', 'graphene.String', ([], {'source': '"""logo_url"""'}), "(source='logo_url')\n", (1081, 1100), False, 'import graphene\n'), ((1498, 1520), ... |
from bokeh.models import HoverTool
from bokeh.plotting import figure, show
from bokeh.plotting import output_file
# prepare some data
x = [0, 1, 2, 3, 4, 5]
y = [0, 1, 4, 9, 16, 25]
# set output to static HTML file
output_file("quad.html")
# create a new plot with a title and axis labels
p = figure(title="x^2 exampl... | [
"bokeh.plotting.show",
"bokeh.plotting.figure",
"bokeh.plotting.output_file",
"bokeh.models.HoverTool"
] | [((217, 241), 'bokeh.plotting.output_file', 'output_file', (['"""quad.html"""'], {}), "('quad.html')\n", (228, 241), False, 'from bokeh.plotting import output_file\n'), ((296, 391), 'bokeh.plotting.figure', 'figure', ([], {'title': '"""x^2 example"""', 'x_axis_label': '"""x"""', 'y_axis_label': '"""y"""', 'active_scrol... |
import os
class ApiConfig:
api_key = None
api_protocol = 'https://'
base_url = "{}api.appery.io/rest/1/apiexpress/api/".format(api_protocol)
use_retries = True
number_of_retries = 5
retry_backoff_factor = 0.5
max_wait_between_retries = 8
retry_status_codes = [429] + list(range(500, 512)... | [
"os.path.expanduser"
] | [((444, 467), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (462, 467), False, 'import os\n'), ((675, 698), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (693, 698), False, 'import os\n')] |
# Desafio 41 Curso em Video Python
# By Rafabr
import os,time,sys
from estrutura_modelo import cabecalho,rodape
cabecalho(41,"Categorizar atletas de natação")
try:
nasc = float(input('Digite o ano de nascimento do atleta: '))
print()
except ValueError:
print('Voçe digitou um valor indevido!')
time.s... | [
"time.sleep",
"estrutura_modelo.rodape",
"estrutura_modelo.cabecalho",
"sys.exit",
"time.localtime"
] | [((115, 162), 'estrutura_modelo.cabecalho', 'cabecalho', (['(41)', '"""Categorizar atletas de natação"""'], {}), "(41, 'Categorizar atletas de natação')\n", (124, 162), False, 'from estrutura_modelo import cabecalho, rodape\n'), ((804, 812), 'estrutura_modelo.rodape', 'rodape', ([], {}), '()\n', (810, 812), False, 'fro... |
from slash_command.command_center.abstract_command import AbstractSlashCommand
from django.http import HttpResponse
from slash_command.game_and_board.game import TTTGame
from django.http import JsonResponse
from slash_command.game_and_board.board import GameBoard
from slash_command.constants import CancelStatus
cl... | [
"slash_command.game_and_board.board.GameBoard.initFromGame",
"django.http.HttpResponse",
"slash_command.game_and_board.game.TTTGame.cancel"
] | [((565, 614), 'slash_command.game_and_board.game.TTTGame.cancel', 'TTTGame.cancel', (['invokingChannelId', 'invokingUserId'], {}), '(invokingChannelId, invokingUserId)\n', (579, 614), False, 'from slash_command.game_and_board.game import TTTGame\n'), ((668, 785), 'django.http.HttpResponse', 'HttpResponse', (['"""There ... |
import os
import shutil
import json
root_dir = os.pardir
libmem_dir = f"{root_dir}{os.sep}libmem"
project_dir = os.curdir
project_src_dir = f"{project_dir}{os.sep}src/libmem-py"
clean_script = "clean.py"
print(f"[+] Creating '{clean_script}'...")
keep_dirs = []
keep_files = []
for (path, dirs, files) in os.walk(os.... | [
"json.dumps",
"shutil.copy",
"os.walk"
] | [((309, 327), 'os.walk', 'os.walk', (['os.curdir'], {}), '(os.curdir)\n', (316, 327), False, 'import os\n'), ((484, 505), 'json.dumps', 'json.dumps', (['json_dict'], {}), '(json_dict)\n', (494, 505), False, 'import json\n'), ((1067, 1112), 'shutil.copy', 'shutil.copy', (['f"""{src_dir}{os.sep}{f}"""', 'dst_dir'], {}), ... |
import datetime
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord_components import Button
from cogs.core.config.config_botchannel import botchannel_check
from cogs.core.config.config_embedcolour import get_embedcolour
from cogs.core.config.config_prefix import get_pref... | [
"cogs.core.defaults.defaults_embed.get_embed_thumbnail",
"cogs.core.defaults.defaults_embed.get_embed_footer",
"discord.ext.commands.Bot.dispatch",
"discord_components.Button",
"discord.ext.commands.is_owner",
"datetime.datetime.now",
"cogs.core.config.config_embedcolour.get_embedcolour",
"cogs.core.c... | [((549, 600), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""tictactoe"""', 'aliases': "['ttt']"}), "(name='tictactoe', aliases=['ttt'])\n", (565, 600), False, 'from discord.ext import commands\n'), ((606, 625), 'discord.ext.commands.is_owner', 'commands.is_owner', ([], {}), '()\n', (623, 625), F... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.gis.geos import Polygon
from initiatives.models import Zone
import requests
import ogr, osr
class Command(BaseCommand):
help = 'Setup data for development'
def handle(self, *args, **options):
url = 'https://prosto... | [
"initiatives.models.Zone.objects.filter",
"initiatives.models.Zone",
"ogr.Geometry",
"requests.get",
"osr.SpatialReference",
"osr.CoordinateTransformation",
"django.contrib.gis.geos.Polygon"
] | [((1261, 1287), 'ogr.Geometry', 'ogr.Geometry', (['ogr.wkbPoint'], {}), '(ogr.wkbPoint)\n', (1273, 1287), False, 'import ogr, osr\n'), ((1394, 1416), 'osr.SpatialReference', 'osr.SpatialReference', ([], {}), '()\n', (1414, 1416), False, 'import ogr, osr\n'), ((1489, 1511), 'osr.SpatialReference', 'osr.SpatialReference'... |
# -*- coding: UTF-8 -*-
# This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it).
# Copyright (c) 2019-2020 <NAME>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
#... | [
"logging.getLogger",
"multiprocessing.Event",
"os.path.split",
"datetime.datetime.now",
"sys.exc_info",
"threading.Thread",
"socket.error"
] | [((2433, 2460), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2450, 2460), False, 'import logging\n'), ((3205, 3212), 'multiprocessing.Event', 'Event', ([], {}), '()\n', (3210, 3212), False, 'from multiprocessing import Event, AuthenticationError\n'), ((3845, 3896), 'threading.Thread', ... |
import logging
import threading
import subprocess
class SSHForwarder:
def __init__(self, conn, command='/usr/sbin/sshd -i', max_read_size=4096):
# first declare constants
self.max_read = max_read_size
self.command = command
self.end_sequence = list([x.encode() for x in 'END_SEQUENC... | [
"threading.Thread",
"logging.info"
] | [((2214, 2259), 'logging.info', 'logging.info', (['"""launching ssh process/threads"""'], {}), "('launching ssh process/threads')\n", (2226, 2259), False, 'import logging\n'), ((2401, 2461), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.forward_to_serial', 'daemon': '(True)'}), '(target=self.forward_to_... |
from django.db.models import IntegerChoices, TextChoices
from django.utils.translation import gettext_lazy as _
class WinterStorageMethod(TextChoices):
ON_TRESTLES = "on_trestles", _("On trestles")
ON_TRAILER = "on_trailer", _("On a trailer")
UNDER_TARP = "under_tarp", _("Under a tarp")
class Applicatio... | [
"django.utils.translation.gettext_lazy"
] | [((187, 203), 'django.utils.translation.gettext_lazy', '_', (['"""On trestles"""'], {}), "('On trestles')\n", (188, 203), True, 'from django.utils.translation import gettext_lazy as _\n'), ((235, 252), 'django.utils.translation.gettext_lazy', '_', (['"""On a trailer"""'], {}), "('On a trailer')\n", (236, 252), True, 'f... |
import requests
import json
import persistent
def get_new_post():
# Currently temporary 60 day token is active! (activated 11 July 2017)
token = '<KEY>'
response = requests.get('https://graph.facebook.com/v2.9/1008311329300738/feed?access_token=%s' % token)
parsed_data = json.loads(response.content)
... | [
"json.loads",
"persistent.lock.release",
"persistent.save_data",
"requests.get",
"persistent.lock.acquire"
] | [((179, 281), 'requests.get', 'requests.get', (["('https://graph.facebook.com/v2.9/1008311329300738/feed?access_token=%s' %\n token)"], {}), "(\n 'https://graph.facebook.com/v2.9/1008311329300738/feed?access_token=%s' %\n token)\n", (191, 281), False, 'import requests\n'), ((291, 319), 'json.loads', 'json.load... |
# Copyright(c) <NAME> 2009 <EMAIL>
# http://vosolok2008.narod.ru
# BSD license
__version__ = '0.2'
__versionTime__ = '2013-01-22'
__author__ = '<NAME> <<EMAIL>>'
__doc__ = '''
pybass_aac.py - is ctypes python module for
BASS_AAC - extension to the BASS audio library that enables the playback
of Advanced Audio Coding ... | [
"ctypes.POINTER",
"bass.load",
"pybass.BASS_ErrorGetCode",
"pybass.BASS_Init",
"pybass.play_handle",
"pybass.BASS_Free"
] | [((523, 542), 'bass.load', 'bass.load', (['__file__'], {}), '(__file__)\n', (532, 542), False, 'import bass\n'), ((1846, 1876), 'ctypes.POINTER', 'ctypes.POINTER', (['BASS_FILEPROCS'], {}), '(BASS_FILEPROCS)\n', (1860, 1876), False, 'import ctypes\n'), ((2448, 2478), 'ctypes.POINTER', 'ctypes.POINTER', (['BASS_FILEPROC... |
import pytest
from dbt.tests.util import run_dbt
models_get__any_model_sql = """
-- models/any_model.sql
select {{ config.get('made_up_nonexistent_key', 'default_value') }} as col_value
"""
class TestConfigGetDefault:
@pytest.fixture(scope="class")
def models(self):
return {"any_model.sql": models... | [
"pytest.fixture",
"dbt.tests.util.run_dbt"
] | [((229, 258), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (243, 258), False, 'import pytest\n'), ((568, 603), 'dbt.tests.util.run_dbt', 'run_dbt', (["['run']"], {'expect_pass': '(False)'}), "(['run'], expect_pass=False)\n", (575, 603), False, 'from dbt.tests.util import run_... |
# Copyright (c) 2011, <NAME>, <NAME>, TU 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | [
"traceback.format_exc",
"qt_gui.settings_proxy.SettingsProxy",
"qt_gui.plugin_menu.PluginMenu",
"python_qt_binding.QtCore.Slot",
"python_qt_binding.QtCore.qCritical",
"qt_gui.plugin_handler_xembed.PluginHandlerXEmbed",
"qt_gui.plugin_handler_container.PluginHandlerContainer",
"python_qt_binding.QtCore... | [((2312, 2320), 'python_qt_binding.QtCore.Signal', 'Signal', ([], {}), '()\n', (2318, 2320), False, 'from python_qt_binding.QtCore import qCritical, qDebug, QObject, Qt, qWarning, Signal, Slot\n'), ((2350, 2358), 'python_qt_binding.QtCore.Signal', 'Signal', ([], {}), '()\n', (2356, 2358), False, 'from python_qt_binding... |
import json
# Remove partitions from user_account dic, which are not supported
def fit_partition(user_account, partitions_path):
with open(partitions_path) as f:
resources_json = json.load(f)
ret = {}
for system, accounts in user_account.items():
ret[system] = {}
for account, projec... | [
"json.load"
] | [((192, 204), 'json.load', 'json.load', (['f'], {}), '(f)\n', (201, 204), False, 'import json\n')] |
#!/usr/bin/python3
import argparse
import tempfile
import subprocess
import shutil
import os
def call_git(args):
subprocess.run(['git'] + args, check=True)
def copy_files_and_dirs(files_and_dirs, dest_dir):
rel_files_and_dirs = []
for file in files_and_dirs:
rel_path = os.path.relpath(file)
... | [
"tempfile.TemporaryDirectory",
"argparse.ArgumentParser",
"shutil.copy2",
"subprocess.run",
"os.path.join",
"os.chdir",
"shutil.copytree",
"os.path.dirname",
"os.path.isdir",
"os.path.relpath"
] | [((120, 162), 'subprocess.run', 'subprocess.run', (["(['git'] + args)"], {'check': '(True)'}), "(['git'] + args, check=True)\n", (134, 162), False, 'import subprocess\n'), ((697, 838), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Publishes files to the specified branch in a single comm... |
"""
This module is concerned with parsing strings and understanding if they match
some internal (customizable) naming convention.
"""
import re
from openpipe.config import get_config, MalformedConfigError
def get_naming_regexes(name):
regexes_patterns = []
naming_config = get_config("show_naming")
nami... | [
"openpipe.config.MalformedConfigError",
"openpipe.config.get_config",
"re.compile"
] | [((286, 311), 'openpipe.config.get_config', 'get_config', (['"""show_naming"""'], {}), "('show_naming')\n", (296, 311), False, 'from openpipe.config import get_config, MalformedConfigError\n'), ((475, 565), 'openpipe.config.MalformedConfigError', 'MalformedConfigError', (['("Naming entry for \'%s\' didn\'t contain a \'... |
from itertools import combinations
def solution(l):
# get all different combinations in descending order
l.sort(reverse=True)
for x in range(len(l), 0, -1):
for c in combinations(l, x):
# join all digits into a resulting number
largest_number = ''.join([str(x) for x in c]... | [
"itertools.combinations"
] | [((189, 207), 'itertools.combinations', 'combinations', (['l', 'x'], {}), '(l, x)\n', (201, 207), False, 'from itertools import combinations\n')] |
from distutils.core import setup
setup(
name='benefitpoint',
version='0.1',
packages=['benefitpoint'],
url='',
license='',
author='anthonyfox',
author_email='<EMAIL>',
description='A python wrapper for BenefitPoint API'
)
| [
"distutils.core.setup"
] | [((34, 229), 'distutils.core.setup', 'setup', ([], {'name': '"""benefitpoint"""', 'version': '"""0.1"""', 'packages': "['benefitpoint']", 'url': '""""""', 'license': '""""""', 'author': '"""anthonyfox"""', 'author_email': '"""<EMAIL>"""', 'description': '"""A python wrapper for BenefitPoint API"""'}), "(name='benefitpo... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"re.sub"
] | [((4445, 4479), 're.sub', 're.sub', (['"""[^0-9A-Za-z]+"""', '"""_"""', 'name'], {}), "('[^0-9A-Za-z]+', '_', name)\n", (4451, 4479), False, 'import re\n')] |
import pandas as pd
from glob import glob
tsvs = sorted(glob('../../sub*/func/*task-gstroop*.tsv'))
for tsv in tsvs:
df = pd.read_csv(tsv, sep='\t')
df.loc[df['response_hand'] == 1, 'response_hand'] = 'left'
df.loc[df['response_hand'] == 2, 'response_hand'] = 'right'
df.to_csv(tsv, sep='\t', index=Fals... | [
"glob.glob",
"pandas.read_csv"
] | [((57, 99), 'glob.glob', 'glob', (['"""../../sub*/func/*task-gstroop*.tsv"""'], {}), "('../../sub*/func/*task-gstroop*.tsv')\n", (61, 99), False, 'from glob import glob\n'), ((127, 153), 'pandas.read_csv', 'pd.read_csv', (['tsv'], {'sep': '"""\t"""'}), "(tsv, sep='\\t')\n", (138, 153), True, 'import pandas as pd\n')] |
'''
Created on Apr 18, 2021
@author: oluiscabral
'''
import unittest
from helpers.webdriver_factory import WebdriverFactory
from ui.login_ui import LoginUI
from ui.stock_ticker_selector_ui import StockTickerSelectorUI
from actioners.login_control import LoginControl
from actioners.stock_ticker_selector import StockTic... | [
"ui.stock_ticker_selector_ui.StockTickerSelectorUI",
"actioners.stock_ticker_selector.StockTickerSelector",
"helpers.webdriver_factory.WebdriverFactory.create",
"unittest.main",
"ui.login_ui.LoginUI"
] | [((965, 980), 'unittest.main', 'unittest.main', ([], {}), '()\n', (978, 980), False, 'import unittest\n'), ((424, 449), 'helpers.webdriver_factory.WebdriverFactory.create', 'WebdriverFactory.create', ([], {}), '()\n', (447, 449), False, 'from helpers.webdriver_factory import WebdriverFactory\n'), ((559, 582), 'ui.stock... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.template import RequestContext
from django.template.defaultfilters import slugify
from django.conf import settings
from django.utils.translation import ugettext as _
from ionyweb.loaders.manife... | [
"ionyweb.loaders.manifest.themes_info"
] | [((627, 640), 'ionyweb.loaders.manifest.themes_info', 'themes_info', ([], {}), '()\n', (638, 640), False, 'from ionyweb.loaders.manifest import list_themes, themes_info\n')] |
# Generated by Django 3.2.4 on 2021-07-27 07:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0176_auto_20210726_1338'),
]
operations = [
migrations.CreateModel(
name='AdminTransact... | [
"django.db.models.AutoField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((377, 470), '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", (393, 470), False, 'from django.db import migrations, models\... |
from struct import unpack
from math import ceil, floor
def unsigned_int(_bytes, pointer):
return unpack('I', _bytes[pointer:pointer + 4])[0]
def unsigned_char(_bytes, pointer):
return unpack('B', _bytes[pointer:pointer + 1])[0]
def float_(_bytes, pointer):
return unpack('f', _bytes[pointer:pointer + 4])[... | [
"struct.unpack",
"math.ceil",
"math.floor"
] | [((998, 1027), 'math.floor', 'floor', (['(llength / (6 + 1 / 30))'], {}), '(llength / (6 + 1 / 30))\n', (1003, 1027), False, 'from math import ceil, floor\n'), ((102, 142), 'struct.unpack', 'unpack', (['"""I"""', '_bytes[pointer:pointer + 4]'], {}), "('I', _bytes[pointer:pointer + 4])\n", (108, 142), False, 'from struc... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import httpx,json,sys
class API:
def __init__(self, ApiKey, Version):
self._h = 'https://api.cybertkr.com'
self._get = httpx.Client(http2=True, timeout=120)
self.api_key = ApiKey
self.api_version = Version
self.api_versionFloat = "... | [
"json.dumps",
"httpx.Client",
"sys.exit"
] | [((184, 221), 'httpx.Client', 'httpx.Client', ([], {'http2': '(True)', 'timeout': '(120)'}), '(http2=True, timeout=120)\n', (196, 221), False, 'import httpx, json, sys\n'), ((3947, 3974), 'json.dumps', 'json.dumps', (['getJsonPostData'], {}), '(getJsonPostData)\n', (3957, 3974), False, 'import httpx, json, sys\n'), ((7... |
import numpy as np
import random
from shapely.geometry import Point
from shapely.geometry import Polygon
class Mock(object):
"""
mock = Mock(**{'type':'int','low': 20, 'high': 40, 'size': 1})
mock.get()
"""
low = 0
size = 0
high = 0
polygon = None
minx = None
miny = N... | [
"random.uniform",
"numpy.random.randint",
"shapely.geometry.Polygon",
"random.randrange"
] | [((1804, 1867), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.low', 'high': 'self.high', 'size': 'self.size'}), '(low=self.low, high=self.high, size=self.size)\n', (1821, 1867), True, 'import numpy as np\n'), ((1125, 1140), 'shapely.geometry.Polygon', 'Polygon', (['coords'], {}), '(coords)\n', (1132, ... |
import pandas as pd
LOAD_CAPIQ_CAT_A_INDEX_str = ["2014-12-31 00:00:00", "2015-12-31 00:00:00", "2016-12-31 00:00:00", "2017-12-31 00:00:00", "2018-12-31 00:00:00"]
LOAD_CAPIQ_CAT_A_INDEX = [pd.to_datetime(val) for val in LOAD_CAPIQ_CAT_A_INDEX_str]
LOAD_CAPIQ_CAT_A_INDEX_DATA_DICT = dict(
revenue=pd.Series(
... | [
"pandas.Series",
"pandas.to_datetime"
] | [((192, 211), 'pandas.to_datetime', 'pd.to_datetime', (['val'], {}), '(val)\n', (206, 211), True, 'import pandas as pd\n'), ((304, 395), 'pandas.Series', 'pd.Series', (['[55184.0, 47011.0, 38537.0, 45462.0, 54722.0]'], {'index': 'LOAD_CAPIQ_CAT_A_INDEX'}), '([55184.0, 47011.0, 38537.0, 45462.0, 54722.0], index=\n LO... |
# Copyright 2015 Lockheed Martin 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 agr... | [
"hashlib.md5",
"laikaboss.objectmodel.ExternalVars",
"logging.debug",
"laikaboss.util.get_option"
] | [((7786, 7815), 'logging.debug', 'logging.debug', (['"""Hello world!"""'], {}), "('Hello world!')\n", (7799, 7815), False, 'import logging\n'), ((7824, 7912), 'logging.debug', 'logging.debug', (['"""HELLOWORLD invoked with helloworld_param value %i"""', 'helloworld_param'], {}), "('HELLOWORLD invoked with helloworld_pa... |
from typing import List
from inspect import signature as create_inspect_signature
from injecta.dtype.DType import DType
from injecta.service.class_.InspectedArgument import InspectedArgument
from injecta.service.class_.InspectedArgumentResolver import InspectedArgumentResolver
from injecta.module import attribute_loade... | [
"inspect.signature",
"injecta.module.attribute_loader.load",
"injecta.service.class_.InspectedArgumentResolver.InspectedArgumentResolver"
] | [((427, 454), 'injecta.service.class_.InspectedArgumentResolver.InspectedArgumentResolver', 'InspectedArgumentResolver', ([], {}), '()\n', (452, 454), False, 'from injecta.service.class_.InspectedArgumentResolver import InspectedArgumentResolver\n'), ((559, 617), 'injecta.module.attribute_loader.load', 'attribute_loade... |
import torch
from collections import OrderedDict, defaultdict
if __name__ == '__main__':
net = torch.load('/home/dingyangyang/SOLO/work_dirs/solov2_attention_label_align2_assim/stage2_epoch_8_0.399.pth')
state_dict = OrderedDict()
for k, v in net['state_dict'].items():
# print(k, v.shape)
... | [
"torch.load",
"collections.OrderedDict",
"torch.save"
] | [((101, 219), 'torch.load', 'torch.load', (['"""/home/dingyangyang/SOLO/work_dirs/solov2_attention_label_align2_assim/stage2_epoch_8_0.399.pth"""'], {}), "(\n '/home/dingyangyang/SOLO/work_dirs/solov2_attention_label_align2_assim/stage2_epoch_8_0.399.pth'\n )\n", (111, 219), False, 'import torch\n'), ((227, 240),... |
from pysc2.env import sc2_env
from pysc2.lib import actions, features, units
import numpy as np
import torch
from absl import flags
FLAGS = flags.FLAGS
FLAGS([''])
class Env:
metadata = {'render.modes': ['human']}
default_settings = {
'map_name': "FindAndDefeatZerglings",
'players': [sc2_en... | [
"pysc2.lib.features.Dimensions",
"pysc2.lib.actions.RAW_FUNCTIONS.raw_move_camera",
"pysc2.env.sc2_env.SC2Env",
"pysc2.lib.actions.RAW_FUNCTIONS.Attack_pt",
"numpy.array",
"numpy.stack",
"pysc2.lib.actions.RAW_FUNCTIONS.no_op",
"pysc2.env.sc2_env.Agent"
] | [((1584, 1606), 'pysc2.env.sc2_env.SC2Env', 'sc2_env.SC2Env', ([], {}), '(**args)\n', (1598, 1606), False, 'from pysc2.env import sc2_env\n'), ((2919, 2980), 'numpy.array', 'np.array', (['raw_obs.observation.feature_minimap.player_relative'], {}), '(raw_obs.observation.feature_minimap.player_relative)\n', (2927, 2980),... |
#
# File:
# scatter1.py
#
# Synopsis:
# Draws a scatter visualization using polymarkers.
#
# Categories:
# Polymarkers
# Tickmarks
# Text
# XY plots
#
# Author:
# <NAME>
#
# Date of initial publication:
# October, 2004
#
# Description:
# This example reads in some dummy of XY coordina... | [
"Ngl.Resources",
"Ngl.xy",
"Ngl.end",
"Ngl.open_wks",
"os.path.join",
"Ngl.polymarker_ndc",
"Ngl.text_ndc",
"Ngl.pynglpath",
"numpy.zeros",
"Ngl.frame",
"Ngl.polymarker",
"numpy.linalg.lstsq"
] | [((1321, 1342), 'Ngl.pynglpath', 'Ngl.pynglpath', (['"""data"""'], {}), "('data')\n", (1334, 1342), False, 'import Ngl\n'), ((1591, 1625), 'Ngl.open_wks', 'Ngl.open_wks', (['wks_type', '"""scatter1"""'], {}), "(wks_type, 'scatter1')\n", (1603, 1625), False, 'import Ngl\n'), ((1663, 1678), 'Ngl.Resources', 'Ngl.Resource... |
#!/usr/bin/env python
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_openid import OpenID
from config import basedir
app = Flask(__name__)
# 获取配置信息
app.config.setdefault(
'SQLALCHEMY_TRACK_MODIFICATIONS', True
)
app.config.from_object('con... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_login.LoginManager",
"os.path.join",
"flask.Flask"
] | [((200, 215), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'from flask import Flask\n'), ((331, 346), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (341, 346), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((352, 366), 'flask_login.LoginManager', 'LoginM... |
# -*- coding: utf-8 -*-
# @Time : 2021/05/17
# @Author : <NAME>
# @Email : <EMAIL>
r"""
BUIR_ID
################################################
Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR21
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from mo... | [
"torch.nn.init.xavier_normal_",
"torch.nn.functional.normalize",
"torch.nn.init.normal_",
"torch.nn.Linear",
"torch.no_grad",
"torch.nn.Embedding"
] | [((2568, 2583), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2581, 2583), False, 'import torch\n'), ((713, 760), 'torch.nn.Embedding', 'nn.Embedding', (['self.user_count', 'self.latent_size'], {}), '(self.user_count, self.latent_size)\n', (725, 760), True, 'import torch.nn as nn\n'), ((788, 835), 'torch.nn.Embe... |
"""Deprecated module."""
from pyglotaran_extras.deprecation import warn_deprecated
from pyglotaran_extras.plotting.plot_data import plot_data_overview
__all__ = ["plot_data_overview"]
warn_deprecated(
deprecated_qual_name_usage="pyglotaran_extras.plotting.data",
new_qual_name_usage="pyglotaran_extras.plottin... | [
"pyglotaran_extras.deprecation.warn_deprecated"
] | [((187, 387), 'pyglotaran_extras.deprecation.warn_deprecated', 'warn_deprecated', ([], {'deprecated_qual_name_usage': '"""pyglotaran_extras.plotting.data"""', 'new_qual_name_usage': '"""pyglotaran_extras.plotting.plot_data"""', 'to_be_removed_in_version': '"""0.7.0"""', 'stacklevel': '(3)'}), "(deprecated_qual_name_usa... |
import threading
# Notices: 1. The correctness is relied on GIL
# 2. Iterator is not thread-safe, so don't access by different threads in the same time
class _SimplePrefetcherIterator:
def __init__(self, iterable, low_limit: int, high_limit: int):
super(_SimplePrefetcherIterator, self).__init__()
... | [
"threading.Thread",
"threading.Lock"
] | [((684, 733), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.worker', 'daemon': '(True)'}), '(target=self.worker, daemon=True)\n', (700, 733), False, 'import threading\n'), ((504, 520), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (518, 520), False, 'import threading\n'), ((576, 592), 'threading... |
# -*- coding: utf-8 -*-
from __future__ import division
import os
import numpy as np
import torch
from cpprb import PrioritizedReplayBuffer
from utils import torchify
class ReplayMemory():
def __init__(self, args, capacity, env):
# Initial importance sampling weight β, annealed to 1 over course of train... | [
"cpprb.PrioritizedReplayBuffer",
"os.makedirs",
"numpy.squeeze"
] | [((624, 1112), 'cpprb.PrioritizedReplayBuffer', 'PrioritizedReplayBuffer', (['capacity', "{'obs': {'shape': env.observation_space.shape, 'dtype': env.\n observation_space.dtype}, 'next_obs': {'shape': env.observation_space.\n shape, 'dtype': env.observation_space.dtype}, 'act': {'shape': 1,\n 'dtype': env.acti... |
#from my_app import app
from flask import Blueprint
product = Blueprint('product',__name__)
@product.route('/')
@product.route('/home')
def index():
return "Hola mundo"
| [
"flask.Blueprint"
] | [((63, 93), 'flask.Blueprint', 'Blueprint', (['"""product"""', '__name__'], {}), "('product', __name__)\n", (72, 93), False, 'from flask import Blueprint\n')] |
from opendc.models.experiment import Experiment
from opendc.util import exceptions
from opendc.util.rest import Response
def GET(request):
"""Get this Experiment."""
try:
request.check_required_parameters(
path={
'experimentId': 'int'
}
)
except ex... | [
"opendc.models.experiment.Experiment.from_primary_key",
"opendc.util.rest.Response"
] | [((459, 526), 'opendc.models.experiment.Experiment.from_primary_key', 'Experiment.from_primary_key', (["(request.params_path['experimentId'],)"], {}), "((request.params_path['experimentId'],))\n", (486, 526), False, 'from opendc.models.experiment import Experiment\n'), ((1734, 1801), 'opendc.models.experiment.Experimen... |
#!/usr/bin/python3
import os
DMAXIND = 2
DMININD = 3
CLOSEIND = 4
MCAPIND = 6
DUMPIND = 7
for name in os.listdir("../data"):
fin = open("../data/"+name)
mat = [l.strip().split(',') + ["-", "-"] for l in fin.readlines()]
passedrows = 1
passedsome = 0
for i, row in enumerate(mat):
... | [
"os.listdir"
] | [((106, 127), 'os.listdir', 'os.listdir', (['"""../data"""'], {}), "('../data')\n", (116, 127), False, 'import os\n')] |
import math
import logging
from shazzam.py64gen import *
from shazzam.py64gen import RegisterX as x, RegisterY as y, RegisterACC as a
from shazzam.macros.aliases import color, vic
logger = logging.getLogger("shazzam")
# Beam Racer * https://beamracer.net
# Video and Display List coprocessor board for the Commodore 64... | [
"logging.getLogger"
] | [((190, 218), 'logging.getLogger', 'logging.getLogger', (['"""shazzam"""'], {}), "('shazzam')\n", (207, 218), False, 'import logging\n')] |
from flask import current_app as app
class Purchase:
def __init__(self, id, uid, ticker,num_shares, cost, time_purchased):
self.id = id
self.uid = uid
self.ticker = ticker
self.num_shares=num_shares
self.cost=cost
self.time_purchased = time_purchased
@staticmet... | [
"flask.current_app.db.execute"
] | [((357, 520), 'flask.current_app.db.execute', 'app.db.execute', (['"""\n SELECT id, uid, ticker, num_shares, cost, time_purchased\n FROM Purchases\n WHERE uid = :uid\n """'], {'uid': 'uid'}), '(\n """\n SELECT id, uid, ticker, num_shares, cost, time_purchased\n FROM Purchase... |
import math
import matplotlib.pyplot as plt
import numpy as np
from pf import pf_localization
from ekf_1 import ekf_estimation
from leastsq import lsq_estimation
# Simulation parameter
# Q_sim = np.diag([0.2]) ** 2
# R_sim = np.diag([1.0, np.deg2rad(30.0)]) ** 2
Q_sim = np.diag([0.4]) ** 2
R_sim = np.diag([0.8, np... | [
"matplotlib.pyplot.grid",
"numpy.hstack",
"ekf_1.ekf_estimation",
"math.sqrt",
"math.cos",
"numpy.array",
"math.hypot",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.vstack",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.cla",
"numpy.eye",
"numpy.linalg.eig",
"pf.pf_localization",
"m... | [((276, 290), 'numpy.diag', 'np.diag', (['[0.4]'], {}), '([0.4])\n', (283, 290), True, 'import numpy as np\n'), ((746, 762), 'numpy.zeros', 'np.zeros', (['(0, 3)'], {}), '((0, 3))\n', (754, 762), True, 'import numpy as np\n'), ((1379, 1451), 'numpy.array', 'np.array', (['[[1.0, 0, 0, 0], [0, 1.0, 0, 0], [0, 0, 1.0, 0],... |
# <editor-fold desc="Manage Imports">
import tensorflow as tf
import numpy as np
import os
import math
import matplotlib.pyplot as plt
# </editor-fold>
# <editor-fold desc="Get / Prep Data">
#Get/Create Data
numUniqueStages = 4
numDataPoints = 1000
seq_len = 10
numRows, numCols = int(numDataPoints/(seq_len+1)), seq_le... | [
"tensorflow.one_hot",
"tensorflow.unstack",
"tensorflow.contrib.rnn.static_rnn",
"tensorflow.Variable",
"numpy.random.random_integers",
"tensorflow.losses.softmax_cross_entropy",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.contrib.rnn.LSTM... | [((333, 412), 'numpy.random.random_integers', 'np.random.random_integers', ([], {'low': '(1)', 'high': 'numUniqueStages', 'size': '(numRows, numCols)'}), '(low=1, high=numUniqueStages, size=(numRows, numCols))\n', (358, 412), True, 'import numpy as np\n'), ((561, 575), 'numpy.min', 'np.min', (['stages'], {}), '(stages)... |
import abc
import csv
from curses import A_ATTRIBUTES
import typing
import numpy as np
from xbbo.core.trials import Trials
# from xbbo.surrogate.base import Surrogate
from xbbo.surrogate.gaussian_process import GPR_sklearn
from xbbo.surrogate.transfer.tst import BaseModel
from xbbo.utils.constants import VERY_SMALL_NU... | [
"numpy.eye",
"numpy.median",
"numpy.triu_indices",
"numpy.full",
"numpy.delete",
"numpy.asarray",
"numpy.squeeze",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.empty",
"xbbo.surrogate.gaussian_process.GPR_sklearn",
"numpy.argwhere",
"numpy.linalg.norm",
"numpy.ex... | [((5252, 5292), 'numpy.zeros', 'np.zeros', (['array.shape[1]'], {'dtype': 'np.int64'}), '(array.shape[1], dtype=np.int64)\n', (5260, 5292), True, 'import numpy as np\n'), ((5876, 5913), 'numpy.asarray', 'np.asarray', (['trials._his_observe_value'], {}), '(trials._his_observe_value)\n', (5886, 5913), True, 'import numpy... |
import os
import codecs
import numpy as np
#class CoNLL_Sentence:
# def __init__(self, tokens):
# self.tokens = tokens
#class Simplified_CoNLL_Token:
# def __init__(self, token, token_label, sentence_label):
# self.token = token
# self.token_label = token_label
# self.sentence_label ... | [
"numpy.array",
"os.path.join",
"os.walk"
] | [((1184, 1197), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1191, 1197), False, 'import os\n'), ((1947, 1958), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1955, 1958), True, 'import numpy as np\n'), ((1960, 1975), 'numpy.array', 'np.array', (['y_arg'], {}), '(y_arg)\n', (1968, 1975), True, 'import numpy as... |
"""
Visualization of different thresholding functions in opencv
"""
import argparse
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, RadioButtons
import cv2
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--image", required=True)
args = parser.parse_args()
image = cv2.imread(args.i... | [
"matplotlib.pyplot.draw",
"argparse.ArgumentParser",
"cv2.threshold",
"cv2.bitwise_and",
"matplotlib.pyplot.axes",
"cv2.bitwise_or",
"matplotlib.widgets.RadioButtons",
"matplotlib.widgets.Slider",
"cv2.imread",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pypl... | [((189, 214), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (212, 214), False, 'import argparse\n'), ((303, 328), 'cv2.imread', 'cv2.imread', (['args.image', '(0)'], {}), '(args.image, 0)\n', (313, 328), False, 'import cv2\n'), ((650, 664), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}... |
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import os
sns.set_style("whitegrid")
def make_separate_plots(logged_values, plot_path: str, model_name: str):
file_path = os.path.join(plot_path, f'{model_name}_accuracy')
fig, ax = plt.subplots(dpi=300)
plot_titles = list(logged_v... | [
"matplotlib.pyplot.savefig",
"os.path.join",
"seaborn.set_style",
"matplotlib.pyplot.close",
"seaborn.lineplot",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.subplots"
] | [((85, 111), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (98, 111), True, 'import seaborn as sns\n'), ((203, 252), 'os.path.join', 'os.path.join', (['plot_path', 'f"""{model_name}_accuracy"""'], {}), "(plot_path, f'{model_name}_accuracy')\n", (215, 252), False, 'import os\n'), ((... |
import sqlite3
from sqlite3 import Error
import pandas as pd
def create_connection(db_file):
""" create a database connection to a SQLite database """
conn = None
try:
conn = sqlite3.connect(db_file)
c = conn.cursor()
print(sqlite3.version)
c.execute('''CREATE TABLE players... | [
"sqlite3.connect",
"pandas.read_csv"
] | [((197, 221), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (212, 221), False, 'import sqlite3\n'), ((404, 430), 'pandas.read_csv', 'pd.read_csv', (['"""players.csv"""'], {}), "('players.csv')\n", (415, 430), True, 'import pandas as pd\n')] |
import collections
class TreeNode:
def __init__(self, left=None, right=None, val=0) -> None:
self.left = left
self.right = right
self.val = val
class Solution:
# BFS
def maxDepth(root: TreeNode) -> int:
if not root:
return 0
que = collections.deque()
... | [
"collections.deque"
] | [((297, 316), 'collections.deque', 'collections.deque', ([], {}), '()\n', (314, 316), False, 'import collections\n'), ((1226, 1233), 'collections.deque', 'deque', ([], {}), '()\n', (1231, 1233), False, 'from collections import deque\n')] |
# -*- coding: utf-8 -*-
#
# Class and values used to maintain current value estimate
#
import os, json
#Indices
DETAILED_INDEX = 0
BASIC_INDEX = 1
#Stars
T_TTauri = (2895, 1208)
WolfRaynet = (2931, 1221)
Carbon = (2930, 1222)
WhiteDwarf = (34294, 14289)
BlackHole = (60589, 25819)
GiantStar = (3122, 1301)
#Planets
Wat... | [
"json.load",
"os.path.dirname",
"json.dump"
] | [((3359, 3384), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3374, 3384), False, 'import os, json\n'), ((3556, 3581), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3571, 3581), False, 'import os, json\n'), ((4078, 4097), 'json.load', 'json.load', (['hardBank'],... |
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QLabel
from Constants import *
class Bullet(QLabel):
def __init__(self, offset_x, offset_y, parent, enemy=False):
QLabel.__init__(self, parent)
if enemy:
self.setPixmap(QPixmap("images/bullet/enemy_bullet.png"))
else:... | [
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QLabel.__init__"
] | [((189, 218), 'PyQt5.QtWidgets.QLabel.__init__', 'QLabel.__init__', (['self', 'parent'], {}), '(self, parent)\n', (204, 218), False, 'from PyQt5.QtWidgets import QLabel\n'), ((264, 305), 'PyQt5.QtGui.QPixmap', 'QPixmap', (['"""images/bullet/enemy_bullet.png"""'], {}), "('images/bullet/enemy_bullet.png')\n", (271, 305),... |
import tweepy
import os
import requests
import json
# Get values from env variables
CONSUMER_KEY= os.getenv('CONSUMER_KEY')
CONSUMER_SECRET= os.getenv('CONSUMER_SECRET')
ACCESS_KEY= os.getenv('ACCESS_KEY')
ACCESS_SECRET= os.getenv('ACCESS_SECRET')
def twitterAuth():
""" Authenticate user using Twitter API generat... | [
"os.getenv",
"tweepy.Cursor",
"json.dumps",
"requests.get",
"tweepy.API",
"tweepy.OAuthHandler"
] | [((99, 124), 'os.getenv', 'os.getenv', (['"""CONSUMER_KEY"""'], {}), "('CONSUMER_KEY')\n", (108, 124), False, 'import os\n'), ((142, 170), 'os.getenv', 'os.getenv', (['"""CONSUMER_SECRET"""'], {}), "('CONSUMER_SECRET')\n", (151, 170), False, 'import os\n'), ((183, 206), 'os.getenv', 'os.getenv', (['"""ACCESS_KEY"""'], ... |
# -*- coding:utf-8 -*-
# Scanner module: Scan binaries to get useful infos for exploits
import subprocess
import mmap
import re
from ropgenerator.core.Architecture import *
import lief
g_binary_lief = None
g_binary_name = None
g_offset = 0
def init_scanner(filename):
global g_binary_lief
global g_binary_n... | [
"lief.parse"
] | [((416, 436), 'lief.parse', 'lief.parse', (['filename'], {}), '(filename)\n', (426, 436), False, 'import lief\n')] |
import json
import os
_HERE = os.path.dirname(__file__)
with open(os.path.join(_HERE, "info.json")) as infofile:
_INFODICT = json.load(infofile)
VERSION = _INFODICT["VERSION"]
AUTHOR = _INFODICT["AUTHOR"]
COPYRIGHT = _INFODICT["COPYRIGHT"]
CONTACT = _INFODICT["CONTACT"]
HOMEPAGE = _INFODICT["HOMEPAGE"]
CLASSIFIE... | [
"json.load",
"os.path.dirname",
"os.path.join"
] | [((31, 56), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (46, 56), False, 'import os\n'), ((131, 150), 'json.load', 'json.load', (['infofile'], {}), '(infofile)\n', (140, 150), False, 'import json\n'), ((68, 100), 'os.path.join', 'os.path.join', (['_HERE', '"""info.json"""'], {}), "(_HERE, ... |
from django.urls import path, re_path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('login/', views.login, name = 'login'),
path('createprofile/', views.make_profile, name = 'createprofile'),
re_path('profile/(?P<id>\d+)/',views.view_profile,name = 'myprofile'),
path(... | [
"django.urls.re_path",
"django.urls.path"
] | [((80, 113), 'django.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (84, 113), False, 'from django.urls import path, re_path\n'), ((119, 160), 'django.urls.path', 'path', (['"""login/"""', 'views.login'], {'name': '"""login"""'}), "('login/', views.login, name... |
"""Prepares and verifies specific fcs text section parameters to be used in
data extraction.
Required FCS primary TEXT segment keywords:
$BEGINANALYSIS $BEGINDATA $BEGINSTEXT $BYTEORD $DATATYPE $ENDANALYSIS $ENDDATA
$ENDSTEXT $MODE $NEXTDATA $PAR $TOT $PnB $PnE $PnN $PnR
"""
from collections import namedtuple
import... | [
"numpy.dtype",
"collections.namedtuple"
] | [((1736, 1755), 'numpy.dtype', 'np.dtype', (['txt_dtype'], {}), '(txt_dtype)\n', (1744, 1755), True, 'import numpy as np\n'), ((2904, 2933), 'collections.namedtuple', 'namedtuple', (['"""spec"""', 'spec_keys'], {}), "('spec', spec_keys)\n", (2914, 2933), False, 'from collections import namedtuple\n')] |
import tensorflow as tf
from typing import Tuple
# Copyright 2019 Bisonai 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/licens... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.Sequential",
"tensorflow.keras.layers.ReLU",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.AveragePooling2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.backend.squeeze",
"tensorflow.keras.layers.ZeroPadding2D",
"t... | [((14366, 14406), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (14387, 14406), True, 'import tensorflow as tf\n'), ((14460, 14520), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': '[model.input]', 'outputs': '[model.output]'}), '(inputs=[... |
# Copyright 2020 by KFMgang.
# All rights reserved.
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
import os, sys, time
from discord_webhook import DiscordWebhook, DiscordEmbed
import psutil
from threading import Thread
from ti... | [
"discord_webhook.DiscordWebhook",
"discord_webhook.DiscordEmbed",
"psutil.process_iter",
"time.sleep",
"threading.Thread"
] | [((393, 414), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (412, 414), False, 'import psutil\n'), ((817, 825), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (822, 825), False, 'from time import sleep\n'), ((1604, 1612), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (1609, 1612), False, 'from time i... |
"""
Read '/repr key=val, key2=val2' style messages from body and throw
back similar message which includes machine readable idiokit
namespace.
"""
import idiokit
from idiokit.xmpp import jid
from abusehelper.core import bot, events, taskfarm
def _collect_text(element):
yield element.text
for child in elemen... | [
"idiokit.send",
"idiokit.next",
"abusehelper.core.events.events_to_elements",
"abusehelper.core.bot.ServiceBot.__init__",
"abusehelper.core.taskfarm.TaskFarm"
] | [((876, 920), 'abusehelper.core.bot.ServiceBot.__init__', 'bot.ServiceBot.__init__', (['self', '*args'], {}), '(self, *args, **keys)\n', (899, 920), False, 'from abusehelper.core import bot, events, taskfarm\n'), ((942, 977), 'abusehelper.core.taskfarm.TaskFarm', 'taskfarm.TaskFarm', (['self.handle_room'], {}), '(self.... |
#
# Copyright (C) 2021 Stephane "Twidi" Angel <<EMAIL>>
#
# This file is part of StreamDeckFS
# (see https://github.com/twidi/streamdeckfs).
#
# License: MIT, see https://opensource.org/licenses/MIT
#
import json
import re
import shutil
from pathlib import Path
from random import randint
import click
import click_log
... | [
"click.Choice",
"cloup.option",
"re.compile",
"pathlib.Path",
"shutil.copy2",
"cloup.constraints.IsSet",
"json.dumps",
"shutil.copytree",
"cloup.constraints.Equal",
"cloup.constraints.AllSet",
"click.Path",
"shutil.rmtree",
"click.BadParameter",
"random.randint",
"click_log.simple_verbos... | [((35672, 35852), 'cloup.option', 'cloup.option', (['"""-b"""', '"""--brightness"""', '"""level"""'], {'type': 'int', 'required': '(True)', 'help': '"""Brightness level, from 0 (no light) to 100 (brightest)"""', 'callback': 'FC.validate_brightness_level'}), "('-b', '--brightness', 'level', type=int, required=True, help... |
#!/usr/bin/env python3
import unittest
from notify_engine import CommonEvent
class TestEvents(unittest.TestCase):
def eq_message_test(self, ev1, ev2):
self.assertEqual(ev1.message, ev2.message)
self.assertEqual(ev1.event_type(), ev2.event_type())
self.assertEqual(ev1.ttl(), ev2.ttl())
... | [
"unittest.main",
"notify_engine.CommonEvent",
"notify_engine.CommonEvent.deserialize"
] | [((1562, 1577), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1575, 1577), False, 'import unittest\n'), ((472, 485), 'notify_engine.CommonEvent', 'CommonEvent', ([], {}), '()\n', (483, 485), False, 'from notify_engine import CommonEvent\n'), ((732, 756), 'notify_engine.CommonEvent', 'CommonEvent', (['ev0.message... |
# -*- coding: utf-8 -*-
"""
A context provider transforms python data (``kwargs``) into emarsys event data.
"""
from __future__ import unicode_literals
import functools
from django.conf import settings
context_providers = {}
class ContextProviderException(Exception):
pass
def register_context_provider(event... | [
"functools.partial"
] | [((746, 792), 'functools.partial', 'functools.partial', (['func'], {'event_name': 'event_name'}), '(func, event_name=event_name)\n', (763, 792), False, 'import functools\n')] |
'''
Copyright 2020, Amazon Web Services Inc.
This code is licensed under MIT license (see LICENSE.txt for details)
Python 3
Provides a buffer object that holds log lines in Elasticsearch _bulk
format. As each line is added, the buffer stores the control line
as well as the log line.
'''
from es_sink.transport_utils... | [
"es_sink.transport_utils.now_pst"
] | [((3023, 3032), 'es_sink.transport_utils.now_pst', 'now_pst', ([], {}), '()\n', (3030, 3032), False, 'from es_sink.transport_utils import now_pst\n')] |
import serial
import serial.tools.list_ports
import os
import sys
import numpy as np
import time
def print_serial(port):
print("---------------[ %s ]---------------" % port.name)
print("Path: %s" % port.device)
print("Descript: %s" % port.description)
print("HWID: %s" % port.hwid)
if not None == po... | [
"serial.tools.list_ports.comports",
"serial.Serial",
"time.sleep"
] | [((649, 683), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {}), '()\n', (681, 683), False, 'import serial\n'), ((1144, 1202), 'serial.Serial', 'serial.Serial', ([], {'port': 'self.port_name', 'baudrate': 'self.baudrate'}), '(port=self.port_name, baudrate=self.baudrate)\n', (1157, 1202), ... |
import pygame
from thorpy.menus.basicmenu import BasicMenu
from thorpy.miscgui import constants
from thorpy.elements.ghost import Ghost
class TickedMenu(BasicMenu):
"""Post time since last frame"""
def post_time_event(self):
tick_ = self.clock.get_time()
event = pygame.event.Even... | [
"pygame.event.Event",
"pygame.event.post",
"thorpy.elements.ghost.Ghost",
"pygame.event.get"
] | [((303, 382), 'pygame.event.Event', 'pygame.event.Event', (['constants.THORPY_EVENT'], {'id': 'constants.EVENT_TIME', 'tick': 'tick_'}), '(constants.THORPY_EVENT, id=constants.EVENT_TIME, tick=tick_)\n', (321, 382), False, 'import pygame\n'), ((464, 488), 'pygame.event.post', 'pygame.event.post', (['event'], {}), '(eve... |
import queue
import threading
import time
import cv2 as cv
class RecordVideoThread(threading.Thread):
def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, daemon=None):
super(RecordVideoThread, self).__init__(group, target=self._record_frame,
... | [
"cv2.VideoWriter_fourcc",
"threading.Condition",
"time.time",
"queue.Queue"
] | [((410, 431), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (429, 431), False, 'import threading\n'), ((536, 549), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (547, 549), False, 'import queue\n'), ((1237, 1248), 'time.time', 'time.time', ([], {}), '()\n', (1246, 1248), False, 'import time\n'), ((1... |
########################################################################
#
# Copyright (c) 2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
########################################################################
import jsonpatch
import pecan
from pecan import rest
import six
import wsme
from ws... | [
"wsme.types.Enum",
"sysinv.api.controllers.v1.utils.validate_sort_dir",
"pecan.request.dbapi.ptp_parameters_get_list",
"wsme.exc.ClientSideError",
"jsonpatch.JsonPatch",
"sysinv.api.controllers.v1.ptp_parameter.PtpParameterController",
"sysinv.common.utils.synchronized",
"oslo_log.log.getLogger",
"s... | [((814, 837), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (827, 837), False, 'from oslo_log import log\n'), ((1566, 1668), 'wsme.types.Enum', 'wtypes.Enum', (['str', 'constants.PTP_PARAMETER_OWNER_INSTANCE', 'constants.PTP_PARAMETER_OWNER_INTERFACE'], {}), '(str, constants.PTP_PARAMET... |
#!/usr/bin/env python
from os.path import join, abspath, dirname, realpath
def _getBasepath():
return abspath(dirname(dirname(realpath(__file__))))
def init_globals():
return [
'@var _id="sys" basepath="{}" imports="{}"'.format(_getBasepath(), join(_getBasepath(),'import')),
]
if __name__ == '__... | [
"os.path.realpath"
] | [((132, 150), 'os.path.realpath', 'realpath', (['__file__'], {}), '(__file__)\n', (140, 150), False, 'from os.path import join, abspath, dirname, realpath\n')] |
import os
from base64 import b64encode
from typing import Optional
from flask import Flask
from flask_login import LoginManager
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "google-cloud.json"
from models import User
app = Flask(__name__)
CI_SECURITY: bool = True if os.environ.get("ENVIRONMENT") == "prod" else Fa... | [
"flask_login.LoginManager",
"flask.Flask",
"os.urandom",
"os.environ.get",
"models.User.objects.filter_by"
] | [((229, 244), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (234, 244), False, 'from flask import Flask\n'), ((476, 493), 'flask_login.LoginManager', 'LoginManager', (['app'], {}), '(app)\n', (488, 493), False, 'from flask_login import LoginManager\n'), ((351, 379), 'os.environ.get', 'os.environ.get', (['... |
from spewe import Spewe
from spewe.http import Response, JsonResponse, TemplateResponse
testapp = Spewe()
@testapp.route('/none/')
def none(request):
return None
@testapp.route('/index')
def index(request):
user = request.params.get('user', ['world'])
origin = request.params.get('from', ['universe'])
... | [
"spewe.http.JsonResponse",
"spewe.http.Response",
"spewe.http.TemplateResponse",
"spewe.Spewe"
] | [((100, 107), 'spewe.Spewe', 'Spewe', ([], {}), '()\n', (105, 107), False, 'from spewe import Spewe\n'), ((484, 526), 'spewe.http.TemplateResponse', 'TemplateResponse', (["{'none': 'none is none'}"], {}), "({'none': 'none is none'})\n", (500, 526), False, 'from spewe.http import Response, JsonResponse, TemplateResponse... |
import uwsgi
import logging
import clog
import clog.global_state
import clog.handlers
import struct
import six
from uwsgidecorators import mule_msg_dispatcher
HEADER_TAG = b'clog'
ENCODE_FMT = '{}sii'.format(len(HEADER_TAG))
HEADER_SZ = struct.calcsize(ENCODE_FMT)
def _encode_mule_msg(stream, line):
if isinstanc... | [
"struct.calcsize",
"logging.Handler.__init__",
"uwsgidecorators.mule_msg_dispatcher",
"struct.unpack",
"uwsgi.mule_msg"
] | [((238, 265), 'struct.calcsize', 'struct.calcsize', (['ENCODE_FMT'], {}), '(ENCODE_FMT)\n', (253, 265), False, 'import struct\n'), ((596, 638), 'struct.unpack', 'struct.unpack', (['ENCODE_FMT', 'msg[:HEADER_SZ]'], {}), '(ENCODE_FMT, msg[:HEADER_SZ])\n', (609, 638), False, 'import struct\n'), ((1340, 1360), 'uwsgi.mule_... |
import matplotlib.pyplot as plt
import numpy as np
a1 = plt.subplot2grid((3,3),(0,0),colspan = 2)
a2 = plt.subplot2grid((3,3),(0,2), rowspan = 3)
a3 = plt.subplot2grid((3,3),(1,0),rowspan = 2, colspan = 2)
x = np.arange(1,10)
a2.plot(x, x*x)
a2.set_title('square')
a1.plot(x, np.exp(x))
a1.set_title('exp')
a3.plot(x... | [
"numpy.log",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplot2grid",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((58, 101), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(3, 3)', '(0, 0)'], {'colspan': '(2)'}), '((3, 3), (0, 0), colspan=2)\n', (74, 101), True, 'import matplotlib.pyplot as plt\n'), ((105, 148), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(3, 3)', '(0, 2)'], {'rowspan': '(3)'}), '((3, 3), ... |
import tables as PT
# This describes indexes in the "pt_undistorted" tuple. These are
# used in MainBrain.py, flydra_tracker.py, and kalmanize.py
PT_TUPLE_IDX_X = 0
PT_TUPLE_IDX_Y = 1
PT_TUPLE_IDX_AREA = 2
PT_TUPLE_IDX_SLOPE = 3
PT_TUPLE_IDX_ECCENTRICITY = 4
# 3D coordinates of plane formed by camera center and slope... | [
"tables.FloatCol",
"tables.StringCol",
"tables.UInt16Col",
"tables.Float32Col",
"tables.UInt8Col",
"tables.Int64Col"
] | [((742, 761), 'tables.UInt16Col', 'PT.UInt16Col', ([], {'pos': '(0)'}), '(pos=0)\n', (754, 761), True, 'import tables as PT\n'), ((774, 792), 'tables.Int64Col', 'PT.Int64Col', ([], {'pos': '(1)'}), '(pos=1)\n', (785, 792), True, 'import tables as PT\n'), ((809, 827), 'tables.FloatCol', 'PT.FloatCol', ([], {'pos': '(2)'... |
import requests
import json
import time
from datetime import date, timedelta
"""
Classe RegistroCivil: classe para conexão com a API da Transparência do Registro Civil.
Métodos:
=> obitos:
=> parametros:
=> data_inicio (str): data inicial da pesquisa no formato YYYY-MM-DD
... | [
"time.localtime",
"requests.get"
] | [((770, 786), 'time.localtime', 'time.localtime', ([], {}), '()\n', (784, 786), False, 'import time\n'), ((2082, 2144), 'requests.get', 'requests.get', (['(self.url_base + rota + busca)'], {'headers': 'cabecalhos'}), '(self.url_base + rota + busca, headers=cabecalhos)\n', (2094, 2144), False, 'import requests\n')] |
import os
import yaml
from functools import reduce
CONFIG_PATH = os.path.dirname(__file__)
def load_yaml(config_name):
with open(os.path.join(CONFIG_PATH, config_name)+ '.yaml') as file:
config = yaml.safe_load(file)
return config
class DotDict(dict):
def __getattr__(self, k):
... | [
"functools.reduce",
"os.path.dirname",
"os.path.join",
"yaml.safe_load"
] | [((70, 95), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (85, 95), False, 'import os\n'), ((220, 240), 'yaml.safe_load', 'yaml.safe_load', (['file'], {}), '(file)\n', (234, 240), False, 'import yaml\n'), ((668, 704), 'functools.reduce', 'reduce', (['(lambda d, kk: d[kk])', 'k', 'self'], {})... |
#!/usr/bin/env python3
# testOptionz.py
""" Test the basic Optionz classes. """
import time
import unittest
from rnglib import SimpleRNG
from optionz import Optionz as Z
from optionz import (ValType, BoolOption, ChoiceOption,
FloatOption, IntOption, ListOption, StrOption)
class TestOptionz(uni... | [
"optionz.BoolOption",
"optionz.ListOption",
"optionz.ChoiceOption",
"optionz.StrOption",
"optionz.Optionz",
"unittest.main",
"time.time",
"optionz.FloatOption",
"optionz.IntOption"
] | [((6891, 6906), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6904, 6906), False, 'import unittest\n'), ((752, 761), 'optionz.Optionz', 'Z', (['"""fred"""'], {}), "('fred')\n", (753, 761), True, 'from optionz import Optionz as Z\n'), ((962, 997), 'optionz.Optionz', 'Z', (['"""frank"""', '"""frivolous"""', '"""fa... |
#FLM: Simplepolator 7 steps
# Simplepolator v1.1
# Description:
# A simple macro to interpolate compatible glyphs inside FontLab.
# To easily apply the Gunnlaugur SE Briem's method
# http://192.168.3.11/~operinan/2/2.3.3a/2.3.3.02.tests.htm
# Credits:
# <NAME>
# http://www.impallari.com/projects/overview/simplepolat... | [
"robofab.interface.all.dialogs.Message",
"robofab.world.CurrentFont"
] | [((419, 432), 'robofab.world.CurrentFont', 'CurrentFont', ([], {}), '()\n', (430, 432), False, 'from robofab.world import CurrentFont\n'), ((464, 509), 'robofab.interface.all.dialogs.Message', 'Message', (['"""Select 2 glyphs for Simplepolation"""'], {}), "('Select 2 glyphs for Simplepolation')\n", (471, 509), False, '... |