code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pandas as pd
import numpy as np
import csv
import urllib.request
import json
from datetime import datetime
from datetime import timedelta
from sklearn.preprocessing import MinMaxScaler
import web_scrapers
import os
def load_real_estate_data(filename, state_attr, state):
df = pd.read_csv(filename, encoding... | [
"json.loads",
"pandas.read_csv",
"pandas.merge",
"json.dump",
"web_scrapers.add_new_ipo_data_to_csv",
"os.path.isfile",
"json.load",
"numpy.array",
"csv.reader",
"pandas.DataFrame",
"datetime.timedelta",
"sklearn.preprocessing.MinMaxScaler",
"pandas.to_datetime"
] | [((290, 334), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'encoding': '"""ISO-8859-1"""'}), "(filename, encoding='ISO-8859-1')\n", (301, 334), True, 'import pandas as pd\n'), ((1285, 1336), 'pandas.to_datetime', 'pd.to_datetime', (["df['Date Filed']"], {'format': '"""%Y-%m-%d"""'}), "(df['Date Filed'], format='%Y... |
from director.devel.plugin import GenericPlugin
from director.fieldcontainer import FieldContainer
from .lib import measurementpanel
from PythonQt import QtCore
class Plugin(GenericPlugin):
ID = 'measurement_tool'
NAME = 'MeasurementTool'
DEPENDENCIES = ['MainWindow']
def __init__(self, app, view):
sup... | [
"director.fieldcontainer.FieldContainer"
] | [((625, 720), 'director.fieldcontainer.FieldContainer', 'FieldContainer', ([], {'measurementToolPanel': 'measurementPanel', 'measurementToolDock': 'measurementDock'}), '(measurementToolPanel=measurementPanel, measurementToolDock=\n measurementDock)\n', (639, 720), False, 'from director.fieldcontainer import FieldCon... |
__author__ = '<NAME> - www.tonybeltramelli.com'
# scripted agents taken from PySC2, credits to DeepMind
# https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py
import numpy as np
import uuid
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_SCREE... | [
"pysc2.lib.actions.FunctionCall",
"pysc2.agents.base_agent.BaseAgent.__init__",
"numpy.argmax",
"uuid.uuid1",
"numpy.stack",
"numpy.array",
"numpy.argmin"
] | [((1168, 1193), 'numpy.stack', 'np.stack', (['screens'], {'axis': '(2)'}), '(screens, axis=2)\n', (1176, 1193), True, 'import numpy as np\n'), ((5072, 5108), 'pysc2.lib.actions.FunctionCall', 'actions.FunctionCall', (['action', 'params'], {}), '(action, params)\n', (5092, 5108), False, 'from pysc2.lib import actions\n'... |
import time
import sys
import dask
from dask.distributed import (
wait,
futures_of,
Client,
)
from tpch import loaddata, queries
#from benchmarks import utils
# Paths or URLs to the TPC-H tables.
#table_paths = {
# 'CUSTOMER': 'hdfs://bu-23-115:9000/tpch/customer.tbl',
# 'LINEITEM': 'hdfs://bu-... | [
"dask.distributed.Client",
"dask.distributed.futures_of",
"time.time"
] | [((1825, 1844), 'dask.distributed.Client', 'Client', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1831, 1844), False, 'from dask.distributed import wait, futures_of, Client\n'), ((5009, 5020), 'time.time', 'time.time', ([], {}), '()\n', (5018, 5020), False, 'import time\n'), ((3765, 3776), 'time.time', 'time.time', ([], ... |
"""Use pika with the Tornado IOLoop
"""
import logging
from tornado import ioloop
from pika.adapters.utils import nbio_interface, selector_ioloop_adapter
from pika.adapters import base_connection
LOGGER = logging.getLogger(__name__)
class TornadoConnection(base_connection.BaseConnection):
"""The TornadoConne... | [
"logging.getLogger",
"tornado.ioloop.IOLoop.instance"
] | [((210, 237), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (227, 237), False, 'import logging\n'), ((2920, 2944), 'tornado.ioloop.IOLoop.instance', 'ioloop.IOLoop.instance', ([], {}), '()\n', (2942, 2944), False, 'from tornado import ioloop\n'), ((2211, 2235), 'tornado.ioloop.IOLoop.ins... |
from mock.mock import patch
import os
import pytest
import ca_test_common
import ceph_volume_simple_activate
fake_cluster = 'ceph'
fake_container_binary = 'podman'
fake_container_image = 'quay.ceph.io/ceph/daemon:latest'
fake_id = '42'
fake_uuid = '0c4a7eca-0c2a-4c12-beff-08a80f064c52'
fake_path = '/etc/ceph/osd/{}-{}... | [
"mock.mock.patch",
"ca_test_common.set_module_args",
"mock.mock.patch.dict",
"ceph_volume_simple_activate.main",
"pytest.raises",
"mock.mock.patch.object"
] | [((412, 471), 'mock.mock.patch', 'patch', (['"""ansible.module_utils.basic.AnsibleModule.exit_json"""'], {}), "('ansible.module_utils.basic.AnsibleModule.exit_json')\n", (417, 471), False, 'from mock.mock import patch\n'), ((1160, 1219), 'mock.mock.patch', 'patch', (['"""ansible.module_utils.basic.AnsibleModule.exit_js... |
import setuptools
setuptools.setup(
name='mintermonitoring',
version='1.0.0',
packages=setuptools.find_packages(include=['mintermonitoring'])
)
| [
"setuptools.find_packages"
] | [((97, 151), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'include': "['mintermonitoring']"}), "(include=['mintermonitoring'])\n", (121, 151), False, 'import setuptools\n')] |
import pandas as pd
import os.path
length_switch = True
max_body_length = 50
process_candidates = os.path.exists('./datasets/candidates.output')
x_train = open('./datasets/x_train').readlines()
x_train = [x.rstrip('\n') for x in x_train]
y_train = open('./datasets/y_train').readlines()
y_train = [x.rstrip('\n') for x... | [
"pandas.DataFrame"
] | [((1215, 1287), 'pandas.DataFrame', 'pd.DataFrame', (["{'source': x_train + x_valid, 'target': y_train + y_valid}"], {}), "({'source': x_train + x_valid, 'target': y_train + y_valid})\n", (1227, 1287), True, 'import pandas as pd\n'), ((901, 988), 'pandas.DataFrame', 'pd.DataFrame', (["{'source': bytecodes, 'target': re... |
import System
dataKey, _ = IN
OUT = System.AppDomain.CurrentDomain.GetData("_Dyn_Wireless_%s" % dataKey) | [
"System.AppDomain.CurrentDomain.GetData"
] | [((37, 105), 'System.AppDomain.CurrentDomain.GetData', 'System.AppDomain.CurrentDomain.GetData', (["('_Dyn_Wireless_%s' % dataKey)"], {}), "('_Dyn_Wireless_%s' % dataKey)\n", (75, 105), False, 'import System\n')] |
from quiet_coms import find_quiet_ports
from quiet import Quiet
import time
if 'EXIT_ON_FAIL' not in locals():
VERBOSE = True
EXIT_ON_FAIL = True
class QuietI2C(Quiet):
def __init__(self, coms, **kargs) -> None:
Quiet.__init__(self, coms, **kargs)
def raw_write(self, addr: int, data: bytearra... | [
"quiet.Quiet.__init__",
"time.sleep"
] | [((1801, 1816), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (1811, 1816), False, 'import time\n'), ((234, 269), 'quiet.Quiet.__init__', 'Quiet.__init__', (['self', 'coms'], {}), '(self, coms, **kargs)\n', (248, 269), False, 'from quiet import Quiet\n'), ((3044, 3061), 'time.sleep', 'time.sleep', (['delay'],... |
# Copyright 2019 The Keras Tuner Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.average",
"math.log",
"collections.defaultdict",
"tensorflow.nest.flatten",
"time.time",
"random.randint"
] | [((3247, 3264), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3258, 3264), False, 'from collections import defaultdict\n'), ((5053, 5070), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (5064, 5070), False, 'from collections import defaultdict\n'), ((7212, 7246), 'math.lo... |
import warnings
from typing import Callable, Optional, TypeVar, cast
CallableType = TypeVar("CallableType", bound=Callable)
def deprecation_wrapper(message: str, function_or_class: CallableType) -> CallableType:
"""Creates a wrapper for a deprecated function or class. Prints a warning
the first time a functi... | [
"warnings.warn",
"typing.cast",
"typing.TypeVar"
] | [((85, 124), 'typing.TypeVar', 'TypeVar', (['"""CallableType"""'], {'bound': 'Callable'}), "('CallableType', bound=Callable)\n", (92, 124), False, 'from typing import Callable, Optional, TypeVar, cast\n'), ((810, 837), 'typing.cast', 'cast', (['CallableType', 'curried'], {}), '(CallableType, curried)\n', (814, 837), Fa... |
import json
data = {
"users": [
{"Name": "Dominator", "skill": 100, "gold": 99999, "weapons": ['Sword', 'Atomic Laser']},
{"Name": "Looser", "skill": 1, "gold": -100000, "weapons": [None, None, None]},
]
}
with open("example.json", "w") as f:
s = json.dumps(data, indent=4)
f.write(s)
| [
"json.dumps"
] | [((277, 303), 'json.dumps', 'json.dumps', (['data'], {'indent': '(4)'}), '(data, indent=4)\n', (287, 303), False, 'import json\n')] |
import random as r
# Sets up required variables
running = True
user_wins = 0
comp_wins = 0
answers = ["R", "P", "S"]
win_combos = ["PR", "RS", "SP"]
# Welcome message
print("Welcome to Rock-Paper-Scissors. Please input one of the following:"
"\n'R' - rock\n'P' - paper\n'S' - scissors\nto get started.")
whil... | [
"random.randint"
] | [((693, 708), 'random.randint', 'r.randint', (['(0)', '(2)'], {}), '(0, 2)\n', (702, 708), True, 'import random as r\n')] |
from baselines import deepq
def add_opts(parser):
pass
class BaselinesDQNAgent(object):
'''
classdocs
'''
def __init__(self, opts):
self.metadata = {
'discrete_actions': True,
}
self.opts = opts
self.agent = None
def configure(self, observation_space_shape, nb_actions):
pass
def train(self, ... | [
"baselines.deepq.learn",
"baselines.deepq.models.mlp",
"baselines.deepq.load"
] | [((368, 390), 'baselines.deepq.models.mlp', 'deepq.models.mlp', (['[64]'], {}), '([64])\n', (384, 390), False, 'from baselines import deepq\n'), ((406, 637), 'baselines.deepq.learn', 'deepq.learn', (['env'], {'q_func': 'model', 'lr': '(0.001)', 'max_timesteps': 'nb_steps', 'buffer_size': '(50000)', 'exploration_fractio... |
#!/usr/bin/python3
import requests
import click
from rich import inspect
from rich.console import Console
from url_normalize import url_normalize
from urllib.parse import quote
console = Console()
def shell_encode(string):
return string.replace(" ", "${IFS}")
@click.command()
@click.option("-u", "--url", prompt... | [
"rich.inspect",
"click.option",
"url_normalize.url_normalize",
"urllib.parse.quote",
"requests.get",
"rich.console.Console",
"click.echo",
"click.command"
] | [((189, 198), 'rich.console.Console', 'Console', ([], {}), '()\n', (196, 198), False, 'from rich.console import Console\n'), ((269, 284), 'click.command', 'click.command', ([], {}), '()\n', (282, 284), False, 'import click\n'), ((286, 381), 'click.option', 'click.option', (['"""-u"""', '"""--url"""'], {'prompt': '"""Ta... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: terra/treasury/v1beta1/genesis.proto, terra/treasury/v1beta1/query.proto, terra/treasury/v1beta1/treasury.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
from betterproto.grpc.grp... | [
"dataclasses.dataclass",
"grpclib.const.Handler",
"grpclib.GRPCError",
"betterproto.string_field",
"betterproto.uint64_field",
"betterproto.message_field"
] | [((369, 400), 'dataclasses.dataclass', 'dataclass', ([], {'eq': '(False)', 'repr': '(False)'}), '(eq=False, repr=False)\n', (378, 400), False, 'from dataclasses import dataclass\n'), ((920, 951), 'dataclasses.dataclass', 'dataclass', ([], {'eq': '(False)', 'repr': '(False)'}), '(eq=False, repr=False)\n', (929, 951), Fa... |
import jax
import elegy
import unittest
import numpy as np
import jax.numpy as jnp
import optax
class MLP(elegy.Module):
"""Standard LeNet-300-100 MLP network."""
n1: int
n2: int
def __init__(self, n1: int = 3, n2: int = 4):
super().__init__()
self.n1 = n1
self.n2 = n2
... | [
"elegy.nn.BatchNormalization",
"optax.adamw",
"jax.nn.relu",
"optax.adam",
"elegy.Optimizer",
"elegy.metrics.SparseCategoricalAccuracy",
"elegy.nn.Linear",
"numpy.allclose",
"numpy.ones",
"optax.sgd",
"elegy.RNGSeq",
"optax.clip",
"jax.numpy.reshape",
"jax.numpy.array",
"numpy.zeros",
... | [((431, 463), 'jax.numpy.reshape', 'jnp.reshape', (['x', '[x.shape[0], -1]'], {}), '(x, [x.shape[0], -1])\n', (442, 463), True, 'import jax.numpy as jnp\n'), ((561, 575), 'jax.nn.relu', 'jax.nn.relu', (['x'], {}), '(x)\n', (572, 575), False, 'import jax\n'), ((629, 643), 'jax.nn.relu', 'jax.nn.relu', (['x'], {}), '(x)\... |
# -- coding: UTF-8 --
"""
Spyder Editor
This is a temporary script file.
"""
from bs4 import BeautifulSoup
import sys
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import urllib.parse,urllib.request,urllib.error
base="https://nazrul-rachanabali.nltr.org/"
page=urllib.request.... | [
"bs4.BeautifulSoup",
"os.path.exists",
"os.makedirs"
] | [((347, 378), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page', '"""html5lib"""'], {}), "(page, 'html5lib')\n", (360, 378), False, 'from bs4 import BeautifulSoup\n'), ((611, 643), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page1', '"""html5lib"""'], {}), "(page1, 'html5lib')\n", (624, 643), False, 'from bs4 import Beautifu... |
try:
from mitmproxy import controller, proxy
from mitmproxy.proxy.server import ProxyServer
except:
from libmproxy import controller, proxy
from libmproxy.proxy.server import ProxyServer
from plugins import *
from threading import Thread
from core.config.settings import SettingsINI
# MIT License
#
# Co... | [
"libmproxy.controller.Master.__init__",
"core.config.settings.SettingsINI",
"libmproxy.controller.Master.run"
] | [((1841, 1881), 'libmproxy.controller.Master.__init__', 'controller.Master.__init__', (['self', 'server'], {}), '(self, server)\n', (1867, 1881), False, 'from libmproxy import controller, proxy\n'), ((1905, 1941), 'core.config.settings.SettingsINI', 'SettingsINI', (['"""core/pumpkinProxy.ini"""'], {}), "('core/pumpkinP... |
import numpy as np
import matplotlib.pyplot as plt
from astropy.convolution import RickerWavelet2DKernel
ricker_2d_kernel = RickerWavelet2DKernel(5)
plt.imshow(ricker_2d_kernel, interpolation='none', origin='lower')
plt.xlabel('x [pixels]')
plt.ylabel('y [pixels]')
plt.colorbar()
plt.show()
print(ricker_2d_kernel)
| [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.colorbar",
"astropy.convolution.RickerWavelet2DKernel",
"matplotlib.pyplot.show"
] | [((126, 150), 'astropy.convolution.RickerWavelet2DKernel', 'RickerWavelet2DKernel', (['(5)'], {}), '(5)\n', (147, 150), False, 'from astropy.convolution import RickerWavelet2DKernel\n'), ((151, 217), 'matplotlib.pyplot.imshow', 'plt.imshow', (['ricker_2d_kernel'], {'interpolation': '"""none"""', 'origin': '"""lower"""'... |
#!/usr/bin/env python3
import logging
import argparse
import traceback
import os
import sys
from analysis import Analysis
from collector import Collector
from config import DEBUG, DEFAULT_LOG_FILE_DIR
def is_dir(dirname):
if not os.path.isdir(dirname):
msg = "{0} is not a directory".format(dirname)
... | [
"logging.basicConfig",
"argparse.FileType",
"collector.Collector",
"argparse.ArgumentParser",
"argparse.ArgumentTypeError",
"os.path.isdir",
"analysis.Analysis",
"logging.info"
] | [((665, 690), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (688, 690), False, 'import argparse\n'), ((237, 259), 'os.path.isdir', 'os.path.isdir', (['dirname'], {}), '(dirname)\n', (250, 259), False, 'import os\n'), ((330, 361), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['m... |
#!/usr/bin/env python
# coding: utf-8
""" """
import typing as t
import attr
import click
@attr.s(frozen=True)
class Memory(object):
banks: t.Tuple[int, ...] = attr.ib()
def balance(self) -> 'Memory':
mem = list(self.banks)
num_banks = len(self.banks)
# Find the amount of blocks to ... | [
"attr.s",
"click.secho",
"click.group",
"click.File",
"attr.ib"
] | [((94, 113), 'attr.s', 'attr.s', ([], {'frozen': '(True)'}), '(frozen=True)\n', (100, 113), False, 'import attr\n'), ((1122, 1135), 'click.group', 'click.group', ([], {}), '()\n', (1133, 1135), False, 'import click\n'), ((167, 176), 'attr.ib', 'attr.ib', ([], {}), '()\n', (174, 176), False, 'import attr\n'), ((1504, 15... |
import glob
import os
import torch
from PIL import Image
from tqdm import tqdm
from ssd.config import cfg
from ssd.data.datasets import COCODataset, VOCDataset
from ssd.modeling.predictor import Predictor
from ssd.modeling.vgg_ssd import build_ssd_model
import argparse
import numpy as np
from ssd.utils.viz import dra... | [
"os.path.exists",
"PIL.Image.fromarray",
"PIL.Image.open",
"argparse.ArgumentParser",
"ssd.modeling.vgg_ssd.build_ssd_model",
"os.makedirs",
"tqdm.tqdm",
"ssd.config.cfg.freeze",
"os.path.join",
"ssd.modeling.predictor.Predictor",
"numpy.array",
"ssd.config.cfg.merge_from_file",
"ssd.config.... | [((678, 708), 'torch.device', 'torch.device', (['cfg.MODEL.DEVICE'], {}), '(cfg.MODEL.DEVICE)\n', (690, 708), False, 'import torch\n'), ((721, 741), 'ssd.modeling.vgg_ssd.build_ssd_model', 'build_ssd_model', (['cfg'], {}), '(cfg)\n', (736, 741), False, 'from ssd.modeling.vgg_ssd import build_ssd_model\n'), ((874, 986),... |
from typing import Any, Dict, Tuple
import torch
from torch_geometric.nn import GATConv
from torch_sparse import SparseTensor, set_diag
from rgnn_at_scale.aggregation import ROBUST_MEANS
from rgnn_at_scale.models.gcn import GCN
class RGATConv(GATConv):
"""Extension of Pytorch Geometric's `GCNConv` to execute a... | [
"torch_sparse.set_diag",
"torch_sparse.SparseTensor.from_edge_index"
] | [((2451, 2471), 'torch_sparse.set_diag', 'set_diag', (['edge_index'], {}), '(edge_index)\n', (2459, 2471), False, 'from torch_sparse import SparseTensor, set_diag\n'), ((4975, 5052), 'torch_sparse.SparseTensor.from_edge_index', 'SparseTensor.from_edge_index', (['edge_idx', 'edge_weight', '(x.shape[0], x.shape[0])'], {}... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw, msgprint
from frappe.utils import nowdate
from frappe.model.document import Documen... | [
"json.loads",
"requests.post",
"frappe.db.get_value",
"frappe.safe_decode",
"frappe.whitelist",
"frappe._",
"requests.get",
"frappe.utils.nowdate",
"frappe.get_doc",
"frappe.db.sql",
"frappe.new_doc"
] | [((753, 771), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (769, 771), False, 'import frappe\n'), ((1161, 1179), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (1177, 1179), False, 'import frappe\n'), ((883, 1110), 'frappe.db.sql', 'frappe.db.sql', (['"""select mobile_no, phone from tabContact \... |
# Generated by Django 2.1.5 on 2019-05-04 07:55
import blog.formatChecker
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0040_auto_20190504_0840'),
]
operations = [
migrations.AlterField(
model_name='videos',
... | [
"django.db.models.FileField"
] | [((358, 467), 'django.db.models.FileField', 'models.FileField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': '"""uploads/"""', 'validators': '[blog.formatChecker.file_size]'}), "(blank=True, null=True, upload_to='uploads/', validators=[\n blog.formatChecker.file_size])\n", (374, 467), False, 'from django.... |
import lkml
from time import time_ns
from rich import print
FILE_PATH = "/Users/ladvien/rusty_looker/src/resources/test.lkml"
with open(FILE_PATH, "r") as f:
lookml = f.read()
startTime = time_ns() // 1_000_000
result = lkml.load(lookml)
print(result)
executionTime = (time_ns() // 1_000_000) - startTime
print('... | [
"time.time_ns",
"rich.print",
"lkml.load"
] | [((228, 245), 'lkml.load', 'lkml.load', (['lookml'], {}), '(lookml)\n', (237, 245), False, 'import lkml\n'), ((246, 259), 'rich.print', 'print', (['result'], {}), '(result)\n', (251, 259), False, 'from rich import print\n'), ((194, 203), 'time.time_ns', 'time_ns', ([], {}), '()\n', (201, 203), False, 'from time import ... |
from django.db import models
from django.db.models.signals import pre_save, post_save
from core.utils.constants import Constants
from core.utils.data_convertion import DataConversion
class ExcelFile(models.Model):
file_name = models.FileField(upload_to='uploads')
date_created = models.DateTimeField(auto_now_... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"core.utils.constants.Constants",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((233, 270), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""uploads"""'}), "(upload_to='uploads')\n", (249, 270), False, 'from django.db import models\n'), ((290, 329), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (310, 3... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com <EMAIL>
import re
from urllib import quote
class Url(object):
unsafe_or_hash = r'(?:(?... | [
"urllib.quote"
] | [((5245, 5273), 'urllib.quote', 'quote', (['url', '"""/:?%=&()~",\'$"""'], {}), '(url, \'/:?%=&()~",\\\'$\')\n', (5250, 5273), False, 'from urllib import quote\n')] |
import constants as c
from deck import Deck
from player import Human, RandomAI
class Game:
def __init__(self):
self.deck = None
self.players = None
self.scores = None
self.rounds_left = None
self.game_over = False
def new(self):
self.game_over = F... | [
"deck.Deck",
"player.RandomAI",
"player.Human"
] | [((540, 546), 'deck.Deck', 'Deck', ([], {}), '()\n', (544, 546), False, 'from deck import Deck\n'), ((387, 394), 'player.Human', 'Human', ([], {}), '()\n', (392, 394), False, 'from player import Human, RandomAI\n'), ((396, 406), 'player.RandomAI', 'RandomAI', ([], {}), '()\n', (404, 406), False, 'from player import Hum... |
"""
Clustar module for fitting-related methods.
This module is designed for the 'ClustarData' object. All listed methods take
an input parameter of a 'ClustarData' object and return a 'ClustarData' object
after processing the method. As a result, all changes are localized within the
'ClustarData' object.
Visit <https... | [
"numpy.abs",
"numpy.mean",
"numpy.average",
"scipy.stats.multivariate_normal",
"numpy.max",
"shapely.geometry.Point",
"numpy.array",
"numpy.linspace",
"shapely.geometry.Polygon",
"numpy.cos",
"numpy.std",
"numpy.sin",
"scipy.ndimage.rotate",
"clustar.graph.critical_points"
] | [((1775, 1805), 'numpy.linspace', 'np.linspace', (['(0)', '(np.pi * 2)', '(360)'], {}), '(0, np.pi * 2, 360)\n', (1786, 1805), True, 'import numpy as np\n'), ((3074, 3126), 'numpy.abs', 'np.abs', (['res.data[res.inside[:, 0], res.inside[:, 1]]'], {}), '(res.data[res.inside[:, 0], res.inside[:, 1]])\n', (3080, 3126), Tr... |
import unittest
from datetime import datetime, timezone
from typing import List
from chillow.service.ai.not_killing_itself_ai import NotKillingItselfAI
from chillow.model.action import Action
from chillow.model.cell import Cell
from chillow.model.direction import Direction
from chillow.model.game import Game
from chil... | [
"datetime.datetime",
"chillow.model.game.Game",
"chillow.model.cell.Cell",
"chillow.service.game_service.GameService",
"chillow.service.ai.not_killing_itself_ai.NotKillingItselfAI",
"chillow.model.player.Player"
] | [((545, 587), 'chillow.model.player.Player', 'Player', (['(1)', '(0)', '(0)', 'Direction.up', '(1)', '(True)', '""""""'], {}), "(1, 0, 0, Direction.up, 1, True, '')\n", (551, 587), False, 'from chillow.model.player import Player\n'), ((606, 650), 'chillow.model.player.Player', 'Player', (['(2)', '(4)', '(4)', 'Directio... |
import json
import pytest
@pytest.mark.usefixtures('client', 'headers')
class TestInfection:
def test_infection_region_tc01(self, client, headers):
# db has data BETWEEN 2020-03-22 2020-03-24
region = 'China'
payload = {
'region': region,
'start_date': '2020-03-22... | [
"json.loads",
"pytest.mark.usefixtures"
] | [((30, 74), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""client"""', '"""headers"""'], {}), "('client', 'headers')\n", (53, 74), False, 'import pytest\n'), ((600, 625), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (610, 625), False, 'import json\n'), ((1171, 1196), 'json.load... |
"""Module grouping tests for the pydov.util.owsutil module."""
import copy
import re
import pytest
from numpy.compat import unicode
from owslib.etree import etree
from owslib.fes import (
PropertyIsEqualTo,
FilterRequest,
)
from owslib.iso import MD_Metadata
from owslib.util import nspath_eval
from pydov.util... | [
"owslib.util.nspath_eval",
"owslib.fes.PropertyIsEqualTo",
"pydov.util.owsutil.get_namespace",
"pydov.util.owsutil.wfs_build_getfeature_request",
"pydov.util.owsutil.get_remote_metadata",
"pydov.util.location.Box",
"owslib.etree.etree.fromstring",
"owslib.etree.etree.tostring",
"pydov.util.owsutil.g... | [((1196, 1238), 're.sub', 're.sub', (['"""[ ]+xmlns:[^=]+="[^"]+\\""""', '""""""', 'xml'], {}), '(\'[ ]+xmlns:[^=]+="[^"]+"\', \'\', xml)\n', (1202, 1238), False, 'import re\n'), ((1289, 1341), 're.sub', 're.sub', (['"""<(/?)[^:]+:([^ >]+)([ >])"""', '"""<\\\\1\\\\2\\\\3"""', 'r'], {}), "('<(/?)[^:]+:([^ >]+)([ >])', '... |
# -*- coding: utf-8 -*-
"""
manage
~~~~~~
Flask-Script Manager
"""
import os
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand
from fbone import create_app
from fbone.extensions import db
from fbone.utils import PROJECT_PATH, MALE
from fbone.modules.user import User, ADMI... | [
"fbone.modules.user.commands.ListUsersCommand",
"flask.ext.script.Manager",
"fbone.modules.user.commands.CreateUserCommand",
"fbone.extensions.db.create_all",
"fbone.modules.user.User",
"fbone.extensions.db.session.commit",
"os.path.join",
"fbone.extensions.db.session.add",
"fbone.create_app",
"fb... | [((472, 484), 'fbone.create_app', 'create_app', ([], {}), '()\n', (482, 484), False, 'from fbone import create_app\n'), ((495, 514), 'flask.ext.script.Manager', 'Manager', (['create_app'], {}), '(create_app)\n', (502, 514), False, 'from flask.ext.script import Manager\n'), ((618, 637), 'fbone.modules.user.commands.Crea... |
"""
MDCrane demo
=============
.. seealso::
`Material Design spec,
Crane <https://material.io/design/material-studies/crane.html#>`
Crane is a travel app that helps users find and book travel, lodging, and
restaurant options that match their input preferences.
"""
import os
import sys
from pathlib i... | [
"os.listdir",
"pathlib.Path",
"kivy.lang.Builder.load_string",
"os.path.join",
"os.path.dirname"
] | [((634, 652), 'os.listdir', 'os.listdir', (['KV_DIR'], {}), '(KV_DIR)\n', (644, 652), False, 'import os\n'), ((581, 606), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (596, 606), False, 'import os\n'), ((2840, 2863), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['KV'], {}), '(KV... |
# !/usr/bin/env python
# coding=UTF-8
"""
@Author: <NAME>
@LastEditors: <NAME>
@Description:
@Date: 2021-09-24
@LastEditTime: 2022-04-17
源自OpenAttack的DCESSubstitute
"""
import random
from typing import NoReturn, List, Any, Optional
import numpy as np
from utils.transformations.base import CharSubstitute
from utils... | [
"random.choice",
"numpy.in1d",
"numpy.stack",
"numpy.array",
"utils.assets.fetch"
] | [((739, 752), 'utils.assets.fetch', 'fetch', (['"""dces"""'], {}), "('dces')\n", (744, 752), False, 'from utils.assets import fetch\n'), ((3462, 3479), 'numpy.stack', 'np.stack', (['matches'], {}), '(matches)\n', (3470, 3479), True, 'import numpy as np\n'), ((1286, 1313), 'random.choice', 'random.choice', (['repl_lette... |
# Copyright 2020 Google LLC. 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 law or a... | [
"tfx.orchestration.portable.mlmd.execution_lib.prepare_execution",
"absl.logging.exception",
"tfx.orchestration.portable.mlmd.execution_lib.put_execution",
"absl.logging.warning",
"os.path.dirname",
"tfx.orchestration.portable.mlmd.execution_lib.set_execution_result",
"tfx.types.Artifact",
"copy.deepc... | [((3017, 3144), 'tfx.orchestration.portable.mlmd.execution_lib.put_execution', 'execution_lib.put_execution', (['metadata_handler', 'execution', 'contexts'], {'input_artifacts': 'None', 'output_artifacts': 'output_artifacts'}), '(metadata_handler, execution, contexts,\n input_artifacts=None, output_artifacts=output_... |
# Copyright 2020 Google Research
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
'''
Imported from: https://github.com/google-research/sam
'''
import torch
class SAM(torch.optim.Optimizer):
def __init__(self, params, base_optimizer, rho... | [
"torch.no_grad",
"torch.abs",
"torch.pow"
] | [((722, 737), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (735, 737), False, 'import torch\n'), ((1392, 1407), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1405, 1407), False, 'import torch\n'), ((1894, 1909), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1907, 1909), False, 'import torch\n'), ((... |
import os
from pathlib import Path
import requests
import shutil
import sys
from distutils.version import LooseVersion
import time
from tqdm import tqdm
from docly.parser import parser as py_parser
from docly.tokenizers import tokenize_code_string
from docly import __version__
# from c2nl.objects import Code
UPDATE_... | [
"os.path.exists",
"requests.sessions.Session",
"os.path.getsize",
"docly.parser.parser.get_func_body_and_docstr",
"pathlib.Path",
"pathlib.Path.home",
"requests.get",
"requests.head",
"docly.tokenizers.tokenize_code_string",
"os.mkdir",
"distutils.version.LooseVersion",
"time.time",
"docly.p... | [((2597, 2616), 'os.path.exists', 'os.path.exists', (['dst'], {}), '(dst)\n', (2611, 2616), False, 'import os\n'), ((2946, 2992), 'requests.get', 'requests.get', (['url'], {'headers': 'header', 'stream': '(True)'}), '(url, headers=header, stream=True)\n', (2958, 2992), False, 'import requests\n'), ((3617, 3656), 'docly... |
#importing necessary modules
from sklearn.linear_model import Perceptron
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
import numpy as np
# Data and labels
Xtrain = [[182, 80, 34], [176, 70, 33], [161, 60, 28], [154, 55, 27], [166, 63, 30], [189, 90, 36], [175, 63, 28], ... | [
"sklearn.metrics.accuracy_score",
"sklearn.linear_model.Perceptron",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.argmax"
] | [((815, 837), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {}), '()\n', (835, 837), False, 'from sklearn.neighbors import KNeighborsClassifier\n'), ((851, 863), 'sklearn.linear_model.Perceptron', 'Perceptron', ([], {}), '()\n', (861, 863), False, 'from sklearn.linear_model import Perceptron\n'... |
# Copyright 2022 Xanadu Quantum Technologies 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 applicable law or a... | [
"pennylane.math.argsort",
"pennylane.math.transpose",
"kahypar.Context",
"pennylane.execute",
"pennylane.S",
"pennylane.math.power",
"dataclasses.dataclass",
"inspect.signature",
"pennylane.wires.Wires",
"kahypar.partition",
"networkx.weakly_connected_components",
"pennylane.numpy.array",
"p... | [((57070, 57184), 'pennylane.math.array', 'qml.math.array', (['[[1.0, 1.0, 0.0, 0.0], [-1.0, -1.0, 2.0, 0.0], [-1.0, -1.0, 0.0, 2.0], [1.0,\n -1.0, 0.0, 0.0]]'], {}), '([[1.0, 1.0, 0.0, 0.0], [-1.0, -1.0, 2.0, 0.0], [-1.0, -1.0, \n 0.0, 2.0], [1.0, -1.0, 0.0, 0.0]])\n', (57084, 57184), True, 'import pennylane as ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... | [
"PyQt5.QtWidgets.QProgressDialog"
] | [((676, 697), 'PyQt5.QtWidgets.QProgressDialog', 'QProgressDialog', (['self'], {}), '(self)\n', (691, 697), False, 'from PyQt5.QtWidgets import QWidget, QProgressDialog\n')] |
#Exercício Python 39: Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade, se ele ainda vai se alistar ao serviço militar, se é a hora exata de se alistar ou se já passou do tempo do alistamento. Seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
imp... | [
"datetime.datetime.today"
] | [((348, 373), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (371, 373), False, 'import datetime\n')] |
######################################
# Import and initialize the librarys #
#####################################
from code.pygame_objects import *
from code.algorithm.bubblesort import bubblesort
from code.algorithm.insertionsort import insertionsort
from code.algorithm.bogosort import bogosort
from code.algorithm.m... | [
"code.algorithm.commonFunc.commonFunc.waitAction"
] | [((5149, 5188), 'code.algorithm.commonFunc.commonFunc.waitAction', 'commonFunc.waitAction', (['sort_screen', '(0.5)'], {}), '(sort_screen, 0.5)\n', (5170, 5188), False, 'from code.algorithm.commonFunc import commonFunc\n')] |
#!/usr/bin/env python
import codecs
from os import path
from setuptools import setup
pwd = path.abspath(path.dirname(__file__))
with codecs.open(path.join(pwd, 'README.md'), 'r', encoding='utf8') as input:
long_description = input.read()
version='1.7'
setup(
name='Perdy',
version=version,
license='MIT',
... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((261, 761), 'setuptools.setup', 'setup', ([], {'name': '"""Perdy"""', 'version': 'version', 'license': '"""MIT"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/eddo888/perdy"""', 'download_url': "('https://github.com/eddo888/perdy/archi... |
from tabulate import tabulate
from slack.errors import SlackApiError
import sys
import logging
import slack
class Slackalert:
"""To send cost report on slack."""
def __init__(self, channel=None, slack_token=None):
self.channel = channel
self.slack_token = slack_token
logging.basicConfi... | [
"logging.basicConfig",
"tabulate.tabulate",
"logging.getLogger",
"sys.exc_info",
"slack.WebClient",
"sys.exit"
] | [((302, 344), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARNING'}), '(level=logging.WARNING)\n', (321, 344), False, 'import logging\n'), ((367, 386), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (384, 386), False, 'import logging\n'), ((1037, 1076), 'slack.WebClient', 'slack.W... |
import logging
from abc import ABC, abstractmethod
from pony.orm import db_session, commit
log = logging.getLogger(__name__)
class Importer(ABC):
def __init__(self, TargetEntity):
self.TargetEntity = TargetEntity
@db_session
def truncate(self):
log.info('Truncating target tables...')
... | [
"logging.getLogger",
"pony.orm.commit"
] | [((99, 126), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (116, 126), False, 'import logging\n'), ((380, 388), 'pony.orm.commit', 'commit', ([], {}), '()\n', (386, 388), False, 'from pony.orm import db_session, commit\n')] |
# Generated by Django 3.2.7 on 2021-10-09 18:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pybo', '0005_auto_20211010_0320'),
]
operations = [
migrations.AddField(
model_name='issue',
name='agree_representor... | [
"django.db.models.CharField"
] | [((344, 398), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(20)', 'null': '(True)'}), "(default='', max_length=20, null=True)\n", (360, 398), False, 'from django.db import migrations, models\n'), ((534, 588), 'django.db.models.CharField', 'models.CharField', ([], {'default... |
import json
import os
def get_file_index(filesProcessed):
new_dict = {}
for f in filesProcessed:
new_dict[f]={"framerate": 30.0, "selected": {"0": 1, "9000": 0}}
return new_dict
ref = json.load(open("/home/lijun/downloads/kf1_meta/references/kf1_all.json","r"))
files = ref["filesProcessed"]
print... | [
"json.dump"
] | [((597, 647), 'json.dump', 'json.dump', (['output', 'j'], {'indent': '(2)', 'ensure_ascii': '(False)'}), '(output, j, indent=2, ensure_ascii=False)\n', (606, 647), False, 'import json\n'), ((801, 854), 'json.dump', 'json.dump', (['file_dict', 'j'], {'indent': '(2)', 'ensure_ascii': '(False)'}), '(file_dict, j, indent=2... |
from enum import Enum, auto
import funcy as fn
import numpy as np
from monotone_bipartition import rectangles as mdtr
from monotone_bipartition import refine
EPS = 1e-4
class SearchResultType(Enum):
TRIVIALLY_FALSE = auto()
TRIVIALLY_TRUE = auto()
NON_TRIVIAL = auto()
def diagonal_convex_comb(r):
... | [
"enum.auto",
"funcy.pluck",
"funcy.compose",
"numpy.array",
"monotone_bipartition.rectangles.unit_rec"
] | [((226, 232), 'enum.auto', 'auto', ([], {}), '()\n', (230, 232), False, 'from enum import Enum, auto\n'), ((254, 260), 'enum.auto', 'auto', ([], {}), '()\n', (258, 260), False, 'from enum import Enum, auto\n'), ((279, 285), 'enum.auto', 'auto', ([], {}), '()\n', (283, 285), False, 'from enum import Enum, auto\n'), ((65... |
from flask import url_for
from flaskcbv.view import View
from flaskcbv.conf import settings
from misc.mixins import HelperMixin
from misc.views import JSONView
class authView(JSONView):
def helper(self):
return """Authorizaion handler
Use "login" and "passwd" arguments by GET or POST to get ses... | [
"flaskcbv.conf.settings._BB_CLIENT.session",
"flaskcbv.conf.settings._BB_CLIENT.login"
] | [((749, 792), 'flaskcbv.conf.settings._BB_CLIENT.login', 'settings._BB_CLIENT.login', (['username', 'passwd'], {}), '(username, passwd)\n', (774, 792), False, 'from flaskcbv.conf import settings\n'), ((1413, 1449), 'flaskcbv.conf.settings._BB_CLIENT.session', 'settings._BB_CLIENT.session', (['session'], {}), '(session)... |
import morepath
from webtest import TestApp as Client
def test_implicit_function():
class app(morepath.App):
@morepath.dispatch_method()
def one(self):
return "Default one"
@morepath.dispatch_method()
def two(self):
return "Default two"
@app.path(path=... | [
"morepath.dispatch_method"
] | [((124, 150), 'morepath.dispatch_method', 'morepath.dispatch_method', ([], {}), '()\n', (148, 150), False, 'import morepath\n'), ((217, 243), 'morepath.dispatch_method', 'morepath.dispatch_method', ([], {}), '()\n', (241, 243), False, 'import morepath\n'), ((816, 842), 'morepath.dispatch_method', 'morepath.dispatch_met... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
convolve_grayscale_padding = __import__(
'2-convolve_grayscale_padding').convolve_grayscale_padding
if __name__ == '__main__':
dataset = np.load('../../supervised_learning/data/MNIST.npz')
images = dataset['X_train']
print(ima... | [
"matplotlib.pyplot.imshow",
"numpy.array",
"numpy.load",
"matplotlib.pyplot.show"
] | [((223, 274), 'numpy.load', 'np.load', (['"""../../supervised_learning/data/MNIST.npz"""'], {}), "('../../supervised_learning/data/MNIST.npz')\n", (230, 274), True, 'import numpy as np\n'), ((344, 390), 'numpy.array', 'np.array', (['[[1, 0, -1], [1, 0, -1], [1, 0, -1]]'], {}), '([[1, 0, -1], [1, 0, -1], [1, 0, -1]])\n'... |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
data=pd.read_csv(path)
data.rename(columns={'Total':'Total_Medals'},inplace =True)
data.head(10)
#Code starts here
# --------------
try:
data['Better_Event'] = np.where(... | [
"pandas.Series",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"numpy.where",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame"
] | [((142, 159), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (153, 159), True, 'import pandas as pd\n'), ((2373, 2467), 'pandas.Series', 'pd.Series', (["(data_1['Gold_Total'] * 3 + data_1['Silver_Total'] * 2 + data_1['Bronze_Total']\n )"], {}), "(data_1['Gold_Total'] * 3 + data_1['Silver_Total'] * 2 +... |
# Generated by Django 2.2.4 on 2019-08-14 09:13
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("order", "0071_order_gift_cards")]
operations = [
migrations.RenameField(
model_name="order",
old... | [
"django.db.migrations.RenameField",
"django.db.models.CharField"
] | [((249, 368), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""order"""', 'old_name': '"""shipping_price_gross"""', 'new_name': '"""shipping_price_gross_amount"""'}), "(model_name='order', old_name='shipping_price_gross',\n new_name='shipping_price_gross_amount')\n", (271, 368), ... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((3460, 3485), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (3479, 3485), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
#!/usr/bin/env python3
import os
import sys
import textwrap
self_path = os.path.dirname(os.path.realpath(__file__));
f = open(self_path + "/unicode/CaseFolding.txt", "r")
status_list = [ "C", "F" ]
folding_list = [ dict(), dict(), dict() ]
# Filter the foldings for "full" folding.
for line in f:
comment_off =... | [
"os.path.realpath",
"sys.stdout.write"
] | [((91, 117), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n'), ((4045, 4071), 'sys.stdout.write', 'sys.stdout.write', (['"""\n};\n"""'], {}), "('\\n};\\n')\n", (4061, 4071), False, 'import sys\n'), ((4321, 4347), 'sys.stdout.write', 'sys.stdout.write', (['"""... |
from controller import Robot
from controller import Motor
from controller import PositionSensor
from controller import Robot, DistanceSensor, GPS, Camera, Receiver, Emitter
import cv2
import numpy as np
import math
import time
robot = Robot()
timeStep = 32
tile_size = 0.12
speed = 6.28
media_baldoza = 0.06
estado = 1
... | [
"controller.Robot"
] | [((236, 243), 'controller.Robot', 'Robot', ([], {}), '()\n', (241, 243), False, 'from controller import Robot, DistanceSensor, GPS, Camera, Receiver, Emitter\n')] |
# Generated by Django 3.0.7 on 2020-11-25 13:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('drip', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='querysetrule',
name='rule_type',
... | [
"django.db.models.CharField"
] | [((329, 418), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('or', 'Or'), ('and', 'And')]", 'default': '"""and"""', 'max_length': '(3)'}), "(choices=[('or', 'Or'), ('and', 'And')], default='and',\n max_length=3)\n", (345, 418), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
"""User functions to streamline working with selected pymer4 LMER fit
attributes from lme4::lmer and lmerTest for ``fitgrid.lmer`` grids.
"""
import functools
import re
import warnings
import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib import pyplot as plt
import f... | [
"fitgrid.lmer",
"matplotlib.ticker.FixedFormatter",
"matplotlib.colors.ListedColormap",
"numpy.zeros",
"functools.partial",
"fitgrid.epochs_from_dataframe",
"warnings.warn",
"re.sub",
"pandas.concat"
] | [((1866, 1907), 'functools.partial', 'functools.partial', (['fitgrid.lmer'], {}), '(fitgrid.lmer, **kwargs)\n', (1883, 1907), False, 'import functools\n'), ((2069, 2106), 'pandas.concat', 'pd.concat', (['coefs'], {'keys': 'levels', 'axis': '(1)'}), '(coefs, keys=levels, axis=1)\n', (2078, 2106), True, 'import pandas as... |
# Copyright (c) 2019 Graphcore Ltd. 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 l... | [
"logging.getLogger",
"os.path.exists",
"subprocess.check_output",
"json.loads",
"pickle.dump",
"os.makedirs",
"os.path.join",
"pickle.load",
"numpy.take",
"numpy.stack",
"numpy.random.randint",
"numpy.concatenate",
"numpy.full",
"numpy.arange"
] | [((1064, 1083), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1073, 1083), False, 'from logging import getLogger\n'), ((6190, 6216), 'os.path.exists', 'os.path.exists', (['cache_file'], {}), '(cache_file)\n', (6204, 6216), False, 'import os\n'), ((9633, 9691), 'os.path.join', 'os.path.join', ([... |
import json
import numpy as np
import pdb
import torch
from ray_utils import get_rays, get_ray_directions, get_ndc_rays
BOX_OFFSETS = torch.tensor([[[i,j,k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]],
device='cuda')
SQR_OFFSETS = torch.tensor([[[i,j] for i in [0, 1] for j in [0,... | [
"numpy.tan",
"torch.all",
"ray_utils.get_rays",
"torch.floor",
"ray_utils.get_ndc_rays",
"torch.tensor",
"pdb.set_trace",
"json.load",
"ray_utils.get_ray_directions",
"torch.FloatTensor",
"torch.clamp"
] | [((137, 231), 'torch.tensor', 'torch.tensor', (['[[[i, j, k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]]'], {'device': '"""cuda"""'}), "([[[i, j, k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]],\n device='cuda')\n", (149, 231), False, 'import torch\n'), ((271, 342), 'torch.tensor', 'torch.tensor', (['[[[i... |
import os
import cv2
import time
import json
import random
import inspect
import argparse
import numpy as np
from tqdm import tqdm
from dataloaders import make_data_loader
from models.sync_batchnorm.replicate import patch_replication_callback
from models.vs_net import *
from utils.loss import loss_dict
from utils.lr_s... | [
"dataloaders.make_data_loader",
"numpy.array",
"numpy.right_shift",
"numpy.mean",
"argparse.ArgumentParser",
"utils.utils.pnp",
"numpy.random.seed",
"torch.autograd.Variable",
"utils.metrics.Evaluator",
"utils.summaries.TensorboardSummary",
"utils.utils.evaluate_vertex_v2",
"os.path.isfile",
... | [((585, 618), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (608, 618), False, 'import warnings\n'), ((13676, 13753), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Landmark Segmentation Training"""'}), "(description='PyTorch Landma... |
import numpy as np
import gzip
import pickle
import os
import urllib.request
class MNIST:
host = 'http://yann.lecun.com/exdb/mnist/'
filenames = {
'train': ('train-images-idx3-ubyte.gz', 'train-labels-idx1-ubyte.gz'),
'test': ('t10k-images-idx3-ubyte.gz', 't10k-labels-idx1-ubyte.gz'),
}
dataset_filen... | [
"pickle.dump",
"os.path.dirname",
"pickle.load",
"os.path.join"
] | [((464, 489), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (479, 489), False, 'import os\n'), ((1514, 1554), 'os.path.join', 'os.path.join', (['self.current_dir', 'filename'], {}), '(self.current_dir, filename)\n', (1526, 1554), False, 'import os\n'), ((1153, 1206), 'os.path.join', 'os.path... |
import os
import numpy as np
import time
import multiprocessing as mp
import csv
import socket
import datetime
import math
import glob
from pypushexp import PushSim
# # input - [recorded item]
# [weight] : 48
# [height] : 160
# [crouch_angle] (deg)
# [step_length_ratio]
# [halfcycle_duration_rati... | [
"os.path.exists",
"os.makedirs",
"numpy.random.multivariate_normal",
"math.sqrt",
"multiprocessing.Manager",
"numpy.diag",
"pypushexp.PushSim",
"datetime.datetime.now",
"re.findall",
"os.path.abspath",
"socket.gethostname",
"time.time",
"glob.glob",
"numpy.set_printoptions"
] | [((5920, 5956), 'math.sqrt', 'math.sqrt', (['stride_vars[launch_order]'], {}), '(stride_vars[launch_order])\n', (5929, 5956), False, 'import math\n'), ((6255, 6290), 'math.sqrt', 'math.sqrt', (['speed_vars[launch_order]'], {}), '(speed_vars[launch_order])\n', (6264, 6290), False, 'import math\n'), ((9026, 9037), 'time.... |
from django.contrib import admin
from .models import Room, Topic, Message, User
admin.site.register(Room)
admin.site.register(Topic)
admin.site.register(Message)
admin.site.register(User)
| [
"django.contrib.admin.site.register"
] | [((81, 106), 'django.contrib.admin.site.register', 'admin.site.register', (['Room'], {}), '(Room)\n', (100, 106), False, 'from django.contrib import admin\n'), ((107, 133), 'django.contrib.admin.site.register', 'admin.site.register', (['Topic'], {}), '(Topic)\n', (126, 133), False, 'from django.contrib import admin\n')... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.contrib.training.python.training.hparam.HParams",
"six.iteritems",
"tensorflow.python.platform.test.main"
] | [((7901, 7912), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (7910, 7912), False, 'from tensorflow.python.platform import test\n'), ((1075, 1092), 'six.iteritems', 'six.iteritems', (['d1'], {}), '(d1)\n', (1088, 1092), False, 'import six\n'), ((1207, 1223), 'tensorflow.contrib.training.python.... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Utilities to create/drop views.
Based on a recipe published in:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views
"""
from sqlalchemy.sql import table... | [
"sqlalchemy.sql.table",
"sqlalchemy.ext.compiler.sql_compiler.process",
"sqlalchemy.ext.compiler.compiles"
] | [((797, 840), 'sqlalchemy.ext.compiler.compiles', 'compiler.compiles', (['CreateView', '"""postgresql"""'], {}), "(CreateView, 'postgresql')\n", (814, 840), False, 'from sqlalchemy.ext import compiler\n'), ((1365, 1404), 'sqlalchemy.ext.compiler.compiles', 'compiler.compiles', (['CreateView', '"""sqlite"""'], {}), "(Cr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'eugene'
'''
MIT License
Copyright (c) 2015 <NAME> (email : <EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwa... | [
"cgen.even_space",
"cgen.FileCopyUtil",
"cgen.CBASEGenerator.__init__",
"cgen.CBASEGenerator.__loadtemplates_firstfiltering__",
"cgen.caps",
"cgen.camel_case_small",
"cgen.__getnextalphabet__",
"cgen.__resetalphabet__"
] | [((11848, 11942), 'cgen.CBASEGenerator.__init__', 'CBASEGenerator.__init__', (['self', 'inputfiledir', 'outputfiledir', 'language', 'author', 'group', 'brief'], {}), '(self, inputfiledir, outputfiledir, language, author,\n group, brief)\n', (11871, 11942), False, 'from cgen import CBASEGenerator, CCodeModel, alpha, ... |
from flask_mail import Message
from flask import render_template
from flask_start.extensions import mail
'''
from threading import Thread
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
'''
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject... | [
"flask.render_template",
"flask_mail.Message",
"flask_start.extensions.mail.send"
] | [((305, 359), 'flask_mail.Message', 'Message', (['subject'], {'sender': 'sender', 'recipients': 'recipients'}), '(subject, sender=sender, recipients=recipients)\n', (312, 359), False, 'from flask_mail import Message\n'), ((414, 428), 'flask_start.extensions.mail.send', 'mail.send', (['msg'], {}), '(msg)\n', (423, 428),... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import division
import os
import numpy
from io import BytesIO
from matplotlib import pyplot
import requests
import torch
from PIL import Image
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
from maskrcnn... | [
"torch.jit.trace",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.show",
"torch.full",
"torch.stack",
"os.path.join",
"io.BytesIO",
"maskrcnn_benchmark.config.cfg.merge_from_list",
"torch.min",
"requests.get",
"torch.tensor",
"predictor.COCODemo",
"numpy.array",
"torch.ops.maskrcnn_benchma... | [((673, 717), 'maskrcnn_benchmark.config.cfg.merge_from_list', 'cfg.merge_from_list', (["['MODEL.DEVICE', 'cpu']"], {}), "(['MODEL.DEVICE', 'cpu'])\n", (692, 717), False, 'from maskrcnn_benchmark.config import cfg\n'), ((722, 734), 'maskrcnn_benchmark.config.cfg.freeze', 'cfg.freeze', ([], {}), '()\n', (732, 734), Fals... |
from django.conf.urls import patterns, url
from temperature import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^save_temp_reading$', views.save_temp_reading, name='save_temp_reading'),
)
| [
"django.conf.urls.url"
] | [((113, 149), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (116, 149), False, 'from django.conf.urls import patterns, url\n'), ((161, 238), 'django.conf.urls.url', 'url', (['"""^save_temp_reading$"""', 'views.save_temp_reading'], {'name': ... |
"""
File: commands/calc.py
Purpose: Performs calculations in response to user input, and outputs the result
"""
from sys import argv
import click
from calculator import *
from models import History
from models.Config import Config
from help_menus import calc_help
@click.group("calc", invoke_without_command=True)
@... | [
"click.argument",
"models.Config.Config.setup",
"click.group",
"click.option",
"help_menus.calc_help",
"click.echo",
"models.History.get"
] | [((270, 318), 'click.group', 'click.group', (['"""calc"""'], {'invoke_without_command': '(True)'}), "('calc', invoke_without_command=True)\n", (281, 318), False, 'import click\n'), ((320, 441), 'click.option', 'click.option', (['"""-M"""', '"""--mass-spec"""'], {'is_flag': '(True)', 'default': '(False)', 'help': '"""Ge... |
"""LS-Dyna license server interface."""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import LicenseManagerBadServerOutput
from lm_agent.parsing import lsdyna
from lm_agent.server_interfaces.license_server_interface import LicenseReportItem, LicenseServerInterface
from lm_agent.server_int... | [
"lm_agent.exceptions.LicenseManagerBadServerOutput",
"lm_agent.server_interfaces.utils.run_command",
"lm_agent.server_interfaces.license_server_interface.LicenseReportItem"
] | [((2371, 2546), 'lm_agent.server_interfaces.license_server_interface.LicenseReportItem', 'LicenseReportItem', ([], {'product_feature': 'product_feature', 'used': "current_feature_item['used']", 'total': "current_feature_item['total']", 'used_licenses': "current_feature_item['uses']"}), "(product_feature=product_feature... |
#!/usr/bin/env python3
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
import argparse
import os
import pickle
import shutil
import numpy as np
import PIL.Image
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
TB_DIR = os.path.join(os.getcwd(), "gan-tb")
SPRITE_IMA... | [
"os.path.exists",
"tensorflow.device",
"tensorflow.contrib.tensorboard.plugins.projector.ProjectorConfig",
"numpy.sqrt",
"os.makedirs",
"argparse.ArgumentParser",
"tensorflow.Variable",
"tensorflow.contrib.tensorboard.plugins.projector.visualize_embeddings",
"tensorflow.Session",
"pickle.load",
... | [((334, 368), 'os.path.join', 'os.path.join', (['TB_DIR', '"""sprite.png"""'], {}), "(TB_DIR, 'sprite.png')\n", (346, 368), False, 'import os\n'), ((287, 298), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (296, 298), False, 'import os\n'), ((473, 487), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (484, 487), Fals... |
from datetime import date
now = date.today()
print('The date today is', now, now.strftime("%A"))
| [
"datetime.date.today"
] | [((32, 44), 'datetime.date.today', 'date.today', ([], {}), '()\n', (42, 44), False, 'from datetime import date\n')] |
import tvm
import sys
import time
import numpy as np
from tvm.tensor_graph.testing.models import resnet
from tvm.tensor_graph.core import ForwardGraph, BackwardGraph, compute, \
GraphTensor, GraphOp, PyTIRGraph
from tvm.tensor_graph.nn import CELoss, SGD
from tvm.tensor_graph.core.schedul... | [
"tvm.tensor_graph.core.tuner.RandomForwardTuner",
"tvm.tensor_graph.core.schedule_generator.form_cut_candidates",
"tvm.tensor_graph.core.utils.flatten_tir_graph",
"numpy.array",
"tvm.tensor_graph.core.GraphTensor",
"tvm.tensor_graph.core.ForwardGraph",
"tvm.tensor_graph.nn.CELoss",
"tvm.tensor_graph.c... | [((1232, 1265), 'tvm.tensor_graph.testing.models.resnet.resnet50', 'resnet.resnet50', ([], {'num_classes': '(1000)'}), '(num_classes=1000)\n', (1247, 1265), False, 'from tvm.tensor_graph.testing.models import resnet\n'), ((1281, 1330), 'tvm.tensor_graph.core.GraphTensor', 'GraphTensor', (['img_shape'], {'dtype': 'dtype... |
import datetime
import logging
import os
import re
from collections import OrderedDict
from html import escape
from html.parser import HTMLParser
from io import StringIO
import docutils
import docutils.core
import docutils.io
from docutils.parsers.rst.languages import get_language as get_docutils_lang
from docutils.wr... | [
"logging.getLogger",
"pelican.contents.Tag",
"re.compile",
"typogrify.filters.typogrify",
"html.escape",
"datetime.datetime",
"os.path.split",
"pelican.plugins.signals.readers_init.send",
"docutils.parsers.rst.languages.get_language",
"io.StringIO",
"os.path.relpath",
"docutils.writers.html4cs... | [((1866, 1893), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1883, 1893), False, 'import logging\n'), ((23231, 23596), 're.compile', 're.compile', (['"""\n (?:\n # src before alt\n <img\n [^\\\\>]*\n src=([\'"])(.*?)\\\\1\n ... |
# coding: utf-8
from __future__ import division, print_function
# Standard library
import time
# Third-party
import matplotlib.pyplot as plt
import numpy as np
from scipy.misc import derivative
from astropy.extern.six.moves import cPickle as pickle
import pytest
# Project
from ..io import load
from ..core import C... | [
"numpy.allclose",
"numpy.repeat",
"astropy.extern.six.moves.cPickle.dump",
"pytest.mark.skip",
"numpy.ascontiguousarray",
"scipy.misc.derivative",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.close",
"numpy.sum",
"numpy.vstack",
"time.time",
"numpy.meshgrid",
"numpy.all",
"astropy... | [((553, 579), 'numpy.array', 'np.array', (['point'], {'copy': '(True)'}), '(point, copy=True)\n', (561, 579), True, 'import numpy as np\n'), ((658, 700), 'scipy.misc.derivative', 'derivative', (['wraps', 'point[dim_ix]'], {}), '(wraps, point[dim_ix], **kwargs)\n', (668, 700), False, 'from scipy.misc import derivative\n... |
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import json
import time
import pandas as pd
import tensorflow as tf
import numpy as np
import math
from decimal import Decimal
import matplotlib.pyplot as plt
from agents.ornstein_uhlenbeck import OrnsteinUhlenbeckActionNoise
eps=10e-8
epochs=0... | [
"pandas.Series",
"numpy.mean",
"data.download_data.DataDownloader",
"argparse.ArgumentParser",
"decimal.Decimal",
"agents.Winner.WINNER",
"matplotlib.pyplot.plot",
"numpy.sum",
"agents.UCRP.UCRP",
"numpy.zeros",
"numpy.std",
"json.load",
"math.exp",
"agents.Losser.LOSSER",
"pandas.concat... | [((5269, 5281), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (5279, 5281), True, 'import matplotlib.pyplot as plt\n'), ((5287, 5297), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5295, 5297), True, 'import matplotlib.pyplot as plt\n'), ((8870, 8993), 'argparse.ArgumentParser', 'ArgumentParser... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2016-03-16 11:28:27
# @Last Modified by: oesteban
# @Last Modified time: 2016-04-04 13:50:50
"""
Batch export freesurfer results to animated gifs
"""
from __future__ import absolute_import
from __future__ import division
from __future__ im... | [
"os.listdir",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.average",
"nibabel.load",
"os.path.join",
"os.environ.copy",
"os.getcwd",
"numpy.argwhere",
"tempfile.mkdtemp",
"os.path.basename",
"subprocess.call",
"shutil.rmtree",
"os.path.abspath"
] | [((752, 878), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Batch export freesurfer results to animated gifs"""', 'formatter_class': 'RawTextHelpFormatter'}), "(description=\n 'Batch export freesurfer results to animated gifs', formatter_class=\n RawTextHelpFormatter)\n", (766, 878), False... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic import (
ListView,
DetailView,
CreateView,
UpdateView,
DeleteView,
)
from django.shortcuts import render
from django.db.models import Count
from django.d... | [
"django.shortcuts.render",
"django.db.models.Count",
"django.db.models.functions.Lower",
"django.urls.reverse_lazy"
] | [((1590, 1696), 'django.shortcuts.render', 'render', (['request', '"""blog/blog_home.html"""', "{'blogs': blogs, 'tags': tag_sorted, 'blog_count': blog_count}"], {}), "(request, 'blog/blog_home.html', {'blogs': blogs, 'tags': tag_sorted,\n 'blog_count': blog_count})\n", (1596, 1696), False, 'from django.shortcuts im... |
import sys
from typing import Generator
from typing import List
from typing import Optional
import pytest
from _pytest.pytester import Pytester
def test_one_dir_pythonpath(pytester: Pytester, file_structure) -> None:
pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub\n")
result = pytester.runpytest("... | [
"sys.path.copy",
"pytest.hookimpl"
] | [((1463, 1511), 'pytest.hookimpl', 'pytest.hookimpl', ([], {'hookwrapper': '(True)', 'tryfirst': '(True)'}), '(hookwrapper=True, tryfirst=True)\n', (1478, 1511), False, 'import pytest\n'), ((1637, 1652), 'sys.path.copy', 'sys.path.copy', ([], {}), '()\n', (1650, 1652), False, 'import sys\n'), ((1691, 1706), 'sys.path.c... |
#!/usr/bin/env python2
import paho.mqtt.client as mqtt
import time
import Adafruit_DHT
from configparser import ConfigParser
import json
config = ConfigParser(delimiters=('=', ))
config.read('config.ini')
sensor_type = config['sensor'].get('type', 'dht22').lower()
if sensor_type == 'dht22':
sensor = Adafruit_DH... | [
"configparser.ConfigParser",
"paho.mqtt.client.Client",
"json.dumps",
"time.sleep",
"Adafruit_DHT.read_retry"
] | [((148, 179), 'configparser.ConfigParser', 'ConfigParser', ([], {'delimiters': "('=',)"}), "(delimiters=('=',))\n", (160, 179), False, 'from configparser import ConfigParser\n'), ((1024, 1037), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (1035, 1037), True, 'import paho.mqtt.client as mqtt\n'), ((1339, ... |
import unittest
import mplisp.evaluator as evaluator
class TestListMap(unittest.TestCase):
def map_test(self):
input1 = """
(map (lambda (x) (* 2 x)) (list 1 2 3))
"""
output1 = list(evaluator.evaluate(input1))
self.assertEqual(output1[0], [2, 4, 6])
def map_test_2(... | [
"mplisp.evaluator.evaluate"
] | [((223, 249), 'mplisp.evaluator.evaluate', 'evaluator.evaluate', (['input1'], {}), '(input1)\n', (241, 249), True, 'import mplisp.evaluator as evaluator\n'), ((475, 501), 'mplisp.evaluator.evaluate', 'evaluator.evaluate', (['input1'], {}), '(input1)\n', (493, 501), True, 'import mplisp.evaluator as evaluator\n')] |
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django_redis.cache import RedisCache as PlainRedisCache
from redis_lock import Lock
from redis_lock import reset_all
class RedisCache(PlainRedisCache):
@property
def __client(self):
try:
return self.client.get_client()
... | [
"redis_lock.Lock",
"redis_lock.reset_all"
] | [((611, 657), 'redis_lock.Lock', 'Lock', (['self.__client', 'key'], {'expire': 'expire', 'id': 'id'}), '(self.__client, key, expire=expire, id=id)\n', (615, 657), False, 'from redis_lock import Lock\n'), ((1898, 1922), 'redis_lock.reset_all', 'reset_all', (['self.__client'], {}), '(self.__client)\n', (1907, 1922), Fals... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("h4ValidData")
# initialize MessageLogger
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.Path"
] | [((52, 78), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""h4ValidData"""'], {}), "('h4ValidData')\n", (63, 78), True, 'import FWCore.ParameterSet.Config as cms\n'), ((1151, 1180), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['process.tbValidData'], {}), '(process.tbValidData)\n', (1159, 1180), True, 'i... |
import asyncio
from query_graphql import query_artifact_domains, query_weapon_materials_book
class Domains:
leylines = {
"Blossom of Revelation": "Character EXP Materials",
"Blossom of Wealth": "Mora"
}
weapon_domains = {}
talent_domains = {}
artifact_domains = {}
trounce_doma... | [
"query_graphql.query_artifact_domains",
"query_graphql.query_weapon_materials_book"
] | [((1407, 1431), 'query_graphql.query_artifact_domains', 'query_artifact_domains', ([], {}), '()\n', (1429, 1431), False, 'from query_graphql import query_artifact_domains, query_weapon_materials_book\n'), ((1454, 1483), 'query_graphql.query_weapon_materials_book', 'query_weapon_materials_book', ([], {}), '()\n', (1481,... |
# __author__ = 'Dave'
import cv2
from skimage import io
from skimage.transform import probabilistic_hough_line
import matplotlib.pyplot as plt
import os
import warnings
import random
import numpy as np
warnings.filterwarnings('ignore', category=RuntimeWarning)
class CorrectImage(object):
def __init__(self):
... | [
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.min",
"skimage.transform.probabilistic_hough_line",
"numpy.isinf",
"cv2.waitKey",
"skimage.io.imread",
"numpy.isnan",
"cv2.Canny",
"cv2.createTrackbar",
"cv2.namedWindow",
"warnings.filter... | [((205, 263), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (228, 263), False, 'import warnings\n'), ((601, 631), 'os.path.join', 'os.path.join', (['self.path', 'image'], {}), '(self.path, image)\n', (613, 631), False, ... |
# -*- coding: utf-8 -*-
# @Time : 2021/9/18 下午11:19
# @Author : DaiPuWei
# @Email : <EMAIL>
# @File : loss.py
# @Software: PyCharm
"""
这是YOLO模型的损失函数的定义脚本,目前目标分类损失支持smooth Label;
目标定位损失支持均方差损失、GIOU Loss、DIOU Loss和CIOU Loss;
"""
import math
import tensorflow as tf
from tensorflow.keras import backend a... | [
"tensorflow.keras.backend.log",
"tensorflow.keras.backend.floatx",
"tensorflow.keras.backend.epsilon",
"tensorflow.boolean_mask",
"tensorflow.keras.backend.dtype",
"tensorflow.keras.backend.sigmoid",
"tensorflow.while_loop",
"tensorflow.keras.backend.expand_dims",
"tensorflow.keras.backend.arange",
... | [((1639, 1670), 'tensorflow.keras.backend.concatenate', 'K.concatenate', (['[grid_x, grid_y]'], {}), '([grid_x, grid_y])\n', (1652, 1670), True, 'from tensorflow.keras import backend as K\n'), ((1970, 2057), 'tensorflow.keras.backend.reshape', 'K.reshape', (['feats', '[-1, grid_shape[0], grid_shape[1], num_anchors, num... |
#!/usr/bin/env python
"""Virtual filesystem module based on pyfsntfs."""
import stat
from typing import Any, Callable, Dict, Iterable, Optional, Text, Type
import pyfsntfs
from grr_response_client import client_utils
from grr_response_client.vfs_handlers import base as vfs_base
from grr_response_core.lib import rdfv... | [
"grr_response_client.client_utils.GetRawDevice",
"grr_response_core.lib.utils.TimeBasedCache",
"grr_response_core.lib.rdfvalues.client_fs.StatEntry",
"grr_response_client.client_utils.LocalPathToCanonicalPath",
"grr_response_core.lib.utils.JoinPath",
"pyfsntfs.volume"
] | [((551, 573), 'grr_response_core.lib.utils.TimeBasedCache', 'utils.TimeBasedCache', ([], {}), '()\n', (571, 573), False, 'from grr_response_core.lib import utils\n'), ((6200, 6225), 'grr_response_core.lib.rdfvalues.client_fs.StatEntry', 'rdf_client_fs.StatEntry', ([], {}), '()\n', (6223, 6225), True, 'from grr_response... |
from encapsulation_04.exe.pizza_maker.project.dough import Dough
from encapsulation_04.exe.pizza_maker.project.pizza import Pizza
from encapsulation_04.exe.pizza_maker.project.topping import Topping
tomato_topping = Topping("Tomato", 60)
print(tomato_topping.topping_type)
print(tomato_topping.weight)
mushrooms_toppin... | [
"encapsulation_04.exe.pizza_maker.project.dough.Dough",
"encapsulation_04.exe.pizza_maker.project.pizza.Pizza",
"encapsulation_04.exe.pizza_maker.project.topping.Topping"
] | [((217, 238), 'encapsulation_04.exe.pizza_maker.project.topping.Topping', 'Topping', (['"""Tomato"""', '(60)'], {}), "('Tomato', 60)\n", (224, 238), False, 'from encapsulation_04.exe.pizza_maker.project.topping import Topping\n'), ((324, 347), 'encapsulation_04.exe.pizza_maker.project.topping.Topping', 'Topping', (['""... |
import cv2
import numpy as np
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
def to_cpu(tensor):
return tensor.detach().cpu()
def xywh2xyxy(x):
''' Convert bounding box from [x, y, w, h] to [x1, y1, x2, y2]
:param x: bounding boxes array
:return: Converted bounding box array
'... | [
"numpy.fromfile",
"torch.nn.ZeroPad2d",
"torch.nn.Sequential",
"torch.max",
"torch.exp",
"torch.min",
"torch.from_numpy",
"torch.nn.MSELoss",
"numpy.array",
"torch.sum",
"torch.nn.functional.interpolate",
"torch.arange",
"os.path.exists",
"torch.nn.BatchNorm2d",
"torch.nn.ModuleList",
... | [((1247, 1270), 'torch.max', 'torch.max', (['b1_x1', 'b2_x1'], {}), '(b1_x1, b2_x1)\n', (1256, 1270), False, 'import torch\n'), ((1288, 1311), 'torch.max', 'torch.max', (['b1_y1', 'b2_y1'], {}), '(b1_y1, b2_y1)\n', (1297, 1311), False, 'import torch\n'), ((1329, 1352), 'torch.min', 'torch.min', (['b1_x2', 'b2_x2'], {})... |
import torch.nn as nn
import torch.optim as optim
from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k
from ltr.data import processing, sampler, LTRLoader
import ltr.models.bbreg.atom as atom_models
from ltr import actors
from ltr.trainers import LTRTrainer
import ltr.data.transforms as tfm
def run(settings)... | [
"ltr.dataset.Got10k",
"ltr.data.processing.ATOMProcessing",
"ltr.actors.AtomActor",
"ltr.trainers.LTRTrainer",
"ltr.dataset.Lasot",
"ltr.data.transforms.ToGrayscale",
"ltr.data.transforms.Normalize",
"torch.optim.lr_scheduler.StepLR",
"ltr.models.bbreg.atom.atom_resnet18",
"ltr.data.sampler.ATOMSa... | [((969, 1013), 'ltr.dataset.Lasot', 'Lasot', (['settings.env.lasot_dir'], {'split': '"""train"""'}), "(settings.env.lasot_dir, split='train')\n", (974, 1013), False, 'from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k\n'), ((1033, 1082), 'ltr.dataset.Got10k', 'Got10k', (['settings.env.got10k_dir'], {'split':... |
""" Activity list window """
import tkinter
import tkinter.ttk
from model import activity, invoice
from model.activity import Activity
from model.company import Company
from gui.activity import ActivityWindow
from gui.activity_split import ActivitySplit
from gui.invoice import InvoiceWindow
from gui.popup_file import p... | [
"model.company.Company",
"model.activity.Activity.delete_activities",
"gui.activity_split.ActivitySplit",
"model.activity.Activity",
"gui.invoice.InvoiceWindow",
"tkinter.Toplevel.__init__",
"tkinter.Button",
"gui.activity.ActivityWindow",
"model.activity.Activity.get_activities",
"model.invoice.g... | [((681, 712), 'tkinter.Toplevel.__init__', 'tkinter.Toplevel.__init__', (['self'], {}), '(self)\n', (706, 712), False, 'import tkinter\n'), ((839, 865), 'tkinter.ttk.Treeview', 'tkinter.ttk.Treeview', (['self'], {}), '(self)\n', (859, 865), False, 'import tkinter\n'), ((1573, 1632), 'tkinter.Button', 'tkinter.Button', ... |
import os
import shutil
import unittest
from base64 import b64encode
from sonLib.bioio import TestStatus
from sonLib.bioio import getTempFile
from sonLib.bioio import getTempDirectory
from sonLib.bioio import system
from toil.job import Job
from toil.common import Toil
from cactus.shared.common import cactus_call, Chi... | [
"sonLib.bioio.getTempFile",
"sonLib.bioio.system",
"cactus.shared.common.cactus_call",
"sonLib.bioio.TestStatus.getTestSetup",
"shutil.rmtree",
"os.getcwd",
"toil.common.Toil",
"sonLib.bioio.getTempDirectory",
"unittest.TestCase.tearDown",
"unittest.main",
"unittest.TestCase.setUp"
] | [((3535, 3550), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3548, 3550), False, 'import unittest\n'), ((409, 447), 'sonLib.bioio.TestStatus.getTestSetup', 'TestStatus.getTestSetup', (['(1)', '(5)', '(10)', '(100)'], {}), '(1, 5, 10, 100)\n', (432, 447), False, 'from sonLib.bioio import TestStatus\n'), ((537, 5... |
"""
Example of usage of the AVB framework to infer a single exponential decay
model.
This uses the Python classes directly to infer the parameters for a single
instance of noisy data constructed as a Numpy array.
"""
import sys
import logging
import numpy as np
from vaby_avb import Avb
import vaby
# Uncomment line ... | [
"numpy.random.normal",
"logging.getLogger",
"logging.StreamHandler",
"numpy.sqrt",
"logging.Formatter",
"vaby.DataModel",
"vaby.get_model_class"
] | [((577, 601), 'numpy.sqrt', 'np.sqrt', (['NOISE_VAR_TRUTH'], {}), '(NOISE_VAR_TRUTH)\n', (584, 601), True, 'import numpy as np\n'), ((1777, 1810), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (1798, 1810), False, 'import logging\n'), ((755, 782), 'vaby.get_model_class', 'vab... |
from dialog_api.users_pb2 import RequestLoadFullUsers, ResponseLoadFullUsers, FullUser
class Users:
def LoadFullUsers(self, request: RequestLoadFullUsers) -> ResponseLoadFullUsers:
return ResponseLoadFullUsers(full_users=[FullUser(id=1, contact_info=[], about=None)])
| [
"dialog_api.users_pb2.FullUser"
] | [((236, 279), 'dialog_api.users_pb2.FullUser', 'FullUser', ([], {'id': '(1)', 'contact_info': '[]', 'about': 'None'}), '(id=1, contact_info=[], about=None)\n', (244, 279), False, 'from dialog_api.users_pb2 import RequestLoadFullUsers, ResponseLoadFullUsers, FullUser\n')] |