code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <NAME>, 2017-2018
from flask_restful import Resource
from mobile.database import Database
from utils.data import rename_json_keys, camelcase_to_underscore
from utils.responses import Success, Error
from utils.validators import validate_json, value_exists
database = Data... | [
"utils.data.rename_json_keys",
"mobile.database.Database",
"utils.validators.validate_json",
"utils.responses.Success",
"utils.responses.Error"
] | [((316, 326), 'mobile.database.Database', 'Database', ([], {}), '()\n', (324, 326), False, 'from mobile.database import Database\n'), ((1712, 1772), 'utils.validators.validate_json', 'validate_json', (['validations', 'self.headers', 'self.resource_type'], {}), '(validations, self.headers, self.resource_type)\n', (1725,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20150421_2037'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((256, 313), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (287, 313), False, 'from django.db import models, migrations\n'), ((9273, 9311), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""users.Cam... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
dataset=pd.read_csv(r'C:\Users\santosh\Downloads\PAASBAAN-crime-prediction-master\data.csv')
data=pd.read_csv(r'C:\Users\santosh\Downloads\PAASBAAN-crime-prediction-master\data.csv')
print(dataset.head())
for col in data:
p... | [
"pandas.DataFrame",
"pandas.read_csv",
"pandas.to_datetime",
"seaborn.pairplot",
"pandas.concat"
] | [((101, 199), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\Users\\\\santosh\\\\Downloads\\\\PAASBAAN-crime-prediction-master\\\\data.csv"""'], {}), "(\n 'C:\\\\Users\\\\santosh\\\\Downloads\\\\PAASBAAN-crime-prediction-master\\\\data.csv'\n )\n", (112, 199), True, 'import pandas as pd\n'), ((191, 289), 'pandas.r... |
"""
Copyright (c) Jupyter Development Team.
Distributed under the terms of the Modified BSD License.
"""
import os
import json
import os.path as osp
from jupyter_server.base.handlers import JupyterHandler, FileFindHandler
from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
fro... | [
"os.path.dirname",
"json.load",
"os.path.join",
"jupyter_server.utils.url_path_join"
] | [((466, 487), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (477, 487), True, 'import os.path as osp\n'), ((1882, 1933), 'os.path.join', 'os.path.join', (['HERE', '"""build"""', '"""application_settings"""'], {}), "(HERE, 'build', 'application_settings')\n", (1894, 1933), False, 'import os\n'), ... |
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = 'svgrepodl',
author="callan",
author_email="<EMAIL>",
description="Pack Downloader for SVG REPO",
long_description=long_description,
long_description_content_type="text/markdown",
homepage="https://gi... | [
"setuptools.setup"
] | [((99, 739), 'setuptools.setup', 'setup', ([], {'name': '"""svgrepodl"""', 'author': '"""callan"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Pack Downloader for SVG REPO"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'homepage': '"""https://github.com/Al... |
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import cv2
import numpy as np
from PIL import Image
import math
class Erosion2d(nn.Layer):
"""
Erosion2d
"""
def __init__(self, m=1):
super(Erosion2d, self).__init__()
self.m = m
self.pad = [m, m, m, m]
d... | [
"paddle.to_tensor",
"paddle.nn.functional.affine_grid",
"paddle.nn.functional.grid_sample",
"paddle.sin",
"paddle.stack",
"paddle.nn.functional.unfold",
"numpy.expand_dims",
"paddle.cos",
"PIL.Image.open",
"paddle.nn.functional.pad",
"paddle.min",
"paddle.full",
"numpy.array",
"paddle.max"... | [((1255, 1285), 'paddle.split', 'paddle.split', (['param', '(8)'], {'axis': '(1)'}), '(param, 8, axis=1)\n', (1267, 1285), False, 'import paddle\n'), ((1374, 1401), 'paddle.sin', 'paddle.sin', (['(math.pi * theta)'], {}), '(math.pi * theta)\n', (1384, 1401), False, 'import paddle\n'), ((1418, 1445), 'paddle.cos', 'padd... |
import sys
import traceback
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gr... | [
"gremlin_python.structure.graph.Graph",
"traceback.format_exc",
"gremlin_python.driver.driver_remote_connection.DriverRemoteConnection",
"sys.exit"
] | [((853, 860), 'gremlin_python.structure.graph.Graph', 'Graph', ([], {}), '()\n', (858, 860), False, 'from gremlin_python.structure.graph import Graph\n'), ((950, 1008), 'gremlin_python.driver.driver_remote_connection.DriverRemoteConnection', 'DriverRemoteConnection', (['"""ws://localhost:8182/gremlin"""', '"""g"""'], {... |
#!/usr/bin/env python
# Copyright 2012-2014 <NAME> <<EMAIL>>
#
# 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 ap... | [
"optparse.OptionParser",
"re.match",
"cProfile.Profile",
"pdf_decanter.start",
"pdf_decanter.dynqt.QtWidgets.qApp.exec_",
"sys.stderr.write",
"sys.exit"
] | [((694, 746), 'optparse.OptionParser', 'OptionParser', ([], {'usage': '"""%prog [options] <filename.pdf>"""'}), "(usage='%prog [options] <filename.pdf>')\n", (706, 746), False, 'from optparse import OptionParser\n'), ((1820, 1869), 're.match', 're.match', (['"""([0-9]+)[ x*,/]([0-9]+)"""', 'options.size'], {}), "('([0-... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""\
[python] 8ebed2c.py [-achimrtuv] [-e compiler] [-f format] [-p pedigree]
(in.8ebed|@testprog) (out.c|-)
8ebed2c.py: A compiler (to C) for the Eightebed programming language.
Language version 1.1. Implementation version 2021.0621.
The @tes... | [
"sys.stdout.write",
"eightebed.drivers.parse_and_gen",
"logging.basicConfig",
"optparse.OptionParser",
"doctest.testmod",
"eightebed.drivers.compile_and_run",
"eightebed.drivers.cmdline",
"sys.exit",
"logging.getLogger"
] | [((717, 742), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (734, 742), False, 'import logging\n'), ((777, 798), 'optparse.OptionParser', 'OptionParser', (['__doc__'], {}), '(__doc__)\n', (789, 798), False, 'from optparse import OptionParser\n'), ((3853, 3919), 'eightebed.drivers.parse_a... |
import pylab, optparse, os
#opt parse arguements, type advect_ini.dat, advect_fin.dat, and norm.dat
#---------------------------------------------------------------------------------
# Not in use now
parser = optparse.OptionParser()
opts, args = parser.parse_args()
#Method that runs the advection program in C for a... | [
"pylab.title",
"pylab.show",
"optparse.OptionParser",
"pylab.ylabel",
"os.system",
"pylab.loglog",
"pylab.plot",
"pylab.log",
"pylab.subplot",
"pylab.figure",
"pylab.xlabel",
"pylab.legend"
] | [((210, 233), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (231, 233), False, 'import pylab, optparse, os\n'), ((4162, 4176), 'pylab.figure', 'pylab.figure', ([], {}), '()\n', (4174, 4176), False, 'import pylab, optparse, os\n'), ((4727, 4741), 'pylab.figure', 'pylab.figure', ([], {}), '()\n', (4... |
import warnings
import parse
import glob
import pytorch_lightning as pl
import xxhash
import re
from nlstruct.registry import get_config
import torch
import os
import traceback
def flat_config(d):
if d is None:
return d
if isinstance(d, dict):
return tuple(sorted(((k, flat_config(v)) for k, v... | [
"os.remove",
"torch.load",
"os.rename",
"os.path.exists",
"torch.save",
"glob.glob",
"parse.parse"
] | [((1641, 1679), 'glob.glob', 'glob.glob', (['glob_search'], {'recursive': '(True)'}), '(glob_search, recursive=True)\n', (1650, 1679), False, 'import glob\n'), ((3283, 3313), 'os.path.exists', 'os.path.exists', (['lock_file_path'], {}), '(lock_file_path)\n', (3297, 3313), False, 'import os\n'), ((3732, 3755), 'torch.lo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from libnmap.parser import NmapParser
rep = NmapParser.parse_fromfile("libnmap/test/files/full_sudo6.xml")
print(
"Nmap scan discovered {0}/{1} hosts up".format(
rep.hosts_up, rep.hosts_total
)
)
for _host in rep.hosts:
if _host.is_up():
print... | [
"libnmap.parser.NmapParser.parse_fromfile"
] | [((92, 154), 'libnmap.parser.NmapParser.parse_fromfile', 'NmapParser.parse_fromfile', (['"""libnmap/test/files/full_sudo6.xml"""'], {}), "('libnmap/test/files/full_sudo6.xml')\n", (117, 154), False, 'from libnmap.parser import NmapParser\n')] |
# takes pmids_not_found from get_pubmed_xml.py, and pmids_by_mods from parse_dqm_json.py, and
# generates a set sorted by MODs of pmids that were not found in pubmed.
#
# python generate_chunk_files.py
from os import environ, path, makedirs
import logging
import logging.config
import re
from datetime import datetime... | [
"os.path.abspath",
"os.makedirs",
"os.path.exists",
"datetime.datetime.now",
"dotenv.load_dotenv",
"os.environ.get",
"re.search",
"logging.config.fileConfig",
"logging.getLogger"
] | [((354, 367), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (365, 367), False, 'from dotenv import load_dotenv\n'), ((452, 492), 'logging.config.fileConfig', 'logging.config.fileConfig', (['log_file_path'], {}), '(log_file_path)\n', (477, 492), False, 'import logging\n'), ((502, 540), 'logging.getLogger', 'log... |
#!/usr/bin/python3
import os
import re
import subprocess
def run(args, output_file_name):
with open(output_file_name, 'w') as output_file:
subprocess.run(['python3'] + args, check=True, universal_newlines=True, stdout=output_file)
run(['./processstatsruns.py', 'runsperinningstats'], 'runsperinning.xml')
r... | [
"os.mkdir",
"os.path.abspath",
"subprocess.run",
"os.listdir",
"re.compile"
] | [((539, 590), 're.compile', 're.compile', (['"""runsperinningstatscumulative\\\\.(\\\\d+)"""'], {}), "('runsperinningstatscumulative\\\\.(\\\\d+)')\n", (549, 590), False, 'import re\n'), ((618, 681), 're.compile', 're.compile', (['"""runsperinningballsstrikesstatscumulative\\\\.(\\\\d+)"""'], {}), "('runsperinningballs... |
# Copyright 2019 TerraPower, 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 writi... | [
"unittest.main",
"traceback.print_exc",
"armi.MPI_COMM.bcast",
"armi.reactor.parameters.ParameterDefinitionCollection",
"armi.reactor.parameters.NoDefault",
"armi.reactor.composites.Composite",
"armi.reactor.parameters.parameterDefinitions._Undefined",
"armi.reactor.parameters.inCategory"
] | [((14349, 14391), 'armi.reactor.parameters.ParameterDefinitionCollection', 'parameters.ParameterDefinitionCollection', ([], {}), '()\n', (14389, 14391), False, 'from armi.reactor import parameters\n'), ((14762, 14788), 'armi.reactor.composites.Composite', 'composites.Composite', (['name'], {}), '(name)\n', (14782, 1478... |
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], ".."))
from juon import Graph
from juon.graphs import walk
from data.graph_data import build_graph, graph_is_as_expected
def test_traversal():
graph = build_graph()
graph_is_as_expected(graph)
d_1 = walk(graph, "Lainie")
# test the ... | [
"juon.graphs.walk",
"data.graph_data.graph_is_as_expected",
"os.path.join",
"data.graph_data.build_graph"
] | [((41, 72), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""'], {}), "(sys.path[0], '..')\n", (53, 72), False, 'import os\n'), ((225, 238), 'data.graph_data.build_graph', 'build_graph', ([], {}), '()\n', (236, 238), False, 'from data.graph_data import build_graph, graph_is_as_expected\n'), ((243, 270), 'data.... |
import numpy as np
import matplotlib.pyplot as plt
from newton_raphson import *
from random import uniform
import numpy.polynomial.legendre as L
###question 0
def E(X):
##Return the value of E(x1,...,xn)
E=0
N=len(X)
for i in range(N):
E+=np.log(abs(X[i]+1))+np.log(abs(X[i]-1))
for j ... | [
"matplotlib.pyplot.title",
"numpy.poly1d",
"numpy.matrix",
"matplotlib.pyplot.show",
"numpy.linalg.lstsq",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.axis",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.polynomial.legendre.leg2poly",
"numpy.li... | [((3963, 3980), 'numpy.zeros', 'np.zeros', (['(10, 1)'], {}), '((10, 1))\n', (3971, 3980), True, 'import numpy as np\n'), ((617, 628), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (625, 628), True, 'import numpy as np\n'), ((659, 675), 'numpy.zeros', 'np.zeros', (['[n, 1]'], {}), '([n, 1])\n', (667, 675), True, 'im... |
import os
import re
import shutil
import struct
from zlib import crc32
from collections import defaultdict
from .parser import SourceBuilder, TLParser, TLObject
AUTO_GEN_NOTICE = \
'"""File generated by TLObjects\' generator. All changes will be ERASED"""'
AUTO_CASTS = {
'InputPeer': 'utils.get_input_peer(cl... | [
"os.remove",
"os.makedirs",
"os.path.isdir",
"os.path.exists",
"struct.pack",
"collections.defaultdict",
"shutil.rmtree",
"os.path.join",
"re.sub"
] | [((733, 770), 'os.path.join', 'os.path.join', (['self.output_dir', '*paths'], {}), '(self.output_dir, *paths)\n', (745, 770), False, 'import os\n'), ((862, 882), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (876, 882), False, 'import os\n'), ((2089, 2106), 'collections.defaultdict', 'defaultdict', ([... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.utils.functional import lazy
from .models import QuerySet
from opps.core.forms import model_choices
class QuerySetAdminForm(forms.ModelForm):
model = forms.ChoiceField(choices=lazy(model_choices, tuple)())
class Meta:
... | [
"django.utils.functional.lazy"
] | [((266, 292), 'django.utils.functional.lazy', 'lazy', (['model_choices', 'tuple'], {}), '(model_choices, tuple)\n', (270, 292), False, 'from django.utils.functional import lazy\n')] |
# Concord
#
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This product may include a number of subcomponents with separate copyright
# notices a... | [
"util.skvbc_exceptions.StaleReadError",
"trio.open_nursery",
"random.randint",
"util.skvbc_exceptions.ConflictingBlockWriteError",
"util.skvbc_exceptions.PhantomBlockError",
"util.skvbc_exceptions.NoConflictError",
"random.random",
"time.monotonic",
"util.skvbc.SimpleKVBCProtocol.get_last_block_req"... | [((1041, 1056), 'functools.wraps', 'wraps', (['async_fn'], {}), '(async_fn)\n', (1046, 1056), False, 'from functools import wraps\n'), ((2188, 2204), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (2202, 2204), False, 'import time\n'), ((2936, 2952), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (2950, 2... |
from ray import Ray
from vec3 import Vec3
import math
from random import random
def random_in_unit_disk():
while True:
p = 2.0 * Vec3(random(),random(),0) -Vec3(1,1,0)
if Vec3.dot(p,p) < 1.0:
return p
class Camera:
def __init__(self,lookfrom,lookat,vup,vfov,aspect,aperture,focus_dist,t0,t1):
sel... | [
"vec3.Vec3.cross",
"math.tan",
"random.random",
"ray.Ray",
"vec3.Vec3.dot",
"vec3.Vec3.unit_vector",
"vec3.Vec3"
] | [((437, 456), 'math.tan', 'math.tan', (['(theta / 2)'], {}), '(theta / 2)\n', (445, 456), False, 'import math\n'), ((533, 568), 'vec3.Vec3.unit_vector', 'Vec3.unit_vector', (['(lookfrom - lookat)'], {}), '(lookfrom - lookat)\n', (549, 568), False, 'from vec3 import Vec3\n'), ((635, 661), 'vec3.Vec3.cross', 'Vec3.cross'... |
# coding: utf-8
import os
import sys
sys.path.append(os.pardir) # 为了导入父目录的文件而进行的设定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from common.multi_layer_net import MultiLayerNet
from common.optimizer import SGD
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True... | [
"sys.path.append",
"numpy.random.choice",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"common.optimizer.SGD",
"matplotlib.pyplot.legend",
"dataset.mnist.load_mnist",
"numpy.arange",
"common.multi_layer_net.MultiLayerNet",
"matplotlib.pyplot.ylabel",
"matplotli... | [((38, 64), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (53, 64), False, 'import sys\n'), ((295, 321), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'normalize': '(True)'}), '(normalize=True)\n', (305, 321), False, 'from dataset.mnist import load_mnist\n'), ((567, 707), 'common.multi_l... |
# -*- coding: utf-8 -*-
"""Tests for classes representing custom host collections."""
from __future__ import unicode_literals
from dns import name
from ipaddress import ip_address
from nose_parameterized import parameterized
from spam_lists.exceptions import InvalidHostError
from spam_lists.host_collections import H... | [
"nose_parameterized.parameterized.expand",
"test.compat.unittest.main",
"test.compat.Mock",
"dns.name.from_text",
"ipaddress.ip_address",
"test.unit.common_definitions.host_list_host_factory"
] | [((1352, 1380), 'test.unit.common_definitions.host_list_host_factory', 'host_list_host_factory', (['host'], {}), '(host)\n', (1374, 1380), False, 'from test.unit.common_definitions import TestFunctionDoesNotHandleMixin, host_list_host_factory, HostListTestMixin\n'), ((3739, 3795), 'nose_parameterized.parameterized.expa... |
import io
import os
import subprocess
from datetime import datetime
from urllib.parse import urlparse
from rastervision.filesystem import (FileSystem, NotReadableError,
NotWritableError)
# Code from https://alexwlchan.net/2017/07/listing-s3-keys/
def get_matching_s3_objects(bucke... | [
"subprocess.run",
"io.BytesIO",
"boto3.Session",
"boto3.client",
"os.path.isfile",
"os.path.join",
"urllib.parse.urlparse"
] | [((651, 669), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (663, 669), False, 'import boto3\n'), ((2188, 2203), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (2201, 2203), False, 'import boto3\n'), ((2294, 2307), 'urllib.parse.urlparse', 'urlparse', (['uri'], {}), '(uri)\n', (2302, 2307), False... |
#coding:utf-8
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"paddlehub.common.downloader.default_downloader.uncompress",
"paddlehub.common.downloader.default_downloader.download_file",
"os.remove",
"argparse.ArgumentParser",
"paddlehub.common.hub_server.default_hub_server.get_resource_url",
"os.path.basename",
"os.rename",
"os.path.exists",
"paddlehub.common... | [((1271, 1439), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'self.__class__.__doc__', 'prog': "('%s %s <model_name/module_name>' % (ENTRY, name))", 'usage': '"""%(prog)s [options]"""', 'add_help': '(False)'}), "(description=self.__class__.__doc__, prog=\n '%s %s <model_name/module_name... |
from infrastructure.models import CustomField, Environment
from resourcehandlers.aws.models import AWSHandler
from common.methods import set_progress
import boto3
import time
def connect_to_elasticache(env):
"""
Return boto connection to the elasticache in the specified environment's region.
"""
rh = ... | [
"resourcehandlers.aws.models.AWSHandler.objects.all",
"boto3.client",
"time.sleep",
"infrastructure.models.Environment.objects.get",
"infrastructure.models.Environment.objects_for_profile",
"common.methods.set_progress",
"infrastructure.models.CustomField.objects.get_or_create"
] | [((578, 726), 'infrastructure.models.CustomField.objects.get_or_create', 'CustomField.objects.get_or_create', ([], {'name': '"""aws_rh_id"""', 'defaults': "{'label': 'AWS RH ID', 'type': 'STR', 'description':\n 'Used by the AWS blueprints'}"}), "(name='aws_rh_id', defaults={'label':\n 'AWS RH ID', 'type': 'STR', ... |
# -*- coding: utf-8 -*-
"""
Wrapper for PyICU word segmentation. This wrapper module uses
:class:`icu.BreakIterator` with Thai as :class:`icu.Local`
to locate boundaries between words from the text.
:See Also:
* `GitHub repository <https://github.com/ovalhub/pyicu>`_
"""
import re
from typing import List
from icu... | [
"icu.Locale",
"re.sub"
] | [((652, 692), 're.sub', 're.sub', (['"""([^\u0e00-\u0e7f\n ]+)"""', '""" \\\\1 """', 'text'], {}), '("""([^\u0e00-\u0e7f\n ]+)""", \' \\\\1 \', text)\n', (658, 692), False, 'import re\n'), ((428, 440), 'icu.Locale', 'Locale', (['"""th"""'], {}), "('th')\n", (434, 440), False, 'from icu import BreakIterator, Locale\n')] |
"""
Jupyter <-> Vim
See: <http://jupyter-client.readthedocs.io/en/stable/api/client.html>
"""
# Standard
import re
from textwrap import dedent
from threading import Thread, Lock
from time import sleep
# Py module
from jupyter_client import KernelManager
import vim
# Local
from jupyter_util import echom, unquote_str... | [
"textwrap.dedent",
"threading.Thread",
"jupyter_util.get_vim",
"jupyter_util.unquote_string",
"jupyter_util.echom",
"Queue.Queue",
"vim.vars.get",
"jupyter_util.match_kernel_id",
"time.sleep",
"threading.Lock",
"jupyter_client.KernelManager",
"vim.command",
"language.list_languages"
] | [((1215, 1222), 'Queue.Queue', 'Queue', ([], {}), '()\n', (1220, 1222), False, 'from Queue import Queue, Empty\n'), ((1267, 1290), 'jupyter_util.get_vim', 'get_vim', (['"""getpid()"""', '(-1)'], {}), "('getpid()', -1)\n", (1274, 1290), False, 'from jupyter_util import echom, unquote_string, match_kernel_id, get_vim\n')... |
# Install the Python library from https://pypi.org/project/amadeus
from amadeus import ResponseError, Client
amadeus = Client(
client_id='YOUR_AMADEUS_API_KEY',
client_secret='YOUR_AMADEUS_API_SECRET'
)
try:
'''
# Delete a given flight order based on it's id
'''
response = amadeus.booking.flig... | [
"amadeus.Client"
] | [((120, 206), 'amadeus.Client', 'Client', ([], {'client_id': '"""YOUR_AMADEUS_API_KEY"""', 'client_secret': '"""YOUR_AMADEUS_API_SECRET"""'}), "(client_id='YOUR_AMADEUS_API_KEY', client_secret=\n 'YOUR_AMADEUS_API_SECRET')\n", (126, 206), False, 'from amadeus import ResponseError, Client\n')] |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# initial
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((629, 701), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'primary_key': '(True)', 'auto_created': '(True)'}), "(verbose_name='ID', primary_key=True, auto_created=True)\n", (645, 701), False, 'from django.db import models\n'), ((729, 781), 'django.db.models.CharField', 'models.Ch... |
from robinhood_crypto_api import RobinhoodCrypto
from bin import pricinginfo
from indicators import ST
import pprint
import time
from multiprocessing import Process
r = RobinhoodCrypto("INSERT GMAIL HERE","INSERT USERNAME HERE")
#Make sure two factor authentication is being sent to your phone
def holdingsinfo(i... | [
"indicators.ST",
"time.sleep",
"bin.pricinginfo",
"multiprocessing.Process",
"robinhood_crypto_api.RobinhoodCrypto"
] | [((175, 235), 'robinhood_crypto_api.RobinhoodCrypto', 'RobinhoodCrypto', (['"""INSERT GMAIL HERE"""', '"""INSERT USERNAME HERE"""'], {}), "('INSERT GMAIL HERE', 'INSERT USERNAME HERE')\n", (190, 235), False, 'from robinhood_crypto_api import RobinhoodCrypto\n'), ((3014, 3028), 'time.sleep', 'time.sleep', (['(10)'], {})... |
# flake8: noqa
import codecs
import time
import unittest
try:
import unittest.mock as compat_mock
except ImportError:
import mock as compat_mock
import sys
import os
try:
from instagram_private_api import (
__version__, Client, ClientError, ClientLoginError,
ClientCookieExpiredError, Clien... | [
"codecs.encode",
"os.path.dirname",
"time.sleep"
] | [((3511, 3542), 'time.sleep', 'time.sleep', (['self.sleep_interval'], {}), '(self.sleep_interval)\n', (3521, 3542), False, 'import time\n'), ((4358, 4389), 'time.sleep', 'time.sleep', (['self.sleep_interval'], {}), '(self.sleep_interval)\n', (4368, 4389), False, 'import time\n'), ((884, 909), 'os.path.dirname', 'os.pat... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"tensorflow.python.training.basic_session_run_hooks.FinalOpsHook",
"tensorflow.python.platform.tf_logging.info",
"tensorflow.python.training.monitored_session.MonitoredSession",
"time.gmtime",
"tensorflow.python.framework.ops.get_default_graph",
"tensorflow.python.training.session_run_hook.SessionRunArgs"... | [((1628, 1651), 'tensorflow.python.framework.ops.get_default_graph', 'ops.get_default_graph', ([], {}), '()\n', (1649, 1651), False, 'from tensorflow.python.framework import ops\n'), ((6717, 6859), 'tensorflow.python.training.monitored_session.ChiefSessionCreator', 'monitored_session.ChiefSessionCreator', ([], {'scaffo... |
from storage import read_region_snapshot, _round_15min
import datetime
from dateutil.parser import parse
def test_read_region_snapshot():
read_region_snapshot('slc_ut', '2021-09-01T00:00:00Z')
def test__round_15min():
ts = parse('2021-01-31T23:59:01Z')
ret = _round_15min(ts)
assert ret == parse('202... | [
"storage._round_15min",
"storage.read_region_snapshot",
"dateutil.parser.parse"
] | [((144, 198), 'storage.read_region_snapshot', 'read_region_snapshot', (['"""slc_ut"""', '"""2021-09-01T00:00:00Z"""'], {}), "('slc_ut', '2021-09-01T00:00:00Z')\n", (164, 198), False, 'from storage import read_region_snapshot, _round_15min\n'), ((235, 264), 'dateutil.parser.parse', 'parse', (['"""2021-01-31T23:59:01Z"""... |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"datasets.Value",
"datasets.Version",
"json.loads",
"os.path.join"
] | [((2583, 2608), 'datasets.Version', 'datasets.Version', (['"""1.0.0"""'], {}), "('1.0.0')\n", (2599, 2608), False, 'import datasets\n'), ((4173, 4189), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (4183, 4189), False, 'import json\n'), ((2766, 2790), 'datasets.Value', 'datasets.Value', (['"""string"""'], {})... |
import subprocess
import os
def check_dependency(name):
""""""
e = subprocess.call('which '+name, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if e!=0:
raise RuntimeError('External dependency \''+name+'\' not installed')
def refresh_gcs_token():
""""""
t = subprocess... | [
"os.environ.putenv",
"subprocess.check_output",
"subprocess.call"
] | [((77, 179), 'subprocess.call', 'subprocess.call', (["('which ' + name)"], {'shell': '(True)', 'stdout': 'subprocess.DEVNULL', 'stderr': 'subprocess.DEVNULL'}), "('which ' + name, shell=True, stdout=subprocess.DEVNULL,\n stderr=subprocess.DEVNULL)\n", (92, 179), False, 'import subprocess\n'), ((310, 403), 'subproces... |
from django.shortcuts import render
from django.http import HttpResponse
from .forms import EmployeeApplicationForm
# Create your views here.
def index(request):
newForm = EmployeeApplicationForm
context = {
"form": newForm,
}
return render(request, "EmployeeAppApp/index.html", context)
def... | [
"django.shortcuts.render"
] | [((261, 314), 'django.shortcuts.render', 'render', (['request', '"""EmployeeAppApp/index.html"""', 'context'], {}), "(request, 'EmployeeAppApp/index.html', context)\n", (267, 314), False, 'from django.shortcuts import render\n'), ((580, 639), 'django.shortcuts.render', 'render', (['request', '"""EmployeeAppApp/gotThatI... |
# -*- coding: utf-8 -*-
"""
Module containing the implementation of Geofile operations using a sql statement.
"""
from concurrent import futures
from dataclasses import dataclass
from datetime import datetime
import logging
import logging.config
import math
import multiprocessing
from pathlib import Path
import shutil... | [
"shutil.rmtree",
"multiprocessing.cpu_count",
"geofileops.convert",
"geofileops.move",
"pandas.DataFrame",
"re.fullmatch",
"datetime.datetime.now",
"geofileops.get_default_layer",
"re.split",
"math.ceil",
"geofileops.GeofileType",
"geofileops.append_to",
"geofileops.get_layerinfo",
"geofil... | [((843, 870), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (860, 870), False, 'import logging\n'), ((3538, 3580), 'geofileops.get_layerinfo', 'gfo.get_layerinfo', (['input_path', 'input_layer'], {}), '(input_path, input_layer)\n', (3555, 3580), True, 'import geofileops as gfo\n'), ((488... |
from urllib.parse import urlparse
from flask import Blueprint, render_template, request, redirect, url_for
from werkzeug.exceptions import NotFound, Forbidden
from .utils import srcf_db_sess as sess
from .utils import parse_domain_name, create_job_maybe_email_and_redirect, find_member
from . import utils, inspect_ser... | [
"flask.Blueprint",
"flask.request.form.get",
"flask.url_for",
"flask.render_template",
"srcf.domains.verify",
"re.search"
] | [((449, 478), 'flask.Blueprint', 'Blueprint', (['"""member"""', '__name__'], {}), "('member', __name__)\n", (458, 478), False, 'from flask import Blueprint, render_template, request, redirect, url_for\n'), ((689, 736), 'flask.render_template', 'render_template', (['"""member/home.html"""'], {'member': 'mem'}), "('membe... |
import logging
from .vid_eval import do_vid_evaluation
def vid_evaluation(dataset, predictions, output_folder, box_only, **_):
logger = logging.getLogger("mega_core.inference")
logger.info("performing vid evaluation, ignored iou_types.")
return do_vid_evaluation(
dataset=dataset,
predicti... | [
"logging.getLogger"
] | [((143, 183), 'logging.getLogger', 'logging.getLogger', (['"""mega_core.inference"""'], {}), "('mega_core.inference')\n", (160, 183), False, 'import logging\n')] |
# Step 0: Add NRPy's directory to the path
# https://stackoverflow.com/questions/16780014/import-file-from-parent-directory
import os,sys
nrpy_dir_path = os.path.join("..")
if nrpy_dir_path not in sys.path:
sys.path.append(nrpy_dir_path)
nrpy_dir_path = os.path.join("../..")
if nrpy_dir_path not in sys.path:
sy... | [
"sys.path.append",
"NRPy_param_funcs.set_parval_from_str",
"sympy.Rational",
"indexedexp.zerorank1",
"sympy.sympify",
"Min_Max_and_Piecewise_Expressions.coord_greater_bound",
"GiRaFFEfood_NRPy.GiRaFFEfood_NRPy_Common_Functions.compute_ValenciavU_from_ED_and_BU",
"os.path.join",
"Min_Max_and_Piecewis... | [((154, 172), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (166, 172), False, 'import os, sys\n'), ((258, 279), 'os.path.join', 'os.path.join', (['"""../.."""'], {}), "('../..')\n", (270, 279), False, 'import os, sys\n'), ((892, 961), 'NRPy_param_funcs.set_parval_from_str', 'par.set_parval_from_str',... |
# Generated by Django 2.2 on 2019-04-15 23:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0006_auto_20190415_1639'),
]
operations = [
migrations.AlterModelTable(
name='post',
table='posts',
),
]
| [
"django.db.migrations.AlterModelTable"
] | [((222, 276), 'django.db.migrations.AlterModelTable', 'migrations.AlterModelTable', ([], {'name': '"""post"""', 'table': '"""posts"""'}), "(name='post', table='posts')\n", (248, 276), False, 'from django.db import migrations\n')] |
import re
def audit_link(linkText, uri):
"""Generate link "markdown" from URI."""
return '{{{}|{}}}'.format(linkText, uri)
def path_to_text(path):
"""Convert object path to the text portion."""
accession = re.match(r'\/.*\/(.*)\/', path)
return accession.group(1) if accession else None
def space_... | [
"re.sub",
"re.match"
] | [((224, 257), 're.match', 're.match', (['"""\\\\/.*\\\\/(.*)\\\\/"""', 'path'], {}), "('\\\\/.*\\\\/(.*)\\\\/', path)\n", (232, 257), False, 'import re\n'), ((481, 530), 're.sub', 're.sub', (['"""(\\\\w)([A-Z])"""', '"""\\\\1 \\\\2"""', 'objects_string'], {}), "('(\\\\w)([A-Z])', '\\\\1 \\\\2', objects_string)\n", (487... |
# -*- coding: utf-8 -*-
# @Time : 2020/9/10-07:22
# @Author : TuringEmmy
# @Email : <EMAIL>
# @WeChat : csy_lgy
# @File : sklearn_nb.py
# @Project : Sep-Dragon
# *************************************************
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
... | [
"sklearn.datasets.load_iris",
"sklearn.model_selection.train_test_split",
"sklearn.naive_bayes.GaussianNB"
] | [((371, 397), 'sklearn.datasets.load_iris', 'load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (380, 397), False, 'from sklearn.datasets import load_iris\n'), ((433, 486), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.5)', 'random_state': '(0)'}), '(X, y... |
import sqlite3
conn = sqlite3.connect('customer.db')
c = conn.cursor()
customer_list = [
('Subhadeep', 'Banerjee', '<EMAIL>'),
('Richard', 'Chakraborty', '<EMAIL>'),
('Soumya', 'Mitra', '<EMAIL>'),
]
c.executemany("INSERT INTO customers VALUES (?, ?, ?)", customer_list)
conn.commit()
conn.close() | [
"sqlite3.connect"
] | [((23, 53), 'sqlite3.connect', 'sqlite3.connect', (['"""customer.db"""'], {}), "('customer.db')\n", (38, 53), False, 'import sqlite3\n')] |
from os.path import dirname, join
from setuptools import setup, find_packages
with open(join(dirname(__file__), 'reminder/VERSION'), 'rb') as f:
version = f.read().decode('ascii').strip()
setup(
name='reminder',
version=version,
description='A Service to keep track of vehicle service date',
long_... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((503, 546), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests', 'tests.*')"}), "(exclude=('tests', 'tests.*'))\n", (516, 546), False, 'from setuptools import setup, find_packages\n'), ((94, 111), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (101, 111), False, 'from os.path im... |
# Copyright © 2021 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"copy.deepcopy",
"tests.unit.create_business",
"random.SystemRandom",
"entity_filer.worker.process_filing",
"legal_api.models.Filing.find_by_id",
"tests.unit.create_filing"
] | [((1079, 1123), 'tests.unit.create_business', 'create_business', (['identifier'], {'legal_type': '"""BC"""'}), "(identifier, legal_type='BC')\n", (1094, 1123), False, 'from tests.unit import create_business, create_filing\n'), ((1138, 1185), 'copy.deepcopy', 'copy.deepcopy', (['REGISTRARS_ORDER_FILING_TEMPLATE'], {}), ... |
import pytest
from django.utils import timezone
from dynamic_models import cache
TEST_MODEL_NAME = "test"
now = timezone.now()
@pytest.fixture
def mock_now(monkeypatch):
monkeypatch.setattr(timezone, "now", lambda: now)
def test_get_and_update_last_modified(mock_now):
assert cache.get_last_modified(TEST_... | [
"django.utils.timezone.now",
"dynamic_models.cache.update_last_modified",
"dynamic_models.cache.get_last_modified",
"dynamic_models.cache.clear_last_modified"
] | [((115, 129), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (127, 129), False, 'from django.utils import timezone\n'), ((344, 387), 'dynamic_models.cache.update_last_modified', 'cache.update_last_modified', (['TEST_MODEL_NAME'], {}), '(TEST_MODEL_NAME)\n', (370, 387), False, 'from dynamic_models import... |
from enum import Enum
import aiogram.utils.markdown as md
from aiogram.dispatcher.filters.state import StatesGroup, State
class PurchaseStates(StatesGroup):
""" States purchase flow """
category = State()
amount = State()
description = State()
class PurchaseCategory(Enum):
""" Categories for p... | [
"aiogram.utils.markdown.bold",
"aiogram.dispatcher.filters.state.State",
"aiogram.utils.markdown.text"
] | [((209, 216), 'aiogram.dispatcher.filters.state.State', 'State', ([], {}), '()\n', (214, 216), False, 'from aiogram.dispatcher.filters.state import StatesGroup, State\n'), ((230, 237), 'aiogram.dispatcher.filters.state.State', 'State', ([], {}), '()\n', (235, 237), False, 'from aiogram.dispatcher.filters.state import S... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | [
"azure.abfs.abfs.ABFS.join",
"tempfile.NamedTemporaryFile",
"json.loads",
"django.contrib.auth.models.User.objects.get",
"os.path.basename",
"nose.tools.assert_true",
"desktop.lib.test_utils.add_permission",
"nose.tools.assert_equal",
"time.time",
"azure.active_directory.ActiveDirectory.from_confi... | [((1431, 1458), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1448, 1458), False, 'import logging\n'), ((1784, 1842), 'desktop.lib.django_test_util.make_logged_in_client', 'make_logged_in_client', ([], {'username': '"""test"""', 'is_superuser': '(False)'}), "(username='test', is_superus... |
import logging
from django.conf import settings
from celery.task import task
from elasticutils.utils import chunked
log = logging.getLogger('elasticutils')
@task
def index_objects(mapping_type, ids, chunk_size=100, es=None, index=None):
"""Index documents of a specified mapping type.
This allows for asyn... | [
"elasticutils.utils.chunked",
"logging.getLogger"
] | [((126, 159), 'logging.getLogger', 'logging.getLogger', (['"""elasticutils"""'], {}), "('elasticutils')\n", (143, 159), False, 'import logging\n'), ((1621, 1645), 'elasticutils.utils.chunked', 'chunked', (['ids', 'chunk_size'], {}), '(ids, chunk_size)\n', (1628, 1645), False, 'from elasticutils.utils import chunked\n')... |
# Unit 単位
import math
from . import lia
from . import const
V2 = lia.Vector2
V2z = lia.Vector2C.Zero
V3 = lia.Vector3
V3z = lia.Vector3C.Zero
M2 = lia.Matrix2
M3 = lia.Matrix3
# 角度(弧度法)
class Rad:
@classmethod
def mapDegRad(cls, degree=0.0):
return degree * math.pi / 180
@classmethod
def map... | [
"math.tan",
"math.cos",
"math.sin",
"math.atan2"
] | [((1259, 1275), 'math.cos', 'math.cos', (['self.n'], {}), '(self.n)\n', (1267, 1275), False, 'import math\n'), ((1319, 1335), 'math.sin', 'math.sin', (['self.n'], {}), '(self.n)\n', (1327, 1335), False, 'import math\n'), ((1371, 1387), 'math.tan', 'math.tan', (['self.n'], {}), '(self.n)\n', (1379, 1387), False, 'import... |
'''
FILENAME: pix2pix_data.py
AUTHORS: <NAME>
START DATE: Friday February 25th 2022
CONTACT: <EMAIL>
INFO: preparing data for training with pix2pix model
'''
import sys
from matplotlib.pyplot import bar_label
sys.path.append('/data1/shaohua/code/GANToy')
import glob
import os
im... | [
"sys.path.append",
"options.train_options.args_option",
"torch.utils.data.DataLoader",
"PIL.Image.open",
"torchvision.transforms.ToTensor",
"numpy.random.random",
"numpy.array",
"torchvision.transforms.Normalize",
"os.path.join",
"torchvision.transforms.Resize"
] | [((249, 294), 'sys.path.append', 'sys.path.append', (['"""/data1/shaohua/code/GANToy"""'], {}), "('/data1/shaohua/code/GANToy')\n", (264, 294), False, 'import sys\n'), ((1533, 1546), 'options.train_options.args_option', 'args_option', ([], {}), '()\n', (1544, 1546), False, 'from options.train_options import args_option... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("READ")
process.source = cms.Source("DQMRootSource",
fileNames = cms.untracked.vstring("file:dqm_merged_file1_file3_file2_filterOnRun1.root"))
process.out = cms.OutputModule("DQMRootOutputModule",
... | [
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.EndPath",
"FWCore.ParameterSet.Config.Service",
"FWCore.ParameterSet.Config.Process"
] | [((52, 71), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""READ"""'], {}), "('READ')\n", (63, 71), True, 'import FWCore.ParameterSet.Config as cms\n'), ((424, 448), 'FWCore.ParameterSet.Config.EndPath', 'cms.EndPath', (['process.out'], {}), '(process.out)\n', (435, 448), True, 'import FWCore.ParameterSet.Co... |
import unittest
from p4_execution.ex5_execute import TpfServer
from p8_test.test_local import TestDataUTS
class Ts23Test(unittest.TestCase):
def setUp(self) -> None:
self.tpf_server = TpfServer()
self.test_data = TestDataUTS()
self.test_data.add_fields([('EBW000', 28), 'CE1$UID'], 'EB0EB'... | [
"unittest.main",
"p4_execution.ex5_execute.TpfServer",
"p8_test.test_local.TestDataUTS"
] | [((1565, 1580), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1578, 1580), False, 'import unittest\n'), ((199, 210), 'p4_execution.ex5_execute.TpfServer', 'TpfServer', ([], {}), '()\n', (208, 210), False, 'from p4_execution.ex5_execute import TpfServer\n'), ((236, 249), 'p8_test.test_local.TestDataUTS', 'TestDat... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.cast",
"tensorflow.train.exponential_decay",
"tensorflow.constant"
] | [((2093, 2227), 'tensorflow.train.exponential_decay', 'tf.train.exponential_decay', (['learning_rate_base', 'global_step', 'learning_rate_decay_steps', 'learning_rate_decay_factor'], {'staircase': '(True)'}), '(learning_rate_base, global_step,\n learning_rate_decay_steps, learning_rate_decay_factor, staircase=True)\... |
from collections import Counter
from io import BytesIO
import base64
from PIL import Image, ImageDraw
import numpy as np
from kmeans import KMeans
def rgb2hex(rgb):
return '#{:02x}{:02x}{:02x}'.format(*[int(x) for x in rgb])
def receive_image(buf):
return Image.open(BytesIO(buf))
def image_to_array(img,... | [
"io.BytesIO",
"PIL.Image.new",
"numpy.uint8",
"numpy.product",
"numpy.array",
"kmeans.KMeans",
"collections.Counter"
] | [((838, 847), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (845, 847), False, 'from io import BytesIO\n'), ((1597, 1606), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1604, 1606), False, 'from io import BytesIO\n'), ((1778, 1787), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1785, 1787), False, 'from io import BytesIO\n'),... |
#!/usr/local/bin/python3
import RPi.GPIO as GPIO
import time
class Button(object):
'''
Button class represents a button.
Has one property to read the current value.
'''
def __init__(self, pin):
self.pin = pin
# Have to set pull_up_down to make sure the button
GPIO.setup(se... | [
"RPi.GPIO.setup",
"RPi.GPIO.input"
] | [((307, 362), 'RPi.GPIO.setup', 'GPIO.setup', (['self.pin', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_UP'}), '(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)\n', (317, 362), True, 'import RPi.GPIO as GPIO\n'), ((543, 563), 'RPi.GPIO.input', 'GPIO.input', (['self.pin'], {}), '(self.pin)\n', (553, 563), True, 'import RPi.GPIO... |
#!/usr/bin/env python
# encoding: utf-8
'''
@license: (C) Copyright 2013-2020, Node Supply Chain Manager Corporation Limited.
@time: 2021/5/8 16:55
@file: bert_model.py
@author: baidq
@Software: PyCharm
@desc:
'''
from bert4keras.backend import keras,set_gelu
from bert4keras.models import build_transformer_model
from ... | [
"bert4keras.models.build_transformer_model",
"bert4keras.backend.keras.layers.Conv1D",
"bert4keras.backend.set_gelu",
"bert4keras.backend.keras.layers.concatenate",
"bert4keras.backend.keras.models.Model",
"bert4keras.backend.keras.layers.Lambda",
"bert4keras.backend.keras.layers.Dense",
"bert4keras.b... | [((355, 371), 'bert4keras.backend.set_gelu', 'set_gelu', (['"""tanh"""'], {}), "('tanh')\n", (363, 371), False, 'from bert4keras.backend import keras, set_gelu\n'), ((1540, 1593), 'bert4keras.backend.keras.layers.concatenate', 'keras.layers.concatenate', (['[cnn1, cnn2, cnn3]'], {'axis': '(-1)'}), '([cnn1, cnn2, cnn3],... |
def pretty_dump(label, o):
import pprint
return """
<{}>
{}
</{}>
""".format(label, pprint.pformat(o, indent=4), label)
| [
"pprint.pformat"
] | [((92, 119), 'pprint.pformat', 'pprint.pformat', (['o'], {'indent': '(4)'}), '(o, indent=4)\n', (106, 119), False, 'import pprint\n')] |
from . core import Literal
from collections import defaultdict
def gen_args(args):
return tuple(chr(ord('A') + arg.number) for arg in args)
def generate_program(model):
before = defaultdict(set)
min_clause = defaultdict(lambda: 0)
directions = defaultdict(lambda: defaultdict(lambda: '?'))
clau... | [
"collections.defaultdict"
] | [((192, 208), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (203, 208), False, 'from collections import defaultdict\n'), ((226, 249), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (237, 249), False, 'from collections import defaultdict\n'), ((336, 352), 'colle... |
import pickle
import torch
from datasets import supported_datamodules
from models import supported_models
from modules.pca_base_module import PCABaseModule
from modules.cae_base_module import CAEBaseModule
from modules.aae_base_module import AAEBaseModule
from modules.vae_base_module import VAEBaseModule
from utils im... | [
"utils.tools.load_config",
"modules.aae_base_module.AAEBaseModule",
"torch.load",
"modules.vae_base_module.VAEBaseModule",
"pickle.load",
"modules.pca_base_module.PCABaseModule",
"modules.cae_base_module.CAEBaseModule"
] | [((697, 755), 'utils.tools.load_config', 'tools.load_config', (["(pth / 'configuration.yaml')"], {'silent': '(True)'}), "(pth / 'configuration.yaml', silent=True)\n", (714, 755), False, 'from utils import tools, supported_preprocessing_transforms\n'), ((2631, 2652), 'torch.load', 'torch.load', (['ckpt_path'], {}), '(ck... |
import torch
from torch.distributions import multinomial
from matplotlib import pyplot as plt
fair_probs = torch.ones([6]) / 6
print("1\n",multinomial.Multinomial(1, fair_probs).sample())
print("2\n",multinomial.Multinomial(10, fair_probs).sample())
counts = multinomial.Multinomial(1000, fair_probs).sample()
... | [
"matplotlib.pyplot.axhline",
"torch.ones",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"torch.distributions.multinomial.Multinomial",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca"
] | [((528, 556), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4.5)'}), '(figsize=(6, 4.5))\n', (538, 556), True, 'from matplotlib import pyplot as plt\n'), ((778, 833), 'matplotlib.pyplot.axhline', 'plt.axhline', ([], {'y': '(0.167)', 'color': '"""black"""', 'linestyle': '"""dashed"""'}), "(y=0.167, col... |
#! /usr/bin/env python3
import csv
import requests
import glob
import os
def read_csv(file):
data = []
with open(file, mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
# map the country fields
if "Country_Region" in row:
... | [
"csv.DictReader",
"os.path.getmtime",
"glob.glob",
"requests.post",
"os.getenv"
] | [((671, 703), 'os.getenv', 'os.getenv', (['"""DATA_LOCATION"""', 'None'], {}), "('DATA_LOCATION', None)\n", (680, 703), False, 'import os\n'), ((1492, 1534), 'requests.post', 'requests.post', ([], {'url': 'API_ENDPOINT', 'json': 'body'}), '(url=API_ENDPOINT, json=body)\n', (1505, 1534), False, 'import requests\n'), ((1... |
# Copyright IBM Corp. 2016 All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"unittest.main",
"os.path.dirname",
"random.choice",
"time.sleep",
"hfc.fabric_ca.caservice.CAService",
"os.getenv",
"test.integration.utils.cli_call"
] | [((4138, 4153), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4151, 4153), False, 'import unittest\n'), ((1294, 1314), 'os.getenv', 'os.getenv', (['"""CA_ADDR"""'], {}), "('CA_ADDR')\n", (1303, 1314), False, 'import os\n'), ((1678, 1724), 'hfc.fabric_ca.caservice.CAService', 'CAService', (["('http://' + self._ca... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import time
import cv2
import os
import sqlite3
import pandas as pd
import matplotlib.pyplot as plt
import copy
import random
import numpy as np
import seaborn as sns
import csv
from IPython.display import HTML
from PIL import Image
# In[2]:
def saveFrames(video_pa... | [
"csv.writer",
"os.makedirs",
"random.randint",
"os.path.isdir",
"random.shuffle",
"cv2.imwrite",
"time.time",
"cv2.VideoCapture",
"os.path.join",
"os.listdir"
] | [((1130, 1150), 'os.listdir', 'os.listdir', (['test_dir'], {}), '(test_dir)\n', (1140, 1150), False, 'import os\n'), ((1709, 1729), 'os.listdir', 'os.listdir', (['dest_dir'], {}), '(dest_dir)\n', (1719, 1729), False, 'import os\n'), ((2085, 2111), 'random.shuffle', 'random.shuffle', (['train_list'], {}), '(train_list)\... |
from eduvpn.menu import menu, input_int, profile_choice, search, provider_choice, write_to_nm_choice
from unittest import TestCase, mock
class TestMenu(TestCase):
def test_menu(self):
menu(institutes=[], orgs=[], search_term="test")
def test_input_int(self):
with mock.patch('builtins.input', ... | [
"eduvpn.menu.search",
"eduvpn.menu.provider_choice",
"eduvpn.menu.menu",
"eduvpn.menu.profile_choice",
"unittest.mock.patch",
"eduvpn.menu.input_int",
"eduvpn.menu.write_to_nm_choice"
] | [((198, 246), 'eduvpn.menu.menu', 'menu', ([], {'institutes': '[]', 'orgs': '[]', 'search_term': '"""test"""'}), "(institutes=[], orgs=[], search_term='test')\n", (202, 246), False, 'from eduvpn.menu import menu, input_int, profile_choice, search, provider_choice, write_to_nm_choice\n'), ((458, 491), 'eduvpn.menu.profi... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-25 11:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('music', '0012_auto_20160704_1559'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.PositiveIntegerField"
] | [((399, 511), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'blank': '(True)', 'help_text': '"""Site-wide sort order (higher numbers first)"""', 'null': '(True)'}), "(blank=True, help_text=\n 'Site-wide sort order (higher numbers first)', null=True)\n", (426, 511), False, 'from django... |
from connect.eaas.extension import ProcessingResponse
from connect.toolkit.requests import RequestBuilder
from caas_ext.connect.sources import ConnectOrderSource
from caas_ext.flows import Flow
from cats_as_a_service.orders.domain.services import order_builder
class PurchaseFlow(Flow):
def process(self, request:... | [
"caas_ext.connect.sources.ConnectOrderSource",
"connect.eaas.extension.ProcessingResponse.done"
] | [((598, 623), 'connect.eaas.extension.ProcessingResponse.done', 'ProcessingResponse.done', ([], {}), '()\n', (621, 623), False, 'from connect.eaas.extension import ProcessingResponse\n'), ((531, 558), 'caas_ext.connect.sources.ConnectOrderSource', 'ConnectOrderSource', (['request'], {}), '(request)\n', (549, 558), Fals... |
from pyModbusTCP.client import ModbusClient
import time
def modbus(ip):
dip = "Offline"
# Initiate modbus client
c = ModbusClient(host=ip, port=502, auto_open=True, timeout=1)
# Read Modbus outputs
reg = c.read_holding_registers(0, 100)
# Close Modbus connection
c.close()
... | [
"pyModbusTCP.client.ModbusClient"
] | [((134, 192), 'pyModbusTCP.client.ModbusClient', 'ModbusClient', ([], {'host': 'ip', 'port': '(502)', 'auto_open': '(True)', 'timeout': '(1)'}), '(host=ip, port=502, auto_open=True, timeout=1)\n', (146, 192), False, 'from pyModbusTCP.client import ModbusClient\n')] |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.contrib.auth.decorators import login_required
from django.conf.urls import ur... | [
"django.conf.urls.url"
] | [((435, 492), 'django.conf.urls.url', 'url', (['"""^create/?$"""', 'feedbackcreate'], {'name': '"""feedback-create"""'}), "('^create/?$', feedbackcreate, name='feedback-create')\n", (438, 492), False, 'from django.conf.urls import url\n'), ((649, 693), 'django.conf.urls.url', 'url', (['"""^thankyou/?$"""', 'thankyou'],... |
import numpy as np
from scipy import interpolate
def clean_ibi(events, samping_rate, n=2):
ibi = _ibi(events, samping_rate)
for _ in range(n):
# detect outlier and repalce with nan
outliers = signal_outliers(ibi, samping_rate)
time = np.cumsum(ibi)
# interpolate nan
f =... | [
"numpy.abs",
"numpy.median",
"numpy.zeros",
"numpy.cumsum",
"numpy.diff",
"numpy.arange",
"scipy.interpolate.interp1d"
] | [((827, 841), 'numpy.median', 'np.median', (['arr'], {}), '(arr)\n', (836, 841), True, 'import numpy as np\n'), ((1315, 1349), 'numpy.zeros', 'np.zeros', (['arr.shape[0]'], {'dtype': 'bool'}), '(arr.shape[0], dtype=bool)\n', (1323, 1349), True, 'import numpy as np\n'), ((268, 282), 'numpy.cumsum', 'np.cumsum', (['ibi']... |
import numpy as np
import matplotlib.pyplot as plt
def f(x):
decay = 10.0
period = decay
return (3.0+0.5*np.sin(2.*np.pi*x/period))*x*np.exp(-x/decay)
# read data from file
xdata, ydata, yerror = np.loadtxt('DecayOcsData.txt', skiprows=5, unpack=True)
# create theoretical fitting curve
x = np.linspace(0,... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.loadtxt",
"numpy.linspace",
"numpy.exp",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.errorbar"
] | [((210, 265), 'numpy.loadtxt', 'np.loadtxt', (['"""DecayOcsData.txt"""'], {'skiprows': '(5)', 'unpack': '(True)'}), "('DecayOcsData.txt', skiprows=5, unpack=True)\n", (220, 265), True, 'import numpy as np\n'), ((306, 329), 'numpy.linspace', 'np.linspace', (['(0)', '(45)', '(128)'], {}), '(0, 45, 128)\n', (317, 329), Tr... |
from django.db import models
from django import forms
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, ModelFormAdminView, DetailAdminView, ListAdminView
def get_gallery_modal():
return """
... | [
"django.utils.translation.ugettext",
"django.utils.safestring.mark_safe",
"xadmin.sites.site.register_plugin"
] | [((4573, 4629), 'xadmin.sites.site.register_plugin', 'site.register_plugin', (['ModelDetailPlugin', 'DetailAdminView'], {}), '(ModelDetailPlugin, DetailAdminView)\n', (4593, 4629), False, 'from xadmin.sites import site\n'), ((4630, 4689), 'xadmin.sites.site.register_plugin', 'site.register_plugin', (['ModelDetailPlugin... |
# Remove "http://sn" login_url
import logging
# logger.basicConfig(filename=f"{__name__}.log")
logger = logging.getLogger(__name__)
sHandler = logging.StreamHandler()
sHandler.setLevel(logging.INFO)
logger.addHandler(sHandler)
logfilenode = __file__.rsplit('.')[0]
handler = logging.FileHandler(f"{logfilenode}.log")
han... | [
"ycommander.api.update_record",
"logging.FileHandler",
"ycommander.api.login",
"ycommander.params.KeeperParams",
"getpass.getpass",
"logging.StreamHandler",
"logging.Formatter",
"ycommander.api.get_record",
"logging.getLogger"
] | [((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((143, 166), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (164, 166), False, 'import logging\n'), ((275, 316), 'logging.FileHandler', 'logging.FileHandler', (['f"""{... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | [
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.list_all_resources",
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.get_common_arg_spec",
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.get_work_request_completed_states",
"ansible.module_utils... | [((22276, 22322), 'ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class', 'get_custom_class', (['"""DataScienceJobHelperCustom"""'], {}), "('DataScienceJobHelperCustom')\n", (22292, 22322), False, 'from ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils import OCIR... |
from random import randint
from pygame.draw import line
class Tile():
def __init__(self, height = None):
if height != None:
self.__height = height
else:
self.__height = randint(0, 100) # percentage of maximum height in order to be simple !
self.__region = None
self.__subRegion = None
self.__car... | [
"random.randint"
] | [((181, 196), 'random.randint', 'randint', (['(0)', '(100)'], {}), '(0, 100)\n', (188, 196), False, 'from random import randint\n'), ((1760, 1773), 'random.randint', 'randint', (['(0)', '(1)'], {}), '(0, 1)\n', (1767, 1773), False, 'from random import randint\n')] |
#!/home/bryan/repo/CINS465-Fall2016-Lecture-Examples/coffee/bin/python3
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates how a 1-bit BitmapImage can be used
# as a dynamically updated overlay
#
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, Im... | [
"PIL.ImageTk.BitmapImage",
"PIL.ImageTk.PhotoImage",
"sys.exit",
"PIL.Image.open"
] | [((1791, 1814), 'PIL.Image.open', 'Image.open', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1801, 1814), False, 'from PIL import Image, ImageTk\n'), ((1760, 1771), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1768, 1771), False, 'import sys\n'), ((610, 632), 'PIL.ImageTk.PhotoImage', 'ImageTk.PhotoImage', (['im'], {... |
import logging
import os.path
import random
from string import ascii_letters, digits
import requests
from flask import render_template, request, redirect, url_for
from config import config
from app import app, fetch, utils
@app.route('/')
def index():
N = 20
state = ''.join(random.SystemRandom().choice(asc... | [
"app.fetch.post_temporary_code",
"app.app.route",
"app.fetch.member_contributions",
"random.SystemRandom",
"app.fetch.orgs_for_user",
"flask.url_for",
"flask.render_template",
"app.fetch.members_in_org",
"app.fetch.member_page"
] | [((229, 243), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (238, 243), False, 'from app import app, fetch, utils\n'), ((665, 683), 'app.app.route', 'app.route', (['"""/auth"""'], {}), "('/auth')\n", (674, 683), False, 'from app import app, fetch, utils\n'), ((1237, 1258), 'app.app.route', 'app.route', ([... |
#!/usr/bin/env python
# As v1, but using scipy.sparse.diags instead of spdiags
"""
Functions for solving a 1D diffusion equations of simplest types
(constant coefficient, no source term):
u_t = a*u_xx on (0,L)
with boundary conditions u=0 on x=0,L, for t in (0,T].
Initial condition: u(x,0)=I(x).
The following ... | [
"numpy.zeros",
"time.perf_counter",
"time.sleep",
"numpy.linspace",
"numpy.linalg.solve",
"sys.exit",
"numpy.sqrt"
] | [((1720, 1739), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1737, 1739), False, 'import time\n'), ((1812, 1843), 'numpy.linspace', 'np.linspace', (['(0)', '(Nt * dt)', '(Nt + 1)'], {}), '(0, Nt * dt, Nt + 1)\n', (1823, 1843), True, 'import numpy as np\n'), ((1873, 1892), 'numpy.sqrt', 'np.sqrt', (['(a ... |
def read_maze(file_name):
"""
Reads a .txt file that must have the following format:
First line - number_of_lines number_of_columns
Second line - line_of_origin_point column_of_origin_point
Third line - line_of_destination_point column_of_destination_point
Maze -> where 0 = empty space and... | [
"os.path.exists",
"os.path.splitext"
] | [((5282, 5309), 'os.path.splitext', 'os.path.splitext', (['maze_file'], {}), '(maze_file)\n', (5298, 5309), False, 'import os\n'), ((5328, 5353), 'os.path.exists', 'os.path.exists', (['maze_file'], {}), '(maze_file)\n', (5342, 5353), False, 'import os\n'), ((5399, 5424), 'os.path.exists', 'os.path.exists', (['maze_file... |
import copy
from typing import List
import numpy as np
from numpy.core import ndarray
from .hg import Histogram
# import matplotlib.pyplot as plt
to_print = False
class NewForest:
"""This creates a forest of trees, given the following list of parameters:
1) n_trees: the number of trees
2) max_depth: the ... | [
"copy.deepcopy",
"numpy.zeros",
"numpy.shape",
"numpy.percentile",
"numpy.argsort",
"numpy.sort",
"numpy.arange",
"numpy.array",
"numpy.random.choice"
] | [((1059, 1085), 'numpy.zeros', 'np.zeros', (['self.max_buckets'], {}), '(self.max_buckets)\n', (1067, 1085), True, 'import numpy as np\n'), ((1195, 1216), 'numpy.shape', 'np.shape', (['self.points'], {}), '(self.points)\n', (1203, 1216), True, 'import numpy as np\n'), ((1351, 1374), 'numpy.zeros', 'np.zeros', (['(self.... |
import sys, csv, os
import math, random
import z3
import xml.etree.ElementTree as ET
#######
# XES #
#######
xes_ns = { 'xes': 'rttp://www.w3.org/2001/XMLSchema' }
def node_from_key(root, key):
for atr in root:
if 'key' in atr.attrib and atr.attrib['key'] == key:
return atr
return None
de... | [
"xml.etree.ElementTree.parse",
"z3.PbLe",
"math.sqrt",
"z3.And",
"z3.Optimize",
"z3.Real",
"z3.Sum",
"z3.Not",
"z3.Or"
] | [((730, 745), 'math.sqrt', 'math.sqrt', (['dist'], {}), '(dist)\n', (739, 745), False, 'import math, random\n'), ((758, 770), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (767, 770), False, 'import math, random\n'), ((920, 962), 'math.sqrt', 'math.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** ... |
import keyboard
# keyboard.press_and_release('shift+s, space')
# keyboard.write('The quick brown fox jumps over the lazy dog.')
# keyboard.add_hotkey('ctrl+shift+a', print, args=('triggered', 'hotkey'))
# # Press PAGE UP then PAGE DOWN to type "foobar".
# keyboard.add_hotkey('4', lambda: keyboard.write('#4'))
# # ... | [
"keyboard.wait"
] | [((925, 945), 'keyboard.wait', 'keyboard.wait', (['"""esc"""'], {}), "('esc')\n", (938, 945), False, 'import keyboard\n')] |
from pathlib import Path
from typing import Any, Dict, Optional, Union
from kedro.pipeline import Pipeline
from kedro_mlflow.pipeline.pipeline_ml import PipelineML
def pipeline_ml(
training: Pipeline,
inference: Pipeline,
input_name: str = None,
conda_env: Optional[Union[str, Path, Dict[str, Any]]] ... | [
"kedro_mlflow.pipeline.pipeline_ml.PipelineML"
] | [((2240, 2364), 'kedro_mlflow.pipeline.pipeline_ml.PipelineML', 'PipelineML', ([], {'nodes': 'training.nodes', 'inference': 'inference', 'input_name': 'input_name', 'conda_env': 'conda_env', 'model_name': 'model_name'}), '(nodes=training.nodes, inference=inference, input_name=input_name,\n conda_env=conda_env, model... |
#_*_coding:utf-8 _*_
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen=pygame.display.set_mode((800,800),0,32)
pygame.display.set_caption("中国AI象棋")
screen.fill((255,255,255))
screen.set_clip(0, 0, 600, 650)
#竖线
pygame.draw.line(screen, (222, 125, 44), (75, 0), (75, 280), 1)
pygame.dra... | [
"pygame.draw.line",
"pygame.draw.rect",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.init",
"pygame.display.update",
"pygame.display.quit",
"pygame.display.set_caption",
"sys.exit"
] | [((85, 98), 'pygame.init', 'pygame.init', ([], {}), '()\n', (96, 98), False, 'import pygame\n'), ((106, 148), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(800, 800)', '(0)', '(32)'], {}), '((800, 800), 0, 32)\n', (129, 148), False, 'import pygame\n'), ((146, 182), 'pygame.display.set_caption', 'pygame.disp... |
import importlib
import logging
from typing import Iterable, Any # noqa: F401
from pyhocon import ConfigTree # noqa: F401
from databuilder.extractor.base_extractor import Extractor
LOGGER = logging.getLogger(__name__)
class DBAPIExtractor(Extractor):
"""
Generic DB API extractor.
"""
CONNECTION_... | [
"importlib.import_module",
"logging.getLogger"
] | [((196, 223), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (213, 223), False, 'import logging\n'), ((1097, 1133), 'importlib.import_module', 'importlib.import_module', (['module_name'], {}), '(module_name)\n', (1120, 1133), False, 'import importlib\n')] |
# -*- coding: utf-8 -*-
"""The check functions."""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import operator
from distutils.version import LooseVersion
import os.path as op
import numpy as np
from ._logging import warn
def _ensure_int(x, name='unknown', must_be='an int'):
"""Ensure a variable is... | [
"operator.index",
"mne.utils.logger.info",
"distutils.version.LooseVersion",
"numpy.allclose",
"numpy.isfinite",
"numpy.random.RandomState",
"os.path.isfile",
"numpy.array",
"numpy.unique"
] | [((5048, 5064), 'os.path.isfile', 'op.isfile', (['fname'], {}), '(fname)\n', (5057, 5064), True, 'import os.path as op\n'), ((8651, 8690), 'numpy.array', 'np.array', (["[ch['loc'][:3] for ch in chs]"], {}), "([ch['loc'][:3] for ch in chs])\n", (8659, 8690), True, 'import numpy as np\n'), ((3713, 3740), 'numpy.random.Ra... |
# --------------
#Importing header files
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
from sklearn.model_selection import train_test_split
# Code starts here
data = pd.read_csv(path)
X = data.drop(['customer.id','paid.back.loan'],axis =1 )
y = data['paid.back.loan']
X_train,X_test,y_train... | [
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.show",
"warnings.filterwarnings",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.axis",
"sklearn.preprocessing.LabelEncoder",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"pydotp... | [((80, 113), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (103, 113), False, 'import warnings\n'), ((196, 213), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (207, 213), True, 'import pandas as pd\n'), ((330, 383), 'sklearn.model_selection.train_test_spli... |
import asyncio
import datetime
import logging
import random
import re
import sys
import traceback
import typing
import warnings
import weakref
from typing import Iterable, Union
import HABApp
import HABApp.core
import HABApp.openhab
import HABApp.rule_manager
import HABApp.util
from HABApp.core.events import AllEvents... | [
"warnings.simplefilter",
"random.randint",
"HABApp.core.EventBus.remove_listener",
"sys._getframe",
"weakref.WeakSet",
"HABApp.core.Items.item_exists",
"HABApp.core.EventBus.add_listener",
"datetime.timedelta",
"traceback.format_exc",
"HABApp.core.Items.get_all_items",
"warnings.warn",
"HABApp... | [((562, 594), 'logging.getLogger', 'logging.getLogger', (['"""HABApp.Rule"""'], {}), "('HABApp.Rule')\n", (579, 594), False, 'import logging\n'), ((840, 872), 'warnings.simplefilter', 'warnings.simplefilter', (['"""default"""'], {}), "('default')\n", (861, 872), False, 'import warnings\n'), ((2255, 2272), 'weakref.Weak... |
# Some tests for the Cylindrical coordinates handler
import numpy as np
from yt.testing import \
fake_amr_ds, \
assert_equal, \
assert_almost_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
def test_cylindrical_coordinates():
# We're go... | [
"yt.testing.fake_amr_ds",
"yt.testing.assert_equal",
"numpy.argmin",
"numpy.argmax"
] | [((432, 467), 'yt.testing.fake_amr_ds', 'fake_amr_ds', ([], {'geometry': '"""cylindrical"""'}), "(geometry='cylindrical')\n", (443, 467), False, 'from yt.testing import fake_amr_ds, assert_equal, assert_almost_equal\n'), ((1069, 1131), 'yt.testing.assert_equal', 'assert_equal', (["dd['index', 'path_element_r']", "dd['i... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 the HERA Project
# Licensed under the MIT License
import os
import argparse
import pyuvdata
from hera_cal.version import version_info
import pyuvdata.utils as uvutils
import numpy as np
parser = argparse.ArgumentParser(description='Extract HERA hex anten... | [
"pyuvdata.UVData",
"argparse.ArgumentParser",
"pyuvdata.utils.ENU_from_ECEF",
"numpy.max",
"numpy.array",
"os.path.splitext",
"numpy.loadtxt"
] | [((261, 375), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract HERA hex antennas from data file, and save with new extension."""'}), "(description=\n 'Extract HERA hex antennas from data file, and save with new extension.')\n", (284, 375), False, 'import argparse\n'), ((1653, 16... |
#!/usr/bin/env python3
import sys
import os
import shutil
if sys.version_info[0] < 3:
print("Python 3 is required to run the script and not Python "+str(sys.version_info[0]))
sys.exit(1)
def fatal_error(message):
sys.stderr.write(message+"\n")
sys.stderr.write("\n\nBUILD FAILED!!! LOOK AT MESSAGES AB... | [
"os.makedirs",
"os.path.isdir",
"os.path.realpath",
"os.system",
"shutil.rmtree",
"sys.stderr.write",
"os.path.join",
"os.chdir",
"sys.exit"
] | [((615, 645), 'os.path.isdir', 'os.path.isdir', (['"""build_release"""'], {}), "('build_release')\n", (628, 645), False, 'import os\n'), ((682, 710), 'os.makedirs', 'os.makedirs', (['"""build_release"""'], {}), "('build_release')\n", (693, 710), False, 'import os\n'), ((185, 196), 'sys.exit', 'sys.exit', (['(1)'], {}),... |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function # Python 2/3 compatibility
__doc__ = """
Demo ward clustering on a graph: various ways of forming clusters and dendrogram
Requires matplotlib
"""... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.sum",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"numpy.ceil",
"nipy.algorithms.clustering.hierarchical_clustering.ward",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"nipy.alg... | [((772, 783), 'numpy.random.randn', 'randn', (['n', '(2)'], {}), '(n, 2)\n', (777, 783), False, 'from numpy.random import randn, rand\n'), ((812, 821), 'nipy.algorithms.graph.knn', 'knn', (['X', '(5)'], {}), '(X, 5)\n', (815, 821), False, 'from nipy.algorithms.graph import knn\n'), ((829, 848), 'nipy.algorithms.cluster... |
import os
import sys
import yaml
import logging
from typing import Optional, Union, TypeVar
T = TypeVar("T")
def _parse_with_warning(var_name: str, default_value: T) -> Union[T, str]:
if var_name in os.environ:
return os.environ[var_name]
else:
logging.warning(f"{var_name} not found in enviro... | [
"logging.error",
"logging.warning",
"yaml.safe_load",
"typing.TypeVar",
"sys.exit"
] | [((97, 109), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (104, 109), False, 'from typing import Optional, Union, TypeVar\n'), ((916, 968), 'logging.error', 'logging.error', (['"""CONN_HOST not specified, exiting..."""'], {}), "('CONN_HOST not specified, exiting...')\n", (929, 968), False, 'import logging... |
# MIT License
#
# Copyright (c) 2018 <NAME>, <EMAIL>, <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 rights
# to use, c... | [
"eosetl.mappers.action_mapper.EosActionMapper",
"eosetl.mappers.transaction_mapper.EosTransactionMapper",
"eosetl.mappers.block_mapper.EosBlockMapper"
] | [((1426, 1442), 'eosetl.mappers.block_mapper.EosBlockMapper', 'EosBlockMapper', ([], {}), '()\n', (1440, 1442), False, 'from eosetl.mappers.block_mapper import EosBlockMapper\n'), ((1477, 1499), 'eosetl.mappers.transaction_mapper.EosTransactionMapper', 'EosTransactionMapper', ([], {}), '()\n', (1497, 1499), False, 'fro... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"unittest.main",
"qiskit.transpiler.passes.Collect2qBlocks",
"qiskit.transpiler.passes.ConsolidateBlocks",
"qiskit.circuit.library.U2Gate",
"qiskit.converters.dag_to_circuit",
"qiskit.circuit.QuantumRegister",
"qiskit.circuit.QuantumCircuit",
"qiskit.quantum_info.operators.Operator",
"qiskit.convert... | [((10883, 10898), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10896, 10898), False, 'import unittest\n'), ((1371, 1395), 'qiskit.circuit.QuantumRegister', 'QuantumRegister', (['(2)', '"""qr"""'], {}), "(2, 'qr')\n", (1386, 1395), False, 'from qiskit.circuit import QuantumCircuit, QuantumRegister\n'), ((1409, 1... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/home/')
def home():
# Connecting to a template (html file)
return render_template('home.html')
@app.route('/puppy/<name>')
def pup_name(name):
return render_template('puppy.html',name=name)
@app.route('/about/')
def a... | [
"flask.Flask",
"flask.render_template"
] | [((48, 63), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (53, 63), False, 'from flask import Flask, render_template\n'), ((166, 194), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (181, 194), False, 'from flask import Flask, render_template\n'), ((252, 292), 'f... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"absl.testing.absltest.main",
"uflow.data.generic_flow_dataset.make_dataset",
"uflow.misc.convert_video_to_dataset.convert_video",
"tensorflow.compat.v1.data.make_one_shot_iterator"
] | [((1623, 1638), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1636, 1638), False, 'from absl.testing import absltest\n'), ((1051, 1145), 'uflow.misc.convert_video_to_dataset.convert_video', 'convert_video_to_dataset.convert_video', ([], {'video_file_path': 'filepath', 'output_folder': 'output_dir'})... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.orm.Group",
"collections.defaultdict",
"aiida.orm.Int",
"aiida.common.timezone.now",
"unittest.skipIf",
"warnings.simplefilter",
"six.moves.range",
"aiida.engine.if_",
"warnings.catch_warnings",
"datetime.timedelta",
"aiida.orm.Data",
"aiida.orm.Dict",
"aiida.orm.CalculationNode",
"... | [((29478, 29589), 'unittest.skipIf', 'unittest.skipIf', (["(settings.BACKEND == u'sqlalchemy')", '"""SQLA doesn\'t have full datetime support in attributes"""'], {}), '(settings.BACKEND == u\'sqlalchemy\',\n "SQLA doesn\'t have full datetime support in attributes")\n', (29493, 29589), False, 'import unittest\n'), ((... |