code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python
# System Imports
from random import randrange
# Panda3d Imports
import gltf
from panda3d.bullet import *
from panda3d.core import *
# Game Imports
class LevelLoader():
def __init__(self, _game):
self.game = _game
# Physics World
self.physicsWorld = self.game.physics.physicsWorld
# Load L... | [
"random.randrange"
] | [((1671, 1687), 'random.randrange', 'randrange', (['(0)', '(50)'], {}), '(0, 50)\n', (1680, 1687), False, 'from random import randrange\n'), ((1807, 1822), 'random.randrange', 'randrange', (['(0)', '(4)'], {}), '(0, 4)\n', (1816, 1822), False, 'from random import randrange\n')] |
import os, sys, numpy
from scipy.interpolate import RectBivariateSpline, interp2d
from scipy.optimize import curve_fit
from matplotlib import cm
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib.figure import Figure
try:
from mpl_toolkits.mplot3d import Axes3D # necessario per caric... | [
"oasys.widgets.gui.widgetBox",
"numpy.sqrt",
"orangecontrib.shadow.util.shadow_objects.ShadowOpticalElement.create_ellipsoid_mirror",
"oasys.widgets.gui.createTabPage",
"oasys.widgets.congruence.checkFileName",
"numpy.log",
"oasys.widgets.congruence.checkStrictlyPositiveNumber",
"oasys.widgets.gui.tab... | [((2776, 2786), 'orangewidget.settings.Setting', 'Setting', (['(0)'], {}), '(0)\n', (2783, 2786), False, 'from orangewidget.settings import Setting\n'), ((2807, 2819), 'orangewidget.settings.Setting', 'Setting', (['(100)'], {}), '(100)\n', (2814, 2819), False, 'from orangewidget.settings import Setting\n'), ((2839, 285... |
# Copyright 2020 <NAME> <<EMAIL>>
# 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... | [
"setuptools.find_packages"
] | [((1055, 1070), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1068, 1070), False, 'from setuptools import find_packages\n')] |
"""Setup file.
<NAME>, 2018
"""
import setuptools
setuptools.setup(
name="ece312_clicker",
version="0.1.0",
url="https://github.com/tommz9/ece312-clicker",
author="<NAME>",
author_email="<EMAIL>",
description="A simple clicker server for ECE312.",
long_description=open('README.md').read... | [
"setuptools.find_packages"
] | [((338, 369), 'setuptools.find_packages', 'setuptools.find_packages', (['"""src"""'], {}), "('src')\n", (362, 369), False, 'import setuptools\n')] |
from datetime import datetime, timedelta
from flask import (Blueprint, current_app, jsonify, make_response, request)
from gopublish.utils import authenticate_user
import jwt
token = Blueprint('token', __name__, url_prefix='/')
@token.route('/api/token/create', methods=['POST'])
def create_token():
if not req... | [
"datetime.datetime.utcnow",
"flask.request.json.get",
"flask.Blueprint",
"flask.current_app.config.get",
"flask.jsonify"
] | [((186, 230), 'flask.Blueprint', 'Blueprint', (['"""token"""', '__name__'], {'url_prefix': '"""/"""'}), "('token', __name__, url_prefix='/')\n", (195, 230), False, 'from flask import Blueprint, current_app, jsonify, make_response, request\n'), ((885, 902), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n'... |
import torch
import models
import cfg
import numpy as np
from utils.utils import set_log_dir, save_checkpoint, create_logger, pruning_generate, see_remain_rate, rewind_weight, see_remain_rate_orig
args = cfg.parse_args()
gen_net = eval('models.sngan_cifar10.Generator')(args=args).cuda()
pruning_generate(gen_net, 1-0.8*... | [
"cfg.parse_args",
"utils.utils.pruning_generate",
"torch.load",
"utils.utils.see_remain_rate"
] | [((204, 220), 'cfg.parse_args', 'cfg.parse_args', ([], {}), '()\n', (218, 220), False, 'import cfg\n'), ((288, 328), 'utils.utils.pruning_generate', 'pruning_generate', (['gen_net', '(1 - 0.8 ** 10)'], {}), '(gen_net, 1 - 0.8 ** 10)\n', (304, 328), False, 'from utils.utils import set_log_dir, save_checkpoint, create_lo... |
import os
from dotenv import load_dotenv
load_dotenv()
NAME = os.environ.get('DB_USER_NAME')
PASSWORD = os.environ.get('DB_PASSWORD')
HOST = os.environ.get('DB_HOST')
DB_NAME = os.environ.get('DB_NAME')
| [
"os.environ.get",
"dotenv.load_dotenv"
] | [((42, 55), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (53, 55), False, 'from dotenv import load_dotenv\n'), ((64, 94), 'os.environ.get', 'os.environ.get', (['"""DB_USER_NAME"""'], {}), "('DB_USER_NAME')\n", (78, 94), False, 'import os\n'), ((107, 136), 'os.environ.get', 'os.environ.get', (['"""DB_PASSWORD"... |
import re
emails = '''
<EMAIL>
<EMAIL>
<EMAIL>
'''
pattern = re.compile(r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+')
matches = pattern.finditer(emails)
for match in matches:
print(match)
| [
"re.compile"
] | [((63, 124), 're.compile', 're.compile', (['"""[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+"""'], {}), "('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+')\n", (73, 124), False, 'import re\n')] |
import common
import paths
def test_simple_move(activate_package, make_workspace):
activate_package(package='basic', into='main')
workspace = make_workspace('main')
changes = workspace.move(
'basic/bar.py',
31,
'basic/foo.py')
workspace.perform(changes)
common.compare_wo... | [
"paths.active",
"paths.approved"
] | [((338, 367), 'paths.approved', 'paths.approved', (['"""simple_move"""'], {}), "('simple_move')\n", (352, 367), False, 'import paths\n'), ((377, 406), 'paths.active', 'paths.active', (['"""main"""', '"""basic"""'], {}), "('main', 'basic')\n", (389, 406), False, 'import paths\n')] |
# -*- coding: utf-8 -*-
# Copyright © 2015 <NAME> and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, ... | [
"re.split",
"smc.mw.Semantics",
"io.open",
"nikola.utils.req_missing",
"nikola.utils.write_metadata",
"os.path.dirname",
"smc.mw.Parser",
"lxml.etree.tostring"
] | [((1794, 1815), 'os.path.dirname', 'os.path.dirname', (['dest'], {}), '(dest)\n', (1809, 1815), False, 'import os\n'), ((1852, 1937), 'nikola.utils.req_missing', 'req_missing', (["['smc.mw']", '"""build this site (compile with MediaWiki)"""'], {'python': '(True)'}), "(['smc.mw'], 'build this site (compile with MediaWik... |
from __future__ import absolute_import
import os
import tempfile
import zipfile
import shutil
import requests
from lxml import etree
import logging
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect, HttpRespo... | [
"logging.getLogger",
"django_irods.views.download",
"os.path.getsize",
"zipfile.ZipFile",
"django.http.HttpResponse",
"lxml.etree.XML",
"os.path.join",
"django.template.RequestContext",
"requests.get",
"os.path.dirname",
"os.path.isdir",
"tempfile.gettempdir",
"tempfile.mkdtemp",
"shutil.r... | [((918, 945), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (935, 945), False, 'import logging\n'), ((9480, 9497), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (9488, 9497), False, 'from rest_framework.decorators import api_view\n'), ((5160, 5174), ... |
#solution_dsci_chapter_03_baseball.py
import pandas as pd
from numpy import nan
import matplotlib.pyplot as plt
import os
if '__file__' in dir():
path, _=os.path.split(__file__)
else: path=os.getcwd()
fn=os.path.join(path, "baseball_stats.xls")
df=pd.read_excel(fn)
fig, ax=plt.subplots(nrows=2, ncols=2, figsiz... | [
"os.path.join",
"os.path.split",
"os.getcwd",
"pandas.read_excel",
"matplotlib.pyplot.subplots"
] | [((213, 253), 'os.path.join', 'os.path.join', (['path', '"""baseball_stats.xls"""'], {}), "(path, 'baseball_stats.xls')\n", (225, 253), False, 'import os\n'), ((257, 274), 'pandas.read_excel', 'pd.read_excel', (['fn'], {}), '(fn)\n', (270, 274), True, 'import pandas as pd\n'), ((283, 329), 'matplotlib.pyplot.subplots',... |
import os
import json
import glob
import subprocess
from pathlib import Path
from dejavu import Dejavu
from dejavu.logic.recognizer.file_recognizer import FileRecognizer
from dejavu.logic.recognizer.microphone_recognizer import MicrophoneRecognizer
## This script labels unlabeled files obtained from an ost rip using ... | [
"glob.escape",
"pathlib.Path",
"os.path.splitext",
"os.path.join",
"dejavu.Dejavu"
] | [((2098, 2112), 'dejavu.Dejavu', 'Dejavu', (['config'], {}), '(config)\n', (2104, 2112), False, 'from dejavu import Dejavu\n'), ((2606, 2624), 'pathlib.Path', 'Path', (['labeled_song'], {}), '(labeled_song)\n', (2610, 2624), False, 'from pathlib import Path\n'), ((2474, 2503), 'glob.escape', 'glob.escape', (['LABELED_S... |
from django.shortcuts import render
from django.http import HttpResponse
# Screen dimensions: 1366 x 768
def index(request):
# tmp_directory = os.path.join('mediapanel', 'tmp', 'Photo albums')
# for root, dirs, files in os.walk(tmp_directory, topdown=False):
# for name in files:
# os.remove... | [
"django.shortcuts.render",
"django.http.HttpResponse"
] | [((472, 507), 'django.shortcuts.render', 'render', (['request', '"""panel/index.html"""'], {}), "(request, 'panel/index.html')\n", (478, 507), False, 'from django.shortcuts import render\n'), ((1192, 1230), 'django.http.HttpResponse', 'HttpResponse', (['binaryStuff', '"""image/gif"""'], {}), "(binaryStuff, 'image/gif')... |
import datetime
import pytest
import pytz
import urlparse
from dateutil.parser import parse as parse_date
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from osf.models import NodeLog
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
)
from tests.base imp... | [
"dateutil.parser.parse",
"osf_tests.factories.ProjectFactory",
"website.util.disconnected_from_listeners",
"framework.auth.core.Auth",
"osf_tests.factories.AuthUserFactory",
"pytest.fixture"
] | [((488, 504), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (502, 504), False, 'import pytest\n'), ((528, 545), 'osf_tests.factories.AuthUserFactory', 'AuthUserFactory', ([], {}), '()\n', (543, 545), False, 'from osf_tests.factories import ProjectFactory, AuthUserFactory\n'), ((599, 615), 'pytest.fixture', 'pyt... |
# Generated by Django 3.2.8 on 2021-12-26 23:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('device', '0008_devicestate_devicestategroup'),
]
operations = [
migrations.RemoveField(
model_name='device',
name='room',
... | [
"django.db.migrations.RemoveField"
] | [((236, 292), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""device"""', 'name': '"""room"""'}), "(model_name='device', name='room')\n", (258, 292), False, 'from django.db import migrations\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims
from rlpyt.models.mlp import MlpModel
from rlpyt.models.utils import FUNCTION_MAP, Reshape
class IDFModel(torch.nn.Module):
def __init__(
self,
image... | [
"torch.nn.ReLU",
"torch.nn.Flatten",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.cat"
] | [((647, 681), 'torch.nn.Conv2d', 'nn.Conv2d', (['c', '(16)', '(3, 3)'], {'stride': '(2)'}), '(c, 16, (3, 3), stride=2)\n', (656, 681), True, 'import torch.nn as nn\n'), ((695, 704), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (702, 704), True, 'import torch.nn as nn\n'), ((718, 753), 'torch.nn.Conv2d', 'nn.Conv2d', (... |
# pylint: disable=missing-docstring
import unittest
from unittest.mock import MagicMock, patch
import handsdown.ast_parser.smart_ast as ast
from handsdown.ast_parser.node_records.module_record import ModuleRecord
from handsdown.utils.import_string import ImportString
class TestFunctionRecord(unittest.TestCase):
... | [
"handsdown.ast_parser.node_records.module_record.ModuleRecord",
"unittest.mock.MagicMock",
"handsdown.ast_parser.node_records.module_record.ModuleRecord.create_from_source",
"handsdown.utils.import_string.ImportString",
"unittest.mock.patch"
] | [((653, 719), 'unittest.mock.patch', 'patch', (['"""handsdown.ast_parser.node_records.module_record.ast.parse"""'], {}), "('handsdown.ast_parser.node_records.module_record.ast.parse')\n", (658, 719), False, 'from unittest.mock import MagicMock, patch\n'), ((3525, 3596), 'unittest.mock.patch', 'patch', (['"""handsdown.a... |
import pathlib
from src import misc
from src.usermod_funcs import login,makenewaccount,deleteaccount,changepassword,changename
import json
fullpath = str(pathlib.Path(__file__).parent.absolute())+"/data.json"
def parse(user_input):
with open(fullpath,"r") as JsonFile:
data = json.load(JsonFile)
safety ... | [
"json.load",
"src.usermod_funcs.login.login",
"src.usermod_funcs.makenewaccount.makenewaccount",
"pathlib.Path"
] | [((289, 308), 'json.load', 'json.load', (['JsonFile'], {}), '(JsonFile)\n', (298, 308), False, 'import json\n'), ((1724, 1743), 'json.load', 'json.load', (['JsonFile'], {}), '(JsonFile)\n', (1733, 1743), False, 'import json\n'), ((1895, 1941), 'src.usermod_funcs.makenewaccount.makenewaccount', 'makenewaccount.makenewac... |
from jwt import decode
from rest_framework import serializers
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer, TokenVerifySerializer
from MIS_server import settings
from app.models import EmailVerifyRecord
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
def validate(self... | [
"jwt.decode"
] | [((912, 977), 'jwt.decode', 'decode', (["attrs['token']", 'settings.SECRET_KEY'], {'algorithms': "['HS256']"}), "(attrs['token'], settings.SECRET_KEY, algorithms=['HS256'])\n", (918, 977), False, 'from jwt import decode\n')] |
# -*- coding: utf-8 -*-
import time,sys,os
from netCDF4 import Dataset
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def readlatlon(file_path):
arr = []
with open(file_path,'r') as f:
for Line in f:
arr.append(list(... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.contourf",
"matplotlib.pyplot.title",
"scipy.interpolate.griddata",
"netCDF4.Dataset",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"numpy.loadtxt",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((923, 938), 'netCDF4.Dataset', 'Dataset', (['fyfile'], {}), '(fyfile)\n', (930, 938), False, 'from netCDF4 import Dataset\n'), ((1216, 1231), 'numpy.array', 'np.array', (['value'], {}), '(value)\n', (1224, 1231), True, 'import numpy as np\n'), ((1329, 1377), 'numpy.arange', 'np.arange', (['xll', '(xll + ncols * cells... |
from __future__ import unicode_literals
import frappe
from frappe import msgprint
from frappe.model.document import Document
from datetime import date
from datetime import datetime, timedelta
from frappe.utils import money_in_words
@frappe.whitelist(allow_guest=True)
def getStock1(item_code,warehouse):
stock = frappe... | [
"frappe.get_list",
"frappe.whitelist",
"frappe._",
"frappe.get_doc",
"frappe.db.sql"
] | [((234, 268), 'frappe.whitelist', 'frappe.whitelist', ([], {'allow_guest': '(True)'}), '(allow_guest=True)\n', (250, 268), False, 'import frappe\n'), ((3688, 3722), 'frappe.whitelist', 'frappe.whitelist', ([], {'allow_guest': '(True)'}), '(allow_guest=True)\n', (3704, 3722), False, 'import frappe\n'), ((314, 445), 'fra... |
from __future__ import print_function
import collections
import math
import os
import pickle
import sys
import time
import numpy
import torch
from sklearn.utils import compute_class_weight
from torch.nn.utils import clip_grad_norm
from torch.utils.data import DataLoader
from nldrp.dnn.config import DNN_BASE_PATH
from ... | [
"sys.stdout.write",
"numpy.array",
"os.remove",
"numpy.mean",
"os.path.exists",
"nldrp.dnn.logger.experiment.Metric",
"nldrp.dnn.util.multi_gpu.get_gpu_id",
"sys.stdout.flush",
"numpy.argmax",
"numpy.sign",
"torch.save",
"pickle.dump",
"numpy.unique",
"os.makedirs",
"time.strftime",
"o... | [((2200, 2231), 'sys.stdout.write', 'sys.stdout.write', (['_progress_str'], {}), '(_progress_str)\n', (2216, 2231), False, 'import sys\n'), ((2236, 2254), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (2252, 2254), False, 'import sys\n'), ((2551, 2566), 'numpy.unique', 'numpy.unique', (['y'], {}), '(y)\n', ... |
"""Visualize the annotated SVs"""
# standard libraries
import argparse
import pathlib
import numpy as np
import pandas as pd
# own libraries
from lib import plotting
# plotting
import matplotlib.pyplot as plt
def argparser():
parser = argparse.ArgumentParser(description="Visualize annotated CNVs.")
parser.... | [
"numpy.repeat",
"pandas.read_csv",
"argparse.ArgumentParser",
"pathlib.Path",
"lib.plotting.plot_feature_dist",
"pandas.concat"
] | [((244, 308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Visualize annotated CNVs."""'}), "(description='Visualize annotated CNVs.')\n", (267, 308), False, 'import argparse\n'), ((793, 818), 'pathlib.Path', 'pathlib.Path', (['args.cnvs_1'], {}), '(args.cnvs_1)\n', (805, 818), False, ... |
# -*- coding: utf-8 -*-
import argparse
from .parser import url_to_question
def scrape(args: argparse.Namespace) -> None:
url = args.url
question = url_to_question(url)
print(question)
def main() -> None:
parser = argparse.ArgumentParser('ros-answers-miner')
subparsers = parser.add_subparsers()... | [
"argparse.ArgumentParser"
] | [((235, 279), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""ros-answers-miner"""'], {}), "('ros-answers-miner')\n", (258, 279), False, 'import argparse\n')] |
import json
from collections import defaultdict
from typing import Dict, List, Union
from attr import attrib, attrs
@attrs
class TransformerConfig:
N = attrib(type=int)
d_ff = attrib(type=int)
h = attrib(type=int)
positional_encoding = attrib(type=dict)
dropout = attrib(type=float)
@attrs
class... | [
"attr.attrib",
"json.load",
"collections.defaultdict"
] | [((159, 175), 'attr.attrib', 'attrib', ([], {'type': 'int'}), '(type=int)\n', (165, 175), False, 'from attr import attrib, attrs\n'), ((187, 203), 'attr.attrib', 'attrib', ([], {'type': 'int'}), '(type=int)\n', (193, 203), False, 'from attr import attrib, attrs\n'), ((212, 228), 'attr.attrib', 'attrib', ([], {'type': '... |
# -*- coding: utf-8 -*-
from modularodm import Q
def remove_sessions_for_user(user):
"""
Permanently remove all stored sessions for the user from the DB.
:param user: User
:return:
"""
from osf.models import Session
Session.remove(Q('data.auth_user_id', 'eq', user._id))
def remove_sess... | [
"osf.models.Session.remove_one",
"modularodm.Q"
] | [((466, 493), 'osf.models.Session.remove_one', 'Session.remove_one', (['session'], {}), '(session)\n', (484, 493), False, 'from osf.models import Session\n'), ((263, 301), 'modularodm.Q', 'Q', (['"""data.auth_user_id"""', '"""eq"""', 'user._id'], {}), "('data.auth_user_id', 'eq', user._id)\n", (264, 301), False, 'from ... |
"""Views for REST APIs for channels"""
from django.shortcuts import get_object_or_404
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateAPIView
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
from rest_framework import status
from channels.api impo... | [
"channels.utils.translate_praw_exceptions",
"channels.api.Api",
"channels.serializers.channels.ChannelSerializer",
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response",
"channels.models.Channel.objects.all",
"rest_framework.exceptions.PermissionDenied"
] | [((1289, 1316), 'channels.api.Api', 'Api', ([], {'user': 'self.request.user'}), '(user=self.request.user)\n', (1292, 1316), False, 'from channels.api import Api\n'), ((1520, 1558), 'channels.serializers.channels.ChannelSerializer', 'ChannelSerializer', (['queryset'], {'many': '(True)'}), '(queryset, many=True)\n', (153... |
"""
basic window containing textarea for output and textfield for input,
includes handling of commands.
"""
# $Id: awtWindow.py,v 1.3 2001/10/12 16:05:28 ivo Exp $
from java.awt import *
from java.awt.event import *
from string import *
from view import guiMessage
class awtWindow(Frame, ActionListener):
... | [
"view.guiMessage.guiMessage"
] | [((946, 977), 'view.guiMessage.guiMessage', 'guiMessage.guiMessage', (['text[1:]'], {}), '(text[1:])\n', (967, 977), False, 'from view import guiMessage\n'), ((1020, 1043), 'view.guiMessage.guiMessage', 'guiMessage.guiMessage', ([], {}), '()\n', (1041, 1043), False, 'from view import guiMessage\n')] |
import sys
from niveristand import nivs_rt_sequence
from niveristand import realtimesequencetools
from niveristand.clientapi import ChannelReference, DoubleValue, I32Value
from niveristand.clientapi import RealTimeSequence
from niveristand.errors import TranslateError, VeristandError
from niveristand.library.primitives... | [
"testutilities.rtseqrunner.run_rtseq_in_VM",
"niveristand.library.primitives.localhost_wait",
"testutilities.validation.test_validate",
"pytest.mark.parametrize",
"niveristand.clientapi.ChannelReference",
"niveristand.clientapi.DoubleValue",
"niveristand.clientapi.RealTimeSequence",
"pytest.raises",
... | [((7672, 7760), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_name, params, expected_result"""', 'run_tests'], {'ids': 'idfunc'}), "('func_name, params, expected_result', run_tests,\n ids=idfunc)\n", (7695, 7760), False, 'import pytest\n'), ((7848, 7936), 'pytest.mark.parametrize', 'pytest.mark.pa... |
from django.conf.urls import url
from django.urls import path
from django.conf import settings
from . import views
from django.contrib.auth.decorators import login_required
from django.views.static import serve
# TODO:Make slug fields
#https://blog.majsky.cz/django-protected-media-files/
#Credit: <NAME>
#Note that t... | [
"django.urls.path"
] | [((1085, 1151), 'django.urls.path', 'path', (['"""detail/<uuid:id>/"""', 'views.posts_detail'], {'name': '"""posts-detail"""'}), "('detail/<uuid:id>/', views.posts_detail, name='posts-detail')\n", (1089, 1151), False, 'from django.urls import path\n'), ((1231, 1295), 'django.urls.path', 'path', (['"""<uuid:id>/edit/"""... |
"""
Trainer for semi-supervised GAN
"""
import numpy as np
import torch
from torch.autograd import Variable
from tqdm import tqdm
from torchlib.common import FloatTensor, LongTensor
from torchlib.utils.plot import get_visdom_line_plotter
class Trainer(object):
def __init__(self, trick_dict=None):
if tri... | [
"numpy.mean",
"torchlib.common.FloatTensor",
"tqdm.tqdm",
"numpy.array",
"torchlib.utils.plot.get_visdom_line_plotter",
"numpy.random.randn"
] | [((477, 508), 'torchlib.utils.plot.get_visdom_line_plotter', 'get_visdom_line_plotter', (['"""main"""'], {}), "('main')\n", (500, 508), False, 'from torchlib.utils.plot import get_visdom_line_plotter\n'), ((2773, 2790), 'tqdm.tqdm', 'tqdm', (['data_loader'], {}), '(data_loader)\n', (2777, 2790), False, 'from tqdm impor... |
import logging
from dataclasses import dataclass, field
from typing import TypedDict
import dearpygui.dearpygui as dpg
@dataclass
class SplitUIWidgets():
def __init__(self):
pass
main_window: int
left: int
center: int
right: int
menu_bar: int
class SplitUi:
"""
Creates a dea... | [
"logging.getLogger",
"dearpygui.dearpygui.set_item_width",
"dearpygui.dearpygui.set_start_callback",
"dearpygui.dearpygui.get_item_height",
"dearpygui.dearpygui.get_item_width",
"dearpygui.dearpygui.menu_bar",
"dearpygui.dearpygui.set_item_pos",
"dearpygui.dearpygui.add_resize_handler",
"dearpygui.d... | [((415, 442), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (432, 442), False, 'import logging\n'), ((1453, 1506), 'dearpygui.dearpygui.get_item_width', 'dpg.get_item_width', (['self.split_ui_widgets.main_window'], {}), '(self.split_ui_widgets.main_window)\n', (1471, 1506), True, 'import... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
import cPickle
from tensorflow.contrib import slim
#Load features and labels
features = cPickle.load(open('nn_features.p', 'rb'))
labels = cPickle.load(open('labels.p', 'rb'))
mask = np.random.choice(features.shape[0], features.shape[0... | [
"tensorflow.contrib.slim.batch_norm",
"tensorflow.initialize_all_variables",
"tensorflow.random_normal",
"tensorflow.contrib.slim.l2_regularizer",
"numpy.random.choice",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.truncated_normal_initializer",
"tensorflow.argmax",
"numpy.array_equ... | [((268, 337), 'numpy.random.choice', 'np.random.choice', (['features.shape[0]', 'features.shape[0]'], {'replace': '(False)'}), '(features.shape[0], features.shape[0], replace=False)\n', (284, 337), True, 'import numpy as np\n'), ((1255, 1300), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, num_fea... |
#!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# ... | [
"unittest.main",
"unittest.skipIf",
"os.remove"
] | [((1766, 1823), 'unittest.skipIf', 'unittest.skipIf', (['g_skip_analysis_test', 'g_skip_analysis_ex'], {}), '(g_skip_analysis_test, g_skip_analysis_ex)\n', (1781, 1823), False, 'import unittest\n'), ((5441, 5456), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5454, 5456), False, 'import unittest\n'), ((3061, 307... |
from collections import defaultdict
import json
from pandas.core import frame
import torch
import pandas as pd
import os
import pickle as pkl
import numpy as np
import cv2
import h5py
import tqdm
import lmdb
from functools import lru_cache
class EPIC_KITCHENS_DATASET(torch.utils.data.Dataset):
def __init__(self, ... | [
"os.path.join",
"numpy.stack",
"numpy.zeros",
"collections.defaultdict",
"lmdb.open",
"numpy.frombuffer",
"numpy.arange"
] | [((4832, 4849), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (4843, 4849), False, 'from collections import defaultdict\n'), ((6648, 6702), 'lmdb.open', 'lmdb.open', (['config.feat_file'], {'readonly': '(True)', 'lock': '(False)'}), '(config.feat_file, readonly=True, lock=False)\n', (6657, 6702)... |
from typing import Text
import argparse
import pandas as pd
import yaml
from sklearn.model_selection import train_test_split
def data_split(config_path: Text) -> None:
""" Lod Raw Data
Args:
config_path {Text} path to config
"""
config = yaml.safe_load(open(config_path))
data... | [
"sklearn.model_selection.train_test_split",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((326, 373), 'pandas.read_csv', 'pd.read_csv', (["config['data_load']['dataset_csv']"], {}), "(config['data_load']['dataset_csv'])\n", (337, 373), True, 'import pandas as pd\n'), ((408, 527), 'sklearn.model_selection.train_test_split', 'train_test_split', (['dataset'], {'test_size': "config['data_split']['test_size']"... |
import io
import os
import time
import argparse
import random
import logging
import warnings
import multiprocessing
import numpy as np
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import Block, nn
from mxnet.gluon.data.sampler import Sampler, SequentialSampler
import gluonnlp as nlp
from gluonnlp.model i... | [
"gluonnlp.data.batchify.Pad",
"numpy.array",
"numpy.arange",
"gluonnlp.data.sampler.FixedBucketSampler",
"numpy.random.seed",
"mxnet.nd.array",
"mxnet.gluon.data.DataLoader",
"os.path.expanduser",
"json.loads",
"gluonnlp.model.get_model",
"random.uniform",
"tmnt.data_loading.PairedDataLoader",... | [((10160, 10182), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (10180, 10182), False, 'import multiprocessing\n'), ((11883, 11905), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (11903, 11905), False, 'import multiprocessing\n'), ((12329, 12472), 'mxnet.gluon.data.DataLoader', '... |
# Generated by Django 3.2.5 on 2021-07-08 20:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('circle', '0008_auto_20210708_2008'),
]
operations = [
migrations.AlterField(
model_name='messag... | [
"django.db.models.ForeignKey"
] | [((371, 492), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '(1)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""receive"""', 'to': '"""circle.person"""'}), "(default=1, on_delete=django.db.models.deletion.CASCADE,\n related_name='receive', to='circle.person')\n", (388,... |
# Generated by Django 2.1.2 on 2018-10-22 09:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goods', '0016_auto_20181022_1131'),
]
operations = [
migrations.AlterModelOptions(
name='goods',
options={'ordering'... | [
"django.db.migrations.AlterModelOptions",
"django.db.models.IntegerField"
] | [((233, 373), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""goods"""', 'options': "{'ordering': ('status', 'index'), 'verbose_name': '商品',\n 'verbose_name_plural': '商品'}"}), "(name='goods', options={'ordering': ('status',\n 'index'), 'verbose_name': '商品', 'verbose_nam... |
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from django.utils.translation import ugettext as _
class Channel(models.Model):
name = models.CharField(
max_length= 100,
verbose_name=_("channel name"),
)
primary_topic_tree = models.ForeignKey(
'TopicT... | [
"django.utils.translation.ugettext",
"django.db.models.CharField",
"mptt.models.TreeForeignKey"
] | [((1844, 1914), 'mptt.models.TreeForeignKey', 'TreeForeignKey', (['"""self"""'], {'null': '(True)', 'blank': '(True)', 'related_name': '"""children"""'}), "('self', null=True, blank=True, related_name='children')\n", (1858, 1914), False, 'from mptt.models import MPTTModel, TreeForeignKey\n'), ((3535, 3565), 'django.db.... |
from keras.applications.inception_v3 import InceptionV3 as KerasInceptionV3
from keras.layers import GlobalAveragePooling2D, Dense, Dropout, Input, Embedding, Lambda
from keras.models import Model
from keras.optimizers import SGD
from keras.preprocessing import image
import numpy as np
import config
from .base_model im... | [
"keras.backend.square",
"keras.layers.Input",
"keras.models.Model",
"keras.layers.Dense",
"keras.layers.GlobalAveragePooling2D"
] | [((1105, 1129), 'keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), '()\n', (1127, 1129), False, 'from keras.layers import GlobalAveragePooling2D, Dense, Dropout, Input, Embedding, Lambda\n'), ((1151, 1248), 'keras.layers.Dense', 'Dense', (['self.noveltyDetectionLayerSize'], {'activation': '"""el... |
from __future__ import absolute_import
from selenium import webdriver
import multiprocessing
import requests
import time
import unittest
import percy
import sys
import os
from .utils import invincible, wait_for
class IntegrationTests(unittest.TestCase):
def percy_snapshot(cls, name):
if ('PERCY_PROJECT' ... | [
"selenium.webdriver.Chrome",
"multiprocessing.Process",
"percy.Runner",
"time.sleep",
"requests.get",
"percy.ResourceLoader"
] | [((864, 882), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (880, 882), False, 'from selenium import webdriver\n'), ((1585, 1603), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (1601, 1603), False, 'from selenium import webdriver\n'), ((2346, 2359), 'time.sleep', 'time.sleep', ... |
import operator
import csv
'''
Input: [ ../wfst/base/dataset/NLSPARQL.train.data | ../wfst/base/dataset/NLSPARQL.test.data ] : str
'''
def word_counter(sourcefile="../wfst/base/dataset/NLSPARQL.train.data"):
f = open(sourcefile,'r')
word_instance = {}
iob_tag_instance = {}
for line in f:
spl... | [
"operator.itemgetter",
"csv.writer"
] | [((2026, 2064), 'csv.writer', 'csv.writer', (['csv_results'], {'delimiter': '""","""'}), "(csv_results, delimiter=',')\n", (2036, 2064), False, 'import csv\n'), ((863, 885), 'operator.itemgetter', 'operator.itemgetter', (['(1)'], {}), '(1)\n', (882, 885), False, 'import operator\n'), ((1037, 1059), 'operator.itemgetter... |
import hashlib, json
import nacl.bindings
from nacl import encoding
from nacl.utils import random
from .utils import to_hex, from_hex, is_hex, str_to_bytes
def create_address(pubkey):
if is_hex(pubkey):
pubkey = from_hex(pubkey)
h = hashlib.new('ripemd160')
h.update(pubkey)
return h.digest()... | [
"hashlib.new",
"json.dumps",
"nacl.encoding.RawEncoder.encode",
"nacl.utils.random",
"nacl.encoding.RawEncoder.decode"
] | [((253, 277), 'hashlib.new', 'hashlib.new', (['"""ripemd160"""'], {}), "('ripemd160')\n", (264, 277), False, 'import hashlib, json\n'), ((1556, 1591), 'nacl.encoding.RawEncoder.decode', 'encoding.RawEncoder.decode', (['message'], {}), '(message)\n', (1582, 1591), False, 'from nacl import encoding\n'), ((1605, 1639), 'n... |
from inqbus.rpi.widgets.line import Line
from tests.base import LONG_LINE, SHORT_LINE, TestBase
class TestLine(TestBase):
def line_run(self, content, x=0, y=0):
line = Line(pos_x=x, pos_y=y)
line.content = content
self.widget_set_as_layout(line)
space_before = ' ' * x
s... | [
"inqbus.rpi.widgets.line.Line"
] | [((184, 206), 'inqbus.rpi.widgets.line.Line', 'Line', ([], {'pos_x': 'x', 'pos_y': 'y'}), '(pos_x=x, pos_y=y)\n', (188, 206), False, 'from inqbus.rpi.widgets.line import Line\n')] |
import graphene
from ...invoice import models
from ..core.types import Job, ModelObjectType
from ..meta.types import ObjectWithMetadata
class Invoice(ModelObjectType):
number = graphene.String()
external_url = graphene.String()
created_at = graphene.DateTime(required=True)
updated_at = graphene.DateT... | [
"graphene.String",
"graphene.DateTime"
] | [((184, 201), 'graphene.String', 'graphene.String', ([], {}), '()\n', (199, 201), False, 'import graphene\n'), ((221, 238), 'graphene.String', 'graphene.String', ([], {}), '()\n', (236, 238), False, 'import graphene\n'), ((256, 288), 'graphene.DateTime', 'graphene.DateTime', ([], {'required': '(True)'}), '(required=Tru... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('midnight_main', '0002_auto_20151122_1620'),
]
operations = [
migrations.AlterModelOptions(
name='pagecomment',
... | [
"django.db.migrations.AlterModelOptions"
] | [((257, 390), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""pagecomment"""', 'options': "{'verbose_name_plural': 'PageComments', 'verbose_name': 'PageComment'}"}), "(name='pagecomment', options={\n 'verbose_name_plural': 'PageComments', 'verbose_name': 'PageComment'})\n"... |
import numpy as np
from skimage.transform import pyramid_gaussian
from lv import get_contour_points, area2cont, cont2area, interpolate_contour
def window_image(img, cent_point, window):
y0 = int(np.round(cent_point[0]) - window // 2)
y1 = int(np.round(cent_point[0]) + window // 2 + 1)
x0 = int(... | [
"lv.cont2area",
"lv.area2cont",
"skimage.transform.pyramid_gaussian",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.linalg.lstsq",
"numpy.gradient",
"numpy.round"
] | [((204, 227), 'numpy.round', 'np.round', (['cent_point[0]'], {}), '(cent_point[0])\n', (212, 227), True, 'import numpy as np\n'), ((320, 343), 'numpy.round', 'np.round', (['cent_point[1]'], {}), '(cent_point[1])\n', (328, 343), True, 'import numpy as np\n'), ((3407, 3426), 'lv.area2cont', 'area2cont', (['true_msk'], {}... |
#!/usr/bin/env python3
#
# Copyright (c) 2015 - 2022, Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
"""Test the scaling model region
"""
import sys
import re
import unittest
import os
import glob
import geopmpy.io
import geopmpy.agent
import geopmdpy.error
import geopmpy.hash
from integration.test ... | [
"integration.test.geopm_test_launcher.geopmread",
"integration.test.util.skip_unless_optimized",
"integration.test.util.skip_unless_cpufreq",
"os.path.join",
"os.path.realpath",
"integration.test.util.do_launch",
"os.path.basename",
"unittest.main"
] | [((895, 921), 'integration.test.util.skip_unless_cpufreq', 'util.skip_unless_cpufreq', ([], {}), '()\n', (919, 921), False, 'from integration.test import util\n'), ((923, 951), 'integration.test.util.skip_unless_optimized', 'util.skip_unless_optimized', ([], {}), '()\n', (949, 951), False, 'from integration.test import... |
import urlparse
def parturl(url):
queryparas = dict(urlparse.parse_qsl(urlparse.urlparse(url).query))
routeparas = url.split('//')[-1]
routeparas = routeparas[routeparas.index('/')+1:]
routeparas = routeparas.split('?')[0]
routeparas = tuple(routeparas.split('/'))
return routeparas, queryparas... | [
"urlparse.ParseResult",
"urlparse.parse_qs",
"urlparse.urlunparse",
"urlparse.urlparse"
] | [((1119, 1141), 'urlparse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (1136, 1141), False, 'import urlparse\n'), ((1164, 1216), 'urlparse.parse_qs', 'urlparse.parse_qs', (['urlobj.query'], {'keep_blank_values': '(1)'}), '(urlobj.query, keep_blank_values=1)\n', (1181, 1216), False, 'import urlparse\n'), ((... |
# Copyright 2019 <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, softw... | [
"mt.mvae.ops.spherical_projected.exp_map_mu0",
"numpy.sqrt",
"mt.mvae.ops.spherical_projected.exp_map",
"mt.mvae.ops.poincare.pm.gyration",
"mt.mvae.ops.spherical_projected.sample_projection_mu0",
"mt.mvae.ops.spherical_projected.inverse_sample_projection_mu0",
"mt.mvae.ops.spherical_projected.gyration"... | [((934, 952), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (948, 952), True, 'import numpy as np\n'), ((1031, 1069), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'dtype': 'torch.float64'}), '(2.0, dtype=torch.float64)\n', (1043, 1069), False, 'import torch\n'), ((1604, 1617), 'mt.mvae.ops.spherical_... |
from os import getenv
from traceback import format_exc
from typing import Optional
from asyncpg import Pool, create_pool
from loguru import logger
from nextcord import Intents
from nextcord.ext.commands import Bot as _BotBase
from nextcord.ext.commands import Context
class Bot(_BotBase):
"""A subclass of nextcor... | [
"nextcord.Intents",
"traceback.format_exc",
"loguru.logger.info",
"os.getenv"
] | [((407, 416), 'nextcord.Intents', 'Intents', ([], {}), '()\n', (414, 416), False, 'from nextcord import Intents\n'), ((1260, 1300), 'loguru.logger.info', 'logger.info', (['"""Connecting to Postgres..."""'], {}), "('Connecting to Postgres...')\n", (1271, 1300), False, 'from loguru import logger\n'), ((1530, 1564), 'logu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE... | [
"re.compile",
"subprocess.Popen",
"os.access",
"os.path.join",
"unittest.main",
"os.path.dirname",
"os.path.abspath",
"os.walk"
] | [((575, 600), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (590, 600), False, 'import os, re, subprocess, sys, unittest\n'), ((1341, 1361), 're.compile', 're.compile', (['"""[^\\\\w]"""'], {}), "('[^\\\\w]')\n", (1351, 1361), False, 'import os, re, subprocess, sys, unittest\n'), ((1446, 146... |
from setuptools import setup
# Version meaning (X.Y.Z)
# X: Major version (e.g. vastly different scene, platform, etc)
# Y: Minor version (e.g. new tasks, major changes to existing tasks, etc)
# Z: Patch version (e.g. small changes to tasks, bug fixes, etc)
setup(name='rlbench',
version='1.0.8',
descripti... | [
"setuptools.setup"
] | [((260, 677), 'setuptools.setup', 'setup', ([], {'name': '"""rlbench"""', 'version': '"""1.0.8"""', 'description': '"""RLBench"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://www.doc.ic.ac.uk/~slj12"""', 'packages': "['rlbench', 'rlbench.backend', 'rlbench.tasks', 'rlbench.task_ttms',... |
"""
Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | [
"mo.utils.error.Error",
"io.BytesIO",
"mo.utils.utils.refer_to_faq_msg",
"struct.unpack",
"os.path.basename",
"numpy.fromstring"
] | [((7192, 7210), 'io.BytesIO', 'io.BytesIO', (['buffer'], {}), '(buffer)\n', (7202, 7210), False, 'import io\n'), ((10726, 10758), 'numpy.fromstring', 'np.fromstring', (['data'], {'dtype': 'dtype'}), '(data, dtype=dtype)\n', (10739, 10758), True, 'import numpy as np\n'), ((2156, 2177), 'struct.unpack', 'struct.unpack', ... |
# -*- coding: utf-8 -*-
"""Classes for 2d U-net training and prediction.
"""
import json
from loguru import logger
import os
import sys
import warnings
from functools import partial
from pathlib import Path
from zipfile import ZipFile
import numpy as np
#from pytorch3dunet.unet3d.losses import GeneralizedDiceLoss
impo... | [
"fastai.vision.unet_learner",
"zipfile.ZipFile",
"torch.max",
"fastai.vision.SegmentationItemList.from_folder",
"skimage.img_as_float",
"numpy.array",
"torch.squeeze",
"numpy.gradient",
"fastai.vision.pil2tensor",
"os.remove",
"matplotlib.pyplot.imshow",
"fastai.utils.mem.gpu_mem_get_free_no_c... | [((712, 726), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (719, 726), True, 'import matplotlib as mpl\n'), ((848, 903), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (871, 903), False, 'import warnings\n'),... |
import itertools
from app.actions import Move
from app.entities import Exit, MovingWall, Player, Wall
from . import Level
def Level3() -> Level:
"""Render the second level"""
return Level(
title="The Patient Terminal",
number=3,
max_commands=15,
description="This introduces t... | [
"app.entities.Player",
"app.entities.Exit",
"app.entities.MovingWall.create_line",
"app.entities.Wall.create_line"
] | [((365, 394), 'app.entities.Player', 'Player', ([], {'start_x': '(8)', 'start_y': '(36)'}), '(start_x=8, start_y=36)\n', (371, 394), False, 'from app.entities import Exit, MovingWall, Player, Wall\n'), ((561, 592), 'app.entities.Wall.create_line', 'Wall.create_line', (['(1)', '(1)', '(88)', '"""h"""'], {}), "(1, 1, 88,... |
from crum import get_current_user
from rest_framework import serializers
from .models import Issue, IssueComment
from apps.profiles.serializers import ProfilePreviewSerializer
class IssueSerializer(serializers.ModelSerializer):
author = ProfilePreviewSerializer(read_only=True)
issue_status = serializers.CharF... | [
"apps.profiles.serializers.ProfilePreviewSerializer",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.CharField",
"crum.get_current_user"
] | [((243, 283), 'apps.profiles.serializers.ProfilePreviewSerializer', 'ProfilePreviewSerializer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (267, 283), False, 'from apps.profiles.serializers import ProfilePreviewSerializer\n'), ((303, 340), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], ... |
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, reduce, repeat
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def pad_to_multiple(tensor, multiple, dim = -1, value = 0):
seq_len = tensor.shap... | [
"torch.nn.Dropout",
"torch.ones",
"torch.nn.GELU",
"torch.nn.ModuleList",
"einops.repeat",
"torch.nn.LayerNorm",
"einops.rearrange",
"torch.arange",
"torch.einsum",
"torch.finfo",
"torch.nn.Linear",
"torch.nn.functional.pad",
"torch.nn.Identity",
"torch.nn.Embedding",
"einops.reduce"
] | [((499, 554), 'torch.nn.functional.pad', 'F.pad', (['tensor', '(*pad_offset, 0, remainder)'], {'value': 'value'}), '(tensor, (*pad_offset, 0, remainder), value=value)\n', (504, 554), True, 'import torch.nn.functional as F\n'), ((1707, 1769), 'einops.reduce', 'reduce', (['x', '"""b (n s) d -> b n d"""', '"""mean"""'], {... |
from setuptools import setup, find_packages
setup(
name='guess_the_movie',
packages=find_packages('src'),
package_dir={'': 'src'},
version='0.9',
license='MIT',
install_requires=[
'pyqt5',
],
description='Game guess the movie by screenshot',
author='Alexey',
author_email... | [
"setuptools.find_packages"
] | [((93, 113), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (106, 113), False, 'from setuptools import setup, find_packages\n')] |
import logging
from django.contrib.gis.geos import GEOSGeometry
from django.utils.translation import ugettext as _
from django.contrib.gis.geos import LineString
from django.conf import settings
from django.db import connection
import pygal
from pygal.style import LightSolarizedStyle
logger = logging.getLogger(__na... | [
"logging.getLogger",
"pygal.XY",
"django.db.connection.cursor",
"django.utils.translation.ugettext",
"django.contrib.gis.geos.GEOSGeometry",
"django.contrib.gis.geos.LineString"
] | [((298, 325), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (315, 325), False, 'import logging\n'), ((1551, 1570), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (1568, 1570), False, 'from django.db import connection\n'), ((3690, 3732), 'pygal.XY', 'pygal.XY', ([],... |
# to trigger registration
import pytest
from datacraft import builder, suppliers, field_loader, SupplierException
from datacraft.supplier.refs import weighted_ref_supplier
# to trigger registration
from datacraft import cli
def test_weighted_ref_missing_key():
ref_weights = {
'foo': 0.5,
'bar': 0... | [
"datacraft.supplier.refs.weighted_ref_supplier",
"datacraft.field_loader",
"datacraft.builder.weighted_ref",
"datacraft.suppliers.values",
"pytest.raises"
] | [((575, 626), 'datacraft.suppliers.values', 'suppliers.values', (["['foo', 'bar', 'baz', 'notvalid']"], {}), "(['foo', 'bar', 'baz', 'notvalid'])\n", (591, 626), False, 'from datacraft import builder, suppliers, field_loader, SupplierException\n'), ((729, 776), 'datacraft.supplier.refs.weighted_ref_supplier', 'weighted... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 28 16:46:29 2018
@author: morbi
"""
#importing the libraries
import pandas as pd
import matplotlib.pyplot as plt, matplotlib,numpy as np
#creating the dataframes - MAKE SURE YOU'RE IN THE SAME DIRECTORY OF THE FILES
surveys_df = pd.read_csv("surveys.csv",
... | [
"pandas.merge",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((279, 344), 'pandas.read_csv', 'pd.read_csv', (['"""surveys.csv"""'], {'keep_default_na': '(False)', 'na_values': "['']"}), "('surveys.csv', keep_default_na=False, na_values=[''])\n", (290, 344), True, 'import pandas as pd\n'), ((384, 449), 'pandas.read_csv', 'pd.read_csv', (['"""species.csv"""'], {'keep_default_na':... |
# -*- coding: utf-8 -*-
"""
Routines and Class definitions for the diffusion maps algorithm.
"""
from __future__ import absolute_import
import numpy as np
import scipy.sparse as sps
import scipy.sparse.linalg as spsl
import warnings
from . import kernel
from . import utils
class DiffusionMap(object):
"""
Dif... | [
"numpy.shape",
"numpy.sqrt",
"scipy.sparse.eye",
"numpy.power",
"numpy.hstack",
"numpy.real",
"numpy.array_equal",
"numpy.vstack",
"warnings.warn",
"scipy.sparse.linalg.eigs",
"scipy.sparse.spdiags"
] | [((14676, 14721), 'numpy.vstack', 'np.vstack', (['[dmap_object.local_kernel.data, Y]'], {}), '([dmap_object.local_kernel.data, Y])\n', (14685, 14721), True, 'import numpy as np\n'), ((14800, 14858), 'numpy.hstack', 'np.hstack', (['[dmap_object.right_norm_vec, yy_right_norm_vec]'], {}), '([dmap_object.right_norm_vec, yy... |
""" Cisco_IOS_XR_ip_tcp_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ip\-tcp package configuration.
This module contains definitions
for the following management objects\:
ip\-tcp\: Global IP TCP configuration
ip\: ip
Copyright (c) 2013\-2017 by Cisco Systems, Inc.
All rights rese... | [
"ydk.types.YList",
"collections.OrderedDict",
"ydk.types.YLeaf",
"ydk.types.Enum.YLeaf"
] | [((2994, 3157), 'collections.OrderedDict', 'OrderedDict', (["[('directory', ('directory', IpTcp.Directory)), ('throttle', ('throttle',\n IpTcp.Throttle)), ('num-thread', ('num_thread', IpTcp.NumThread))]"], {}), "([('directory', ('directory', IpTcp.Directory)), ('throttle', (\n 'throttle', IpTcp.Throttle)), ('num... |
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | [
"logging.getLogger",
"config.parser.debug_enabled",
"api.files_ext.models.FileExt.load_from_ext_id",
"celery.Celery",
"api.scans.services.set_result",
"api.files.services.remove_files_size",
"api.files.services.remove_files",
"api.common.sessions.session_transaction",
"humanfriendly.parse_timespan",... | [((1126, 1151), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (1141, 1151), False, 'from celery.utils.log import get_task_logger\n'), ((1196, 1225), 'celery.Celery', 'celery.Celery', (['"""frontend_app"""'], {}), "('frontend_app')\n", (1209, 1225), False, 'import celery\n'),... |
"""Link user to organisation
Revision ID: 4d8b254d7e7e
Revises: 016571f41a20
Create Date: 2020-01-22 17:42:42.968199
"""
# revision identifiers, used by Alembic.
revision = '4d8b254d7e7e'
down_revision = '016571f41a20'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative... | [
"alembic.op.get_bind",
"alembic.op.create_foreign_key",
"alembic.op.drop_constraint",
"alembic.op.alter_column",
"alembic.op.drop_column",
"sqlalchemy.orm.Session",
"sqlalchemy.Integer",
"alembic.op.execute",
"sqlalchemy.String",
"sqlalchemy.ext.declarative.declarative_base"
] | [((380, 398), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (396, 398), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((441, 454), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (452, 454), False, 'from alembic import op\n'), ((469, 505), 'sqlalchem... |
import random
import secrets
from dateutil.relativedelta import relativedelta
from django.utils.timezone import now
from posthog.constants import TREND_FILTER_TYPE_ACTIONS
from posthog.demo.data_generator import DataGenerator
from posthog.models import Action, ActionStep, Dashboard, DashboardItem, Person
class Reve... | [
"posthog.models.ActionStep.objects.create",
"random.choice",
"dateutil.relativedelta.relativedelta",
"secrets.token_urlsafe",
"django.utils.timezone.now",
"posthog.models.DashboardItem.objects.create",
"posthog.models.Action.objects.create",
"random.randint"
] | [((2333, 2387), 'posthog.models.Action.objects.create', 'Action.objects.create', ([], {'team': 'self.team', 'name': '"""Purchase"""'}), "(team=self.team, name='Purchase')\n", (2354, 2387), False, 'from posthog.models import Action, ActionStep, Dashboard, DashboardItem, Person\n'), ((2396, 2463), 'posthog.models.ActionS... |
# -*- coding: utf-8 -*-
from setuptools import setup
# This file is required to support editable install
# See https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
setup()
| [
"setuptools.setup"
] | [((183, 190), 'setuptools.setup', 'setup', ([], {}), '()\n', (188, 190), False, 'from setuptools import setup\n')] |
"""
pgdumplib exposes a load method to create a :py:class:`~pgdumplib.dump.Dump`
instance from a :command:`pg_dump` file created in the `custom` format.
See the :doc:`examples` page to see how to read a dump or create one.
"""
version = '3.1.0'
def load(filepath, converter=None):
"""Load a pg_dump file created ... | [
"pgdumplib.dump.Dump"
] | [((1416, 1465), 'pgdumplib.dump.Dump', 'dump.Dump', (['dbname', 'encoding', 'converter', 'appear_as'], {}), '(dbname, encoding, converter, appear_as)\n', (1425, 1465), False, 'from pgdumplib import dump\n'), ((710, 740), 'pgdumplib.dump.Dump', 'dump.Dump', ([], {'converter': 'converter'}), '(converter=converter)\n', (7... |
"""
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve --show gui
in your browser.
"""
from os.path import dirname, join
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import layout, Spacer
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.models import Hov... | [
"bokeh.plotting.figure",
"bokeh.models.widgets.Button",
"bokeh.models.widgets.CheckboxGroup",
"roentgen.absorption.Response",
"roentgen.util.get_density",
"numpy.arange",
"bokeh.io.curdoc",
"astropy.units.imperial.enable",
"bokeh.models.widgets.TableColumn",
"bokeh.models.widgets.DataTable",
"bo... | [((876, 895), 'astropy.units.imperial.enable', 'u.imperial.enable', ([], {}), '()\n', (893, 895), True, 'import astropy.units as u\n'), ((1484, 1586), 'bokeh.models.HoverTool', 'HoverTool', ([], {'tooltips': "[('energy [keV]', '@{x}{0.2f}'), ('transmission', '@{y}{0.3f}')]", 'mode': '"""vline"""'}), "(tooltips=[('energ... |
import os
import string
import random
from django.core.management.base import BaseCommand
from django.utils import six
from django.utils.six.moves import input
from django.conf import settings
class Command(BaseCommand):
help = "Generate/regenerate a random 50-character secret key stored in a file specified by the `S... | [
"os.makedirs",
"os.path.dirname",
"os.path.isdir",
"random.SystemRandom",
"django.utils.six.moves.input"
] | [((1552, 1577), 'os.path.dirname', 'os.path.dirname', (['key_file'], {}), '(key_file)\n', (1567, 1577), False, 'import os\n'), ((1662, 1697), 'os.makedirs', 'os.makedirs', (['key_dir'], {'exist_ok': '(True)'}), '(key_dir, exist_ok=True)\n', (1673, 1697), False, 'import os\n'), ((1602, 1624), 'os.path.isdir', 'os.path.i... |
"""Ptrack Template Tag"""
import logging
from django import template
from django.utils.html import mark_safe
logger = logging.getLogger(__name__)
register = template.Library()
@register.simple_tag
def ptrack(*args, **kwargs):
"""Generate a tracking pixel html img element."""
from ptrack import create_img
... | [
"logging.getLogger",
"ptrack.create_img",
"django.utils.html.mark_safe",
"django.template.Library"
] | [((120, 147), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'import logging\n'), ((159, 177), 'django.template.Library', 'template.Library', ([], {}), '()\n', (175, 177), False, 'from django import template\n'), ((328, 355), 'ptrack.create_img', 'create_img', (['*args'... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 14:01:00 2020
@author: hvf811
"""
seed_val = 1234
import os
import tensorflow as tf
from tensorflow.keras.layers import Dense, Input, Dropout,Multiply, LSTM, Add, Concatenate, TimeDistributed
from tensorflow.keras.layers import Conv1D, Flatten, Lambda, ... | [
"numpy.prod",
"tensorflow.keras.initializers.RandomUniform",
"tensorflow.keras.backend.epsilon",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.backend.not_equal",
"tensorflow.keras.backend.shape",
"tensorflow.keras.backend.max",
"numpy.random.seed",
"tensorflow.keras.backend.cast",
"numpy.con... | [((1119, 1147), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed_val'], {}), '(seed_val)\n', (1137, 1147), True, 'import tensorflow as tf\n'), ((1149, 1173), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (1163, 1173), True, 'import numpy as np\n'), ((1175, 1196), 'random.seed', '... |
from django.urls import path
from django.conf import settings
from vbbot import views
app_name = 'vbbot'
token = settings.VIBER_TOKEN
urlpatterns = [
path(token, views.viber_app),
]
| [
"django.urls.path"
] | [((156, 184), 'django.urls.path', 'path', (['token', 'views.viber_app'], {}), '(token, views.viber_app)\n', (160, 184), False, 'from django.urls import path\n')] |
"""This module implements a model selection by filename and class name
according to opts.
Opts must contain attributes opts.model_module and opts.model_cls. The
specified class must be a subclass of nn.Module.
"""
import torch.nn as nn
import importlib
from pathlib import Path
from torch.utils.data import Dataset,... | [
"importlib.import_module"
] | [((1029, 1066), 'importlib.import_module', 'importlib.import_module', (['model_import'], {}), '(model_import)\n', (1052, 1066), False, 'import importlib\n')] |
"""
Code for processing operations for numpy arrays of tif stacks
"""
#Import packages
#Dependences
import numpy as np
from numpy.fft import fft2, ifft2, fftshift
from scipy.ndimage import median_filter, gaussian_filter, shift
import itertools
import gc
def doMedianFilter(imgstack, med_fsize=3):
'''
Median F... | [
"numpy.fft.fftshift",
"numpy.fft.ifft2",
"numpy.expm1",
"numpy.fft.fft2",
"scipy.ndimage.shift",
"numpy.array",
"numpy.empty",
"gc.collect",
"scipy.ndimage.gaussian_filter",
"itertools.izip",
"scipy.ndimage.median_filter",
"numpy.maximum",
"numpy.zeros_like"
] | [((571, 612), 'numpy.empty', 'np.empty', (['imgstack.shape'], {'dtype': 'np.uint16'}), '(imgstack.shape, dtype=np.uint16)\n', (579, 612), True, 'import numpy as np\n'), ((1522, 1545), 'numpy.empty', 'np.empty', (['logimgs.shape'], {}), '(logimgs.shape)\n', (1530, 1545), True, 'import numpy as np\n'), ((1782, 1794), 'gc... |
import simalign
from tqdm import tqdm
from simalign import SentenceAligner
def parse_file2lines(filename):
lines=[]
with open(filename) as f:
lines = f.readlines()
lines = [x.strip() for x in lines]
return lines
def align_simaligner(infile_src, infile_tgt, outfile, langs):
moden = 'iter... | [
"simalign.SentenceAligner"
] | [((563, 634), 'simalign.SentenceAligner', 'SentenceAligner', ([], {'model': '"""xlmr"""', 'token_type': '"""bpe"""', 'matching_methods': '"""mai"""'}), "(model='xlmr', token_type='bpe', matching_methods='mai')\n", (578, 634), False, 'from simalign import SentenceAligner\n')] |
from lex import *
import copy
from abc import abstractmethod
from typing import List
from copy import deepcopy
class Node:
def __init__(self):
self.tok = nil_token # type: Token
self.sub_nodes = []
self.precedence = 10000 # just for better code generation
self.parent = None
... | [
"copy.copy",
"copy.deepcopy"
] | [((1165, 1180), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (1174, 1180), False, 'import copy\n'), ((13986, 14010), 'copy.deepcopy', 'deepcopy', (['self.interface'], {}), '(self.interface)\n', (13994, 14010), False, 'from copy import deepcopy\n'), ((770, 793), 'copy.copy', 'copy.copy', (['self.tok.tok'], {}),... |
import sys
N = int(sys.stdin.readline())
time = []
for i in range(N):
(s, f) = map(int, sys.stdin.readline().split())
time.append((s, f))
time = sorted(time, key=lambda x :(x[1], x[0]))
s, f = time[0][0], time[0][1]
count = 1
for i in range(1, N):
(new_s, new_f) = time[i]
if new_s >= f:
count += 1
s, f = new_... | [
"sys.stdin.readline"
] | [((19, 39), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (37, 39), False, 'import sys\n'), ((89, 109), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (107, 109), False, 'import sys\n')] |
import smtpd
import asyncore
import argparse
def _get_args():
p = argparse.ArgumentParser()
p.add_argument('-p', '--port', type=int, help="Bind to port", default=25)
return p.parse_args()
class DebuggingServer(smtpd.DebuggingServer):
def process_message(self, peer, mailfrom, rcpttos, dat... | [
"smtpd.DebuggingServer.process_message",
"asyncore.loop",
"argparse.ArgumentParser"
] | [((78, 103), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (101, 103), False, 'import argparse\n'), ((767, 782), 'asyncore.loop', 'asyncore.loop', ([], {}), '()\n', (780, 782), False, 'import asyncore\n'), ((513, 587), 'smtpd.DebuggingServer.process_message', 'smtpd.DebuggingServer.process_mes... |
#!/usr/bin/env python3
from os import system
import curses
def get_param(prompt_string):
screen.clear()
screen.border(0)
screen.addstr(2, 2, prompt_string)
screen.refresh()
minput = screen.getstr(10, 10, 60)
return minput
def execute_cmd(cmd_string):
system("clear")
a = system(cmd_s... | [
"os.system",
"curses.endwin",
"curses.initscr"
] | [((1118, 1133), 'curses.endwin', 'curses.endwin', ([], {}), '()\n', (1131, 1133), False, 'import curses\n'), ((1134, 1149), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (1140, 1149), False, 'from os import system\n'), ((284, 299), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (290, 299), ... |
import time
from src.celery import app
@app.task(bind=True, default_retry_delay=10)
def process_event(self, event):
process_change(event['wait'])
return event
def process_change(wait_secs):
start = time.time()
while time.time() - start < wait_secs:
time.sleep(0.001)
| [
"src.celery.app.task",
"time.time",
"time.sleep"
] | [((43, 86), 'src.celery.app.task', 'app.task', ([], {'bind': '(True)', 'default_retry_delay': '(10)'}), '(bind=True, default_retry_delay=10)\n', (51, 86), False, 'from src.celery import app\n'), ((215, 226), 'time.time', 'time.time', ([], {}), '()\n', (224, 226), False, 'import time\n'), ((278, 295), 'time.sleep', 'tim... |
"""Support for Eldes sensors."""
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from .const import (
DATA_CLIENT,
DATA_COORDI... | [
"logging.getLogger"
] | [((383, 410), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (400, 410), False, 'import logging\n')] |
import json
import os
import pathlib
import google.auth
import google.auth.transport.requests
import requests
# Util methods for making REST calls
def get_auth_token():
"""
Returns Goggle OAuth 2.0 access token
"""
# getting the credentials and project details for gcp project
credentials, your_pr... | [
"json.loads",
"requests.get",
"pathlib.Path"
] | [((1056, 1105), 'requests.get', 'requests.get', (['url'], {'headers': 'headers', 'params': 'params'}), '(url, headers=headers, params=params)\n', (1068, 1105), False, 'import requests\n'), ((1149, 1177), 'json.loads', 'json.loads', (['response.content'], {}), '(response.content)\n', (1159, 1177), False, 'import json\n'... |
# Copyright (c) 2016-2019 Cloudify Platform Ltd. 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 ... | [
"cloudify_libvirt.volume_tasks.snapshot_apply",
"mock.patch",
"mock.Mock",
"cloudify_libvirt.volume_tasks.snapshot_delete",
"cloudify.state.current_ctx.set",
"cloudify_libvirt.volume_tasks.create",
"cloudify_libvirt.volume_tasks.libvirt.libvirtError",
"cloudify_libvirt.volume_tasks.stop",
"cloudify_... | [((26445, 26460), 'unittest.main', 'unittest.main', ([], {}), '()\n', (26458, 26460), False, 'import unittest\n'), ((1051, 1215), 'cloudify.mocks.MockCloudifyContext', 'MockCloudifyContext', (['"""node_name"""'], {'properties': "{'libvirt_auth': {'a': 'c'}, 'params': {'pool': 'pool_name'}}", 'runtime_properties': "{'li... |
# -*- coding:utf-8 -*-
import os
import six
from .pystring import PyString
class PyFile(object):
"""More human-friendly file access interface.
Works on Python2 and 3.
Usage:
file = File(".bashrc")
file.write("Hello, world!!")
print(file.read())
del file
"""
clas... | [
"os.stat"
] | [((902, 920), 'os.stat', 'os.stat', (['self.path'], {}), '(self.path)\n', (909, 920), False, 'import os\n'), ((957, 975), 'os.stat', 'os.stat', (['self.path'], {}), '(self.path)\n', (964, 975), False, 'import os\n')] |
from websocket import create_connection
ws = create_connection("ws://localhost:8000/Member/on_open/MGD4")
print("Sending 'Hello, World'...")
ws.send("Hello, World")
print("Sent")
print("Receiving...")
result = ws.recv()
print("Received '%s'" % result)
ws.close() | [
"websocket.create_connection"
] | [((46, 106), 'websocket.create_connection', 'create_connection', (['"""ws://localhost:8000/Member/on_open/MGD4"""'], {}), "('ws://localhost:8000/Member/on_open/MGD4')\n", (63, 106), False, 'from websocket import create_connection\n')] |
from urllib.request import urlopen
from bs4 import BeautifulSoup
# html = urlopen('http://www.pythonscraping.com/pages/warandpeace.html')
# bs = BeautifulSoup(html.read(), 'html5lib')
#
# nameList = bs.findAll('span', {'class': 'green'})
# for name in nameList:
# print(name.get_text())
html = urlopen('https://www... | [
"urllib.request.urlopen"
] | [((300, 374), 'urllib.request.urlopen', 'urlopen', (['"""https://www.nike.com/nl/w/heren-jordan-schoenen-37eefznik1zy7ok"""'], {}), "('https://www.nike.com/nl/w/heren-jordan-schoenen-37eefznik1zy7ok')\n", (307, 374), False, 'from urllib.request import urlopen\n')] |
# 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 License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"official.utils.logs.hooks_helper.get_train_hooks",
"official.utils.logs.logger.get_benchmark_logger",
"official.utils.logs.mlperf_helper.ncf_print",
"tensorflow.estimator.RunConfig",
"official.recommendation.ncf_common.parse_flags",
"official.recommendation.ncf_common.get_v1_distribution_strategy",
"of... | [((2230, 2277), 'official.recommendation.ncf_common.get_v1_distribution_strategy', 'ncf_common.get_v1_distribution_strategy', (['params'], {}), '(params)\n', (2269, 2277), False, 'from official.recommendation import ncf_common\n'), ((2294, 2382), 'tensorflow.estimator.RunConfig', 'tf.estimator.RunConfig', ([], {'train_... |
#!/usr/bin/python
import sys
import os
workload_dir = "../bin/workload_list/"
SIM_NUM = 100
# 6128-node BLESS
out_dir = "../results/BLESS/16x16/"
workload = "hetero_workload_16x16"
network_nrX = "16"
network_nrY = "16"
router_addrPacketSize = "1"
router_dataPacketSize = "4"
router_maxPacketSize = "4"
... | [
"os.system"
] | [((1069, 1092), 'os.system', 'os.system', (['command_line'], {}), '(command_line)\n', (1078, 1092), False, 'import os\n')] |
"""Config file reader utils."""
import os
import shutil
from google.protobuf import text_format
import avod
from avod.protos import model_pb2
from avod.protos import pipeline_pb2
class ConfigObj:
pass
def proto_to_obj(config):
"""Hack to convert proto config into an object so repeated fields can be
o... | [
"os.path.exists",
"os.makedirs",
"avod.root_dir",
"avod.protos.model_pb2.ModelConfig",
"os.path.split",
"avod.protos.pipeline_pb2.NetworkPipelineConfig",
"shutil.copy"
] | [((1013, 1036), 'avod.protos.model_pb2.ModelConfig', 'model_pb2.ModelConfig', ([], {}), '()\n', (1034, 1036), False, 'from avod.protos import model_pb2\n'), ((1849, 1885), 'avod.protos.pipeline_pb2.NetworkPipelineConfig', 'pipeline_pb2.NetworkPipelineConfig', ([], {}), '()\n', (1883, 1885), False, 'from avod.protos imp... |
import logging
import os
import pickle
import re
import shutil
import sys
import tempfile
import threading
import uuid
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta
from typing import DefaultDict, Iterator, List, Optional, Union
from seleniumwire.request import Request, Resp... | [
"logging.getLogger",
"collections.OrderedDict",
"os.listdir",
"pickle.dump",
"os.makedirs",
"threading.Lock",
"os.path.join",
"pickle.load",
"uuid.uuid4",
"os.path.dirname",
"datetime.datetime.now",
"collections.defaultdict",
"os.mkdir",
"tempfile.gettempdir",
"shutil.rmtree",
"os.path... | [((350, 377), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (367, 377), False, 'import logging\n'), ((2256, 2295), 'os.path.join', 'os.path.join', (['base_dir', '""".seleniumwire"""'], {}), "(base_dir, '.seleniumwire')\n", (2268, 2295), False, 'import os\n'), ((2404, 2448), 'os.makedirs'... |
import codecs
import numpy as np
import os
_CORE_ARGS = { "ARG0", "ARG1", "ARG2", "ARG3", "ARG4", "ARG5", "ARGA",
"A0", "A1", "A2", "A3", "A4", "A5", "AA" }
def logsumexp(arr):
maxv = np.max(arr)
lognorm = maxv + np.log(np.sum(np.exp(arr - maxv)))
arr2 = np.exp(arr - lognorm)
#print maxv, logn... | [
"numpy.exp",
"numpy.max"
] | [((204, 215), 'numpy.max', 'np.max', (['arr'], {}), '(arr)\n', (210, 215), True, 'import numpy as np\n'), ((279, 300), 'numpy.exp', 'np.exp', (['(arr - lognorm)'], {}), '(arr - lognorm)\n', (285, 300), True, 'import numpy as np\n'), ((249, 267), 'numpy.exp', 'np.exp', (['(arr - maxv)'], {}), '(arr - maxv)\n', (255, 267... |
from aitlas.datasets.crops_classification import CropsDataset
import os
import zipfile
import tarfile
import urllib
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import seaborn as sns
import h5py
from ..base import ... | [
"aitlas.datasets.crops_classification.CropsDataset.__init__",
"os.path.exists",
"numpy.multiply",
"numpy.repeat",
"pandas.read_csv",
"urllib.request.urlretrieve",
"sklearn.model_selection.train_test_split",
"os.scandir",
"pandas.concatenate",
"eolearn.core.EOPatch.load",
"h5py.File",
"os.path.... | [((1493, 1528), 'aitlas.datasets.crops_classification.CropsDataset.__init__', 'CropsDataset.__init__', (['self', 'config'], {}), '(self, config)\n', (1514, 1528), False, 'from aitlas.datasets.crops_classification import CropsDataset\n'), ((2327, 2401), 'pandas.read_csv', 'pd.read_csv', (["(self.root + os.sep + self.reg... |
# REGULAR EXPRESSIONS
# Start by importing "re" for Reglar Expressions
import re
patterns = ["term1", "term2"]
text = "This is a string with term1, but not the other!"
# Search with re
print("\n** Regular Expression - Search")
for pattern in patterns:
print("*Serching for: " + pattern)
if re.search(patter... | [
"re.split",
"re.findall",
"re.search"
] | [((412, 436), 're.search', 're.search', (['"""term1"""', 'text'], {}), "('term1', text)\n", (421, 436), False, 'import re\n'), ((651, 672), 're.findall', 're.findall', (['"""t"""', 'text'], {}), "('t', text)\n", (661, 672), False, 'import re\n'), ((304, 328), 're.search', 're.search', (['pattern', 'text'], {}), '(patte... |
from unittest import mock
import pytest
from onapsdk.aai.business import VfModuleInstance
from onapsdk.so.deletion import VfModuleDeletionRequest
from onapsdk.exceptions import ResourceNotFound
def test_vf_module():
vnf_instance = mock.MagicMock()
vnf_instance.url = "test_url"
vf_module_instance = VfModu... | [
"unittest.mock.MagicMock",
"onapsdk.aai.business.VfModuleInstance",
"pytest.raises",
"unittest.mock.patch.object"
] | [((751, 809), 'unittest.mock.patch.object', 'mock.patch.object', (['VfModuleDeletionRequest', '"""send_request"""'], {}), "(VfModuleDeletionRequest, 'send_request')\n", (768, 809), False, 'from unittest import mock\n'), ((238, 254), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (252, 254), False, 'from... |
import operator
import rt
def parallel_sum(l, r):
"""Computes (l + (l+1) + ... + r)."""
# TODO(zhangwen): this function can either return an int or a future; this seems confusing...
if l == r:
return l
m = (l + r) // 2
sl = parallel_sum(l, m)
sr = parallel_sum(m + 1, r)
return rt... | [
"rt.spawn"
] | [((318, 350), 'rt.spawn', 'rt.spawn', (['operator.add', '(sl, sr)'], {}), '(operator.add, (sl, sr))\n', (326, 350), False, 'import rt\n')] |
#!/usr/bin/env python
# coding: utf-8
# ### - Calculate the signature strength and Transcriptional Activity Score for each compound based on its replicates for Cell painting Level-4 profiles
#
#
# #### Definitions from [clue.io](https://clue.io/connectopedia/signature_quality_metrics)
#
# - **Signature strength -*... | [
"os.path.exists",
"pickle.dump",
"pandas.merge",
"numpy.warnings.filterwarnings",
"os.path.join",
"math.sqrt",
"pandas.DataFrame.from_dict",
"seaborn.set_style",
"os.mkdir",
"warnings.simplefilter"
] | [((1304, 1329), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (1317, 1329), True, 'import seaborn as sns\n'), ((1390, 1452), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n",... |