code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("dark")
plt.rcParams['figure.figsize'] = 16, 12
import pandas as pd
from tqdm import tqdm_notebook, tqdm
import io
from PIL import Image
from glob import glob
from collections import defaultdict
import os
import pic... | [
"torch.nn.CrossEntropyLoss",
"numpy.random.rand",
"imgaug.augmenters.GaussianBlur",
"kaggle_camera_model_id_lib.models.InceptionResNetV2",
"kaggle_camera_model_id_lib.utils.n_pseudorandom_crops",
"kaggle_camera_model_id_lib.models.ResNetX",
"torchvision.transforms.Lambda",
"torch.LongTensor",
"seabo... | [((91, 112), 'seaborn.set_style', 'sns.set_style', (['"""dark"""'], {}), "('dark')\n", (104, 112), True, 'import seaborn as sns\n'), ((462, 488), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(True)'], {}), '(True)\n', (482, 488), False, 'import cv2\n'), ((1459, 1470), 'kaggle_camera_model_id_lib.utils.PechkaBot',... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import ubelt as ub
import netharn as nh
def mwe():
# Assuming optimizer has two groups.
import torch.optim.lr_scheduler
import netharn as nh
model = nh.models.ToyNet2d()
optimizer = torch.opt... | [
"ubelt.odict",
"netharn.XPU.coerce",
"netharn.models.ToyNet2d",
"ubelt.ensure_app_cache_dir",
"ubelt.repr2",
"netharn.data.ToyData2d"
] | [((274, 294), 'netharn.models.ToyNet2d', 'nh.models.ToyNet2d', ([], {}), '()\n', (292, 294), True, 'import netharn as nh\n'), ((1322, 1332), 'ubelt.odict', 'ub.odict', ([], {}), '()\n', (1330, 1332), True, 'import ubelt as ub\n'), ((1691, 1743), 'netharn.data.ToyData2d', 'nh.data.ToyData2d', ([], {'size': 'size', 'bord... |
import logging
from asyncio import gather
from virtool.db.utils import get_one_field
from virtool.jobs.db import PROJECTION, cancel
logger = logging.getLogger(__name__)
WORKFLOW_NAMES = (
"jobs_build_index",
"jobs_create_sample",
"jobs_create_subtraction",
"jobs_aodp",
"jobs_nuvs",
"jobs_pat... | [
"logging.getLogger",
"asyncio.gather",
"virtool.jobs.db.cancel",
"virtool.db.utils.get_one_field"
] | [((143, 170), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (160, 170), False, 'import logging\n'), ((513, 560), 'virtool.db.utils.get_one_field', 'get_one_field', (['self.db.jobs', '"""workflow"""', 'job_id'], {}), "(self.db.jobs, 'workflow', job_id)\n", (526, 560), False, 'from virtool... |
""" manifests for tsrc """
import operator
from typing import cast, Any, Dict, List, Optional # noqa
from path import Path
import schema
import tsrc
class RepoNotFound(tsrc.Error):
def __init__(self, src: str) -> None:
super().__init__("No repo found in '%s'" % src)
class Manifest:
def __init__(... | [
"operator.attrgetter",
"schema.Optional",
"schema.Use",
"tsrc.GroupList",
"schema.SchemaError",
"tsrc.Remote",
"tsrc.Copy",
"tsrc.parse_config",
"tsrc.Repo"
] | [((4808, 4833), 'schema.Use', 'schema.Use', (['validate_repo'], {}), '(validate_repo)\n', (4818, 4833), False, 'import schema\n'), ((5342, 5391), 'tsrc.parse_config', 'tsrc.parse_config', (['manifest_path', 'manifest_schema'], {}), '(manifest_path, manifest_schema)\n', (5359, 5391), False, 'import tsrc\n'), ((1479, 154... |
""" adaptation of part of <NAME>'s libvaxdata test suite for <NAME>'s PyVAX wrapper
Authors
-------
| <NAME> (<EMAIL>)
<NAME>
University of California, Los Angeles.
"""
import pyvax as pv
import numpy as np
from pytest import approx
def func_i2(x):
fstr = pv.from_vax_i2(x)
print(np.frombuffer(fstr, dtyp... | [
"pytest.approx",
"pyvax.from_vax_g8",
"pyvax.from_vax_i2",
"numpy.frombuffer",
"pyvax.from_vax_d8",
"pyvax.from_vax_r4",
"pyvax.from_vax_i4"
] | [((268, 285), 'pyvax.from_vax_i2', 'pv.from_vax_i2', (['x'], {}), '(x)\n', (282, 285), True, 'import pyvax as pv\n'), ((353, 397), 'numpy.frombuffer', 'np.frombuffer', (['fstr'], {'dtype': 'np.int16', 'count': '(1)'}), '(fstr, dtype=np.int16, count=1)\n', (366, 397), True, 'import numpy as np\n'), ((426, 443), 'pyvax.f... |
'''
A script to blind the files in a directory for analysis. Ensure that this
script is placed in the original directory with the original files to be
blinded. It is non-destructive and will create a copy of the files to be
blinded and record their identities to a text file.
'''
from pathlib import Path
import shuti... | [
"pathlib.Path.cwd",
"os.listdir",
"random.shuffle",
"shutil.copy"
] | [((477, 489), 'os.listdir', 'os.listdir', ([], {}), '()\n', (487, 489), False, 'import shutil, os\n'), ((490, 515), 'random.shuffle', 'random.shuffle', (['directory'], {}), '(directory)\n', (504, 515), False, 'import random\n'), ((649, 659), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (657, 659), False, 'from pat... |
# -*- coding: utf-8 -*-
#
"""
https://github.com/RDFLib/pySHACL/issues/108
"""
from pyshacl import validate
# from DASH
shacl_file_text = """
@prefix dash: <http://datashapes.org/dash#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org... | [
"pyshacl.validate"
] | [((1118, 1167), 'pyshacl.validate', 'validate', (['shacl_file_text'], {'advanced': '(True)', 'js': '(True)'}), '(shacl_file_text, advanced=True, js=True)\n', (1126, 1167), False, 'from pyshacl import validate\n')] |
from sql_base_action_test_case import SqlBaseActionTestCase
from lib.base_action import BaseAction
from st2common.runners.base_action import Action
from delete import SQLDeleteAction
import mock
__all__ = [
'TestActionSQLDeleteAction'
]
class TestActionSQLDeleteAction(SqlBaseActionTestCase):
__test__ = Tru... | [
"mock.Mock",
"mock.patch"
] | [((584, 638), 'mock.patch', 'mock.patch', (['"""lib.base_action.BaseAction.db_connection"""'], {}), "('lib.base_action.BaseAction.db_connection')\n", (594, 638), False, 'import mock\n'), ((644, 675), 'mock.patch', 'mock.patch', (['"""delete.sqlalchemy"""'], {}), "('delete.sqlalchemy')\n", (654, 675), False, 'import moc... |
"""Transformation of the FERC Form 714 data."""
import logging
import pathlib
import re
import geopandas
import numpy as np
import pandas as pd
import pudl
import pudl.constants as pc
logger = logging.getLogger(__name__)
##############################################################################
# Constants req... | [
"logging.getLogger",
"pandas.to_timedelta",
"geopandas.read_file",
"pathlib.Path",
"pandas.Int64Dtype",
"pandas.Timedelta",
"pandas.StringDtype",
"re.match",
"pudl.helpers.convert_cols_dtypes",
"pandas.to_numeric",
"pandas.concat",
"pandas.to_datetime"
] | [((197, 224), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (214, 224), False, 'import logging\n'), ((3832, 3862), 'pandas.Timedelta', 'pd.Timedelta', (['(-5)'], {'unit': '"""hours"""'}), "(-5, unit='hours')\n", (3844, 3862), True, 'import pandas as pd\n'), ((3895, 3925), 'pandas.Timedel... |
import csv
from os import listdir
from os.path import isfile, join
import numpy as np
import pandas as pd
from scipy.io import arff
from clustering_algorithms import CLARA, PAM, get_initial_points
from data_loaders import load_data
from timer import Timer
from visualizers import plot_data
DIRECTORY = "datasets/artif... | [
"clustering_algorithms.get_initial_points",
"numpy.mean",
"os.path.join",
"data_loaders.load_data",
"timer.Timer"
] | [((720, 741), 'os.path.join', 'join', (['DIRECTORY', 'file'], {}), '(DIRECTORY, file)\n', (724, 741), False, 'from os.path import isfile, join\n'), ((761, 780), 'data_loaders.load_data', 'load_data', (['filepath'], {}), '(filepath)\n', (770, 780), False, 'from data_loaders import load_data\n'), ((803, 862), 'clustering... |
from bats.lib import comparelog
from bats.lib.Error import Error
class Item(object):
def __init__(self, file, properties, error=None):
self.file = file
self.properties = properties
self.error = error
def has_error(self, check, target_item_file=None):
if self.error:
... | [
"bats.lib.comparelog.print_error"
] | [((321, 621), 'bats.lib.comparelog.print_error', 'comparelog.print_error', ([], {'msg': 'self.error.message', 'args': "{'testName': check.testName, 'checkName': check.checkName, 'cardinality':\n check.cardinality, 'targetItem': target_item_file, 'type': self.error.\n type, 'source': self.file}", 'console': '(chec... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 8 16:58:10 2020
@author: nephilim
"""
import keras
import numpy as np
import my_Im2col
from matplotlib import pyplot,cm
import skimage.transform
import T_PowerGain
import DataNormalized
import Reshape2Encoder
def GetPatch(Image,patch_size,sliding... | [
"keras.layers.Conv2D",
"numpy.log10",
"Reshape2Encoder.ReshapeData2Encoder",
"numpy.array",
"keras.layers.Dense",
"numpy.arange",
"matplotlib.pyplot.imshow",
"keras.models.Model",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.savefig",
"my_Im2col.my_im2col",
"keras.layers.Flatten",
"keras.lay... | [((341, 391), 'my_Im2col.my_im2col', 'my_Im2col.my_im2col', (['Image', 'patch_size', 'slidingDis'], {}), '(Image, patch_size, slidingDis)\n', (360, 391), False, 'import my_Im2col\n'), ((458, 476), 'numpy.sum', 'np.sum', (['(Image ** 2)'], {}), '(Image ** 2)\n', (464, 476), True, 'import numpy as np\n'), ((489, 517), 'n... |
import Adafruit_BMP.BMP085 as BMP085
sensor = BMP085.BMP085()
temp = '{0:0.2f}'.format(sensor.read_temperature())
pressure = '{0:0.2f}'.format(sensor.read_pressure())
altitude = '{0:0.2f}'.format(sensor.read_altitude())
seaalevelPressure = '{0:0.2f}'.format(sensor.read_sealevel_pressure())
print(type(temp))
| [
"Adafruit_BMP.BMP085.BMP085"
] | [((46, 61), 'Adafruit_BMP.BMP085.BMP085', 'BMP085.BMP085', ([], {}), '()\n', (59, 61), True, 'import Adafruit_BMP.BMP085 as BMP085\n')] |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... | [
"config_loader.try_load_from_file",
"hpOneView.oneview_client.OneViewClient",
"pprint.pprint"
] | [((1534, 1560), 'config_loader.try_load_from_file', 'try_load_from_file', (['config'], {}), '(config)\n', (1552, 1560), False, 'from config_loader import try_load_from_file\n'), ((1579, 1600), 'hpOneView.oneview_client.OneViewClient', 'OneViewClient', (['config'], {}), '(config)\n', (1592, 1600), False, 'from hpOneView... |
from django.views.generic import TemplateView, ListView
from .models import Spool
from django.db.models import Q
# Create your views here.
class HomePageView(TemplateView):
template_name = 'home.html'
class SearchResultsView(ListView):
model = Spool
template_name = 'search_results.html'
def get_q... | [
"django.db.models.Q"
] | [((433, 445), 'django.db.models.Q', 'Q', ([], {'tag': 'query'}), '(tag=query)\n', (434, 445), False, 'from django.db.models import Q\n'), ((448, 462), 'django.db.models.Q', 'Q', ([], {'level': 'query'}), '(level=query)\n', (449, 462), False, 'from django.db.models import Q\n')] |
# -*- coding: latin-1 -*-
# Copyright 2018 Google 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 applicable la... | [
"os.path.isfile",
"os.unlink"
] | [((1250, 1275), 'os.path.isfile', 'os.path.isfile', (['kTestFile'], {}), '(kTestFile)\n', (1264, 1275), False, 'import os\n'), ((1283, 1303), 'os.unlink', 'os.unlink', (['kTestFile'], {}), '(kTestFile)\n', (1292, 1303), False, 'import os\n'), ((1325, 1350), 'os.path.isfile', 'os.path.isfile', (['kTestFile'], {}), '(kTe... |
import tkinter as tk
from tkinter import CENTER
class WaitingPage:
def __init__(self, parent_frame, width, height):
self.waiting_frame = None
self.count = 1
self.parent_frame = parent_frame
self.width = width
self.height = height
self.waiting_text = "Waiting to con... | [
"tkinter.Frame",
"tkinter.Label"
] | [((524, 563), 'tkinter.Frame', 'tk.Frame', (['self.parent_frame'], {'bg': '"""black"""'}), "(self.parent_frame, bg='black')\n", (532, 563), True, 'import tkinter as tk\n'), ((697, 801), 'tkinter.Label', 'tk.Label', (['self.waiting_frame'], {'text': 'self.waiting_text', 'bg': '"""black"""', 'fg': '"""white"""', 'font': ... |
from chalice import Chalice, Response
import shortid
import boto3
import os
dynamodb = boto3.resource('dynamodb')
sid = shortid.ShortId()
app = Chalice(app_name=os.environ['DB_NAME'])
@app.route('/{code}', cors = True)
def get_original_url(code):
table = dynamodb.Table(os.environ['DB_NAME'])
try:
resp... | [
"boto3.resource",
"chalice.Chalice",
"shortid.ShortId",
"chalice.Response"
] | [((88, 114), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (102, 114), False, 'import boto3\n'), ((121, 138), 'shortid.ShortId', 'shortid.ShortId', ([], {}), '()\n', (136, 138), False, 'import shortid\n'), ((145, 184), 'chalice.Chalice', 'Chalice', ([], {'app_name': "os.environ['DB_NAM... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | [
"os.system"
] | [((2497, 2563), 'os.system', 'os.system', (["('pdftk %s generate_fdf output /tmp/toto.fdf' % filename)"], {}), "('pdftk %s generate_fdf output /tmp/toto.fdf' % filename)\n", (2506, 2563), False, 'import os\n'), ((2739, 2826), 'os.system', 'os.system', (["('pdftk %s fill_form /tmp/toto.fdf output %s flatten' % (infile, ... |
# Build yak packages for publishing
import os
import shutil
import sys
src_dir = os.path.dirname(os.path.realpath(__file__))
dist_dir = os.path.join(src_dir, 'dist')
# clear output dir
if os.path.exists(dist_dir):
shutil.rmtree(dist_dir)
# build hops (inc. self-contained rhino.compute.exe)
os.chdir(src_dir)
buil... | [
"os.path.exists",
"os.listdir",
"sys.exit",
"os.path.join",
"os.chdir",
"os.path.realpath",
"shutil.copy",
"shutil.rmtree",
"os.system"
] | [((137, 166), 'os.path.join', 'os.path.join', (['src_dir', '"""dist"""'], {}), "(src_dir, 'dist')\n", (149, 166), False, 'import os\n'), ((190, 214), 'os.path.exists', 'os.path.exists', (['dist_dir'], {}), '(dist_dir)\n', (204, 214), False, 'import os\n'), ((298, 315), 'os.chdir', 'os.chdir', (['src_dir'], {}), '(src_d... |
"""Collection of CapsuleNet variants
The reference paper:
- Dynamic Routing Between Capsules
- <NAME>, <NAME>, <NAME>
- https://arxiv.org/abs/1710.09829
The reference implementations:
1. TensorFlow CapsNet
- https://github.com/naturomics/CapsNet-Tensorflow
2. Keras CapsNet
- https://github.com/XifengGuo/CapsNe... | [
"tensorflow.get_variable",
"tensorflow.variable_scope",
"tensorflow.multiply",
"tensorflow.sqrt",
"tensorflow.matmul",
"tensorflow.square",
"tensorflow.expand_dims",
"tensorflow.zeros"
] | [((1112, 1144), 'tensorflow.multiply', 'tf.multiply', (['x', 'scale'], {'name': 'name'}), '(x, scale, name=name)\n', (1123, 1144), True, 'import tensorflow as tf\n'), ((1732, 1825), 'tensorflow.get_variable', 'tf.get_variable', (['"""weights"""'], {'shape': '(filters0, length0, filters * length)', 'dtype': 'tf.float32'... |
import sys
import numpy as np
np.set_printoptions(precision=2, threshold=sys.maxsize)
from scipy.linalg import block_diag
from qpsolvers import solve_qp
from util import util
from pnc.data_saver import DataSaver
class IHWBC(object):
"""
Implicit Hierarchy Whole Body Control
------------------
Usage:... | [
"numpy.copy",
"numpy.eye",
"pnc.data_saver.DataSaver",
"qpsolvers.solve_qp",
"numpy.dot",
"numpy.zeros",
"numpy.concatenate",
"scipy.linalg.block_diag",
"util.util.weighted_pinv",
"numpy.set_printoptions"
] | [((31, 86), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'threshold': 'sys.maxsize'}), '(precision=2, threshold=sys.maxsize)\n', (50, 86), True, 'import numpy as np\n'), ((1512, 1524), 'numpy.copy', 'np.copy', (['val'], {}), '(val)\n', (1519, 1524), True, 'import numpy as np\n'), ((1975, 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" **Module summary**: Very basic management script for the Flask API
OTRS Tutorial. In a real app, you would register commands to further
automate your work. Check out the Flask-Script, Flask-Runner or the
Flask command line interface (CLI) new in version 0.11.
"""
from... | [
"logging.getLogger",
"os.path.exists",
"logging.StreamHandler",
"os.getenv",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"os.path.join",
"os.access",
"flask_debugtoolbar.DebugToolbarExtension",
"os.path.dirname",
"os.path.isdir",
"os.mkdir",
"sys.exit"
] | [((690, 716), 'flask_debugtoolbar.DebugToolbarExtension', 'DebugToolbarExtension', (['app'], {}), '(app)\n', (711, 716), False, 'from flask_debugtoolbar import DebugToolbarExtension\n'), ((1316, 1350), 'os.path.join', 'os.path.join', (['BASEDIR', 'log_basedir'], {}), '(BASEDIR, log_basedir)\n', (1328, 1350), False, 'im... |
import os
import sys
import unittest
import HtmlTestRunner
import cv2.cv2 as cv2
import numpy as np
current_path = os.path.dirname(os.path.abspath(__file__))
list_paths = [os.sep.join([current_path, os.pardir, 'src']), os.sep.join([current_path, os.pardir])]
for path in list_paths:
if path not in sys.path:
... | [
"HtmlTestRunner.HTMLTestRunner",
"unittest.TestSuite",
"sys.path.insert",
"cv2.cv2.imread",
"os.path.join",
"MapSlicer.MapSlicer",
"os.sep.join",
"TrafficDetector.TrafficDetector",
"numpy.nonzero",
"os.path.abspath",
"unittest.TextTestRunner"
] | [((441, 479), 'os.path.join', 'os.path.join', (['current_path', '"""../data/"""'], {}), "(current_path, '../data/')\n", (453, 479), False, 'import os\n'), ((132, 157), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'import os\n'), ((173, 218), 'os.sep.join', 'os.sep.join', ... |
"""
auth.py
Defines all routes that are used specifically for authentication. Used to identify
scans to a user.
"""
import os
import binascii
import hashlib
from flask import render_template, request, redirect, flash, url_for
from flask_login import login_user, logout_user
from boa import db
from boa.routes ... | [
"flask.render_template",
"hashlib.sha256",
"boa.db.session.add",
"flask.flash",
"flask_login.login_user",
"boa.forms.LoginForm",
"flask_login.logout_user",
"os.urandom",
"boa.routes.web.route",
"boa.models.User",
"flask.url_for",
"boa.db.session.commit",
"boa.models.User.query.filter_by",
... | [((774, 818), 'boa.routes.web.route', 'web.route', (['"""/login"""'], {'methods': "['GET', 'POST']"}), "('/login', methods=['GET', 'POST'])\n", (783, 818), False, 'from boa.routes import web\n'), ((1776, 1823), 'boa.routes.web.route', 'web.route', (['"""/register"""'], {'methods': "['GET', 'POST']"}), "('/register', me... |
'''This file contains the method used to identify the denomination of the uploaded image'''
# from matplotlib import pyplot as plt
from cv2 import cv2
from os import listdir
import matplotlib.pyplot as plt
from preprocessing.processing import readImage
# from preprocessing.processing import resizeImage, imageToGray, ... | [
"os.listdir",
"cv2.cv2.imread",
"preprocessing.processing.readImage",
"cv2.cv2.ORB_create",
"cv2.cv2.BFMatcher",
"cv2.cv2.cvtColor",
"cv2.cv2.drawMatches"
] | [((617, 661), 'cv2.cv2.ORB_create', 'cv2.ORB_create', ([], {'scoreType': 'cv2.ORB_FAST_SCORE'}), '(scoreType=cv2.ORB_FAST_SCORE)\n', (631, 661), False, 'from cv2 import cv2\n'), ((677, 696), 'preprocessing.processing.readImage', 'readImage', (['filePath'], {}), '(filePath)\n', (686, 696), False, 'from preprocessing.pro... |
import sys
from django.core.management.base import BaseCommand
from elections.constraints import check_constraints, ViolatedConstraint
from elections.models import Election
class Command(BaseCommand):
def handle(self, *args, **kwargs):
elections = Election.private_objects.all()
exitcode = 0
... | [
"elections.constraints.check_constraints",
"elections.models.Election.private_objects.all",
"sys.exit"
] | [((262, 292), 'elections.models.Election.private_objects.all', 'Election.private_objects.all', ([], {}), '()\n', (290, 292), False, 'from elections.models import Election\n'), ((533, 551), 'sys.exit', 'sys.exit', (['exitcode'], {}), '(exitcode)\n', (541, 551), False, 'import sys\n'), ((382, 409), 'elections.constraints... |
#!/usr/bin/env python
"""
Hmm maybe its impossible to get anywhere with integral without first fixing the BetaInverse
In [22]: pw.subs(b, 1.55)
Out[2... | [
"sympy.symbols",
"numpy.array",
"sympy.Piecewise",
"sympy.Max"
] | [((773, 1084), 'numpy.array', 'np.array', (['[[1.55, 1.478], [1.795, 1.48], [2.105, 1.484], [2.271, 1.486], [2.551, \n 1.492], [2.845, 1.496], [3.064, 1.499], [4.133, 1.526], [6.2, 1.619], [\n 6.526, 1.618], [6.889, 1.527], [7.294, 1.554], [7.75, 1.793], [8.267, \n 1.783], [8.857, 1.664], [9.538, 1.554], [10.3... |
import requests
from django.db.models import Q
from crawlers.models import Player
from crawlers.serializers import PlayerSerializer
from crawlers.views import success_rsp, ViewSet
from rq import Queue
from worker import conn
q = Queue(connection=conn)
def get_user_info(user_id):
user_detail_url = 'http://cgi.a... | [
"crawlers.views.success_rsp",
"crawlers.models.Player.objects.update_or_create",
"crawlers.serializers.PlayerSerializer",
"crawlers.models.Player.objects.filter",
"requests.get",
"rq.Queue",
"django.db.models.Q"
] | [((233, 255), 'rq.Queue', 'Queue', ([], {'connection': 'conn'}), '(connection=conn)\n', (238, 255), False, 'from rq import Queue\n'), ((446, 475), 'requests.get', 'requests.get', (['user_detail_url'], {}), '(user_detail_url)\n', (458, 475), False, 'import requests\n'), ((684, 711), 'requests.get', 'requests.get', (['us... |
# coding: utf-8
# In[1]:
import magma as m
m.set_mantle_target("coreir")
import mantle
def DefineAdder(N):
T = m.UInt(N)
class Adder(m.Circuit):
name = "Adder{}".format(N)
IO = ["I0", m.In(T), "I1", m.In(T), "CIN", m.In(m.Bit),
"O", m.Out(T), "COUT", m.Out(m.Bit)]
@cla... | [
"magma.compile",
"magma.In",
"magma.UInt",
"magma.Out",
"magma.fold",
"mantle.FullAdder",
"magma.set_mantle_target",
"fault.test_vectors.generate_simulator_test_vectors",
"magma.wire"
] | [((47, 76), 'magma.set_mantle_target', 'm.set_mantle_target', (['"""coreir"""'], {}), "('coreir')\n", (66, 76), True, 'import magma as m\n'), ((689, 739), 'magma.compile', 'm.compile', (['"""build/Adder4"""', 'Adder4'], {'output': '"""coreir"""'}), "('build/Adder4', Adder4, output='coreir')\n", (698, 739), True, 'impor... |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# copy supplier_address to address_display, and set supplier_address to blank
stock_entries = frappe.db.sql(""" select name, purchase_order, s... | [
"frappe.db.sql",
"frappe.reload_doc"
] | [((272, 428), 'frappe.db.sql', 'frappe.db.sql', (['""" select name, purchase_order, supplier_address from `tabStock Entry`\n\t\twhere ifnull(supplier_address, \'\') <> \'\'"""'], {'as_dict': '(True)'}), '(\n """ select name, purchase_order, supplier_address from `tabStock Entry`\n\t\twhere ifnull(supplier_address, \... |
import argparse
import importlib
from common import TimedValue, timed
def main(args: argparse.Namespace):
try:
with open(args.file) as f:
contents = f.read().splitlines()
except FileNotFoundError:
print(f"File {args.file} does not exist, exiting...")
exit(1)
day_module ... | [
"common.timed",
"importlib.import_module",
"argparse.ArgumentParser"
] | [((322, 363), 'importlib.import_module', 'importlib.import_module', (['f"""day{args.day}"""'], {}), "(f'day{args.day}')\n", (345, 363), False, 'import importlib\n'), ((776, 801), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (799, 801), False, 'import argparse\n'), ((395, 427), 'common.timed',... |
import numpy as np
#---------------------------------------------------------
#Read in transition counts between cells (N_alpha_beta)
#---------------------------------------------------------
def compute_Nab_Ta(trajectory_crossings,N,i):
'''
Compute N_a_b and T_a for one individual trajectory at one individ... | [
"numpy.linalg.solve",
"numpy.ones",
"numpy.log",
"numpy.random.exponential",
"numpy.array",
"numpy.sum",
"numpy.zeros",
"numpy.random.randint",
"numpy.random.uniform"
] | [((560, 584), 'numpy.zeros', 'np.zeros', (['(N - 1, N - 1)'], {}), '((N - 1, N - 1))\n', (568, 584), True, 'import numpy as np\n'), ((591, 606), 'numpy.zeros', 'np.zeros', (['(N - 1)'], {}), '(N - 1)\n', (599, 606), True, 'import numpy as np\n'), ((657, 672), 'numpy.sum', 'np.sum', (['l[:, 1]'], {}), '(l[:, 1])\n', (66... |
from backend.api_schemas import amount
from backend.api_schemas import StrippedString
from colander import Decimal as colanderDecimal
from colander import Invalid
from colander import null
from colander import String
from decimal import Decimal
from unittest import TestCase
class TestAmount(TestCase):
def _make(... | [
"backend.api_schemas.StrippedString",
"decimal.Decimal",
"backend.api_schemas.amount"
] | [((342, 350), 'backend.api_schemas.amount', 'amount', ([], {}), '()\n', (348, 350), False, 'from backend.api_schemas import amount\n'), ((646, 661), 'decimal.Decimal', 'Decimal', (['"""1.46"""'], {}), "('1.46')\n", (653, 661), False, 'from decimal import Decimal\n'), ((754, 769), 'decimal.Decimal', 'Decimal', (['"""1.4... |
#!/usr/bin/env python3
"""
usage: head.py [-h] [-n COUNT] [FILE ...]
show just the leading lines of a file
positional arguments:
FILE the file to drop trailing lines from (default: stdin)
options:
-h, --help show this help message and exit
-n COUNT, --lines COUNT
... | [
"argdoc.parse_args",
"argdoc.format_usage",
"sys.stderr.write",
"sys.exit"
] | [((970, 989), 'argdoc.parse_args', 'argdoc.parse_args', ([], {}), '()\n', (987, 989), False, 'import argdoc\n'), ((1104, 1157), 'sys.stderr.write', 'sys.stderr.write', (['"""head.py: error: not implemented\n"""'], {}), "('head.py: error: not implemented\\n')\n", (1120, 1157), False, 'import sys\n'), ((1162, 1173), 'sys... |
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, redirect, request, current_app, g, flash, url_for
from flask_login import login_required, logout_user
from flask_babel import gettext as _
from .models import User
from ..extensions import db
from .forms import SettingsForm
auth = Blueprint('auth',... | [
"flask.render_template",
"flask.request.args.get",
"flask_login.logout_user",
"flask.url_for",
"flask.redirect",
"flask_babel.gettext",
"flask.Blueprint"
] | [((303, 380), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'url_prefix': '"""/auth/"""', 'template_folder': '"""templates"""'}), "('auth', __name__, url_prefix='/auth/', template_folder='templates')\n", (312, 380), False, 'from flask import Blueprint, render_template, redirect, request, current_app, g,... |
import pandas
if __name__ == "__main__":
data = pandas.read_csv("nato_phonetic_alphabet.csv")
phonetic_dict = {row.letter: row.code for (index, row) in data.iterrows()}
print(phonetic_dict)
word = input("Enter a word: ").upper()
output_list = [phonetic_dict[letter] for letter in word]
print(ou... | [
"pandas.read_csv"
] | [((54, 99), 'pandas.read_csv', 'pandas.read_csv', (['"""nato_phonetic_alphabet.csv"""'], {}), "('nato_phonetic_alphabet.csv')\n", (69, 99), False, 'import pandas\n')] |
# -*- coding: utf-8 -*-
from urlparse import parse_qsl
import sys
params = dict(parse_qsl(sys.argv[2].replace('?','')))
action = params.get('action')
icon = params.get('icon')
id = params.get('id')
type = params.get('type')
name = params.get('name')
title = params.get('title')
year = params.get('year')
imdb = ... | [
"resources.lib.api.aptoide.searchApp",
"resources.lib.indexers.navigator.navigator",
"resources.lib.api.aptoide.AppSelect",
"resources.lib.api.aptoide.getPopulars",
"resources.lib.api.aptoide.getGames",
"resources.lib.api.aptoide.getApplications",
"resources.lib.api.aptoide.getStore"
] | [((920, 954), 'resources.lib.api.aptoide.getPopulars', 'aptoide.getPopulars', ([], {'offset': 'offset'}), '(offset=offset)\n', (939, 954), False, 'from resources.lib.api import aptoide\n'), ((817, 838), 'resources.lib.indexers.navigator.navigator', 'navigator.navigator', ([], {}), '()\n', (836, 838), False, 'from resou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Provide the wrench task.
The wrench task tries to generate a wrench near the desired one by minimizing:
.. math:: || w - k (w_{des} - w_t) ||^2
where :math:`w = [f \tau] \in \mathbb{R}^6` is the wrench vector being optimized, :math:`k` is a proportional gain,
:math:`... | [
"numpy.asarray"
] | [((3525, 3545), 'numpy.asarray', 'np.asarray', (['wrenches'], {}), '(wrenches)\n', (3535, 3545), True, 'import numpy as np\n'), ((4340, 4360), 'numpy.asarray', 'np.asarray', (['wrenches'], {}), '(wrenches)\n', (4350, 4360), True, 'import numpy as np\n')] |
"""
This benchmark compares the performance of:
* selectinload()
* selectinquery() with query caching
* selectinquery() with no query caching
"""
from tests.benchmarks.benchmark_utils import benchmark_parallel_funcs
from tests.models import get_big_db_for_benchmarks, User
from mongosql import CountingQuery
# Init DB
... | [
"tests.benchmarks.benchmark_utils.benchmark_parallel_funcs",
"tests.models.get_big_db_for_benchmarks"
] | [((338, 373), 'tests.models.get_big_db_for_benchmarks', 'get_big_db_for_benchmarks', (['(50)', '(0)', '(0)'], {}), '(50, 0, 0)\n', (363, 373), False, 'from tests.models import get_big_db_for_benchmarks, User\n'), ((806, 884), 'tests.benchmarks.benchmark_utils.benchmark_parallel_funcs', 'benchmark_parallel_funcs', (['N_... |
import numpy as np
def trans():
print("Transpose of matrix:")
#Enter rows and columns
row=int(input("Enter number of rows:"))
column=int(input("Enter number of columns:"))
print("Enter the elements of Matrix:")
matrix_a= [[int(input()) for i in range(column)] for i in range(row)]
print("Matrix is: ")
f... | [
"numpy.array"
] | [((362, 380), 'numpy.array', 'np.array', (['matrix_a'], {}), '(matrix_a)\n', (370, 380), True, 'import numpy as np\n')] |
import json
import os
from pymongo import MongoClient
import requests
DATA_DIR = './data'
client = MongoClient(port=27017)
db=client.newspaper
pages = db.source.find({}, {'_id':0,'name':1, 'fullname':1})
print(list(pages)) | [
"pymongo.MongoClient"
] | [((100, 123), 'pymongo.MongoClient', 'MongoClient', ([], {'port': '(27017)'}), '(port=27017)\n', (111, 123), False, 'from pymongo import MongoClient\n')] |
import jinja2
from lib.notify.all_notifiers import get_notifier_class, DEFAULT_NOTIFIER
from logic import user as user_logic
from app.db import with_session
@with_session
def notify_user(user, template_name, template_params, notifier_name=None, session=None):
if notifier_name is None:
notification_prefere... | [
"logic.user.get_user_settings",
"lib.notify.all_notifiers.get_notifier_class",
"jinja2.FileSystemLoader"
] | [((661, 694), 'lib.notify.all_notifiers.get_notifier_class', 'get_notifier_class', (['notifier_name'], {}), '(notifier_name)\n', (679, 694), False, 'from lib.notify.all_notifiers import get_notifier_class, DEFAULT_NOTIFIER\n'), ((326, 412), 'logic.user.get_user_settings', 'user_logic.get_user_settings', (['user.id', '"... |
from django.db import models
class City(models.Model):
city_name = models.CharField(max_length=30)
country = models.CharField(max_length=30)
@classmethod
def get_default_city(cls):
return cls.objects.get_or_create(city_name='*unknown')
@classmethod
def get_deleted_city(cls):
... | [
"inspect.getmembers",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((73, 104), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (89, 104), False, 'from django.db import models\n'), ((119, 150), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (135, 150), False, 'from django.db impo... |
import sys
import argparse
import subprocess
import os
from datetime import datetime
import random
username="sanchayana2007"
token= os.environ.get("GIT_TOKEN")
#Random int to create the value
j= random.randint(0,1)
################ RAndom file creator for chein in ##################
if j:
if os.path.isfile("./t... | [
"subprocess.check_output",
"os.environ.get",
"os.path.isfile",
"datetime.datetime.now",
"os.path.isdir",
"random.randint"
] | [((133, 160), 'os.environ.get', 'os.environ.get', (['"""GIT_TOKEN"""'], {}), "('GIT_TOKEN')\n", (147, 160), False, 'import os\n'), ((199, 219), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (213, 219), False, 'import random\n'), ((853, 876), 'os.path.isdir', 'os.path.isdir', (['"""./.git"""'], {... |
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,2*np.pi,101)
s=np.sin(x)
c=np.cos(x)
plt.close('all')
plt.subplot(2,2,1)
plt.plot(x,s,'b+',x,c,'r+')
plt.axis('tight')
plt.subplot(2,2,2)
plt.plot(x,s)
plt.grid()
plt.xlabel('radians')
plt.ylabel('amplitudes')
plt.title('sin(x)')
plt.axis('tight')
plt... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot"
] | [((53, 83), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(101)'], {}), '(0, 2 * np.pi, 101)\n', (64, 83), True, 'import numpy as np\n'), ((82, 91), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (88, 91), True, 'import numpy as np\n'), ((94, 103), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (100, 103), True... |
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn.functional as F
from torch import nn
import os
import matplotlib.pyplot as plt
import sys
import numpy as np
sys.path.append('./')
from args import opt
sys.path.append('./lib/')
from dataset import FruitFlyNeuronDataset
from cv2... | [
"torch.nn.ConvTranspose2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"cv2transforms.composed_transforms",
"numpy.reshape",
"torch.nn.Dropout",
"torch.nn.Sequential",
"utils.initialize_weights",
"utils.show_patches",
"os.path.join",
"torch.nn.Conv2d",
"dataset.FruitFlyNeuronDataset",
"torch.n... | [((201, 222), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (216, 222), False, 'import sys\n'), ((244, 269), 'sys.path.append', 'sys.path.append', (['"""./lib/"""'], {}), "('./lib/')\n", (259, 269), False, 'import sys\n'), ((670, 691), 'cv2transforms.composed_transforms', 'composed_transforms', ... |
'''
https://github.com/makifozkanoglu/MultiResUNet-PyTorch/blob/main/multiresunet.py
'''
import jittor as jt
from jittor import init
from jittor import nn
def Conv2dSame(in_channels, out_channels, kernel_size, use_bias=True, padding_layer=nn.ReflectionPad2d):
ka = (kernel_size // 2)
kb = ((ka - 1) if ((kernel... | [
"jittor.nn.Conv",
"jittor.nn.cross_entropy_loss",
"jittor.nn.relu",
"jittor.nn.ConvTranspose",
"jittor.add",
"jittor.nn.Dropout",
"jittor.nn.Pool",
"jittor.nn.ReLU",
"jittor.ones",
"jittor.contrib.concat",
"jittor.nn.BatchNorm",
"jittor.nn.Sequential"
] | [((782, 806), 'jittor.nn.Sequential', 'nn.Sequential', (['*sequence'], {}), '(*sequence)\n', (795, 806), False, 'from jittor import nn\n'), ((6311, 6336), 'jittor.ones', 'jt.ones', (['[2, 3, 512, 512]'], {}), '([2, 3, 512, 512])\n', (6318, 6336), True, 'import jittor as jt\n'), ((391, 453), 'jittor.nn.Conv', 'nn.Conv',... |
import os
import sys
sys.path.append('../')
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
import pygsp as pg
from modules.my_io import readDatasets
from modules import xsphere
# Plotting options
import matplotlib
matplotlib.use('cairo') # Cairo
ma... | [
"matplotlib.use",
"cartopy.crs.Orthographic",
"os.path.join",
"sys.path.append",
"modules.my_io.readDatasets",
"cartopy.crs.Geodetic"
] | [((21, 43), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (36, 43), False, 'import sys\n'), ((286, 309), 'matplotlib.use', 'matplotlib.use', (['"""cairo"""'], {}), "('cairo')\n", (300, 309), False, 'import matplotlib\n'), ((1222, 1237), 'cartopy.crs.Geodetic', 'ccrs.Geodetic', ([], {}), '()\n'... |
from formation import fields as F
from formation.field_types import MultiValueField
from formation.fields import get_field_index
from formation.form_base import Form
from formation.forms import county_form_selector
EDITABLE_FIELDS = {
F.ContactPreferences,
F.FirstName,
F.MiddleName,
F.LastName,
F.... | [
"formation.fields.SocialSecurityNumberField",
"formation.fields.DriverLicenseOrIDNumber",
"formation.forms.county_form_selector.get_combined_form_spec"
] | [((922, 992), 'formation.forms.county_form_selector.get_combined_form_spec', 'county_form_selector.get_combined_form_spec', ([], {'counties': 'all_county_slugs'}), '(counties=all_county_slugs)\n', (965, 992), False, 'from formation.forms import county_form_selector\n'), ((1172, 1244), 'formation.forms.county_form_selec... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.BoardListView.as_view(), name='home'),
path('boards/<int:pk>/', views.TopicListView.as_view(), name='board_topics'),
path('boards/<int:pk>/new/', views.new_topic, name='new_topic'),
path('boards/<int:pk>/topics/<int:topic_... | [
"django.urls.path"
] | [((211, 274), 'django.urls.path', 'path', (['"""boards/<int:pk>/new/"""', 'views.new_topic'], {'name': '"""new_topic"""'}), "('boards/<int:pk>/new/', views.new_topic, name='new_topic')\n", (215, 274), False, 'from django.urls import path\n'), ((382, 477), 'django.urls.path', 'path', (['"""boards/<int:pk>/topics/<int:to... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class JobApplicantInterviewSheet(Document):
def validate(self):
calculate_average_score(self)
def... | [
"frappe.whitelist",
"frappe.get_doc"
] | [((852, 870), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (868, 870), False, 'import frappe\n'), ((934, 976), 'frappe.get_doc', 'frappe.get_doc', (['"""Interview"""', 'template_name'], {}), "('Interview', template_name)\n", (948, 976), False, 'import frappe\n'), ((1097, 1142), 'frappe.get_doc', 'frappe.ge... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import nowdate, add_months
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_... | [
"frappe.db.exists",
"frappe.db.get_value",
"frappe.set_user",
"erpnext.tests.utils.create_test_contact_and_address",
"erpnext.shopping_cart.cart.get_party",
"frappe.utils.nowdate",
"erpnext.shopping_cart.cart._get_cart_quotation",
"erpnext.shopping_cart.cart.update_cart",
"frappe.get_doc",
"erpnex... | [((552, 584), 'frappe.set_user', 'frappe.set_user', (['"""Administrator"""'], {}), "('Administrator')\n", (567, 584), False, 'import frappe\n'), ((587, 620), 'erpnext.tests.utils.create_test_contact_and_address', 'create_test_contact_and_address', ([], {}), '()\n', (618, 620), False, 'from erpnext.tests.utils import cr... |
import pdb
import copy
import numpy as np
import os
import scipy
import math
import torch
import torch
from pytorch3d.transforms import euler_angles_to_matrix, matrix_to_euler_angles
def read_total_poses(cam_file_path):
with open(cam_file_path) as f:
lines = f.readlines()
index_list = np.array(list(... | [
"numpy.clip",
"pytorch3d.transforms.euler_angles_to_matrix",
"math.floor",
"torch.from_numpy",
"numpy.argsort",
"numpy.array",
"scipy.misc.imresize",
"numpy.linalg.norm",
"numpy.moveaxis",
"numpy.sin",
"copy.copy",
"numpy.arange",
"torch.arange",
"numpy.multiply",
"numpy.repeat",
"nump... | [((358, 387), 'numpy.where', 'np.where', (['(index_list % 5 == 0)'], {}), '(index_list % 5 == 0)\n', (366, 387), True, 'import numpy as np\n'), ((3770, 3828), 'numpy.loadtxt', 'np.loadtxt', (['cameraPO_file'], {'dtype': 'np.float64', 'delimiter': '""" """'}), "(cameraPO_file, dtype=np.float64, delimiter=' ')\n", (3780,... |
from __future__ import print_function
import sys
import os
import json
if sys.version_info.major >= 3:
from urllib.parse import urlencode
from urllib.request import Request
from urllib.request import urlopen
else:
from urllib import urlencode
from urllib2 import urlopen
from urllib2 import Requ... | [
"json.loads",
"urllib2.urlopen",
"json.dumps",
"os.path.splitext",
"urllib2.Request",
"urllib.urlencode",
"sys.exit"
] | [((664, 680), 'urllib.urlencode', 'urlencode', (['query'], {}), '(query)\n', (673, 680), False, 'from urllib import urlencode\n'), ((849, 884), 'urllib2.Request', 'Request', (['full_url', 'payload', 'headers'], {}), '(full_url, payload, headers)\n', (856, 884), False, 'from urllib2 import Request\n'), ((896, 908), 'url... |
from collections import namedtuple
def _namedtuple(typename, field_names):
"""Fixes hashing for different tuples with same content
"""
base = namedtuple(typename, field_names)
def __hash__(self):
return hash((self.__class__, super(base, self).__hash__()))
return type(typename, (base,), {... | [
"collections.namedtuple"
] | [((156, 189), 'collections.namedtuple', 'namedtuple', (['typename', 'field_names'], {}), '(typename, field_names)\n', (166, 189), False, 'from collections import namedtuple\n')] |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
__all__ = ['FixupResNet', 'fixup_resnet18', 'fixup_resnet34', 'fixup_resnet50', 'fixup_resnet101', 'fixup_resnet152']
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_pla... | [
"torch.nn.BatchNorm2d",
"numpy.prod",
"torch.nn.LeakyReLU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.randn_like",
"torch.nn.functional.interpolate",
"torch.zeros",
"torch.ones"
] | [((304, 393), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=False)\n', (313, 393), True, 'import torch.nn as nn\n'), ((508, 597), 'torch.nn.Conv2d... |
# Copyright 2021 The FLAN Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"re.fullmatch",
"numpy.any"
] | [((1075, 1140), 'numpy.any', 'np.any', (["[('{options_}' in pattern) for pattern in input_patterns]"], {}), "([('{options_}' in pattern) for pattern in input_patterns])\n", (1081, 1140), True, 'import numpy as np\n'), ((2035, 2080), 're.fullmatch', 're.fullmatch', (['"""^(.+)_type_(\\\\d+)$"""', 'task_name'], {}), "('^... |
import pytorch_wavelets.dwt.lowlevel as lowlevel
import pywt
import torch
__all__ = [
"DWTForwardOverwrite",
"DWTInverse",
"construct_filters_from_2d",
"construct_2d_from_filters",
]
class DWTForwardOverwrite(torch.nn.Module):
"""
Mirrors the setup of the matlab function `FWT2_PO_fast`.
T... | [
"pytorch_wavelets.dwt.lowlevel.mode_to_int",
"pywt.Wavelet",
"pytorch_wavelets.dwt.lowlevel.AFB2D.apply",
"torch.cat",
"torch.zeros",
"pytorch_wavelets.dwt.lowlevel.prep_filt_sfb2d",
"pytorch_wavelets.dwt.lowlevel.SFB2D.apply",
"pytorch_wavelets.dwt.lowlevel.prep_filt_afb2d"
] | [((9420, 9444), 'torch.cat', 'torch.cat', (['ret_2d'], {'dim': '(0)'}), '(ret_2d, dim=0)\n', (9429, 9444), False, 'import torch\n'), ((2082, 2153), 'pytorch_wavelets.dwt.lowlevel.prep_filt_afb2d', 'lowlevel.prep_filt_afb2d', (['h0_col', 'h1_col', 'h0_row', 'h1_row'], {'device': 'device'}), '(h0_col, h1_col, h0_row, h1_... |
import middleend
import hlir
import expr
import dataflow
import utils
import vmcall
class Propagation(middleend.Optimization):
def safe_to_propagate(self, use_point, definition, paths):
# first we must check the instruction type
def_ins = definition.point.ins
if def_ins.type != hlir.ins_types.assign:
# calls... | [
"utils.visit_and_modify_instruction",
"utils.instruction_pairs",
"hlir.make_vmcall",
"dataflow.DefUseExplorer",
"dataflow.ids_may_be_equal",
"utils.visit_expr",
"dataflow.ProgramPoint",
"dataflow.ids_must_be_equal",
"dataflow.get_certain_definitions"
] | [((3006, 3056), 'dataflow.get_certain_definitions', 'dataflow.get_certain_definitions', (['ident', 'use_point'], {}), '(ident, use_point)\n', (3038, 3056), False, 'import dataflow\n'), ((568, 589), 'utils.visit_expr', 'utils.visit_expr', (['arg'], {}), '(arg)\n', (584, 589), False, 'import utils\n'), ((1431, 1478), 'da... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
from setuptools import setup, find_packages
import nrftool
def clean():
os.system("rm -rf dist *.egg-info")
def publish():
os.system("python setup.py sdist upload")
if "publish" in sys.argv:
clean()
publish()
sys.exit()
elif "clean" in sys.argv:
cle... | [
"os.system",
"setuptools.find_packages",
"sys.exit"
] | [((135, 170), 'os.system', 'os.system', (['"""rm -rf dist *.egg-info"""'], {}), "('rm -rf dist *.egg-info')\n", (144, 170), False, 'import os\n'), ((188, 229), 'os.system', 'os.system', (['"""python setup.py sdist upload"""'], {}), "('python setup.py sdist upload')\n", (197, 229), False, 'import os\n'), ((278, 288), 's... |
"""
Implements modification of human attributes at different levels.
###################### Quarantining / Behavior change logic ########################
Following orders takes care of the person faced with multiple quarantining triggers (each trigger has a suggested duration for quarantine) -
(i) (not app-base... | [
"warnings.warn",
"numpy.zeros",
"datetime.timedelta"
] | [((10598, 10630), 'numpy.zeros', 'np.zeros', (['self.n_behavior_levels'], {}), '(self.n_behavior_levels)\n', (10606, 10630), True, 'import numpy as np\n'), ((10657, 10689), 'numpy.zeros', 'np.zeros', (['self.n_behavior_levels'], {}), '(self.n_behavior_levels)\n', (10665, 10689), True, 'import numpy as np\n'), ((10712, ... |
import subprocess as sb
from operator import itemgetter
from itertools import chain
def check_kubectl():
try:
res = sb.run('kubectl', capture_output=True)
return res.returncode == 0
except FileNotFoundError:
return False
def parse_pod_owide(s):
# print('original:', s)
return [... | [
"itertools.chain.from_iterable",
"subprocess.run"
] | [((459, 523), 'subprocess.run', 'sb.run', (["['kubectl', 'get', 'pod', '-owide']"], {'capture_output': '(True)'}), "(['kubectl', 'get', 'pod', '-owide'], capture_output=True)\n", (465, 523), True, 'import subprocess as sb\n'), ((130, 168), 'subprocess.run', 'sb.run', (['"""kubectl"""'], {'capture_output': '(True)'}), "... |
from sys import stdin
N, K = [int(x) for x in stdin.readline().split()]
if K == 1:
print(1)
exit()
currentEnd = [1] * (N + 1)
for _ in range(K - 2):
nextEnd = [sum(currentEnd[x:]) for x in range(N + 1)]
currentEnd = nextEnd
print(sum(currentEnd) % 1000000000) | [
"sys.stdin.readline"
] | [((47, 63), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (61, 63), False, 'from sys import stdin\n')] |
import numpy
import random
from solution import solution
def elitism(population, scores, bestIndividual, bestScore):
"""
This melitism operator of the population
"""
# get the worst individual
worstFitnessId = selectWorstIndividual(scores)
# replace worst cromosome with best one from previous... | [
"numpy.clip",
"numpy.copy",
"random.uniform",
"numpy.unique",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.empty_like",
"numpy.concatenate",
"numpy.random.uniform",
"random.randint"
] | [((450, 476), 'numpy.copy', 'numpy.copy', (['bestIndividual'], {}), '(bestIndividual)\n', (460, 476), False, 'import numpy\n'), ((510, 531), 'numpy.copy', 'numpy.copy', (['bestScore'], {}), '(bestScore)\n', (520, 531), False, 'import numpy\n'), ((1601, 1637), 'numpy.zeros', 'numpy.zeros', (['(self.popnum, self.dim)'], ... |
"""
code from: https://raw.githubusercontent.com/MichiganCOG/TASED-Net/master/model.py
"""
import torch
from torch import nn
from gazenet.models.shared_components.conv3d import model as conv3d
class TASED_v2(nn.Module):
def __init__(self):
super(TASED_v2, self).__init__()
self.base1 = nn.Sequent... | [
"gazenet.models.shared_components.conv3d.model.Mixed_4e",
"gazenet.models.shared_components.conv3d.model.Mixed_5b",
"gazenet.models.shared_components.conv3d.model.Mixed_3b",
"torch.nn.ReLU",
"torch.nn.BatchNorm3d",
"torch.nn.ConvTranspose3d",
"torch.nn.Sigmoid",
"gazenet.models.shared_components.conv3... | [((649, 721), 'torch.nn.MaxPool3d', 'nn.MaxPool3d', ([], {'kernel_size': '(1, 3, 3)', 'stride': '(1, 2, 2)', 'padding': '(0, 1, 1)'}), '(kernel_size=(1, 3, 3), stride=(1, 2, 2), padding=(0, 1, 1))\n', (661, 721), False, 'from torch import nn\n'), ((737, 809), 'torch.nn.MaxPool3d', 'nn.MaxPool3d', ([], {'kernel_size': '... |
from django.shortcuts import render,HttpResponse
from django.utils.translation import override
from .serializers import QuestionSerializer,TeamSerializer,TeamFlagSerializer
from rest_framework.views import APIView
from rest_framework import serializers, status
from rest_framework.response import Response
from .models i... | [
"django.shortcuts.HttpResponse",
"rest_framework.response.Response"
] | [((399, 454), 'django.shortcuts.HttpResponse', 'HttpResponse', (['"""This backend for CTF server has started"""'], {}), "('This backend for CTF server has started')\n", (411, 454), False, 'from django.shortcuts import render, HttpResponse\n'), ((677, 702), 'rest_framework.response.Response', 'Response', (['serializer.d... |
# Copyright (c) 2018, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | [
"subprocess.check_call",
"numpy.get_printoptions",
"numpy.array_repr",
"im2col.im2col_indices",
"numpy.max",
"tempfile.mktemp",
"math.log",
"numpy.dot",
"numpy.zeros",
"numpy.pad",
"numpy.load",
"numpy.set_printoptions"
] | [((3925, 3982), 'subprocess.check_call', 'check_call', (['[self.execmd, self.ifilename, self.ofilename]'], {}), '([self.execmd, self.ifilename, self.ofilename])\n', (3935, 3982), False, 'from subprocess import check_call\n'), ((3998, 4021), 'numpy.load', 'np.load', (['self.ofilename'], {}), '(self.ofilename)\n', (4005,... |
from datetime import date
from dateutil.relativedelta import relativedelta
from django import forms
from sagepaypi.fields import CardExpiryDateField
from tests.test_case import AppTestCase
class TestField(AppTestCase):
def test_valid_values(self):
today = date.today()
next_month = today + relat... | [
"datetime.date.today",
"dateutil.relativedelta.relativedelta",
"datetime.date",
"sagepaypi.fields.CardExpiryDateField"
] | [((273, 285), 'datetime.date.today', 'date.today', ([], {}), '()\n', (283, 285), False, 'from datetime import date\n'), ((732, 767), 'sagepaypi.fields.CardExpiryDateField', 'CardExpiryDateField', ([], {'required': '(False)'}), '(required=False)\n', (751, 767), False, 'from sagepaypi.fields import CardExpiryDateField\n'... |
import FWCore.ParameterSet.Config as cms
ecalPreshowerPedestalTask = cms.EDAnalyzer('ESPedestalTask',
LookupTable = cms.untracked.FileInPath("EventFilter/ESDigiToRaw/data/ES_lookup_table.dat"),
DigiLabel = cms.InputTag("ecalPreshowerDigis"),
OutputFile = cms.untracked.string("")
)
| [
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.untracked.FileInPath",
"FWCore.ParameterSet.Config.InputTag"
] | [((123, 199), 'FWCore.ParameterSet.Config.untracked.FileInPath', 'cms.untracked.FileInPath', (['"""EventFilter/ESDigiToRaw/data/ES_lookup_table.dat"""'], {}), "('EventFilter/ESDigiToRaw/data/ES_lookup_table.dat')\n", (147, 199), True, 'import FWCore.ParameterSet.Config as cms\n'), ((214, 248), 'FWCore.ParameterSet.Conf... |
from ...requests import Request
from ...responses import *
from ...distributor import Distributor
from ...paths import PATHS
import flask, html, random, traceback, shutil, os, time
PLATFORM = 'WebApp'
app = flask.Flask(__name__)
app.static_folder = 'static'
class WebTemp:
def __init__(self):
... | [
"flask.render_template",
"flask.request.args.get",
"os.path.exists",
"os.listdir",
"traceback.format_exc",
"flask.Flask",
"os.path.join",
"flask.request.cookies.get",
"os.mkdir",
"html.escape",
"random.random",
"traceback.print_exc",
"time.time",
"random.randint"
] | [((217, 238), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (228, 238), False, 'import flask, html, random, traceback, shutil, os, time\n'), ((3610, 3641), 'flask.request.cookies.get', 'flask.request.cookies.get', (['"""id"""'], {}), "('id')\n", (3635, 3641), False, 'import flask, html, random, trac... |
# coding: utf8
from __future__ import print_function, unicode_literals
from decimal import Decimal as D
from liberapay.billing.transactions import charge, create_wallet
from liberapay.models.exchange_route import ExchangeRoute
from liberapay.testing import Harness
from liberapay.testing.mangopay import create_card
... | [
"decimal.Decimal",
"liberapay.testing.mangopay.create_card",
"liberapay.billing.transactions.create_wallet",
"liberapay.models.exchange_route.ExchangeRoute.insert"
] | [((1627, 1665), 'liberapay.billing.transactions.create_wallet', 'create_wallet', (['self.db', 'janeway', '"""EUR"""'], {}), "(self.db, janeway, 'EUR')\n", (1640, 1665), False, 'from liberapay.billing.transactions import charge, create_wallet\n'), ((1679, 1716), 'liberapay.testing.mangopay.create_card', 'create_card', (... |
import unittest
from dfs.nfl.positions import normalize_position, QB, RB, WR, TE, DST
class TestPositions(unittest.TestCase):
def test_normalize_position(self):
self.assertEqual(QB, normalize_position('QB'))
self.assertEqual(RB, normalize_position('RB'))
self.assertEqual(WR, normalize_po... | [
"dfs.nfl.positions.normalize_position"
] | [((198, 222), 'dfs.nfl.positions.normalize_position', 'normalize_position', (['"""QB"""'], {}), "('QB')\n", (216, 222), False, 'from dfs.nfl.positions import normalize_position, QB, RB, WR, TE, DST\n'), ((253, 277), 'dfs.nfl.positions.normalize_position', 'normalize_position', (['"""RB"""'], {}), "('RB')\n", (271, 277)... |
__copyright__ = 'Copyright(c) <NAME> 2017'
"""
"""
from a_tuin.db import TableMap, PagedQuery, InstanceQuery
from glod.model.parish_list.parishioner import Parishioner, ParishionerCollection
from glod.db.db_column_type_map import DB_COLUMN_TYPE_MAP
from glod.db.constants import SCHEMA_NAME
TableMap(Parishioner, ... | [
"a_tuin.db.TableMap"
] | [((298, 367), 'a_tuin.db.TableMap', 'TableMap', (['Parishioner', 'SCHEMA_NAME', '"""parishioner"""', 'DB_COLUMN_TYPE_MAP'], {}), "(Parishioner, SCHEMA_NAME, 'parishioner', DB_COLUMN_TYPE_MAP)\n", (306, 367), False, 'from a_tuin.db import TableMap, PagedQuery, InstanceQuery\n')] |
from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from nodeconductor.structure.models import BalanceHistory
from nodeconductor.structure.models import Customer
class Command(BaseCommand):
help = """ Initialize demo records of balance history """... | [
"django.utils.timezone.now",
"datetime.timedelta",
"nodeconductor.structure.models.Customer.objects.all"
] | [((474, 496), 'nodeconductor.structure.models.Customer.objects.all', 'Customer.objects.all', ([], {}), '()\n', (494, 496), False, 'from nodeconductor.structure.models import Customer\n'), ((649, 663), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (661, 663), False, 'from django.utils import timezone\n'... |
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import setup, find_packages
setup(
name = 'pybedforms',
version = '0.0.1',
long_description = "tbd",
url='https://github.com/andrewa... | [
"setuptools.find_packages",
"os.path.basename",
"glob.glob"
] | [((427, 447), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (440, 447), False, 'from setuptools import setup, find_packages\n'), ((536, 552), 'glob.glob', 'glob', (['"""src/*.py"""'], {}), "('src/*.py')\n", (540, 552), False, 'from glob import glob\n'), ((505, 519), 'os.path.basename', ... |
#PyCountry
import pandas as pd
import numpy as np
import os
import extractconfig
#Read Raw Data into Pandas Dataframe
extract_file_path = os.path.join(os.path.dirname(__file__), extractconfig.RAW_DATA_FILE)
raw_data = pd.read_csv(extract_file_path)
#Read ExtractList into List
extract_list_path = os.path.join(os.pat... | [
"os.path.dirname",
"pandas.read_csv",
"pandas.read_excel"
] | [((221, 251), 'pandas.read_csv', 'pd.read_csv', (['extract_file_path'], {}), '(extract_file_path)\n', (232, 251), True, 'import pandas as pd\n'), ((603, 654), 'pandas.read_excel', 'pd.read_excel', (['extract_list_path'], {'engine': '"""openpyxl"""'}), "(extract_list_path, engine='openpyxl')\n", (616, 654), True, 'impor... |
import matplotlib.pyplot as plt
import numpy as np
import dynpy
bn = dynpy.bn.BooleanNetwork(rules=dynpy.sample_nets.budding_yeast_bn)
initState = np.zeros(bn.num_vars, 'uint8')
initState[ [1,3,6] ] = 1
plt.spy(bn.get_trajectory(start_state=initState, max_time=15))
plt.xlabel('Node')
plt.ylabel('Time')
| [
"numpy.zeros",
"matplotlib.pyplot.xlabel",
"dynpy.bn.BooleanNetwork",
"matplotlib.pyplot.ylabel"
] | [((70, 135), 'dynpy.bn.BooleanNetwork', 'dynpy.bn.BooleanNetwork', ([], {'rules': 'dynpy.sample_nets.budding_yeast_bn'}), '(rules=dynpy.sample_nets.budding_yeast_bn)\n', (93, 135), False, 'import dynpy\n'), ((149, 179), 'numpy.zeros', 'np.zeros', (['bn.num_vars', '"""uint8"""'], {}), "(bn.num_vars, 'uint8')\n", (157, 1... |
import requests
from urllib.parse import urljoin, urlencode
from .utils import flatten
class APIKeyMissingError(Exception):
pass
class CFLApi(object):
def __init__(self, apiKey, baseUri='http://api.cfl.ca'):
if apiKey == None:
raise APIKeyMissingError(
"An API Key is requir... | [
"requests.Session",
"urllib.parse.urljoin"
] | [((481, 499), 'requests.Session', 'requests.Session', ([], {}), '()\n', (497, 499), False, 'import requests\n'), ((1924, 1959), 'urllib.parse.urljoin', 'urljoin', (['self._baseUri', '"""/v1/games"""'], {}), "(self._baseUri, '/v1/games')\n", (1931, 1959), False, 'from urllib.parse import urljoin, urlencode\n'), ((2643, ... |
#!/usr/bin/env python
"""
Created on Mar 7, 2013
Create a report on the demographics of a course, and create an anonymized
csv file for the students in the course. The demographics include the gender and
age distribution, level of education, and the country of the student. All of
the information is self-reported, and ... | [
"csv.field_size_limit",
"classData.userprofile.builddict",
"utils.getFileName",
"classData.ipGeoloc.buildIdtoLoc"
] | [((1995, 2027), 'csv.field_size_limit', 'csv.field_size_limit', (['(1000000000)'], {}), '(1000000000)\n', (2015, 2027), False, 'import csv\n'), ((2057, 2087), 'utils.getFileName', 'utils.getFileName', (['"""user file"""'], {}), "('user file')\n", (2074, 2087), False, 'import utils\n'), ((2139, 2176), 'utils.getFileName... |
import time
import datetime
import cv2
import imutils
def finish(vs, fps, SAVE, writer):
# do a bit of cleanup
print("[INFO] cleaning up")
fps.stop() # calculate fps values
vs.stop()
if SAVE:
writer.release()
# display fps values
print("[INFO] elasped time: {:.2f}".format(fps.elap... | [
"cv2.flip",
"time.sleep",
"cv2.VideoWriter",
"imutils.resize",
"cv2.VideoWriter_fourcc"
] | [((391, 404), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (401, 404), False, 'import time\n'), ((993, 1024), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MJPG'"], {}), "(*'MJPG')\n", (1015, 1024), False, 'import cv2\n'), ((1167, 1186), 'cv2.flip', 'cv2.flip', (['frame', '(-1)'], {}), '(frame, -1)\n'... |
import logging
import psutil
from icrawl_plugin import IHostCrawler
from utils.features import CpuFeature
logger = logging.getLogger('crawlutils')
class CpuHostCrawler(IHostCrawler):
def get_feature(self):
return 'cpu'
def crawl(self, **kwargs):
logger.debug('Crawling %s' % (self.get_feat... | [
"logging.getLogger",
"psutil.cpu_times_percent"
] | [((118, 149), 'logging.getLogger', 'logging.getLogger', (['"""crawlutils"""'], {}), "('crawlutils')\n", (135, 149), False, 'import logging\n'), ((365, 402), 'psutil.cpu_times_percent', 'psutil.cpu_times_percent', ([], {'percpu': '(True)'}), '(percpu=True)\n', (389, 402), False, 'import psutil\n')] |
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row, SparkSession
from pyspark.sql.functions import regexp_extract
# Create a SparkSession (the config bit is only for Windows!)
spark = SparkSession.builder.config(
'spark.sql.warehouse.dir', 'file:///C:/temp'... | [
"pyspark.sql.SparkSession.builder.config",
"pyspark.sql.functions.regexp_extract"
] | [((790, 826), 'pyspark.sql.functions.regexp_extract', 'regexp_extract', (['"""value"""', 'host_exp', '(1)'], {}), "('value', host_exp, 1)\n", (804, 826), False, 'from pyspark.sql.functions import regexp_extract\n'), ((846, 882), 'pyspark.sql.functions.regexp_extract', 'regexp_extract', (['"""value"""', 'time_exp', '(1)... |
from setuptools import setup, find_packages
setup(name='jsonrpcstdio',
description='Asynchroncous Python implementation of JSON RPC for arbitrary'
' Streams and a particular implementation for JSON RPC of '
'standard IO',
author='amas0',
version='0.6',
packag... | [
"setuptools.find_packages"
] | [((323, 338), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (336, 338), False, 'from setuptools import setup, find_packages\n')] |
from django.http.response import JsonResponse
from rest_framework import status
from dataCRUD.permission import data_check, dataset_check, workspace_check
def check_user(request, target, type):
# check if user have session
user = request.session.get('user')
if user is None:
return JsonResponse({'... | [
"dataCRUD.permission.data_check",
"dataCRUD.permission.dataset_check",
"django.http.response.JsonResponse",
"dataCRUD.permission.workspace_check"
] | [((305, 399), 'django.http.response.JsonResponse', 'JsonResponse', (["{'type': 'data_get', 'success': False}"], {'status': 'status.HTTP_401_UNAUTHORIZED'}), "({'type': 'data_get', 'success': False}, status=status.\n HTTP_401_UNAUTHORIZED)\n", (317, 399), False, 'from django.http.response import JsonResponse\n'), ((5... |
"""Testing phantomconfig."""
import pathlib
import phantomconfig as pc
from .stub import test_data
test_phantom_file = pathlib.Path(__file__).parent / 'stub' / 'config.in'
test_json_file = pathlib.Path(__file__).parent / 'stub' / 'config.json'
test_toml_file = pathlib.Path(__file__).parent / 'stub' / 'config.toml'
... | [
"phantomconfig.read_dict",
"pathlib.Path",
"phantomconfig.read_json",
"phantomconfig.read_toml",
"phantomconfig.read_config"
] | [((488, 521), 'phantomconfig.read_config', 'pc.read_config', (['test_phantom_file'], {}), '(test_phantom_file)\n', (502, 521), True, 'import phantomconfig as pc\n'), ((740, 768), 'phantomconfig.read_json', 'pc.read_json', (['test_json_file'], {}), '(test_json_file)\n', (752, 768), True, 'import phantomconfig as pc\n'),... |
import sdf
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-paper')
num_bins = 50
me = 9.1e-31
c = 3e8
file = '/Users/yaowp/code/merge/epoch2d/'
ii = 15
folder = 'Data0'
fname = file+folder+'/6'+str(ii).zfill(4)+'.sdf'
datafile = sdf.read(fname)
px = datafile.Particles_Px_subset_part_pho.da... | [
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"sdf.read",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((62, 92), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-paper"""'], {}), "('seaborn-paper')\n", (75, 92), True, 'import matplotlib.pyplot as plt\n'), ((259, 274), 'sdf.read', 'sdf.read', (['fname'], {}), '(fname)\n', (267, 274), False, 'import sdf\n'), ((351, 399), 'matplotlib.pyplot.hist', 'plt.hist'... |
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent.resolve()))
from coc_workspace_symbols.symbol_base import SymbolBase
class Source(SymbolBase):
def __init__(self, vim):
super().__init__(vim, 'coc-workspace-symbols')
def start_lookup(self, query):
se... | [
"pathlib.Path"
] | [((56, 70), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (60, 70), False, 'from pathlib import Path\n')] |
import unittest
from collections import namedtuple
from operator import attrgetter, itemgetter
from foil.order import partition_ordered, partition
MockTuple = namedtuple('MockTuple', ('a', 'b'))
def is_even(x):
return True if x % 2 == 0 else False
class TestPartitionOrdered(unittest.TestCase):
def test_... | [
"operator.attrgetter",
"operator.itemgetter",
"collections.namedtuple"
] | [((162, 197), 'collections.namedtuple', 'namedtuple', (['"""MockTuple"""', "('a', 'b')"], {}), "('MockTuple', ('a', 'b'))\n", (172, 197), False, 'from collections import namedtuple\n'), ((635, 650), 'operator.attrgetter', 'attrgetter', (['"""a"""'], {}), "('a')\n", (645, 650), False, 'from operator import attrgetter, i... |
#==============================================================================
# purpose: example of fitting a LASSO example; based on the DataRobot example here:
# http://www.datarobot.com/blog/r-getting-started-with-data-science/
# author: <NAME>
# created: 5/7/15
# revised:
# comments:
# 1. The requests library ... | [
"urllib.urlretrieve",
"ftplib.FTP",
"requests.get"
] | [((605, 641), 'ftplib.FTP', 'ftplib.FTP', ([], {'host': '"""ftp.nhtsa.dot.gov"""'}), "(host='ftp.nhtsa.dot.gov')\n", (615, 641), False, 'import ftplib\n'), ((813, 885), 'requests.get', 'requests.get', ([], {'url': '"""ftp://ftp.nhtsa.dot.gov/GES/GES12/GES12_Flatfile.zip"""'}), "(url='ftp://ftp.nhtsa.dot.gov/GES/GES12/G... |
"""Copy metadata from one tif to another"""
from __future__ import print_function, absolute_import, division, unicode_literals
import os
import argparse
from hyp3lib import saa_func_lib as saa
from osgeo import gdal
def copy_metadata(infile, outfile):
ds = saa.open_gdal_file(infile)
md = ds.GetMetadata()
... | [
"hyp3lib.saa_func_lib.open_gdal_file",
"osgeo.gdal.Translate",
"os.path.basename"
] | [((265, 291), 'hyp3lib.saa_func_lib.open_gdal_file', 'saa.open_gdal_file', (['infile'], {}), '(infile)\n', (283, 291), True, 'from hyp3lib import saa_func_lib as saa\n'), ((540, 567), 'hyp3lib.saa_func_lib.open_gdal_file', 'saa.open_gdal_file', (['outfile'], {}), '(outfile)\n', (558, 567), True, 'from hyp3lib import sa... |
import os
import application.application as app
import base64
if __name__ == '__main__':
app.greetings()
| [
"application.application.greetings"
] | [((95, 110), 'application.application.greetings', 'app.greetings', ([], {}), '()\n', (108, 110), True, 'import application.application as app\n')] |
from keras.models import load_model, Model
import numpy as np
import os
from src.data.shl_data import shl_min, shl_max, mean, std
from tqdm import tqdm
import seaborn as sns
import shutil
from loguru import logger
x_min = shl_min()[np.newaxis, np.newaxis, :]
x_max = shl_max()[np.newaxis, np.newaxis, :]
x_mean = mean()... | [
"loguru.logger.add",
"numpy.mean",
"os.listdir",
"keras.models.load_model",
"loguru.logger.info",
"os.makedirs",
"src.data.shl_data.std",
"src.data.shl_data.shl_max",
"src.data.shl_data.shl_min",
"numpy.load",
"numpy.save",
"src.data.shl_data.mean"
] | [((314, 320), 'src.data.shl_data.mean', 'mean', ([], {}), '()\n', (318, 320), False, 'from src.data.shl_data import shl_min, shl_max, mean, std\n'), ((329, 334), 'src.data.shl_data.std', 'std', ([], {}), '()\n', (332, 334), False, 'from src.data.shl_data import shl_min, shl_max, mean, std\n'), ((369, 466), 'loguru.logg... |
import pytest
from unittest.mock import patch
from baserow_premium.license.tasks import license_check
@pytest.mark.django_db
@patch("baserow_premium.license.handler.check_licenses")
def test_license_check(mock_check_licenses, premium_data_fixture):
license_check()
assert not mock_check_licenses.called
... | [
"unittest.mock.patch",
"baserow_premium.license.tasks.license_check"
] | [((130, 185), 'unittest.mock.patch', 'patch', (['"""baserow_premium.license.handler.check_licenses"""'], {}), "('baserow_premium.license.handler.check_licenses')\n", (135, 185), False, 'from unittest.mock import patch\n'), ((257, 272), 'baserow_premium.license.tasks.license_check', 'license_check', ([], {}), '()\n', (2... |
import pytest
from copy import deepcopy
from unittest.mock import patch
from pycliarr.api.radarr import RadarrCli, RadarrMovieItem
from pycliarr.api.exceptions import RadarrCliError
TEST_ROOT_PATH = [{"path": "some/path/", "id": 1},{"path": "yet/otherpath/", "id": 3}]
TEST_JSON = {'somefield': "some value"}
TEST_MOVIE... | [
"pytest.raises",
"pycliarr.api.radarr.RadarrCli",
"copy.deepcopy",
"pycliarr.api.radarr.RadarrMovieItem",
"unittest.mock.patch"
] | [((1263, 1341), 'unittest.mock.patch', 'patch', (['"""pycliarr.api.radarr.BaseCliMediaApi.get_item"""'], {'return_value': 'TEST_MOVIE'}), "('pycliarr.api.radarr.BaseCliMediaApi.get_item', return_value=TEST_MOVIE)\n", (1268, 1341), False, 'from unittest.mock import patch\n'), ((1511, 1596), 'unittest.mock.patch', 'patch... |
#!/usr/bin/env python3
""" Running the tests for karafs """
import os
import subprocess
import platform
KARAFS_BIN = os.path.abspath('bin/karafs')
def run_command(cmd='') -> str:
""" Runs a command on karafs and returns the output as string """
if platform.system().startswith('Winodws'):
python_exe ... | [
"os.path.abspath",
"platform.system"
] | [((120, 149), 'os.path.abspath', 'os.path.abspath', (['"""bin/karafs"""'], {}), "('bin/karafs')\n", (135, 149), False, 'import os\n'), ((260, 277), 'platform.system', 'platform.system', ([], {}), '()\n', (275, 277), False, 'import platform\n')] |
# Generated by Django 2.2.5 on 2020-06-30 17:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0011_update_proxy_permissions'),
('subscriptions', '0006_remove_subscriptionplan_group'),
]
operati... | [
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((336, 410), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""subscriptionplan"""', 'name': '"""account_type"""'}), "(model_name='subscriptionplan', name='account_type')\n", (358, 410), False, 'from django.db import migrations, models\n'), ((563, 747), 'django.db.models.ForeignKey'... |
"""packaging for pymlhelloworld."""
from setuptools import find_packages, setup
setup(
name='pymlhelloworld',
version='1.0.0',
packages=find_packages(),
url='https://github.com/pellmont/pymlhelloworld',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='a helloworld f... | [
"setuptools.find_packages"
] | [((150, 165), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (163, 165), False, 'from setuptools import find_packages, setup\n')] |
import numpy as np
def evaluate(env, agent, num_runs, max_steps=np.inf):
returns = np.zeros(num_runs)
for run_ix in range(num_runs):
env.reset()
cumulative_reward = 0.
step = 0
while env.steps_beyond_done is None and step < max_steps:
next_state_actions = env.get_sa... | [
"numpy.zeros"
] | [((89, 107), 'numpy.zeros', 'np.zeros', (['num_runs'], {}), '(num_runs)\n', (97, 107), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import formatter
# m: number of machines
# n: number of jobs
# T: number of time indices
# S: schedule
# p: integer processing times
# s: inclusive integer earlest starting times
# f: exclusive itneger latest finishing times
def new_schedule(... | [
"numpy.multiply",
"numpy.repeat",
"numpy.any",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.sum",
"formatter.number_to_letters",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((3249, 3268), 'numpy.array', 'np.array', (['[2, 3, 2]'], {}), '([2, 3, 2])\n', (3257, 3268), True, 'import numpy as np\n'), ((3271, 3303), 'numpy.array', 'np.array', (['[[0, 1, 0], [1, 0, 0]]'], {}), '([[0, 1, 0], [1, 0, 0]])\n', (3279, 3303), True, 'import numpy as np\n'), ((3303, 3335), 'numpy.array', 'np.array', (... |