code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
from __future__ import absolute_import
import sys
import os
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
try:
import queue
except ImportError:
import Queue as queue
import numpy
impo... | [
"uproot.source.file.MultithreadedFileSource",
"uproot.source.http.MultithreadedHTTPSource",
"uproot.source.xrootd.XRootDSource",
"uproot.source.http.HTTPSource",
"pytest.importorskip",
"uproot.source.xrootd.MultithreadedXRootDSource",
"Queue.Queue",
"uproot.source.file.MemmapSource"
] | [((534, 547), 'Queue.Queue', 'queue.Queue', ([], {}), '()\n', (545, 547), True, 'import Queue as queue\n'), ((1192, 1205), 'Queue.Queue', 'queue.Queue', ([], {}), '()\n', (1203, 1205), True, 'import Queue as queue\n'), ((1844, 1857), 'Queue.Queue', 'queue.Queue', ([], {}), '()\n', (1855, 1857), True, 'import Queue as q... |
import time
import dns
import dns.exception
import dns.name
import dns.query
import dns.resolver
from dyn.tm.errors import DynectCreateError, DynectGetError
from dyn.tm.session import DynectSession
from dyn.tm.zones import Node, Zone, get_all_zones
from flask import current_app
def get_dynect_session():
dynect_s... | [
"flask.current_app.logger.debug",
"dns.rcode.to_text",
"dyn.tm.zones.Zone",
"dns.resolver.get_default_resolver",
"dns.query.udp",
"dyn.tm.zones.Node",
"dns.resolver.Resolver",
"dyn.tm.zones.get_all_zones",
"time.sleep",
"dns.message.make_query",
"dns.name.from_text",
"flask.current_app.config.... | [((1677, 1692), 'dyn.tm.zones.get_all_zones', 'get_all_zones', ([], {}), '()\n', (1690, 1692), False, 'from dyn.tm.zones import Node, Zone, get_all_zones\n'), ((2245, 2260), 'dyn.tm.zones.get_all_zones', 'get_all_zones', ([], {}), '()\n', (2258, 2260), False, 'from dyn.tm.zones import Node, Zone, get_all_zones\n'), ((2... |
"""Basic filtering of garbage and perplexity sampling for OSCAR v1."""
import gzip
import multiprocessing
import os
from random import sample
import fsspec
import kenlm # pip install https://github.com/kpu/kenlm/archive/master.zip
import langid
import numpy as np
from datasets import load_dataset
from nltk.corpus im... | [
"os.path.exists",
"kenlm.Model",
"random.sample",
"numpy.random.default_rng",
"gzip.open",
"multiprocessing.Process",
"os.path.split",
"numpy.exp",
"langid.classify",
"os.unlink",
"transformers.AutoTokenizer.from_pretrained",
"os.system",
"fsspec.open"
] | [((10563, 10578), 'os.unlink', 'os.unlink', (['file'], {}), '(file)\n', (10572, 10578), False, 'import os\n'), ((12981, 13002), 'os.path.exists', 'os.path.exists', (['file2'], {}), '(file2)\n', (12995, 13002), False, 'import os\n'), ((13096, 13235), 'os.system', 'os.system', (['f"""/content/lmplz --discount_fallback -... |
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import pytest
import test_util as tu
@tu.requires_ipu_model
def test_ipu_copy_bca1():
popart.getLogger().setLevel("TRACE")
builder = popart.Builder()
i1 = builder.addInputTensor(popart.TensorInfo("FLOAT", [1]))
... | [
"popart.Builder",
"test_util.create_test_device",
"popart.AnchorReturnType",
"numpy.random.rand",
"popart.SessionOptions",
"popart.TensorInfo",
"pytest.raises",
"popart.getLogger"
] | [((235, 251), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (249, 251), False, 'import popart\n'), ((744, 767), 'popart.SessionOptions', 'popart.SessionOptions', ([], {}), '()\n', (765, 767), False, 'import popart\n'), ((1228, 1244), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (1242, 1244), False, 'im... |
from django.conf import settings
from importlib import import_module
from django.utils.module_loading import import_string
try:
from django.urls import URLPattern as RegexURLPattern
from django.urls import URLResolver as RegexURLResolver
except:
from django.core.urlresolvers import RegexURLResolver, RegexUR... | [
"addict.Dict",
"django.contrib.admindocs.views.simplify_regex",
"django.utils.module_loading.import_string",
"importlib.import_module"
] | [((1550, 1556), 'addict.Dict', 'Dict', ([], {}), '()\n', (1554, 1556), False, 'from addict import Dict\n'), ((711, 747), 'django.utils.module_loading.import_string', 'import_string', (['settings.ROOT_URLCONF'], {}), '(settings.ROOT_URLCONF)\n', (724, 747), False, 'from django.utils.module_loading import import_string\n... |
#!/usr/bin/env python
# coding: utf-8
# # Homework 1 Solution Question 2
# In[1]:
#importing libraries
import csv
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# In[2]:
#opening the data files for data 1
with open('data_1.csv') as csvfile:
x_1=[]
y_1=[]
readCSV = csv.reader(cs... | [
"matplotlib.pyplot.text",
"numpy.sqrt",
"numpy.linalg.eig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.zeros_like",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"csv.reader",
"matplotlib.pyplot.title",
"matplotlib.pyplo... | [((844, 871), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 4)'}), '(figsize=(15, 4))\n', (854, 871), True, 'import matplotlib.pyplot as plt\n'), ((871, 887), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(121)'], {}), '(121)\n', (882, 887), True, 'import matplotlib.pyplot as plt\n'), ((888, 908), '... |
"""
Beta interface to Plotly's /v2/dash-apps endpoints.
"""
from __future__ import absolute_import
from chart_studio.api.v2.utils import build_url, request
RESOURCE = "dash-apps"
def create(body):
"""Create a dash app item."""
url = build_url(RESOURCE)
return request("post", url, json=body)
def retrie... | [
"chart_studio.api.v2.utils.request",
"chart_studio.api.v2.utils.build_url"
] | [((245, 264), 'chart_studio.api.v2.utils.build_url', 'build_url', (['RESOURCE'], {}), '(RESOURCE)\n', (254, 264), False, 'from chart_studio.api.v2.utils import build_url, request\n'), ((276, 307), 'chart_studio.api.v2.utils.request', 'request', (['"""post"""', 'url'], {'json': 'body'}), "('post', url, json=body)\n", (2... |
'''
Modified from https://raw.githubusercontent.com/jeonsworld/ViT-pytorch/main/models/modeling.py
MIT License
Copyright (c) 2020 jeonsworld
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software witho... | [
"torch.nn.Dropout",
"torch.utils.model_zoo.load_url",
"math.sqrt",
"copy.deepcopy",
"torch.nn.init.xavier_uniform_",
"torch.nn.ModuleList",
"torch.nn.LayerNorm",
"torch.nn.init.zeros_",
"torch.matmul",
"torch.nn.modules.utils._pair",
"torch.cat",
"torch.nn.init.normal_",
"torch.nn.Softmax",
... | [((2272, 2288), 'torch.sigmoid', 'torch.sigmoid', (['x'], {}), '(x)\n', (2285, 2288), False, 'import torch\n'), ((2737, 2783), 'torch.nn.Linear', 'Linear', (['config.hidden_size', 'self.all_head_size'], {}), '(config.hidden_size, self.all_head_size)\n', (2743, 2783), False, 'from torch.nn import CrossEntropyLoss, Dropo... |
from django.conf.urls import url
from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, \
CategoryListView, AuthorPostListView, CommentDeleteView
urlpatterns = [
url(r'^$', IndexView.as_view()),
url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()),
url... | [
"blog.views.PostView.as_view",
"blog.views.TagListView.as_view",
"blog.views.CommentDeleteView.as_view",
"blog.views.RepositoryView.as_view",
"blog.views.RepositoryDetailView.as_view",
"blog.views.AuthorPostListView.as_view",
"blog.views.CategoryListView.as_view",
"blog.views.IndexView.as_view",
"bl... | [((236, 255), 'blog.views.IndexView.as_view', 'IndexView.as_view', ([], {}), '()\n', (253, 255), False, 'from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, CategoryListView, AuthorPostListView, CommentDeleteView\n'), ((292, 310), 'blog.views.PostView.as_view', 'P... |
import json
import logging
import math
import socket
import time
import numpy as np
import tables
import torch
import torch.nn.functional as F
import transformers
from torch import nn
from torch.nn import DataParallel
from torchtext import data
from torchtext.data import Iterator, Batch
from tqdm import tqdm
from tran... | [
"logging.debug",
"torch.LongTensor",
"transformers.get_constant_schedule_with_warmup",
"torch.cuda.device_count",
"transformers.AutoTokenizer.from_pretrained",
"logging.info",
"logging.error",
"json.dumps",
"numpy.concatenate",
"socket.gethostname",
"tables.Float32Atom",
"torchtext.data.Field"... | [((8610, 8625), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8623, 8625), False, 'import torch\n'), ((12921, 12936), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (12934, 12936), False, 'import torch\n'), ((827, 963), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (["config... |
import os
import sys
import numpy as np
from joblib import Parallel, delayed
import joblib
import argparse
import importlib
from itertools import product
import collections
from copy import deepcopy
from mcpy.utils import filesafe
from mcpy import plotting
def _get(opts, key, default):
return opts[key] if (key in... | [
"os.path.exists",
"mcpy.utils.filesafe",
"mcpy.plotting.sweep_plot",
"importlib.import_module",
"argparse.ArgumentParser",
"os.makedirs",
"joblib.load",
"itertools.product",
"mcpy.plotting.instance_plot",
"numpy.min",
"numpy.max",
"numpy.random.seed",
"copy.deepcopy",
"joblib.delayed",
"... | [((7760, 7821), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(description='Process some integers.')\n", (7783, 7821), False, 'import argparse\n'), ((7945, 7981), 'importlib.import_module', 'importlib.import_module', (['args.config'], {}), '(args.config)\n... |
#
# (C) Copyright 2011 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in LICENSE.txt
#
from six import BytesIO
import time
from .abstract_store import Value, AuthorizationError
from .utils import add_context_manager_support
class StringValu... | [
"six.BytesIO",
"time.time"
] | [((628, 639), 'time.time', 'time.time', ([], {}), '()\n', (637, 639), False, 'import time\n'), ((702, 713), 'time.time', 'time.time', ([], {}), '()\n', (711, 713), False, 'import time\n'), ((819, 838), 'six.BytesIO', 'BytesIO', (['self._data'], {}), '(self._data)\n', (826, 838), False, 'from six import BytesIO\n')] |
import sys
sys.path.append("..")
from util.utilities import *
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%B-%d-%Y %H:%M:%S',
filename=f"../logs/{Path(__file__).stem}.log",
filemode='w'
)
def send_advisor_attendance_emails():
... | [
"sys.path.append"
] | [((12, 33), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (27, 33), False, 'import sys\n')] |
import unittest
from typing import Union, Any
def nice_library_function(v: Any) -> str:
if isinstance(v, str):
return f"STRING: {v}"
elif isinstance(v, int):
return f"INT: {v}"
elif isinstance(v, dict):
return str({k: nice_library_function(v2) for k, v2 in v.items()})
elif isin... | [
"unittest.main"
] | [((2236, 2251), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2249, 2251), False, 'import unittest\n')] |
r"""Initiate a session and exercise some common reservation operations on the session.
This particular example is using NI-SCOPE but the session reservation API should work for any driver
session.
The gRPC API is built from the C API. NI-SCOPE documentation is installed with the driver at:
C:\Program Files (x86)\IV... | [
"niscope_pb2_grpc.NiScopeStub",
"session_pb2.UnreserveRequest",
"niscope_pb2.ErrorMessageRequest",
"grpc.insecure_channel",
"session_pb2.IsReservedByClientRequest",
"session_pb2_grpc.SessionUtilitiesStub",
"session_pb2.ResetServerRequest",
"niscope_pb2.InitWithOptionsRequest",
"session_pb2.ReserveRe... | [((2204, 2260), 'grpc.insecure_channel', 'grpc.insecure_channel', (['f"""{SERVER_ADDRESS}:{SERVER_PORT}"""'], {}), "(f'{SERVER_ADDRESS}:{SERVER_PORT}')\n", (2225, 2260), False, 'import grpc\n'), ((2278, 2311), 'niscope_pb2_grpc.NiScopeStub', 'grpc_niscope.NiScopeStub', (['channel'], {}), '(channel)\n', (2302, 2311), Tr... |
import socket
import threading
import argparse
import time
def run_server(host, port):
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind((host, port))
listener.listen(5)
print('Time ser... | [
"threading.Thread",
"socket.socket",
"time.time",
"argparse.ArgumentParser"
] | [((921, 946), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (944, 946), False, 'import argparse\n'), ((104, 153), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (117, 153), False, 'import socket\n'), ((706, 717), 'tim... |
import pytest
import pyvibdmc as pv
import os
import numpy as np
def test_imp_samp_derivs():
water_coord = np.array([[1.81005599, 0., 0.],
[-0.45344658, 1.75233806, 0.],
[0., 0., 0.]]) * 1.01
water_coord = np.tile(water_coord, (1000, 1, 1))
ohs = [[... | [
"numpy.tile",
"numpy.array",
"pyvibdmc.ChainRuleHelper"
] | [((272, 306), 'numpy.tile', 'np.tile', (['water_coord', '(1000, 1, 1)'], {}), '(water_coord, (1000, 1, 1))\n', (279, 306), True, 'import numpy as np\n'), ((360, 395), 'pyvibdmc.ChainRuleHelper', 'pv.ChainRuleHelper', (['water_coord', 'np'], {}), '(water_coord, np)\n', (378, 395), True, 'import pyvibdmc as pv\n'), ((113... |
#!/usr/bin/python3
# Copyright 2019 Adobe. All rights reserved.
# This file is licensed to you 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 requir... | [
"argparse.ArgumentParser",
"libs3.JobsManager.JobsManager",
"networkx.DiGraph",
"libs3.MongoConnector.MongoConnector",
"libs3.LoggingUtil.LoggingUtil.create_log",
"datetime.datetime.now",
"networkx.readwrite.json_graph.node_link_data",
"libs3.ZoneManager.ZoneManager.get_distinct_zones",
"libs3.DNSMa... | [((18631, 18669), 'libs3.DNSManager.DNSManager', 'DNSManager.DNSManager', (['mongo_connector'], {}), '(mongo_connector)\n', (18652, 18669), False, 'from libs3 import DNSManager, MongoConnector, JobsManager\n'), ((19716, 19748), 'libs3.LoggingUtil.LoggingUtil.create_log', 'LoggingUtil.create_log', (['__name__'], {}), '(... |
#-*- coding: utf-8 -*-
from .base import Base
from datetime import datetime
from django.contrib.gis.db.models import BooleanField
from django.contrib.gis.db.models import CharField
from django.contrib.gis.db.models import DateTimeField
from django.contrib.gis.db.models import SET_NULL
from django.contrib.gis.db.models ... | [
"django.contrib.gis.db.models.ForeignKey",
"django.contrib.gis.db.models.CharField",
"django.contrib.gis.db.models.URLField",
"django.contrib.gis.db.models.BooleanField",
"datetime.datetime.now",
"django.contrib.gis.db.models.DateTimeField",
"django.contrib.gis.db.models.IntegerField",
"shutil.rmtree"... | [((547, 574), 'django.contrib.gis.db.models.BooleanField', 'BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (559, 574), False, 'from django.contrib.gis.db.models import BooleanField\n'), ((590, 613), 'django.contrib.gis.db.models.IntegerField', 'IntegerField', ([], {'null': '(True)'}), '(null=True)\n'... |
#
# lossstatistic.py
#
# Author(s):
# <NAME> <<EMAIL>>
#
# Copyright (c) 2020-2021 ETH Zurich.
#
# 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-... | [
"torch.Tensor"
] | [((1571, 1590), 'torch.Tensor', 'torch.Tensor', (['[0.0]'], {}), '([0.0])\n', (1583, 1590), False, 'import torch\n'), ((1501, 1518), 'torch.Tensor', 'torch.Tensor', (['[0]'], {}), '([0])\n', (1513, 1518), False, 'import torch\n'), ((2139, 2157), 'torch.Tensor', 'torch.Tensor', (['[bs]'], {}), '([bs])\n', (2151, 2157), ... |
import numpy as np
from scipy.signal import kaiserord, lfilter, firwin, freqz, lfilter_zi
class fir_filter(object):
def __init__(self, fs, cutoff, ripple_db):
self.fs = fs # sample_rate
# The Nyquist rate of the signal.
nyq_rate = self.fs / 2.0
# The desired width of the transitio... | [
"utils.Logger.IO",
"scipy.signal.firwin",
"scipy.signal.lfilter_zi",
"numpy.array",
"matplotlib.pylab.plt.plot",
"matplotlib.pylab.plt.show",
"numpy.arange",
"scipy.signal.kaiserord"
] | [((2478, 2501), 'numpy.array', 'np.array', (['filter_x_list'], {}), '(filter_x_list)\n', (2486, 2501), True, 'import numpy as np\n'), ((2516, 2538), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(0.01)'], {}), '(0, 10, 0.01)\n', (2525, 2538), True, 'import numpy as np\n'), ((2537, 2562), 'matplotlib.pylab.plt.plot', '... |
"""
Application class for the model 'im_3_kW' of an induction machine
https://gitlab.onelab.info/doc/models/-/wikis/Electric-machines
"""
from typing import Dict
import os
import subprocess
from subprocess import PIPE
import tempfile
import time
import numpy as np
from pymgrit.core.application import Application
fro... | [
"pymgrit.induction_machine.helper.is_numeric",
"tempfile.TemporaryDirectory",
"pymgrit.induction_machine.helper.set_resolution",
"pymgrit.induction_machine.helper.get_values_from",
"numpy.size",
"subprocess.run",
"os.path.splitext",
"os.path.join",
"os.path.split",
"os.path.isfile",
"numpy.sum",... | [((2013, 2044), 'pymgrit.induction_machine.helper.pre_file', 'pre_file', (['(path_im3kw + self.pre)'], {}), '(path_im3kw + self.pre)\n', (2021, 2044), False, 'from pymgrit.induction_machine.helper import is_numeric, pre_file, get_values_from, getdp_read_resolution, set_resolution, get_preresolution\n'), ((2621, 2706), ... |
"""Test the TfidfVectorizeTokenLists pipeline stage."""
import pytest
import pandas as pd
import pdpipe as pdp
DF = pd.DataFrame(
data=[
[23, ['live', 'full', 'cats', 'mango']],
[80, ['hovercraft', 'full', 'eels']],
],
columns=['Age', 'Quote'],
)
DF2 = pd.DataFrame(
data=[
[... | [
"pandas.DataFrame",
"pytest.mark.parametrize",
"pdpipe.TfidfVectorizeTokenLists"
] | [((119, 248), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "[[23, ['live', 'full', 'cats', 'mango']], [80, ['hovercraft', 'full', 'eels']]]", 'columns': "['Age', 'Quote']"}), "(data=[[23, ['live', 'full', 'cats', 'mango']], [80, [\n 'hovercraft', 'full', 'eels']]], columns=['Age', 'Quote'])\n", (131, 248), True... |
import torch
from torch import nn
rnn_units = 128
class Model(nn.Module):
def __init__(self, column_units):
super(Model, self).__init__()
self.cnn = nn.Sequential(
nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),
nn.BatchNorm2d(16),
nn.ReLU(inplace=True),
... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.randn"
] | [((1071, 1100), 'torch.randn', 'torch.randn', (['(8)', '(10)', '(3)', '(32)', '(32)'], {}), '(8, 10, 3, 32, 32)\n', (1082, 1100), False, 'import torch\n'), ((398, 462), 'torch.nn.LSTM', 'nn.LSTM', (['(16 * (32 // 2) * (32 // 2))', 'rnn_units'], {'batch_first': '(True)'}), '(16 * (32 // 2) * (32 // 2), rnn_units, batch_... |
# Importing the libraries
import numpy as np
import pandas as pd
#import tensorflow as tf
#Data Preprocessing
# Importing the dataset
dataset_1 = pd.read_csv('2020_US_weekly_symptoms_dataset.csv') #Search Trends dataset
dataset_2 = pd.read_csv('aggregated_cc_by.csv', dtype={"test_units": "object"}) #hospitalizati... | [
"pandas.merge",
"pandas.read_csv",
"pandas.set_option"
] | [((150, 200), 'pandas.read_csv', 'pd.read_csv', (['"""2020_US_weekly_symptoms_dataset.csv"""'], {}), "('2020_US_weekly_symptoms_dataset.csv')\n", (161, 200), True, 'import pandas as pd\n'), ((237, 304), 'pandas.read_csv', 'pd.read_csv', (['"""aggregated_cc_by.csv"""'], {'dtype': "{'test_units': 'object'}"}), "('aggrega... |
"""
Reduced 3-body Problem testing script
====================================
Testing the reduced 3-body problem solvers with different numerical algorithms.
"""
import os
import time
from math import pi,cos,sin
import numpy as np
import matplotlib.pyplot as plt
from const import *
import reduced3body as r3b
try:
... | [
"matplotlib.pyplot.ylabel",
"math.cos",
"reduced3body.hohmann",
"reduced3body.low_energy_parts8",
"numpy.sin",
"reduced3body.trajectory",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"reduced3body.refine",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.yscale"... | [((414, 425), 'time.time', 'time.time', ([], {}), '()\n', (423, 425), False, 'import time\n'), ((8816, 8828), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (8826, 8828), True, 'import matplotlib.pyplot as plt\n'), ((8829, 8865), 'matplotlib.pyplot.plot', 'plt.plot', (['(tlist * unit_time)', 'errlist'], {}... |
# This sample tests the assert_type call.
from typing import Any, Literal
from typing_extensions import assert_type
def func1():
# This should generate an error.
assert_type()
# This should generate an error.
assert_type(1)
# This should generate an error.
assert_type(1, 2, 3)
# This sh... | [
"typing_extensions.assert_type"
] | [((172, 185), 'typing_extensions.assert_type', 'assert_type', ([], {}), '()\n', (183, 185), False, 'from typing_extensions import assert_type\n'), ((228, 242), 'typing_extensions.assert_type', 'assert_type', (['(1)'], {}), '(1)\n', (239, 242), False, 'from typing_extensions import assert_type\n'), ((285, 305), 'typing_... |
import random
from datetime import datetime
random.seed(datetime.now())
class SoS(object):
def __init__(self, CSs, environment):
self.CSs = CSs
self.environment = environment
pass
def run(self, tick):
logs = []
random.shuffle(self.CSs)
for CS in self.CSs:
... | [
"datetime.datetime.now",
"random.shuffle"
] | [((56, 70), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (68, 70), False, 'from datetime import datetime\n'), ((262, 286), 'random.shuffle', 'random.shuffle', (['self.CSs'], {}), '(self.CSs)\n', (276, 286), False, 'import random\n')] |
import sys
import os
this_path = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(this_path, os.pardir, os.pardir))
sys.path.append(root_path)
from torch import nn
from modules.image_encoders import *
from torchvision import models
from transformers import GPT2LMHeadModel, GPT2Toke... | [
"transformers.GPT2Tokenizer.from_pretrained",
"torchvision.models.vgg19",
"os.path.join",
"os.path.realpath",
"torchvision.models.resnet152",
"transformers.GPT2LMHeadModel.from_pretrained",
"torch.nn.Linear",
"sys.path.append"
] | [((153, 179), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (168, 179), False, 'import sys\n'), ((344, 381), 'transformers.GPT2Tokenizer.from_pretrained', 'GPT2Tokenizer.from_pretrained', (['"""gpt2"""'], {}), "('gpt2')\n", (373, 381), False, 'from transformers import GPT2LMHeadModel, GPT2... |
import os
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.files.storage import default_storage as storage
from django.db import models
from django.db.models.fields import BLANK_CHOICE_DASH
from django.forms.widgets import RadioSelect
from django.utils.safestring imp... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.core.files.storage.default_storage.exists",
"os.scandir",
"os.path.join",
"os.path.splitext",
"django.core.exceptions.ValidationError",
"django.db.models.BooleanField",
"os.path.split",
"os.pat... | [((863, 927), 'os.path.join', 'os.path.join', (['settings.ROOT', '"""static"""', '"""img"""', '"""hero"""', '"""featured"""'], {}), "(settings.ROOT, 'static', 'img', 'hero', 'featured')\n", (875, 927), False, 'import os\n'), ((952, 1013), 'os.path.join', 'os.path.join', (['settings.ROOT', '"""static"""', '"""img"""', '... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
import numpy as np
class RMTPP(nn.Module):
def __init__(self, cfg, args):
super(RMTPP, self).__init__()
self.cfg = cfg
self.args = args
if self.cfg.EMB_DIM != 0:
self.embedding = nn.Embeddi... | [
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.from_numpy",
"torch.exp",
"torch.tensor",
"torch.cat",
"torch.nn.NLLLoss",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torch.nn.functional.log_softmax",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.zeros",
"torch.nn.Embedding... | [((664, 716), 'torch.nn.Linear', 'nn.Linear', (['self.cfg.RNN_HIDDEN_DIM', 'self.cfg.MLP_DIM'], {}), '(self.cfg.RNN_HIDDEN_DIM, self.cfg.MLP_DIM)\n', (673, 716), True, 'import torch.nn as nn\n'), ((745, 796), 'torch.nn.Linear', 'nn.Linear', (['self.cfg.MLP_DIM', 'self.cfg.EVENT_CLASSES'], {}), '(self.cfg.MLP_DIM, self.... |
#!/usr/bin/python
import argparse
from twisted.internet import reactor
from pllm import config, monitor
parser = argparse.ArgumentParser(description='PLLM monitor dumper')
parser.add_argument('-r', '--raw',
action="store_true", default=False,
help='Dump raw messages')
args = ... | [
"twisted.internet.reactor.run",
"pllm.config.get",
"argparse.ArgumentParser",
"pllm.monitor.MonitorClientFactory"
] | [((116, 174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PLLM monitor dumper"""'}), "(description='PLLM monitor dumper')\n", (139, 174), False, 'import argparse\n'), ((486, 516), 'pllm.monitor.MonitorClientFactory', 'monitor.MonitorClientFactory', ([], {}), '()\n', (514, 516), False,... |
from sage.all import lcm
from dissect.traits.trait_interface import compute_results
from dissect.utils.custom_curve import CustomCurve
def torsion_finder(curve: CustomCurve, l):
"""
Finds the minimal degrees k_2,k_1 of extension of curve E/F_q where
E/F_q**(k_2) contains E[l] and E/F_q**(k_1) has nontriv... | [
"sage.all.lcm",
"dissect.traits.trait_interface.compute_results"
] | [((1628, 1715), 'dissect.traits.trait_interface.compute_results', 'compute_results', (['curve_list', '"""a05"""', 'a05_curve_function'], {'desc': 'desc', 'verbose': 'verbose'}), "(curve_list, 'a05', a05_curve_function, desc=desc, verbose=\n verbose)\n", (1643, 1715), False, 'from dissect.traits.trait_interface impor... |
import logging
import copy
from rest_framework.response import Response
from rest_framework.views import APIView
from django.db.models import F, Q
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.helpers.generic_helper import get_pagination_metadata
from usaspending_api.co... | [
"logging.getLogger",
"usaspending_api.recipient.models.RecipientProfile.objects.filter",
"usaspending_api.common.validator.utils.update_model_in_list",
"usaspending_api.common.validator.tinyshield.TinyShield",
"usaspending_api.common.helpers.generic_helper.get_pagination_metadata",
"django.db.models.F",
... | [((638, 665), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (655, 665), False, 'import logging\n'), ((1300, 1303), 'django.db.models.Q', 'Q', ([], {}), '()\n', (1301, 1303), False, 'from django.db.models import F, Q\n'), ((2351, 2416), 'usaspending_api.common.helpers.generic_helper.get_p... |
import sys
import os
from os import path
import shutil
"""
Look at a "rendered" folder, move the rendered to the output path
Keep the empty folders in place (don't delete since it might still be rendered right)
Also copy the corresponding yaml in there
"""
input_path = sys.argv[1]
output_path = sys.argv[2]
yaml_path ... | [
"os.listdir",
"os.path.join"
] | [((418, 440), 'os.listdir', 'os.listdir', (['input_path'], {}), '(input_path)\n', (428, 440), False, 'import os\n'), ((1052, 1075), 'os.listdir', 'os.listdir', (['output_path'], {}), '(output_path)\n', (1062, 1075), False, 'import os\n'), ((471, 511), 'os.path.join', 'path.join', (['input_path', 'r', '"""segmentation""... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... | [
"mock.MagicMock",
"apps.node_man.models.Subscription",
"apps.node_man.models.JobTask",
"apps.node_man.models.JobTask.objects.create",
"apps.node_man.models.SubscriptionTask.objects.create",
"apps.node_man.models.SubscriptionInstanceRecord.objects.create",
"apps.node_man.models.IdentityData.objects.creat... | [((8259, 8308), 'mock.MagicMock', 'MagicMock', ([], {'return_value': 'get_and_set_prompt_return'}), '(return_value=get_and_set_prompt_return)\n', (8268, 8308), False, 'from mock import MagicMock\n'), ((8333, 8379), 'mock.MagicMock', 'MagicMock', ([], {'return_value': 'send_cmd_return_return'}), '(return_value=send_cmd_... |
"""
Using simulation trackers
=========================
This example illustrates how trackers can be used to analyze simulations.
"""
from pde import (DiffusionPDE, UnitGrid, ScalarField, MemoryStorage,
PlotTracker, PrintTracker, RealtimeIntervals)
grid = UnitGrid([32, 32]) # generate grid
state = ... | [
"pde.UnitGrid",
"pde.MemoryStorage",
"pde.DiffusionPDE",
"pde.RealtimeIntervals",
"pde.ScalarField.random_uniform",
"pde.PlotTracker"
] | [((276, 294), 'pde.UnitGrid', 'UnitGrid', (['[32, 32]'], {}), '([32, 32])\n', (284, 294), False, 'from pde import DiffusionPDE, UnitGrid, ScalarField, MemoryStorage, PlotTracker, PrintTracker, RealtimeIntervals\n'), ((320, 352), 'pde.ScalarField.random_uniform', 'ScalarField.random_uniform', (['grid'], {}), '(grid)\n',... |
""".. module:: target_endpoints """
import json
from json import dumps, loads
from flask import request, jsonify, abort, current_app, make_response, g
from flask_restplus import Resource, Namespace
from application.handlers.config_handler import ConfigHandler, get_ini_configuration, get_storages_configuration, get_co... | [
"flask.request.args.get",
"flask_restplus.Namespace",
"application.handlers.config_handler.get_ini_configuration",
"flask.abort",
"flask.jsonify"
] | [((515, 541), 'flask_restplus.Namespace', 'Namespace', (['"""configuration"""'], {}), "('configuration')\n", (524, 541), False, 'from flask_restplus import Resource, Namespace\n'), ((1232, 1256), 'flask.request.args.get', 'request.args.get', (['"""dirs"""'], {}), "('dirs')\n", (1248, 1256), False, 'from flask import re... |
from PyQt5 import QtCore, QtGui, QtWidgets
import Backend
from datetime import datetime
class Ui_MainWindow(object):
def __init__(self):
self.eventos = list()
self.pos = 0
self.act = 1
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
Ma... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextEdit",
"PyQt5.QtWidgets.QMainWindow",
"PyQt5.QtWidgets.QDateEdit",
"PyQt5.QtWidgets.QListWidget",
"PyQt5.QtWidgets.QCalendarWidget",
"Backend.insert",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtCore.QRect",
"... | [((8464, 8496), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (8486, 8496), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((8514, 8537), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (8535, 8537), False, 'from PyQt5 import QtCore, QtG... |
# Generated by Django 3.1.2 on 2021-04-19 16:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notebooks', '0004_auto_20210419_1557'),
]
operations = [
migrations.AddField(
model_name='note',
name='description',... | [
"django.db.models.CharField"
] | [((339, 427), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(500)', 'null': '(True)', 'verbose_name': '"""description"""'}), "(blank=True, max_length=500, null=True, verbose_name=\n 'description')\n", (355, 427), False, 'from django.db import migrations, models\n'), ((539,... |
import logging
import os
import warnings
from collections import defaultdict
from typing import Union, Tuple
from multiprocessing import Pool
import h5py
import numpy as np
import torch
from sklearn.metrics import f1_score, roc_auc_score, confusion_matrix, average_precision_score, auc
from deepethogram import utils
f... | [
"logging.getLogger",
"sklearn.metrics.auc",
"numpy.logical_not",
"sklearn.metrics.roc_auc_score",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.mean",
"numpy.asarray",
"deepethogram.postprocessing.remove_low_thresholds",
"numpy.stack",
"numpy.linspace",
"os.path.isdir",
"numpy.con... | [((388, 415), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'import logging\n'), ((1384, 1438), 'numpy.zeros', 'np.zeros', (['(index.shape[0], n_classes)'], {'dtype': 'np.uint16'}), '((index.shape[0], n_classes), dtype=np.uint16)\n', (1392, 1438), True, 'import numpy a... |
import collections
import os
from pynvml import *
import time
from numbers import Number
import threading
from wandb import util
from wandb import termlog
psutil = util.get_module("psutil")
class SystemStats(object):
def __init__(self, run, api):
try:
nvmlInit()
self.gpu_count = nv... | [
"threading.Thread",
"wandb.termlog",
"time.sleep",
"wandb.util.get_module"
] | [((164, 189), 'wandb.util.get_module', 'util.get_module', (['"""psutil"""'], {}), "('psutil')\n", (179, 189), False, 'from wandb import util\n'), ((886, 928), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._thread_body'}), '(target=self._thread_body)\n', (902, 928), False, 'import threading\n'), ((747, 8... |
# -*- coding: utf-8 -*-
# author: <NAME>
"""pyplt.
绘图函数接口
# ## matplotlib
# matplotlib 提供了较为完整的matlab式绘图API,这种绘图代码简洁;
#
# 一般语法为plt.func
#
# 对于复杂绘图的支持,matplotlib 可以用面向对象的API接口实现
#
# 通过图层一步步搭建图形 figure->axes->axis,对于子图的设置为axes.set_prop
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import ticker... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.ticker.ScalarFormatter",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.ylim",
"numpy.meshgrid",
"... | [((369, 457), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 18, 'font.family': 'Serif', 'text.usetex': False}"], {}), "({'font.size': 18, 'font.family': 'Serif', 'text.usetex':\n False})\n", (388, 457), True, 'import matplotlib.pyplot as plt\n'), ((590, 630), 'matplotlib.ticker.ScalarF... |
#!/usr/bin/env python3
# encoding: utf-8
import time
import numpy as np
from keras.models import Sequential
from keras.layers.recurrent import LSTM
from keras.callbacks import EarlyStopping
from keras.layers.core import Dense, Activation, Dropout
from utils import read_dataset, split_dataset
from nn_common import plot... | [
"utils.split_dataset",
"hyperopt.fmin",
"nn_common.store_model",
"numpy.reshape",
"keras.layers.core.Activation",
"nn_common.plot_result",
"hyperopt.hp.randint",
"keras.models.Sequential",
"keras.layers.core.Dense",
"utils.read_dataset",
"keras.callbacks.EarlyStopping",
"keras.layers.core.Drop... | [((453, 465), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (463, 465), False, 'from keras.models import Sequential\n'), ((937, 948), 'time.time', 'time.time', ([], {}), '()\n', (946, 948), False, 'import time\n'), ((1006, 1068), 'utils.read_dataset', 'read_dataset', (['"""../datasets/internet-traffic-data... |
# import the necessary packages
import cv2
import joblib
import numpy as np
import tkinter as tk
import time
from core import extract_signature
from PIL import Image, ImageTk
from tkinter import filedialog
def resize(image, size):
w, h = image.size
if w == 0 or h == 0:
return Image.fromarray(np.ones(... | [
"cv2.rectangle",
"core.extract_signature",
"tkinter.Button",
"numpy.array",
"tkinter.Label",
"tkinter.Frame",
"tkinter.Grid.rowconfigure",
"numpy.where",
"joblib.load",
"PIL.ImageTk.PhotoImage",
"tkinter.filedialog.askopenfilename",
"numpy.ones",
"numpy.fliplr",
"cv2.cvtColor",
"time.tim... | [((604, 619), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (612, 619), True, 'import numpy as np\n'), ((834, 857), 'PIL.Image.fromarray', 'Image.fromarray', (['canvas'], {}), '(canvas)\n', (849, 857), False, 'from PIL import Image, ImageTk\n'), ((1872, 1900), 'tkinter.filedialog.askopenfilename', 'filedialo... |
"""The tests the for GPSLogger device tracker platform."""
from unittest.mock import patch
import pytest
from homeassistant.components import zone
from homeassistant.components.device_tracker import \
DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.gpslogger import URL, DOMAIN
from homeassistant.com... | [
"pytest.fixture",
"homeassistant.setup.async_setup_component",
"unittest.mock.patch"
] | [((816, 844), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (830, 844), False, 'import pytest\n'), ((1876, 1904), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1890, 1904), False, 'import pytest\n'), ((1108, 1157), 'homeassistant.setup.async... |
import datetime
import json
from aiohttp import request
import random
import inspect
import os
import dbl
import aiohttp
import io
import asyncpraw
import discord
import DiscordUtils
import httpx
from discord.ext import commands
from dotenv import load_dotenv
from prsaw import RandomStuff
from dotenv import load_dotenv... | [
"discord.ext.commands.has_permissions",
"discord.ext.commands.group",
"discord.ext.commands.command",
"discord.ext.commands.Cog.listener",
"discord.Colour.gold",
"dotenv.load_dotenv",
"DiscordUtils.Pagination.CustomEmbedPaginator",
"discord.Embed",
"random.randint",
"discord.File",
"json.loads",... | [((356, 375), 'dotenv.load_dotenv', 'load_dotenv', (['""".env"""'], {}), "('.env')\n", (367, 375), False, 'from dotenv import load_dotenv\n'), ((737, 758), 'os.getenv', 'os.getenv', (['"""DBLTOKEN"""'], {}), "('DBLTOKEN')\n", (746, 758), False, 'import os\n'), ((916, 934), 'discord.ext.commands.command', 'commands.comm... |
#appModules/javaw.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2014 NV Access Limited
"""Support for app specific modules for Java apps hosted by javaw.exe.
"""
import os
import shlex
import appModuleHandl... | [
"shlex.split",
"appModuleHandler.getAppNameFromProcessID",
"appModuleHandler.getWmiProcessInfo"
] | [((1006, 1051), 'appModuleHandler.getWmiProcessInfo', 'appModuleHandler.getWmiProcessInfo', (['processId'], {}), '(processId)\n', (1040, 1051), False, 'import appModuleHandler\n'), ((400, 416), 'shlex.split', 'shlex.split', (['cmd'], {}), '(cmd)\n', (411, 416), False, 'import shlex\n'), ((1104, 1152), 'appModuleHandler... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import ABC
from asyncio import sleep
from copy import Error
from http import HTTPStatus
from typing import Awaitable, Callable, List, Union
from botbuilder.core.invoke_response import InvokeResponse
from botbuilder... | [
"copy.Error",
"botbuilder.schema.ResourceResponse",
"botframework.connector.auth.ClaimsIdentity",
"botbuilder.schema.ExpectedReplies",
"asyncio.sleep",
"botbuilder.core.invoke_response.InvokeResponse"
] | [((10838, 10966), 'botframework.connector.auth.ClaimsIdentity', 'ClaimsIdentity', (['{AuthenticationConstants.AUDIENCE_CLAIM: bot_app_id,\n AuthenticationConstants.APP_ID_CLAIM: bot_app_id}', '(True)'], {}), '({AuthenticationConstants.AUDIENCE_CLAIM: bot_app_id,\n AuthenticationConstants.APP_ID_CLAIM: bot_app_id}... |
#!/usr/bin/env python3
# Copyright (c) 2019 <NAME>
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import os
import time
import argparse
import logging
import traceback
from twisted.internet import reactor, task
from screen_ui im... | [
"logger.setup_logging",
"node_info.LnNodeInfo",
"jukebox.Jukebox",
"logging.error",
"os.path.exists",
"argparse.ArgumentParser",
"physical_ui.PhysicalUI",
"os.path.isdir",
"serve_websocket.ServeWebsocket",
"twisted.internet.task.LoopingCall",
"serve_web.ServeWeb",
"bitcoinrpc.Bitcoind.getblock... | [((1305, 1353), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESCRIPTION'}), '(description=DESCRIPTION)\n', (1328, 1353), False, 'import argparse\n'), ((2428, 2528), 'logger.setup_logging', 'setup_logging', (['args.log_file', '"""jukebox"""'], {'min_level': 'logging.INFO', 'console_silent... |
from django.contrib.gis.db import models
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel
from model_utils import Choices
from .mixins import DateConstraintMixin, DateDisplayMixin
class OrganisationManager(models.QuerySet):
def get_date_filter(self, date):
return ... | [
"model_utils.Choices",
"django.contrib.gis.db.models.ManyToManyField",
"django.contrib.gis.db.models.ForeignKey",
"django.contrib.gis.db.models.CharField",
"django.contrib.gis.db.models.Q",
"django.urls.reverse",
"django.contrib.gis.db.models.MultiPolygonField",
"django.contrib.gis.db.models.DateField... | [((942, 1208), 'model_utils.Choices', 'Choices', (["('combined-authority', 'combined-authority')", "('sp', 'sp')", "('gla', 'gla')", "('local-authority', 'local-authority')", "('naw', 'naw')", "('senedd', 'senedd')", "('nia', 'nia')", "('parl', 'parl')", "('police-area', 'police-area')", "('europarl', 'europarl')"], {}... |
# coding: utf-8
import pprint
import re
import six
class FreeResourceDetail:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value... | [
"six.iteritems"
] | [((9121, 9154), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (9134, 9154), False, 'import six\n')] |
import json
from json import JSONDecodeError
import simplejson
def read_id():
with open("token.txt") as f:
return f.readline().strip()
def read_config():
with open("config.json", 'r+') as f:
try:
pre = json.load(f)
except JSONDecodeError:
write_config({})
... | [
"json.load",
"json.loads",
"simplejson.dumps"
] | [((243, 255), 'json.load', 'json.load', (['f'], {}), '(f)\n', (252, 255), False, 'import json\n'), ((497, 547), 'simplejson.dumps', 'simplejson.dumps', (['config'], {'indent': '(4)', 'sort_keys': '(True)'}), '(config, indent=4, sort_keys=True)\n', (513, 547), False, 'import simplejson\n'), ((335, 351), 'json.loads', 'j... |
"""
Module for managing container and VM images
.. versionadded:: 2014.7.0
"""
import logging
import os
import pprint
import shlex
import uuid
import salt.syspaths
import salt.utils.kickstart
import salt.utils.path
import salt.utils.preseed
import salt.utils.stringutils
import salt.utils.validate.path
import salt.ut... | [
"logging.getLogger",
"os.path.exists",
"os.listdir",
"os.path.join",
"pprint.pformat",
"uuid.uuid4",
"os.path.isdir",
"shlex.quote",
"salt.exceptions.SaltInvocationError"
] | [((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((3952, 4015), 'salt.exceptions.SaltInvocationError', 'SaltInvocationError', (['"""The img_format must be "sparse" or "dir\\""""'], {}), '(\'The img_format must be "sparse" or "dir"\')\n',... |
from spacy.lang.en import English
nlp = English()
# Procesa el texto
doc = nlp(
"In 1990, more than 60% of people in East Asia were in extreme poverty. "
"Now less than 4% are."
)
# Itera sobre los tokens en el doc
for token in doc:
# Revisa si el token parece un número
if ____.____:
# Obtén ... | [
"spacy.lang.en.English"
] | [((41, 50), 'spacy.lang.en.English', 'English', ([], {}), '()\n', (48, 50), False, 'from spacy.lang.en import English\n')] |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: performance_metrics.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from go... | [
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.FileDescriptor"
] | [((424, 450), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (448, 450), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((468, 1106), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""performance_metrics.pr... |
from rest_framework import serializers
from todo.models import Todo
class TodoSerializer(serializers.ModelSerializer):
created = serializers.ReadOnlyField()
datecompleted = serializers.ReadOnlyField()
class Meta:
model = Todo
fields = ['id', 'title', 'memo', 'created', 'datecompleted', '... | [
"rest_framework.serializers.ReadOnlyField"
] | [((136, 163), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {}), '()\n', (161, 163), False, 'from rest_framework import serializers\n'), ((184, 211), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {}), '()\n', (209, 211), False, 'from rest_framework import ... |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import links
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_size': 10, 'out_size': 10},
{'in_size': 10, 'out_size': 40}... | [
"chainer.testing.parameterize",
"chainer.Variable",
"chainer.gradient_check.assert_allclose",
"chainer.links.LSTM",
"numpy.random.uniform",
"chainer.cuda.to_gpu"
] | [((226, 316), 'chainer.testing.parameterize', 'testing.parameterize', (["{'in_size': 10, 'out_size': 10}", "{'in_size': 10, 'out_size': 40}"], {}), "({'in_size': 10, 'out_size': 10}, {'in_size': 10,\n 'out_size': 40})\n", (246, 316), False, 'from chainer import testing\n'), ((401, 440), 'chainer.links.LSTM', 'links.... |
import cv2
import numpy as np
from generic_dataset.dataset_folder_manager import DatasetFolderManager
from generic_dataset.utilities.color import Color
from generic_dataset.dataset_manager import DatasetManager
from gibson_env_utilities.doors_dataset.door_sample import DoorSample
dataset_path ='/home/michele/myfiles... | [
"generic_dataset.dataset_folder_manager.DatasetFolderManager",
"generic_dataset.utilities.color.Color",
"generic_dataset.dataset_manager.DatasetManager",
"numpy.concatenate",
"cv2.waitKey"
] | [((413, 511), 'generic_dataset.dataset_folder_manager.DatasetFolderManager', 'DatasetFolderManager', ([], {'dataset_path': 'dataset_path', 'folder_name': '"""house1"""', 'sample_class': 'DoorSample'}), "(dataset_path=dataset_path, folder_name='house1',\n sample_class=DoorSample)\n", (433, 511), False, 'from generic_... |
""" Tokenize and tag documents from a .jsonl file """
import spacy
import ujson
import plac
import os
import sys
import logging
if "../../" not in sys.path:
sys.path.append ("../../")
from modules import constants
TAGGED_EXT=".tokenized"
MAX_LENGTH = 10000000
NLP = spacy.load ("en_core_web_sm")
NLP.max_length = M... | [
"logging.basicConfig",
"plac.annotations",
"spacy.load",
"ujson.dumps",
"os.path.join",
"plac.call",
"ujson.loads",
"sys.path.append"
] | [((272, 300), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (282, 300), False, 'import spacy\n'), ((331, 426), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(level... |
# Generated by Django 3.2.3 on 2021-05-24 16:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("UserProfile", "0003_auto_20210524_1602"),
]
operations = [
migrations.AlterField(
model_name="customuser",
name="is_... | [
"django.db.models.BooleanField"
] | [((347, 380), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (366, 380), False, 'from django.db import migrations, models\n')] |
# coding: utf-8
import json
from pymongo import MongoClient
if __name__ == "__main__":
client = MongoClient('172.24.99.98', 27017)
db = client['Grupo01_taller04']
# tweets = db.tweets.find({})
#
# fileJ = open('testfile2.json', 'w')
#
# for tweet in tweets:
# json_data = {
# ... | [
"pymongo.MongoClient",
"json.dump"
] | [((101, 135), 'pymongo.MongoClient', 'MongoClient', (['"""172.24.99.98"""', '(27017)'], {}), "('172.24.99.98', 27017)\n", (112, 135), False, 'from pymongo import MongoClient\n'), ((2581, 2608), 'json.dump', 'json.dump', (['json_data', 'fileJ'], {}), '(json_data, fileJ)\n', (2590, 2608), False, 'import json\n'), ((2940,... |
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
# Read in the image
image = mpimg.imread('./images/waymo_car.jpg')
# Print out the image dimensions
print('Image dimensions:', image.shape)
# Change from color to grayscale
gray_image = cv2.cvtColor(image, cv2.COLOR_RGB2GRA... | [
"matplotlib.pyplot.imshow",
"numpy.amin",
"matplotlib.image.imread",
"numpy.array",
"cv2.cvtColor",
"matplotlib.pyplot.matshow",
"numpy.amax",
"matplotlib.pyplot.show"
] | [((124, 162), 'matplotlib.image.imread', 'mpimg.imread', (['"""./images/waymo_car.jpg"""'], {}), "('./images/waymo_car.jpg')\n", (136, 162), True, 'import matplotlib.image as mpimg\n'), ((283, 322), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_RGB2GRAY'], {}), '(image, cv2.COLOR_RGB2GRAY)\n', (295, 322), False... |
from scheduled_bots.utils import getConceptLabels
from wikidataintegrator import wdi_core
from wikidataintegrator.wdi_core import WDItemEngine
from wikidataintegrator.wdi_helpers import try_write
PROPS = {
"subclass of": "P279",
"has part": "P527",
"instance of": "P31"
}
# chromosomes
CHROMOSOME = dict()
... | [
"wikidataintegrator.wdi_core.WDItemEngine.execute_sparql_query",
"scheduled_bots.utils.getConceptLabels",
"wikidataintegrator.wdi_core.WDItemID",
"wikidataintegrator.wdi_core.WDItemEngine"
] | [((3818, 3855), 'scheduled_bots.utils.getConceptLabels', 'getConceptLabels', (['self.component_qids'], {}), '(self.component_qids)\n', (3834, 3855), False, 'from scheduled_bots.utils import getConceptLabels\n'), ((4200, 4229), 'wikidataintegrator.wdi_core.WDItemEngine', 'wdi_core.WDItemEngine', ([], {'data': 's'}), '(d... |
# pylint: disable=C,R,E1101
import torch
import numpy as np
class NormActivation(torch.nn.Module):
def __init__(self, dimensionalities, tensor_act=None, scalar_act=None, eps=1e-6, bias_min=.5, bias_max=2):
'''
:param dimensionalities: list of dimensionalities of the capsules
:param scalar_... | [
"torch.nn.Softplus",
"torch.Tensor",
"torch.cat",
"numpy.array",
"torch.norm",
"torch.sum",
"torch.FloatTensor",
"torch.rand"
] | [((2936, 2973), 'torch.cat', 'torch.cat', (['capsule_activations'], {'dim': '(1)'}), '(capsule_activations, dim=1)\n', (2945, 2973), False, 'import torch\n'), ((5750, 5787), 'torch.cat', 'torch.cat', (['capsule_activations'], {'dim': '(1)'}), '(capsule_activations, dim=1)\n', (5759, 5787), False, 'import torch\n'), ((6... |
"""vendimia URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | [
"django.conf.urls.include",
"django.contrib.auth.views.LoginView.as_view",
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((1445, 1506), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1451, 1506), False, 'from django.conf.urls.static import static\n'), ((1312, 1387), 'django.conf.urls.url', 'url', (['"""^logout/$... |
import unittest
from robot.parsing.robotreader import RobotReader
from robot.parsing.txtreader import TxtReader
from robot.utils.asserts import assert_equal
class TestRobotReader(unittest.TestCase):
Reader = RobotReader
def test_split_row_with_pipe(self):
raw_text = "| col0 | col1 | col2"
... | [
"unittest.main"
] | [((863, 878), 'unittest.main', 'unittest.main', ([], {}), '()\n', (876, 878), False, 'import unittest\n')] |
from sklearn import tree
def train(X, y):
clf = tree.DecisionTreeClassifier(max_depth=10, random_state=0)
clf = clf.fit(X, y)
return clf
| [
"sklearn.tree.DecisionTreeClassifier"
] | [((52, 109), 'sklearn.tree.DecisionTreeClassifier', 'tree.DecisionTreeClassifier', ([], {'max_depth': '(10)', 'random_state': '(0)'}), '(max_depth=10, random_state=0)\n', (79, 109), False, 'from sklearn import tree\n')] |
#!/usr/bin/env python
import sys, os
import chpl_platform, utils
from utils import memoize
@memoize
def get():
make_val = os.environ.get('CHPL_MAKE')
if not make_val:
platform_val = chpl_platform.get()
if platform_val.startswith('cygwin') or platform_val == 'darwin':
make_val = 'ma... | [
"chpl_platform.get",
"os.environ.get",
"utils.find_executable"
] | [((128, 155), 'os.environ.get', 'os.environ.get', (['"""CHPL_MAKE"""'], {}), "('CHPL_MAKE')\n", (142, 155), False, 'import sys, os\n'), ((200, 219), 'chpl_platform.get', 'chpl_platform.get', ([], {}), '()\n', (217, 219), False, 'import chpl_platform, utils\n'), ((386, 416), 'utils.find_executable', 'utils.find_executab... |
"""
Created on 26/05/2020
4chan-scraper v0.2
@author: <NAME>
"""
import requests
import logging
import json
import os
import datetime as dt
import sys
import time
#===============================================================================
# Setup
#======================================... | [
"logging.basicConfig",
"os.path.exists",
"os.makedirs",
"logging.info",
"requests.get",
"datetime.datetime.now",
"time.time",
"logging.error",
"json.dump"
] | [((640, 816), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)-8s %(message)s"""', 'datefmt': '"""%Y-%m-%d_T_%H:%M:%S"""', 'filename': '"""4chan_catalog_scraper_custom.log"""', 'level': 'logging.DEBUG'}), "(format='%(asctime)s %(levelname)-8s %(message)s',\n datefmt='%Y-%m... |
import os
from nltk.corpus import stopwords
class Config():
APPDIR = os.path.abspath(os.path.dirname(__file__))
SOURCEDIR = os.path.abspath(os.path.join(APPDIR,'..',r'CORPUS')) # источник файлов для моделей и индексов
PICKLEDIR = os.path.abspath(os.path.join(APPDIR,r'store'))
LEXPATH = os.path.a... | [
"os.path.exists",
"nltk.corpus.stopwords.words",
"os.path.join",
"os.path.dirname",
"os.mkdir"
] | [((96, 121), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (111, 121), False, 'import os\n'), ((155, 191), 'os.path.join', 'os.path.join', (['APPDIR', '""".."""', '"""CORPUS"""'], {}), "(APPDIR, '..', 'CORPUS')\n", (167, 191), False, 'import os\n'), ((265, 294), 'os.path.join', 'os.path.join... |
# remove warning message
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# required library
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from local_utils import detect_lp
from os.path import splitext,basename
from keras.models import model_from_json... | [
"cv2.rectangle",
"sklearn.preprocessing.LabelEncoder",
"cv2.convertScaleAbs",
"cv2.imshow",
"argparse.ArgumentParser",
"cv2.threshold",
"numpy.stack",
"cv2.waitKey",
"os.path.splitext",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.resize",
"cv2.GaussianBlur",
"cv2.imread",
"keras.models.mode... | [((4434, 4459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4457, 4459), False, 'import argparse\n'), ((5640, 5676), 'cv2.imshow', 'cv2.imshow', (['"""Vehicle Image"""', 'vehicle'], {}), "('Vehicle Image', vehicle)\n", (5650, 5676), False, 'import cv2\n'), ((5678, 5717), 'cv2.imshow', 'cv2.... |
#! /usr/bin/env python3
import common, glob, os, platform, subprocess, sys
def build_shared():
os.chdir(os.path.dirname(__file__) + '/..')
sources = glob.glob('shared/java/**/*.java', recursive=True)
common.javac(common.deps(), sources, 'shared/target/classes')
target_native = {'macos': 'libjwm_' + common.arch ... | [
"subprocess.check_call",
"common.javac",
"os.path.dirname",
"common.deps",
"glob.glob"
] | [((154, 204), 'glob.glob', 'glob.glob', (['"""shared/java/**/*.java"""'], {'recursive': '(True)'}), "('shared/java/**/*.java', recursive=True)\n", (163, 204), False, 'import common, glob, os, platform, subprocess, sys\n'), ((540, 784), 'subprocess.check_call', 'subprocess.check_call', (["(['cmake', '-B', 'build', '-G',... |
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
def _sanitize(ver):
skt_list = []
for point in ver.strip().split('.'):
point = point.strip()
try:
point = int(point)
except ValueError:
pass
skt_list.append(point)
return skt_list
def ... | [
"os.system",
"argparse.ArgumentParser"
] | [((665, 690), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (688, 690), False, 'import argparse\n'), ((785, 850), 'os.system', 'os.system', (['"""echo "version bumped to `python setup.py --version`\\""""'], {}), '(\'echo "version bumped to `python setup.py --version`"\')\n', (794, 850), False,... |
"""Component to interface with various sensors that can be monitored."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESSURE,
D... | [
"logging.getLogger",
"datetime.timedelta",
"homeassistant.helpers.entity_component.EntityComponent",
"voluptuous.In"
] | [((656, 683), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (673, 683), False, 'import logging\n'), ((755, 776), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(30)'}), '(seconds=30)\n', (764, 776), False, 'from datetime import timedelta\n'), ((1267, 1289), 'voluptuous.In', 'vol.In... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"airflow.timetables.interval.CronDataIntervalTimetable",
"airflow.timetables.base.TimeRestriction",
"pytest.param",
"airflow.timetables.base.DataInterval",
"pytest.raises",
"freezegun.freeze_time",
"airflow.timetables.base.DagRunInfo.interval",
"pendulum.DateTime",
"datetime.timedelta"
] | [((1200, 1246), 'pendulum.DateTime', 'pendulum.DateTime', (['(2021)', '(9)', '(4)'], {'tzinfo': 'TIMEZONE'}), '(2021, 9, 4, tzinfo=TIMEZONE)\n', (1217, 1246), False, 'import pendulum\n'), ((1372, 1444), 'airflow.timetables.base.DataInterval', 'DataInterval', ([], {'start': 'PREV_DATA_INTERVAL_START', 'end': 'PREV_DATA_... |
#!/usr/bin/python3
# Generate an intent schema file by asking questions.
from __future__ import print_function
import json
import readline
import os
from .config import config
read_in = config.read_in
intent_schema_path = config.DEFAULT_INTENT_SCHEMA_LOCATION
empty_schema = """{"intents": []}"""
slot_type_mapping... | [
"json.load",
"json.loads",
"json.dumps"
] | [((1148, 1172), 'json.loads', 'json.loads', (['empty_schema'], {}), '(empty_schema)\n', (1158, 1172), False, 'import json\n'), ((1281, 1298), 'json.load', 'json.load', (['infile'], {}), '(infile)\n', (1290, 1298), False, 'import json\n'), ((2872, 2900), 'json.dumps', 'json.dumps', (['output'], {'indent': '(2)'}), '(out... |
from unittest import main, TestCase
class Node:
def __init__(self, data, next):
self._data = data
self._next = next
def __repr__(self):
return "{} -> {}".format(self._data, self._next)
class Stack:
""" Stack 구현
Interfaces:
push: add to stack as last node
pop... | [
"unittest.main"
] | [((2332, 2338), 'unittest.main', 'main', ([], {}), '()\n', (2336, 2338), False, 'from unittest import main, TestCase\n')] |
from typing import Union
from vyper import ast as vy_ast
from vyper.exceptions import StructureException
from vyper.semantics.types.bases import (
BasePrimitive,
DataLocation,
IndexableTypeDefinition,
)
from vyper.semantics.types.utils import get_type_from_annotation
from vyper.semantics.validation.utils i... | [
"vyper.exceptions.StructureException",
"vyper.semantics.validation.utils.validate_expected_type",
"vyper.semantics.types.utils.get_type_from_annotation"
] | [((759, 802), 'vyper.semantics.validation.utils.validate_expected_type', 'validate_expected_type', (['node', 'self.key_type'], {}), '(node, self.key_type)\n', (781, 802), False, 'from vyper.semantics.validation.utils import validate_expected_type\n'), ((1729, 1803), 'vyper.semantics.types.utils.get_type_from_annotation... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
from jsonschema import ValidationError
import io
import logging
import os
import pkg... | [
"atomic_reactor.plugins.pre_reactor_config.get_smtp_session",
"re.compile",
"atomic_reactor.plugins.pre_reactor_config.ReactorConfigPlugin",
"atomic_reactor.plugins.pre_reactor_config.get_flatpak_base_image",
"io.BytesIO",
"atomic_reactor.plugins.pre_reactor_config.get_operator_manifests",
"tests.stubs.... | [((3037, 3087), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fallback"""', '[False, True]'], {}), "('fallback', [False, True])\n", (3060, 3087), False, 'import pytest\n'), ((3117, 4077), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('config', 'valid')", '[(\n """ version: 1\n ... |
# Copyright (c) 2018, NVIDIA 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 appli... | [
"distutils.version.StrictVersion",
"logging.disable"
] | [((1069, 1099), 'logging.disable', 'logging.disable', (['logging.ERROR'], {}), '(logging.ERROR)\n', (1084, 1099), False, 'import logging\n'), ((2123, 2145), 'distutils.version.StrictVersion', 'StrictVersion', (['"""16.04"""'], {}), "('16.04')\n", (2136, 2145), False, 'from distutils.version import StrictVersion\n'), ((... |
# Typing imports
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import bbUser
from ..bbConfig import bbData, bbConfig
from .items import bbModuleFactory, bbShip, bbWeapon, bbTurret, bbItem
from .items.modules import bbModule
from . import bbInventory
import random
from... | [
"random.choice"
] | [((6707, 6755), 'random.choice', 'random.choice', (['bbData.moduleObjsByTL[itemTL - 1]'], {}), '(bbData.moduleObjsByTL[itemTL - 1])\n', (6720, 6755), False, 'import random\n'), ((6971, 7019), 'random.choice', 'random.choice', (['bbData.weaponObjsByTL[itemTL - 1]'], {}), '(bbData.weaponObjsByTL[itemTL - 1])\n', (6984, 7... |
# -*- encoding: utf-8 -*-
from hypernets.hyperctl.appliation import BatchApplication
from hypernets.hyperctl.server import RestCode, BaseHandler, create_hyperctl_handlers, \
HyperctlWebApplication
from hypernets.utils import logging as hyn_logging
from tsbenchmark import tasks
logger = hyn_logging.getLogger(__nam... | [
"hypernets.hyperctl.server.HyperctlWebApplication",
"tsbenchmark.tasks.TSTask",
"hypernets.hyperctl.server.create_hyperctl_handlers",
"hypernets.utils.logging.getLogger"
] | [((293, 324), 'hypernets.utils.logging.getLogger', 'hyn_logging.getLogger', (['__name__'], {}), '(__name__)\n', (314, 324), True, 'from hypernets.utils import logging as hyn_logging\n'), ((864, 1033), 'tsbenchmark.tasks.TSTask', 'TSTask', (['(1)'], {'task': '"""multivariate-forecast"""', 'target': '"""Var_1"""', 'time_... |
#/*---------------------------------------------------------------------
#This file has been adapted from the implementation
#(available at, Public Domain https://github.com/pq-crystals/kyber)
#of "CRYSTALS - Kyber: a CCA-secure module-lattice-based KEM"
#by : <NAME>, <NAME>, <NAME>, <NAME>,
#<NAME>, <NAME>, <NAME> & <... | [
"math.factorial",
"math.sqrt",
"math.ceil"
] | [((902, 912), 'math.factorial', 'fac', (['(x - y)'], {}), '(x - y)\n', (905, 912), True, 'from math import factorial as fac\n'), ((710, 719), 'math.sqrt', 'sqrt', (['(2.0)'], {}), '(2.0)\n', (714, 719), False, 'from math import log, ceil, erf, sqrt\n'), ((882, 888), 'math.factorial', 'fac', (['x'], {}), '(x)\n', (885, ... |
import pytest
import os
import tempfile
import logging
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA
from app.index import DefaultIndexView
logging.basicConfig(format="%(asctime)s:%(levelname)s:%(name)s:%(message)s")
logging.getLogger().setLevel(logging.ERROR)
app = Flask(__name__)
app.conf... | [
"logging.basicConfig",
"flask_appbuilder.AppBuilder",
"logging.getLogger",
"flask.Flask",
"os.close",
"os.unlink",
"tempfile.mkstemp",
"flask_appbuilder.SQLA"
] | [((168, 244), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s:%(levelname)s:%(name)s:%(message)s"""'}), "(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')\n", (187, 244), False, 'import logging\n'), ((296, 311), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (301, 311)... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
from typing import Any, Callable, Dict, List, Optional
import torch.nn as nn
from pytext.contrib.pytext_lib.data.datasets.batchers import Batcher
from pytext.contrib.pytext_lib.data.datasets.pytext_dataset impo... | [
"logging.getLogger",
"pytext.data.sources.tsv.TSV",
"pytext.data.sources.data_source.SafeFileWrapper"
] | [((448, 475), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (465, 475), False, 'import logging\n'), ((1342, 1399), 'pytext.data.sources.data_source.SafeFileWrapper', 'SafeFileWrapper', (['path'], {'encoding': '"""utf-8"""', 'errors': '"""replace"""'}), "(path, encoding='utf-8', errors='r... |
# a tentative script to upload all existing drstree "versions" into CMIP sqlite database
# each variable, mip, experiment, model, ensemble combination add a new instance in "instance"
# for each instance there should be at least one version in "version" table
# for each version add at least one file in table "files"
... | [
"os.listdir",
"ARCCSSive.CMIP5.other_functions.get_trackid",
"ARCCSSive.CMIP5.other_functions.check_hash",
"ARCCSSive.CMIP5.update_db_functions.insert_unique",
"ARCCSSive.CMIP5.other_functions.list_drs_files",
"ARCCSSive.CMIP5.other_functions.list_tmpdir",
"ARCCSSive.CMIP5.DB.connect",
"ARCCSSive.CMIP... | [((1478, 1490), 'ARCCSSive.CMIP5.DB.connect', 'DB.connect', ([], {}), '()\n', (1488, 1490), False, 'from ARCCSSive.CMIP5 import DB\n'), ((1725, 1743), 'ARCCSSive.CMIP5.other_functions.list_tmpdir', 'list_tmpdir', (['flist'], {}), '(flist)\n', (1736, 1743), False, 'from ARCCSSive.CMIP5.other_functions import list_tmpdir... |
import os
import json
import csv
import shutil
from ..utils.core import flatten_json
class CW:
"""
Base class for continuous file writers.
Can be used as a context manager (using the `with` keyword).
Otherwise, the writer can be explicitly closed.
"""
def __init__(self, file_name, overwrite... | [
"csv.DictWriter",
"os.path.exists",
"csv.DictReader",
"os.makedirs",
"json.dumps",
"os.path.splitext",
"os.path.dirname",
"json.load"
] | [((3183, 3245), 'json.dumps', 'json.dumps', (['item'], {'indent': 'self.indent', 'sort_keys': 'self.sort_keys'}), '(item, indent=self.indent, sort_keys=self.sort_keys)\n', (3193, 3245), False, 'import json\n'), ((4950, 5000), 'csv.DictWriter', 'csv.DictWriter', (['self.file'], {'fieldnames': 'self.columns'}), '(self.fi... |
import os
import openai
from secrets import API_Token
from prompt import en_ru
translate_input = input("What to Translate: ")
openai.api_key = API_Token
response = openai.Completion.create(
engine="davinci",
prompt=en_ru + translate_input + "\nRussian: ",
temperature=0.5,
max_tokens=100,
top_p=1,
frequency_... | [
"openai.Completion.create"
] | [((170, 365), 'openai.Completion.create', 'openai.Completion.create', ([], {'engine': '"""davinci"""', 'prompt': "(en_ru + translate_input + '\\nRussian: ')", 'temperature': '(0.5)', 'max_tokens': '(100)', 'top_p': '(1)', 'frequency_penalty': '(0)', 'presence_penalty': '(0)', 'stop': "['###']"}), "(engine='davinci', pr... |
#programa que vai gerar cinco números aleatórios e colocar em uma tupla.
# Depois disso, mostre a listagem de números gerados e também indique o menor e o maior valor que estão na tupla
from random import randint
n = (randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10))
print(f'Eu sortiei os ... | [
"random.randint"
] | [((218, 232), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (225, 232), False, 'from random import randint\n'), ((234, 248), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (241, 248), False, 'from random import randint\n'), ((250, 264), 'random.randint', 'randint', (['(1)', '(10)'],... |
import sys
import os
import errno
from fontTools.ttLib import TTFont
from os.path import dirname, abspath, join as pjoin
PYVER = sys.version_info[0]
BASEDIR = abspath(pjoin(dirname(__file__), os.pardir, os.pardir))
_enc_kwargs = {}
if PYVER >= 3:
_enc_kwargs = {'encoding': 'utf-8'}
def readTextFile(filename):
w... | [
"os.path.dirname",
"fontTools.ttLib.TTFont",
"os.makedirs"
] | [((560, 615), 'fontTools.ttLib.TTFont', 'TTFont', (['file'], {'recalcBBoxes': '(False)', 'recalcTimestamp': '(False)'}), '(file, recalcBBoxes=False, recalcTimestamp=False)\n', (566, 615), False, 'from fontTools.ttLib import TTFont\n'), ((174, 191), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (181,... |
# -*- coding: utf-8 -*-
import os.path
from bs4 import BeautifulSoup
try:
from io import open
except ImportError:
pass
def find_sub(parent, text):
"""
Given an a ToC entry find an entry directly underneath it with the given
text. Here is the structure of a rendered table of contents with two level... | [
"bs4.BeautifulSoup"
] | [((1578, 1612), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (1591, 1612), False, 'from bs4 import BeautifulSoup\n')] |
import logging
import json
import os
import torch
import pickle
from cnn import CNN
import numpy as np
import gzip
from io import BytesIO, StringIO
OUTPUT_CONTENT_TYPE = 'text/csv'
INPUT_CONTENT_TYPE = 'application/x-npy'
logger = logging.getLogger(__name__)
image_names = []
def model_fn(model_dir):
model_i... | [
"logging.getLogger",
"torch.load",
"os.path.join",
"io.BytesIO",
"torch.from_numpy",
"gzip.decompress",
"torch.cuda.is_available",
"cnn.CNN",
"io.StringIO"
] | [((232, 259), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (249, 259), False, 'import logging\n'), ((634, 686), 'cnn.CNN', 'CNN', ([], {'similarity_dims': "model_info['simililarity-dims']"}), "(similarity_dims=model_info['simililarity-dims'])\n", (637, 686), False, 'from cnn import CNN\... |
#############################################################################
# Copyright (c) 2018 <NAME>. 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... | [
"pyci.api.ci.ci.detect",
"pyci.tests.utils.MagicMock"
] | [((894, 1070), 'pyci.api.ci.ci.detect', 'ci.detect', ([], {'environ': "{'TRAVIS': 'True', 'TRAVIS_REPO_SLUG': 'repo', 'TRAVIS_BRANCH': 'release',\n 'TRAVIS_COMMIT': None, 'TRAVIS_TAG': None, 'TRAVIS_PULL_REQUEST': 'false'}"}), "(environ={'TRAVIS': 'True', 'TRAVIS_REPO_SLUG': 'repo',\n 'TRAVIS_BRANCH': 'release', ... |
from googlemaps.timezone import timezone as _timezone
async def timezone(client, location, timestamp=None, language=None):
return await _timezone(client, location,
timestamp=timestamp,
language=language)
| [
"googlemaps.timezone.timezone"
] | [((142, 209), 'googlemaps.timezone.timezone', '_timezone', (['client', 'location'], {'timestamp': 'timestamp', 'language': 'language'}), '(client, location, timestamp=timestamp, language=language)\n', (151, 209), True, 'from googlemaps.timezone import timezone as _timezone\n')] |
import json
source = "local knowledge"
no_dataset_id = True
query = [('highway', 'bus_stop')]
duplicate_distance=2
max_distance = 10
overpass_timeout = 550
delete_unmatched = True
def dataset(fileobj):
import codecs
source = json.load(codecs.getreader('utf-8-sig')(fileobj))
data = []
for el in sourc... | [
"codecs.getreader"
] | [((247, 276), 'codecs.getreader', 'codecs.getreader', (['"""utf-8-sig"""'], {}), "('utf-8-sig')\n", (263, 276), False, 'import codecs\n')] |
#!/usr/bin/python
# Copyright 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice... | [
"tritonclient.http.InferInput",
"tritonclient.http.InferenceServerClient",
"builtins.range",
"tritonclient.http.InferRequestedOutput",
"numpy.expand_dims",
"unittest.main",
"numpy.full",
"sys.path.append",
"numpy.arange"
] | [((1572, 1600), 'sys.path.append', 'sys.path.append', (['"""../common"""'], {}), "('../common')\n", (1587, 1600), False, 'import sys\n'), ((5132, 5147), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5145, 5147), False, 'import unittest\n'), ((2018, 2083), 'tritonclient.http.InferenceServerClient', 'httpclient.In... |
from django.contrib import admin
from .models import Jobs
# Register your models here.
admin.site.register(Jobs)
| [
"django.contrib.admin.site.register"
] | [((89, 114), 'django.contrib.admin.site.register', 'admin.site.register', (['Jobs'], {}), '(Jobs)\n', (108, 114), False, 'from django.contrib import admin\n')] |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | [
"enaml.qt.QtGui.QApplication.instance",
"enaml.qt.QtCore.QSize",
"enaml.qt.QtGui.QApplication.postEvent",
"enaml.qt.QtCore.Signal",
"enaml.qt.QtCore.QTimer",
"enaml.qt.QtCore.QRect"
] | [((7776, 7788), 'enaml.qt.QtCore.Signal', 'Signal', (['bool'], {}), '(bool)\n', (7782, 7788), False, 'from enaml.qt.QtCore import Qt, QRect, QSize, QPoint, QTimer, Signal\n'), ((7945, 7957), 'enaml.qt.QtCore.Signal', 'Signal', (['bool'], {}), '(bool)\n', (7951, 7957), False, 'from enaml.qt.QtCore import Qt, QRect, QSiz... |
# -*- coding: utf-8 -*-
# Copyright 2011 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
import logging
logger = logging.getLogger(__name__)
#~ from django.utils import unittest
#~ from django.test.client import Client
#from lino.igen import models
#from lino_xl.lib.contacts.models import Contact, Compan... | [
"logging.getLogger",
"lino.core.utils.resolve_model"
] | [((127, 154), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'import logging\n'), ((618, 648), 'lino.core.utils.resolve_model', 'resolve_model', (['"""sales.Invoice"""'], {}), "('sales.Invoice')\n", (631, 648), False, 'from lino.core.utils import resolve_model\n')] |