code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import math
def oversample(all_paths, per_class_split, oversample_ids, class_names):
union = set()
all_sum = 0
print('Oversample stats:')
print('Total images before =', len(all_paths[0]))
for i in oversample_ids:
duplicates = 1
print(f'id = {i} -> {class_names[i]} : num of oversampled =', len(per_cla... | [
"math.log2"
] | [((1073, 1124), 'math.log2', 'math.log2', (['(downsampling_factor // upsampling_factor)'], {}), '(downsampling_factor // upsampling_factor)\n', (1082, 1124), False, 'import math\n')] |
from cdm.objectmodel import CdmCorpusDefinition, CdmManifestDefinition
from cdm.storage import LocalAdapter
from cdm.enums import CdmObjectType
def generate_manifest(local_root_path: str) -> 'CdmManifestDefinition':
"""
Creates a manifest used for the tests.
"""
cdmCorpus = CdmCorpusDefinition()
... | [
"cdm.storage.LocalAdapter",
"cdm.objectmodel.CdmManifestDefinition",
"cdm.objectmodel.CdmCorpusDefinition"
] | [((297, 318), 'cdm.objectmodel.CdmCorpusDefinition', 'CdmCorpusDefinition', ([], {}), '()\n', (316, 318), False, 'from cdm.objectmodel import CdmCorpusDefinition, CdmManifestDefinition\n'), ((383, 417), 'cdm.storage.LocalAdapter', 'LocalAdapter', ([], {'root': 'local_root_path'}), '(root=local_root_path)\n', (395, 417)... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 UnitedStack Inc.
# 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/licen... | [
"pecan.request.dbapi.ilvg_get_by_ihost",
"sysinv.openstack.common.gettextutils._",
"wsme.wsattr",
"sysinv.api.controllers.v1.link.Link.make_link",
"sysinv.api.controllers.v1.utils.validate_sort_dir",
"pecan.request.dbapi.controller_fs_get_by_isystem",
"sysinv.objects.controller_fs.get_by_uuid",
"wsme.... | [((1471, 1494), 'sysinv.openstack.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1484, 1494), False, 'from sysinv.openstack.common import log\n'), ((2544, 2584), 'wsme.wsattr', 'wsme.wsattr', (['wtypes.text'], {'mandatory': '(True)'}), '(wtypes.text, mandatory=True)\n', (2555, 2584), False... |
import scrapy
from locations.items import GeojsonPointItem
from urllib.parse import urlencode
from scrapy.selector import Selector
from locations.hours import OpeningHours
Days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
class DollaramaSpider(scrapy.Spider):
name = "dollarama"
item_attributes = {"brand": "D... | [
"urllib.parse.urlencode",
"locations.hours.OpeningHours",
"locations.items.GeojsonPointItem"
] | [((993, 1007), 'locations.hours.OpeningHours', 'OpeningHours', ([], {}), '()\n', (1005, 1007), False, 'from locations.hours import OpeningHours\n'), ((2264, 2294), 'locations.items.GeojsonPointItem', 'GeojsonPointItem', ([], {}), '(**properties)\n', (2280, 2294), False, 'from locations.items import GeojsonPointItem\n')... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datasets.registry
from foundations import hparams
from foundations.step import Step
from lottery.branch import base
import models.regist... | [
"training.train.standard_train",
"pruning.mask.Mask.load"
] | [((1052, 1165), 'training.train.standard_train', 'train.standard_train', (['m', 'self.branch_root', 'retrain_d', 'retrain_t'], {'start_step': 'start_step', 'verbose': 'self.verbose'}), '(m, self.branch_root, retrain_d, retrain_t, start_step=\n start_step, verbose=self.verbose)\n', (1072, 1165), False, 'from training... |
"""
Created on Thu Mar 22 15:07:43 2018
@author: Tanvee
First attempt at an program for the EV3 bot.
The main aim of this is to develop an algorithm to search clockwise for and identify
close objects, before rushing to meet them.
"""
print(0)
from time import sleep
import sys, os
# Import the ev3dev specific library
f... | [
"time.sleep"
] | [((1569, 1577), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (1574, 1577), False, 'from time import sleep\n')] |
from unittest import TestCase, mock
from modelgen import ModelGenerator, Base
from os import getcwd, path
class TestModelgen(TestCase):
@classmethod
def setUpClass(self):
self.yaml = {'tables': {'userinfo':{'columns':
[{'name': 'firstname', 'type': 'varchar'},
... | [
"modelgen.ModelGenerator",
"os.getcwd",
"unittest.mock.patch",
"modelgen.Base"
] | [((688, 734), 'unittest.mock.patch', 'mock.patch', (['"""modelgen.modelgenerator.Validate"""'], {}), "('modelgen.modelgenerator.Validate')\n", (698, 734), False, 'from unittest import TestCase, mock\n'), ((740, 786), 'unittest.mock.patch', 'mock.patch', (['"""modelgen.ModelGenerator.__init__"""'], {}), "('modelgen.Mode... |
from heisen.config import settings
from jsonrpclib.request import ConnectionPool
def get_rpc_connection():
if settings.CREDENTIALS:
username, passowrd = settings.CREDENTIALS[0]
else:
username = passowrd = None
servers = {'self': []}
for instance_number in range(settings.INSTANCE_COUNT... | [
"jsonrpclib.request.ConnectionPool"
] | [((517, 569), 'jsonrpclib.request.ConnectionPool', 'ConnectionPool', (['servers', '"""heisen"""', 'settings.APP_NAME'], {}), "(servers, 'heisen', settings.APP_NAME)\n", (531, 569), False, 'from jsonrpclib.request import ConnectionPool\n')] |
import logging
import discord
import discord.ext.commands as commands
_LOG = logging.getLogger('discord-util').getChild("uwu")
class Uwu(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.content.lower().startswith('hello bot') or message.content.... | [
"discord.ext.commands.Cog.listener",
"logging.getLogger"
] | [((160, 183), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (181, 183), True, 'import discord.ext.commands as commands\n'), ((79, 112), 'logging.getLogger', 'logging.getLogger', (['"""discord-util"""'], {}), "('discord-util')\n", (96, 112), False, 'import logging\n')] |
import math
import os
from curses_tools import draw_frame, get_frame_size
def _limit(value, min_value, max_value):
"""Limit value by min_value and max_value."""
if value < min_value:
return min_value
if value > max_value:
return max_value
return value
def _apply_acceleration(speed,... | [
"math.cos",
"curses_tools.get_frame_size",
"os.path.join"
] | [((623, 647), 'math.cos', 'math.cos', (['speed_fraction'], {}), '(speed_fraction)\n', (631, 647), False, 'import math\n'), ((1472, 1502), 'curses_tools.get_frame_size', 'get_frame_size', (['self.frames[0]'], {}), '(self.frames[0])\n', (1486, 1502), False, 'from curses_tools import draw_frame, get_frame_size\n'), ((1181... |
import secrets
import asyncio
from datetime import datetime, timedelta
import discord
from discord.ext import commands
from database import DatabasePersonality, DatabaseDeck
class Roll(commands.Cog):
def __init__(self, bot):
"""Initial the cog with the bot."""
self.bot = bot
#### Commands #... | [
"database.DatabaseDeck.get",
"database.DatabasePersonality.get",
"secrets.randbelow",
"datetime.datetime.strptime",
"discord.ui.button",
"datetime.datetime.now",
"datetime.timedelta",
"discord.Embed",
"discord.ext.commands.command"
] | [((330, 422), 'discord.ext.commands.command', 'commands.command', ([], {'description': '"""Roll a random idom and get the possibility to claim it."""'}), "(description=\n 'Roll a random idom and get the possibility to claim it.')\n", (346, 422), False, 'from discord.ext import commands\n'), ((7444, 7493), 'datetime.... |
from __future__ import print_function
import time
from sr.robot import *
SEARCHING = "SEARCHING"
DRIVING = "DRIVING"
R = Robot()
def drive(speed, seconds):
R.motors[0].m0.power = speed
R.motors[0].m1.power = speed
time.sleep(seconds)
R.motors[0].m0.power = 0
R.motors[0].m1.power = 0
def turn(s... | [
"time.sleep"
] | [((231, 250), 'time.sleep', 'time.sleep', (['seconds'], {}), '(seconds)\n', (241, 250), False, 'import time\n'), ((407, 426), 'time.sleep', 'time.sleep', (['seconds'], {}), '(seconds)\n', (417, 426), False, 'import time\n'), ((1300, 1315), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (1310, 1315), False, 'im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | [
"unittest.mock.call",
"unittest.mock.patch",
"unittest.mock.Mock"
] | [((1120, 1163), 'unittest.mock.patch', 'patch', (['"""supvisors.mainloop.getRPCInterface"""'], {}), "('supvisors.mainloop.getRPCInterface')\n", (1125, 1163), False, 'from unittest.mock import call, patch, Mock, DEFAULT\n'), ((3462, 3509), 'unittest.mock.Mock', 'Mock', ([], {}), "(**{'check_subscriber.return_value': Non... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist, TransformStamped
from std_msgs.msg import String
from enum import Enum
import tf2_ros
import math
class mission_states(Enum):
STOP = -1
SUBMERGE = 0
MOVE_TO_GATE = 1
MOVE_THROUGH_GATE = 2
def checkTolerance(current, wanted):
t... | [
"rospy.logerr",
"rospy.is_shutdown",
"tf2_ros.TransformListener",
"rospy.init_node",
"geometry_msgs.msg.Twist",
"tf2_ros.Buffer",
"rospy.Time",
"rospy.Rate",
"rospy.Publisher"
] | [((436, 489), 'rospy.init_node', 'rospy.init_node', (['"""mission_controller"""'], {'anonymous': '(True)'}), "('mission_controller', anonymous=True)\n", (451, 489), False, 'import rospy\n'), ((541, 599), 'rospy.Publisher', 'rospy.Publisher', (['"""wolf_control/goal"""', 'Twist'], {'queue_size': '(10)'}), "('wolf_contro... |
#!/usr/bin/python
# Copyright 2021 Northern.tech AS
#
# 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 ap... | [
"common.api_client_mgmt.get_users",
"common.api_client_mgmt.update_user",
"tenantadm.run_fake_delete_user",
"common.api_client_mgmt.get_settings",
"common.api_client_mgmt.get_user",
"pytest.mark.parametrize",
"common.api_client_mgmt.login",
"common.api_client_mgmt.create_user",
"common.make_auth",
... | [((3664, 3728), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""tenant_id"""', "['tenant1id', 'tenant2id']"], {}), "('tenant_id', ['tenant1id', 'tenant2id'])\n", (3687, 3728), False, 'import pytest\n'), ((4045, 4109), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""tenant_id"""', "['tenant1id', ... |
import os
chrom_bins = {}
with open("GSE88952_Sc_Su.32000.bed") as in_file:
for line in in_file:
line = line.strip().split()
chrom_bins[line[3]] = "{}\t{}\t{}".format(line[0], line[1], line[2])
in_file.close()
if not os.path.isfile("ctrl_32kb.bed"):
with open("ctrl_32kb.bed", "w") as out_file:
with open("ct... | [
"os.path.isfile"
] | [((226, 257), 'os.path.isfile', 'os.path.isfile', (['"""ctrl_32kb.bed"""'], {}), "('ctrl_32kb.bed')\n", (240, 257), False, 'import os\n'), ((693, 729), 'os.path.isfile', 'os.path.isfile', (['"""galactose_32kb.bed"""'], {}), "('galactose_32kb.bed')\n", (707, 729), False, 'import os\n')] |
# Author: <NAME>
# email: <EMAIL>
import matplotlib.pyplot as plt, numpy as np
# import seaborn as sns
# from pandas import DataFrame
# from sklearn.neighbors import NearestNeighbors
from terminaltables import AsciiTable
from collections import Counter
from .private import save_vis_close_helper, get_fig_ax_helper
fro... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"numpy.argsort",
"numpy.array",
"xinshuo_miscellaneous.iscolorimage_dimension",
"xinshuo_miscellaneous.isinteger",
"numpy.arange",
"numpy.mean",
"xinshuo_miscellaneous.isnparray",
"matplotlib.pyplot.xlabel",
"matpl... | [((2895, 2922), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2905, 2922), True, 'import matplotlib.pyplot as plt, numpy as np\n'), ((3148, 3183), 'numpy.linspace', 'np.linspace', (['(0)', 'maximum_x', 'num_bins'], {}), '(0, maximum_x, num_bins)\n', (3159, 3183), True, ... |
import sys
N = int(sys.stdin.readline())
dis = list(map(int, sys.stdin.readline().split()))
coin = list(map(int, sys.stdin.readline().split()))
use_coin = coin[0]
tot = dis[0] * use_coin
for i in range(1, N - 1):
if coin[i] < use_coin:
use_coin = coin[i]
tot += dis[i] * use_coin
print(tot) | [
"sys.stdin.readline"
] | [((20, 40), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (38, 40), False, 'import sys\n'), ((62, 82), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (80, 82), False, 'import sys\n'), ((114, 134), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (132, 134), False, 'import sys... |
import napari
import time
from napari._qt.qthreading import thread_worker
import numpy as np
# create a viewer window
viewer = napari.Viewer()
# https://napari.org/guides/stable/threading.html
@thread_worker
def loop_run():
while True: # endless loop
print("Hello world", time.time())
time.sleep(0.... | [
"napari.Viewer",
"numpy.random.random",
"time.sleep",
"napari.run",
"time.time"
] | [((128, 143), 'napari.Viewer', 'napari.Viewer', ([], {}), '()\n', (141, 143), False, 'import napari\n'), ((701, 713), 'napari.run', 'napari.run', ([], {}), '()\n', (711, 713), False, 'import napari\n'), ((307, 322), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (317, 322), False, 'import time\n'), ((286, 297)... |
from math import erf, sqrt
from functools import partial
from ..library.multinomial import multinomial, to_multinomial
def gaussian_cdf(x, mu, sigma):
y = (1.0 + erf((x - mu) / (sigma * sqrt(2.0)))) / 2.0
y = (1.0 + erf((x) / (sqrt(2.0)))) / 2.0
assert y >= 0 and y <= 1.0, 'y is not a valid probability: y... | [
"math.sqrt",
"functools.partial"
] | [((390, 431), 'functools.partial', 'partial', (['gaussian_cdf'], {'mu': 'mu', 'sigma': 'sigma'}), '(gaussian_cdf, mu=mu, sigma=sigma)\n', (397, 431), False, 'from functools import partial\n'), ((237, 246), 'math.sqrt', 'sqrt', (['(2.0)'], {}), '(2.0)\n', (241, 246), False, 'from math import erf, sqrt\n'), ((192, 201), ... |
from arguments import get_args
import numpy as np
from network.models import MLP_Net
from utils.utils import get_env_params
import torch
import os, gym
"""
script to watch the demo of the ESIL
"""
# process the inputs
def process_inputs(o, g, o_mean, o_std, g_mean, g_std, args):
o_clip = np.clip(o, -args.clip_obs... | [
"numpy.clip",
"utils.utils.get_env_params",
"torch.load",
"torch.tensor",
"torch.no_grad",
"network.models.MLP_Net",
"numpy.concatenate",
"arguments.get_args",
"gym.make"
] | [((295, 336), 'numpy.clip', 'np.clip', (['o', '(-args.clip_obs)', 'args.clip_obs'], {}), '(o, -args.clip_obs, args.clip_obs)\n', (302, 336), True, 'import numpy as np\n'), ((350, 391), 'numpy.clip', 'np.clip', (['g', '(-args.clip_obs)', 'args.clip_obs'], {}), '(g, -args.clip_obs, args.clip_obs)\n', (357, 391), True, 'i... |
from datetime import datetime
from kickbase_api.models._transforms import parse_date, parse_key_value_array_to_dict
from kickbase_api.models.base_model import BaseModel
from kickbase_api.models.league_user_season_stats import LeagueUserSeasonStats
class LeagueUserStats(BaseModel):
name: str = None
profile_im... | [
"kickbase_api.models.league_user_season_stats.LeagueUserSeasonStats",
"kickbase_api.models._transforms.parse_date"
] | [((700, 718), 'kickbase_api.models._transforms.parse_date', 'parse_date', (["o['d']"], {}), "(o['d'])\n", (710, 718), False, 'from kickbase_api.models._transforms import parse_date, parse_key_value_array_to_dict\n'), ((773, 798), 'kickbase_api.models.league_user_season_stats.LeagueUserSeasonStats', 'LeagueUserSeasonSta... |
from django.contrib import admin
from .models import Post, Comment, UserProfile
class ProfileAdmin(admin.ModelAdmin):
filter_horizontal =("followers", "following",)
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
admin.site.register(UserProfile, admin_class=ProfileAdmin)
| [
"django.contrib.admin.site.register"
] | [((200, 225), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (219, 225), False, 'from django.contrib import admin\n'), ((226, 254), 'django.contrib.admin.site.register', 'admin.site.register', (['Comment'], {}), '(Comment)\n', (245, 254), False, 'from django.contrib import admi... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-27 14:43
from __future__ import unicode_literals
import ckeditor.fields
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.NullBooleanField",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"d... | [((448, 505), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (479, 505), False, 'from django.db import migrations, models\n'), ((22575, 22685), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'dja... |
from Bio.SeqIO import parse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC, generic_dna
from Bio import Alphabet, Entrez
from Bio.SeqUtils import GC
from Bio.Blast import NCBIWWW, NCBIXML
from Bio import pairwise2
from Bio.pairwise2 import format_alignme... | [
"Bio.pairwise2.align.globalms",
"Bio.motifs.create",
"Bio.Blast.NCBIWWW.qblast",
"Bio.SeqRecord.SeqRecord",
"Bio.pairwise2.align.localxx",
"Bio.SeqUtils.GC",
"Bio.pairwise2.align.globalxx",
"Bio.SeqIO.parse",
"Bio.SeqIO.write",
"Bio.SeqIO.read",
"Bio.Entrez.efetch",
"Bio.pairwise2.format_align... | [((877, 913), 'Bio.SeqRecord.SeqRecord', 'SeqRecord', (['self.sequence'], {'id': 'self.id'}), '(self.sequence, id=self.id)\n', (886, 913), False, 'from Bio.SeqRecord import SeqRecord\n'), ((1231, 1258), 'Bio.SeqIO.parse', 'parse', (['file_handle', '"""fasta"""'], {}), "(file_handle, 'fasta')\n", (1236, 1258), False, 'f... |
import pymongo
client = pymongo.MongoClient('''mongodb://dakotapope:<PASSWORD>wrd@
cluster0-shard-00-00-iaoct.mongodb.net:27017,cluster0-shard-00
-01-iaoct.mongodb.net:27017,cluster0-shard-00-02-iaoct.mongodb.
net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=
admin&retryWrites=true''')
# investigate the ... | [
"pymongo.MongoClient"
] | [((25, 311), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb://dakotapope:<PASSWORD>wrd@\ncluster0-shard-00-00-iaoct.mongodb.net:27017,cluster0-shard-00\n-01-iaoct.mongodb.net:27017,cluster0-shard-00-02-iaoct.mongodb.\nnet:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=\nadmin&retryWrites=true""... |
"""Promises, promises, promises."""
from __future__ import absolute_import, unicode_literals
import re
from collections import namedtuple
from .abstract import Thenable
from .promises import promise
from .synchronization import barrier
from .funtools import (
maybe_promise, ensure_promise,
ppartial, preplace... | [
"collections.namedtuple",
"re.match"
] | [((538, 625), 'collections.namedtuple', 'namedtuple', (['"""version_info_t"""', "('major', 'minor', 'micro', 'releaselevel', 'serial')"], {}), "('version_info_t', ('major', 'minor', 'micro', 'releaselevel',\n 'serial'))\n", (548, 625), False, 'from collections import namedtuple\n'), ((730, 782), 're.match', 're.matc... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from LLC_Membranes.timeseries.forecast_ctrw import System
from LLC_Membranes.llclib import file_rw
import names
residues = ["GCL", "SOH"]
wt = 10
path = "/home/bcoscia/Documents/Gromacs/Transport/NaGA3C11"
colors = ['blue', 'red']
opacity = 1
n... | [
"numpy.histogram",
"LLC_Membranes.llclib.file_rw.load_object",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((348, 383), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(10, 5)'}), '(1, 2, figsize=(10, 5))\n', (360, 383), True, 'import matplotlib.pyplot as plt\n'), ((1882, 1900), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (1898, 1900), True, 'import matplotlib.pyplot ... |
"""Added tariff
Revision ID: 4dbaa3104f4
Revises: <PASSWORD>
Create Date: 2015-05-27 16:00:09.343862
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engine_name):
glob... | [
"sqlalchemy.DECIMAL",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.Text",
"sqlalchemy.Boolean",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String"
] | [((2756, 2792), 'alembic.op.drop_table', 'op.drop_table', (['"""tariff_localization"""'], {}), "('tariff_localization')\n", (2769, 2792), False, 'from alembic import op\n'), ((2797, 2828), 'alembic.op.drop_table', 'op.drop_table', (['"""tariff_history"""'], {}), "('tariff_history')\n", (2810, 2828), False, 'from alembi... |
import ctypes
import struct
import time
from fixate.core.common import bits
from fixate.core.exceptions import InstrumentError, InstrumentNotConnected
import fixate.config
import fixate.core.discover
def open(ftdi_description=""):
"""Open is the public api for the bit bang driver for discovering and opening a con... | [
"struct.calcsize",
"ctypes.byref",
"ctypes.POINTER",
"ctypes.create_string_buffer",
"ctypes.WinDLL",
"fixate.core.exceptions.InstrumentError",
"ctypes.c_char_p",
"fixate.core.common.bits",
"ctypes.sizeof"
] | [((882, 911), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_char'], {}), '(ctypes.c_char)\n', (896, 911), False, 'import ctypes\n'), ((921, 951), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_ubyte'], {}), '(ctypes.c_ubyte)\n', (935, 951), False, 'import ctypes\n'), ((985, 1015), 'ctypes.POINTER', 'ctypes.POINTER',... |
import unittest
from nose.tools import eq_, ok_, raises
from sqlalchemy import create_engine, MetaData, Column, Integer, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from geoalchemy2 import Geometry
from sqlalchemy.exc import DataError, IntegrityError, InternalE... | [
"sqlalchemy.orm.sessionmaker",
"nose.tools.eq_",
"sqlalchemy.sql.func.postgis_version",
"sqlalchemy.create_engine",
"sqlalchemy.engine.reflection.Inspector.from_engine",
"sqlalchemy.sql.func.ST_Buffer",
"sqlalchemy.MetaData",
"nose.tools.raises",
"sqlalchemy.ext.declarative.declarative_base",
"geo... | [((336, 398), 'sqlalchemy.create_engine', 'create_engine', (['"""postgresql://gis:gis@localhost/gis"""'], {'echo': '(True)'}), "('postgresql://gis:gis@localhost/gis', echo=True)\n", (349, 398), False, 'from sqlalchemy import create_engine, MetaData, Column, Integer, func\n'), ((410, 426), 'sqlalchemy.MetaData', 'MetaDa... |
from dateutil.relativedelta import relativedelta
from uuid import uuid4
import unittest
import pytz
from django.test import TestCase
from django.utils.timezone import datetime
from core.tests.helpers import CoreProviderMachineHelper, CoreMachineRequestHelper, CoreInstanceHelper
from service.machine import process_m... | [
"service.machine.process_machine_request",
"core.tests.helpers.CoreInstanceHelper",
"django.utils.timezone.datetime",
"uuid.uuid4",
"core.tests.helpers.CoreMachineRequestHelper",
"core.tests.helpers.CoreProviderMachineHelper"
] | [((1211, 1285), 'core.tests.helpers.CoreMachineRequestHelper', 'CoreMachineRequestHelper', (['new_name', 'fork_date', 'new_version', '(True)', 'instance'], {}), '(new_name, fork_date, new_version, True, instance)\n', (1235, 1285), False, 'from core.tests.helpers import CoreProviderMachineHelper, CoreMachineRequestHelpe... |
from rest_framework.views import APIView
from rest_framework.response import Response
from django.shortcuts import render
from django.http.response import JsonResponse
from nitmis_admin.serializers.UserSerializer import UserSerializer
def create_user(role="Guest"):
"""
"""
def fun_wrapper(func):
d... | [
"django.shortcuts.render",
"nitmis_admin.serializers.UserSerializer.UserSerializer",
"django.http.response.JsonResponse"
] | [((1070, 1098), 'django.shortcuts.render', 'render', (['request', '"""base.html"""'], {}), "(request, 'base.html')\n", (1076, 1098), False, 'from django.shortcuts import render\n'), ((374, 407), 'nitmis_admin.serializers.UserSerializer.UserSerializer', 'UserSerializer', ([], {'data': 'args[1].data'}), '(data=args[1].da... |
from django.utils.timezone import now
class NotHistorical(TypeError):
"""No related history model found."""
def get_history_model_for_model(model):
"""Find the history model for a given app model."""
try:
manager_name = model._meta.simple_history_manager_attribute
except AttributeError:
... | [
"django.utils.timezone.now"
] | [((713, 718), 'django.utils.timezone.now', 'now', ([], {}), '()\n', (716, 718), False, 'from django.utils.timezone import now\n')] |
from flask_login import LoginManager
from PhoenixNow.model import User
login_manager = LoginManager()
login_manager.login_view = "regular.signin"
@login_manager.user_loader
def load_user(user_id):
user = User.query.filter_by(id=user_id).first()
return user
| [
"flask_login.LoginManager",
"PhoenixNow.model.User.query.filter_by"
] | [((88, 102), 'flask_login.LoginManager', 'LoginManager', ([], {}), '()\n', (100, 102), False, 'from flask_login import LoginManager\n'), ((210, 242), 'PhoenixNow.model.User.query.filter_by', 'User.query.filter_by', ([], {'id': 'user_id'}), '(id=user_id)\n', (230, 242), False, 'from PhoenixNow.model import User\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-16 07:49
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((312, 369), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (343, 369), False, 'from django.db import migrations, models\n'), ((498, 591), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import math
import unittest
import torch
from nuscenes.prediction.models import mtp
class TestMTPLoss(unittest.TestCase):
"""
Test each component of MTPLoss as well as the
__call__ method.
"""
def test_get_trajectories_and_modes(self):
loss_n_modes_5 = mtp.MTPLoss(5, 0, 0)
los... | [
"torch.Tensor",
"math.sqrt",
"math.log",
"nuscenes.prediction.models.mtp.MTPLoss",
"torch.allclose",
"torch.zeros",
"torch.arange",
"torch.ones"
] | [((288, 308), 'nuscenes.prediction.models.mtp.MTPLoss', 'mtp.MTPLoss', (['(5)', '(0)', '(0)'], {}), '(5, 0, 0)\n', (299, 308), False, 'from nuscenes.prediction.models import mtp\n'), ((334, 354), 'nuscenes.prediction.models.mtp.MTPLoss', 'mtp.MTPLoss', (['(1)', '(0)', '(0)'], {}), '(1, 0, 0)\n', (345, 354), False, 'fro... |
from Tkinter import *
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.autograd as autograd
from torch.autograd import Variable
master = Tk()
goal = 0
var_goal = StringVar()
GAMMA = 0.9
last_state = Variable(torch.Tensor([0,0,0,0,0,0])).u... | [
"numpy.abs",
"numpy.random.rand",
"torch.nn.LSTMCell",
"torch.Tensor",
"torch.nn.functional.smooth_l1_loss",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.softmax"
] | [((1365, 1382), 'torch.nn.functional.softmax', 'F.softmax', (['output'], {}), '(output)\n', (1374, 1382), True, 'import torch.nn.functional as F\n'), ((1931, 1948), 'torch.nn.functional.softmax', 'F.softmax', (['output'], {}), '(output)\n', (1940, 1948), True, 'import torch.nn.functional as F\n'), ((2154, 2187), 'torch... |
import docker
import os
import sys
import pandas as pd
import warnings
from src.PRM import PRM
from pathlib import Path
from src.util import prepare_path_docker
__all__ = ['PathLinker']
class PathLinker(PRM):
required_inputs = ['nodetypes', 'network']
@staticmethod
def generate_inputs(data, filename_map)... | [
"pandas.read_csv",
"pathlib.Path",
"os.getuid",
"docker.from_env",
"warnings.warn",
"src.util.prepare_path_docker"
] | [((2666, 2683), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (2681, 2683), False, 'import docker\n'), ((2864, 2879), 'pathlib.Path', 'Path', (['nodetypes'], {}), '(nodetypes)\n', (2868, 2879), False, 'from pathlib import Path\n'), ((2903, 2916), 'pathlib.Path', 'Path', (['network'], {}), '(network)\n', (2907... |
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
import utils
import glob, os
import pca.dataanalyzer as da, pca.pca as pca
from sklearn.metrics import accuracy_score
# visulaize ... | [
"sklearn.preprocessing.LabelEncoder",
"utils.load_h5",
"matplotlib.pyplot.hist",
"numpy.unique",
"matplotlib.rcParams.update",
"glob.iglob",
"matplotlib.pyplot.figure",
"pca.dataanalyzer.getbytes",
"sklearn.cross_validation.train_test_split",
"matplotlib.pyplot.tight_layout",
"os.path.basename",... | [((1219, 1240), 'pandas.concat', 'pd.concat', (['dataframes'], {}), '(dataframes)\n', (1228, 1240), True, 'import pandas as pd\n'), ((1428, 1455), 'pca.dataanalyzer.getbytes', 'da.getbytes', (['data', 'data_len'], {}), '(data, data_len)\n', (1439, 1455), True, 'import pca.dataanalyzer as da, pca.pca as pca\n'), ((1606,... |
import time
import uuid
from random import random
def now():
return int(time.time() * 1000)
def uuid1():
return str(uuid.uuid1())
def millis(s):
return s * 1000
def seconds(ms):
return ms / 1000
def exponential_backoff(
attempts,
base_delay,
max_delay=None,
jitter=True,
):
... | [
"uuid.uuid1",
"random.random",
"time.time"
] | [((128, 140), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (138, 140), False, 'import uuid\n'), ((78, 89), 'time.time', 'time.time', ([], {}), '()\n', (87, 89), False, 'import time\n'), ((770, 778), 'random.random', 'random', ([], {}), '()\n', (776, 778), False, 'from random import random\n')] |
from dagster import job, op
@op
def get_name():
return "dagster"
@op
def hello(name: str):
print(f"Hello, {name}!")
@job(description="Hello world Dagster pipeline")
def hello_dagster():
hello(get_name()) | [
"dagster.job"
] | [((131, 178), 'dagster.job', 'job', ([], {'description': '"""Hello world Dagster pipeline"""'}), "(description='Hello world Dagster pipeline')\n", (134, 178), False, 'from dagster import job, op\n')] |
# -*- coding: utf-8 -*-
import time
import numpy as np
from qulab.device import BaseDriver, QInteger, QOption, QReal, QString, QVector
class Driver(BaseDriver):
error_command = '*ESR?'
support_models = ['AFG3102']
quants = [
QOption('Output',ch=1,
set_cmd='OUTP%(ch)d %(option)s', get_... | [
"qulab.device.QReal",
"qulab.device.QOption",
"numpy.zeros"
] | [((252, 376), 'qulab.device.QOption', 'QOption', (['"""Output"""'], {'ch': '(1)', 'set_cmd': '"""OUTP%(ch)d %(option)s"""', 'get_cmd': '"""OUTP%(ch)d?"""', 'options': "[('OFF', 'OFF'), ('ON', 'ON')]"}), "('Output', ch=1, set_cmd='OUTP%(ch)d %(option)s', get_cmd=\n 'OUTP%(ch)d?', options=[('OFF', 'OFF'), ('ON', 'ON')... |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
"""
输入3个句子,每个句子由5个单词构成,每个单词词向量10维
batch=3, seq_len=5, Embedding=10
"""
# 设置LSTM参数,词向量维数10,隐藏元维度20,2个LSTM隐藏层,双向LSTM
bilstm = nn.LSTM(input_size=10, hidden_size=20, num_layers=2, bidirectional=True)
# 如下表示输入句子
input = torch.randn(5, 3, 10)
# 初始化的隐藏元和记忆元,通常维度一样
... | [
"torch.nn.LSTM",
"torch.randn",
"torch.nn.Linear"
] | [((184, 256), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': '(10)', 'hidden_size': '(20)', 'num_layers': '(2)', 'bidirectional': '(True)'}), '(input_size=10, hidden_size=20, num_layers=2, bidirectional=True)\n', (191, 256), True, 'import torch.nn as nn\n'), ((277, 298), 'torch.randn', 'torch.randn', (['(5)', '(3)', '... |
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.serializers.order import OrderInfoSerializer
from apps.meiduo_admin.utils import PageNum
from apps.orders.models import OrderInfo
class OrderModelViewSet(M... | [
"apps.orders.models.OrderInfo.objects.get",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"apps.orders.models.OrderInfo.objects.all"
] | [((350, 373), 'apps.orders.models.OrderInfo.objects.all', 'OrderInfo.objects.all', ([], {}), '()\n', (371, 373), False, 'from apps.orders.models import OrderInfo\n'), ((562, 598), 'rest_framework.decorators.action', 'action', ([], {'methods': "['PUT']", 'detail': '(True)'}), "(methods=['PUT'], detail=True)\n", (568, 59... |
import nekos
from ..utils import admin_cmd
@borg.on(admin_cmd(pattern = "tcat$"))
async def hmm(cat):
if cat.fwd_from:
return
reactcat = nekos.textcat()
await cat.edit(reactcat)
@borg.on(admin_cmd(pattern = "why$"))
async def hmm(cat):
if cat.fwd_from:
return
whycat = nekos... | [
"nekos.textcat",
"nekos.fact",
"nekos.why"
] | [((154, 169), 'nekos.textcat', 'nekos.textcat', ([], {}), '()\n', (167, 169), False, 'import nekos\n'), ((315, 326), 'nekos.why', 'nekos.why', ([], {}), '()\n', (324, 326), False, 'import nekos\n'), ((472, 484), 'nekos.fact', 'nekos.fact', ([], {}), '()\n', (482, 484), False, 'import nekos\n')] |
import copy
import torch.nn as nn
from .transformer import (Encoder,
EncoderLayer,
MultiHeadedAttention,
PositionwiseFeedforward,
PositionalEncoding)
class TransformerEncoder(nn.Module):
"""Transformer Encod... | [
"torch.nn.init.xavier_uniform_"
] | [((1878, 1904), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['p'], {}), '(p)\n', (1901, 1904), True, 'import torch.nn as nn\n')] |
# -*- coding: utf-8 -*-
from flask import make_response, Blueprint
from app import derive_import_root, add_url_rules_for_blueprint
from application import exception
from application.model.service import Service
from application.model.service_template import ServiceTemplate
from application.util.database import session... | [
"application.exception.api.Forbidden",
"application.util.database.session_scope",
"application.views.base_api.ApiResult",
"app.add_url_rules_for_blueprint",
"application.exception.api.NotFound",
"app.derive_import_root"
] | [((3752, 3780), 'app.derive_import_root', 'derive_import_root', (['__name__'], {}), '(__name__)\n', (3770, 3780), False, 'from app import derive_import_root, add_url_rules_for_blueprint\n'), ((3781, 3818), 'app.add_url_rules_for_blueprint', 'add_url_rules_for_blueprint', (['root', 'bp'], {}), '(root, bp)\n', (3808, 381... |
# ----------------------------------------------------------------------
# |
# | CastExpressionParserInfo_UnitTest.py
# |
# | <NAME> <<EMAIL>>
# | 2021-10-04 09:14:16
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2021
# | Distributed under the B... | [
"CommonEnvironment.ThisFullpath",
"CommonEnvironmentEx.Package.InitRelativeImports",
"pytest.raises",
"os.path.split"
] | [((827, 859), 'CommonEnvironment.ThisFullpath', 'CommonEnvironment.ThisFullpath', ([], {}), '()\n', (857, 859), False, 'import CommonEnvironment\n'), ((907, 938), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (920, 938), False, 'import os\n'), ((1021, 1042), 'CommonEnvironmentEx.... |
from django.shortcuts import render
def contact(request):
return render(request, 'contacts/contact.html')
| [
"django.shortcuts.render"
] | [((75, 115), 'django.shortcuts.render', 'render', (['request', '"""contacts/contact.html"""'], {}), "(request, 'contacts/contact.html')\n", (81, 115), False, 'from django.shortcuts import render\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu May 3 18:33:28 2018
@author: malopez
"""
import pandas as pd
import matplotlib.pyplot as plt
import cv2
images_folder = "C:/Users/malopez/Desktop/disksMD/images"
data_folder = "C:/Users/malopez/Desktop/disksMD/data"
output_video = './video4.mp4'
particle_radius = 1.0
n_part... | [
"cv2.VideoWriter",
"matplotlib.pyplot.close",
"pandas.read_table",
"cv2.VideoWriter_fourcc",
"matplotlib.pyplot.scatter",
"cv2.imread",
"matplotlib.pyplot.subplots"
] | [((1454, 1475), 'cv2.imread', 'cv2.imread', (['images[0]'], {}), '(images[0])\n', (1464, 1475), False, 'import cv2\n'), ((1577, 1608), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'mp4v'"], {}), "(*'mp4v')\n", (1599, 1608), False, 'import cv2\n'), ((1643, 1703), 'cv2.VideoWriter', 'cv2.VideoWriter', (['outpu... |
import sys
import difflib
import errno
import json
import logging
import functools
import os
import pytest
from shell import shell
from diag_paranoia import diag_paranoia, filtered_overview, sanitize_errors
VALIDATOR_IMAGE = "datawire/ambassador-envoy-alpine:v1.5.0-116-g7ccb25882"
DIR = os.path.dirname(__file__)
E... | [
"diag_paranoia.diag_paranoia",
"os.path.exists",
"os.listdir",
"json.loads",
"os.path.join",
"os.path.dirname",
"pytest.mark.parametrize",
"os.path.isdir",
"os.path.basename",
"os.unlink",
"diag_paranoia.filtered_overview",
"shell.shell"
] | [((293, 318), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (308, 318), False, 'import os\n'), ((420, 461), 'os.path.join', 'os.path.join', (['DIR', '""".."""', '"""default-config"""'], {}), "(DIR, '..', 'default-config')\n", (432, 461), False, 'import os\n'), ((1833, 1878), 'pytest.mark.par... |
#!/usr/bin/env python3
import json
import googlemaps
import sys
import os
gmaps = googlemaps.Client(key=os.environ["GOOGLE_API_KEY"])
print(gmaps)
filename = sys.argv[1]
with open(filename) as f:
data = json.load(f)
for d in data:
if d.get("address") and not d.get("latitude"):
result = gmaps.geocode(... | [
"json.load",
"googlemaps.Client",
"json.dump"
] | [((83, 134), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': "os.environ['GOOGLE_API_KEY']"}), "(key=os.environ['GOOGLE_API_KEY'])\n", (100, 134), False, 'import googlemaps\n'), ((209, 221), 'json.load', 'json.load', (['f'], {}), '(f)\n', (218, 221), False, 'import json\n'), ((520, 538), 'json.dump', 'json.dump'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: <NAME>
# Date : 2019.2
# Email : <EMAIL>
###################################################################
from dayu_widgets.avatar import MAvatar
from dayu_widgets.divider import MDivider
fro... | [
"dayu_widgets.qt.MPixmap",
"random.choice",
"dayu_widgets.qt.QApplication",
"dayu_widgets.qt.QHBoxLayout",
"dayu_widgets.divider.MDivider",
"dayu_widgets.qt.QFormLayout",
"dayu_widgets.label.MLabel",
"dayu_widgets.push_button.MPushButton",
"dayu_widgets.avatar.MAvatar",
"dayu_widgets.dayu_theme.ap... | [((2418, 2440), 'dayu_widgets.qt.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2430, 2440), False, 'from dayu_widgets.qt import QApplication\n'), ((2472, 2494), 'dayu_widgets.dayu_theme.apply', 'dayu_theme.apply', (['test'], {}), '(test)\n', (2488, 2494), False, 'from dayu_widgets import dayu_them... |
from bs4 import BeautifulSoup
from difflib import SequenceMatcher
class _Check:
"""
Parent check class. All other checks should be a subclass of this class.
"""
key = "check"
name = "Check"
description = "Parent check"
class _BlindCheck(_Check):
"""
These checks identify issues in in... | [
"bs4.BeautifulSoup",
"difflib.SequenceMatcher"
] | [((4960, 5008), 'bs4.BeautifulSoup', 'BeautifulSoup', (['true_response.text', '"""html.parser"""'], {}), "(true_response.text, 'html.parser')\n", (4973, 5008), False, 'from bs4 import BeautifulSoup\n'), ((5030, 5079), 'bs4.BeautifulSoup', 'BeautifulSoup', (['false_response.text', '"""html.parser"""'], {}), "(false_resp... |
from os.path import abspath, join, dirname
from colibris.conf import settings
STATIC_PATH = abspath(join(dirname(__file__), 'swagger'))
UI_URL = settings.API_DOCS_URL
STATIC_URL = '{}/static'.format(UI_URL)
APISPEC_URL = '{}/apispec'.format(UI_URL)
| [
"os.path.dirname"
] | [((107, 124), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (114, 124), False, 'from os.path import abspath, join, dirname\n')] |
"""
Step Chart
-----------------
This example shows Google's stock price over time.
"""
import altair as alt
from vega_datasets import data
source = data.stocks()
chart = alt.Chart(source).mark_line(interpolate = 'step-after').encode(
x = 'date',
y = 'price'
)
chart.transform = [{"filter": "datum.symbol==='... | [
"altair.Chart",
"vega_datasets.data.stocks"
] | [((151, 164), 'vega_datasets.data.stocks', 'data.stocks', ([], {}), '()\n', (162, 164), False, 'from vega_datasets import data\n'), ((174, 191), 'altair.Chart', 'alt.Chart', (['source'], {}), '(source)\n', (183, 191), True, 'import altair as alt\n')] |
# -*- coding: utf-8 -*-
"""
file: graph_networkx.py
Provides a NetworkX compliant Graph class.
"""
from graphit.graph import GraphBase
from graphit.graph_exceptions import GraphitException, GraphitNodeNotFound
from graphit.graph_algorithms import degree, size
from graphit.graph_utils.graph_utilities import graph_und... | [
"graphit.graph_utils.graph_utilities.graph_directional_to_undirectional",
"graphit.graph_utils.graph_utilities.graph_undirectional_to_directional",
"graphit.graph_exceptions.GraphitNodeNotFound",
"graphit.graph_exceptions.GraphitException",
"graphit.graph_algorithms.size"
] | [((4371, 4396), 'graphit.graph_algorithms.size', 'size', (['self'], {'weight': 'weight'}), '(self, weight=weight)\n', (4375, 4396), False, 'from graphit.graph_algorithms import degree, size\n'), ((4584, 4624), 'graphit.graph_utils.graph_utilities.graph_undirectional_to_directional', 'graph_undirectional_to_directional'... |
r"""
This is the base module for all other objects of the package.
+ `LaTeX` returns a LaTeX string out of an `Irene` object.
+ `base` is the parent of all `Irene` objects.
"""
def LaTeX(obj):
r"""
Returns LaTeX representation of Irene's objects.
"""
from sympy.core.core import all_classes
... | [
"os.access",
"sympy.latex",
"os.path.join",
"os.path.split",
"os.path.isfile",
"os.path.realpath"
] | [((1526, 1548), 'os.path.split', 'os.path.split', (['program'], {}), '(program)\n', (1539, 1548), False, 'import os\n'), ((616, 626), 'sympy.latex', 'latex', (['obj'], {}), '(obj)\n', (621, 626), False, 'from sympy import latex\n'), ((1450, 1471), 'os.path.isfile', 'os.path.isfile', (['fpath'], {}), '(fpath)\n', (1464,... |
#from https://github.com/mfurukawa/imu_sensor/tree/master/src/Python
# September 03, 2020
# <NAME>
from __future__ import unicode_literals ,print_function
import serial
from time import sleep
import numpy as np
import matplotlib.pyplot as plt
import io
import csv
import time
import datetime
import struct
impo... | [
"csv.writer",
"time.sleep",
"datetime.datetime.now",
"struct.unpack",
"serial.Serial",
"time.time"
] | [((1527, 1567), 'serial.Serial', 'serial.Serial', (['"""COM3"""', '(921600)'], {'timeout': '(1)'}), "('COM3', 921600, timeout=1)\n", (1540, 1567), False, 'import serial\n'), ((5693, 5704), 'time.time', 'time.time', ([], {}), '()\n', (5702, 5704), False, 'import time\n'), ((5775, 5786), 'time.time', 'time.time', ([], {}... |
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"multitest_transport.models.sql_models.TestModuleResult.failed_tests.desc",
"multitest_transport.models.sql_models.db.Session",
"multitest_transport.models.messages.ConvertList",
"protorpc.messages.EnumField",
"endpoints.BadRequestException",
"multitest_transport.util.tfc_client.GetLatestFinishedAttempts"... | [((1101, 1173), 'multitest_transport.api.base.MTT_API.api_class', 'base.MTT_API.api_class', ([], {'resource_name': '"""test_result"""', 'path': '"""test_results"""'}), "(resource_name='test_result', path='test_results')\n", (1123, 1173), False, 'from multitest_transport.api import base\n'), ((2345, 2386), 'multitest_tr... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"pytorch_lightning.utilities.exceptions.MisconfigurationException"
] | [((1719, 1824), 'pytorch_lightning.utilities.exceptions.MisconfigurationException', 'MisconfigurationException', (['"""Cannot use DeviceStatsMonitor callback with Trainer that has no logger."""'], {}), "(\n 'Cannot use DeviceStatsMonitor callback with Trainer that has no logger.')\n", (1744, 1824), False, 'from pyto... |
import pickle
import pytest
import numpy as np
from astropy.coordinates import Longitude
from astropy import coordinates as coord
from astropy.tests.helper import pickle_protocol, check_pickling_recovery # noqa
# Can't test distances without scipy due to cosmology deps
from astropy.utils.compat.optional_deps import ... | [
"numpy.identity",
"pickle.dumps",
"astropy.coordinates.Longitude",
"pickle.loads",
"astropy.tests.helper.check_pickling_recovery",
"pytest.xfail"
] | [((369, 413), 'astropy.coordinates.Longitude', 'Longitude', (['(1.23)', '"""radian"""'], {'wrap_angle': '"""180d"""'}), "(1.23, 'radian', wrap_angle='180d')\n", (378, 413), False, 'from astropy.coordinates import Longitude\n'), ((422, 440), 'pickle.dumps', 'pickle.dumps', (['lon1'], {}), '(lon1)\n', (434, 440), False, ... |
#!/usr/bin/env python
#
# Copyright (C) 2017 ShadowMan
#
import operator
import numpy as np
group = np.array([
[1.0, 1.1],
[1.0, 1.0],
[0.0, 0.0],
[0.0, 0.1]
])
labels = ['A', 'A', 'B','B']
def auto_normal(data_set):
# 寻找一行/列中的最小值
# axis:表示行(1)或者列(0)
min_values = data_set.min(axis = 0)
... | [
"numpy.array",
"numpy.zeros",
"numpy.tile",
"operator.itemgetter"
] | [((101, 159), 'numpy.array', 'np.array', (['[[1.0, 1.1], [1.0, 1.0], [0.0, 0.0], [0.0, 0.1]]'], {}), '([[1.0, 1.1], [1.0, 1.0], [0.0, 0.0], [0.0, 0.1]])\n', (109, 159), True, 'import numpy as np\n'), ((497, 521), 'numpy.zeros', 'np.zeros', (['data_set.shape'], {}), '(data_set.shape)\n', (505, 521), True, 'import numpy ... |
import os
from typing import Tuple, List
from controller.invoker.invoker_task_exporting import TaskExportingInvoker
from controller import config
from controller.label_model.label_studio import LabelStudio
from controller.utils.app_logger import logger
def prepare_label_dir(working_dir: str, task_id: str) -> Tuple[s... | [
"os.listdir",
"controller.utils.app_logger.logger.info",
"os.makedirs",
"controller.invoker.invoker_task_exporting.TaskExportingInvoker.exporting_cmd",
"os.path.join",
"controller.label_model.label_studio.LabelStudio"
] | [((361, 416), 'os.path.join', 'os.path.join', (['working_dir', 'f"""label_{task_id}"""', '"""Images"""'], {}), "(working_dir, f'label_{task_id}', 'Images')\n", (373, 416), False, 'import os\n'), ((421, 458), 'os.makedirs', 'os.makedirs', (['asset_dir'], {'exist_ok': '(True)'}), '(asset_dir, exist_ok=True)\n', (432, 458... |
from math import pi, sin, cos
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from floorplan import Floorplan
import numpy as np
import random
import copy
class Viewer(ShowBase):
def __init__(self):
ShowBase.__init__(self)
#self.scene = self.loader.loadM... | [
"numpy.arcsin",
"floorplan.Floorplan",
"numpy.cos",
"copy.deepcopy",
"numpy.sin",
"direct.showbase.ShowBase.ShowBase.__init__",
"random.random",
"random.randint"
] | [((261, 284), 'direct.showbase.ShowBase.ShowBase.__init__', 'ShowBase.__init__', (['self'], {}), '(self)\n', (278, 284), False, 'from direct.showbase.ShowBase import ShowBase\n'), ((737, 766), 'floorplan.Floorplan', 'Floorplan', (['"""test/floorplan_7"""'], {}), "('test/floorplan_7')\n", (746, 766), False, 'from floorp... |
import numpy as np
class KF1D:
# this EKF assumes constant covariance matrix, so calculations are much simpler
# the Kalman gain also needs to be precomputed using the control module
def __init__(self, x0, A, C, K):
self.x = x0
self.A = A
self.C = C
self.K = K
self.A_K = self.A - np.dot(se... | [
"numpy.dot"
] | [((311, 333), 'numpy.dot', 'np.dot', (['self.K', 'self.C'], {}), '(self.K, self.C)\n', (317, 333), True, 'import numpy as np\n'), ((560, 584), 'numpy.dot', 'np.dot', (['self.A_K', 'self.x'], {}), '(self.A_K, self.x)\n', (566, 584), True, 'import numpy as np\n'), ((587, 607), 'numpy.dot', 'np.dot', (['self.K', 'meas'], ... |
import datetime
import logging
import os
import boto3
from qiskit import IBMQ
from qiskit import QuantumCircuit, execute
logger = logging.getLogger()
logger.setLevel(logging.INFO)
backend_candidates = [
"ibmq_athens",
"ibmq_santiago",
"ibmq_belem",
"ibmq_quito",
"ibmq_lima",
]
def _get_provider... | [
"logging.getLogger",
"boto3.client",
"qiskit.execute",
"datetime.datetime.strptime",
"qiskit.IBMQ.enable_account",
"qiskit.IBMQ.active_account",
"boto3.resource",
"qiskit.IBMQ.get_provider",
"qiskit.QuantumCircuit"
] | [((132, 151), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (149, 151), False, 'import logging\n'), ((1460, 1480), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(4)', '(4)'], {}), '(4, 4)\n', (1474, 1480), False, 'from qiskit import QuantumCircuit, execute\n'), ((1631, 1656), 'qiskit.execute', 'execute', ... |
"""
@author: mkowalska
"""
import os
import numpy as np
from numpy.linalg import LinAlgError
import matplotlib.pyplot as plt
from figure_properties import *
import matplotlib.gridspec as gridspec
from kcsd import KCSD1D
import targeted_basis as tb
__abs_file__ = os.path.abspath(__file__)
def _html(r, g, b):
ret... | [
"numpy.identity",
"numpy.linalg.LinAlgError",
"targeted_basis.simulate_data",
"kcsd.KCSD1D",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.linspace",
"numpy.dot",
"os.path.abspath",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((265, 290), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (280, 290), False, 'import os\n'), ((3478, 3568), 'targeted_basis.simulate_data', 'tb.simulate_data', (['csd_profile', 'true_csd_xlims', 'R', 'MU', 'total_ele', 'ele_lims'], {'noise': 'noise'}), '(csd_profile, true_csd_xlims, R, MU,... |
import re
COMMENT_REGEX = re.compile(r'(checkov:skip=|bridgecrew:skip=) *([A-Z_\d]+)(:[^\n]+)?')
| [
"re.compile"
] | [((27, 98), 're.compile', 're.compile', (['"""(checkov:skip=|bridgecrew:skip=) *([A-Z_\\\\d]+)(:[^\\\\n]+)?"""'], {}), "('(checkov:skip=|bridgecrew:skip=) *([A-Z_\\\\d]+)(:[^\\\\n]+)?')\n", (37, 98), False, 'import re\n')] |
# Generated by Django 2.1.4 on 2020-04-20 23:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('plugins', '0033_pluginparameter_short_flag'),
]
operations = [
migrations.AlterField(
model_name='computeresource',
... | [
"django.db.models.CharField"
] | [((374, 419), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'unique': '(True)'}), '(max_length=100, unique=True)\n', (390, 419), False, 'from django.db import migrations, models\n')] |
'''
Created on Dec 21, 2014
@author: Milos
'''
'''
Forma za eventualna prosirenja djangovog user-a
'''
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404... | [
"django.shortcuts.get_object_or_404",
"django.forms.EmailField",
"django.forms.CharField",
"django.core.urlresolvers.reverse"
] | [((656, 687), 'django.forms.EmailField', 'forms.EmailField', ([], {'required': '(True)'}), '(required=True)\n', (672, 687), False, 'from django import forms\n'), ((705, 736), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (720, 736), False, 'from django import forms\n'... |
import os
import sys
from loguru import logger
from rich.console import Console
console_args = {}
if "pytest" in sys.modules:
console_args["width"] = 120
console = Console(**console_args)
cpu_count = None
def escape_logging(s):
return str(s).replace("<", "\\<").replace("{", "{{").replace("}", "}}")
def CP... | [
"os.popen2",
"pathlib.Path",
"rich.console.Console",
"sys.exc_info",
"os.sysconf",
"loguru.logger.opt"
] | [((169, 192), 'rich.console.Console', 'Console', ([], {}), '(**console_args)\n', (176, 192), False, 'from rich.console import Console\n'), ((1754, 1775), 'pathlib.Path', 'Path', (['job_or_filename'], {}), '(job_or_filename)\n', (1758, 1775), False, 'from pathlib import Path\n'), ((3958, 3977), 'loguru.logger.opt', 'log... |
from keras.models import Model, Sequential
from keras.layers import Input, Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dense, Dropout, Activation
import numpy as np
from os import listdir,path
from os.path import isfile, join
from PIL import Image
from keras.preprocessing.image import load_img, save_img, img_t... | [
"keras.preprocessing.image.img_to_array",
"numpy.sqrt",
"keras.layers.Activation",
"numpy.multiply",
"os.listdir",
"keras.models.Model",
"keras.applications.imagenet_utils.preprocess_input",
"keras.layers.ZeroPadding2D",
"keras.layers.Convolution2D",
"keras.layers.Flatten",
"keras.layers.MaxPool... | [((529, 541), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (539, 541), False, 'from keras.models import Model, Sequential\n'), ((2285, 2353), 'keras.models.Model', 'Model', ([], {'inputs': 'model.layers[0].input', 'outputs': 'model.layers[-2].output'}), '(inputs=model.layers[0].input, outputs=model.layers... |
"""Module with view functions that serve each uri."""
from datetime import datetime
from learning_journal.models.mymodel import Journal
from learning_journal.security import is_authenticated
from pyramid.httpexceptions import HTTPFound, HTTPNotFound
from pyramid.security import NO_PERMISSION_REQUIRED, forget, remem... | [
"learning_journal.security.is_authenticated",
"pyramid.security.forget",
"datetime.datetime.now",
"pyramid.view.view_config",
"pyramid.security.remember"
] | [((365, 471), 'pyramid.view.view_config', 'view_config', ([], {'route_name': '"""home"""', 'renderer': '"""learning_journal:templates/index.jinja2"""', 'permission': '"""view"""'}), "(route_name='home', renderer=\n 'learning_journal:templates/index.jinja2', permission='view')\n", (376, 471), False, 'from pyramid.vie... |
# Generated by Django 3.1.3 on 2021-02-10 01:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('labels', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='species',
name='de',
field=m... | [
"django.db.models.CharField"
] | [((319, 363), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(100)'}), "(default='', max_length=100)\n", (335, 363), False, 'from django.db import migrations, models\n'), ((516, 560), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': ... |
#!/usr/bin/env python3
import argparse
import getpass
import os
import sys
import argcomplete
from datetime import datetime
from forest import cmake_tools
from forest.common.eval_handler import EvalHandler
from forest.common.install import install_package, write_setup_file, write_ws_file, check_ws_file, uninstall_pac... | [
"forest.common.install.clean",
"sys.exit",
"os.path.exists",
"forest.common.install.write_setup_file",
"argparse.ArgumentParser",
"forest.common.install.check_ws_file",
"forest.common.recipe.Cookbook.add_recipes",
"os.mkdir",
"forest.common.recipe.Cookbook.get_available_recipes",
"forest.common.in... | [((883, 919), 'forest.common.recipe.Cookbook.set_recipe_path', 'Cookbook.set_recipe_path', (['recipesdir'], {}), '(recipesdir)\n', (907, 919), False, 'from forest.common.recipe import RecipeSource, Cookbook\n'), ((969, 1001), 'forest.common.recipe.Cookbook.get_available_recipes', 'Cookbook.get_available_recipes', ([], ... |
"""
Given an array of numbers, find the subarray that maximizes the sum of all
elements in the array. Note that these numbers can be negative
"""
import random
def createArray(n):
nums = []
for i in range(n):
nums.append(random.randint(-10, 10))
return nums
def bruteForceBest(a):
best = a... | [
"random.randint"
] | [((243, 266), 'random.randint', 'random.randint', (['(-10)', '(10)'], {}), '(-10, 10)\n', (257, 266), False, 'import random\n')] |
from datetime import datetime
from typing import Optional, List, Dict
import sys
sys.path.append("../../")
from backend.server.pd_model import *
from backend.queue.services import add_task, stop_all_ws_task
from backend.database.main import gis_stac
__all__ = ["preview_processing", "vector_processing", "refuse_proces... | [
"backend.queue.services.add_task",
"datetime.datetime.fromtimestamp",
"backend.queue.services.stop_all_ws_task",
"backend.database.main.gis_stac.root_catalog.get_child",
"backend.database.main.gis_stac.filter",
"sys.path.append"
] | [((81, 106), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (96, 106), False, 'import sys\n'), ((510, 572), 'backend.database.main.gis_stac.filter', 'gis_stac.filter', ([], {'time_intervals': '[time_interval]', 'bboxes': '[bbox]'}), '(time_intervals=[time_interval], bboxes=[bbox])\n', (52... |
"""
Adds a ubt command which adds basic block counts to frames within a backtrace.
Usage: ubt
Contributors: <NAME>, <NAME>
Copyright (C) 2019 Undo Ltd
"""
import gdb
from undodb.debugger_extensions import (
debugger_utils,
udb,
)
class BacktraceWithTime(gdb.Command):
def __init__(self):
supe... | [
"undodb.debugger_extensions.debugger_utils.execute_to_string",
"undodb.debugger_extensions.debugger_utils.suspend_breakpoints",
"undodb.debugger_extensions.udb.time.get",
"undodb.debugger_extensions.udb.time.auto_reverting"
] | [((539, 564), 'undodb.debugger_extensions.udb.time.auto_reverting', 'udb.time.auto_reverting', ([], {}), '()\n', (562, 564), False, 'from undodb.debugger_extensions import debugger_utils, udb\n'), ((566, 602), 'undodb.debugger_extensions.debugger_utils.suspend_breakpoints', 'debugger_utils.suspend_breakpoints', ([], {}... |
"""
Integration test for remove_participants_under_18years module
Original Issues: DC-1724
The intent is to remove data for participants under 18 years old from all the domain tables."""
# Python Imports
import os
import datetime
# Project Imports
from common import VISIT_OCCURRENCE, OBSERVATION
from common import... | [
"datetime.datetime.strptime",
"cdr_cleaner.cleaning_rules.remove_participants_under_18years.RemoveParticipantsUnder18Years",
"os.environ.get",
"common.JINJA_ENV.from_string"
] | [((630, 1263), 'common.JINJA_ENV.from_string', 'JINJA_ENV.from_string', (['"""\nINSERT INTO `{{project_id}}.{{dataset_id}}.person`\n(person_id, birth_datetime, gender_concept_id, year_of_birth, race_concept_id, ethnicity_concept_id)\nVALUES\n /* Adding participans with different ranges of birthdays.*/\n /* Pa... |
import pandas as pd
canucks = pd.read_csv('data/canucks.csv')
# Identify any columns with null values with .info()
# Save this dataframe as canucks_info
canucks_info = canucks.info()
canucks_info
# Create a new column in the dataframe named Wealth
# where all the values equal "comfortable"
# Name the new dataframe ... | [
"pandas.read_csv"
] | [((31, 62), 'pandas.read_csv', 'pd.read_csv', (['"""data/canucks.csv"""'], {}), "('data/canucks.csv')\n", (42, 62), True, 'import pandas as pd\n')] |
# This file is part of the Edison Project.
# Please refer to the LICENSE document that was supplied with this software for information on how it can be used.
# Create your views here.
from django.http import Http404, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template im... | [
"django.template.RequestContext"
] | [((947, 996), 'django.template.RequestContext', 'RequestContext', (['request'], {'processors': '[custom_proc]'}), '(request, processors=[custom_proc])\n', (961, 996), False, 'from django.template import RequestContext\n'), ((1247, 1270), 'django.template.RequestContext', 'RequestContext', (['request'], {}), '(request)\... |
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import include,url
from . import views
urlpatterns=[
url(r'api/user/user-id/(?P<pk>[0-9]+)/$',
views.UserDescription.as_view()),
url(r'api/project/project-id/(?P<pk>[0-9]+)/$',
views.ProjectDesc... | [
"django.conf.urls.static.static",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((344, 391), 'django.conf.urls.url', 'url', (['"""^profile/"""', 'views.profile'], {'name': '"""profile"""'}), "('^profile/', views.profile, name='profile')\n", (347, 391), False, 'from django.conf.urls import include, url\n'), ((396, 432), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""inde... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Red Hat, 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... | [
"pytest.fail",
"dci.common.schemas.check_json_is_valid"
] | [((1824, 1872), 'dci.common.schemas.check_json_is_valid', 'check_json_is_valid', (['tag_schema', "{'name': 'tag'}"], {}), "(tag_schema, {'name': 'tag'})\n", (1843, 1872), False, 'from dci.common.schemas import check_json_is_valid, tag_schema\n'), ((1906, 1942), 'pytest.fail', 'pytest.fail', (['"""tag_schema is invalid"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Logging Handler integrating RabbitMQ and
Graylog Extended Log Format (GELF)"""
import json
from logging import Filter
from logging.handlers import SocketHandler
from amqplib import client_0_8 as amqp # pylint: disable=import-error
from graypy.handler import BaseGELF... | [
"logging.handlers.SocketHandler.__init__",
"urlparse.urlparse",
"urllib.unquote",
"json.dumps",
"logging.Filter.__init__",
"amqplib.client_0_8.Message",
"amqplib.client_0_8.Connection",
"graypy.handler.BaseGELFHandler.__init__"
] | [((1404, 1417), 'urlparse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (1412, 1417), False, 'from urlparse import urlparse\n'), ((2136, 2176), 'graypy.handler.BaseGELFHandler.__init__', 'BaseGELFHandler.__init__', (['self'], {}), '(self, **kwargs)\n', (2160, 2176), False, 'from graypy.handler import BaseGELFHandler... |
import boto3
comprehend = boto3.client(service_name='comprehend')
translate = boto3.client(service_name='translate')
def detect_language(text):
"""
Detects the dominant language in a text
Parameters
----------
text: string, required
Input text
Returns
-------
string
Rep... | [
"boto3.client"
] | [((27, 66), 'boto3.client', 'boto3.client', ([], {'service_name': '"""comprehend"""'}), "(service_name='comprehend')\n", (39, 66), False, 'import boto3\n'), ((79, 117), 'boto3.client', 'boto3.client', ([], {'service_name': '"""translate"""'}), "(service_name='translate')\n", (91, 117), False, 'import boto3\n')] |
# 2020.05.10
# update topNscore
# learner on subspace
# particular designed for encounter missing class in this subspace
# if one class do not exists in training data, probability for this class would be zeros under anytime
#
# learner: a regressor or classifier, must have methods named 'predict'
# num_class: tota... | [
"numpy.ones",
"numpy.unique",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_digits",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"sklearn.svm.SVC"
] | [((3189, 3211), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (3209, 3211), False, 'from sklearn import datasets\n'), ((3358, 3431), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'digits.target'], {'test_size': '(0.2)', 'stratify': 'digits.target'}), '(X, digits.targ... |
"""Contains tests for the functions found in ``controls/templates_helpers.py``
To run this particular test file use the following command line:
nose2 -v app.tests.controls.tests_template_helpers
"""
from app import db, create_app
import unittest
from unittest import TestCase
from config import Config
from app.tests.u... | [
"app.controls.template_helpers.sidebar_widget_count",
"app.tests.utils.control_search_bar",
"app.controls.template_helpers.categories_presence",
"app.db.create_all",
"app.create_app",
"app.controls.template_helpers.ordered_widgets",
"app.models.SearchBarControls.query.first",
"app.tests.utils.add_thre... | [((3649, 3675), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (3662, 3675), False, 'import unittest\n'), ((1928, 1950), 'app.create_app', 'create_app', (['TestConfig'], {}), '(TestConfig)\n', (1938, 1950), False, 'from app import db, create_app\n'), ((2041, 2054), 'app.db.drop_all', '... |
import torch
import torch.nn as nn
from ..networks.basic.util import check
from ..networks.basic.predict import PredictNet, PredictLayer, OutLayer
from ..utils.util import get_shape_from_obs_space
class OneHot:
def __init__(self, out_dim):
self.out_dim = out_dim
def transform(self, tensor):
y_... | [
"torch.cat",
"torch.device"
] | [((566, 585), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (578, 585), False, 'import torch\n'), ((1271, 1304), 'torch.cat', 'torch.cat', (['(obs, actions)'], {'dim': '(-1)'}), '((obs, actions), dim=-1)\n', (1280, 1304), False, 'import torch\n'), ((1431, 1450), 'torch.device', 'torch.device', (['""... |
"""Compare evolution matrices to v0.1 numerics"""
import wetrunner
import unittest
from pkg_resources import resource_filename
import numpy as np
import numpy.testing as npt
def getUs_new(classname):
arg = (0.56, 5, 0.12, 1/127, 0, 0, 0, 1.2, 4.2, 0, 0, 1.8)
return wetrunner.rge.getUs(classname, *arg)
def ... | [
"wetrunner.rge.getUs",
"wetrunner.rge.getUe",
"pkg_resources.resource_filename"
] | [((277, 313), 'wetrunner.rge.getUs', 'wetrunner.rge.getUs', (['classname', '*arg'], {}), '(classname, *arg)\n', (296, 313), False, 'import wetrunner\n'), ((416, 452), 'wetrunner.rge.getUe', 'wetrunner.rge.getUe', (['classname', '*arg'], {}), '(classname, *arg)\n', (435, 452), False, 'import wetrunner\n'), ((546, 606), ... |
"""
Copyright (c) 2020 Intel Corporation
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 writin... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"argparse.ArgumentParser",
"torch.load",
"os.path.join",
"shutil.copyfile",
"torch.save",
"torch.IntTensor"
] | [((957, 973), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (971, 973), False, 'from argparse import ArgumentParser\n'), ((1648, 1663), 'os.path.exists', 'exists', (['dst_dir'], {}), '(dst_dir)\n', (1654, 1663), False, 'from os.path import isfile, join, exists\n'), ((1673, 1690), 'os.makedirs', 'makedi... |
#!/usr/bin/python3
import subprocess
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
#MAC address of the smart plug
MAC_ADDRESS = '84:f3:eb:32:e3:b4'
# netmask of your network
NET_MASK = '192.168.1.1/24'
#octopi config
OCTOPI_CONFIG = ... | [
"subprocess.Popen",
"yaml.safe_dump",
"yaml.load",
"subprocess.check_call"
] | [((384, 448), 'subprocess.check_call', 'subprocess.check_call', (["['/usr/bin/nmap', '-sP', '-T4', NET_MASK]"], {}), "(['/usr/bin/nmap', '-sP', '-T4', NET_MASK])\n", (405, 448), False, 'import subprocess\n'), ((453, 518), 'subprocess.Popen', 'subprocess.Popen', (["['/usr/sbin/arp', '-n']"], {'stdout': 'subprocess.PIPE'... |
from tkinter_gui_builder.panel_templates.widget_panel.widget_panel import AbstractWidgetPanel
from tkinter_gui_builder.widgets import basic_widgets
class CanvasDemoButtonPanel(AbstractWidgetPanel):
fname_select = basic_widgets.Button
zoom_in = basic_widgets.Button
zoom_out = basic_widgets.Button
rect_... | [
"tkinter_gui_builder.panel_templates.widget_panel.widget_panel.AbstractWidgetPanel.__init__"
] | [((1123, 1165), 'tkinter_gui_builder.panel_templates.widget_panel.widget_panel.AbstractWidgetPanel.__init__', 'AbstractWidgetPanel.__init__', (['self', 'parent'], {}), '(self, parent)\n', (1151, 1165), False, 'from tkinter_gui_builder.panel_templates.widget_panel.widget_panel import AbstractWidgetPanel\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import mechkit
import mechmean
class KanataniFactory(object):
def __init__(self, N):
self.con = mechkit.notation.Converter()
self._I2 = mechkit.tensors.Basic().I2
self.N = N = self.con.to_tensor(N)
self.degree = le... | [
"numpy.arccos",
"mechkit.notation.Converter",
"mechkit.tensors.Basic",
"numpy.column_stack",
"numpy.multiply.outer",
"numpy.array",
"numpy.einsum",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.arange"
] | [((3198, 3235), 'numpy.arccos', 'arccos', (['(1 - 2 * indices / nbr_vectors)'], {}), '(1 - 2 * indices / nbr_vectors)\n', (3204, 3235), False, 'from numpy import pi, cos, sin, arccos, arange\n'), ((3367, 3393), 'numpy.column_stack', 'np.column_stack', (['(x, y, z)'], {}), '((x, y, z))\n', (3382, 3393), True, 'import nu... |
from setuptools import setup, find_packages
setup(
name="fancylog",
version="0.2.6",
description="Fancier logging in Python",
install_requires=["packaging", "rich"],
extras_require={
"dev": [
"black",
"pytest-cov",
"pytest",
"coverage",
... | [
"setuptools.find_packages"
] | [((450, 465), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (463, 465), False, 'from setuptools import setup, find_packages\n')] |
from ymmsl import Identifier, Reference
import pytest
import yatiml
def test_create_identifier() -> None:
part = Identifier('testing')
assert str(part) == 'testing'
part = Identifier('CapiTaLs')
assert str(part) == 'CapiTaLs'
part = Identifier('under_score')
assert str(part) == 'under_score... | [
"yatiml.load_function",
"ymmsl.Identifier",
"yatiml.dumps_function",
"pytest.raises",
"ymmsl.Reference"
] | [((120, 141), 'ymmsl.Identifier', 'Identifier', (['"""testing"""'], {}), "('testing')\n", (130, 141), False, 'from ymmsl import Identifier, Reference\n'), ((188, 210), 'ymmsl.Identifier', 'Identifier', (['"""CapiTaLs"""'], {}), "('CapiTaLs')\n", (198, 210), False, 'from ymmsl import Identifier, Reference\n'), ((258, 28... |
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize("installed_packages", [
("haproxy20"),
("socat"),
("keepalived"),
("bind"),
])
def test_p... | [
"pytest.mark.parametrize"
] | [((191, 286), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""installed_packages"""', "['haproxy20', 'socat', 'keepalived', 'bind']"], {}), "('installed_packages', ['haproxy20', 'socat',\n 'keepalived', 'bind'])\n", (214, 286), False, 'import pytest\n'), ((449, 506), 'pytest.mark.parametrize', 'pytest.ma... |
import sys
from util.Timer import Timer
from util.FileOpener import FileOpener
from util.Logger import Logger
from util.PathExtractor import PathExtractor
from util.PathValidator import PathValidator
from service import SpacyModel
def lemmatize_text(file_path: str, timer: Timer):
logger = Logger()
output_file = File... | [
"util.PathExtractor.PathExtractor",
"util.FileOpener.FileOpener",
"util.Logger.Logger",
"service.SpacyModel.instance.get_en_spacy_line",
"util.PathValidator.PathValidator",
"util.Timer.Timer"
] | [((292, 300), 'util.Logger.Logger', 'Logger', ([], {}), '()\n', (298, 300), False, 'from util.Logger import Logger\n'), ((1046, 1053), 'util.Timer.Timer', 'Timer', ([], {}), '()\n', (1051, 1053), False, 'from util.Timer import Timer\n'), ((316, 328), 'util.FileOpener.FileOpener', 'FileOpener', ([], {}), '()\n', (326, 3... |
from app import app
if __name__ == '__main__':
app.run_server(port=5000, debug=True, host='localhost') | [
"app.app.run_server"
] | [((52, 107), 'app.app.run_server', 'app.run_server', ([], {'port': '(5000)', 'debug': '(True)', 'host': '"""localhost"""'}), "(port=5000, debug=True, host='localhost')\n", (66, 107), False, 'from app import app\n')] |