code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
import argparse
import numpy as np
from .. import zemax, trains, sdb, _utility, agf
from otk.rt2 import rt2_scalar_qt as rt2
def view_zmx():
parser = argparse.ArgumentParser(
description='Load and view a Zemax lens. Glass catalogs are obtained the directory zemax_glass_catalog_dir'
... | [
"otk.rt2.rt2_scalar_qt.Assembly.make",
"numpy.eye",
"otk.rt2.rt2_scalar_qt.view_assembly",
"otk.rt2.rt2_scalar_qt.application",
"argparse.ArgumentParser",
"otk.rt2.rt2_scalar_qt.make_elements",
"sys.exit"
] | [((167, 347), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Load and view a Zemax lens. Glass catalogs are obtained the directory zemax_glass_catalog_dirdefined in the otk configuration file."""'}), "(description=\n 'Load and view a Zemax lens. Glass catalogs are obtained the directo... |
# coding=utf-8
import requests
def get_hitokoto_info():
"""
从『一言』获取信息。(官网:https://hitokoto.cn/)
:return: str,一言。
"""
print('获取一言...')
try:
resp = requests.get('https://v1.hitokoto.cn/', params={'c': 'e', 'encode': 'text'})
if resp.status_code == 200:
return "开心一言:\r... | [
"requests.get"
] | [((180, 256), 'requests.get', 'requests.get', (['"""https://v1.hitokoto.cn/"""'], {'params': "{'c': 'e', 'encode': 'text'}"}), "('https://v1.hitokoto.cn/', params={'c': 'e', 'encode': 'text'})\n", (192, 256), False, 'import requests\n')] |
# Imports
from maze_generator import breadth_first_generation
from PIL import Image
import numpy
def main():
"""
Generates a few new mazes
:return: None
"""
for i in range(5):
breadth_first_generation(name=f'image{i}.jpg')
def astar_algorithm(name):
"""
Algorithm that is based o... | [
"PIL.Image.open",
"numpy.asarray",
"maze_generator.breadth_first_generation"
] | [((414, 430), 'PIL.Image.open', 'Image.open', (['name'], {}), '(name)\n', (424, 430), False, 'from PIL import Image\n'), ((449, 469), 'numpy.asarray', 'numpy.asarray', (['image'], {}), '(image)\n', (462, 469), False, 'import numpy\n'), ((207, 253), 'maze_generator.breadth_first_generation', 'breadth_first_generation', ... |
from PIL import Image
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--file', action='store', type=str, required=True)
parser.add_argument('--gridbuf', action='store', type=int, default=5)
parser.add_argument('--size', action='store', type=int, default=2000)
parser.add_argument('--... | [
"json.load",
"PIL.Image.new",
"PIL.Image.open",
"argparse.ArgumentParser"
] | [((60, 85), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (83, 85), False, 'import argparse\n'), ((419, 431), 'json.load', 'json.load', (['f'], {}), '(f)\n', (428, 431), False, 'import json\n'), ((829, 878), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(osize, osize)', '(255, 255, 255)'], {})... |
import pytest
from zs.bibtex import structures, parser, exceptions
from .helpers import parse_entry, parse_bibliography
def test_article_structure():
"""
The validator should notice missing required and optionally
also probably unsupported fields.
"""
entry = parse_entry("@article{somename, autho... | [
"pytest.fail",
"zs.bibtex.parser.parse_string"
] | [((1897, 2080), 'zs.bibtex.parser.parse_string', 'parser.parse_string', (['"""@article{mm09,\n author = {<NAME>},\n title = {The story of my life},\n year = {2009},\n journal = {Life Journale},\n volume = {1}\n }"""'], {}), '(\n """@article{mm09,\n author = {<NAME>},\n title = {The story of m... |
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import exception
from sysinv.common import utils
from sysinv.openstack.common import log as logging
from sysinv.helm import common
from sysinv.helm import openstack
LOG = lo... | [
"sysinv.openstack.common.log.getLogger",
"sysinv.common.utils.get_vswitch_type",
"sysinv.common.exception.InvalidHelmNamespace"
] | [((318, 345), 'sysinv.openstack.common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (335, 345), True, 'from sysinv.openstack.common import log as logging\n'), ((1444, 1478), 'sysinv.common.utils.get_vswitch_type', 'utils.get_vswitch_type', (['self.dbapi'], {}), '(self.dbapi)\n', (1466, 1478)... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | [
"json.loads",
"os.popen"
] | [((1005, 1024), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1015, 1024), False, 'import json\n'), ((1333, 1352), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1343, 1352), False, 'import json\n'), ((1659, 1678), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1669, 167... |
#!/usr/bin/python
# Standard Library
import argparse
import datetime
import json
import logging
import os
import subprocess
from functools import wraps
# Third Party
import requests
import mixingboard
from chassis.database import db_session
from chassis.models import User, Account, JobHistory, Notification, Token
fro... | [
"logging.getLogger",
"flask.request.args.get",
"flask.request.args.items",
"flask.Flask",
"flask.request.form.items",
"mixingboard.getConf",
"chassis.models.Account",
"chassis.database.db_session.remove",
"logging.info",
"flask.jsonify",
"argparse.ArgumentParser",
"subprocess.Popen",
"functo... | [((512, 573), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run the Quarry server."""'}), "(description='Run the Quarry server.')\n", (535, 573), False, 'import argparse\n'), ((1122, 1149), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1139, 1149), False... |
import os
import sys
import json
from random import randint
import StringIO
import socket
import uuid
import copy
' Test command line usage: python genimporter_solver.py <modulename> <quakeml> <station> <user_conf>'
' scriptpath1="./resources/"+sys.argv[1]+".py '
from specfemGlobeMesher import *
import os
import sys
... | [
"uuid.uuid1",
"json.dumps",
"shutil.copy",
"copy.deepcopy"
] | [((2139, 2215), 'shutil.copy', 'shutil.copy', (["('provout_mesher-' + runid + '_0')", "(os.environ['PROV_PATH'] + '/')"], {}), "('provout_mesher-' + runid + '_0', os.environ['PROV_PATH'] + '/')\n", (2150, 2215), False, 'import shutil\n'), ((2073, 2107), 'json.dumps', 'json.dumps', (["output_gen['metadata']"], {}), "(ou... |
s = 'xyzABC'
print(f'{s} is a valid identifier = {s.isidentifier()}')
s = '0xyz' # identifier can't start with digits 0-9
print(f'{s} is a valid identifier = {s.isidentifier()}')
s = '' # identifier can't be empty string
print(f'{s} is a valid identifier = {s.isidentifier()}')
s = '_xyz'
print(f'{s} is a valid id... | [
"unicodedata.name"
] | [((652, 683), 'unicodedata.name', 'unicodedata.name', (['ch', '"""UNNAMED"""'], {}), "(ch, 'UNNAMED')\n", (668, 683), False, 'import unicodedata\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# 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
# no... | [
"bambou.pushcenter_logger.debug",
"json.dumps",
"threading.Event",
"bambou.pushcenter_logger.info",
"bambou.pushcenter_logger.error",
"time.time"
] | [((2109, 2126), 'threading.Event', 'threading.Event', ([], {}), '()\n', (2124, 2126), False, 'import threading\n'), ((3751, 3847), 'bambou.pushcenter_logger.debug', 'pushcenter_logger.debug', (["('[NURESTPushCenter] Starting push center on url %s ...' % self.url)"], {}), "(\n '[NURESTPushCenter] Starting push center... |
from .errors import NoInfoError
import ipaddress
class IP:
def __init__(self, packet: dict):
self.senderIP = ipaddress.ip_address(packet['ip.src'])
self.receiverIP = ipaddress.ip_address(packet['ip.dst'])
self.senderHost = packet['ip.src_host']
self.receiverHost = packet['ip.ds... | [
"ipaddress.ip_address"
] | [((127, 165), 'ipaddress.ip_address', 'ipaddress.ip_address', (["packet['ip.src']"], {}), "(packet['ip.src'])\n", (147, 165), False, 'import ipaddress\n'), ((192, 230), 'ipaddress.ip_address', 'ipaddress.ip_address', (["packet['ip.dst']"], {}), "(packet['ip.dst'])\n", (212, 230), False, 'import ipaddress\n')] |
import numpy as np
from methods_project_old import MaximumIterationError
from robot_arm import RobotArm
def test_point_outside_outer_circle(lengths, n, plot_initial=True, plot_minimizer=True, animate=False):
print('---- Test with destination outside configuration space ----')
analytical_tests('ooc', lengths, n... | [
"numpy.random.random",
"numpy.delete",
"numpy.argmax",
"robot_arm.RobotArm",
"numpy.sum",
"numpy.zeros",
"numpy.array",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"numpy.save"
] | [((535, 553), 'numpy.argmax', 'np.argmax', (['lengths'], {}), '(lengths)\n', (544, 553), True, 'import numpy as np\n'), ((2543, 2554), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2551, 2554), True, 'import numpy as np\n'), ((2598, 2616), 'numpy.argmax', 'np.argmax', (['lengths'], {}), '(lengths)\n', (2607, 2616),... |
"""Omnilauncher entry point"""
import sys
from resources.lib.log import getLogger
try:
from urllib.parse import parse_qs
except ImportError:
from urlparse import parse_qs
from resources.lib import omnilauncher
from resources.lib import kodiservice
log = getLogger(__name__)
def main():
log.debug(sys.ar... | [
"resources.lib.omnilauncher.Omnilauncher",
"resources.lib.log.getLogger",
"urlparse.parse_qs",
"resources.lib.kodiservice.KodiService"
] | [((266, 285), 'resources.lib.log.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (275, 285), False, 'from resources.lib.log import getLogger\n'), ((387, 412), 'urlparse.parse_qs', 'parse_qs', (['sys.argv[2][1:]'], {}), '(sys.argv[2][1:])\n', (395, 412), False, 'from urlparse import parse_qs\n'), ((492, 523... |
import sys, random, time, pygame
from pygame.locals import *
from Pinyin2Hanzi import DefaultDagParams
from Pinyin2Hanzi import dag
dagparams = DefaultDagParams()
num = 0
flag = 0
x = 300
y = 350
words_list = [['老虎', '狮子', '蛇', '蛤蟆', '老鼠', '蜘蛛'],
['丑', '可爱', '美丽', '凶猛', '勤劳', '警觉'],
['头', ... | [
"Pinyin2Hanzi.DefaultDagParams",
"pygame.event.poll",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.transform.smoothscale",
"pygame.time.Clock",
"time.sleep",
"pygame.key.get_pressed",
"pygame.draw.rect",
"pygame.font.init",
"pygame.display.set_caption"... | [((145, 163), 'Pinyin2Hanzi.DefaultDagParams', 'DefaultDagParams', ([], {}), '()\n', (161, 163), False, 'from Pinyin2Hanzi import DefaultDagParams\n'), ((627, 670), 'pygame.transform.smoothscale', 'pygame.transform.smoothscale', (['long1', '(x, y)'], {}), '(long1, (x, y))\n', (655, 670), False, 'import sys, random, tim... |
from flask import Flask
from pelican_manager import make_app
def test_make_app():
path = 'tests/pelicanconf.py'
app = make_app(path)
assert isinstance(app, Flask)
| [
"pelican_manager.make_app"
] | [((127, 141), 'pelican_manager.make_app', 'make_app', (['path'], {}), '(path)\n', (135, 141), False, 'from pelican_manager import make_app\n')] |
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torchvision import models
from linear_attention_transformer import ImageLinearAttention
class ResnetGenerator(nn.Module):
def __init__(self, input_nc, output_nc, ngf=64, n_blocks=6, img_size=256):
assert(n_blocks >= 0)... | [
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.Sequential",
"torch.nn.ReflectionPad2d",
"torch.sqrt",
"torchvision.models.resnet18",
"torch.sum",
"linear_attention_transformer.ImageLinearAttention",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.mean",
"torch.nn.functional.adaptive_max_pool2d",
... | [((1174, 1187), 'torch.nn.ReLU', 'nn.ReLU', (['(True)'], {}), '(True)\n', (1181, 1187), True, 'import torch.nn as nn\n'), ((1435, 1480), 'torch.nn.Linear', 'nn.Linear', (['(ngf * mult)', '(ngf * mult)'], {'bias': '(False)'}), '(ngf * mult, ngf * mult, bias=False)\n', (1444, 1480), True, 'import torch.nn as nn\n'), ((15... |
from urllib.parse import urljoin
import requests
from adform import exceptions
class Base:
"""Base class for requesting API with ticket. Containst common http methods like GET, POST, PUT, DELETE."""
base_url = "https://api.adform.com"
_ticket = None
body = None
_headers = {'Authorization': 'Bear... | [
"requests.post",
"adform.exceptions.ApiError",
"requests.get",
"requests.delete",
"urllib.parse.urljoin"
] | [((526, 558), 'urllib.parse.urljoin', 'urljoin', (['self.base_url', 'endpoint'], {}), '(self.base_url, endpoint)\n', (533, 558), False, 'from urllib.parse import urljoin\n'), ((578, 618), 'requests.get', 'requests.get', (['url'], {'headers': 'self._headers'}), '(url, headers=self._headers)\n', (590, 618), False, 'impor... |
# ---------------------------------------------------------------------------- #
# Description #
# This file defines entities (or components) in simulators, including: #
# - Event: basic building block in the event-driven simulator that happens ... | [
"collections.namedtuple",
"heapq.heappop",
"heapq.heappush",
"heapq.heapify",
"time.time"
] | [((1205, 1253), 'collections.namedtuple', 'namedtuple', (['"""Event"""', '"""time name added_by kwargs"""'], {}), "('Event', 'time name added_by kwargs')\n", (1215, 1253), False, 'from collections import namedtuple\n'), ((9324, 9343), 'heapq.heapify', 'heapify', (['self.queue'], {}), '(self.queue)\n', (9331, 9343), Fal... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='django_sourcerer',
version='2.1',
author='<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>',
author_email="<EMAIL>",
description="Django app that import and correlating data from external sou... | [
"setuptools.find_packages"
] | [((510, 536), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (534, 536), False, 'import setuptools\n')] |
"""Implements a simple two layer mlp network."""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class MlpNet(nn.Module):
"""Implements a simple fully connected mlp network."""
def __init__(self, sa_dim, n_agents, hidden_size,
agent_id=0, agent_shuffle='none'... | [
"numpy.arange",
"torch.nn.functional.relu",
"torch.nn.Linear",
"torch.cat",
"numpy.random.permutation"
] | [((377, 418), 'torch.nn.Linear', 'nn.Linear', (['(sa_dim * n_agents)', 'hidden_size'], {}), '(sa_dim * n_agents, hidden_size)\n', (386, 418), True, 'import torch.nn as nn\n'), ((438, 473), 'torch.nn.Linear', 'nn.Linear', (['hidden_size', 'hidden_size'], {}), '(hidden_size, hidden_size)\n', (447, 473), True, 'import tor... |
# Modified from https://learn.adafruit.com/simon-game-with-pyruler-and-circuitpython/code-pyruler-with-circuitpython
import os
import board
from digitalio import DigitalInOut, Direction
import time
import touchio
import adafruit_dotstar
import random
leddot = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MO... | [
"time.monotonic",
"touchio.TouchIn",
"time.sleep",
"digitalio.DigitalInOut",
"adafruit_dotstar.DotStar",
"random.randint"
] | [((262, 326), 'adafruit_dotstar.DotStar', 'adafruit_dotstar.DotStar', (['board.APA102_SCK', 'board.APA102_MOSI', '(1)'], {}), '(board.APA102_SCK, board.APA102_MOSI, 1)\n', (286, 326), False, 'import adafruit_dotstar\n'), ((384, 407), 'digitalio.DigitalInOut', 'DigitalInOut', (['board.D13'], {}), '(board.D13)\n', (396, ... |
"""Utility functions used across Myapp"""
from datetime import date, datetime, time, timedelta
import decimal
from email.mime.application import MIMEApplication
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formatdate
... | [
"bleach.clean",
"logging.getLogger",
"sqlalchemy.Table",
"sqlalchemy.Text",
"myapp.utils.dates.datetime_to_epoch",
"logging.exception",
"signal.alarm",
"sqlalchemy.select",
"logging.info",
"logging.error",
"flask.current_app.config.get",
"datetime.datetime",
"flask.flash",
"celery.Celery",... | [((2008, 2047), 'myapp.exceptions.MyappException', 'MyappException', (["('%s is not valid' % key)"], {}), "('%s is not valid' % key)\n", (2022, 2047), False, 'from myapp.exceptions import MyappException, MyappTimeoutException\n'), ((6649, 6720), 'datetime.datetime', 'datetime', (['d.tm_year', 'd.tm_mon', 'd.tm_mday', '... |
#
# -*- coding: utf-8 -*-
#
# Copyright © 2013 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | [
"django.db.models.EmailField",
"M2Crypto.X509.load_request_bio",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"M2Crypto.RSA.load_key_string",
"M2Crypto.EVP.PKey",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1826, 1887), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1024)', 'unique': '(True)', 'db_index': '(True)'}), '(max_length=1024, unique=True, db_index=True)\n', (1842, 1887), False, 'from django.db import models\n'), ((1900, 1995), 'django.db.models.EmailField', 'models.EmailField', ([], {... |
# Importing tensorflow
import tensorflow as tf
# importing the data
from tensorflow.examples.tutorials.mnist import input_data
# Importing some more libraries
import matplotlib.pyplot as plt
from numpy import loadtxt
import numpy as np
from pylab import rcParams
from sklearn import preprocessing
import cv2
i... | [
"matplotlib.pyplot.ylabel",
"math.sqrt",
"numpy.divide",
"matplotlib.pyplot.imshow",
"numpy.mean",
"os.listdir",
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.placeholder",
"numpy.asarray",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.yticks",
"t... | [((1925, 1945), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (1935, 1945), False, 'import os\n'), ((2342, 2361), 'numpy.asarray', 'np.asarray', (['X_train'], {}), '(X_train)\n', (2352, 2361), True, 'import numpy as np\n'), ((3257, 3313), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[... |
# PyVot Python Variational Optimal Transportation
# Author: <NAME> <<EMAIL>>
# Date: April 28th 2020
# Licence: MIT
"""
===============================================================
Area Preserving Map through Optimal Transportation
===============================================================
This demo sh... | [
"vot_numpy.VOTAP",
"matplotlib.pyplot.savefig",
"numpy.random.multivariate_normal",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"matplotlib.pyplot.tight_layout",
"utils.scatter_otsamples",
"os.path.abspath",
"time.time",
"utils.plot_otmap",
"matplotlib.pyplot.... | [((826, 843), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (840, 843), True, 'import numpy as np\n'), ((1151, 1206), 'vot_numpy.VOTAP', 'VOTAP', (['data'], {'sampling': '"""square"""', 'ratio': '(200)', 'verbose': '(True)'}), "(data, sampling='square', ratio=200, verbose=True)\n", (1156, 1206), False,... |
'''
This file contains basic utility functions that you can use.
'''
import binascii
MAX_NUM_CLIENTS = 10
TIME_OUT = 0.5 # 500ms
NUM_OF_RETRANSMISSIONS = 3
CHUNK_SIZE = 1400 # 1400 Bytes
def validate_checksum(message):
'''
Validates Checksum of a message and returns true/false
'''
try:
msg, ch... | [
"binascii.crc32"
] | [((584, 607), 'binascii.crc32', 'binascii.crc32', (['message'], {}), '(message)\n', (598, 607), False, 'import binascii\n')] |
import os
# 数据库配置
MYSQL_HOST = os.getenv('MYSQL_HOST', 'localhost')
MYSQL_PORT = os.getenv('MYSQL_PORT', '3306')
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE', 'my-site')
MYSQL_USER = os.getenv('MYSQL_USER', 'admin')
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', '<PASSWORD>')
# redis配置
REDIS_HOST = os.getenv('REDIS_HOS... | [
"os.getenv"
] | [((33, 69), 'os.getenv', 'os.getenv', (['"""MYSQL_HOST"""', '"""localhost"""'], {}), "('MYSQL_HOST', 'localhost')\n", (42, 69), False, 'import os\n'), ((83, 114), 'os.getenv', 'os.getenv', (['"""MYSQL_PORT"""', '"""3306"""'], {}), "('MYSQL_PORT', '3306')\n", (92, 114), False, 'import os\n'), ((132, 170), 'os.getenv', '... |
import pandas as pd
def resample_and_merge(df_blocks: pd.DataFrame,
df_prices: pd.DataFrame,
dict_params: dict,
freq: str = "5T"):
df = resample(df_blocks, freq, dict_params)
df_prices = resample(df_prices, freq, dict_params)
# we add ... | [
"pandas.concat"
] | [((1461, 1487), 'pandas.concat', 'pd.concat', (['columns'], {'axis': '(1)'}), '(columns, axis=1)\n', (1470, 1487), True, 'import pandas as pd\n')] |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | [
"logging.getLogger",
"otcextensions.common.sdk_utils.get_osc_show_columns_for_sdk_resource",
"otcextensions.i18n._",
"osc_lib.utils.get_item_properties"
] | [((770, 797), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (787, 797), False, 'import logging\n'), ((1057, 1122), 'otcextensions.common.sdk_utils.get_osc_show_columns_for_sdk_resource', 'sdk_utils.get_osc_show_columns_for_sdk_resource', (['item', 'column_map'], {}), '(item, column_map)\... |
"""
Copyright (c) 2015 SONATA-NFV
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | [
"requests.post",
"simplejson.loads",
"simplejson.dumps",
"requests.get",
"requests.delete",
"os.path.dirname",
"requests.put",
"unittest.main",
"unittest.skip"
] | [((1860, 1897), 'unittest.skip', 'unittest.skip', (['"""temporarily disabled"""'], {}), "('temporarily disabled')\n", (1873, 1897), False, 'import unittest\n'), ((71569, 71584), 'unittest.main', 'unittest.main', ([], {}), '()\n', (71582, 71584), False, 'import unittest\n'), ((2700, 2734), 'requests.get', 'requests.get'... |
import os
import json
import datetime as dt
import importlib
from unittest.mock import call
import requests
import dateutil.parser
from werkzeug.exceptions import InternalServerError, NotFound, BadRequest
import pytest
import freezegun
import lazy_import
orion = lazy_import.lazy_module('src.orion')
const = lazy_impor... | [
"json.decoder.JSONDecodeError",
"datetime.datetime.utcnow",
"unittest.mock.call",
"pytest.mark.parametrize",
"lazy_import.lazy_module",
"pytest.raises",
"pytest.mark.usefixtures",
"importlib.reload",
"freezegun.freeze_time"
] | [((265, 301), 'lazy_import.lazy_module', 'lazy_import.lazy_module', (['"""src.orion"""'], {}), "('src.orion')\n", (288, 301), False, 'import lazy_import\n'), ((310, 346), 'lazy_import.lazy_module', 'lazy_import.lazy_module', (['"""src.const"""'], {}), "('src.const')\n", (333, 346), False, 'import lazy_import\n'), ((356... |
import argparse
import datetime as dt
import errno
import glob
import json
import logging
import logging.config
import math
import multiprocessing
import ntpath
import os
import re
import shlex
import shutil
import signal
import subprocess
import time
from functools import wraps
from urllib.error import HTTPError, URLE... | [
"logging.debug",
"zipfile.ZipFile",
"shlex.split",
"multiprocessing.cpu_count",
"shapely.geometry.Point",
"time.sleep",
"signal.alarm",
"shapely.geometry.shape",
"joblib.delayed",
"datetime.timedelta",
"datetime.datetime.today",
"os.strerror",
"logging.info",
"logging.error",
"os.remove"... | [((867, 922), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'parser_description'}), '(description=parser_description)\n', (890, 922), False, 'import argparse\n'), ((3835, 3892), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name__', '"""logging.json"""'], {}), "... |
from neurospyke.classify_cell import classify_cell
from neurospyke.plot_df_utils import D1_D3_scatter_subplots
from neurospyke.query import Query
from neurospyke.utils import concat_dfs_by_index
from neurospyke.utils import load_cell
from neurospyke.utils import load_cells
from neurospyke.utils import reorder_df
fro... | [
"neurospyke.utils.load_cells",
"neurospyke.utils.reorder_df",
"neurospyke.query.Query.create_or_load_from_cache",
"neurospyke.utils.concat_dfs_by_index",
"neurospyke.utils.load_cell",
"neurospyke.plot_df_utils.D1_D3_scatter_subplots",
"neurospyke.classify_cell.classify_cell"
] | [((484, 513), 'neurospyke.utils.load_cells', 'load_cells', (['cell_file_pattern'], {}), '(cell_file_pattern)\n', (494, 513), False, 'from neurospyke.utils import load_cells\n'), ((747, 876), 'neurospyke.query.Query.create_or_load_from_cache', 'Query.create_or_load_from_cache', (['example_cells'], {'response_criteria': ... |
from typing import List
from typing import Tuple
from jsonschema import validate
from pyanalysis.mysql import Conn
from pyanalysis.moment import moment
from pyghostbt.tool.runtime import Runtime
from pyghostbt.tool.asset import Asset
from pyghostbt.tool.indices import Indices
from pyghostbt.tool.param import Param
fro... | [
"pyghostbt.util.get_contract_type",
"pyghostbt.tool.indices.Indices",
"pyghostbt.tool.param.Param",
"pyanalysis.moment.moment.get",
"pyanalysis.mysql.Conn",
"jsonschema.validate",
"pyanalysis.moment.moment.now",
"pyghostbt.util.real_number"
] | [((882, 926), 'jsonschema.validate', 'validate', ([], {'instance': 'kw', 'schema': 'strategy_input'}), '(instance=kw, schema=strategy_input)\n', (890, 926), False, 'from jsonschema import validate\n'), ((2717, 2770), 'jsonschema.validate', 'validate', ([], {'instance': 'instance', 'schema': 'INSTANCE_VALIDATE'}), '(ins... |
import aiounittest
import copy
import pydantic
from app.github.webhook_model import Webhook
data = {
"action": 'renamed',
"pull_request": {
"merged": True
},
"repository": {
"full_name": "organization/project",
"lastName": "p",
"age": 71
},
"changes": {
... | [
"app.github.webhook_model.Webhook",
"copy.deepcopy"
] | [((690, 710), 'copy.deepcopy', 'copy.deepcopy', (['data2'], {}), '(data2)\n', (703, 710), False, 'import copy\n'), ((727, 748), 'app.github.webhook_model.Webhook', 'Webhook', ([], {}), '(**local_data)\n', (734, 748), False, 'from app.github.webhook_model import Webhook\n'), ((910, 930), 'copy.deepcopy', 'copy.deepcopy'... |
# Generated by Django 3.1.7 on 2021-03-09 08:16
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('base', '0001_initial'),
]
operations = [
migrati... | [
"django.db.migrations.RenameModel",
"django.db.migrations.swappable_dependency"
] | [((186, 243), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (217, 243), False, 'from django.db import migrations\n'), ((313, 376), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Pro... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Mantium, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"jsonapi_requests.orm.AttributeField"
] | [((967, 996), 'jsonapi_requests.orm.AttributeField', 'AttributeField', (['"""ai_provider"""'], {}), "('ai_provider')\n", (981, 996), False, 'from jsonapi_requests.orm import ApiModel, AttributeField\n'), ((1011, 1036), 'jsonapi_requests.orm.AttributeField', 'AttributeField', (['"""api_key"""'], {}), "('api_key')\n", (1... |
"""
"""
from cddm.map import k_select
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
#diffusion constant
from examples.paper.one_component.conf import D, DATA_PATH
import os.path as path
SHOW_FITS = True
colors = ["C{}".format(i) for i in range(10)]
def _g1(x,f,a):
"""g... | [
"scipy.optimize.curve_fit",
"numpy.diag",
"cddm.map.k_select",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.isnan",
"matplotlib.pyplot.show"
] | [((1613, 1625), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1623, 1625), True, 'import matplotlib.pyplot as plt\n'), ((2656, 2666), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2664, 2666), True, 'import matplotlib.pyplot as plt\n'), ((1024, 1065), 'cddm.map.k_select', 'k_select', (['y'], {... |
"Reloading Callback Handlers Dynamically"
# reload callback handlers dynamically
from tkinter import *
import radactions # get initial callback handlers
from importlib import reload
class Hello(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)... | [
"radactions.message2",
"radactions.message1",
"importlib.reload"
] | [((594, 612), 'importlib.reload', 'reload', (['radactions'], {}), '(radactions)\n', (600, 612), False, 'from importlib import reload\n'), ((701, 722), 'radactions.message1', 'radactions.message1', ([], {}), '()\n', (720, 722), False, 'import radactions\n'), ((837, 855), 'importlib.reload', 'reload', (['radactions'], {}... |
import requests
from django.shortcuts import render
from django.http import JsonResponse
from .models import Product
from blog.models import Like
def home(requests):
#product = Product.objects.all()
product= Product.objects.all()
context={
'products' : product
}
return render(... | [
"django.shortcuts.render",
"requests.request",
"blog.models.Like.objects.filter",
"requests.GET.get"
] | [((313, 361), 'django.shortcuts.render', 'render', (['requests', '"""products/index.html"""', 'context'], {}), "(requests, 'products/index.html', context)\n", (319, 361), False, 'from django.shortcuts import render\n'), ((405, 437), 'requests.GET.get', 'requests.GET.get', (['"""product_name"""'], {}), "('product_name')... |
import logging
import numpy
from ..common import Event
from .observer import Observer
class ConsoleObserver(Observer):
"""
Basic EvolutionEngine observer which uses logging module to print debug information.
"""
def trigger(self, event):
"""
Print debug information.
:param e... | [
"logging.debug"
] | [((399, 438), 'logging.debug', 'logging.debug', (['"""initialized population"""'], {}), "('initialized population')\n", (412, 438), False, 'import logging\n'), ((933, 969), 'logging.debug', 'logging.debug', (['"""finished processing"""'], {}), "('finished processing')\n", (946, 969), False, 'import logging\n')] |
from netmiko.ssh_dispatcher import ConnectHandler
from netmiko.ssh_autodetect import SSHDetect
from netmiko.ssh_exception import NetMikoTimeoutException
from netmiko.ssh_exception import NetMikoAuthenticationException
from paramiko.ssh_exception import SSHException
from getpass import getpass
#Use this for pas... | [
"netmiko.ssh_autodetect.SSHDetect",
"netmiko.ssh_dispatcher.ConnectHandler",
"getpass.getpass"
] | [((382, 412), 'getpass.getpass', 'getpass', (['"""Enter ssh password:"""'], {}), "('Enter ssh password:')\n", (389, 412), False, 'from getpass import getpass\n'), ((1299, 1326), 'netmiko.ssh_autodetect.SSHDetect', 'SSHDetect', ([], {}), '(**remote_devices)\n', (1308, 1326), False, 'from netmiko.ssh_autodetect import SS... |
from argparse import ArgumentParser
import torch
from benchmark.utils import Timer
from torchtext.functional import to_tensor
from torchtext.models import XLMR_BASE_ENCODER, XLMR_LARGE_ENCODER, ROBERTA_BASE_ENCODER, ROBERTA_LARGE_ENCODER
ENCODERS = {
"xlmr_base": XLMR_BASE_ENCODER,
"xlmr_large": XLMR_LARGE_EN... | [
"torch.no_grad",
"torch.ones_like",
"benchmark.utils.Timer",
"argparse.ArgumentParser"
] | [((1691, 1707), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1705, 1707), False, 'from argparse import ArgumentParser\n'), ((689, 715), 'torch.ones_like', 'torch.ones_like', (['model_out'], {}), '(model_out)\n', (704, 715), False, 'import torch\n'), ((1364, 1396), 'benchmark.utils.Timer', 'Timer', ([... |
import xarray as xr
import numpy as np
import glob
import sys
import dask
from CASutils import averaging_utils as avg
from CASutils import lensread_utils as lens
from CASutils import calendar_utils as cal
import importlib
importlib.reload(lens)
pathout="/project/cas02/islas/SINGLEFORCING/cesm2_le/"
topdir="/project/... | [
"CASutils.calendar_utils.season_ts",
"xarray.concat",
"CASutils.lensread_utils.lens2memnamegen_second50",
"importlib.reload",
"xarray.open_mfdataset",
"glob.glob"
] | [((224, 246), 'importlib.reload', 'importlib.reload', (['lens'], {}), '(lens)\n', (240, 246), False, 'import importlib\n'), ((463, 496), 'CASutils.lensread_utils.lens2memnamegen_second50', 'lens.lens2memnamegen_second50', (['(50)'], {}), '(50)\n', (492, 496), True, 'from CASutils import lensread_utils as lens\n'), ((95... |
import numpy as np
import matplotlib.pyplot as plt
import sys
import pandas as pd
import seaborn as sns
import networkx as nx
import yaml
from networkx.algorithms import approximation as nx_approx
from tqdm.notebook import tqdm
from copy import deepcopy
# Adding path to module
sys.path.append("../")
# picture path
PICS... | [
"contagion.Contagion",
"sys.path.append",
"pandas.DataFrame"
] | [((278, 300), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (293, 300), False, 'import sys\n'), ((607, 627), 'contagion.Contagion', 'Contagion', (['my_config'], {}), '(my_config)\n', (616, 627), False, 'from contagion import Contagion, config\n'), ((654, 688), 'pandas.DataFrame', 'pd.DataFrame... |
import argparse
import os
import re
import yaml
_ENV_EXPAND = {}
def nested_set(dic, keys, value, existed=False):
for key in keys[:-1]:
dic = dic[key]
if existed:
if keys[-1] not in dic:
raise RuntimeError('{} does not exist in the dict'.format(keys[-1]))
value = type(dic[... | [
"os.path.exists",
"argparse.ArgumentParser",
"re.compile",
"os.path.expandvars",
"os.path.join",
"yaml.load",
"os.path.splitext",
"os.path.split"
] | [((5980, 6005), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6003, 6005), False, 'import argparse\n'), ((1250, 1286), 're.compile', 're.compile', (['""".*\\\\$\\\\{([^}^{]+)\\\\}.*"""'], {}), "('.*\\\\$\\\\{([^}^{]+)\\\\}.*')\n", (1260, 1286), False, 'import re\n'), ((1900, 1923), 'os.path.e... |
import argparse
import os
from util import util
from ipdb import set_trace as st
# for gray scal : input_nc, output_nc, ngf, ndf, gpu_ids, batchSize, norm
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
self.init... | [
"os.path.exists",
"os.makedirs",
"argparse.ArgumentParser",
"ipdb.set_trace",
"os.path.join"
] | [((223, 302), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (246, 302), False, 'import argparse\n'), ((4972, 5018), 'os.path.join', 'os.path.join', (['self.opt.savepath', 'self.opt.... |
# Standalone AMR parser
import os
import json
import torch
from transition_amr_parser.model import AMRModel
import transition_amr_parser.utils as utils
from fairseq.models.roberta import RobertaModel
from transition_amr_parser.roberta_utils import extract_features_aligned_to_words
class AMRParser():
def __init_... | [
"torch.hub.load",
"transition_amr_parser.roberta_utils.extract_features_aligned_to_words",
"torch.load",
"torch.stack",
"os.path.join",
"transition_amr_parser.model.AMRModel",
"os.path.isfile",
"os.path.dirname",
"fairseq.models.roberta.RobertaModel.from_pretrained",
"transition_amr_parser.utils.v... | [((1882, 2644), 'transition_amr_parser.model.AMRModel', 'AMRModel', ([], {'oracle_stats': 'oracle_stats', 'embedding_dim': "config['embedding_dim']", 'action_embedding_dim': "config['action_embedding_dim']", 'char_embedding_dim': "config['char_embedding_dim']", 'hidden_dim': "config['hidden_dim']", 'char_hidden_dim': "... |
import numpy as np
import scipy as sc
import matplotlib.pyplot as plt
import pandas as pd
from functions.sub_surrender_profiles import get_risk_drivers, get_age_coeff, get_duration_coeff, get_duration_elapsed_coeff, get_duration_remain_coeff, \
get_prem_freq_coeff, get_prem_annual_c... | [
"numpy.random.rand",
"functions.sub_surrender_profiles.get_time_coeff",
"numpy.log",
"functions.sub_surrender_profiles.get_prem_annual_coeff",
"functions.sub_surrender_profiles.get_age_coeff",
"functions.sub_surrender_profiles.get_risk_drivers",
"numpy.exp",
"numpy.linspace",
"numpy.random.gamma",
... | [((1729, 1746), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1743, 1746), True, 'import numpy as np\n'), ((1758, 1813), 'numpy.random.gamma', 'np.random.gamma', ([], {'shape': '(5.5)', 'scale': '(6.8)', 'size': 'N_contracts'}), '(shape=5.5, scale=6.8, size=N_contracts)\n', (1773, 1813), True, 'import... |
from gym.envs.registration import register
from mjrl.envs.mujoco_env import MujocoEnv
# Swing the door open
register(
id='door-v0',
entry_point='mj_envs.hand_manipulation_suite:DoorEnvV0',
max_episode_steps=200,
)
from mj_envs.hand_manipulation_suite.door_v0 import DoorEnvV0
# Hammer a nail into the board... | [
"gym.envs.registration.register"
] | [((109, 216), 'gym.envs.registration.register', 'register', ([], {'id': '"""door-v0"""', 'entry_point': '"""mj_envs.hand_manipulation_suite:DoorEnvV0"""', 'max_episode_steps': '(200)'}), "(id='door-v0', entry_point=\n 'mj_envs.hand_manipulation_suite:DoorEnvV0', max_episode_steps=200)\n", (117, 216), False, 'from gy... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 30 16:20:13 2021
@author: doudou
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import time # record the time record
import matplotlib.pyplot as plt #draw the diagram
import numpy as np #linear algebra
import datetime
import random
from DSL impo... | [
"torch.nn.Embedding",
"torch.log",
"torch.load",
"sklearn.manifold.TSNE",
"torch.reshape",
"torch.softmax",
"torch.tensor",
"torch.nn.Linear",
"torch.save",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.cla",
"torch.cat",
"torch.nn.GRU"
] | [((11360, 11380), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)'}), '(n_components=2)\n', (11364, 11380), False, 'from sklearn.manifold import TSNE\n'), ((908, 938), 'torch.cat', 'torch.cat', (['(arr1, arr2)'], {'dim': '(0)'}), '((arr1, arr2), dim=0)\n', (917, 938), False, 'import torch\n'), ((10696, 1070... |
import tensorflow as tf
import numpy as np
class TFPositionalEncoding2D(tf.keras.layers.Layer):
def __init__(self, channels:int, return_format:str="pos", dtype=tf.float32):
"""
Args:
channels int: The last dimension of the tensor you want to apply pos emb to.
Keyword Args:
... | [
"tensorflow.tile",
"numpy.ceil",
"tensorflow.shape",
"numpy.float32",
"tensorflow.range",
"tensorflow.einsum",
"tensorflow.concat",
"tensorflow.sin",
"tensorflow.cos",
"numpy.arange"
] | [((1436, 1460), 'tensorflow.range', 'tf.range', (['x'], {'dtype': 'dtype'}), '(x, dtype=dtype)\n', (1444, 1460), True, 'import tensorflow as tf\n'), ((1477, 1501), 'tensorflow.range', 'tf.range', (['y'], {'dtype': 'dtype'}), '(y, dtype=dtype)\n', (1485, 1501), True, 'import tensorflow as tf\n'), ((1531, 1573), 'tensorf... |
#!/usr/bin/env python3
"""
This housekeeping script reads a GFF3 file and writes a new one, adding a 'gene'
row for any RNA feature which doesn't have one. The coordinates of the RNA will
be copied.
The initial use-case here was a GFF file dumped from WebApollo which had this issue.
In this particular use case, the... | [
"biocode.gff.column_9_value",
"argparse.ArgumentParser"
] | [((983, 1070), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Adds gene features for RNAs which lack them"""'}), "(description=\n 'Adds gene features for RNAs which lack them')\n", (1006, 1070), False, 'import argparse\n'), ((1700, 1733), 'biocode.gff.column_9_value', 'gff.column_9_va... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from scuole.core.admin import ReadOnlyAdmin
from .models import State, StateCohorts, StateStats
@admin.register(State)
class StateAdmin(ReadOnlyAdmin):
pass
@admin.register(StateStats)
class Stat... | [
"django.contrib.admin.register"
] | [((216, 237), 'django.contrib.admin.register', 'admin.register', (['State'], {}), '(State)\n', (230, 237), False, 'from django.contrib import admin\n'), ((283, 309), 'django.contrib.admin.register', 'admin.register', (['StateStats'], {}), '(StateStats)\n', (297, 309), False, 'from django.contrib import admin\n'), ((360... |
#! /usr/bin/python3
LICENSE = """\
/* Copyright © 2020, <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, c... | [
"mako.template.Template",
"re.match",
"mako.exceptions.text_error_template",
"sys.exit"
] | [((3473, 4287), 'mako.template.Template', 'Template', (['(LICENSE +\n """\n/* This file is auto-generated via gen/parse_enums.py. DO NOT EDIT */\n\n% for enum in enums.values():\n#[allow(dead_code)]\npub enum ${enum.name()} {\n% for key, value in enum.items():\n #[allow(non_camel_case_types)]\n ${key} = ${valu... |
from google.cloud import bigquery, storage
import json
import pandas as pd
import time
import requests
import os
import datetime
import geojson
import numpy as np
from matplotlib.path import Path
from time import sleep
import yaml
UPDATE_MINS = 60
gs_client = storage.Client()
env = None
_area_params = None
# Downloa... | [
"google.cloud.storage.Client",
"matplotlib.path.Path",
"geojson.Point",
"pandas.Timestamp.utcnow",
"pandas.Timedelta",
"pandas.util.hash_pandas_object",
"requests.get",
"time.sleep",
"pandas.DataFrame",
"time.time",
"google.cloud.bigquery.Client",
"pandas.to_datetime"
] | [((262, 278), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (276, 278), False, 'from google.cloud import bigquery, storage\n'), ((4214, 4232), 'matplotlib.path.Path', 'Path', (['verts', 'codes'], {}), '(verts, codes)\n', (4218, 4232), False, 'from matplotlib.path import Path\n'), ((8168, 8189), 'pa... |
#!/usr/bin/env python
from std_srvs.srv import Trigger, TriggerResponse
import rospy
import subprocess
import rosnode
class NavLauncher(object):
''' Service for restarting the gmapping and move_base nodes for the
hardest setting of VLN evaluation - ensuring an empty map at the
start of each epi... | [
"rospy.logwarn",
"rospy.init_node",
"subprocess.Popen",
"rospy.Service",
"rosnode.kill_nodes",
"rospy.spin",
"std_srvs.srv.TriggerResponse",
"rospy.loginfo"
] | [((940, 988), 'rospy.init_node', 'rospy.init_node', (['"""nav_launcher"""'], {'anonymous': '(False)'}), "('nav_launcher', anonymous=False)\n", (955, 988), False, 'import rospy\n'), ((363, 400), 'rospy.loginfo', 'rospy.loginfo', (['"""Started nav_launcher"""'], {}), "('Started nav_launcher')\n", (376, 400), False, 'impo... |
import numpy as np
import argparse
from MultinomialNBClassifier import multinomial_nb_classifier
from NBClassifier import nb_classifier
from LogisticRegressionClassifer import lr_classifer
from SGDClassifier import sgd_classifier
from Parser import get_vocabulary, bag_of_words, bernoulli
def main():
parser = argp... | [
"Parser.bag_of_words",
"NBClassifier.nb_classifier",
"Parser.bernoulli",
"argparse.ArgumentParser",
"MultinomialNBClassifier.multinomial_nb_classifier",
"numpy.warnings.filterwarnings",
"Parser.get_vocabulary",
"LogisticRegressionClassifer.lr_classifer",
"SGDClassifier.sgd_classifier"
] | [((316, 368), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Instructions:"""'}), "(description='Instructions:')\n", (339, 368), False, 'import argparse\n'), ((1311, 1347), 'Parser.get_vocabulary', 'get_vocabulary', (['args.train_data_path'], {}), '(args.train_data_path)\n', (1325, 1347)... |
#!/usr/bin/python3
import click
import sys
import os
import shutil
import tempfile
import colorama
from .merge3 import merge3
from .output import Diff2OutputDriver
from .file import CSVKeyError
@click.command()
@click.option("-c", "--colour/--nocolour", is_flag = True,
default = None,
h... | [
"click.argument",
"click.option",
"sys.stdout.isatty",
"click.Path",
"os.path.basename",
"sys.exit",
"click.command",
"colorama.init"
] | [((199, 214), 'click.command', 'click.command', ([], {}), '()\n', (212, 214), False, 'import click\n'), ((217, 371), 'click.option', 'click.option', (['"""-c"""', '"""--colour/--nocolour"""'], {'is_flag': '(True)', 'default': 'None', 'help': "('Colourise diffs in output (default is True ' + 'if outputting to a tty)')"}... |
import random
from matplotlib import pyplot as plt
from algorithms import crossover_mutation
import main
# from src.wall import Wall
from model import rooms
from view.gui import GFX
from algorithms.neuralnet import *
from model.robot import Robot
NUM_THREADS = 4
# NUM_THREADS = 1 # Set to 1 to disable multiprocessi... | [
"random.shuffle",
"main.load_population",
"view.gui.GFX",
"algorithms.crossover_mutation.mutation_v1",
"model.robot.Robot",
"multiprocessing.Pool",
"main.load_best_weights",
"matplotlib.pyplot.subplots",
"main.save_population",
"matplotlib.pyplot.show"
] | [((2407, 2435), 'main.load_best_weights', 'main.load_best_weights', (['path'], {}), '(path)\n', (2429, 2435), False, 'import main\n'), ((2723, 2786), 'main.load_population', 'main.load_population', (['WIDTH', 'HEIGHT', 'wall_list', 'load_population'], {}), '(WIDTH, HEIGHT, wall_list, load_population)\n', (2743, 2786), ... |
# -*- coding: utf-8 -*-
"""
:author: Kleon
:url: https://github.com/kleon1024
"""
from datetime import datetime
from enum import Enum
from werkzeug.security import generate_password_hash, check_password_hash
from .extensions import db, whooshee
from .common import merge
import json
DIGEST_LENGTH = 64
COLOR_... | [
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((25888, 25920), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (25910, 25920), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((25980, 26029), 'werkzeug.security.check_password_hash', 'check_password_hash', (['self.pass... |
import requests
from settings import url, IMAGES, DATA
from kivy.core.image import Image
from kivy.uix.dropdown import DropDown
from kivy.uix.slider import Slider
from os.path import join
class BaseDropDown(DropDown):
NAME = None
def __init__(self, *args, **kwargs):
super(BaseDropDown, self).__i... | [
"requests.post",
"os.path.join",
"requests.get",
"requests.delete",
"requests.put"
] | [((964, 1004), 'requests.get', 'requests.get', (['(url + query)'], {'params': 'params'}), '(url + query, params=params)\n', (976, 1004), False, 'import requests\n'), ((1126, 1176), 'requests.post', 'requests.post', (['(url + query)'], {'data': 'data', 'files': 'files'}), '(url + query, data=data, files=files)\n', (1139... |
"""
Configuration for the MyMCAdmin commands and backend.
"""
import json
import os.path
from . import errors
# pylint: disable=too-few-public-methods
class Config(object):
"""
MyMCAdmin's configuration file for controlling things like where server
instances are stored. Config files are stored in each us... | [
"json.load"
] | [((718, 735), 'json.load', 'json.load', (['config'], {}), '(config)\n', (727, 735), False, 'import json\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from crawl_image.run_factory import run_for_url_list
if __name__ == '__main__':
# run()
# run_for_url_list('C:/Users/xh/Desktop/url/1.txt', img_save_path='D:/crawl/image/1', do_last_url_file_name=True)
run_for_url_list('C:/Users/xh/Desktop/url/url.txt', img_sa... | [
"crawl_image.run_factory.run_for_url_list"
] | [((262, 383), 'crawl_image.run_factory.run_for_url_list', 'run_for_url_list', (['"""C:/Users/xh/Desktop/url/url.txt"""'], {'img_save_path': '"""D:/crawl/image/real"""', 'do_last_url_file_name': '(True)'}), "('C:/Users/xh/Desktop/url/url.txt', img_save_path=\n 'D:/crawl/image/real', do_last_url_file_name=True)\n", (2... |
import logging, bottle, json
from WLANderlust.networking import Networking, OutwardNetworkInterface, OutwardTransceiverInterface, tunnel, vpn
from WLANderlust import config
from WLANderlust import CredentialsStore
logger = logging.getLogger(__name__)
@bottle.get('/Networking/settings')
def getConfig():
_config = {... | [
"logging.getLogger",
"bottle.template",
"bottle.request.forms.get",
"WLANderlust.CredentialsStore.getStore",
"WLANderlust.config.get",
"WLANderlust.networking.vpn.impl.getImplementations",
"WLANderlust.networking.Networking.getInstance",
"bottle.post",
"json.dumps",
"bottle.route",
"WLANderlust.... | [((225, 252), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (242, 252), False, 'import logging, bottle, json\n'), ((255, 289), 'bottle.get', 'bottle.get', (['"""/Networking/settings"""'], {}), "('/Networking/settings')\n", (265, 289), False, 'import logging, bottle, json\n'), ((2399, 243... |
"""
Demo: Calculate the kernel matrices on the MUTAG data.
"""
from os import path
from igraph import Graph
from graphkernels import kernels as gk
N_GRAPHS = 188
MUTAG_DIR = 'mutag'
THIS_DIR = path.dirname(__file__)
def gen_mutag_graph_paths():
yield from (
path.join(MUTAG_DIR, ('mutag_%d.graphml' % ... | [
"graphkernels.kernels.CalculateVertexVertexEdgeHistKernel",
"graphkernels.kernels.CalculateGeometricRandomWalkKernel",
"graphkernels.kernels.CalculateEdgeHistKernel",
"graphkernels.kernels.CalculateKStepRandomWalkKernel",
"os.path.join",
"graphkernels.kernels.CalculateVertexEdgeHistKernel",
"graphkernel... | [((198, 220), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (210, 220), False, 'from os import path\n'), ((532, 566), 'graphkernels.kernels.CalculateEdgeHistKernel', 'gk.CalculateEdgeHistKernel', (['graphs'], {}), '(graphs)\n', (558, 566), True, 'from graphkernels import kernels as gk\n'), ((57... |
"""Utility functions."""
import builtins
import os
import shutil
def print_verbose(verbose, *args, **kwargs):
"""
Print the input if verbose is True.
More readable than an if-print statement in nested loops.
"""
if verbose:
builtins.print(*args, **kwargs)
def refresh_directory(dir_name)... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"os.path.join",
"shutil.rmtree",
"builtins.print"
] | [((514, 538), 'os.path.exists', 'os.path.exists', (['dir_name'], {}), '(dir_name)\n', (528, 538), False, 'import os\n'), ((576, 597), 'os.makedirs', 'os.makedirs', (['dir_name'], {}), '(dir_name)\n', (587, 597), False, 'import os\n'), ((255, 286), 'builtins.print', 'builtins.print', (['*args'], {}), '(*args, **kwargs)\... |
# -*- coding: utf-8 -*-
################################################
###### Copyright (c) 2016, <NAME>
###
import numpy as np
import itertools
import time
from .categoryaction import CatObject
class MultQ(object):
def __init__(self,x):
"""Initializes an element of the multiplicative quantale.
... | [
"numpy.unique",
"numpy.sum",
"numpy.array_equal",
"numpy.empty",
"numpy.all"
] | [((11851, 11905), 'numpy.empty', 'np.empty', (['(card_source, card_source)'], {'dtype': 'self.qtype'}), '((card_source, card_source), dtype=self.qtype)\n', (11859, 11905), True, 'import numpy as np\n'), ((12884, 12938), 'numpy.empty', 'np.empty', (['(card_target, card_source)'], {'dtype': 'self.qtype'}), '((card_target... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
# - <NAME>
# <<EMAIL>>, <<EMAIL>>
# - <NAME>
# <<EMAIL>>, <<EMAIL>>
# Language: python2.7
import os
import pandas as pd
import numpy as np
from pkg_resources import resource_filename
from rule_mining.rm.datasets.data_preprocess import (
preprocess_ca... | [
"os.path.exists",
"rule_mining.rm.datasets.data_preprocess.preprocess_categorical_dataset",
"rule_mining.rm.datasets.data_preprocess.preprocess_categorical_continuous_dataset",
"pkg_resources.resource_filename",
"rule_mining.rm.datasets.synthetic_dataset.DecisionTreeSamples",
"os.system",
"rule_mining.r... | [((3393, 3453), 'pkg_resources.resource_filename', 'resource_filename', (['"""rule_mining"""', "('rm/datasets/' + file_name)"], {}), "('rule_mining', 'rm/datasets/' + file_name)\n", (3410, 3453), False, 'from pkg_resources import resource_filename\n'), ((3890, 3966), 'rule_mining.rm.datasets.data_preprocess.preprocess_... |
"""
cs3_file_api.py
CS3 File API for the JupyterLab Extension
Authors:
"""
import http
import time
import grpc
import requests
import cs3.gateway.v1beta1.gateway_api_pb2_grpc as cs3gw_grpc
import cs3.rpc.v1beta1.code_pb2 as cs3code
import cs3.storage.provider.v1beta1.provider_api_pb2 as cs3sp
from cs3api4lab.except... | [
"cs3api4lab.utils.file_utils.FileUtils.get_reference",
"cs3api4lab.logic.storage_logic.StorageLogic",
"grpc.intercept_channel",
"cs3api4lab.auth.channel_connector.ChannelConnector",
"cs3api4lab.utils.model_utils.ModelUtils.convert_container_to_directory_model",
"cs3api4lab.auth.authenticator.Auth.get_auth... | [((1037, 1093), 'cs3api4lab.auth.authenticator.Auth.get_authenticator', 'Auth.get_authenticator', ([], {'config': 'self.config', 'log': 'self.log'}), '(config=self.config, log=self.log)\n', (1059, 1093), False, 'from cs3api4lab.auth.authenticator import Auth\n'), ((1172, 1231), 'cs3api4lab.auth.check_auth_interceptor.C... |
import math
import torch
from torch.autograd import Variable
from dataset import get_train_transform, get_test_transform, get_loader, get_cross_valid_img_list
from dataset import EyeDataset
from utils import plot_figure
def train(net, optimizer, criterion, epoch, trainloader):
net.train()
train_loss = 0
... | [
"dataset.get_test_transform",
"dataset.EyeDataset",
"dataset.get_cross_valid_img_list",
"torch.load",
"dataset.get_train_transform",
"dataset.get_loader",
"torch.utils.data.DataLoader",
"torch.no_grad",
"torch.autograd.Variable",
"utils.plot_figure"
] | [((3754, 3775), 'dataset.get_train_transform', 'get_train_transform', ([], {}), '()\n', (3773, 3775), False, 'from dataset import get_train_transform, get_test_transform, get_loader, get_cross_valid_img_list\n'), ((3791, 3834), 'dataset.EyeDataset', 'EyeDataset', (['train_img_list', 'transform_train'], {}), '(train_img... |
#!/usr/bin/env python
##updating 041121 add the read supporting information
##updation 110520 add the MAF filtration
##updation 110120 add an opt to generate vcf file
##import modules
from Bio import SeqIO
import re
import sys
import subprocess
def generate_sample_list (input_all_sample_list_file):
all_name_list... | [
"re.match",
"Bio.SeqIO.parse"
] | [((953, 992), 'Bio.SeqIO.parse', 'SeqIO.parse', (['input_genome_file', '"""fasta"""'], {}), "(input_genome_file, 'fasta')\n", (964, 992), False, 'from Bio import SeqIO\n'), ((9647, 9681), 're.match', 're.match', (['""".+/(.+)"""', 'genotype_file'], {}), "('.+/(.+)', genotype_file)\n", (9655, 9681), False, 'import re\n'... |
import requests
from lxml import html
from documentscraper.base import ScraperEngineBase
class RequestsScraperEngine(ScraperEngineBase):
def get_page(self, url: str):
response = requests.get(url)
response.raise_for_status()
return html.fromstring(response.content)
def get_element(se... | [
"lxml.html.fromstring",
"requests.get"
] | [((194, 211), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (206, 211), False, 'import requests\n'), ((263, 296), 'lxml.html.fromstring', 'html.fromstring', (['response.content'], {}), '(response.content)\n', (278, 296), False, 'from lxml import html\n')] |
from lex.bots import BaseBot
import time
class PollexyHygieneBot(BaseBot):
def __init__(self, lexbot):
self.bot_name = 'PollexyHygieneBot'
self.lexbot = lexbot
super(PollexyHygieneBot, self).__init__()
def on_fulfilled(self):
print(self.lexbot.last_intent)
if self.lexb... | [
"time.sleep"
] | [((1183, 1197), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (1193, 1197), False, 'import time\n'), ((1375, 1389), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (1385, 1389), False, 'import time\n'), ((1871, 1884), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1881, 1884), False, 'import time\n'... |
from coincurve import PublicKey
from sha3 import keccak_256
import os
f = open("addr.txt", "r")
s=f.read()
while True:
private_key=keccak_256(os.urandom(128)).digest()
public_key = PublicKey.from_valid_secret(private_key).format(compressed=False)[1:]
addr = keccak_256(public_key).digest()[-20:]
addr=add... | [
"sha3.keccak_256",
"os.urandom",
"coincurve.PublicKey.from_valid_secret"
] | [((146, 161), 'os.urandom', 'os.urandom', (['(128)'], {}), '(128)\n', (156, 161), False, 'import os\n'), ((189, 229), 'coincurve.PublicKey.from_valid_secret', 'PublicKey.from_valid_secret', (['private_key'], {}), '(private_key)\n', (216, 229), False, 'from coincurve import PublicKey\n'), ((270, 292), 'sha3.keccak_256',... |
#!/usr/bin/python
from subprocess import check_output, call, CalledProcessError
from re import split as regx_split
import argparse
def main():
args = process_args()
output = check_output(['git', 'status', '--porcelain', '-uno'])
filelist = output.split('\n')
for staged_file in filelist:
if stag... | [
"subprocess.check_output",
"re.split",
"subprocess.call",
"argparse.ArgumentParser"
] | [((183, 237), 'subprocess.check_output', 'check_output', (["['git', 'status', '--porcelain', '-uno']"], {}), "(['git', 'status', '--porcelain', '-uno'])\n", (195, 237), False, 'from subprocess import check_output, call, CalledProcessError\n'), ((494, 542), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'de... |
import hashlib
import os
import csv
def hashID(card):
cardstring = ''.join([x if type(x) is str else ''.join(x) for x in card])
cardID = hashlib.sha256(cardstring.encode('utf-8')).hexdigest()
return cardID
def make_cardHistories(history):
cardDict = {}
for unixtime, cardID, score in history:
... | [
"csv.writer",
"os.path.join"
] | [((845, 878), 'os.path.join', 'os.path.join', (['__file__', '"""content"""'], {}), "(__file__, 'content')\n", (857, 878), False, 'import os\n'), ((894, 928), 'os.path.join', 'os.path.join', (['outputPath', 'fileName'], {}), '(outputPath, fileName)\n', (906, 928), False, 'import os\n'), ((1006, 1026), 'csv.writer', 'csv... |
import numpy as np
def euclidean_dist(x, y):
"""
Returns matrix of pairwise, squared Euclidean distances
"""
norms_1 = (x ** 2).sum(axis=1)
norms_2 = (y ** 2).sum(axis=1)
y = np.transpose(y)
prod = np.dot(x, y)
prod = 2*prod
norms_1 = norms_1.reshape(-1,1)
sum = norms_1 + norms_... | [
"numpy.exp",
"numpy.abs",
"numpy.dot",
"numpy.transpose"
] | [((200, 215), 'numpy.transpose', 'np.transpose', (['y'], {}), '(y)\n', (212, 215), True, 'import numpy as np\n'), ((227, 239), 'numpy.dot', 'np.dot', (['x', 'y'], {}), '(x, y)\n', (233, 239), True, 'import numpy as np\n'), ((358, 369), 'numpy.abs', 'np.abs', (['sum'], {}), '(sum)\n', (364, 369), True, 'import numpy as ... |
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoader
import os
import shutil
from time import time
from utils.logger import *
from utils.datasets import *
from models.selector import *
fro... | [
"os.path.exists",
"os.makedirs",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"os.path.join",
"os.path.isfile",
"torch.nn.functional.log_softmax",
"shutil.rmtree",
"time.time",
"torch.nn.functional.softmax"
] | [((1628, 1739), 'torch.optim.lr_scheduler.CosineAnnealingLR', 'optim.lr_scheduler.CosineAnnealingLR', (['self.optimizer_generator', 'args.total_n_pseudo_batches'], {'last_epoch': '(-1)'}), '(self.optimizer_generator, args.\n total_n_pseudo_batches, last_epoch=-1)\n', (1664, 1739), True, 'import torch.optim as optim\... |
#! /usr/bin/python3
import SnnBase
import Stdp
import DopamineStdp
import random
class TogglePulsar:
def __init__(self, magnitude, frequency):
self.magnitude = magnitude
self.frequency = frequency # not used after construction at present
self.delay = 1.0 / frequency
self.remainin... | [
"SnnBase.Synapse.connect",
"SnnBase.run_simulation",
"DopamineStdp.DopamineStdpSynapse.connect",
"random.random",
"SnnBase.SpikingNeuron"
] | [((5710, 5796), 'SnnBase.SpikingNeuron', 'SnnBase.SpikingNeuron', ([], {'threshold': '(50.0)', 'magnitude': '(50.0)', 'leak_eql': '(0.0)', 'leak_tau': '(0.25)'}), '(threshold=50.0, magnitude=50.0, leak_eql=0.0,\n leak_tau=0.25)\n', (5731, 5796), False, 'import SnnBase\n'), ((5873, 6035), 'DopamineStdp.DopamineStdpSy... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-14 17:48
from __future__ import unicode_literals
from django.db import migrations
import json
from io import open
import os
from gwells.codes import CodeFixture
from wells.models import WaterQualityCharacteristic, WaterQualityColour
def water_quality_c... | [
"os.path.realpath",
"gwells.codes.CodeFixture"
] | [((472, 497), 'gwells.codes.CodeFixture', 'CodeFixture', (['fixture_path'], {}), '(fixture_path)\n', (483, 497), False, 'from gwells.codes import CodeFixture\n'), ((422, 448), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (438, 448), False, 'import os\n')] |
"""
Cyberpunk Configuration Module
"""
import os
from typing import Optional
class CyberpunkConfigException(Exception):
pass
class CyberpunkConfig:
"""Global configuration object for Cyberpunk"""
def __init__(
self,
audio_path: str = "local",
local_storage_base_dir: Optional[st... | [
"os.environ.get"
] | [((3986, 4023), 'os.environ.get', 'os.environ.get', (['"""AUDIO_PATH"""', '"""local"""'], {}), "('AUDIO_PATH', 'local')\n", (4000, 4023), False, 'import os\n'), ((4060, 4113), 'os.environ.get', 'os.environ.get', (['"""LOCAL_STORAGE_BASE_DIR"""', '"""testdata/"""'], {}), "('LOCAL_STORAGE_BASE_DIR', 'testdata/')\n", (407... |
from unittest import mock
def test_init(mocker):
from krux.settings import Settings
s = Settings()
assert isinstance(s, Settings)
def test_store_init(mocker):
from krux.settings import Store, SETTINGS_FILE
cases = [
(None, {}),
("""{"settings":{"network":"test"}}""", {"setting... | [
"unittest.mock.mock_open",
"krux.settings.Store",
"krux.settings.Settings",
"krux.settings.Setting"
] | [((99, 109), 'krux.settings.Settings', 'Settings', ([], {}), '()\n', (107, 109), False, 'from krux.settings import Settings\n'), ((653, 669), 'unittest.mock.mock_open', 'mock.mock_open', ([], {}), '()\n', (667, 669), False, 'from unittest import mock\n'), ((753, 760), 'krux.settings.Store', 'Store', ([], {}), '()\n', (... |
__author__ = "<NAME>"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import matplotlib.pyplot as plt
# RiBuild Modules
from delphin_6_automation.database_interactions import mongo_setup
from delphin_6_au... | [
"delphin_6_automation.database_interactions.mongo_setup.global_end_ssh",
"delphin_6_automation.database_interactions.mongo_setup.global_init",
"delphin_6_automation.backend.result_extraction.filter_db",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"delphin_6_automation... | [((588, 622), 'delphin_6_automation.database_interactions.mongo_setup.global_init', 'mongo_setup.global_init', (['auth_dict'], {}), '(auth_dict)\n', (611, 622), False, 'from delphin_6_automation.database_interactions import mongo_setup\n'), ((1079, 1120), 'delphin_6_automation.backend.result_extraction.filter_db', 'res... |
# Generated by Django 2.1 on 2018-08-14 20:28
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('urlapp', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='url',
name='created_date... | [
"datetime.datetime"
] | [((370, 419), 'datetime.datetime', 'datetime.datetime', (['(2018)', '(8)', '(14)', '(13)', '(28)', '(36)', '(13025)'], {}), '(2018, 8, 14, 13, 28, 36, 13025)\n', (387, 419), False, 'import datetime\n')] |
"""
zoom.services
background services
"""
import logging
import os
import shlex
import subprocess
def run(command, returncode=False, location=None):
"""Run a shell command and return the response as a string
>>> run("echo testing")
'testing\\n'
>>> run("echo testing", location=... | [
"logging.getLogger",
"os.chdir",
"shlex.split",
"os.getcwd"
] | [((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 395), False, 'import logging\n'), ((411, 422), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (420, 422), False, 'import os\n'), ((1069, 1087), 'os.chdir', 'os.chdir', (['save_dir'], {}), '(save_dir)\n', (1077, 1087), False, ... |
import time
import pickle
import os
path = os.path.dirname(os.path.realpath(__file__))
path ="F:/learnning/ai/data"
def backupSave(data,fname):
now = time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time()))
fullName=path+"/trainData/"+fname+"_"+now+".data"
f= open(fullName, 'wb')
pic... | [
"os.path.realpath",
"pickle.load",
"pickle.dump",
"time.time"
] | [((64, 90), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (80, 90), False, 'import os\n'), ((317, 337), 'pickle.dump', 'pickle.dump', (['data', 'f'], {}), '(data, f)\n', (328, 337), False, 'import pickle\n'), ((500, 520), 'pickle.dump', 'pickle.dump', (['data', 'f'], {}), '(data, f)\n', (5... |
from cx_Freeze import setup, Executable
import os
import PySnake
requires_files = ['game_font.ttf', 'game.ico', 'README.md', 'LICENSE.md']
requires = []
with open('requirements.txt', 'r') as file:
requires.extend([row for row in file.read().split('\n') if row != ''])
PYTHON_INSTALL_DIR = os.path.dirname(os.path.... | [
"os.path.dirname",
"os.path.join",
"cx_Freeze.Executable"
] | [((370, 419), 'os.path.join', 'os.path.join', (['PYTHON_INSTALL_DIR', '"""tcl"""', '"""tcl8.6"""'], {}), "(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')\n", (382, 419), False, 'import os\n'), ((447, 495), 'os.path.join', 'os.path.join', (['PYTHON_INSTALL_DIR', '"""tcl"""', '"""tk8.6"""'], {}), "(PYTHON_INSTALL_DIR, 'tcl', 'tk8.... |
#!/usr/bin/python3
import numpy
MOD = 2 ** 16
class RandomGenerator:
def __init__(self, seed):
self.seed = seed
def next(self):
self.seed = (self.seed * 25173 + 13849) % (2 ** 16)
return self.seed
def get_random_vector(generator, size):
return numpy.array([[generator.next()] f... | [
"numpy.dot",
"numpy.zeros",
"numpy.hstack"
] | [((821, 851), 'numpy.zeros', 'numpy.zeros', (['(n, n)'], {'dtype': 'int'}), '((n, n), dtype=int)\n', (832, 851), False, 'import numpy\n'), ((557, 587), 'numpy.dot', 'numpy.dot', (['matrix', 'rand_vector'], {}), '(matrix, rand_vector)\n', (566, 587), False, 'import numpy\n'), ((605, 646), 'numpy.hstack', 'numpy.hstack',... |
import json
import time
from asyncio import Lock
from asyncoss import Auth, Bucket
class Uploader:
def __init__(self, auth: tuple, endpoint: str, bucket: str, oss_prefix: str):
self._auth = Auth(*auth)
self._endpoint = endpoint
self._bucket = bucket
self._oss_prefix = oss_prefix
... | [
"asyncoss.Auth",
"json.dumps",
"asyncoss.Bucket",
"asyncio.Lock",
"time.time"
] | [((205, 216), 'asyncoss.Auth', 'Auth', (['*auth'], {}), '(*auth)\n', (209, 216), False, 'from asyncoss import Auth, Bucket\n'), ((376, 382), 'asyncio.Lock', 'Lock', ([], {}), '()\n', (380, 382), False, 'from asyncio import Lock\n'), ((342, 353), 'time.time', 'time.time', ([], {}), '()\n', (351, 353), False, 'import tim... |
import json
import numpy as np
def to_ndarray(obj, dtype=np.float64):
"""
Greedily and recursively convert the given object to a dtype ndarray.
"""
if isinstance(obj, dict):
for k in obj:
obj[k] = to_ndarray(obj[k])
return obj
elif isinstance(obj, list):
try:
... | [
"json.JSONEncoder.default",
"json.dumps",
"numpy.array",
"copy.deepcopy",
"json.load"
] | [((3452, 3471), 'copy.deepcopy', 'copy.deepcopy', (['data'], {}), '(data)\n', (3465, 3471), False, 'import copy\n'), ((678, 711), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'o'], {}), '(self, o)\n', (702, 711), False, 'import json\n'), ((1468, 1509), 'json.dumps', 'json.dumps', (['o'], {'cls': 'H... |
# testing understanding and use of tf transforms
import rospy
import tf
from geometry_msgs.msg import PointStamped
if __name__ == '__main__':
rospy.init_node('tf_demo')
tfl = tf.TransformListener()
rospy.sleep(1)
a = PointStamped()
while not rospy.is_shutdown():
(trans, rot) = tfl.lookupTr... | [
"rospy.is_shutdown",
"rospy.init_node",
"geometry_msgs.msg.PointStamped",
"rospy.Time",
"tf.TransformListener",
"rospy.sleep"
] | [((147, 173), 'rospy.init_node', 'rospy.init_node', (['"""tf_demo"""'], {}), "('tf_demo')\n", (162, 173), False, 'import rospy\n'), ((184, 206), 'tf.TransformListener', 'tf.TransformListener', ([], {}), '()\n', (204, 206), False, 'import tf\n'), ((211, 225), 'rospy.sleep', 'rospy.sleep', (['(1)'], {}), '(1)\n', (222, 2... |
#!/usr/bin/python
import sys, re
import os.path
import argparse
from dependency_input import Dependency
from operator import itemgetter
PUNCTS=set(['PU', 'PUNCT', '``', ',', ':', '.', "''", '-LRB-', '-RRB-'])
def smart_open(fname, mode = 'r'):
if fname.endswith('.gz'):
import gzip
# Using max comp... | [
"sys.stderr.write",
"dependency_input.Dependency",
"argparse.ArgumentParser",
"gzip.open"
] | [((1240, 1265), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1263, 1265), False, 'import argparse\n'), ((415, 440), 'gzip.open', 'gzip.open', (['fname', 'mode', '(1)'], {}), '(fname, mode, 1)\n', (424, 440), False, 'import gzip\n'), ((2222, 2241), 'dependency_input.Dependency', 'Dependency',... |
import torch
from Utils import *
import torchvision
import math
import numpy as np
import faiss
from Utils import LogText
import clustering
from scipy.optimize import linear_sum_assignment
import imgaug.augmenters as iaa
import imgaug.augmentables.kps
class SuperPoint():
def __init__(self, number_of_clusters, co... | [
"torch.nn.ReLU",
"clustering.preprocess_features",
"numpy.argsort",
"numpy.array",
"faiss.index_cpu_to_gpu",
"scipy.optimize.linear_sum_assignment",
"torch.unsqueeze",
"numpy.sort",
"torchvision.ops.nms",
"faiss.StandardGpuResources",
"clustering.Kmeans",
"torch.nn.PixelShuffle",
"torch.norm... | [((1744, 1767), 'torch.nn.Softmax', 'torch.nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (1760, 1767), False, 'import torch\n'), ((1795, 1819), 'torch.nn.PixelShuffle', 'torch.nn.PixelShuffle', (['(8)'], {}), '(8)\n', (1816, 1819), False, 'import torch\n'), ((1915, 2020), 'Utils.LogText', 'LogText', (['f"""Extraction... |
from my_code import year_100
def test_inc():
assert 2105 == year_100(15)
assert 2120 == year_100(0)
assert 2095 == year_100(25)
| [
"my_code.year_100"
] | [((66, 78), 'my_code.year_100', 'year_100', (['(15)'], {}), '(15)\n', (74, 78), False, 'from my_code import year_100\n'), ((98, 109), 'my_code.year_100', 'year_100', (['(0)'], {}), '(0)\n', (106, 109), False, 'from my_code import year_100\n'), ((129, 141), 'my_code.year_100', 'year_100', (['(25)'], {}), '(25)\n', (137,... |
import nose
import trie
Trie = trie.Trie
def test_trie_101():
t = Trie()
nose.tools.assert_is_instance(t, trie.Trie)
def test_trie_num_entries():
t = Trie()
nose.tools.assert_equal(t.num_entries(), 0)
def test_trie_append():
t = Trie()
t.append("ci", 2)
nose.tools.assert_equal(t.num_e... | [
"nose.tools.assert_is_instance"
] | [((84, 127), 'nose.tools.assert_is_instance', 'nose.tools.assert_is_instance', (['t', 'trie.Trie'], {}), '(t, trie.Trie)\n', (113, 127), False, 'import nose\n')] |
import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StringType, IntegerType
from pyspark.sql.types import TimestampType
HOME = '/usr/local/airflow/spark'
spark = SparkSession.builder.appName('Example').getOrCreate()
schema = StructType() \
.add('uid', IntegerType(), True... | [
"pyspark.sql.types.StructType",
"pyspark.sql.types.IntegerType",
"pyspark.sql.types.TimestampType",
"pyspark.sql.SparkSession.builder.appName",
"pyspark.sql.types.StringType"
] | [((428, 443), 'pyspark.sql.types.TimestampType', 'TimestampType', ([], {}), '()\n', (441, 443), False, 'from pyspark.sql.types import TimestampType\n'), ((206, 245), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""Example"""'], {}), "('Example')\n", (234, 245), False, 'from pyspark.sql... |
import sys, argparse
from driver import InfrastructureConfiguration
class Setup:
def __init__(self):
self.conf = InfrastructureConfiguration()
self.conf_map = {
1: self.conf_nodes,
2: self.conf_packages,
3: self.conf_scripts,
4: self.save_infra,
5: self.show_conf,
6: self.save_conf,
7: sys.... | [
"argparse.ArgumentParser",
"driver.InfrastructureConfiguration"
] | [((3102, 3127), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3125, 3127), False, 'import sys, argparse\n'), ((119, 148), 'driver.InfrastructureConfiguration', 'InfrastructureConfiguration', ([], {}), '()\n', (146, 148), False, 'from driver import InfrastructureConfiguration\n')] |
import datetime
from nose.tools import eq_
from mkt.games.constants import GAME_CATEGORIES
from mkt.games.filters import DailyGamesFilter
from mkt.games.views import DailyGamesView
from mkt.search.tests.test_filters import FilterTestsBase
class TestDailyGamesFilter(FilterTestsBase):
filter_classes = [DailyGames... | [
"datetime.datetime.now",
"nose.tools.eq_"
] | [((939, 1011), 'nose.tools.eq_', 'eq_', (["qs['aggs']['top_hits']['aggs']['first_game']['top_hits']['size']", '(1)'], {}), "(qs['aggs']['top_hits']['aggs']['first_game']['top_hits']['size'], 1)\n", (942, 1011), False, 'from nose.tools import eq_\n'), ((869, 905), 'nose.tools.eq_', 'eq_', (["shoulds[i]['term']['tags']",... |