code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 22:15:01 2018
@author: Mauro
"""
# =============================================================================
# Imports
# =============================================================================
# py imports
import random
import copy
# project imports
import... | [
"vec.V4",
"snake.Snake",
"random.randrange",
"poly.create_cube4d",
"bfh.BinaryFile",
"copy.deepcopy"
] | [((1082, 1095), 'snake.Snake', 'snake.Snake', ([], {}), '()\n', (1093, 1095), False, 'import snake\n'), ((2935, 2978), 'poly.create_cube4d', 'poly.create_cube4d', (['food_point', '(0.9)', '"""blue"""'], {}), "(food_point, 0.9, 'blue')\n", (2953, 2978), False, 'import poly\n'), ((3945, 3969), 'copy.deepcopy', 'copy.deep... |
from rest_framework import serializers
from apps.blog.models import Post, Tag, Category
from django.contrib.auth import get_user_model
class AuthorSerializer(serializers.ModelSerializer):
count = serializers.SerializerMethodField()
def get_count(self, *args):
return Post.objects.filter(author=args[0]... | [
"rest_framework.serializers.DateTimeField",
"django.contrib.auth.get_user_model",
"rest_framework.serializers.IntegerField",
"apps.blog.models.Post.objects.create",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.ListField",
"apps.blog.models.Tag.objects.filter",
"apps.... | [((202, 237), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (235, 237), False, 'from rest_framework import serializers\n'), ((486, 521), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (519, 521), Fal... |
from flask import Flask, request
from config import CONSUMERSECRET
import base64
import hashlib
import hmac
import json
import multiprocessing as mp
import tipbot
application = Flask('twitter-tipbot')
def sig(msg: bytes) -> str:
sha256_hash_digest = hmac.new(CONSUMERSECRET.encode(), msg = msg, digestmod = hashlib... | [
"flask.request.args.get",
"flask.Flask",
"multiprocessing.Process",
"json.dumps",
"base64.b64encode",
"config.CONSUMERSECRET.encode",
"flask.request.headers.get"
] | [((178, 201), 'flask.Flask', 'Flask', (['"""twitter-tipbot"""'], {}), "('twitter-tipbot')\n", (183, 201), False, 'from flask import Flask, request\n'), ((794, 814), 'json.dumps', 'json.dumps', (['response'], {}), '(response)\n', (804, 814), False, 'import json\n'), ((1052, 1103), 'flask.request.headers.get', 'request.h... |
## run after running 'batch_seg_images_in_folder.py'
# which creates a folder of 'predseg' outputs for mapping
# import numpy as np
from tkinter import Tk
from tkinter.filedialog import askopenfilename, askdirectory
import os
from glob import glob
## prepare 4 text files. Each lists folders to process. One file for... | [
"os.system",
"tkinter.Tk",
"glob.glob",
"tkinter.filedialog.askopenfilename"
] | [((416, 420), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (418, 420), False, 'from tkinter import Tk\n'), ((438, 603), 'tkinter.filedialog.askopenfilename', 'askopenfilename', ([], {'initialdir': '"""./"""', 'title': '"""Select text file listing model output folders to process"""', 'filetypes': "(('txt file', '*.txt'), ('all... |
import os
import os.path as osp
import subprocess
import time
import sys
import argparse
import numpy as np
from sklearn.metrics import roc_auc_score
import time
LSGKM_DIR = osp.join("baselines", "lsgkm-master/src")
LSGKM_TRAIN = osp.join(LSGKM_DIR, "gkmtrain")
LSGKM_PREDICT = osp.join(LSGKM_DIR, "gkmpredict")
def g... | [
"subprocess.check_output",
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"sklearn.metrics.roc_auc_score"
] | [((175, 216), 'os.path.join', 'osp.join', (['"""baselines"""', '"""lsgkm-master/src"""'], {}), "('baselines', 'lsgkm-master/src')\n", (183, 216), True, 'import os.path as osp\n'), ((231, 262), 'os.path.join', 'osp.join', (['LSGKM_DIR', '"""gkmtrain"""'], {}), "(LSGKM_DIR, 'gkmtrain')\n", (239, 262), True, 'import os.pa... |
# -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from sqlalchemy import desc
from Crud.core import Conexao
from Crud.Models import CatAReceber
class CrudCatAReceber(object):
def __init__(self, id="", categoriaReceber="", query=""):
self.id = id
self.categoriaReceber = categoriaR... | [
"Crud.Models.CatAReceber",
"Crud.core.Conexao",
"sqlalchemy.desc"
] | [((490, 499), 'Crud.core.Conexao', 'Conexao', ([], {}), '()\n', (497, 499), False, 'from Crud.core import Conexao\n'), ((977, 986), 'Crud.core.Conexao', 'Conexao', ([], {}), '()\n', (984, 986), False, 'from Crud.core import Conexao\n'), ((1065, 1131), 'Crud.Models.CatAReceber', 'CatAReceber', ([], {'id': 'self.id', 'ca... |
from idiotic.utils import Filter
from asyncio import coroutine, iscoroutine, iscoroutinefunction, Queue, QueueFull, get_event_loop
try:
# timeout is only on 3.5.2+
from asyncio import timeout
except ImportError:
# But aiohttp has the same thing already
from aiohttp import Timeout as timeout
import loggi... | [
"logging.getLogger",
"asyncio.iscoroutinefunction",
"asyncio.coroutine",
"asyncio.Queue",
"functools.partial",
"idiotic.utils.Filter",
"aiohttp.Timeout",
"asyncio.get_event_loop",
"asyncio.iscoroutine"
] | [((347, 384), 'logging.getLogger', 'logging.getLogger', (['"""idiotic.dispatch"""'], {}), "('idiotic.dispatch')\n", (364, 384), False, 'import logging\n'), ((476, 483), 'asyncio.Queue', 'Queue', ([], {}), '()\n', (481, 483), False, 'from asyncio import coroutine, iscoroutine, iscoroutinefunction, Queue, QueueFull, get_... |
"""The watcher file is a script meant to be run as an ongoing process to watch a given directory and analyzing files
that may be moved there for certain keywords. Automatic processing will be started if the file contains the keywords."""
import collections
import concurrent.futures
import datetime
import os
from functo... | [
"logging.getLogger",
"pylinac.load_log",
"pylinac.core.io.retrieve_demo_file",
"zipfile.ZipFile",
"gzip.open",
"time.sleep",
"pylinac.core.image.prepare_for_classification",
"datetime.timedelta",
"os.walk",
"os.remove",
"os.listdir",
"pylinac.core.io.is_dicom_image",
"pylinac.core.schedule.e... | [((870, 898), 'logging.getLogger', 'logging.getLogger', (['"""pylinac"""'], {}), "('pylinac')\n", (887, 898), False, 'import logging\n'), ((900, 1008), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(leve... |
import tensorflow as tf
weight = tf.Variable(1.0,name="weight")
input_value = tf.constant(0.5,name="input_value")
expected_output = tf.constant(0.0,name="expected_output")
model = tf.multiply(input_value,weight,"model")
loss_function = tf.pow(expected_output - model,2,name="loss_function")
optimizer = tf.train.Gradie... | [
"tensorflow.summary.merge_all",
"tensorflow.pow",
"tensorflow.Variable",
"tensorflow.Session",
"tensorflow.multiply",
"tensorflow.global_variables_initializer",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.constant",
"tensorflow.summary.scalar",
"tensorflow.summary.FileWriter"
] | [((34, 65), 'tensorflow.Variable', 'tf.Variable', (['(1.0)'], {'name': '"""weight"""'}), "(1.0, name='weight')\n", (45, 65), True, 'import tensorflow as tf\n'), ((79, 115), 'tensorflow.constant', 'tf.constant', (['(0.5)'], {'name': '"""input_value"""'}), "(0.5, name='input_value')\n", (90, 115), True, 'import tensorflo... |
import random
alges = ["Alge 2", "Alge 3", "Alge 4", "Alge 5", "Alge 6"]
megaalges = ["Grün", "Rot", "Blau", "Gelb"]
colours = ["Grün", "Rot"]
# Generates a random Alge from the lists above
def generate_alge():
alge = random.choice(alges)
return alge
# Generates a random Megaalge colour from the lists above... | [
"random.choice"
] | [((224, 244), 'random.choice', 'random.choice', (['alges'], {}), '(alges)\n', (237, 244), False, 'import random\n'), ((359, 383), 'random.choice', 'random.choice', (['megaalges'], {}), '(megaalges)\n', (372, 383), False, 'import random\n'), ((494, 516), 'random.choice', 'random.choice', (['colours'], {}), '(colours)\n'... |
# Copyright 2016 OpenMarket Ltd
#
# 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 writin... | [
"logging.getLogger",
"twisted.web.resource.NoResource"
] | [((649, 676), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (666, 676), False, 'import logging\n'), ((2010, 2022), 'twisted.web.resource.NoResource', 'NoResource', ([], {}), '()\n', (2020, 2022), False, 'from twisted.web.resource import NoResource\n')] |
#!/usr/bin/env python
from __future__ import print_function
import glob
import hashlib
import httplib2
import os
import re
from dateutil.parser import parse
from apiclient import discovery
from jinja2 import Template
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storag... | [
"dateutil.parser.parse",
"os.listdir",
"httplib2.Http",
"hashlib.md5",
"os.path.join",
"oauth2client.client.flow_from_clientsecrets",
"re.match",
"jinja2.Template",
"os.path.realpath",
"oauth2client.file.Storage",
"os.path.abspath",
"oauth2client.tools.run_flow",
"apiclient.discovery.build",... | [((597, 640), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""content"""', '"""events"""'], {}), "(BASE_DIR, 'content', 'events')\n", (609, 640), False, 'import os\n'), ((4138, 4211), 'os.path.join', 'os.path.join', (['credential_dir', '"""sheets.googleapis.com-endosys-events.json"""'], {}), "(credential_dir, 'sheets... |
import json as jsonlib
import requests
from csvwlib.utils.metadata import MetadataValidator
from csvwlib.utils.url.WellKnownUriResolver import WellKnownUriResolver
class MetadataLocator:
@staticmethod
def find_and_get(csv_url, metadata_url=None):
if metadata_url is not None:
return json... | [
"requests.head",
"csvwlib.utils.url.WellKnownUriResolver.WellKnownUriResolver.resolve",
"csvwlib.utils.metadata.MetadataValidator.instance.print_bad_reference_warning",
"requests.get"
] | [((395, 417), 'requests.head', 'requests.head', (['csv_url'], {}), '(csv_url)\n', (408, 417), False, 'import requests\n'), ((2150, 2183), 'requests.get', 'requests.get', (['site_wide_conf_file'], {}), '(site_wide_conf_file)\n', (2162, 2183), False, 'import requests\n'), ((1128, 1154), 'requests.get', 'requests.get', ([... |
import pathlib, stat, shutil, urllib.request, subprocess, time
import json, sys
import os, tarfile, psutil
def _log(message):
print("[%s] %s" % (time.strftime("%H:%M:%S", time.localtime()), message))
def _download(url, path):
try:
with urllib.request.urlopen(url) as response:
with open(path, "wb") as outfile:
... | [
"time.localtime",
"tarfile.open",
"sys.exit",
"shutil.copyfileobj",
"pathlib.Path",
"subprocess.Popen",
"subprocess.run",
"os.path.join",
"psutil.process_iter",
"time.sleep",
"shutil.which",
"os.path.isfile",
"shutil.rmtree",
"json.load",
"shutil.unpack_archive",
"os.remove"
] | [((450, 471), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (469, 471), False, 'import os, tarfile, psutil\n'), ((900, 988), 'subprocess.run', 'subprocess.run', (["['./ngrok', 'authtoken', '-config', ngrok_config, token]"], {'check': '(True)'}), "(['./ngrok', 'authtoken', '-config', ngrok_config, toke... |
from model import C620_OP,C620_SF,TR_C620,C660_MF,TR_C620_T651,C660_OP,C660_SF,TR_C660,C670_OP,C670_SF,TR_C670
import torch
from torch import nn
from torch.utils.tensorboard import SummaryWriter
class Model(nn.Module):
def __init__(self):
super().__init__()
self.c620_op = C620_OP()
self.c62... | [
"torch.utils.tensorboard.SummaryWriter",
"model.C670_OP",
"model.C620_SF",
"model.TR_C620_T651",
"model.C670_SF",
"model.TR_C670",
"model.TR_C620",
"model.C660_MF",
"model.C660_OP",
"model.TR_C660",
"model.C660_SF",
"model.C620_OP",
"torch.rand"
] | [((1875, 1892), 'torch.rand', 'torch.rand', (['(64)', '(3)'], {}), '(64, 3)\n', (1885, 1892), False, 'import torch\n'), ((1908, 1925), 'torch.rand', 'torch.rand', (['(64)', '(2)'], {}), '(64, 2)\n', (1918, 1925), False, 'import torch\n'), ((1941, 1959), 'torch.rand', 'torch.rand', (['(64)', '(41)'], {}), '(64, 41)\n', ... |
#coding:utf-8
from caty.core.resource import ResourceFinder
from caty.core.facility import ReadOnlyFacility
from caty.core.language import split_colon_dot_path
from caty.core.casm.language.casmparser import parse
from caty.core.casm.language.ast import ModuleName
import caty.core.runtimeobject as ro
import caty.core.sc... | [
"caty.core.resource.ResourceFinder.__init__",
"caty.core.runtimeobject.i18n.get"
] | [((692, 734), 'caty.core.resource.ResourceFinder.__init__', 'ResourceFinder.__init__', (['self', 'app', 'system'], {}), '(self, app, system)\n', (715, 734), False, 'from caty.core.resource import ResourceFinder\n'), ((1289, 1354), 'caty.core.runtimeobject.i18n.get', 'ro.i18n.get', (['"""Uneable to add command at runtim... |
"""Conda tasks."""
import logging
from invoke import task
logger = logging.getLogger(__name__)
@task
def create(c):
"""Recreate the conda environment."""
logger.info("Recreating conda environment edbscan-env...")
c.run("conda-merge environment.run.yml environment.dev.yml > environment.yml", pty=True)
... | [
"logging.getLogger"
] | [((70, 97), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (87, 97), False, 'import logging\n')] |
from setuptools import setup, find_packages
setup(
name="lwhn_example_app_python_flask",
version="1.0.0",
packages=find_packages(where="."),
package_dir={"": "."},
install_requires=[
"Flask-Session>=0.3.1",
"attrs>=18.1.0",
"flask-login>=0.4.1",
"flask>=1.0",
... | [
"setuptools.find_packages"
] | [((128, 152), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""."""'}), "(where='.')\n", (141, 152), False, 'from setuptools import setup, find_packages\n')] |
"""empty message
Revision ID: 460c4a8d039d
Revises: 03225b07634c
Create Date: 2019-01-07 13:56:13.683601
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '460c4a8d039d'
down_revision = '03225b07634c'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
"sqlalchemy.String",
"alembic.op.drop_column",
"sqlalchemy.VARCHAR"
] | [((923, 974), 'alembic.op.drop_column', 'op.drop_column', (['"""work_packages"""', '"""next_deliverable"""'], {}), "('work_packages', 'next_deliverable')\n", (937, 974), False, 'from alembic import op\n'), ((979, 1020), 'alembic.op.drop_column', 'op.drop_column', (['"""work_packages"""', '"""issues"""'], {}), "('work_p... |
from pyweblogalyzer import cli
def test_cli():
cli.main()
| [
"pyweblogalyzer.cli.main"
] | [((54, 64), 'pyweblogalyzer.cli.main', 'cli.main', ([], {}), '()\n', (62, 64), False, 'from pyweblogalyzer import cli\n')] |
import lcd_lib as lcd
file_name = 'qr'
LCD = lcd.LCD_1inch3()
file = open(file_name, "r")
LCD.fill(LCD.white)
data = file.read()
data = data.split('\r\n')
for line in data:
row, elements = line.split(':')
elements = elements.split(',')
for i in range(0,len(elements),2):
for k in range(int(elem... | [
"lcd_lib.LCD_1inch3"
] | [((47, 63), 'lcd_lib.LCD_1inch3', 'lcd.LCD_1inch3', ([], {}), '()\n', (61, 63), True, 'import lcd_lib as lcd\n')] |
import pytest
import requests
url = 'http://127.0.0.1:5000'
def test_product_create():
global pname, pdescription, pid
pname = "Example product"
pdescription = "Example description"
r = requests.post(url + '/api/v1/products',
json = {'name': pname,
'description': pdescription})
pid = r.json()['id']
asse... | [
"requests.post",
"requests.get"
] | [((193, 287), 'requests.post', 'requests.post', (["(url + '/api/v1/products')"], {'json': "{'name': pname, 'description': pdescription}"}), "(url + '/api/v1/products', json={'name': pname, 'description':\n pdescription})\n", (206, 287), False, 'import requests\n'), ((572, 610), 'requests.get', 'requests.get', (["(ur... |
"Data model implementation for the game."
from collections import namedtuple
from copy import deepcopy
from enum import IntEnum
def print_board(board):
print(" ", ' '.join(str(index) for index in range(8)))
for index, line in enumerate(board):
print(index, ' '.join(str(piece) for piece in line))
cla... | [
"collections.namedtuple",
"copy.deepcopy"
] | [((1527, 1589), 'collections.namedtuple', 'namedtuple', (['"""Move"""', "('player', 'from_position', 'to_position')"], {}), "('Move', ('player', 'from_position', 'to_position'))\n", (1537, 1589), False, 'from collections import namedtuple\n'), ((5815, 5835), 'copy.deepcopy', 'deepcopy', (['self.board'], {}), '(self.boa... |
import day1, day2, day3, day4, day5, day6
if __name__ == "__main__":
day1.main()
day2.main()
day3.main()
day4.main()
day5.main()
day6.main() | [
"day6.main",
"day4.main",
"day5.main",
"day2.main",
"day1.main",
"day3.main"
] | [((74, 85), 'day1.main', 'day1.main', ([], {}), '()\n', (83, 85), False, 'import day1, day2, day3, day4, day5, day6\n'), ((90, 101), 'day2.main', 'day2.main', ([], {}), '()\n', (99, 101), False, 'import day1, day2, day3, day4, day5, day6\n'), ((106, 117), 'day3.main', 'day3.main', ([], {}), '()\n', (115, 117), False, '... |
# -*- coding: utf-8 -*-
# this file is generated by gen_kdata_schema function, dont't change it
from sqlalchemy.ext.declarative import declarative_base
from zvt.contract.register import register_schema
from zvt.domain.quotes import StockStyleFactorCommon
FactorBase = declarative_base()
class StockStyleFactor(Factor... | [
"zvt.contract.register.register_schema",
"sqlalchemy.ext.declarative.declarative_base"
] | [((270, 288), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (286, 288), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((1241, 1339), 'zvt.contract.register.register_schema', 'register_schema', ([], {'providers': "['joinquant']", 'db_name': '"""stock_style_fa... |
import clawpack.pyclaw
class State(clawpack.pyclaw.State):
"""Parallel State class"""
__doc__ += clawpack.pyclaw.util.add_parent_doc(clawpack.pyclaw.state)
@property
def num_eqn(self):
r"""(int) - Number of unknowns (components of q)"""
if self.q_da is None:
raise Exceptio... | [
"petsc4py.PETSc.DA",
"petsc4py.PETSc.COMM_WORLD.getRank",
"petsc4py.PETSc.Scatter.toZero"
] | [((9825, 9856), 'petsc4py.PETSc.Scatter.toZero', 'PETSc.Scatter.toZero', (['q_natural'], {}), '(q_natural)\n', (9845, 9856), False, 'from petsc4py import PETSc\n'), ((9949, 9975), 'petsc4py.PETSc.COMM_WORLD.getRank', 'PETSc.COMM_WORLD.getRank', ([], {}), '()\n', (9973, 9975), False, 'from petsc4py import PETSc\n'), ((1... |
import sys, math
while True:
line = sys.stdin.readline()
if not line:
break
a, b = (int(x) for x in line.split())
print(a // b)
| [
"sys.stdin.readline"
] | [((40, 60), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (58, 60), False, 'import sys, math\n')] |
import pynetbox
import os
import ipaddress
netbox_token = os.getenv("NETBOX_TOKEN")
netbox_url = os.getenv("NETBOX_URL")
site_name = os.getenv("NETBOX_SITE")
tenant_name = os.getenv("NETBOX_TENANT")
netbox = pynetbox.api(netbox_url, token=netbox_token)
tenant = netbox.tenancy.tenants.get(name=tenant_name)
mgmt_tena... | [
"pynetbox.api",
"ipaddress.ip_network",
"os.getenv"
] | [((59, 84), 'os.getenv', 'os.getenv', (['"""NETBOX_TOKEN"""'], {}), "('NETBOX_TOKEN')\n", (68, 84), False, 'import os\n'), ((98, 121), 'os.getenv', 'os.getenv', (['"""NETBOX_URL"""'], {}), "('NETBOX_URL')\n", (107, 121), False, 'import os\n'), ((135, 159), 'os.getenv', 'os.getenv', (['"""NETBOX_SITE"""'], {}), "('NETBO... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.animals import animals
def test_animals():
"""Test module animals.py by downloading
animals.csv and testing shape of
extracted data has 20... | [
"observations.r.animals.animals",
"tempfile.mkdtemp",
"shutil.rmtree"
] | [((360, 378), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (376, 378), False, 'import tempfile\n'), ((401, 419), 'observations.r.animals.animals', 'animals', (['test_path'], {}), '(test_path)\n', (408, 419), False, 'from observations.r.animals import animals\n'), ((477, 501), 'shutil.rmtree', 'shutil.rmtre... |
# SPDX-License-Identifier: Apache-2.0
import os
import numpy
from _tools import generate_random_images, benchmark_tflite
def main(opset=13):
url = "https://tfhub.dev/google/coral-model/yamnet/classification/coral/1?coral-format=tflite"
dest = "tf-yamnet"
name = "yamnet"
onnx_name = os.path.join(dest, ... | [
"_tools.benchmark_tflite",
"_tools.generate_random_images",
"os.path.join"
] | [((301, 349), 'os.path.join', 'os.path.join', (['dest', "('%s-%d.onnx' % (name, opset))"], {}), "(dest, '%s-%d.onnx' % (name, opset))\n", (313, 349), False, 'import os\n'), ((362, 427), '_tools.generate_random_images', 'generate_random_images', ([], {'shape': '(1, 256, 256, 3)', 'dtype': 'numpy.int32'}), '(shape=(1, 25... |
from __future__ import absolute_import, division, print_function
import os
import sys
import pprint
import random
import socket
import docker
import logging
import time
import tempfile
cur_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath("%s/../clipper_admin" % cur_dir))
from clipper_... | [
"logging.getLogger",
"os.path.exists",
"os.makedirs",
"socket.socket",
"clipper_admin.ClipperConnection",
"clipper_admin.KubernetesContainerManager",
"time.sleep",
"docker.from_env",
"tempfile.mkdtemp",
"pprint.PrettyPrinter",
"os.path.abspath",
"random.randint",
"clipper_admin.DockerContain... | [((570, 597), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (587, 597), False, 'import logging\n'), ((740, 778), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'dir': 'CLIPPER_TEMP_DIR'}), '(dir=CLIPPER_TEMP_DIR)\n', (756, 778), False, 'import tempfile\n'), ((211, 236), 'os.path.abspath',... |
import os
from django.test import TestCase, Client
from django.contrib.auth.models import User
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from fileman.views import read_dir, get_full_path
USER = 'test'
ADMIN = 'admin'
PASSWORD = '<PASSWORD>'
TEST_FI... | [
"django.core.urlresolvers.reverse",
"fileman.views.get_full_path",
"fileman.views.read_dir",
"django.contrib.auth.models.User.objects.create_user",
"django.test.Client"
] | [((413, 472), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': 'ADMIN', 'password': 'PASSWORD'}), '(username=ADMIN, password=PASSWORD)\n', (437, 472), False, 'from django.contrib.auth.models import User\n'), ((567, 625), 'django.contrib.auth.models.User.objects.create... |
import socket
import threading
import tkinter as tk
from tkinter import scrolledtext
from tkinter import messagebox
HOST = '127.0.0.1'
PORT = 1234
DARK_GREY = '#121212'
MEDIUM_GREY = '#1F1B24'
OCEAN_BLUE = '#464EB8'
WHITE = "white"
FONT = ("Helvetica", 17)
BUTTON_FONT = ("Helvetica", 15)
SMALL_FONT = ("Helvetica", 13... | [
"tkinter.messagebox.showerror",
"tkinter.Entry",
"socket.socket",
"tkinter.Button",
"tkinter.scrolledtext.ScrolledText",
"tkinter.Tk",
"tkinter.Label",
"threading.Thread",
"tkinter.Frame"
] | [((333, 382), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (346, 382), False, 'import socket\n'), ((1471, 1478), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1476, 1478), True, 'import tkinter as tk\n'), ((1686, 1737), 'tkinter.Frame', 'tk.Fram... |
import pandas as pd
def i18n():
file = open('translation.csv','r')
reader = csv.reader(file)
people = {}
for row in reader:
people[row[0]]={'value':row[1],'value2':row[2]}
print(people)
def get():
df = pd.read_csv('setting.csv')
saved_column = df['conf']
font=[]
font=df.iloc[:,0]
print(font)
#proporc... | [
"pandas.read_csv"
] | [((214, 240), 'pandas.read_csv', 'pd.read_csv', (['"""setting.csv"""'], {}), "('setting.csv')\n", (225, 240), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 16:57:37 2020
@author: rkhat
"""
from tkinter import *
from tkinter import ttk, filedialog, messagebox
import pytesseract
import cv2
class ReadFileApp:
master=None
def __init__(self, master):
self.master=master
self.x_start, self.y_start,... | [
"cv2.setMouseCallback",
"cv2.rectangle",
"tkinter.ttk.Button",
"cv2.threshold",
"tkinter.filedialog.asksaveasfile",
"tkinter.ttk.Label",
"cv2.imshow",
"cv2.waitKey",
"tkinter.messagebox.askquestion",
"cv2.destroyAllWindows",
"pytesseract.image_to_string",
"cv2.bitwise_not",
"tkinter.messageb... | [((417, 453), 'tkinter.ttk.Label', 'ttk.Label', (['master'], {'text': '"""Open Image"""'}), "(master, text='Open Image')\n", (426, 453), False, 'from tkinter import ttk, filedialog, messagebox\n'), ((652, 699), 'tkinter.ttk.Label', 'ttk.Label', (['master'], {'text': '"""Display Image Content"""'}), "(master, text='Disp... |
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
door = "closed"
passwords = set()
class PassWord(Resource):
def get(self):
global passwords
return {
"result": "OK",
"passwords": list(passwords)
}
... | [
"flask_restful.Api",
"flask.Flask"
] | [((80, 95), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'from flask import Flask, request\n'), ((102, 110), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (105, 110), False, 'from flask_restful import Resource, Api\n')] |
#Copyright 2021 <NAME>, <NAME> Institute for Biomedical Research
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable la... | [
"logging.getLogger",
"sqlalchemy.orm.relationship",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.Table",
"sqlalchemy.ext.automap.automap_base",
"sqlalchemy.ForeignKey",
"sqlalchemy.MetaData",
"sqlalchemy.orm.scoped_session",
"sqlalchemy.Column",
"os.path.expanduser"
] | [((1046, 1072), 'logging.getLogger', 'logging.getLogger', (['"""RosEM"""'], {}), "('RosEM')\n", (1063, 1072), False, 'import logging\n'), ((1790, 1820), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'self.engine'}), '(bind=self.engine)\n', (1802, 1820), False, 'from sqlalchemy.orm import relationship, se... |
import pyautogui as pag
alert = 0
class changes():
def __init__(self):
self.last = 35
def change(i, obj):
last = obj.last
if i > 0 and i < 31:
if last > 0 and last < 31:
pass
else:
pag.hotkey('ctrl', '-')
elif i > 30 and i < 51:
if last > 3... | [
"pyautogui.hotkey"
] | [((248, 271), 'pyautogui.hotkey', 'pag.hotkey', (['"""ctrl"""', '"""-"""'], {}), "('ctrl', '-')\n", (258, 271), True, 'import pyautogui as pag\n'), ((423, 446), 'pyautogui.hotkey', 'pag.hotkey', (['"""ctrl"""', '"""+"""'], {}), "('ctrl', '+')\n", (433, 446), True, 'import pyautogui as pag\n'), ((481, 504), 'pyautogui.h... |
import string
import random
import time
import os
import os.path
# Defining All Possible Characters
chars = string.ascii_letters + string.punctuation + string.digits
# Creates Empty Password Variable to Be Filled Later
password = ''
# Gathers User Input for Text File
passwordApp = input("What App is this Password f... | [
"random.choice",
"os.path.join",
"time.sleep"
] | [((712, 725), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (722, 725), False, 'import time\n'), ((890, 903), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (900, 903), False, 'import time\n'), ((1128, 1141), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1138, 1141), False, 'import time\n'), ((1162, 1... |
from pathlib import Path
from .argtypes import FileType
import argparse
import sys
def parse_file(pattern):
"""
Parse file path if corresponding argument was given
:param pattern: custom file type keyword for argument parser
:return: file path if file exists else NoneType
"""
ap = argparse.Arg... | [
"pathlib.Path",
"argparse.ArgumentParser",
"sys.exit"
] | [((308, 333), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (331, 333), False, 'import argparse\n'), ((724, 735), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (732, 735), False, 'import sys\n'), ((541, 559), 'pathlib.Path', 'Path', (["args['path']"], {}), "(args['path'])\n", (545, 559), Fal... |
import os
# Dictionary for ORF detection
search_pattern = {"AAA": "K", "AAC": "N", "AAG": "K", "AAT": "N", "ACA": "T", "ACC": "T", "ACG": "T", "ACT": "T",
"AGA": "R", "AGC": "S", "AGG": "R", "AGT": "S", "ATA": "I", "ATC": "I", "ATG": "M", "ATT": "I",
"CAA": "Q", "CAC": "H", "CAG": "... | [
"os.scandir"
] | [((3204, 3225), 'os.scandir', 'os.scandir', (['input_dir'], {}), '(input_dir)\n', (3214, 3225), False, 'import os\n'), ((3722, 3756), 'os.scandir', 'os.scandir', (["(input_dir + '/' + path)"], {}), "(input_dir + '/' + path)\n", (3732, 3756), False, 'import os\n')] |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"unittest.main",
"snipphthalate.comment.block",
"textwrap.dedent",
"unittest.mock.create_autospec"
] | [((2139, 2154), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2152, 2154), False, 'import unittest\n'), ((857, 894), 'unittest.mock.create_autospec', 'mock.create_autospec', (['context.Context'], {}), '(context.Context)\n', (877, 894), False, 'from unittest import mock\n'), ((922, 966), 'unittest.mock.create_aut... |
from pysst.steps.requests_steps import step_requests_is_installed, step_we_set_header, step_the_request_type_is, step_status_code_is
import requests
class behave_context(object):
"""Fake behave object"""
def __init__(self):
self.requests = None
self.request_type = 'get'
self.target = No... | [
"pysst.steps.requests_steps.step_the_request_type_is",
"pysst.steps.requests_steps.step_status_code_is",
"pysst.steps.requests_steps.step_requests_is_installed",
"pysst.steps.requests_steps.step_we_set_header"
] | [((424, 459), 'pysst.steps.requests_steps.step_requests_is_installed', 'step_requests_is_installed', (['context'], {}), '(context)\n', (450, 459), False, 'from pysst.steps.requests_steps import step_requests_is_installed, step_we_set_header, step_the_request_type_is, step_status_code_is\n'), ((567, 615), 'pysst.steps.r... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2011 CEA
# <NAME>
# Licensed under the terms of the CECILL License
# (see guidata/__init__.py for details)
"""
qtwidgets
---------
The ``guidata.qtwidgets`` module provides ready-to-use or generic widgets
for developing easily Qt-based graphical user interfaces.
"""
from... | [
"qtpy.QtWidgets.QWidget.__init__",
"guidata.configtools.get_family",
"qtpy.QtGui.QPainter",
"qtpy.QtWidgets.QLabel.__init__",
"qtpy.QtWidgets.QLabel.sizeHint",
"qtpy.QtGui.QPen",
"math.cos",
"qtpy.QtCore.QSize",
"math.sin",
"qtpy.QtWidgets.QDockWidget"
] | [((1100, 1135), 'qtpy.QtWidgets.QLabel.__init__', 'QLabel.__init__', (['self', 'text', 'parent'], {}), '(self, text, parent)\n', (1115, 1135), False, 'from qtpy.QtWidgets import QLabel, QWidget, QDockWidget\n'), ((1472, 1486), 'qtpy.QtGui.QPainter', 'QPainter', (['self'], {}), '(self)\n', (1480, 1486), False, 'from qtp... |
#coding:utf-8
#
# id: functional.gtcs.conversion_error_from_string
# title: GTCS/tests/CF_ISQL_31. Script issues conversion error from string ""
# decription:
# ::: NB :::
# ### Name of original test has no any relation with actual task of this test: ###
# ... | [
"pytest.mark.version",
"firebird.qa.db_factory",
"firebird.qa.isql_act"
] | [((1086, 1131), 'firebird.qa.db_factory', 'db_factory', ([], {'sql_dialect': '(3)', 'init': 'init_script_1'}), '(sql_dialect=3, init=init_script_1)\n', (1096, 1131), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((8169, 8231), 'firebird.qa.isql_act', 'isql_act', (['"""db_1"""', 'test_script_1'], {'s... |
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
_colors = ('blue', 'yellow', 'cyan')
def _maximize():
mng = plt.get_current_fig_manager()
backend = matplotlib.get_backend()
if backend == 'TkAgg':
mng.window.state('zoomed')
elif backend == 'wxAgg':
... | [
"matplotlib.patches.Rectangle",
"matplotlib.get_backend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.get_current_fig_manager",
"matplotlib.pyplot.show"
] | [((153, 182), 'matplotlib.pyplot.get_current_fig_manager', 'plt.get_current_fig_manager', ([], {}), '()\n', (180, 182), True, 'import matplotlib.pyplot as plt\n'), ((197, 221), 'matplotlib.get_backend', 'matplotlib.get_backend', ([], {}), '()\n', (219, 221), False, 'import matplotlib\n'), ((470, 482), 'matplotlib.pyplo... |
"""ocr cache
Revision ID: 8d8c050d3eca
Revises: 9<PASSWORD>
Create Date: 2016-05-12 18:52:33.968021
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8d8c050d3eca'
down_revision = '9c92c<PASSWORD>'
def upgrade():
op.create_table('cache',
sa.Column('id',... | [
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Unicode",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.BigInteger"
] | [((613, 635), 'alembic.op.drop_table', 'op.drop_table', (['"""cache"""'], {}), "('cache')\n", (626, 635), False, 'from alembic import op\n'), ((522, 551), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (545, 551), True, 'import sqlalchemy as sa\n'), ((557, 583), 'sqlalchem... |
# Copyright 2018 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... | [
"os.path.dirname"
] | [((980, 1005), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (995, 1005), False, 'import os\n')] |
from setuptools import setup, find_packages
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='zen_of_python',
# other arguments... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((135, 157), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'from os import path\n'), ((169, 207), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (178, 207), False, 'from os import path\n'), ((504, 519), 'setuptool... |
# -*- coding: utf-8 -*-
"""
============================
sigutils
============================
"""
import numpy as np
from scipy import signal
from sigutils.plot import (bode, bodes, bode_sys, bode_syss,
bode_z, bode_firs, bode_zz,
bode_an_dig, nyquist,
... | [
"scipy.signal.get_window"
] | [((1376, 1409), 'scipy.signal.get_window', 'signal.get_window', (['window', 'x.size'], {}), '(window, x.size)\n', (1393, 1409), False, 'from scipy import signal\n')] |
import requests
import arrow
def fetch():
url = """https://extry.herokuapp.com/fna/meetings"""
response = requests.request("GET", url)
data = response.json()
return data
| [
"requests.request"
] | [((113, 141), 'requests.request', 'requests.request', (['"""GET"""', 'url'], {}), "('GET', url)\n", (129, 141), False, 'import requests\n')] |
import base64, os, pickle
STORE_LOCATION = './routes.db'
g_routeStore = None
class RouteStore:
def __init__( self , storeLocation=STORE_LOCATION ):
self.fileLocation = storeLocation
self.LoadRouteStore()
def _UpdateRouteStore( self ):
pickle.dump( self.routes, open( self.fileLocation... | [
"pickle.load"
] | [((465, 482), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (476, 482), False, 'import base64, os, pickle\n')] |
"""BoSy"""
import logging
from ...globals import IMAGE_BASE_NAME
from ...ltl import LTLSpec
from ...ltl.ltl_syn.ltl_syn_status import LTLSynStatus
from ..containerized_grpc_service import ContainerizedGRPCService
from ..protos import ltl_pb2
from . import bosy_pb2, bosy_pb2_grpc
logging.basicConfig(level=logging.INF... | [
"logging.basicConfig",
"logging.getLogger"
] | [((283, 322), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (302, 322), False, 'import logging\n'), ((332, 359), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (349, 359), False, 'import logging\n')] |
import os.path
import os
import subprocess
initial_dir = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
repl_dir = os.path.join(script_dir, "docker-repls")
for filename in os.listdir(repl_dir):
a_repl = os.path.join(repl_dir,filename)
if os.path.isdir(a_repl):
os.chdir(a_repl)
subproc... | [
"os.listdir",
"os.path.join",
"os.getcwd",
"os.path.realpath",
"os.chdir",
"os.path.isdir",
"subprocess.call"
] | [((58, 69), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (67, 69), False, 'import os\n'), ((138, 178), 'os.path.join', 'os.path.join', (['script_dir', '"""docker-repls"""'], {}), "(script_dir, 'docker-repls')\n", (150, 178), False, 'import os\n'), ((195, 215), 'os.listdir', 'os.listdir', (['repl_dir'], {}), '(repl_dir)\... |
# Generated by Django 2.0.4 on 2018-04-30 00:33
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | [
"django.db.models.OneToOneField",
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django... | [((9529, 9637), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""members.PaymentStrategy"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n to='members.PaymentStrategy')\n", (9546, 9637), False, 'from django.db i... |
#!/usr/bin/env python3
import unittest
import learn2learn as l2l
TOO_BIG_TO_TEST = [
'tiered-imagenet',
]
class UtilTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_tasksets(self):
names = l2l.vision.benchmarks.list_tasksets()
for n... | [
"unittest.main",
"learn2learn.vision.benchmarks.list_tasksets",
"learn2learn.vision.benchmarks.get_tasksets"
] | [((992, 1007), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1005, 1007), False, 'import unittest\n'), ((269, 306), 'learn2learn.vision.benchmarks.list_tasksets', 'l2l.vision.benchmarks.list_tasksets', ([], {}), '()\n', (304, 306), True, 'import learn2learn as l2l\n'), ((422, 477), 'learn2learn.vision.benchmarks... |
#!/usr/bin/env python
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
#
# This python script creates a version string in a C++ file.
import hashlib
import... | [
"utils.GetSemanticSDKVersion",
"sys.exit",
"hashlib.md5",
"utils.GetChannel",
"utils.GetGitTimestamp",
"sys.stderr.flush",
"utils.GetAbiVersion",
"os.path.join",
"optparse.OptionParser",
"sys.stderr.write",
"utils.ReadVersionFile",
"utils.GetShortGitHash",
"utils.GetOldestSupportedAbiVersion... | [((456, 474), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (472, 474), False, 'import sys\n'), ((1089, 1107), 'utils.GetChannel', 'utils.GetChannel', ([], {}), '()\n', (1105, 1107), False, 'import utils\n'), ((2437, 2450), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (2448, 2450), False, 'import hashlib... |
import numpy, pandas as pd
import matplotlib, matplotlib.pyplot as plt
import sklearn.linear_model as lm
sap = pd.read_csv("sapXXI.csv").set_index("Date")
sap.index = pd.to_datetime(sap.index)
sap_linear = sap.ix[sap.index > pd.to_datetime('2009-01-01')]
olm = lm.LinearRegression()
x = numpy.array([x.toordinal() for x... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.style.use",
"matplotlib.pyplot.title",
"sklearn.linear_model.LinearRegression",
"pandas.to_datetime"
] | [((168, 193), 'pandas.to_datetime', 'pd.to_datetime', (['sap.index'], {}), '(sap.index)\n', (182, 193), True, 'import numpy, pandas as pd\n'), ((262, 283), 'sklearn.linear_model.LinearRegression', 'lm.LinearRegression', ([], {}), '()\n', (281, 283), True, 'import sklearn.linear_model as lm\n'), ((493, 523), 'matplotlib... |
import torch
import torch.nn as nn
import LinearHebbianLayer as Hebbian
import torchvision
class Flatten(nn.Module):
def forward(self, input):
return input.view(input.size(0), -1)
class Model(torch.nn.Module):
def __init__(self, input_features, output_features):
super(Model, self).__init__()
... | [
"LinearHebbianLayer.HebbianLinearLayer",
"torch.nn.ReLU",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"torch.zeros",
"torch.argmax"
] | [((403, 456), 'LinearHebbianLayer.HebbianLinearLayer', 'Hebbian.HebbianLinearLayer', (['input_features', '(256)', '(True)'], {}), '(input_features, 256, True)\n', (429, 456), True, 'import LinearHebbianLayer as Hebbian\n'), ((495, 504), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (502, 504), True, 'import torch.nn as... |
#!/usr/bin/env python3
import os
import argparse
import logging
import json
import random
import re
import torch
import spacy, en_core_web_sm
import csv
from utils.json_encoder import CompactJSONEncoder
from utils.utils import Label
from utils.tokenizer import Tokenizer as Detokenizer
from utils.tokenizer import norm... | [
"logging.getLogger",
"num2words.num2words",
"en_core_web_sm.load",
"text_to_num.alpha2digit",
"transformers.AutoTokenizer.from_pretrained",
"re.search",
"argparse.ArgumentParser",
"json.dumps",
"nltk.sent_tokenize",
"re.finditer",
"utils.utils.random_choice_neq",
"utils.sentence_scorer.Sentenc... | [((682, 797), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO', 'datefmt': '"""%H:%M:%S"""'}), "(format='%(asctime)s - %(levelname)s - %(message)s',\n level=logging.INFO, datefmt='%H:%M:%S')\n", (701, 797), False, 'import logging... |
#
# Copyright (c) 2017-2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import collections
import copy
import six
from netaddr import IPAddress
from netaddr import IPNetwork
from oslo_log import log
from sysinv._i18n import _
from sysinv.common import constants
from sysinv.common import except... | [
"sysinv.common.interface._get_address_interface_name_index",
"sysinv.common.interface.get_sriov_interface_vf_addrs",
"copy.copy",
"sysinv.common.interface._get_interface_name_index",
"oslo_log.log.getLogger",
"sysinv._i18n._",
"netaddr.IPAddress",
"sysinv.common.interface.get_lower_interface",
"sysi... | [((507, 530), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (520, 530), False, 'from oslo_log import log\n'), ((17140, 17188), 'sysinv.common.interface.get_interface_datanets', 'interface.get_interface_datanets', (['context', 'iface'], {}), '(context, iface)\n', (17172, 17188), False, '... |
"""run this to initialize the game database"""
import os
import sqlite3
from sqlite3 import Error
def create_table(conn,create_table_sql):
try:
c = conn.cursor()
c.execute(create_table_sql)
except Error as e:
print(e)
def create_connection(db_file):
""" create a database connecti... | [
"os.path.isfile",
"sqlite3.connect"
] | [((852, 873), 'os.path.isfile', 'os.path.isfile', (['fname'], {}), '(fname)\n', (866, 873), False, 'import os\n'), ((372, 396), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (387, 396), False, 'import sqlite3\n')] |
#! /usr/bin/env python
#<NAME>
#<EMAIL>
import sys
import os
import argparse
import numpy as np
from osgeo import gdal
from pygeotools.lib import iolib
#Can use ASP image_calc for multithreaded ndv replacement of huge images
#image_calc -o ${1%.*}_ndv.tif -c 'var_0' --output-nodata-value $2 $1
def getparser():
... | [
"osgeo.gdal.Open",
"pygeotools.lib.iolib.ds_getma",
"argparse.ArgumentParser",
"numpy.ma.fix_invalid",
"pygeotools.lib.iolib.get_ndv_b",
"os.path.splitext"
] | [((331, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Replace raster NoData value"""'}), "(description='Replace raster NoData value')\n", (354, 397), False, 'import argparse\n'), ((1175, 1192), 'osgeo.gdal.Open', 'gdal.Open', (['src_fn'], {}), '(src_fn)\n', (1184, 1192), False, 'f... |
from __future__ import unicode_literals
from re_scan import Scanner
scanner = Scanner([
('bold', r'\*\*'),
('link_special', r'\[\[(?P<target>.*?)\|(?P<text>.*?)\]\]'),
('link', r'\[\[(.*?)\]\]'),
('underline', r'_'),
])
input_text = 'Hello **World**! [[Stuff|extra]] _[[Stuff]]_.'
... | [
"re_scan.Scanner"
] | [((81, 234), 're_scan.Scanner', 'Scanner', (["[('bold', '\\\\*\\\\*'), ('link_special',\n '\\\\[\\\\[(?P<target>.*?)\\\\|(?P<text>.*?)\\\\]\\\\]'), ('link',\n '\\\\[\\\\[(.*?)\\\\]\\\\]'), ('underline', '_')]"], {}), "([('bold', '\\\\*\\\\*'), ('link_special',\n '\\\\[\\\\[(?P<target>.*?)\\\\|(?P<text>.*?)\\\\... |
#Most commong libraries used in tfx
#Make sure you have the latest requirements.txt file installed firs before proceeding
#Common used Libraries
import os
import urllib.request
import tempfile
import shutil
from absl import logging
logging.set_verbosity(logging.INFO) # Set default logging level.
#Tensorflow related li... | [
"tfx.v1.proto.EvalArgs",
"tensorflow_model_analysis.GenericChangeThreshold",
"tfx.v1.components.CsvExampleGen",
"tensorflow_model_analysis.ModelSpec",
"os.path.join",
"tfx.v1.orchestration.metadata.sqlite_metadata_connection_config",
"tensorflow_model_analysis.SlicingSpec",
"tfx.v1.dsl.Channel",
"tf... | [((232, 267), 'absl.logging.set_verbosity', 'logging.set_verbosity', (['logging.INFO'], {}), '(logging.INFO)\n', (253, 267), False, 'from absl import logging\n'), ((1350, 1390), 'os.path.join', 'os.path.join', (['"""pipelines"""', 'PIPELINE_NAME'], {}), "('pipelines', PIPELINE_NAME)\n", (1362, 1390), False, 'import os\... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 1 13:38:59 2019
@author: ryancompton
"""
import os
import pandas as pd
import numpy as np
print("CONVERTING ACCOUNTS TO AMLSIM FORMATTED ACCOUNTS")
file_path = os.path.join("output_datasets")
files = [os.path.join(file_path,x) for x in os.list... | [
"os.listdir",
"pandas.read_csv",
"numpy.random.choice",
"os.path.join",
"numpy.random.randint"
] | [((236, 267), 'os.path.join', 'os.path.join', (['"""output_datasets"""'], {}), "('output_datasets')\n", (248, 267), False, 'import os\n'), ((416, 447), 'pandas.read_csv', 'pd.read_csv', (['latest_account_csv'], {}), '(latest_account_csv)\n', (427, 447), True, 'import pandas as pd\n'), ((792, 823), 'pandas.read_csv', 'p... |
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, **kwargs):
super(Model, self).__init__()
self.image_size = kwargs['IMAGE_SIZE']
self.patch_keys = kwargs['PATCH_KEYS']
self.target_keys = kwargs['TARGET_KEYS']
self.layer1 = nn.Sequential(nn.Co... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.cat"
] | [((1966, 1984), 'torch.nn.Linear', 'nn.Linear', (['(1024)', '(8)'], {}), '(1024, 8)\n', (1975, 1984), True, 'import torch.nn as nn\n'), ((2746, 2773), 'torch.cat', 'torch.cat', (['[p1, p2]'], {'axis': '(1)'}), '([p1, p2], axis=1)\n', (2755, 2773), False, 'import torch\n'), ((315, 345), 'torch.nn.Conv2d', 'nn.Conv2d', (... |
import logging
import subprocess
import wireless_emulator.emulator
logger = logging.getLogger(__name__)
class Link:
linkNumber = 1
def __init__(self, linkEnds):
self.linkEnds = linkEnds
self.emEnv = wireless_emulator.emulator.Emulator()
self.bridgeName = None
self.linkId = No... | [
"logging.getLogger",
"subprocess.Popen"
] | [((78, 105), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (95, 105), False, 'import logging\n'), ((2917, 3009), 'subprocess.Popen', 'subprocess.Popen', (['stringCmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(stringCmd, shell=True, stdout=subproc... |
import pandas as pd
import toolz
import ibis.common.exceptions as com
import ibis.config
import ibis.expr.schema as sch
import ibis.expr.types as ir
from ibis.backends.base import BaseBackend
from .client import PandasDatabase, PandasTable, ibis_schema_to_pandas
class BasePandasBackend(BaseBackend):
"""
Bas... | [
"pandas.DataFrame",
"ibis.expr.schema.infer",
"ibis.common.exceptions.IbisError"
] | [((2225, 2253), 'ibis.expr.schema.infer', 'sch.infer', (['df'], {'schema': 'schema'}), '(df, schema=schema)\n', (2234, 2253), True, 'import ibis.expr.schema as sch\n'), ((2639, 2677), 'ibis.expr.schema.infer', 'sch.infer', (['self.dictionary[table_name]'], {}), '(self.dictionary[table_name])\n', (2648, 2677), True, 'im... |
from web3 import Web3
import contracts.slp_doe_staking_contract as slp_doe_staking_contract
import contracts.slp_eth_doe_contract as slp_eth_doe_contract
import contracts.doe_doe_staking_contract as doe_doe_staking_contract
import contracts.doe_nft_staking_contract as doe_nft_staking_contract
import contracts.nft_contr... | [
"lib.nft_data.get_estimated_price",
"json.dumps",
"lib.nft_data.get_collection_stats",
"web3.Web3.HTTPProvider"
] | [((730, 761), 'lib.nft_data.get_collection_stats', 'nft_data.get_collection_stats', ([], {}), '()\n', (759, 761), True, 'import lib.nft_data as nft_data\n'), ((774, 825), 'lib.nft_data.get_estimated_price', 'nft_data.get_estimated_price', (['(891)', 'collection_stats'], {}), '(891, collection_stats)\n', (802, 825), Tru... |
"""Should export."""
import os
import tensorflow as tf
import keras.backend as K
import sys
from keras.models import load_model, Model, Sequential
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import tag_constants
from tensorflow.python.saved_model.signatur... | [
"os.path.exists",
"os.listdir",
"keras.models.load_model",
"keras.models.Model.from_config",
"os.makedirs",
"tensorflow.Session",
"keras.models.Sequential.from_config",
"keras.backend.set_session",
"tensorflow.python.saved_model.builder.SavedModelBuilder",
"keras.backend.get_session",
"tensorflo... | [((743, 755), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (753, 755), True, 'import tensorflow as tf\n'), ((760, 779), 'keras.backend.set_session', 'K.set_session', (['sess'], {}), '(sess)\n', (773, 779), True, 'import keras.backend as K\n'), ((807, 830), 'keras.backend.set_learning_phase', 'K.set_learning_ph... |
import time
import torch
def train_model_face(model, criterion, optimizer, dataloader, dataset_size, device, num_epochs=25):
since = time.time()
for epoch in range(num_epochs):
print('Epoch {}/{}'.format(epoch, num_epochs - 1))
print('-' * 10)
model.train() # Set model to training ... | [
"torch.sum",
"torch.max",
"time.time",
"torch.set_grad_enabled"
] | [((140, 151), 'time.time', 'time.time', ([], {}), '()\n', (149, 151), False, 'import time\n'), ((1337, 1348), 'time.time', 'time.time', ([], {}), '()\n', (1346, 1348), False, 'import time\n'), ((1044, 1075), 'torch.sum', 'torch.sum', (['(preds == labels.data)'], {}), '(preds == labels.data)\n', (1053, 1075), False, 'im... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 12 19:07:50 2016
@author: ngordon
"""
#==============================================================================
# 3d animation 0 stackoverflow
#==============================================================================
import numpy as np
from mpl_t... | [
"numpy.sin",
"matplotlib.pyplot.figure",
"numpy.cos",
"matplotlib.pyplot.show"
] | [((855, 867), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (865, 867), True, 'import matplotlib.pyplot as plt\n'), ((995, 1005), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1003, 1005), True, 'import matplotlib.pyplot as plt\n'), ((526, 539), 'numpy.cos', 'np.cos', (['angle'], {}), '(angle)\... |
from django.conf import settings
from django.shortcuts import render
from .models import Tweet
from .serializers import TweetSerializer
from rest_framework.views import APIView
from rest_framework import generics, permissions, serializers
from rest_framework.parsers import JSONParser, MultiPartParser, FormParser
from r... | [
"rest_framework.response.Response",
"rest_framework.authtoken.models.Token.objects.get_or_create"
] | [((1358, 1396), 'rest_framework.authtoken.models.Token.objects.get_or_create', 'Token.objects.get_or_create', ([], {'user': 'user'}), '(user=user)\n', (1385, 1396), False, 'from rest_framework.authtoken.models import Token\n'), ((1412, 1489), 'rest_framework.response.Response', 'Response', (["{'token': token.key, 'user... |
import numpy as np
from numpy import abs, cos, exp, mean, pi, prod, sin, sqrt, sum
from autotune import TuningProblem
from autotune.space import *
# problem space
task_space = None
input_space = Space([
Real(-15, 15, name=f'x_{i}') for i in range(10)
])
output_space = Space([
Real(-inf, inf, name='y')
])
de... | [
"numpy.sqrt",
"autotune.TuningProblem",
"numpy.exp",
"numpy.sum",
"numpy.cos",
"numpy.asarray_chkfinite"
] | [((721, 855), 'autotune.TuningProblem', 'TuningProblem', ([], {'task_space': 'None', 'input_space': 'input_space', 'output_space': 'output_space', 'objective': 'myobj', 'constraints': 'None', 'model': 'None'}), '(task_space=None, input_space=input_space, output_space=\n output_space, objective=myobj, constraints=Non... |
#!/usr/bin/env python
""" python """
#
# Copyright (c) <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice,... | [
"logging.getLogger",
"os.path.exists",
"logging.basicConfig",
"re.split",
"re.compile",
"distutils.version.StrictVersion"
] | [((2646, 2673), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2663, 2673), False, 'import logging\n'), ((2674, 2695), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (2693, 2695), False, 'import logging\n'), ((2793, 2816), 're.compile', 're.compile', (['"""\\\\s+=\\\\s+"... |
from chuckle_bot.ally_message import AllyMessage
from chuckle_bot.interpreter import Interpreter
def dummy_encounter_context():
class DummyEncounterContext:
def __init__(self):
self.participants = ['char_a', 'char_b']
return DummyEncounterContext()
def dummy_interpreter():
return Int... | [
"chuckle_bot.interpreter.Interpreter._get_lwords",
"chuckle_bot.interpreter.Interpreter._create_placeholders",
"chuckle_bot.ally_message.AllyMessage",
"chuckle_bot.interpreter.Interpreter._simplify"
] | [((546, 574), 'chuckle_bot.interpreter.Interpreter._get_lwords', 'Interpreter._get_lwords', (['msg'], {}), '(msg)\n', (569, 574), False, 'from chuckle_bot.interpreter import Interpreter\n'), ((736, 764), 'chuckle_bot.interpreter.Interpreter._get_lwords', 'Interpreter._get_lwords', (['msg'], {}), '(msg)\n', (759, 764), ... |
import requests
import os
import sys
def remove_nonpicture_files(arr, file, extensions):
for extension in extensions:
if file.endswith("." + extension):
return
arr.remove(file)
return
print("Running " + sys.argv[0] + " with " + str(len(sys.argv)) + " args...")
if not(len(sys.argv) == 4... | [
"os.listdir",
"sys.exit"
] | [((636, 647), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (644, 647), False, 'import sys\n'), ((1095, 1109), 'os.listdir', 'os.listdir', (['F1'], {}), '(F1)\n', (1105, 1109), False, 'import os\n'), ((1126, 1140), 'os.listdir', 'os.listdir', (['F2'], {}), '(F2)\n', (1136, 1140), False, 'import os\n')] |
from pylaut.language.phonology import word, phonology
import random
import pathlib
class Lexicon(object):
def __init__(self):
self.language = None
self.date = None
self.phonology = None
self.word_factory = None
self.entries = list()
@classmethod
def load(cls, fil... | [
"random.choice",
"pylaut.language.phonology.word.WordFactory",
"pathlib.Path"
] | [((349, 380), 'pathlib.Path', 'pathlib.Path', (['file_path_or_name'], {}), '(file_path_or_name)\n', (361, 380), False, 'import pathlib\n'), ((795, 826), 'pathlib.Path', 'pathlib.Path', (['file_name_or_path'], {}), '(file_name_or_path)\n', (807, 826), False, 'import pathlib\n'), ((1074, 1101), 'random.choice', 'random.c... |
import numpy as np
import pandas as pd
MAXEPOCH = 1000
file = open("Train.txt")
lines = file.readlines()
numClass, numFeature, datasetLen = 0, 0, 0
dataset = []
count = 0
for line in lines:
if count == 0:
var = line.split()
numFeature = int(var[0])
numClass = int(var[1])
datas... | [
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.random.seed",
"numpy.random.uniform"
] | [((625, 643), 'numpy.random.seed', 'np.random.seed', (['(41)'], {}), '(41)\n', (639, 643), True, 'import numpy as np\n'), ((648, 690), 'numpy.random.uniform', 'np.random.uniform', (['(-10)', '(10)', '(numFeature + 1)'], {}), '(-10, 10, numFeature + 1)\n', (665, 690), True, 'import numpy as np\n'), ((961, 975), 'numpy.a... |
from __future__ import unicode_literals
from django import template
from django.templatetags.static import static
from django.utils.html import format_html, mark_safe, conditional_escape
from .. import Icon
from ..app_settings import get_css
css = get_css()
register = template.Library()
@register.simple_tag
def f... | [
"django.utils.html.conditional_escape",
"django.utils.html.format_html",
"django.templatetags.static.static",
"django.template.Library"
] | [((273, 291), 'django.template.Library', 'template.Library', ([], {}), '()\n', (289, 291), False, 'from django import template\n'), ((516, 588), 'django.utils.html.format_html', 'format_html', (['"""<link href="{}" rel="stylesheet" media="all">"""', 'stylesheet'], {}), '(\'<link href="{}" rel="stylesheet" media="all">\... |
import json
import aiohttp
from aiohttp import TCPConnector
from aiohttp.errors import ClientConnectionError
from plumeria.util.network import NameResolver
class SelectiveConnector(TCPConnector):
def __init__(self, *args, port_validator=None, **kwargs):
super().__init__(*args, **kwargs)
self.por... | [
"plumeria.util.network.NameResolver",
"json.loads",
"json.dumps"
] | [((1438, 1460), 'json.loads', 'json.loads', (['self._text'], {}), '(self._text)\n', (1448, 1460), False, 'import json\n'), ((1656, 1682), 'json.dumps', 'json.dumps', (["kwargs['data']"], {}), "(kwargs['data'])\n", (1666, 1682), False, 'import json\n'), ((891, 905), 'plumeria.util.network.NameResolver', 'NameResolver', ... |
from setuptools import setup, find_packages
setup(
name='rlsuite',
version='0.0.1',
description='A suite of basic reinforcement learning algorithms and environments.',
url='http://github.com/christopher-wolff/rlsuite',
author='<NAME>',
license='MIT',
packages=find_packages()
)
| [
"setuptools.find_packages"
] | [((289, 304), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (302, 304), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ifcfg
from ifcfg.parser import NullParser
from nose.tools import eq_, ok_, raises
from . import ifconfig_out
from .base import IfcfgTestCase
class IfcfgTestCase(IfcfgTestCase):
def test_ifcfg(self):
ifcfg.distro = 'Linux'
if... | [
"nose.tools.eq_",
"ifcfg.default_interface",
"ifcfg.get_parser_class",
"ifcfg.interfaces",
"nose.tools.raises",
"nose.tools.ok_",
"ifcfg.get_parser"
] | [((652, 672), 'nose.tools.raises', 'raises', (['RuntimeError'], {}), '(RuntimeError)\n', (658, 672), False, 'from nose.tools import eq_, ok_, raises\n'), ((333, 357), 'ifcfg.get_parser_class', 'ifcfg.get_parser_class', ([], {}), '()\n', (355, 357), False, 'import ifcfg\n'), ((379, 424), 'ifcfg.interfaces', 'ifcfg.inter... |
from PIL import Image
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
from examples.classification.cat_dog_net import CatDogNet
from pytorch_toolbox.transformations.image import Resize, Normalize, NumpyImage2Tensor
from pytorch_toolbox.transformations.to_float import ToFloat
from ... | [
"examples.classification.cat_dog_net.CatDogNet",
"PIL.Image.open",
"pytorch_toolbox.transformations.image.Normalize",
"pytorch_toolbox.transformations.to_float.ToFloat",
"pytorch_toolbox.transformations.image.Resize",
"pytorch_toolbox.probe.activation.show_activations",
"pytorch_toolbox.transformations.... | [((613, 624), 'examples.classification.cat_dog_net.CatDogNet', 'CatDogNet', ([], {}), '()\n', (622, 624), False, 'from examples.classification.cat_dog_net import CatDogNet\n'), ((1425, 1435), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1433, 1435), True, 'import matplotlib.pyplot as plt\n'), ((1386, 1420),... |
from setuptools import find_packages, setup
install_requires = [
"pandas",
"numpy",
"networkx",
"matplotlib",
"seaborn",
"tqdm",
]
#setup_requires = ['pytest-runner']
#tests_require = [
# 'pytest',
# 'pytest-cov',
# 'codecov'
#]
keywords = [
"bitcoin",
"lightning-network",
... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((485, 507), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (497, 507), False, 'from os import path\n'), ((519, 557), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (528, 557), False, 'from os import path\n'), ((870, 885), 'setuptool... |
import os
import sys
tenant_check = int(sys.argv[1])
domain_name = sys.argv[2]
each = int(sys.argv[3])
#subnet = sys.argv[4]
# subnet_dict = sys.argv[5]
os.system("docker run --name " +str(domain_name) +" --cap-add=NET_ADMIN -itd main-vm")
print( "docker run --name " +str(domain_name) +" --cap-add=NET_ADMIN -itd main... | [
"os.system"
] | [((394, 468), 'os.system', 'os.system', (["('sudo docker exec -it ' + domain_name + ' ip route del default')"], {}), "('sudo docker exec -it ' + domain_name + ' ip route del default')\n", (403, 468), False, 'import os\n')] |
from ..models import Post,Category,Tag
from django import template
from django.db.models.aggregates import Count
register = template.Library()
#实例化一个template.Library类,将get_recent_posts装饰为register.simple_tag
@register.simple_tag
def get_recent_posts(num=5):
return Post.objects.all().order_by('-created_time')[:nu... | [
"django.db.models.aggregates.Count",
"django.template.Library"
] | [((126, 144), 'django.template.Library', 'template.Library', ([], {}), '()\n', (142, 144), False, 'from django import template\n'), ((634, 647), 'django.db.models.aggregates.Count', 'Count', (['"""post"""'], {}), "('post')\n", (639, 647), False, 'from django.db.models.aggregates import Count\n'), ((552, 565), 'django.d... |
from django import forms
class announces(forms.Form):
textarea = forms.CharField(label='Textarea',max_length=300)
material = forms.CharField(label='Material',max_length=100)
class uploads(forms.Form):
title = forms.CharField(label='Assignment Title',max_length=100)
description = forms.CharField(labe... | [
"django.forms.IntegerField",
"django.forms.CharField"
] | [((72, 121), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Textarea"""', 'max_length': '(300)'}), "(label='Textarea', max_length=300)\n", (87, 121), False, 'from django import forms\n'), ((136, 185), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Material"""', 'max_length': '(100)'}),... |
from gamelib import event
B_RIGHT = 72 #to 4e4
def go_to(lev):
event.go_to_level("Level_4"+lev, True, True, True)
def go_4():
event.move_player(-44, 24)
go_to("e4")
def kill():
event.clear_ai_messages()
for i in range(300):
try:
o = event.get_object(i)
if hasat... | [
"gamelib.event.get_object",
"gamelib.event.get_flag",
"gamelib.event.go_to_level",
"gamelib.event.clear_ai_messages",
"gamelib.event.register_collision_func",
"gamelib.event.move_player",
"gamelib.event.set_flag"
] | [((72, 124), 'gamelib.event.go_to_level', 'event.go_to_level', (["('Level_4' + lev)", '(True)', '(True)', '(True)'], {}), "('Level_4' + lev, True, True, True)\n", (89, 124), False, 'from gamelib import event\n'), ((140, 166), 'gamelib.event.move_player', 'event.move_player', (['(-44)', '(24)'], {}), '(-44, 24)\n', (157... |
#!/usr/bin/python3
import os
from datetime import datetime
import logging
# absolute paths
DIR_UTIL = os.path.dirname(os.path.realpath(__file__))
DIR_TESTING = os.path.dirname(DIR_UTIL)
DIR_SCRIPT = os.path.dirname(DIR_TESTING)
DIR_REPO = os.path.dirname(DIR_SCRIPT)
DIR_TMP = "/tmp"
# default settings of the TestServ... | [
"logging.getLogger",
"logging.StreamHandler",
"datetime.datetime.utcnow",
"logging.Formatter",
"os.path.join",
"os.path.realpath",
"os.path.dirname"
] | [((161, 186), 'os.path.dirname', 'os.path.dirname', (['DIR_UTIL'], {}), '(DIR_UTIL)\n', (176, 186), False, 'import os\n'), ((200, 228), 'os.path.dirname', 'os.path.dirname', (['DIR_TESTING'], {}), '(DIR_TESTING)\n', (215, 228), False, 'import os\n'), ((240, 267), 'os.path.dirname', 'os.path.dirname', (['DIR_SCRIPT'], {... |
import numpy as np
from .binarygrid_util import MfGrdFile
def get_structured_faceflows(
flowja, grb_file=None, ia=None, ja=None, verbose=False
):
"""
Get the face flows for the flow right face, flow front face, and
flow lower face from the MODFLOW 6 flowja flows. This method can
be useful for bui... | [
"numpy.zeros"
] | [((3865, 3893), 'numpy.zeros', 'np.zeros', (['nodes'], {'dtype': 'float'}), '(nodes, dtype=float)\n', (3873, 3893), True, 'import numpy as np\n'), ((1796, 1824), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'float'}), '(shape, dtype=float)\n', (1804, 1824), True, 'import numpy as np\n'), ((1845, 1873), 'numpy.zeros... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("BSworkflow")
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
"/store/express/Run2015A/StreamExpress/ALCARECO/TkAlMinBias-Express-v1/000/246/959/00000/14174DF2-490A-E511-9862-02163E0143E9.root",
)
)
process.load... | [
"FWCore.ParameterSet.Config.Path",
"FWCore.ParameterSet.Config.InputTag",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.bool",
"RecoVertex.PrimaryVertexProducer.OfflinePrimaryVerti... | [((52, 77), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""BSworkflow"""'], {}), "('BSworkflow')\n", (63, 77), True, 'import FWCore.ParameterSet.Config as cms\n'), ((1570, 1600), 'RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi.offlinePrimaryVertices.clone', 'offlinePrimaryVertices.clone', ([], ... |
import io
def test_upload_pdf_for_prediction(mocker, test_client):
mocked_task = mocker.patch('service.tasks.predict_task.delay', return_value=type('obj', (object,), {'id' : '123'}))
file_name = "mock.pdf"
data = {
'pdf': (io.BytesIO(b"test pdf data"), file_name)
}
response = test_client.po... | [
"io.BytesIO"
] | [((244, 272), 'io.BytesIO', 'io.BytesIO', (["b'test pdf data'"], {}), "(b'test pdf data')\n", (254, 272), False, 'import io\n')] |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"text2sql.launch.infer.inference",
"traceback.format_exc",
"text2sql.utils.Timer",
"pathlib.Path",
"os.path.join",
"text2sql.io.save",
"traceback.print_exc",
"logging.info"
] | [((1307, 1320), 'text2sql.utils.Timer', 'utils.Timer', ([], {}), '()\n', (1318, 1320), False, 'from text2sql import utils\n'), ((2940, 2953), 'text2sql.utils.Timer', 'utils.Timer', ([], {}), '()\n', (2951, 2953), False, 'from text2sql import utils\n'), ((2532, 2568), 'text2sql.launch.infer.inference', 'infer.inference'... |
from django_tables2 import RequestConfig
from django.shortcuts import render, redirect
from django.forms import modelformset_factory, inlineformset_factory
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.contrib.auth.decorators import login_required
from .tables import PaymentTable
from .... | [
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.forms.modelformset_factory",
"django.db.models.F",
"django_tables2.RequestConfig",
"django.template.Library"
] | [((706, 724), 'django.template.Library', 'template.Library', ([], {}), '()\n', (722, 724), False, 'from django import template\n'), ((3930, 3970), 'django.shortcuts.render', 'render', (['request', '"""payment.html"""', 'context'], {}), "(request, 'payment.html', context)\n", (3936, 3970), False, 'from django.shortcuts ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 <NAME> <<EMAIL>>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, thi... | [
"re.sub",
"luxon.utils.text.blank_to_none",
"urllib.parse.urlunparse",
"urllib.parse.urlparse"
] | [((3257, 3281), 'urllib.parse.urlunparse', 'parse.urlunparse', (['parsed'], {}), '(parsed)\n', (3273, 3281), False, 'from urllib import parse\n'), ((3612, 3631), 'urllib.parse.urlparse', 'parse.urlparse', (['uri'], {}), '(uri)\n', (3626, 3631), False, 'from urllib import parse\n'), ((3105, 3124), 'urllib.parse.urlparse... |
#!/usr/bin/python3
''' Summary: Script to process images and update the database '''
import datetime
import os
import sqlite3
from pathlib import Path
from sqlite3 import Error
import cv2
import numpy as np
from numpy import array
from shapely.geometry import Polygon, asPoint
import mrcnn.config
from mrcnn.model impo... | [
"os.path.exists",
"sqlite3.connect",
"pathlib.Path",
"numpy.delete",
"os.path.join",
"os.path.dirname",
"numpy.array",
"datetime.datetime.now",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"shapely.geometry.Polygon"
] | [((1720, 1750), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"""'], {}), "(ROOT_DIR, 'logs')\n", (1732, 1750), False, 'import os\n'), ((1807, 1850), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mask_rcnn_coco.h5"""'], {}), "(ROOT_DIR, 'mask_rcnn_coco.h5')\n", (1819, 1850), False, 'import os\n'), ((356, 38... |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import numpy as np
from scipy.stats import gamma
from statsmodels.nonparametric import bandwidths
__all__ = ['get_kernel_width', 'get_gram_matrix', 'hsic_teststat', 'hsic_test_gamma']
def get_... | [
"numpy.tile",
"numpy.eye",
"numpy.median",
"scipy.stats.gamma.cdf",
"numpy.ones",
"statsmodels.nonparametric.bandwidths.bw_silverman",
"numpy.diag",
"numpy.exp",
"numpy.sum",
"numpy.dot",
"numpy.tril",
"statsmodels.nonparametric.bandwidths.bw_scott"
] | [((995, 1021), 'numpy.tile', 'np.tile', (['G', '(1, n_samples)'], {}), '(G, (1, n_samples))\n', (1002, 1021), True, 'import numpy as np\n'), ((1030, 1058), 'numpy.tile', 'np.tile', (['G.T', '(n_samples, 1)'], {}), '(G.T, (n_samples, 1))\n', (1037, 1058), True, 'import numpy as np\n'), ((1499, 1527), 'numpy.tile', 'np.t... |
#!/usr/bin/env python3
import os
import re
import json
import typing
import argparse
# region Global sets
# A set of category folder names in current sample viewer.
categories = {
'Maps',
'Layers',
'Features',
'Display information',
'Search',
'Edit data',
'Geometry',
'Route and direct... | [
"re.split",
"os.listdir",
"argparse.ArgumentParser",
"re.compile",
"json.dumps",
"os.path.join",
"os.path.splitext",
"os.path.normpath",
"json.load",
"re.sub",
"os.walk"
] | [((751, 789), 're.compile', 're.compile', (['"""[@_!#$%^&*<>?|/\\\\\\\\}{~:]"""'], {}), "('[@_!#$%^&*<>?|/\\\\\\\\}{~:]')\n", (761, 789), False, 'import re\n'), ((800, 825), 're.sub', 're.sub', (['regex', '""""""', 'string'], {}), "(regex, '', string)\n", (806, 825), False, 'import re\n'), ((7980, 8029), 'os.path.join'... |