code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
"""
Exercise setting and getting individual vector elements
"""
def test():
# package access
import gsl
# make a vector
v = gsl.vector(shape=100)
# fill with a test pattern
f... | [
"gsl.vector"
] | [((262, 283), 'gsl.vector', 'gsl.vector', ([], {'shape': '(100)'}), '(shape=100)\n', (272, 283), False, 'import gsl\n')] |
from functools import wraps
import numpy as np
import torch
from mani_skill_learn.utils.data import split_in_dict_array, concat_list_of_array
def disable_gradients(network):
for param in network.parameters():
param.requires_grad = False
def worker_init_fn(worker_id):
"""The function is designed for ... | [
"numpy.random.seed",
"torch.IntTensor",
"functools.wraps",
"torch.no_grad",
"mani_skill_learn.utils.data.concat_list_of_array",
"mani_skill_learn.utils.data.split_in_dict_array"
] | [((658, 695), 'numpy.random.seed', 'np.random.seed', (['(base_seed + worker_id)'], {}), '(base_seed + worker_id)\n', (672, 695), True, 'import numpy as np\n'), ((718, 726), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (723, 726), False, 'from functools import wraps\n'), ((1214, 1259), 'mani_skill_learn.utils.data.... |
"""
test melange.propagators
"""
from jax import random
from jax import vmap
import jax.numpy as jnp
from melange.propagators import *
from melange.tests.utils import checker_function, get_nondefault_potential_initializer
import tqdm
import numpy as np
from jax.config import config; config.update("jax_enable_x64", True... | [
"jax.config.config.update",
"jax.numpy.array",
"melange.propagators.generate_Euler_Maruyama_propagators",
"jax.vmap",
"tqdm.trange",
"melange.propagators.driven_Langevin_log_proposal_ratio",
"jax.random.PRNGKey",
"jax.random.multivariate_normal",
"melange.propagators.generate_driven_Langevin_propaga... | [((284, 321), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (297, 321), False, 'from jax.config import config\n'), ((356, 373), 'jax.random.PRNGKey', 'random.PRNGKey', (['(0)'], {}), '(0)\n', (370, 373), False, 'from jax import random\n'), ((658, 67... |
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,line-too-long
from unittest import mock
import pytest
from eze.plugins.tools.node_npmaudit import NpmAuditTool
from eze.utils.io import create_tempfile_path
from tests.plugins.tools.tool_helper import ToolMetaTestBase
clas... | [
"unittest.mock.MagicMock",
"eze.plugins.tools.node_npmaudit.NpmAuditTool",
"unittest.mock.patch",
"eze.utils.io.create_tempfile_path",
"eze.plugins.tools.node_npmaudit.NpmAuditTool.check_installed"
] | [((6817, 6865), 'unittest.mock.patch', 'mock.patch', (['"""eze.utils.cli.async_subprocess_run"""'], {}), "('eze.utils.cli.async_subprocess_run')\n", (6827, 6865), False, 'from unittest import mock\n'), ((7432, 7480), 'unittest.mock.patch', 'mock.patch', (['"""eze.utils.cli.async_subprocess_run"""'], {}), "('eze.utils.c... |
# Generated by Django 3.2.12 on 2022-03-19 17:25
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('dog_shelters', '0011_auto_20220319_1724'),
]
operations = [
migrations.Remo... | [
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((305, 356), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""dog"""', 'name': '"""id"""'}), "(model_name='dog', name='id')\n", (327, 356), False, 'from django.db import migrations, models\n'), ((500, 666), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'dja... |
"""
Copyright [2009-2019] EMBL-European Bioinformatics Institute
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 a... | [
"subprocess.Popen",
"argparse.ArgumentParser",
"os.path.basename",
"utils.db_utils.get_number_of_seed_sequences",
"os.path.exists",
"utils.db_utils.get_family_unique_ncbi_ids",
"utils.db_utils.fetch_type_specific_rfam_accessions",
"subprocess.call",
"utils.db_utils.get_number_of_full_hits",
"os.pa... | [((1526, 1558), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (1541, 1558), False, 'import subprocess\n'), ((2151, 2179), 'os.path.basename', 'os.path.basename', (['family_dir'], {}), '(family_dir)\n', (2167, 2179), False, 'import os\n'), ((2199, 2244), 'os.path.join', 'os... |
from django.urls import path
from LLINS_API import views
from rest_framework.urlpatterns import format_suffix_patterns
from django.contrib import admin
urlpatterns = [
path('', admin.site.urls),
path('patients/', views.patient_data_list),
path('patints/<int:pk>/', views.patient_data_detail),
path('nets/... | [
"django.urls.path"
] | [((172, 197), 'django.urls.path', 'path', (['""""""', 'admin.site.urls'], {}), "('', admin.site.urls)\n", (176, 197), False, 'from django.urls import path\n'), ((203, 245), 'django.urls.path', 'path', (['"""patients/"""', 'views.patient_data_list'], {}), "('patients/', views.patient_data_list)\n", (207, 245), False, 'f... |
from django import forms
class UpdateReviewForm(forms.Form):
"""
UpdateReviewForm Valida los datos del request.data al modificar un review
Args:
forms (Form): Form de django
Atributes:
observacion (TextField): Campo para validar que se especifca la observacion
"""
observacio... | [
"django.forms.CharField"
] | [((324, 422), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(True)', 'error_messages': "{'required': 'No especificaste la observacion'}"}), "(required=True, error_messages={'required':\n 'No especificaste la observacion'})\n", (339, 422), False, 'from django import forms\n')] |
# to do 发送邮件,以及需要增加用例的执行结果
import time
import ApplicationPerformance.sendReport as sendReport
import ApplicationPerformance.applicationperformance.launchTime as launchTime # MAC
# import ApplicationPerformance.applicationperformance.launchTime as launchTime # Windows
from selenium import webdriver
from selenium.webd... | [
"ApplicationPerformance.sendReport.SendReport",
"selenium.webdriver.Firefox",
"ApplicationPerformance.applicationperformance.launchTime.ReadExcel",
"selenium.webdriver.FirefoxProfile",
"time.sleep",
"time.time",
"selenium.webdriver.Chrome",
"ApplicationPerformance.applicationperformance.launchTime.Mys... | [((514, 532), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (530, 532), False, 'from selenium import webdriver\n'), ((17975, 17991), 'time.localtime', 'time.localtime', ([], {}), '()\n', (17989, 17991), False, 'import time\n'), ((17857, 17879), 'ApplicationPerformance.applicationperformance.launchT... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 13:50:54 2020
This is the load to load data based on occupancy maps
@author: cheng
"""
import numpy as np
import time
import os
from augmentation import rotation
from maps import Maps
from occupancy import circle_group_grid
def loaddata(dataset_list, args, data... | [
"numpy.load",
"numpy.concatenate",
"occupancy.circle_group_grid",
"numpy.empty",
"os.path.exists",
"numpy.genfromtxt",
"numpy.isnan",
"time.time",
"augmentation.rotation",
"numpy.reshape",
"maps.Maps",
"numpy.savez",
"numpy.all"
] | [((5232, 5243), 'time.time', 'time.time', ([], {}), '()\n', (5241, 5243), False, 'import time\n'), ((483, 533), 'numpy.empty', 'np.empty', (['(0, args.obs_seq + args.pred_seq - 1, 8)'], {}), '((0, args.obs_seq + args.pred_seq - 1, 8))\n', (491, 533), True, 'import numpy as np\n'), ((550, 596), 'numpy.empty', 'np.empty'... |
"""Test functions for util.tm_util"""
import unittest
from ample.testing import test_funcs
from ample.util import ample_util, tm_util
@unittest.skipUnless(test_funcs.found_exe("TMscore" + ample_util.EXE_EXT), "TMscore exec missing")
class TestTM(unittest.TestCase):
def test_gaps_1(self):
gaps = tm_util.T... | [
"unittest.main",
"ample.testing.test_funcs.found_exe",
"ample.util.tm_util.TMscore"
] | [((158, 210), 'ample.testing.test_funcs.found_exe', 'test_funcs.found_exe', (["('TMscore' + ample_util.EXE_EXT)"], {}), "('TMscore' + ample_util.EXE_EXT)\n", (178, 210), False, 'from ample.testing import test_funcs\n'), ((980, 995), 'unittest.main', 'unittest.main', ([], {}), '()\n', (993, 995), False, 'import unittest... |
# Copyright 2017 Google Inc. and Skytruth 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 law or agr... | [
"utility.read_vessel_multiclass_metadata",
"numpy.random.RandomState"
] | [((2400, 2423), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (2421, 2423), True, 'import numpy as np\n'), ((2931, 3044), 'utility.read_vessel_multiclass_metadata', 'utility.read_vessel_multiclass_metadata', (['all_available_mmsis', 'metadata_file', 'fishing_ranges', 'fishing_upweight'], {}), '... |
"""Support for Google Places API."""
from datetime import timedelta
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_API_KEY, CONF_ID, CONF_NAME
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
import logging
import popu... | [
"voluptuous.Required",
"populartimes.get_id",
"datetime.timedelta",
"logging.getLogger"
] | [((365, 392), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (382, 392), False, 'import logging\n'), ((600, 621), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(10)'}), '(minutes=10)\n', (609, 621), False, 'from datetime import timedelta\n'), ((450, 476), 'voluptuous.Required', 'vo... |
from typing import Iterable
from eth2spec.test.helpers.constants import ALTAIR, MINIMAL, MAINNET, PHASE0
from eth2spec.test.altair.transition import (
test_transition as test_altair_transition,
test_activations_and_exits as test_altair_activations_and_exits,
test_leaking as test_altair_leaking,
test_sl... | [
"eth2spec.gen_helpers.gen_base.gen_typing.TestProvider",
"eth2spec.gen_helpers.gen_from_tests.gen.generate_from_tests"
] | [((1023, 1087), 'eth2spec.gen_helpers.gen_base.gen_typing.TestProvider', 'gen_typing.TestProvider', ([], {'prepare': 'prepare_fn', 'make_cases': 'cases_fn'}), '(prepare=prepare_fn, make_cases=cases_fn)\n', (1046, 1087), False, 'from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing\n'), ((774, 937), 'eth2spec... |
# -*- coding: utf-8 -*-
import time
from layout import Layout
from component import *
class Layout_222(Layout):
def __init__(self):
super(Layout_222, self).__init__(color = "black")
self.ch1 = 18 # component height 1
self.ch2 = 26 # component height 2
self.sh1 =... | [
"time.strftime",
"lcd.LCD"
] | [((3500, 3510), 'lcd.LCD', 'LCD', (['(False)'], {}), '(False)\n', (3503, 3510), False, 'from lcd import LCD\n'), ((875, 897), 'time.strftime', 'time.strftime', (['"""%d-%b"""'], {}), "('%d-%b')\n", (888, 897), False, 'import time\n'), ((1044, 1066), 'time.strftime', 'time.strftime', (['"""%H:%M"""'], {}), "('%H:%M')\n"... |
import xml.etree.ElementTree as ET
def parse_xml(anno_path):
CLASSES = ('background',
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car',
'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike',
'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'... | [
"xml.etree.ElementTree.parse"
] | [((390, 409), 'xml.etree.ElementTree.parse', 'ET.parse', (['anno_path'], {}), '(anno_path)\n', (398, 409), True, 'import xml.etree.ElementTree as ET\n')] |
# encoding: UTF-8
from tests.base import TestCase
from vilya.models.issue import Issue
from vilya.models.project_issue import ProjectIssue
class TestProjectIssue(TestCase):
def test_add_issue(self):
p = ProjectIssue.add('test', 'test description', 'test', project=1)
assert isinstance(p, Project... | [
"vilya.models.project_issue.ProjectIssue.gets_by_creator_id",
"vilya.models.project_issue.ProjectIssue._gets_by_issue_ids",
"vilya.models.project_issue.ProjectIssue.gets_by_assignee_id",
"vilya.models.project_issue.ProjectIssue._get_issues_by_project_id",
"vilya.models.project_issue.ProjectIssue.get_count_b... | [((220, 283), 'vilya.models.project_issue.ProjectIssue.add', 'ProjectIssue.add', (['"""test"""', '"""test description"""', '"""test"""'], {'project': '(1)'}), "('test', 'test description', 'test', project=1)\n", (236, 283), False, 'from vilya.models.project_issue import ProjectIssue\n'), ((506, 569), 'vilya.models.proj... |
# https://www.terraform.io/docs/configuration/locals.html
import terrascript
import terrascript.aws
import terrascript.aws.d
from shared import assert_equals_json
def test():
"""Data (008)"""
config = terrascript.Terrascript()
config += terrascript.aws.aws(version='~> 2.0', region='us-east-1')
con... | [
"terrascript.aws.aws",
"shared.assert_equals_json",
"terrascript.Terrascript"
] | [((213, 238), 'terrascript.Terrascript', 'terrascript.Terrascript', ([], {}), '()\n', (236, 238), False, 'import terrascript\n'), ((254, 311), 'terrascript.aws.aws', 'terrascript.aws.aws', ([], {'version': '"""~> 2.0"""', 'region': '"""us-east-1"""'}), "(version='~> 2.0', region='us-east-1')\n", (273, 311), False, 'imp... |
# cluster_features.py
#
# Based on snippets here:
# http://scikit-learn.org/dev/auto_examples/cluster/plot_cluster_iris.html#sphx-glr-auto-examples-cluster-plot-cluster-iris-py
from __future__ import print_function
import time
import datetime
import numpy as np
import pandas as pd
import ... | [
"sklearn.cross_validation.train_test_split",
"sklearn.preprocessing.StandardScaler",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"sklearn.cluster.KMeans",
"sklearn.metrics.accuracy_score",
"time.time",
"numpy.shape",
"matplotlib.pyplot.fig... | [((695, 730), 'pandas.read_csv', 'pd.read_csv', (['csv_filename'], {'header': '(0)'}), '(csv_filename, header=0)\n', (706, 730), True, 'import pandas as pd\n'), ((1418, 1473), 'sklearn.cross_validation.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': '(0.25)', 'random_state': '(42)'}), '(X, Y, test_siz... |
from typing import List
from wai.json.object import StrictJSONObject
from wai.json.object.property import ArrayProperty, StringProperty, EnumProperty
class CategoriesModSpec(StrictJSONObject['CategoriesModSpec']):
"""
A specification of which images to modify the categories
for, and which categories to m... | [
"wai.json.object.property.StringProperty",
"wai.json.object.property.EnumProperty"
] | [((419, 457), 'wai.json.object.property.EnumProperty', 'EnumProperty', ([], {'values': "('add', 'remove')"}), "(values=('add', 'remove'))\n", (431, 457), False, 'from wai.json.object.property import ArrayProperty, StringProperty, EnumProperty\n'), ((583, 611), 'wai.json.object.property.StringProperty', 'StringProperty'... |
import numpy as np
from numba import jit
import pyflann
from petsc4py import PETSc
from mpi4py import MPI
from speclus4py.types import DataObject, DataType, GraphType, OperatorType, OperatorContainer
@jit(nopython=True)
def get_global_index(x, y, ydim):
return y + x * ydim
@jit(nopython=True)
def get_global_i... | [
"petsc4py.PETSc.Mat",
"speclus4py.types.DataObject.__init__",
"speclus4py.types.OperatorContainer.__init__",
"numpy.abs",
"speclus4py.types.OperatorContainer.reset",
"petsc4py.PETSc.Sys.Print",
"numba.jit",
"numpy.exp",
"numpy.linalg.norm",
"pyflann.FLANN",
"pyflann.set_distance_type",
"petsc4... | [((205, 223), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (208, 223), False, 'from numba import jit\n'), ((285, 303), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (288, 303), False, 'from numba import jit\n'), ((398, 416), 'numba.jit', 'jit', ([], {'nopython': '(True... |
from util.inputReader import read_as_strings
def part1(slope_grid):
trees = 0
slope = 1
for i, line in enumerate(slope_grid):
if i % 2 == 0 and line[(int(i / 2) * slope) % len(line)] == '#':
trees += 1
return trees
grid = read_as_strings("../inputs/2020_03.txt")
print("part1:", ... | [
"util.inputReader.read_as_strings"
] | [((263, 303), 'util.inputReader.read_as_strings', 'read_as_strings', (['"""../inputs/2020_03.txt"""'], {}), "('../inputs/2020_03.txt')\n", (278, 303), False, 'from util.inputReader import read_as_strings\n')] |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"suite.load",
"mock.patch.object",
"absl.testing.parameterized.named_parameters",
"absl.testing.absltest.main"
] | [((808, 916), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('none', None)", "('easy', 'easy')", "('medium', 'medium')", "('hard', 'hard')"], {}), "(('none', None), ('easy', 'easy'), ('medium',\n 'medium'), ('hard', 'hard'))\n", (838, 916), False, 'from absl.testing import param... |
from Qt import QtWidgets
from Qt import QtCore
from Qt import QtGui
from . import const
from . import uiUtil
from .. import util
from .. import box
from .. import core
from functools import partial
import re
ReEqual = re.compile("^\s*[=]\s*")
class ParamCreator(QtWidgets.QDialog):
ParamTypes = {"bool": bool, "i... | [
"Qt.QtCore.Signal",
"functools.partial",
"Qt.QtWidgets.QLabel",
"Qt.QtWidgets.QHBoxLayout",
"Qt.QtWidgets.QLineEdit",
"Qt.QtWidgets.QVBoxLayout",
"Qt.QtWidgets.QGridLayout",
"Qt.QtWidgets.QPushButton",
"Qt.QtWidgets.QWidget",
"Qt.QtWidgets.QScrollArea",
"Qt.QtWidgets.QMenu",
"Qt.QtWidgets.QCom... | [((220, 246), 're.compile', 're.compile', (['"""^\\\\s*[=]\\\\s*"""'], {}), "('^\\\\s*[=]\\\\s*')\n", (230, 246), False, 'import re\n'), ((2342, 2357), 'Qt.QtCore.Signal', 'QtCore.Signal', ([], {}), '()\n', (2355, 2357), False, 'from Qt import QtCore\n'), ((3370, 3385), 'Qt.QtCore.Signal', 'QtCore.Signal', ([], {}), '(... |
import pytest
from requests import codes
from tilapya.errors import TransLinkAPIError
from tilapya.gtfsrt import GTFSRT
from .conftest import remove_response_headers_func
# Apply VCR to all tests in this file.
pytestmark = pytest.mark.vcr(before_record_response=remove_response_headers_func('Set-Cookie'))
@pytest.f... | [
"pytest.raises",
"tilapya.gtfsrt.GTFSRT"
] | [((370, 399), 'tilapya.gtfsrt.GTFSRT', 'GTFSRT', ([], {'api_key': 'valid_api_key'}), '(api_key=valid_api_key)\n', (376, 399), False, 'from tilapya.gtfsrt import GTFSRT\n'), ((705, 737), 'pytest.raises', 'pytest.raises', (['TransLinkAPIError'], {}), '(TransLinkAPIError)\n', (718, 737), False, 'import pytest\n'), ((755, ... |
"""
See COPYING for license information.
"""
import unittest
import os
import time
from twisted.python import log
from swftp.utils import (
try_datetime_parse, MetricCollector, parse_key_value_config)
class MetricCollectorTest(unittest.TestCase):
def setUp(self):
self.c = MetricCollector()
def ... | [
"swftp.utils.try_datetime_parse",
"swftp.utils.MetricCollector",
"time.tzset",
"swftp.utils.parse_key_value_config"
] | [((293, 310), 'swftp.utils.MetricCollector', 'MetricCollector', ([], {}), '()\n', (308, 310), False, 'from swftp.utils import try_datetime_parse, MetricCollector, parse_key_value_config\n'), ((349, 368), 'swftp.utils.MetricCollector', 'MetricCollector', (['(10)'], {}), '(10)\n', (364, 368), False, 'from swftp.utils imp... |
from matplotlib.colors import Normalize
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pandas as pd
import numpy as np
from math import pi, log
from scipy.stats import rankdata
from argparse import ArgumentParser
if __name__ == "__main__":
... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.loadtxt"
] | [((330, 346), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (344, 346), False, 'from argparse import ArgumentParser\n'), ((736, 756), 'numpy.loadtxt', 'np.loadtxt', (['filepath'], {}), '(filepath)\n', (746, 756), True, 'import numpy as np\n'), ((1013, 1025), 'matplotlib.pyplot.figure', 'plt.figure', ([... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32
rospy.init_node('publisher_radius')
pub = rospy.Publisher('radius', Float32, queue_size=1)
rate = rospy.Rate(1)
radius = 1.0
while not rospy.is_shutdown():
try:
pub.publish(radius)
rate.sleep()
except:
pass | [
"rospy.is_shutdown",
"rospy.Publisher",
"rospy.init_node",
"rospy.Rate"
] | [((70, 105), 'rospy.init_node', 'rospy.init_node', (['"""publisher_radius"""'], {}), "('publisher_radius')\n", (85, 105), False, 'import rospy\n'), ((112, 160), 'rospy.Publisher', 'rospy.Publisher', (['"""radius"""', 'Float32'], {'queue_size': '(1)'}), "('radius', Float32, queue_size=1)\n", (127, 160), False, 'import r... |
# coding=utf-8
from django.contrib import admin
from .admin_support.forms import NoteModelForm
from .models import Note, Tag
class TagInline(admin.TabularInline):
model = Note.tags.through
class NoteAdmin(admin.ModelAdmin):
ordering = ["title"]
exclude = ("created", "modified", "body")
list_displa... | [
"django.contrib.admin.site.register"
] | [((495, 519), 'django.contrib.admin.site.register', 'admin.site.register', (['Tag'], {}), '(Tag)\n', (514, 519), False, 'from django.contrib import admin\n'), ((520, 556), 'django.contrib.admin.site.register', 'admin.site.register', (['Note', 'NoteAdmin'], {}), '(Note, NoteAdmin)\n', (539, 556), False, 'from django.con... |
'''
test en-zh
'''
# import sys
import pytest # type: ignore
from loguru import logger
# sys.path.insert(0, '..')
# from google_tr_async.google_tr_async import google_tr_async
from google_tr_async import google_tr_async
@pytest.mark.asyncio
async def test_0():
''' test 0'''
text = \
'''There is now... | [
"loguru.logger.debug",
"google_tr_async.google_tr_async"
] | [((1534, 1569), 'loguru.logger.debug', 'logger.debug', (["('trtext: %s' % trtext)"], {}), "('trtext: %s' % trtext)\n", (1546, 1569), False, 'from loguru import logger\n'), ((1239, 1272), 'google_tr_async.google_tr_async', 'google_tr_async', (['text'], {'debug': '(True)'}), '(text, debug=True)\n', (1254, 1272), False, '... |
import pandas as pd
train = pd.read_csv('alldata/labeledTrainData.tsv', header=0, delimiter='\t', quoting=3)
print(train.shape)
print(train.columns.values)
print(train.head())
print(train['review'][0])
test = pd.read_csv('alldata/testData.tsv', header=0, delimiter='\t', quoting=3)
print(test.shape)
print(test.head())
... | [
"pandas.read_csv",
"nltk.corpus.stopwords.words",
"bs4.BeautifulSoup"
] | [((28, 113), 'pandas.read_csv', 'pd.read_csv', (['"""alldata/labeledTrainData.tsv"""'], {'header': '(0)', 'delimiter': '"""\t"""', 'quoting': '(3)'}), "('alldata/labeledTrainData.tsv', header=0, delimiter='\\t', quoting=3\n )\n", (39, 113), True, 'import pandas as pd\n'), ((210, 282), 'pandas.read_csv', 'pd.read_csv... |
"""Classes to run register functions at certain timepoints and run asynchronously"""
import threading
import time
from typing import Any, Callable, Iterable, NoReturn, Union
import numpy as np
import sc3nb
from sc3nb.osc.osc_communication import Bundler, OSCCommunication, OSCMessage
class Event:
"""Stores a ti... | [
"threading.Thread",
"numpy.empty",
"numpy.searchsorted",
"sc3nb.SC.get_default",
"time.time",
"threading.Lock",
"time.sleep",
"numpy.insert",
"threading.Event"
] | [((2418, 2434), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2))\n', (2426, 2434), True, 'import numpy as np\n'), ((2491, 2508), 'threading.Event', 'threading.Event', ([], {}), '()\n', (2506, 2508), False, 'import threading\n'), ((2530, 2546), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2544, 2546), Fa... |
import os
from ..models import DocumentType
from ..permissions import (
permission_document_properties_edit,
permission_document_type_create, permission_document_type_delete,
permission_document_type_edit, permission_document_type_view,
)
from .base import GenericDocumentViewTestCase
from .literals import... | [
"os.path.splitext"
] | [((9421, 9463), 'os.path.splitext', 'os.path.splitext', (['self.test_document.label'], {}), '(self.test_document.label)\n', (9437, 9463), False, 'import os\n'), ((10140, 10182), 'os.path.splitext', 'os.path.splitext', (['self.test_document.label'], {}), '(self.test_document.label)\n', (10156, 10182), False, 'import os\... |
"""
Unit and regression test for the kissim.encoding.features.sitealign.SiteAlignFeature class.
"""
from pathlib import Path
import pytest
import numpy as np
import pandas as pd
from opencadd.databases.klifs import setup_local
from kissim.io import PocketBioPython
from kissim.encoding.features import SiteAlignFeatur... | [
"kissim.io.PocketBioPython.from_structure_klifs_id",
"opencadd.databases.klifs.setup_local",
"numpy.isnan",
"pytest.raises",
"pathlib.Path",
"kissim.encoding.features.SiteAlignFeature",
"kissim.encoding.features.SiteAlignFeature.from_pocket",
"pytest.mark.parametrize"
] | [((400, 446), 'opencadd.databases.klifs.setup_local', 'setup_local', (["(PATH_TEST_DATA / 'KLIFS_download')"], {}), "(PATH_TEST_DATA / 'KLIFS_download')\n", (411, 446), False, 'from opencadd.databases.klifs import setup_local\n'), ((541, 782), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""structure_klifs_... |
from zeit.vgwort.token import _order_tokens
import transaction
import unittest
import zeit.vgwort.interfaces
import zeit.vgwort.testing
import zope.component
class TokenStorageTest(zeit.vgwort.testing.EndToEndTestCase):
def order(self, amount):
ts = zope.component.getUtility(zeit.vgwort.interfaces.IToken... | [
"transaction.commit",
"zeit.vgwort.token._order_tokens",
"zeit.vgwort.token.TokenService",
"transaction.abort",
"datetime.datetime.now"
] | [((1180, 1195), 'zeit.vgwort.token._order_tokens', '_order_tokens', ([], {}), '()\n', (1193, 1195), False, 'from zeit.vgwort.token import _order_tokens\n'), ((1421, 1436), 'zeit.vgwort.token._order_tokens', '_order_tokens', ([], {}), '()\n', (1434, 1436), False, 'from zeit.vgwort.token import _order_tokens\n'), ((1799,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('computing', '0009_auto_20141128_1121'),
]
operations = [
migrations.RenameField(
model_name='computer',
... | [
"django.db.migrations.RenameField"
] | [((253, 349), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""computer"""', 'old_name': '"""warranty_type"""', 'new_name': '"""warranty"""'}), "(model_name='computer', old_name='warranty_type',\n new_name='warranty')\n", (275, 349), False, 'from django.db import models, migratio... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((1854, 1890), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""keySigningKeys"""'}), "(name='keySigningKeys')\n", (1867, 1890), False, 'import pulumi\n'), ((2190, 2223), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""managedZone"""'}), "(name='managedZone')\n", (2203, 2223), False, 'import pulumi\n'), ((2434,... |
import logging
from dropbox.client import DropboxClient # Dropobox official library
from ..redislist import RedisDropboxDownloadList, RedisDropboxIndexList
from .dropboxfile import DropboxFile
log = logging.getLogger('dropbox')
class DropboxDownloader:
"""
Download files from Dropbox based on a list previ... | [
"dropbox.client.DropboxClient",
"logging.getLogger"
] | [((203, 231), 'logging.getLogger', 'logging.getLogger', (['"""dropbox"""'], {}), "('dropbox')\n", (220, 231), False, 'import logging\n'), ((1020, 1052), 'dropbox.client.DropboxClient', 'DropboxClient', (['self.access_token'], {}), '(self.access_token)\n', (1033, 1052), False, 'from dropbox.client import DropboxClient\n... |
import pandas as pd
import numpy as np
import Levenshtein
import random
random.seed(12345)
d = pd.read_csv("../data/asjp19wide.csv", index_col=0)
words = d.values[~d.isnull()]
words = np.concatenate([w.split('-') for w in words])
tests = pd.DataFrame(columns=['word1', 'word2', 'LD'])
for i in range(1000):
if... | [
"pandas.read_csv",
"Levenshtein.distance",
"random.seed",
"pandas.DataFrame"
] | [((73, 91), 'random.seed', 'random.seed', (['(12345)'], {}), '(12345)\n', (84, 91), False, 'import random\n'), ((97, 147), 'pandas.read_csv', 'pd.read_csv', (['"""../data/asjp19wide.csv"""'], {'index_col': '(0)'}), "('../data/asjp19wide.csv', index_col=0)\n", (108, 147), True, 'import pandas as pd\n'), ((243, 289), 'pa... |
"""Test for the snakemake workflow distributed with region_set_profiler"""
import json
import subprocess
import os
import pandas as pd
import numpy as np
tmpdir = "/icgc/dkfzlsdf/analysis/hs_ontogeny/temp"
# TODO: gtfanno result has weird index
gtfanno_result: pd.DataFrame = pd.read_pickle(
"/icgc/dkfzlsdf/analy... | [
"json.dump",
"numpy.cumsum",
"numpy.arange",
"pandas.read_pickle",
"os.path.expanduser"
] | [((279, 460), 'pandas.read_pickle', 'pd.read_pickle', (['"""/icgc/dkfzlsdf/analysis/hs_ontogeny/results/wgbs/cohort_results/analyses/hierarchy/annotation/hierarchy-dmrs/v1/hierarchy-dmrs-anno_primary-annotations.p"""'], {}), "(\n '/icgc/dkfzlsdf/analysis/hs_ontogeny/results/wgbs/cohort_results/analyses/hierarchy/ann... |
# -*- coding: utf-8 -*-
import functools
from django.forms.utils import ErrorList
from .readonly import read_only_mode, ReadOnlyError
from .signals import send_post_commit, send_post_rollback, send_pre_commit
def full_clean_if_not_read_only(full_clean):
"""Decorator for preventing form submissions while in read... | [
"django.forms.utils.ErrorList",
"functools.wraps"
] | [((1036, 1057), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1051, 1057), False, 'import functools\n'), ((1659, 1680), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1674, 1680), False, 'import functools\n'), ((2163, 2184), 'functools.wraps', 'functools.wraps', (['func'], {}), ... |
import sys
sys.path.append("../../")
import unittest
import paddle
import numpy as np
from paddleslim import UnstructuredPruner
from paddle.vision.models import mobilenet_v1
class TestUnstructuredPruner(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestUnstructuredPruner, self).__init__(*... | [
"sys.path.append",
"unittest.main",
"numpy.random.uniform",
"paddleslim.UnstructuredPruner",
"paddle.disable_static",
"paddleslim.UnstructuredPruner.total_sparse",
"paddle.vision.models.mobilenet_v1"
] | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((2156, 2171), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2169, 2171), False, 'import unittest\n'), ((344, 367), 'paddle.disable_static', 'paddle.disable_static', ([], {}), '()\n', (365,... |
# 人脸追踪例程
#
# 这个例程展示了如何使用关键特征来追踪一个已经使用Haar Cascade检测出来的人脸。
# 程序第一阶段先使用 Haar Cascade 找出人脸.然后使用关键特征来学习,最后不停的找这个人脸。
# 关键特征点可以用来追踪任何栋。
#
#翻译:01Studio
import sensor, time, image
# Reset sensor
sensor.reset()
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((320, 240)) ... | [
"sensor.set_framesize",
"sensor.set_windowing",
"sensor.set_gainceiling",
"sensor.skip_frames",
"image.match_descriptor",
"sensor.set_contrast",
"sensor.reset",
"sensor.snapshot",
"time.clock",
"time.sleep",
"image.HaarCascade",
"sensor.set_pixformat"
] | [((189, 203), 'sensor.reset', 'sensor.reset', ([], {}), '()\n', (201, 203), False, 'import sensor, time, image\n'), ((204, 226), 'sensor.set_contrast', 'sensor.set_contrast', (['(3)'], {}), '(3)\n', (223, 226), False, 'import sensor, time, image\n'), ((227, 253), 'sensor.set_gainceiling', 'sensor.set_gainceiling', (['(... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 <NAME> All rights reserved.
#
"""
"""
#end_pymotw_header
import warnings
import logging
logging.basicConfig(level=logging.INFO)
def send_warnings_to_log(message, category, filename, lineno, file=None):
logging.warning(
'%s:%s: %s:%s' %
... | [
"logging.warning",
"warnings.warn",
"logging.basicConfig"
] | [((153, 192), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (172, 192), False, 'import logging\n'), ((467, 491), 'warnings.warn', 'warnings.warn', (['"""message"""'], {}), "('message')\n", (480, 491), False, 'import warnings\n'), ((272, 357), 'logging.warning',... |
#!/usr/bin/env python3
"""Setup script. Used by easy_install and pip."""
import os
from setuptools import setup, find_packages
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
SRC_PATH = os.path.join(BASE_PATH, "src")
PACKAGES = find_packages(where=SRC_PATH)
NAME = 'HartreeParticleDSL'
AUTHOR = ("<NAME> <<EMAI... | [
"os.path.abspath",
"setuptools.setup",
"os.path.basename",
"os.walk",
"os.path.relpath",
"os.path.join",
"setuptools.find_packages"
] | [((195, 225), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""src"""'], {}), "(BASE_PATH, 'src')\n", (207, 225), False, 'import os\n'), ((237, 266), 'setuptools.find_packages', 'find_packages', ([], {'where': 'SRC_PATH'}), '(where=SRC_PATH)\n', (250, 266), False, 'from setuptools import setup, find_packages\n'), ((1... |
# BSD 2-CLAUSE LICENSE
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# Redistributions i... | [
"numpy.abs",
"pandas.DatetimeIndex",
"numpy.sin",
"numpy.arange",
"inspect.getmembers",
"pandas.DataFrame",
"warnings.simplefilter",
"inspect.isclass",
"warnings.catch_warnings",
"pandas.concat",
"datetime.datetime",
"scipy.special.expit",
"pandas.to_timedelta",
"pandas.to_datetime",
"pa... | [((2738, 2769), 'pandas.to_datetime', 'pd.to_datetime', (['df[time_col][0]'], {}), '(df[time_col][0])\n', (2752, 2769), True, 'import pandas as pd\n'), ((6696, 6716), 'pandas.DatetimeIndex', 'pd.DatetimeIndex', (['dt'], {}), '(dt)\n', (6712, 6716), True, 'import pandas as pd\n'), ((11951, 11978), 'pandas.DataFrame', 'p... |
# coding: utf-8
# In[2]:
#start of code
#importing packages
import numpy as np
import scipy.signal as sp
import matplotlib.pyplot as plt
# In[3]:
def time_domain_output(f,H,t_start,t_end):
t = np.linspace(t_start,t_end,10*(t_end-t_start))
t2,y,svec=sp.lsim(H,f,t)
return y
# In[4]:
t_start ... | [
"matplotlib.pyplot.title",
"numpy.poly1d",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.signal.impulse",
"matplotlib.pyplot.legend",
"scipy.signal.lsim",
"matplotlib.pyplot.grid",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"... | [((340, 391), 'numpy.linspace', 'np.linspace', (['t_start', 't_end', '(10 * (t_end - t_start))'], {}), '(t_start, t_end, 10 * (t_end - t_start))\n', (351, 391), True, 'import numpy as np\n'), ((441, 466), 'scipy.signal.lti', 'sp.lti', (['[1]', '[1, 0, 2.25]'], {}), '([1], [1, 0, 2.25])\n', (447, 466), True, 'import sci... |
import re
def sort_by_double_camel(chars: str) -> str:
"""ダブルキャメルケースで分割ソートする
Args:
chars(str): ソート対象の文字列
Returns:
(list[str]): 昇順でソートされたダブルキャメルケース文字列
"""
double_camels = sorted(re.findall("[A-Z][a-z]*[A-Z]", chars), key=str.lower)
return "".join(double_camels)
def main():
... | [
"re.findall"
] | [((215, 252), 're.findall', 're.findall', (['"""[A-Z][a-z]*[A-Z]"""', 'chars'], {}), "('[A-Z][a-z]*[A-Z]', chars)\n", (225, 252), False, 'import re\n')] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2020 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | [
"collections.deque"
] | [((1934, 1941), 'collections.deque', 'deque', ([], {}), '()\n', (1939, 1941), False, 'from collections import deque\n')] |
'''Python script to generate CAC'''
'''Authors - <NAME>
'''
import numpy as np
import pandas as pd
from datetime import datetime
import collections
from .helpers import *
class CAC:
def __init__(self, fin_perf, oper_metrics, oth_metrics):
print("INIT CAC")
self.fin_perf = pd.DataFrame(fin_perf)
... | [
"pandas.DataFrame",
"pandas.Series"
] | [((297, 319), 'pandas.DataFrame', 'pd.DataFrame', (['fin_perf'], {}), '(fin_perf)\n', (309, 319), True, 'import pandas as pd\n'), ((348, 374), 'pandas.DataFrame', 'pd.DataFrame', (['oper_metrics'], {}), '(oper_metrics)\n', (360, 374), True, 'import pandas as pd\n'), ((402, 427), 'pandas.DataFrame', 'pd.DataFrame', (['o... |
import pytest
from unittest.mock import (
call,
mock_open,
patch,
)
from subnet import ip_network, IPv4Network, IPv4Address
from wireguard import (
Config,
ServerConfig,
Peer,
Server,
)
from wireguard.utils import IPAddressSet
def test_basic_server():
subnet = '192.168.0.0/24'
a... | [
"wireguard.Server",
"wireguard.Peer",
"wireguard.Config",
"pytest.raises",
"unittest.mock.mock_open",
"wireguard.ServerConfig",
"pytest.mark.parametrize",
"unittest.mock.call",
"wireguard.utils.IPAddressSet"
] | [((3466, 3910), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('interface', 'path', 'full_path', 'peers_full_path')", "[(None, None, '/etc/wireguard/wg0.conf', '/etc/wireguard/wg0-peers.conf'),\n ('wg3', None, '/etc/wireguard/wg3.conf',\n '/etc/wireguard/wg3-peers.conf'), (None, '/opt/my-wg-dir',\n ... |
# Copyright 2010-2016 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"BeautifulSoup.BeautifulSoup",
"pyhole.core.utils.decode_entities",
"pyhole.core.request.get",
"pyhole.core.plugin.hook_add_command"
] | [((839, 871), 'pyhole.core.plugin.hook_add_command', 'plugin.hook_add_command', (['"""urban"""'], {}), "('urban')\n", (862, 871), False, 'from pyhole.core import plugin\n'), ((1662, 1698), 'pyhole.core.plugin.hook_add_command', 'plugin.hook_add_command', (['"""wikipedia"""'], {}), "('wikipedia')\n", (1685, 1698), False... |
# Generated by Django 2.2 on 2019-05-16 07:59
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('modelchimp', '0048_auto_20190515_1032'),
]
operations = [
migrations.RemoveField(
model_name='experiment',
name='algorithm',
... | [
"django.db.migrations.RemoveField"
] | [((228, 293), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""experiment"""', 'name': '"""algorithm"""'}), "(model_name='experiment', name='algorithm')\n", (250, 293), False, 'from django.db import migrations\n'), ((338, 402), 'django.db.migrations.RemoveField', 'migrations.RemoveF... |
# --------------------------------------------------------------------------
#<pycode(py_expr)>
try:
import types
import ctypes
# Callback for IDC func callback (On Windows, we use stdcall)
# typedef error_t idaapi idc_func_t(idc_value_t *argv,idc_value_t *r);
try:
_IDCFUNC_CB_T = ctypes.WIN... | [
"ctypes.CFUNCTYPE",
"ctypes.cast",
"ctypes.WINFUNCTYPE"
] | [((310, 376), 'ctypes.WINFUNCTYPE', 'ctypes.WINFUNCTYPE', (['ctypes.c_int', 'ctypes.c_void_p', 'ctypes.c_void_p'], {}), '(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)\n', (328, 376), False, 'import ctypes\n'), ((650, 737), 'ctypes.CFUNCTYPE', 'ctypes.CFUNCTYPE', (['ctypes.c_long', 'ctypes.c_void_p', 'ctypes.c_void_p... |
from django.contrib.auth.models import User
from django.test import TestCase
from dfirtrack_artifacts.forms import ArtifactCreatorForm
from dfirtrack_artifacts.models import Artifactpriority, Artifactstatus, Artifacttype
from dfirtrack_main.models import System, Systemstatus, Tag, Tagcolor
class ArtifactCreatorFormT... | [
"dfirtrack_main.models.Tagcolor.objects.create",
"dfirtrack_artifacts.models.Artifacttype.objects.get",
"dfirtrack_main.models.Tag.objects.create",
"dfirtrack_main.models.Systemstatus.objects.create",
"dfirtrack_artifacts.models.Artifactpriority.objects.create",
"django.contrib.auth.models.User.objects.cr... | [((466, 556), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""testuser_artifact_creator"""', 'password': '"""<PASSWORD>"""'}), "(username='testuser_artifact_creator', password=\n '<PASSWORD>')\n", (490, 556), False, 'from django.contrib.auth.models import User... |
import numpy as np
import sympy
from lark import Transformer, Tree
from sortedcontainers import SortedList
from TS.State import Vector
class Rate:
def __init__(self, expression):
self.expression = expression
def __eq__(self, other):
return self.expression == other.expression
def __repr_... | [
"sympy.Symbol",
"TS.State.Vector",
"lark.Tree"
] | [((3779, 3802), 'lark.Tree', 'Tree', (['"""agent"""', '[vector]'], {}), "('agent', [vector])\n", (3783, 3802), False, 'from lark import Transformer, Tree\n'), ((4276, 4290), 'TS.State.Vector', 'Vector', (['result'], {}), '(result)\n', (4282, 4290), False, 'from TS.State import Vector\n'), ((4342, 4365), 'lark.Tree', 'T... |
import sys, time, os, json
import numpy as np
import matplotlib.pylab as plt
from PIL import Image
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization
from google.colab import drive
def... | [
"matplotlib.pylab.imshow",
"numpy.ones",
"matplotlib.pylab.axis",
"os.path.isfile",
"sys.stdout.flush",
"matplotlib.pylab.title",
"matplotlib.pylab.show",
"matplotlib.pylab.figure",
"numpy.random.choice",
"numpy.add",
"json.dump",
"google.colab.drive.mount",
"numpy.memmap",
"numpy.concaten... | [((2246, 2319), 'numpy.memmap', 'np.memmap', (['path'], {'dtype': 'np.uint8', 'mode': '"""r"""', 'shape': '((train_num,) + img_shape)'}), "(path, dtype=np.uint8, mode='r', shape=(train_num,) + img_shape)\n", (2255, 2319), True, 'import numpy as np\n'), ((2365, 2390), 'os.path.isfile', 'os.path.isfile', (['json_name'], ... |
import argparse
import os
import sys
import cv2
import numpy as np
from matplotlib import pyplot as plt
from functools import cmp_to_key
from fhi_lib.geometry import Point, Line
class DistanceEstimator():
def __init__(self, img):
self.img = img
self.panel_length = 2235
self.scale_length = 100
def initialize... | [
"cv2.GaussianBlur",
"cv2.contourArea",
"numpy.absolute",
"cv2.dilate",
"cv2.cvtColor",
"cv2.getStructuringElement",
"cv2.approxPolyDP",
"fhi_lib.geometry.Line",
"numpy.min",
"fhi_lib.geometry.Point",
"cv2.convexHull",
"cv2.erode",
"cv2.inRange",
"cv2.findContours"
] | [((574, 583), 'fhi_lib.geometry.Point', 'Point', (['pt'], {}), '(pt)\n', (579, 583), False, 'from fhi_lib.geometry import Point, Line\n'), ((1635, 1672), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['self.img', '(5, 5)', '(0)'], {}), '(self.img, (5, 5), 0)\n', (1651, 1672), False, 'import cv2\n'), ((1684, 1721), 'cv2.cvtC... |
from distutils.core import setup, Extension
import glob
import numpy
import config
import sys
import os
from config import ROOT
includes = [os.path.join(ROOT,"Include"),os.path.join(ROOT,"PrivateInclude"),os.path.join("cmsisdsp_pkg","src")]
if sys.platform == 'win32':
cflags = ["-DWIN",config.cflags,"-DUNALIGNED_SU... | [
"numpy.get_include",
"os.path.join",
"distutils.core.setup"
] | [((3420, 3826), 'distutils.core.setup', 'setup', ([], {'name': 'config.setupName', 'version': '"""0.0.1"""', 'description': 'config.setupDescription', 'ext_modules': '[module1]', 'author': '"""Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved."""', 'url': '"""https://github.com/ARM-software/CMS... |
# Copyright 2021, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | [
"tensorflow.test.main",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"numpy.minimum",
"tensorflow.keras.losses.MeanSquaredError",
"tensorflow.keras.layers.Dense",
"numpy.std",
"tensorflow.keras.optimizers.SGD",
"numpy.zeros",
"tensorflow.keras.layers.InputLayer",
"numpy.mean",
"numpy... | [((946, 964), 'numpy.array', 'np.array', (['[[3, 4]]'], {}), '([[3, 4]])\n', (954, 964), True, 'import numpy as np\n'), ((2029, 2153), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('l2_norm_clip 10.0', 10.0)", "('l2_norm_clip 40.0', 40.0)", "('l2_norm_clip 200.0', 200.0)"], {}), "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: philld
"""
import os
import json
from transifex.api import transifex_api
print(os.getenv("PWD"))
transifex_api.setup(auth=os.getenv("TX_TOKEN"))
organization = transifex_api.Organization.get(slug="hisp-uio")
projects = organization.fetch('projects')
lang... | [
"json.load",
"json.dumps",
"transifex.api.transifex_api.Organization.get",
"transifex.api.transifex_api.ResourceLanguageStats.filter",
"transifex.api.transifex_api.Language.all",
"os.getenv"
] | [((225, 272), 'transifex.api.transifex_api.Organization.get', 'transifex_api.Organization.get', ([], {'slug': '"""hisp-uio"""'}), "(slug='hisp-uio')\n", (255, 272), False, 'from transifex.api import transifex_api\n'), ((524, 537), 'json.load', 'json.load', (['ft'], {}), '(ft)\n', (533, 537), False, 'import json\n'), ((... |
#!/usr/bin/env python
'''
A module for getting the stream info for a video.
Info:
type: eta.core.types.Module
version: 0.1.0
Copyright 2017-2018, Voxel51, LLC
voxel51.com
<NAME>, <EMAIL>
'''
# pragma pylint: disable=redefined-builtin
# pragma pylint: disable=unused-wildcard-import
# pragma pylint: disable=wi... | [
"eta.core.video.VideoStreamInfo.build_for",
"eta.core.module.setup",
"logging.getLogger"
] | [((770, 797), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (787, 797), False, 'import logging\n'), ((2058, 2131), 'eta.core.module.setup', 'etam.setup', (['stream_info_config'], {'pipeline_config_path': 'pipeline_config_path'}), '(stream_info_config, pipeline_config_path=pipeline_config... |
# Copyright 2020-present <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"discord.ext.commands.command",
"discord.AllowedMentions",
"asyncio.sleep",
"discord.ext.commands.max_concurrency",
"discord.Object",
"asyncio.Lock",
"discord.ext.commands.bot_has_guild_permissions",
"datetime.timedelta",
"discord.ext.commands.group",
"datetime.datetime.now",
"logging.getLogger"... | [((982, 1032), 'logging.getLogger', 'logging.getLogger', (['"""salamander.extensions.cleanup"""'], {}), "('salamander.extensions.cleanup')\n", (999, 1032), False, 'import logging\n'), ((1102, 1156), 'discord.ext.commands.max_concurrency', 'commands.max_concurrency', (['(1)', 'commands.BucketType.guild'], {}), '(1, comm... |
import z3
from mythril.laser.smt.model import Model
from mythril.laser.smt.bool import Bool
from mythril.laser.smt.solver.solver_statistics import stat_smt_query
from typing import Set, Tuple, Dict, List, cast
def _get_expr_variables(expression: z3.ExprRef) -> List[z3.ExprRef]:
"""
Gets the variables that m... | [
"typing.cast",
"mythril.laser.smt.model.Model",
"z3.Solver"
] | [((3114, 3125), 'z3.Solver', 'z3.Solver', ([], {}), '()\n', (3123, 3125), False, 'import z3\n'), ((4774, 4792), 'mythril.laser.smt.model.Model', 'Model', (['self.models'], {}), '(self.models)\n', (4779, 4792), False, 'from mythril.laser.smt.model import Model\n'), ((3622, 3652), 'typing.cast', 'cast', (['Tuple[Bool]', ... |
import numpy as np
import pytest
from gtd.ml.vocab import SimpleVocab, SimpleEmbeddings
@pytest.fixture
def vocab():
return SimpleVocab(['a', 'b', 'c'])
@pytest.fixture
def embeds(vocab):
array = np.eye(len(vocab))
return SimpleEmbeddings(array, vocab)
class TestSimpleVocab(object):
def test_save... | [
"gtd.ml.vocab.SimpleVocab.load",
"gtd.ml.vocab.SimpleEmbeddings",
"gtd.ml.vocab.SimpleVocab"
] | [((131, 159), 'gtd.ml.vocab.SimpleVocab', 'SimpleVocab', (["['a', 'b', 'c']"], {}), "(['a', 'b', 'c'])\n", (142, 159), False, 'from gtd.ml.vocab import SimpleVocab, SimpleEmbeddings\n'), ((239, 269), 'gtd.ml.vocab.SimpleEmbeddings', 'SimpleEmbeddings', (['array', 'vocab'], {}), '(array, vocab)\n', (255, 269), False, 'f... |
# Import a library related to my test called unittest
import unittest
from pandas import DataFrame
from lambdata.assi import add_state_names_column
class TestAssi(unittest.TestCase):
def test_assi(self):
df = DataFrame({"abbrev": ["CA", "CO", "CT", "DC", "TX"]})
self.assertEqual(len(df.col... | [
"unittest.main",
"lambdata.assi.add_state_names_column",
"pandas.DataFrame"
] | [((774, 789), 'unittest.main', 'unittest.main', ([], {}), '()\n', (787, 789), False, 'import unittest\n'), ((231, 284), 'pandas.DataFrame', 'DataFrame', (["{'abbrev': ['CA', 'CO', 'CT', 'DC', 'TX']}"], {}), "({'abbrev': ['CA', 'CO', 'CT', 'DC', 'TX']})\n", (240, 284), False, 'from pandas import DataFrame\n'), ((471, 49... |
"""
Here I am going to convert array to image from it's pixel value and put those images in their respective directory for
both in train and test set.
train set -------> [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
test set -------> [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
"""
# Import requi... | [
"os.mkdir",
"os.getcwd",
"cv2.imwrite",
"numpy.asarray",
"os.path.join",
"os.listdir"
] | [((841, 852), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (850, 852), False, 'import os\n'), ((1457, 1488), 'os.path.join', 'os.path.join', (['parent_dir', 'label'], {}), '(parent_dir, label)\n', (1469, 1488), False, 'import os\n'), ((1644, 1666), 'os.listdir', 'os.listdir', (['parent_dir'], {}), '(parent_dir)\n', (165... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, bizmap technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
# lst = []
# for i in frappe.get_all('Task',filters,['asset']):
# lst.append(i.asset)
# return [(d,) for d in lst]
... | [
"frappe.whitelist"
] | [((322, 340), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (338, 340), False, 'import frappe\n')] |
import pytest
from icevision.all import *
@pytest.fixture
def dummy_class_map():
return ClassMap(["dummy-1", "dummy-2"], background=None)
@pytest.fixture
def dummy_class_map_elaborate():
return ClassMap(["dummy-1", "dummy-2", "dummy-3", "dummy-4"], background=None)
def test_classification_multilabel(dummy... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((645, 696), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""label_ids"""', '[[0, 1], [0]]'], {}), "('label_ids', [[0, 1], [0]])\n", (668, 696), False, 'import pytest\n'), ((1405, 1467), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""label_ids"""', '[[0, 1, 2], [0, 1], [0]]'], {}), "('label_id... |
from .models import * # Change as necessary
from django.forms import ModelForm
from django import forms
class TodoListForm(ModelForm):
class Meta:
model = Cabecera
exclude =('trabajador',)
widgets = {
'codigo': forms.TextInput(attrs={'class': 'form-control'}),
'distribuidor': forms.Select(attr... | [
"django.forms.NumberInput",
"django.forms.TextInput",
"django.forms.Select"
] | [((233, 281), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (248, 281), False, 'from django import forms\n'), ((303, 348), 'django.forms.Select', 'forms.Select', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-cont... |
import pandas as pd
import datetime
import json
def parse_txt_report(path: str, path_tpl:str, separators: tuple = (':', ',')):
report = {}
with open(path) as file:
tpl = pd.read_csv(path_tpl)
for row in tpl['predicted_class']:
report.update({row: []})
for line in file:
... | [
"pandas.read_csv",
"datetime.datetime.now",
"json.dumps"
] | [((187, 208), 'pandas.read_csv', 'pd.read_csv', (['path_tpl'], {}), '(path_tpl)\n', (198, 208), True, 'import pandas as pd\n'), ((1057, 1075), 'json.dumps', 'json.dumps', (['report'], {}), '(report)\n', (1067, 1075), False, 'import json\n'), ((1456, 1480), 'json.dumps', 'json.dumps', (['short_report'], {}), '(short_rep... |
import argparse
import numpy as np
from astropy.io import fits
from numba import jit
class DragonPedestal:
n_pixels = 7
roisize = 40
size4drs = 4*1024
high_gain = 0
low_gain = 1
def __init__(self):
self.first_capacitor = np.zeros((2, 8))
self.meanped = np.zeros((2, self.n_pixe... | [
"numpy.zeros",
"numba.jit"
] | [((1068, 1086), 'numba.jit', 'jit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (1071, 1086), False, 'from numba import jit\n'), ((2238, 2254), 'numpy.zeros', 'np.zeros', (['(2, 8)'], {}), '((2, 8))\n', (2246, 2254), True, 'import numpy as np\n'), ((256, 272), 'numpy.zeros', 'np.zeros', (['(2, 8)'], {}), '((2, 8... |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-Headless',
version=get_versio... | [
"re.findall",
"setuptools.find_packages"
] | [((181, 228), 're.findall', 're.findall', (['"""__([a-z]+)__ = \'([^\']+)\'"""', 'content'], {}), '("__([a-z]+)__ = \'([^\']+)\'", content)\n', (191, 228), False, 'import re\n'), ((588, 631), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'tests.*']"}), "(exclude=['tests', 'tests.*'])\n", (601... |
#TODO: move this to pioneer.das.acquisition
from pioneer.das.api import platform
try:
import folium #pip3 install folium
except:
pass
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import tqdm
import utm
def easting_northing_from_lat_long(latitude, longitude):
easting, northing, ... | [
"utm.from_latlon",
"numpy.zeros_like",
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.maximum",
"numpy.minimum",
"numpy.std",
"numpy.copy",
"pioneer.das.api.platform.Platform",
"numpy.diff",
"numpy.array",
"numpy.mean",
"folium.Map",
"folium.PolyLine",
"matplotlib.pyplot.subplots"
] | [((327, 363), 'utm.from_latlon', 'utm.from_latlon', (['latitude', 'longitude'], {}), '(latitude, longitude)\n', (342, 363), False, 'import utm\n'), ((455, 471), 'numpy.diff', 'np.diff', (['easting'], {}), '(easting)\n', (462, 471), True, 'import numpy as np\n'), ((482, 499), 'numpy.diff', 'np.diff', (['northing'], {}),... |
import os.path as osp
import numpy as np
import mmcv
from . import XMLDataset
from .builder import DATASETS
import xml.etree.ElementTree as ET
from PIL import Image
@DATASETS.register_module()
class LogosDataset(XMLDataset):
def load_annotations(self, ann_file):
"""Load annotation from XML style ann_... | [
"xml.etree.ElementTree.parse",
"PIL.Image.open",
"numpy.arange",
"mmcv.list_from_file",
"os.path.join"
] | [((578, 607), 'mmcv.list_from_file', 'mmcv.list_from_file', (['ann_file'], {}), '(ann_file)\n', (597, 607), False, 'import mmcv\n'), ((1875, 1901), 'numpy.arange', 'np.arange', (['(0.5)', '(0.96)', '(0.05)'], {}), '(0.5, 0.96, 0.05)\n', (1884, 1901), True, 'import numpy as np\n'), ((712, 769), 'os.path.join', 'osp.join... |
import json
import random
import unittest
from model.position import Position
class PositionTest(unittest.TestCase):
def test_given_a_position_then_it_is_serializable(self):
x = random.randint(1, 100)
y = random.randint(1, 100)
z = random.randint(1, 100)
expected_json = {
... | [
"random.randint",
"model.position.Position"
] | [((193, 215), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (207, 215), False, 'import random\n'), ((228, 250), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (242, 250), False, 'import random\n'), ((263, 285), 'random.randint', 'random.randint', (['(1)', '(100)'],... |
import os
from collections import OrderedDict, MutableMapping, MutableSequence
from operator import itemgetter, attrgetter
from copy import deepcopy
import xmltodict
TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.2draft"
xmlns:viz="http://www.gexf.net/1.1draft/viz"
... | [
"os.path.realpath",
"operator.attrgetter",
"xmltodict.unparse",
"xmltodict.parse",
"collections.OrderedDict"
] | [((1811, 1833), 'os.path.realpath', 'os.path.realpath', (['path'], {}), '(path)\n', (1827, 1833), False, 'import os\n'), ((1984, 2004), 'xmltodict.parse', 'xmltodict.parse', (['xml'], {}), '(xml)\n', (1999, 2004), False, 'import xmltodict\n'), ((2774, 2821), 'xmltodict.unparse', 'xmltodict.unparse', (['self.clean_tree'... |
from typing import Callable, Any, List
from machin.parallel.distributed import (
get_world, get_cur_name
)
from machin.parallel.server import (
PushPullGradServerImpl,
PushPullModelServerImpl
)
from torch.optim import Adam
def grad_server_helper(model_creators: List[Callable],
optim... | [
"machin.parallel.distributed.get_cur_name",
"machin.parallel.distributed.get_world"
] | [((1275, 1286), 'machin.parallel.distributed.get_world', 'get_world', ([], {}), '()\n', (1284, 1286), False, 'from machin.parallel.distributed import get_world, get_cur_name\n'), ((2780, 2791), 'machin.parallel.distributed.get_world', 'get_world', ([], {}), '()\n', (2789, 2791), False, 'from machin.parallel.distributed... |
"""
Module for locating and accessing [[https://takeout.google.com][Google Takeout]] data
"""
from dataclasses import dataclass
from typing import Optional
from my.config import google as user_config
from ..core.common import Paths
@dataclass
class google(user_config):
# directory to unzipped takeout data
... | [
"warnings.warn",
"pathlib.Path"
] | [((1595, 1720), 'warnings.warn', 'warnings.warn', (['f"""Theres a new takeout at {new_takeouts[0]}, run ./scripts/unzip_google_takeout to update the data!"""'], {}), "(\n f'Theres a new takeout at {new_takeouts[0]}, run ./scripts/unzip_google_takeout to update the data!'\n )\n", (1608, 1720), False, 'import warni... |
import re
from datetime import date
import boundaries
boundaries.register('Toronto wards (2010)',
singular='Toronto ward',
domain='Toronto, ON',
last_updated=date(2018, 1, 16),
name_func=boundaries.attr('NAME'),
id_func=lambda f: re.sub(r'\A0', '', f.get('SCODE_NAME')),
authority='City of Toro... | [
"boundaries.attr",
"datetime.date"
] | [((172, 189), 'datetime.date', 'date', (['(2018)', '(1)', '(16)'], {}), '(2018, 1, 16)\n', (176, 189), False, 'from datetime import date\n'), ((205, 228), 'boundaries.attr', 'boundaries.attr', (['"""NAME"""'], {}), "('NAME')\n", (220, 228), False, 'import boundaries\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-11-08 04:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('guides', '0015_auto_20200220_1619'),
]
operations = [
migrations.AddField(... | [
"django.db.models.CharField"
] | [((407, 549), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('YES', 'Yes'), ('NO', 'No')]", 'default': '"""NO"""', 'max_length': '(32)', 'verbose_name': '"""Will you be attending the next IETF?"""'}), "(choices=[('YES', 'Yes'), ('NO', 'No')], default='NO',\n max_length=32, verbose_name='Will y... |
from obb.models.platform import Platform, Train
from django.shortcuts import get_object_or_404
from obb.serializers.serializers import PlatformSerializer
from rest_framework import viewsets
from rest_framework.response import Response
class PlatformViewSet(viewsets.ViewSet):
def list(self, request):
quer... | [
"obb.models.platform.Train.objects.all",
"obb.models.platform.Platform.objects.get",
"obb.serializers.serializers.PlatformSerializer",
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response",
"obb.models.platform.Platform.objects.all",
"obb.models.platform.Platform"
] | [((327, 349), 'obb.models.platform.Platform.objects.all', 'Platform.objects.all', ([], {}), '()\n', (347, 349), False, 'from obb.models.platform import Platform, Train\n'), ((371, 410), 'obb.serializers.serializers.PlatformSerializer', 'PlatformSerializer', (['queryset'], {'many': '(True)'}), '(queryset, many=True)\n',... |
import csv
import os
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
#from sklearn.neighbors import NearestNeighbors
from path import Path
from vector_math import *
from find_matches import *
import search_matches
#********************
#**** this compares two sets of an... | [
"search_matches.match_angles",
"matplotlib.pyplot.show",
"numpy.amin",
"numpy.subtract",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"numpy.amax",
"matplotlib.pyplot.figure",
"search_matches.max_distance_between_segments",
"numpy.... | [((1257, 1353), 'search_matches.match_angles', 'search_matches.match_angles', (['path1_angles', 'path2_angles', 'angle_tolerance', 'distance_tolerance'], {}), '(path1_angles, path2_angles, angle_tolerance,\n distance_tolerance)\n', (1284, 1353), False, 'import search_matches\n'), ((9746, 9784), 'numpy.array', 'np.ar... |
from matplotlib import pyplot as plt
from fastai.callback import Callback
from fastai.callbacks import hook_output
def request_lr(learn, **kwargs):
learn.lr_find(**kwargs)
learn.recorder.plot()#suggestion=False
plt.show()
return float(input('Select LR: '))
def auto_lr(learn, **kwargs):
learn.lr_fi... | [
"fastai.callbacks.hook_output",
"matplotlib.pyplot.show"
] | [((224, 234), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (232, 234), True, 'from matplotlib import pyplot as plt\n'), ((1131, 1150), 'fastai.callbacks.hook_output', 'hook_output', (['module'], {}), '(module)\n', (1142, 1150), False, 'from fastai.callbacks import hook_output\n')] |
import asyncio
import discord
from discord.ext import commands
from crimsobot.bot import CrimsoBOT
from crimsobot.utils import tarot
from crimsobot.utils import tools as c
from crimsobot.utils.tarot import Deck, Suit
class Mystery(commands.Cog):
def __init__(self, bot: CrimsoBOT):
self.bot = bot
@c... | [
"crimsobot.utils.tarot.command",
"discord.File",
"crimsobot.utils.tarot.reading",
"crimsobot.utils.tarot.Deck.get_card",
"discord.ext.commands.cooldown",
"discord.ext.commands.group",
"crimsobot.utils.tarot.Deck.get_cards_in_suit"
] | [((319, 411), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)', 'brief': '"""Delve into the mysteries of tarot."""'}), "(invoke_without_command=True, brief=\n 'Delve into the mysteries of tarot.')\n", (333, 411), False, 'from discord.ext import commands\n'), ((1091, 1147), 'cr... |
from flask import jsonify, redirect, request, session
from . import middle
import requests, os
from urllib.parse import unquote, quote
@middle.route('/ebay/get_token', methods=['POST', 'GET'])
def ebay_auth():
url = os.environ.get('EBAY_RUNAME')
return redirect(url)
@middle.route('/ebay/get_token/response... | [
"flask.redirect",
"flask.request.headers.get",
"os.environ.get",
"flask.jsonify",
"requests.get",
"requests.post"
] | [((223, 252), 'os.environ.get', 'os.environ.get', (['"""EBAY_RUNAME"""'], {}), "('EBAY_RUNAME')\n", (237, 252), False, 'import requests, os\n'), ((264, 277), 'flask.redirect', 'redirect', (['url'], {}), '(url)\n', (272, 277), False, 'from flask import jsonify, redirect, request, session\n'), ((898, 908), 'flask.jsonify... |
import os
import glob
from shutil import copy2
from PIL import Image
import json
import numpy as np
import argparse
import shutil
from skimage import io
from tqdm import tqdm
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
eli... | [
"json.dump",
"shutil.copytree",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.median",
"os.path.basename",
"os.path.exists",
"os.path.isfile",
"numpy.where",
"numpy.array",
"os.rmdir",
"os.symlink",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((558, 577), 'os.path.exists', 'os.path.exists', (['dst'], {}), '(dst)\n', (572, 577), False, 'import os\n'), ((605, 630), 'shutil.copytree', 'shutil.copytree', (['src', 'dst'], {}), '(src, dst)\n', (620, 630), False, 'import shutil\n'), ((696, 717), 'os.listdir', 'os.listdir', (['inst_root'], {}), '(inst_root)\n', (7... |
import kfp.dsl as dsl
import json
import kfp.components as comp
from collections import OrderedDict
from kubernetes import client as k8s_client
def create_matrix(d1: int, d2: int):
pipeline_parameters_block = '''
d1 = {}
d2 = {}
'''.format(d1, d2)
block1 = '''
import numpy as np
'''
... | [
"kubernetes.client.V1SecurityContext",
"kale.utils.kfp_utils.update_uimetadata",
"kale.utils.kfp_utils.generate_run_name",
"json.dumps",
"kfp.compiler.Compiler",
"kfp.Client",
"kfp.components.func_to_container_op",
"kale.utils.jupyter_utils.run_code",
"kfp.dsl.VolumeOp",
"collections.OrderedDict",... | [((2764, 2804), 'kfp.components.func_to_container_op', 'comp.func_to_container_op', (['create_matrix'], {}), '(create_matrix)\n', (2789, 2804), True, 'import kfp.components as comp\n'), ((2823, 2860), 'kfp.components.func_to_container_op', 'comp.func_to_container_op', (['sum_matrix'], {}), '(sum_matrix)\n', (2848, 2860... |
from . import argv
import os
import sys
import json
import csv
from . import dlprof_parser
from .show_gpu_info import show_gpu
from .profiling_command import *
def to_dict(result):
tmp = dict()
tmp["summary"] = list()
for i in result:
tmp["summary"].append(
i.to_dict()
)
re... | [
"csv.writer",
"json.dump",
"os.system"
] | [((1087, 1111), 'os.system', 'os.system', (['"""rm -rf log/"""'], {}), "('rm -rf log/')\n", (1096, 1111), False, 'import os\n'), ((514, 564), 'json.dump', 'json.dump', (['result', 'f'], {'ensure_ascii': '(False)', 'indent': '(4)'}), '(result, f, ensure_ascii=False, indent=4)\n', (523, 564), False, 'import json\n'), ((1... |
"""
PHD2 guider helper
"""
from thirdparty.phd2guider import Guider as PHD2Guider
class GuiderHelper:
guider = None
def connect(self, hostname="localhost"):
if self.guider is None:
self.guider = PHD2Guider(hostname)
self.guider.Connect()
def disconnect(self):
if... | [
"thirdparty.phd2guider.Guider"
] | [((228, 248), 'thirdparty.phd2guider.Guider', 'PHD2Guider', (['hostname'], {}), '(hostname)\n', (238, 248), True, 'from thirdparty.phd2guider import Guider as PHD2Guider\n')] |
from django.core import serializers
from django.db import connection
from psycopg2 import sql
def reset_primary_key_index(table, col='id'):
"""Sets the postgres primary key index to one larger than max"""
query = sql.SQL(
'''SELECT setval(
pg_get_serial_sequence(%(table)s, %(col)s),
... | [
"django.core.serializers.deserialize",
"psycopg2.sql.SQL",
"django.db.connection.cursor",
"psycopg2.sql.Identifier"
] | [((463, 482), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (480, 482), False, 'from django.db import connection\n'), ((224, 374), 'psycopg2.sql.SQL', 'sql.SQL', (['"""SELECT setval(\n pg_get_serial_sequence(%(table)s, %(col)s),\n coalesce(max({col}), 1)\n ) FROM {table}... |
# Copyright 2006-2012 <NAME>
""" Version of Binner class that works with sqlalchemy
"""
from .rangeFinder import Binner
from sqlalchemy import and_, or_
class BinnerSA(Binner):
"""generate sqlalchemy query to find overlapping ranges using bin numbers"""
@staticmethod
def getOverlappingSqlExpr(seqCol, binC... | [
"sqlalchemy.and_",
"sqlalchemy.or_"
] | [((862, 873), 'sqlalchemy.or_', 'or_', (['*parts'], {}), '(*parts)\n', (865, 873), False, 'from sqlalchemy import and_, or_\n'), ((751, 793), 'sqlalchemy.and_', 'and_', (['(binCol >= bins[0])', '(binCol <= bins[1])'], {}), '(binCol >= bins[0], binCol <= bins[1])\n', (755, 793), False, 'from sqlalchemy import and_, or_\... |
import torch
import scipy.fft
import numpy as np
from functools import lru_cache
@lru_cache()
def compute_dct_mat(n: int, device: str, dtype: torch.dtype) -> torch.Tensor:
m = scipy.fft.dct(np.eye(n), norm="ortho")
return torch.tensor(m, device=device, dtype=dtype)
@lru_cache()
def compute_idct_mat(n: int, ... | [
"torch.einsum",
"functools.lru_cache",
"numpy.eye",
"torch.tensor"
] | [((84, 95), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (93, 95), False, 'from functools import lru_cache\n'), ((279, 290), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (288, 290), False, 'from functools import lru_cache\n'), ((232, 275), 'torch.tensor', 'torch.tensor', (['m'], {'device': 'device', '... |
# -*- coding: utf-8 -*-
'''
Source:
https://github.com/yangaound/xmlutil
Created on 2016年12月24日
@author: albin
'''
import re
import abc
import itertools
from collections import defaultdict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import petl
try:
... | [
"xml.etree.ElementTree.parse",
"collections.defaultdict",
"itertools.chain",
"petl.empty",
"ordereddict.OrderedDict",
"re.sub",
"petl.fromdicts",
"re.compile"
] | [((525, 543), 're.compile', 're.compile', (['"""{.+}"""'], {}), "('{.+}')\n", (535, 543), False, 'import re\n'), ((812, 854), 're.sub', 're.sub', (['namespace_pattern', '""""""', 'element.tag'], {}), "(namespace_pattern, '', element.tag)\n", (818, 854), False, 'import re\n'), ((7159, 7171), 'petl.empty', 'petl.empty', ... |
import os
from os.path import join, dirname
from dotenv import load_dotenv
from pymongo import MongoClient
import pymysql.cursors
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
client = MongoClient('localhost', 27017, username='admin', password="<PASSWORD>")
sql_client = lambda db: pymysql.co... | [
"dotenv.load_dotenv",
"os.path.dirname",
"pymongo.MongoClient"
] | [((177, 201), 'dotenv.load_dotenv', 'load_dotenv', (['dotenv_path'], {}), '(dotenv_path)\n', (188, 201), False, 'from dotenv import load_dotenv\n'), ((212, 284), 'pymongo.MongoClient', 'MongoClient', (['"""localhost"""', '(27017)'], {'username': '"""admin"""', 'password': '"""<PASSWORD>"""'}), "('localhost', 27017, use... |
import os
import errno
import sys
from pyswip import Prolog
# function for reducing a topology to a term "l(type,dir,term1,term2)"
def reduce(outputFile):
# load Prolog program "reducer"
prolog = Prolog()
prolog.consult("prolog/reducer.pl")
# check well-formedness
violating = list(prolog.query("vi... | [
"os.mkdir",
"pyswip.Prolog"
] | [((205, 213), 'pyswip.Prolog', 'Prolog', ([], {}), '()\n', (211, 213), False, 'from pyswip import Prolog\n'), ((1253, 1271), 'os.mkdir', 'os.mkdir', (['"""output"""'], {}), "('output')\n", (1261, 1271), False, 'import os\n')] |
import os
import shutil
import datetime
from pylokit import Office
from wand.image import Image
from tempfile import NamedTemporaryFile, TemporaryDirectory
from rq import get_current_job
from docsbox import app, rq
from docsbox.docs.utils import make_zip_archive, make_thumbnails
@rq.job(timeout=app.config["REDIS_... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"tempfile.TemporaryDirectory",
"docsbox.docs.utils.make_zip_archive",
"pylokit.Office",
"wand.image.Image",
"datetime.timedelta",
"docsbox.rq.job",
"rq.get_current_job",
"docsbox.docs.utils.make_thumbnails",
"os.path.join"
] | [((287, 334), 'docsbox.rq.job', 'rq.job', ([], {'timeout': "app.config['REDIS_JOB_TIMEOUT']"}), "(timeout=app.config['REDIS_JOB_TIMEOUT'])\n", (293, 334), False, 'from docsbox import app, rq\n'), ((525, 572), 'docsbox.rq.job', 'rq.job', ([], {'timeout': "app.config['REDIS_JOB_TIMEOUT']"}), "(timeout=app.config['REDIS_J... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('apps.consultants.views',
url(r'^maillist/$', 'maillist', name='maillist'),
url(r'^vcf/$', 'vcf', name='vcf'),
url(r'^maillist/(?P<team_id>[0-9]{2}|(tl))/$', 'maillist', name='maillist'),
)
| [
"django.conf.urls.url"
] | [((106, 153), 'django.conf.urls.url', 'url', (['"""^maillist/$"""', '"""maillist"""'], {'name': '"""maillist"""'}), "('^maillist/$', 'maillist', name='maillist')\n", (109, 153), False, 'from django.conf.urls import patterns, include, url\n'), ((160, 192), 'django.conf.urls.url', 'url', (['"""^vcf/$"""', '"""vcf"""'], {... |
import asyncio
from helpers import get_db
import importlib
import json
import logging
import sys
from datetime import datetime
from os import path
from queue import Queue
import requests
from alive_progress import alive_bar
from checkEp import check_episode
dir = path.split(path.abspath(__file__))[0]
# logging setu... | [
"os.path.abspath",
"json.loads",
"importlib.import_module",
"logging.warning",
"logging.StreamHandler",
"checkEp.check_episode",
"datetime.datetime.now",
"os.path.isfile",
"requests.get",
"logging.critical",
"helpers.get_db",
"queue.Queue",
"sys.exit"
] | [((322, 345), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (343, 345), False, 'import logging\n'), ((837, 870), 'logging.warning', 'logging.warning', (['f"""Years={years}"""'], {}), "(f'Years={years}')\n", (852, 870), False, 'import logging\n'), ((2347, 2380), 'importlib.import_module', 'importli... |
import requests
from lxml import html
import pandas as pd
import datetime
from lxml import etree
import google.cloud.storage
import re
from google.cloud import bigquery
import html as hhhh
from functools import reduce
def scrapping(article):
r1 = requests.get('https://www.semana.com{}'.format(artic... | [
"pandas.DataFrame",
"google.cloud.bigquery.Client",
"datetime.datetime.now",
"lxml.html.fromstring",
"datetime.datetime.utcnow",
"requests.get",
"lxml.etree.tostring",
"re.sub"
] | [((337, 364), 'lxml.html.fromstring', 'html.fromstring', (['r1.content'], {}), '(r1.content)\n', (352, 364), False, 'from lxml import html\n'), ((444, 489), 'lxml.etree.tostring', 'etree.tostring', (['content[0]'], {'pretty_print': '(True)'}), '(content[0], pretty_print=True)\n', (458, 489), False, 'from lxml import et... |