code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import models
class Endereco(models.Model):
linha_1 = models.CharField(max_length=150)
linha_2 = models.CharField(max_length=150, blank=True, null=True)
cidade = models.CharField(max_length=100)
estado = models.CharField(max_length=50)
pais = models.CharField(max_length=70)
latit... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((74, 106), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (90, 106), False, 'from django.db import models\n'), ((121, 176), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)', 'blank': '(True)', 'null': '(True)'}), '(max_length=150, bl... |
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QGraphicsPixmapItem
from client.constants import IMAGES_DIR
from client.models.abstract.info_scene import InfoScene
from client.models.enums.button_state import ButtonState
from client.models.menu_objects.button import Button
from c... | [
"client.models.menu_objects.button.Button",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QGraphicsPixmapItem"
] | [((556, 577), 'PyQt5.QtWidgets.QGraphicsPixmapItem', 'QGraphicsPixmapItem', ([], {}), '()\n', (575, 577), False, 'from PyQt5.QtWidgets import QGraphicsPixmapItem\n'), ((606, 643), 'PyQt5.QtGui.QPixmap', 'QPixmap', (["(IMAGES_DIR + 'menu/logo.png')"], {}), "(IMAGES_DIR + 'menu/logo.png')\n", (613, 643), False, 'from PyQ... |
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO.setup("P8_16",GPIO.IN)
while True:
if GPIO.input("P8_16"):
print("Pin is HIGH")
else:
print("Pin is LOW")
time.sleep(1)
| [
"Adafruit_BBIO.GPIO.input",
"time.sleep",
"Adafruit_BBIO.GPIO.setup"
] | [((47, 75), 'Adafruit_BBIO.GPIO.setup', 'GPIO.setup', (['"""P8_16"""', 'GPIO.IN'], {}), "('P8_16', GPIO.IN)\n", (57, 75), True, 'import Adafruit_BBIO.GPIO as GPIO\n'), ((95, 114), 'Adafruit_BBIO.GPIO.input', 'GPIO.input', (['"""P8_16"""'], {}), "('P8_16')\n", (105, 114), True, 'import Adafruit_BBIO.GPIO as GPIO\n'), ((... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from django.forms.models import model_to_dict
from django.test import Client
from django.urls import reverse
from reprohack_hub.reprohack.models import Review
from reprohack_hub.users.models import User
pytestmark = pytest.mark.django_db
def test_markdown... | [
"django.forms.models.model_to_dict",
"django.urls.reverse"
] | [((855, 876), 'django.forms.models.model_to_dict', 'model_to_dict', (['review'], {}), '(review)\n', (868, 876), False, 'from django.forms.models import model_to_dict\n'), ((412, 433), 'django.urls.reverse', 'reverse', (['"""about_test"""'], {}), "('about_test')\n", (419, 433), False, 'from django.urls import reverse\n'... |
#! /usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pytest
from . import _conf_settings
URL = _conf_settings.URL
USER_AGENT = _conf_settings... | [
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.Firefox",
"selenium.webdriver.FirefoxProfile"
] | [((390, 416), 'selenium.webdriver.FirefoxProfile', 'webdriver.FirefoxProfile', ([], {}), '()\n', (414, 416), False, 'from selenium import webdriver\n'), ((688, 730), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'firefox_profile': 'profile'}), '(firefox_profile=profile)\n', (705, 730), False, 'from selenium ... |
# Copyright 2020 The 9nFL 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 applicable la... | [
"DataJoin.db.db_models.DataBlockMeta",
"DataJoin.utils.base.current_timestamp",
"DataJoin.db.db_models.DataSourceMeta",
"DataJoin.db.db_models.DB.connection_context",
"DataJoin.db.db_models.DataSourceMeta.select",
"DataJoin.db.db_models.DataBlockMeta.select",
"DataJoin.db.db_models.DataSource",
"DataJ... | [((1587, 1610), 'DataJoin.db.db_models.DB.connection_context', 'DB.connection_context', ([], {}), '()\n', (1608, 1610), False, 'from DataJoin.db.db_models import DB, DataBlockMeta, DataSourceMeta, DataSource\n'), ((2986, 3009), 'DataJoin.db.db_models.DB.connection_context', 'DB.connection_context', ([], {}), '()\n', (3... |
import os
import torch
import wandb
from omegaconf import DictConfig, OmegaConf
import pprint
from project_2.src.metrics import calc_all_metrics
from project_2.src.metrics.energy import calculate_energy
from project_2.src.metrics.get_preds import get_mc_preds, get_regular_preds, get_ensemble_preds
from project_2.src.p... | [
"project_2.src.metrics.compare.calc_inner_expert",
"project_2.src.plot_results.plot_predictions_ensemble",
"project_2.src.utils.get_ensemble_models",
"torch.cuda.is_available",
"project_2.src.metrics.energy.calculate_energy",
"project_2.src.utils.download_file",
"torch.mean",
"project_2.src.plot_resul... | [((700, 746), 'project_2.src.utils.download_file', 'download_file', (['cfg.run_id', '"""train_config.yaml"""'], {}), "(cfg.run_id, 'train_config.yaml')\n", (713, 746), False, 'from project_2.src.utils import download_file, get_ensemble_models\n'), ((763, 798), 'omegaconf.OmegaConf.load', 'OmegaConf.load', (['"""train_c... |
# -*- coding: utf-8 -*-
"""Generating a cosmological summary of the H0 or D_dt H0_samples
Example
-------
To run this script, pass in the version ID and the sampling method as the argument::
$ python summarize.py 21 simple_mc_default
The summary will be saved to the same directory level as the sample directo... | [
"pandas.read_csv",
"h0rton.h0_inference.h0_utils.get_normal_stats_naive",
"numpy.isfinite",
"numpy.arange",
"numpy.mean",
"os.listdir",
"h0rton.h0_inference.h0_utils.get_normal_stats",
"argparse.ArgumentParser",
"h0rton.tdlmc_utils.convert_to_dataframe",
"numpy.exp",
"h0rton.h0_inference.h0_util... | [((656, 681), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (679, 681), False, 'import argparse\n'), ((1413, 1448), 'h0rton.configs.TestConfig.from_file', 'TestConfig.from_file', (['test_cfg_path'], {}), '(test_cfg_path)\n', (1433, 1448), False, 'from h0rton.configs import TestConfig\n'), ((22... |
from flask import url_for
from app.catalog.domain.product import Product
from app.cart.domain.cart import Cart
from app.order.domain.order import Order
from app.order.domain.order_state import OrderState
from app.tests import utils
def test_place(db_session, client, loginned_user):
# Given
product = Produc... | [
"flask.url_for",
"app.cart.domain.cart.Cart",
"app.catalog.domain.product.Product"
] | [((314, 368), 'app.catalog.domain.product.Product', 'Product', ([], {'name': '"""라즈베리파이3 모델B"""', 'price': '(56000)', 'detail': '"""모델B"""'}), "(name='라즈베리파이3 모델B', price=56000, detail='모델B')\n", (321, 368), False, 'from app.catalog.domain.product import Product\n'), ((417, 470), 'app.cart.domain.cart.Cart', 'Cart', ([... |
import unittest
import pylidator
from pylidator.exceptions import ContextNotAvailableError
from functools import wraps
def child_generator(obj):
for row in obj.children:
yield row
class TestObj(object):
def __init__(self, returns):
self.it_happened = False
self.returns = returns
... | [
"pylidator.validator",
"pylidator.validate"
] | [((348, 382), 'pylidator.validator', 'pylidator.validator', ([], {'of': '"""base_obj"""'}), "(of='base_obj')\n", (367, 382), False, 'import pylidator\n'), ((462, 497), 'pylidator.validator', 'pylidator.validator', ([], {'of': '"""child_obj"""'}), "(of='child_obj')\n", (481, 497), False, 'import pylidator\n'), ((594, 65... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. 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.apa... | [
"file_op.get_api_statistic",
"util_global.set_value",
"os.path.getsize",
"pandas.DataFrame",
"file_op.abs_join",
"util.log_warning",
"os.path.join",
"conver_by_ast.conver_ast",
"file_op.mkdir",
"file_op.adjust_index",
"file_op.write_report_terminator",
"util_global.get_value",
"util.check_pa... | [((1316, 1347), 'util_global.get_value', 'util_global.get_value', (['"""output"""'], {}), "('output')\n", (1337, 1347), False, 'import util_global\n'), ((1566, 1597), 'util_global.get_value', 'util_global.get_value', (['"""report"""'], {}), "('report')\n", (1587, 1597), False, 'import util_global\n'), ((1602, 1619), 'f... |
#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
... | [
"os.getuid",
"os.fsencode",
"os.strerror",
"binascii.unhexlify",
"os.listdir",
"pathlib.Path",
"os.chmod",
"os.path.isdir",
"os.unlink",
"os.mkdir",
"os.rename",
"os.path.dirname",
"os.lstat",
"toml.dump",
"typing.cast",
"datetime.datetime.fromtimestamp",
"os.getenv",
"os.makedirs"... | [((45478, 45504), 'os.path.isdir', 'os.path.isdir', (['mount_point'], {}), '(mount_point)\n', (45491, 45504), False, 'import os\n'), ((45538, 45566), 'os.path.dirname', 'os.path.dirname', (['mount_point'], {}), '(mount_point)\n', (45553, 45566), False, 'import os\n'), ((45574, 45599), 'os.path.isdir', 'os.path.isdir', ... |
import unittest
import numpy as np
from qubo_nn.problems import KnapsackIntegerWeights
class TestKnapsackIntegerWeights(unittest.TestCase):
def test_gen_qubo_matrix(self):
"""Test whether a correct QUBO is generated.
Test case from: My brain.
"""
w = np.array([2, 5, 3])
c ... | [
"numpy.random.get_state",
"numpy.random.set_state",
"qubo_nn.problems.KnapsackIntegerWeights",
"numpy.array",
"qubo_nn.problems.KnapsackIntegerWeights.gen_problems",
"numpy.random.seed"
] | [((290, 309), 'numpy.array', 'np.array', (['[2, 5, 3]'], {}), '([2, 5, 3])\n', (298, 309), True, 'import numpy as np\n'), ((322, 341), 'numpy.array', 'np.array', (['[5, 2, 4]'], {}), '([5, 2, 4])\n', (330, 341), True, 'import numpy as np\n'), ((375, 433), 'qubo_nn.problems.KnapsackIntegerWeights', 'KnapsackIntegerWeigh... |
import pickle
from collections import Counter
from itertools import chain
import numpy as np
from data.dataimport import import_data
from data.featuredict import FeatureDictionary
from encoders.baseencoder import AbstractEncoder
class TfidfEncoder(AbstractEncoder):
def decoder_loss(self, data: tuple, representa... | [
"data.dataimport.import_data",
"itertools.chain",
"pickle.dump"
] | [((922, 945), 'data.dataimport.import_data', 'import_data', (['train_file'], {}), '(train_file)\n', (933, 945), False, 'from data.dataimport import import_data\n'), ((1202, 1229), 'itertools.chain', 'chain', (['*all_document_tokens'], {}), '(*all_document_tokens)\n', (1207, 1229), False, 'from itertools import chain\n'... |
#!/usr/bin/env python2
from __future__ import print_function
import sys
import random
from osrmcpy import OSRM, Coordinate
# Example User Code
def main():
if '--help' in sys.argv or '-h' in sys.argv:
sys.exit('Usage: {} [OSRM data base path]'.format(sys.argv[0]))
osrm = OSRM(sys.argv[1] if len(sys... | [
"random.uniform",
"osrmcpy.Coordinate"
] | [((356, 406), 'osrmcpy.Coordinate', 'Coordinate', ([], {'longitude': '(7.419758)', 'latitude': '(43.731142)'}), '(longitude=7.419758, latitude=43.731142)\n', (366, 406), False, 'from osrmcpy import OSRM, Coordinate\n'), ((417, 467), 'osrmcpy.Coordinate', 'Coordinate', ([], {'longitude': '(7.419505)', 'latitude': '(43.7... |
import torch
import torch.nn as nn
import superp
import prob
############################################
# set default data type to double
############################################
torch.set_default_dtype(torch.float64)
torch.set_default_tensor_type(torch.DoubleTensor)
# torch.set_default_dtype(torch.float32)
# to... | [
"prob.vector_field",
"torch.index_select",
"torch.max",
"torch.relu",
"torch.set_default_tensor_type",
"torch.set_default_dtype",
"torch.tensor",
"torch.norm",
"torch.sum",
"torch.no_grad"
] | [((186, 224), 'torch.set_default_dtype', 'torch.set_default_dtype', (['torch.float64'], {}), '(torch.float64)\n', (209, 224), False, 'import torch\n'), ((225, 274), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['torch.DoubleTensor'], {}), '(torch.DoubleTensor)\n', (254, 274), False, 'import torch\... |
import streamlit as st
from sagas.ofbiz.entities import OfEntity as e, \
create_data_frame, create_relation_data_frame, \
entity, record_list_df, finder
DEFAULT_ENT = "Shipment"
def entity_meta(ent_name):
# meta_df=e('meta').Shipment
meta_df=create_data_frame(ent_name)
return meta_df
st.sidebar.t... | [
"streamlit.sidebar.title",
"sagas.ofbiz.entities.create_data_frame",
"sagas.ofbiz.entities.create_relation_data_frame",
"sagas.ofbiz.entities.record_list_df",
"streamlit.button",
"streamlit.sidebar.slider",
"streamlit.dataframe",
"sagas.ofbiz.entities.finder.find_list",
"streamlit.text_input"
] | [((308, 348), 'streamlit.sidebar.title', 'st.sidebar.title', (['"""Interactive entities"""'], {}), "('Interactive entities')\n", (324, 348), True, 'import streamlit as st\n'), ((365, 420), 'streamlit.sidebar.slider', 'st.sidebar.slider', (['"""Entity list data?"""', '(0)', '(100)', '[0, 20]'], {}), "('Entity list data?... |
from urllib.parse import urljoin
import requests
class PortainerService:
def get_stack(
self, endpoint: str, stack_name: str, username: str, password: str
) -> str:
token = self.__login(endpoint, username, password)
stack_id = self.__get_stack_id(endpoint, stack_name, token)
st... | [
"urllib.parse.urljoin"
] | [((537, 567), 'urllib.parse.urljoin', 'urljoin', (['endpoint', '"""/api/auth"""'], {}), "(endpoint, '/api/auth')\n", (544, 567), False, 'from urllib.parse import urljoin\n'), ((1033, 1065), 'urllib.parse.urljoin', 'urljoin', (['endpoint', '"""/api/stacks"""'], {}), "(endpoint, '/api/stacks')\n", (1040, 1065), False, 'f... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apac... | [
"azure._parse_service_resources_response"
] | [((2090, 2143), 'azure._parse_service_resources_response', '_parse_service_resources_response', (['response', 'Database'], {}), '(response, Database)\n', (2123, 2143), False, 'from azure import MANAGEMENT_HOST, _parse_service_resources_response\n')] |
import click
import yaml
import re
from kubernetes import client
from os import path
from utils import hiss, util
from settings import settings
def setup_admin(org):
# Get domain
domain = util.get_domain(org)
# Get orderer information
orderer_names = settings.ORDERER_ORGS.split(' ')
orderer_domai... | [
"settings.settings.k8s.exec_pod",
"click.group",
"settings.settings.REMOTE_ORDERER_NAME.split",
"utils.util.get_k8s_template_path",
"settings.settings.ORDERER_DOMAINS.split",
"utils.hiss.echo",
"settings.settings.PEER_ORGS.split",
"utils.hiss.sub_echo",
"settings.settings.k8s.prereqs",
"utils.hiss... | [((2759, 2772), 'click.group', 'click.group', ([], {}), '()\n', (2770, 2772), False, 'import click\n'), ((198, 218), 'utils.util.get_domain', 'util.get_domain', (['org'], {}), '(org)\n', (213, 218), False, 'from utils import hiss, util\n'), ((270, 302), 'settings.settings.ORDERER_ORGS.split', 'settings.ORDERER_ORGS.spl... |
# 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 applic... | [
"paddle2onnx.op_mapper.OpMapper",
"paddle2onnx.utils.logging.info"
] | [((806, 830), 'paddle2onnx.op_mapper.OpMapper', 'op_mapper', (['"""im2sequence"""'], {}), "('im2sequence')\n", (815, 830), True, 'from paddle2onnx.op_mapper import OpMapper as op_mapper\n'), ((2934, 2988), 'paddle2onnx.utils.logging.info', 'logging.info', (['"""==========Importance Notice==========="""'], {}), "('=====... |
#!/usr/bin/python
################################################################################
# "THE BEER-WARE LICENSE" (Revision 42): #
# <lennartATlacerta.be> wrote this file. As long as you retain this notice you #
# can do whatever you want with this stuff. If we meet som... | [
"smtplib.SMTP",
"sqlite3.connect",
"argparse.ArgumentParser",
"email.Utils.COMMASPACE.join",
"email.mime.multipart.MIMEMultipart",
"Gnuplot.Data",
"Gnuplot.Gnuplot",
"time.time",
"email.mime.text.MIMEText"
] | [((2160, 2177), 'Gnuplot.Gnuplot', 'Gnuplot.Gnuplot', ([], {}), '()\n', (2175, 2177), False, 'import Gnuplot\n'), ((2626, 2644), 'Gnuplot.Data', 'Gnuplot.Data', (['swap'], {}), '(swap)\n', (2638, 2644), False, 'import Gnuplot\n'), ((2693, 2712), 'Gnuplot.Data', 'Gnuplot.Data', (['cache'], {}), '(cache)\n', (2705, 2712)... |
import json
import os
import re
from typing import List
import numpy as np
import pandas as pd
from common import camel_case_to_snake_case, load_institutions, isnumber
def convert_initial_to_row(data: dict, rank: int, document_specific=False) -> List:
row = [rank, data["name"], data["country"]]
if document_... | [
"pandas.Series",
"os.listdir",
"common.load_institutions",
"re.compile",
"pandas.read_csv",
"os.rename",
"os.path.join",
"common.camel_case_to_snake_case",
"json.load",
"pandas.to_numeric",
"pandas.DataFrame",
"pandas.concat"
] | [((3239, 3264), 're.compile', 're.compile', (['"""\\\\d{1,3}_.*"""'], {}), "('\\\\d{1,3}_.*')\n", (3249, 3264), False, 'import re\n'), ((3278, 3307), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'headers'}), '(columns=headers)\n', (3290, 3307), True, 'import pandas as pd\n'), ((4583, 4608), 're.compile', 're.co... |
"""
Plugin for Pillow library.
"""
from copy import deepcopy
from typing import Any
from PIL import Image, ImageFile
from ._options import options
from .constants import HeifErrorCode
from .error import HeifError
from .heif import HeifImage, from_pillow, is_supported, open_heif
from .misc import getxmp, set_orientat... | [
"PIL.Image.register_save",
"PIL.Image.register_save_all",
"copy.deepcopy",
"PIL.Image.register_extensions",
"PIL.Image.register_mime",
"PIL.Image.register_open"
] | [((4324, 4394), 'PIL.Image.register_open', 'Image.register_open', (['HeifImageFile.format', 'HeifImageFile', 'is_supported'], {}), '(HeifImageFile.format, HeifImageFile, is_supported)\n', (4343, 4394), False, 'from PIL import Image, ImageFile\n'), ((4399, 4447), 'PIL.Image.register_save', 'Image.register_save', (['Heif... |
# Generated by Django 2.2.4 on 2019-12-16 11:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('froide_payment', '0009_auto_20191017_1446'),
]
operations = [
migrations.AddField(
model_name='payment',
name='recei... | [
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((351, 425), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'blank': '(True)', 'decimal_places': '(2)', 'max_digits': '(9)', 'null': '(True)'}), '(blank=True, decimal_places=2, max_digits=9, null=True)\n', (370, 425), False, 'from django.db import migrations, models\n'), ((548, 843), 'django.db.models.C... |
# Copyright 2017 <NAME>
#
# 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, softwa... | [
"paramodai.term.Term.get"
] | [((2117, 2150), 'paramodai.term.Term.get', 'Term.get', (["('stk_%x' % stack_offset)"], {}), "('stk_%x' % stack_offset)\n", (2125, 2150), False, 'from paramodai.term import Term\n')] |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import random
import numpy as np
import torch
from torch import nn
from typing import Dict
def mem2str(num_bytes):
assert num_bytes >= 0
if num_bytes >= 2 ** 30: # GB
val = float(num_bytes) / (2 ** 30)
result = "%.3f GB"... | [
"torch.manual_seed",
"torch.load",
"psutil.virtual_memory",
"random.seed",
"torch.nn.init.orthogonal_",
"numpy.random.seed",
"torch.cuda.manual_seed",
"torch.FloatTensor"
] | [((909, 932), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n', (930, 932), False, 'import psutil\n'), ((2846, 2868), 'random.seed', 'random.seed', (['rand_seed'], {}), '(rand_seed)\n', (2857, 2868), False, 'import random\n'), ((2873, 2902), 'numpy.random.seed', 'np.random.seed', (['(rand_seed + 1)'],... |
# Copyright 2018 DeepMind Technologies Limited. 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 ... | [
"optax.adam",
"acme.testing.fakes.ContinuousEnvironment",
"jax.random.PRNGKey",
"absl.testing.absltest.main",
"absl.testing.parameterized.named_parameters",
"acme.agents.jax.crr.make_networks",
"acme.specs.make_environment_spec",
"acme.testing.fakes.transition_iterator"
] | [((877, 1061), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('exp', crr.policy_loss_coeff_advantage_exp)", "('indicator', crr.policy_loss_coeff_advantage_indicator)", "('all', crr.policy_loss_coeff_constant)"], {}), "(('exp', crr.policy_loss_coeff_advantage_exp),\n ('indicator'... |
"""
unit tests for GridSearch class
"""
import tigerforecast
from tigerforecast.utils.autotuning import GridSearch
from tigerforecast.utils.optimizers import *
import jax.numpy as np
import matplotlib.pyplot as plt
import itertools
def test_grid_search(show=False):
test_grid_search_arma(show=show)
test_grid_... | [
"jax.numpy.abs",
"tigerforecast.utils.autotuning.GridSearch",
"itertools.product",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"jax.numpy.sum",
"tigerforecast.problem",
"matplotlib.pyplot.pause",
"tigerforecast.method",
"matplotlib.pyplot.show"
] | [((935, 974), 'itertools.product', 'itertools.product', (['opts', 'learning_rates'], {}), '(opts, learning_rates)\n', (952, 974), False, 'import itertools\n'), ((1112, 1124), 'tigerforecast.utils.autotuning.GridSearch', 'GridSearch', ([], {}), '()\n', (1122, 1124), False, 'from tigerforecast.utils.autotuning import Gri... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from common.constants import STATUS_PENDING
from common.functions import instance_get_thumbnail, common_clean
def organization_render_reference(organization, display_edit_link=False, field_name=''):
html = '<span... | [
"django.core.urlresolvers.reverse",
"django.utils.translation.ugettext_lazy",
"common.functions.common_clean",
"common.functions.instance_get_thumbnail"
] | [((1097, 1115), 'common.functions.common_clean', 'common_clean', (['html'], {}), '(html)\n', (1109, 1115), False, 'from common.functions import instance_get_thumbnail, common_clean\n'), ((1700, 1718), 'common.functions.common_clean', 'common_clean', (['html'], {}), '(html)\n', (1712, 1718), False, 'from common.function... |
from django.utils import timezone
from datetime import timedelta
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import GenericAPIView
from ..permissions import IsAuthenticated
from ..models import Duo
from ..app_settings import NewDuoSerializer, ActivateDuoS... | [
"django.utils.timezone.now",
"rest_framework.response.Response",
"datetime.timedelta"
] | [((1227, 1278), 'rest_framework.response.Response', 'Response', (["{'duos': duos}"], {'status': 'status.HTTP_200_OK'}), "({'duos': duos}, status=status.HTTP_200_OK)\n", (1235, 1278), False, 'from rest_framework.response import Response\n'), ((3609, 3729), 'rest_framework.response.Response', 'Response', (["{'id': new_du... |
from .models import *
# Create your views here.
from django.shortcuts import render,redirect
from .models import *
def home(request):
return render(request,'task/home.html')
def loginpage(request):
return render(request,'task/login.html')
| [
"django.shortcuts.render"
] | [((152, 185), 'django.shortcuts.render', 'render', (['request', '"""task/home.html"""'], {}), "(request, 'task/home.html')\n", (158, 185), False, 'from django.shortcuts import render, redirect\n'), ((224, 258), 'django.shortcuts.render', 'render', (['request', '"""task/login.html"""'], {}), "(request, 'task/login.html'... |
# coding: utf8
import os
import sys
path=str(os.getcwd())+"\Env"
if os.path.exists(path):
os.system(r'start.bat')
else:
filecont='"'+sys.exec_prefix+"\python.exe"+'"'+" -m venv %CD%\Env && %CD%\Env\Scripts"+"\\"+"activate.bat"
filecont+=" && python -m pip install --upgrade pip && pip install c... | [
"os.path.exists",
"os.system",
"os.getcwd"
] | [((70, 90), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (84, 90), False, 'import os\n'), ((100, 122), 'os.system', 'os.system', (['"""start.bat"""'], {}), "('start.bat')\n", (109, 122), False, 'import os\n'), ((468, 492), 'os.system', 'os.system', (['"""prepare.bat"""'], {}), "('prepare.bat')\n", (4... |
import numpy as np
import torch.nn as nn
from torch.nn.modules.loss import _Loss
from torch.optim.optimizer import Optimizer
import torch.optim as optim
class ProgressBar(object):
def __init__(self,
max_iter: int = 1,
verbose: int = 1,
bar_nums: int = 20,
... | [
"torch.nn.CrossEntropyLoss",
"torch.nn.L1Loss",
"torch.nn.KLDivLoss",
"torch.nn.PoissonNLLLoss",
"numpy.array",
"torch.nn.NLLLoss2d",
"torch.nn.MSELoss",
"torch.nn.NLLLoss",
"torch.nn.BCELoss",
"torch.nn.CTCLoss",
"torch.nn.SmoothL1Loss"
] | [((2249, 2265), 'numpy.array', 'np.array', (['arrays'], {}), '(arrays)\n', (2257, 2265), True, 'import numpy as np\n'), ((3148, 3159), 'torch.nn.L1Loss', 'nn.L1Loss', ([], {}), '()\n', (3157, 3159), True, 'import torch.nn as nn\n'), ((3225, 3237), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n', (3235, 3237), True, ... |
from event_model import DocumentRouter
import matplotlib.pyplot as plt
import numpy
class Grid(DocumentRouter):
"""
Draw a matplotlib AxesImage Arist update it for each Event.
The purposes of this callback is to create (on initialization) of a
matplotlib grid image and then update it with new data fo... | [
"numpy.full",
"matplotlib.pyplot.subplots"
] | [((1631, 1664), 'numpy.full', 'numpy.full', (['self.shape', 'numpy.nan'], {}), '(self.shape, numpy.nan)\n', (1641, 1664), False, 'import numpy\n'), ((1570, 1584), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1582, 1584), True, 'import matplotlib.pyplot as plt\n')] |
from initialstate.initialstate_connector import InitialStateConnector
from snap_to_cloud import SNAPToCloudExample
if __name__ == "__main__":
cloud_connector = InitialStateConnector()
SNAPToCloudExample(cloud_connector.publish) | [
"snap_to_cloud.SNAPToCloudExample",
"initialstate.initialstate_connector.InitialStateConnector"
] | [((165, 188), 'initialstate.initialstate_connector.InitialStateConnector', 'InitialStateConnector', ([], {}), '()\n', (186, 188), False, 'from initialstate.initialstate_connector import InitialStateConnector\n'), ((193, 236), 'snap_to_cloud.SNAPToCloudExample', 'SNAPToCloudExample', (['cloud_connector.publish'], {}), '... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 15 15:26:19 2018
@authors: <NAME> (verseve) & <NAME> (haag)
"""
# required modules
import rasterio
from rasterio.mask import mask
from shapely.geometry import box
from shapely.geometry import Point
from shapely.geometry import Polygon
from shapely.geometry import MultiPo... | [
"configparser.ConfigParser",
"pandas.read_csv",
"numpy.log",
"shapely.geometry.box",
"numpy.column_stack",
"shapely.geometry.Polygon",
"geopandas.overlay",
"sys.exit",
"numpy.sin",
"merit.merit_model_data.upscale_merit_basin",
"pandas.read_excel",
"numpy.arange",
"setup_logging.getStats",
... | [((1818, 1897), 'scipy.ndimage.distance_transform_edt', 'nd.distance_transform_edt', (['invalid'], {'return_distances': '(False)', 'return_indices': '(True)'}), '(invalid, return_distances=False, return_indices=True)\n', (1843, 1897), True, 'from scipy import ndimage as nd\n'), ((2578, 2602), 'numpy.radians', 'np.radia... |
from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import BulkOpTask
class BulkOperationsApi(BaseApi):
def bulk_add_agent(self, group_id, bulk_add_agent, scanner_id=1):
"""Creates a bulk operation task to add agents to a group.
:param group_id: The agent group ID.
... | [
"tenable_io.api.models.BulkOpTask.from_json"
] | [((988, 1023), 'tenable_io.api.models.BulkOpTask.from_json', 'BulkOpTask.from_json', (['response.text'], {}), '(response.text)\n', (1008, 1023), False, 'from tenable_io.api.models import BulkOpTask\n'), ((1900, 1935), 'tenable_io.api.models.BulkOpTask.from_json', 'BulkOpTask.from_json', (['response.text'], {}), '(respo... |
from hypergan.samplers.base_sampler import BaseSampler
import numpy as np
import tensorflow as tf
class GridSampler(BaseSampler):
def __init__(self, gan, samples_per_row=8):
BaseSampler.__init__(self, gan, samples_per_row)
self.x = gan.session.run(gan.inputs.x)
batch = self.x.shape[0]
... | [
"numpy.tile",
"numpy.reshape",
"numpy.hstack",
"hypergan.samplers.base_sampler.BaseSampler.__init__",
"numpy.linspace",
"numpy.concatenate",
"numpy.expand_dims"
] | [((188, 236), 'hypergan.samplers.base_sampler.BaseSampler.__init__', 'BaseSampler.__init__', (['self', 'gan', 'samples_per_row'], {}), '(self, gan, samples_per_row)\n', (208, 236), False, 'from hypergan.samplers.base_sampler import BaseSampler\n'), ((333, 410), 'numpy.reshape', 'np.reshape', (['self.x[0]', '[1, self.x.... |
import os
# from sklearn.metrics import log_loss, roc_auc_score
import time
from librerank.utils import *
from librerank.reranker import *
from librerank.rl_reranker import *
def eval(model, data, l2_reg, batch_size, isrank, metric_scope, _print=False):
preds = []
# labels = []
losses = []
data_size... | [
"os.path.join",
"time.time",
"os.path.isfile"
] | [((426, 437), 'time.time', 'time.time', ([], {}), '()\n', (435, 437), False, 'import time\n'), ((14733, 14773), 'os.path.join', 'os.path.join', (['processed_dir', '"""data.stat"""'], {}), "(processed_dir, 'data.stat')\n", (14745, 14773), False, 'import os\n'), ((15786, 15845), 'os.path.join', 'os.path.join', (['process... |
import os
import pymongo
import time
import random
client = pymongo.MongoClient(os.environ['CHANGE_STREAM_DB'])
while True:
print(client.changestream.collection.insert_one({"temperature": random.random() * 100}).inserted_id)
time.sleep(0.050)
| [
"pymongo.MongoClient",
"random.random",
"time.sleep"
] | [((61, 112), 'pymongo.MongoClient', 'pymongo.MongoClient', (["os.environ['CHANGE_STREAM_DB']"], {}), "(os.environ['CHANGE_STREAM_DB'])\n", (80, 112), False, 'import pymongo\n'), ((234, 250), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (244, 250), False, 'import time\n'), ((193, 208), 'random.random', 'ran... |
import argparse
import typing
def generate_argument_parser(parser: argparse.ArgumentParser = None):
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument('--log_level', help='Set logging level', default='WARNING',
type=str.upper,
choi... | [
"argparse.ArgumentParser"
] | [((142, 167), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (165, 167), False, 'import argparse\n')] |
def create_switchyard(input_file, file_code):
from rsbeams.rsdata.switchyard import Switchyard
switchyard = Switchyard()
switchyard.read(input_file, file_code)
return switchyard | [
"rsbeams.rsdata.switchyard.Switchyard"
] | [((118, 130), 'rsbeams.rsdata.switchyard.Switchyard', 'Switchyard', ([], {}), '()\n', (128, 130), False, 'from rsbeams.rsdata.switchyard import Switchyard\n')] |
# -*- coding: utf-8 -*-
"""
src.api.live_updates
~~~~~~~~~~~~~~~~~~~~
Classes:
LiveUpdates
Fuctions:
new_update()
delete_all_updates()
delete_update(id: int)
"""
from flask import Blueprint, request
from werkzeug.exceptions import BadRequest, NotFound
from src.common... | [
"src.models.live_update.LiveUpdate.drop_collection",
"flask_socketio.emit",
"src.models.live_update.LiveUpdate.objects",
"flask.request.get_json",
"werkzeug.exceptions.BadRequest",
"src.common.decorators.privileges",
"src.models.live_update.LiveUpdate.objects.exclude",
"flask.Blueprint",
"werkzeug.e... | [((513, 548), 'flask.Blueprint', 'Blueprint', (['"""live_updates"""', '__name__'], {}), "('live_updates', __name__)\n", (522, 548), False, 'from flask import Blueprint, request\n'), ((631, 666), 'src.common.decorators.privileges', 'privileges', (['(ROLES.MOD | ROLES.ADMIN)'], {}), '(ROLES.MOD | ROLES.ADMIN)\n', (641, 6... |
from decimal import Decimal
from rest_framework import serializers
from goods.models import SKU
from django.utils import timezone
from django_redis import get_redis_connection
from django.db import transaction
class CartSKUSerializer(serializers.ModelSerializer):
"""
购物车商品数据序列化器
"""
count = serialize... | [
"django_redis.get_redis_connection",
"rest_framework.serializers.IntegerField",
"goods.models.SKU.objects.filter",
"django.db.transaction.atomic",
"rest_framework.serializers.ValidationError",
"rest_framework.serializers.DecimalField",
"django.utils.timezone.now",
"django.db.transaction.savepoint",
... | [((311, 347), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {'label': '"""数量"""'}), "(label='数量')\n", (335, 347), False, 'from rest_framework import serializers\n'), ((524, 593), 'rest_framework.serializers.DecimalField', 'serializers.DecimalField', ([], {'label': '"""运费"""', 'decimal_plac... |
import numpy
from chainer import functions
from chainer import testing
@testing.parameterize(*testing.product_dict(
[
{'shape': (), 'pad_width': 1, 'mode': 'constant'},
{'shape': (2, 3), 'pad_width': 0, 'mode': 'constant'},
{'shape': (2, 3), 'pad_width': 1, 'mode': 'constant'},
{'... | [
"chainer.functions.pad",
"chainer.testing.run_module",
"chainer.testing.product_dict",
"chainer.testing.product",
"chainer.testing.with_requires",
"numpy.random.uniform",
"numpy.pad"
] | [((2712, 2750), 'chainer.testing.with_requires', 'testing.with_requires', (['"""numpy>=1.11.1"""'], {}), "('numpy>=1.11.1')\n", (2733, 2750), False, 'from chainer import testing\n'), ((3521, 3559), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (3539, 3559)... |
# Test that the app can start
import re
from flask import url_for
from nose.tools import *
import config
class TestAppStart:
def setUp(self):
config.TESTING = True
config.SERVER_NAME = 'localhost'
from app import create_app
self.app = create_app()
self.app_context = self.ap... | [
"re.compile",
"app.create_app",
"flask.url_for"
] | [((273, 285), 'app.create_app', 'create_app', ([], {}), '()\n', (283, 285), False, 'from app import create_app\n'), ((643, 664), 'flask.url_for', 'url_for', (['"""main.index"""'], {}), "('main.index')\n", (650, 664), False, 'from flask import url_for\n'), ((686, 723), 're.compile', 're.compile', (['"""Hello,\\\\s+Stran... |
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.text import slugify
from . import base
class Reference(base.Model):
author = models.CharField(max_length=255)
year = models.Posit... | [
"django.utils.html.escape",
"django.utils.safestring.mark_safe",
"django.urls.reverse",
"django.db.models.URLField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((264, 296), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (280, 296), False, 'from django.db import models\n'), ((308, 342), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {}), '()\n', (340, 342), False, 'from django.db i... |
from google.cloud import vision, storage
import tempfile
import os
vision_client = vision.ImageAnnotatorClient()
storage_client = storage.Client()
def file_detection(data, context):
"""Triggered by a change to a Cloud Storage bucket.
Args:
event (dict): Event payload.
context (google.cloud.f... | [
"google.cloud.storage.Client",
"google.cloud.vision.ImageSource",
"google.cloud.vision.ImageAnnotatorClient",
"tempfile.mkstemp",
"os.remove"
] | [((84, 113), 'google.cloud.vision.ImageAnnotatorClient', 'vision.ImageAnnotatorClient', ([], {}), '()\n', (111, 113), False, 'from google.cloud import vision, storage\n'), ((131, 147), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (145, 147), False, 'from google.cloud import vision, storage\n'), ((... |
import pandas as pd
# change this
def filter_func(x):
return x['credit'] >= 5
data = pd.read_csv('output/courses.csv')
df = data[data.apply(filter_func, axis=1)]
#data.iloc[0,:].to_csv('output/query.csv', header=False, index=False)
df.to_csv('output/query.csv', index=False) | [
"pandas.read_csv"
] | [((91, 124), 'pandas.read_csv', 'pd.read_csv', (['"""output/courses.csv"""'], {}), "('output/courses.csv')\n", (102, 124), True, 'import pandas as pd\n')] |
import pytest
import pandas as pd
from iguanas.rule_selection._base_filter import _BaseFilter
from iguanas.rules import Rules
@pytest.fixture
def _create_data():
X_rules = pd.DataFrame({
'A': [1, 0, 1],
'B': [1, 1, 1]
})
return X_rules
def test_transform(_create_data):
X_rules = _cre... | [
"pandas.DataFrame",
"pandas.testing.assert_frame_equal",
"iguanas.rules.Rules",
"iguanas.rule_selection._base_filter._BaseFilter"
] | [((178, 224), 'pandas.DataFrame', 'pd.DataFrame', (["{'A': [1, 0, 1], 'B': [1, 1, 1]}"], {}), "({'A': [1, 0, 1], 'B': [1, 1, 1]})\n", (190, 224), True, 'import pandas as pd\n'), ((338, 382), 'iguanas.rule_selection._base_filter._BaseFilter', '_BaseFilter', ([], {'rules_to_keep': "['A']", 'rules': 'None'}), "(rules_to_k... |
# dj/main/urls.py
from django.conf.urls import url
# from django.views.generic import list_detail
from .views import *
# client_list={"queryset": Client.objects.all(), }
# "template_object_name": "client_list" }
urlpatterns = [
url(r'^$', main, name='main'),
url(r'start/$', start_here, name='start_here'... | [
"django.conf.urls.url"
] | [((240, 268), 'django.conf.urls.url', 'url', (['"""^$"""', 'main'], {'name': '"""main"""'}), "('^$', main, name='main')\n", (243, 268), False, 'from django.conf.urls import url\n'), ((275, 320), 'django.conf.urls.url', 'url', (['"""start/$"""', 'start_here'], {'name': '"""start_here"""'}), "('start/$', start_here, name... |
from torch import nn
from ..registry import ENCODERS
from ..utils import RecurrentLayer
import torch.nn.functional as F
@ENCODERS.register_module
class RecurrentEncoder(nn.Module):
def __init__(
self,
vocab_size,
pad_token_id=None,
hidden_size=128,
embedding_size=None,
... | [
"torch.nn.Dropout",
"torch.nn.Embedding"
] | [((788, 857), 'torch.nn.Embedding', 'nn.Embedding', ([], {'num_embeddings': 'vocab_size', 'embedding_dim': 'embedding_size'}), '(num_embeddings=vocab_size, embedding_dim=embedding_size)\n', (800, 857), False, 'from torch import nn\n'), ((1110, 1131), 'torch.nn.Dropout', 'nn.Dropout', ([], {'p': 'dropout'}), '(p=dropout... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: Nov 20, 2019
# @Last Modified by: <NAME>
# @Last Modified time: Apr 26, 2020
# Python 2/3 compatibility
from __future__ import print_function, absolute_import, division
import os
import sys
import argparse
import cv2
import numpy as np
from... | [
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"rosbag.Bag",
"utils.make_image_message",
"std_msgs.msg.Header",
"sys.exit",
"sys.stdout.flush",
"cv2.imread",
"sys.stdout.write"
] | [((3554, 3617), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Add images to a ROS bag."""'}), "(description='Add images to a ROS bag.')\n", (3577, 3617), False, 'import argparse\n'), ((3939, 3965), 'os.listdir', 'os.listdir', (['args.image_dir'], {}), '(args.image_dir)\n', (3949, 3965),... |
import param
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# from gym_film.utils.convert_reward import to_single_reward
# from matplotlib.patches import Patch
# Uses the following methods/attributes from env:
# - O, R (observation and reward)
# - jets_power
# - system_state
# - reward, ... | [
"matplotlib.rcParams.update",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.plot",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((322, 367), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 15}"], {}), "({'font.size': 15})\n", (348, 367), False, 'import matplotlib\n'), ((5786, 5845), 'matplotlib.pyplot.plot', 'plt.plot', (['[]', '[]'], {'label': '"""observation domain"""', 'color': '"""green"""'}), "([], [], label='... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = [
"transformer",
"message",
"SimpleDataDialog",
"DataEntry",
"execdir",
]
import gui
import message
import misc
transformer = gui.transformer
SimpleDataDialog = gui.SimpleDataDialog
DataEntry = gui.DataEntry
execdir... | [
"misc.getstarterdir"
] | [((323, 343), 'misc.getstarterdir', 'misc.getstarterdir', ([], {}), '()\n', (341, 343), False, 'import misc\n')] |
# Learn about functions
from random import randint
from objects.mario import Mario
from objects.goomba import Goomba
from objects.bowser import Bowser
# Remember functions? We have so many print statements now, we're going to have the user press enter for each print!
def user_print(string):
input(string)
mario =... | [
"objects.goomba.Goomba",
"objects.mario.Mario",
"random.randint",
"objects.bowser.Bowser"
] | [((321, 331), 'objects.mario.Mario', 'Mario', (['(100)'], {}), '(100)\n', (326, 331), False, 'from objects.mario import Mario\n'), ((341, 355), 'random.randint', 'randint', (['(0)', '(50)'], {}), '(0, 50)\n', (348, 355), False, 'from random import randint\n'), ((364, 378), 'random.randint', 'randint', (['(0)', '(75)'],... |
import os
from celery import Celery
from operator_api.util import cyan, red
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'operator_api.settings')
operator_celery = Celery('operator_api')
operator_celery.config_from_object('django.conf:settings', namespace='CELERY')
operator_celery.autodiscover_tasks()
IS_DEV_POA ... | [
"os.environ.setdefault",
"celery.Celery",
"os.environ.get"
] | [((77, 149), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""operator_api.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'operator_api.settings')\n", (98, 149), False, 'import os\n'), ((169, 191), 'celery.Celery', 'Celery', (['"""operator_api"""'], {}), "('operator_api')\n", (17... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import beanmachine.ppl as bm
import torch.distributions as dist
from torch import Tensor
class BetaBinomialModel(object):
"""This Bean... | [
"torch.distributions.Beta"
] | [((1030, 1064), 'torch.distributions.Beta', 'dist.Beta', (['self.alpha_', 'self.beta_'], {}), '(self.alpha_, self.beta_)\n', (1039, 1064), True, 'import torch.distributions as dist\n')] |
import numpy as np
import matplotlib.pyplot as plt
from time import time
from numba import cuda
N = 640000
def main():
x = np.linspace(0, 1, N, endpoint=True)
from serial import sArray
start = time()
f = sArray(x)
elapsed = time() - start
print("--- Serial timing: %s seconds ---" % elapsed)
from parallel impo... | [
"numpy.linspace",
"parallel.sArray",
"time.time"
] | [((126, 161), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'N'], {'endpoint': '(True)'}), '(0, 1, N, endpoint=True)\n', (137, 161), True, 'import numpy as np\n'), ((198, 204), 'time.time', 'time', ([], {}), '()\n', (202, 204), False, 'from time import time\n'), ((210, 219), 'parallel.sArray', 'sArray', (['x'], {}),... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql
class QuanshuspiderPipeline:
def process_item(self, item, spider):
return item
class mysqlPipel... | [
"pymysql.connect"
] | [((407, 554), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""localhost"""', 'user': '"""root"""', 'passwd': '"""<PASSWORD>"""', 'db': '"""novelsite"""', 'charset': '"""utf8mb4"""', 'cursorclass': 'pymysql.cursors.DictCursor'}), "(host='localhost', user='root', passwd='<PASSWORD>', db=\n 'novelsite', charset... |
import json
import jinja2
TEMPLATE = "cluster.yml.j2"
CONFIG = "config.json"
if __name__ == "__main__":
# Load configuration
with open(CONFIG) as cfg:
config = json.loads(cfg.read())
user = config["vm"]["user"]
# Create nodes to be used by template
names = []
for i in range(config["v... | [
"jinja2.FileSystemLoader",
"jinja2.Environment"
] | [((1915, 1955), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', ([], {'searchpath': '"""./"""'}), "(searchpath='./')\n", (1938, 1955), False, 'import jinja2\n'), ((1966, 2039), 'jinja2.Environment', 'jinja2.Environment', ([], {'loader': 'fsloader', 'trim_blocks': '(True)', 'lstrip_blocks': '(True)'}), '(loader=fs... |
from table import Table
from evaluator import Evaluator
from card import Card
class Game:
def __init__(self, table):
self.table = table
def has_min_players(self):
'''
Assumes that set_preflop_action_order has already been called
'''
if len(self.table.action_order)... | [
"evaluator.Evaluator",
"card.Card.print_pretty_cards"
] | [((999, 1040), 'card.Card.print_pretty_cards', 'Card.print_pretty_cards', (['self.table.board'], {}), '(self.table.board)\n', (1022, 1040), False, 'from card import Card\n'), ((1131, 1172), 'card.Card.print_pretty_cards', 'Card.print_pretty_cards', (['self.table.board'], {}), '(self.table.board)\n', (1154, 1172), False... |
#!/usr/bin/env python3
# Copyright (c) 2019 <NAME> (@hotenov). Available under the MIT License.
"""
Python 3.5+ script for parsing the all FREE episodes
of Luke's ENGLISH Podcast, available on its archive webpage
https://teacherluke.co.uk/archive-of-episodes-1-149/
Prerequisite:
Installing of packa... | [
"collections.OrderedDict",
"collections.namedtuple",
"requests.Session",
"re.compile",
"requests.Response",
"platform.platform",
"json.dumps",
"bs4.BeautifulSoup",
"sys.exit",
"re.sub",
"re.findall",
"time.time",
"json.dump",
"re.search"
] | [((1423, 1434), 'time.time', 'time.time', ([], {}), '()\n', (1432, 1434), False, 'import time\n'), ((2104, 2141), 'collections.namedtuple', 'namedtuple', (['"""MainKeys"""', 'keys_for_json'], {}), "('MainKeys', keys_for_json)\n", (2114, 2141), False, 'from collections import namedtuple, OrderedDict\n'), ((2951, 2993), ... |
# Generated by Django 2.2.24 on 2021-07-02 13:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('user_importer', '0001_initial'),
('users', '0029_userhistory'),
]
operations = [
migrations.AddFie... | [
"django.db.models.ForeignKey"
] | [((419, 534), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""user_importer.UserUploadRecord"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n to='user_importer.UserUploadRecord')\n", (436, 534), False, 'from d... |
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base
from config import create_new_sqla
from helpers import (get_video_douban_ids,
get_celebrity_douban_ids,
get_animation_bilibili_ids)
test_database_url = 'sqlite://... | [
"helpers.get_celebrity_douban_ids",
"config.create_new_sqla",
"helpers.get_video_douban_ids",
"pytest.fixture",
"models.Base.metadata.drop_all",
"helpers.get_animation_bilibili_ids",
"models.Base.metadata.create_all"
] | [((333, 364), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (347, 364), False, 'import pytest\n'), ((398, 444), 'config.create_new_sqla', 'create_new_sqla', (['test_database_url'], {'echo': '(False)'}), '(test_database_url, echo=False)\n', (413, 444), False, 'from config i... |
import random
from ...ProjectEssentials import (AutoExecutor, Signal,)
class Weather:
def __init__ (self, externalweathersensor, timespeed=None):
if (type(externalweathersensor).__name__ != 'ExternalWeather'):
raise TypeError("externalweathersensor requires 'ExternalWeather'")
if (type(t... | [
"random.choice"
] | [((7963, 8049), 'random.choice', 'random.choice', (['[False, False, False, False, False, False, True, True, True, True]'], {}), '([False, False, False, False, False, False, True, True, True, \n True])\n', (7976, 8049), False, 'import random\n'), ((9755, 9834), 'random.choice', 'random.choice', (['[False, False, Fals... |
from typing import Any, List, NamedTuple, Set, Union
import warnings
from .util import UUID
def citation_key_constructor(loader, node) -> str:
"""
A constructor for !cite yaml tags, returning a bibtex key as a str.
All we need for now is a key string we can match in citations.bib,
so _we're not parsi... | [
"warnings.warn"
] | [((3057, 3190), 'warnings.warn', 'warnings.warn', (["(f'Artifact {uuid} was created prior to provenance tracking. ' +\n 'Provenance data will be incomplete.')", 'UserWarning'], {}), "(f'Artifact {uuid} was created prior to provenance tracking. ' +\n 'Provenance data will be incomplete.', UserWarning)\n", (3070, 3... |
import mock
from jukeboxcore import errors
from jukeboxmaya.menu import MenuManager
@mock.patch('jukeboxmaya.menu.cmds.setParent')
@mock.patch('jukeboxmaya.menu.cmds.menu')
@mock.patch('jukeboxmaya.menu.cmds.menuItem')
@mock.patch('jukeboxmaya.menu.cmds.deleteUI')
def test_menu_manager(new_delete, new_menuitem, new_... | [
"mock.call",
"mock.patch",
"jukeboxmaya.menu.MenuManager.get"
] | [((88, 133), 'mock.patch', 'mock.patch', (['"""jukeboxmaya.menu.cmds.setParent"""'], {}), "('jukeboxmaya.menu.cmds.setParent')\n", (98, 133), False, 'import mock\n'), ((135, 175), 'mock.patch', 'mock.patch', (['"""jukeboxmaya.menu.cmds.menu"""'], {}), "('jukeboxmaya.menu.cmds.menu')\n", (145, 175), False, 'import mock\... |
__copyright__ = """
Copyright 2020 Cisco Systems, Inc.
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... | [
"traceback.format_exc",
"os.path.join",
"time.sleep"
] | [((8596, 8631), 'os.path.join', 'os.path.join', (['keypath', 'key_filename'], {}), '(keypath, key_filename)\n', (8608, 8631), False, 'import os\n'), ((1824, 1859), 'os.path.join', 'os.path.join', (['keypath', 'key_filename'], {}), '(keypath, key_filename)\n', (1836, 1859), False, 'import os\n'), ((3665, 3685), 'time.sl... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
# Local imports
from jetmontecarlo.tests.simple_tests.test_simpleSampler import *
from jetmontecarlo.montecarlo.integrator import *
from jetmontecarlo.utils.color_utils import *
# Parameters
NUM_SAMPLES = int(1e4)
NUM_BINS = 10
EPSILON = 1e... | [
"numpy.log10",
"matplotlib.pyplot.figaspect",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.cm.coolwarm",
"numpy.meshgrid"
] | [((1745, 1764), 'numpy.meshgrid', 'np.meshgrid', (['xs', 'ys'], {}), '(xs, ys)\n', (1756, 1764), True, 'import numpy as np\n'), ((2059, 2077), 'matplotlib.pyplot.figaspect', 'plt.figaspect', (['(0.5)'], {}), '(0.5)\n', (2072, 2077), True, 'import matplotlib.pyplot as plt\n'), ((2173, 2200), 'matplotlib.pyplot.figure', ... |
import logging
import random
from flask import request
from flask_restplus import Resource, Namespace, fields
from ..managers import copy_job_manager
from .. import tasks
from ..exceptions import HTTP_EXCEPTION
api = Namespace('copy-jobs', description='CopyJob related operations')
dto = api.model('copy-job', {
... | [
"flask_restplus.Namespace",
"logging.exception",
"flask_restplus.fields.Integer",
"flask_restplus.fields.String",
"flask_restplus.fields.Boolean"
] | [((222, 286), 'flask_restplus.Namespace', 'Namespace', (['"""copy-jobs"""'], {'description': '"""CopyJob related operations"""'}), "('copy-jobs', description='CopyJob related operations')\n", (231, 286), False, 'from flask_restplus import Resource, Namespace, fields\n'), ((328, 371), 'flask_restplus.fields.Integer', 'f... |
#!python
# Copyright 2014 Google Inc. 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 applicabl... | [
"os.path.exists",
"log_helper.GetLogger",
"os.path.join",
"optparse.OptionParser",
"runner.ChromeRunner",
"os.path.dirname",
"sys.path.append",
"ctypes.windll.kernel32.SetErrorMode"
] | [((1263, 1294), 'sys.path.append', 'sys.path.append', (['_BENCHMARK_DIR'], {}), '(_BENCHMARK_DIR)\n', (1278, 1294), False, 'import sys\n'), ((1295, 1323), 'sys.path.append', 'sys.path.append', (['_ETW_DB_DIR'], {}), '(_ETW_DB_DIR)\n', (1310, 1323), False, 'import sys\n'), ((1324, 1349), 'sys.path.append', 'sys.path.app... |
import argparse
def main():
"""
The Carpentries command line tool.
"""
parser = argparse.ArgumentParser(description="""
A toolkit for The Carpentries.
""")
from carpentries import values
if __name__ == "__main__":
main()
| [
"argparse.ArgumentParser"
] | [((98, 186), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n A toolkit for The Carpentries.\n """'}), '(description=\n """\n A toolkit for The Carpentries.\n """)\n', (121, 186), False, 'import argparse\n')] |
import logging
from enum import Enum
logger = logging.getLogger(__name__)
__version__ = "0.3.0"
class STATUS(Enum):
ERROR = -1
STOPPED = 1
PLAYING = 2
PAUSED = 3
class StatusObject(object):
def __init__(self):
self._status = STATUS.STOPPED
def status(self):
return self._st... | [
"logging.getLogger"
] | [((47, 74), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (64, 74), False, 'import logging\n')] |
"""This is a draft of machine learning code, so that we can test how to do the machine learning algorithm of the
gravitational lenses. """
# IMPORTS
from cnnUtils import getPositiveSimulatedTrain, getNegativeDESTrain, getPositiveSimulatedTest, getNegativeDESTest, \
makeTrainTest, useKerasModel, plotModel, visualize... | [
"cnnUtils.getNegativeDESTrain",
"cnnUtils.getPositiveSimulatedTrain",
"cnnUtils.plotModel",
"cnnUtils.visualizeKeras",
"cnnUtils.getNegativeDESTest",
"cnnUtils.getKerasKFold",
"cnnUtils.makeTrainTest",
"cnnUtils.useKerasModel",
"cnnUtils.getPositiveSimulatedTest"
] | [((694, 721), 'cnnUtils.getPositiveSimulatedTrain', 'getPositiveSimulatedTrain', ([], {}), '()\n', (719, 721), False, 'from cnnUtils import getPositiveSimulatedTrain, getNegativeDESTrain, getPositiveSimulatedTest, getNegativeDESTest, makeTrainTest, useKerasModel, plotModel, visualizeKeras, testUnseenDES2017, testUnseen... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.core.mail import send_mail
from django.conf import settings
from django.urls import reverse
from django.utils.html import strip_tags
from django.template.loader import render_to_string
import uuid
class User(AbstractUser):
... | [
"django.db.models.DateField",
"django.utils.html.strip_tags",
"django.db.models.TextField",
"django.db.models.BooleanField",
"uuid.uuid4",
"django.urls.reverse",
"django.db.models.ImageField",
"django.db.models.CharField",
"django.template.loader.render_to_string"
] | [((1484, 1534), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""avatars"""', 'blank': '(True)'}), "(upload_to='avatars', blank=True)\n", (1501, 1534), False, 'from django.db import models\n'), ((1548, 1615), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'GENDER_CHOICES', ... |
import argparse
import functools
import math
import sys
import traceback
import tkinter as tk
import tkinter.messagebox
from labrat.catcher import Catcher
import labrat.convert as convert
VERSION = [0, 1, 1]
def canonicalize_int(s):
try:
return str(int(s))
except ValueError:
return s
def ... | [
"labrat.convert.xyz_from_rgb",
"labrat.convert.xyz_from_lab",
"math.cos",
"tkinter.Label",
"math.hypot",
"tkinter.Frame",
"tkinter.Entry",
"argparse.ArgumentParser",
"tkinter.StringVar",
"labrat.convert.rgb_from_int",
"traceback.print_exc",
"math.radians",
"math.atan2",
"labrat.convert.rgb... | [((10440, 10465), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (10463, 10465), False, 'import argparse\n'), ((1084, 1115), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self', 'master'], {}), '(self, master)\n', (1101, 1115), True, 'import tkinter as tk\n'), ((1984, 2000), 'tkinter.Frame'... |
from django.db import models
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
#return 'user_{0}/{1}'.format(instance.user.id, filename)
return 'unaligned_images' + '/' + '{0}/{1}'.format(instance.person.name,filename)
class Person(models.Model):
nam... | [
"django.db.models.FileField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((324, 380), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'null': '(False)', 'blank': '(False)'}), '(max_length=20, null=False, blank=False)\n', (340, 380), False, 'from django.db import models\n'), ((461, 508), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': 'user... |
# Copyright [2019] [FORTH-ICS]
#
# 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... | [
"pyh3lib.H3",
"struct.unpack",
"argparse.ArgumentParser",
"time.clock_gettime"
] | [((882, 921), 'time.clock_gettime', 'time.clock_gettime', (['time.CLOCK_REALTIME'], {}), '(time.CLOCK_REALTIME)\n', (900, 921), False, 'import time\n'), ((1975, 2034), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ExpiresAt Controller"""'}), "(description='ExpiresAt Controller')\n", (19... |
import random
num = random.randint(1,6)
print(num)
| [
"random.randint"
] | [((22, 42), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (36, 42), False, 'import random\n')] |
from unittest import TestCase
from procurvefront.ConfigParser import VlanConfig, ConfigParser
class TestConfigParser(TestCase):
def test_range_parser(self):
numbers = VlanConfig._parse_range('0-10,20,30-40')
self.assertEqual(23, len(numbers))
self.assertListEqual(list(range(0, 11)), numbe... | [
"procurvefront.ConfigParser.ConfigParser",
"procurvefront.ConfigParser.VlanConfig._parse_range"
] | [((182, 222), 'procurvefront.ConfigParser.VlanConfig._parse_range', 'VlanConfig._parse_range', (['"""0-10,20,30-40"""'], {}), "('0-10,20,30-40')\n", (205, 222), False, 'from procurvefront.ConfigParser import VlanConfig, ConfigParser\n'), ((480, 507), 'procurvefront.ConfigParser.ConfigParser', 'ConfigParser', (['SAMPLE_... |
#coding=utf-8
from api.document.doc_tools import *
from api.view.base import *
from app.live.models import *
from django.conf import settings
from api.convert.convert_user import *
from app.customer.models.user import *
# from PIL import Image
import urlparse
import hashlib
import base64
import time
import json
import ... | [
"time.time",
"hashlib.md5"
] | [((889, 902), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (900, 902), False, 'import hashlib\n'), ((916, 929), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (927, 929), False, 'import hashlib\n'), ((1271, 1282), 'time.time', 'time.time', ([], {}), '()\n', (1280, 1282), False, 'import time\n')] |
import torch
import time
import os
from statistics import mean
from thop import profile
from torch_geometric.data.batch import Batch as tgb
import utils.loader as dl
import utils.network as net
import utils.util as ut
#**************************************************************#
#*********************** MAIN ... | [
"statistics.mean",
"utils.loader.data_loader",
"utils.network.NetGINConv",
"utils.util.getGraphDataList",
"utils.util.test",
"utils.util.train",
"torch.load",
"torch_geometric.data.batch.Batch.from_data_list",
"utils.util.displacement_error",
"torch.cuda.is_available",
"time.time",
"torch.devi... | [((1349, 1391), 'utils.loader.data_loader', 'dl.data_loader', (['(data_dir + data_folders[1])'], {}), '(data_dir + data_folders[1])\n', (1363, 1391), True, 'import utils.loader as dl\n'), ((1414, 1456), 'utils.loader.data_loader', 'dl.data_loader', (['(data_dir + data_folders[2])'], {}), '(data_dir + data_folders[2])\n... |
import ctypes
ctypes.CDLL(None).func()
| [
"ctypes.CDLL"
] | [((16, 33), 'ctypes.CDLL', 'ctypes.CDLL', (['None'], {}), '(None)\n', (27, 33), False, 'import ctypes\n')] |
__author__ = 'dooferlad'
import hashlib
import os
import tempfile
import unittest
import urllib2
import urlparse
import json
import random
import shutil
import mock
from django.conf import settings
from django.test import Client, TestCase
from django.http import HttpResponse
from license_protected_downloads.buildin... | [
"mock.Mock",
"license_protected_downloads.models.APIKeyStore.objects.get",
"license_protected_downloads.buildinfo.BuildInfo",
"license_protected_downloads.views._sizeof_fmt",
"license_protected_downloads.views._process_include_tags",
"unittest.main",
"license_protected_downloads.tests.helpers.temporary_... | [((990, 1037), 'os.path.join', 'os.path.join', (['THIS_DIRECTORY', '"""testserver_root"""'], {}), "(THIS_DIRECTORY, 'testserver_root')\n", (1002, 1037), False, 'import os\n'), ((945, 970), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (960, 970), False, 'import os\n'), ((15826, 15880), 'mock... |
""" handles the bulk of the tweepy api operations """
import tweepy
class APIMinions(object):
""" minions tweepy api helper class. """
def __init__(self, app_consumer_key, app_consumer_secret, app_access_key, \
app_access_secret):
""" create the object with empty properties. """
... | [
"tweepy.Cursor",
"tweepy.API",
"tweepy.OAuthHandler"
] | [((1202, 1260), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['app_consumer_key', 'app_consumer_secret'], {}), '(app_consumer_key, app_consumer_secret)\n', (1221, 1260), False, 'import tweepy\n'), ((1354, 1449), 'tweepy.API', 'tweepy.API', (['auth'], {'wait_on_rate_limit': '(True)', 'wait_on_rate_limit_notify': '(Tru... |
import aepp
from aepp import connector
from copy import deepcopy
import logging
class DataSets:
"""
Class that provides methods to manage labels of datasets.
A complete documentation ca be found here:
https://www.adobe.io/apis/experienceplatform/home/api-reference.html#!acpdr/swagger-specs/dataset-ser... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"logging.FileHandler",
"copy.deepcopy",
"aepp.connector.AdobeRequest"
] | [((2257, 2377), 'aepp.connector.AdobeRequest', 'connector.AdobeRequest', ([], {'config_object': 'config', 'header': 'header', 'loggingEnabled': 'self.loggingEnabled', 'logger': 'self.logger'}), '(config_object=config, header=header, loggingEnabled=\n self.loggingEnabled, logger=self.logger)\n', (2279, 2377), False, ... |
from importlib import import_module
import sys
import os
def main():
if len(sys.argv[1:]) != 2:
print("python %s [day] [input file]" % sys.argv[0])
exit(1)
day = import_module("advent.%s" % sys.argv[1])
root_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(root_... | [
"os.path.abspath",
"os.path.join",
"importlib.import_module"
] | [((188, 228), 'importlib.import_module', 'import_module', (["('advent.%s' % sys.argv[1])"], {}), "('advent.%s' % sys.argv[1])\n", (201, 228), False, 'from importlib import import_module\n'), ((261, 286), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (276, 286), False, 'import os\n'), ((302, ... |
"""Config loader of Heartbeat Server"""
import os
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
dotenv_path = os.path.join(os.path.dirname(__file__), ".env")
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
SERVER_PORT = 4792
PROTOCOL_CONFIG = {"allow_public_attrs": Tr... | [
"os.path.exists",
"os.environ.get",
"os.path.join",
"dotenv.load_dotenv",
"os.path.dirname"
] | [((199, 226), 'os.path.exists', 'os.path.exists', (['dotenv_path'], {}), '(dotenv_path)\n', (213, 226), False, 'import os\n'), ((107, 132), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (122, 132), False, 'import os\n'), ((161, 186), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), ... |
__author__ = 'huyheo'
import logging
from gluon import *
from intent_relation_def import expected_intent_gen, topic_intent_dic
from utility import *
log = logging.getLogger("h")
log.setLevel(logging.DEBUG)
session = current.session
class user_factory(object):
def __init__(self):
pass
def me(se... | [
"logging.getLogger"
] | [((158, 180), 'logging.getLogger', 'logging.getLogger', (['"""h"""'], {}), "('h')\n", (175, 180), False, 'import logging\n')] |
import torch
def tokenise(x, vocab):
batch = []
for s in x:
tokens = [vocab.go] + [vocab.word2idx[w] if w in vocab.word2idx else vocab.unk for w in s] + [vocab.eos]
t = torch.tensor(tokens, dtype=torch.long)
batch.append(t)
return batch
def de_tokenise(y, vocab):
omit_tokens = ... | [
"torch.tensor"
] | [((194, 232), 'torch.tensor', 'torch.tensor', (['tokens'], {'dtype': 'torch.long'}), '(tokens, dtype=torch.long)\n', (206, 232), False, 'import torch\n')] |
# coding: utf-8
# Remove a specific participant entry from database
# Created by <NAME> (2021)
import slack
import ast
import settings
import config
from slackers.hooks import commands
conv_db = config.conv_handler
@commands.on("deleteparticipant")
def deleteparticipant(payload):
return
| [
"slackers.hooks.commands.on"
] | [((221, 253), 'slackers.hooks.commands.on', 'commands.on', (['"""deleteparticipant"""'], {}), "('deleteparticipant')\n", (232, 253), False, 'from slackers.hooks import commands\n')] |
# Generated by Django 2.2.20 on 2021-07-14 03:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("petition", "0038_auto_20210412_0353"),
]
operations = [
migrations.AddFie... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((409, 442), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (428, 442), False, 'from django.db import migrations, models\n'), ((561, 681), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name'... |
import numpy as np
import torch, functools
import table_batched_embeddings, table_batched_embeddings_ops
np.random.seed(42)
def div_round_up(a, b):
return int((a + b - 1) // b) * b
def get_table_batched_offsets_from_dense(merged_indices):
(T, B, L) = merged_indices.size()
lengths = np.ones((T, B)) * L
... | [
"table_batched_embeddings_ops.TableBatchedEmbeddingBags",
"torch.cuda.synchronize",
"table_batched_embeddings.forward",
"torch.nn.AvgPool2d",
"table_batched_embeddings_ops.MixedDimTableBatchedEmbeddingBags",
"torch.testing.assert_allclose",
"torch.nn.BatchNorm2d",
"torch.addmm",
"torch.relu",
"fun... | [((105, 123), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (119, 123), True, 'import numpy as np\n'), ((657, 681), 'torch.cuda.synchronize', 'torch.cuda.synchronize', ([], {}), '()\n', (679, 681), False, 'import torch, functools\n'), ((700, 736), 'torch.cuda.Event', 'torch.cuda.Event', ([], {'enable... |
from tkinter import Tk, Toplevel, LabelFrame, Button, Label
class DummyGPIO():
def __init__(self, tkinterApp):
print("Project doesn't run on a Raspberry Pi.\nSimulation will start!\n")
self.tkinterApp = tkinterApp
self.BCM = "bcm"
self.OUT= "output"
self.IN = "input"
... | [
"tkinter.LabelFrame",
"tkinter.Toplevel",
"tkinter.Button",
"tkinter.Tk",
"tkinter.Label"
] | [((1795, 1805), 'tkinter.Toplevel', 'Toplevel', ([], {}), '()\n', (1803, 1805), False, 'from tkinter import Tk, Toplevel, LabelFrame, Button, Label\n'), ((1885, 1889), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (1887, 1889), False, 'from tkinter import Tk, Toplevel, LabelFrame, Button, Label\n'), ((2063, 2104), 'tkinter.Lab... |
# Copyright 2019 Inspur Corporation. 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... | [
"parse_model.ParseModel",
"torch.no_grad",
"dnscp_core.DnscpCore",
"time.time"
] | [((1202, 1214), 'parse_model.ParseModel', 'ParseModel', ([], {}), '()\n', (1212, 1214), False, 'from parse_model import ParseModel\n'), ((1791, 1802), 'dnscp_core.DnscpCore', 'DnscpCore', ([], {}), '()\n', (1800, 1802), False, 'from dnscp_core import DnscpCore\n'), ((6783, 6794), 'time.time', 'time.time', ([], {}), '()... |
# -*- coding: utf-8 -*-
"""PANDAS_Merge_Datasets.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1tl-hpZnuk6VCN8kR7K47d-8l29o62U7B
<h2>Python para Análise de Dados</h2>
**Consulta os dados em mais de um dataset**
"""
import pandas as pd
"""**C... | [
"pandas.merge",
"IPython.display.Image",
"pandas.read_csv"
] | [((366, 496), 'pandas.read_csv', 'pd.read_csv', (['"""/content/drive/My Drive/Colab Notebooks/ Data Science - Minerando Dados/datasets/olist_orders_dataset.csv"""'], {}), "(\n '/content/drive/My Drive/Colab Notebooks/ Data Science - Minerando Dados/datasets/olist_orders_dataset.csv'\n )\n", (377, 496), True, 'imp... |
import hashlib
import hmac
import base64
def main():
sign = "sdffdsfdsjjnxjcvdfe"
h = hmac.new("1234567890123456", sign, hashlib.sha1)
print(base64.b64encode(h.digest()))
if __name__ == '__main__':
main()
| [
"hmac.new"
] | [((103, 151), 'hmac.new', 'hmac.new', (['"""1234567890123456"""', 'sign', 'hashlib.sha1'], {}), "('1234567890123456', sign, hashlib.sha1)\n", (111, 151), False, 'import hmac\n')] |
from tensor_operator import TensorOperator
import re
import numpy as np
class MemorySurface:
__format__ = {'FeatureMap','weight','image'}
#__data_type__ = {'int8', 'int16', 'float16'}
def __init__(self, name):
self.name = name
self.seed = 0
self.pattern = None
sel... | [
"re.compile",
"tensor_operator.TensorOperator.convert_weight_memory_surface_to_nchw",
"tensor_operator.TensorOperator.append_c_compensation_to_nchw_tensor",
"tensor_operator.TensorOperator.convert_nchw_to_weight_memory_surface",
"tensor_operator.TensorOperator.merge_nchw_tensors_by_dimemsion",
"tensor_ope... | [((455, 480), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (469, 480), True, 'import numpy as np\n'), ((4493, 4587), 'tensor_operator.TensorOperator.append_c_compensation_to_nchw_tensor', 'TensorOperator.append_c_compensation_to_nchw_tensor', (['self.tensor_nchw', 'self.atomic_memory'], ... |