code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import division
from scipy.stats import norm
from pandas import read_excel
import numpy as np
# Transform to normal distribution #
def allnorm(x, y):
sample = len(x)
# Estimate norm parameters #
phat1 = norm.fit(x, loc=0, scale=1)
meanx = phat1[0]
sigmax = phat1[1]
phat2 = n... | [
"scipy.stats.norm.fit",
"numpy.sum",
"numpy.zeros",
"numpy.concatenate",
"pandas.read_excel",
"scipy.stats.norm.cdf"
] | [((235, 262), 'scipy.stats.norm.fit', 'norm.fit', (['x'], {'loc': '(0)', 'scale': '(1)'}), '(x, loc=0, scale=1)\n', (243, 262), False, 'from scipy.stats import norm\n'), ((319, 346), 'scipy.stats.norm.fit', 'norm.fit', (['y'], {'loc': '(0)', 'scale': '(1)'}), '(y, loc=0, scale=1)\n', (327, 346), False, 'from scipy.stat... |
from django.conf import settings
from django.db import migrations, connection
class KeepTranslationsMixin:
_saved_data_from_plain = {}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.operations.insert(0, migrations.RunPython(
self._saveDataFromPlain, s... | [
"django.db.migrations.RunPython",
"django.db.connection.cursor"
] | [((260, 331), 'django.db.migrations.RunPython', 'migrations.RunPython', (['self._saveDataFromPlain', 'self._restoreDataToPlain'], {}), '(self._saveDataFromPlain, self._restoreDataToPlain)\n', (280, 331), False, 'from django.db import migrations, connection\n'), ((386, 456), 'django.db.migrations.RunPython', 'migrations... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-17 19:27
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
def populate_outlet_name(apps, schema_editor):
Outlet = apps.get_model('cashup', 'Outlet')
for outlet in Outlet.objects.all()... | [
"django.db.migrations.RunPython",
"django.db.migrations.RenameField",
"django.db.models.SlugField"
] | [((525, 602), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""outlet"""', 'old_name': '"""name"""', 'new_name': '"""slug"""'}), "(model_name='outlet', old_name='name', new_name='slug')\n", (547, 602), False, 'from django.db import migrations, models\n'), ((1202, 1271), 'django.db.m... |
import sqlite3
from flask_restplus import Resource, reqparse
class User:
def __init__(self, _id, username, password):
self.id = _id
self.username = username
self.password = password
@classmethod
def find_by_username(cls, username):
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
... | [
"flask_restplus.reqparse.RequestParser",
"sqlite3.connect"
] | [((1277, 1301), 'flask_restplus.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (1299, 1301), False, 'from flask_restplus import Resource, reqparse\n'), ((259, 285), 'sqlite3.connect', 'sqlite3.connect', (['"""data.db"""'], {}), "('data.db')\n", (274, 285), False, 'import sqlite3\n'), ((771, 797), ... |
# coding: utf8
"""
weasyprint.text
---------------
Interface with Pango to decide where to do line breaks and to draw text.
:copyright: Copyright 2011-2012 <NAME> and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division
# XXX No unicode_literals,... | [
"cairocffi.PDFSurface",
"cffi.FFI",
"cairocffi.ImageSurface",
"pyphen.Pyphen"
] | [((472, 482), 'cffi.FFI', 'cffi.FFI', ([], {}), '()\n', (480, 482), False, 'import cffi\n'), ((6793, 6827), 'cairocffi.ImageSurface', 'cairo.ImageSurface', (['"""ARGB32"""', '(1)', '(1)'], {}), "('ARGB32', 1, 1)\n", (6811, 6827), True, 'import cairocffi as cairo\n'), ((6875, 6903), 'cairocffi.PDFSurface', 'cairo.PDFSur... |
from cal_tool.models import Users, Calendars, CalendarSources
class UpdateManager:
def __init__(self):
self.__last_completed_update = datetime.now()
self.__force_refilter = True
pass
# -----------------------------------------------------------------------------------------------------... | [
"cal_tool.models.CalendarSources",
"cal_tool.event_updates.event_changes.event_changes",
"cal_tool.models.Filters.check_filters_changed",
"cal_tool.models.Calendars.get_calenders_from_user",
"datetime.datetime.now",
"cal_tool.models.CalendarSources.objects.filter",
"cal_tool.models.Users.objects.all",
... | [((147, 161), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (159, 161), False, 'from datetime import datetime\n'), ((1062, 1081), 'cal_tool.models.Users.objects.all', 'Users.objects.all', ([], {}), '()\n', (1079, 1081), False, 'from cal_tool.models import Users, Calendars, CalendarSources\n'), ((1509, 1523... |
from telegram import Update
from telegram.ext import CallbackContext
from codenames.handlers.special_types import LocalizedCommandHandler
def show_help(update: Update, context: CallbackContext) -> None:
update.effective_chat.send_message(context.language.t.HELP_MESSAGE)
def show_welcome(update: Update, con... | [
"codenames.handlers.special_types.LocalizedCommandHandler"
] | [((444, 486), 'codenames.handlers.special_types.LocalizedCommandHandler', 'LocalizedCommandHandler', (['"""help"""', 'show_help'], {}), "('help', show_help)\n", (467, 486), False, 'from codenames.handlers.special_types import LocalizedCommandHandler\n'), ((503, 549), 'codenames.handlers.special_types.LocalizedCommandHa... |
from os.path import join as pathjoin
from PyQt5.QtWidgets import QDialog
from PyQt5 import uic
from PyQt5.Qt import Qt
from PyQt5.Qt import QIcon
from PyQt5.Qt import QUrl
from PyQt5.QtWidgets import QTreeWidgetItem
from PyQt5.QtWidgets import QMenu
from PyQt5.Qt import QAction
from PyQt5.Qt import QDir
from PyQt5.QtWi... | [
"mc.common.globalvars.gVar.app.clipboard",
"PyQt5.uic.loadUi",
"PyQt5.Qt.QDir.homePath",
"mc.tools.Scripts.Scripts.getAllImages",
"PyQt5.Qt.QImage.fromData",
"PyQt5.QtWidgets.QMenu",
"mc.common.globalvars.gVar.appTools.setWmClass",
"PyQt5.Qt.QIcon.fromTheme",
"mc.common.globalvars.gVar.app.networkMa... | [((1077, 1083), 'PyQt5.Qt.QUrl', 'QUrl', ([], {}), '()\n', (1081, 1083), False, 'from PyQt5.Qt import QUrl\n'), ((1104, 1144), 'PyQt5.uic.loadUi', 'uic.loadUi', (['"""mc/other/SiteInfo.ui"""', 'self'], {}), "('mc/other/SiteInfo.ui', self)\n", (1114, 1144), False, 'from PyQt5 import uic\n'), ((1214, 1254), 'mc.common.gl... |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 362820908
"""
"""
random actions, total chaos
"""
board = gamma_new(4, 5, 2, 6)
assert board is... | [
"part1.gamma_move",
"part1.gamma_board",
"part1.gamma_new",
"part1.gamma_golden_move",
"part1.gamma_delete",
"part1.gamma_busy_fields",
"part1.gamma_golden_possible",
"part1.gamma_free_fields"
] | [((283, 304), 'part1.gamma_new', 'gamma_new', (['(4)', '(5)', '(2)', '(6)'], {}), '(4, 5, 2, 6)\n', (292, 304), False, 'from part1 import gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new\n'), ((1063, 1081), 'part1.gamma_board', 'gamma_board... |
# -*- coding:utf-8 -*-
"""
@author:SiriYang
@file: ConfigController.py
@time: 2020.1.30 13:24
"""
from ConfigModel import Config
from tools.sql.SQLConnector import SQLConnector
class ConfigController (object):
mSQLConn = None
def __init__(self,dbpath):
self.mSQLConn = SQLConnector(dbpath)
def __del__(self... | [
"tools.sql.SQLConnector.SQLConnector",
"ConfigModel.Config"
] | [((280, 300), 'tools.sql.SQLConnector.SQLConnector', 'SQLConnector', (['dbpath'], {}), '(dbpath)\n', (292, 300), False, 'from tools.sql.SQLConnector import SQLConnector\n'), ((958, 966), 'ConfigModel.Config', 'Config', ([], {}), '()\n', (964, 966), False, 'from ConfigModel import Config\n')] |
#date and time
import datetime
current_date=datetime.date.today()
print(current_date.strftime("%d%b,%Y"))
print(current_date.strftime("%d%B,%Y"))
print(current_date.strftime("%d%b,%y"))
print(current_date.strftime("%d-%b-%Y"))
print(current_date.strftime("%d/%b/%Y"))
| [
"datetime.date.today"
] | [((44, 65), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (63, 65), False, 'import datetime\n')] |
from multiprocessing.managers import BaseManager
m = BaseManager(address=('127.0.0.1', 5000), authkey=b'abc')
m.connect()
| [
"multiprocessing.managers.BaseManager"
] | [((53, 109), 'multiprocessing.managers.BaseManager', 'BaseManager', ([], {'address': "('127.0.0.1', 5000)", 'authkey': "b'abc'"}), "(address=('127.0.0.1', 5000), authkey=b'abc')\n", (64, 109), False, 'from multiprocessing.managers import BaseManager\n')] |
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import cross_val_score
def train_knn(x_train, y_train, neighbors, fold):
scores = []
print(f"KNN")
for neighbor in neighbors:
knn = KNeighborsClassifier(n_neighbors=neighbor)
score = cross_va... | [
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.model_selection.cross_val_score"
] | [((253, 295), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': 'neighbor'}), '(n_neighbors=neighbor)\n', (273, 295), False, 'from sklearn.neighbors import KNeighborsClassifier\n'), ((312, 359), 'sklearn.model_selection.cross_val_score', 'cross_val_score', (['knn', 'x_train', 'y_tra... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
get_bbmap_time.py
Get the bbmap running time for the mapping jobs.
Created on Tue Aug 26 11:05:03 EDT 2014
@author: cjg
"""
import sys
import os
import argparse
import time
import re
import glob
#sys.path.append("/chongle/shared/software/metalrec/src")
#import metalrec_l... | [
"os.path.abspath",
"os.path.exists",
"re.findall",
"argparse.ArgumentParser"
] | [((490, 762), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get the bbmap running time for the mapping jobs."""', 'prog': '"""check_PBreads"""', 'prefix_chars': '"""-"""', 'fromfile_prefix_chars': '"""@"""', 'conflict_handler': '"""resolve"""', 'add_help': '(True)', 'formatter_class': '... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | [
"argparse.ArgumentParser",
"tensorflow.python.pywrap_mlir.experimental_convert_saved_model_to_mlir"
] | [((921, 1000), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Translate saved model to tf mlir dialect"""'}), "(description='Translate saved model to tf mlir dialect')\n", (944, 1000), False, 'import argparse\n'), ((789, 879), 'tensorflow.python.pywrap_mlir.experimental_convert_saved_mod... |
from collections import deque
from copy import deepcopy
def spread_plants(spread_patterns, state):
pattern = deque(state[:4])
new_state = deepcopy(state)
for next_pot in range(4, len(state)):
pattern.append(state[next_pot])
spread_result = spread_patterns.get(''.join(pattern))
cha... | [
"collections.deque",
"copy.deepcopy"
] | [((115, 131), 'collections.deque', 'deque', (['state[:4]'], {}), '(state[:4])\n', (120, 131), False, 'from collections import deque\n'), ((148, 163), 'copy.deepcopy', 'deepcopy', (['state'], {}), '(state)\n', (156, 163), False, 'from copy import deepcopy\n')] |
import numpy as np
import pandas as pd
import sympy
from biodescriptors.calc.calc_COM_for_planes import _calc_COM_for_planes
from biodescriptors.calc import constraints
from biodescriptors.calc import utils
def _calc_plane_angles(chain, l1, l2, l3):
"""Calculate angles between every layer. l1, l2, l3 - lists wh... | [
"biodescriptors.calc.utils.get_model_and_structure",
"biodescriptors.calc.calc_COM_for_planes._calc_COM_for_planes",
"sympy.Plane",
"sympy.Point3D"
] | [((413, 444), 'biodescriptors.calc.calc_COM_for_planes._calc_COM_for_planes', '_calc_COM_for_planes', (['chain', 'l1'], {}), '(chain, l1)\n', (433, 444), False, 'from biodescriptors.calc.calc_COM_for_planes import _calc_COM_for_planes\n'), ((458, 489), 'biodescriptors.calc.calc_COM_for_planes._calc_COM_for_planes', '_c... |
#!/usr/bin/env python3
import argparse
from pathlib import Path
module_info = {
# Name of the module (should be the same as the filename)
'name': 'lightsail__download_ssh_keys',
# Name and any other notes about the author
'author': '<NAME> of Rhino Security Labs',
# Category of the module. Make s... | [
"pathlib.Path.cwd",
"argparse.ArgumentParser"
] | [((1194, 1273), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)', 'description': "module_info['description']"}), "(add_help=False, description=module_info['description'])\n", (1217, 1273), False, 'import argparse\n'), ((1646, 1656), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (165... |
#!/usr/bin/python
# todo: preview doesnt work
# TODO: new types: pixel (rgba)
# todo: legacy? e.g. compute image of points, computation illustration etc.
# todo: doesn't detect wrong number of args
# todo: set color
# todo: filled julia with the number of it
# todo: implement missing rect and arg and line complex
# to... | [
"ezInputConf.convert_string_to_string",
"ezInputConf.convert_string_to_boolean"
] | [((17036, 17066), 'ezInputConf.convert_string_to_boolean', 'convert_string_to_boolean', (['arg'], {}), '(arg)\n', (17061, 17066), False, 'from ezInputConf import convert_string_to_boolean\n'), ((17432, 17461), 'ezInputConf.convert_string_to_string', 'convert_string_to_string', (['arg'], {}), '(arg)\n', (17456, 17461), ... |
from PIL import Image, ImageDraw, ImageFont
import math
HEX_CODE = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'A': 10, 'B': 11, 'C': 12,
'D': 13, 'E': 14, 'F': 15}
class Mark:
def __init__(self):
"""
Initializes the text and the margin to avoid p... | [
"PIL.Image.open",
"PIL.Image.new",
"math.sqrt",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw",
"PIL.Image.alpha_composite",
"math.atan"
] | [((1592, 1633), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', 'img.size', '(0, 0, 0, 0)'], {}), "('RGBA', img.size, (0, 0, 0, 0))\n", (1601, 1633), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((1673, 1714), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['f"""{style}"""'], {'size': 'size'}), "(f'{style}'... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import torch
import unittest
import gpytorch
from torch.autograd import Variable
from torch import nn
class AddDiagTest(unittest.TestCase):
def test_fo... | [
"torch.Tensor",
"torch.norm",
"unittest.main",
"gpytorch.add_diag",
"torch.randn",
"torch.ones"
] | [((1002, 1017), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1015, 1017), False, 'import unittest\n'), ((433, 456), 'gpytorch.add_diag', 'gpytorch.add_diag', (['b', 'a'], {}), '(b, a)\n', (450, 456), False, 'import gpytorch\n'), ((475, 522), 'torch.Tensor', 'torch.Tensor', (['[[6, 1, 1], [1, 6, 1], [1, 1, 6]]']... |
from configparser import ConfigParser
from iot_message.message import Message
from iot_message.cryptor.base64 import Cryptor as B64
from iot_message.cryptor.plain import Cryptor as Plain
from iot_message.cryptor.aes_sha1 import Cryptor as AES
from node_listener.service.hd44780_40_4 import Dump
import json
class Confi... | [
"iot_message.cryptor.base64.Cryptor",
"json.loads",
"configparser.ConfigParser",
"iot_message.cryptor.plain.Cryptor",
"iot_message.message.Message.add_decoder",
"iot_message.message.Message.add_encoder"
] | [((447, 461), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (459, 461), False, 'from configparser import ConfigParser\n'), ((973, 1005), 'iot_message.message.Message.add_encoder', 'Message.add_encoder', (['encoder_aes'], {}), '(encoder_aes)\n', (992, 1005), False, 'from iot_message.message import Messa... |
"""Google Cloud Platform storage bucket utility"""
import os
from google.cloud import storage
from .globals import ML2_BUCKET
def latest_version(bucket_dir: str, name: str, bucket_name: str = ML2_BUCKET):
storage_client = storage.Client()
latest_version = -1
prefix = f'{bucket_dir}/{name}-'
for blob... | [
"google.cloud.storage.Client",
"os.path.exists",
"os.makedirs",
"os.path.split",
"os.path.isfile",
"os.path.isdir",
"os.walk"
] | [((230, 246), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (244, 246), False, 'from google.cloud import storage\n'), ((698, 714), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (712, 714), False, 'from google.cloud import storage\n'), ((1308, 1324), 'google.cloud.storage.Client... |
import requests
req_url = "https://www.chinaamc.com/indexfundvalue.js"
response = requests.get(req_url)
print(response.apparent_encoding)
response.encoding = "UTF-8"
print(response.text) | [
"requests.get"
] | [((85, 106), 'requests.get', 'requests.get', (['req_url'], {}), '(req_url)\n', (97, 106), False, 'import requests\n')] |
from onegov.core.orm.types import UTCDateTime
from sedate import to_timezone
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy import Text
from sqlalchemy.dialects.postgresql import HSTORE
from sqlalchemy.ext.mutable import MutableDict
class OccurrenceMixin(object):
""" Contains all attr... | [
"sedate.to_timezone",
"sqlalchemy.ext.mutable.MutableDict.as_mutable",
"sqlalchemy.Column"
] | [((729, 757), 'sqlalchemy.Column', 'Column', (['Text'], {'nullable': '(False)'}), '(Text, nullable=False)\n', (735, 757), False, 'from sqlalchemy import Column\n'), ((819, 831), 'sqlalchemy.Column', 'Column', (['Text'], {}), '(Text)\n', (825, 831), False, 'from sqlalchemy import Column\n'), ((896, 923), 'sqlalchemy.Col... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"onnxruntime.quantization.quant_utils.attribute_to_kwarg",
"onnx.helper.make_node"
] | [((2553, 2640), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""QAttention"""', 'inputs', 'node.output', 'qattention_name'], {}), "('QAttention', inputs, node.output, qattention_name,\n **kwargs)\n", (2574, 2640), False, 'import onnx\n'), ((2459, 2488), 'onnxruntime.quantization.quant_utils.attribute_to_kwar... |
# Copyright 2017 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 License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.ops.array_ops.placeholder",
"tensorflow.contrib.data.python.ops.dataset_ops.Dataset.range",
"tensorflow.contrib.data.python.ops.dataset_ops.Dataset.from_tensor_slices",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.framework.tensor_shape.TensorShape",
"tensorflo... | [((7355, 7366), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (7364, 7366), False, 'from tensorflow.python.platform import test\n'), ((1245, 1290), 'tensorflow.python.ops.array_ops.placeholder', 'array_ops.placeholder', (['dtypes.int64'], {'shape': '[]'}), '(dtypes.int64, shape=[])\n', (1266, 1... |
import torch.utils.data as data
import torch
import numpy as np
import os
from os import listdir
from os.path import join
from PIL import Image, ImageOps, ImageEnhance
import random
import re
import json
import math
import torch.nn.functional as F
def is_image_file(filename):
return any(filename.endswith(extension... | [
"PIL.Image.open",
"os.listdir",
"numpy.float32",
"random.randrange",
"os.path.join",
"os.path.split",
"json.load",
"torch.tensor",
"numpy.zeros",
"numpy.cos",
"PIL.ImageOps.flip",
"numpy.sin",
"random.randint",
"torch.rand"
] | [((6182, 6195), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (6188, 6195), True, 'import numpy as np\n'), ((6243, 6256), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (6249, 6256), True, 'import numpy as np\n'), ((6273, 6286), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (6279, 6286), True, 'impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db.models import Count
from django.utils import timezone
impo... | [
"services.models.Service.objects.filter",
"stats.models.Incident.objects.filter",
"stats.models.Incident.objects.get",
"django.utils.timezone.now",
"services.models.ServiceHistory.objects.filter",
"services.models.Service.objects.get",
"datetime.timedelta",
"django_rq.get_queue",
"stats.models.Incid... | [((506, 520), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (518, 520), False, 'from django.utils import timezone\n'), ((617, 657), 'stats.models.Incident.objects.filter', 'Incident.objects.filter', ([], {'is_closed': '(False)'}), '(is_closed=False)\n', (640, 657), False, 'from stats.models import Inci... |
from django.http import JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
import json
from facetouch.models import Event, Section, Item, Image
from datetime import datetime
from django.views.generic import TemplateView
@csrf_exempt
def create_event(request):
if ... | [
"django.shortcuts.render",
"json.loads",
"facetouch.models.Event.objects.all",
"facetouch.models.Section.objects.all",
"django.http.JsonResponse",
"facetouch.models.Event.objects.filter",
"datetime.datetime.utcnow",
"facetouch.models.Item.objects.filter"
] | [((837, 866), 'django.http.JsonResponse', 'JsonResponse', (["{'status': 200}"], {}), "({'status': 200})\n", (849, 866), False, 'from django.http import JsonResponse\n'), ((1225, 1265), 'django.http.JsonResponse', 'JsonResponse', (["{'status': 'no new event'}"], {}), "({'status': 'no new event'})\n", (1237, 1265), False... |
'''This is the repo which contains the original code to the WACV 2021 paper
"Same Same But DifferNet: Semi-Supervised Defect Detection with Normalizing Flows"
by <NAME>, <NAME> and <NAME>.
For further information contact <NAME> (<EMAIL>)'''
import config as c
from train import *
from utils import load_datasets, make_d... | [
"utils.make_dataloaders",
"time.time",
"gc.collect",
"utils.load_datasets"
] | [((383, 426), 'utils.load_datasets', 'load_datasets', (['c.dataset_path', 'c.class_name'], {}), '(c.dataset_path, c.class_name)\n', (396, 426), False, 'from utils import load_datasets, make_dataloaders\n'), ((462, 509), 'utils.make_dataloaders', 'make_dataloaders', (['train_set', 'validate_set', 'None'], {}), '(train_s... |
# coding: utf-8
import math
print(math.radians(45))
| [
"math.radians"
] | [((36, 52), 'math.radians', 'math.radians', (['(45)'], {}), '(45)\n', (48, 52), False, 'import math\n')] |
# -*- coding: utf-8 -*-
import logging
from itertools import chain
from collections import OrderedDict
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QImage
from qgis.core import (
QgsCoordinateReferenceSystem,
QgsRectangle,
QgsFeatureRequest,
QgsRenderContext,
QgsMapRenderer,
QgsSca... | [
"logging.getLogger",
"itertools.chain",
"qgis.core.QgsRectangle",
"qgis.core.QgsMapRenderer",
"qgis.core.QgsRenderContext",
"qgis.core.QgsFeatureRequest",
"PyQt4.QtCore.QSize",
"qgis.core.QgsCoordinateReferenceSystem"
] | [((545, 572), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (562, 572), False, 'import logging\n'), ((1059, 1089), 'qgis.core.QgsCoordinateReferenceSystem', 'QgsCoordinateReferenceSystem', ([], {}), '()\n', (1087, 1089), False, 'from qgis.core import QgsCoordinateReferenceSystem, QgsRect... |
# plugin which demonstrates
# how to play a media file
# on a keypress, for simplicity reasons we just start vlc in hidden mode
import os
cfg = globals()["config"]
drv = globals()["drivers"]
print(drv)
os.system("vlc --play-and-exit --intf dummy /home/werpu/PycharmProjects/" +
"input_pipe/src/test/resources... | [
"os.system"
] | [((204, 336), 'os.system', 'os.system', (["('vlc --play-and-exit --intf dummy /home/werpu/PycharmProjects/' +\n 'input_pipe/src/test/resources/Burping_2_short.ogg')"], {}), "('vlc --play-and-exit --intf dummy /home/werpu/PycharmProjects/' +\n 'input_pipe/src/test/resources/Burping_2_short.ogg')\n", (213, 336), Fa... |
from solution import solution
def test_solution_1():
assert solution('1211', 10) == 1
def test_solution_2():
assert solution('210022', 3) == 3
| [
"solution.solution"
] | [((66, 86), 'solution.solution', 'solution', (['"""1211"""', '(10)'], {}), "('1211', 10)\n", (74, 86), False, 'from solution import solution\n'), ((128, 149), 'solution.solution', 'solution', (['"""210022"""', '(3)'], {}), "('210022', 3)\n", (136, 149), False, 'from solution import solution\n')] |
#!/usr/bin/env python
"""detector.py: module is dedicated to all detector functions."""
__author__ = "<NAME>."
__copyright__ = "Copyright 2020, SuperDARN@VT"
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
import os
import datetime as... | [
"numpy.log10",
"pandas.read_csv",
"numpy.array",
"datetime.timedelta",
"numpy.gradient",
"datetime.datetime",
"os.path.exists",
"json.dumps",
"plotlib.plot_fit_data_with_scores",
"traceback.print_exc",
"numpy.abs",
"uuid.uuid1",
"pandas.DataFrame.from_records",
"numpy.median",
"numpy.qua... | [((615, 627), 'json.load', 'json.load', (['f'], {}), '(f)\n', (624, 627), False, 'import json\n'), ((11753, 11774), 'multiprocessing.Pool', 'Pool', ([], {'processes': 'procs'}), '(processes=procs)\n', (11757, 11774), False, 'from multiprocessing import Pool\n'), ((12629, 12650), 'multiprocessing.Pool', 'Pool', ([], {'p... |
import os
import torch
import shutil
import numpy as np
from torch import nn
import pytorch_lightning as pl
import torch.nn.functional as F
from torchvision import transforms
import torchvision.models as models
from collections import OrderedDict
from torch.utils.data import DataLoader
from torchvision.utils import sa... | [
"torch.optim.lr_scheduler.MultiStepLR",
"model_utils.RefineLavaLampModel",
"model_utils.RefineReactionDiffusionModel",
"torch.nn.MSELoss",
"model_utils.RefineDoublePendulumModel",
"os.path.exists",
"model_utils.RefineElasticPendulumModel",
"model_utils.RefineCircularMotionModel",
"model_utils.Refine... | [((983, 1005), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (997, 1005), False, 'import os\n'), ((1041, 1060), 'os.makedirs', 'os.makedirs', (['folder'], {}), '(folder)\n', (1052, 1060), False, 'import os\n'), ((1015, 1036), 'shutil.rmtree', 'shutil.rmtree', (['folder'], {}), '(folder)\n', (1028,... |
# Stdlib imports
import os
# Core Django imports
from django.core.management import call_command
# Third-party app imports
import pytest
# Imports from your apps
from usaspending_api.references.models import Rosetta
@pytest.mark.django_db
def test_rosetta_fresh_load():
test_file_path = os.path.abspath("usaspen... | [
"os.path.abspath",
"usaspending_api.references.models.Rosetta.objects.filter",
"usaspending_api.references.models.Rosetta.objects.count",
"django.core.management.call_command"
] | [((296, 388), 'os.path.abspath', 'os.path.abspath', (['"""usaspending_api/references/tests/data/20181219rosetta-test-file.xlsx"""'], {}), "(\n 'usaspending_api/references/tests/data/20181219rosetta-test-file.xlsx')\n", (311, 388), False, 'import os\n'), ((399, 422), 'usaspending_api.references.models.Rosetta.objects... |
import optparse
import os
def main():
parser = optparse.OptionParser(usage="%prog [OPTIONS]")
parser.add_option('-l', '--logfile',
help='log output to LOGFILE',
)
parser.add_option('-d', '--daemonize',
action='store_true',
help='become daemon as soon as possible',
)
pars... | [
"mwlib.utils.start_logging",
"mwlib.filequeue.FileJobPoller",
"optparse.OptionParser",
"mwlib.utils.safe_unlink",
"os.getpid",
"mwlib.utils.daemonize"
] | [((52, 98), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'usage': '"""%prog [OPTIONS]"""'}), "(usage='%prog [OPTIONS]')\n", (73, 98), False, 'import optparse\n'), ((1257, 1293), 'mwlib.utils.start_logging', 'utils.start_logging', (['options.logfile'], {}), '(options.logfile)\n', (1276, 1293), False, 'from mw... |
from pathlib import Path
import dash_core_components as dcc
import dash_html_components as html
from ...api_doc import ApiDoc
from ...helpers import (
ExampleContainer,
HighlightedSource,
load_source_with_environment,
)
from ...metadata import get_component_metadata
HERE = Path(__file__).parent
LOREM = (... | [
"dash_html_components.H4",
"dash_core_components.Markdown",
"dash_html_components.H2",
"pathlib.Path"
] | [((289, 303), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (293, 303), False, 'from pathlib import Path\n'), ((678, 717), 'dash_html_components.H2', 'html.H2', (['"""Modal"""'], {'className': '"""display-4"""'}), "('Modal', className='display-4')\n", (685, 717), True, 'import dash_html_components as html... |
# -*- coding: utf-8 -*-
# file: train_text_classification_glove.py
# time: 2021/8/5
# author: yangheng <<EMAIL>>
# github: https://github.com/yangheng95
# Copyright (C) 2021. All Rights Reserved.
from pyabsa import ClassificationConfigManager, ClassificationDatasetList
from pyabsa.functional import GloVeClas... | [
"pyabsa.functional.Trainer",
"pyabsa.ClassificationConfigManager.get_classification_config_glove"
] | [((384, 445), 'pyabsa.ClassificationConfigManager.get_classification_config_glove', 'ClassificationConfigManager.get_classification_config_glove', ([], {}), '()\n', (443, 445), False, 'from pyabsa import ClassificationConfigManager, ClassificationDatasetList\n'), ((908, 1013), 'pyabsa.functional.Trainer', 'Trainer', ([... |
import numpy as np
import pandas as pd
from text_process import Text_process
from helpers import create_folder_path,load_pk_file,save_pk_file
from sklearn.feature_extraction import DictVectorizer
from sklearn import utils
from sklearn.model_selection import train_test_split
from gensim.models.doc2vec import Doc2... | [
"gensim.models.doc2vec.TaggedDocument",
"helpers.load_pk_file",
"spacy.load",
"sklearn.utils.shuffle",
"os.path.join",
"multiprocessing.cpu_count",
"gensim.models.Word2Vec",
"helpers.create_folder_path",
"gensim.models.doc2vec.Doc2Vec",
"tqdm.tqdm.pandas"
] | [((519, 547), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (529, 547), False, 'import spacy\n'), ((596, 609), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (607, 609), False, 'from tqdm import tqdm\n'), ((1013, 1040), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count'... |
import os
import shutil
import stat
from ..base import TarballRecipe
class SoftwareFoundationsRecipe(TarballRecipe):
def __init__(self, *args, **kwargs):
super(SoftwareFoundationsRecipe, self).__init__(*args, **kwargs)
self.sha256 = '55376b75bcac244560b64b9c470422fa' \
'0bc6b... | [
"os.path.exists",
"os.path.join",
"os.chmod",
"shutil.copytree",
"shutil.rmtree"
] | [((578, 638), 'os.path.join', 'os.path.join', (['self.prefix_dir', '"""doc"""', '"""software-foundations"""'], {}), "(self.prefix_dir, 'doc', 'software-foundations')\n", (590, 638), False, 'import os\n'), ((650, 669), 'os.path.exists', 'os.path.exists', (['dir'], {}), '(dir)\n', (664, 669), False, 'import os\n'), ((710... |
# Generated by Django 3.1.6 on 2021-02-09 08:27
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Genre',
fields=[
... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((331, 424), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (347, 424), False, 'from django.db import migrations, models\... |
#!/usr/bin/env python
import time
from homie.device_state import Device_State
mqtt_settings = {
'MQTT_BROKER' : 'QueenMQTT',
'MQTT_PORT' : 1883,
}
#states allowed for this device
STATES = "A,B,C,D,E"
class My_State(Device_State):
def set_state(self,state):
print('Received MQTT message to set ... | [
"time.sleep"
] | [((537, 550), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (547, 550), False, 'import time\n'), ((591, 604), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (601, 604), False, 'import time\n'), ((645, 658), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (655, 658), False, 'import time\n')] |
import os
from bottle import request, HTTPError, redirect as bottle_redirect, response
from functools import wraps
from six.moves.urllib.parse import quote, urlencode
from webrecorder.utils import sanitize_tag, sanitize_title, get_bool
from webrecorder.models import User
from webrecorder.apiutils import api_decorato... | [
"webrecorder.utils.sanitize_title",
"bottle.response.set_header",
"bottle.request.forms.getunicode",
"os.environ.get",
"six.moves.urllib.parse.quote",
"functools.wraps",
"six.moves.urllib.parse.urlencode",
"bottle.HTTPError",
"bottle.request.query.getunicode",
"webrecorder.utils.sanitize_tag",
"... | [((862, 892), 'os.environ.get', 'os.environ.get', (['"""APP_HOST"""', '""""""'], {}), "('APP_HOST', '')\n", (876, 892), False, 'import os\n'), ((921, 955), 'os.environ.get', 'os.environ.get', (['"""CONTENT_HOST"""', '""""""'], {}), "('CONTENT_HOST', '')\n", (935, 955), False, 'import os\n'), ((1133, 1193), 'os.environ.... |
from main import api_wordcloud
from flask import Flask, request, jsonify
from flask_cors import cross_origin
from main import api_admin, api_client
import traceback
app = Flask(__name__)
# app.debug = True
@app.route('/')
@cross_origin()
def home():
return "home"
@app.route('/admin')
@cross_origin()
def admin():... | [
"flask.request.args.get",
"traceback.format_exc",
"flask.Flask",
"flask.jsonify",
"flask_cors.cross_origin",
"main.api_admin",
"main.api_wordcloud",
"main.api_client"
] | [((172, 187), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (177, 187), False, 'from flask import Flask, request, jsonify\n'), ((225, 239), 'flask_cors.cross_origin', 'cross_origin', ([], {}), '()\n', (237, 239), False, 'from flask_cors import cross_origin\n'), ((293, 307), 'flask_cors.cross_origin', 'cro... |
from keras import backend as K
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Conv2D, Flatten, MaxPooling2D, BatchNormalization, Activation, ZeroPadding2D, Add, AveragePooling2D
CHANNEL_AXIS = 1 if K.image_data_format() == "channels_first" else -1
def res_identity_block(... | [
"tensorflow.keras.layers.Input",
"keras.backend.image_data_format",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Add",
"tensorflow.keras.layers.AveragePooling2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"ten... | [((1963, 1987), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (1968, 1987), False, 'from tensorflow.keras.layers import Input, Dense, Conv2D, Flatten, MaxPooling2D, BatchNormalization, Activation, ZeroPadding2D, Add, AveragePooling2D\n'), ((3361, 3414), 'tensorflow.k... |
import csv
DEFAULT_INPUT_FILE = "input_file.csv"
DEFAULT_OUTPUT_FILE = "output_file.csv"
def read_csv_data(input_file, input_delimiter):
data = []
with open(input_file, "r") as csv_file:
reader = csv.reader(csv_file, delimiter=input_delimiter)
for row in reader:
data.append(row)
... | [
"csv.writer",
"csv.reader"
] | [((215, 262), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': 'input_delimiter'}), '(csv_file, delimiter=input_delimiter)\n', (225, 262), False, 'import csv\n'), ((668, 763), 'csv.writer', 'csv.writer', (['csv_file'], {'delimiter': 'output_delimiter', 'quotechar': '"""\\""""', 'quoting': 'csv.QUOTE_MINIMAL'}),... |
# -*- coding: utf-8 -*-
"""Test for updater.kalman module"""
import pytest
import numpy as np
from stonesoup.models.measurement.linear import LinearGaussian
from stonesoup.types.detection import Detection
from stonesoup.types.hypothesis import SingleHypothesis
from stonesoup.types.prediction import (
GaussianState... | [
"stonesoup.types.state.GaussianState",
"numpy.allclose",
"stonesoup.updater.kalman.SqrtKalmanUpdater",
"numpy.array",
"numpy.linalg.inv",
"numpy.array_equal",
"stonesoup.updater.kalman.KalmanUpdater",
"numpy.linalg.cholesky",
"stonesoup.types.hypothesis.SingleHypothesis"
] | [((3165, 3365), 'stonesoup.types.state.GaussianState', 'GaussianState', (['(prediction.mean + kalman_gain @ (measurement.state_vector -\n eval_measurement_prediction.mean))', '(prediction.covar - kalman_gain @ eval_measurement_prediction.covar @\n kalman_gain.T)'], {}), '(prediction.mean + kalman_gain @ (measurem... |
import re
from random import randint
from typing import Match
from typing import Optional
from retrying import retry
import apysc as ap
from apysc._expression import expression_data_util
from apysc._expression.event_handler_scope import HandlerScope
from apysc._type.copy_interface import CopyInterface
from... | [
"apysc._expression.expression_data_util.empty_expression",
"apysc._expression.expression_data_util.get_current_expression",
"apysc._type.variable_name_interface.VariableNameInterface",
"apysc._expression.event_handler_scope.HandlerScope",
"apysc.Array",
"apysc._expression.expression_data_util.get_current_... | [((559, 574), 'apysc._type.copy_interface.CopyInterface', 'CopyInterface', ([], {}), '()\n', (572, 574), False, 'from apysc._type.copy_interface import CopyInterface\n'), ((1007, 1046), 'apysc._expression.expression_data_util.empty_expression', 'expression_data_util.empty_expression', ([], {}), '()\n', (1044, 1046), Fa... |
#!/usr/bin/env python
import sys
from rq import Connection, Worker
from redis import Redis
# Preload libraries
import json
import copy
from bisect import bisect_left
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from globalsettings import blockSettings
import logging.config
import conv... | [
"rq.Worker",
"redis.Redis"
] | [((669, 679), 'rq.Worker', 'Worker', (['qs'], {}), '(qs)\n', (675, 679), False, 'from rq import Connection, Worker\n'), ((616, 636), 'redis.Redis', 'Redis', (['"""redis"""', '(6379)'], {}), "('redis', 6379)\n", (621, 636), False, 'from redis import Redis\n')] |
# -*- coding: UTF8 -*-
from pupylib.PupyModule import *
from pupylib.PupyCompleter import *
from rpyc.utils.classic import download
import os
import os.path
import time
__class_name__="DownloaderScript"
@config(category="manage")
class DownloaderScript(PupyModule):
""" download a file/directory from a remote syst... | [
"os.path.getsize",
"time.time",
"os.makedirs",
"rpyc.utils.classic.download"
] | [((1149, 1160), 'time.time', 'time.time', ([], {}), '()\n', (1158, 1160), False, 'import time\n'), ((1169, 1225), 'rpyc.utils.classic.download', 'download', (['self.client.conn', 'remote_file', 'args.local_file'], {}), '(self.client.conn, remote_file, args.local_file)\n', (1177, 1225), False, 'from rpyc.utils.classic i... |
import os
from PIL import Image
import math
import sys
import pickle
import warnings
def color_distance(c1, c2):
(r1, g1, b1) = c1
(r2, g2, b2) = c2
return math.sqrt((r1 - r2) ** 2 + (g1 - g2) ** 2 + (b1 - b2) ** 2)
def get_average_color(image):
input_image = image.resize((1, 1))
return input_im... | [
"os.path.exists",
"PIL.Image.open",
"pickle.dump",
"PIL.Image.new",
"os.path.join",
"math.sqrt",
"pickle.load",
"os.mkdir",
"warnings.filterwarnings",
"os.walk"
] | [((170, 229), 'math.sqrt', 'math.sqrt', (['((r1 - r2) ** 2 + (g1 - g2) ** 2 + (b1 - b2) ** 2)'], {}), '((r1 - r2) ** 2 + (g1 - g2) ** 2 + (b1 - b2) ** 2)\n', (179, 229), False, 'import math\n'), ((754, 787), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (777, 787), False,... |
import pprint
from bluesky.callbacks.zmq import RemoteDispatcher as ZmqRemoteDispatcher
from bluesky.callbacks.zmq import Publisher as ZmqPublisher
from event_model import RunRouter
zmq_listening_prefix = b"raw"
zmq_dispatcher = ZmqRemoteDispatcher(
address=("127.0.0.1", 5678), prefix=zmq_listening_prefix
)
# ... | [
"event_model.RunRouter",
"pprint.pformat",
"bluesky.callbacks.zmq.RemoteDispatcher",
"bluesky.callbacks.zmq.Publisher"
] | [((233, 310), 'bluesky.callbacks.zmq.RemoteDispatcher', 'ZmqRemoteDispatcher', ([], {'address': "('127.0.0.1', 5678)", 'prefix': 'zmq_listening_prefix'}), "(address=('127.0.0.1', 5678), prefix=zmq_listening_prefix)\n", (252, 310), True, 'from bluesky.callbacks.zmq import RemoteDispatcher as ZmqRemoteDispatcher\n'), ((4... |
from argparse import ArgumentParser
from losses import get_available_losses
def add_general_args(parser):
group = parser.add_argument_group("General options")
group.add_argument("--dataset", choices=["de-en", "en-fr", "fr-en"], required=True)
group.add_argument(
"--token-type", choices=["word", "... | [
"argparse.ArgumentParser",
"losses.get_available_losses"
] | [((1288, 1304), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1302, 1304), False, 'from argparse import ArgumentParser\n'), ((1429, 1445), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1443, 1445), False, 'from argparse import ArgumentParser\n'), ((400, 422), 'losses.get_available_lo... |
# mk_qd.py
#
# Make a blank QD (Quick Disk) image.
#
# Written & released by <NAME> <<EMAIL>>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import sys,struct,argparse
def main(argv):
parser = argparse.ArgumentPar... | [
"struct.pack",
"argparse.ArgumentParser"
] | [((300, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (323, 379), False, 'import sys, struct, argparse\n'), ((1205, 1234), 'struct.pack', 'struct.pack', (['"""<3x2s3x"""', "b'... |
bl_info = {
"name": "Denoiser animation Avisynth script generator",
"description": "Generate denoising script for Avisynth",
"author": "<NAME>",
"version": (0, 3),
"blender": (2, 78, 0),
"location": "Properties > Render > Denoising scrip generator",
"warning": "Requires Avisynth to denoise t... | [
"bpy.props.IntProperty",
"bpy.props.BoolProperty",
"bpy.utils.unregister_module",
"bpy.context.scene.render.frame_path",
"os.path.exists",
"bpy.props.FloatProperty",
"os.chmod",
"bpy.props.EnumProperty",
"bpy.utils.register_module",
"os.system",
"os.remove"
] | [((762, 786), 'bpy.props.BoolProperty', 'bpy.props.BoolProperty', ([], {}), '()\n', (784, 786), False, 'import bpy\n'), ((15611, 15696), 'bpy.props.BoolProperty', 'bpy.props.BoolProperty', ([], {'name': '"""SomeError"""', 'default': '(False)', 'description': '"""SomeError"""'}), "(name='SomeError', default=False, descr... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy import Item,Field
class BasicInfoItem(Item):
basic_id = Field()
city_id = Field()
city_name = Field()
district_name = Field()
distric... | [
"scrapy.Field"
] | [((227, 234), 'scrapy.Field', 'Field', ([], {}), '()\n', (232, 234), False, 'from scrapy import Item, Field\n'), ((249, 256), 'scrapy.Field', 'Field', ([], {}), '()\n', (254, 256), False, 'from scrapy import Item, Field\n'), ((273, 280), 'scrapy.Field', 'Field', ([], {}), '()\n', (278, 280), False, 'from scrapy import ... |
import functools
import random, logging, os
from biostar.accounts.tasks import create_messages
from biostar.emailer.tasks import send_email
from django.conf import settings
import time, random
from biostar.utils.decorators import task, timer
from biostar.forum.auth import db_logger
from django.db.models import Q
logg... | [
"logging.getLogger",
"biostar.forum.models.Award",
"biostar.forum.auth.db_logger",
"biostar.utils.spamlib.classify_content",
"random.shuffle",
"biostar.emailer.tasks.send_email",
"biostar.forum.models.Subscription.objects.filter",
"biostar.accounts.models.User.objects.order_by",
"os.path.isfile",
... | [((325, 352), 'logging.getLogger', 'logging.getLogger', (['"""engine"""'], {}), "('engine')\n", (342, 352), False, 'import random, logging, os\n'), ((3285, 3313), 'biostar.forum.auth.valid_awards', 'auth.valid_awards', ([], {'user': 'user'}), '(user=user)\n', (3302, 3313), False, 'from biostar.forum import auth, models... |
'''
@Author: fxm
@Date: Dec 27, 2020.
@Title: SelfPlay class.
'''
import logging
from tqdm import tqdm
log = logging.getLogger(__name__)
'''
SelfPlay类
自博弈过程
'''
class SelfPlay():
'''
初始化
参数设置:
net1, net2: 两个智能体玩家,接收棋盘为输入并输出动作
game:游戏对象
display:布尔值,是否输出棋... | [
"logging.getLogger"
] | [((123, 150), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (140, 150), False, 'import logging\n')] |
#!/usr/bin/python3
import dearpygui.dearpygui as ui
import serial.tools.list_ports
import json
import threading
import time
from enum import Enum
from img102_UART import *
baudrate_list = ('500000', '1000000', '2000000', '4000000')
dithering_list = ('None', 'Floyd-Steinberg', 'Atkinson', 'Burkes', 'Sierra', 'Two-Row S... | [
"dearpygui.dearpygui.create_viewport",
"dearpygui.dearpygui.add_input_int",
"dearpygui.dearpygui.add_combo",
"time.sleep",
"dearpygui.dearpygui.window",
"dearpygui.dearpygui.add_radio_button",
"dearpygui.dearpygui.add_slider_int",
"dearpygui.dearpygui.tab_bar",
"dearpygui.dearpygui.create_context",
... | [((3887, 3903), 'time.sleep', 'time.sleep', (['(0.15)'], {}), '(0.15)\n', (3897, 3903), False, 'import time\n'), ((4793, 4843), 'threading.Thread', 'threading.Thread', ([], {'target': 'tr.main_loop', 'daemon': '(True)'}), '(target=tr.main_loop, daemon=True)\n', (4809, 4843), False, 'import threading\n'), ((4864, 4883),... |
#!/usr/bin/env python3
"""
focus_next_visible.py - toggles focus between visible windows on workspace
- requires https://github.com/acrisci/i3ipc-python
"""
from sys import argv
from itertools import cycle
from subprocess import check_output
import i3ipc
def get_windows_on_ws(conn):
return filter(lambda x: x... | [
"i3ipc.Connection",
"itertools.cycle"
] | [((836, 854), 'i3ipc.Connection', 'i3ipc.Connection', ([], {}), '()\n', (852, 854), False, 'import i3ipc\n'), ((1025, 1039), 'itertools.cycle', 'cycle', (['visible'], {}), '(visible)\n', (1030, 1039), False, 'from itertools import cycle\n')] |
# setupPly.py ---
#
# Description:
# Author: <NAME>
# Date: 28 Jun 2019
# https://arxiv.org/abs/1904.01701
#
# Instituto Superior Técnico (IST)
# Code:
import open3d as o3d
import argparse
import os
from glob import glob
import pickle
from global_registration import preprocess_point_cloud, execute_global_registratio... | [
"numpy.trace",
"open3d.PointCloud",
"numpy.array",
"open3d.Vector2iVector",
"numpy.linalg.norm",
"copy.deepcopy",
"global_registration.execute_global_registration",
"numpy.arange",
"open3d.TransformationEstimationPointToPoint",
"open3d.VisualizerWithEditing",
"argparse.ArgumentParser",
"numpy.... | [((407, 432), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (430, 432), False, 'import argparse\n'), ((939, 964), 'os.path.join', 'os.path.join', (['path', 'depth'], {}), '(path, depth)\n', (951, 964), False, 'import os\n'), ((1006, 1029), 'os.path.join', 'os.path.join', (['path', 'rgb'], {}),... |
from aoc2020 import *
from aoc2020.utils import math_product
from itertools import chain
import numpy as np
def tborder(tile):
_, m = tile
return "".join(m[0])
def bborder(tile):
_, m = tile
return "".join(m[-1])
def lborder(tile):
_, m = tile
return "".join(m[:,0])
def rborder(tile):
... | [
"numpy.fliplr",
"numpy.array",
"aoc2020.utils.math_product",
"numpy.rot90"
] | [((517, 529), 'numpy.fliplr', 'np.fliplr', (['m'], {}), '(m)\n', (526, 529), True, 'import numpy as np\n'), ((727, 817), 'aoc2020.utils.math_product', 'math_product', (['[image_table[y][x][0] for x, y in [(0, 0), (0, -1), (-1, 0), (-1, -1)]]'], {}), '([image_table[y][x][0] for x, y in [(0, 0), (0, -1), (-1, 0), (\n ... |
#!/usr/bin/env python
# coding: utf-8
# <img src="imagenes/rn3.png" width="200">
# <img src="http://www.identidadbuho.uson.mx/assets/letragrama-rgb-150.jpg" width="200">
#
# # [Curso de Redes Neuronales](https://curso-redes-neuronales-unison.github.io/Temario/)
#
# # Operaciones básicas en TensorFlow
#
# [**<NAME>... | [
"tensorflow.InteractiveSession",
"tensorflow.reset_default_graph",
"tensorflow.Variable",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.multiply",
"tensorflow.add",
"tensorflow.global_variables_initializer",
"tensorflow.assign",
"tensorflow.constant",
"tensorflow.matmul",
"tensor... | [((2105, 2127), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (2125, 2127), True, 'import tensorflow as tf\n'), ((2319, 2335), 'tensorflow.constant', 'tf.constant', (['(1.0)'], {}), '(1.0)\n', (2330, 2335), True, 'import tensorflow as tf\n'), ((3869, 3881), 'tensorflow.Session', 'tf.Session'... |
import os
from sentio_prober_control.Sentio.ProberSentio import *
from sentio_prober_control.Communication.CommunicatorGpib import *
from sentio_prober_control.Communication.CommunicatorTcpIp import *
def main():
try:
# prober = SentioProber(CommunicatorGpib.create(GpibCardVendor.Adlink, "GPIB0:20"))
... | [
"os.path.abspath"
] | [((683, 708), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (698, 708), False, 'import os\n')] |
"""Check if state is mixed."""
import numpy as np
from toqito.state_props import is_pure
def is_mixed(state: np.ndarray) -> bool:
r"""
Determine if a given quantum state is mixed [WikMix]_.
A mixed state by definition is a state that is not pure.
Examples
==========
Consider the following d... | [
"toqito.state_props.is_pure"
] | [((1195, 1209), 'toqito.state_props.is_pure', 'is_pure', (['state'], {}), '(state)\n', (1202, 1209), False, 'from toqito.state_props import is_pure\n')] |
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMenu
from utils.utils import read_text_file
from utils.resources import Resources
class HelpMenu(QMenu):
def __init__(self, app):
super(HelpMenu, self).__init__()
self.app = app
self.feedbackAction = self.addAction("feedback")
... | [
"utils.resources.Resources.getResourcesPathByTheme",
"utils.resources.Resources.getIconByFilename"
] | [((774, 824), 'utils.resources.Resources.getIconByFilename', 'Resources.getIconByFilename', (['"""none_black_18dp.png"""'], {}), "('none_black_18dp.png')\n", (801, 824), False, 'from utils.resources import Resources\n'), ((531, 579), 'utils.resources.Resources.getResourcesPathByTheme', 'Resources.getResourcesPathByThem... |
import pandas as pd
from pytest import mark
from pytest import approx
@mark.inflation
@mark.usefixtures('_init_inflation')
class TestInflation:
def test_get_infl_rub_data(self):
assert self.infl_rub.first_date == pd.to_datetime('1991-01')
assert self.infl_rub.pl.years == 10
assert self.in... | [
"pytest.approx",
"pytest.mark.usefixtures",
"pandas.to_datetime"
] | [((89, 124), 'pytest.mark.usefixtures', 'mark.usefixtures', (['"""_init_inflation"""'], {}), "('_init_inflation')\n", (105, 124), False, 'from pytest import mark\n'), ((2418, 2449), 'pytest.mark.usefixtures', 'mark.usefixtures', (['"""_init_rates"""'], {}), "('_init_rates')\n", (2434, 2449), False, 'from pytest import ... |
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence
from torch.nn.utils.rnn import pad_packed_sequence
def l2norm(inputs, dim=-1):
# inputs: (batch, dim_ft)
norm = torch.norm(... | [
"torch.sort",
"torch.index_select",
"torch.abs",
"torch.unsqueeze",
"torch.norm",
"torch.cuda.is_available",
"torch.arange",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.FloatTensor",
"torch.clamp"
] | [((309, 355), 'torch.norm', 'torch.norm', (['inputs'], {'p': '(2)', 'dim': 'dim', 'keepdim': '(True)'}), '(inputs, p=2, dim=dim, keepdim=True)\n', (319, 355), False, 'import torch\n'), ((1180, 1217), 'torch.sort', 'torch.sort', (['seq_lens'], {'descending': '(True)'}), '(seq_lens, descending=True)\n', (1190, 1217), Fal... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
pio.templates.default = "simple_white"
def test_univariate_gaussian():
# Question 1 - Draw samples and print fitted model
sample = np.random.normal(10, 1, 1000)
... | [
"numpy.random.normal",
"plotly.graph_objects.Heatmap",
"numpy.random.multivariate_normal",
"numpy.sort",
"numpy.argmax",
"plotly.graph_objects.Figure",
"numpy.array",
"numpy.linspace",
"plotly.graph_objects.Scatter",
"numpy.random.seed",
"numpy.shape",
"IMLearn.learners.UnivariateGaussian",
... | [((288, 317), 'numpy.random.normal', 'np.random.normal', (['(10)', '(1)', '(1000)'], {}), '(10, 1, 1000)\n', (304, 317), True, 'import numpy as np\n'), ((327, 347), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (345, 347), False, 'from IMLearn.learners import UnivariateGaussian, Multiva... |
MQTT_HOST = "192.168.12.1"
CONTROL_NODE = "touch01"
# install pynput: https://pynput.readthedocs.io/en/latest/
from pynput import keyboard
kbc = keyboard.Controller()
key=keyboard.Key
KEYBOARD_MAP = {
0:key.left,
1:key.right,
2:key.up,
3:key.down,
4:key.space,
5:"a",
6:"d",
7:"w",
... | [
"pynput.keyboard.Controller"
] | [((147, 168), 'pynput.keyboard.Controller', 'keyboard.Controller', ([], {}), '()\n', (166, 168), False, 'from pynput import keyboard\n')] |
# ===============================================================================
# Copyright 2013 <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/... | [
"sqlalchemy.orm.relationship",
"pychron.database.orms.isotope.util.foreignkey",
"sqlalchemy.sql.expression.func.now",
"sqlalchemy.Column"
] | [((1312, 1327), 'sqlalchemy.Column', 'Column', (['Integer'], {}), '(Integer)\n', (1318, 1327), False, 'from sqlalchemy import Column, Integer, BLOB, Float, DateTime\n'), ((1341, 1397), 'sqlalchemy.orm.relationship', 'relationship', (['"""spec_MassCalScanTable"""'], {'backref': '"""history"""'}), "('spec_MassCalScanTabl... |
import os
src_folder = "/home/sean/Downloads/nanodet_onnx"
onnx2ncnn = "/home/sean/Desktop/ncnn/build/tools/onnx/onnx2ncnn"
ncnn2opt = "/home/sean//ncnn/build/tools/ncnnoptimize"
# curr_path = os.getcwd()
# src_folder
for folder in os.listdir(src_folder):
sub_folder = os.path.join(src_folder, folder)
ncnn_bin... | [
"os.system",
"os.listdir",
"os.path.join"
] | [((234, 256), 'os.listdir', 'os.listdir', (['src_folder'], {}), '(src_folder)\n', (244, 256), False, 'import os\n'), ((275, 307), 'os.path.join', 'os.path.join', (['src_folder', 'folder'], {}), '(src_folder, folder)\n', (287, 307), False, 'import os\n'), ((328, 364), 'os.path.join', 'os.path.join', (['sub_folder', '"""... |
# -*- coding: UTF-8 -*-
"""
此脚本用于展示如何利用LDA做数据降维
"""
import sys
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
def load_data():
"""
读取scikit-learn自带数据:手写数字
"""
digits = datasets... | [
"sklearn.datasets.load_digits",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"sklearn.discriminant_analysis.LinearDiscriminantAnalysis",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((312, 334), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (332, 334), False, 'from sklearn import datasets\n'), ((473, 515), 'sklearn.discriminant_analysis.LinearDiscriminantAnalysis', 'LinearDiscriminantAnalysis', ([], {'n_components': '(3)'}), '(n_components=3)\n', (499, 515), False, 'fr... |
#!/usr/bin/python3
# coding: utf-8
# Usage: read_posts.py [document]
# Creates language dictionaries based on tags and inline one-word code blocks on Stack Overflow.
# To be used with documents from the Stack Exchange data dump (https://archive.org/details/stackexchange)
from lxml import etree
import collections
impo... | [
"re.compile",
"collections.Counter",
"lxml.etree.iterparse",
"collections.defaultdict",
"sys.exit",
"re.findall"
] | [((532, 572), 're.compile', 're.compile', (['"""\\\\<([a-z0-9\\\\.\\\\#\\\\-]+)\\\\>"""'], {}), "('\\\\<([a-z0-9\\\\.\\\\#\\\\-]+)\\\\>')\n", (542, 572), False, 'import re\n'), ((578, 621), 're.compile', 're.compile', (['"""\\\\<code\\\\>(\\\\w+)\\\\<\\\\/code\\\\>"""'], {}), "('\\\\<code\\\\>(\\\\w+)\\\\<\\\\/code\\\\... |
#
# Copyright (c) 2019 by Delphix. All rights reserved.
#
# flake8: noqa
from dlpx.virtualization.platform import Plugin, Status
direct = Plugin()
@direct.discovery.repository()
def repository_discovery(source_connection):
return []
@direct.discovery.source_config()
def source_config_discovery(source_connectio... | [
"dlpx.virtualization.platform.Plugin"
] | [((139, 147), 'dlpx.virtualization.platform.Plugin', 'Plugin', ([], {}), '()\n', (145, 147), False, 'from dlpx.virtualization.platform import Plugin, Status\n')] |
from ads import adssymbols
def test_plc_string():
s = adssymbols.PLCString.create(25)
print(s)
| [
"ads.adssymbols.PLCString.create"
] | [((66, 97), 'ads.adssymbols.PLCString.create', 'adssymbols.PLCString.create', (['(25)'], {}), '(25)\n', (93, 97), False, 'from ads import adssymbols\n')] |
from flask_wtf import FlaskForm
from wtforms.fields import (
StringField,
SubmitField,
)
from wtforms.validators import InputRequired
class Delete(FlaskForm):
name = StringField("Name", validators=[InputRequired()])
submit = SubmitField ('Delete this corpus')
| [
"wtforms.validators.InputRequired",
"wtforms.fields.SubmitField"
] | [((243, 276), 'wtforms.fields.SubmitField', 'SubmitField', (['"""Delete this corpus"""'], {}), "('Delete this corpus')\n", (254, 276), False, 'from wtforms.fields import StringField, SubmitField\n'), ((212, 227), 'wtforms.validators.InputRequired', 'InputRequired', ([], {}), '()\n', (225, 227), False, 'from wtforms.val... |
from __future__ import annotations
from jsonclasses import jsonclass, types
@jsonclass
class SuperFilter:
list1: list[int] | None = types.listof(int).filter(lambda i: i % 2 == 0)
list2: list[int] | None = types.listof(int).filter(types.mod(2).eq(0))
| [
"jsonclasses.types.listof",
"jsonclasses.types.mod"
] | [((138, 155), 'jsonclasses.types.listof', 'types.listof', (['int'], {}), '(int)\n', (150, 155), False, 'from jsonclasses import jsonclass, types\n'), ((215, 232), 'jsonclasses.types.listof', 'types.listof', (['int'], {}), '(int)\n', (227, 232), False, 'from jsonclasses import jsonclass, types\n'), ((240, 252), 'jsoncla... |
import cv2
from imutils.video import FPS
tracker=cv2.TrackerCSRT_create()
#initialize the bounding box
initbb=None
fps=None
cap=cv2.VideoCapture(0)
while True:
_,frame=cap.read()
#frame=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
frame=cv2.resize(frame,(640, 480))
(H,W) =frame.shape[:2]
if initbb is no... | [
"cv2.rectangle",
"cv2.imshow",
"cv2.putText",
"imutils.video.FPS",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.selectROI",
"cv2.resize",
"cv2.waitKey",
"cv2.TrackerCSRT_create"
] | [((50, 74), 'cv2.TrackerCSRT_create', 'cv2.TrackerCSRT_create', ([], {}), '()\n', (72, 74), False, 'import cv2\n'), ((130, 149), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (146, 149), False, 'import cv2\n'), ((1220, 1243), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1241, 1... |
"""
.. _ref_multi_stage_cyclic_advanced:
Multi-stage Cyclic Symmetry Use Advanced Customization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This example shows how to expand on selected sectors the mesh and results from a
multi-stage cyclic analysis.
It also shows how to use the cyclic support for advanced p... | [
"ansys.dpf.core.Model",
"ansys.dpf.core.operators.metadata.cyclic_support_provider",
"ansys.dpf.core.ScopingsContainer",
"ansys.dpf.core.Scoping",
"ansys.dpf.core.examples.download_multi_stage_cyclic_result",
"ansys.dpf.core.operators.metadata.cyclic_mesh_expansion",
"ansys.dpf.core.operators.result.cyc... | [((596, 641), 'ansys.dpf.core.examples.download_multi_stage_cyclic_result', 'examples.download_multi_stage_cyclic_result', ([], {}), '()\n', (639, 641), False, 'from ansys.dpf.core import examples\n'), ((650, 664), 'ansys.dpf.core.Model', 'dpf.Model', (['cyc'], {}), '(cyc)\n', (659, 664), True, 'from ansys.dpf import c... |
from typing import Set, Optional, Iterable
from django.urls import reverse
from lazy import lazy
from annotation.models import ClinVar, ClinVarVersion
from classification.enums import SpecialEKeys
from classification.views.classification_export_utils import ExportFormatter, AlleleGroup
from library.django_utils impor... | [
"annotation.models.ClinVar.objects.filter",
"library.utils.export_column",
"annotation.models.ClinVarVersion.objects.filter",
"django.urls.reverse"
] | [((1012, 1027), 'library.utils.export_column', 'export_column', ([], {}), '()\n', (1025, 1027), False, 'from library.utils import ExportRow, export_column\n'), ((1173, 1188), 'library.utils.export_column', 'export_column', ([], {}), '()\n', (1186, 1188), False, 'from library.utils import ExportRow, export_column\n'), (... |
from math import exp
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
class LR():
def __init__(self,max_iterator=200,learning_rate = 0.01):
self.max_iterator = max_iterator
self.learning... | [
"math.exp",
"numpy.dot",
"numpy.transpose",
"numpy.hstack"
] | [((597, 627), 'numpy.hstack', 'np.hstack', (['(pad, data_feature)'], {}), '((pad, data_feature))\n', (606, 627), True, 'import numpy as np\n'), ((1507, 1530), 'numpy.dot', 'np.dot', (['x', 'self.weights'], {}), '(x, self.weights)\n', (1513, 1530), True, 'import numpy as np\n'), ((387, 394), 'math.exp', 'exp', (['(-x)']... |
import numpy as np
from torch.utils.data import Dataset
import jsonlines
import json
import random
from tqdm import tqdm
import pandas as pd
try:
from vocab_gen import *
except ImportError:
from datasets.vocab_gen import *
class YelpDataset(Dataset):
def __init__(self, jsonl_file:str, tokenizer=None, max_... | [
"random.shuffle",
"json.dump",
"tqdm.tqdm",
"numpy.asarray",
"jsonlines.open",
"numpy.array",
"numpy.savetxt",
"pandas.read_json"
] | [((5103, 5130), 'tqdm.tqdm', 'tqdm', (['training_yelp.reviews'], {}), '(training_yelp.reviews)\n', (5107, 5130), False, 'from tqdm import tqdm\n'), ((2582, 2598), 'numpy.array', 'np.array', (['review'], {}), '(review)\n', (2590, 2598), True, 'import numpy as np\n'), ((2914, 2942), 'random.shuffle', 'random.shuffle', ([... |
import os, numpy as np
class CMIP6_models:
total_num = 0
instances = []
file_path = './'
def __init__(self, Name, Res, Grids, CaseList, VarLab):
self.__class__.instances.append(self)
self.Name = Name
self.Res = Res
self.Grids = Grids
self.CaseList = CaseList
... | [
"os.listdir",
"numpy.unique"
] | [((840, 861), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (850, 861), False, 'import os, numpy as np\n'), ((1041, 1061), 'numpy.unique', 'np.unique', (['timestamp'], {}), '(timestamp)\n', (1050, 1061), True, 'import os, numpy as np\n')] |
# pip install pycocotools opencv-python opencv-contrib-python
# wget https://github.com/opencv/opencv_extra/raw/master/testdata/cv/ximgproc/model.yml.gz
import os
import copy
import time
import argparse
import contextlib
import multiprocessing
import numpy as np
import cv2
import cv2.ximgproc
import matplotlib.patc... | [
"pycocotools.cocoeval.COCOeval",
"numpy.array",
"copy.deepcopy",
"matplotlib.pyplot.imshow",
"os.path.exists",
"cv2.ximgproc.createStructuredEdgeDetection",
"argparse.ArgumentParser",
"numpy.asarray",
"pycocotools.coco.COCO",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"cv2.ximgproc.s... | [((548, 560), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (558, 560), True, 'import matplotlib.pyplot as plt\n'), ((565, 580), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (575, 580), True, 'import matplotlib.pyplot as plt\n'), ((585, 600), 'matplotlib.pyplot.axis', 'plt.axis', ([... |
import numpy as np
import os
import csv
import sys
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from keras.callbacks import EarlyStopping, Callback
from keras.models import Model, Sequential, load_model
from keras.layers import Input, Dense, Dropout, Fla... | [
"keras.backend.sum",
"math.sqrt",
"scipy.stats.pearsonr",
"keras.layers.Dense",
"numpy.mean",
"numpy.delete",
"keras.utils.plot_model",
"keras.backend.square",
"numpy.asarray",
"os.path.isdir",
"os.mkdir",
"numpy.concatenate",
"keras.models.Model",
"sklearn.metrics.mean_absolute_error",
... | [((3941, 3983), 'numpy.load', 'np.load', (['"""outliers.npy"""'], {'allow_pickle': '(True)'}), "('outliers.npy', allow_pickle=True)\n", (3948, 3983), True, 'import numpy as np\n'), ((3991, 4033), 'numpy.load', 'np.load', (['"""X_ab_aux.npy"""'], {'allow_pickle': '(True)'}), "('X_ab_aux.npy', allow_pickle=True)\n", (399... |
import requests, json, re
from requests import get
def main():
n = 1
check = True
while check == True:
check = scrape(n)
n = n+1
def scrape(n):
if n > 403:
n = n+1
url = 'https://xkcd.com/%d/info.0.json' %n
r = requests.get(url)
if r.status_code == 200:
file =... | [
"re.sub",
"requests.get"
] | [((259, 276), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (271, 276), False, 'import requests, json, re\n'), ((404, 452), 're.sub', 're.sub', (['"""\\\\[\\\\[\\\\s*(.*?)\\\\s*\\\\]\\\\]"""', '""""""', 'content'], {}), "('\\\\[\\\\[\\\\s*(.*?)\\\\s*\\\\]\\\\]', '', content)\n", (410, 452), False, 'import r... |
import subprocess
import sys
import pytest
import pyprctl
from .util import restore_old_value
def test_no_new_privs_set() -> None:
assert not pyprctl.get_no_new_privs()
pyprctl.set_no_new_privs()
assert pyprctl.get_no_new_privs()
@restore_old_value(pyprctl.get_keepcaps, pyprctl.set_keepcaps)
def test... | [
"pyprctl.caps._capset_from_bitmask",
"pyprctl.cap_ambient.limit",
"pyprctl.cap_ambient_clear_all",
"pyprctl.Cap.probe_supported",
"subprocess.Popen",
"pyprctl.get_no_new_privs",
"pyprctl.capbset_probe",
"pyprctl.CapState.get_current",
"pyprctl.set_keepcaps",
"pyprctl.cap_ambient_is_set",
"pyprct... | [((182, 208), 'pyprctl.set_no_new_privs', 'pyprctl.set_no_new_privs', ([], {}), '()\n', (206, 208), False, 'import pyprctl\n'), ((220, 246), 'pyprctl.get_no_new_privs', 'pyprctl.get_no_new_privs', ([], {}), '()\n', (244, 246), False, 'import pyprctl\n'), ((352, 378), 'pyprctl.set_keepcaps', 'pyprctl.set_keepcaps', (['(... |
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... | [
"sagemaker.workflow.steps.TrainingStep",
"tests.integ.retry.retries",
"sagemaker.workflow.pipeline.Pipeline",
"sagemaker.get_execution_role",
"os.path.join",
"sagemaker.pytorch.estimator.PyTorch",
"sagemaker.debugger.rule_configs.all_zero",
"uuid.uuid4",
"sagemaker.workflow.parameters.ParameterInteg... | [((1199, 1236), 'sagemaker.get_execution_role', 'get_execution_role', (['sagemaker_session'], {}), '(sagemaker_session)\n', (1217, 1236), False, 'from sagemaker import TrainingInput, get_execution_role, utils\n'), ((1287, 1338), 'sagemaker.utils.unique_name_from_base', 'utils.unique_name_from_base', (['"""my-pipeline-t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Matlab to Python Code Converter
"""
import re
#print re.sub(r"\[((\S)\s*)+\]", "\[ \2 \]", txt)
function_template = \
"""
def {functioname}({arguments}):
{code}
return {outputs}
"""
def tralaste_general(text):
text= text.replace(';', '') # Remove s... | [
"re.sub",
"re.escape",
"re.finditer",
"re.compile"
] | [((927, 961), 're.sub', 're.sub', (['"""\x08NaN\x08"""', '"""nan"""', 'text'], {}), "('\\x08NaN\\x08', 'nan', text)\n", (933, 961), False, 'import re\n'), ((969, 1003), 're.sub', 're.sub', (['"""\x08Inf\x08"""', '"""inf"""', 'text'], {}), "('\\x08Inf\\x08', 'inf', text)\n", (975, 1003), False, 'import re\n'), ((1012, 1... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyramid.events import subscriber
from h.accounts import events
from h.stats import get_client as stats
@subscriber(events.LoginEvent)
def login(event):
stats(event.request).get_counter('auth.local.login').increment()
@subscriber(events.Logou... | [
"pyramid.events.subscriber",
"h.stats.get_client"
] | [((177, 206), 'pyramid.events.subscriber', 'subscriber', (['events.LoginEvent'], {}), '(events.LoginEvent)\n', (187, 206), False, 'from pyramid.events import subscriber\n'), ((297, 327), 'pyramid.events.subscriber', 'subscriber', (['events.LogoutEvent'], {}), '(events.LogoutEvent)\n', (307, 327), False, 'from pyramid.e... |
import logging
import io
import unittest
from soar_soi.io.logging import get_logger, MyLogFormatter
class TestLogFormat(unittest.TestCase):
logger_name = 'TestLogFormatApp'
expected_log_format = \
r'(\[[D,I,W,E,C]\s\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s\w*\]\s)'
def setUp(self):
self.... | [
"logging.StreamHandler",
"soar_soi.io.logging.get_logger",
"soar_soi.io.logging.MyLogFormatter",
"logging.getLevelName",
"io.StringIO"
] | [((332, 348), 'soar_soi.io.logging.MyLogFormatter', 'MyLogFormatter', ([], {}), '()\n', (346, 348), False, 'from soar_soi.io.logging import get_logger, MyLogFormatter\n'), ((371, 384), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (382, 384), False, 'import io\n'), ((408, 442), 'logging.StreamHandler', 'logging.Strea... |
"""Quote
Archive, search, and recite humorous, inspiring, or out-of-context quotes.
Includes a variety of commands for searching and managing quotes, as well as
reporting quote database statistics.
"""
from __future__ import annotations
import itertools
import re
import sqlite3
import textwrap
from collections impor... | [
"datetime.datetime.utcnow",
"re.compile",
"textwrap.TextWrapper",
"ZeroBot.util.flatten",
"re.match",
"functools.partial",
"datetime.datetime.fromisoformat",
"itertools.compress",
"ZeroBot.protocol.discord.classes.DiscordMessage"
] | [((1170, 1201), 're.compile', 're.compile', (['"""(?:\\\\n|\\\\\\\\n)\\\\s*"""'], {}), "('(?:\\\\n|\\\\\\\\n)\\\\s*')\n", (1180, 1201), False, 'import re\n'), ((1218, 1248), 're.compile', 're.compile', (['"""(?:<(.+)>|(.+):)"""'], {}), "('(?:<(.+)>|(.+):)')\n", (1228, 1248), False, 'import re\n'), ((1271, 1295), 're.co... |
'''script for utils
'''
import json
import re
import select
import subprocess
import sys
import config
def writeerr(cont):
sys.stderr.write(cont)
sys.stderr.write("\n")
def writeerr_and_exit(cont):
writeerr(cont)
sys.exit(1)
def format_string(cont):
cont = cont.replace('\r\n', '\n')
cont ... | [
"select.select",
"subprocess.Popen",
"sys.stdin.readline",
"sys.stderr.write",
"sys.exit",
"json.load",
"re.sub",
"json.dump"
] | [((130, 152), 'sys.stderr.write', 'sys.stderr.write', (['cont'], {}), '(cont)\n', (146, 152), False, 'import sys\n'), ((157, 179), 'sys.stderr.write', 'sys.stderr.write', (['"""\n"""'], {}), "('\\n')\n", (173, 179), False, 'import sys\n'), ((234, 245), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (242, 245), False, ... |
# Imports
from pynput.mouse import Button, Controller
import keyboard
import tkinter
import time
# Defining a variable again because I might decide to expand
def run(clicks=0):
count = click_count.get()
mouse = Controller()
while 1:
if keyboard.is_pressed('-'):
for i in ra... | [
"tkinter.Entry",
"keyboard.is_pressed",
"tkinter.Button",
"time.sleep",
"tkinter.Tk",
"pynput.mouse.Controller"
] | [((552, 564), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (562, 564), False, 'import tkinter\n'), ((575, 672), 'tkinter.Button', 'tkinter.Button', ([], {'text': '"""INITIATE HACK"""', 'width': '(25)', 'height': '(5)', 'bg': '"""gray"""', 'fg': '"""white"""', 'command': 'run'}), "(text='INITIATE HACK', width=25, heigh... |
"""
This is a sample implementation for working PyTorch Geometric with DeepChem!
"""
import torch.nn as nn
from deepchem.models.torch_models.torch_model import TorchModel
class GAT(nn.Module):
"""Graph Attention Networks.
This model takes arbitary graphs as an input, and predict graph properties. This model is
... | [
"torch_geometric.nn.GATConv",
"torch_geometric.data.Batch.from_data_list",
"torch.nn.Linear"
] | [((2831, 2870), 'torch.nn.Linear', 'nn.Linear', (['in_node_dim', 'hidden_node_dim'], {}), '(in_node_dim, hidden_node_dim)\n', (2840, 2870), True, 'import torch.nn as nn\n'), ((3172, 3222), 'torch.nn.Linear', 'nn.Linear', (['hidden_node_dim', 'predictor_hidden_feats'], {}), '(hidden_node_dim, predictor_hidden_feats)\n',... |
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
class OutageTest(TestCase):
def test_command_output(self):
out = StringIO()
# call_command("playlists", stdout=out)
# self.assertIn("Expected output", out.getvalue())
| [
"io.StringIO"
] | [((184, 194), 'io.StringIO', 'StringIO', ([], {}), '()\n', (192, 194), False, 'from io import StringIO\n')] |