code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.conf import settings
from django.db import models
from .validators import validate_file_extension
# Create your models here.
class NormalProject(models.Model):
name = models.CharField(max_length=100, null=False, unique=True)
owner = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='owner_nor... | [
"django.db.models.FileField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField"
] | [((183, 240), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(False)', 'unique': '(True)'}), '(max_length=100, null=False, unique=True)\n', (199, 240), False, 'from django.db import models\n'), ((253, 363), 'django.db.models.ForeignKey', 'models.ForeignKey', (['settings.AUTH_USE... |
import numpy as np
import pandas as pd
import torch
import torch.utils.data
import torch.optim as optim
from torch.optim import Adam
from torch.nn import functional as F
from torch.nn import (Dropout, LeakyReLU, Linear, Module, ReLU, Sequential,
Conv2d, ConvTranspose2d, BatchNorm2d, Sigmoid, init, BCELoss, CrossEntropy... | [
"torch.nn.Dropout",
"numpy.sum",
"numpy.argmax",
"torch.argmax",
"torch.cat",
"torch.randn",
"torch.nn.init.constant_",
"numpy.arange",
"torch.nn.BCELoss",
"model.synthesizer.transformer.ImageTransformer",
"torch.nn.Linear",
"numpy.random.choice",
"torch.log",
"numpy.random.shuffle",
"nu... | [((2100, 2124), 'torch.cat', 'torch.cat', (['data_t'], {'dim': '(1)'}), '(data_t, dim=1)\n', (2109, 2124), False, 'import torch\n'), ((6050, 6074), 'torch.stack', 'torch.stack', (['loss'], {'dim': '(1)'}), '(loss, dim=1)\n', (6061, 6074), False, 'import torch\n'), ((1104, 1120), 'torch.nn.Sequential', 'Sequential', (['... |
import requests
import json
from bs4 import BeautifulSoup
from gamayun.gamayun_utils import report_result_with_maps_only
from gamayun.gamayun_utils import report_error
from gamayun.gamayun_utils import run_gamayun_script_logic
def parse_single_entry(entry):
# test if this entry contains comment (if it doesn't it i... | [
"bs4.BeautifulSoup",
"gamayun.gamayun_utils.report_result_with_maps_only",
"gamayun.gamayun_utils.run_gamayun_script_logic",
"requests.get"
] | [((1110, 1145), 'gamayun.gamayun_utils.run_gamayun_script_logic', 'run_gamayun_script_logic', (['job_logic'], {}), '(job_logic)\n', (1134, 1145), False, 'from gamayun.gamayun_utils import run_gamayun_script_logic\n'), ((807, 881), 'requests.get', 'requests.get', ([], {'url': '"""https://old.reddit.com/r/programming/"""... |
"""
util.py
Some utility functions
"""
import os
import numpy as np
from sklearn.neighbors import BallTree, radius_neighbors_graph
import networkx as nx
__all__ = ["ORCA_PATH", "pbc", "orbits", "weights", "compute_graph"]
ORCA_PATH = os.path.abspath(os.path.abspath(__file__) + "../../../orca/orca.exe")
def pbc(x0,... | [
"os.path.abspath",
"numpy.abs",
"networkx.from_numpy_matrix",
"sklearn.neighbors.radius_neighbors_graph",
"numpy.log",
"numpy.where",
"numpy.array",
"sklearn.neighbors.BallTree"
] | [((477, 734), 'numpy.array', 'np.array', (['[1, 2, 2, 2, 3, 4, 3, 3, 4, 3, 4, 4, 4, 4, 3, 4, 6, 5, 4, 5, 6, 6, 4, 4, 4,\n 5, 7, 4, 6, 6, 7, 4, 6, 6, 6, 5, 6, 7, 7, 5, 7, 6, 7, 6, 5, 5, 6, 8, 7,\n 6, 6, 8, 6, 9, 5, 6, 4, 6, 6, 7, 8, 6, 6, 8, 7, 6, 7, 7, 8, 5, 6, 6, 4]'], {'dtype': 'np.float'}), '([1, 2, 2, 2, 3, 4... |
from panda3d.core import Point3, TransformState, LQuaternion
from panda3d.core import Camera, PerspectiveLens, OrthographicLens, CS_default, CS_zup_right, CS_yup_right, CS_zup_left, CS_yup_left, CS_invalid
from panda3d.core import GeomVertexArrayFormat, Geom, GeomVertexFormat, GeomVertexData, GeomVertexWriter, Triangul... | [
"panda3d.core.GeomVertexWriter",
"panda3d.core.CollisionNode",
"panda3d.core.GeomVertexFormat",
"panda3d.core.GeomVertexFormat.registerFormat",
"panda3d.core.GeomVertexData",
"panda3d.core.Point3",
"panda3d.core.PerspectiveLens",
"os.path.join",
"panda3d.core.CollisionPolygon",
"panda3d.core.Filen... | [((618, 630), 'panda3d.core.Notify.out', 'Notify.out', ([], {}), '()\n', (628, 630), False, 'from panda3d.core import BamFile, BamWriter, Filename, Notify\n'), ((869, 936), 'bpy.context.window_manager.popup_menu', 'bpy.context.window_manager.popup_menu', (['draw'], {'title': 'title', 'icon': 'icon'}), '(draw, title=tit... |
# -*- coding: utf-8 -*-
import pandas as pd
import plotly.graph_objs as go
import requests
from base64 import b64encode as be
from dash_html_components import Th, Tr, Td, A
from datetime import datetime, timedelta
from flask import request
from folium import Map
from operator import itemgetter
from os.path import join... | [
"pandas.DataFrame",
"dash_html_components.Td",
"random.randint",
"plotly.graph_objs.Scatter",
"os.path.realpath",
"pandas.read_json",
"datetime.datetime.utcnow",
"pandas.to_datetime",
"datetime.timedelta",
"folium.Map",
"pandas.Grouper",
"dash_html_components.Th",
"requests.auth.HTTPBasicAut... | [((792, 822), 'pandas.DataFrame', 'pd.DataFrame', (["j['records'][ch]"], {}), "(j['records'][ch])\n", (804, 822), True, 'import pandas as pd\n'), ((1455, 1485), 'pandas.DataFrame', 'pd.DataFrame', (["j['records'][ch]"], {}), "(j['records'][ch])\n", (1467, 1485), True, 'import pandas as pd\n'), ((2102, 2132), 'pandas.Da... |
#!/usr/bin/python
# coding:utf8
"""
@author: <NAME>
@time: 2019-12-07 20:51
"""
import os
import re
import json
import tensorflow as tf
import tokenization
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
vocab_file = "./vocab.txt"
tokenizer_ = tokenization.FullTokenizer(vocab_file=vocab_file)
label2id = json.loads(open("./l... | [
"tensorflow.train.import_meta_graph",
"tensorflow.reset_default_graph",
"tokenization.FullTokenizer",
"tensorflow.Session",
"json.dumps",
"re.search",
"tensorflow.train.get_checkpoint_state"
] | [((239, 288), 'tokenization.FullTokenizer', 'tokenization.FullTokenizer', ([], {'vocab_file': 'vocab_file'}), '(vocab_file=vocab_file)\n', (265, 288), False, 'import tokenization\n'), ((2103, 2127), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (2125, 2127), True, 'import tensorflow as t... |
import os
import torch
def GERF_loss(GT, pred, args):
mask = (GT < args.maxdisp) & (GT >= 0)
# print(mask.size(), GT.size(), pred.size())
count = len(torch.nonzero(mask))
# print(count)
if count == 0:
count = 1
return torch.sum(torch.sqrt(torch.pow(GT[mask] - pred[mask], 2) + 4) /2 - 1)... | [
"torch.nonzero",
"torch.pow"
] | [((163, 182), 'torch.nonzero', 'torch.nonzero', (['mask'], {}), '(mask)\n', (176, 182), False, 'import torch\n'), ((272, 307), 'torch.pow', 'torch.pow', (['(GT[mask] - pred[mask])', '(2)'], {}), '(GT[mask] - pred[mask], 2)\n', (281, 307), False, 'import torch\n')] |
import inspect
import os
def get_datasets_folder():
return os.path.join(get_data_folder(), "Datasets")
def get_data_folder():
return os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
| [
"inspect.currentframe"
] | [((192, 214), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (212, 214), False, 'import inspect\n')] |
from collections import Counter
import difflib
def _checksum(r):
counter = Counter(r)
return int(any([x == 2 for x in counter.values()])), int(any([x == 3 for x in counter.values()]))
def _solve_1(rows):
d = [_checksum(row) for row in rows]
return sum([x[0] for x in d]) * sum([x[1] for x in d])
d... | [
"collections.Counter",
"AOC2018.run_solver",
"difflib.SequenceMatcher"
] | [((81, 91), 'collections.Counter', 'Counter', (['r'], {}), '(r)\n', (88, 91), False, 'from collections import Counter\n'), ((760, 787), 'AOC2018.run_solver', 'run_solver', (['solve', '__file__'], {}), '(solve, __file__)\n', (770, 787), False, 'from AOC2018 import run_solver\n'), ((439, 473), 'difflib.SequenceMatcher', ... |
import asyncio
import functools
import contextlib
import aiohttp
from ..protocol import Protocol
from ..exceptions import InstagramError
__all__ = (
"AioHTTPInstagramApi",
)
class AioHTTPInstagramApi:
def __init__(self, username, password, state=None, delay=5, proxy=None, loop=None, lock=None):
i... | [
"asyncio.get_event_loop",
"asyncio.sleep",
"contextlib.suppress",
"asyncio.Lock",
"functools.wraps",
"aiohttp.ProxyConnector"
] | [((826, 849), 'functools.wraps', 'functools.wraps', (['method'], {}), '(method)\n', (841, 849), False, 'import functools\n'), ((406, 441), 'aiohttp.ProxyConnector', 'aiohttp.ProxyConnector', ([], {'proxy': 'proxy'}), '(proxy=proxy)\n', (428, 441), False, 'import aiohttp\n'), ((554, 578), 'asyncio.get_event_loop', 'asyn... |
import jinja2
def render(filename, context={}, error=None, path='templates'):
if error:
# Error should be a string
if isinstance(error, str):
context['error'] = error
else:
raise TypeError('Error message must be a string')
return jinja2.Environment(
load... | [
"jinja2.FileSystemLoader"
] | [((323, 352), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', (['path'], {}), '(path)\n', (346, 352), False, 'import jinja2\n')] |
"""
@author: <NAME>
@contact: <EMAIL>
"""
import logging
import numpy as np # type: ignore
import sys
from typing import Callable
def ert_type(x, stype, label):
if not isinstance(x, stype):
raise AssertionError(f"{label} should be {stype}, {type(x)} instead")
def ert_multiTypes(x, types, label):
c... | [
"logging.exception",
"logging.warning",
"numpy.iinfo",
"numpy.finfo",
"sys.exit"
] | [((1998, 2060), 'logging.warning', 'logging.warning', (['f"""assert not implemented for dtype \'{dtype}\'"""'], {}), '(f"assert not implemented for dtype \'{dtype}\'")\n', (2013, 2060), False, 'import logging\n'), ((1350, 1365), 'numpy.finfo', 'np.finfo', (['dtype'], {}), '(dtype)\n', (1358, 1365), True, 'import numpy ... |
import ast
import os
import cv2
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from keras.applications.densenet import preprocess_input
from keras.metrics import (categorical_accuracy, top_k_categorical_accuracy)
from keras.models import Model, load_model
DP_DIR = './input... | [
"cv2.line",
"keras.applications.densenet.preprocess_input",
"numpy.random.seed",
"tensorflow.keras.utils.to_categorical",
"cv2.cvtColor",
"pandas.read_csv",
"numpy.zeros",
"numpy.flipud",
"tensorflow.set_random_seed",
"numpy.argsort",
"numpy.array",
"numpy.random.permutation",
"keras.metrics... | [((429, 454), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(2018)'}), '(seed=2018)\n', (443, 454), True, 'import numpy as np\n'), ((455, 484), 'tensorflow.set_random_seed', 'tf.set_random_seed', ([], {'seed': '(2018)'}), '(seed=2018)\n', (473, 484), True, 'import tensorflow as tf\n'), ((1588, 1635), 'keras.met... |
# Copyright (c) 2018 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSlot
from UM.Qt.ListModel import ListModel
from UM.Logger import Logger
#
# This the QML model for the quality management page.
#
class QualityManagementModel(ListModel):
NameRole = Qt.UserRo... | [
"UM.PluginRegistry.PluginRegistry.getInstance",
"cura.CuraApplication.CuraApplication.getInstance",
"UM.i18n.i18nCatalog",
"PyQt5.QtCore.pyqtSlot"
] | [((4055, 4091), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', (['str'], {'result': '"""QVariantList"""'}), "(str, result='QVariantList')\n", (4063, 4091), False, 'from PyQt5.QtCore import Qt, pyqtSlot\n'), ((4195, 4217), 'UM.i18n.i18nCatalog', 'i18nCatalog', (['"""uranium"""'], {}), "('uranium')\n", (4206, 4217), False, 'from U... |
from click.testing import CliRunner
from git_history.cli import cli
from git_history.utils import RESERVED
import itertools
import json
import pytest
import subprocess
import sqlite_utils
import textwrap
git_commit = [
"git",
"-c",
"user.name='Tests'",
"-c",
"user.email='<EMAIL>'",
"commit",
]
... | [
"textwrap.dedent",
"json.loads",
"sqlite_utils.Database",
"json.dumps",
"pytest.mark.parametrize",
"click.testing.CliRunner",
"itertools.chain"
] | [((5263, 5317), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""namespace"""', "(None, 'custom')"], {}), "('namespace', (None, 'custom'))\n", (5286, 5317), False, 'import pytest\n'), ((6734, 6788), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""namespace"""', "(None, 'custom')"], {}), "('namesp... |
import mysql.connector
import progressbar
import argparse
import yaml
import re
import collections
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--out', type=str, default='data/racist/racist.txt',
help='text file where the data is written to')
args = parser.pa... | [
"yaml.load",
"argparse.ArgumentParser",
"re.escape",
"collections.Counter",
"progressbar.ProgressBar",
"re.sub"
] | [((126, 151), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (149, 151), False, 'import argparse\n'), ((1048, 1088), 'progressbar.ProgressBar', 'progressbar.ProgressBar', ([], {'max_value': 'count'}), '(max_value=count)\n', (1071, 1088), False, 'import progressbar\n'), ((388, 400), 'yaml.load',... |
import os
import glob
import csv
import argparse
from xlsxwriter.workbook import Workbook
def arguments():
parser = argparse.ArgumentParser()
parser.add_argument('path', default = os.getcwd(), help = "Path to CSV files")
parser.add_argument('--outname', default = None, help = "Name of output XLSX file")
... | [
"os.path.abspath",
"csv.reader",
"argparse.ArgumentParser",
"os.path.basename",
"os.getcwd",
"xlsxwriter.workbook.Workbook",
"os.path.join"
] | [((122, 147), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (145, 147), False, 'import argparse\n'), ((410, 434), 'os.path.abspath', 'os.path.abspath', (['csvpath'], {}), '(csvpath)\n', (425, 434), False, 'import os\n'), ((584, 622), 'os.path.join', 'os.path.join', (['directory_path', 'filenam... |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.local.local_settings import SIGNUP_ROLES, OPENSTACK_API_VERSIONS
from openstack_dashboard.dashboards.identity.signups.common import get_admin_ksclient
class Signups(horizon.Panel):
name = _("Signups")
slug = 'signu... | [
"django.utils.translation.ugettext_lazy",
"openstack_dashboard.dashboards.identity.signups.common.get_admin_ksclient"
] | [((290, 302), 'django.utils.translation.ugettext_lazy', '_', (['"""Signups"""'], {}), "('Signups')\n", (291, 302), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((518, 538), 'openstack_dashboard.dashboards.identity.signups.common.get_admin_ksclient', 'get_admin_ksclient', ([], {}), '()\n', (536, 5... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Adapted from https://github.com/microsoft/CodeXGLUE/blob/main/Text-Code/NL-code-search-Adv/evaluator/evaluator.py
import logging
import sys, json
import numpy as np
def read_answers(filename):
answers = {}
with open(filename) as f:
... | [
"numpy.mean",
"argparse.ArgumentParser",
"sys.exit",
"json.loads"
] | [((1399, 1496), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate leaderboard predictions for POJ-104 dataset."""'}), "(description=\n 'Evaluate leaderboard predictions for POJ-104 dataset.')\n", (1422, 1496), False, 'import argparse\n'), ((1314, 1329), 'numpy.mean', 'np.mean', ... |
import threading
#
# @author andy
#
class LongAdder:
def __init__(self):
self._lock = threading.Lock()
self._value = 0
def get_value(self):
return self._value
def increment(self):
with self._lock:
self._value += 1
def decrement(self):
with self._lo... | [
"threading.Lock"
] | [((99, 115), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (113, 115), False, 'import threading\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import actionlib
import math
from trajectory_msgs.msg import JointTrajectry
from trajectry_msgs.msg import JointTrajectoryPoint
from control_msgs.msg import JointTrajectory
from sensor_msgs.msg import LaserScan
i=0
def callback(msg):
rospy.loginfo('min ... | [
"rospy.Subscriber",
"rospy.Time.now",
"actionlib.SimpleActionClient",
"rospy.loginfo",
"control_msgs.msg.JointTrajectory",
"rospy.init_node",
"rospy.spin",
"rospy.Duration"
] | [((301, 397), 'rospy.loginfo', 'rospy.loginfo', (["('min %f -(%f)-> max %f' % (msg.angle_min, msg.angle_increment, msg.angle_max))"], {}), "('min %f -(%f)-> max %f' % (msg.angle_min, msg.angle_increment,\n msg.angle_max))\n", (314, 397), False, 'import rospy\n'), ((452, 561), 'actionlib.SimpleActionClient', 'actionl... |
import json
from datetime import datetime
from django.db.models import Model
from jsonpath_ng import parse
from rdflib import Graph, URIRef
from safetydance import step_data
from safetydance_django.steps import ( # noqa: F401
http_client,
http_response,
json_values_match,
)
from safetydance_django.test im... | [
"rdflib.Graph",
"safetydance_test.step_extension.step_extension",
"json.dumps",
"rdflib.URIRef",
"jsonpath_ng.parse",
"safetydance.step_data",
"safetydance_django.steps.http_response.json",
"safetydance_django.steps.json_values_match"
] | [((827, 860), 'safetydance.step_data', 'step_data', (['dict'], {'initializer': 'dict'}), '(dict, initializer=dict)\n', (836, 860), False, 'from safetydance import step_data\n'), ((885, 918), 'safetydance.step_data', 'step_data', (['dict'], {'initializer': 'dict'}), '(dict, initializer=dict)\n', (894, 918), False, 'from... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2015, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import sys
import mimetypes
import base64
import textwrap
import datetime
import io
import uuid
import json
import time
import shutil
import subprocess as sp
import itertools
from collections import named... | [
"yaml.load",
"snakemake.logging.logger.warning",
"base64.b64decode",
"collections.defaultdict",
"os.path.isfile",
"snakemake.exceptions.WorkflowError",
"docutils.parsers.rst.directives.images.Image.run",
"mimetypes.guess_type",
"os.path.dirname",
"snakemake.logging.logger.info",
"requests.get",
... | [((1369, 1430), 'docutils.parsers.rst.directives.register_directive', 'directives.register_directive', (['"""embeddedimage"""', 'EmbeddedImage'], {}), "('embeddedimage', EmbeddedImage)\n", (1398, 1430), False, 'from docutils.parsers.rst import directives\n'), ((1489, 1552), 'docutils.parsers.rst.directives.register_dir... |
#!/usr/bin/env python
import os
import re
from flask import Flask, redirect
from tumblpy import Tumblpy
import app_config
app = Flask(app_config.PROJECT_NAME)
app.config['PROPAGATE_EXCEPTIONS'] = True
@app.route('/dear-mr-president/', methods=['POST'])
def _post_to_tumblr():
"""
Handles the POST to Tumblr... | [
"flask.redirect",
"flask.Flask",
"re.sub",
"tumblpy.Tumblpy",
"re.compile"
] | [((132, 162), 'flask.Flask', 'Flask', (['app_config.PROJECT_NAME'], {}), '(app_config.PROJECT_NAME)\n', (137, 162), False, 'from flask import Flask, redirect\n'), ((1647, 1844), 'tumblpy.Tumblpy', 'Tumblpy', ([], {'app_key': 'app_config.TUMBLR_KEY', 'app_secret': "os.environ['TUMBLR_APP_SECRET']", 'oauth_token': "os.en... |
from math import sqrt
#Courtesy of Aran-Fey https://chat.stackoverflow.com/transcript/message/47258396#47258396
def circle_octant(r):
r2 = r ** 2
y = 0
while y <= r:
x = sqrt(r2 - y**2)
if x-int(x) >= 0.5:
x += 1
else:
# If we moved left, find o... | [
"PIL.ImageDraw.Draw",
"animation.make_gif",
"PIL.Image.new",
"math.sqrt"
] | [((2554, 2613), 'animation.make_gif', 'animation.make_gif', (['frames'], {'delay': '(8)', 'delete_temp_files': '(True)'}), '(frames, delay=8, delete_temp_files=True)\n', (2572, 2613), False, 'import animation\n'), ((1943, 1982), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(SIZE, SIZE)', '"""white"""'], {}), "('RGB', ... |
import pyOcean_cpu as ocean
s = ocean.cdouble(3+4j)
print(s)
print(s.asPython())
print(s.imag.asPython())
print(s.real.asPython())
print(int(s.real))
print(float(s.real))
| [
"pyOcean_cpu.cdouble"
] | [((33, 56), 'pyOcean_cpu.cdouble', 'ocean.cdouble', (['(3 + 4.0j)'], {}), '(3 + 4.0j)\n', (46, 56), True, 'import pyOcean_cpu as ocean\n')] |
# Generated by Django 2.2.4 on 2019-09-11 03:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('deck', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Boar... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((1832, 1910), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""game.Game"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='game.Game')\n", (1849, 1910), False, 'from django.db import migrations, models\n'), ((368, 461), 'django.db.models.Aut... |
#%% Load Dependencies
from math import pi
from IPython.display import display
from pyvlm import LatticeResult, LatticeOptimum
from pyvlm import latticesystem_from_json
from pyvlm.tools import elliptical_lift_force_distribution
#%% Create Lattice System
jsonfilepath = '../files/Straight_Wing_Cosine_100.json'
lsys = lat... | [
"pyvlm.latticesystem_from_json",
"pyvlm.LatticeOptimum",
"pyvlm.tools.elliptical_lift_force_distribution",
"IPython.display.display",
"pyvlm.LatticeResult"
] | [((317, 354), 'pyvlm.latticesystem_from_json', 'latticesystem_from_json', (['jsonfilepath'], {}), '(jsonfilepath)\n', (340, 354), False, 'from pyvlm import latticesystem_from_json\n'), ((355, 368), 'IPython.display.display', 'display', (['lsys'], {}), '(lsys)\n', (362, 368), False, 'from IPython.display import display\... |
from django.contrib import admin
from django.urls import path, include
from avaloq_app import views
urlpatterns = [
path('', views.review, name='review'),
path('avaloq/', include('avaloq_app.urls')),
path('admin/', admin.site.urls),
path('accounts/', include('registration.backends.default.urls')),
]
ha... | [
"django.urls.path",
"django.urls.include"
] | [((121, 158), 'django.urls.path', 'path', (['""""""', 'views.review'], {'name': '"""review"""'}), "('', views.review, name='review')\n", (125, 158), False, 'from django.urls import path, include\n'), ((213, 244), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (21... |
import os
import re
import sys
import webbrowser
import yaml
import pyautogui
import tkinter
file = __file__[:-7]
meetings = {"meetings": []}
def more_option(opt):
os.system("cls || clear")
# Add
if opt == 1:
print(" Give alias for your meeting")
alias = input(" [User] >>> ")
... | [
"tkinter.Label",
"webbrowser.open",
"pyautogui.click",
"yaml.load",
"pyautogui.locateCenterOnScreen",
"yaml.dump",
"os.system",
"re.match",
"tkinter.Frame",
"re.search",
"tkinter.Tk"
] | [((173, 198), 'os.system', 'os.system', (['"""cls || clear"""'], {}), "('cls || clear')\n", (182, 198), False, 'import os\n'), ((3211, 3236), 'os.system', 'os.system', (['"""cls || clear"""'], {}), "('cls || clear')\n", (3220, 3236), False, 'import os\n'), ((3927, 3968), 'tkinter.Tk', 'tkinter.Tk', ([], {'className': '... |
import matplotlib.pyplot as plt
def display_metric_vs_epochs_plot(scores, metric, nth_iter, nth_fold):
"""Display a metric vs. epochs plot.
Both the training and validation scores will be plotted for the
chosen metric.
Parameters
----------
scores : pandas.DataFrame
Scores containing ... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.xlabel"
] | [((847, 873), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4)'}), '(figsize=(6, 4))\n', (857, 873), True, 'import matplotlib.pyplot as plt\n'), ((877, 947), 'matplotlib.pyplot.plot', 'plt.plot', (['epochs', 'metric_fold_scores', '"""bo"""'], {'label': 'f"""Training {metric}"""'}), "(epochs, metric_fo... |
import os # NOQA
import sys # NOQA
import re # NOQA
import math # NOQA
import fileinput
from collections import Counter, deque, namedtuple # NOQA
from itertools import count, product, permutations, combinations, combinations_with_replacement # NOQA
from utils import parse_line, mul, factors, memoize, primes, new... | [
"utils.new_table",
"fileinput.input",
"utils.parse_line"
] | [((713, 747), 'utils.new_table', 'new_table', (['None'], {'width': '(2)', 'height': '(4)'}), '(None, width=2, height=4)\n', (722, 747), False, 'from utils import parse_line, mul, factors, memoize, primes, new_table, Point\n'), ((774, 791), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (789, 791), False, 'impo... |
from __future__ import print_function
import argparse
import numpy as np
import os, csv
from dataset import CIFAR10IndexPseudoLabelEnsemble
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
import torch.utils.data as Data
import torch.backends.... | [
"dataset.CIFAR10IndexPseudoLabelEnsemble",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.autograd.grad",
"utils.adjust_learning_rate",
"losses.SupConLoss",
"torch.get_rng_state",
"torch.cuda.device_count",
"models.resnet_cifar_multibn_ensembleFC.resnet18",
"pickle.load",
"tensorboard_lo... | [((886, 911), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (909, 911), False, 'import argparse\n'), ((4093, 4118), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (4116, 4118), False, 'import torch\n'), ((4706, 4763), 'utils.TwoCropTransformAdv', 'TwoCropTransformAdv',... |
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from . import views
from django.contrib import messages
from django.shortcuts import redirect
app_name = 'free'
def protected_file(request, path, document_root=None):
messages.error(request, "접근 불가")
retu... | [
"django.shortcuts.redirect",
"django.contrib.messages.error",
"django.conf.urls.static.static",
"django.urls.path"
] | [((1191, 1268), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL', 'protected_file'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, protected_file, document_root=settings.MEDIA_ROOT)\n', (1197, 1268), False, 'from django.conf.urls.static import static\n'), ((279, 311), 'django.contri... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 19 21:04:18 2017
@author: pd
"""
#from IPython import get_ipython
#get_ipython().magic('reset -sf')
import numpy as np
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
from sklearn.cross_... | [
"sklearn.cross_validation.train_test_split",
"matplotlib.pyplot.show",
"sklearn.datasets.make_classification",
"sklearn.tree.DecisionTreeClassifier",
"numpy.arange",
"matplotlib.pyplot.subplots"
] | [((378, 472), 'sklearn.datasets.make_classification', 'datasets.make_classification', (['(750)'], {'n_features': 'n_features', 'n_informative': '(5)', 'random_state': '(29)'}), '(750, n_features=n_features, n_informative=5,\n random_state=29)\n', (406, 472), False, 'from sklearn import datasets\n'), ((507, 561), 'sk... |
#!/usr/bin/python
# coding: utf-8
import sys
import Levenshtein
import numpy as np
assert len(sys.argv) > 1
with open(sys.argv[1], 'r', encoding='utf-8') as file:
lines = file.readlines()
n_lines = len(lines)
distances = np.zeros((n_lines, n_lines), dtype=int)
messages = []
for x in range(n_lines):
for y i... | [
"Levenshtein.distance",
"numpy.zeros"
] | [((229, 268), 'numpy.zeros', 'np.zeros', (['(n_lines, n_lines)'], {'dtype': 'int'}), '((n_lines, n_lines), dtype=int)\n', (237, 268), True, 'import numpy as np\n'), ((384, 424), 'Levenshtein.distance', 'Levenshtein.distance', (['lines[x]', 'lines[y]'], {}), '(lines[x], lines[y])\n', (404, 424), False, 'import Levenshte... |
import json
from copy import deepcopy
from random import randrange
from typing import List
import uvicorn
from fastapi import FastAPI, HTTPException, status
from pydantic import BaseModel
from starlette.responses import FileResponse
app = FastAPI()
class Repos(BaseModel):
repositories: List[str]
with open("mock_... | [
"copy.deepcopy",
"json.load",
"starlette.responses.FileResponse",
"fastapi.HTTPException",
"uvicorn.run",
"random.randrange",
"fastapi.FastAPI"
] | [((241, 250), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (248, 250), False, 'from fastapi import FastAPI, HTTPException, status\n'), ((357, 372), 'json.load', 'json.load', (['file'], {}), '(file)\n', (366, 372), False, 'import json\n'), ((912, 945), 'copy.deepcopy', 'deepcopy', (["test_data['status'][id]"], {}), "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2018 <NAME>
""" Support creation of an iPython console, with rayoptics environment
.. Created on Wed Nov 21 21:48:02 2018
.. codeauthor: <NAME>
"""
from PyQt5.QtGui import QColor
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from qtconsole.in... | [
"qdarkstyle.load_stylesheet",
"rayoptics.util.colors.accent_colors",
"rayoptics.gui.appmanager.ModelInfo",
"qtconsole.inprocess.QtInProcessKernelManager",
"IPython.lib.guisupport.get_app_qt"
] | [((2895, 2915), 'rayoptics.gui.appmanager.ModelInfo', 'ModelInfo', (['opt_model'], {}), '(opt_model)\n', (2904, 2915), False, 'from rayoptics.gui.appmanager import ModelInfo\n'), ((3531, 3557), 'qtconsole.inprocess.QtInProcessKernelManager', 'QtInProcessKernelManager', ([], {}), '()\n', (3555, 3557), False, 'from qtcon... |
import sys, logging, time, random
import web
import json
from intellect.Intellect import Intellect
from MyIntellect import MyIntellect
from Question import Question
from Arrow_Model import Arrow_Model
from Model import Model
class Application(object):
def __init__(self):
# Load the rules
self._myIntellect = MyI... | [
"Model.Model",
"web.header",
"json.dumps",
"web.input",
"Arrow_Model.Arrow_Model",
"Question.Question",
"MyIntellect.MyIntellect",
"logging.getLogger"
] | [((317, 330), 'MyIntellect.MyIntellect', 'MyIntellect', ([], {}), '()\n', (328, 330), False, 'from MyIntellect import MyIntellect\n'), ((496, 542), 'web.header', 'web.header', (['"""Access-Control-Allow-Origin"""', '"""*"""'], {}), "('Access-Control-Allow-Origin', '*')\n", (506, 542), False, 'import web\n'), ((545, 599... |
#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2019-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.ec... | [
"argparse.ArgumentParser",
"lxml.etree.Element",
"random.random",
"lxml.etree.parse",
"lxml.etree.tostring"
] | [((16150, 16173), 'lxml.etree.parse', 'etree.parse', (['input_file'], {}), '(input_file)\n', (16161, 16173), False, 'from lxml import etree\n'), ((16928, 16953), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (16951, 16953), False, 'import argparse\n'), ((8325, 8340), 'random.random', 'random.r... |
# -*- coding: utf-8 -*-
# Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from datetime import date,datetime
class wizard_multiple_test_request(models.TransientModel):
_name = 'wizard.multiple.test.request'
request_date = fields.Datetime(... | [
"odoo.fields.Many2many",
"odoo.fields.Datetime",
"odoo.fields.Many2one",
"odoo.fields.Boolean"
] | [((304, 350), 'odoo.fields.Datetime', 'fields.Datetime', (['"""Request Date"""'], {'required': '(True)'}), "('Request Date', required=True)\n", (319, 350), False, 'from odoo import api, fields, models, _\n'), ((392, 452), 'odoo.fields.Many2one', 'fields.Many2one', (['"""medical.patient"""', '"""Patient"""'], {'required... |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free ... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.TextField",
"django.db.models.DateTimeField"
] | [((619, 640), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (638, 640), False, 'from django.db import models\n'), ((658, 689), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (674, 689), False, 'from django.db import models\n'), ((704, 746... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import numpy as np
import tensorflow as tf
from collections import namedtuple
from edward.models import (
Beta, Dirichlet, DirichletProcess, Gamma, MultivariateNormalDiag,
Normal, P... | [
"tensorflow.test.main",
"tensorflow.ones",
"edward.transform",
"numpy.sum",
"edward.models.Dirichlet",
"tensorflow.zeros",
"collections.namedtuple",
"edward.models.Normal",
"edward.models.Gamma",
"edward.models.Beta",
"tensorflow.contrib.distributions.bijectors.Softplus"
] | [((2782, 2796), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2794, 2796), True, 'import tensorflow as tf\n'), ((511, 554), 'numpy.sum', 'np.sum', (['(sample > 0.0)'], {'axis': '(0)', 'keepdims': '(True)'}), '(sample > 0.0, axis=0, keepdims=True)\n', (517, 554), True, 'import numpy as np\n'), ((571, 614), ... |
import sys
import reader
r = reader.Reader(sys.argv[1])
try:
print(r.read())
finally:
r.close()
| [
"reader.Reader"
] | [((29, 55), 'reader.Reader', 'reader.Reader', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (42, 55), False, 'import reader\n')] |
import torch as t
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model.encoder import Encoder
from model.decoder import Decoder
import math
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.encoder = Encoder()
self.d... | [
"torch.ones",
"torch.randn",
"torch.zeros",
"model.encoder.Encoder",
"torch.exp",
"torch.pow",
"model.decoder.Decoder"
] | [((296, 305), 'model.encoder.Encoder', 'Encoder', ([], {}), '()\n', (303, 305), False, 'from model.encoder import Encoder\n'), ((329, 338), 'model.decoder.Decoder', 'Decoder', ([], {}), '()\n', (336, 338), False, 'from model.decoder import Decoder\n'), ((788, 807), 'torch.exp', 't.exp', (['(0.5 * logvar)'], {}), '(0.5 ... |
import logging
from celery import shared_task
from bdn import contract
from bdn import redis
from .perform_ipfs_meta_verifications_array import (
perform_ipfs_meta_verifications_array)
logger = logging.getLogger(__name__)
@shared_task
def listen_ethereum_ipfs_hash_storage():
redis_db = redis.get_redis()
... | [
"bdn.contract.contract",
"bdn.redis.get_redis",
"logging.getLogger"
] | [((200, 227), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (217, 227), False, 'import logging\n'), ((299, 316), 'bdn.redis.get_redis', 'redis.get_redis', ([], {}), '()\n', (314, 316), False, 'from bdn import redis\n'), ((344, 384), 'bdn.contract.contract', 'contract.contract', (['"""Ver... |
import unittest
from prestans.http import STATUS
from prestans.http import VERB
from prestans import exception
class ExceptionBase(unittest.TestCase):
def test_http_status(self):
base_value = exception.Base(http_status=STATUS.OK, message="message")
self.assertEqual(base_value.http_status, STATUS... | [
"prestans.exception.InconsistentPersistentDataError",
"prestans.exception.Base",
"prestans.exception.UnsupportedContentTypeError",
"prestans.exception.NotFound",
"prestans.exception.ServiceUnavailable",
"prestans.exception.AuthorizationError",
"prestans.exception.InvalidFormatError",
"prestans.deseria... | [((208, 264), 'prestans.exception.Base', 'exception.Base', ([], {'http_status': 'STATUS.OK', 'message': '"""message"""'}), "(http_status=STATUS.OK, message='message')\n", (222, 264), False, 'from prestans import exception\n'), ((493, 549), 'prestans.exception.Base', 'exception.Base', ([], {'http_status': 'STATUS.OK', '... |
from django.core.paginator import Paginator
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from touchtechnology.news.models import Article, Category
register = Library()
@register.filter("category")
def get_category(slug):
return Category.objects.get(slug=slug)
@reg... | [
"django.template.Library",
"touchtechnology.news.models.Category.objects.get",
"touchtechnology.news.models.Article.objects.live",
"django.core.paginator.Paginator",
"touchtechnology.news.models.Category.objects.all",
"django.utils.translation.ugettext_lazy"
] | [((206, 215), 'django.template.Library', 'Library', ([], {}), '()\n', (213, 215), False, 'from django.template import Library\n'), ((282, 313), 'touchtechnology.news.models.Category.objects.get', 'Category.objects.get', ([], {'slug': 'slug'}), '(slug=slug)\n', (302, 313), False, 'from touchtechnology.news.models import... |
# Copyright (C) 2022 Red Hat
# SPDX-License-Identifier: Apache-2.0
# A copy of logreduce.tokenizer
import re
import os
DAYS = "sunday|monday|tuesday|wednesday|thursday|friday|saturday"
MONTHS = (
"january|february|march|april|may|june|july|august|september|"
"october|november|december"
)
SHORT_MONTHS = "jan|f... | [
"re.compile"
] | [((764, 1316), 're.compile', 're.compile', (['""""GET / HTTP/1.1"|"OPTIONS * HTTP/1.0" 200|AAAA[A-Z][0-9]|\\\\$[0-9]\\\\$|-----BEGIN|HEAD is now at|Change-Id: | ETA |\\\\* [a-zA-Z]+: [a-zA-Z0-9\\\\.-]*$|Trying other mirror.|audit.*exe="/usr/sbin/sshd"|sshd.*[iI]nvalid user|sshd.*Unable to connect using the available au... |
from flink_rest_client.common import _execute_rest_request, RestException
class JobTrigger:
def __init__(self, prefix, type_name, job_id, trigger_id):
self._prefix = prefix
self._type_name = type_name
self.job_id = job_id
self.trigger_id = trigger_id
@property
def status(s... | [
"flink_rest_client.common._execute_rest_request"
] | [((341, 440), 'flink_rest_client.common._execute_rest_request', '_execute_rest_request', ([], {'url': 'f"""{self._prefix}/{self.job_id}/{self._type_name}/{self.trigger_id}"""'}), "(url=\n f'{self._prefix}/{self.job_id}/{self._type_name}/{self.trigger_id}')\n", (362, 440), False, 'from flink_rest_client.common import... |
"""
Copyright 2018, <NAME>, Stevens Institute of Technology
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 ... | [
"os.path.abspath",
"pickle.dump",
"argparse.ArgumentParser",
"os.path.isdir",
"random.shuffle",
"random.sample",
"os.path.isfile",
"pickle.load",
"random.seed",
"itertools.product",
"multiprocessing.Process",
"resources.optimizeMILP.optimizeMILP"
] | [((644, 665), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (659, 665), False, 'import sys, os\n'), ((979, 1000), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (994, 1000), False, 'import sys, os\n'), ((1328, 1352), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), ... |
import basics
import random
import math
import matplotlib.pyplot as plt
import numpy as np
import cProfile
import pstats
import time
class node():
# Has a keyword that defines it's means ofo decrypting the text
# Can reproduce to make a mutated offspring
def __init__(self, key=None):
s... | [
"matplotlib.pyplot.show",
"pstats.Stats",
"math.ceil",
"math.floor",
"random.choice",
"cProfile.Profile",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.pause",
"basics.ngram_score"
] | [((8274, 8292), 'cProfile.Profile', 'cProfile.Profile', ([], {}), '()\n', (8290, 8292), False, 'import cProfile\n'), ((8583, 8597), 'pstats.Stats', 'pstats.Stats', ([], {}), '()\n', (8595, 8597), False, 'import pstats\n'), ((1089, 1156), 'basics.ngram_score', 'basics.ngram_score', (['"""english_trigrams.txt"""', '"""en... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.12.5)
#
# WARNING! All changes made in this file will be lost!
# from PyQt5 import QtCore
from silx.gui import qt as QtCore
qt_resource_data = b"\
\x00\x00\x19\x3d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d... | [
"silx.gui.qt.qRegisterResourceData",
"silx.gui.qt.qVersion",
"silx.gui.qt.qUnregisterResourceData"
] | [((27887, 27988), 'silx.gui.qt.qRegisterResourceData', 'QtCore.qRegisterResourceData', (['rcc_version', 'qt_resource_struct', 'qt_resource_name', 'qt_resource_data'], {}), '(rcc_version, qt_resource_struct,\n qt_resource_name, qt_resource_data)\n', (27915, 27988), True, 'from silx.gui import qt as QtCore\n'), ((2801... |
from datetime import timedelta
from django.db.models import Sum, Q, DurationField
from django.db.models.functions import Coalesce, Cast
from django.utils import timezone
from .models import ControllerSession
from ..users.models import User, Status
def annotate_hours(query):
"""
Annotates given QuerySet with ... | [
"django.utils.timezone.now",
"django.db.models.DurationField",
"django.db.models.Sum",
"django.db.models.Q",
"datetime.timedelta"
] | [((465, 479), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (477, 479), False, 'from django.utils import timezone\n'), ((501, 515), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (513, 515), False, 'from django.utils import timezone\n'), ((539, 574), 'django.db.models.Q', 'Q', ([], {'se... |
# -*- coding: utf-8 -*-
"""
For testing neuromaps.stats functionality
"""
import numpy as np
import pytest
from neuromaps import stats
@pytest.mark.xfail
def test_compare_images():
assert False
def test_permtest_metric():
rs = np.random.default_rng(12345678)
x, y = rs.random(size=(2, 100))
r, p = ... | [
"neuromaps.stats.efficient_pearsonr",
"numpy.allclose",
"numpy.isnan",
"numpy.random.default_rng",
"pytest.raises",
"neuromaps.stats.permtest_metric"
] | [((241, 272), 'numpy.random.default_rng', 'np.random.default_rng', (['(12345678)'], {}), '(12345678)\n', (262, 272), True, 'import numpy as np\n'), ((320, 347), 'neuromaps.stats.permtest_metric', 'stats.permtest_metric', (['x', 'y'], {}), '(x, y)\n', (341, 347), False, 'from neuromaps import stats\n'), ((359, 420), 'nu... |
from openpyxl import Workbook
from checkcel.validators import OntologyValidator, SetValidator, LinkedSetValidator
from openpyxl.utils import get_column_letter
from checkcel.checkplate import Checkplate
class Checkerator(Checkplate):
def __init__(
self,
output,
**kwargs
):
sup... | [
"openpyxl.utils.get_column_letter",
"openpyxl.Workbook"
] | [((428, 438), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (436, 438), False, 'from openpyxl import Workbook\n'), ((1277, 1315), 'openpyxl.utils.get_column_letter', 'get_column_letter', (['current_data_column'], {}), '(current_data_column)\n', (1294, 1315), False, 'from openpyxl.utils import get_column_letter\n')... |
from django.dispatch import receiver
from django.db.models.signals import pre_save
from django.db import models
from authors.apps.articles.models import Article
from authors.apps.profiles.models import Profile
from simple_history.models import HistoricalRecords
class Comment(models.Model):
"""
Handles CRUD on ... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.BooleanField",
"simple_history.models.HistoricalRecords",
"django.db.models.DateTimeField"
] | [((377, 409), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(500)'}), '(max_length=500)\n', (393, 409), False, 'from django.db import models\n'), ((424, 463), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (444, 463), False, ... |
from django import forms
class InterestForm(forms.Form):
amount=forms.FloatField(label='Amount')
rate=forms.FloatField(label="Interest rate" ,min_value=5 ,max_value=50)
| [
"django.forms.FloatField"
] | [((73, 105), 'django.forms.FloatField', 'forms.FloatField', ([], {'label': '"""Amount"""'}), "(label='Amount')\n", (89, 105), False, 'from django import forms\n'), ((119, 185), 'django.forms.FloatField', 'forms.FloatField', ([], {'label': '"""Interest rate"""', 'min_value': '(5)', 'max_value': '(50)'}), "(label='Intere... |
from selenium import webdriver
import geckodriver_binary # Adds geckodriver binary to path
def test_driver():
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.titl
driver.quit()
| [
"selenium.webdriver.Firefox"
] | [((125, 144), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (142, 144), False, 'from selenium import webdriver\n')] |
############
# use_type
############
# type()
'''
动态语言和静态语言最大的不同,就是函数和类的定义,【不是编译时定义的,而是运行时动态创建的。】
'''
# 比方说我们要定义一个Hello的class,就写一个hello.py模块:
'''
class Hello(object):
def hello(self, name='world'):
print('Hello, %s.' % name)
'''
# 当Python解释器载入hello模块时,就会依次执行该模块的所有语句,执行结果就是动态创建出一个
# Hello的class对象,测试如下:
fro... | [
"hello.Hello"
] | [((345, 352), 'hello.Hello', 'Hello', ([], {}), '()\n', (350, 352), False, 'from hello import Hello\n')] |
import numpy as np
import pytest
import snc.environments.job_generators.discrete_review_job_generator \
as drjg
import snc.environments.controlled_random_walk as crw
import snc.environments.state_initialiser as si
import snc.agents.general_heuristics.random_nonidling_agent \
as random_nonidling_agent
import sn... | [
"snc.environments.job_generators.discrete_review_job_generator.DeterministicDiscreteReviewJobGenerator",
"numpy.zeros_like",
"numpy.ones_like",
"numpy.random.seed",
"numpy.sum",
"snc.agents.general_heuristics.longest_buffer_priority_agent.LongestBufferPriorityAgent",
"numpy.zeros",
"numpy.ones",
"sn... | [((696, 715), 'numpy.ones_like', 'np.ones_like', (['state'], {}), '(state)\n', (708, 715), True, 'import numpy as np\n'), ((1739, 1754), 'numpy.ones', 'np.ones', (['(1, 1)'], {}), '((1, 1))\n', (1746, 1754), True, 'import numpy as np\n'), ((1838, 1876), 'snc.environments.controlled_random_walk.ControlledRandomWalk', 'c... |
import torch
from torchvision.transforms import Compose,Normalize,RandomCrop,RandomResizedCrop,Resize,RandomHorizontalFlip, ToTensor
from torchvision import transforms
def get_transforms():
normalize = Normalize(mean=[0.485, 0.456, 0.406],std=[0.229, 0.224, 0.225])
transform = Compose([normalize])
return ... | [
"torchvision.transforms.Normalize",
"torchvision.transforms.Compose"
] | [((208, 272), 'torchvision.transforms.Normalize', 'Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (217, 272), False, 'from torchvision.transforms import Compose, Normalize, RandomCrop, RandomResizedCrop, Resize, RandomHor... |
import numpy as np
import matplotlib.pyplot as plt
import pprint
def missingIsNan(s):
return np.nan if s == b'?' else float(s)
def makeStandardize(X):
means = X.mean(axis = 0)
stds = X.std(axis = 0)
def standardize(origX):
return (origX - means) / stds
def unstandardize(stdX):
return stds * ... | [
"numpy.linalg.lstsq",
"numpy.isnan",
"numpy.insert",
"numpy.mean",
"numpy.arange",
"numpy.random.shuffle"
] | [((1004, 1020), 'numpy.arange', 'np.arange', (['nRows'], {}), '(nRows)\n', (1013, 1020), True, 'import numpy as np\n'), ((1023, 1046), 'numpy.random.shuffle', 'np.random.shuffle', (['rows'], {}), '(rows)\n', (1040, 1046), True, 'import numpy as np\n'), ((1517, 1544), 'numpy.insert', 'np.insert', (['XtrainS', '(0)', '(1... |
import logging
from abc_core.database.sqllite_client import SQLLite
from abc_core.utils.logger_client import get_basis_logger_config
def main():
logging.basicConfig(**get_basis_logger_config())
db = SQLLite(filename="../../data/application.db")
res = db.select("SELECT * FROM blogs1")
print(res)
... | [
"abc_core.database.sqllite_client.SQLLite",
"abc_core.utils.logger_client.get_basis_logger_config"
] | [((210, 255), 'abc_core.database.sqllite_client.SQLLite', 'SQLLite', ([], {'filename': '"""../../data/application.db"""'}), "(filename='../../data/application.db')\n", (217, 255), False, 'from abc_core.database.sqllite_client import SQLLite\n'), ((174, 199), 'abc_core.utils.logger_client.get_basis_logger_config', 'get_... |
import torch.nn as nn
from utils.BBBlayers import BBBConv2d, FlattenLayer, BBBLinearFactorial
class BBBSqueezeNet(nn.Module):
"""
SqueezeNet with slightly modified Fire modules and Bayesian layers.
"""
def __init__(self, outputs, inputs):
super(BBBSqueezeNet, self).__init__()
self.con... | [
"torch.nn.Dropout",
"torch.nn.ModuleList",
"utils.BBBlayers.BBBConv2d",
"torch.nn.Softplus",
"utils.BBBlayers.FlattenLayer",
"torch.nn.MaxPool2d",
"utils.BBBlayers.BBBLinearFactorial"
] | [((325, 371), 'utils.BBBlayers.BBBConv2d', 'BBBConv2d', (['inputs', '(64)'], {'kernel_size': '(3)', 'stride': '(2)'}), '(inputs, 64, kernel_size=3, stride=2)\n', (334, 371), False, 'from utils.BBBlayers import BBBConv2d, FlattenLayer, BBBLinearFactorial\n'), ((393, 406), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), '(... |
from django.contrib import admin
from .models import Balance
class BalanceAdmin(admin.ModelAdmin):
list_display = ('balance',)
admin.site.register(Balance) | [
"django.contrib.admin.site.register"
] | [((134, 162), 'django.contrib.admin.site.register', 'admin.site.register', (['Balance'], {}), '(Balance)\n', (153, 162), False, 'from django.contrib import admin\n')] |
import discord
from discord.ext import commands
import json, requests, io, re
class Weather:
"""Weather class handles weather using openweather api
params:
attributes:
apikey: api key for openweather
config_location: configuration location for saberbot
locations: json file ... | [
"discord.ext.commands.command",
"json.loads",
"discord.ext.commands.cooldown",
"requests.get",
"re.sub",
"re.compile"
] | [((1680, 1715), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (1696, 1715), False, 'from discord.ext import commands\n'), ((1721, 1774), 'discord.ext.commands.cooldown', 'commands.cooldown', (['(1)', '(5.0)', 'commands.BucketType.server'], {}), '(1, 5.0, ... |
from django.contrib import admin
from .models import Article
class ArticleAdmin(admin.ModelAdmin):
model = Article
admin.site.register(Article)
| [
"django.contrib.admin.site.register"
] | [((122, 150), 'django.contrib.admin.site.register', 'admin.site.register', (['Article'], {}), '(Article)\n', (141, 150), False, 'from django.contrib import admin\n')] |
import os
from databroker.assets.handlers_base import HandlerBase
from databroker.assets.base_registry import DuplicateHandler
import fabio
# for backward compatibility, fpp was always 1 before Jan 2018
#global pilatus_fpp
#pilatus_fpp = 1
# this is used by the CBF file handler
from enum import Enum
class tri... | [
"os.path.join",
"fabio.open"
] | [((1593, 1616), 'os.path.join', 'os.path.join', (['rpath', '""""""'], {}), "(rpath, '')\n", (1605, 1616), False, 'import os\n'), ((2631, 2645), 'fabio.open', 'fabio.open', (['fn'], {}), '(fn)\n', (2641, 2645), False, 'import fabio\n')] |
from typing import Tuple, Dict
import random
import numpy as np
import torch
from torchvision import datasets, transforms
from sklearn.metrics.pairwise import cosine_distances
from matplotlib import pyplot as plt
try:
from torch.utils.tensorboard import SummaryWriter
except ImportError:
from tensorboardX im... | [
"matplotlib.pyplot.title",
"sklearn.metrics.pairwise.cosine_distances",
"numpy.random.seed",
"matplotlib.pyplot.show",
"torch.eye",
"torch.manual_seed",
"torch.cuda.random.manual_seed",
"torch.cuda.manual_seed",
"torch.cuda.manual_seed_all",
"random.seed",
"torch.tensor"
] | [((569, 585), 'matplotlib.pyplot.title', 'plt.title', (['label'], {}), '(label)\n', (578, 585), True, 'from matplotlib import pyplot as plt\n'), ((637, 647), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (645, 647), True, 'from matplotlib import pyplot as plt\n'), ((3421, 3438), 'random.seed', 'random.seed', ... |
from __future__ import absolute_import
from email.parser import FeedParser
import logging
import os
from pip.basecommand import Command
from pip.status_codes import SUCCESS, ERROR
from pip._vendor import pkg_resources
logger = logging.getLogger(__name__)
class ShowCommand(Command):
"""Show information about on... | [
"pip._vendor.six.moves.xmlrpc_client.ServerProxy",
"pip._vendor.pkg_resources.get_distribution",
"email.parser.FeedParser",
"pip.download.PipXmlrpcTransport",
"os.path.relpath",
"os.path.join",
"logging.getLogger"
] | [((230, 257), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (247, 257), False, 'import logging\n'), ((1908, 1954), 'pip._vendor.pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['r.project_name'], {}), '(r.project_name)\n', (1938, 1954), False, 'from pip._vendor import... |
import torch.nn as nn
import torch.nn.functional as F
import scipy.io as scio
from torchvision.models import vgg19_bn, resnet152, densenet161
class LeNet_300_100(nn.Module):
def __init__(self, enable_bias=True): # original code is true
super().__init__()
self.fc1 = nn.Linear(784, 300, bias=enable_bias)
... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.nn.BatchNorm2d",
"torch.nn.functional.log_softmax",
"torch.nn.functional.max_pool2d",
"torch.nn.MaxPool2d"
] | [((279, 316), 'torch.nn.Linear', 'nn.Linear', (['(784)', '(300)'], {'bias': 'enable_bias'}), '(784, 300, bias=enable_bias)\n', (288, 316), True, 'import torch.nn as nn\n'), ((332, 369), 'torch.nn.Linear', 'nn.Linear', (['(300)', '(100)'], {'bias': 'enable_bias'}), '(300, 100, bias=enable_bias)\n', (341, 369), True, 'im... |
import os
import tempfile
import subprocess
import getpass
import shutil
from textwrap import dedent
def get_r_env():
env = {}
executable = 'R'
try:
# get notebook app
from notebook.notebookapp import NotebookApp
nbapp = NotebookApp.instance()
kernel_name = nbapp.kernel_man... | [
"textwrap.dedent",
"tempfile.NamedTemporaryFile",
"os.path.abspath",
"getpass.getuser",
"os.getcwd",
"subprocess.check_output",
"os.path.exists",
"shutil.which",
"os.environ.get",
"notebook.notebookapp.NotebookApp.instance",
"os.path.join"
] | [((1286, 1314), 'subprocess.check_output', 'subprocess.check_output', (['cmd'], {}), '(cmd)\n', (1309, 1314), False, 'import subprocess\n'), ((259, 281), 'notebook.notebookapp.NotebookApp.instance', 'NotebookApp.instance', ([], {}), '()\n', (279, 281), False, 'from notebook.notebookapp import NotebookApp\n'), ((2793, 2... |
__author__ = 'alexanderstolz'
import hib_sql_connection
def getAllTransfers():
connection = hib_sql_connection.connectToHibiscus()
return hib_sql_connection.queryToHibiscus(connection, "select * from umsatz;")
def getOutgoingTransfers():
connection = hib_sql_connection.connectToHibiscus()
return hi... | [
"hib_sql_connection.queryToHibiscus",
"hib_sql_connection.connectToHibiscus"
] | [((100, 138), 'hib_sql_connection.connectToHibiscus', 'hib_sql_connection.connectToHibiscus', ([], {}), '()\n', (136, 138), False, 'import hib_sql_connection\n'), ((150, 221), 'hib_sql_connection.queryToHibiscus', 'hib_sql_connection.queryToHibiscus', (['connection', '"""select * from umsatz;"""'], {}), "(connection, '... |
import os,sys,talib,numpy,math,logging,time,datetime,numbers
from collections import OrderedDict
from baseindicator import BaseIndicator
class EMA(BaseIndicator):
def __init__(self,csdata, config = {}):
config["period"] = config.get("period",30)
config["metric"] = config.get("metric","closed")
... | [
"collections.OrderedDict",
"datetime.datetime.strptime",
"numpy.array",
"baseindicator.BaseIndicator.__init__"
] | [((455, 499), 'baseindicator.BaseIndicator.__init__', 'BaseIndicator.__init__', (['self', 'csdata', 'config'], {}), '(self, csdata, config)\n', (477, 499), False, 'from baseindicator import BaseIndicator\n'), ((2563, 2576), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2574, 2576), False, 'from collectio... |
from http.server import HTTPServer,BaseHTTPRequestHandler
import signal
import sys
class Server(BaseHTTPRequestHandler) :
def _set_response(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_POST(self):
content_length = int(self.headers['Co... | [
"sys.exit"
] | [((1244, 1255), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1252, 1255), False, 'import sys\n')] |
from rest_framework import serializers
from .models import Profile
class ProfileSerializer(serializers.ModelSerializer):
last_name = serializers.CharField(source='user.last_name')
bio = serializers.CharField(allow_blank=True,required=False)
#work_domain = serializers.CharField(max_length=50)
image = se... | [
"rest_framework.serializers.CharField",
"rest_framework.serializers.SerializerMethodField"
] | [((138, 184), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""user.last_name"""'}), "(source='user.last_name')\n", (159, 184), False, 'from rest_framework import serializers\n'), ((195, 250), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'allow_blank': '(Tru... |
import os
import Token
from xml.dom import minidom
class ProcessDoc:
def __init__(self, path, lemma, stem):
self.collection_dic = {}
self.doc_info = []
self.lemma = lemma
self.stem = stem
self.path = path
def run(self):
for filename in os.listdir(self.path):
... | [
"Token.Token",
"xml.dom.minidom.parse",
"os.path.join",
"os.listdir"
] | [((295, 316), 'os.listdir', 'os.listdir', (['self.path'], {}), '(self.path)\n', (305, 316), False, 'import os\n'), ((1036, 1054), 'xml.dom.minidom.parse', 'minidom.parse', (['url'], {}), '(url)\n', (1049, 1054), False, 'from xml.dom import minidom\n'), ((1309, 1322), 'Token.Token', 'Token.Token', ([], {}), '()\n', (132... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('projects', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import models, migrations\n'), ((443, 536), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"... |
# config.py
import os
import datetime
import argparse
result_path = "results/"
result_path = os.path.join(result_path, datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S/'))
parser = argparse.ArgumentParser(description='Your project title goes here')
# ======================== Data Setings =========================... | [
"datetime.datetime.now",
"argparse.ArgumentParser"
] | [((186, 253), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Your project title goes here"""'}), "(description='Your project title goes here')\n", (209, 253), False, 'import argparse\n'), ((120, 143), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (141, 143), False, ... |
from openprocurement.api.models import Organization as BaseOrganization
from openprocurement.tender.cfaselectionua.models.submodels.contactpoint import ContactPoint
from schematics.types import StringType
from schematics.types.compound import ModelType
from openprocurement.api.roles import RolesFromCsv
from openprocure... | [
"schematics.types.StringType",
"schematics.types.compound.ModelType",
"openprocurement.api.roles.RolesFromCsv"
] | [((437, 460), 'schematics.types.compound.ModelType', 'ModelType', (['ContactPoint'], {}), '(ContactPoint)\n', (446, 460), False, 'from schematics.types.compound import ModelType\n'), ((632, 694), 'schematics.types.StringType', 'StringType', ([], {'choices': "['general', 'special', 'defense', 'other']"}), "(choices=['ge... |
import os
import glob
files = open('dados.dll')
data = files.read()
files.close
#desktop of user
user_info = os.path.expanduser('~')
location_default = os.path.expanduser('~\\Desktop')
location = os.path.expanduser('~\\Desktop')
desktop = os.path.expanduser(f'{location}').replace(f'{user_info}', f'{data}')
os.chdir... | [
"os.getcwd",
"os.system",
"glob.glob",
"os.path.expanduser",
"os.chdir"
] | [((111, 134), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (129, 134), False, 'import os\n'), ((155, 187), 'os.path.expanduser', 'os.path.expanduser', (['"""~\\\\Desktop"""'], {}), "('~\\\\Desktop')\n", (173, 187), False, 'import os\n'), ((199, 231), 'os.path.expanduser', 'os.path.expanduse... |
# %%
import os
import sys
# os.chdir("../../..")
os.environ['DJANGO_SETTINGS_MODULE'] = 'MAKDataHub.settings'
import django
django.setup()
# %%
import math
import pickle
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from MAKDataHub.services import Services
profile_servi... | [
"django.setup",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"sklearn.neighbors.LocalOutlierFactor",
"sklearn.feature_selection.RFE",
"numpy.isnan",
"sklearn.feature_selection.SelectFromModel",
"numpy.mean",
"seaborn.pairplot",
"sklearn.model_selection.Random... | [((124, 138), 'django.setup', 'django.setup', ([], {}), '()\n', (136, 138), False, 'import django\n'), ((325, 351), 'MAKDataHub.services.Services.profile_service', 'Services.profile_service', ([], {}), '()\n', (349, 351), False, 'from MAKDataHub.services import Services\n'), ((370, 396), 'MAKDataHub.services.Services.s... |
import sys
from pdb import Pdb, getsourcelines
from .utils import check_frame
from bytefall._modules import sys as py_sys
from bytefall._c_api import convert_to_builtin_frame
from bytefall.config import EnvConfig
__all__ = ['PdbWrapper']
class PdbWrapper(object):
@staticmethod
@check_frame
def set_trac... | [
"pdb.Pdb",
"bytefall._c_api.convert_to_builtin_frame",
"bytefall.config.EnvConfig",
"sys._getframe",
"pdb.getsourcelines",
"bytefall._modules.sys._getframe",
"bytefall._modules.sys.settrace"
] | [((480, 485), 'pdb.Pdb', 'Pdb', ([], {}), '()\n', (483, 485), False, 'from pdb import Pdb, getsourcelines\n'), ((2479, 2515), 'bytefall._modules.sys.settrace', 'py_sys.settrace', (['self.trace_dispatch'], {}), '(self.trace_dispatch)\n', (2494, 2515), True, 'from bytefall._modules import sys as py_sys\n'), ((435, 446), ... |
import pylab as plt
import numpy as np
from math import *
N=100
t0 = 0.0
t1 = 2.0
t = np.linspace(t0,t1,N)
dt = (t1-t0)/N
one = np.ones((N))
xp = np.zeros((N))
yp = np.zeros((N))
th = np.zeros((N))
x = t*t
y = t
plt.figure()
plt.plot(x,y,'g-')
plt.legend(['Path'],loc='best')
plt.title('Quadratic Path')
plt.show()
d... | [
"pylab.title",
"pylab.show",
"numpy.zeros",
"numpy.ones",
"pylab.figure",
"numpy.linspace",
"pylab.legend",
"pylab.plot",
"numpy.sqrt"
] | [((87, 109), 'numpy.linspace', 'np.linspace', (['t0', 't1', 'N'], {}), '(t0, t1, N)\n', (98, 109), True, 'import numpy as np\n'), ((129, 139), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (136, 139), True, 'import numpy as np\n'), ((147, 158), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (155, 158), True, 'import... |
#!/usr/bin/env python
# gatherUpper.py
import numpy
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
LENGTH = 3
x = None
x_local = numpy.linspace(rank*LENGTH,(rank+1)*LENGTH, LENGTH)
print(x_local)
if rank == 0:
x = numpy.zeros(size*LENGTH)
print (x)
comm.Gather(x_local... | [
"numpy.zeros",
"numpy.linspace"
] | [((173, 231), 'numpy.linspace', 'numpy.linspace', (['(rank * LENGTH)', '((rank + 1) * LENGTH)', 'LENGTH'], {}), '(rank * LENGTH, (rank + 1) * LENGTH, LENGTH)\n', (187, 231), False, 'import numpy\n'), ((262, 288), 'numpy.zeros', 'numpy.zeros', (['(size * LENGTH)'], {}), '(size * LENGTH)\n', (273, 288), False, 'import nu... |
"""Run simulations for SDC model.
Parameters
----------
N_JOBS
Number of cores used for parallelization.
RANDOM_SEED
Seed for the random numbers generator.
SPACE
Types of social space.
Available values: 'uniform', 'lognormal', 'clusters_normal'.
N
Sizes of networks,
NDIM
Number of dimensions of... | [
"numpy.random.seed",
"os.makedirs",
"_.simulate",
"os.path.realpath",
"sklearn.externals.joblib.Memory",
"gc.collect",
"os.path.join",
"pandas.concat"
] | [((1067, 1097), 'os.path.join', 'os.path.join', (['HERE', '"""raw-data"""'], {}), "(HERE, 'raw-data')\n", (1079, 1097), False, 'import os\n'), ((1122, 1158), 'sklearn.externals.joblib.Memory', 'Memory', ([], {'location': '""".cache"""', 'verbose': '(1)'}), "(location='.cache', verbose=1)\n", (1128, 1158), False, 'from ... |
# Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import build_from_cfg
from mmdet.core.bbox.iou_calculators.builder import IOU_CALCULATORS
ROTATED_IOU_CALCULATORS = IOU_CALCULATORS
def build_iou_calculator(cfg, default_args=None):
"""Builder of IoU calculator."""
return build_from_cfg(cfg, ROT... | [
"mmcv.utils.build_from_cfg"
] | [((297, 355), 'mmcv.utils.build_from_cfg', 'build_from_cfg', (['cfg', 'ROTATED_IOU_CALCULATORS', 'default_args'], {}), '(cfg, ROTATED_IOU_CALCULATORS, default_args)\n', (311, 355), False, 'from mmcv.utils import build_from_cfg\n')] |
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ █... | [
"unittest.main",
"PyFunceble.converter.url2netloc.Url2Netloc"
] | [((7749, 7764), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7762, 7764), False, 'import unittest\n'), ((1978, 1990), 'PyFunceble.converter.url2netloc.Url2Netloc', 'Url2Netloc', ([], {}), '()\n', (1988, 1990), False, 'from PyFunceble.converter.url2netloc import Url2Netloc\n')] |
import requests
import json
import time
import neopixel
import board
#Set Colours
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
ORANGE = (100, 64, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
OFF = (0, 0, 0)
#Set NeoPixel Details - Pin/Number Pixels/Brightness etc
pixels = neop... | [
"json.loads",
"time.sleep",
"time.time",
"requests.get",
"neopixel.NeoPixel"
] | [((316, 384), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['board.D18', '(144)'], {'brightness': '(0.03)', 'auto_write': '(False)'}), '(board.D18, 144, brightness=0.03, auto_write=False)\n', (333, 384), False, 'import neopixel\n'), ((420, 431), 'time.time', 'time.time', ([], {}), '()\n', (429, 431), False, 'import time\... |
import cPickle as pickle
import datetime
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404, HttpResponse
from django.core import urlresolvers
from unipath import FSPath as Path
from projects.models import Project
def document(r... | [
"django.http.Http404",
"projects.models.Project.objects.get",
"django.http.HttpResponse"
] | [((1601, 1621), 'django.http.HttpResponse', 'HttpResponse', (['"""done"""'], {}), "('done')\n", (1613, 1621), False, 'from django.http import Http404, HttpResponse\n'), ((370, 403), 'projects.models.Project.objects.get', 'Project.objects.get', ([], {'slug': 'project'}), '(slug=project)\n', (389, 403), False, 'from proj... |
# *****************************************************************
# Copyright 2013 MIT Lincoln Laboratory
# Project: SPAR
# Authors: SY
# Description: Section class
#
#
# Modifications:
# Date Name Modification
# ---- ---- ... | [
"spar_python.report_generation.ta1.ta1_analysis_input.Input",
"spar_python.report_generation.common.latex_classes.LatexTable",
"spar_python.report_generation.common.regression.regress"
] | [((1587, 1775), 'spar_python.report_generation.common.latex_classes.LatexTable', 'latex_classes.LatexTable', (['"""Query Latency vs. Number of Records Returned Best Fit Functions"""', '"""lat_main"""', "['DBNR', 'DBRS', 'Select', 'Query Type', 'Best-Fit Func', 'R-Squared']"], {}), "(\n 'Query Latency vs. Number of R... |
import numpy as np
import scipy.signal as sp
import scipy.spatial.distance as sp_dist
import librosa
class MedianNMF:
y, sr = None,None
n_components = None
def __init__(self,y,sr,n_components = 5):
self.y, self.sr = y,sr
self.n_components = n_components
def decompose(self):
... | [
"librosa.decompose.decompose",
"scipy.signal.savgol_filter",
"librosa.effects.percussive",
"librosa.istft",
"numpy.multiply.outer",
"librosa.magphase",
"librosa.stft"
] | [((438, 458), 'librosa.stft', 'librosa.stft', (['hpss_y'], {}), '(hpss_y)\n', (450, 458), False, 'import librosa\n'), ((521, 540), 'librosa.magphase', 'librosa.magphase', (['D'], {}), '(D)\n', (537, 540), False, 'import librosa\n'), ((940, 989), 'librosa.effects.percussive', 'librosa.effects.percussive', (['self.y'], {... |
import numpy as np
from collections import defaultdict
class Agent:
def __init__(self, nA=6):
""" Initialize agent.
Params
======
- nA: number of actions available to the agent
"""
self.nA = nA
self.Q = defaultdict(lambda: np.zeros(self.nA))
self.ep... | [
"numpy.zeros",
"numpy.arange",
"numpy.ones",
"numpy.argmax"
] | [((636, 660), 'numpy.argmax', 'np.argmax', (['self.Q[state]'], {}), '(self.Q[state])\n', (645, 660), True, 'import numpy as np\n'), ((1397, 1415), 'numpy.arange', 'np.arange', (['self.nA'], {}), '(self.nA)\n', (1406, 1415), True, 'import numpy as np\n'), ((286, 303), 'numpy.zeros', 'np.zeros', (['self.nA'], {}), '(self... |
import argparse
import sys
import copy
from graphviz import Digraph
from rply import LexingError, ParsingError
from lang.lexer import Lexer
from lang.parser import Parser
from lang.scope import Scope
lexer = Lexer()
parser = Parser(lexer.tokens)
def execute(scope, source, draw=False, lexer_output=False, opt=False)... | [
"argparse.ArgumentParser",
"lang.parser.Parser",
"copy.copy",
"graphviz.Digraph",
"lang.scope.Scope",
"lang.lexer.Lexer"
] | [((211, 218), 'lang.lexer.Lexer', 'Lexer', ([], {}), '()\n', (216, 218), False, 'from lang.lexer import Lexer\n'), ((228, 248), 'lang.parser.Parser', 'Parser', (['lexer.tokens'], {}), '(lexer.tokens)\n', (234, 248), False, 'from lang.parser import Parser\n'), ((1074, 1081), 'lang.scope.Scope', 'Scope', ([], {}), '()\n'... |
import logging
import os
from typing import Literal, Union
from ghaudit.cli import cli
LOGFILE = os.environ.get("LOGFILE")
LOGLEVEL = os.environ.get("LOGLEVEL", "ERROR")
# pylint: disable=line-too-long
LOG_FORMAT = "{asctime} {levelname:8s} ghaudit <{filename}:{lineno} {module}.{funcName}> {message}" # noqa: E501
ST... | [
"ghaudit.cli.cli",
"logging.FileHandler",
"logging.basicConfig",
"os.environ.get",
"logging.Formatter",
"logging.getLogger"
] | [((99, 124), 'os.environ.get', 'os.environ.get', (['"""LOGFILE"""'], {}), "('LOGFILE')\n", (113, 124), False, 'import os\n'), ((136, 171), 'os.environ.get', 'os.environ.get', (['"""LOGLEVEL"""', '"""ERROR"""'], {}), "('LOGLEVEL', 'ERROR')\n", (150, 171), False, 'import os\n'), ((810, 815), 'ghaudit.cli.cli', 'cli', ([]... |
import numpy as np
class Mesh:
""" Contains all the information about the spatial domain """
def __init__(self,dimension,topology,geometry):
self.Nvoxels = len(topology)
self.dimension = dimension
self.topology = topology # adjaceny matrix (numpy array), 0 along main diagonal, 1 elsew... | [
"numpy.diag",
"numpy.zeros",
"numpy.ones",
"numpy.linspace"
] | [((855, 873), 'numpy.zeros', 'np.zeros', (['(Nx, Nx)'], {}), '((Nx, Nx))\n', (863, 873), True, 'import numpy as np\n'), ((881, 896), 'numpy.ones', 'np.ones', (['(Nx - 1)'], {}), '(Nx - 1)\n', (888, 896), True, 'import numpy as np\n'), ((952, 969), 'numpy.zeros', 'np.zeros', (['(Nx, 2)'], {}), '((Nx, 2))\n', (960, 969),... |
# snapy - a python snmp library
#
# Copyright (C) 2009 ITA Software, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be ... | [
"snapy.netsnmp.Session",
"time.localtime",
"snapy.netsnmp.OID"
] | [((1135, 1227), 'snapy.netsnmp.Session', 'Session', ([], {'version': 'self.version', 'community': '"""public"""', 'peername': 'address', '_use_bulk': 'self.bulk'}), "(version=self.version, community='public', peername=address,\n _use_bulk=self.bulk)\n", (1142, 1227), False, 'from snapy.netsnmp import Session, SnmpEr... |
# The MIT License (MIT)
#
# Copyright (c) 2017 <NAME> and Adafruit Industries
#
# 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
# ... | [
"platform.python_implementation",
"adafruit_bus_device.spi_device.SPIDevice",
"ustruct.calcsize",
"time.sleep",
"ustruct.pack",
"ustruct.unpack"
] | [((1729, 1761), 'platform.python_implementation', 'platform.python_implementation', ([], {}), '()\n', (1759, 1761), False, 'import platform\n'), ((5103, 5138), 'ustruct.pack', 'struct.pack', (['self._ENCODE_POS', 'x', 'y'], {}), '(self._ENCODE_POS, x, y)\n', (5114, 5138), True, 'import ustruct as struct\n'), ((5238, 52... |