code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# File: H (Python 2.4)
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from pirates.reputation import ReputationGlobals
from pirates.piratesbase import PLocalizer
from pirates.piratesgui import PiratesGuiGlobals
from pirates.piratesbase import PiratesGl... | [
"pirates.piratesbase.PiratesGlobals.getPirateOutlineFont"
] | [((1127, 1164), 'pirates.piratesbase.PiratesGlobals.getPirateOutlineFont', 'PiratesGlobals.getPirateOutlineFont', ([], {}), '()\n', (1162, 1164), False, 'from pirates.piratesbase import PiratesGlobals\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines unit tests for :mod:`colour.models.ipt` module.
"""
from __future__ import division, unicode_literals
import numpy as np
import sys
if sys.version_info[:2] <= (2, 6):
import unittest2 as unittest
else:
import unittest
from colour.models import XYZ_t... | [
"numpy.array"
] | [((1085, 1132), 'numpy.array', 'np.array', (['[1.00300825, 0.01906918, -0.01369292]'], {}), '([1.00300825, 0.01906918, -0.01369292])\n', (1093, 1132), True, 'import numpy as np\n'), ((1272, 1318), 'numpy.array', 'np.array', (['[0.73974548, 0.95333412, 1.71951212]'], {}), '([0.73974548, 0.95333412, 1.71951212])\n', (128... |
# -*- coding: utf-8 -*-
# @Time : 2020/9/10
# @Author : <NAME>
# @File : .py
# @Role :
from tornado.web import RequestHandler
from kube_bench.main import kube_daily_scan
from libs.base_handler import BaseHandler
from sqlalchemy import or_
from libs.pagination import pagination_util
from models.kube_bench ... | [
"models.kube_bench.model_to_dict",
"kube_bench.main.kube_daily_scan",
"websdk.db_context.DBContext"
] | [((2427, 2444), 'kube_bench.main.kube_daily_scan', 'kube_daily_scan', ([], {}), '()\n', (2442, 2444), False, 'from kube_bench.main import kube_daily_scan\n'), ((611, 625), 'websdk.db_context.DBContext', 'DBContext', (['"""w"""'], {}), "('w')\n", (620, 625), False, 'from websdk.db_context import DBContext\n'), ((1213, 1... |
"""
Project OCELoT: Open, Competitive Evaluation Leaderboard of Translations
"""
from difflib import SequenceMatcher
from django.contrib import messages
from django.core.paginator import Paginator
from django.http import Http404
from django.shortcuts import HttpResponseRedirect
from django.shortcuts import render
fro... | [
"django.shortcuts.render",
"django.contrib.messages.warning",
"difflib.SequenceMatcher",
"leaderboard.views._get_team_data",
"leaderboard.models.Submission.objects.filter",
"django.shortcuts.HttpResponseRedirect",
"leaderboard.models.Submission.objects.get",
"django.core.paginator.Paginator"
] | [((1100, 1135), 'difflib.SequenceMatcher', 'SequenceMatcher', (['None', 'toks1', 'toks2'], {}), '(None, toks1, toks2)\n', (1115, 1135), False, 'from difflib import SequenceMatcher\n'), ((2588, 2611), 'leaderboard.views._get_team_data', '_get_team_data', (['request'], {}), '(request)\n', (2602, 2611), False, 'from leade... |
from .handler import JupytexprHandler
from notebook.utils import url_path_join
def _load_jupyter_server_extension(serverapp):
"""
This function is called when the extension is loaded.
"""
web_app = serverapp.web_app
host_pattern = '.*$'
route_pattern = url_path_join(web_app.settings['base_url... | [
"notebook.utils.url_path_join"
] | [((280, 342), 'notebook.utils.url_path_join', 'url_path_join', (["web_app.settings['base_url']", '"""/jupytexpr/(.*)"""'], {}), "(web_app.settings['base_url'], '/jupytexpr/(.*)')\n", (293, 342), False, 'from notebook.utils import url_path_join\n')] |
import sys
from benchmark_paths import get_result_path
from benchmark_tools import run
assert len(sys.argv) == 3, "Usage: python script.py scene_name scene_depth"
scene = sys.argv[1]
scene_depth = int(sys.argv[2])
replay_name = "small_edits"
num_threads = ["2", "4", "6"];
base_defines = [
("SCENE", "\"{}\"".for... | [
"benchmark_paths.get_result_path"
] | [((535, 559), 'benchmark_paths.get_result_path', 'get_result_path', (['"""edits"""'], {}), "('edits')\n", (550, 559), False, 'from benchmark_paths import get_result_path\n')] |
"""Module for testing modles for the API"""
from tests.basetest import TestBase
from api_v1.models import User, Shoppinglist, Shoppingitem
class UserTestCase(TestBase):
"""Class to to test the user model"""
def test_create_models_instance(self):
"""Test number of users in the users table"""
s... | [
"api_v1.models.Shoppinglist",
"api_v1.models.User.query.filter_by",
"api_v1.models.Shoppingitem",
"api_v1.models.Shoppinglist.query.count",
"api_v1.models.Shoppingitem.query.count"
] | [((1524, 1571), 'api_v1.models.Shoppinglist', 'Shoppinglist', ([], {'name': '"""Groceries"""', 'created_by': 'None'}), "(name='Groceries', created_by=None)\n", (1536, 1571), False, 'from api_v1.models import User, Shoppinglist, Shoppingitem\n'), ((1911, 1971), 'api_v1.models.Shoppingitem', 'Shoppingitem', ([], {'name':... |
import os
import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--output-file", required=True)
parser.add_argument("--start", type=float, required=True)
parser.add_argument("--end", type=float, required=True)
args = parser.parse_args()... | [
"json.load",
"os.path.exists",
"json.dump",
"argparse.ArgumentParser"
] | [((50, 75), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (73, 75), False, 'import argparse\n'), ((333, 365), 'os.path.exists', 'os.path.exists', (['args.output_file'], {}), '(args.output_file)\n', (347, 365), False, 'import os\n'), ((411, 423), 'json.load', 'json.load', (['f'], {}), '(f)\n', ... |
from dataclasses import dataclass, field
from banking.transaction import Transaction
@dataclass
class BankController:
undo_stack: list[Transaction] = field(default_factory=list)
redo_stack: list[Transaction] = field(default_factory=list)
def execute(self, transaction: Transaction) -> None:
trans... | [
"dataclasses.field"
] | [((157, 184), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (162, 184), False, 'from dataclasses import dataclass, field\n'), ((221, 248), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (226, 248), False, 'from dataclasses impo... |
"""
Package for the db models.
"""
import hashlib
import time
from datetime import datetime
class User(object):
"""A transcript object for use in db/repository"""
def __init__(
self,
id="",
name="",
expense_ids=None,
friend_ids=None,
):
... | [
"datetime.datetime.now",
"time.time"
] | [((1163, 1177), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1175, 1177), False, 'from datetime import datetime\n'), ((1560, 1571), 'time.time', 'time.time', ([], {}), '()\n', (1569, 1571), False, 'import time\n')] |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: <NAME>
@file: gen_data.py
@time: 17-6-23 14:48
"""
import os
data_dir = './stackoverflow'
if not os.path.exists(data_dir):
os.makedirs(data_dir)
tag_file = 'label_StackOverflow.txt'
title_file = 'title_StackOverflow.txt'
tag_fin = list(open(tag_file).readl... | [
"os.path.exists",
"os.makedirs"
] | [((155, 179), 'os.path.exists', 'os.path.exists', (['data_dir'], {}), '(data_dir)\n', (169, 179), False, 'import os\n'), ((185, 206), 'os.makedirs', 'os.makedirs', (['data_dir'], {}), '(data_dir)\n', (196, 206), False, 'import os\n')] |
# Generated by Django 3.2.12 on 2022-03-18 19:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('regions', '0001_initial'),
('authors', '0001_initial'),
('articles', '0001_initial'),
... | [
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((453, 565), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""authors.author"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.SET_NULL, to='authors.author')\n", (470, 565), False, 'from d... |
"""Django settings for one_barangay project.
Generated by 'django-admin startproject' using Django 3.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import io... | [
"os.getenv",
"pathlib.Path",
"sentry_sdk.integrations.django.DjangoIntegration",
"os.path.join",
"os.environ.get",
"one_barangay.scripts.service_account.gcloud_auth",
"dotenv.load_dotenv",
"os.path.isfile",
"one_barangay.scripts.service_account.firestore_auth",
"firebase_admin.firestore.client",
... | [((777, 807), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".env"""'], {}), "(BASE_DIR, '.env')\n", (789, 807), False, 'import os\n'), ((812, 836), 'os.path.isfile', 'os.path.isfile', (['env_file'], {}), '(env_file)\n', (826, 836), False, 'import os\n'), ((1497, 1523), 'one_barangay.scripts.service_account.firestor... |
# -*- coding: utf-8 -*-
import ipaddress
__all__ = [
'config_to_map',
'get_region'
]
def config_to_map(topology_config):
"""
args:
topology_config: dict
{
'region1': [
'10.1.1.0/24',
'10.1.10.0/24',
'172.1... | [
"ipaddress.ip_network",
"ipaddress.ip_address"
] | [((1900, 1928), 'ipaddress.ip_address', 'ipaddress.ip_address', (['ip_str'], {}), '(ip_str)\n', (1920, 1928), False, 'import ipaddress\n'), ((1220, 1249), 'ipaddress.ip_network', 'ipaddress.ip_network', (['net_str'], {}), '(net_str)\n', (1240, 1249), False, 'import ipaddress\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import click
import libtopologycmp as lcmp
import myfunc
@click.command()
@click.argument('alnfile')
@click.option('--outfile', default="", help='write the output to file')
@click.option('--method', default=1, help='0 for slower method, 1 for faster method')
d... | [
"click.argument",
"myfunc.ReadFasta",
"libtopologycmp.RemoveUnnecessaryGap",
"click.option",
"libtopologycmp.RemoveUnnecessaryGap_old",
"click.echo",
"click.command"
] | [((117, 132), 'click.command', 'click.command', ([], {}), '()\n', (130, 132), False, 'import click\n'), ((134, 159), 'click.argument', 'click.argument', (['"""alnfile"""'], {}), "('alnfile')\n", (148, 159), False, 'import click\n'), ((161, 231), 'click.option', 'click.option', (['"""--outfile"""'], {'default': '""""""'... |
from skypyblue.core import ConstraintSystem
from skypyblue.models import Constraint, Method, Strength, Variable, Strength
class Fixture:
def __init__(self):
self.constraint_system = ConstraintSystem()
self.a = Variable("a", 1, self.constraint_system)
self.b = Variable("b", 2, self.constraint_system)
... | [
"skypyblue.models.Constraint",
"skypyblue.models.Variable",
"skypyblue.models.Method",
"skypyblue.core.ConstraintSystem"
] | [((189, 207), 'skypyblue.core.ConstraintSystem', 'ConstraintSystem', ([], {}), '()\n', (205, 207), False, 'from skypyblue.core import ConstraintSystem\n'), ((221, 261), 'skypyblue.models.Variable', 'Variable', (['"""a"""', '(1)', 'self.constraint_system'], {}), "('a', 1, self.constraint_system)\n", (229, 261), False, '... |
#
# Part of hdlpy.
# Copyright (c) 2021, <NAME>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DI... | [
"hdlpy.sim.Wait.delay",
"hdlpy.sim.Sim",
"hdlpy.when",
"hdlpy.logic"
] | [((1035, 1062), 'hdlpy.when', 'when', ([], {'rising': "('rst', 'clk')"}), "(rising=('rst', 'clk'))\n", (1039, 1062), False, 'from hdlpy import logic, part, once, always, when\n'), ((2132, 2140), 'hdlpy.logic', 'logic', (['(0)'], {}), '(0)\n', (2137, 2140), False, 'from hdlpy import logic, part, once, always, when\n'), ... |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import math
import numpy as np
import tqdm
import torch
import torch... | [
"os.path.exists",
"math.ceil",
"os.makedirs",
"argparse.ArgumentParser",
"npy_append_array.NpyAppendArray",
"os.path.join",
"tqdm.tqdm",
"torch.from_numpy",
"shutil.copyfile",
"torch.nn.functional.pad",
"torch.no_grad",
"numpy.load",
"os.remove"
] | [((446, 558), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""mean pools representations by compressing uniform splits of the data"""'}), "(description=\n 'mean pools representations by compressing uniform splits of the data')\n", (469, 558), False, 'import argparse\n'), ((1185, 1218),... |
"""Outbox for handling and sending collected notifications."""
from destinations.ms_teams import build_notification_text, send_notification
from models.notification import Notification
class Outbox:
"""Handle storing and sending notifications."""
def __init__(self, notifications: list[Notification] = None) ... | [
"destinations.ms_teams.build_notification_text"
] | [((1399, 1436), 'destinations.ms_teams.build_notification_text', 'build_notification_text', (['notification'], {}), '(notification)\n', (1422, 1436), False, 'from destinations.ms_teams import build_notification_text, send_notification\n')] |
import datetime
from unittest import mock
from unittest.mock import MagicMock
import orjson
import pytest
from core.exporter import api, dataset, storage
from .models import (
AppointmentTag,
AvailabilityTag,
County,
Location,
LocationType,
Provider,
ProviderType,
Reporter,
State,
... | [
"core.exporter.storage.DebugWriter",
"unittest.mock.MagicMock",
"datetime.timedelta",
"core.exporter.api",
"core.exporter.dataset",
"datetime.date.today",
"unittest.mock.patch"
] | [((348, 386), 'unittest.mock.patch', 'mock.patch', (['"""core.exporter.api_export"""'], {}), "('core.exporter.api_export')\n", (358, 386), False, 'from unittest import mock\n'), ((10649, 10660), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (10658, 10660), False, 'from unittest.mock import MagicMock\n'), ((... |
import copy
from collections import deque
import numpy as np
from domainbed.lib import swa_utils
class SWADBase:
def update_and_evaluate(self, segment_swa, val_acc, val_loss, prt_fn):
raise NotImplementedError()
def get_final_model(self):
raise NotImplementedError()
class IIDMax(SWADBase):
... | [
"numpy.mean",
"collections.deque",
"copy.deepcopy",
"numpy.argmin",
"domainbed.lib.swa_utils.AveragedModel"
] | [((2126, 2150), 'collections.deque', 'deque', ([], {'maxlen': 'n_converge'}), '(maxlen=n_converge)\n', (2131, 2150), False, 'from collections import deque\n'), ((2175, 2200), 'collections.deque', 'deque', ([], {'maxlen': 'n_tolerance'}), '(maxlen=n_tolerance)\n', (2180, 2200), False, 'from collections import deque\n'),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
web2py_ckeditor4: web2py plugin for CKEditor v4: http://ckeditor.com/
"""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__copyright__ = 'Copyright(c) 2012-2014, <NAME>, <NAME>, ' \
'<NAME>'
__license__ = 'LGPLv3'
__version__ = '0.1'
# possible options: Pr... | [
"gluon.sqlhtml.FormWidget._attributes",
"os.path.splitext",
"os.path.join",
"gluon.storage.Storage"
] | [((785, 794), 'gluon.storage.Storage', 'Storage', ([], {}), '()\n', (792, 794), False, 'from gluon.storage import Storage\n'), ((2727, 2779), 'gluon.sqlhtml.FormWidget._attributes', 'FormWidget._attributes', (['field', 'default'], {}), '(field, default, **attributes)\n', (2749, 2779), False, 'from gluon.sqlhtml import ... |
from exceptions.invalid_query import InvalidQueryException
from threading import Thread
class DownloadWorker(Thread):
def __init__(self, queue, hs_table):
Thread.__init__(self)
self.queue = queue
self.hs_table = hs_table
def run(self):
while True:
host,... | [
"threading.Thread.__init__"
] | [((169, 190), 'threading.Thread.__init__', 'Thread.__init__', (['self'], {}), '(self)\n', (184, 190), False, 'from threading import Thread\n')] |
import sys
from datetime import timedelta
import click
import redis
from redis_bulk_cleaner.redis_bulk_cleaner import Cleaner
@click.command()
@click.argument('patterns', nargs=-1)
@click.option('--dry-run', '-D', is_flag=True, help='Do not delete keys just print them')
@click.option('--restart', '-R', is_flag=True... | [
"click.Choice",
"click.argument",
"click.option",
"redis.Redis",
"datetime.timedelta",
"click.command"
] | [((131, 146), 'click.command', 'click.command', ([], {}), '()\n', (144, 146), False, 'import click\n'), ((148, 184), 'click.argument', 'click.argument', (['"""patterns"""'], {'nargs': '(-1)'}), "('patterns', nargs=-1)\n", (162, 184), False, 'import click\n'), ((186, 279), 'click.option', 'click.option', (['"""--dry-run... |
#!/usr/bin/env python
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"google.cloud.storage.Client",
"google.appengine.api.app_identity.get_application_id",
"logging.debug",
"flask.Flask",
"oauth2client.client.GoogleCredentials.get_application_default",
"json.dumps",
"time.sleep",
"os.path.dirname",
"jinja2.FileSystemLoader",
"google.appengine.ext.vendor.add"
] | [((808, 825), 'google.appengine.ext.vendor.add', 'vendor.add', (['"""lib"""'], {}), "('lib')\n", (818, 825), False, 'from google.appengine.ext import vendor\n'), ((978, 993), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (983, 993), False, 'from flask import Flask\n'), ((1182, 1198), 'google.cloud.storage... |
# For webhook signing verification, not used just leaving
import hmac
import base64
import pdb
SIGNING_SECRET_SECRET=b'abc123'
#SIGNING_SECRET_SECRET = b'<KEY> #dont get excited, its from the docs
BODY = '{"start": "2021-07-25T10:00:00", "end": "2021-07-25T11:00:00"}'.encode()
TIMESTAMP = '2021-07-25T10:00:00Z'.enc... | [
"hmac.new",
"hmac.compare_digest"
] | [((502, 553), 'hmac.new', 'hmac.new', (['SIGNING_SECRET_SECRET'], {'digestmod': '"""sha256"""'}), "(SIGNING_SECRET_SECRET, digestmod='sha256')\n", (510, 553), False, 'import hmac\n'), ((643, 680), 'hmac.compare_digest', 'hmac.compare_digest', (['comp1', 'SIGNATURE'], {}), '(comp1, SIGNATURE)\n', (662, 680), False, 'imp... |
import os
from typing import TYPE_CHECKING, List, Optional
import click
if TYPE_CHECKING:
from typing_extensions import Literal
StyleName = Literal['s_clean', 's_unpushed', 's_changed', 's_untracked']
HOME = os.getenv("HOME", "")
def _shortpath(pathstr):
if HOME and pathstr.startswith(HOME):
r... | [
"click.echo",
"click.style",
"os.getenv"
] | [((220, 241), 'os.getenv', 'os.getenv', (['"""HOME"""', '""""""'], {}), "('HOME', '')\n", (229, 241), False, 'import os\n'), ((1561, 1602), 'click.style', 'click.style', (['text'], {'fg': '"""green"""', 'bold': '(False)'}), "(text, fg='green', bold=False)\n", (1572, 1602), False, 'import click\n'), ((1326, 1364), 'clic... |
from utils.database import db
class Article(db.Model):
__tablename__ = 'articles'
id = db.Column(db.Integer, primary_key=True)
author_id = db.Column(db.Integer, db.ForeignKey('users.id'))
created_at = db.Column(db.BigInteger)
text = db.Column(db.String())
def serialize(self):
... | [
"utils.database.db.Column",
"utils.database.db.String",
"utils.database.db.ForeignKey"
] | [((101, 140), 'utils.database.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (110, 140), False, 'from utils.database import db\n'), ((224, 248), 'utils.database.db.Column', 'db.Column', (['db.BigInteger'], {}), '(db.BigInteger)\n', (233, 248), False, 'from util... |
"""
Title : Random Walker 구현
"""
# import Part ----------------------------------------------------------------------------------------------------------
import numpy as np
from random import randint
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
# -----------------------... | [
"random.randint"
] | [((1167, 1180), 'random.randint', 'randint', (['(1)', '(4)'], {}), '(1, 4)\n', (1174, 1180), False, 'from random import randint\n')] |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 23:59:55 2020
@author: <NAME>
"""
from copy import deepcopy
with open('inputs/input8.txt') as fh:
program = [line.strip().split() for line in fh.readlines()]
def run(program):
lines = len(program)
visited = []
accumulator = 0
line = 0
while True:
if l... | [
"copy.deepcopy"
] | [((976, 993), 'copy.deepcopy', 'deepcopy', (['program'], {}), '(program)\n', (984, 993), False, 'from copy import deepcopy\n')] |
from xpinyin import Pinyin
from lyricsgenius import Genius
import apikeys
def cleanup(text):
clean = "\n"
for char in text:
if clean[-1] != '\n' and clean[-1] != ' ':
clean += char
else:
if char != " ":
clean += char
if clean[-1] == '\n':
... | [
"lyricsgenius.Genius",
"xpinyin.Pinyin"
] | [((383, 405), 'lyricsgenius.Genius', 'Genius', (['apikeys.genius'], {}), '(apikeys.genius)\n', (389, 405), False, 'from lyricsgenius import Genius\n'), ((544, 552), 'xpinyin.Pinyin', 'Pinyin', ([], {}), '()\n', (550, 552), False, 'from xpinyin import Pinyin\n')] |
#!/usr/bin/env python3
#
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import subprocess
import tempfile
import os
import sys
from pathlib import Path
def run(*command, capture=False, **kwargs):
c... | [
"os.path.abspath",
"subprocess.run",
"pathlib.Path"
] | [((456, 504), 'subprocess.run', 'subprocess.run', (['command'], {'stdout': 'stdout'}), '(command, stdout=stdout, **kwargs)\n', (470, 504), False, 'import subprocess\n'), ((799, 813), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (803, 813), False, 'from pathlib import Path\n'), ((3119, 3146), 'os.path.abs... |
import json
from datetime import datetime
from bson.json_util import dumps
from bson.objectid import ObjectId
from flask import Blueprint, request, jsonify
# Database
from configurations.database import mongo
search_products_blueprint = Blueprint("search_products_blueprint", __name__)
@search_products_blueprint.ro... | [
"flask.request.args.get",
"flask.jsonify",
"bson.json_util.dumps",
"bson.objectid.ObjectId",
"configurations.database.mongo.db.user.aggregate",
"configurations.database.mongo.db.product.aggregate",
"flask.Blueprint",
"configurations.database.mongo.db.category.aggregate"
] | [((241, 289), 'flask.Blueprint', 'Blueprint', (['"""search_products_blueprint"""', '__name__'], {}), "('search_products_blueprint', __name__)\n", (250, 289), False, 'from flask import Blueprint, request, jsonify\n'), ((406, 441), 'flask.request.args.get', 'request.args.get', (['"""search_criteria"""'], {}), "('search_c... |
import datetime
from app.models.base.base import BaseModel
from app import db
class WeChatWantBuyModel(db.Model, BaseModel):
__bind_key__ = "a_social"
__tablename__ = "wechat_want_buy"
id = db.Column(db.Integer, primary_key=True)
seller_id = db.Column(db.Integer, default=0)
buyer_id = db.Column(d... | [
"app.db.Column"
] | [((205, 244), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (214, 244), False, 'from app import db\n'), ((261, 293), 'app.db.Column', 'db.Column', (['db.Integer'], {'default': '(0)'}), '(db.Integer, default=0)\n', (270, 293), False, 'from app import db\n'... |
import datajoint as dj
from . import lab, experiment, ccf
from . import get_schema_name
import numpy as np
from scipy.interpolate import CubicSpline
schema = dj.schema(get_schema_name('ephys'))
[lab, experiment, ccf] # NOQA flake8
@schema
class ProbeInsertion(dj.Manual):
definition = """
-> experiment.Se... | [
"numpy.hstack",
"numpy.delete",
"numpy.diff",
"numpy.argmax",
"numpy.array",
"numpy.argmin"
] | [((7603, 7626), 'numpy.argmin', 'np.argmin', (['ave_waveform'], {}), '(ave_waveform)\n', (7612, 7626), True, 'import numpy as np\n'), ((7648, 7671), 'numpy.argmax', 'np.argmax', (['ave_waveform'], {}), '(ave_waveform)\n', (7657, 7671), True, 'import numpy as np\n'), ((8777, 8790), 'numpy.diff', 'np.diff', (['spks'], {}... |
"""
Plot modules.
"""
#=============================================================================
#Modules
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.mlab import griddata
def contour_plot(array3d, **kwargs):
"""Do the contour plot of a 3D array.
Parameters
----------
... | [
"numpy.reshape",
"numpy.unique",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.mlab.griddata",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.pcolormesh",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.figure",
"mat... | [((833, 870), 'numpy.reshape', 'np.reshape', (['array3d[:, 0]', '(n_x, n_y)'], {}), '(array3d[:, 0], (n_x, n_y))\n', (843, 870), True, 'import numpy as np\n'), ((880, 917), 'numpy.reshape', 'np.reshape', (['array3d[:, 1]', '(n_x, n_y)'], {}), '(array3d[:, 1], (n_x, n_y))\n', (890, 917), True, 'import numpy as np\n'), (... |
from fjarrsyn.core.simulator import FiniteSystemRunner
from fjarrsyn.core.sampler import AgentSampler, EnvSampler, SystemIO
from .propagator import Propagator
from .world import World
from .envs import Lake
from .society import Village
N_VILLAGES = 2
INIT_PEOPLE = 10
INIT_FISHES = 0
INIT_HOW_LOW = 2.0
INIT_MAX_EXTRA... | [
"fjarrsyn.core.sampler.SystemIO",
"fjarrsyn.core.simulator.FiniteSystemRunner",
"fjarrsyn.core.sampler.AgentSampler",
"fjarrsyn.core.sampler.EnvSampler"
] | [((734, 935), 'fjarrsyn.core.sampler.AgentSampler', 'AgentSampler', ([], {'resource_args': "[('village items', 'n_people')]", 'essence_args': "[('disposition', 'max_extraction'), ('disposition', 'how_low')]", 'sample_steps': '(5)', 'matcher': "(lambda x: 'Village' in x.name)"}), "(resource_args=[('village items', 'n_pe... |
# Generated by Django 2.2.5 on 2019-12-05 16:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_moderation', '0013_auto_20190909_1236'),
]
operations = [
migrations.AlterField(
model_name='moderatedobject',
... | [
"django.db.models.CharField"
] | [((362, 498), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('P', 'Post'), ('PC', 'Post Comment'), ('C', 'Community'), ('U', 'User'),\n ('H', 'Hashtag')]", 'max_length': '(5)'}), "(choices=[('P', 'Post'), ('PC', 'Post Comment'), ('C',\n 'Community'), ('U', 'User'), ('H', 'Hashtag')], max_le... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | [
"msrest.polling.NoPolling",
"msrest.polling.LROPoller",
"uuid.uuid1",
"msrestazure.polling.arm_polling.ARMPolling",
"msrest.pipeline.ClientRawResponse"
] | [((12305, 12381), 'msrest.polling.LROPoller', 'LROPoller', (['self._client', 'raw_result', 'get_long_running_output', 'polling_method'], {}), '(self._client, raw_result, get_long_running_output, polling_method)\n', (12314, 12381), False, 'from msrest.polling import LROPoller, NoPolling\n'), ((17422, 17498), 'msrest.pol... |
# coding=utf-8
import time
from service.mahjong.models.hutype.basetype import BaseType
from service.mahjong.constants.carddefine import CardType
from service.mahjong.models.hutype.basetype import BaseType
from service.mahjong.constants.carddefine import CardType, CARD_SIZE
from service.mahjong.models.card.hand_card im... | [
"service.mahjong.models.card.hand_card.HandCard",
"time.time",
"service.mahjong.models.utils.cardanalyse.CardAnalyse"
] | [((1564, 1577), 'service.mahjong.models.utils.cardanalyse.CardAnalyse', 'CardAnalyse', ([], {}), '()\n', (1575, 1577), False, 'from service.mahjong.models.utils.cardanalyse import CardAnalyse\n'), ((1594, 1611), 'service.mahjong.models.card.hand_card.HandCard', 'HandCard', (['(0)', 'None'], {}), '(0, None)\n', (1602, 1... |
# -*- coding: utf-8 -*-
"""
Geometric example
=================
A small example script showing the usage of the 'geographic' coordinates type
for ordinary kriging on a sphere.
"""
from pykrige.ok import OrdinaryKriging
import numpy as np
from matplotlib import pyplot as plt
# Make this example reproducible:
np.rand... | [
"pykrige.ok.OrdinaryKriging",
"numpy.random.rand",
"numpy.array_str",
"numpy.random.random",
"numpy.linspace",
"numpy.random.seed",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((313, 337), 'numpy.random.seed', 'np.random.seed', (['(89239413)'], {}), '(89239413)\n', (327, 337), True, 'import numpy as np\n'), ((697, 723), 'numpy.linspace', 'np.linspace', (['(0.0)', '(360.0)', '(7)'], {}), '(0.0, 360.0, 7)\n', (708, 723), True, 'import numpy as np\n'), ((735, 762), 'numpy.linspace', 'np.linspa... |
import zmq
import struct
ctx = zmq.Context()
sock = ctx.socket(zmq.SUB)
sock.connect('tcp://127.0.0.1:55114')
sock.setsockopt_string(zmq.SUBSCRIBE,'')
while(1):
msgs = sock.recv_multipart()
pos = msgs[:3]
rot = msgs[3:]
pos = [struct.unpack('f',d)[0] for d in pos]
rot = [struct.unpack('f',d)[0] fo... | [
"struct.unpack",
"zmq.Context"
] | [((32, 45), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (43, 45), False, 'import zmq\n'), ((245, 266), 'struct.unpack', 'struct.unpack', (['"""f"""', 'd'], {}), "('f', d)\n", (258, 266), False, 'import struct\n'), ((294, 315), 'struct.unpack', 'struct.unpack', (['"""f"""', 'd'], {}), "('f', d)\n", (307, 315), False... |
# flake8: noqa
import logging
__version__ = '0.0.1'
_this_srcfile = __file__
class CustomLogger(logging.getLoggerClass()):
def __init__(self, name, level=logging.NOTSET):
super(CustomLogger, self).__init__(name, level)
def findCaller(self, stack_info=False):
"""
Find the stack fram... | [
"logging.getLogger",
"logging.setLoggerClass",
"logging.basicConfig",
"coloredlogs.install",
"logging.currentframe",
"logging.getLoggerClass",
"os.path.normcase"
] | [((101, 125), 'logging.getLoggerClass', 'logging.getLoggerClass', ([], {}), '()\n', (123, 125), False, 'import logging\n'), ((1639, 1675), 'logging.setLoggerClass', 'logging.setLoggerClass', (['CustomLogger'], {}), '(CustomLogger)\n', (1661, 1675), False, 'import logging\n'), ((2191, 2214), 'logging.getLogger', 'loggin... |
# Generated by Django 2.2 on 2020-04-15 01:58
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('initial', '0036_auto_20200414_0456'),
]
operations = [
migrations.AlterField(
model_name='sectionattendance',
... | [
"django.db.models.DateField"
] | [((365, 433), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'default': 'datetime.date.today', 'null': '(True)'}), '(blank=True, default=datetime.date.today, null=True)\n', (381, 433), False, 'from django.db import migrations, models\n'), ((559, 604), 'django.db.models.DateField', 'models.Da... |
# Copyright (c) 2017, IGLU consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and... | [
"logging.basicConfig",
"os.path.exists",
"os.path.join",
"home_platform.semantic.SuncgSemantics",
"home_platform.semantic.MaterialColorTable.getColorsFromObject",
"os.path.realpath",
"home_platform.suncg.SunCgSceneLoader.loadHouseFromJson",
"home_platform.suncg.loadModel",
"home_platform.semantic.Ma... | [((8243, 8282), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARN'}), '(level=logging.WARN)\n', (8262, 8282), False, 'import logging\n'), ((8287, 8309), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (8296, 8309), True, 'import numpy as np\n'), ((8314, 8329), 'uni... |
import numpy as np
import scipy.ndimage as ndimage
from skimage import measure, morphology, segmentation
from skimage.morphology import ball, disk, dilation, binary_erosion, remove_small_objects, erosion, closing, reconstruction, binary_closing
from skimage.measure import label,regionprops, perimeter
from skimage.morph... | [
"numpy.bitwise_or",
"skimage.morphology.binary_closing",
"scipy.ndimage.black_tophat",
"scipy.ndimage.binary_dilation",
"cv2.threshold",
"numpy.max",
"numpy.hypot",
"skimage.morphology.watershed",
"numpy.ones",
"skimage.measure.regionprops",
"scipy.ndimage.iterate_structure",
"scipy.ndimage.bi... | [((655, 697), 'skimage.segmentation.clear_border', 'segmentation.clear_border', (['marker_internal'], {}), '(marker_internal)\n', (680, 697), False, 'from skimage import measure, morphology, segmentation\n'), ((727, 757), 'skimage.measure.label', 'measure.label', (['marker_internal'], {}), '(marker_internal)\n', (740, ... |
#! /usr/bin/env python3
# coding: utf-8
import unittest
from src.helpers.area import Area, OffsetedArea
class Test_Area(unittest.TestCase):
def test_coordinates(self):
area = Area(5, 10)
self.assertEqual(area.surface, 5 * 10)
self.assertEqual(area.width, 5)
self.assertEqual(area.... | [
"src.helpers.area.OffsetedArea",
"src.helpers.area.Area"
] | [((191, 202), 'src.helpers.area.Area', 'Area', (['(5)', '(10)'], {}), '(5, 10)\n', (195, 202), False, 'from src.helpers.area import Area, OffsetedArea\n'), ((880, 907), 'src.helpers.area.OffsetedArea', 'OffsetedArea', (['(5)', '(10)', '(-3)', '(-8)'], {}), '(5, 10, -3, -8)\n', (892, 907), False, 'from src.helpers.area ... |
from functools import wraps
import inspect
from typing import Any, Callable, Union
from requests.adapters import Response
from mstrio import config
from mstrio.api.exceptions import MstrException, PartialSuccess, Success
from mstrio.utils.helper import get_default_args_from_func, response_handler
def get_args_and_b... | [
"mstrio.api.exceptions.PartialSuccess",
"mstrio.utils.helper.response_handler",
"inspect.signature",
"functools.wraps",
"mstrio.api.exceptions.MstrException",
"mstrio.api.exceptions.Success",
"mstrio.utils.helper.get_default_args_from_func"
] | [((393, 416), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (410, 416), False, 'import inspect\n'), ((1425, 1436), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1430, 1436), False, 'from functools import wraps\n'), ((2377, 2421), 'mstrio.utils.helper.get_default_args_from_func', 'get_... |
import torch
import torch.fx as fx
from torch.utils._pytree import tree_flatten
aten = torch.ops.aten
rand_ops = [aten.dropout, aten._fused_dropout, aten._standard_gamma,
aten.bernoulli, aten.multinomial, aten.native_dropout,
aten.normal, aten.poisson, aten.binomial, aten.rrelu,
ate... | [
"torch.fx.Graph",
"torch.utils._pytree.tree_flatten"
] | [((529, 539), 'torch.fx.Graph', 'fx.Graph', ([], {}), '()\n', (537, 539), True, 'import torch.fx as fx\n'), ((1403, 1425), 'torch.utils._pytree.tree_flatten', 'tree_flatten', (['arg_list'], {}), '(arg_list)\n', (1415, 1425), False, 'from torch.utils._pytree import tree_flatten\n')] |
#!/usr/bin/env python
# coding: utf-8
# */Aaipnd-project-master/train_commonfns.py
#
# PROGRAMMER: <NAME>
# DATE CREATED: 01/01/2020
# REVISED DATE:
# PURPOSE: common support needed for train program
# ... | [
"numpy.clip",
"argparse.ArgumentParser",
"matplotlib.use",
"matplotlib.pyplot.plot",
"numpy.array",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend"
] | [((526, 547), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (540, 547), False, 'import matplotlib\n'), ((2743, 2768), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2766, 2768), False, 'import argparse\n'), ((4419, 4444), 'argparse.ArgumentParser', 'argparse.ArgumentPar... |
from django.contrib import admin
from django.conf.urls.static import static, settings
from django.urls import path, include
handler404 = 'database.views.page_not_found'
handler500 = 'database.views.server_error'
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('database.urls')),
path('', ... | [
"django.conf.urls.static.static",
"django.urls.path",
"django.urls.include"
] | [((527, 588), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (533, 588), False, 'from django.conf.urls.static import static, settings\n'), ((234, 265), 'django.urls.path', 'path', (['"""admin/""... |
# Copyright 2018-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, ... | [
"struct.pack"
] | [((1609, 1632), 'struct.pack', 'struct.pack', (['"""!I"""', 'alen'], {}), "('!I', alen)\n", (1620, 1632), False, 'import struct\n')] |
import os
import re
import shutil
import json
HOME = 'D:\Download\CodeandData\RDANER-master'
dataset_info = f'{HOME}/data/dataset_info.json'
dataset_info = json.load(open(dataset_info))['ner']
script_base = f'{HOME}/scripts/'
model_base = f'{HOME}/checkpoint'
data_base = f'{HOME}/data/split/ner'
def run_lm(model, d... | [
"os.path.exists",
"os.path.join",
"shutil.rmtree",
"re.sub",
"os.system",
"os.remove"
] | [((464, 495), 'os.path.exists', 'os.path.exists', (['base_ner_output'], {}), '(base_ner_output)\n', (478, 495), False, 'import os\n'), ((549, 593), 'os.path.join', 'os.path.join', (['model_base', 'model', '"""vocab.txt"""'], {}), "(model_base, model, 'vocab.txt')\n", (561, 593), False, 'import os\n'), ((607, 638), 'os.... |
from elasticsearch import Elasticsearch
import sys, csv, json, os, uuid
## create customized document based on template
## rtype null
def createMpAnnotation(host, port, annotation, annotationId):
es = Elasticsearch([{'host': host, 'port': port}])
es.index(index="annotator", doc_type="annotation", id=annotationId, b... | [
"elasticsearch.Elasticsearch",
"json.dumps"
] | [((203, 248), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["[{'host': host, 'port': port}]"], {}), "([{'host': host, 'port': port}])\n", (216, 248), False, 'from elasticsearch import Elasticsearch\n'), ((463, 508), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["[{'host': host, 'port': port}]"], {}), "([{'host'... |
import numpy as np
from qiskit.circuit.library import EfficientSU2
from qiskit.opflow import Y, X, Z, Gradient, StateFn
from gradient import ForwardGradient, ReverseGradient
operator = X ^ X ^ X
ansatz = EfficientSU2(3, reps=1)
values = list(range(ansatz.num_parameters))
fwd = ForwardGradient()
rev = ReverseGradient(... | [
"qiskit.opflow.Gradient",
"qiskit.circuit.library.EfficientSU2",
"qiskit.opflow.StateFn",
"gradient.ForwardGradient",
"gradient.ReverseGradient"
] | [((205, 228), 'qiskit.circuit.library.EfficientSU2', 'EfficientSU2', (['(3)'], {'reps': '(1)'}), '(3, reps=1)\n', (217, 228), False, 'from qiskit.circuit.library import EfficientSU2\n'), ((280, 297), 'gradient.ForwardGradient', 'ForwardGradient', ([], {}), '()\n', (295, 297), False, 'from gradient import ForwardGradien... |
# -*- coding: utf-8 -*-
"""
oy.contrib.users.model
~~~~~~~~~~~~~~~~~~~~~~~~
Provides the user profile model.
:copyright: (c) 2018 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
from sqlalchemy.orm import backref, mapper
from sqlalchemy.orm.collections import attribute_mapped_collecti... | [
"sqlalchemy.ext.associationproxy.association_proxy",
"oy.babel.lazy_gettext",
"sqlalchemy.orm.backref",
"sqlalchemy.orm.collections.attribute_mapped_collection",
"oy.boot.sqla.db.event.listens_for",
"oy.boot.sqla.db.ForeignKey",
"oy.boot.sqla.db.Column"
] | [((1493, 1529), 'oy.boot.sqla.db.event.listens_for', 'db.event.listens_for', (['mapper', '"""init"""'], {}), "(mapper, 'init')\n", (1513, 1529), False, 'from oy.boot.sqla import db\n'), ((633, 672), 'oy.boot.sqla.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (... |
from flask_sqlalchemy import SQLAlchemy
from flask import Flask
from flask_login import LoginManager
from config import conf_obj
from .utils.mail import Mail
login_manager = LoginManager()
db = SQLAlchemy()
mail = Mail()
def create_app(env_type: str='development'):
app = Flask(__name__)
app.config.from_obje... | [
"flask_login.LoginManager",
"flask_sqlalchemy.SQLAlchemy",
"flask.Flask"
] | [((176, 190), 'flask_login.LoginManager', 'LoginManager', ([], {}), '()\n', (188, 190), False, 'from flask_login import LoginManager\n'), ((196, 208), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (206, 208), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((280, 295), 'flask.Flask', 'Flask', (['_... |
import os
import gzip
def remove_safely(fn):
if os.path.isfile(fn):
os.remove(fn)
def check_call(command, quiet=False):
if not quiet:
print(repr(command))
exitcode = os.system(command)
assert exitcode == 0, f"Command failed: {command}"
def smart_open(filename, mode):
if filenam... | [
"os.path.isfile",
"os.system",
"gzip.open",
"os.remove"
] | [((54, 72), 'os.path.isfile', 'os.path.isfile', (['fn'], {}), '(fn)\n', (68, 72), False, 'import os\n'), ((198, 216), 'os.system', 'os.system', (['command'], {}), '(command)\n', (207, 216), False, 'import os\n'), ((82, 95), 'os.remove', 'os.remove', (['fn'], {}), '(fn)\n', (91, 95), False, 'import os\n'), ((354, 379), ... |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
def plot_duration(df):
'''
Plots a histogram of the movie duration
:param df: cleaned dataframe
:return: figure and axes objects
'''
fig, ax = plt.subplots(nrows = 1, ncols =... | [
"seaborn.lmplot",
"seaborn.relplot",
"seaborn.despine",
"seaborn.histplot",
"seaborn.heatmap",
"seaborn.scatterplot",
"seaborn.barplot",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((289, 337), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(10, 10)'}), '(nrows=1, ncols=1, figsize=(10, 10))\n', (301, 337), True, 'import matplotlib.pyplot as plt\n'), ((348, 409), 'seaborn.histplot', 'sns.histplot', ([], {'data': 'df', 'x': '"""duration"""', 'ax': '... |
from chkpkg import Package
if __name__ == "__main__":
with Package() as pkg:
pkg.run_python_code('import neatest; neatest.print_version()')
pkg.run_shell_code('neatest --version')
print("\nPackage is OK!")
| [
"chkpkg.Package"
] | [((64, 73), 'chkpkg.Package', 'Package', ([], {}), '()\n', (71, 73), False, 'from chkpkg import Package\n')] |
from itertools import chain
import numpy as np
from sacred import Ingredient
import torch
import torch.nn as nn
from racer.car_racing_env import feature_size, car_racing_env, image_size
from racer.models.agent import Agent
from racer.utils import load_pixels, flatten_parameters, build_parameters
simple_nn = Ingredien... | [
"torch.tanh",
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.tensor",
"torch.zeros",
"torch.nn.MaxPool2d",
"racer.car_racing_env.feature_size",
"racer.car_racing_env.image_size",
"torch.nn.Linear",
"sacred.Ingredient",
"torch.no_grad",
"racer.utils.build... | [((311, 364), 'sacred.Ingredient', 'Ingredient', (['"""simple_nn"""'], {'ingredients': '[car_racing_env]'}), "('simple_nn', ingredients=[car_racing_env])\n", (321, 364), False, 'from sacred import Ingredient\n'), ((631, 644), 'racer.utils.load_pixels', 'load_pixels', ([], {}), '()\n', (642, 644), False, 'from racer.uti... |
from http import HTTPStatus
from flask_jwt_extended import get_jwt_identity
from flask_jwt_extended import jwt_required
from flask_restplus import Namespace
from flask_restplus import Resource
from LMS.controller.signup import USER_ID
from LMS.service import user_services
API = Namespace("user", description="User")
... | [
"flask_jwt_extended.get_jwt_identity",
"flask_restplus.Namespace",
"LMS.service.user_services.get_groupmates",
"LMS.service.user_services.get_profile"
] | [((282, 319), 'flask_restplus.Namespace', 'Namespace', (['"""user"""'], {'description': '"""User"""'}), "('user', description='User')\n", (291, 319), False, 'from flask_restplus import Namespace\n'), ((797, 815), 'flask_jwt_extended.get_jwt_identity', 'get_jwt_identity', ([], {}), '()\n', (813, 815), False, 'from flask... |
import csv
import re
from mtgsdk import Card
from utils.json import write_json
LANGUAGE = 'English'
SET = 'rna'
RESTVAL = 'NA'
EXTRASACTION = 'raise'
DIALECT = 'unix'
def get_fieldnames(o):
for k, v in o.__dict__.items():
yield k
def get_collection(set_name, language):
for c in Card \
... | [
"mtgsdk.Card.where"
] | [((300, 329), 'mtgsdk.Card.where', 'Card.where', ([], {'language': 'language'}), '(language=language)\n', (310, 329), False, 'from mtgsdk import Card\n')] |
from collections import defaultdict
from itertools import count, islice
from .core import initial
from .dispatch import SingledispatchCache
from .stream import unfold
from .unify import Var, walk
class ReifiedVar:
def __init__(self, name, type):
self.name = name
self.type = type
def __repr__... | [
"itertools.count"
] | [((877, 884), 'itertools.count', 'count', ([], {}), '()\n', (882, 884), False, 'from itertools import count, islice\n')] |
import logging
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, viewsets
from apps.utils.rest.cached_views import cache_on_auth
from apps.utils.rest.permissions import HasAuthAPIKeyNoOrg, IsStaffOrReadOnly, ReadOnly... | [
"logging.getLogger",
"apps.utils.rest.cached_views.cache_on_auth"
] | [((411, 438), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (428, 438), False, 'import logging\n'), ((1633, 1681), 'apps.utils.rest.cached_views.cache_on_auth', 'cache_on_auth', (['(60 * 15)'], {'key_prefix': '"""api:vartype"""'}), "(60 * 15, key_prefix='api:vartype')\n", (1646, 1681), F... |
import yaml, os, re, csv, requests
from bs4 import BeautifulSoup
from operator import itemgetter
# Used for finding skus in stockfile
def Binary_search(L, target):
start = 0
end = len(L) - 1
while start <= end:
middle = int((start + end)/ 2)
midpoint = L[middle]
if midpoint > target... | [
"re.split",
"requests.post",
"csv.writer",
"os.path.join",
"yaml.load",
"os.path.isfile",
"bs4.BeautifulSoup",
"re.sub",
"operator.itemgetter",
"re.search"
] | [((758, 796), 'yaml.load', 'yaml.load', (['cfg'], {'Loader': 'yaml.FullLoader'}), '(cfg, Loader=yaml.FullLoader)\n', (767, 796), False, 'import yaml, os, re, csv, requests\n'), ((1322, 1347), 'os.path.isfile', 'os.path.isfile', (['storePath'], {}), '(storePath)\n', (1336, 1347), False, 'import yaml, os, re, csv, reques... |
from __future__ import division, print_function
import CoolProp
from CoolProp import unit_systems_constants
from CoolProp.CoolProp import Props, get_REFPROPname, IsFluidType, set_standard_unit_system
import CoolProp.CoolProp as CP
import numpy as np
modes = []
modes.append('pure')
#modes.append('pseudo-pure')
# Check... | [
"CoolProp.CoolProp.get_REFPROPname",
"CoolProp.CoolProp.set_standard_unit_system",
"nose.runmodule",
"CoolProp.CoolProp.IsFluidType",
"CoolProp.CoolProp.Props"
] | [((2730, 2771), 'CoolProp.CoolProp.Props', 'Props', (['inputs[0]', '"""T"""', 'T', '"""D"""', 'rho', 'Fluid'], {}), "(inputs[0], 'T', T, 'D', rho, Fluid)\n", (2735, 2771), False, 'from CoolProp.CoolProp import Props, get_REFPROPname, IsFluidType, set_standard_unit_system\n'), ((2780, 2821), 'CoolProp.CoolProp.Props', '... |
from django.shortcuts import render, redirect
from .models import Message, Reply, Reader
from .forms import MessageForm, ReplyForm
from pprint import pprint
from django.contrib.auth.models import User
from datetime import datetime
# Create your views here.
def index(request):
if request.user.is_authenticated:
... | [
"django.shortcuts.render",
"datetime.datetime.now"
] | [((569, 709), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'title': 'Message System inbox', 'messages': messages, 'ccMessages':\n ccMessages, 'logged_in': logged_in}"], {}), "(request, 'index.html', {'title': 'Message System inbox', 'messages':\n messages, 'ccMessages': ccMessages, 'log... |
# https://leetcode.com/problems/n-repeated-element-in-size-2n-array/
from collections import Counter
class Solution(object):
def repeatedNTimes(self, A):
"""
:type A: List[int]
:rtype: int
"""
c = Counter(A)
return [x for x in c if c[x] == len(A) // 2][0]
| [
"collections.Counter"
] | [((245, 255), 'collections.Counter', 'Counter', (['A'], {}), '(A)\n', (252, 255), False, 'from collections import Counter\n')] |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
"""
Celery Signals are disjointed and don't allow us to pass the scope object along
with the Job message so we instead store all scopes in a dictionary on the
registered Task job.
These methods allow pushing and pop'ing of scopes on Task objects.
WeakV... | [
"weakref.WeakValueDictionary"
] | [((1018, 1039), 'weakref.WeakValueDictionary', 'WeakValueDictionary', ([], {}), '()\n', (1037, 1039), False, 'from weakref import WeakValueDictionary\n')] |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sklearn.datasets import make_classification, make_moons
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.l... | [
"sklearn.datasets.make_moons",
"sklearn.preprocessing.StandardScaler",
"pandas.DataFrame",
"numpy.meshgrid",
"numpy.arange"
] | [((468, 512), 'sklearn.datasets.make_moons', 'make_moons', ([], {'n_samples': 'n_samples', 'noise': 'noise'}), '(n_samples=n_samples, noise=noise)\n', (478, 512), False, 'from sklearn.datasets import make_classification, make_moons\n'), ((527, 562), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': "['A', 'B']"})... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-05-10 08:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icds_reports', '0188_rebuild_view_bihar_api'),
]
operations = [
migrations.... | [
"django.db.models.DateTimeField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.SmallIntegerField"
] | [((428, 463), 'django.db.models.SmallIntegerField', 'models.SmallIntegerField', ([], {'null': '(True)'}), '(null=True)\n', (452, 463), False, 'from django.db import migrations, models\n'), ((609, 636), 'django.db.models.DateField', 'models.DateField', ([], {'null': '(True)'}), '(null=True)\n', (625, 636), False, 'from ... |
#!/usr/bin/env python3
# Copyright © 2014, 2015 <NAME>
#
# 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, modify, ... | [
"os.listdir",
"os.rename",
"base64.b64encode",
"shred.shred",
"optparse.OptionParser",
"os.path.isdir",
"hashlib.sha1",
"os.remove"
] | [((1650, 1673), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (1671, 1673), False, 'import optparse\n'), ((5460, 5485), 'os.path.isdir', 'os.path.isdir', (['key_source'], {}), '(key_source)\n', (5473, 5485), False, 'import os\n'), ((9208, 9232), 'base64.b64encode', 'base64.b64encode', (['result'],... |
from flask import jsonify
from .messages import ( # MSG_NO_DATA; MSG_PASSWORD_DIDNT_MATCH,; MSG_RESOURCE_CREATED
MSG_ALREADY_EXISTS,
MSG_DOES_NOT_EXIST,
MSG_EXCEPTION,
MSG_INVALID_DATA,
MSG_PERMISSION_DENIED
)
def resp_invalid_data(resource: str, errors: dict, msg: str = MSG_INVALID_DATA) -> dic... | [
"flask.jsonify"
] | [((504, 569), 'flask.jsonify', 'jsonify', (["{'resource': resource, 'message': msg, 'errors': errors}"], {}), "({'resource': resource, 'message': msg, 'errors': errors})\n", (511, 569), False, 'from flask import jsonify\n'), ((922, 997), 'flask.jsonify', 'jsonify', (["{'resource': resource, 'message': msg, 'description... |
"""HTML related implementations.
Mainly following interfaces are defined:
- remove_first_selector_symbol_char : Remove first selector
symbol (`.` or `#`) from string.
- append_html_to_str : Add html string to another string with line
break and specified number's indentation.
- append_indent_to_each_sc... | [
"apysc._type.value_util.get_copy",
"apysc._string.indent_util.make_spaces_for_html",
"apysc.append_js_expression",
"typing.TypeVar",
"re.search"
] | [((1074, 1109), 'typing.TypeVar', 'TypeVar', (['"""StrOrString"""', 'str', 'String'], {}), "('StrOrString', str, String)\n", (1081, 1109), False, 'from typing import TypeVar\n'), ((2924, 2970), 'apysc.append_js_expression', 'ap.append_js_expression', ([], {'expression': 'expression'}), '(expression=expression)\n', (294... |
from datetime import date
import pytest
import mock
from wtforms.validators import StopValidation, ValidationError
import dmutils.forms.validators
from dmutils.forms.validators import (
GreaterThan,
DateValidator,
)
@pytest.fixture
def form():
return mock.MagicMock()
@pytest.fixture
def field(form):
... | [
"dmutils.forms.validators.DateValidator",
"pytest.mark.parametrize",
"pytest.raises",
"datetime.date",
"dmutils.forms.validators.GreaterThan",
"mock.MagicMock"
] | [((345, 519), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""invalid_email_address"""', "(None, '', 'foobar', 'bob@blob', '<EMAIL>', '<EMAIL>;<EMAIL>',\n 'Please send emails to b o b at b l o b dot example')"], {}), "('invalid_email_address', (None, '', 'foobar',\n 'bob@blob', '<EMAIL>', '<EMAIL>;<EM... |
import subprocess
import sys
import setup_util
def start(args, logfile, errfile):
try:
subprocess.check_call("lein deps", shell=True, cwd="http-kit/hello", stderr=errfile, stdout=logfile)
subprocess.check_call("rm -rf target", shell=True, cwd="http-kit/hello")
# pack all dependencies into a single jar:... | [
"subprocess.Popen",
"subprocess.check_call"
] | [((96, 201), 'subprocess.check_call', 'subprocess.check_call', (['"""lein deps"""'], {'shell': '(True)', 'cwd': '"""http-kit/hello"""', 'stderr': 'errfile', 'stdout': 'logfile'}), "('lein deps', shell=True, cwd='http-kit/hello', stderr\n =errfile, stdout=logfile)\n", (117, 201), False, 'import subprocess\n'), ((201,... |
from collections import deque
from pathlib import Path
import numpy as np
import pandas as pd
from pyoaz.bots.leftmost_bot import LeftmostBot
from pyoaz.bots.random_bot import RandomBot
from pyoaz.bots.nn_bot import NNBot
from pyoaz.bots.mcts_bot import MCTSBot
from pyoaz.tournament import Participant, Tournament
d... | [
"pyoaz.tournament.Tournament",
"pyoaz.tournament.Participant",
"collections.deque",
"pandas.read_csv",
"pathlib.Path",
"pyoaz.bots.nn_bot.NNBot.load_model",
"pyoaz.bots.random_bot.RandomBot",
"pyoaz.games.tic_tac_toe.boards_to_bin",
"pandas.merge",
"numpy.log",
"pyoaz.bots.leftmost_bot.LeftmostB... | [((525, 545), 'pathlib.Path', 'Path', (['benchmark_path'], {}), '(benchmark_path)\n', (529, 545), False, 'from pathlib import Path\n'), ((1737, 1807), 'pandas.read_csv', 'pd.read_csv', (["(benchmark_path / 'tic_tac_toe_table.csv')"], {'index_col': '(False)'}), "(benchmark_path / 'tic_tac_toe_table.csv', index_col=False... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.ops.operations.Split",
"mindspore.nn.CellList",
"mindspore.ops.operations.Concat",
"mindspore.nn.Conv2d",
"mindspore.ops.operations.Cast"
] | [((1464, 1477), 'mindspore.nn.CellList', 'nn.CellList', ([], {}), '()\n', (1475, 1477), True, 'import mindspore.nn as nn\n'), ((1502, 1541), 'mindspore.ops.operations.Split', 'P.Split', ([], {'axis': '(1)', 'output_num': 'self.groups'}), '(axis=1, output_num=self.groups)\n', (1509, 1541), True, 'from mindspore.ops impo... |
import buff
target = ("10.10.39.66", 9999)
# From Spiking I learnt what the prefix is
runner = buff.Buff(target = target, prefix = "TRUN /.:/")
"""
FIRST CREATE WOKRING DIRECTORY!!!
!mona config -set workingfolder c:\mona\%p
"""
# ----- 1. FUZZING -----
# Crashed at 2000
# runner.fuzz()
# ----- 2. Send Uniqu... | [
"buff.Buff"
] | [((98, 142), 'buff.Buff', 'buff.Buff', ([], {'target': 'target', 'prefix': '"""TRUN /.:/"""'}), "(target=target, prefix='TRUN /.:/')\n", (107, 142), False, 'import buff\n')] |
#!/bin/env python
# vim: set et ts=4 sw=4 fileencoding=utf-8:
'''
Setup script for pycsync
'''
import os
from setuptools import setup
# Ensure we are in pycsync source dir
SETUP_DIRNAME = os.path.dirname(__file__)
if SETUP_DIRNAME != '':
os.chdir(SETUP_DIRNAME)
PYCSYNC_VERSION = os.path.join(os.path.abspath(SETU... | [
"os.chdir",
"os.path.dirname",
"os.path.abspath",
"setuptools.setup"
] | [((190, 215), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (205, 215), False, 'import os\n'), ((244, 267), 'os.chdir', 'os.chdir', (['SETUP_DIRNAME'], {}), '(SETUP_DIRNAME)\n', (252, 267), False, 'import os\n'), ((300, 330), 'os.path.abspath', 'os.path.abspath', (['SETUP_DIRNAME'], {}), '(S... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 28 12:48:10 2021
@author: huzongxiang
"""
import numpy as np
from typing import List
from enum import Enum, unique
from pymatgen.core import Structure
from pymatgen.analysis.bond_valence import BVAnalyzer
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
@uniqu... | [
"numpy.array",
"numpy.eye",
"pymatgen.analysis.bond_valence.BVAnalyzer",
"pymatgen.symmetry.analyzer.SpacegroupAnalyzer"
] | [((950, 985), 'numpy.eye', 'np.eye', (['num_atoms'], {'dtype': 'np.float32'}), '(num_atoms, dtype=np.float32)\n', (956, 985), True, 'import numpy as np\n'), ((1408, 1432), 'pymatgen.analysis.bond_valence.BVAnalyzer', 'BVAnalyzer', ([], {'symm_tol': '(0.1)'}), '(symm_tol=0.1)\n', (1418, 1432), False, 'from pymatgen.anal... |
#!/usr/bin/env python3
import pandas as pd
import numpy as np
def changeCode(text):
if "Male" in text: return("M")
if "Female" in text: return("F")
return("")
data = {"Name": ["James", "Alice", "Phil", "James","Mark"],
"Age": [24, 28, 40, 24,48],
"Sex": ["Male", "Female", "Male", "Male... | [
"pandas.DataFrame"
] | [((333, 351), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (345, 351), True, 'import pandas as pd\n')] |
#!/usr/bin/env python
# coding: utf-8
# # Uninformed Search
#
# This notebook serves as supporting material for topics covered in **Lecture 3 - Uninformed Search** from the lecture *Grundlagen der Künstlichen Intelligenz (IN2062)* at the Technical University of Munich. This notebook uses implementations from [search.... | [
"search_helpers.display_steps",
"warnings.filterwarnings",
"ypstruct.struct",
"search_helpers.show_tree"
] | [((1109, 1142), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1132, 1142), False, 'import warnings\n'), ((3878, 3905), 'search_helpers.show_tree', 'show_tree', (['simple_tree_data'], {}), '(simple_tree_data)\n', (3887, 3905), False, 'from search_helpers import show_tree,... |
"""
This Python module serves to analyze the performance metrics of kharon.
"""
#%%
import matplotlib.pyplot as plt
import sys
import os
import numpy as np
from scipy.stats import norm
import statistics
# retrieve data from
# option = -1
# if sys.argv[1] == "new":
# option = 0
# else:
# option = 1
out_file = "p... | [
"statistics.mean",
"os.path.exists",
"statistics.stdev",
"scipy.stats.norm.pdf",
"numpy.arange",
"os.remove"
] | [((426, 453), 'os.path.exists', 'os.path.exists', (['"""means.txt"""'], {}), "('means.txt')\n", (440, 453), False, 'import os\n'), ((1099, 1126), 'numpy.arange', 'np.arange', (['(4000)', '(10000)', '(0.5)'], {}), '(4000, 10000, 0.5)\n', (1108, 1126), True, 'import numpy as np\n'), ((1133, 1170), 'statistics.mean', 'sta... |
import requests
import shutil
import tempfile
class Restclient(object):
def __init__(self,host,username,password):
self.host = host
self.auth = (username,password)
def get_phenotype_data(self,studyid):
headers = {'Accept':'application/json'}
URL = '%s/provider/study/%s/studygw... | [
"requests.get"
] | [((362, 426), 'requests.get', 'requests.get', (['URL'], {'headers': 'headers', 'auth': 'self.auth', 'verify': '(False)'}), '(URL, headers=headers, auth=self.auth, verify=False)\n', (374, 426), False, 'import requests\n'), ((719, 783), 'requests.get', 'requests.get', (['URL'], {'headers': 'headers', 'auth': 'self.auth',... |
from platon._utils.method_formatters import (
PYTHONIC_REQUEST_FORMATTERS,
PYTHONIC_RESULT_FORMATTERS,
)
from platon.middleware.formatting import (
construct_formatting_middleware,
)
pythonic_middleware = construct_formatting_middleware(
request_formatters=PYTHONIC_REQUEST_FORMATTERS,
result_format... | [
"platon.middleware.formatting.construct_formatting_middleware"
] | [((218, 348), 'platon.middleware.formatting.construct_formatting_middleware', 'construct_formatting_middleware', ([], {'request_formatters': 'PYTHONIC_REQUEST_FORMATTERS', 'result_formatters': 'PYTHONIC_RESULT_FORMATTERS'}), '(request_formatters=\n PYTHONIC_REQUEST_FORMATTERS, result_formatters=PYTHONIC_RESULT_FORMA... |
import numpy as np
import matplotlib.pyplot as plt
import time
def completeRank1Matrix(observations,mask,PLOT=False):
# observations and mask are two 2D numpy arrays of the same size, where observations is a
# numerical matrix indicating the observed values of the matrix and mask is a boolean array
# indicating ... | [
"numpy.logical_not",
"numpy.any",
"time.sleep",
"matplotlib.pyplot.close",
"numpy.argwhere",
"numpy.transpose",
"matplotlib.pyplot.subplots"
] | [((1925, 1937), 'matplotlib.pyplot.close', 'plt.close', (['f'], {}), '(f)\n', (1934, 1937), True, 'import matplotlib.pyplot as plt\n'), ((378, 419), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {'sharex': '(True)', 'sharey': '(True)'}), '(2, sharex=True, sharey=True)\n', (390, 419), True, 'import matplotlib.... |
# Copyright 2018 <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, software
... | [
"sysbar.ui.user.UiUserList",
"gi.repository.Gtk.Grid",
"sysbar.lib.session.SbSession",
"gi.repository.Gtk.Button",
"sysbar.lib.settings.SbBackup",
"sysbar.ui.dialog.UiDialog",
"sysbar.lib.settings.SbStoreInfo",
"sysbar.ui.products.new.UiNewProduct",
"gi.repository.Gtk.Window.__init__",
"gi.reposit... | [((576, 608), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (594, 608), False, 'import gi\n'), ((1117, 1205), 'gi.repository.Gtk.Window.__init__', 'Gtk.Window.__init__', (['self'], {'title': '"""Administração - SysBar"""', 'window_position': '"""center"""'}), "(self, ... |
# This file was generated during the PCRaster build.
# Do not edit!
import sys
import math
import pcraster.operations
import pcraster as _pcraster
from . import _pcraster_multicore as _pmc
if sys.version_info.major == 2:
import __builtin__ as builtins
else:
import builtins
def set_nr_worker_threads(arg1):
... | [
"builtins.min",
"builtins.max",
"math.floor",
"pcraster.operations.min",
"pcraster.clone",
"pcraster.celllength",
"pcraster.operations.max",
"pcraster.operations.cover",
"pcraster.readmap"
] | [((2137, 2175), 'math.floor', 'math.floor', (['((maximum_window - 1) / 2.0)'], {}), '((maximum_window - 1) / 2.0)\n', (2147, 2175), False, 'import math\n'), ((5074, 5092), 'builtins.max', 'builtins.max', (['args'], {}), '(args)\n', (5086, 5092), False, 'import builtins\n'), ((5715, 5733), 'builtins.min', 'builtins.min'... |
from yapsy.IPlugin import IPlugin
from plugins import PluginUtil
from modules import common
from lib.pubsub import pub
import sys
import os
import lib.plyj.parser as plyj
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '../lib')
STRING = ("Reading files stored on {} makes it vulnerable to data inject... | [
"os.path.realpath",
"plugins.PluginUtil.contains",
"lib.plyj.parser.Parser"
] | [((1483, 1496), 'lib.plyj.parser.Parser', 'plyj.Parser', ([], {}), '()\n', (1494, 1496), True, 'import lib.plyj.parser as plyj\n'), ((207, 233), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (223, 233), False, 'import os\n'), ((2312, 2371), 'plugins.PluginUtil.contains', 'PluginUtil.contai... |
# -*- coding: utf-8 -*-
import argparse
import math
import pdb
import traceback
from typing import List, Tuple
def get_divisors(n: int) -> List[int]:
small = [i for i in range(1, int(math.sqrt(n)) + 1) if n % i == 0]
large = [n // d for d in small if n != d * d]
return small + large
def solve(target: i... | [
"pdb.post_mortem",
"traceback.print_exc",
"math.sqrt",
"argparse.ArgumentParser"
] | [((1070, 1182), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Advent of Code - 2015 - Day 20 - Infinite Elves and Infinite Houses."""'}), "(description=\n 'Advent of Code - 2015 - Day 20 - Infinite Elves and Infinite Houses.')\n", (1093, 1182), False, 'import argparse\n'), ((1465, 14... |
from django.http import HttpResponse
from django.shortcuts import render
def messageBlock(request):
return render(request, 'form.html')
def test(request):
context = {}
context['hi'] = 'Hello'
return render(request, 'error.html', context)
| [
"django.shortcuts.render"
] | [((118, 146), 'django.shortcuts.render', 'render', (['request', '"""form.html"""'], {}), "(request, 'form.html')\n", (124, 146), False, 'from django.shortcuts import render\n'), ((228, 266), 'django.shortcuts.render', 'render', (['request', '"""error.html"""', 'context'], {}), "(request, 'error.html', context)\n", (234... |
# -*- coding: utf-8 -*-
import random
import time
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(a)
b = a[:3]
b[1] = 0
print(a)
def change(a, i):
a[i] = -2
return True
change(a, 5)
print(a)
start_time = time.time()
for i in range(100):
print(random.randint(0, 5))
end_time = time.time()
sec_cost = end_time - star... | [
"time.time",
"random.randint"
] | [((206, 217), 'time.time', 'time.time', ([], {}), '()\n', (215, 217), False, 'import time\n'), ((282, 293), 'time.time', 'time.time', ([], {}), '()\n', (291, 293), False, 'import time\n'), ((249, 269), 'random.randint', 'random.randint', (['(0)', '(5)'], {}), '(0, 5)\n', (263, 269), False, 'import random\n')] |
import discord
from discord.ext import commands
from discord_ui.cogs import slash_cog
from discord_ui.receive import SlashedCommand
from requests import request
import config
from bs4 import BeautifulSoup
class Search(commands.Cog):
def __init__(self, bot):
self.bot = bot
@slash_cog(
name="py... | [
"bs4.BeautifulSoup",
"requests.request",
"discord_ui.cogs.slash_cog",
"discord.Color.random"
] | [((293, 404), 'discord_ui.cogs.slash_cog', 'slash_cog', ([], {'name': '"""pypi"""', 'description': '"""Search to python projects from pypi.org"""', 'guild_ids': '[config.guild_id]'}), "(name='pypi', description=\n 'Search to python projects from pypi.org', guild_ids=[config.guild_id])\n", (302, 404), False, 'from di... |
import boto3
def get_ec2_public_ip(instance_id: str):
ec2 = boto3.resource("ec2")
instance = ec2.Instance(instance_id)
return instance.public_ip_address
| [
"boto3.resource"
] | [((66, 87), 'boto3.resource', 'boto3.resource', (['"""ec2"""'], {}), "('ec2')\n", (80, 87), False, 'import boto3\n')] |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
unique_id = fields.Char(string='Unique Id', help="The Unique Sequence no", readonly=True, default='/')
@api.model
def create(self, values):
res = super(ResPartner, self).cre... | [
"odoo.fields.Char"
] | [((142, 237), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Unique Id"""', 'help': '"""The Unique Sequence no"""', 'readonly': '(True)', 'default': '"""/"""'}), "(string='Unique Id', help='The Unique Sequence no', readonly=\n True, default='/')\n", (153, 237), False, 'from odoo import models, fields, api\n'... |
from random import randrange
import pygame
from pygame import mixer
import random
import math
# intial instances of pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
# Add background image
background = pygame.image.load("assests/mountains03-1920-x-1080_full.png")
# Background Music
mixer.music.loa... | [
"pygame.init",
"pygame.event.get",
"random.randrange",
"pygame.display.set_mode",
"pygame.display.update",
"math.pow",
"pygame.display.set_icon",
"pygame.mixer.Sound",
"pygame.mixer.music.load",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.font.Font",
"pygame.mixer.music.play",... | [((124, 137), 'pygame.init', 'pygame.init', ([], {}), '()\n', (135, 137), False, 'import pygame\n'), ((148, 183), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(800, 600)'], {}), '((800, 600))\n', (171, 183), False, 'import pygame\n'), ((222, 283), 'pygame.image.load', 'pygame.image.load', (['"""assests/moun... |
import asyncio
from asynctest import TestCase, mock
from aiohttp import client_exceptions, WSMsgType
from aiocometd.transports.websocket import WebSocketTransport, WebSocketFactory
from aiocometd.constants import ConnectionType
from aiocometd.exceptions import TransportConnectionClosed, TransportError
class TestWeb... | [
"aiohttp.client_exceptions.ClientError",
"asyncio.CancelledError",
"asynctest.mock.call",
"asynctest.mock.MagicMock",
"aiocometd.exceptions.TransportConnectionClosed",
"aiocometd.transports.websocket.WebSocketFactory",
"aiocometd.transports.websocket.WebSocketTransport",
"asynctest.mock.patch",
"asy... | [((4013, 4065), 'asynctest.mock.patch', 'mock.patch', (['"""aiocometd.transports.websocket.asyncio"""'], {}), "('aiocometd.transports.websocket.asyncio')\n", (4023, 4065), False, 'from asynctest import TestCase, mock\n'), ((4850, 4902), 'asynctest.mock.patch', 'mock.patch', (['"""aiocometd.transports.websocket.asyncio"... |
from django.contrib import admin
from epsilon.projects.models import Pip
# Register your models here.
class PipAdmin(admin.ModelAdmin):
pass
admin.site.register(Pip, PipAdmin) | [
"django.contrib.admin.site.register"
] | [((148, 182), 'django.contrib.admin.site.register', 'admin.site.register', (['Pip', 'PipAdmin'], {}), '(Pip, PipAdmin)\n', (167, 182), False, 'from django.contrib import admin\n')] |