code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import os
from os.path import join as pjoin
import nibabel as nib
import numpy as np
import torch
from deep_hilbert_inverse_3chan_sparse import DeepHilbertInverse, MyDataset
from spectral_blending import blend_method
from utils import HilbertPlane, NORMALIZATION
def dataset_prediction(plane: HilbertPlan... | [
"numpy.eye",
"os.listdir",
"os.path.join",
"numpy.zeros",
"json.load",
"spectral_blending.blend_method",
"deep_hilbert_inverse_3chan_sparse.MyDataset",
"torch.cat"
] | [((831, 906), 'deep_hilbert_inverse_3chan_sparse.MyDataset', 'MyDataset', ([], {'filename': 'test_files[0]', 'plane': 'plane', 'transform': 'model.trafo_valid'}), '(filename=test_files[0], plane=plane, transform=model.trafo_valid)\n', (840, 906), False, 'from deep_hilbert_inverse_3chan_sparse import DeepHilbertInverse,... |
from flask import Flask
from flask import render_template
from flask import abort
from sufee import app
@app.route("/")
@app.route("/home")
def index():
template = 'index.html'
return render_template(template)
@app.route("/about")
def aboutindex():
template = 'about.html'
return render_template(templa... | [
"flask.render_template",
"sufee.app.route"
] | [((106, 120), 'sufee.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (115, 120), False, 'from sufee import app\n'), ((122, 140), 'sufee.app.route', 'app.route', (['"""/home"""'], {}), "('/home')\n", (131, 140), False, 'from sufee import app\n'), ((221, 240), 'sufee.app.route', 'app.route', (['"""/about"""'], {})... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2014 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyrig... | [
"pickle.dumps",
"socket.socket"
] | [((1561, 1609), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (1574, 1609), False, 'import socket\n'), ((1788, 1807), 'pickle.dumps', 'pickle.dumps', (['chunk'], {}), '(chunk)\n', (1800, 1807), False, 'import pickle\n')] |
"""
Test for GitHub issue: https://github.com/RDFLib/rdflib/issues/1216
"""
import pytest
import rdflib
from octadocs.types import LOCAL
DOCUMENT = f"""
@base <{LOCAL}> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<class_to_class>
a
rdfs:Class ,
<Category> ;
<color> "blue" ;
<priority> 4 .... | [
"pytest.mark.skip",
"rdflib.ConjunctiveGraph"
] | [((328, 392), 'pytest.mark.skip', 'pytest.mark.skip', (['"""https://github.com/RDFLib/rdflib/issues/1216"""'], {}), "('https://github.com/RDFLib/rdflib/issues/1216')\n", (344, 392), False, 'import pytest\n'), ((496, 521), 'rdflib.ConjunctiveGraph', 'rdflib.ConjunctiveGraph', ([], {}), '()\n', (519, 521), False, 'import... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
)
class LnkGoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lnkgo\.(?:alfa\.)?lt/visi-video/(?P<show>[^/]+)/ziurek-(?P<id>[A-Za-z0-9-... | [
"re.search"
] | [((3220, 3321), 're.search', 're.search', (['"""^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<play_path>.+)$"""', "config['EpisodeVideoLink']"], {}), "('^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<play_path>.+)$',\n config['EpisodeVideoLink'])\n", (3229, 3321), False, 'import re\n')] |
import stp.play as play
import stp.tactic as tactic
from rj_gameplay.tactic import clear_tactic, nmark_tactic, goalie_tactic
import stp.skill as skill
import stp.role as role
from stp.role.assignment.naive import NaiveRoleAssignment
import stp.rc as rc
import numpy as np
from typing import Dict, List, Tuple
class D... | [
"stp.play.flatten_requests",
"rj_gameplay.tactic.goalie_tactic.GoalieTactic",
"stp.play.unflatten_results",
"rj_gameplay.tactic.nmark_tactic.NMarkTactic",
"numpy.array",
"stp.role.assignment.naive.NaiveRoleAssignment"
] | [((393, 421), 'rj_gameplay.tactic.goalie_tactic.GoalieTactic', 'goalie_tactic.GoalieTactic', ([], {}), '()\n', (419, 421), False, 'from rj_gameplay.tactic import clear_tactic, nmark_tactic, goalie_tactic\n'), ((446, 473), 'rj_gameplay.tactic.nmark_tactic.NMarkTactic', 'nmark_tactic.NMarkTactic', (['(2)'], {}), '(2)\n',... |
import urllib.request, traceback
import pypandoc
from django.core.cache import cache
import re, os, glob
from . import settings
def get_readme(url):
if url[-4:] == '.git':
url = url[:-4]
base_url = url.replace('github', 'raw.githubusercontent', 1).strip('/')+'/master/'
readme_url = base_url +'READ... | [
"re.search",
"traceback.format_exc",
"re.compile",
"os.path.join",
"pypandoc.convert_text",
"re.sub",
"django.core.cache.cache.set",
"django.core.cache.cache.get"
] | [((484, 547), 're.compile', 're.compile', (['"""\\\\!\\\\[(.*?)\\\\]\\\\(/?((?!http).*?)\\\\)"""', 're.MULTILINE'], {}), "('\\\\!\\\\[(.*?)\\\\]\\\\(/?((?!http).*?)\\\\)', re.MULTILINE)\n", (494, 547), False, 'import re, os, glob\n'), ((559, 611), 're.sub', 're.sub', (['pattern', "('' % base_url)", 'co... |
# -*- coding: utf-8 -*-
import os
# super sneaky inicheck thinger
from . import utils # noqa
__version__ = '0.3.2'
__core_config__ = os.path.abspath(
os.path.dirname(__file__) + '/CoreConfig.ini')
__recipes__ = os.path.abspath(os.path.dirname(__file__) + '/recipes.ini')
__config_checkers__ = 'utils'
# from . ... | [
"os.path.dirname"
] | [((159, 184), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (174, 184), False, 'import os\n'), ((236, 261), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (251, 261), False, 'import os\n')] |
import numpy as np
from pandas import (
TimedeltaIndex,
timedelta_range,
)
import pandas._testing as tm
class TestRepeat:
def test_repeat(self):
index = timedelta_range("1 days", periods=2, freq="D")
exp = TimedeltaIndex(["1 days", "1 days", "2 days", "2 days"])
for r... | [
"pandas._testing.assert_index_equal",
"pandas.TimedeltaIndex",
"numpy.repeat",
"pandas.timedelta_range"
] | [((187, 233), 'pandas.timedelta_range', 'timedelta_range', (['"""1 days"""'], {'periods': '(2)', 'freq': '"""D"""'}), "('1 days', periods=2, freq='D')\n", (202, 233), False, 'from pandas import TimedeltaIndex, timedelta_range\n'), ((249, 305), 'pandas.TimedeltaIndex', 'TimedeltaIndex', (["['1 days', '1 days', '2 days',... |
import re
import pymel.core as pm
from cleanfreak.checker import Checker
class MayaSelectMixin(object):
def select(self):
if self.selection:
pm.select(self.selection)
class References(MayaSelectMixin, Checker):
full_name = "References"
description = "Checks for references, we want ... | [
"pymel.core.polyEvaluate",
"pymel.core.listReferences",
"pymel.core.select",
"pymel.core.listRelatives",
"pymel.core.polyAutoProjection",
"pymel.core.ls",
"pymel.core.delete",
"pymel.core.objExists",
"pymel.core.system.sceneName",
"pymel.core.PyNode",
"pymel.core.group",
"re.sub"
] | [((542, 592), 'pymel.core.listReferences', 'pm.listReferences', ([], {'refNodes': '(False)', 'references': '(True)'}), '(refNodes=False, references=True)\n', (559, 592), True, 'import pymel.core as pm\n'), ((1529, 1544), 'pymel.core.ls', 'pm.ls', ([], {'dag': '(True)'}), '(dag=True)\n', (1534, 1544), True, 'import pyme... |
# type: ignore[attr-defined]
from typing import Optional
from distutils.spawn import find_executable
from pathlib import Path
import typer
from . import __version__, app, console, version_callback
from .bed2map import bed2map
from .liftover import liftBed, liftDat, liftPed
from .logger import plo_logger as logger
fr... | [
"distutils.spawn.find_executable",
"pathlib.Path",
"typer.Option",
"typer.run",
"typer.Argument"
] | [((404, 465), 'typer.Argument', 'typer.Argument', (['...'], {'help': '"""The plink MAP file to `liftOver`."""'}), "(..., help='The plink MAP file to `liftOver`.')\n", (418, 465), False, 'import typer\n'), ((502, 592), 'typer.Argument', 'typer.Argument', (['...'], {'help': '"""The location of the chain files to provide ... |
# 3rd party
import collections
from bs4 import BeautifulSoup
from django import forms
from wagtail.core import blocks
from wagtail.embeds import embeds
from wagtail.embeds.blocks import EmbedBlock as WagtailEmbedBlock
from wagtail.documents.blocks import DocumentChooserBlock
from wagtail.contrib.table_block.blocks im... | [
"modules.case_studies.models.CaseStudyPage.objects.live",
"taggit.models.Tag.objects.all",
"wagtail.documents.blocks.DocumentChooserBlock",
"wagtailnhsukfrontend.blocks.ActionLinkBlock",
"modules.blog_posts.models.BlogPost.objects.live",
"wagtail.core.blocks.BlockQuoteBlock",
"wagtail.embeds.embeds.get_... | [((1068, 1121), 'wagtail.core.blocks.PageChooserBlock', 'blocks.PageChooserBlock', ([], {'required': '(False)', 'label': '"""Page"""'}), "(required=False, label='Page')\n", (1091, 1121), False, 'from wagtail.core import blocks\n'), ((1132, 1176), 'wagtail.core.blocks.URLBlock', 'blocks.URLBlock', ([], {'label': '"""URL... |
## _____ _____
## | __ \| __ \ AUTHOR: <NAME>
## | |__) | |__) | ---------------------------------
## | ___/| _ / DATE: May 19, 2021
## | | | | \ \ ---------------------------------
## |_| |_| \_\ https://github.com/pedrorrivero
##
## Copyright 2021 <NAME>
##
## Licensed under th... | [
"warnings.warn"
] | [((1136, 1164), 'warnings.warn', 'warn', (['MESSAGE', 'FutureWarning'], {}), '(MESSAGE, FutureWarning)\n', (1140, 1164), False, 'from warnings import warn\n')] |
"""
Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import argparse
import glob
import logging
import os
import random
import sys
import timeit
from ... | [
"logging.getLogger",
"components.utils.mkdir_p",
"components.config.set_seed",
"torch.cuda.device_count",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"transformers.AutoTokenizer.from_pretrained",
"torch.distributed.get_rank",
"torch.distributed.barrier",
"os.path.... | [((1353, 1380), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1370, 1380), False, 'import logging\n'), ((1780, 1827), 'functools.partial', 'partial', (['disamb_collate_fn'], {'tokenizer': 'tokenizer'}), '(disamb_collate_fn, tokenizer=tokenizer)\n', (1787, 1827), False, 'from functools i... |
import torch
import numpy as np
import shutil
import os
from data import ljspeech
import hparams as hp
def preprocess_ljspeech(filename):
in_dir = filename
out_dir = hp.mel_ground_truth
if not os.path.exists(out_dir):
os.makedirs(out_dir, exist_ok=True)
metadata = ljspeech.build_from_path(in_... | [
"os.path.exists",
"os.path.join",
"os.makedirs",
"data.ljspeech.build_from_path"
] | [((292, 333), 'data.ljspeech.build_from_path', 'ljspeech.build_from_path', (['in_dir', 'out_dir'], {}), '(in_dir, out_dir)\n', (316, 333), False, 'from data import ljspeech\n'), ((690, 726), 'os.path.join', 'os.path.join', (['"""data"""', '"""LJSpeech-1.1"""'], {}), "('data', 'LJSpeech-1.1')\n", (702, 726), False, 'imp... |
from django.core.management.base import BaseCommand, CommandError
from canvas.thumbnailer import update_all_content
from canvas.models import Content
from canvas.upload import get_fs
from configuration import Config
from django.conf import settings
class Command(BaseCommand):
args = ''
help = 'Recreates all th... | [
"canvas.upload.get_fs"
] | [((403, 429), 'canvas.upload.get_fs', 'get_fs', (['*settings.IMAGE_FS'], {}), '(*settings.IMAGE_FS)\n', (409, 429), False, 'from canvas.upload import get_fs\n')] |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... | [
"warnings.warn"
] | [((1175, 1306), 'warnings.warn', 'warn', (['"""You used ReorderSegTransform but there is no \'seg\' key in your data_dict, returning data_dict unmodified"""', 'Warning'], {}), '(\n "You used ReorderSegTransform but there is no \'seg\' key in your data_dict, returning data_dict unmodified"\n , Warning)\n', (1179, ... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""A servlet for project owners to create a new component def."""
import logging
import time
f... | [
"tracker.tracker_views.ComponentDefView",
"framework.permissions.CanEditComponentDef",
"framework.permissions.PermissionException",
"tracker.tracker_bizobj.FindComponentDef",
"time.time",
"tracker.tracker_constants.COMPONENT_NAME_RE.match",
"third_party.ezt.boolean",
"tracker.component_helpers.ParseCo... | [((5744, 5789), 'tracker.tracker_bizobj.FindComponentDef', 'tracker_bizobj.FindComponentDef', (['path', 'config'], {}), '(path, config)\n', (5775, 5789), False, 'from tracker import tracker_bizobj\n'), ((3100, 3169), 'tracker.component_helpers.ParseComponentRequest', 'component_helpers.ParseComponentRequest', (['mr', '... |
import logging
import re
from brownie import chain, web3
from cachetools.func import lru_cache
from yearn.cache import memory
logger = logging.getLogger(__name__)
def safe_views(abi):
return [
item["name"]
for item in abi
if item["type"] == "function"
and item["stateMutability"]... | [
"logging.getLogger",
"cachetools.func.lru_cache",
"brownie.web3.manager.request_blocking",
"brownie.web3.eth.get_code",
"google.cloud.bigquery.Client",
"yearn.cache.memory.cache"
] | [((138, 165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'import logging\n'), ((446, 458), 'cachetools.func.lru_cache', 'lru_cache', (['(1)'], {}), '(1)\n', (455, 458), False, 'from cachetools.func import lru_cache\n'), ((658, 672), 'yearn.cache.memory.cache', 'memo... |
import json
import os
""" Retrieve configs for the client as well as any module configurations"""
with open("../bot.json", "r") as file:
botConfig = json.load(file)
with open("../modules.json", "r") as file:
moduleConfig = json.load(file)
PREFIX = botConfig["prefix"]
DESCRIPTION = botConfig["descripti... | [
"json.load"
] | [((155, 170), 'json.load', 'json.load', (['file'], {}), '(file)\n', (164, 170), False, 'import json\n'), ((234, 249), 'json.load', 'json.load', (['file'], {}), '(file)\n', (243, 249), False, 'import json\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Takes Disqus Export xml and converts posts into yaml
https://help.disqus.com/customer/portal/articles/472149-comments-export
Matched format for how I have Staticman configured for comments. I then use Hugo to generate the page.
Generates the following folder struct... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.dirname",
"codecs.open"
] | [((879, 904), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (894, 904), False, 'import os\n'), ((1113, 1138), 'os.path.exists', 'os.path.exists', (['directory'], {}), '(directory)\n', (1127, 1138), False, 'import os\n'), ((1144, 1166), 'os.makedirs', 'os.makedirs', (['directory'], {}), '(dir... |
# coding=utf-8
"""
负责进行云音乐的数据库相关操作
Created by jayvee on 16/12/24.
"""
from utils.db_utils import get_db_inst
from utils.logger_utils import data_process_logger
class CloudMusicDAO:
def __init__(self, db_name, collection_name):
self.db_name = db_name
self.collection_name = collection_name
... | [
"utils.logger_utils.data_process_logger.warn",
"utils.db_utils.get_db_inst"
] | [((336, 383), 'utils.db_utils.get_db_inst', 'get_db_inst', (['self.db_name', 'self.collection_name'], {}), '(self.db_name, self.collection_name)\n', (347, 383), False, 'from utils.db_utils import get_db_inst\n'), ((1078, 1181), 'utils.logger_utils.data_process_logger.warn', 'data_process_logger.warn', (["('overwrite it... |
import threading
def run_server1(import_name,host,port=80):
import wpkit
from wpkit.web.applications.all import BluePan
from wpkit.web import MyBlueprint
app = wpkit.web.get_default_app(import_name)
bp_pan = pan.BluePan(import_name)
app.add_blueprint(bp_pan)
print(app.url_map)
print(a... | [
"threading.Thread",
"wpkit.web.get_default_app",
"wpkit.services.LocalFSServer"
] | [((176, 214), 'wpkit.web.get_default_app', 'wpkit.web.get_default_app', (['import_name'], {}), '(import_name)\n', (201, 214), False, 'import wpkit\n'), ((466, 503), 'wpkit.services.LocalFSServer', 'LocalFSServer', (['import_name'], {'path': '"""./"""'}), "(import_name, path='./')\n", (479, 503), False, 'from wpkit.serv... |
import csv, glob, os
import matplotlib.pyplot as plt
import datetime
from datetime import date, timedelta, datetime
import numpy as np
import matplotlib.dates as mdates
def load_cases_by_date(in_dir = '../data/CA/raw', county = 'Los Angeles'):
casesCSV = 'CasesDeaths.csv'
reader = csv.reader(open(os.path.join... | [
"os.path.join"
] | [((308, 338), 'os.path.join', 'os.path.join', (['in_dir', 'casesCSV'], {}), '(in_dir, casesCSV)\n', (320, 338), False, 'import csv, glob, os\n'), ((1360, 1390), 'os.path.join', 'os.path.join', (['in_dir', 'casesCSV'], {}), '(in_dir, casesCSV)\n', (1372, 1390), False, 'import csv, glob, os\n'), ((2203, 2237), 'os.path.j... |
import json
import logging
import re
import sys
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.openapi.utils import get_openapi
from fastapi.responses import JSONResponse
from timvt.db.catalog import table_index
fr... | [
"logging.basicConfig",
"fastapi.FastAPI",
"timvt.db.events.close_db_connection",
"fastapi.responses.JSONResponse",
"fastapi.openapi.utils.get_openapi",
"timvt.db.events.connect_to_db",
"timvt.db.catalog.table_index"
] | [((622, 681), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (641, 681), False, 'import logging\n'), ((689, 710), 'fastapi.FastAPI', 'FastAPI', ([], {'docs_url': '"""/"""'}), "(docs_url='/')\n", (696, 710), False, 'fr... |
# Copyright 2016-2019 The <NAME> at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");
# you ... | [
"numpy.tile",
"tensorflow.python.keras.backend.get_value",
"tensorflow.python.framework.test_util.run_in_graph_and_eager_modes",
"deepcell.layers.RegressBoxes",
"deepcell.layers.ClipBoxes",
"numpy.random.random",
"numpy.array",
"numpy.random.randint",
"tensorflow.python.keras.backend.floatx",
"dee... | [((1666, 1709), 'tensorflow.python.framework.test_util.run_in_graph_and_eager_modes', 'tf_test_util.run_in_graph_and_eager_modes', ([], {}), '()\n', (1707, 1709), True, 'from tensorflow.python.framework import test_util as tf_test_util\n'), ((2634, 2677), 'tensorflow.python.framework.test_util.run_in_graph_and_eager_mo... |
#-*- coding: utf8 -*-
from __future__ import division
import numpy as n, pylab as p, networkx as x, random as r, collections as c, string
__doc__="""Este arquivo possui a classe Sistem, base para todas as animações
G=x.read_gml("1-400cpp.gml") # digrafo com peso
S=Sistem(G)
S.draw("grafo1.png")
S.add_msgs([msg1,msg2.... | [
"dateutil.parser.parse",
"numpy.reshape",
"networkx.to_agraph",
"numpy.hstack",
"numpy.random.random",
"pylab.plot",
"networkx.DiGraph",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"numpy.vstack",
"networkx.copy.deepcopy",
"numpy.sin",
"networkx.read_gml",
"pylab.clf",
"pylab.show"... | [((16102, 16113), 'networkx.DiGraph', 'x.DiGraph', ([], {}), '()\n', (16111, 16113), True, 'import numpy as n, pylab as p, networkx as x, random as r, collections as c, string\n'), ((17122, 17140), 'networkx.copy.deepcopy', 'x.copy.deepcopy', (['g'], {}), '(g)\n', (17137, 17140), True, 'import numpy as n, pylab as p, n... |
import urllib.parse
import pipestash.output
import redis
import json
import inspect
import re
import time
import random
class RedisOutput(pipestash.output.Output):
def __init__(self, config):
redis_url = urllib.parse.urlparse(config.redis_url)
self.redis = redis.StrictRedis(host=redis_url.hostname,... | [
"re.sub",
"random.random"
] | [((347, 379), 're.sub', 're.sub', (['"""^/"""', '""""""', 'redis_url.path'], {}), "('^/', '', redis_url.path)\n", (353, 379), False, 'import re\n'), ((670, 685), 'random.random', 'random.random', ([], {}), '()\n', (683, 685), False, 'import random\n')] |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from datadog_checks.dev import get_docker_hostname
from datadog_checks.nginx.metrics import COUNT_METRICS, METRICS_SEND_AS_COUNT
CHECK_NAME = 'nginx'
HERE = os.path.dirname(os.path.abspath(__f... | [
"os.getenv",
"os.environ.get",
"os.path.join",
"os.path.abspath",
"datadog_checks.dev.get_docker_hostname"
] | [((344, 374), 'os.path.join', 'os.path.join', (['HERE', '"""fixtures"""'], {}), "(HERE, 'fixtures')\n", (356, 374), False, 'import os\n'), ((383, 404), 'datadog_checks.dev.get_docker_hostname', 'get_docker_hostname', ([], {}), '()\n', (402, 404), False, 'from datadog_checks.dev import get_docker_hostname\n'), ((301, 32... |
import h5py
import numpy as np
from keras.datasets import mnist
from keras.utils import to_categorical
# input image dimensions
img_rows, img_cols = 28, 28
# the data, shuffled and split between train and test sets
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape[0], img... | [
"keras.datasets.mnist.load_data",
"h5py.File",
"keras.utils.to_categorical",
"numpy.concatenate",
"h5py.special_dtype"
] | [((255, 272), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (270, 272), False, 'from keras.datasets import mnist\n'), ((569, 602), 'numpy.concatenate', 'np.concatenate', (['(y_train, y_test)'], {}), '((y_train, y_test))\n', (583, 602), True, 'import numpy as np\n'), ((826, 854), 'h5py.special_d... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: edgir/name.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from g... | [
"google.protobuf.descriptor_pool.Default",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default"
] | [((479, 505), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (503, 505), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1111, 1249), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""Names... |
from flask import jsonify
from models.mongo import Document
from bs4 import BeautifulSoup
import bs4
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.ex... | [
"requests.post",
"dateutil.relativedelta.relativedelta",
"pandas.read_csv",
"time.sleep",
"datetime.datetime.today",
"datetime.timedelta",
"models.mongo.Document",
"flask.jsonify",
"json.dumps",
"unicodedata.normalize",
"json.loads",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.w... | [((628, 638), 'models.mongo.Document', 'Document', ([], {}), '()\n', (636, 638), False, 'from models.mongo import Document\n'), ((780, 805), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (803, 805), False, 'from selenium import webdriver\n'), ((2275, 2317), 'requests.post', 'requests.... |
import json
import logging
from http import HTTPStatus
from typing import Any, Iterable, Mapping, Union
from amundsen_common.entity.resource_type import ResourceType
from amundsen_common.models.feature import FeatureSchema
from amundsen_common.models.generation_code import GenerationCodeSchema
from amundsen_common.mod... | [
"logging.getLogger",
"flasgger.swag_from",
"json.loads",
"flask_restful.reqparse.RequestParser",
"metadata_service.api.tag.TagCommon",
"metadata_service.api.badge.BadgeCommon",
"amundsen_common.models.feature.FeatureSchema",
"amundsen_common.models.generation_code.GenerationCodeSchema",
"amundsen_co... | [((673, 700), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (690, 700), False, 'import logging\n'), ((855, 902), 'flasgger.swag_from', 'swag_from', (['"""swagger_doc/feature/detail_get.yml"""'], {}), "('swagger_doc/feature/detail_get.yml')\n", (864, 902), False, 'from flasgger import swa... |
#!/usr/bin/python3
#-*- coding : UTF-8 -*-
import os
import sys
class Lancement():
def Restartd(self):
python = sys.executable
os.execl(python, python, *sys.argv)
# Lecture du fichier init.txt pour connaitre son etat
def states_run(self)-> str:
f = open("init.txt")
state ... | [
"os.execl"
] | [((150, 185), 'os.execl', 'os.execl', (['python', 'python', '*sys.argv'], {}), '(python, python, *sys.argv)\n', (158, 185), False, 'import os\n')] |
import os
from sqlalchemy import create_engine
N_ROWS_CHUNKSIZE = 100_000
POSTGRES_USER = os.getenv('POSTGRES_USER') or 'postgres'
POSTGRES_PASSWORD = os.getenv('POSTGRES_PASSWORD') or '<PASSWORD>'
POSTGRES_HOST = os.environ.get('POSTGRES_HOST') or 'postgres'
POSTGRES_PORT = os.environ.get('POSTGRES_PORT') or... | [
"sqlalchemy.create_engine",
"os.environ.get",
"os.getenv"
] | [((528, 555), 'sqlalchemy.create_engine', 'create_engine', (['db_uri_no_db'], {}), '(db_uri_no_db)\n', (541, 555), False, 'from sqlalchemy import create_engine\n'), ((683, 704), 'sqlalchemy.create_engine', 'create_engine', (['db_uri'], {}), '(db_uri)\n', (696, 704), False, 'from sqlalchemy import create_engine\n'), ((9... |
# Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import subprocess
import tempfile
from typing import List, Optional, Union
from mmcv.utils import requires_executable
@requires_executable('ffmpeg')
def convert_video(in_file: str,
out_file: str,
print... | [
"os.close",
"tempfile.mkstemp",
"subprocess.call",
"os.path.abspath",
"mmcv.utils.requires_executable",
"os.remove"
] | [((202, 231), 'mmcv.utils.requires_executable', 'requires_executable', (['"""ffmpeg"""'], {}), "('ffmpeg')\n", (221, 231), False, 'from mmcv.utils import requires_executable\n'), ((1584, 1613), 'mmcv.utils.requires_executable', 'requires_executable', (['"""ffmpeg"""'], {}), "('ffmpeg')\n", (1603, 1613), False, 'from mm... |
import torch.nn as nn
from ops.transforms import *
from torch.nn.init import normal_, constant_
from ops.basic_ops import ConsensusModule
import sys
from importlib import import_module
sys.path.append('..')
class VideoNet(nn.Module):
def __init__(self, num_class, num_segments, modality,
backbone='... | [
"torch.nn.Dropout",
"importlib.import_module",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"ops.basic_ops.ConsensusModule",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"sys.path.append",
"torch.nn.init.normal_"
] | [((186, 207), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (201, 207), False, 'import sys\n'), ((1274, 1305), 'ops.basic_ops.ConsensusModule', 'ConsensusModule', (['consensus_type'], {}), '(consensus_type)\n', (1289, 1305), False, 'from ops.basic_ops import ConsensusModule\n'), ((1329, 1341), '... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 13:43:28 2017
@author: nightowl
"""
from __future__ import print_function
import os
# from fuzzywuzzy import fuzz
from shutil import copyfile
from ..io.database.sql_to_python import QuerySQL
from ..io.database.sql_connector import DVH_SQL
from .... | [
"os.listdir",
"os.path.join",
"os.path.isfile",
"shutil.copyfile",
"os.remove"
] | [((22811, 22831), 'os.listdir', 'os.listdir', (['PREF_DIR'], {}), '(PREF_DIR)\n', (22821, 22831), False, 'import os\n'), ((1775, 1818), 'os.path.join', 'os.path.join', (['PREF_DIR', '"""institutional.roi"""'], {}), "(PREF_DIR, 'institutional.roi')\n", (1787, 1818), False, 'import os\n'), ((1830, 1859), 'os.path.isfile'... |
"""Queenbee DAG steps.
A DAG step defines a single step in a Recipe. Each step indicates what function template
should be used and maps inputs and outputs for the specific task.
"""
from typing import List, Union, Dict
from pydantic import Field, validator, root_validator
from ..base.basemodel import BaseModel
from .... | [
"pydantic.Field",
"pydantic.validator"
] | [((754, 823), 'pydantic.Field', 'Field', (['None'], {'description': '"""Optional annotations for Queenbee objects."""'}), "(None, description='Optional annotations for Queenbee objects.')\n", (759, 823), False, 'from pydantic import Field, validator, root_validator\n'), ((852, 889), 'pydantic.validator', 'validator', (... |
import json
def load_json(filename):
try:
with open(filename, encoding="utf-8") as f:
return json.loads(f.read())
except IOError as e:
print("Error loading", filename, e)
return []
def write_json(filename, contents):
with open(filename, "w") as outfile:
outfi... | [
"json.dumps"
] | [((329, 359), 'json.dumps', 'json.dumps', (['contents'], {'indent': '(2)'}), '(contents, indent=2)\n', (339, 359), False, 'import json\n')] |
from __future__ import division
import cv2
import numpy as np
from opensfm import transformations
def rotation_from_angle_axis(angle_axis):
return cv2.Rodrigues(np.asarray(angle_axis))[0]
def rotation_from_ptr(pan, tilt, roll):
"""Camera rotation matrix from pan, tilt and roll."""
R1 = rotation_from_a... | [
"numpy.identity",
"numpy.cross",
"numpy.asarray",
"opensfm.transformations.euler_from_matrix",
"numpy.dot",
"numpy.arctan2",
"numpy.linalg.norm",
"opensfm.transformations.euler_matrix"
] | [((809, 845), 'numpy.dot', 'np.dot', (['rotation_matrix.T', '[0, 0, 1]'], {}), '(rotation_matrix.T, [0, 0, 1])\n', (815, 845), True, 'import numpy as np\n'), ((857, 887), 'numpy.arctan2', 'np.arctan2', (['Rt_ez[0]', 'Rt_ez[1]'], {}), '(Rt_ez[0], Rt_ez[1])\n', (867, 887), True, 'import numpy as np\n'), ((943, 979), 'num... |
import os
import sys
import logging.config
# Prepend package directory for working imports
package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, package_dir)
logging.config.dictConfig(
{
"version": 1,
"handlers": {"console": {"class": "logging.StreamHand... | [
"os.path.dirname",
"sys.path.insert"
] | [((170, 201), 'sys.path.insert', 'sys.path.insert', (['(0)', 'package_dir'], {}), '(0, package_dir)\n', (185, 201), False, 'import sys\n'), ((136, 161), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (151, 161), False, 'import os\n')] |
from __future__ import division, print_function
import unittest
import mock
from smqtk.algorithms.descriptor_generator import get_descriptor_generator_impls
from smqtk.algorithms.descriptor_generator.colordescriptor.colordescriptor \
import ColorDescriptor_Image_csift # arbitrary leaf class
if ColorDescriptor_... | [
"mock.patch",
"smqtk.algorithms.descriptor_generator.colordescriptor.colordescriptor.ColorDescriptor_Image_csift.is_usable",
"smqtk.algorithms.descriptor_generator.colordescriptor.colordescriptor.ColorDescriptor_Image_csift.get_default_config",
"smqtk.algorithms.descriptor_generator.colordescriptor.colordescr... | [((304, 343), 'smqtk.algorithms.descriptor_generator.colordescriptor.colordescriptor.ColorDescriptor_Image_csift.is_usable', 'ColorDescriptor_Image_csift.is_usable', ([], {}), '()\n', (341, 343), False, 'from smqtk.algorithms.descriptor_generator.colordescriptor.colordescriptor import ColorDescriptor_Image_csift\n'), (... |
import frappe, json
@frappe.whitelist()
def check_order_tracking(name):
order_tracking = frappe.db.sql(""" SELECT COUNT(*) as count FROM `tabOrder Tracking` WHERE purchase_order_ref=%s """,name, as_dict=1 )
return order_tracking[0].count > 0
def validate_po(doc, method):
if len(doc.orders) > 0:
f... | [
"json.loads",
"frappe.whitelist",
"frappe.get_doc",
"frappe.db.commit",
"frappe.db.sql"
] | [((22, 40), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (38, 40), False, 'import frappe, json\n'), ((523, 541), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (539, 541), False, 'import frappe, json\n'), ((94, 217), 'frappe.db.sql', 'frappe.db.sql', (['""" SELECT COUNT(*) as count FROM `tabOrde... |
import datetime
from unittest.mock import MagicMock, patch, Mock
from nose.tools import assert_equal
from parameterized import parameterized
import unittest
from telebot.types import Message, User, Chat
from modules.core.source import attach_core_module
from modules.schedule import permanent
from modules.schedule.so... | [
"unittest.mock.Mock",
"telebot.types.Chat",
"datetime.datetime.now",
"modules.schedule.source.attach_schedule_module",
"telebot.types.User",
"unittest.mock.patch"
] | [((426, 450), 'modules.schedule.source.attach_schedule_module', 'attach_schedule_module', ([], {}), '()\n', (448, 450), False, 'from modules.schedule.source import attach_schedule_module\n'), ((1094, 1119), 'unittest.mock.Mock', 'Mock', ([], {'return_value': "['Hi']"}), "(return_value=['Hi'])\n", (1098, 1119), False, '... |
'''
parse flask request to event format
'''
from urllib.parse import parse_qs, urlencode
import json
import pydash as _
def flaskRequestParser(request, action):
'''
parse flask request to event format:
{
'pathParameters': {
'action': action
},
'queryStringParameters': dict(request.args),
'... | [
"urllib.parse.urlencode",
"urllib.parse.parse_qs",
"json.loads",
"pydash.predicates.is_dict"
] | [((505, 528), 'urllib.parse.urlencode', 'urlencode', (['request.form'], {}), '(request.form)\n', (514, 528), False, 'from urllib.parse import parse_qs, urlencode\n'), ((540, 554), 'urllib.parse.parse_qs', 'parse_qs', (['body'], {}), '(body)\n', (548, 554), False, 'from urllib.parse import parse_qs, urlencode\n'), ((764... |
#!/usr/bin/env python
# coding: utf-8
import time
import atexit
import weakref
import pybullet
import threading
from qibullet.tools import *
from qibullet.controller import Controller
class BaseController(Controller):
"""
Class describing a robot base controller
"""
# _instances = set()
FRAME_WO... | [
"pybullet.error",
"pybullet.getBasePositionAndOrientation",
"time.sleep",
"qibullet.controller.Controller.__init__",
"pybullet.getQuaternionFromEuler",
"pybullet.resetBaseVelocity",
"pybullet.changeConstraint",
"threading.Thread",
"pybullet.getEulerFromQuaternion"
] | [((649, 704), 'qibullet.controller.Controller.__init__', 'Controller.__init__', (['self', 'robot_model', 'physicsClientId'], {}), '(self, robot_model, physicsClientId)\n', (668, 704), False, 'from qibullet.controller import Controller\n'), ((1670, 1768), 'pybullet.getBasePositionAndOrientation', 'pybullet.getBasePositi... |
import os
import nibabel as nib
import numpy.ma as ma
import settings_dist
import numpy as np
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("root_dir")
parser.add_argument("sample")
parser.add_argument("train_test_split")
parser.add_argument("resize")
parser.add_argument(... | [
"numpy.dstack",
"numpy.mean",
"argparse.ArgumentParser",
"nibabel.load",
"numpy.asarray",
"os.path.join",
"numpy.ma.masked_not_equal",
"numpy.rot90",
"numpy.std",
"numpy.concatenate",
"os.walk"
] | [((142, 167), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (165, 167), False, 'import argparse\n'), ((1231, 1254), 'numpy.asarray', 'np.asarray', (['msks_parsed'], {}), '(msks_parsed)\n', (1241, 1254), True, 'import numpy as np\n'), ((1420, 1438), 'numpy.asarray', 'np.asarray', (['slices'], {... |
"""
Response selection methods determines which response should be used in
the event that multiple responses are generated within a logic adapter.
"""
import logging
def get_most_frequent_response(input_statement, response_list):
"""
:param input_statement: A statement, that closely matches an input to the ch... | [
"logging.getLogger",
"random.choice"
] | [((654, 681), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (671, 681), False, 'import logging\n'), ((1513, 1540), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1530, 1540), False, 'import logging\n'), ((2116, 2143), 'logging.getLogger', 'logging.getLogge... |
"""
Wishlist API Service Test Suite
Test cases can be run with the following:
nosetests -v --with-spec --spec-color
coverage report -m
codecov --token=$CODECOV_TOKEN
While debugging just these tests it's convinient to use this:
nosetests --stop tests/test_service.py:TestWishlistsServer
"""
import os
impo... | [
"service.models.db.session.remove",
"logging.debug",
"os.getenv",
"service.models.db.drop_all",
"service.models.db.session.close",
"service.routes.app.test_client",
"service.routes.app.logger.setLevel",
"service.models.db.create_all",
"logging.disable",
"service.models.init_db"
] | [((744, 777), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (759, 777), False, 'import logging\n'), ((864, 943), 'os.getenv', 'os.getenv', (['"""DATABASE_URI"""', '"""postgres://postgres:postgres@localhost:5432/testdb"""'], {}), "('DATABASE_URI', 'postgres://postgres:postgres... |
# Generated by Django 4.0 on 2022-01-01 11:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("podcasts", "0120_rename_follow_subscription_and_more"),
]
operations = [
migrations.RemoveIndex(
model_name="podcast",
name="p... | [
"django.db.migrations.RemoveIndex"
] | [((243, 329), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""podcast"""', 'name': '"""podcasts_podcast_title_lower"""'}), "(model_name='podcast', name=\n 'podcasts_podcast_title_lower')\n", (265, 329), False, 'from django.db import migrations\n')] |
import numpy as np
import torch
import itertools
from torch.autograd import Variable
def getGridMask(frame, dimensions, num_person, neighborhood_size, grid_size, is_occupancy = False):
'''
This function computes the binary mask that represents the
occupancy of each ped in the other's grid
params:
... | [
"itertools.permutations",
"numpy.floor",
"numpy.zeros"
] | [((1441, 1480), 'itertools.permutations', 'itertools.permutations', (['list_indices', '(2)'], {}), '(list_indices, 2)\n', (1463, 1480), False, 'import itertools\n'), ((850, 881), 'numpy.zeros', 'np.zeros', (['(mnp, grid_size ** 2)'], {}), '((mnp, grid_size ** 2))\n', (858, 881), True, 'import numpy as np\n'), ((911, 94... |
# PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <NAME>
# 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
... | [
"quizx.VecGraph"
] | [((1642, 1658), 'quizx.VecGraph', 'quizx.VecGraph', ([], {}), '()\n', (1656, 1658), False, 'import quizx\n')] |
import pandas as pd
dfs = []
for i in range(24):
try:
df1 = pd.read_csv('result{}.csv'.format(i), sep = ';', encoding = 'utf-8', usecols= ['name', 'position', 'profession', 'profexp', 'anotherexp', 'strongs', 'contacts'])
dfs.append(df1)
except Exception:
print(i)
continue
df =... | [
"pandas.concat"
] | [((321, 335), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (330, 335), True, 'import pandas as pd\n')] |
# (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import logging
import re
from collections import OrderedDict
import mock
import pytest
from datadog_checks.base import AgentCheck
pytestmark = pytest.mark.metadata
SET_CHECK_METADATA_METHOD = 'data... | [
"collections.OrderedDict",
"mock.patch",
"datadog_checks.base.AgentCheck",
"json.loads",
"re.compile",
"pytest.raises"
] | [((468, 481), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (479, 481), False, 'from collections import OrderedDict\n'), ((549, 577), 'datadog_checks.base.AgentCheck', 'AgentCheck', (['"""test"""', '{}', '[{}]'], {}), "('test', {}, [{}])\n", (559, 577), False, 'from datadog_checks.base import AgentCheck\n... |
import torch
import torch.nn as nn
class Generator(nn.Module) :
# gray => n_channel = 1, color => n_channel = 3
def __init__(self, z_dim = 100, g_n_channel = 64, n_channel = 3) :
super(Generator, self).__init__()
self.layers = nn.Sequential(
nn.ConvTranspose2d(z_di... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.Tanh"
] | [((297, 360), 'torch.nn.ConvTranspose2d', 'nn.ConvTranspose2d', (['z_dim', '(g_n_channel * 8)', '(4)', '(1)', '(0)'], {'bias': '(False)'}), '(z_dim, g_n_channel * 8, 4, 1, 0, bias=False)\n', (315, 360), True, 'import torch.nn as nn\n'), ((375, 406), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(g_n_channel * 8)'], {}),... |
# coding: utf-8
"""
Sunshine Conversations API
The version of the OpenAPI document: 9.4.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from sunshine_conversations_client.api_cli... | [
"six.iteritems",
"sunshine_conversations_client.exceptions.ApiTypeError",
"sunshine_conversations_client.api_client.ApiClient",
"sunshine_conversations_client.exceptions.ApiValueError"
] | [((4812, 4853), 'six.iteritems', 'six.iteritems', (["local_var_params['kwargs']"], {}), "(local_var_params['kwargs'])\n", (4825, 4853), False, 'import six\n'), ((11686, 11727), 'six.iteritems', 'six.iteritems', (["local_var_params['kwargs']"], {}), "(local_var_params['kwargs'])\n", (11699, 11727), False, 'import six\n'... |
"""Convert FIDUCIA csv files"""
import csv
import decimal
import logging
log = logging.getLogger(__name__)
class Dialect(csv.Dialect):
delimiter = ";"
quotechar = '"'
quoting = csv.QUOTE_MINIMAL
lineterminator = "\n"
def import_account(filename, ynab):
# Skipping first lines with unneeded info... | [
"logging.getLogger",
"csv.DictReader"
] | [((81, 108), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (98, 108), False, 'import logging\n'), ((452, 494), 'csv.DictReader', 'csv.DictReader', (['bank_file'], {'dialect': 'Dialect'}), '(bank_file, dialect=Dialect)\n', (466, 494), False, 'import csv\n')] |
import requests
def splash_render(url):
splash_url = "http://localhost:8050/render.html"
args = {
"url": url,
"timeout": 5,
"image": 0
}
response = requests.get(splash_url, params=args)
return response.text
if __name__ == '__main__':
url = "http://quotes.toscrape.co... | [
"requests.get"
] | [((192, 229), 'requests.get', 'requests.get', (['splash_url'], {'params': 'args'}), '(splash_url, params=args)\n', (204, 229), False, 'import requests\n')] |
# 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... | [
"six.add_metaclass"
] | [((1109, 1139), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (1126, 1139), False, 'import six\n')] |
#!/usr/bin/python3
#-- Use pprint module..
from pprint import pprint
pprint([[1,2,3,4],[11,22,33,44],[111,222,333,444]], width=20)
#-- Use printf style formatting..
pi=22/7
print('pi is approximately: %9.6f' % pi)
#-- Write some multivariate for loops..
for x,y in [[1,2],[11,22]]:
print('x:',x,'y:',y)
#-- Comput... | [
"pprint.pprint"
] | [((70, 142), 'pprint.pprint', 'pprint', (['[[1, 2, 3, 4], [11, 22, 33, 44], [111, 222, 333, 444]]'], {'width': '(20)'}), '([[1, 2, 3, 4], [11, 22, 33, 44], [111, 222, 333, 444]], width=20)\n', (76, 142), False, 'from pprint import pprint\n'), ((893, 912), 'pprint.pprint', 'pprint', (['x'], {'width': '(62)'}), '(x, widt... |
""" Console script for led_tester. """
import sys
import click
click.disable_unicode_literals_warning = True
@click.command()
@click.option("--input", default=None, help="input URI (file or URL)")
def main(input=None):
""" Console script for led_tester."""
print("input", input)
N, instructions = parseFile(input)
... | [
"click.option",
"click.command"
] | [((111, 126), 'click.command', 'click.command', ([], {}), '()\n', (124, 126), False, 'import click\n'), ((128, 197), 'click.option', 'click.option', (['"""--input"""'], {'default': 'None', 'help': '"""input URI (file or URL)"""'}), "('--input', default=None, help='input URI (file or URL)')\n", (140, 197), False, 'impor... |
#!/usr/bin/env python3
import unittest
import torch
from gpytorch.priors import NormalPrior
from gpytorch.test.utils import least_used_cuda_device
from torch.distributions import Normal
class TestNormalPrior(unittest.TestCase):
def test_normal_prior_to_gpu(self):
if torch.cuda.is_available():
... | [
"torch.distributions.Normal",
"torch.tensor",
"torch.cuda.is_available",
"gpytorch.priors.NormalPrior",
"unittest.main",
"gpytorch.test.utils.least_used_cuda_device",
"torch.zeros",
"torch.device"
] | [((4057, 4072), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4070, 4072), False, 'import unittest\n'), ((283, 308), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (306, 308), False, 'import torch\n'), ((761, 793), 'torch.tensor', 'torch.tensor', (['(0.0)'], {'device': 'device'}), '(0.0,... |
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
# путь к драйверу chrome
chromedriver = '/usr/bin/chrom... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.support.ui.WebDriverWait",
"time.sleep"
] | [((394, 419), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (417, 419), False, 'from selenium import webdriver\n'), ((505, 575), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'chromedriver', 'chrome_options': 'options'}), '(executable_path=chromedriver, chr... |
import torch
import mmocr.utils as utils
from mmocr.models.builder import CONVERTORS
from .base import BaseConvertor
import numpy as np
@CONVERTORS.register_module()
class MasterConvertor(BaseConvertor):
"""Convert between text, index and tensor for encoder-decoder based
pipeline.
Args:
dict_typ... | [
"torch.LongTensor",
"torch.max",
"torch.stack",
"mmocr.utils.is_type_list",
"mmocr.models.builder.CONVERTORS.register_module",
"torch.ones"
] | [((140, 168), 'mmocr.models.builder.CONVERTORS.register_module', 'CONVERTORS.register_module', ([], {}), '()\n', (166, 168), False, 'from mmocr.models.builder import CONVERTORS\n'), ((2972, 3004), 'mmocr.utils.is_type_list', 'utils.is_type_list', (['strings', 'str'], {}), '(strings, str)\n', (2990, 3004), True, 'import... |
import argparse
import os
import numpy as np
# DNN Libraries
# import pl torch libs
import pytorch_lightning as pl
from pytorch_lightning.trainer import Trainer
from pytorch_lightning.callbacks import EarlyStopping
# Turboflow Libraries
from turboflow.dataloaders import TurboFlowDataModule
from turboflow.models.phyr... | [
"turboflow.dataloaders.TurboFlowDataModule.from_argparse_args",
"pytorch_lightning.callbacks.EarlyStopping",
"argparse.ArgumentParser",
"pytorch_lightning.trainer.Trainer.from_argparse_args",
"os.path.realpath",
"turboflow.models.phyrff_hard.plDivFreeRFFNet.add_model_specific_args",
"argparse.Namespace"... | [((634, 688), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""main.py"""', 'add_help': '(True)'}), "(prog='main.py', add_help=True)\n", (657, 688), False, 'import argparse\n'), ((741, 791), 'turboflow.dataloaders.TurboFlowDataModule.add_data_specific_args', 'TurboFlowDataModule.add_data_specific... |
# <NAME> <<EMAIL>>
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.concurrently import CommunicationChannel0
##__________________________________________________________________||
@pytest.fixture()
def obj():
return CommunicationChannel0()
##______________... | [
"pytest.fixture",
"alphatwirl.concurrently.CommunicationChannel0",
"mock.call",
"mock.Mock"
] | [((240, 256), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (254, 256), False, 'import pytest\n'), ((279, 302), 'alphatwirl.concurrently.CommunicationChannel0', 'CommunicationChannel0', ([], {}), '()\n', (300, 302), False, 'from alphatwirl.concurrently import CommunicationChannel0\n'), ((977, 1002), 'mock.Mock'... |
# A simple program that wanders and avoids obstacles
from finch import Finch
from time import sleep
# Instantiate the Finch object and connect to Finch
tweety = Finch()
# Get the Z-Axis acceleration
zAccel = tweety.acceleration()[2]
# Do the following while the Finch is not upside down (z value in gees above -0.7)
... | [
"finch.Finch",
"time.sleep"
] | [((163, 170), 'finch.Finch', 'Finch', ([], {}), '()\n', (168, 170), False, 'from finch import Finch\n'), ((549, 559), 'time.sleep', 'sleep', (['(1.0)'], {}), '(1.0)\n', (554, 559), False, 'from time import sleep\n'), ((739, 749), 'time.sleep', 'sleep', (['(1.0)'], {}), '(1.0)\n', (744, 749), False, 'from time import sl... |
"""Definitions and implementations for data-path expressions to query and manipulate (insert, update, delete)."""
from . import urlquote
import copy
from datetime import date
import itertools
import logging
import re
from requests import HTTPError
import warnings
__all__ = ['DataPathException', 'Min', 'Max', 'Sum', '... | [
"logging.getLogger",
"re.match",
"copy.deepcopy",
"warnings.warn",
"re.sub"
] | [((377, 404), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (394, 404), False, 'import logging\n'), ((1940, 1974), 're.sub', 're.sub', (['"""[^_a-zA-Z0-9]"""', '"""_"""', 'name'], {}), "('[^_a-zA-Z0-9]', '_', name)\n", (1946, 1974), False, 'import re\n'), ((646, 738), 'warnings.warn', 'w... |
from readers.base.reader_strategy import ReaderStrategy
import pandas as pd
import io
import json
class ReaderJSON(ReaderStrategy):
def read_file(self, file: io.BytesIO):
json_data = json.loads(file.read())
return json_data
def read_file_as_pandas(self, file):
return pd.read_json(file... | [
"pandas.read_json"
] | [((303, 321), 'pandas.read_json', 'pd.read_json', (['file'], {}), '(file)\n', (315, 321), True, 'import pandas as pd\n')] |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense
from .layers import Encoder, Decoder, GraphConvolution
class VariationalAutoEncoder(Model):
"""Combines the encoder and decoder into an end-to-end model for training."""
def __init__(
self,
or... | [
"tensorflow.keras.layers.Dense",
"tensorflow.exp",
"tensorflow.square"
] | [((1725, 1771), 'tensorflow.keras.layers.Dense', 'Dense', ([], {'units': 'num_classes', 'activation': '"""softmax"""'}), "(units=num_classes, activation='softmax')\n", (1730, 1771), False, 'from tensorflow.keras.layers import Dense\n'), ((975, 992), 'tensorflow.exp', 'tf.exp', (['z_log_var'], {}), '(z_log_var)\n', (981... |
from typing import Any, Dict, List
from model.blocks.delivery import Delivery
from model.blocks.order_creation import OrderCreation
from model.blocks.order_ingest import OrderIngest
from model.blocks.order_material import OrderMaterial
from model.blocks.production import Production
from model.blocks.wait_for_material ... | [
"model.blocks.delivery.Delivery",
"model.blocks.order_material.OrderMaterial",
"model.blocks.production.Production",
"model.blocks.order_creation.OrderCreation",
"model.blocks.wait_for_material.WaitForMaterial",
"model.blocks.order_ingest.OrderIngest",
"model.blocks.wait_for_sop.WaitForSop"
] | [((665, 757), 'model.blocks.order_creation.OrderCreation', 'OrderCreation', (['self.env', '"""customer"""'], {'xy': '(41, 43)', 'ways': "{'ingest': [(59, 43), (117, 43)]}"}), "(self.env, 'customer', xy=(41, 43), ways={'ingest': [(59, 43),\n (117, 43)]})\n", (678, 757), False, 'from model.blocks.order_creation import... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os, sys, requests, json, urllib.parse, random
from argparse import ArgumentParser
from flask import Flask, request, abort
from linebot import LineBotApi, WebhookHandler
from linebot.exceptions import InvalidSignatureError
from linebot.models impo... | [
"json.loads",
"linebot.WebhookHandler",
"random.sample",
"linebot.models.CarouselTemplate",
"argparse.ArgumentParser",
"flask.Flask",
"random.Random",
"flask.request.get_data",
"linebot.LineBotApi",
"requests.get",
"linebot.models.URITemplateAction",
"flask.abort",
"linebot.models.TextSendMe... | [((489, 504), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'from flask import Flask, request, abort\n'), ((521, 572), 'linebot.LineBotApi', 'LineBotApi', (["os.environ['LINE_CHANNEL_ACCESS_TOKEN']"], {}), "(os.environ['LINE_CHANNEL_ACCESS_TOKEN'])\n", (531, 572), False, 'from linebot i... |
from classy_blocks.classes.mesh import Mesh
from classy_blocks.classes.shapes import ExtrudedRing
template_path = None # use default template
def get_mesh():
mesh = Mesh()
pipe_wall = ExtrudedRing(
[0, 0, 0], [2, 2, 0], [-0.707, 0.707, 0], 1.2
)
core_size = 0.1
bl_thickness = 0.005
... | [
"classy_blocks.classes.shapes.ExtrudedRing",
"classy_blocks.classes.mesh.Mesh"
] | [((171, 177), 'classy_blocks.classes.mesh.Mesh', 'Mesh', ([], {}), '()\n', (175, 177), False, 'from classy_blocks.classes.mesh import Mesh\n'), ((195, 254), 'classy_blocks.classes.shapes.ExtrudedRing', 'ExtrudedRing', (['[0, 0, 0]', '[2, 2, 0]', '[-0.707, 0.707, 0]', '(1.2)'], {}), '([0, 0, 0], [2, 2, 0], [-0.707, 0.70... |
#!/usr/bin/env python3
# coding:utf-8
from helper import TreeNode
class Solution:
def TreeDepth(self, pRoot):
if pRoot is None:
return 0
return max(self.TreeDepth(pRoot.left), self.TreeDepth(pRoot.right)) + 1
if __name__ == "__main__":
"""
1
/ \
2 3
... | [
"helper.TreeNode"
] | [((347, 358), 'helper.TreeNode', 'TreeNode', (['(0)'], {}), '(0)\n', (355, 358), False, 'from helper import TreeNode\n'), ((368, 379), 'helper.TreeNode', 'TreeNode', (['(1)'], {}), '(1)\n', (376, 379), False, 'from helper import TreeNode\n'), ((389, 400), 'helper.TreeNode', 'TreeNode', (['(2)'], {}), '(2)\n', (397, 400... |
#coding: utf-8
import logging
import json
import datetime
from django.db import close_connection
from celery.result import AsyncResult
from journalmanager import tasks
from thrift import spec
from scielomanager import connectors
from journalmanager.models import Journal, Issue, Collection, JournalTimeline
from editor... | [
"logging.getLogger",
"journalmanager.models.Issue.objects.filter",
"journalmanager.models.Journal.objects.get",
"thrift.spec.Collection",
"thrift.spec.ServerError",
"thrift.spec.BadRequestError",
"thrift.spec.EditorialBoardMember",
"journalmanager.models.JournalTimeline.objects.filter",
"json.dumps"... | [((424, 451), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (441, 451), False, 'import logging\n'), ((472, 505), 'scielomanager.connectors.ArticleElasticsearch', 'connectors.ArticleElasticsearch', ([], {}), '()\n', (503, 505), False, 'from scielomanager import connectors\n'), ((2182, 226... |
#!/usr/bin/env python
#Copyright (c) 2013, <NAME>
#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, this list of conditi... | [
"xlrd.open_workbook"
] | [((1800, 1850), 'xlrd.open_workbook', 'xlrd.open_workbook', (['filename'], {'formatting_info': '(True)'}), '(filename, formatting_info=True)\n', (1818, 1850), False, 'import xlrd\n')] |
from rply.token import BaseBox
from vython.errors import error, Errors as errors
import sys
class BinaryOp(BaseBox):
def __init__(self, left, right):
self.left = left
self.right = right
if self.right.kind == "string" or self.left.kind == "string":
self.kind = "string"
el... | [
"sys.exit"
] | [((1049, 1060), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1057, 1060), False, 'import sys\n'), ((1752, 1763), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1760, 1763), False, 'import sys\n'), ((2457, 2468), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2465, 2468), False, 'import sys\n'), ((3156, 3167), '... |
# encoding: UTF-8
import sys
sys.path.append("lib") # noqa
from lib.workflow import Workflow3, Workflow, ICON_WARNING
from dictionary import find_definitions
def err(wf, title, subtitle=""):
# type: (Workflow, unicode, unicode) -> int
"""
Show error text and exit
:param wf: Workflow instance
:... | [
"sys.path.append",
"lib.workflow.Workflow3"
] | [((31, 53), 'sys.path.append', 'sys.path.append', (['"""lib"""'], {}), "('lib')\n", (46, 53), False, 'import sys\n'), ((2115, 2126), 'lib.workflow.Workflow3', 'Workflow3', ([], {}), '()\n', (2124, 2126), False, 'from lib.workflow import Workflow3, Workflow, ICON_WARNING\n')] |
from . import views
from rest_framework.routers import SimpleRouter
from django.urls import path
router = SimpleRouter(trailing_slash=False)
router.register('branch', views.BranchViewSet)
router.register('shop', views.ShopViewSet)
# urlpatterns = [
# path('add/', views.ShopCreateAPIView.as_view(), name="create-shop... | [
"rest_framework.routers.SimpleRouter"
] | [((107, 141), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (119, 141), False, 'from rest_framework.routers import SimpleRouter\n')] |
import numpy as np
from envs.focal_point_task_us_env import FocalPointTaskUsEnv
from envs.plane_task_us_env import PlaneTaskUsEnv
from envs.phantom import (
ScatterersPhantom,
Ball,
Teddy
)
from envs.imaging import ImagingSystem, Probe
from envs.generator import (
ConstPhantomGenerator,
ConstProbeGe... | [
"envs.imaging.ImagingSystem",
"envs.generator.ConstProbeGenerator",
"envs.focal_point_task_us_env.FocalPointTaskUsEnv",
"envs.plane_task_us_env.PlaneTaskUsEnv",
"envs.generator.RandomProbeGenerator",
"numpy.array",
"envs.generator.ConstPhantomGenerator"
] | [((443, 624), 'envs.imaging.ImagingSystem', 'ImagingSystem', ([], {'c': '(1540)', 'fs': '(100000000.0)', 'image_width': '(40 / 1000)', 'image_height': '(90 / 1000)', 'image_resolution': '(40, 90)', 'median_filter_size': '(5)', 'dr_threshold': '(-200)', 'dec': '(1)', 'no_lines': '(64)'}), '(c=1540, fs=100000000.0, image... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
#
# requirement.txt 内のファイルのインストール処理
#
def _load_requires_from_file(filepath):
return [pkg_name.rstrip('\n') for pkg_name in open(filepath).readlines()]
def _install_requires():
return _load_requires_from_file('require... | [
"setuptools.find_packages"
] | [((587, 602), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (600, 602), False, 'from setuptools import setup, find_packages\n')] |
import subprocess
import pytest
from pathlib import Path
# ------------------------------------------------------------------------------
testdata = [
('_', 'powerstation_coal_A', '-s'),
('_', 'substation_tx_230kv', '-sl'),
('_', 'pumping_station_testbed', '-s'),
('_', 'potable_water_treatment_plant_A... | [
"pytest.mark.parametrize",
"subprocess.run",
"pytest.main",
"pathlib.Path"
] | [((805, 900), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dir_setup, model_name, run_arg"""', 'testdata'], {'indirect': "['dir_setup']"}), "('dir_setup, model_name, run_arg', testdata,\n indirect=['dir_setup'])\n", (828, 900), False, 'import pytest\n'), ((1525, 1638), 'pytest.mark.parametrize', 'pyte... |
from RPA.Browser.Selenium import Selenium
import datetime
class list_agencies:
def __init__(self):
self.browser = Selenium()
self.browser.open_available_browser("https://itdashboard.gov/")
def _wait_element(self,path):
self.browser.wait_until_element_is_visible(
locator=path... | [
"datetime.timedelta",
"RPA.Browser.Selenium.Selenium"
] | [((126, 136), 'RPA.Browser.Selenium.Selenium', 'Selenium', ([], {}), '()\n', (134, 136), False, 'from RPA.Browser.Selenium import Selenium\n'), ((342, 372), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(60)'}), '(seconds=60)\n', (360, 372), False, 'import datetime\n')] |
# Faça um mini-sistema que utilize o intreractive Help do Python. O usuário vai digitar o comando e o manual vai
# aparecer. Quando o usuário digitar a palavra 'FIM', o programa se encerra. obs: Use cores
def letreiro(msg, tipoFonte='', corFonte='', corFundo=''):
"""
-> Função que moonta um letreiro.
... | [
"time.sleep"
] | [((1267, 1277), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (1272, 1277), False, 'from time import sleep\n'), ((1076, 1084), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (1081, 1084), False, 'from time import sleep\n'), ((1152, 1163), 'time.sleep', 'sleep', (['(0.01)'], {}), '(0.01)\n', (1157, 1163), False, 'f... |
import sys
from time import time
class Progress:
"""
"""
def __init__(self, iterable, size = None, interval = 0.1):
"""
Args:
iterable
size (int): max size of iterable
interval (float): update bar interval second, default is `0.1`
Attrs:
... | [
"sys.stdout.flush",
"time.time",
"sys.stdout.write"
] | [((1654, 1660), 'time.time', 'time', ([], {}), '()\n', (1658, 1660), False, 'from time import time\n'), ((3015, 3037), 'sys.stdout.write', 'sys.stdout.write', (['text'], {}), '(text)\n', (3031, 3037), False, 'import sys\n'), ((3046, 3064), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (3062, 3064), False, '... |
from typing import Optional
from fastapi import APIRouter, Body, Depends
from starlette import status
from app.api.dependencies.database import get_repository
# from app.db.repositories.comments import CommentsRepository
# from app.db.repositories.words import WordsRepository
from app.db.repositories.project1_words i... | [
"app.models.schemas.words.ListOfWordOutWithIdDate",
"fastapi.APIRouter",
"app.api.dependencies.database.get_repository"
] | [((843, 854), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (852, 854), False, 'from fastapi import APIRouter, Body, Depends\n'), ((1280, 1316), 'app.models.schemas.words.ListOfWordOutWithIdDate', 'ListOfWordOutWithIdDate', ([], {'words': 'words'}), '(words=words)\n', (1303, 1316), False, 'from app.models.schemas... |
import json
import jieba
schools=[]
keyword =[]
department =[]
database = {}
for f in open("schools.txt", "r",encoding ='UTF-8'):
schools.append(f.strip('\ufeff').strip('\n').split(' '))
for f in open("keyword.txt", "r",encoding ='UTF-8'):
keyword.append(f.strip('\ufeff').strip('\n').split(' '))
for f in ... | [
"json.load",
"jieba.cut"
] | [((1164, 1190), 'jieba.cut', 'jieba.cut', (['(title + content)'], {}), '(title + content)\n', (1173, 1190), False, 'import jieba\n'), ((489, 509), 'json.load', 'json.load', (['inputdata'], {}), '(inputdata)\n', (498, 509), False, 'import json\n'), ((1645, 1675), 'jieba.cut', 'jieba.cut', (['CommentContent[Com]'], {}), ... |
import numpy as np
from sklearn.neighbors import BallTree
from scipy.spatial.qhull import QhullError
from infomap import Infomap
from scipy.spatial import ConvexHull
from tqdm import tqdm
def pass_func(input, **kwargs):
return input
def query_neighbors(coords, r2, distance_metric='haversine', weighted=False):
... | [
"numpy.radians",
"infomap.Infomap",
"scipy.spatial.ConvexHull",
"numpy.array",
"numpy.zeros",
"sklearn.neighbors.BallTree"
] | [((1117, 1157), 'sklearn.neighbors.BallTree', 'BallTree', (['coords'], {'metric': 'distance_metric'}), '(coords, metric=distance_metric)\n', (1125, 1157), False, 'from sklearn.neighbors import BallTree\n'), ((1857, 1879), 'infomap.Infomap', 'Infomap', (['"""--two-level"""'], {}), "('--two-level')\n", (1864, 1879), Fals... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import torch.nn as nn
import torchvision
from torch.utils.data import DataLoader
import sys
import os
import logging
import time
import itertools
from backbone import EmbedNetwork
from loss import TripletLoss
from triplet_selector import BatchHardTripletSelect... | [
"os.path.exists",
"loss.TripletLoss",
"logger.logger.info",
"os.makedirs",
"torch.utils.data.DataLoader",
"batch_sampler.BatchSampler",
"torch.nn.DataParallel",
"datasets.Market1501.Market1501",
"triplet_selector.BatchHardTripletSelector",
"torch.multiprocessing.set_sharing_strategy",
"time.time... | [((513, 570), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (555, 570), False, 'import torch\n'), ((655, 704), 'logger.logger.info', 'logger.info', (['"""setting up backbone model and loss"""'], {}), "('setting up backbone m... |
"""
Derived module from filehandler.py to handle OpenFOAM files.
"""
import numpy as np
import pygem.filehandler as fh
class OpenFoamHandler(fh.FileHandler):
"""
OpenFOAM mesh file handler class.
:cvar string infile: name of the input file to be processed.
:cvar string outfile: name of the output fil... | [
"numpy.zeros"
] | [((1385, 1414), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n_points, 3)'}), '(shape=(n_points, 3))\n', (1393, 1414), True, 'import numpy as np\n')] |
__all__ = [
'get_summary_mapping',
'generate_summaryxref_files',
'merge_oed_to_mapping',
'write_exposure_summary',
'write_summary_levels',
'write_mapping_file',
]
import io
import json
import os
import warnings
import pandas as pd
from ..utils.coverages import SUPPORTED_COVERAGE_TYPES
from ..... | [
"os.path.exists",
"pandas.read_csv",
"json.dumps",
"os.path.join",
"io.open",
"pandas.Index",
"os.path.basename",
"pandas.DataFrame",
"pandas.concat"
] | [((13097, 13131), 'os.path.join', 'os.path.join', (['target_dir', 'filename'], {}), '(target_dir, filename)\n', (13109, 13131), False, 'import os\n'), ((14921, 14935), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (14933, 14935), True, 'import pandas as pd\n'), ((18476, 18511), 'os.path.join', 'os.path.join', (... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"traceback.format_exc",
"nose.plugins.attrib.attr"
] | [((5048, 5135), 'nose.plugins.attrib.attr', 'attr', (['"""disruptive"""', '"""simulator_only"""'], {'tags': "['advanced']", 'required_hardware': '"""false"""'}), "('disruptive', 'simulator_only', tags=['advanced'], required_hardware=\n 'false')\n", (5052, 5135), False, 'from nose.plugins.attrib import attr\n'), ((58... |
import logging
import re
import threading
from time import sleep
import gatt
from pylgbst.comms import Connection, MOVE_HUB_HW_UUID_SERV, MOVE_HUB_HW_UUID_CHAR, \
MOVE_HUB_HARDWARE_HANDLE
from pylgbst.utilities import str2hex
log = logging.getLogger('comms-gatt')
class CustomDevice(gatt.Device, object):
de... | [
"logging.getLogger",
"pylgbst.utilities.str2hex",
"gatt.DeviceManager",
"gatt.Device.connect",
"gatt.Device.services_resolved",
"gatt.Device.__init__",
"time.sleep",
"re.finditer",
"threading.Thread"
] | [((239, 270), 'logging.getLogger', 'logging.getLogger', (['"""comms-gatt"""'], {}), "('comms-gatt')\n", (256, 270), False, 'import logging\n'), ((368, 436), 'gatt.Device.__init__', 'gatt.Device.__init__', (['self'], {'mac_address': 'mac_address', 'manager': 'manager'}), '(self, mac_address=mac_address, manager=manager)... |
#!/usr/bin/env python
from django.template import Context, Template
out=Template("""
{% load my_filters %}
{{ "<script>alert('danger!')</script>" | my_not_save_filter }}
{{ "<script>alert('danger!')</script>" | my_save_filter }}""").render(Context())
print(out)
| [
"django.template.Template",
"django.template.Context"
] | [((241, 250), 'django.template.Context', 'Context', ([], {}), '()\n', (248, 250), False, 'from django.template import Context, Template\n'), ((73, 243), 'django.template.Template', 'Template', (['"""\n{% load my_filters %}\n{{ "<script>alert(\'danger!\')</script>" | my_not_save_filter }}\n{{ "<script>alert(\'danger!\')... |
# -*- coding: utf-8 -*-
import logging
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from moderation_model_mixin import signals, managers, settings
logger... | [
"logging.getLogger",
"moderation_model_mixin.managers.NotModeratedModerableEntryManager",
"moderation_model_mixin.signals.set_accepted.send",
"django.utils.translation.ugettext_lazy",
"moderation_model_mixin.managers.RejectedModerableEntryManager",
"moderation_model_mixin.managers.NotRejectedModerableEntr... | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n'), ((452, 484), 'moderation_model_mixin.managers.ModerableEntryManager', 'managers.ModerableEntryManager', ([], {}), '()\n', (482, 484), False, 'from moderation_model_mixin import signals, ma... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
avatar = models.CharField(max_length=500)
about = models.CharField(max_length=1000)
... | [
"django.db.models.OneToOneField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((175, 227), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (195, 227), False, 'from django.db import models\n'), ((241, 273), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)'}), '(max_length=500)... |
from ariadne import QueryType
from neo4j_graphql_py import neo4j_graphql
query = QueryType()
@query.field('Movie')
@query.field('MoviesByYear')
def resolve(obj, info, **kwargs):
return neo4j_graphql(obj, info.context, info, **kwargs)
| [
"neo4j_graphql_py.neo4j_graphql",
"ariadne.QueryType"
] | [((82, 93), 'ariadne.QueryType', 'QueryType', ([], {}), '()\n', (91, 93), False, 'from ariadne import QueryType\n'), ((192, 240), 'neo4j_graphql_py.neo4j_graphql', 'neo4j_graphql', (['obj', 'info.context', 'info'], {}), '(obj, info.context, info, **kwargs)\n', (205, 240), False, 'from neo4j_graphql_py import neo4j_grap... |
"""
<NAME>'s solution to the DoJo problem of March 21,2019.
"""
from itertools import chain
def is_word_in_array(word, array):
left_to_right_strings = (''.join(row) for row in array)
top_to_bottom_strings = (''.join(column) for column in zip(*array))
all_strings = chain(left_to_right_strings, top_to_botto... | [
"itertools.chain"
] | [((279, 330), 'itertools.chain', 'chain', (['left_to_right_strings', 'top_to_bottom_strings'], {}), '(left_to_right_strings, top_to_bottom_strings)\n', (284, 330), False, 'from itertools import chain\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('statmaps', '0069_auto_20160509_0907'),
]
operations = [
migrations.RemoveField(
model_name='nidmresults',
... | [
"django.db.migrations.RemoveField",
"django.db.models.BooleanField"
] | [((252, 319), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""nidmresults"""', 'name': '"""provn_file"""'}), "(model_name='nidmresults', name='provn_file')\n", (274, 319), False, 'from django.db import migrations, models\n'), ((479, 512), 'django.db.models.BooleanField', 'models.Bo... |