code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import re
from django.conf import settings
from django.template import loader
from django.contrib.sites.models import Site
def send_welcome_mail(user=None):
current_site = Site.objects.get_current()
site_name = current_site.name
domain = current_site.domain
site = 'https://' + domain
c = {
... | [
"django.contrib.sites.models.Site.objects.get_current",
"django.template.loader.render_to_string",
"re.compile"
] | [((179, 205), 'django.contrib.sites.models.Site.objects.get_current', 'Site.objects.get_current', ([], {}), '()\n', (203, 205), False, 'from django.contrib.sites.models import Site\n'), ((719, 768), 'django.template.loader.render_to_string', 'loader.render_to_string', (['subject_template_name', 'c'], {}), '(subject_tem... |
import argparse
from .. import load_graph_data
from ..train import train_and_eval
from ..train import register_general_args
from .gresnet import GCN_GResNet
from .gresnet import GAT_GResNet
def gresnet_model_fn(args, data):
if args.base_conv == 'gcn':
return GCN_GResNet(data.graph,
ar... | [
"argparse.ArgumentParser"
] | [((1724, 1770), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""GResNet"""'}), "(description='GResNet')\n", (1747, 1770), False, 'import argparse\n')] |
# -*- coding: utf-8 -*-
import yurlungur
from yurlungur.core.app import application
from yurlungur.core import env
class MultiObject(object):
"""
command wrapper for any application
"""
if env.Photoshop():
from yurlungur.adapters import photoshop as ps
doc = ps.Document()._doc
if ... | [
"yurlungur.adapters.unreal.GetEditorAssetLibrary",
"yurlungur.core.env.Max",
"yurlungur.core.env.Maya",
"yurlungur.core.env.Unity",
"yurlungur.core.env.Davinci",
"yurlungur.adapters.unreal.execute_console_command",
"yurlungur.adapters.unreal.EditorUtil",
"yurlungur.core.env.Substance",
"inspect.getm... | [((207, 222), 'yurlungur.core.env.Photoshop', 'env.Photoshop', ([], {}), '()\n', (220, 222), False, 'from yurlungur.core import env\n'), ((320, 332), 'yurlungur.core.env.Unreal', 'env.Unreal', ([], {}), '()\n', (330, 332), False, 'from yurlungur.core import env\n'), ((550, 561), 'yurlungur.core.env.Unity', 'env.Unity',... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 23 14:46:16 2020
@author: pkk24
"""
import unittest
import numpy as np
import pickle
import os
from spore import mmv_models, mmv_utils
class TestMMVPsetup(unittest.TestCase):
def test_signal_gen(self):
N, D, k, lamTot, initSeed = 20, 1000, 3, 5, 1
... | [
"unittest.main",
"spore.mmv_models.LinearGaussianFixedDiagonalCovariance",
"os.remove",
"spore.mmv_models.LinearWithScalingVarianceGaussianNoise",
"numpy.allclose",
"spore.mmv_models.PhiUniform",
"numpy.zeros",
"numpy.ones",
"spore.mmv_utils.MMVP",
"pickle.load",
"numpy.mean",
"numpy.all"
] | [((5548, 5563), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5561, 5563), False, 'import unittest\n'), ((337, 390), 'spore.mmv_utils.MMVP', 'mmv_utils.MMVP', (['N', 'D', 'k', 'lamTot'], {'initialSeed': 'initSeed'}), '(N, D, k, lamTot, initialSeed=initSeed)\n', (351, 390), False, 'from spore import mmv_models, m... |
import os
import shutil
from datetime import datetime
from absl import app
from absl import flags
from src.trainer import Trainer
from src.utils import load_config
EXPERIMENT_PATH = "experiments"
EXPERIMENT_CONFIG_NAME = "config.yml"
FLAGS = flags.FLAGS
flags.DEFINE_string(
"experiment_name",
"",
"Expe... | [
"os.makedirs",
"shutil.copy2",
"src.utils.load_config",
"datetime.datetime.now",
"absl.flags.DEFINE_string",
"src.trainer.Trainer",
"absl.app.run",
"os.path.join"
] | [((259, 402), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""experiment_name"""', '""""""', '"""Experiment name: experiment outputs will be saved in a created experiment name directory"""'], {}), "('experiment_name', '',\n 'Experiment name: experiment outputs will be saved in a created experiment name dire... |
"""
act.retrievals.irt
------------------
Modules for converting irt temperatures and radiances
"""
import dask
import xarray as xr
import numpy as np
from scipy.optimize import brentq
from act.utils.radiance_utils import planck_converter
def irt_response_function():
"""
Function to return the wavenumber a... | [
"numpy.nansum",
"dask.delayed",
"scipy.optimize.brentq",
"numpy.asarray",
"numpy.isnan",
"numpy.array",
"dask.compute",
"act.utils.radiance_utils.planck_converter"
] | [((629, 4949), 'numpy.array', 'np.array', (['[847.133, 847.615, 848.097, 848.579, 849.061, 849.543, 850.026, 850.508, \n 850.99, 851.472, 851.954, 852.436, 852.918, 853.401, 853.883, 854.365, \n 854.847, 855.329, 855.811, 856.293, 856.776, 857.258, 857.74, 858.222, \n 858.704, 859.186, 859.668, 860.151, 860.63... |
#!/usr/bin/python3
from pythonping import ping
from prometheus_client import start_http_server, Histogram
from backend.pinger.setInterval import setInterval
target = ''
h = Histogram('ping_latency_miliseconds', 'Time it takes to get a ping reponse for target')
def set_interval(func, sec):
def func_wrapper():
... | [
"pythonping.ping",
"prometheus_client.Histogram",
"backend.pinger.setInterval.setInterval"
] | [((175, 266), 'prometheus_client.Histogram', 'Histogram', (['"""ping_latency_miliseconds"""', '"""Time it takes to get a ping reponse for target"""'], {}), "('ping_latency_miliseconds',\n 'Time it takes to get a ping reponse for target')\n", (184, 266), False, 'from prometheus_client import start_http_server, Histog... |
"""
Encryption worker
"""
import logging
from ..utilities.cryptography import CryptoLayer
from ..utilities.address import Address
from ..utilities.status import Status
from ..utilities.data_indexes import SubprocessorIndex
_SubprocessorIndex = SubprocessorIndex()
logger = logging.Logger('workers.utim_worker_sign')
... | [
"logging.Logger"
] | [((276, 318), 'logging.Logger', 'logging.Logger', (['"""workers.utim_worker_sign"""'], {}), "('workers.utim_worker_sign')\n", (290, 318), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# odoo imports
from odoo import models
from odoo import fields
from odoo import api
from odoo import exceptions
# others imports
class HouseLocationType(models.Model):
_name = 'house.location.type'
_description = 'Property Type'
name = fields.Char(string="Property Type", require... | [
"odoo.exceptions.ValidationError",
"odoo.fields.Char"
] | [((277, 336), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Property Type"""', 'required': '(True)', 'help': '""""""'}), "(string='Property Type', required=True, help='')\n", (288, 336), False, 'from odoo import fields\n'), ((812, 876), 'odoo.exceptions.ValidationError', 'exceptions.ValidationError', (['f"""Ty... |
# ******************************************************
## Copyright 2019, PBL Netherlands Environmental Assessment Agency and Utrecht University.
## Reuse permitted under Gnu Public License, GPL v3.
# ******************************************************
import general_class
'''
Class with general species specific... | [
"general_class.General.__init__"
] | [((1475, 1511), 'general_class.General.__init__', 'general_class.General.__init__', (['self'], {}), '(self)\n', (1505, 1511), False, 'import general_class\n')] |
import sys
sys.path.append('ParseCAN')
import ParseCAN
from common import can_lib_h_path, templ, coord, ifndef, endif, frame_handler
def write_declare(frame, name_prepends, fw):
tot_name = coord(name_prepends, frame.name, prefix=False)
fw (
'CANlib_Transmit_Error_T CANlib_Transmit_{}'.format(tot_name)... | [
"sys.path.append",
"common.ifndef",
"common.endif",
"common.frame_handler",
"common.coord"
] | [((11, 38), 'sys.path.append', 'sys.path.append', (['"""ParseCAN"""'], {}), "('ParseCAN')\n", (26, 38), False, 'import sys\n'), ((195, 241), 'common.coord', 'coord', (['name_prepends', 'frame.name'], {'prefix': '(False)'}), '(name_prepends, frame.name, prefix=False)\n', (200, 241), False, 'from common import can_lib_h_... |
from reportlab.lib import colors
black = colors.Color(48 / 255, 48 / 255, 48 / 255)
lightgrey = colors.Color(220 / 255, 220 / 255, 220 / 255)
lightwhite = colors.Color(245 / 255, 245 / 255, 245 / 255)
yellow = colors.Color(229 / 255, 235 / 255, 52 / 255)
bleu = colors.Color(0.18, 0.33, 0.59)
bleuciel = colors.Color(0.... | [
"reportlab.lib.colors.Color"
] | [((42, 84), 'reportlab.lib.colors.Color', 'colors.Color', (['(48 / 255)', '(48 / 255)', '(48 / 255)'], {}), '(48 / 255, 48 / 255, 48 / 255)\n', (54, 84), False, 'from reportlab.lib import colors\n'), ((97, 142), 'reportlab.lib.colors.Color', 'colors.Color', (['(220 / 255)', '(220 / 255)', '(220 / 255)'], {}), '(220 / 2... |
from django.db import models
from django.contrib.auth.models import User
from enumfields import EnumIntegerField
from django.db.models.signals import post_save
from .enums import ClusterType, MemberType, SettingsType
import uuid
class Member(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.u... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"enumfields.EnumIntegerField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.UUIDField",
"django.d... | [((2244, 2289), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['create_member'], {'sender': 'User'}), '(create_member, sender=User)\n', (2261, 2289), False, 'from django.db.models.signals import post_save\n'), ((271, 341), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(Tr... |
# Copyright 2016 Canonical Limited.
#
# This file is part of charms.hardening.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope th... | [
"charms_hardening.utils.get_settings",
"charms_hardening.audits.file.DirectoryPermissionAudit"
] | [((997, 1021), 'charms_hardening.utils.get_settings', 'utils.get_settings', (['"""os"""'], {}), "('os')\n", (1015, 1021), False, 'from charms_hardening import utils\n'), ((1170, 1262), 'charms_hardening.audits.file.DirectoryPermissionAudit', 'DirectoryPermissionAudit', (['"""/etc/security/limits.d"""'], {'user': '"""ro... |
import tensorflow as tf
import numpy as np
import argparse
import gym
import pybullet_envs
import roboschool
from mvc.envs.wrappers import MuJoCoWrapper
from mvc.controllers.sac import SACController
from mvc.controllers.eval import EvalController
from mvc.models.networks.sac import SACNetwork, SACNetworkParams
from m... | [
"mvc.controllers.eval.EvalController",
"mvc.models.networks.sac.SACNetwork",
"tensorflow.train.Saver",
"argparse.ArgumentParser",
"gym.make",
"tensorflow.global_variables_initializer",
"mvc.controllers.sac.SACController",
"mvc.interaction.interact",
"tensorflow.Session",
"mvc.noise.EmptyNoise",
... | [((783, 1024), 'mvc.models.networks.sac.SACNetworkParams', 'SACNetworkParams', ([], {'fcs': 'args.layers', 'concat_index': 'args.concat_index', 'state_shape': 'env.observation_space.shape', 'num_actions': 'num_actions', 'gamma': 'args.gamma', 'tau': 'args.tau', 'pi_lr': 'args.pi_lr', 'v_lr': 'args.v_lr', 'q_lr': 'args.... |
import shapefile
import numpy as np
import matplotlib.pyplot as plt
import geopandas as gpd
import matplotlib
from shapely.geometry import Polygon
import pyproj
from shapely.geometry import Point
import matplotlib.path as mpltPath
from shapely.geometry.multipolygon import MultiPolygon
import xarray as xr
def explode_... | [
"numpy.meshgrid",
"numpy.zeros_like",
"xarray.Dataset",
"matplotlib.path.Path",
"geopandas.GeoDataFrame",
"numpy.where",
"numpy.array",
"geopandas.read_file"
] | [((367, 405), 'geopandas.GeoDataFrame', 'gpd.GeoDataFrame', ([], {'columns': 'indf.columns'}), '(columns=indf.columns)\n', (383, 405), True, 'import geopandas as gpd\n'), ((1216, 1239), 'numpy.meshgrid', 'np.meshgrid', (['lons', 'lats'], {}), '(lons, lats)\n', (1227, 1239), True, 'import numpy as np\n'), ((1529, 1545),... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import getdate, flt
def execute(filters=None):
if not filters: filters = {}
float_precision = fr... | [
"frappe.db.sql",
"frappe._",
"frappe.utils.flt",
"frappe.db.get_default"
] | [((318, 358), 'frappe.db.get_default', 'frappe.db.get_default', (['"""float_precision"""'], {}), "('float_precision')\n", (339, 358), False, 'import frappe\n'), ((2280, 2536), 'frappe.db.sql', 'frappe.db.sql', (['("""\n\t\tselect item_code, abs(sum(actual_qty)) as consumed_qty\n\t\tfrom `tabStock Ledger Entry`\n\t\twhe... |
#!/usr/bin/env python3
"""
max_sonar.py - convert analog stream into range measurements
Copyright (c) 2011 Vanadium Labs LLC. All right reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributi... | [
"rospy.Subscriber",
"rospy.Time.now",
"arbotix_msgs.srv.SetupChannelRequest",
"rospy.ServiceProxy",
"rospy.Publisher",
"rospy.spin",
"rospy.get_param",
"sensor_msgs.msg.Range",
"rospy.init_node",
"rospy.wait_for_service"
] | [((1875, 1903), 'rospy.init_node', 'rospy.init_node', (['"""max_sonar"""'], {}), "('max_sonar')\n", (1890, 1903), False, 'import rospy\n'), ((2010, 2057), 'rospy.wait_for_service', 'rospy.wait_for_service', (['"""arbotix/SetupAnalogIn"""'], {}), "('arbotix/SetupAnalogIn')\n", (2032, 2057), False, 'import rospy\n'), ((2... |
import binascii
import requests
from ethereum.utils import ecsign, normalize_key, int_to_big_endian, checksum_encode
from web3 import Web3, HTTPProvider
from ethereum.utils import sha3, is_string, encode_hex, checksum_encode
from trinity import GWEI_COEFFICIENT
from common.log import LOG
from random import randint
de... | [
"web3.Web3.soliditySha3",
"random.randint",
"binascii.hexlify",
"ethereum.utils.checksum_encode",
"web3.Web3.eth.account.decrypt",
"web3.HTTPProvider",
"requests.get",
"ethereum.utils.normalize_key"
] | [((466, 515), 'web3.Web3.eth.account.decrypt', 'Web3.eth.account.decrypt', (['encrypted_key', 'password'], {}), '(encrypted_key, password)\n', (490, 515), False, 'from web3 import Web3, HTTPProvider\n'), ((3751, 3789), 'web3.Web3.soliditySha3', 'Web3.soliditySha3', (['typeList', 'valueList'], {}), '(typeList, valueList... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import mechanize
import cookielib
from BeautifulSoup import BeautifulSoup as bsoup
import requests
br = mechanize.Browser()
# cookie jar
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.set_handle_equiv(True)
#br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.s... | [
"BeautifulSoup.BeautifulSoup",
"cookielib.LWPCookieJar",
"mechanize.Browser",
"requests.get",
"mechanize._http.HTTPRefreshProcessor"
] | [((149, 168), 'mechanize.Browser', 'mechanize.Browser', ([], {}), '()\n', (166, 168), False, 'import mechanize\n'), ((188, 212), 'cookielib.LWPCookieJar', 'cookielib.LWPCookieJar', ([], {}), '()\n', (210, 212), False, 'import cookielib\n'), ((394, 432), 'mechanize._http.HTTPRefreshProcessor', 'mechanize._http.HTTPRefre... |
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
@api_view(('GET',))
def workplace(request, format=None):
return Response({
'users': reverse('users:users', request=request, format=format),
'people': reverse('peop... | [
"rest_framework.reverse.reverse",
"rest_framework.decorators.api_view"
] | [((138, 156), 'rest_framework.decorators.api_view', 'api_view', (["('GET',)"], {}), "(('GET',))\n", (146, 156), False, 'from rest_framework.decorators import api_view\n'), ((233, 287), 'rest_framework.reverse.reverse', 'reverse', (['"""users:users"""'], {'request': 'request', 'format': 'format'}), "('users:users', requ... |
import unittest
import pandas as pd
from pymatgen.core import Structure, Lattice
from pymatgen.analysis.local_env import VoronoiNN, JmolNN, CrystalNN
from matminer.featurizers.site.misc import (
IntersticeDistribution,
CoordinationNumber,
)
from matminer.featurizers.site.tests.base import SiteFeaturizerTest
... | [
"unittest.main",
"pandas.DataFrame",
"pymatgen.analysis.local_env.VoronoiNN",
"pymatgen.analysis.local_env.JmolNN",
"matminer.featurizers.site.misc.IntersticeDistribution",
"matminer.featurizers.site.misc.CoordinationNumber.from_preset",
"matminer.featurizers.site.misc.CoordinationNumber",
"pymatgen.c... | [((7677, 7692), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7690, 7692), False, 'import unittest\n'), ((606, 653), 'pandas.DataFrame', 'pd.DataFrame', (["{'struct': [bcc_li], 'site': [1]}"], {}), "({'struct': [bcc_li], 'site': [1]})\n", (618, 653), True, 'import pandas as pd\n'), ((689, 713), 'matminer.featuri... |
# what is a dot product
# a = [1 ,2 ,3]
# b = [2, 3, 4]
# dot_product = a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
# print(dot_product)
import numpy as np
# inputs = [1, 2, 3, 2.5]
# weights = [0.2, 0.8, -0.5, 1.0]
# biases = 2
inputs = [1, 2, 3, 2.5]
weights = [
[0.2, 0.8, -0.5, 1.0],
[0.5, -0.91, 0.26, -0.5],
[-... | [
"numpy.dot"
] | [((382, 405), 'numpy.dot', 'np.dot', (['weights', 'inputs'], {}), '(weights, inputs)\n', (388, 405), True, 'import numpy as np\n')] |
import os
import netaddr
from flask import abort
from flask import jsonify
from flask import make_response
from flask import request
from app import app
from app import utils
@app.route('/')
def index():
return os.environ.get("MSG", "Hello, World!")
@app.route('/subnets', methods=['POST'])
def create_subnet():... | [
"app.app.route",
"app.utils.check_overlap",
"app.utils.read_cidrs",
"flask.request.args.get",
"app.utils.delete_cidr",
"app.utils.allocate_addr",
"app.utils.deallocate_addr",
"app.utils.save_cidr",
"app.utils.set_next_id",
"app.utils.get_next_id",
"flask.abort",
"os.environ.get",
"flask.json... | [((179, 193), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (188, 193), False, 'from app import app\n'), ((260, 299), 'app.app.route', 'app.route', (['"""/subnets"""'], {'methods': "['POST']"}), "('/subnets', methods=['POST'])\n", (269, 299), False, 'from app import app\n'), ((1010, 1048), 'app.app.route'... |
from argparse import ArgumentParser
import sys
import os
from sentiment.model import SentimentNet
def parse_arguments():
parser = ArgumentParser()
parser.add_argument(dest='MODEL',
help='Path to the pretrained model.')
parser.add_argument('-f', dest='FILE', default=None,
... | [
"sys.platform.startswith",
"sentiment.model.SentimentNet.load",
"os.system",
"argparse.ArgumentParser"
] | [((138, 154), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (152, 154), False, 'from argparse import ArgumentParser\n'), ((741, 770), 'sentiment.model.SentimentNet.load', 'SentimentNet.load', (['args.MODEL'], {}), '(args.MODEL)\n', (758, 770), False, 'from sentiment.model import SentimentNet\n'), ((806... |
import pytest
from app.main.helpers.dm_google_analytics import custom_dimension, CurrentProjectStageEnum
def test_custom_dimension_create_with_enum_instance():
dimension_dict = custom_dimension(CurrentProjectStageEnum, CurrentProjectStageEnum.AWARDED)
assert dimension_dict == {'data_id': 8, 'data_value': 'aw... | [
"app.main.helpers.dm_google_analytics.custom_dimension",
"pytest.raises"
] | [((184, 258), 'app.main.helpers.dm_google_analytics.custom_dimension', 'custom_dimension', (['CurrentProjectStageEnum', 'CurrentProjectStageEnum.AWARDED'], {}), '(CurrentProjectStageEnum, CurrentProjectStageEnum.AWARDED)\n', (200, 258), False, 'from app.main.helpers.dm_google_analytics import custom_dimension, CurrentP... |
import sys
import IceRayCpp
print( '********************' )
#print( IceRayCpp.__dict__ )
print( '********************' )
def print_string( P_string ):
sys.stdout.write( P_string )
def print_coord(P_cord):
sys.stdout.write( '(' + str( P_cord[0] ) + ', ' + str( P_cord[1] ) + ', ' + str( P_cord[2] )... | [
"sys.stdout.write",
"IceRayCpp.GeometrySimpleCylinder"
] | [((779, 813), 'IceRayCpp.GeometrySimpleCylinder', 'IceRayCpp.GeometrySimpleCylinder', ([], {}), '()\n', (811, 813), False, 'import IceRayCpp\n'), ((165, 191), 'sys.stdout.write', 'sys.stdout.write', (['P_string'], {}), '(P_string)\n', (181, 191), False, 'import sys\n'), ((369, 391), 'sys.stdout.write', 'sys.stdout.writ... |
# -*- coding: utf-8 -*-
from RSA.MyRSA import Rsa
import os
from RSA.MySigner import Signer
from config import *
import hashlib
import json
import requests
pk_path = "keys/public_key.pem"
sk_path = "keys/private_key.pem"
def main():
_rsa = Rsa()
## 将类Rsa中的_rsa导入,使用单例模式
if not (os.path.exists(pk_path) and ... | [
"requests.post",
"RSA.MyRSA.Rsa",
"os.path.exists",
"json.dumps"
] | [((246, 251), 'RSA.MyRSA.Rsa', 'Rsa', ([], {}), '()\n', (249, 251), False, 'from RSA.MyRSA import Rsa\n'), ((1125, 1156), 'requests.post', 'requests.post', (['url'], {'files': 'files'}), '(url, files=files)\n', (1138, 1156), False, 'import requests\n'), ((292, 315), 'os.path.exists', 'os.path.exists', (['pk_path'], {})... |
import os
import sys
import time
import numpy as np
import pytest
import ray
import ray.ray_constants as ray_constants
from ray.test_utils import get_other_nodes
@pytest.mark.parametrize(
"ray_start_cluster", [{
"num_cpus": 4,
"num_nodes": 3,
"do_init": True
}],
indirect=True)
de... | [
"ray.worker._global_node.kill_monitor",
"ray.worker._global_node.kill_plasma_store",
"ray.worker._global_node.kill_gcs_server",
"ray.worker._global_node.kill_raylet",
"ray.get",
"time.sleep",
"os.environ.get",
"pytest.main",
"ray.worker._global_node.kill_log_monitor",
"numpy.random.rand",
"pytes... | [((167, 283), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ray_start_cluster"""', "[{'num_cpus': 4, 'num_nodes': 3, 'do_init': True}]"], {'indirect': '(True)'}), "('ray_start_cluster', [{'num_cpus': 4, 'num_nodes': \n 3, 'do_init': True}], indirect=True)\n", (190, 283), False, 'import pytest\n'), ((28... |
import torch
import os
import pickle
import cv2
class DellyDataset(torch.utils.data.Dataset):
def __init__(self, condition_label_make = False, transform = None):
self.x = list()
self.y = list()
self.condition = list()
self.transform = transform
self.make()
for k in s... | [
"pickle.dump",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"cv2.waitKey",
"cv2.imread",
"pickle.load",
"cv2.arrowedLine",
"cv2.imshow",
"os.listdir"
] | [((918, 943), 'matplotlib.pyplot.hist', 'plt.hist', (['self.y'], {'bins': '(50)'}), '(self.y, bins=50)\n', (926, 943), True, 'import matplotlib.pyplot as plt\n'), ((952, 962), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (960, 962), True, 'import matplotlib.pyplot as plt\n'), ((1001, 1024), 'os.listdir', 'os... |
from tests.base_test_case import BaseTestCase
from radiotherm.thermostat import Thermostat
class TestConstructURL(BaseTestCase):
def test_with_ip(self):
tstat = Thermostat('192.168.0.2')
url = tstat._construct_url('/fake')
self.assertEqual(url, 'http://192.168.0.2/fake')
def test_with_... | [
"radiotherm.thermostat.Thermostat"
] | [((174, 199), 'radiotherm.thermostat.Thermostat', 'Thermostat', (['"""192.168.0.2"""'], {}), "('192.168.0.2')\n", (184, 199), False, 'from radiotherm.thermostat import Thermostat\n'), ((348, 385), 'radiotherm.thermostat.Thermostat', 'Thermostat', (['"""tstat.home.mydomain.org"""'], {}), "('tstat.home.mydomain.org')\n",... |
# This examples shows how to load several robots in panda3d_viewer.
# Note: this feature requires panda3d_viewer to be installed, this can be done using
# pip install --user panda3d_viewer
import pinocchio as pin
import sys
from os.path import dirname, join, abspath
# add path to the example-robot-data package
path ... | [
"sys.path.append",
"os.path.abspath",
"pinocchio.visualize.panda3d_visualizer.Panda3dVisualizer",
"panda3d_viewer.Viewer"
] | [((406, 427), 'sys.path.append', 'sys.path.append', (['path'], {}), '(path)\n', (421, 427), False, 'import sys\n'), ((716, 755), 'panda3d_viewer.Viewer', 'Viewer', ([], {'window_title': '"""python-pinocchio"""'}), "(window_title='python-pinocchio')\n", (722, 755), False, 'from panda3d_viewer import Viewer\n'), ((932, 9... |
# Copyright (c) 2014 <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 in writing, softwar... | [
"spdx.parsers.validations.validate_pkg_ext_ref_category",
"spdx.parsers.tagvaluebuilders.str_from_text",
"spdx.checksum.Algorithm",
"spdx.package.ExternalPackageRef",
"spdx.parsers.validations.validate_pkg_ext_ref_type",
"spdx.parsers.builderexceptions.CardinalityError",
"spdx.parsers.builderexceptions.... | [((1100, 1146), 're.compile', 're.compile', (['"""SPDX-(\\\\d+)\\\\.(\\\\d+)"""', 're.UNICODE'], {}), "('SPDX-(\\\\d+)\\\\.(\\\\d+)', re.UNICODE)\n", (1110, 1146), False, 'import re\n'), ((11352, 11403), 'spdx.parsers.validations.validate_pkg_ext_ref_category', 'validations.validate_pkg_ext_ref_category', (['category']... |
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget
from xu.compa.Parapluie import PResource, PFunction
def style() -> str:
return PResource.stylesheet()
def applyStyle(w: QWidget, stylePath: str = None):
if stylePath is None:
stylePath = style()
PFunction.applyStyle(w, stylePath)... | [
"xu.compa.Parapluie.PResource.stylesheet",
"xu.compa.Parapluie.PFunction.applyStyle"
] | [((152, 174), 'xu.compa.Parapluie.PResource.stylesheet', 'PResource.stylesheet', ([], {}), '()\n', (172, 174), False, 'from xu.compa.Parapluie import PResource, PFunction\n'), ((286, 320), 'xu.compa.Parapluie.PFunction.applyStyle', 'PFunction.applyStyle', (['w', 'stylePath'], {}), '(w, stylePath)\n', (306, 320), False,... |
import re
import pytest
from golem.core import test_parser
class TestFunctionBodyCode:
def test_function_body_code(self):
def function1():
pass
code = test_parser.function_body_code(function1)
assert code == ' pass\n'
def function2(param1,
... | [
"golem.core.test_parser._replace_re_pattern",
"golem.core.test_parser._replace_substrings",
"golem.core.test_parser.parse_function_steps",
"golem.core.test_parser._code_block_is_function_call",
"golem.core.test_parser._parse_function_call",
"golem.core.test_parser._split_code_into_blocks",
"pytest.mark.... | [((6246, 6300), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_string"""', 'function_calls'], {}), "('test_string', function_calls)\n", (6269, 6300), False, 'import pytest\n'), ((6720, 6778), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_string"""', 'not_function_calls'], {}), "('te... |
from typing import List, Dict
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.data.tokenizers import Token
from allennlp.models import Model
from allennlp.predictors.predictor import Predictor
import numpy as np
from many_tokeni... | [
"allennlp.data.tokenizers.Token",
"numpy.argmax"
] | [((721, 761), 'numpy.argmax', 'np.argmax', (["result['tag_logits']"], {'axis': '(-1)'}), "(result['tag_logits'], axis=-1)\n", (730, 761), True, 'import numpy as np\n'), ((1018, 1029), 'allennlp.data.tokenizers.Token', 'Token', (['char'], {}), '(char)\n', (1023, 1029), False, 'from allennlp.data.tokenizers import Token\... |
#! /usr/bin/python
import ck.kernel as ck
import copy
import re
# Framework tag.
framework_tag='kann'
# Platform tag.
platform_tag='kalray-emb02'
# Maximum number of images (> 1).
max_num_images=5
# Number of statistical repetitions.
num_repetitions=3
def do(i):
# Detect basic platform info.
ii={'action'... | [
"ck.kernel.out",
"copy.deepcopy",
"ck.kernel.access",
"ck.kernel.err"
] | [((391, 404), 'ck.kernel.access', 'ck.access', (['ii'], {}), '(ii)\n', (400, 404), True, 'import ck.kernel as ck\n'), ((804, 817), 'ck.kernel.access', 'ck.access', (['ii'], {}), '(ii)\n', (813, 817), True, 'import ck.kernel as ck\n'), ((1218, 1253), 'copy.deepcopy', 'copy.deepcopy', (["cdeps['kanndataset']"], {}), "(cd... |
import logging
import os
from string import Template
import six
from .errors import ConfigurationError
log = logging.getLogger(__name__)
def interpolate_environment_variables(config):
mapping = BlankDefaultDict(os.environ)
return dict(
(service_name, process_service(service_name, service_dict, mapp... | [
"logging.getLogger",
"string.Template"
] | [((111, 138), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (128, 138), False, 'import logging\n'), ((1845, 1861), 'string.Template', 'Template', (['string'], {}), '(string)\n', (1853, 1861), False, 'from string import Template\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import datetime
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import scrape_common as sc
import scrape_ge_common as sgc
is_first = True
# parse tested from PDF
pdf_url = sgc.get_latest_ge_wee... | [
"selenium.webdriver.chrome.options.Options",
"scrape_common.xlsdownload",
"scrape_common.DayData",
"scrape_common.download",
"datetime.date",
"datetime.datetime",
"scrape_ge_common.get_latest_ge_weekly_pdf_url",
"scrape_ge_common.get_link_from_element",
"datetime.datetime.strptime",
"scrape_common... | [((299, 333), 'scrape_ge_common.get_latest_ge_weekly_pdf_url', 'sgc.get_latest_ge_weekly_pdf_url', ([], {}), '()\n', (331, 333), True, 'import scrape_ge_common as sgc\n'), ((340, 376), 'scrape_common.pdfdownload', 'sc.pdfdownload', (['pdf_url'], {'silent': '(True)'}), '(pdf_url, silent=True)\n', (354, 376), True, 'impo... |
import numpy as np
class VectorNewton(object):
"""
Vectorized Newton solver
"""
def __init__(self, f, J):
self.f = f
self.J = J
def solve(self, x0, tol=1e-10, verbose=False):
x = x0.copy()
y = self.f(x)
r = np.abs(y).max()
i = 0
while r > tol:... | [
"numpy.abs"
] | [((268, 277), 'numpy.abs', 'np.abs', (['y'], {}), '(y)\n', (274, 277), True, 'import numpy as np\n'), ((688, 698), 'numpy.abs', 'np.abs', (['yn'], {}), '(yn)\n', (694, 698), True, 'import numpy as np\n')] |
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from apps.notifications.models import MailPreferences
class Command(BaseCommand):
"""
Set default mailpreferences for existing users.
"""
def handle(self, **options):
for user in get_user_model(... | [
"apps.notifications.models.MailPreferences",
"django.contrib.auth.get_user_model"
] | [((305, 321), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (319, 321), False, 'from django.contrib.auth import get_user_model\n'), ((349, 375), 'apps.notifications.models.MailPreferences', 'MailPreferences', ([], {'user': 'user'}), '(user=user)\n', (364, 375), False, 'from apps.notification... |
import numpy as np
import cv2
import pickle
from os.path import join as opj
from utils import mask2rle, rle2mask
import rasterio
from rasterio.windows import Window
from torch.utils.data import Dataset
def generate_data(filename, i, img_patch, mask_patch, config):
img_save_path = opj(config['OUTPUT_PATH'],filenam... | [
"pickle.dump",
"rasterio.open",
"utils.rle2mask",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.zeros",
"rasterio.windows.Window.from_slices",
"os.path.join",
"numpy.vstack"
] | [((287, 345), 'os.path.join', 'opj', (["config['OUTPUT_PATH']", "(filename + f'_img_{i:04d}.jpg')"], {}), "(config['OUTPUT_PATH'], filename + f'_img_{i:04d}.jpg')\n", (290, 345), True, 'from os.path import join as opj\n'), ((359, 401), 'cv2.cvtColor', 'cv2.cvtColor', (['img_patch', 'cv2.COLOR_RGB2BGR'], {}), '(img_patc... |
from numpy import exp, sqrt, log, cos, sin, isnan, isinf, seterr
seterr(over='raise')
def _log(x):
if x <= 0:
return 0
return log(x)
def _exp(x):
try:
return exp(x)
except (FloatingPointError):
return 1
def _sqrt(x):
return sqrt(abs(x))
def _cos(x):
return cos(x)
def... | [
"numpy.log",
"numpy.seterr",
"numpy.sin",
"numpy.exp",
"numpy.cos"
] | [((66, 86), 'numpy.seterr', 'seterr', ([], {'over': '"""raise"""'}), "(over='raise')\n", (72, 86), False, 'from numpy import exp, sqrt, log, cos, sin, isnan, isinf, seterr\n'), ((143, 149), 'numpy.log', 'log', (['x'], {}), '(x)\n', (146, 149), False, 'from numpy import exp, sqrt, log, cos, sin, isnan, isinf, seterr\n')... |
#------------------------------------------------------------------------------
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
#
# Portions Copyright 2007-2015, <NAME>. All rights reserved.
#
# Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta,
# Canada. All righ... | [
"SampleEnv.GetMainConnectString",
"time.sleep"
] | [((1873, 1905), 'SampleEnv.GetMainConnectString', 'SampleEnv.GetMainConnectString', ([], {}), '()\n', (1903, 1905), False, 'import SampleEnv\n'), ((2494, 2507), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (2504, 2507), False, 'import time\n')] |
from __future__ import print_function
import sys
import argparse
import numpy as np
from zigzag import zigzag_pts
class Store_as_array(argparse._StoreAction):
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, np.array(values))
def parse_args(argv=None):
... | [
"zigzag.zigzag_pts",
"numpy.array",
"argparse.ArgumentParser"
] | [((331, 383), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""zigzag points"""'}), "(description='zigzag points')\n", (354, 383), False, 'import argparse\n'), ((581, 602), 'zigzag.zigzag_pts', 'zigzag_pts', (['args.step'], {}), '(args.step)\n', (591, 602), False, 'from zigzag import zigza... |
from rest_framework.views import exception_handler
from rest_framework.exceptions import ValidationError
def custom_exception_handler(exc, context):
response = exception_handler(exc, context)
if isinstance(exc, ValidationError) and response is not None:
response.data = exc.get_full_details()
ret... | [
"rest_framework.views.exception_handler"
] | [((166, 197), 'rest_framework.views.exception_handler', 'exception_handler', (['exc', 'context'], {}), '(exc, context)\n', (183, 197), False, 'from rest_framework.views import exception_handler\n')] |
import json
from django.contrib.auth.models import User
from django.urls import reverse
from model_mommy import mommy
from rest_framework import status
from rest_framework.test import APITestCase
from authentication.models import Profile
from employee.models import Employee
from restapi.models import EmployeeRoles, E... | [
"django.urls.reverse",
"django.contrib.auth.models.User.objects.create_user",
"json.dumps",
"model_mommy.mommy.make"
] | [((561, 577), 'django.urls.reverse', 'reverse', (['"""login"""'], {}), "('login')\n", (568, 577), False, 'from django.urls import reverse\n'), ((604, 621), 'django.urls.reverse', 'reverse', (['"""logout"""'], {}), "('logout')\n", (611, 621), False, 'from django.urls import reverse\n'), ((679, 733), 'django.urls.reverse... |
from google.cloud import storage
from google.cloud.storage import Blob, Bucket
# This function is mainly written for environments without gsutil.
def upload_blob(source: str, destination: str):
"""Uploads a file to the bucket."""
# source = "local/path/to/file"
# destination = "gs://your-bucket-name/stora... | [
"google.cloud.storage.Bucket.from_string",
"google.cloud.storage.Blob.from_string",
"google.cloud.storage.Client",
"fire.Fire"
] | [((358, 374), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (372, 374), False, 'from google.cloud import storage\n'), ((388, 435), 'google.cloud.storage.Bucket.from_string', 'Bucket.from_string', (['destination', 'storage_client'], {}), '(destination, storage_client)\n', (406, 435), False, 'from go... |
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from celery.schedules import crontab
import datetime
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dashboard.settings')
app = Celery('dashboard')
# Using... | [
"celery.Celery",
"os.environ.setdefault",
"celery.schedules.crontab",
"datetime.datetime.now"
] | [((215, 284), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""dashboard.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'dashboard.settings')\n", (236, 284), False, 'import os\n'), ((292, 311), 'celery.Celery', 'Celery', (['"""dashboard"""'], {}), "('dashboard')\n", (298, 311), F... |
'''
'''
import unittest
from csb.statistics.pdf.parameterized import Parameter
from binf.pdf import AbstractBinfPDF
class MockParameter(Parameter):
pass
class MockBinfPDF(AbstractBinfPDF):
def __init__(self, name='MockBinfPDF'):
super(MockBinfPDF, self).__init__(name=name)
self._regis... | [
"unittest.main",
"csb.statistics.pdf.parameterized.Parameter"
] | [((2856, 2871), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2869, 2871), False, 'import unittest\n'), ((359, 383), 'csb.statistics.pdf.parameterized.Parameter', 'Parameter', (['(2.0)', '"""ParamA"""'], {}), "(2.0, 'ParamA')\n", (368, 383), False, 'from csb.statistics.pdf.parameterized import Parameter\n')] |
import math
import six.moves as sm
from gem import vector
from gem import common
def zero_matrix(size):
''' Return zero filled matrix list of the requested size'''
return [[0.0] * size for _ in sm.range(size)]
def identity(size):
''' Return an identity matrix list of the requested size '''
return [[1.... | [
"gem.common.conv_list_2d",
"six.moves.range",
"gem.vector.normalize",
"math.radians",
"math.tan",
"math.sin",
"gem.vector.cross",
"gem.vector.Vector",
"math.cos",
"gem.common.list_2d_to_1d"
] | [((996, 1018), 'gem.vector.Vector', 'vector.Vector', (['vecSize'], {}), '(vecSize)\n', (1009, 1018), False, 'from gem import vector\n'), ((3611, 3636), 'gem.vector.normalize', 'vector.normalize', (['(3)', 'axis'], {}), '(3, axis)\n', (3627, 3636), False, 'from gem import vector\n'), ((4383, 4408), 'gem.vector.normalize... |
import pytest
from anchore_engine.services.analyzer.imports import is_import_message
message_matrix = [
(
{
"userId": "account1",
"imageDigest": "sha256:abc123def456",
"manifest": {
"tags": ["sometag"],
"digest": "sha256:abc123def456",
... | [
"pytest.mark.parametrize",
"anchore_engine.services.analyzer.imports.is_import_message"
] | [((1451, 1516), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('message', 'is_import')", 'message_matrix'], {}), "(('message', 'is_import'), message_matrix)\n", (1474, 1516), False, 'import pytest\n'), ((1588, 1614), 'anchore_engine.services.analyzer.imports.is_import_message', 'is_import_message', (['messag... |
# Copyright 2019 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"typing.TypeVar",
"numpy.array"
] | [((805, 859), 'typing.TypeVar', 'TypeVar', (['"""Tensor"""', 'tf.Tensor', 'torch.Tensor', 'np.ndarray'], {}), "('Tensor', tf.Tensor, torch.Tensor, np.ndarray)\n", (812, 859), False, 'from typing import Collection, TypeVar, Union\n'), ((3792, 3806), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (3800, 3806), Tr... |
import unittest.mock
import mock
from isoimage import mkdir_p, create_destination_directory, extract_zip_file
from isoimage import extract_tar_file, does_file_exists
class TestFactorial(unittest.TestCase):
@mock.patch('isoimage.os')
def test_mkdirs_called_once(self, mocked_os):
mkdir_p('something')... | [
"isoimage.mkdir_p",
"isoimage.create_destination_directory",
"mock.patch",
"isoimage.extract_zip_file",
"isoimage.does_file_exists",
"isoimage.extract_tar_file"
] | [((216, 241), 'mock.patch', 'mock.patch', (['"""isoimage.os"""'], {}), "('isoimage.os')\n", (226, 241), False, 'import mock\n'), ((375, 400), 'mock.patch', 'mock.patch', (['"""isoimage.os"""'], {}), "('isoimage.os')\n", (385, 400), False, 'import mock\n'), ((577, 602), 'mock.patch', 'mock.patch', (['"""isoimage.os"""']... |
import os
import shutil
import tempfile
import unittest
from os.path import join
try:
from catkin.init_workspace import init_workspace, _symlink_or_copy
except ImportError as impe:
raise ImportError(
'Please adjust your pythonpath before running this test: %s' % str(impe))
class InitWorkspaceTest(uni... | [
"os.getcwd",
"os.path.dirname",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.path.join"
] | [((410, 428), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (426, 428), False, 'import tempfile\n'), ((1630, 1653), 'shutil.rmtree', 'shutil.rmtree', (['root_dir'], {}), '(root_dir)\n', (1643, 1653), False, 'import shutil\n'), ((1726, 1744), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1742, 1... |
"""A simple python script to search for allele switches, strand flips,
multiallelic sites, ambiguous sites, and indels. The output is in the form of
a .bim-like table and a log file.
See:
https://github.com/BEFH/flippyr
"""
from setuptools import setup, find_packages
setup(
name='flippyr',
version='0.4.0',
... | [
"setuptools.setup"
] | [((272, 1449), 'setuptools.setup', 'setup', ([], {'name': '"""flippyr"""', 'version': '"""0.4.0"""', 'description': '"""Find reference mismatches in PLINK filesets and fix them."""', 'long_description': '"""A simple python script tosearch for allele switches,\nstrand flips, multiallelic sites, ambiguous sites,\nand ind... |
from typing import Any
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
from sklearn.preprocessing import PowerTransformer
from etna.datasets import TSDataset
from etna.transforms.power import BoxCoxTransform
from etna.transforms.power import YeoJohnsonTransform
@pytest.fixture
def n... | [
"sklearn.preprocessing.PowerTransformer",
"pandas.date_range",
"etna.datasets.TSDataset.to_dataset",
"numpy.random.RandomState",
"etna.transforms.power.BoxCoxTransform",
"pytest.raises",
"pytest.mark.parametrize",
"numpy.testing.assert_array_almost_equal",
"pandas.concat"
] | [((1614, 1671), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "('macro', 'per-segment')"], {}), "('mode', ('macro', 'per-segment'))\n", (1637, 1671), False, 'import pytest\n'), ((1972, 2099), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""preprocessing_class,method"""', "((BoxCoxTra... |
# -*- coding: utf-8 -*-
"""
@author: Po-Kan (William) Shih
@advisor: Dr.<NAME>
This program simulates the algorithm proposed in the paper
"Reinforcement Learning Applied to Linear Quadratic Regulation",
following code flow shown in Figure(1) in the paper
"""
import numpy as np
import matplotlib.pyplot as plt
... | [
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.transpose",
"numpy.array",
"numpy.random.normal",
"numpy.dot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((323, 340), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (337, 340), True, 'import numpy as np\n'), ((805, 854), 'numpy.array', 'np.array', (['[[h11, h12], [h21, h22]]'], {'dtype': '"""float"""'}), "([[h11, h12], [h21, h22]], dtype='float')\n", (813, 854), True, 'import numpy as np\n'), ((1034, 1054... |
from __future__ import annotations
import sys
from typing import TYPE_CHECKING, Any, Hashable, Optional, Sequence, Union
import numpy as np
from pandas import DataFrame, Series
from .data import ArrayLike, OptionalArrayLike
NP_GTE_121 = np.lib.NumpyVersion(np.__version__) >= np.lib.NumpyVersion("1.21.0")
__all__ ... | [
"numpy.lib.NumpyVersion"
] | [((241, 276), 'numpy.lib.NumpyVersion', 'np.lib.NumpyVersion', (['np.__version__'], {}), '(np.__version__)\n', (260, 276), True, 'import numpy as np\n'), ((280, 309), 'numpy.lib.NumpyVersion', 'np.lib.NumpyVersion', (['"""1.21.0"""'], {}), "('1.21.0')\n", (299, 309), True, 'import numpy as np\n')] |
import iptc
#Made by jerry5 2021/1/18
# 增删改查
table='filter'
chain='INPUT'
#初始拒绝所有对该端口的访问
def add_reject_port(port):
#先禁止所有对指定端口的访问
if find_reject_port(port) is None:
rule_d = {'protocol': 'tcp', 'target': 'REJECT', 'tcp': {'dport': port}}
iptc.easy.insert_rule(table,chain,rule_d)... | [
"iptc.easy.delete_rule",
"iptc.easy.insert_rule",
"iptc.easy.dump_chain",
"re.compile"
] | [((2909, 2930), 're.compile', 're.compile', (['"""^\\\\d+?$"""'], {}), "('^\\\\d+?$')\n", (2919, 2930), False, 'import re\n'), ((424, 458), 'iptc.easy.dump_chain', 'iptc.easy.dump_chain', (['table', 'chain'], {}), '(table, chain)\n', (444, 458), False, 'import iptc\n'), ((1153, 1187), 'iptc.easy.dump_chain', 'iptc.easy... |
# coding: utf-8
# # Improving a model with Grid Search
#
# In this mini-lab, we'll fit a decision tree model to some sample data. This initial model will overfit heavily. Then we'll use Grid Search to find better parameters for this model, to reduce the overfitting.
#
# First, some imports.
# In[2]:
get_ipython(... | [
"sklearn.model_selection.GridSearchCV",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.metrics.f1_score",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.tick_params",
"numpy.unique",
"numpy.meshgrid",
"sklearn.metrics.make_scorer",
... | [((1133, 1143), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1141, 1143), True, 'import matplotlib.pyplot as plt\n'), ((2335, 2350), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (2346, 2350), False, 'import random\n'), ((2435, 2489), 'sklearn.model_selection.train_test_split', 'train_test_split',... |
import logging
import re
import uuid
from smtplib import SMTPException
from django.conf import settings
from django.core.mail import send_mail
from django.db import IntegrityError
from django.db.models import Q
from django.template.loader import render_to_string
from rest_framework.request import Request
from rest_fra... | [
"logging.error",
"uuid.uuid4",
"apps.authentication.models.RegisterToken.objects.create",
"django.core.mail.send_mail",
"django.template.loader.render_to_string",
"apps.authentication.models.OnlineUser.objects.filter",
"django.db.models.Q",
"rest_framework.reverse.reverse",
"re.sub",
"logging.getL... | [((551, 578), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (568, 578), False, 'import logging\n'), ((1465, 1505), 'apps.authentication.models.OnlineUser.objects.filter', 'OnlineUser.objects.filter', ([], {'is_staff': '(True)'}), '(is_staff=True)\n', (1490, 1505), False, 'from apps.authe... |
import pytest
from agora.retry import Backoff, ConstantBackoff, LinearBackoff, ExponentialBackoff, BinaryExponentialBackoff
class TestBackoff:
def test_get_backoff(self):
with pytest.raises(NotImplementedError):
Backoff().get_backoff(1)
class TestConstantBackoff:
def test_get_backoff(se... | [
"agora.retry.LinearBackoff",
"agora.retry.BinaryExponentialBackoff",
"agora.retry.ConstantBackoff",
"pytest.raises",
"agora.retry.ExponentialBackoff",
"agora.retry.Backoff"
] | [((337, 357), 'agora.retry.ConstantBackoff', 'ConstantBackoff', (['(0.1)'], {}), '(0.1)\n', (352, 357), False, 'from agora.retry import Backoff, ConstantBackoff, LinearBackoff, ExponentialBackoff, BinaryExponentialBackoff\n'), ((504, 520), 'agora.retry.LinearBackoff', 'LinearBackoff', (['(1)'], {}), '(1)\n', (517, 520)... |
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Publ... | [
"os.getcwd",
"re.match",
"os.path.isfile",
"re.search",
"sys.exit"
] | [((3609, 3656), 're.match', 're.match', (['"""^\\\\-\\\\-help$"""', 'myArgv', 're.IGNORECASE'], {}), "('^\\\\-\\\\-help$', myArgv, re.IGNORECASE)\n", (3617, 3656), False, 'import re\n'), ((4103, 4151), 'sys.exit', 'sys.exit', (['"""Missing Parameter in job description"""'], {}), "('Missing Parameter in job description'... |
import json
import unittest
from alerta.app import create_app, custom_webhooks
import alerta_opmanager
class OpManagerWebhookTestCase(unittest.TestCase):
def setUp(self):
test_config = {
'TESTING': True,
'AUTH_REQUIRED': False
}
self.app = create_app(test_config)... | [
"alerta.app.create_app",
"alerta_opmanager.OpManagerWebhook"
] | [((297, 320), 'alerta.app.create_app', 'create_app', (['test_config'], {}), '(test_config)\n', (307, 320), False, 'from alerta.app import create_app, custom_webhooks\n'), ((453, 488), 'alerta_opmanager.OpManagerWebhook', 'alerta_opmanager.OpManagerWebhook', ([], {}), '()\n', (486, 488), False, 'import alerta_opmanager\... |
#!/usr/bin/env python
"""pysub-dl project"""
requirements = []
with open('README.md') as text:
long_description = text.read()
try:
from setuptools import setup, find_packages
except ImportError:
requirements.append('setuptools')
try:
import BeautifulSoup
except ImportError:
requirements.append('B... | [
"setuptools.find_packages"
] | [((823, 838), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (836, 838), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author: qianmoq
@License: Apache Licence
@File: checker.py
@Time: 2021-01-28 22:23:49
@Contact: qianmoq
@Site:
@Software: incubator-gcm
"""
def checker_command(command=None):
"""
Check command is exists on system
e.g: checker_command <command>
... | [
"os.getcwd",
"os.path.exists",
"shutil.which"
] | [((542, 556), 'shutil.which', 'which', (['command'], {}), '(command)\n', (547, 556), False, 'from shutil import which\n'), ((1009, 1031), 'os.path.exists', 'os.path.exists', (['source'], {}), '(source)\n', (1023, 1031), False, 'import os\n'), ((988, 999), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (997, 999), False, '... |
import logging
import threading
from enum import Enum
from recordclass.mutabletuple import mutabletuple
import requests
from stackoversight.scraping.abstractsite import AbstractSite
class StackOverflow(AbstractSite):
site = 'stackoverflow'
api_url = 'https://api.stackexchange.com'
api_version = '2.2'
... | [
"stackoversight.scraping.abstractsite.AbstractSite.cook_soup",
"recordclass.mutabletuple.mutabletuple",
"threading.Lock",
"logging.info",
"requests.get",
"logging.critical",
"threading.current_thread"
] | [((427, 443), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (441, 443), False, 'import threading\n'), ((487, 503), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (501, 503), False, 'import threading\n'), ((3308, 3326), 'requests.get', 'requests.get', (['link'], {}), '(link)\n', (3320, 3326), False, 'impo... |
# Generated by Django 3.2.9 on 2021-12-20 20:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0002_alter_project_owner'),
]
operations = [
migrations.RemoveField(
model_name='project',
name='owner',... | [
"django.db.migrations.RemoveField",
"django.db.models.FileField"
] | [((237, 295), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""project"""', 'name': '"""owner"""'}), "(model_name='project', name='owner')\n", (259, 295), False, 'from django.db import migrations, models\n'), ((446, 482), 'django.db.models.FileField', 'models.FileField', ([], {'uplo... |
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import *
from unittest import TestCase
from i2p import crypto
class KeyMixin(object):
def setUp(self):
self.key = self.cls()
self.data = 'test 12345'.encode('utf-8')
def test_to_public(self):
... | [
"i2p.crypto.ECDSA256Key"
] | [((1535, 1555), 'i2p.crypto.ECDSA256Key', 'crypto.ECDSA256Key', ([], {}), '()\n', (1553, 1555), False, 'from i2p import crypto\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('donation', '0045_referral_order'),
]
operations = [
migrations.AlterField(
model_name='referral',
na... | [
"django.db.models.CharField",
"django.db.models.BigIntegerField"
] | [((350, 485), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'help_text': '"""Enter an integer. Reasons will be ordered from smallest to largest."""', 'null': '(True)', 'blank': '(True)'}), "(help_text=\n 'Enter an integer. Reasons will be ordered from smallest to largest.',\n null=True, blan... |
#!/usr/bin/env python
import re
import glob
import sys
import os
import io
import subprocess
# These files are ignored in the scanning, due to being too weird.
SKIP_LIST=['Diagnostic_Fields_Interfaces.F90','Diagnostic_Fields_New.F90']
def read_fortran_file(filename):
""" Parse a Fortran 90 file and extract the u... | [
"subprocess.Popen",
"io.BytesIO",
"optparse.OptionParser",
"os.path.basename",
"os.path.realpath",
"re.findall",
"os.path.relpath",
"glob.glob",
"re.search",
"sys.exit"
] | [((759, 800), 're.search', 're.search', (['"""(?<=module )\\\\w+"""', 'data', 're.I'], {}), "('(?<=module )\\\\w+', data, re.I)\n", (768, 800), False, 'import re\n'), ((946, 1001), 're.findall', 're.findall', (['"""(?<=^use )\\\\w+"""', 'data', '(re.MULTILINE + re.I)'], {}), "('(?<=^use )\\\\w+', data, re.MULTILINE + r... |
#!/usr/bin/env python3
import os
from pycryptography import encrypt
from secret import flag
if __name__ == '__main__':
with open('flag.enc', 'wb+') as f:
# 160 bits security!
enc = encrypt(flag.encode(), os.urandom(20))
f.write(enc)
| [
"secret.flag.encode",
"os.urandom"
] | [((211, 224), 'secret.flag.encode', 'flag.encode', ([], {}), '()\n', (222, 224), False, 'from secret import flag\n'), ((226, 240), 'os.urandom', 'os.urandom', (['(20)'], {}), '(20)\n', (236, 240), False, 'import os\n')] |
import logging
import numpy as np
import pytest
from climate_indices import compute
# ------------------------------------------------------------------------------
# disable logging messages
logging.disable(logging.CRITICAL)
# ------------------------------------------------------------------------------
@pytest.... | [
"numpy.full",
"climate_indices.compute.transform_fitted_gamma",
"numpy.testing.assert_raises",
"numpy.allclose",
"climate_indices.compute.sum_to_scale",
"numpy.zeros",
"climate_indices.compute.transform_fitted_pearson",
"logging.disable",
"numpy.array",
"climate_indices.compute.pearson_parameters"... | [((195, 228), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (210, 228), False, 'import logging\n'), ((313, 659), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""precips_mm_monthly"""', '"""precips_mm_daily"""', '"""data_year_start_monthly"""', '"""data_year_end_mo... |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
def make_1080p():
cap.set(3, 1920)
cap.set(4, 1080)
def make_720p():
cap.set(3, 1280)
cap.set(4, 720)
def make_480p():
cap.set(3, 640)
cap.set(4, 480)
def change_res(width, height):
cap.set(3, width)
cap.set(4, height)
def re... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((37, 56), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (53, 56), False, 'import cv2\n'), ((951, 974), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (972, 974), False, 'import cv2\n'), ((521, 573), 'cv2.resize', 'cv2.resize', (['frame', 'dim'], {'interpolation': 'cv2.INTER_AREA... |
#!/usr/bin/env python
'''Test load using the Python gdkpixbuf2 GIF loader. You should see the 8bpp.gif
image on a checkboard background.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
import base_load
from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder
clas... | [
"unittest.main",
"pyglet.image.codecs.gdkpixbuf2.GdkPixbuf2ImageDecoder"
] | [((403, 427), 'pyglet.image.codecs.gdkpixbuf2.GdkPixbuf2ImageDecoder', 'GdkPixbuf2ImageDecoder', ([], {}), '()\n', (425, 427), False, 'from pyglet.image.codecs.gdkpixbuf2 import GdkPixbuf2ImageDecoder\n'), ((463, 478), 'unittest.main', 'unittest.main', ([], {}), '()\n', (476, 478), False, 'import unittest\n')] |
#!/usr/bin/env python
import time
from os.path import dirname, abspath
import numpy as np
import rospkg
from klampt.model import ik, coordinates
from klampt.math import so3
from klampt import IKObjective, IKSolver, WorldModel, vis
class KinovaGen3IK():
def __init__(self):
# Klampt
# world
... | [
"klampt.math.so3.quaternion",
"numpy.floor",
"klampt.vis.lock",
"klampt.math.so3.from_rpy",
"klampt.model.coordinates.manager",
"klampt.vis.add",
"klampt.WorldModel",
"klampt.model.ik.objective",
"klampt.math.so3.rpy",
"klampt.vis.unlock",
"klampt.model.coordinates.setWorldModel",
"time.sleep"... | [((336, 348), 'klampt.WorldModel', 'WorldModel', ([], {}), '()\n', (346, 348), False, 'from klampt import IKObjective, IKSolver, WorldModel, vis\n'), ((357, 394), 'klampt.model.coordinates.setWorldModel', 'coordinates.setWorldModel', (['self.world'], {}), '(self.world)\n', (382, 394), False, 'from klampt.model import i... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"apache_beam.utils.retry.with_exponential_backoff",
"google.cloud.bigquery.Client",
"apache_beam.testing.test_utils.compute_hash",
"logging.info"
] | [((3100, 3204), 'apache_beam.utils.retry.with_exponential_backoff', 'retry.with_exponential_backoff', ([], {'num_retries': 'MAX_RETRIES', 'retry_filter': 'retry_on_http_and_value_error'}), '(num_retries=MAX_RETRIES, retry_filter=\n retry_on_http_and_value_error)\n', (3130, 3204), False, 'from apache_beam.utils impor... |
#!/usr/bin/env python
"""A base class for EE Functions."""
# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
import textwrap
from . import computedobject
from . import ee_exception
from . import encodable
from . import serializer
class Function(encodable.EncodableFunct... | [
"textwrap.fill"
] | [((5517, 5579), 'textwrap.fill', 'textwrap.fill', (["signature['description']"], {'width': 'DOCSTRING_WIDTH'}), "(signature['description'], width=DOCSTRING_WIDTH)\n", (5530, 5579), False, 'import textwrap\n')] |
from typing import Type, TypeVar
from django.db.models import Model
from .managers import AsyncEnabledManager
from .querysets import AsyncEnabledQuerySet
from .utils import sync_to_async
_T = TypeVar("_T", bound=Model)
class AsyncModelMixin:
async def async_save(self: _T) -> None: # type: ignore
@sync... | [
"typing.TypeVar"
] | [((195, 221), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {'bound': 'Model'}), "('_T', bound=Model)\n", (202, 221), False, 'from typing import Type, TypeVar\n')] |
### Import START
import logging
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import config
from er_extractor import models
### Import END
### Global declarations START
logger = logging.getLogger(__name__)
engine = create_engine(config.DB_CONN_STRING)
models.Base.metadata.bind = engin... | [
"sqlalchemy.create_engine",
"sqlalchemy.orm.sessionmaker",
"logging.getLogger"
] | [((212, 239), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (229, 239), False, 'import logging\n'), ((250, 286), 'sqlalchemy.create_engine', 'create_engine', (['config.DB_CONN_STRING'], {}), '(config.DB_CONN_STRING)\n', (263, 286), False, 'from sqlalchemy import create_engine\n'), ((335,... |
# coding: utf-8
"""
Template to develop a python module using
:epkg:`cython` and :epkg:`openmp`.
"""
__version__ = "0.1.2"
__author__ = "<NAME>"
def check(verbose=1):
"""
Runs a couple of functions to check the module is working.
:param verbose: 0 to hide the standout output
:return: list of diction... | [
"pprint.pprint",
"numpy.random.randn"
] | [((897, 920), 'numpy.random.randn', 'numpy.random.randn', (['(100)'], {}), '(100)\n', (915, 920), False, 'import numpy\n'), ((952, 975), 'numpy.random.randn', 'numpy.random.randn', (['(100)'], {}), '(100)\n', (970, 975), False, 'import numpy\n'), ((1710, 1728), 'pprint.pprint', 'pprint.pprint', (['res'], {}), '(res)\n'... |
from collections import defaultdict
def concept2dict(concepts):
d = defaultdict(list)
for c in concepts:
d[c.index].append(c._asdict())
return d | [
"collections.defaultdict"
] | [((73, 90), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (84, 90), False, 'from collections import defaultdict\n')] |
from django.db import IntegrityError, transaction
from rest_framework.views import APIView
from rest_framework.generics import ListAPIView, RetrieveAPIView
from rest_framework.permissions import (
AllowAny,
)
from rest_framework.response import Response
from rest_framework import status
from backend.votes.models ... | [
"backend.votes.models.Question.objects.all",
"rest_framework.response.Response"
] | [((752, 774), 'backend.votes.models.Question.objects.all', 'Question.objects.all', ([], {}), '()\n', (772, 774), False, 'from backend.votes.models import Question\n'), ((914, 936), 'backend.votes.models.Question.objects.all', 'Question.objects.all', ([], {}), '()\n', (934, 936), False, 'from backend.votes.models import... |
# coding: utf-8
from py7zlib import Archive7z
class Py7z:
def __init__(self, file):
self.archive = Archive7z(file)
def namelist(self):
return self.archive.getnames()
def read(self, name):
return self.archive.getmember(name).read()
| [
"py7zlib.Archive7z"
] | [((114, 129), 'py7zlib.Archive7z', 'Archive7z', (['file'], {}), '(file)\n', (123, 129), False, 'from py7zlib import Archive7z\n')] |
#!/usr/bin/env python3
import cv2
import depthai as dai
import time
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
aprilTag = pipeline.create(dai.node.AprilTag)
manip = pipeline.create(dai.node.ImageManip)
xoutAprilTag = pipeline.create(dai.no... | [
"depthai.Pipeline",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"depthai.Device",
"time.monotonic",
"cv2.imshow"
] | [((99, 113), 'depthai.Pipeline', 'dai.Pipeline', ([], {}), '()\n', (111, 113), True, 'import depthai as dai\n'), ((1155, 1175), 'depthai.Device', 'dai.Device', (['pipeline'], {}), '(pipeline)\n', (1165, 1175), True, 'import depthai as dai\n'), ((1450, 1466), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (1464, ... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.ce.set_nc_config",
"ansible.module_utils.ce.get_nc_config",
"xml.etree.ElementTree.fromstring"
] | [((12890, 12954), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'self.spec', 'supports_check_mode': '(True)'}), '(argument_spec=self.spec, supports_check_mode=True)\n', (12903, 12954), False, 'from ansible.module_utils.basic import AnsibleModule\n'), ((13365, 13401), 'ansible.modul... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============================================================================
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | [
"tensorflow.train.piecewise_constant",
"tensorflow.cond",
"tensorflow.cast"
] | [((1871, 1931), 'tensorflow.train.piecewise_constant', 'tf.train.piecewise_constant', (['global_step', 'boundaries', 'values'], {}), '(global_step, boundaries, values)\n', (1898, 1931), True, 'import tensorflow as tf\n'), ((2129, 2197), 'tensorflow.cond', 'tf.cond', (['(global_step < warmup_steps)', '(lambda : warmup_l... |
import requests
from bs4 import BeautifulSoup
from utils import write_data
import json
import time
import datetime
from datetime import date, timedelta
def compare_data(js_file1, js_file2):
confirmed_cmp_seoul = []
with open(js_file1, "r", encoding="utf-8") as f1:
with open(js_file2, "r", encoding="utf-... | [
"utils.write_data",
"json.load",
"datetime.timedelta",
"datetime.date.today"
] | [((896, 908), 'datetime.date.today', 'date.today', ([], {}), '()\n', (906, 908), False, 'from datetime import date, timedelta\n'), ((921, 933), 'datetime.date.today', 'date.today', ([], {}), '()\n', (931, 933), False, 'from datetime import date, timedelta\n'), ((936, 948), 'datetime.timedelta', 'timedelta', (['(1)'], {... |
from django.forms import ModelForm, TextInput, FileInput, Select
from .models import Product, Category, Document
class ProductForm(ModelForm):
class Meta:
model = Product
exclude = ('author', 'create_date', 'mod_date')
widgets = {
'name': TextInput(attrs={'class': 'form-contr... | [
"django.forms.TextInput",
"django.forms.FileInput",
"django.forms.Select"
] | [((283, 325), 'django.forms.TextInput', 'TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (292, 325), False, 'from django.forms import ModelForm, TextInput, FileInput, Select\n'), ((347, 389), 'django.forms.TextInput', 'TextInput', ([], {'attrs': "{'class': 'form-control'... |
"""
.. automodule:: tridesclous.dataio
.. automodule:: tridesclous.catalogueconstructor
.. automodule:: tridesclous.peeler
"""
from .version import version as __version__
import PyQt5 # this force pyqtgraph to deal with Qt5
# For matplotlib to Qt5 :
# * this avoid tinker problem when not installed
# * wor... | [
"matplotlib.use",
"warnings.catch_warnings",
"warnings.simplefilter"
] | [((413, 438), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (436, 438), False, 'import warnings\n'), ((685, 716), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (706, 716), False, 'import warnings\n'), ((725, 749), 'matplotlib.use', 'matplotlib.use', ... |
import pygame as pg
from Define.Set_Define import *
class Obstacle():
def __init__(self):
self.circle_img = pg.image.load("./Obstacle/black_circle.png")
self.rectangle_img = pg.image.load("./Obstacle/black_square.png")
self.circle_size_img = None
self.rectangle_size_img = None
... | [
"pygame.image.load",
"pygame.transform.scale",
"pygame.mask.from_surface"
] | [((122, 166), 'pygame.image.load', 'pg.image.load', (['"""./Obstacle/black_circle.png"""'], {}), "('./Obstacle/black_circle.png')\n", (135, 166), True, 'import pygame as pg\n'), ((196, 240), 'pygame.image.load', 'pg.image.load', (['"""./Obstacle/black_square.png"""'], {}), "('./Obstacle/black_square.png')\n", (209, 240... |
import time
import logging
import sys
import config
sys.path.insert(0, config.mxnet_path)
import mxnet as mx
from mxnet.module import Module
from mxnet import metric
from mxnet.model import BatchEndParam
def _as_list(obj):
if isinstance(obj, list):
return obj
else:
return [obj]
class Solve... | [
"mxnet.module.Module",
"sys.path.insert",
"time.time",
"mxnet.cpu",
"mxnet.metric.create",
"logging.getLogger"
] | [((54, 91), 'sys.path.insert', 'sys.path.insert', (['(0)', 'config.mxnet_path'], {}), '(0, config.mxnet_path)\n', (69, 91), False, 'import sys\n'), ((472, 480), 'mxnet.cpu', 'mx.cpu', ([], {}), '()\n', (478, 480), True, 'import mxnet as mx\n'), ((1002, 1216), 'mxnet.module.Module', 'Module', ([], {'symbol': 'self.symbo... |
import numpy as np
import matplotlib.pyplot as plt
import neurolab as nl
# Load input data
text = np.loadtxt('data/data_vector_quantization.txt')
# Separate it into data and labels
data = text[:, 0:2]
labels = text[:, 2:]
# Define a neural network:
n_input = 10
n_output = 4
weights = [1/n_output] * n_output
nn = nl... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"neurolab.tool.minmax",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"numpy.arange",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.concatenate"
] | [((100, 147), 'numpy.loadtxt', 'np.loadtxt', (['"""data/data_vector_quantization.txt"""'], {}), "('data/data_vector_quantization.txt')\n", (110, 147), True, 'import numpy as np\n'), ((563, 595), 'numpy.concatenate', 'np.concatenate', (['(xx, yy)'], {'axis': '(1)'}), '((xx, yy), axis=1)\n', (577, 595), True, 'import num... |
import inspect
from pathlib import Path
import pandas as pd
import pytest
import yaml
from pandas.testing import assert_frame_equal
from skillmodels.process_model import process_model
# ======================================================================================
# Integration test with model2 from the repl... | [
"pandas.testing.assert_frame_equal",
"yaml.load",
"pandas.read_csv",
"pathlib.Path",
"inspect.signature",
"skillmodels.process_model.process_model"
] | [((2271, 2366), 'pandas.read_csv', 'pd.read_csv', (["(test_dir / 'model2_correct_update_info.csv')"], {'index_col': "['period', 'variable']"}), "(test_dir / 'model2_correct_update_info.csv', index_col=[\n 'period', 'variable'])\n", (2282, 2366), True, 'import pandas as pd\n'), ((2380, 2413), 'pandas.testing.assert_f... |
# All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"six.add_metaclass"
] | [((661, 691), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (678, 691), False, 'import six\n')] |
#
# This python script is the basis for Cosmics HLT path testing
#
# Only the developed path are runned on the RAW data sample
#
# We are using GRun_data version of the HLT menu
#
# SV (<EMAIL>): 04/02/2011
#
import FWCore.ParameterSet.Config as cms
process = cms.Process('HLT2')
# import of standard configurations
... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.bool",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.Schedule",
"FWCore.Param... | [((263, 282), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""HLT2"""'], {}), "('HLT2')\n", (274, 282), True, 'import FWCore.ParameterSet.Config as cms\n'), ((2457, 2488), 'FWCore.ParameterSet.Config.Service', 'cms.Service', (['"""PathTimerService"""'], {}), "('PathTimerService')\n", (2468, 2488), True, 'imp... |
from django.db import models
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=100, null = False, blank =False)
def __str__(self):
return self.name
class Photo(models.Model):
title = models.CharField(max_length=255, null=True, blank=True )
category ... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((101, 158), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(False)', 'blank': '(False)'}), '(max_length=100, null=False, blank=False)\n', (117, 158), False, 'from django.db import models\n'), ((250, 305), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(... |
from pybrid.split_scripts import main
from pybrid.config import default_cfg as cfg
cfg.exp.log_dir = "results/hybrid_split"
cfg.exp.num_batches = 3000
cfg.exp.batches_per_epoch = 100
cfg.exp.test_hybrid = True
cfg.exp.test_amort = True
cfg.data.train_size = None
cfg.data.test_size = None
cfg.infer.num_train_iters = ... | [
"pybrid.split_scripts.main"
] | [((483, 492), 'pybrid.split_scripts.main', 'main', (['cfg'], {}), '(cfg)\n', (487, 492), False, 'from pybrid.split_scripts import main\n')] |
import unittest
from coala_decorators import (
arguments_to_lists, enforce_signature, generate_eq, generate_ordering,
generate_repr, yield_once)
class YieldOnceTest(unittest.TestCase):
def test_yield_once(self):
@yield_once
def iterate_over_list(arg_list):
for arg in arg_list... | [
"coala_decorators.generate_eq",
"coala_decorators.generate_ordering",
"coala_decorators.generate_repr"
] | [((4532, 4608), 'coala_decorators.generate_repr', 'generate_repr', (['"""A"""', "('B', str)", '"""ComplexMember"""', "('Q', lambda x: 'OVERRIDE')"], {}), "('A', ('B', str), 'ComplexMember', ('Q', lambda x: 'OVERRIDE'))\n", (4545, 4608), False, 'from coala_decorators import arguments_to_lists, enforce_signature, generat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.