code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import pickle
class ConnectionHelper:
@staticmethod
def send_json(socket, data):
try:
serialized = json.dumps(data)
except (TypeError, ValueError) as e:
raise Exception('You can only send JSON-serializable data')
# send the length of the serialized ... | [
"pickle.loads",
"json.loads",
"json.dumps",
"pickle.dumps"
] | [((142, 158), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (152, 158), False, 'import json\n'), ((643, 659), 'json.loads', 'json.loads', (['view'], {}), '(view)\n', (653, 659), False, 'import json\n'), ((947, 967), 'pickle.dumps', 'pickle.dumps', (['object'], {}), '(object)\n', (959, 967), False, 'import pic... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set"
] | [((979, 1011), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""regionName"""'}), "(name='regionName')\n", (992, 1011), False, 'import pulumi\n'), ((4768, 4797), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""hashKey"""'}), "(name='hashKey')\n", (4781, 4797), False, 'import pulumi\n'), ((5424, 5460), 'pulumi.ge... |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from collections import namedtuple
import logging
import dns.opcode
import dns.rcode
import dns.rdatatype
import dns.resolver
import dns.reversename
DNS_IP_RDTYPES = (dn... | [
"collections.namedtuple"
] | [((368, 424), 'collections.namedtuple', 'namedtuple', (['"""NameServer"""', "('nameserver', 'ip_addresses')"], {}), "('NameServer', ('nameserver', 'ip_addresses'))\n", (378, 424), False, 'from collections import namedtuple\n')] |
## @package teetool
# This module contains the GaussianProcess class
#
# See GaussianProcess class for more details
import teetool as tt
import numpy as np
from numpy.linalg import det, inv, pinv, cond
## GaussianProcess class evaluates an ensemble of trajectories as a Gaussian process
#
# Such a Gaussian process... | [
"teetool.helpers.nearest_spd",
"numpy.abs",
"numpy.diagflat",
"numpy.empty",
"numpy.ones",
"numpy.linalg.cond",
"numpy.interp",
"numpy.mat",
"numpy.linalg.pinv",
"teetool.helpers.get_cluster_data_norm",
"numpy.zeros_like",
"numpy.multiply",
"numpy.isfinite",
"numpy.reshape",
"numpy.linsp... | [((850, 899), 'teetool.helpers.get_cluster_data_outline', 'tt.helpers.get_cluster_data_outline', (['cluster_data'], {}), '(cluster_data)\n', (885, 899), True, 'import teetool as tt\n'), ((928, 983), 'teetool.helpers.get_cluster_data_norm', 'tt.helpers.get_cluster_data_norm', (['cluster_data', 'outline'], {}), '(cluster... |
"""
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | [
"s2e_env.commands.project_creation.Target.empty",
"os.path.dirname",
"os.path.realpath",
"magic.Magic",
"os.path.exists",
"s2e_env.commands.project_creation.Target",
"argparse.ArgumentTypeError",
"s2e_env.commands.project_creation.abstract_project.validate_arguments",
"os.path.isfile",
"s2e_env.in... | [((1668, 1700), 'logging.getLogger', 'logging.getLogger', (['"""new_project"""'], {}), "('new_project')\n", (1685, 1700), False, 'import logging\n'), ((1908, 1933), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1923, 1933), False, 'import os\n'), ((1946, 1994), 'os.path.join', 'os.path.join... |
import boto3
if __name__ == "__main__":
collectionId='photos'
faces=[]
faces.append("373ce3fd-c2e0-410d-ba78-9023e2216f76")
client=boto3.client('rekognition',region_name='us-east-1')
response=client.delete_faces(CollectionId=collectionId,
FaceIds=faces)
... | [
"boto3.client"
] | [((154, 206), 'boto3.client', 'boto3.client', (['"""rekognition"""'], {'region_name': '"""us-east-1"""'}), "('rekognition', region_name='us-east-1')\n", (166, 206), False, 'import boto3\n')] |
#!/usr/bin/env python3.8
# Copyright (c) 2018 Google 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 l... | [
"os.path.split",
"re.sub"
] | [((1510, 1531), 're.sub', 're.sub', (['"""//.*"""', '""""""', 'l'], {}), "('//.*', '', l)\n", (1516, 1531), False, 'import re\n'), ((1567, 1597), 're.sub', 're.sub', (['"""(^\\\\s+|\\\\s+$)"""', '""""""', 'l'], {}), "('(^\\\\s+|\\\\s+$)', '', l)\n", (1573, 1597), False, 'import re\n'), ((1324, 1350), 'os.path.split', '... |
#!/usr/bin/env python
"""
Apply doi_submission_generator to all pubs
"""
import argparse
import copy
import os
import sys
from pathlib import Path
import subprocess
from natsort import natsorted
import warnings
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate valid XML from metad... | [
"copy.deepcopy",
"pathlib.Path",
"argparse.ArgumentParser",
"subprocess.run"
] | [((254, 359), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate valid XML from metadata.json for Crossref submission"""'}), "(description=\n 'Generate valid XML from metadata.json for Crossref submission')\n", (277, 359), False, 'import argparse\n'), ((3275, 3284), 'pathlib.Path... |
# Generated by Django 3.1.2 on 2020-11-05 12:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='catenauser',
name='access_token',
... | [
"django.db.models.TextField"
] | [((331, 387), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)', 'verbose_name': '"""Access Token"""'}), "(null=True, verbose_name='Access Token')\n", (347, 387), False, 'from django.db import migrations, models\n')] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cv2
import tensorflow as tf
from PIL import Image
import os
from sklearn.model_selection import train_test_split
from keras.utils import to_categorical
from keras.models import Sequential, load_model
from keras.layers import Conv2D, MaxPool... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"keras.layers.MaxPool2D",
"matplotlib.pyplot.figure",
"keras.layers.Flatten",
"keras.utils.to_categorical",
"matplotlib.pyplot.show",
"keras.layers.Dropout",
"matplotlib.py... | [((395, 406), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (404, 406), False, 'import os\n'), ((916, 930), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (924, 930), True, 'import numpy as np\n'), ((940, 956), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (948, 956), True, 'import numpy as np\n'), (... |
import dataclasses
import re
import sys
import copy
import json
import yaml
from enum import Enum
from pathlib import Path
from dataclasses import dataclass, field
from typing import Any, Iterable, List, NewType, Optional, Tuple, Union, Dict
from transformers.hf_argparser import HfArgumentParser as ArgumentParser
Da... | [
"copy.copy",
"pathlib.Path",
"dataclasses.fields",
"typing.NewType",
"re.compile"
] | [((330, 355), 'typing.NewType', 'NewType', (['"""DataClass"""', 'Any'], {}), "('DataClass', Any)\n", (337, 355), False, 'from typing import Any, Iterable, List, NewType, Optional, Tuple, Union, Dict\n'), ((372, 401), 'typing.NewType', 'NewType', (['"""DataClassType"""', 'Any'], {}), "('DataClassType', Any)\n", (379, 40... |
import qcircuits as qc
# Quantum Teleportation: transmitting two classical bits to transport a qubit state
# Alice has a qubit in a given quantum state.
# Alice and Bob have previously prepared a Bell state, and have since
# physically separated the qubits.
# Alice manipulates her hidden qubit and her half of the Bel... | [
"qcircuits.Hadamard",
"qcircuits.CNOT",
"qcircuits.PauliX",
"qcircuits.PauliZ",
"qcircuits.bell_state",
"qcircuits.qubit"
] | [((600, 609), 'qcircuits.CNOT', 'qc.CNOT', ([], {}), '()\n', (607, 609), True, 'import qcircuits as qc\n'), ((618, 631), 'qcircuits.Hadamard', 'qc.Hadamard', ([], {}), '()\n', (629, 631), True, 'import qcircuits as qc\n'), ((640, 651), 'qcircuits.PauliX', 'qc.PauliX', ([], {}), '()\n', (649, 651), True, 'import qcircui... |
# built-in
import ast
from textwrap import dedent
# external
import astroid
import pytest
# project
from deal.linter._extractors import get_exceptions
@pytest.mark.parametrize('text, expected', [
('raise BaseException', (BaseException, )),
('raise ValueError', (ValueError, )),
('raise UnknownError', ('U... | [
"textwrap.dedent",
"deal.linter._extractors.get_exceptions",
"astroid.parse",
"ast.dump",
"pytest.mark.parametrize",
"ast.parse"
] | [((156, 942), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text, expected"""', '[(\'raise BaseException\', (BaseException,)), (\'raise ValueError\', (\n ValueError,)), (\'raise UnknownError\', (\'UnknownError\',)), (\n \'raise ValueError("lol")\', (ValueError,)), (\'raise unknown()\', ()), (\n \... |
import io
import numpy as np
import pytest
from typing import List, Tuple
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.observation_pb2 import (
ObservationProto,
NONE,
PNG,
)
from mlagents_envs.communicator_objects.brain_parameters_pb2... | [
"numpy.sum",
"mlagents_envs.communicator_objects.observation_pb2.ObservationProto",
"mlagents_envs.rpc_utils.behavior_spec_from_proto",
"numpy.allclose",
"mlagents_envs.communicator_objects.brain_parameters_pb2.BrainParametersProto",
"numpy.mean",
"mlagents_envs.base_env.ActionSpec.create_continuous",
... | [((2964, 2982), 'mlagents_envs.communicator_objects.observation_pb2.ObservationProto', 'ObservationProto', ([], {}), '()\n', (2980, 2982), False, 'from mlagents_envs.communicator_objects.observation_pb2 import ObservationProto, NONE, PNG\n'), ((3569, 3587), 'mlagents_envs.communicator_objects.observation_pb2.Observatio... |
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from pytest import FixtureRequest
pytest_plugins = ["pytester"]
@pytest.fixture(scope="session")
def event_loop():
"""Redefine pytest-asyncio event_loop fixture with 'session' scope."""
l... | [
"pytest.fixture",
"asyncio.get_event_loop_policy"
] | [((190, 221), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (204, 221), False, 'import pytest\n'), ((410, 441), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (424, 441), False, 'import pytest\n'), ((480, 508), 'pytest.fixture'... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import utils
from time import sleep
from urllib import parse
from requests import codes, exceptions
# Developer token
apikey = utils.config('api_key')
def run(string, entities):
"""Verify if one or several email addresses have been pwned"""
emails = []
... | [
"utils.http",
"utils.config",
"time.sleep",
"utils.translate",
"urllib.parse.quote_plus"
] | [((174, 197), 'utils.config', 'utils.config', (['"""api_key"""'], {}), "('api_key')\n", (186, 197), False, 'import utils\n'), ((2149, 2157), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (2154, 2157), False, 'from time import sleep\n'), ((473, 495), 'utils.config', 'utils.config', (['"""emails"""'], {}), "('emails')\n... |
import sys
def FileHeader(time, in_file, out_file, intra_gap_tol, inter_gap_tol, overlap_tol, eval_tol, Tot_prot_cnt, Tot_cnt, NC_cnt, CP_cnt, IS_cnt):
fileHeader = \
"""#===========================================================================================
# DOMAIN MAPPER v2.0.2
# Johns Hopkins Univeristy ... | [
"sys.stderr.write",
"sys.stderr.flush",
"sys.exit"
] | [((3015, 3039), 'sys.stderr.write', 'sys.stderr.write', (['ErrMsg'], {}), '(ErrMsg)\n', (3031, 3039), False, 'import sys\n'), ((3044, 3062), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (3060, 3062), False, 'import sys\n'), ((3074, 3084), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3082, 3084), False, 'impo... |
import sys
READ_POINTS = 0
READ_FOLDS = 1
def main(args):
with open("test_input.txt" if len(args) > 1 and args[1] == "-t" else "input.txt") as f:
mode = READ_POINTS
points = set()
folds = []
for line in f.readlines():
line = line.strip("\n")
if mode == READ_POINTS:
... | [
"sys.stdout.write"
] | [((1686, 1708), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (1702, 1708), False, 'import sys\n'), ((1600, 1621), 'sys.stdout.write', 'sys.stdout.write', (['"""#"""'], {}), "('#')\n", (1616, 1621), False, 'import sys\n'), ((1655, 1676), 'sys.stdout.write', 'sys.stdout.write', (['"""."""'], {... |
import unittest
from celery import Celery
from django.conf import settings
from django.db import connection
class SmokeTests(unittest.TestCase):
def test_can_access_db(self):
"""
access the database
"""
cursor = connection.cursor()
cursor.execute("SELECT 1")
row = ... | [
"celery.Celery",
"django.db.connection.cursor"
] | [((251, 270), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (268, 270), False, 'from django.db import connection\n'), ((542, 563), 'celery.Celery', 'Celery', (['"""cla_backend"""'], {}), "('cla_backend')\n", (548, 563), False, 'from celery import Celery\n')] |
import os
from collections import OrderedDict
from click.testing import CliRunner
from great_expectations import DataContext
from great_expectations.cli.v012 import cli
from tests.cli.v012.test_cli import yaml
from tests.cli.v012.utils import (
assert_dict_key_and_val_in_stdout,
assert_no_logging_messages_or_... | [
"tests.cli.v012.utils.assert_no_tracebacks",
"great_expectations.DataContext",
"tests.cli.v012.utils.assert_no_logging_messages_or_tracebacks",
"collections.OrderedDict",
"click.testing.CliRunner",
"os.path.join"
] | [((578, 607), 'great_expectations.DataContext', 'DataContext', (['project_root_dir'], {}), '(project_root_dir)\n', (589, 607), False, 'from great_expectations import DataContext\n'), ((622, 649), 'click.testing.CliRunner', 'CliRunner', ([], {'mix_stderr': '(False)'}), '(mix_stderr=False)\n', (631, 649), False, 'from cl... |
#!/usr/bin/env python3 -u
# -*- coding: utf-8 -*-
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
from logging import warning
import numpy as np
import pandas as pd
from sklearn.utils import check_array, check_consistent_length
from sktime.datatypes import check_is_scitype, convert
from sktime... | [
"pandas.DataFrame",
"sktime.datatypes.check_is_scitype",
"numpy.isin",
"numpy.average",
"sklearn.utils.check_array",
"logging.warning",
"numpy.asarray",
"sktime.datatypes.convert",
"pandas.MultiIndex.from_product",
"pandas.Series",
"numpy.tile",
"sklearn.utils.check_consistent_length",
"nump... | [((10207, 10236), 'pandas.Series', 'pd.Series', ([], {'index': 'y_pred.index'}), '(index=y_pred.index)\n', (10216, 10236), True, 'import pandas as pd\n'), ((10848, 10887), 'sklearn.utils.check_consistent_length', 'check_consistent_length', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (10871, 10887), False, 'from s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 <NAME> <<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 Software without restriction, including without limitation the ... | [
"tcflib.service.run_as_cli",
"re.sub",
"tcflib.tagsets.TagSet"
] | [((1437, 1454), 'tcflib.tagsets.TagSet', 'TagSet', (['"""DC-1345"""'], {}), "('DC-1345')\n", (1443, 1454), False, 'from tcflib.tagsets import TagSet\n'), ((3995, 4019), 'tcflib.service.run_as_cli', 'run_as_cli', (['MalletWorker'], {}), '(MalletWorker)\n', (4005, 4019), False, 'from tcflib.service import ExportingWorker... |
# -*- coding: utf-8 -*-
# @Time : 2019/4/2 14:53
# @Author : Alan
# @Email : <EMAIL>
# @File : demo test.py
# @Software: PyCharm
from elasticsearch import Elasticsearch
import json
es = Elasticsearch()
data = {'title': '美国留给伊拉克的是个烂摊子吗', 'url': 'http://view.news.qq.com/zt2011/usa_iraq/index.htm'}
data2 = {'t... | [
"elasticsearch.Elasticsearch",
"json.dumps"
] | [((198, 213), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {}), '()\n', (211, 213), False, 'from elasticsearch import Elasticsearch\n'), ((2418, 2433), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {}), '()\n', (2431, 2433), False, 'from elasticsearch import Elasticsearch\n'), ((2507, 2558), 'json.dumps'... |
import random
from time import sleep
def rand_wait_min(a=None, b=None):
a = a if not a else a * 60
b = b if not b else b * 60
rand_wait_sec(a, b)
def rand_wait_sec(min_v=2, max_v=3):
sleep(random.randint(min_v, max_v))
| [
"random.randint"
] | [((209, 237), 'random.randint', 'random.randint', (['min_v', 'max_v'], {}), '(min_v, max_v)\n', (223, 237), False, 'import random\n')] |
import time
import numpy as np
import torch
from onpolicy.runner.shared.base_runner import Runner
import wandb
import imageio
def _t2n(x):
return x.detach().cpu().numpy()
class MPERunner(Runner):
"""Runner class to perform training, evaluation. and data collection for the MPEs. See parent class for details.""... | [
"numpy.zeros",
"numpy.ones",
"numpy.expand_dims",
"time.time",
"time.sleep",
"numpy.mean",
"numpy.array",
"numpy.eye",
"torch.no_grad",
"numpy.concatenate"
] | [((3685, 3700), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3698, 3700), False, 'import torch\n'), ((6358, 6373), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6371, 6373), False, 'import torch\n'), ((8961, 8976), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8974, 8976), False, 'import torch\n')... |
import re
from django.core.exceptions import ValidationError
def phone_validator(value):
v = re.match('^[0-9\+]{8,13}$', value)
if v is None:
raise ValidationError('Tylko cyfry (min.9) np.111222333')
return True
| [
"django.core.exceptions.ValidationError",
"re.match"
] | [((100, 135), 're.match', 're.match', (['"""^[0-9\\\\+]{8,13}$"""', 'value'], {}), "('^[0-9\\\\+]{8,13}$', value)\n", (108, 135), False, 'import re\n'), ((167, 218), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""Tylko cyfry (min.9) np.111222333"""'], {}), "('Tylko cyfry (min.9) np.111222333')\n", (... |
# -*- coding: utf-8 -*-
"""Module providing schema definitions for general widgets"""
from plone.app.textfield import RichText
from plone.autoform.interfaces import IFormFieldProvider
from zope import schema
from zope.interface import Interface, provider
from ade25.widgets import MessageFactory as _
@provider(IFormF... | [
"ade25.widgets.MessageFactory",
"zope.interface.provider"
] | [((305, 333), 'zope.interface.provider', 'provider', (['IFormFieldProvider'], {}), '(IFormFieldProvider)\n', (313, 333), False, 'from zope.interface import Interface, provider\n'), ((414, 442), 'zope.interface.provider', 'provider', (['IFormFieldProvider'], {}), '(IFormFieldProvider)\n', (422, 442), False, 'from zope.i... |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"fate_flow.utils.job_utils.job_server_routing",
"io.BytesIO",
"flask.request.json.get",
"os.path.join",
"tarfile.open",
"fate_flow.utils.job_utils.get_job_log_directory",
"fate_flow.driver.job_controller.JobController.submit_job",
"flask.Flask",
"fate_flow.utils.api_utils.get_json_result",
"os.wal... | [((1188, 1203), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1193, 1203), False, 'from flask import Flask, request, send_file\n'), ((2671, 2701), 'fate_flow.utils.job_utils.job_server_routing', 'job_utils.job_server_routing', ([], {}), '()\n', (2699, 2701), False, 'from fate_flow.utils import job_utils,... |
##############################################################################
# Institute for the Design of Advanced Energy Systems Process Systems
# Engineering Framework (IDAES PSE Framework) Copyright (c) 2018-2019, by the
# software owners: The Regents of the University of California, through
# Lawrence Berkeley N... | [
"idaes.surrogate.ripe.ems",
"idaes.surrogate.ripe.ripemodel",
"numpy.random.seed",
"numpy.zeros",
"numpy.array"
] | [((907, 925), 'numpy.random.seed', 'np.random.seed', (['(20)'], {}), '(20)\n', (921, 925), True, 'import numpy as np\n'), ((1634, 1768), 'idaes.surrogate.ripe.ripemodel', 'ripe.ripemodel', (['cdata'], {'stoich': 'stoich', 'mechanisms': 'mechs', 'x0': 'cdata0', 'hide_output': '(False)', 'sigma': 'sigma', 'deltaterm': '(... |
import os
import numpy as np
from glob import glob
from os.path import join
import torch.utils.data as data
from sklearn.neighbors import NearestNeighbors
import datasets_util
class GeolocDataset(data.Dataset):
def __init__(self, datasets_folder="datasets", dataset_name="pitts30k", split="train", positive_dist_... | [
"sklearn.neighbors.NearestNeighbors",
"os.path.join",
"datasets_util.open_image_and_apply_transform",
"os.path.exists"
] | [((1037, 1089), 'os.path.join', 'join', (['datasets_folder', 'dataset_name', '"""images"""', 'split'], {}), "(datasets_folder, dataset_name, 'images', split)\n", (1041, 1089), False, 'from os.path import join\n'), ((1308, 1344), 'os.path.join', 'join', (['self.dataset_folder', '"""gallery"""'], {}), "(self.dataset_fold... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict
from typing import Dict, Set, List, Tuple
from time import time
from subprocess import run, PIPE, TimeoutExpired
from random import randint
import re
class NetworkError(RuntimeError):
"""any error related to this module"""
class... | [
"subprocess.run",
"random.randint",
"re.match",
"time.time",
"collections.defaultdict",
"re.search"
] | [((8302, 8343), 'subprocess.run', 'run', (['connect_args'], {'stderr': 'PIPE', 'timeout': '(2)'}), '(connect_args, stderr=PIPE, timeout=2)\n', (8305, 8343), False, 'from subprocess import run, PIPE, TimeoutExpired\n'), ((9402, 9446), 'subprocess.run', 'run', (['disconnect_args'], {'stderr': 'PIPE', 'timeout': '(2)'}), ... |
# -*- coding: utf-8 -*-
"""
Source: https://github.com/awesto/django-shop/blob/3a069d764a7b72ef119828220869dcfbbfc1b9c5/shop/apps.py
"""
from __future__ import unicode_literals
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ShopConfig(AppConfig):
name = 'edw_shop'... | [
"django.utils.translation.ugettext_lazy",
"edw.deferred.ForeignKeyBuilder.check_for_pending_mappings"
] | [((340, 349), 'django.utils.translation.ugettext_lazy', '_', (['"""Shop"""'], {}), "('Shop')\n", (341, 349), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((981, 1027), 'edw.deferred.ForeignKeyBuilder.check_for_pending_mappings', 'ForeignKeyBuilder.check_for_pending_mappings', ([], {}), '()\n', (1... |
# https://github.com/JasonHaley/hello-python/tree/master/app
from flask import Flask, request
import socket
import datetime
app = Flask(__name__)
@app.route("/")
def hello():
msg ='Your URL is "{}" .\nFrom Hands On GKE.\nHostName: {}\nIP: {}\nCurrent time: {}\n'.format(request.url, host_name, host_ip, current_ti... | [
"socket.gethostname",
"flask.Flask",
"datetime.datetime.now",
"socket.gethostbyname"
] | [((132, 147), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'from flask import Flask, request\n'), ((603, 623), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (621, 623), False, 'import socket\n'), ((643, 674), 'socket.gethostbyname', 'socket.gethostbyname', (['host_name'... |
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
import CoolProp
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize = (2,2))
ax = fig.add_subplot(111, projection='3d')
NT = 1000
NR = 1000
rho,t = np.logspace(np.log10(2e-3), np.log10(1... | [
"numpy.meshgrid",
"numpy.log",
"matplotlib.pyplot.close",
"CoolProp.CoolProp.PropsSI",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.linspace",
"numpy.log10",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig"
] | [((18, 41), 'matplotlib.use', 'matplotlib.use', (['"""WXAgg"""'], {}), "('WXAgg')\n", (32, 41), False, 'import matplotlib\n'), ((182, 208), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2, 2)'}), '(figsize=(2, 2))\n', (192, 208), True, 'import matplotlib.pyplot as plt\n'), ((365, 384), 'numpy.meshgrid', ... |
# modify_annotations_txt.py
import glob
import string
txt_list = glob.glob('/media/wrc/0EB90E450EB90E45/data/kitti/label_2/*.txt') # 存储Labels文件夹所有txt文件路径
def show_category(txt_list):
category_list= []
for item in txt_list:
try:
with open(item) as tdf:
for each_line... | [
"glob.glob"
] | [((70, 135), 'glob.glob', 'glob.glob', (['"""/media/wrc/0EB90E450EB90E45/data/kitti/label_2/*.txt"""'], {}), "('/media/wrc/0EB90E450EB90E45/data/kitti/label_2/*.txt')\n", (79, 135), False, 'import glob\n')] |
import json
import os
import shutil
import time
from flask import Flask
from flask.testing import FlaskClient
from pyfakefs.fake_filesystem import FakeFilesystem
def wait_for_task(client: FlaskClient, name: str) -> None:
while True:
time.sleep(0.5)
resp = client.get('/task',
... | [
"json.loads",
"os.makedirs",
"os.path.exists",
"json.dumps",
"time.sleep",
"shutil.rmtree"
] | [((773, 822), 'os.path.exists', 'os.path.exists', (["app.config['BASE_CLASSIFIER_DIR']"], {}), "(app.config['BASE_CLASSIFIER_DIR'])\n", (787, 822), False, 'import os\n'), ((885, 946), 'os.makedirs', 'os.makedirs', (["app.config['BASE_CLASSIFIER_DIR']"], {'exist_ok': '(True)'}), "(app.config['BASE_CLASSIFIER_DIR'], exis... |
from models.original_models import wide_resnet_model
from tools.foolbox.model import Model
class WideResNetModel(Model):
def __init__(self, checkpoint_path, image_height=32, image_width=32, n_channels=3, n_classes=10):
super().__init__(image_height=image_height, image_width=image_width, n_channels=n_chann... | [
"models.original_models.wide_resnet_model.WideResnetModel"
] | [((461, 619), 'models.original_models.wide_resnet_model.WideResnetModel', 'wide_resnet_model.WideResnetModel', ([], {'image_height': 'self.image_height', 'image_width': 'self.image_width', 'n_channels': 'self.n_channels', 'n_classes': 'self.n_classes'}), '(image_height=self.image_height,\n image_width=self.image_wid... |
import logging
import time
from dataclasses import dataclass, field
from typing import Iterable, List
import confluent_kafka
from confluent_kafka.schema_registry.schema_registry_client import SchemaRegistryClient
import datahub.ingestion.extractor.schema_util as schema_util
from datahub.configuration import ConfigMod... | [
"datahub.metadata.com.linkedin.pegasus2avro.mxe.MetadataChangeEvent",
"datahub.metadata.com.linkedin.pegasus2avro.common.AuditStamp",
"datahub.configuration.kafka.KafkaConsumerConnectionConfig",
"datahub.metadata.com.linkedin.pegasus2avro.metadata.snapshot.DatasetSnapshot",
"datahub.configuration.common.All... | [((1019, 1046), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1036, 1046), False, 'import logging\n'), ((1176, 1207), 'datahub.configuration.kafka.KafkaConsumerConnectionConfig', 'KafkaConsumerConnectionConfig', ([], {}), '()\n', (1205, 1207), False, 'from datahub.configuration.kafka im... |
import os
import os
API_ID = int(os.getenv("API_ID"))
API_HASH = os.getenv("API_HASH")
BOT_TOKEN = os.getenv("SESSION")
LOG_GRP = os.getenv("LOG_GRP")
| [
"os.getenv"
] | [((68, 89), 'os.getenv', 'os.getenv', (['"""API_HASH"""'], {}), "('API_HASH')\n", (77, 89), False, 'import os\n'), ((102, 122), 'os.getenv', 'os.getenv', (['"""SESSION"""'], {}), "('SESSION')\n", (111, 122), False, 'import os\n'), ((133, 153), 'os.getenv', 'os.getenv', (['"""LOG_GRP"""'], {}), "('LOG_GRP')\n", (142, 15... |
from __future__ import division
import sys
import pytest
import numpy as np
from datashader.glyphs import Glyph
from datashader.glyphs.line import _build_draw_segment, \
_build_map_onto_pixel_for_line
from datashader.utils import ngjit
py2_skip = pytest.mark.skipif(sys.version_info.major < 3, reason="py2 not s... | [
"datashader.glyphs.Glyph._expand_aggs_and_cols",
"numpy.zeros",
"pytest.mark.benchmark",
"pytest.mark.skipif",
"datashader.utils.ngjit",
"datashader.glyphs.line._build_map_onto_pixel_for_line",
"datashader.glyphs.line._build_draw_segment"
] | [((256, 330), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(sys.version_info.major < 3)'], {'reason': '"""py2 not supported"""'}), "(sys.version_info.major < 3, reason='py2 not supported')\n", (274, 330), False, 'import pytest\n'), ((342, 360), 'datashader.utils.ngjit', 'ngjit', (['(lambda x: x)'], {}), '(lambda x: x... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"sqlalchemy.inspect",
"sqlalchemy.func.current_timestamp",
"itertools.zip_longest",
"flask_marshmallow.Marshmallow",
"sqlalchemy.Column",
"logging.getLogger"
] | [((1207, 1234), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1224, 1234), False, 'import logging\n'), ((1659, 1672), 'flask_marshmallow.Marshmallow', 'Marshmallow', ([], {}), '()\n', (1670, 1672), False, 'from flask_marshmallow import Marshmallow\n'), ((2201, 2254), 'sqlalchemy.Column'... |
import pytest
import sys
sys.path.append('../src')
from remap import parse_schema
def test_import_aws(file):
parse_schema(file)
return
if __name__ == '__main__':
test_import_aws("./schema.txt") | [
"sys.path.append",
"remap.parse_schema"
] | [((25, 50), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (40, 50), False, 'import sys\n'), ((114, 132), 'remap.parse_schema', 'parse_schema', (['file'], {}), '(file)\n', (126, 132), False, 'from remap import parse_schema\n')] |
#!/usr/bin/env python
"""
Horizontal split example.
"""
from __future__ import unicode_literals
from prompt_toolkit.application import Application
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.layout.containers import HSplit, Window
from prompt_toolkit.layout.controls import FormattedTextContr... | [
"prompt_toolkit.layout.containers.Window",
"prompt_toolkit.key_binding.KeyBindings",
"prompt_toolkit.layout.layout.Layout",
"prompt_toolkit.layout.controls.FormattedTextControl"
] | [((698, 711), 'prompt_toolkit.key_binding.KeyBindings', 'KeyBindings', ([], {}), '()\n', (709, 711), False, 'from prompt_toolkit.key_binding import KeyBindings\n'), ((562, 588), 'prompt_toolkit.layout.containers.Window', 'Window', ([], {'height': '(1)', 'char': '"""-"""'}), "(height=1, char='-')\n", (568, 588), False, ... |
# __init__.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
"""
Public API for flowsa
For standard dataframe formats, see
https://github.com/USEPA/flowsa/tree/master/format%20specs
Files are loaded from a user's local directory
https://github.com/USEPA/flowsa/wiki/Data-Storage#local-storage
or can be downloaded fro... | [
"flowsa.bibliography.generate_fbs_bibliography",
"flowsa.settings.log.info",
"esupy.processed_data_mgmt.load_preprocessed_output",
"esupy.processed_data_mgmt.download_from_remote",
"flowsa.settings.log.error",
"flowsa.metadata.set_fb_meta",
"flowsa.flowbyfunctions.filter_by_geoscale",
"flowsa.validati... | [((2098, 2133), 'flowsa.metadata.set_fb_meta', 'set_fb_meta', (['name', '"""FlowByActivity"""'], {}), "(name, 'FlowByActivity')\n", (2109, 2133), False, 'from flowsa.metadata import set_fb_meta\n'), ((2186, 2227), 'esupy.processed_data_mgmt.load_preprocessed_output', 'load_preprocessed_output', (['fba_meta', 'paths'], ... |
"""Example of a custom gym environment and model. Run this for a demo.
This example shows:
- using a custom environment
- using a custom model
- using Tune for grid search
You can visualize experiment results in ~/ray_results using TensorBoard.
"""
import argparse
import os
import numpy as np
import pygame
impor... | [
"argparse.ArgumentParser",
"pygame.event.get",
"ray.rllib.agents.ppo.PPOTrainer",
"WindAI.farm_env.env.FarmEnv",
"pygame.display.update",
"pygame.font.Font",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"pygame.display.set_mode",
"ray.rllib.models.torch.fcnet.FullyConnectedNetwork",
"pygame.... | [((1228, 1243), 'ray.rllib.utils.framework.try_import_tf', 'try_import_tf', ([], {}), '()\n', (1241, 1243), False, 'from ray.rllib.utils.framework import try_import_tf, try_import_torch\n'), ((1256, 1274), 'ray.rllib.utils.framework.try_import_torch', 'try_import_torch', ([], {}), '()\n', (1272, 1274), False, 'from ray... |
import smart_imports
smart_imports.all()
class HeroStatisticsTest(utils_testcase.TestCase):
def setUp(self):
super(HeroStatisticsTest, self).setUp()
self.place_1, self.place_2, self.place_3 = game_logic.create_test_map()
account = self.accounts_factory.create_account()
self.s... | [
"smart_imports.all"
] | [((23, 42), 'smart_imports.all', 'smart_imports.all', ([], {}), '()\n', (40, 42), False, 'import smart_imports\n')] |
from pathlib import Path
COIN_MARKET_CAP_URL = "https://coinmarketcap.com/currencies/bitcoin/markets"
WEB_API_EXCHANGE_PRICE_URL = "https://web-api.coinmarketcap.com/v1/exchange/market-pairs/latest?id="
COIN_NAME_BITCOIN = "BitCoin"
COIN_NAME_ETC = "ETC"
TARGET_EXCHANGE_SET = {"Binance", "Gemini", "Bitfinex", "Coin... | [
"pathlib.Path"
] | [((783, 797), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (787, 797), False, 'from pathlib import Path\n')] |
# Who were the top 3 editors during that hour?
import requests
import json
ENDPOINT = 'https://en.wikipedia.org/w/api.php'
parameters = { 'action' : 'query',
'prop' : 'revisions',
'titles' : 'Panama_Papers',
'format' : 'json',
'rvdir' : 'newer',
... | [
"requests.get"
] | [((528, 569), 'requests.get', 'requests.get', (['ENDPOINT'], {'params': 'parameters'}), '(ENDPOINT, params=parameters)\n', (540, 569), False, 'import requests\n')] |
"""
Copied from ESRI documentation
"""
import arcpy, time, smtplib
# Set the workspace
arcpy.env.workspace = 'Database Connections/admin.sde'
# Set a variable for the workspace
workspace = arcpy.env.workspace
# Get a list of connected users.
userList = arcpy.ListUsers("Database Connections/admin.sde")
# Get a lis... | [
"arcpy.Compress_management",
"arcpy.ReconcileVersions_management",
"smtplib.SMTP",
"arcpy.DisconnectUser",
"arcpy.AnalyzeDatasets_management",
"arcpy.ListVersions",
"arcpy.RebuildIndexes_management",
"time.sleep",
"arcpy.AcceptConnections",
"arcpy.ListUsers"
] | [((258, 307), 'arcpy.ListUsers', 'arcpy.ListUsers', (['"""Database Connections/admin.sde"""'], {}), "('Database Connections/admin.sde')\n", (273, 307), False, 'import arcpy, time, smtplib\n'), ((940, 960), 'smtplib.SMTP', 'smtplib.SMTP', (['SERVER'], {}), '(SERVER)\n', (952, 960), False, 'import arcpy, time, smtplib\n'... |
import requests
import urllib
from django.conf import settings
from django.contrib.auth import get_user_model, login
from django.contrib import messages
from django.http.response import HttpResponseRedirect
from django.shortcuts import redirect
from django.utils.module_loading import import_string
from django_salesfo... | [
"django.utils.module_loading.import_string",
"urllib.parse.urlencode",
"django.shortcuts.redirect",
"django.contrib.messages.error",
"django.contrib.auth.get_user_model",
"django_salesforce_oauth.utils.get_or_create_user",
"django.contrib.messages.info",
"requests.post",
"django.contrib.auth.login"
... | [((1108, 1140), 'urllib.parse.urlencode', 'urllib.parse.urlencode', (['url_args'], {}), '(url_args)\n', (1130, 1140), False, 'import urllib\n'), ((1184, 1197), 'django.shortcuts.redirect', 'redirect', (['url'], {}), '(url)\n', (1192, 1197), False, 'from django.shortcuts import redirect\n'), ((1955, 1979), 'requests.pos... |
from datetime import datetime
from operator import itemgetter
from os.path import dirname, join
import pytest # noqa
from city_scrapers_core.constants import BOARD, PASSED
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_land_trust import ChiLandTrus... | [
"city_scrapers.spiders.chi_land_trust.ChiLandTrustSpider",
"os.path.dirname",
"datetime.datetime",
"freezegun.freeze_time",
"operator.itemgetter"
] | [((536, 556), 'city_scrapers.spiders.chi_land_trust.ChiLandTrustSpider', 'ChiLandTrustSpider', ([], {}), '()\n', (554, 556), False, 'from city_scrapers.spiders.chi_land_trust import ChiLandTrustSpider\n'), ((568, 593), 'freezegun.freeze_time', 'freeze_time', (['"""2019-07-11"""'], {}), "('2019-07-11')\n", (579, 593), F... |
import time
import numpy as np
from pyembree import rtcore_scene as rtcs
from pyembree.mesh_construction import TriangleMesh
N = 4
def xplane(x):
return [[[x, -1.0, -1.0],
[x, +1.0, -1.0],
[x, -1.0, +1.0]],
[[x, +1.0, -1.0],
[x, +1.0, +1.0],
[x, -1... | [
"pyembree.rtcore_scene.EmbreeScene",
"numpy.zeros",
"time.time",
"numpy.array",
"pyembree.mesh_construction.TriangleMesh",
"numpy.vstack"
] | [((370, 400), 'numpy.array', 'np.array', (['triangles', '"""float32"""'], {}), "(triangles, 'float32')\n", (378, 400), True, 'import numpy as np\n'), ((410, 428), 'pyembree.rtcore_scene.EmbreeScene', 'rtcs.EmbreeScene', ([], {}), '()\n', (426, 428), True, 'from pyembree import rtcore_scene as rtcs\n'), ((436, 466), 'py... |
import configuration.location_configurations as loc_conf
import requests
from requests.structures import CaseInsensitiveDict
class HomeLocation:
def __init__(self, coordinates: [str, None]):
self.coordinates = coordinates
if coordinates:
self.data = {}
self.extract_raw_data... | [
"requests.structures.CaseInsensitiveDict",
"requests.get"
] | [((719, 740), 'requests.structures.CaseInsensitiveDict', 'CaseInsensitiveDict', ([], {}), '()\n', (738, 740), False, 'from requests.structures import CaseInsensitiveDict\n'), ((1898, 1919), 'requests.structures.CaseInsensitiveDict', 'CaseInsensitiveDict', ([], {}), '()\n', (1917, 1919), False, 'from requests.structures... |
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render, redirect
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
from main.user_utils import get_id
from main.utils import get_md5, generate_token, certify_token
from passport.models import ... | [
"passport.models.User",
"main.utils.get_md5",
"passport.models.UserGroup.objects.order_by",
"main.user_utils.get_id",
"django.shortcuts.render",
"main.utils.certify_token"
] | [((878, 925), 'django.shortcuts.render', 'render', (['request', '"""passport/login.html"""', 'context'], {}), "(request, 'passport/login.html', context)\n", (884, 925), False, 'from django.shortcuts import render, redirect\n'), ((1689, 1736), 'django.shortcuts.render', 'render', (['request', '"""passport/login.html"""'... |
# ______ _____ _ ________
# / ____/___ / ___/(_)___ ___ / _/ __ |
# / / / __ \\__ \/ / __ `__ \ / // / / /
# / /___/ /_/ /__/ / / / / / / // // /_/ /
# \____/\____/____/_/_/ /_/ /_/___/\____/
# Kratos CoSimulationApplication
#
# License: BSD License, see license.txt
#
# Main auth... | [
"CoSimIO.ModelPart",
"CoSimIO.ImportMesh",
"CoSimIO.Disconnect",
"CoSimIO.Info",
"CoSimIO.mpi.mpi4pyInterface.mpi4pyCommHolder"
] | [((656, 670), 'CoSimIO.Info', 'CoSimIO.Info', ([], {}), '()\n', (668, 670), False, 'import CoSimIO\n'), ((1119, 1133), 'CoSimIO.Info', 'CoSimIO.Info', ([], {}), '()\n', (1131, 1133), False, 'import CoSimIO\n'), ((1242, 1274), 'CoSimIO.ModelPart', 'CoSimIO.ModelPart', (['"""mp_exchange"""'], {}), "('mp_exchange')\n", (1... |
import asyncio
import httpx
import pytest
from asgi_lifespan import LifespanManager
from fastapi import status
@pytest.fixture(scope="session")
def event_loop():
loop = asyncio.get_event_loop()
yield loop
loop.close()
@pytest.fixture
async def test_client():
async with LifespanManager(app):
... | [
"httpx.AsyncClient",
"asgi_lifespan.LifespanManager",
"pytest.fixture",
"asyncio.get_event_loop"
] | [((115, 146), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (129, 146), False, 'import pytest\n'), ((176, 200), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (198, 200), False, 'import asyncio\n'), ((291, 311), 'asgi_lifespan.LifespanManager', 'Life... |
# coding:UTF-8
import time
import hashlib
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from message.models import AppModel, TokenModel, AccountModel
def index(request):
apps = AppModel.objects.order_by("-id").fi... | [
"message.models.TokenModel",
"django.shortcuts.render_to_response",
"hashlib.md5",
"message.models.AppModel.objects.order_by",
"message.models.AppModel.objects.filter",
"time.strftime",
"message.models.AccountModel.objects.get",
"time.time",
"django.http.HttpResponseRedirect",
"message.models.Toke... | [((346, 400), 'django.shortcuts.render_to_response', 'render_to_response', (['"""admin/index.html"""', "{'apps': apps}"], {}), "('admin/index.html', {'apps': apps})\n", (364, 400), False, 'from django.shortcuts import render_to_response\n'), ((677, 708), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['""... |
import tensorflow as tf
import tensorflow.contrib.slim as slim
def lrelu(x, leak=0.2, name="lrelu"):
with tf.variable_scope(name):
f1 = 0.5 * (1 + leak)
f2 = 0.5 * (1 - leak)
return f1 * x + f2 * abs(x)
def selu(x):
alpha = 1.6732632423543772848170429916717
scale = 1.050700987355... | [
"tensorflow.abs",
"tensorflow.constant_initializer",
"tensorflow.less",
"tensorflow.variable_scope",
"tensorflow.contrib.layers.batch_norm",
"tensorflow.exp",
"tensorflow.nn.conv2d",
"tensorflow.where",
"tensorflow.square",
"tensorflow.truncated_normal_initializer"
] | [((472, 500), 'tensorflow.abs', 'tf.abs', (['(predictions - labels)'], {}), '(predictions - labels)\n', (478, 500), True, 'import tensorflow as tf\n'), ((517, 541), 'tensorflow.less', 'tf.less', (['residual', 'delta'], {}), '(residual, delta)\n', (524, 541), True, 'import tensorflow as tf\n'), ((653, 694), 'tensorflow.... |
import numpy as np
import pandas as pd
import read_data as rd
import argparse
import os
import time
import sklearn
from sklearn.externals import joblib
from sklearn.metrics import precision_recall_curve
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
def prepare_data(df=N... | [
"sklearn.externals.joblib.dump",
"numpy.abs",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.ensemble.GradientBoostingRegressor",
"time.strftime",
"numpy.exp",
"read_data.read_data",
"pandas.DataFrame",
"read_data.date_lookup",
"os.path.exists",
"sklearn.preprocessing.LabelEncoder",
... | [((10726, 10750), 'numpy.linspace', 'np.linspace', (['cut', '(50)', '(10)'], {}), '(cut, 50, 10)\n', (10737, 10750), True, 'import numpy as np\n'), ((11068, 11098), 'numpy.linspace', 'np.linspace', (['cut', '(cut / 2)', '(100)'], {}), '(cut, cut / 2, 100)\n', (11079, 11098), True, 'import numpy as np\n'), ((12418, 1247... |
# coding=utf-8
import signal
import sys
import time
import RPi.GPIO as GPIO
# Piezo buzzer - pin 31 on Raspberry Pi corresponds to BCM GPIO 22
BeepPin = 31
def close(signal, frame):
GPIO.output(BeepPin, GPIO.LOW)
sys.exit(0)
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings... | [
"RPi.GPIO.setmode",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"signal.signal",
"RPi.GPIO.setwarnings",
"sys.exit"
] | [((279, 303), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (291, 303), True, 'import RPi.GPIO as GPIO\n'), ((304, 327), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (320, 327), True, 'import RPi.GPIO as GPIO\n'), ((329, 364), 'signal.signal', 'signal.signal'... |
# Hotspot 2.0 PPS MO tests
# Copyright (c) 2018, The Linux Foundation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import os.path
import subprocess
import hostapd
from utils import HwsimSkip
from test_ap_hs20 import... | [
"test_ap_hs20.check_sp_type",
"subprocess.check_output",
"hostapd.add_ap",
"test_ap_eap.check_eap_capa",
"test_ap_hs20.interworking_connect",
"utils.HwsimSkip",
"test_ap_hs20.hs20_ap_params",
"logging.getLogger",
"test_ap_hs20.interworking_select"
] | [((199, 218), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (216, 218), False, 'import logging\n'), ((615, 700), 'subprocess.check_output', 'subprocess.check_output', (["['../../hs20/client/hs20-osu-client', 'set_pps', pps_mo]"], {}), "(['../../hs20/client/hs20-osu-client', 'set_pps',\n pps_mo])\n", (6... |
"""
This is the main module for parsing the parameter file. There are two other
modules strongly linked ot this one:
* options: contains definitions of the possible options of a parameter file
* option_parsing: provides the classes Section and Option for simpler parsing
and validation.
:Authors: <NAME>, <NAME>
"""
... | [
"os.listdir",
"hyvr.geo.model.Model",
"shutil.rmtree",
"pathlib.Path",
"hyvr.geo.contact_surface_utils.parse_contact_model",
"tempfile.mkdtemp",
"hyvr.utils.print_to_stdout",
"configparser.ConfigParser",
"os.path.join",
"warnings.warn"
] | [((1598, 1649), 'hyvr.geo.model.Model', 'Model', (['model_dict', 'strata_dict', 'elements', 'flowtrans'], {}), '(model_dict, strata_dict, elements, flowtrans)\n', (1603, 1649), False, 'from hyvr.geo.model import Model\n'), ((2576, 2617), 'hyvr.utils.print_to_stdout', 'print_to_stdout', (['"""Reading parameter file"""']... |
# This function is copied from https://github.com/Rubikplayer/flame-fitting
'''
Copyright 2015 <NAME>, <NAME> and the Max Planck Gesellschaft. All rights reserved.
This software is provided for research purposes only.
By using this software you agree to the terms of the SMPL Model license here http://smpl.is.tue... | [
"chumpy.eye",
"cv2.Rodrigues",
"numpy.array",
"numpy.eye"
] | [((832, 856), 'cv2.Rodrigues', 'cv2.Rodrigues', (['self.rt.r'], {}), '(self.rt.r)\n', (845, 856), False, 'import cv2\n'), ((946, 970), 'cv2.Rodrigues', 'cv2.Rodrigues', (['self.rt.r'], {}), '(self.rt.r)\n', (959, 970), False, 'import cv2\n'), ((1329, 1338), 'chumpy.eye', 'ch.eye', (['(3)'], {}), '(3)\n', (1335, 1338), ... |
import logging
import time
import can
import j1939
logging.getLogger('j1939').setLevel(logging.DEBUG)
logging.getLogger('can').setLevel(logging.DEBUG)
def on_message(priority, pgn, sa, timestamp, data):
"""Receive incoming messages from the bus
:param int priority:
Priority of the message... | [
"j1939.ElectronicControlUnit",
"logging.getLogger",
"time.sleep"
] | [((776, 805), 'j1939.ElectronicControlUnit', 'j1939.ElectronicControlUnit', ([], {}), '()\n', (803, 805), False, 'import j1939\n'), ((1516, 1531), 'time.sleep', 'time.sleep', (['(120)'], {}), '(120)\n', (1526, 1531), False, 'import time\n'), ((57, 83), 'logging.getLogger', 'logging.getLogger', (['"""j1939"""'], {}), "(... |
import json
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.views.generic import DetailView, ListView, TemplateView
from django.views.decorators.cache import (
cache_page,
pat... | [
"django.views.decorators.cache.patch_cache_control",
"djangae.utils.on_production",
"django.views.decorators.cache.cache_page",
"django.core.urlresolvers.reverse"
] | [((437, 452), 'djangae.utils.on_production', 'on_production', ([], {}), '()\n', (450, 452), False, 'from djangae.utils import on_production\n'), ((658, 717), 'django.views.decorators.cache.patch_cache_control', 'patch_cache_control', (['response'], {'public': '(True)', 'max_age': 'MAX_AGE'}), '(response, public=True, m... |
import matplotlib.pyplot as plt
import cv2
import sys
if len(sys.argv) < 2:
print('Please enter filename')
sys.exit()
file_path = ''.join([x + ' ' for x in sys.argv[1:]])[:-1]
extension = file_path.split('.')[-1]
file_name = ''.join([x + '.' for x in file_path.split('.')[:-1]])[:-1]
# print(file_... | [
"cv2.resize",
"cv2.cvtColor",
"cv2.imread",
"matplotlib.pyplot.imsave",
"sys.exit"
] | [((357, 378), 'cv2.imread', 'cv2.imread', (['file_path'], {}), '(file_path)\n', (367, 378), False, 'import cv2\n'), ((388, 426), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (400, 426), False, 'import cv2\n'), ((124, 134), 'sys.exit', 'sys.exit', ([], {}), '()\n'... |
# Generated by Django 2.1.1 on 2018-10-22 14:15
from django.db import migrations
from openwisp_users.migrations import create_default_groups
class Migration(migrations.Migration):
dependencies = [
('openwisp_users', '0003_default_organization'),
]
operations = [
migrations.RunPython(
... | [
"django.db.migrations.RunPython"
] | [((295, 383), 'django.db.migrations.RunPython', 'migrations.RunPython', (['create_default_groups'], {'reverse_code': 'migrations.RunPython.noop'}), '(create_default_groups, reverse_code=migrations.\n RunPython.noop)\n', (315, 383), False, 'from django.db import migrations\n')] |
from datetime import datetime
from freezegun import freeze_time
from django.urls import reverse
from api.cases.enums import CaseTypeEnum
from api.compliance.tests.factories import ComplianceSiteCaseFactory, OpenLicenceReturnsFactory
from api.licences.enums import LicenceStatus
from api.staticdata.statuses.enums impo... | [
"django.urls.reverse",
"api.licences.enums.LicenceStatus.to_str",
"freezegun.freeze_time",
"datetime.datetime.now",
"api.staticdata.statuses.libraries.get_case_status.get_case_status_by_status"
] | [((3572, 3597), 'freezegun.freeze_time', 'freeze_time', (['"""2020-06-14"""'], {}), "('2020-06-14')\n", (3583, 3597), False, 'from freezegun import freeze_time\n'), ((4544, 4569), 'freezegun.freeze_time', 'freeze_time', (['"""2020-06-14"""'], {}), "('2020-06-14')\n", (4555, 4569), False, 'from freezegun import freeze_t... |
from django.urls import path
from . import views
urlpatterns = [
path('plagiarism/check/<int:id>', views.check),
path('forum/search', views.forumSearch),
path('products/search', views.productSearch),
path('vectorize', views.vectorize),
]
| [
"django.urls.path"
] | [((70, 116), 'django.urls.path', 'path', (['"""plagiarism/check/<int:id>"""', 'views.check'], {}), "('plagiarism/check/<int:id>', views.check)\n", (74, 116), False, 'from django.urls import path\n'), ((122, 161), 'django.urls.path', 'path', (['"""forum/search"""', 'views.forumSearch'], {}), "('forum/search', views.foru... |
""" Customization of pyface functionality.
"""
import logging
from pyface.api import DirectoryDialog, FileDialog, OK
from pyface.message_dialog import MessageDialog
local_logger = logging.getLogger(__name__)
def message_dialog(message, title='Error', severity='error'):
""" Convenience function to show an error ... | [
"pyface.message_dialog.MessageDialog",
"logging.getLogger"
] | [((182, 209), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'import logging\n'), ((621, 696), 'pyface.message_dialog.MessageDialog', 'MessageDialog', ([], {'parent': 'None', 'message': 'message', 'title': 'title', 'severity': 'severity'}), '(parent=None, message=messag... |
"""
There are a total of numCourses courses you have to take,
labeled from 0 to numCourses - 1.
You are given an array prerequisites where prerequisites[i] = [ai, bi]
indicates that you must take course bi first if you want to take course ai.
For example, the pair [0, 1], indicates that to take course 0 you have t... | [
"collections.defaultdict",
"collections.deque"
] | [((1185, 1214), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1208, 1214), False, 'import collections\n'), ((2010, 2039), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (2033, 2039), False, 'import collections\n'), ((2945, 2974), 'collections.defau... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'hash_verify_gui.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_hashDialog(object):
def setupUi(self, hashDialog):
has... | [
"PyQt5.QtWidgets.QTextBrowser",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtWidgets.QProgressBar",
"PyQt5.QtCore.QRect",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtGui.QPalette",
"PyQt5.QtCore.QMetaObject.connectSlotsByName"
] | [((449, 541), 'PyQt5.QtWidgets.QSizePolicy', 'QtWidgets.QSizePolicy', (['QtWidgets.QSizePolicy.Preferred', 'QtWidgets.QSizePolicy.Preferred'], {}), '(QtWidgets.QSizePolicy.Preferred, QtWidgets.\n QSizePolicy.Preferred)\n', (470, 541), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((776, 809), 'PyQt5.QtWidg... |
from pathFinders import Dijkstra
from pathFinders import Astar
from mazeGenerators import randomMaze
from pathFinders import Bfs
from pathFinders import Dfs
import tkinter as tk
import Grid
class main():
def __init__(self, row, col, sizeCase):
self.win=tk.Tk()
self.win.title("pathfiding vizualiser"... | [
"tkinter.StringVar",
"pathFinders.Dijkstra.Dijkstra",
"tkinter.Canvas",
"tkinter.Button",
"pathFinders.Dfs.Dfs",
"Grid.Gui",
"mazeGenerators.randomMaze.Generate",
"tkinter.OptionMenu",
"pathFinders.Bfs.Bfs",
"pathFinders.Astar.Astar",
"tkinter.Tk"
] | [((266, 273), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (271, 273), True, 'import tkinter as tk\n'), ((346, 388), 'tkinter.Canvas', 'tk.Canvas', (['self.win'], {'height': '(600)', 'width': '(900)'}), '(self.win, height=600, width=900)\n', (355, 388), True, 'import tkinter as tk\n'), ((408, 450), 'tkinter.Canvas', 'tk.Ca... |
import os
import csv
import time
import math
import pandas as pd
import torch
import torch.nn as nn
import torchvision.utils as vutils
from torch.optim.sgd import SGD
from torch.utils.data import DataLoader
from optims import OCGD, BCGD2
from train_utils import get_data, weights_init_d, weights_init_g, \
get_diff... | [
"pandas.DataFrame",
"torch.utils.data.DataLoader",
"train_utils.save_checkpoint",
"torch.manual_seed",
"train_utils.get_model",
"torch.load",
"losses.get_loss",
"torch.randn",
"train_utils.get_data",
"torch.cuda.is_available"
] | [((475, 503), 'torch.manual_seed', 'torch.manual_seed', ([], {'seed': 'seed'}), '(seed=seed)\n', (492, 503), False, 'import torch\n'), ((917, 976), 'train_utils.get_data', 'get_data', ([], {'dataname': 'dataname', 'path': "('../datas/%s' % data_path)"}), "(dataname=dataname, path='../datas/%s' % data_path)\n", (925, 97... |
# Pytests to test the referenceSystem.json schema file
# TODO: test that "calendar" is "Gregorian" or a URI
import pytest
from jsonschema.exceptions import ValidationError
pytestmark = pytest.mark.schema("/schemas/referenceSystem")
def test_geographic_rs(validator):
''' Tests a minimal geographic RS '''
c... | [
"pytest.raises",
"pytest.mark.schema"
] | [((188, 234), 'pytest.mark.schema', 'pytest.mark.schema', (['"""/schemas/referenceSystem"""'], {}), "('/schemas/referenceSystem')\n", (206, 234), False, 'import pytest\n'), ((2058, 2088), 'pytest.raises', 'pytest.raises', (['ValidationError'], {}), '(ValidationError)\n', (2071, 2088), False, 'import pytest\n'), ((2263,... |
# reimplementation of lecture2-segment2.py for better understanding.
class Food(object):
def __init__(self, v, n, w):
self.name = n
self.value = v
self.calories = w
def getValue(self):
return self.value
def getName(self):
return self.name
def getCost(self):
... | [
"random.randint"
] | [((2361, 2386), 'random.randint', 'random.randint', (['(1)', 'maxVal'], {}), '(1, maxVal)\n', (2375, 2386), False, 'import random\n'), ((2432, 2458), 'random.randint', 'random.randint', (['(1)', 'maxCost'], {}), '(1, maxCost)\n', (2446, 2458), False, 'import random\n')] |
from ObstacleManager import ObstacleManager
import time
obstacle = ObstacleManager.get_instance()
obstacle.start_movement()
obstacle.set_period(0.05)
start_time = time.clock()
while time.clock() - start_time < 3:
print("Obstacle Position: (" + str(obstacle.xPosition) + ", " + str(obstacle.yPosition) + ")")
obst... | [
"time.clock",
"ObstacleManager.ObstacleManager.get_instance"
] | [((69, 99), 'ObstacleManager.ObstacleManager.get_instance', 'ObstacleManager.get_instance', ([], {}), '()\n', (97, 99), False, 'from ObstacleManager import ObstacleManager\n'), ((166, 178), 'time.clock', 'time.clock', ([], {}), '()\n', (176, 178), False, 'import time\n'), ((185, 197), 'time.clock', 'time.clock', ([], {... |
# Copyright (c) 2020 Trail of Bits, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is di... | [
"os.listdir",
"os.path.join",
"os.path.splitext"
] | [((865, 891), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (881, 891), False, 'import os\n'), ((974, 995), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (984, 995), False, 'import os\n'), ((1380, 1401), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', ... |
from socialsent3.representations.embedding import SVDEmbedding, Embedding, GigaEmbedding, FullEmbedding
from socialsent3.representations.explicit import Explicit
def create_representation(rep_type, path, *args, **kwargs):
if rep_type == 'Explicit':
return Explicit.load(path, *args, **kwargs)
el... | [
"socialsent3.representations.embedding.FullEmbedding",
"socialsent3.representations.embedding.Embedding.load",
"socialsent3.representations.explicit.Explicit.load",
"socialsent3.representations.embedding.SVDEmbedding",
"socialsent3.representations.embedding.GigaEmbedding"
] | [((276, 312), 'socialsent3.representations.explicit.Explicit.load', 'Explicit.load', (['path', '*args'], {}), '(path, *args, **kwargs)\n', (289, 312), False, 'from socialsent3.representations.explicit import Explicit\n'), ((358, 393), 'socialsent3.representations.embedding.SVDEmbedding', 'SVDEmbedding', (['path', '*arg... |
import os
from pathlib import Path
import pandas as pd
import numpy as np
import math
from parsing import split_tmp, split_wnd, split_ceil, split_vis, split_liquid_precip, split_snow
def see_maps_location(lat, lon):
print(f'https://www.google.com.au/maps/search/{lat},{lon}')
def get_complete_station_years(path... | [
"pandas.DataFrame",
"os.listdir",
"parsing.split_wnd",
"math.sqrt",
"pandas.read_csv",
"math.radians",
"pandas.merge",
"parsing.split_vis",
"parsing.split_tmp",
"parsing.split_liquid_precip",
"math.sin",
"parsing.split_ceil",
"pathlib.Path",
"parsing.split_snow",
"pandas.concat",
"nump... | [((414, 428), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (426, 428), True, 'import pandas as pd\n'), ((441, 465), 'os.listdir', 'os.listdir', (["(path / 'raw')"], {}), "(path / 'raw')\n", (451, 465), False, 'import os\n'), ((1817, 1840), 'parsing.split_liquid_precip', 'split_liquid_precip', (['df'], {}), '(d... |
import time
import board
# i2c = board.STEMMA_I2C()
rtc_enabled = False
# i2c.try_lock()
# i2c_scan_results = i2c.scan()
# i2c.unlock()
# rtc_enabled = False
# if 0x6b in i2c_scan_results:
# rtc_enabled = True
# import adafruit_pcf8523
# rtc = adafruit_pcf8523.PCF8523(i2c)
# months = ("", "January", "February... | [
"displayio.FourWire",
"displayio.Group",
"displayio.Bitmap",
"displayio.Palette",
"keypad.Event",
"keypad.Keys",
"time.sleep",
"hx711.hx711_pio.HX711_PIO",
"board.SPI",
"displayio.TileGrid",
"adafruit_il0373.IL0373",
"time.monotonic",
"adafruit_display_text.label.Label",
"neopixel.NeoPixel... | [((1233, 1289), 'hx711.hx711_pio.HX711_PIO', 'HX711_PIO', (['pio_data', 'pio_clk'], {'tare': '(False)', 'scalar': '(395.513)'}), '(pio_data, pio_clk, tare=False, scalar=395.513)\n', (1242, 1289), False, 'from hx711.hx711_pio import HX711_PIO\n'), ((1371, 1442), 'keypad.Keys', 'keypad.Keys', (['(key_a, key_b, key_c)'], ... |
import FWCore.ParameterSet.Config as cms
nEvtLumi = 4
nEvtRun = 2*nEvtLumi
nRuns = 64
nStreams = 4
nEvt = nRuns*nEvtRun
process = cms.Process("TESTGLOBALMODULES")
import FWCore.Framework.test.cmsExceptionsFatalOption_cff
process.options = cms.untracked.PSet(
numberOfStreams = cms.untracked.uint32(nStreams),
... | [
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.Task",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.uint32",
"FWCore.ParameterSet.Config.untracked.uint64",
"FWCore.ParameterS... | [((132, 164), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""TESTGLOBALMODULES"""'], {}), "('TESTGLOBALMODULES')\n", (143, 164), True, 'import FWCore.ParameterSet.Config as cms\n'), ((4878, 4912), 'FWCore.ParameterSet.Config.Task', 'cms.Task', (['process.TestAccumulator1'], {}), '(process.TestAccumulator1)\... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import io
import logging
import subprocess
import sys
import tarfile
import tempfile
from pathlib import Path
from threading import Lock
from t... | [
"subprocess.Popen",
"compiler_gym.datasets.BenchmarkSource",
"compiler_gym.envs.llvm.llvm_benchmark.ClangInvocation.from_c_file",
"compiler_gym.util.download.download",
"fasteners.InterProcessLock",
"threading.Lock",
"pathlib.Path",
"compiler_gym.util.runfiles_path.transient_cache_path",
"compiler_g... | [((1019, 1025), 'threading.Lock', 'Lock', ([], {}), '()\n', (1023, 1025), False, 'from threading import Lock\n'), ((9664, 9787), 'subprocess.Popen', 'subprocess.Popen', (['self.clang_compile_command'], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.DEVNULL'}), '(self.clang_compile_comma... |
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
from __future__ import absolute_import
import numpy
import pytest
import uproot
@pytest.mark.network
def test():
with uproot.open(
"https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/RD_distribution.roo... | [
"uproot.open"
] | [((211, 329), 'uproot.open', 'uproot.open', (['"""https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/RD_distribution.root:tree"""'], {}), "(\n 'https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/RD_distribution.root:tree'\n )\n", (222, 329), False, 'import uproot\n')] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
import re
import sys
import threading
from queue import Que... | [
"torchx.runner.get_runner",
"threading.Thread",
"re.match",
"logging.getLogger",
"torchx.specs.api.make_app_handle",
"sys.exit",
"queue.Queue",
"urllib.parse.urlparse"
] | [((648, 675), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (665, 675), False, 'import logging\n'), ((1577, 1597), 'urllib.parse.urlparse', 'urlparse', (['identifier'], {}), '(identifier)\n', (1585, 1597), False, 'from urllib.parse import urlparse\n'), ((1823, 1852), 'torchx.runner.get_r... |
from __future__ import print_function
from functools import wraps, partial
from strict_functions import overload, attempt
from inspect import getsource
import itertools
from itertools import permutations, islice
import sys
import os
import operator
import generators
from generators import iterable, consume, itemgetter... | [
"generators.iterable",
"generators.skip_errors",
"functools.partial",
"itertools.permutations",
"generators.itemgetter",
"functools.wraps",
"itertools.product",
"itertools.islice"
] | [((1016, 1025), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (1021, 1025), False, 'from functools import wraps, partial\n'), ((3754, 3763), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (3759, 3763), False, 'from functools import wraps, partial\n'), ((1101, 1114), 'generators.iterable', 'iterable', (['out'... |
from utils import log
from utils import correlate
import random
class Predictor:
def __init__(self, history_db, orders_db):
self.history_db = history_db
self.orders_db = orders_db
def predict_simple(self, history_points, statistics):
correlations = [[], [], [], [], []]
guesse... | [
"random.randint",
"utils.log",
"utils.correlate"
] | [((634, 673), 'utils.correlate', 'correlate', (['directions[x]', 'directions[y]'], {}), '(directions[x], directions[y])\n', (643, 673), False, 'from utils import correlate\n'), ((735, 791), 'utils.log', 'log', (["('Correlation: [%d -> %d] %f' % (x + 1, y + 1, corr))"], {}), "('Correlation: [%d -> %d] %f' % (x + 1, y + ... |
from django import template
import random
register = template.Library()
@register.simple_tag
def pet_name():
pet_names = ['happy little shark', 'shimmery merperson', 'delicous ham sandwich',
'button-nosed field mouse', 'shiny little june bug', 'titan, you', 'sweet little croissant',
'lovely little poppy',... | [
"django.template.Library",
"random.choice"
] | [((54, 72), 'django.template.Library', 'template.Library', ([], {}), '()\n', (70, 72), False, 'from django import template\n'), ((405, 429), 'random.choice', 'random.choice', (['pet_names'], {}), '(pet_names)\n', (418, 429), False, 'import random\n'), ((668, 693), 'random.choice', 'random.choice', (['adjectives'], {}),... |
import ipaddress
import re
import rdap
from rdap import RdapAsn
from rdap.exceptions import RdapException, RdapHTTPError, RdapNotFoundError
import requests
from django.utils.translation import ugettext_lazy as _
from peeringdb_server import settings
# RFC 5398 documentation asn range
ASN_RFC_5398_16BIT = (64496, 645... | [
"ipaddress.IPv6Network",
"django.utils.translation.ugettext_lazy",
"ipaddress.IPv4Network",
"peeringdb_server.settings.RDAP_URL.rstrip"
] | [((4612, 4641), 'ipaddress.IPv4Network', 'ipaddress.IPv4Network', (['prefix'], {}), '(prefix)\n', (4633, 4641), False, 'import ipaddress\n'), ((1960, 1989), 'peeringdb_server.settings.RDAP_URL.rstrip', 'settings.RDAP_URL.rstrip', (['"""/"""'], {}), "('/')\n", (1984, 1989), False, 'from peeringdb_server import settings\... |
import torch
import numpy as np
import pandas as pd
import os
from RBM import RBM
from load_dataset import MNIST
import cv2
from PIL import Image
from matplotlib import pyplot as plt
def image_beautifier(names, final_name):
image_names = sorted(names)
images = [Image.open(x) for x in names]
widths, heights = zip(*... | [
"matplotlib.pyplot.title",
"PIL.Image.new",
"matplotlib.pyplot.savefig",
"load_dataset.MNIST",
"RBM.RBM",
"cv2.imwrite",
"matplotlib.pyplot.imshow",
"PIL.Image.open",
"cv2.imread",
"numpy.mean",
"numpy.array",
"numpy.reshape",
"matplotlib.pyplot.cla",
"numpy.where",
"cv2.resize"
] | [((410, 453), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(total_width, max_height)'], {}), "('RGB', (total_width, max_height))\n", (419, 453), False, 'from PIL import Image\n'), ((579, 601), 'cv2.imread', 'cv2.imread', (['final_name'], {}), '(final_name)\n', (589, 601), False, 'import cv2\n'), ((609, 664), 'cv2.resi... |
import tkinter as tk
class ControlPanel():
def __init__(self, parent, logger):
self.logger = logger
self.backend = None
self.frame = tk.Frame(master=parent)
self.frame.pack(fill=tk.BOTH, expand=True)
self.create_track_labels(self.frame)
self.create_control_area(self.frame)
self.create_volume_bar(se... | [
"tkinter.StringVar",
"tkinter.Button",
"tkinter.Scale",
"tkinter.Frame",
"tkinter.DoubleVar",
"tkinter.Label"
] | [((146, 169), 'tkinter.Frame', 'tk.Frame', ([], {'master': 'parent'}), '(master=parent)\n', (154, 169), True, 'import tkinter as tk\n'), ((386, 409), 'tkinter.Frame', 'tk.Frame', ([], {'master': 'parent'}), '(master=parent)\n', (394, 409), True, 'import tkinter as tk\n'), ((434, 448), 'tkinter.StringVar', 'tk.StringVar... |
#
# Copyright 2021. Futurewei Technologies Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | [
"json.load",
"os.getenv",
"os.system",
"time.time"
] | [((863, 891), 'os.system', 'os.system', (["('mkdir ' + folder)"], {}), "('mkdir ' + folder)\n", (872, 891), False, 'import os\n'), ((990, 1012), 'os.system', 'os.system', (['geticonscmd'], {}), '(geticonscmd)\n', (999, 1012), False, 'import os\n'), ((1067, 1079), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1076, 1... |
from binascii import hexlify
import responses
from pyrex.daemon import Daemon
from pyrex.backends.jsonrpc import JSONRPCDaemon
from pyrex.transaction import Transaction
from .base import JSONTestCase
class JSONRPCDaemonTestCase(JSONTestCase):
jsonrpc_url = 'http://1172.16.58.3:18081/json_rpc'
mempool_url = '... | [
"pyrex.backends.jsonrpc.JSONRPCDaemon"
] | [((455, 470), 'pyrex.backends.jsonrpc.JSONRPCDaemon', 'JSONRPCDaemon', ([], {}), '()\n', (468, 470), False, 'from pyrex.backends.jsonrpc import JSONRPCDaemon\n')] |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from egg.core.interaction import Log... | [
"egg.core.interaction.LoggingStrategy",
"torch.nn.Identity",
"torch.nn.Linear"
] | [((803, 816), 'torch.nn.Identity', 'nn.Identity', ([], {}), '()\n', (814, 816), True, 'import torch.nn as nn\n'), ((3334, 3351), 'egg.core.interaction.LoggingStrategy', 'LoggingStrategy', ([], {}), '()\n', (3349, 3351), False, 'from egg.core.interaction import LoggingStrategy\n'), ((3499, 3516), 'egg.core.interaction.L... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""The plugin of the pytest.
The pytest plugin hooks do not need to be imported into any test code, it will
load automatically when running pytest.
References:
https://docs.pytest.org/en/2.7.3/plugins.html
"""
import pytest
from rayvision_max.analyse_max import An... | [
"rayvision_max.analyse_max.AnalyseMax",
"pytest.fixture"
] | [((332, 348), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (346, 348), False, 'import pytest\n'), ((667, 683), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (681, 683), False, 'import pytest\n'), ((760, 786), 'rayvision_max.analyse_max.AnalyseMax', 'AnalyseMax', ([], {}), '(**analyze_info)\n', (770, 78... |
#!/usr/bin/env python
"""
This program will generate a greyscale bitmap from a
CDED flavoured DEM file.
"""
from cdedtools import demparser
import argparse
import Image
# Command Line Options
parser = argparse.ArgumentParser(description="Generate a BMP from a DEM file.")
parser.add_argument("-c", "--colourize", des... | [
"cdedtools.demparser.read_data",
"Image.new",
"argparse.ArgumentParser"
] | [((205, 275), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate a BMP from a DEM file."""'}), "(description='Generate a BMP from a DEM file.')\n", (228, 275), False, 'import argparse\n'), ((892, 914), 'cdedtools.demparser.read_data', 'demparser.read_data', (['f'], {}), '(f)\n', (91... |
'''
This is a script to convert a wikipedia2vec model file to word2vec.
Usage:
$ python3 convert_wiki2vec_glove.py [MODEL_NAME] [OUTPUT_FILE_NAME]
'''
from wikipedia2vec import Wikipedia2Vec
from wikipedia2vec.dictionary import Word
import sys
def save_text(wiki2vec, out_file):
with open(out_file, 'wb') as f:
... | [
"wikipedia2vec.Wikipedia2Vec.load"
] | [((916, 946), 'wikipedia2vec.Wikipedia2Vec.load', 'Wikipedia2Vec.load', (['MODEL_FILE'], {}), '(MODEL_FILE)\n', (934, 946), False, 'from wikipedia2vec import Wikipedia2Vec\n')] |
"""
Base classes for Custom Authenticator to use OAuth with JupyterHub
Most of the code c/o <NAME> (@rgbkrk)
"""
import base64
import json
import os
from urllib.parse import quote, urlparse
import uuid
from tornado import gen, web
from tornado.log import app_log
from jupyterhub.handlers import BaseHandler
from jupy... | [
"traitlets.Bool",
"tornado.web.HTTPError",
"uuid.uuid4",
"json.loads",
"urllib.parse.urlparse",
"json.dumps",
"traitlets.Unicode",
"tornado.log.app_log.error",
"urllib.parse.quote",
"base64.urlsafe_b64decode",
"os.getenv",
"jupyterhub.utils.url_path_join"
] | [((855, 872), 'json.dumps', 'json.dumps', (['state'], {}), '(state)\n', (865, 872), False, 'import json\n'), ((7635, 7655), 'traitlets.Unicode', 'Unicode', ([], {'config': '(True)'}), '(config=True)\n', (7642, 7655), False, 'from traitlets import Unicode, Bool, List\n'), ((7934, 7954), 'traitlets.Unicode', 'Unicode', (... |
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy.distutils.misc_util
import argparse
import sys, os
import numpy as np
print(sys.argv)
parser = argparse.ArgumentParser(description='Build Cython Extension for CPU')
parser.add_argument... | [
"setuptools.setup",
"argparse.ArgumentParser",
"os.path.isdir",
"setuptools.extension.Extension",
"os.path.isfile",
"numpy.get_include",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((231, 300), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Build Cython Extension for CPU"""'}), "(description='Build Cython Extension for CPU')\n", (254, 300), False, 'import argparse\n'), ((2139, 2328), 'setuptools.setup', 'setup', ([], {'name': '"""kokkos_cpu"""', 'packages': "['kok... |
#!/usr/bin/env/python
import roslib; roslib.load_manifest('myBot')
import rospy
from geometry_msgs.msg import PoseWithCovarianceStamped
def main():
pub = rospy.Publisher('/initialpose', PoseWithCovarianceStamped)
rospy.sleep(0.3)
pose = PoseWithCovarianceStamped()
pose.header.frame_id = '/map'
pos... | [
"rospy.Publisher",
"rospy.sleep",
"rospy.init_node",
"geometry_msgs.msg.PoseWithCovarianceStamped",
"roslib.load_manifest"
] | [((38, 67), 'roslib.load_manifest', 'roslib.load_manifest', (['"""myBot"""'], {}), "('myBot')\n", (58, 67), False, 'import roslib\n'), ((160, 218), 'rospy.Publisher', 'rospy.Publisher', (['"""/initialpose"""', 'PoseWithCovarianceStamped'], {}), "('/initialpose', PoseWithCovarianceStamped)\n", (175, 218), False, 'import... |