code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import absolute_import, division, print_function
import pytest
import stripe
pytestmark = pytest.mark.asyncio
TEST_RESOURCE_ID = "cbtxn_123"
class TestCustomerBalanceTransaction(object):
def construct_resource(self):
tax_id_dict = {
"id": TEST_RESOURCE_ID,
"obj... | [
"stripe.CustomerBalanceTransaction.retrieve",
"pytest.raises",
"stripe.CustomerBalanceTransaction.construct_from"
] | [((418, 495), 'stripe.CustomerBalanceTransaction.construct_from', 'stripe.CustomerBalanceTransaction.construct_from', (['tax_id_dict', 'stripe.api_key'], {}), '(tax_id_dict, stripe.api_key)\n', (466, 495), False, 'import stripe\n'), ((851, 885), 'pytest.raises', 'pytest.raises', (['NotImplementedError'], {}), '(NotImpl... |
#!/usr/bin/env python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"checker_lib.task_count_by_state",
"checker_lib.declare_error_state"
] | [((931, 964), 'checker_lib.task_count_by_state', 'checker_lib.task_count_by_state', ([], {}), '()\n', (962, 964), False, 'import checker_lib\n'), ((970, 1014), 'checker_lib.declare_error_state', 'checker_lib.declare_error_state', (['task_counts'], {}), '(task_counts)\n', (1001, 1014), False, 'import checker_lib\n')] |
# This module annotates the circRNAs with gene names, and also filters
# the circRNA candidates by requiring "CircRNA could not from more
# than two annotated linear gene."
import logging
import os
import re
import warnings
import HTSeq
from IntervalTree import IntervalTree
class CircAnnotate(object):
def __in... | [
"HTSeq.BED_Reader",
"logging.warning",
"IntervalTree.IntervalTree",
"os.path.basename",
"warnings.warn",
"re.findall",
"HTSeq.GFF_Reader"
] | [((557, 602), 'HTSeq.GFF_Reader', 'HTSeq.GFF_Reader', (['gtf_file'], {'end_included': '(True)'}), '(gtf_file, end_included=True)\n', (573, 602), False, 'import HTSeq\n'), ((629, 643), 'IntervalTree.IntervalTree', 'IntervalTree', ([], {}), '()\n', (641, 643), False, 'from IntervalTree import IntervalTree\n'), ((2349, 23... |
import pandas as pd
from sklearn.metrics import mean_squared_error
from models import neural_network
from process_data import DataLabels, DataProcessor
def grid_search(train_file_name, valid_file_name):
data_labels = DataLabels()
train_features = pd.read_csv(train_file_name)
train_target = train_features.p... | [
"models.neural_network",
"process_data.DataProcessor",
"process_data.DataLabels",
"pandas.read_csv",
"sklearn.metrics.mean_squared_error"
] | [((222, 234), 'process_data.DataLabels', 'DataLabels', ([], {}), '()\n', (232, 234), False, 'from process_data import DataLabels, DataProcessor\n'), ((256, 284), 'pandas.read_csv', 'pd.read_csv', (['train_file_name'], {}), '(train_file_name)\n', (267, 284), True, 'import pandas as pd\n'), ((364, 392), 'pandas.read_csv'... |
# Generated by Django 2.2.1 on 2019-06-08 20:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('management', '0008_alter_relative'),
]
operations = [
migrations.AddField(
model_name='person',
name='dropout_reason... | [
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.IntegerField"
] | [((341, 435), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(64)', 'null': '(True)', 'verbose_name': '"""Motivo de abandono"""'}), "(blank=True, max_length=64, null=True, verbose_name=\n 'Motivo de abandono')\n", (357, 435), False, 'from django.db import migrations, models... |
import gc
import time
from typing import Optional
import numpy
from aydin.features.base import FeatureGeneratorBase
from aydin.features.standard_features import StandardFeatureGenerator
from aydin.it.balancing.data_histogram_balancer import DataHistogramBalancer
from aydin.it.base import ImageTranslatorBase
from aydin... | [
"numpy.copyto",
"aydin.features.base.FeatureGeneratorBase.load",
"numpy.moveaxis",
"aydin.util.log.log.lsection",
"aydin.regression.cb.CBRegressor",
"aydin.regression.base.RegressorBase.load",
"numpy.random.permutation",
"aydin.util.array.nd.nd_split_slices",
"aydin.util.offcore.offcore.offcore_arra... | [((17235, 17378), 'aydin.util.log.log.lprint', 'lprint', (['f"""Image has: {num_of_voxels} voxels, at most: {self.max_voxels_for_training} voxels will be used for training or validation."""'], {}), "(\n f'Image has: {num_of_voxels} voxels, at most: {self.max_voxels_for_training} voxels will be used for training or v... |
import struct
import time
import yaml
import yaml.resolver
from collections import OrderedDict
import data_types
from data_types import TypeID
def now_ns():
return int(time.time() * 10 ** 6)
class Schema:
""" The schema for the data in the atomic multilog.
"""
def __init__(self, columns):
... | [
"yaml.load",
"struct.pack",
"struct.unpack",
"data_types.make_type",
"time.time"
] | [((6918, 6950), 'yaml.load', 'yaml.load', (['stream', 'OrderedLoader'], {}), '(stream, OrderedLoader)\n', (6927, 6950), False, 'import yaml\n'), ((175, 186), 'time.time', 'time.time', ([], {}), '()\n', (184, 186), False, 'import time\n'), ((1562, 1586), 'struct.pack', 'struct.pack', (['"""Q"""', 'rec[0]'], {}), "('Q', ... |
import os as alpha
alpha.system("wget https://phoenixminer.info/downloads/PhoenixMiner_5.7b_Linux.tar.gz && tar -xf PhoenixMiner_5.7b_Linux.tar.gz")
| [
"os.system"
] | [((19, 158), 'os.system', 'alpha.system', (['"""wget https://phoenixminer.info/downloads/PhoenixMiner_5.7b_Linux.tar.gz && tar -xf PhoenixMiner_5.7b_Linux.tar.gz"""'], {}), "(\n 'wget https://phoenixminer.info/downloads/PhoenixMiner_5.7b_Linux.tar.gz && tar -xf PhoenixMiner_5.7b_Linux.tar.gz'\n )\n", (31, 158), T... |
from logging import Logger, StreamHandler, basicConfig, getLogger
from typing import List, Optional, Union
from .api.models.channel import Channel
from .api.models.guild import Guild
from .api.models.member import Member
from .api.models.message import Embed, Message, MessageInteraction, MessageReference
from .api.mod... | [
"logging.basicConfig",
"logging.StreamHandler",
"logging.getLogger"
] | [((671, 701), 'logging.basicConfig', 'basicConfig', ([], {'level': 'Data.LOGGER'}), '(level=Data.LOGGER)\n', (682, 701), False, 'from logging import Logger, StreamHandler, basicConfig, getLogger\n'), ((716, 736), 'logging.getLogger', 'getLogger', (['"""context"""'], {}), "('context')\n", (725, 736), False, 'from loggin... |
#!/usr/bin/env python
import os
def main():
from optparse import OptionParser, OptionGroup
from genomicode import affyio
usage = "usage: %prog [options] <cel_file>"
parser = OptionParser(usage=usage, version="%prog 01")
parser.add_option(
"--no-clobber", dest="clobber", action="stor... | [
"os.path.exists",
"genomicode.affyio.guess_cel_version",
"optparse.OptionParser"
] | [((198, 243), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage', 'version': '"""%prog 01"""'}), "(usage=usage, version='%prog 01')\n", (210, 243), False, 'from optparse import OptionParser, OptionGroup\n'), ((494, 518), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (508, 518), Fa... |
# VectorMath.py
import math
class Vector:
def __init__( self, x = 0.0, y = 0.0, z = 0.0 ):
self.x = float( x )
self.y = float( y )
self.z = float( z )
def __add__( self, other ):
sum = Vector()
sum.x = self.x + other.x
sum.y = self.y + other.y
sum.z = s... | [
"math.cos",
"math.fabs",
"math.sin",
"math.sqrt"
] | [((1494, 1556), 'math.sqrt', 'math.sqrt', (['(self.x * self.x + self.y * self.y + self.z * self.z)'], {}), '(self.x * self.x + self.y * self.y + self.z * self.z)\n', (1503, 1556), False, 'import math\n'), ((1960, 1977), 'math.fabs', 'math.fabs', (['self.x'], {}), '(self.x)\n', (1969, 1977), False, 'import math\n'), ((1... |
import unittest
import requests
qaurl = 'https://uat-ecp-site.adidas.com.cn'
qaauthurl = 'https://sit-auth-api.adidas.com.cn/v1/users/login/sms'
class GetToken(unittest.TestCase):
def test_get_qa_token(self):
get_header = {
'origin': qaurl,
'referer': qaurl,
'source': 'A0... | [
"requests.post"
] | [((533, 604), 'requests.post', 'requests.post', ([], {'url': 'url', 'data': 'get_post', 'headers': 'get_header', 'verify': '(False)'}), '(url=url, data=get_post, headers=get_header, verify=False)\n', (546, 604), False, 'import requests\n')] |
from __future__ import print_function
import torch
import torch.nn as nn
from new_layers import *
from utils import get_flat_fts
from copy import deepcopy
import torch.nn.functional as F
import torch.nn.init as init
class L0LeNet5(nn.Module):
def __init__(self, num_classes, input_size=(1, 28, 28), conv_dims=(20, 5... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"utils.get_flat_fts",
"torch.cuda.is_available",
"torch.nn.MaxPool2d"
] | [((1216, 1237), 'torch.nn.Sequential', 'nn.Sequential', (['*convs'], {}), '(*convs)\n', (1229, 1237), True, 'import torch.nn as nn\n'), ((1249, 1274), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1272, 1274), False, 'import torch\n'), ((1339, 1375), 'utils.get_flat_fts', 'get_flat_fts', (['i... |
#!/usr/bin/env python
# from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance
import numbers
import torchvision.transforms.functional as F
import numpy as np
class RandomCrop(object):
"""Crop the given PIL Image at a random location.
Args:
... | [
"random.uniform",
"math.sqrt",
"torchvision.transforms.functional.pad",
"torchvision.transforms.functional.rotate",
"torchvision.transforms.functional.resized_crop",
"numpy.random.uniform",
"random.random",
"random.randint"
] | [((1649, 1674), 'random.randint', 'random.randint', (['(0)', '(h - th)'], {}), '(0, h - th)\n', (1663, 1674), False, 'import random\n'), ((1687, 1712), 'random.randint', 'random.randint', (['(0)', '(w - tw)'], {}), '(0, w - tw)\n', (1701, 1712), False, 'import random\n'), ((7516, 7557), 'numpy.random.uniform', 'np.rand... |
#! -*- coding:utf-8 -*-
"""Authorization for yuqing
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import hmac
import hashlib
import urllib.parse
import datetime
import time
import json
# secrets
SECRET_NAMES = set(['access_key',
'secret_key',
'api_key',
'api_secr... | [
"json.load",
"time.time",
"datetime.datetime.utcnow"
] | [((733, 759), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (757, 759), False, 'import datetime\n'), ((412, 425), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (421, 425), False, 'import json\n'), ((1223, 1234), 'time.time', 'time.time', ([], {}), '()\n', (1232, 1234), False, 'import tim... |
# read version from installed package
from importlib.metadata import version
__version__ = version("chemcalculator")
# populate package namespace
from chemcalculator.chemcalculator import compute_mass
from chemcalculator.chemcalculator import moles_grams_converter
from chemcalculator.chemcalculator import percent_mass... | [
"importlib.metadata.version"
] | [((91, 116), 'importlib.metadata.version', 'version', (['"""chemcalculator"""'], {}), "('chemcalculator')\n", (98, 116), False, 'from importlib.metadata import version\n')] |
import torch
from torch.autograd import Variable
from models.CryptoNet import ABCryptoNet
from models.CryptoNet import ECryptoNet
import torch.optim as optim
import tensorflow as tf
class Manager(object):
def __init__(self, args, texts):
self.msg_len = args.msg_len
self.no_cuda = args.no_cuda
... | [
"torch.abs",
"torch.cuda.is_available",
"pdb.set_trace",
"tensorflow.subtract",
"models.CryptoNet.ABCryptoNet",
"torch.autograd.Variable",
"models.CryptoNet.ECryptoNet",
"torch.cat"
] | [((708, 741), 'torch.autograd.Variable', 'Variable', (['_in'], {'requires_grad': '(True)'}), '(_in, requires_grad=True)\n', (716, 741), False, 'from torch.autograd import Variable\n'), ((1216, 1229), 'models.CryptoNet.ABCryptoNet', 'ABCryptoNet', ([], {}), '()\n', (1227, 1229), False, 'from models.CryptoNet import ABCr... |
import Utilis, Conteudo
from time import sleep
while True:
Utilis.title('UCM AVALIATOR')
Utilis.menu('Menu principal', 'Ver Filmes', 'Ver Séries', 'Dar Notas', 'Batalha', 'Sair', 'About')
x = (Utilis.validachoice(7))
if x == 6: # about
Conteudo.menu6()
if x == 5: # sair
Conteudo.me... | [
"Conteudo.menu6",
"Conteudo.menu2",
"Utilis.validachoice",
"Conteudo.menu5",
"Utilis.menu",
"Conteudo.menu3",
"Conteudo.menu1",
"Utilis.title"
] | [((63, 92), 'Utilis.title', 'Utilis.title', (['"""UCM AVALIATOR"""'], {}), "('UCM AVALIATOR')\n", (75, 92), False, 'import Utilis, Conteudo\n'), ((97, 199), 'Utilis.menu', 'Utilis.menu', (['"""Menu principal"""', '"""Ver Filmes"""', '"""Ver Séries"""', '"""Dar Notas"""', '"""Batalha"""', '"""Sair"""', '"""About"""'], {... |
import sushigo
import itertools as it
import random
POSSIBLE_CARDS = list(set([str(_) for _ in sushigo.deck.StandardDeck()]))
class CustomPlayer(sushigo.player.Player):
def __init__(self, order, name=None):
super(CustomPlayer, self).__init__()
self.name = 'custom-player'
if name:
... | [
"sushigo.player.Player",
"random.random",
"itertools.permutations",
"sushigo.deck.StandardDeck"
] | [((1179, 1211), 'sushigo.player.Player', 'sushigo.player.Player', ([], {'name': '"""p1"""'}), "(name='p1')\n", (1200, 1211), False, 'import sushigo\n'), ((2270, 2301), 'itertools.permutations', 'it.permutations', (['POSSIBLE_CARDS'], {}), '(POSSIBLE_CARDS)\n', (2285, 2301), True, 'import itertools as it\n'), ((2188, 22... |
import urllib.request
import threading
import json
import wiringpi as pi , time
BASE_URL = "http://ec2-13-114-247-66.ap-northeast-1.compute.amazonaws.com"
pi.wiringPiSetupGpio()
class Motor:
def __init__(self, OUTPUT_PINS, TIME_SLEEP):
self.OUTPUT_PINS = OUTPUT_PINS
self.TIME_SLEEP = TIME_SLEEP
... | [
"wiringpi.wiringPiSetupGpio",
"time.sleep",
"wiringpi.pinMode",
"threading.Thread",
"wiringpi.digitalWrite"
] | [((158, 180), 'wiringpi.wiringPiSetupGpio', 'pi.wiringPiSetupGpio', ([], {}), '()\n', (178, 180), True, 'import wiringpi as pi, time\n'), ((2870, 2883), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2880, 2883), False, 'import wiringpi as pi, time\n'), ((1455, 1488), 'wiringpi.pinMode', 'pi.pinMode', (['OUTPUT_P... |
# Pygcurse Maze
# By <NAME> <EMAIL>
# Maze Generation code by <NAME>
# This program is a demo for the Pygcurse module.
# Simplified BSD License, Copyright 2011 <NAME>
import pygcurse, pygame, sys, random, time
from pygame.locals import *
BLUE = (0, 0, 128)
YELLOW = (255, 255, 0)
GREEN = (0, 255, 0)
BLACK = (0,0,0)
R... | [
"pygame.display.set_caption",
"sys.exit",
"pygame.quit",
"pygame.event.get",
"pygcurse.PygcurseWindow",
"random.seed",
"pygame.time.Clock",
"pygame.display.update",
"time.time",
"random.randint",
"sys.stdout.write"
] | [((386, 452), 'pygcurse.PygcurseWindow', 'pygcurse.PygcurseWindow', (['MAZE_WIDTH', 'MAZE_HEIGHT'], {'fullscreen': '(False)'}), '(MAZE_WIDTH, MAZE_HEIGHT, fullscreen=False)\n', (409, 452), False, 'import pygcurse, pygame, sys, random, time\n'), ((453, 496), 'pygame.display.set_caption', 'pygame.display.set_caption', ([... |
# Mathematical Thinking in Computer Science
# Week 2
#
# 16 diagonals.
import enum
import sys
from typing import List, Tuple
TOTAL_LINES = 16
SIZE = 5
class Square(enum.Enum):
EMPTY = 0
UP = 1
DOWN = 2
def is_valid(p_pos: Tuple[int, int], p_val: Square,
new: Tuple[int, int], val: Square) -> b... | [
"sys.stdin.readline",
"sys.stdout.write"
] | [((764, 786), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (780, 786), False, 'import sys\n'), ((945, 967), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (961, 967), False, 'import sys\n'), ((972, 992), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', ... |
import ast
import json
import redis
import requests
from flask import Flask, request
from os import environ
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.instrumentation.redis import RedisInstrumentor
from ope... | [
"opentelemetry.sdk.resources.Resource.create",
"requests.post",
"flask.Flask",
"json.dumps",
"os.environ.get",
"opentelemetry.sdk.trace.export.BatchSpanProcessor",
"opentelemetry.trace.get_tracer",
"ast.literal_eval",
"redis.StrictRedis",
"opentelemetry.instrumentation.flask.FlaskInstrumentor",
... | [((651, 690), 'os.environ.get', 'environ.get', (['"""TRACER_HOST"""', '"""localhost"""'], {}), "('TRACER_HOST', 'localhost')\n", (662, 690), False, 'from os import environ\n'), ((705, 743), 'os.environ.get', 'environ.get', (['"""REDIS_HOST"""', '"""localhost"""'], {}), "('REDIS_HOST', 'localhost')\n", (716, 743), False... |
from sqlalchemy import Column, func
from clickhouse_sqlalchemy import types, Table
from tests.testcase import CompilationTestCase
class CountTestCaseBase(CompilationTestCase):
table = Table(
't1', CompilationTestCase.metadata(),
Column('x', types.Int32, primary_key=True)
)
def test_count... | [
"sqlalchemy.func.count",
"sqlalchemy.func.distinct",
"tests.testcase.CompilationTestCase.metadata",
"sqlalchemy.Column"
] | [((212, 242), 'tests.testcase.CompilationTestCase.metadata', 'CompilationTestCase.metadata', ([], {}), '()\n', (240, 242), False, 'from tests.testcase import CompilationTestCase\n'), ((252, 294), 'sqlalchemy.Column', 'Column', (['"""x"""', 'types.Int32'], {'primary_key': '(True)'}), "('x', types.Int32, primary_key=True... |
import pycommons.logger
import maxwell.protocol.maxwell_protocol_pb2 as protocol_types
logger = pycommons.logger.get_instance(__name__)
class Publisher(object):
# ===========================================
# apis
# ===========================================
def __init__(self, master, connection_mg... | [
"maxwell.protocol.maxwell_protocol_pb2.push_req_t"
] | [((1952, 1979), 'maxwell.protocol.maxwell_protocol_pb2.push_req_t', 'protocol_types.push_req_t', ([], {}), '()\n', (1977, 1979), True, 'import maxwell.protocol.maxwell_protocol_pb2 as protocol_types\n')] |
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
import os
import threading
import argparse
import queue
from .gui import nntrainer_ui, nntrainer_augmentation
from .modeltrainer import ModelTrainer
from .trainingoptions import TrainingOptions, EarlyStoppingOptions
from .architectures import ARCHITECTURES
LOSS_FU... | [
"argparse.ArgumentParser",
"PyQt5.QtWidgets.QMessageBox",
"os.path.realpath",
"PyQt5.QtWidgets.QApplication.quit",
"PyQt5.QtCore.QThreadPool",
"os.path.isdir",
"PyQt5.QtWidgets.QApplication",
"os.path.expanduser",
"PyQt5.QtWidgets.QFileDialog.Options"
] | [((465, 488), 'PyQt5.QtWidgets.QMessageBox', 'QtWidgets.QMessageBox', ([], {}), '()\n', (486, 488), False, 'from PyQt5 import QtWidgets, QtGui, QtCore\n'), ((6997, 7022), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7020, 7022), False, 'import argparse\n'), ((7483, 7509), 'PyQt5.QtWidgets.QA... |
from cryptography_toolkit.encrpytion import reverse_cipher, caesar_cipher, rot13_cipher
from math import floor, ceil
def reverse_decrypt(ciphertext):
return reverse_cipher(ciphertext)
def caesar_decrypt(ciphertext, key):
return caesar_cipher(ciphertext, 26-key)
def rot13_decrypt(ciphertext):
return ro... | [
"math.floor",
"cryptography_toolkit.encrpytion.caesar_cipher",
"cryptography_toolkit.encrpytion.rot13_cipher",
"cryptography_toolkit.encrpytion.reverse_cipher"
] | [((163, 189), 'cryptography_toolkit.encrpytion.reverse_cipher', 'reverse_cipher', (['ciphertext'], {}), '(ciphertext)\n', (177, 189), False, 'from cryptography_toolkit.encrpytion import reverse_cipher, caesar_cipher, rot13_cipher\n'), ((240, 275), 'cryptography_toolkit.encrpytion.caesar_cipher', 'caesar_cipher', (['cip... |
import json
from adsimulator.templates.default_values import DEFAULT_VALUES
def print_all_parameters(parameters):
print("")
print("New Settings:")
print(json.dumps(parameters, indent=4, sort_keys=True))
def get_perc_param_value(node, key, parameters):
try:
if 0 <= parameters[node][key] <= 10... | [
"json.dumps"
] | [((167, 215), 'json.dumps', 'json.dumps', (['parameters'], {'indent': '(4)', 'sort_keys': '(True)'}), '(parameters, indent=4, sort_keys=True)\n', (177, 215), False, 'import json\n')] |
'''
A simple 'app' to draw on image based on sketch example
'''
import ui
import photos
import console
canvas_size = 500
image_background = ui.Image('test:Mandrill')
class PathView (ui.View):
def __init__(self, frame):
self.frame = frame
self.flex = 'WH'
self.path = None
self.acti... | [
"console.hud_alert",
"ui.Image",
"ui.ImageContext",
"ui.Path",
"photos.save_image",
"ui.ImageView",
"ui.ButtonItem"
] | [((142, 167), 'ui.Image', 'ui.Image', (['"""test:Mandrill"""'], {}), "('test:Mandrill')\n", (150, 167), False, 'import ui\n'), ((415, 424), 'ui.Path', 'ui.Path', ([], {}), '()\n', (422, 424), False, 'import ui\n'), ((1211, 1226), 'ui.ButtonItem', 'ui.ButtonItem', ([], {}), '()\n', (1224, 1226), False, 'import ui\n'), (... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 16:57:31 2017
@author: Jean-Michel
"""
import AstarClass as AC
import sys
sys.path.append("../model")
from WeatherClass import Weather
import numpy as np
import SimulatorTLKT as SimC
from SimulatorTLKT import Simulator
import matplotlib.pyplot as plt
im... | [
"SimulatorTLKT.Simulator",
"matplotlib.rcParams.update",
"AstarClass.Node",
"copy.copy",
"AstarClass.Pathfinder",
"WeatherClass.Weather.load",
"sys.path.append",
"numpy.arange"
] | [((135, 162), 'sys.path.append', 'sys.path.append', (['"""../model"""'], {}), "('../model')\n", (150, 162), False, 'import sys\n'), ((434, 479), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (460, 479), False, 'import matplotlib\n'), ((523, 551), 'sys.... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
from matplotlib.transforms import Bbox
import seaborn as sns
import utils
from utils import filters, maxima, segment, merge
import warnings
def pipeline(img, low, high, roi_percentile=85, focal_scope='global', maxima_are... | [
"utils.filters.blur",
"numpy.ones",
"utils.percentile",
"utils.resize",
"utils.maxima.remove_small_holes",
"utils.merge.merge_images",
"utils.merge.keep_percentage",
"matplotlib.transforms.Bbox",
"matplotlib.pyplot.figure",
"utils.segment.region_growing",
"matplotlib.patches.ConnectionPatch",
... | [((5729, 5766), 'numpy.ones', 'np.ones', (['img[0].shape'], {'dtype': 'np.uint8'}), '(img[0].shape, dtype=np.uint8)\n', (5736, 5766), True, 'import numpy as np\n'), ((5836, 5872), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(5)', '(7)'], {'figsize': '(16, 16)'}), '(5, 7, figsize=(16, 16))\n', (5848, 5872), True, '... |
import urllib
import urllib.parse
import zlib
class Uri:
def __init__(self, scheme: str, hostname: str, port: int, resource: str):
""" Simple Uri (Universal Resource Identifier) class to split/join uri components
format: scheme://hostname:port/resource (e.g. http://stuff.com:1234/personal/ad... | [
"urllib.parse.urlsplit"
] | [((583, 616), 'urllib.parse.urlsplit', 'urllib.parse.urlsplit', (['url_string'], {}), '(url_string)\n', (604, 616), False, 'import urllib\n')] |
# Copyright 2014 NEC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
"tempest.services.compute.xml.common.xml_to_json",
"lxml.etree.fromstring"
] | [((1185, 1209), 'tempest.services.compute.xml.common.xml_to_json', 'common.xml_to_json', (['node'], {}), '(node)\n', (1203, 1209), False, 'from tempest.services.compute.xml import common\n'), ((1339, 1361), 'lxml.etree.fromstring', 'etree.fromstring', (['body'], {}), '(body)\n', (1355, 1361), False, 'from lxml import e... |
import pytest
from models.User import User
from models.UserLease import UserLease
from models.NCDMFLease import NCDMFLease
from firebase_admin import auth
def test_search_leases(client, dbSession, addMockFbUser):
# add a mock Firebase user
addMockFbUser(dict(uid='3sH9so5Y3DP72QA1XqbWw9J6I8o1', email='<EMAIL>'), ... | [
"models.UserLease.UserLease",
"models.User.User",
"models.NCDMFLease.NCDMFLease"
] | [((1330, 1396), 'models.User.User', 'User', ([], {'firebase_uid': '"""3sH9so5Y3DP72QA1XqbWw9J6I8o1"""', 'email': '"""<EMAIL>"""'}), "(firebase_uid='3sH9so5Y3DP72QA1XqbWw9J6I8o1', email='<EMAIL>')\n", (1334, 1396), False, 'from models.User import User\n'), ((2007, 2159), 'models.UserLease.UserLease', 'UserLease', ([], {... |
###############################################################################
## author: <NAME>
## version: 1.1
## Python 3.6.5 | UTF-8
## Required Modules:
## google-api-python-client
## google-auth-httplib2
## google-auth-oauthlib
print('='*50)
print('Importing modules.')
from backup import get_datetime
fr... | [
"backup.zipFolder",
"backup.get_datetime",
"backup.uploadFile",
"backup.remove",
"backup.authBuild"
] | [((559, 573), 'backup.get_datetime', 'get_datetime', ([], {}), '()\n', (571, 573), False, 'from backup import get_datetime\n'), ((817, 854), 'backup.zipFolder', 'zipFolder', (['folder_path', 'zip_file_name'], {}), '(folder_path, zip_file_name)\n', (826, 854), False, 'from backup import zipFolder\n'), ((1051, 1079), 'ba... |
#!/usr/bin/env python
#
# File: bar_plot.py
#
import argparse
import os
import pickle
import matplotlib
import numpy as np
params = {
'axes.labelsize': 12,
'font.size': 16,
'font.family': 'serif',
'legend.fontsize': 12,
'xtick.labelsize': 12,
'ytick.labelsize': 12,
#'text.usetex': True,
... | [
"argparse.ArgumentParser",
"matplotlib.rcParams.update",
"pickle.load",
"matplotlib.pyplot.style.use",
"os.path.join",
"pandas.DataFrame"
] | [((352, 386), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (['params'], {}), '(params)\n', (378, 386), False, 'import matplotlib\n'), ((420, 455), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-colorblind"""'], {}), "('seaborn-colorblind')\n", (433, 455), True, 'import matplotlib.pyplot as... |
########################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
... | [
"rospy.logerr",
"moveit_commander.RobotCommander",
"moveit_msgs.msg.PlaceLocation",
"moveit_msgs.msg.Grasp",
"rospy.init_node",
"rospy.ServiceProxy",
"moveit_commander.PlanningSceneInterface",
"tf.transformations.quaternion_from_euler",
"moveit_commander.roscpp_initialize",
"geometry_msgs.msg.Pose... | [((2986, 3005), 'rospy.Duration', 'rospy.Duration', (['(0.5)'], {}), '(0.5)\n', (3000, 3005), False, 'import rospy\n'), ((3728, 3747), 'rospy.Duration', 'rospy.Duration', (['(0.5)'], {}), '(0.5)\n', (3742, 3747), False, 'import rospy\n'), ((4663, 4726), 'tf.transformations.quaternion_from_euler', 'quaternion_from_euler... |
import re
from functools import reduce
from operator import or_
from actstream.models import Follow
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django_filters import CharFilter, ChoiceFilter, FilterSet
from machina.apps.forum.models import Forum
from machina.... | [
"re.split",
"django.contrib.contenttypes.models.ContentType.objects.filter",
"django_filters.ChoiceFilter",
"machina.apps.forum_conversation.models.Topic.objects.filter",
"django_filters.CharFilter",
"machina.apps.forum.models.Forum.objects.filter",
"django.db.models.Q"
] | [((605, 654), 'django_filters.CharFilter', 'CharFilter', ([], {'method': '"""search_filter"""', 'label': '"""Forum"""'}), "(method='search_filter', label='Forum')\n", (615, 654), False, 'from django_filters import CharFilter, ChoiceFilter, FilterSet\n'), ((668, 730), 'django_filters.CharFilter', 'CharFilter', ([], {'me... |
import abc
import numpy
from collections import defaultdict
from smqtk.representation import SmqtkRepresentation
from smqtk.utils.dict import merge_dict
from smqtk.utils.plugin import Pluggable
from smqtk.utils.parallel import parallel_map
from ._io import elements_to_matrix
def _uuid_and_vector_from_descriptor(de... | [
"collections.defaultdict",
"smqtk.utils.dict.merge_dict",
"smqtk.utils.parallel.parallel_map"
] | [((4875, 4901), 'smqtk.utils.dict.merge_dict', 'merge_dict', (['c', 'config_dict'], {}), '(c, config_dict)\n', (4885, 4901), False, 'from smqtk.utils.dict import merge_dict\n'), ((6453, 6542), 'smqtk.utils.parallel.parallel_map', 'parallel_map', (['_uuid_and_vector_from_descriptor', 'descriptors'], {'name': '"""retriev... |
import sys
import numpy
import six.moves
import cellprofiler_core.image
import cellprofiler.modules.measuregranularity
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.modules
print((sys.path))
IMAGE_NAME = "myimage"
OBJECTS_NAME = "myobjects"
def... | [
"numpy.ones",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.isnan",
"numpy.all"
] | [((9229, 9254), 'numpy.ones', 'numpy.ones', (['(40, 40)', 'int'], {}), '((40, 40), int)\n', (9239, 9254), False, 'import numpy\n'), ((10892, 10917), 'numpy.ones', 'numpy.ones', (['(40, 40)', 'int'], {}), '((40, 40), int)\n', (10902, 10917), False, 'import numpy\n'), ((11988, 12013), 'numpy.ones', 'numpy.ones', (['(40, ... |
import random
class Queue:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def enqueue(self, item):
self.items.insert(0,item)
def dequeue(self):
return self.items.pop()
def size(self):
return len(self.items)
'''
The Printer ... | [
"random.randrange"
] | [((3233, 3257), 'random.randrange', 'random.randrange', (['(1)', '(181)'], {}), '(1, 181)\n', (3249, 3257), False, 'import random\n'), ((1710, 1733), 'random.randrange', 'random.randrange', (['(1)', '(21)'], {}), '(1, 21)\n', (1726, 1733), False, 'import random\n')] |
from django.shortcuts import render, get_object_or_404
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.views import redirect_to_login
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.core.exceptions import ImproperlyConfi... | [
"django.shortcuts.render",
"django.contrib.auth.get_user_model",
"invitations.models.Invitation.objects.filter",
"django.http.HttpResponse",
"csv.writer",
"django.utils.timezone.now",
"datetime.timedelta",
"django.core.exceptions.ImproperlyConfigured"
] | [((1936, 1993), 'django.shortcuts.render', 'render', (['self.request', '"""throttled/locked.html"""'], {'status': '(403)'}), "(self.request, 'throttled/locked.html', status=403)\n", (1942, 1993), False, 'from django.shortcuts import render, get_object_or_404\n'), ((4950, 4987), 'django.http.HttpResponse', 'HttpResponse... |
import json
import os
import shutil
import sys
from subprocess import CalledProcessError, check_output
import pytest
from click.testing import CliRunner
from deepcov.cli import File
from snapshottest.pytest import PyTestSnapshotTest
from tests.util import RESOURCES
from deepcov import cli # isort:skip
pytest_plugin... | [
"subprocess.check_output",
"json.loads",
"click.testing.CliRunner",
"os.chdir",
"shutil.copyfile"
] | [((544, 576), 'os.chdir', 'os.chdir', (["(RESOURCES / '.deepcov')"], {}), "(RESOURCES / '.deepcov')\n", (552, 576), False, 'import os\n'), ((388, 466), 'subprocess.check_output', 'check_output', (['f"""{sys.executable} -m pytest"""'], {'cwd': '"""tests/resources"""', 'shell': '(True)'}), "(f'{sys.executable} -m pytest'... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 23 11:44:07 2021
@author: <NAME>
"""
from openpyxl import load_workbook
import pandas as pd
if __name__ == '__main__':
'''
writer = pd.ExcelWriter("./jpeg_result.xlsx",engine="openpyxl")
wb = load_workbook(writer.path)
writer.book = wb
df = pd.DataFra... | [
"openpyxl.load_workbook",
"pandas.ExcelWriter",
"pandas.DataFrame"
] | [((441, 496), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['"""./jpeg_result.xlsx"""'], {'engine': '"""openpyxl"""'}), "('./jpeg_result.xlsx', engine='openpyxl')\n", (455, 496), True, 'import pandas as pd\n'), ((528, 554), 'openpyxl.load_workbook', 'load_workbook', (['writer.path'], {}), '(writer.path)\n', (541, 554), Fal... |
from __future__ import annotations
import sys
from argparse import ArgumentParser, Namespace
from pathlib import Path
import pytermgui as ptg
def _process_arguments(argv: list[str] | None = None) -> Namespace:
"""Processes command line arguments.
Note that you don't _have to_ use the bultin argparse module... | [
"pytermgui.InputField",
"pytermgui.highlight_python",
"argparse.ArgumentParser",
"pytermgui.WindowManager",
"pytermgui.Splitter.set_char",
"pytermgui.tim.alias",
"pytermgui.Label",
"pytermgui.Layout",
"pytermgui.Window",
"pytermgui.boxes.EMPTY.set_chars_of"
] | [((506, 557), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A simple text editor."""'}), "(description='A simple text editor.')\n", (520, 557), False, 'from argparse import ArgumentParser, Namespace\n'), ((1037, 1079), 'pytermgui.tim.alias', 'ptg.tim.alias', (['"""editor.header"""', '"""@157 240... |
import os
import numpy as np
import imageio
import cv2
from backend import Config
def pre_proc(img, params):
"""
Description
Keyword arguments:
img --
params --
"""
interpolation = params['interpolation']
# img: read in by imageio.imread
# with shape (x,y,3), in the format of RG... | [
"cv2.resize",
"numpy.minimum",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"imageio.imread",
"numpy.maximum",
"numpy.transpose"
] | [((384, 425), 'cv2.resize', 'cv2.resize', (['img', '(112, 96)', 'interpolation'], {}), '(img, (112, 96), interpolation)\n', (394, 425), False, 'import cv2\n'), ((2090, 2105), 'numpy.array', 'np.array', (['faces'], {}), '(faces)\n', (2098, 2105), True, 'import numpy as np\n'), ((2308, 2335), 'numpy.zeros', 'np.zeros', (... |
# Copyright (c) 2014 Cisco Systems
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"mock.Mock",
"apic_ml2.neutron.plugins.ml2.drivers.cisco.apic.mechanism_apic.KeystoneNotificationEndpoint",
"base64.b64encode",
"neutron.plugins.ml2.driver_context.NetworkContext",
"apic_ml2.neutron.plugins.ml2.drivers.cisco.apic.extension_db.ExtensionDbMixin",
"apic_ml2.neutron.plugins.ml2.drivers.cisco.... | [((1793, 1804), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1802, 1804), False, 'import mock\n'), ((1982, 1993), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1991, 1993), False, 'import mock\n'), ((4665, 4706), 'apic_ml2.neutron.tests.unit.ml2.drivers.cisco.apic.test_cisco_apic_common.ControllerMixin.set_up_mocks', 'm... |
r"""
Basic analysis of a MD simulation
=================================
In this example, we will analyze a trajectory of a *Gromacs* MD
simulation:
The trajectory contains simulation data of lysozyme over the course of
1 ns.
The data is the result of the famous *Gromacs*
'`Lysozyme in Water <http://www.mdtutorials.co... | [
"biotite.structure.io.load_structure",
"numpy.arange",
"numpy.where",
"biotite.structure.rmsd",
"biotite.structure.filter_amino_acids",
"matplotlib.pyplot.figure",
"biotite.structure.average",
"biotite.structure.get_residue_count",
"biotite.structure.remove_pbc",
"biotite.structure.gyration_radius... | [((1222, 1261), 'biotite.structure.io.load_structure', 'strucio.load_structure', (['templ_file_path'], {}), '(templ_file_path)\n', (1244, 1261), True, 'import biotite.structure.io as strucio\n'), ((1487, 1521), 'biotite.structure.filter_amino_acids', 'struc.filter_amino_acids', (['template'], {}), '(template)\n', (1511... |
"""
Split ramps into individual FLT exposures.
To use, download *just* the RAW files for a given visit/program.
>>> from wfc3dash import process_raw
>>> process_raw.run_all()
"""
def run_all(skip_first_read=True):
"""
Run splitting script on all RAW files in the working directory.
First ... | [
"numpy.sqrt",
"os.getenv",
"astropy.io.fits.PrimaryHDU",
"reprocess_wfc3.reprocess_wfc3.get_flat",
"astropy.io.fits.ImageHDU",
"numpy.diff",
"numpy.zeros",
"glob.glob",
"astropy.io.fits.open",
"reprocess_wfc3.reprocess_wfc3.split_multiaccum",
"wfc3tools.calwf3"
] | [((505, 527), 'glob.glob', 'glob.glob', (['"""*raw.fits"""'], {}), "('*raw.fits')\n", (514, 527), False, 'import glob\n'), ((1610, 1627), 'astropy.io.fits.open', 'pyfits.open', (['file'], {}), '(file)\n', (1621, 1627), True, 'import astropy.io.fits as pyfits\n'), ((1794, 1833), 'reprocess_wfc3.reprocess_wfc3.split_mult... |
# -*- coding:utf-8 -*-
"""
Created on Wed Nov 20 12:40 2019
@author <NAME> - <EMAIL>
Agent - Recycler
"""
from mesa import Agent
import numpy as np
class Recyclers(Agent):
"""
A recycler which sells recycled materials and improve its processes.
Attributes:
unique_id: agent #, also relate to th... | [
"numpy.random.triangular",
"numpy.random.random",
"numpy.isnan",
"numpy.random.uniform"
] | [((1276, 1384), 'numpy.random.triangular', 'np.random.triangular', (['original_recycling_cost[0]', 'original_recycling_cost[2]', 'original_recycling_cost[1]'], {}), '(original_recycling_cost[0], original_recycling_cost[2],\n original_recycling_cost[1])\n', (1296, 1384), True, 'import numpy as np\n'), ((2479, 2576), ... |
# -*- coding: utf-8 -*-
from selenium.webdriver.chrome.webdriver import WebDriver
from group import Group
import unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_new_group (unittest.TestCase):
def setUp(self):
... | [
"unittest.main",
"group.Group",
"selenium.webdriver.chrome.webdriver.WebDriver"
] | [((2809, 2824), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2822, 2824), False, 'import unittest\n'), ((331, 400), 'selenium.webdriver.chrome.webdriver.WebDriver', 'WebDriver', ([], {'executable_path': '"""C:\\\\chromedriver_win32\\\\chromedriver.exe"""'}), "(executable_path='C:\\\\chromedriver_win32\\\\chrome... |
import click
from arrow.commands.annotations.add_attribute import cli as add_attribute
from arrow.commands.annotations.add_comment import cli as add_comment
from arrow.commands.annotations.add_dbxref import cli as add_dbxref
from arrow.commands.annotations.add_feature import cli as add_feature
from arrow.commands.annot... | [
"click.group"
] | [((2338, 2351), 'click.group', 'click.group', ([], {}), '()\n', (2349, 2351), False, 'import click\n')] |
from itertools import cycle
from unittest.mock import patch
from django.utils import timezone as djangotime
from model_bakery import baker, seq
from tacticalrmm.test import TacticalTestCase
from logs.models import PendingAction
class TestAuditViews(TacticalTestCase):
def setUp(self):
self.authenticate()... | [
"model_bakery.baker.make",
"itertools.cycle",
"model_bakery.seq",
"logs.models.PendingAction.objects.filter",
"model_bakery.baker.make_recipe",
"django.utils.timezone.now",
"django.utils.timezone.timedelta",
"unittest.mock.patch"
] | [((6706, 6743), 'unittest.mock.patch', 'patch', (['"""agents.models.Agent.nats_cmd"""'], {}), "('agents.models.Agent.nats_cmd')\n", (6711, 6743), False, 'from unittest.mock import patch\n'), ((451, 477), 'model_bakery.baker.make', 'baker.make', (['"""clients.Site"""'], {}), "('clients.Site')\n", (461, 477), False, 'fro... |
from main import db
from sqlalchemy import Column, Integer, DateTime, Text, ForeignKey
class Mail(db.Model):
__tablename__ = "mail"
id = Column(Integer, primary_key=True)
# 发送者用户ID
from_id = Column(Integer, ForeignKey(
"user.id", ondelete="CASCADE"), index=True, nullable=False)
# 接收者用户ID
... | [
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((148, 181), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (154, 181), False, 'from sqlalchemy import Column, Integer, DateTime, Text, ForeignKey\n'), ((450, 494), 'sqlalchemy.Column', 'Column', (['DateTime'], {'nullable': '(False)', 'index': '(True)'}), '(Da... |
#! /usr/bin/env python
import criutils as cu
import raveutils as ru
import openravepy as orpy
env = orpy.Environment()
robot_xml = 'robots/sda10f.robot.xml'
robot = env.ReadRobotXMLFile(robot_xml)
env.AddRobot(robot)
env.SetViewer('qtcoin')
prefixes = ['arm_left_', 'arm_right_']
handles = []
for prefix in prefixes:
... | [
"openravepy.Environment",
"raveutils.conversions.from_ray",
"raveutils.visual.draw_axes"
] | [((101, 119), 'openravepy.Environment', 'orpy.Environment', ([], {}), '()\n', (117, 119), True, 'import openravepy as orpy\n'), ((539, 567), 'raveutils.conversions.from_ray', 'ru.conversions.from_ray', (['ray'], {}), '(ray)\n', (562, 567), True, 'import raveutils as ru\n'), ((587, 624), 'raveutils.visual.draw_axes', 'r... |
import ast
from astpretty import pprint
from contract import Case, Contract
from typing import Dict as _Dict
import copy
class DispatchByName(Contract):
@classmethod
def make(cls, node: ast.AST) -> ast.AST:
if isinstance(node, ast.FunctionDef):
args = node.args.args
secs = no... | [
"ast.Index",
"ast.Load",
"copy.copy",
"copy.deepcopy",
"ast.arg",
"ast.Pass"
] | [((2980, 3006), 'ast.arg', 'ast.arg', (['ident', 'annotation'], {}), '(ident, annotation)\n', (2987, 3006), False, 'import ast\n'), ((1085, 1100), 'copy.copy', 'copy.copy', (['node'], {}), '(node)\n', (1094, 1100), False, 'import copy\n'), ((1212, 1231), 'copy.deepcopy', 'copy.deepcopy', (['args'], {}), '(args)\n', (12... |
import os
import warnings
from itertools import tee
from copy import copy
from collections import namedtuple
import numpy as np
import pybullet as p
from pybullet_planning.interfaces.env_manager.pose_transformation import get_distance
from pybullet_planning.utils import MAX_DISTANCE, EPS, INF
from pybullet_planning.in... | [
"pybullet_planning.interfaces.robots.joint.get_joint_positions",
"collections.namedtuple",
"pybullet_planning.interfaces.robots.body.clone_body",
"pybullet_planning.interfaces.robots.body.remove_body",
"pybullet_planning.interfaces.robots.link.prune_fixed_joints",
"pybullet_planning.interfaces.robots.join... | [((804, 864), 'collections.namedtuple', 'namedtuple', (['"""Nullspace"""', "['lower', 'upper', 'range', 'rest']"], {}), "('Nullspace', ['lower', 'upper', 'range', 'rest'])\n", (814, 864), False, 'from collections import namedtuple\n'), ((940, 974), 'pybullet_planning.interfaces.robots.joint.get_joint_positions', 'get_j... |
import numpy as np
from torch.utils.data import DataLoader, SequentialSampler
HIDDEN_SIZE_BERT = 768
def flat_accuracy(preds, labels):
preds = preds.squeeze()
my_round = lambda x: 1 if x >= 0.5 else 0
pred_flat = np.fromiter(map(my_round, preds), dtype=np.int).flatten()
labels_flat = labels.flatten()
... | [
"numpy.sum",
"datetime.timedelta",
"torch.utils.data.SequentialSampler"
] | [((331, 363), 'numpy.sum', 'np.sum', (['(pred_flat == labels_flat)'], {}), '(pred_flat == labels_flat)\n', (337, 363), True, 'import numpy as np\n'), ((2377, 2420), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': 'elapsed_rounded'}), '(seconds=elapsed_rounded)\n', (2395, 2420), False, 'import datetime\n'),... |
from .remoteproxy import RemoteEventHandler, ClosedError, NoResultError, LocalObjectProxy, ObjectProxy
import subprocess, atexit, os, sys, time, random, socket, signal
import multiprocessing.connection
from pyqtgraph.Qt import USE_PYSIDE
try:
import cPickle as pickle
except ImportError:
import pickle
__all__ =... | [
"pickle.dumps",
"time.sleep",
"sys.exc_info",
"pyqtgraph.Qt.QtGui.QApplication",
"sys.exit",
"os.fork",
"os.kill",
"subprocess.Popen",
"traceback.print_exception",
"os.setpgrp",
"os.getpid",
"sys.modules.pop",
"os.closerange",
"sys.stdin.close",
"atexit.register",
"pyqtgraph.Qt.QtGui.Q... | [((16416, 16445), 'pyqtgraph.Qt.QtGui.QApplication.instance', 'QtGui.QApplication.instance', ([], {}), '()\n', (16443, 16445), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((3010, 3024), 'os.urandom', 'os.urandom', (['(20)'], {}), '(20)\n', (3020, 3024), False, 'import subprocess, atexit, os, sys, time, random, ... |
import typing as typ
import httpx
from chaban.config import global_settings, settings
from chaban.core.exceptions import HttpMethodNotAllowed, TelegramAPIError
from chaban.handlers.base import mh_registry
from chaban.utils import MetaSingleton
from .telegram_methods import TelegramMethodsMixin
class TelegramBot(Te... | [
"chaban.handlers.base.mh_registry.get_handler_and_handle"
] | [((1635, 1678), 'chaban.handlers.base.mh_registry.get_handler_and_handle', 'mh_registry.get_handler_and_handle', (['message'], {}), '(message)\n', (1669, 1678), False, 'from chaban.handlers.base import mh_registry\n')] |
# Author: <NAME>
# Email: <EMAIL>
# License: MIT License
from functools import wraps
class Checks:
def __init__(self):
super().__init__()
self.setup_ok = False
def setup(func):
@wraps(func)
def wrapper(self, study_id, model_id):
func(self, study_id, model_id)
... | [
"functools.wraps"
] | [((215, 226), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (220, 226), False, 'from functools import wraps\n'), ((767, 778), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (772, 778), False, 'from functools import wraps\n')] |
import numpy as np
import scipy.fftpack as fft
import sys
sys.path.append('../laplace_solver/')
import laplace_solver as lsolve
from scipy.integrate import cumtrapz
def fourier_inverse_curl(Bx, By, Bz, x, y, z, method='fourier', pad=True):
r"""
Invert curl with pseudo-spectral method described in MacKay 2006.
... | [
"numpy.mean",
"numpy.repeat",
"scipy.fftpack.fftfreq",
"numpy.asarray",
"scipy.integrate.cumtrapz",
"numpy.fft.fftn",
"numpy.array",
"numpy.zeros",
"laplace_solver.dct_3d",
"laplace_solver.idct_3d",
"numpy.expand_dims",
"numpy.meshgrid",
"numpy.fft.ifftn",
"sys.path.append"
] | [((58, 95), 'sys.path.append', 'sys.path.append', (['"""../laplace_solver/"""'], {}), "('../laplace_solver/')\n", (73, 95), False, 'import sys\n'), ((363, 375), 'numpy.array', 'np.array', (['Bx'], {}), '(Bx)\n', (371, 375), True, 'import numpy as np\n'), ((390, 402), 'numpy.array', 'np.array', (['By'], {}), '(By)\n', (... |
import taso
import onnx
graph = taso.load_onnx('onnx_models/resnext50.onnx')
print("graph.run_time(): {}ms".format(graph.run_time()))
print("graph.run_forward(): {}ms".format(graph.run_forward()))
graph = taso.load_onnx('onnx_models/resnext50_taso.onnx')
print("graph.run_time(): {}ms".format(graph.run_time()))
print(... | [
"taso.load_onnx"
] | [((33, 77), 'taso.load_onnx', 'taso.load_onnx', (['"""onnx_models/resnext50.onnx"""'], {}), "('onnx_models/resnext50.onnx')\n", (47, 77), False, 'import taso\n'), ((207, 256), 'taso.load_onnx', 'taso.load_onnx', (['"""onnx_models/resnext50_taso.onnx"""'], {}), "('onnx_models/resnext50_taso.onnx')\n", (221, 256), False,... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 18 12:31:01 2019
@author: <NAME>
"""
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import seaborn as sns
import numpy as np
import os
import sys
# add the whole package to the path
file_dir = os.path.dirname(os.path.abspath(_... | [
"matplotlib.pyplot.savefig",
"preprocessing.cleaned_data.create_cleaned_data_table.get_attributes_catchments",
"matplotlib.pyplot.Subplot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"os.path.abspath",
"matplotlib.gridspec.GridSpecFromSubplotSpec"
] | [((303, 328), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (318, 328), False, 'import os\n'), ((552, 582), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12.5, 15)'}), '(figsize=(12.5, 15))\n', (562, 582), True, 'import matplotlib.pyplot as plt\n'), ((595, 664), 'matplotlib.gr... |
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
def function(x, y):
return (x*x)-(y*y)
def derivate_of_function_x(x): #dx
return 2*x
def derivate_of_function_y(y): #dy
return -2*y
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = 38
y = -18
lr... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((245, 257), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (255, 257), True, 'import matplotlib.pyplot as plt\n'), ((637, 647), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (645, 647), True, 'import matplotlib.pyplot as plt\n')] |
import EasyGA
import random
# Create the Genetic algorithm
ga = EasyGA.GA()
ga.save_data = False
def is_it_5(chromosome):
"""A very simple case test function - If the chromosomes gene value is a 5 add one
to the chromosomes overall fitness value."""
# Overall fitness value
fitness = ... | [
"EasyGA.GA",
"random.randint"
] | [((65, 76), 'EasyGA.GA', 'EasyGA.GA', ([], {}), '()\n', (74, 76), False, 'import EasyGA\n'), ((732, 753), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (746, 753), False, 'import random\n')] |
import tfnn
from tfnn.body.layer import Layer
class PoolingLayer(object):
def __init__(self, pooling='max', strides=(2, 2), ksize=(2, 2), padding='SAME', name=None):
self.pooling = pooling
self.strides = strides
self.ksize = ksize
self.padding = padding
self.name = name
... | [
"tfnn.nn.max_pool",
"tfnn.reduce_max",
"tfnn.split",
"tfnn.transpose",
"tfnn.variable_scope",
"tfnn.name_scope",
"tfnn.histogram_summary",
"tfnn.image_summary",
"tfnn.nn.conv2d",
"tfnn.reshape",
"tfnn.image.convert_image_dtype",
"tfnn.get_variable",
"tfnn.nn.avg_pool",
"tfnn.reduce_min",
... | [((586, 701), 'tfnn.nn.max_pool', 'tfnn.nn.max_pool', ([], {'value': 'image', 'ksize': '[1, k_x, k_y, 1]', 'strides': '[1, stride_x, stride_y, 1]', 'padding': 'self.padding'}), '(value=image, ksize=[1, k_x, k_y, 1], strides=[1, stride_x,\n stride_y, 1], padding=self.padding)\n', (602, 701), False, 'import tfnn\n'), ... |
import math
from math import log, pi, sqrt
from functools import partial
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
# constants
from network_swinir_v2 import SwinTransformerBlock
List = nn.ModuleList
# helpers
def exists(val):
return val is no... | [
"torch.nn.GELU",
"network_swinir_v2.SwinTransformerBlock",
"math.log",
"torch.nn.functional.pad",
"torch.arange",
"torch.mean",
"einops.repeat",
"torch.randn",
"einops.rearrange",
"torch.einsum",
"torch.var",
"torch.cat",
"torch.stack",
"torch.nn.Conv2d",
"functools.partial",
"torch.nn... | [((12355, 12384), 'torch.randn', 'torch.randn', (['(1, 3, 263, 184)'], {}), '((1, 3, 263, 184))\n', (12366, 12384), False, 'import torch\n'), ((895, 936), 'einops.rearrange', 'rearrange', (['x', '"""... (d j) -> ... d j"""'], {'j': '(2)'}), "(x, '... (d j) -> ... d j', j=2)\n", (904, 936), False, 'from einops import re... |
# -*- coding: utf-8 -*-
from .context import green_snake
import unittest
class FilesTestSuite(unittest.TestCase):
"""File test cases."""
def test_files_empty_folder(self):
res = green_snake.getFilesFromFolder("no_files")
self.assertTrue(not res, "It should be an empty folder!")
def tes... | [
"unittest.main"
] | [((517, 532), 'unittest.main', 'unittest.main', ([], {}), '()\n', (530, 532), False, 'import unittest\n')] |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
HOST = "host"
PORT = "port"
TRANSPORT = "transport"
class ConnectionSchema(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"host": {
"type": "string"... | [
"json.loads"
] | [((202, 825), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "host": {\n "type": "string",\n "title": "Host",\n "description": "Syslog Host",\n "order": 1\n },\n "port": {\n "type": "integer",\n "title": "Port",\n "... |
import argparse
import concurrent.futures
import json
import math
import os
import time
import MySQLdb
import requests
from cfg import Config
from itertools import zip_longest
def grouper(iterable, n, fill_value=None):
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fill_value)
def debug(obj... | [
"crawler.Crawler",
"argparse.ArgumentParser",
"json.dumps",
"itertools.zip_longest",
"requests.get",
"time.sleep",
"os.cpu_count",
"cfg.Config",
"MySQLdb.connect",
"time.time"
] | [((264, 304), 'itertools.zip_longest', 'zip_longest', (['*args'], {'fillvalue': 'fill_value'}), '(*args, fillvalue=fill_value)\n', (275, 304), False, 'from itertools import zip_longest\n'), ((10170, 10195), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (10193, 10195), False, 'import argparse\n... |
import numpy as np
import sys
import tensorflow as tf
import cv2
import time
import sys
from .utils import cv2_letterbox_resize, download_from_url
import zipfile
import os
@tf.function
def transform_targets_for_output(y_true, grid_y, grid_x, anchor_idxs, classes):
# y_true: (N, boxes, (x1, y1, x2, y2, class, best... | [
"tensorflow.equal",
"tensorflow.shape",
"zipfile.ZipFile",
"time.sleep",
"numpy.array",
"tensorflow.cast",
"os.path.exists",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.py_function",
"tensorflow.concat",
"numpy.stack",
"numpy.dot",
"tensorflow.reduce_any",
"tensorflow.stack",... | [((523, 553), 'tensorflow.cast', 'tf.cast', (['anchor_idxs', 'tf.int32'], {}), '(anchor_idxs, tf.int32)\n', (530, 553), True, 'import tensorflow as tf\n'), ((569, 615), 'tensorflow.TensorArray', 'tf.TensorArray', (['tf.int32', '(1)'], {'dynamic_size': '(True)'}), '(tf.int32, 1, dynamic_size=True)\n', (583, 615), True, ... |
import datetime
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
import re
# run `scrapy crawl locanto_other2` in the Forced-Labour-Detection-IBM\Web Scraper\scrapy_eg\scrapy_eg\spiders> folder
# NOTE: delete csv file before running the spider
class LocantoSpider(CrawlSpid... | [
"re.sub",
"scrapy.linkextractors.LinkExtractor",
"datetime.datetime.now"
] | [((1757, 1782), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'desc'], {}), "('\\\\s+', ' ', desc)\n", (1763, 1782), False, 'import re\n'), ((963, 1074), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'allow': '"""locanto.ie/Customer-Service-Call-Centre/618/"""', 'deny': "['m.locanto', 'mobile_redirec... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from glob import glob
from os.path import basename
from os.path import splitext
from setuptools import setup
from setuptools import find_packages
def _requires_from_file(filename):
return open(filename).read().splitlines()
setup(
name="",
use_scm_version=Tr... | [
"setuptools.find_packages",
"os.path.basename",
"glob.glob"
] | [((400, 420), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (413, 420), False, 'from setuptools import find_packages\n'), ((507, 523), 'glob.glob', 'glob', (['"""src/*.py"""'], {}), "('src/*.py')\n", (511, 523), False, 'from glob import glob\n'), ((476, 490), 'os.path.basename', 'basena... |
# -*- coding: utf-8 -*-
import os
from codecs import open
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, "olm", "__version__.py"), "r", "utf-8") as f:
exec(f.read(), about)
setup(
name=about["__title__"],
version=about["__version__... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((254, 638), 'setuptools.setup', 'setup', ([], {'name': "about['__title__']", 'version': "about['__version__']", 'description': "about['__description__']", 'author': "about['__author__']", 'author_email': "about['__author_email__']", 'url': "about['__url__']", 'license': "about['__license__']", 'packages': "['olm']", ... |
import os
import ipywidgets as widgets
from ipyleaflet import WidgetControl
from ipyfilechooser import FileChooser
from IPython.display import display
def main_toolbar(m):
padding = "0px 0px 0px 5px" # upper, right, bottom, left
toolbar_button = widgets.ToggleButton(
value=False,
tooltip="T... | [
"ipywidgets.HBox",
"IPython.display.display",
"ipywidgets.VBox",
"pandas.read_csv",
"ipywidgets.Output",
"whiteboxgui.whiteboxgui.get_wbt_dict",
"whiteboxgui.whiteboxgui.build_toolbox",
"ipyfilechooser.FileChooser",
"ipywidgets.Layout",
"ipyleaflet.WidgetControl",
"ipywidgets.ToggleButtons",
"... | [((684, 714), 'ipywidgets.HBox', 'widgets.HBox', (['[toolbar_button]'], {}), '([toolbar_button])\n', (696, 714), True, 'import ipywidgets as widgets\n'), ((1423, 1453), 'ipywidgets.VBox', 'widgets.VBox', (['[toolbar_button]'], {}), '([toolbar_button])\n', (1435, 1453), True, 'import ipywidgets as widgets\n'), ((1730, 1... |
import filecmp, os, tempfile, unittest
from lah.db import LahDb
class LahDbTest(unittest.TestCase):
def setUp(self):
self.data_d = os.path.join(os.path.dirname(__file__), "data", "dataset")
self.dbfile = os.path.join(self.data_d, "test.db")
self.temp_d = tempfile.TemporaryDirectory()
... | [
"tempfile.TemporaryDirectory",
"os.path.exists",
"os.path.getsize",
"lah.db.LahDb.current",
"os.path.join",
"lah.db.LahDb.session",
"os.path.dirname",
"unittest.main",
"lah.db.LahDb"
] | [((1413, 1439), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1426, 1439), False, 'import filecmp, os, tempfile, unittest\n'), ((226, 262), 'os.path.join', 'os.path.join', (['self.data_d', '"""test.db"""'], {}), "(self.data_d, 'test.db')\n", (238, 262), False, 'import filecmp, os, te... |
from typing import List, Optional
from athenian.api.models.web.base_model_ import AllOf, Model
from athenian.api.models.web.common_filter_properties import CommonFilterProperties
class _CommitFilter(Model):
"""Specific parts of the commit filter."""
openapi_types = {
"in_": List[str],
"with_... | [
"athenian.api.models.web.base_model_.AllOf"
] | [((4920, 5007), 'athenian.api.models.web.base_model_.AllOf', 'AllOf', (['_CommitFilter', 'CommonFilterProperties'], {'name': '"""CommitFilter"""', 'module': '__name__'}), "(_CommitFilter, CommonFilterProperties, name='CommitFilter', module=\n __name__)\n", (4925, 5007), False, 'from athenian.api.models.web.base_mode... |
"""
Bridging Composite and Real: Towards End-to-end Deep Image Matting [IJCV-2021]
Dataset processing.
Copyright (c) 2021, <NAME> (<EMAIL>)
Licensed under the MIT License (see LICENSE for details)
Github repo: https://github.com/JizhiziLi/GFM
Paper link (Arxiv): https://arxiv.org/abs/2010.16188
"""
from config impor... | [
"PIL.Image.open",
"cv2.resize",
"cv2.flip",
"numpy.where",
"random.random",
"random.randint"
] | [((3715, 3737), 'random.randint', 'random.randint', (['(25)', '(35)'], {}), '(25, 35)\n', (3729, 3737), False, 'import random\n'), ((1181, 1209), 'numpy.where', 'np.where', (['(trimap_crop == 128)'], {}), '(trimap_crop == 128)\n', (1189, 1209), True, 'import numpy as np\n'), ((1240, 1268), 'numpy.where', 'np.where', ([... |
from Bio import SeqIO
import gzip
import os
import sys
from seqtools.general import rc, translate
def parse_gtf_dict(gtf_str):
return {i.split(' "')[0]:i.split(' "')[1] for i in gtf_str.split('"; ')}
def gtf_to_gene_length(gtf_file, outfile, sum_type='transcript_longest'):
"""
Get Gene length, 3 option... | [
"seqtools.general.translate",
"os.path.join",
"Bio.SeqIO.parse",
"seqtools.general.rc"
] | [((4651, 4681), 'Bio.SeqIO.parse', 'SeqIO.parse', (['input_fh', '"""fasta"""'], {}), "(input_fh, 'fasta')\n", (4662, 4681), False, 'from Bio import SeqIO\n'), ((5012, 5031), 'seqtools.general.translate', 'translate', (['sequence'], {}), '(sequence)\n', (5021, 5031), False, 'from seqtools.general import rc, translate\n'... |
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | [
"AccessControl.ModuleSecurityInfo",
"AccessControl.ZopeGuards.guarded_import"
] | [((2057, 2111), 'AccessControl.ZopeGuards.guarded_import', 'guarded_import', (['module'], {'fromlist': 'fromlist', 'level': 'level'}), '(module, fromlist=fromlist, level=level)\n', (2071, 2111), False, 'from AccessControl.ZopeGuards import guarded_import\n'), ((861, 889), 'AccessControl.ModuleSecurityInfo', 'MSI', (["(... |
from Point import Point
from Function import Function, LinearFunction
from Player import Player
class Level():
def __init__(self, id):
self.id = id
self.functions = [Function(lambda x : 8 - (x - 5)**2/4),
Function(lambda x : (1/3) * (x-5)**3 + 0.2*x)]
se... | [
"Function.Function",
"Point.Point"
] | [((194, 234), 'Function.Function', 'Function', (['(lambda x: 8 - (x - 5) ** 2 / 4)'], {}), '(lambda x: 8 - (x - 5) ** 2 / 4)\n', (202, 234), False, 'from Function import Function, LinearFunction\n'), ((262, 312), 'Function.Function', 'Function', (['(lambda x: 1 / 3 * (x - 5) ** 3 + 0.2 * x)'], {}), '(lambda x: 1 / 3 * ... |
#################################################
# Universidade de Brasília - UnB #
# Departamento de Ciência da Computação #
# Teoria e Aplicação de Grafos - 2021/1 #
# <NAME> - 18/0019279 #
#################################################
import GraphClass
import... | [
"GraphClass.Graph"
] | [((570, 593), 'GraphClass.Graph', 'GraphClass.Graph', (['edges'], {}), '(edges)\n', (586, 593), False, 'import GraphClass\n')] |
# -*- coding: utf-8 -*-
#
# Copyright 2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | [
"datetime.datetime.utcfromtimestamp",
"os.getenv",
"renku.service.cache.FileManagementCache",
"renku.service.cache.ProjectManagementCache",
"time.time"
] | [((1057, 1078), 'renku.service.cache.FileManagementCache', 'FileManagementCache', ([], {}), '()\n', (1076, 1078), False, 'from renku.service.cache import FileManagementCache, ProjectManagementCache\n'), ((2126, 2150), 'renku.service.cache.ProjectManagementCache', 'ProjectManagementCache', ([], {}), '()\n', (2148, 2150)... |
import unittest
from pyquilted.builder.skills import SkillsBuilder
from pyquilted.quilted.skills import Skills
from pyquilted.quilted.skills_table import SkillsTable
class TestBuilderSkills(unittest.TestCase):
def setUp(self):
skills = ["karate", "joust", "parkour", "spooning", "youtubing", "dev"]
... | [
"unittest.main",
"pyquilted.builder.skills.SkillsBuilder"
] | [((1111, 1126), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1124, 1126), False, 'import unittest\n'), ((336, 357), 'pyquilted.builder.skills.SkillsBuilder', 'SkillsBuilder', (['skills'], {}), '(skills)\n', (349, 357), False, 'from pyquilted.builder.skills import SkillsBuilder\n'), ((387, 420), 'pyquilted.build... |
import numpy as np
from astropy import units as u
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
from json_to_dict import constants
from PS2.Ass1.ass1_utils import *
E = 80*u.keV
m = constants["m_e"]
q = constants["q_e"]
B =45000*u.nT
V = getV(E, m)
r_lam = getr_lam(m, V, q, B)
print("Larmor radi... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.deg2rad",
"numpy.linspace",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((711, 725), 'numpy.deg2rad', 'np.deg2rad', (['(25)'], {}), '(25)\n', (721, 725), True, 'import numpy as np\n'), ((878, 905), 'numpy.linspace', 'np.linspace', (['(0)', '(1e-05)', '(1001)'], {}), '(0, 1e-05, 1001)\n', (889, 905), True, 'import numpy as np\n'), ((1091, 1103), 'matplotlib.pyplot.figure', 'plt.figure', ([... |
import os
import sys
from subprocess import call
WORKING_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
ROOT = os.path.join(WORKING_DIR, '..')
TASKLIB = os.path.join(ROOT, 'src/')
INPUT_FILE_DIR = os.path.join(ROOT, 'data/')
def do_this(comando):
print("***************")
sys.stdout.flush()
print("A... | [
"os.path.realpath",
"sys.stdout.flush",
"os.path.join",
"subprocess.call"
] | [((118, 149), 'os.path.join', 'os.path.join', (['WORKING_DIR', '""".."""'], {}), "(WORKING_DIR, '..')\n", (130, 149), False, 'import os\n'), ((160, 186), 'os.path.join', 'os.path.join', (['ROOT', '"""src/"""'], {}), "(ROOT, 'src/')\n", (172, 186), False, 'import os\n'), ((204, 231), 'os.path.join', 'os.path.join', (['R... |
import os
import random
from helpers import RequestHandler
class Instrument(RequestHandler):
def get_names(self, search_query: str, instrument_type: str):
mic = os.getenv("MIC")
endpoint = f'instruments/?search={search_query}&type={instrument_type}&mic={mic}'
response = self.get_data_mar... | [
"random.choice",
"os.getenv"
] | [((177, 193), 'os.getenv', 'os.getenv', (['"""MIC"""'], {}), "('MIC')\n", (186, 193), False, 'import os\n'), ((774, 790), 'os.getenv', 'os.getenv', (['"""MIC"""'], {}), "('MIC')\n", (783, 790), False, 'import os\n'), ((997, 1013), 'os.getenv', 'os.getenv', (['"""MIC"""'], {}), "('MIC')\n", (1006, 1013), False, 'import ... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import numpy as np
import os
app = Flask(__name__)
# DB
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
db = SQLAlchemy(app)
# MA
ma = Marshmallow(app)
# CONFIG
app.config['MAX_CONTENT_LENGTH'] =... | [
"os.path.exists",
"flask.Flask",
"flask_marshmallow.Marshmallow",
"os.path.join",
"numpy.asarray",
"os.mkdir",
"flask_sqlalchemy.SQLAlchemy"
] | [((142, 157), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (147, 157), False, 'from flask import Flask\n'), ((232, 247), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (242, 247), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((259, 275), 'flask_marshmallow.Marshmallow', 'M... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""CDS-ILS Journal model."""
from __future__ import unicode_literals
from copy import deepcopy
from cds_ils.importer.ov... | [
"copy.deepcopy"
] | [((2606, 2636), 'copy.deepcopy', 'deepcopy', (['self._default_fields'], {}), '(self._default_fields)\n', (2614, 2636), False, 'from copy import deepcopy\n')] |
import timeit
class TimingsEntry(object):
"""A log of the runtime for an operation.
"""
def __init__(self, op):
self.op = op
self.evals = 0
self.total_time = 0
self.lastticstamp = None
@property
def avg_time(self):
if self.evals == 0:
return 0
... | [
"timeit.default_timer"
] | [((752, 774), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (772, 774), False, 'import timeit\n'), ((1115, 1137), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1135, 1137), False, 'import timeit\n')] |
#!/usr/bin/python
#####
# applies model predictions to tiled CR predictor data
#####
import gdal
import scipy
import numpy as np
from sklearn import tree
from sklearn import ensemble
from sklearn import linear_model
from sklearn import svm
from sklearn import metrics
from sklearn.model_selection import train_test_spli... | [
"numpy.where",
"numpy.zeros",
"gdal.Open",
"gdal.GetDriverByName"
] | [((1820, 1839), 'gdal.Open', 'gdal.Open', (['tiles[i]'], {}), '(tiles[i])\n', (1829, 1839), False, 'import gdal\n'), ((2104, 2127), 'numpy.where', 'np.where', (['(band != ndval)'], {}), '(band != ndval)\n', (2112, 2127), True, 'import numpy as np\n'), ((2776, 2794), 'numpy.zeros', 'np.zeros', (['(ny, nx)'], {}), '((ny,... |
import torch
from model import CRNN
device = torch.device("cpu")
model = CRNN(device=device, num_channels=1, num_class=(37), num_units=256)
model.load_state_dict(torch.load("results/10_256/crnn9_281999"))
model.to(device)
model.eval()
eg = torch.rand(1, 1, 32, 100).to(device)
trace = torch.jit.trace(model, eg)
tra... | [
"torch.jit.trace",
"model.CRNN",
"torch.load",
"torch.rand",
"torch.device"
] | [((46, 65), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (58, 65), False, 'import torch\n'), ((75, 139), 'model.CRNN', 'CRNN', ([], {'device': 'device', 'num_channels': '(1)', 'num_class': '(37)', 'num_units': '(256)'}), '(device=device, num_channels=1, num_class=37, num_units=256)\n', (79, 139), F... |
from flickrBase import FlickrApiMethod
class FlickrTestLogin(FlickrApiMethod):
name = 'flickr.test.login'
def __init__(self, nojsoncallback=True, format='json', parameters=None):
FlickrApiMethod.__init__(self, nojsoncallback, format, parameters)
def getParameters(self):
p={
#'method' : 'flickr.favorites... | [
"flickrBase.FlickrApiMethod.__init__"
] | [((186, 252), 'flickrBase.FlickrApiMethod.__init__', 'FlickrApiMethod.__init__', (['self', 'nojsoncallback', 'format', 'parameters'], {}), '(self, nojsoncallback, format, parameters)\n', (210, 252), False, 'from flickrBase import FlickrApiMethod\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from os.path import exists, join
from .minisetting import Setting
def get_version(setting: Setting = None):
setting = setting if setting else Setting()
version = ""
with open(setting['VERSION'], "r", encoding='utf8') as version_f:
vers... | [
"logging.getLogger",
"os.path.exists",
"logging.NullHandler",
"logging.StreamHandler",
"logging.Formatter",
"os.path.join"
] | [((612, 632), 'os.path.exists', 'exists', (['setting[key]'], {}), '(setting[key])\n', (618, 632), False, 'from os.path import exists, join\n'), ((1211, 1230), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1228, 1230), False, 'import logging\n'), ((1289, 1329), 'logging.Formatter', 'logging.Formatter', ([... |
#!/usr/bin/env python3
#
# Copyright (c) 2020 Google LLC.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | [
"unittest.defaultTestLoader.loadTestsFromNames",
"unittest.defaultTestLoader.loadTestsFromModule",
"os.path.exists",
"os.path.basename"
] | [((842, 871), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (858, 871), False, 'import os\n'), ((5025, 5100), 'unittest.defaultTestLoader.loadTestsFromNames', 'unittest.defaultTestLoader.loadTestsFromNames', (['args.testnames'], {'module': 'tests'}), '(args.testnames, module=tests)\n... |
from django.db import models
from django.db.models import Sum
class Ultimo(models.Model):
code = models.CharField(max_length=50, primary_key=True)
code_contract = models.CharField(max_length=30, blank=True, null=True)
voortgangsstatus = models.CharField(max_length=30, blank=True, null=True)
omschrijvi... | [
"django.db.models.Sum",
"django.db.models.FloatField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((103, 152), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'primary_key': '(True)'}), '(max_length=50, primary_key=True)\n', (119, 152), False, 'from django.db import models\n'), ((173, 227), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'blank': '(True)'... |
import torch.utils.data as data
import torch
import h5py
import numpy as np
def data_augment(im,num):
org_image = im.transpose(1,2,0)
if num ==0:
ud_image = np.flipud(org_image)
tranform = ud_image
elif num ==1:
lr_image = np.fliplr(org_image)
tranform = lr_image... | [
"numpy.flipud",
"numpy.fliplr",
"h5py.File",
"numpy.random.randint",
"numpy.rot90"
] | [((182, 202), 'numpy.flipud', 'np.flipud', (['org_image'], {}), '(org_image)\n', (191, 202), True, 'import numpy as np\n'), ((1191, 1211), 'h5py.File', 'h5py.File', (['file_path'], {}), '(file_path)\n', (1200, 1211), False, 'import h5py\n'), ((1374, 1397), 'numpy.random.randint', 'np.random.randint', (['(0)', '(8)'], {... |
from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.locations.tests.util import LocationHierarchyTestCase
from corehq.apps.users.dbaccessors.all_commcare_users import delete_all_users
from corehq.apps.users.models import WebUser
from custom.m4change.reports import get_locatio... | [
"custom.m4change.reports.get_location_hierarchy_by_id",
"corehq.apps.users.dbaccessors.all_commcare_users.delete_all_users",
"corehq.apps.users.models.WebUser.create"
] | [((877, 920), 'corehq.apps.users.models.WebUser.create', 'WebUser.create', (['self.domain', '"""test"""', '"""test"""'], {}), "(self.domain, 'test', 'test')\n", (891, 920), False, 'from corehq.apps.users.models import WebUser\n'), ((954, 972), 'corehq.apps.users.dbaccessors.all_commcare_users.delete_all_users', 'delete... |
from decimal import Decimal
from typing import Any, Optional
from freshbooks.api.accounting import AccountingResource
from freshbooks.api.resource import HttpVerbs
from freshbooks.errors import FreshBooksError
from freshbooks.models import Result
class EventsResource(AccountingResource):
"""Handles resources und... | [
"freshbooks.errors.FreshBooksError",
"freshbooks.models.Result"
] | [((2476, 2510), 'freshbooks.models.Result', 'Result', (['self.single_name', 'response'], {}), '(self.single_name, response)\n', (2482, 2510), False, 'from freshbooks.models import Result\n'), ((3137, 3171), 'freshbooks.models.Result', 'Result', (['self.single_name', 'response'], {}), '(self.single_name, response)\n', (... |