code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
import numpy
import itertools
from pymatgen.core.lattice import Lattice
from pymatgen.core.operations import SymmOp
from pymatgen.core.structure import Structure
from crystal import fillcell, tikz_atoms
def dfh(single = True, defect = False):
if defect:
single = False
a = 5.43
... | [
"pymatgen.core.structure.Structure",
"itertools.combinations",
"crystal.fillcell",
"numpy.array",
"pymatgen.core.lattice.Lattice",
"numpy.linalg.norm",
"pymatgen.core.operations.SymmOp.from_rotation_and_translation",
"crystal.tikz_atoms"
] | [((1909, 1924), 'crystal.fillcell', 'fillcell', (['atoms'], {}), '(atoms)\n', (1917, 1924), False, 'from crystal import fillcell, tikz_atoms\n'), ((1949, 1983), 'numpy.array', 'numpy.array', (['[0.625, 0.625, 0.625]'], {}), '([0.625, 0.625, 0.625])\n', (1960, 1983), False, 'import numpy\n'), ((2001, 2038), 'itertools.c... |
import logging
def create_app(config=None, testing=False):
from airflow.www_rbac import app as airflow_app
app, appbuilder = airflow_app.create_app(config=config, testing=testing)
# only now we can load view..
# this import might causes circular dependency if placed above
from dbnd_airflow.airfl... | [
"dbnd_airflow.airflow_override.dbnd_aiflow_webserver.use_databand_airflow_dagbag",
"airflow.www_rbac.app.create_app",
"logging.info"
] | [((136, 190), 'airflow.www_rbac.app.create_app', 'airflow_app.create_app', ([], {'config': 'config', 'testing': 'testing'}), '(config=config, testing=testing)\n', (158, 190), True, 'from airflow.www_rbac import app as airflow_app\n'), ((411, 440), 'dbnd_airflow.airflow_override.dbnd_aiflow_webserver.use_databand_airflo... |
# coding: utf-8
"""
@brief test log(time=1s)
"""
import unittest
import pandas
import numpy
from scipy.sparse.linalg import lsqr as sparse_lsqr
from pyquickhelper.pycode import ExtTestCase, ignore_warnings
from pandas_streaming.df import pandas_groupby_nan, numpy_types
class TestPandasHelper(ExtTestCase):
d... | [
"pandas.DataFrame",
"numpy.isnan",
"pandas_streaming.df.numpy_types",
"unittest.main",
"pyquickhelper.pycode.ignore_warnings",
"pandas_streaming.df.pandas_groupby_nan"
] | [((4454, 4482), 'pyquickhelper.pycode.ignore_warnings', 'ignore_warnings', (['UserWarning'], {}), '(UserWarning)\n', (4469, 4482), False, 'from pyquickhelper.pycode import ExtTestCase, ignore_warnings\n'), ((5306, 5321), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5319, 5321), False, 'import unittest\n'), ((27... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classification.tl_classifier import TLCla... | [
"rospy.logerr",
"rospy.Subscriber",
"rospy.logwarn",
"rospy.init_node",
"rospy.get_param",
"scipy.spatial.KDTree",
"std_msgs.msg.Int32",
"yaml.load",
"cv_bridge.CvBridge",
"light_classification.tl_classifier.TLClassifier",
"tf.TransformListener",
"rospy.spin",
"rospy.Publisher"
] | [((480, 510), 'rospy.init_node', 'rospy.init_node', (['"""tl_detector"""'], {}), "('tl_detector')\n", (495, 510), False, 'import rospy\n'), ((675, 735), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {}), "('/current_pose', PoseStamped, self.pose_cb)\n", (691, 735), Fal... |
#Import required Modules:
import pygame
import constants
from paddle import Paddle
from ball import Ball
from score import Score
from text import Text
from screenState import ScreenState
#This function basically executes everything in the "screenState" module's class
def init():
#Initialize all the c... | [
"score.Score",
"screenState.ScreenState",
"text.Text",
"ball.Ball",
"pygame.time.Clock",
"constants.initialize",
"paddle.Paddle"
] | [((344, 366), 'constants.initialize', 'constants.initialize', ([], {}), '()\n', (364, 366), False, 'import constants\n'), ((412, 431), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (429, 431), False, 'import pygame\n'), ((499, 512), 'score.Score', 'Score', (['screen'], {}), '(screen)\n', (504, 512), False... |
import tensorflow as tf
from typing import List
from ..utils.tf_utils import gen_CNN
from ...utils import MODEL
from ..utils.pointnet import pointnet2_utils
class Pointnet2MSG(tf.keras.layers.Layer):
def __init__(
self,
in_channels=6,
use_xyz=True,
SA_config={
... | [
"tensorflow.reduce_sum",
"tensorflow.reduce_max",
"tensorflow.concat",
"tensorflow.reduce_mean",
"tensorflow.expand_dims",
"tensorflow.gather_nd",
"tensorflow.squeeze"
] | [((9439, 9476), 'tensorflow.expand_dims', 'tf.expand_dims', (['new_features'], {'axis': '(-1)'}), '(new_features, axis=-1)\n', (9453, 9476), True, 'import tensorflow as tf\n'), ((9558, 9591), 'tensorflow.squeeze', 'tf.squeeze', (['new_features'], {'axis': '(-1)'}), '(new_features, axis=-1)\n', (9568, 9591), True, 'impo... |
import argparse
import json
from easydict import EasyDict
def get_args():
argparser = argparse.ArgumentParser(description=__doc__)
argparser.add_argument(
'-c', '--config',
metavar='C',
default=None,
help='The Configuration file')
argparser.add_argument(
'-i', '--id... | [
"json.load",
"easydict.EasyDict",
"argparse.ArgumentParser"
] | [((92, 136), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (115, 136), False, 'import argparse\n'), ((969, 990), 'easydict.EasyDict', 'EasyDict', (['config_dict'], {}), '(config_dict)\n', (977, 990), False, 'from easydict import EasyDict\n'), ((872, 8... |
import shutil
import numpy as np
ALL_SYNTHS_LIST = 'synth_imgs.txt'
TRAIN_IMAGES_LIST = 'train_imgs.txt'
VAL_IMAGES_LIST = 'val_imgs.txt'
TEST_IMAGES_LIST = 'test_imgs.txt'
TRAIN_STOP = 342000
VAL_STOP = TRAIN_STOP + 38000
'''
390000 examples : 342000 train and 38000 val (90/10 splits on 380000), 10000 test
'''
wi... | [
"shutil.copy",
"numpy.random.permutation"
] | [((428, 465), 'numpy.random.permutation', 'np.random.permutation', (['files.shape[0]'], {}), '(files.shape[0])\n', (449, 465), True, 'import numpy as np\n'), ((556, 594), 'shutil.copy', 'shutil.copy', (['files[i]', '"""./train_imgs/"""'], {}), "(files[i], './train_imgs/')\n", (567, 594), False, 'import shutil\n'), ((60... |
import importlib
import json
import os
import pdb
import sys
import fnet
import pandas as pd
import tifffile
import numpy as np
from fnet.transforms import normalize
def pearson_loss(x, y):
#x = output
#y = target
vx = x - torch.mean(x)
vy = y - torch.mean(y)
cost = torch.sum(vx * vy) / (torch.sq... | [
"fnet.fnet_model.Model",
"importlib.import_module",
"pandas.read_csv",
"numpy.corrcoef",
"tifffile.imread",
"os.path.join",
"numpy.max",
"numpy.array",
"os.path.isdir",
"numpy.min",
"pandas.concat",
"fnet.transforms.normalize"
] | [((1322, 1339), 'numpy.corrcoef', 'np.corrcoef', (['x', 'y'], {}), '(x, y)\n', (1333, 1339), True, 'import numpy as np\n'), ((1503, 1544), 'importlib.import_module', 'importlib.import_module', (["('fnet.' + module)"], {}), "('fnet.' + module)\n", (1526, 1544), False, 'import importlib\n'), ((1552, 1577), 'os.path.isdir... |
import os
import pandas as pd
import pymongo
import requests
import time
from splinter import Browser
from bs4 import BeautifulSoup
from selenium import webdriver
print(os.path.abspath("chromedriver.exe"))
def init_browser():
executable_path = {"executable_path": os.path.abspath("chromedriver.exe")}
return B... | [
"pandas.DataFrame",
"splinter.Browser",
"time.sleep",
"bs4.BeautifulSoup",
"os.path.abspath"
] | [((170, 205), 'os.path.abspath', 'os.path.abspath', (['"""chromedriver.exe"""'], {}), "('chromedriver.exe')\n", (185, 205), False, 'import os\n'), ((319, 371), 'splinter.Browser', 'Browser', (['"""chrome"""'], {'headless': '(False)'}), "('chrome', **executable_path, headless=False)\n", (326, 371), False, 'from splinter... |
import lyricsgenius
geniustoken = "<KEY>"
genius = lyricsgenius.Genius(geniustoken)
songname = input("")
def lysearch(songname):
import lyricsgenius
geniustoken = "<KEY>"
genius = lyricsgenius.Genius(geniustoken)
songname = songname.split("/")
if len(songname) == 1:
song = genius.s... | [
"lyricsgenius.Genius"
] | [((53, 85), 'lyricsgenius.Genius', 'lyricsgenius.Genius', (['geniustoken'], {}), '(geniustoken)\n', (72, 85), False, 'import lyricsgenius\n'), ((199, 231), 'lyricsgenius.Genius', 'lyricsgenius.Genius', (['geniustoken'], {}), '(geniustoken)\n', (218, 231), False, 'import lyricsgenius\n')] |
import numpy as np
import numpy.random as rand
from functools import reduce
class Network:
def __init__(self, layer_sizes):
# layer_sizes: list of numbers representing number of neurons per layer
# Create a numpy array of biases for each layer except the (first) input layer
self.biases =... | [
"numpy.exp",
"numpy.dot",
"numpy.random.randn"
] | [((322, 338), 'numpy.random.randn', 'rand.randn', (['l', '(1)'], {}), '(l, 1)\n', (332, 338), True, 'import numpy.random as rand\n'), ((539, 555), 'numpy.random.randn', 'rand.randn', (['y', 'x'], {}), '(y, x)\n', (549, 555), True, 'import numpy.random as rand\n'), ((857, 867), 'numpy.exp', 'np.exp', (['(-z)'], {}), '(-... |
import sys
sys.path.append('../') # 新加入的
sys.path.append('.') # 新加入的
from flasgger import Swagger
from flask import Flask
from v1.sum_ab_controller import demo_sum
app = Flask(__name__)
# API 文档的配置
template = {
"swagger": "2.0",
"info": {
"title": "XXX 在线API",
"description": "在线API 调用测试",
"contact":... | [
"flasgger.Swagger",
"sys.path.append",
"flask.Flask"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((42, 62), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (57, 62), False, 'import sys\n'), ((173, 188), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (178, 188), Fals... |
from django.conf.urls import patterns, include, url
from .views import (show_job_submitted, dynamic_input, dynamic_finished,
ogusa_results, dynamic_landing, dynamic_behavioral,
behavior_results, edit_dynamic_behavioral, elastic_results,
dynamic_elasticities, ... | [
"django.conf.urls.url"
] | [((375, 441), 'django.conf.urls.url', 'url', (['"""^results/(?P<pk>\\\\d+)/"""', 'ogusa_results'], {'name': '"""ogusa_results"""'}), "('^results/(?P<pk>\\\\d+)/', ogusa_results, name='ogusa_results')\n", (378, 441), False, 'from django.conf.urls import patterns, include, url\n'), ((447, 509), 'django.conf.urls.url', 'u... |
import collections
import torch
import einops
import cached_property
import padertorch as pt
# loss: torch.Tenso r =None,
# losses: dict =None,
# scalars: dict =None,
# histograms: dict =None,
# audios: dict =None,
# images: dict =None,
class ReviewSummary(collections.abc.Mapping):
"""
>>> review_summary... | [
"matplotlib.pyplot.imshow",
"padertorch.summary.spectrogram_to_image",
"matplotlib.pyplot.grid",
"padertorch.data.batch.example_to_numpy",
"padertorch.summary.mask_to_image",
"torch.isfinite",
"einops.rearrange",
"paderbox.visualization.axes_context",
"paderbox.io.play.play",
"numpy.einsum",
"pa... | [((834, 855), 'torch.isfinite', 'torch.isfinite', (['value'], {}), '(value)\n', (848, 855), False, 'import torch\n'), ((1106, 1156), 'padertorch.data.batch.example_to_numpy', 'pt.data.batch.example_to_numpy', (['value'], {'detach': '(True)'}), '(value, detach=True)\n', (1136, 1156), True, 'import padertorch as pt\n'), ... |
# Generated by Django 2.1.4 on 2019-01-21 03:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.migrations.swappable_dependency",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((434, 527), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=os-command-injection@v1.0 defects=1}
def exec_command_noncompliant():
from paramiko import client
from flask import request
address = request.args.get("address")
cmd = "ping -c 1 %s... | [
"flask.request.args.get",
"paramiko.client.connect",
"paramiko.client.exec_command",
"paramiko.client.SSHClient"
] | [((269, 296), 'flask.request.args.get', 'request.args.get', (['"""address"""'], {}), "('address')\n", (285, 296), False, 'from flask import request\n'), ((345, 363), 'paramiko.client.SSHClient', 'client.SSHClient', ([], {}), '()\n', (361, 363), False, 'from paramiko import client\n'), ((368, 404), 'paramiko.client.conn... |
#!/usr/bin/python
# encoding: utf-8
"""
adobeutils.py
Utilities to enable munki to install/uninstall Adobe CS3/CS4/CS5 products
using the CS3/CS4/CS5 Deployment Toolkits.
"""
# Copyright 2009-2014 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... | [
"re.compile",
"time.sleep",
"munkicommon.log",
"utils.getPIDforProcessName",
"munkicommon.getconsoleuser",
"munkistatus.percent",
"os.walk",
"munkicommon.pref",
"os.path.exists",
"xml.dom.minidom.parse",
"munkicommon.getOsVersion",
"subprocess.Popen",
"munkicommon.getVersionString",
"munki... | [((4930, 4955), 'os.path.basename', 'os.path.basename', (['dmgpath'], {}), '(dmgpath)\n', (4946, 4955), False, 'import os\n'), ((4967, 5129), 'subprocess.Popen', 'subprocess.Popen', (["['/usr/bin/hdiutil', 'attach', dmgpath, '-nobrowse', '-noverify', '-plist']"], {'bufsize': '(-1)', 'stdout': 'subprocess.PIPE', 'stderr... |
import sys, pygame
pygame.init()
world_size = width, height = 10000, 9000
speed = [2, 2]
DX, DY = 0.1, 0.1
position = [width / 2, height / 2]
screen_size = int(DX * width), int(DY * height)
black = 0, 0, 0
screen = pygame.display.set_mode(screen_size)
ball = pygame.image.load("intro_ball.gif")
ballrect = ball.get_r... | [
"pygame.init",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.event.wait",
"sys.exit",
"pygame.image.load",
"pygame.time.set_timer"
] | [((19, 32), 'pygame.init', 'pygame.init', ([], {}), '()\n', (30, 32), False, 'import sys, pygame\n'), ((218, 254), 'pygame.display.set_mode', 'pygame.display.set_mode', (['screen_size'], {}), '(screen_size)\n', (241, 254), False, 'import sys, pygame\n'), ((263, 298), 'pygame.image.load', 'pygame.image.load', (['"""intr... |
# Generated by Django 3.2.5 on 2021-07-04 19:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activities', '0002_rename_currentactivity_currentactivitie'),
]
operations = [
migrations.AlterField(
model_name='currentactivit... | [
"django.db.models.CharField"
] | [((380, 563), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('Optional', 'Optional'), ('Important', 'Important'), ('Very important',\n 'Very important'), ('Critical', 'Critical')]", 'default': '"""None"""', 'max_length': '(25)'}), "(choices=[('Optional', 'Optional'), ('Important',\n 'Import... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Unit tests for the item() utility function.
'''
import unittest
from collector.utilities.item import item
class TestUtilityItem(unittest.TestCase):
'''
Tests for the item() utility function.
'''
def test_item_returns_correct_type(self):
'''
Tests that the... | [
"collector.utilities.item.item"
] | [((390, 404), 'collector.utilities.item.item', 'item', (['"""bullet"""'], {}), "('bullet')\n", (394, 404), False, 'from collector.utilities.item import item\n')] |
# flake8: noqa
import json
import time
import requests
from django.conf import settings
from websocket import create_connection
from open.core.scripts.swarm_ml_services import get_random_prompt
from open.core.writeup.constants import TEXT_GENERATION_URL
"""
this script's design was to compare performance behind djan... | [
"open.core.scripts.swarm_ml_services.get_random_prompt",
"requests.post",
"json.dumps",
"websocket.create_connection",
"time.time"
] | [((797, 819), 'websocket.create_connection', 'create_connection', (['url'], {}), '(url)\n', (814, 819), False, 'from websocket import create_connection\n'), ((833, 844), 'time.time', 'time.time', ([], {}), '()\n', (842, 844), False, 'import time\n'), ((1027, 1038), 'time.time', 'time.time', ([], {}), '()\n', (1036, 103... |
import http.client, urllib.request, urllib.parse, urllib.error, base64, time, json, ast, datetime, math, keys
import logging
logging.basicConfig(filename='io.log', level=logging.INFO, format='%(asctime)s %(message)s')
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': keys.OCP_APIM_SUBSCRIPTION_KEY,
... | [
"logging.basicConfig",
"datetime.datetime.now",
"logging.info",
"time.sleep"
] | [((127, 224), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""io.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s %(message)s"""'}), "(filename='io.log', level=logging.INFO, format=\n '%(asctime)s %(message)s')\n", (146, 224), False, 'import logging\n'), ((901, 938), 'logging.info', 'l... |
import time
import random
def main():
print("You are trying to find your way to the centre of a maze where there is a pot of gold!")
time.sleep(2)
print("What you don't know is that this is a dangerous maze with traps and hazards.")
time.sleep(2)
start = input ("Do you want to enter the maze? (... | [
"random.choice",
"time.sleep"
] | [((146, 159), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (156, 159), False, 'import time\n'), ((254, 267), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (264, 267), False, 'import time\n'), ((486, 499), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (496, 499), False, 'import time\n'), ((586, 599), ... |
import os
from PyQt5 import QtWidgets
from .qtd import Ui_MainWindow
from version import __version__
from utils import SpinBoxFixStyle
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
Main window
"""
def __init__(self, parent=None):
# initialization of the superclass
super(... | [
"utils.SpinBoxFixStyle"
] | [((823, 840), 'utils.SpinBoxFixStyle', 'SpinBoxFixStyle', ([], {}), '()\n', (838, 840), False, 'from utils import SpinBoxFixStyle\n'), ((954, 971), 'utils.SpinBoxFixStyle', 'SpinBoxFixStyle', ([], {}), '()\n', (969, 971), False, 'from utils import SpinBoxFixStyle\n'), ((1085, 1102), 'utils.SpinBoxFixStyle', 'SpinBoxFix... |
# Python3
from solution1 import arrayReplace as f
qa = [
([1, 2, 1], 1, 3,
[3, 2, 3]),
([1, 2, 3, 4, 5], 3, 0,
[1, 2, 0, 4, 5]),
([1, 1, 1], 1, 10,
[10, 10, 10]),
([1, 2, 1, 2, 1], 2, 1,
[1, 1, 1, 1, 1]),
([1, 2, 1, 2, 1], 2, 2,
[1, 2, 1, 2, 1]),
([3, 1], 3, 9,
[9... | [
"solution1.arrayReplace"
] | [((434, 439), 'solution1.arrayReplace', 'f', (['*q'], {}), '(*q)\n', (435, 439), True, 'from solution1 import arrayReplace as f\n')] |
from avatar2 import *
import sys
import os
import logging
import serial
import time
import argparse
import pyudev
import struct
import ctypes
from random import randint
# For profiling
import pstats
logging.basicConfig(filename='/tmp/inception-tests.log', level=logging.INFO)
# ************************************... | [
"logging.basicConfig",
"ctypes.create_string_buffer",
"time.time",
"random.randint",
"struct.unpack_from"
] | [((203, 279), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""/tmp/inception-tests.log"""', 'level': 'logging.INFO'}), "(filename='/tmp/inception-tests.log', level=logging.INFO)\n", (222, 279), False, 'import logging\n'), ((1534, 1571), 'ctypes.create_string_buffer', 'ctypes.create_string_buffer', (... |
from django.conf.urls import include, url
urlpatterns = [
url(r'^admin/(?P<slug>[\w\-]+)/', 'posts.views.post_preview', name='post_preview'),
url(r'^tag/(?P<slug>[\w\-]+)/', 'posts.views.posts_view_tag', name='posts_tag'),
url(r'^popular/', 'posts.views.posts_view_popular', name='posts_popular'),
url(r... | [
"django.conf.urls.url"
] | [((63, 151), 'django.conf.urls.url', 'url', (['"""^admin/(?P<slug>[\\\\w\\\\-]+)/"""', '"""posts.views.post_preview"""'], {'name': '"""post_preview"""'}), "('^admin/(?P<slug>[\\\\w\\\\-]+)/', 'posts.views.post_preview', name=\n 'post_preview')\n", (66, 151), False, 'from django.conf.urls import include, url\n'), ((1... |
from hlt.positionals import Position, Direction
from hlt import constants
import random
import logging
# Import my stuff
import helpers
def navigate_old(ship, destination, game_map):
curr_pos = ship.position
move_cost = game_map[curr_pos].halite_amount/constants.MOVE_COST_RATIO
if ship.halite_amount >=... | [
"random.choice",
"helpers.closest_most_dense_spot",
"random.shuffle",
"hlt.positionals.Direction.get_all_cardinals",
"hlt.positionals.Position",
"helpers.closest_drop",
"helpers.closest_dense_spot",
"helpers.get_spaces_in_region",
"logging.info"
] | [((666, 704), 'logging.info', 'logging.info', (['"""destination normalized"""'], {}), "('destination normalized')\n", (678, 704), False, 'import logging\n'), ((4722, 4784), 'logging.info', 'logging.info', (['"""group_navigate: There is more than zero ships."""'], {}), "('group_navigate: There is more than zero ships.')... |
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.svm import SVR
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import HuberRegressor
import numpy as np
import pickle
from dataloader import HeadlineDataset
from csv import writer
import os, subprocess
im... | [
"subprocess.run",
"dataloader.HeadlineDataset",
"csv.writer",
"pickle.load",
"sklearn.metrics.mean_squared_error",
"collections.Counter",
"os.chdir",
"numpy.array",
"sklearn.ensemble.GradientBoostingRegressor"
] | [((1300, 1309), 'collections.Counter', 'Counter', ([], {}), '()\n', (1307, 1309), False, 'from collections import Counter\n'), ((1366, 1388), 'dataloader.HeadlineDataset', 'HeadlineDataset', (['"""dev"""'], {}), "('dev')\n", (1381, 1388), False, 'from dataloader import HeadlineDataset\n'), ((1405, 1432), 'dataloader.He... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from typing import Iterable
from pants.backend.swift.target_types import SWIFT_FILE_EXTENSIONS, SwiftSourcesGenerator... | [
"dataclasses.dataclass",
"pants.engine.unions.UnionRule",
"pants.engine.rules.rule",
"pants.engine.rules.collect_rules",
"pants.core.goals.tailor.PutativeTargets",
"pants.core.goals.tailor.group_by_dir"
] | [((750, 772), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (759, 772), False, 'from dataclasses import dataclass\n'), ((1100, 1178), 'pants.engine.rules.rule', 'rule', ([], {'level': 'LogLevel.DEBUG', 'desc': '"""Determine candidate Swift targets to create"""'}), "(level=LogLevel... |
import json
import requests
import time
from flask import Flask, render_template, request
app = Flask(__name__)
API_KEY='<insert_api_key_here>'
@app.route('/')
def index():
background, style, message = setParams()
return render_template('index.html', background=background, style=style, message=message)
#fun... | [
"flask.render_template",
"time.time",
"requests.get",
"flask.Flask"
] | [((97, 112), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (102, 112), False, 'from flask import Flask, render_template, request\n'), ((232, 319), 'flask.render_template', 'render_template', (['"""index.html"""'], {'background': 'background', 'style': 'style', 'message': 'message'}), "('index.html', backg... |
import torch
def magic_box(x):
"""DiCE operation that saves computation graph inside tensor
See ``Implementation of DiCE'' section in the DiCE Paper for details
Args:
x (tensor): Input tensor
Returns:
1 (tensor): Tensor that has computation graph saved
References:
https://g... | [
"torch.stack",
"torch.cumsum"
] | [((1475, 1501), 'torch.stack', 'torch.stack', (['reward'], {'dim': '(1)'}), '(reward, dim=1)\n', (1486, 1501), False, 'import torch\n'), ((1983, 2015), 'torch.cumsum', 'torch.cumsum', (['logprob_sum'], {'dim': '(1)'}), '(logprob_sum, dim=1)\n', (1995, 2015), False, 'import torch\n'), ((2044, 2081), 'torch.stack', 'torc... |
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
import numpy as np
freq = {}
def read_file(filename='corpora.txt'):
f = open(filename, "r", encoding="utf-8")
for character in f.read():
if (character in freq):
freq[character] += 1
... | [
"matplotlib.font_manager.createFontList",
"matplotlib.pyplot.ylabel",
"matplotlib.font_manager.FontProperties",
"matplotlib.font_manager.findSystemFonts",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.xlabel",
"matplotlib.font_manager.fontManager.ttflist.extend",
"matplotlib.pyplot.subplots",
... | [((915, 945), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(40, 20)'}), '(figsize=(40, 20))\n', (927, 945), True, 'import matplotlib.pyplot as plt\n'), ((957, 997), 'matplotlib.font_manager.FontProperties', 'fm.FontProperties', ([], {'fname': '"""kalpurush.ttf"""'}), "(fname='kalpurush.ttf')\n", (974... |
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import os
import tempfile
from zipfile import ZipFile
'''
Generates a document in markdown format summrizing the coverage of serialized
testing. The document lives in
`caffe2/python/serialized_test/SerializedTestCoverage.m... | [
"os.listdir",
"zipfile.ZipFile",
"os.path.join",
"os.path.isfile",
"tempfile.mkdtemp",
"caffe2.python.core._GetRegisteredOperators",
"caffe2.proto.caffe2_pb2.OperatorDef"
] | [((2435, 2465), 'caffe2.python.core._GetRegisteredOperators', 'core._GetRegisteredOperators', ([], {}), '()\n', (2463, 2465), False, 'from caffe2.python import core, workspace\n'), ((3040, 3062), 'os.listdir', 'os.listdir', (['source_dir'], {}), '(source_dir)\n', (3050, 3062), False, 'import os\n'), ((2922, 2946), 'caf... |
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
"""
This module contains useful fudge math routines that do not fit into any other module.
"""
from pqu import PQU
from fudg... | [
"brownies.legacy.endl.endl2dmathClasses.endl2dmath",
"numpy.float64",
"fudge.core.utilities.brb.getType",
"brownies.legacy.endl.endl3dmathClasses.endl3dmath"
] | [((390, 408), 'numpy.float64', 'numpy.float64', (['(1.0)'], {}), '(1.0)\n', (403, 408), False, 'import numpy\n'), ((902, 1001), 'brownies.legacy.endl.endl3dmathClasses.endl3dmath', 'endl3dmathClasses.endl3dmath', (['d3'], {'xLabel': 'xLabel', 'yLabel': 'yLabel', 'zLabel': 'zLabel', 'checkDataType': '(0)'}), '(d3, xLabe... |
#!/usr/bin/env python3
import os
import time
import shutil
import signal
import yaml
import sass
import pyinotify
from colorama import init, Fore, Style
from jsmin import jsmin
from csscompressor import compress
VERSION = '1.4.7'
class Kyk(object):
"""Kyk
Build JS
- if min: minify in place, append _m... | [
"signal.signal",
"csscompressor.compress",
"os.path.join",
"yaml.load",
"signal.pause",
"time.sleep",
"os.path.isfile",
"os.path.basename",
"shutil.copy",
"sass.compile",
"os.path.abspath",
"pyinotify.ThreadedNotifier",
"pyinotify.WatchManager",
"time.time",
"colorama.init"
] | [((585, 591), 'colorama.init', 'init', ([], {}), '()\n', (589, 591), False, 'from colorama import init, Fore, Style\n'), ((628, 671), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'self.teardown'], {}), '(signal.SIGINT, self.teardown)\n', (641, 671), False, 'import signal\n'), ((1312, 1326), 'yaml.load', 'yaml.l... |
import os
import sys
import argparse
_version_ = '0.0.1'
class scaffold():
result = []
def new_project(self):
if os.path.exists(self.result.project):
print("project has been existed")
exit(1)
os.mkdir(self.result.project)
os.chdir(self.result.project)
... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"os.chdir",
"os.rmdir",
"os.path.isdir",
"os.mkdir",
"os.system"
] | [((133, 168), 'os.path.exists', 'os.path.exists', (['self.result.project'], {}), '(self.result.project)\n', (147, 168), False, 'import os\n'), ((244, 273), 'os.mkdir', 'os.mkdir', (['self.result.project'], {}), '(self.result.project)\n', (252, 273), False, 'import os\n'), ((282, 311), 'os.chdir', 'os.chdir', (['self.re... |
import keras
import random
import numpy as np
from glob import glob
from keras.models import Model
from keras.utils import np_utils
from keras.models import load_model
import matplotlib.pyplot as plt
import os
import keras.backend as K
import tensorflow as tf
from keras.utils import to_categorical
from tqdm import tqdm... | [
"numpy.ptp",
"keras.backend.gradients",
"keras.utils.to_categorical",
"sys.path.append",
"keras.layers.core.K.set_learning_phase",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.empty",
"matplotlib.pyplot.yticks",
"glob.glob",
"numpy.abs",
"matplotlib.pyplot.xticks",
"numpy.argmax",
"mat... | [((332, 353), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (347, 353), False, 'import sys\n'), ((8210, 8464), 'keras.models.load_model', 'load_model', (['"""/home/parth/Interpretable_ML/saved_models/SimUnet/model_lrsch.hdf5"""'], {'custom_objects': "{'gen_dice_loss': gen_dice_loss, 'dice_whole_... |
import json
from collections import OrderedDict
def json_file(filename, converter):
with open(filename, 'r') as file:
raw = json.load(
file,
object_pairs_hook=OrderedDict # to insure that order of items in json won't be broken
)
return converter(raw)
| [
"json.load"
] | [((138, 184), 'json.load', 'json.load', (['file'], {'object_pairs_hook': 'OrderedDict'}), '(file, object_pairs_hook=OrderedDict)\n', (147, 184), False, 'import json\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# board.py
# Author: <NAME> <<EMAIL>>
# Version: 0.1
# License: MIT
"""Import modules"""
from random import sample
class Board:
"""board object which regroup the coordinates of the game's elements
(walls, start, end, guard, components...)"""
def __init__... | [
"random.sample"
] | [((1759, 1784), 'random.sample', 'sample', (['self.corridors', '(3)'], {}), '(self.corridors, 3)\n', (1765, 1784), False, 'from random import sample\n')] |
"""
tests.test_parser
~~~~~~~~~~~~~~~~~
Parser tests for Drowsy.
"""
# :copyright: (c) 2016-2020 by <NAME> and contributors.
# See AUTHORS for more details.
# :license: MIT - See LICENSE for more details.
from marshmallow import fields
from marshmallow.exceptions import ValidationError
from dr... | [
"tests.schemas.CustomerSchema",
"tests.schemas.AlbumCamelSchema",
"tests.schemas.TrackPermissionsSchema",
"tests.schemas.ArtistSchema",
"tests.schemas.AlbumSchema",
"drowsy.schema.NestedOpts",
"tests.schemas.TrackSchema",
"tests.models.Track",
"pytest.raises",
"tests.models.Album",
"drowsy.conve... | [((1102, 1115), 'tests.schemas.AlbumSchema', 'AlbumSchema', ([], {}), '()\n', (1113, 1115), False, 'from tests.schemas import AlbumSchema, AlbumCamelSchema, ArtistSchema, CustomerSchema, TrackPermissionsSchema, TrackSchema\n'), ((2453, 2477), 'drowsy.convert.ModelResourceConverter', 'ModelResourceConverter', ([], {}), ... |
from distutils.core import setup
setup(
name='RL-EmsPy',
version='0.0.1',
packages=['emspy'],
url='https://github.com/mechyai/RL-EmsPy',
license='Apache License 2.0',
author='<NAME>',
)
| [
"distutils.core.setup"
] | [((34, 192), 'distutils.core.setup', 'setup', ([], {'name': '"""RL-EmsPy"""', 'version': '"""0.0.1"""', 'packages': "['emspy']", 'url': '"""https://github.com/mechyai/RL-EmsPy"""', 'license': '"""Apache License 2.0"""', 'author': '"""<NAME>"""'}), "(name='RL-EmsPy', version='0.0.1', packages=['emspy'], url=\n 'https... |
import os
from cv2 import cv2
for d in os.listdir():
if not d.endswith(".png"): continue
img = cv2.imread(d)
cv2.imwrite(d.replace(".png",".webp"), img)
os.remove(d) | [
"cv2.cv2.imread",
"os.listdir",
"os.remove"
] | [((40, 52), 'os.listdir', 'os.listdir', ([], {}), '()\n', (50, 52), False, 'import os\n'), ((98, 111), 'cv2.cv2.imread', 'cv2.imread', (['d'], {}), '(d)\n', (108, 111), False, 'from cv2 import cv2\n'), ((158, 170), 'os.remove', 'os.remove', (['d'], {}), '(d)\n', (167, 170), False, 'import os\n')] |
"""
NLTK DRT module extended with presuppositions
"""
__author__ = "<NAME>, <NAME>, <NAME>"
__version__ = "1.0"
__date__ = "Tue, 24 Aug 2010"
import re
import operator
from nltk.sem.logic import Variable
from nltk.sem.logic import EqualityExpression, ApplicationExpression, ExistsExpression, AndExpression
from nltk... | [
"nltk.sem.logic.ParseException",
"nltk.sem.drt.DrtBooleanExpression.simplify",
"re.match",
"nltk.sem.logic.Variable",
"nltk.sem.logic.is_eventvar",
"nltk.sem.logic._counter.get",
"nltk.sem.logic.is_funcvar",
"nltk.sem.drt.DrtParser.handle_DRS",
"nltk.sem.drt.DrtParser.handle",
"nltk.sem.drt.Anapho... | [((1392, 1430), 're.match', 're.match', (['"""^[a-df-mo-ru-z]\\\\d*$"""', 'expr'], {}), "('^[a-df-mo-ru-z]\\\\d*$', expr)\n", (1400, 1430), False, 'import re\n'), ((1788, 1816), 're.match', 're.match', (['"""^[tn]\\\\d*$"""', 'expr'], {}), "('^[tn]\\\\d*$', expr)\n", (1796, 1816), False, 'import re\n'), ((2121, 2146), ... |
from openem.models import ImageModel
from openem.models import Preprocessor
import cv2
import numpy as np
import tensorflow as tf
from collections import namedtuple
import csv
Detection=namedtuple('Detection', ['location',
'confidence',
'species',... | [
"collections.namedtuple",
"csv.DictReader"
] | [((189, 276), 'collections.namedtuple', 'namedtuple', (['"""Detection"""', "['location', 'confidence', 'species', 'frame', 'video_id']"], {}), "('Detection', ['location', 'confidence', 'species', 'frame',\n 'video_id'])\n", (199, 276), False, 'from collections import namedtuple\n'), ((631, 655), 'csv.DictReader', 'c... |
# -*- coding: utf-8 -*-
import asyncio
import datetime
import importlib
import io
import json
import logging
import os
import platform
import re
import subprocess
import sys
import textwrap
import traceback
from contextlib import redirect_stderr, redirect_stdout
from functools import partial
from glob i... | [
"logging.getLogger",
"aioconsole.ainput",
"logging.StreamHandler",
"re.compile",
"aiofiles.open",
"contextlib.redirect_stderr",
"sys.exit",
"datetime.timedelta",
"os.remove",
"re.search",
"textwrap.indent",
"aiofiles.os.remove",
"json.dumps",
"os.execv",
"asyncio.sleep",
"asyncio.gathe... | [((1363, 1397), 'importlib.import_module', 'importlib.import_module', (['"""discord"""'], {}), "('discord')\n", (1386, 1397), False, 'import importlib\n'), ((1412, 1449), 'importlib.import_module', 'importlib.import_module', (['"""fortnitepy"""'], {}), "('fortnitepy')\n", (1435, 1449), False, 'import importlib\n'), ((1... |
import pytest
grblas = pytest.importorskip("grblas")
from metagraph.tests.util import default_plugin_resolver
from . import RoundTripper
from metagraph.plugins.numpy.types import NumpyMatrixType
from metagraph.plugins.graphblas.types import GrblasMatrixType
import numpy as np
def test_matrix_roundtrip_dense_square(... | [
"numpy.array",
"pytest.importorskip"
] | [((24, 53), 'pytest.importorskip', 'pytest.importorskip', (['"""grblas"""'], {}), "('grblas')\n", (43, 53), False, 'import pytest\n'), ((403, 465), 'numpy.array', 'np.array', (['[[1.1, 2.2, 3.3], [3.3, 3.3, 9.9], [3.3, 0.0, -3.3]]'], {}), '([[1.1, 2.2, 3.3], [3.3, 3.3, 9.9], [3.3, 0.0, -3.3]])\n', (411, 465), True, 'im... |
#!/usr/bin/env python
""" This file is a Python translation of the MATLAB file acm.m
Python version by RDL 29 Mar 2012
Copyright notice from acm.m:
copyright 1996, by <NAME>. For use with the book
"Statistical Digital Signal Processing and Modeling"
(John Wiley & Sons, 1996).
"""
from __future__ import print_fu... | [
"numpy.insert",
"numpy.abs",
"numpy.dot",
"numpy.linalg.lstsq",
"convm.convm"
] | [((995, 1010), 'convm.convm', 'convm', (['x', '(p + 1)'], {}), '(x, p + 1)\n', (1000, 1010), False, 'from convm import convm\n'), ((1117, 1135), 'numpy.insert', 'np.insert', (['a', '(0)', '(1)'], {}), '(a, 0, 1)\n', (1126, 1135), True, 'import numpy as np\n'), ((1195, 1209), 'numpy.dot', 'np.dot', (['err', 'a'], {}), '... |
import os
import shutil
import doctest
from crds.core import log, utils
from crds import tests, data_file
from crds.tests import test_config
from crds.refactoring import checksum
from crds.refactoring.checksum import ChecksumScript
def dt_checksum_script_fits_add():
"""
>>> old_state = test_config.setup()
... | [
"crds.tests.tstmod"
] | [((9085, 9106), 'crds.tests.tstmod', 'tstmod', (['test_checksum'], {}), '(test_checksum)\n', (9091, 9106), False, 'from crds.tests import test_checksum, tstmod\n')] |
from fsspec import AbstractFileSystem # type: ignore
from fsspec.implementations.local import LocalFileSystem # type: ignore
from typing import Callable, Optional
class Pipe(object):
"""A container for piping data through transformations.
Args:
src_fs (AbstractFileSystem): The source file system.
... | [
"fsspec.implementations.local.LocalFileSystem"
] | [((1293, 1310), 'fsspec.implementations.local.LocalFileSystem', 'LocalFileSystem', ([], {}), '()\n', (1308, 1310), False, 'from fsspec.implementations.local import LocalFileSystem\n')] |
"""
Regression tests for custom manager classes.
"""
from django.db import models
class RestrictedManager(models.Manager):
"""
A manager that filters out non-public instances.
"""
def get_query_set(self):
return super(RestrictedManager, self).get_query_set().filter(is_public=True)
class Relat... | [
"django.db.models.OneToOneField",
"django.db.models.Manager",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.CharField"
] | [((354, 385), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (370, 385), False, 'from django.db import models\n'), ((488, 519), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (504, 519), False, 'from django.db im... |
import torch
import torch.nn.functional as f
from torch import nn
from einops import rearrange
def scaled_dot_product_attention(query, key, value):
attention = torch.einsum('bdtc,beuc->bdteu',[query,key])
mask = torch.zeros_like(attention)
for frame in torch.arange(mask.size(-2)):
mask[:, frame, :... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"einops.rearrange",
"torch.einsum",
"torch.nn.Linear",
"torch.zeros_like",
"torch.nn.functional.softmax"
] | [((166, 212), 'torch.einsum', 'torch.einsum', (['"""bdtc,beuc->bdteu"""', '[query, key]'], {}), "('bdtc,beuc->bdteu', [query, key])\n", (178, 212), False, 'import torch\n'), ((222, 249), 'torch.zeros_like', 'torch.zeros_like', (['attention'], {}), '(attention)\n', (238, 249), False, 'import torch\n'), ((420, 466), 'ein... |
"""
License: Apache-2.0
Author: <NAME>
E-mail: <EMAIL>
"""
import tensorflow as tf
import rnn_cell_GRU as rnn_cell
import rnn
import numpy as np
from config import cfg
from utils import get_batch_data
from capsLayer import CapsLayer
from sklearn import metrics
import pickle
from sklearn.cross_validation import train... | [
"tensorflow.tile",
"tensorflow.contrib.layers.conv2d",
"tensorflow.transpose",
"tensorflow.reduce_sum",
"tensorflow.split",
"tensorflow.nn.softmax",
"tensorflow.Graph",
"tensorflow.random_normal",
"tensorflow.placeholder",
"capsLayer.CapsLayer",
"tensorflow.matmul",
"tensorflow.maximum",
"te... | [((734, 744), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (742, 744), True, 'import tensorflow as tf\n'), ((3264, 3311), 'tensorflow.logging.info', 'tf.logging.info', (['"""Seting up the main structure"""'], {}), "('Seting up the main structure')\n", (3279, 3311), True, 'import tensorflow as tf\n'), ((3620, 3656)... |
import numpy as np
import cv2
img = cv2.imread("test_image.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
camera = cv2.VideoCaptu... | [
"cv2.rectangle",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"cv2.imread"
] | [((36, 64), 'cv2.imread', 'cv2.imread', (['"""test_image.jpg"""'], {}), "('test_image.jpg')\n", (46, 64), False, 'import cv2\n'), ((72, 109), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (84, 109), False, 'import cv2\n'), ((125, 185), 'cv2.CascadeClassifier', 'cv2.... |
import os
import sys
import torch
from torch import nn
from torch.nn import functional as F, init
from src.utils import bernoulli_log_pdf
from src.objectives.elbo import \
log_bernoulli_marginal_estimate_sets
class Statistician(nn.Module):
def __init__(self, c_dim, z_dim, hidden_dim_statistic=3, hidden_dim=40... | [
"torch.mean",
"torch.nn.functional.elu",
"torch.sigmoid",
"torch.exp",
"torch.no_grad",
"torch.randn_like",
"torch.chunk",
"torch.sum",
"src.objectives.elbo.log_bernoulli_marginal_estimate_sets",
"torch.nn.Linear",
"torch.nn.init.constant",
"torch.nn.init.calculate_gain",
"src.utils.bernoull... | [((2186, 2212), 'src.utils.bernoulli_log_pdf', 'bernoulli_log_pdf', (['x', 'x_mu'], {}), '(x, x_mu)\n', (2203, 2212), False, 'from src.utils import bernoulli_log_pdf\n'), ((2420, 2443), 'torch.sum', 'torch.sum', (['kl_c'], {'dim': '(-1)'}), '(kl_c, dim=-1)\n', (2429, 2443), False, 'import torch\n'), ((2963, 2986), 'tor... |
from corehq.project_limits.rate_limiter import RateDefinition, RateLimiter, \
PerUserRateDefinition
from corehq.util.datadog.gauges import datadog_counter
from corehq.util.datadog.utils import bucket_value
from corehq.util.decorators import silence_and_report_error, enterprise_skip
from corehq.util.timer import Ti... | [
"corehq.project_limits.rate_limiter.RateLimiter",
"corehq.util.datadog.utils.bucket_value",
"corehq.util.timer.TimingContext",
"corehq.project_limits.rate_limiter.RateDefinition",
"corehq.util.decorators.silence_and_report_error"
] | [((572, 663), 'corehq.project_limits.rate_limiter.RateDefinition', 'RateDefinition', ([], {'per_week': '(115)', 'per_day': '(23)', 'per_hour': '(3)', 'per_minute': '(0.07)', 'per_second': '(0.005)'}), '(per_week=115, per_day=23, per_hour=3, per_minute=0.07,\n per_second=0.005)\n', (586, 663), False, 'from corehq.pro... |
from django.shortcuts import render, redirect
from django.views.generic import UpdateView, DeleteView
from .models import Storage
from django_tables2 import RequestConfig
from .tables import StorageTable
from django.contrib.auth.decorators import login_required
from .forms import StorageForm, QuestionForm
def index(r... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django_tables2.RequestConfig",
"django.contrib.auth.decorators.login_required"
] | [((996, 1039), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login"""'}), "(login_url='/accounts/login')\n", (1010, 1039), False, 'from django.contrib.auth.decorators import login_required\n'), ((383, 446), 'django.shortcuts.render', 'render', (['request', '"""../te... |
import unittest
from app.models import User,Post,Comments
from app import db
class PostTest(unittest.TestCase):
def setUp(self):
"""
Set up method that will run before every Test
"""
self.post= Post(category='Product', content='Yes we can!')
self.user_Derrick = User(userna... | [
"app.models.Comments.query.delete",
"app.models.Post",
"app.models.Post.query.delete",
"app.models.User",
"app.models.User.query.delete",
"app.models.Comments.query.all",
"app.models.Comments"
] | [((233, 280), 'app.models.Post', 'Post', ([], {'category': '"""Product"""', 'content': '"""Yes we can!"""'}), "(category='Product', content='Yes we can!')\n", (237, 280), False, 'from app.models import User, Post, Comments\n'), ((309, 371), 'app.models.User', 'User', ([], {'username': '"""Derrick"""', 'password': '"""p... |
# -*- encoding:utf-8 -*-
from kscore.session import get_session
import json
if __name__ == "__main__":
s = get_session()
client = s.create_client("monitor", "cn-beijing-6", use_ssl=True)
clientv2 = s.create_client("monitorv2", "cn-beijing-6", use_ssl=True)
'''
通用产品线,不包含容器(docker)
'''
#Lis... | [
"kscore.session.get_session",
"json.dumps"
] | [((113, 126), 'kscore.session.get_session', 'get_session', ([], {}), '()\n', (124, 126), False, 'from kscore.session import get_session\n'), ((542, 581), 'json.dumps', 'json.dumps', (['m'], {'sort_keys': '(True)', 'indent': '(4)'}), '(m, sort_keys=True, indent=4)\n', (552, 581), False, 'import json\n')] |
import numpy as np
class RegularizeOrthogonal(object):
"""
Orthogonal
"""
def __init__(self, coeff_lambda=0.0):
self.coeff_lambda = coeff_lambda
def cost(self, layers):
c = 0.0
for layer in layers:
wt = layer.w.transpose()
for j in range(layer.outp... | [
"numpy.outer",
"numpy.zeros_like"
] | [((795, 812), 'numpy.zeros_like', 'np.zeros_like', (['wt'], {}), '(wt)\n', (808, 812), True, 'import numpy as np\n'), ((1022, 1040), 'numpy.outer', 'np.outer', (['wtj', 'wtj'], {}), '(wtj, wtj)\n', (1030, 1040), True, 'import numpy as np\n')] |
import pandas as pd
file = r'8_calculate_spacer_len.csv'
with open(file, 'r') as f:
data = pd.read_csv(f)
for i in data.index:
box_motif = data.at[i, 'box motif']
if '[' in box_motif:
data.at[i, 'Upstream mismatch'] = data.at[i, 'Upstream mismatch'] + 0.5
data.at[i, 'Downstream... | [
"pandas.read_csv"
] | [((100, 114), 'pandas.read_csv', 'pd.read_csv', (['f'], {}), '(f)\n', (111, 114), True, 'import pandas as pd\n')] |
import numpy as np
import pandas as pd
from pandas.util import testing as pdt
import pytest
from spandex import TableFrame
from spandex.io import db_to_df, df_to_db
def test_tableframe(loader):
table = loader.tables.sample.hf_bg
for cache in [False, True]:
tf = TableFrame(table, index_col='gid', cach... | [
"spandex.io.db_to_df",
"numpy.issubdtype",
"spandex.TableFrame",
"pytest.importorskip",
"pandas.DataFrame",
"pandas.util.testing.assert_frame_equal"
] | [((1216, 1262), 'pytest.importorskip', 'pytest.importorskip', (['"""urbansim.sim.simulation"""'], {}), "('urbansim.sim.simulation')\n", (1235, 1262), False, 'import pytest\n'), ((1366, 1402), 'spandex.TableFrame', 'TableFrame', (['parcels'], {'index_col': '"""gid"""'}), "(parcels, index_col='gid')\n", (1376, 1402), Fal... |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))
from training_structures.MFM import train_MFM,test_MFM
from fusions.common_fusions import Concat
from unimodals.MVAE import LeNetEncoder,DeLeNet
from unimodals.common_models import MLP
from torch import nn
import torch
from objective_fu... | [
"unimodals.MVAE.LeNetEncoder",
"unimodals.MVAE.DeLeNet",
"datasets.avmnist.get_data_robust.get_dataloader",
"fusions.common_fusions.Concat",
"torch.load",
"objective_functions.recon.sigmloss1dcentercrop",
"os.getcwd",
"unimodals.common_models.MLP",
"training_structures.MFM.train_MFM",
"training_st... | [((526, 583), 'datasets.avmnist.get_data_robust.get_dataloader', 'get_dataloader', (['"""../../../../yiwei/avmnist/_MFAS/avmnist"""'], {}), "('../../../../yiwei/avmnist/_MFAS/avmnist')\n", (540, 583), False, 'from datasets.avmnist.get_data_robust import get_dataloader\n'), ((625, 633), 'fusions.common_fusions.Concat', ... |
#!/usr/bin/python3
# By <NAME>
import sys
import random
import pygame
from pygame.locals import *
class Colours:
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
AQUA = (0, 255, 255)
GREY = (128, 128, 128)
NAVY = (0, 0, 128)
SILVER = (192, 192 ,192)
GREEN = (0, 128, 0)
OLIV... | [
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"random.randrange",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock"
] | [((780, 793), 'pygame.init', 'pygame.init', ([], {}), '()\n', (791, 793), False, 'import pygame\n'), ((852, 871), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (869, 871), False, 'import pygame\n'), ((954, 1004), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(self.width, self.height)'], {}), '(... |
try:
import unzip_requirements
except ImportError:
pass
import json
import os
import tarfile
import boto3
import tensorflow as tf
import numpy as np
import census_data
import logging
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
FILE_DIR = '/tmp/'
BUCKET = os.environ['BUCKET']
import queue
im... | [
"logging.getLogger",
"json.loads",
"boto3.client",
"json.dumps",
"logging.warning",
"json.load",
"queue.Queue"
] | [((201, 220), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (218, 220), False, 'import logging\n'), ((399, 412), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (410, 412), False, 'import queue\n'), ((429, 451), 'boto3.client', 'boto3.client', (['"""lambda"""'], {}), "('lambda')\n", (441, 451), False, 'im... |
from time import time
import rclpy
from rclpy.node import Node
import json
from std_msgs.msg import String, Float32, Int8, Int16
import sailbot.autonomous.p2p as p2p
from collections import deque
class ControlSystem(Node): # Gathers data from some nodes and distributes it to others
def __init__(self):
s... | [
"std_msgs.msg.String",
"rclpy.ok",
"json.loads",
"collections.deque",
"json.dumps",
"std_msgs.msg.Int8",
"sailbot.autonomous.p2p.P2P",
"rclpy.spin_once",
"std_msgs.msg.Int16",
"rclpy.init",
"rclpy.shutdown"
] | [((6174, 6195), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (6184, 6195), False, 'import rclpy\n'), ((6249, 6259), 'rclpy.ok', 'rclpy.ok', ([], {}), '()\n', (6257, 6259), False, 'import rclpy\n'), ((11225, 11241), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (11239, 11241), False, 'imp... |
from dataclasses import dataclass
from app import crud
from app.schemas import UserCreate, SlackEventHook
from app.settings import REACTION_LIST, DAY_MAX_REACTION
# about reaction
REMOVED_REACTION = 'reaction_removed'
ADDED_REACTION = 'reaction_added'
APP_MENTION_REACTION = 'app_mention'
# about command
CREATE_USER... | [
"app.schemas.UserCreate",
"app.crud.update_added_reaction",
"app.crud.create_user",
"app.crud.update_my_reaction",
"app.crud.get_user"
] | [((3752, 3806), 'app.crud.get_user', 'crud.get_user', (['db'], {'item_user': 'add_user_cmd_dto.slack_id'}), '(db, item_user=add_user_cmd_dto.slack_id)\n', (3765, 3806), False, 'from app import crud\n'), ((3862, 4044), 'app.schemas.UserCreate', 'UserCreate', ([], {'username': 'add_user_cmd_dto.name', 'slack_id': 'add_us... |
"""
Creates files for end-to-end tests
python util/build_tests.py
"""
# stdlib
import json
from dataclasses import asdict
# module
import avwx
def make_metar_test(station: str) -> dict:
"""
Builds METAR test file for station
"""
m = avwx.Metar(station)
m.update()
# Clear timestamp due to pa... | [
"dataclasses.asdict",
"pathlib.Path",
"avwx.Metar",
"avwx.Taf",
"avwx.Pireps"
] | [((254, 273), 'avwx.Metar', 'avwx.Metar', (['station'], {}), '(station)\n', (264, 273), False, 'import avwx\n'), ((693, 710), 'avwx.Taf', 'avwx.Taf', (['station'], {}), '(station)\n', (701, 710), False, 'import avwx\n'), ((743, 757), 'dataclasses.asdict', 'asdict', (['t.data'], {}), '(t.data)\n', (749, 757), False, 'fr... |
from micropython import const
ADXL345_ADDRESS = const(0x53) # I2C address of adxl345
ADXL345_DEVICE_ID = const(0xe5) #
ADXL345_DEVID = const(0x00) # Device ID
ADXL345_THESH_TAP = const(0x1d) # Tap threshold
ADXL345_OFSX = const(0x1e) ... | [
"micropython.const"
] | [((62, 71), 'micropython.const', 'const', (['(83)'], {}), '(83)\n', (67, 71), False, 'from micropython import const\n'), ((134, 144), 'micropython.const', 'const', (['(229)'], {}), '(229)\n', (139, 144), False, 'from micropython import const\n'), ((185, 193), 'micropython.const', 'const', (['(0)'], {}), '(0)\n', (190, ... |
import random
global_mutation = 0.002
encodings = {'0': '00000', '1': '00001', '2': '00010', '3': '00011', '4': '00100',
'5': '00101', 'A': '00110', 'B': '00111', 'C': '01000', 'D': '01001',
'E': '01010', 'F': '01011', 'G': '01100', 'H': '01101', 'I': '01110',
'J': '01111... | [
"random.random"
] | [((871, 886), 'random.random', 'random.random', ([], {}), '()\n', (884, 886), False, 'import random\n')] |
# ============================================================================
# FILE: func.py
# AUTHOR: <NAME> <<EMAIL>>
# License: MIT license
# ============================================================================
# pylint: disable=E0401,C0411
import os
import subprocess
from denite import util
from .base imp... | [
"os.path.isabs",
"os.path.ismount",
"denite.util.error",
"os.access",
"os.path.join",
"subprocess.run",
"os.path.dirname",
"os.path.basename",
"os.path.relpath"
] | [((453, 487), 'os.path.join', 'os.path.join', (['path', '"""package.json"""'], {}), "(path, 'package.json')\n", (465, 487), False, 'import os\n'), ((499, 520), 'os.access', 'os.access', (['p', 'os.R_OK'], {}), '(p, os.R_OK)\n', (508, 520), False, 'import os\n'), ((561, 582), 'os.path.dirname', 'os.path.dirname', (['pat... |
import logging
from .model.orm import (
Check,
Host,
Instance,
)
from .alerting import (
bootstrap_checks,
check_specs,
)
logger = logging.getLogger(__name__)
def merge_agent_info(session, host_info, instances_info):
"""Update the host, instance and database information with the
data re... | [
"logging.getLogger"
] | [((154, 181), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'import logging\n')] |
#!/usr/bin/env python3
#===============================================================================
# Copyright (c) 2020 <NAME>
# Lab of Dr. <NAME> and Dr. <NAME>
# University of Michigan
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation f... | [
"os.path.exists",
"sys.exit",
"sqlite3.connect",
"argparse.ArgumentParser",
"gzip.open",
"sys.stdin",
"rsidx.index.index",
"os.system",
"rsidx.search.search"
] | [((1591, 1727), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert weights files with just rsIDs to ones with chromosomes and coordinates too\n"""'}), '(description=\n """Convert weights files with just rsIDs to ones with chromosomes and coordinates too\n"""\n )\n', (1614, 1727... |
# encoding: UTF-8
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
name = 'crrCython',
ext_modules = cythonize("crrCython.pyx"),
include_dirs = [numpy.get_include()]
)
| [
"Cython.Build.cythonize",
"numpy.get_include"
] | [((146, 172), 'Cython.Build.cythonize', 'cythonize', (['"""crrCython.pyx"""'], {}), "('crrCython.pyx')\n", (155, 172), False, 'from Cython.Build import cythonize\n'), ((192, 211), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (209, 211), False, 'import numpy\n')] |
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: <EMAIL>
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcenter_sdk
from ReleaseUpda... | [
"unittest.main"
] | [((902, 917), 'unittest.main', 'unittest.main', ([], {}), '()\n', (915, 917), False, 'import unittest\n')] |
from ftplib import FTP
from datetime import *
from tkinter import *
def interval():
now = date.today()
yourDay = int(input("Vous êtes né quel jour ? "))
yourMonth = int(input("Vous êtes né quel mois ? "))
yourYear = int(input("Vous êtes né quelle année ? "))
birthday = date(yourYear, yourMonth, yourDay)
daysPas... | [
"os.system"
] | [((370, 388), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (379, 388), False, 'import os\n')] |
#!/usr/bin/env python3
from setuptools import setup
setup(
name="deeplator",
version="0.0.7",
description="Wrapper for DeepL translator.",
long_description="Deeplator is a library enabling translation via the DeepL translator.",
author="uinput",
author_email="<EMAIL>",
license="MIT",
u... | [
"setuptools.setup"
] | [((54, 664), 'setuptools.setup', 'setup', ([], {'name': '"""deeplator"""', 'version': '"""0.0.7"""', 'description': '"""Wrapper for DeepL translator."""', 'long_description': '"""Deeplator is a library enabling translation via the DeepL translator."""', 'author': '"""uinput"""', 'author_email': '"""<EMAIL>"""', 'licens... |
import sys
import logging as log
from ..common import parsers, helpers, retrievers, data_handlers
from ..common.data_models import Taxon
from typing import List
def run_taiga(infile: str,
email: str,
gb_mode: int = 0,
tid: bool = False,
correction: bool = False,... | [
"logging.info",
"logging.error",
"sys.exit"
] | [((2038, 2314), 'logging.info', 'log.info', (['"""\n *********************************************\n * *\n * TaIGa - Taxonomy Information Gatherer *\n * *\n *********************************************"""'], {}), '(\... |
from django.shortcuts import render
def HomeView(request):
return render(request , 'site_home.html')
def AboutView(request):
return render(request, 'about.html') | [
"django.shortcuts.render"
] | [((71, 104), 'django.shortcuts.render', 'render', (['request', '"""site_home.html"""'], {}), "(request, 'site_home.html')\n", (77, 104), False, 'from django.shortcuts import render\n'), ((142, 171), 'django.shortcuts.render', 'render', (['request', '"""about.html"""'], {}), "(request, 'about.html')\n", (148, 171), Fals... |
import pandas as pd
import pandas
import numpy as np
#provide local path
testfile='../input/test.csv'
data = open(testfile).readlines()
sequences={} #(key, value) = (id , sequence)
for i in range(1,len(data)):
line=data[i]
line =line.replace('"','')
line = line[:-1].split(',')
id = int(... | [
"numpy.array",
"numpy.linalg.inv",
"numpy.linalg.det"
] | [((1019, 1030), 'numpy.array', 'np.array', (['A'], {}), '(A)\n', (1027, 1030), True, 'import numpy as np\n'), ((1032, 1043), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (1040, 1043), True, 'import numpy as np\n'), ((1067, 1083), 'numpy.linalg.det', 'np.linalg.det', (['A'], {}), '(A)\n', (1080, 1083), True, 'import... |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2014 The Crashpad 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/LICEN... | [
"subprocess.check_call",
"argparse.ArgumentParser",
"re.compile"
] | [((1296, 1340), 're.compile', 're.compile', (['"""^(\t} __Reply);$"""', 're.MULTILINE'], {}), "('^(\\t} __Reply);$', re.MULTILINE)\n", (1306, 1340), False, 'import re\n'), ((2177, 2251), 're.compile', 're.compile', (['"""^mig_internal (kern_return_t __MIG_check__.*)$"""', 're.MULTILINE'], {}), "('^mig_internal (kern_re... |
from setuptools import setup
# with open("../README.md", "r") as fh:
# long_description = fh.read()
setup(name='pulzar-pkg',
version='21.4.1',
author='<NAME>',
author_email='<EMAIL>',
description='Distributed database and jobs',
# long_description=long_description,
# long... | [
"setuptools.setup"
] | [((105, 492), 'setuptools.setup', 'setup', ([], {'name': '"""pulzar-pkg"""', 'version': '"""21.4.1"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Distributed database and jobs"""', 'url': '"""http://github.com/cleve/pulzar"""', 'packages': "['pulzarcore', 'pulzarutils']", 'classifier... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Sample 10^6 particles from anisotropic Hernquist DF.
Created: February 2021
Author: <NAME>
"""
import sys
from emcee import EnsembleSampler as Sampler
import numpy as np
sys.path.append("../src")
from constants import G, M_sun, kpc
from hernquist import calc_DF_aniso... | [
"numpy.savez",
"numpy.sqrt",
"numpy.random.rand",
"numpy.random.choice",
"numpy.where",
"numpy.log",
"emcee.EnsembleSampler",
"numpy.array",
"numpy.linalg.norm",
"hernquist.calc_DF_aniso",
"sys.path.append"
] | [((223, 248), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (238, 248), False, 'import sys\n'), ((1068, 1093), 'hernquist.calc_DF_aniso', 'calc_DF_aniso', (['q', 'p', 'M', 'a'], {}), '(q, p, M, a)\n', (1081, 1093), False, 'from hernquist import calc_DF_aniso\n'), ((2235, 2284), 'emcee.En... |
# Generated by Django 3.0.5 on 2020-05-26 13:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RepositoryDetails',
fields... | [
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((346, 439), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (362, 439), False, 'from django.db import migrations, models\... |
# coding: utf-8
import os, pickle, csv, json
import subprocess
from typing import NamedTuple, List, TextIO, Tuple, Dict, Optional, Union, Iterable, Hashable
import numpy as np
import pandas as pd
from scipy import stats
from itertools import product, groupby, takewhile
from collections import namedtuple, Counter
impor... | [
"csv.DictReader",
"logging.debug",
"multiprocessing.cpu_count",
"numpy.array",
"scipy.stats.ttest_ind",
"numpy.linalg.norm",
"pandas.api.extensions.register_series_accessor",
"numpy.arange",
"os.path.exists",
"numpy.mean",
"subprocess.Popen",
"subprocess.run",
"itertools.product",
"numpy.d... | [((386, 407), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (400, 407), False, 'import matplotlib\n'), ((5594, 5646), 'pandas.api.extensions.register_series_accessor', 'pd.api.extensions.register_series_accessor', (['"""foldit"""'], {}), "('foldit')\n", (5636, 5646), True, 'import pandas as pd\n... |
import os
import tempfile
import shutil
import argparse
import networkx as nx
from tqdm import tqdm
from joblib import Parallel, delayed
from collections import defaultdict, Counter
import math
import numpy as np
from .isvalid import *
from .__init__ import __version__
from .cdhit import run_cdhit
from .clean_network... | [
"networkx.relabel_nodes",
"math.ceil",
"argparse.ArgumentParser",
"tqdm.tqdm",
"os.path.join",
"shutil.rmtree",
"collections.Counter",
"os.path.isfile",
"networkx.write_gml",
"collections.defaultdict",
"tempfile.mkdtemp",
"tempfile.NamedTemporaryFile",
"networkx.read_gml",
"networkx.compos... | [((1054, 1107), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'outdir'}), '(delete=False, dir=outdir)\n', (1081, 1107), False, 'import tempfile\n'), ((1159, 1212), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'dir': 'outdir'})... |
import os
import re
import yaml
for root, dirs, files in os.walk("."):
for file in files:
njk = os.path.join(root, file)
if njk.endswith(".njk"):
with open(njk, "r") as file:
lines = file.read().split("\n")
if not(lines[0].startswith("---")):
... | [
"os.path.join",
"os.walk",
"yaml.dump"
] | [((58, 70), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (65, 70), False, 'import os\n'), ((109, 133), 'os.path.join', 'os.path.join', (['root', 'file'], {}), '(root, file)\n', (121, 133), False, 'import os\n'), ((1022, 1083), 'yaml.dump', 'yaml.dump', (['meta'], {'default_flow_style': '(False)', 'allow_unicode'... |
# project libraries imports:
# instruments:
from GenericScript import TestScript
class Test(TestScript):
def __init__(self):
TestScript.__init__(self)
self.Name = 'Modulated photocurrent frequency spectrum'
self.Description = """Measurement of the modulation frequency spectrum of photocurre... | [
"Devices.Thermometer",
"Devices.Monochromator",
"GenericScript.TestScript.__init__",
"AllScripts.ScriptsBase.add_script",
"Devices.LockIn",
"Devices.PowerSource",
"Devices.Clock",
"Devices.HamamatsuPhotodiode",
"Devices.GeneratorSquare"
] | [((11413, 11462), 'AllScripts.ScriptsBase.add_script', 'ScriptsBase.add_script', (['Test', '"""Photoconductivity"""'], {}), "(Test, 'Photoconductivity')\n", (11435, 11462), False, 'from AllScripts import ScriptsBase\n'), ((138, 163), 'GenericScript.TestScript.__init__', 'TestScript.__init__', (['self'], {}), '(self)\n'... |
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import pgettext_lazy
from .constants import REDIRECT_TYPE_CHOICES, REDIRECT_301
from .fields import MultipleChoiceArrayField
__all__ = (
'Redirect',
)
LANGUAGES = getattr(setti... | [
"django.db.models.CharField",
"django.utils.translation.pgettext_lazy"
] | [((548, 594), 'django.utils.translation.pgettext_lazy', 'pgettext_lazy', (['"""ok:redirects"""', '"""redirect from"""'], {}), "('ok:redirects', 'redirect from')\n", (561, 594), False, 'from django.utils.translation import pgettext_lazy\n'), ((888, 949), 'django.db.models.CharField', 'models.CharField', ([], {'max_lengt... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% {"slideshow": {"slide_ty... | [
"networkx.DiGraph",
"os.path.join",
"graphPlot.setCanvas",
"sys.path.remove",
"sys.path.append",
"graphPlot.drawGraph"
] | [((774, 785), 'graphPlot.setCanvas', 'setCanvas', ([], {}), '()\n', (783, 785), False, 'from graphPlot import drawGraph, setCanvas\n'), ((2042, 2067), 'networkx.DiGraph', 'nx.DiGraph', ([], {'directed': '(True)'}), '(directed=True)\n', (2052, 2067), True, 'import networkx as nx\n'), ((2246, 2258), 'graphPlot.drawGraph'... |
from django.conf.urls import url, include
from driver import views
# from djgeojson.views import GeoJSONLayerView
# from driver.models import Points
urlpatterns = [
url(r'^new/driver$', views.create_driver_profile, name='new-driver-profile'),
url(r'^new/car$', views.submit_car, name='new-car'),
] | [
"django.conf.urls.url"
] | [((170, 245), 'django.conf.urls.url', 'url', (['"""^new/driver$"""', 'views.create_driver_profile'], {'name': '"""new-driver-profile"""'}), "('^new/driver$', views.create_driver_profile, name='new-driver-profile')\n", (173, 245), False, 'from django.conf.urls import url, include\n'), ((252, 302), 'django.conf.urls.url'... |
import numpy as np
import tensorflow as tf
from utils import fc_block
from params import*
class Model():
def __init__(self, input_dim=INPUT_DIM, output_dim=OUTPUT_DIM, dim_hidden=DIM_HIDDEN, latent_dim=LATENT_DIM, update_lr=LEARNING_RATE, scope='model'):
self.input_dim = input_dim
self.ou... | [
"tensorflow.one_hot",
"tensorflow.random_normal",
"utils.fc_block",
"tensorflow.shape",
"tensorflow.variable_scope",
"tensorflow.reduce_sum",
"tensorflow.matmul",
"tensorflow.nn.softmax",
"tensorflow.expand_dims",
"tensorflow.train.AdamOptimizer",
"tensorflow.losses.mean_squared_error",
"tenso... | [((1553, 1651), 'utils.fc_block', 'fc_block', (['inp', "weights['w1']", "weights['b1']", 'prob', 'reuse', "(scope + '0')"], {'is_training': 'is_training'}), "(inp, weights['w1'], weights['b1'], prob, reuse, scope + '0',\n is_training=is_training)\n", (1561, 1651), False, 'from utils import fc_block\n'), ((1664, 1765... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
requirements = [
"xarray>=0.14",
"numpy>=1.11",
"scikit-learn>=0.22",
"fsspec>=0.6.2",
"pyyaml>=5.1.2",
"tensorflow>=2.2.0",
"tensorflow-addons>=0.11.2",
"typing_extension... | [
"setuptools.find_packages"
] | [((1367, 1412), 'setuptools.find_packages', 'find_packages', ([], {'include': "['fv3fit', 'fv3fit.*']"}), "(include=['fv3fit', 'fv3fit.*'])\n", (1380, 1412), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
"""Dupa
Set of tools handy during working, debuging and testing
the code."""
__version__ = '0.0.1'
__author__ = '<NAME> <<EMAIL>>'
import time
from functools import wraps
from dupa.fixturize import fixturize
def debug(func):
"""Print the function signature and return value"""
@wraps... | [
"functools.wraps"
] | [((315, 326), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (320, 326), False, 'from functools import wraps\n'), ((760, 771), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (765, 771), False, 'from functools import wraps\n'), ((1266, 1277), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (127... |
from django.contrib.sites.models import Site
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from htmlmin.decorators import not_minified_response
from dss import localsettings
from spa.forms import UserForm
__author__ = 'fergalm'
@not_minified_response
de... | [
"django.template.context.RequestContext",
"django.contrib.sites.models.Site.objects.get_current",
"spa.forms.UserForm"
] | [((460, 483), 'django.template.context.RequestContext', 'RequestContext', (['request'], {}), '(request)\n', (474, 483), False, 'from django.template.context import RequestContext\n'), ((1025, 1048), 'django.template.context.RequestContext', 'RequestContext', (['request'], {}), '(request)\n', (1039, 1048), False, 'from ... |
import os
import argparse
import numpy as np
import scipy
import imageio
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import graphkke.generate_graphs.graph_generation as graph_generation
import graphkke.generate_graphs.generate_SDE as generate_SDE
parser = argparse.ArgumentParser()
parser.add_... | [
"sklearn.cluster.KMeans",
"graphkke.generate_graphs.generate_SDE.LemonSlice2D",
"argparse.ArgumentParser",
"imageio.imwrite",
"numpy.asarray",
"os.path.join",
"numpy.zeros",
"graphkke.generate_graphs.graph_generation.LemonGraph",
"matplotlib.pyplot.scatter",
"imageio.mimsave",
"scipy.rand",
"m... | [((282, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (305, 307), False, 'import argparse\n'), ((1114, 1130), 'numpy.zeros', 'np.zeros', (['[d, n]'], {}), '([d, n])\n', (1122, 1130), True, 'import numpy as np\n'), ((1246, 1315), 'graphkke.generate_graphs.generate_SDE.LemonSlice2D', 'gene... |
import sys
try:
import uos as os
except ImportError:
import os
if not hasattr(os, "unlink"):
print("SKIP")
sys.exit()
# cleanup in case testfile exists
try:
os.unlink("testfile")
except OSError:
pass
try:
f = open("testfile", "r+b")
print("Unexpectedly opened non-existing file")
excep... | [
"os.unlink",
"sys.exit"
] | [((124, 134), 'sys.exit', 'sys.exit', ([], {}), '()\n', (132, 134), False, 'import sys\n'), ((179, 200), 'os.unlink', 'os.unlink', (['"""testfile"""'], {}), "('testfile')\n", (188, 200), False, 'import os\n'), ((694, 715), 'os.unlink', 'os.unlink', (['"""testfile"""'], {}), "('testfile')\n", (703, 715), False, 'import ... |
import json
import re
import datetime
import scrapy
import yaml
import munch
import pathlib
from appdirs import user_config_dir
config_path = list(pathlib.Path(__file__).parent.parent.parent.resolve().glob('config.yml'))[0]
class YtchSpider(scrapy.Spider):
name = "ytch"
start_urls = list(
munch.Munch... | [
"re.findall",
"datetime.datetime.now",
"json.loads",
"pathlib.Path"
] | [((986, 1001), 'json.loads', 'json.loads', (['res'], {}), '(res)\n', (996, 1001), False, 'import json\n'), ((1085, 1108), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1106, 1108), False, 'import datetime\n'), ((711, 764), 're.findall', 're.findall', (['"""(".*?"):(".*?"|\\\\[.*?\\\\]|true|false)... |
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_finance import candlestick_ohlc
# import matplotlib as mpl then mpl.use('TkAgg')
import pandas as pd
import numpy as np
from datetime import datetime
df = pd.read_csv('BitMEX-OHLCV-1d.csv')
df.columns = ['date', 'open', 'high', 'low', 'clo... | [
"mpl_finance.candlestick_ohlc",
"numpy.reshape",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((236, 270), 'pandas.read_csv', 'pd.read_csv', (['"""BitMEX-OHLCV-1d.csv"""'], {}), "('BitMEX-OHLCV-1d.csv')\n", (247, 270), True, 'import pandas as pd\n'), ((351, 378), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)'}), '(figsize=(10, 5))\n', (361, 378), True, 'import matplotlib.pyplot as plt\n')... |