code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from core_backend import context
from core_backend.service import handler
from core_backend.libs import token as tk
from core_backend.libs.exception import Error
from server.domain.models impor... | [
"core_backend.libs.exception.Error",
"server.utils.tools.delete_file",
"re.findall",
"os.path.join",
"logging.getLogger"
] | [((515, 542), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (532, 542), False, 'import logging\n'), ((1060, 1106), 'os.path.join', 'os.path.join', (['settings.STATIC_SOURCE_DIR', 'path'], {}), '(settings.STATIC_SOURCE_DIR, path)\n', (1072, 1106), False, 'import os\n'), ((1115, 1136), 'se... |
# Import Packages
from .Util import encodeURIComponent
from .Exception import *
import requests
# Track Class
class Track():
def __init__(self, token: str):
self.token = token
def search(self, query: str, limit: int = 1):
link = 'https://api.spotify.com/v1/search'
header = {'Authoriza... | [
"requests.request"
] | [((816, 942), 'requests.request', 'requests.request', (['"""GET"""', "('https://api.spotify.com/v1/tracks/' + trackID)"], {'headers': "{'Authorization': 'Bearer ' + self.token}"}), "('GET', 'https://api.spotify.com/v1/tracks/' + trackID,\n headers={'Authorization': 'Bearer ' + self.token})\n", (832, 942), False, 'im... |
import torch
from logger.Logger import log
# uses global logger if available
class Metric():
def __init__(self, name):
self.name = name
log().add_plot(name, columns=("metric_value",))
def add(self, value):
self.add__(value)
def add_barrier(self, value):
self.add__(value)
... | [
"logger.Logger.log"
] | [((157, 162), 'logger.Logger.log', 'log', ([], {}), '()\n', (160, 162), False, 'from logger.Logger import log\n'), ((356, 361), 'logger.Logger.log', 'log', ([], {}), '()\n', (359, 361), False, 'from logger.Logger import log\n'), ((435, 440), 'logger.Logger.log', 'log', ([], {}), '()\n', (438, 440), False, 'from logger.... |
import numpy as np
from yaml import safe_load
import pandas as pd
import glob
from cricscraper.cricinfo import CricInfo
from cricscraper.matchinfo import MatchInfo
class CricSheet:
innings_name = ["1st innings", "2nd innings", "3rd innings", "4th innings"]
def __init__(self, files=None, folder=None):
if fold... | [
"pandas.DataFrame",
"cricscraper.matchinfo.MatchInfo",
"numpy.ceil",
"cricscraper.cricinfo.CricInfo",
"yaml.safe_load",
"pandas.concat"
] | [((429, 443), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (441, 443), True, 'import pandas as pd\n'), ((4120, 4138), 'cricscraper.cricinfo.CricInfo', 'CricInfo', (['match_id'], {}), '(match_id)\n', (4128, 4138), False, 'from cricscraper.cricinfo import CricInfo\n'), ((1086, 1104), 'yaml.safe_load', 'safe_load... |
from pyinstaller_setuptools import setup
setup(
name="mtool-1.04.1 measurement app",
version="1.04.1",
description="Read me",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/antkp/mtool.git",
author="<NAME>.",
author_email="<EMAI... | [
"pyinstaller_setuptools.setup"
] | [((44, 705), 'pyinstaller_setuptools.setup', 'setup', ([], {'name': '"""mtool-1.04.1 measurement app"""', 'version': '"""1.04.1"""', 'description': '"""Read me"""', 'long_description': 'README', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/antkp/mtool.git"""', 'author': '"""<NAM... |
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
import user.models as um
class OrganisationSignUpTest(TestCase):
def setUp(self) -> None:
self.client = APIClient()
def test_organisation_can_sign_up(self):
... | [
"user.models.Admin.objects.get",
"user.models.OrganisationAdmin.objects.get",
"django.urls.reverse",
"user.models.Organisation.objects.get",
"rest_framework.test.APIClient"
] | [((259, 270), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (268, 270), False, 'from rest_framework.test import APIClient\n'), ((8201, 8212), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (8210, 8212), False, 'from rest_framework.test import APIClient\n'), ((13433, 13444), 'rest_fram... |
from typing import Optional
from flask import Flask, current_app, json, redirect
class App:
def __init__(self, test_config: Optional[dict] = None):
self._app = Flask(__name__, static_folder="staticfiles")
self._configure_app(test_config)
self._setup_database()
self._setup_cors()
... | [
"flask_jwt_extended.JWTManager",
"flask.redirect",
"flask_cors.CORS",
"flask.Flask",
"flask.json.dumps"
] | [((175, 219), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""staticfiles"""'}), "(__name__, static_folder='staticfiles')\n", (180, 219), False, 'from flask import Flask, current_app, json, redirect\n'), ((1652, 1667), 'flask_cors.CORS', 'CORS', (['self._app'], {}), '(self._app)\n', (1656, 1667), False, 'f... |
# -*- coding: utf-8 -*-
"""
security utils services module.
"""
from pyrin.application.services import get_component
from pyrin.security.utils import SecurityUtilsPackage
def generate_rsa_key(length=None, **options):
"""
generates a pair of public/private rsa keys.
:param int length: key length in bits.... | [
"pyrin.application.services.get_component"
] | [((532, 582), 'pyrin.application.services.get_component', 'get_component', (['SecurityUtilsPackage.COMPONENT_NAME'], {}), '(SecurityUtilsPackage.COMPONENT_NAME)\n', (545, 582), False, 'from pyrin.application.services import get_component\n'), ((1061, 1111), 'pyrin.application.services.get_component', 'get_component', (... |
################################################################################
# <NAME>
# https://github.com/aaronpenne
################################################################################
import datetime
import string
import sys
from random import shuffle, seed
import helper
##########################... | [
"helper.get_seed",
"helper.set_seed",
"datetime.datetime.now",
"helper.save_frame_timestamp"
] | [((547, 575), 'helper.get_seed', 'helper.get_seed', (['random_seed'], {}), '(random_seed)\n', (562, 575), False, 'import helper\n'), ((576, 604), 'helper.set_seed', 'helper.set_seed', (['random_seed'], {}), '(random_seed)\n', (591, 604), False, 'import helper\n'), ((2651, 2715), 'helper.save_frame_timestamp', 'helper.s... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import math
import numpy as np
from openvino.tools.mo.ops.ONNXResize10 import ONNXResize10
from openvino.tools.mo.ops.upsample import UpsampleOp
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.fron... | [
"openvino.tools.mo.front.onnx.extractors.utils.onnx_attr",
"openvino.tools.mo.front.onnx.extractors.utils.get_onnx_opset_version",
"math.fabs",
"openvino.tools.mo.ops.upsample.UpsampleOp.update_node_stat",
"openvino.tools.mo.utils.error.Error",
"numpy.array",
"openvino.tools.mo.ops.ONNXResize10.ONNXResi... | [((597, 625), 'openvino.tools.mo.front.onnx.extractors.utils.get_onnx_opset_version', 'get_onnx_opset_version', (['node'], {}), '(node)\n', (619, 625), False, 'from openvino.tools.mo.front.onnx.extractors.utils import onnx_attr, get_onnx_opset_version\n'), ((807, 858), 'openvino.tools.mo.ops.ONNXResize10.ONNXResize10.u... |
# Debit card data compilation
import pandas as pd
cols_list = ['UNI_PT_KEY', 'CIF', 'CARD_CLASS_CODE', 'CARD_NUM', 'PRODUCT',
'PRIMARY_ACCOUNT', 'CARD_SEGMENT', 'CARD_BIN', 'CARD_RANGE', 'EMBLEM_ID',
'ACCOUNT_OPEN_DATE', 'CARD_ISSUE_DATE', 'CARD_EXPIRY_DATE', 'CARD_ACTIVATION_DATE',
'FI... | [
"pandas.read_csv",
"pandas.isnull",
"pandas.DataFrame"
] | [((385, 498), 'pandas.read_csv', 'pd.read_csv', (['"""debitcards.csv"""'], {'usecols': 'cols_list', 'dtype': 'str', 'sep': '""";"""', 'error_bad_lines': '(False)', 'low_memory': '(False)'}), "('debitcards.csv', usecols=cols_list, dtype=str, sep=';',\n error_bad_lines=False, low_memory=False)\n", (396, 498), True, 'i... |
from django import forms
from django.utils.translation import ugettext as _
from .models import Item, Group, Profile, Area
class SearchForm(forms.Form):
area = forms.ModelChoiceField(label=_('Area'), queryset=Area.objects.all(), required=False)
group = forms.ModelChoiceField(label=_('Group'), queryset=Group.... | [
"django.utils.translation.ugettext"
] | [((196, 205), 'django.utils.translation.ugettext', '_', (['"""Area"""'], {}), "('Area')\n", (197, 205), True, 'from django.utils.translation import ugettext as _\n'), ((293, 303), 'django.utils.translation.ugettext', '_', (['"""Group"""'], {}), "('Group')\n", (294, 303), True, 'from django.utils.translation import uget... |
# encoding: utf-8
from nose.tools import *
import numpy as np
from cmpy.inference import standardize_data
from cmpy import machines
from ..canonical import tmatrix
from ..counts import path_counts, out_arrays
def test_path_counts1():
# Test without state_path
m = machines.Even()
delta, nodes, symbols =... | [
"cmpy.inference.standardize_data",
"numpy.random.RandomState",
"cmpy.machines.Even"
] | [((277, 292), 'cmpy.machines.Even', 'machines.Even', ([], {}), '()\n', (290, 292), False, 'from cmpy import machines\n'), ((344, 367), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (365, 367), True, 'import numpy as np\n'), ((426, 445), 'cmpy.inference.standardize_data', 'standardize_data', (['... |
import sys
import gurobipy
import math
import numpy as np
import time
# Lies die Lösungsdatei ein und gib eine Liste der Mittelpunkte zurück
# solutionFilePath = Pfad zur Lösungsdatei (string)
# n = Dimension der Kugel (int, >= 1)
def readSolution(solutionFilePath, n=3):
solution = []
try:
# Öffne die ... | [
"gurobipy.Model",
"time.time",
"numpy.array",
"math.cos",
"sys.exit"
] | [((1451, 1467), 'gurobipy.Model', 'gurobipy.Model', ([], {}), '()\n', (1465, 1467), False, 'import gurobipy\n'), ((4200, 4216), 'gurobipy.Model', 'gurobipy.Model', ([], {}), '()\n', (4214, 4216), False, 'import gurobipy\n'), ((5245, 5256), 'time.time', 'time.time', ([], {}), '()\n', (5254, 5256), False, 'import time\n'... |
# This file is part of the markdown-svgbob project
# https://github.com/mbarkhau/markdown-svgbob
#
# Copyright (c) 2019-2021 <NAME> (<EMAIL>) - MIT License
# SPDX-License-Identifier: MIT
import re
import copy
import json
import base64
import typing as typ
import hashlib
import logging
from markdown.extensions import E... | [
"markdown_svgbob.wrapper.text2svg",
"copy.deepcopy",
"hashlib.md5",
"json.loads",
"urllib.quote",
"base64.standard_b64encode",
"markdown_svgbob.wrapper.parse_options",
"logging.getLogger",
"re.compile"
] | [((581, 608), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (598, 608), False, 'import logging\n'), ((628, 659), 're.compile', 're.compile', (['"""^(`{3,}|~{3,})bob"""'], {}), "('^(`{3,}|~{3,})bob')\n", (638, 659), False, 'import re\n'), ((678, 736), 're.compile', 're.compile', (['"""^(`... |
import torch
from torch.utils.data import DataLoader
from torch.optim import Adam, RMSprop
import torch.nn as nn
from model import W2V_model, W2V_SGNS_model
from w2v_dataloader import CBOW_dataset, SkipGramDataset, SkipGramNegativeSamplingDataset
from test_embeddings import test_embedding_question_words
import os
im... | [
"json.dump",
"tqdm.tqdm",
"os.mkdir",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torch.nn.BCELoss",
"w2v_dataloader.SkipGramDataset",
"torch.load",
"torch.nn.CrossEntropyLoss",
"os.path.exists",
"test_embeddings.test_embedding_question_words",
"os.path.isfile",
"torch.cuda.is... | [((8020, 8045), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8043, 8045), False, 'import argparse\n'), ((604, 636), 'os.path.isfile', 'os.path.isfile', (['opt.dataset_path'], {}), '(opt.dataset_path)\n', (618, 636), False, 'import os\n'), ((1432, 1453), 'torch.nn.CrossEntropyLoss', 'nn.Cross... |
#!/usr/bin/env python3
# encoding: utf-8
# end_pymotw_header
import sys
import sys_shelve_importer
def show_module_details(module):
print(" message :", module.message)
print(" __name__ :", module.__name__)
print(" __package__:", module.__package__)
print(" __file__ :", module.__file__)
... | [
"sys.path.insert",
"sys.path_hooks.append"
] | [((457, 512), 'sys.path_hooks.append', 'sys.path_hooks.append', (['sys_shelve_importer.ShelveFinder'], {}), '(sys_shelve_importer.ShelveFinder)\n', (478, 512), False, 'import sys\n'), ((513, 541), 'sys.path.insert', 'sys.path.insert', (['(0)', 'filename'], {}), '(0, filename)\n', (528, 541), False, 'import sys\n')] |
#!/usr/bin/env vpython3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script for updating the project settings for a chromium branch.
To initialize a new chromium branch, run the following from the ro... | [
"os.path.join",
"json.dumps"
] | [((675, 709), 'os.path.join', 'os.path.join', (['__file__', '""".."""', '""".."""'], {}), "(__file__, '..', '..')\n", (687, 709), False, 'import os\n'), ((2013, 2043), 'json.dumps', 'json.dumps', (['settings'], {'indent': '(4)'}), '(settings, indent=4)\n', (2023, 2043), False, 'import json\n'), ((1075, 1122), 'os.path.... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from .managers import CustomUserManager
# Create your models here.
class CustomUser(Abst... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.utils.translation.gettext_lazy"
] | [((469, 524), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(True)', 'blank': '(True)'}), '(max_length=100, null=True, blank=True)\n', (485, 524), False, 'from django.db import models\n'), ((543, 598), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)... |
import pickle
import copy
import pathlib
import dash
import math
import datetime as dt
import pandas as pd
import pydriller
pydriller.Commit
# Multi-dropdown options
from controls import COUNTIES, WELL_STATUSES, WELL_TYPES, WELL_COLORS
# Create controls
county_options = [
{"label": str(COUNTIES[county]), "value":... | [
"math.log",
"datetime.datetime"
] | [((1200, 1219), 'math.log', 'math.log', (['num', '(1000)'], {}), '(num, 1000)\n', (1208, 1219), False, 'import math\n'), ((1627, 1660), 'datetime.datetime', 'dt.datetime', (['year_slider[1]', '(1)', '(1)'], {}), '(year_slider[1], 1, 1)\n', (1638, 1660), True, 'import datetime as dt\n'), ((1553, 1586), 'datetime.datetim... |
from beneath.client import Client
from beneath.utils import ProjectIdentifier, ServiceIdentifier, TableIdentifier
from beneath.cli.utils import (
async_cmd,
mb_to_bytes,
pretty_print_graphql_result,
str2bool,
project_path_help,
service_path_help,
table_path_help,
)
def add_subparser(root):... | [
"beneath.utils.ProjectIdentifier.from_path",
"beneath.cli.utils.async_cmd",
"beneath.client.Client",
"beneath.utils.TableIdentifier.from_path",
"beneath.cli.utils.pretty_print_graphql_result",
"beneath.cli.utils.mb_to_bytes",
"beneath.utils.ServiceIdentifier.from_path"
] | [((3249, 3257), 'beneath.client.Client', 'Client', ([], {}), '()\n', (3255, 3257), False, 'from beneath.client import Client\n'), ((3267, 3313), 'beneath.utils.ProjectIdentifier.from_path', 'ProjectIdentifier.from_path', (['args.project_path'], {}), '(args.project_path)\n', (3294, 3313), False, 'from beneath.utils impo... |
import json
import unittest
from alerta.app import create_app, db, key_helper
from alerta.models.enums import Scope
from alerta.models.key import ApiKey
from alerta.models.permission import Permission
class ScopesTestCase(unittest.TestCase):
def setUp(self):
test_config = {
'TESTING': True,... | [
"alerta.models.permission.Permission.lookup",
"alerta.models.key.ApiKey",
"json.dumps",
"alerta.models.permission.Permission.is_in_scope",
"alerta.app.key_helper.type_to_scopes",
"alerta.app.db.destroy",
"alerta.app.create_app"
] | [((597, 647), 'alerta.app.create_app', 'create_app', (['test_config'], {'environment': '"""development"""'}), "(test_config, environment='development')\n", (607, 647), False, 'from alerta.app import create_app, db, key_helper\n'), ((1949, 1961), 'alerta.app.db.destroy', 'db.destroy', ([], {}), '()\n', (1959, 1961), Fal... |
'''
Implementation of SQLAlchemy backend.
'''
import sys
import threading
from oslo_config import cfg
from oslo_db import api as oslo_db_api
from oslo_db.sqlalchemy import enginefacade
from oslo_log import log as logging
from oslo_utils import timeutils
from sqlalchemy.orm import joinedload_all
from playnetmano_rm... | [
"playnetmano_rm.db.sqlalchemy.migration.db_sync",
"playnetmano_rm.common.exceptions.QuotaClassNotFound",
"oslo_db.api.wrap_db_retry",
"oslo_log.log.getLogger",
"oslo_utils.timeutils.utcnow",
"sqlalchemy.orm.joinedload_all",
"oslo_db.sqlalchemy.enginefacade.transaction_context",
"playnetmano_rm.common.... | [((506, 533), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (523, 533), True, 'from oslo_log import log as logging\n'), ((608, 625), 'threading.local', 'threading.local', ([], {}), '()\n', (623, 625), False, 'import threading\n'), ((7938, 8051), 'oslo_db.api.wrap_db_retry', 'oslo_db... |
import logging
from typing import Dict, Text, Any, List, Union, Optional
from rasa_sdk import Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormAction, REQUESTED_SLOT
from rasa_sdk.events import AllSlotsReset, SlotSet, EventType
from actions.snow import SnowAPI
import random
lo... | [
"actions.snow.SnowAPI",
"rasa_sdk.events.SlotSet",
"rasa_sdk.events.AllSlotsReset",
"logging.getLogger"
] | [((327, 354), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (344, 354), False, 'import logging\n'), ((422, 431), 'actions.snow.SnowAPI', 'SnowAPI', ([], {}), '()\n', (429, 431), False, 'from actions.snow import SnowAPI\n'), ((7294, 7309), 'rasa_sdk.events.AllSlotsReset', 'AllSlotsReset',... |
from dataclasses import dataclass, field
from typing import List, Text
from typefit import typefit
@dataclass
class Comment:
text: Text
children: List["Comment"] = field(default_factory=list)
data = {"text": "Hello", "children": [{"text": "Howdy"}, {"text": "Hello to you too"}]}
def test_forward_ref():
... | [
"dataclasses.field",
"typefit.typefit"
] | [((175, 202), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (180, 202), False, 'from dataclasses import dataclass, field\n'), ((333, 355), 'typefit.typefit', 'typefit', (['Comment', 'data'], {}), '(Comment, data)\n', (340, 355), False, 'from typefit import typefit\n')] |
import base64
import collections
import functools
import six
from six.moves import urllib
from dcos import cosmos, util
from dcos.errors import (DCOSAuthenticationException,
DCOSAuthorizationException, DCOSBadRequest,
DCOSConnectionError, DCOSException, DCOSHTTPExcept... | [
"six.moves.urllib.parse.urljoin",
"dcos.util.get_logger",
"dcos.cosmos.Cosmos",
"dcos.util.open_file",
"base64.b64decode",
"functools.wraps",
"dcos.errors.DCOSHTTPException",
"dcos.errors.DCOSException",
"dcos.util.md5_hash_file"
] | [((335, 360), 'dcos.util.get_logger', 'util.get_logger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'from dcos import cosmos, util\n'), ((590, 609), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (605, 609), False, 'import functools\n'), ((1680, 1710), 'dcos.cosmos.Cosmos', 'cosmos.Cosmos', (... |
#------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | [
"os.path.abspath",
"traits.api.Property",
"traits.api.provides",
"wx.Icon",
"wx.EmptyIcon"
] | [((934, 958), 'traits.api.provides', 'provides', (['IImageResource'], {}), '(IImageResource)\n', (942, 958), False, 'from traits.api import Any, HasTraits, List, Property, provides\n'), ((1397, 1414), 'traits.api.Property', 'Property', (['Unicode'], {}), '(Unicode)\n', (1405, 1414), False, 'from traits.api import Any, ... |
import logging
from datetime import timedelta
from core import Feed
from core.errors import ObservableValidationError
from core.observables import Ip
from core.config.config import yeti_config
class AbuseIPDB(Feed):
default_values = {
"frequency": timedelta(hours=5),
"name": "AbuseIPDB",
... | [
"core.observables.Ip.get_or_create",
"core.config.config.yeti_config.get",
"datetime.timedelta",
"logging.error"
] | [((263, 281), 'datetime.timedelta', 'timedelta', ([], {'hours': '(5)'}), '(hours=5)\n', (272, 281), False, 'from datetime import timedelta\n'), ((498, 533), 'core.config.config.yeti_config.get', 'yeti_config.get', (['"""abuseIPDB"""', '"""key"""'], {}), "('abuseIPDB', 'key')\n", (513, 533), False, 'from core.config.con... |
from urllib import parse
from django.contrib import auth
from django.contrib.auth import logout
from django.core.cache import cache
from django.shortcuts import render
# Create your views here.
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views... | [
"django.core.cache.cache.ttl",
"django.utils.decorators.method_decorator",
"ZhiQue.utils.get_redirect_uri",
"urllib.parse.urlencode",
"django.core.cache.cache.set",
"django.core.cache.cache.get",
"rest_framework.reverse.reverse",
"django.contrib.auth.logout",
"rest_framework.response.Response",
"d... | [((1065, 1095), 'django.utils.decorators.method_decorator', 'method_decorator', (['csrf_protect'], {}), '(csrf_protect)\n', (1081, 1095), False, 'from django.utils.decorators import method_decorator\n'), ((1101, 1130), 'django.utils.decorators.method_decorator', 'method_decorator', (['never_cache'], {}), '(never_cache)... |
from kafka import KafkaProducer
import requests
from json import dumps
import time
def on_message1(message):
producer1.send('ntpc', message)
producer1.flush()
producer1 = KafkaProducer(value_serializer=lambda m: dumps(m).encode("utf-8"), bootstrap_servers=['localhost:9092'])
# url for collecting NTPC compa... | [
"json.dumps",
"requests.get",
"time.sleep"
] | [((436, 453), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (448, 453), False, 'import requests\n'), ((1156, 1169), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1166, 1169), False, 'import time\n'), ((223, 231), 'json.dumps', 'dumps', (['m'], {}), '(m)\n', (228, 231), False, 'from json import dumps\... |
# -*- coding: utf-8 -*-
from brewtils.errors import ModelValidationError
from brewtils.models import Operation
from brewtils.schema_parser import SchemaParser
from beer_garden.api.http.base_handler import BaseHandler
class AdminAPI(BaseHandler):
async def patch(self):
"""
---
summary: Ini... | [
"brewtils.errors.ModelValidationError",
"brewtils.models.Operation",
"brewtils.schema_parser.SchemaParser.parse_patch"
] | [((1485, 1570), 'brewtils.schema_parser.SchemaParser.parse_patch', 'SchemaParser.parse_patch', (['self.request.decoded_body'], {'many': '(True)', 'from_string': '(True)'}), '(self.request.decoded_body, many=True, from_string=True\n )\n', (1509, 1570), False, 'from brewtils.schema_parser import SchemaParser\n'), ((20... |
# -*- coding: utf-8 -*-
import cv2, glob
import numpy as np
import pandas as pd
from os import path
from math import isnan
from sklearn.metrics.pairwise import euclidean_distances
from JPP_precision import load_JPP_ply
from Modules.utils import get_parameter, get_args, figure_disappears, enum_test_files
from Modules.f... | [
"pandas.DataFrame",
"math.isnan",
"Modules.coordinate_conversion.project_point_cloud",
"pandas.read_csv",
"JPP_precision.load_JPP_ply",
"numpy.zeros",
"numpy.ones",
"os.path.exists",
"Modules.features_labels.make_labels",
"Modules.utils.get_args",
"cv2.imread",
"numpy.where",
"numpy.array",
... | [((494, 516), 'numpy.ones', 'np.ones', (['(n_joints, 2)'], {}), '((n_joints, 2))\n', (501, 516), True, 'import numpy as np\n'), ((687, 815), 'numpy.array', 'np.array', (['(0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 5, 18, 18, 18, 18, 6, 7, 8, 9, 10, 11, 18, \n 18, 18, 18, 12, 13, 14, 15, 16, 17, 18)'], {}), '((0, 0, 0, 0, 1, 2, ... |
from dimagi.utils.parsing import string_to_boolean
from corehq.apps.custom_data_fields.models import PROFILE_SLUG
from corehq.apps.user_importer.exceptions import UserUploadError
from corehq.apps.users.audit.change_messages import UserChangeMessage
from corehq.apps.users.model_log import UserModelAction
from corehq.a... | [
"corehq.apps.user_importer.importer.find_location_id",
"corehq.apps.user_importer.importer.get_location_from_site_code",
"corehq.apps.users.audit.change_messages.UserChangeMessage.profile_info",
"corehq.apps.users.audit.change_messages.UserChangeMessage.password_reset",
"corehq.apps.users.audit.change_messa... | [((514, 538), 'dimagi.utils.parsing.string_to_boolean', 'string_to_boolean', (['value'], {}), '(value)\n', (531, 538), False, 'from dimagi.utils.parsing import string_to_boolean\n'), ((9084, 9144), 'corehq.apps.user_importer.importer.find_location_id', 'find_location_id', (['location_codes', 'domain_info.location_cache... |
import boto3
import os
import sys
import uuid
from urllib.parse import unquote_plus
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
s3_client = boto3.client('s3')
destBucket= os.environ['DEST_BUCKET']
control_key = "/"
def lambda_handler(event, context):
for record in ev... | [
"urllib.parse.unquote_plus",
"uuid.uuid4",
"logging.getLogger",
"boto3.client"
] | [((113, 132), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (130, 132), False, 'import logging\n'), ((176, 194), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (188, 194), False, 'import boto3\n'), ((398, 441), 'urllib.parse.unquote_plus', 'unquote_plus', (["record['s3']['object']['key']"... |
""" Implementation of all available options """
from __future__ import print_function
"""Model architecture/optimization options for Seq2seq architecture."""
import argparse
import logging
logger = logging.getLogger(__name__)
# Index of arguments concerning the core model architecture
MODEL_ARCHITECTURE ... | [
"argparse.Namespace",
"logging.getLogger"
] | [((209, 236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'import logging\n'), ((9999, 10031), 'argparse.Namespace', 'argparse.Namespace', ([], {}), '(**arg_values)\n', (10017, 10031), False, 'import argparse\n'), ((10813, 10843), 'argparse.Namespace', 'argparse.Name... |
from TikTokApi import TikTokApi
import json
api = TikTokApi.get_instance()
count = 1
tiktoks = api.byUsername("iamtabithabrown", count=count)
jsonString = json.dumps(tiktoks)
jsonFile = open("tiktok_example_data.json", "w")
jsonFile.write(jsonString)
jsonFile.close()
for tiktok in tiktoks:
# print(tiktok)
p... | [
"TikTokApi.TikTokApi.get_instance",
"json.dumps"
] | [((51, 75), 'TikTokApi.TikTokApi.get_instance', 'TikTokApi.get_instance', ([], {}), '()\n', (73, 75), False, 'from TikTokApi import TikTokApi\n'), ((159, 178), 'json.dumps', 'json.dumps', (['tiktoks'], {}), '(tiktoks)\n', (169, 178), False, 'import json\n')] |
# Generated by Django 3.1.7 on 2021-03-16 15:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0003_profile_dtu_email'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='roll_no',
... | [
"django.db.models.CharField"
] | [((334, 388), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(50)', 'null': '(True)'}), '(blank=True, max_length=50, null=True)\n', (350, 388), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python3
# Copyright 2017 gRPC authors.
#
# 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 ... | [
"argparse.ArgumentParser",
"subprocess.check_output",
"os.walk",
"os.path.dirname",
"operator.attrgetter",
"collections.namedtuple",
"os.path.relpath",
"collections.OrderedDict",
"os.path.join"
] | [((920, 967), 'os.path.join', 'os.path.join', (['git_root', '""".github"""', '"""CODEOWNERS"""'], {}), "(git_root, '.github', 'CODEOWNERS')\n", (932, 967), False, 'import os\n'), ((976, 1035), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Generate .github/CODEOWNERS file"""'], {}), "('Generate .github/COD... |
import os ;from equities import Universe
import random
u = Universe()
k,f,s = 'bar',(10,7),True
ciks = u.ciks
random.shuffle(ciks)
for cik in u.ciks:
c = u.company(cik)
income = c['income']
if not income.empty:
income.to_csv(os.path.join('data','income'+c['name']+'.csv'))
balance = c['bala... | [
"random.shuffle",
"os.path.join",
"equities.Universe"
] | [((60, 70), 'equities.Universe', 'Universe', ([], {}), '()\n', (68, 70), False, 'from equities import Universe\n'), ((112, 132), 'random.shuffle', 'random.shuffle', (['ciks'], {}), '(ciks)\n', (126, 132), False, 'import random\n'), ((250, 301), 'os.path.join', 'os.path.join', (['"""data"""', "('income' + c['name'] + '.... |
# Frontend
from tkinter import *
import tkinter.messagebox
import stdDatabase_Backend
class Student():
def __init__(self, root):
self.root = root
self.root.title("Akwins - Your Student Data Manager")
self.root.geometry("1350x7500+0+0")
self.root.config(bg = "#3399FF")
St... | [
"stdDatabase_Backend.deleteRec",
"stdDatabase_Backend.viewData"
] | [((1832, 1862), 'stdDatabase_Backend.viewData', 'stdDatabase_Backend.viewData', ([], {}), '()\n', (1860, 1862), False, 'import stdDatabase_Backend\n'), ((3295, 3331), 'stdDatabase_Backend.deleteRec', 'stdDatabase_Backend.deleteRec', (['sd[0]'], {}), '(sd[0])\n', (3324, 3331), False, 'import stdDatabase_Backend\n'), ((3... |
import inspect
"""
An immutable class representing a command, which is anything that has a side
effect or is asynchronous.
"""
class Cmd:
def __init__(self, performer_getter, map_functions=None, dependent=None):
# A non-async function that, when given the result from `dependent`,
# returns a function (can be asyn... | [
"inspect.isawaitable"
] | [((1265, 1301), 'inspect.isawaitable', 'inspect.isawaitable', (['maybe_awaitable'], {}), '(maybe_awaitable)\n', (1284, 1301), False, 'import inspect\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-09 16:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ejudge', '0012_auto_20170405_1555'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.TextField"
] | [((414, 442), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (430, 442), False, 'from django.db import migrations, models\n')] |
import igraph as ig
from load_data import load_data
def create_graph(data):
nodes_count = len(data['nodes'])
edges_count = len(data['links'])
Edges=[(data['links'][i]['source'], data['links'][i]['target']) for i in range(edges_count)]
return ig.Graph(Edges, directed=False)
if __name__ == "__main__":
print(crea... | [
"load_data.load_data",
"igraph.Graph"
] | [((249, 280), 'igraph.Graph', 'ig.Graph', (['Edges'], {'directed': '(False)'}), '(Edges, directed=False)\n', (257, 280), True, 'import igraph as ig\n'), ((329, 340), 'load_data.load_data', 'load_data', ([], {}), '()\n', (338, 340), False, 'from load_data import load_data\n')] |
# OpenNero will execute ModMain when this mod is loaded
from Maze.client import ClientMain
def ModMain():
ClientMain()
def StartMe():
from Maze.module import getMod
getMod().set_speedup(1.0) # full speed ahead
getMod().start_sarsa() # start an algorithm for headless mode
| [
"Maze.module.getMod",
"Maze.client.ClientMain"
] | [((111, 123), 'Maze.client.ClientMain', 'ClientMain', ([], {}), '()\n', (121, 123), False, 'from Maze.client import ClientMain\n'), ((179, 187), 'Maze.module.getMod', 'getMod', ([], {}), '()\n', (185, 187), False, 'from Maze.module import getMod\n'), ((228, 236), 'Maze.module.getMod', 'getMod', ([], {}), '()\n', (234, ... |
import os
from vitaes_parser import env
if env == 'production' or env == 'staging':
print('Building for %s environment...' % env)
print()
os.system('docker build --tag latexos latexos/')
os.system('docker build --tag webapp webapp/')
os.system('docker build --tag renderer renderer/')
os.system(... | [
"os.system"
] | [((151, 199), 'os.system', 'os.system', (['"""docker build --tag latexos latexos/"""'], {}), "('docker build --tag latexos latexos/')\n", (160, 199), False, 'import os\n'), ((204, 250), 'os.system', 'os.system', (['"""docker build --tag webapp webapp/"""'], {}), "('docker build --tag webapp webapp/')\n", (213, 250), Fa... |
import unittest
from taric_challange.core.models.book import Book
data = {"author_data" : [
{
"name": "<NAME>",
"id": "richards_rowland"
}],
"awards_text": "",
"marc_enc_level": "4",
"subject_ids": [
"mechanics_applied",
"physics"
... | [
"taric_challange.core.models.book.Book"
] | [((1147, 1157), 'taric_challange.core.models.book.Book', 'Book', (['data'], {}), '(data)\n', (1151, 1157), False, 'from taric_challange.core.models.book import Book\n')] |
# pylint: disable=missing-docstring
# pylint: disable=invalid-name
# pylint: disable=unnecessary-lambda
# pylint: disable=unused-argument
# pylint: disable=no-self-use
import textwrap
import unittest
from typing import List, Optional # pylint: disable=unused-import
import icontract
import tests.error
class TestOK(u... | [
"unittest.main",
"icontract.snapshot",
"textwrap.dedent",
"icontract.ensure"
] | [((10319, 10334), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10332, 10334), False, 'import unittest\n'), ((410, 453), 'icontract.snapshot', 'icontract.snapshot', (['(lambda : z[:])'], {'name': '"""z"""'}), "(lambda : z[:], name='z')\n", (428, 453), False, 'import icontract\n'), ((462, 515), 'icontract.ensure'... |
from pretf.blocks import output, variable
def pretf_blocks(var):
yield variable.one(default=1)
yield output.one(value=var.one)
yield variable.two(default=2)
| [
"pretf.blocks.variable.one",
"pretf.blocks.output.one",
"pretf.blocks.variable.two"
] | [((77, 100), 'pretf.blocks.variable.one', 'variable.one', ([], {'default': '(1)'}), '(default=1)\n', (89, 100), False, 'from pretf.blocks import output, variable\n'), ((111, 136), 'pretf.blocks.output.one', 'output.one', ([], {'value': 'var.one'}), '(value=var.one)\n', (121, 136), False, 'from pretf.blocks import outpu... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
x=np.arange(0,2*np.pi,0.1)
y=np.exp(x)
plt.plot(x,y)
plt.show()
| [
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((71, 99), 'numpy.arange', 'np.arange', (['(0)', '(2 * np.pi)', '(0.1)'], {}), '(0, 2 * np.pi, 0.1)\n', (80, 99), True, 'import numpy as np\n'), ((98, 107), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (104, 107), True, 'import numpy as np\n'), ((108, 122), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, ... |
"""
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
# -*- coding: utf-8 -*-
import sys
import os
import time
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from PIL import Image
import cv2
from skimage import io... | [
"argparse.ArgumentParser",
"torch.cat",
"tools.craft_utils.adjustResultCoordinates",
"models.moran.MORAN.cuda",
"torch.no_grad",
"cv2.imshow",
"models.moran.MORAN.eval",
"torch.load",
"models.craft.CRAFT",
"tools.utils.strLabelConverterForAttention",
"tools.utils.saveResult",
"tools.utils.load... | [((2591, 2650), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""CRAFT Text Detection"""'}), "(description='CRAFT Text Detection')\n", (2614, 2650), False, 'import argparse\n'), ((812, 825), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (823, 825), False, 'from collections im... |
import os
import sys
from contextlib import contextmanager
from typing import Iterator
def exists_case_sensitive(path: str) -> bool:
"""Returns if the given path exists and also matches the case on Windows.
When finding files that can be imported, it is important for the cases to match because while
file... | [
"os.listdir",
"sys.platform.startswith",
"os.getcwd",
"os.path.exists",
"os.path.split",
"os.chdir"
] | [((491, 511), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (505, 511), False, 'import os\n'), ((868, 879), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (877, 879), False, 'import os\n'), ((884, 898), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (892, 898), False, 'import os\n'), ((622, 641), 'o... |
# Author: <NAME> <<EMAIL>>
# License: Simplified BSD
from sklearn.metrics.pairwise import polynomial_kernel
from sklearn.utils.extmath import safe_sparse_dot
from scipy.sparse import issparse
import numpy as np
def safe_power(X, degree=2):
"""Element-wise power supporting both sparse and dense data.
Parame... | [
"numpy.dot",
"scipy.sparse.issparse",
"sklearn.metrics.pairwise.polynomial_kernel"
] | [((630, 641), 'scipy.sparse.issparse', 'issparse', (['X'], {}), '(X)\n', (638, 641), False, 'from scipy.sparse import issparse\n'), ((1498, 1554), 'sklearn.metrics.pairwise.polynomial_kernel', 'polynomial_kernel', (['X', 'P'], {'degree': 'degree', 'gamma': '(1)', 'coef0': '(0)'}), '(X, P, degree=degree, gamma=1, coef0=... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, DateField
from wtforms.validators import DataRequired, Email, EqualTo, ValidationError, Length
from barbearia.models import Usuario
class RegisterForm(FlaskForm):
username = StringField(label='Nome:', validators=[DataRequ... | [
"wtforms.validators.Email",
"wtforms.validators.Length",
"barbearia.models.Usuario.query.filter_by",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.DataRequired",
"wtforms.validators.ValidationError"
] | [((785, 817), 'wtforms.SubmitField', 'SubmitField', ([], {'label': '"""Criar Conta"""'}), "(label='Criar Conta')\n", (796, 817), False, 'from wtforms import StringField, PasswordField, SubmitField, DateField\n'), ((1559, 1585), 'wtforms.SubmitField', 'SubmitField', ([], {'label': '"""Entre"""'}), "(label='Entre')\n", (... |
#!/usr/bin/env python
# This Script is needed to change the frindly name in the device
import paho.mqtt.client as mqtt, sys
import time
# main
def on_connect(client, userdata, flags, rc):
print("Connected")
client.is_connected = True
def on_message(client, userdata, message):
''' note: m... | [
"paho.mqtt.client.Client",
"sys.exit",
"time.sleep"
] | [((493, 506), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (504, 506), True, 'import paho.mqtt.client as mqtt, sys\n'), ((657, 670), 'time.sleep', 'time.sleep', (['(6)'], {}), '(6)\n', (667, 670), False, 'import time\n'), ((986, 999), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (996, 999), False,... |
from typing import Union, Tuple
from screeninfo import get_monitors
RESOLUTION = [1 << 32, 1 << 32]
for monitor in get_monitors():
RESOLUTION[0] = min(RESOLUTION[0], monitor.width)
RESOLUTION[1] = min(RESOLUTION[1], monitor.height)
def get_target_size(image_size, target: Union[int, float, Tuple[int, int]] =... | [
"screeninfo.get_monitors"
] | [((117, 131), 'screeninfo.get_monitors', 'get_monitors', ([], {}), '()\n', (129, 131), False, 'from screeninfo import get_monitors\n')] |
import numpy
from noise import snoise2
from worldengine.model.world import Step
from worldengine.simulations.basic import find_threshold_f
from worldengine.simulations.hydrology import WatermapSimulation
from worldengine.simulations.irrigation import IrrigationSimulation
from worldengine.simulations.humidity import H... | [
"worldengine.simulations.basic.find_threshold_f",
"worldengine.simulations.temperature.TemperatureSimulation",
"numpy.iinfo",
"worldengine.simulations.permeability.PermeabilitySimulation",
"worldengine.simulations.biome.BiomeSimulation",
"worldengine.simulations.hydrology.WatermapSimulation",
"worldengi... | [((1152, 1165), 'worldengine.common.get_verbose', 'get_verbose', ([], {}), '()\n', (1163, 1165), False, 'from worldengine.common import anti_alias, get_verbose\n'), ((1338, 1351), 'worldengine.common.get_verbose', 'get_verbose', ([], {}), '()\n', (1349, 1351), False, 'from worldengine.common import anti_alias, get_verb... |
from django.conf.urls import url
from DPMAPI import views
urlpatterns = [
url('', views.forecast),
url('Forecast/', views.forecast)
]
| [
"django.conf.urls.url"
] | [((79, 102), 'django.conf.urls.url', 'url', (['""""""', 'views.forecast'], {}), "('', views.forecast)\n", (82, 102), False, 'from django.conf.urls import url\n'), ((108, 140), 'django.conf.urls.url', 'url', (['"""Forecast/"""', 'views.forecast'], {}), "('Forecast/', views.forecast)\n", (111, 140), False, 'from django.c... |
from raytracerchallenge_python.shape import Shape
from raytracerchallenge_python.intersection import Intersection, Intersections
from raytracerchallenge_python.tuple import Vector
from raytracerchallenge_python.helpers import EPSILON
class Cube(Shape):
def local_normal_at(self, point):
maxc = max(abs(po... | [
"raytracerchallenge_python.intersection.Intersection",
"raytracerchallenge_python.tuple.Vector",
"raytracerchallenge_python.intersection.Intersections"
] | [((409, 430), 'raytracerchallenge_python.tuple.Vector', 'Vector', (['point.x', '(0)', '(0)'], {}), '(point.x, 0, 0)\n', (415, 430), False, 'from raytracerchallenge_python.tuple import Vector\n'), ((1417, 1432), 'raytracerchallenge_python.intersection.Intersections', 'Intersections', ([], {}), '()\n', (1430, 1432), Fals... |
#!/usr/bin/env python
import copy
import numpy as np
from scipy import signal
from edrixs.photon_transition import dipole_polvec_rixs
from edrixs.utils import boltz_dist
from edrixs.rixs_utils import scattering_mat
if __name__ == "__main__":
'''
Purpose: This exampl... | [
"edrixs.photon_transition.dipole_polvec_rixs",
"numpy.abs",
"scipy.signal.fftconvolve",
"edrixs.utils.boltz_dist",
"numpy.zeros",
"numpy.transpose",
"numpy.loadtxt",
"numpy.linspace",
"numpy.exp",
"edrixs.rixs_utils.scattering_mat"
] | [((1002, 1028), 'numpy.linspace', 'np.linspace', (['om1', 'om2', 'nom'], {}), '(om1, om2, nom)\n', (1013, 1028), True, 'import numpy as np\n'), ((1087, 1117), 'numpy.linspace', 'np.linspace', (['(-0.5)', '(5.0)', 'neloss'], {}), '(-0.5, 5.0, neloss)\n', (1098, 1117), True, 'import numpy as np\n'), ((1372, 1396), 'numpy... |
from pandac.PandaModules import *
from direct.particles import ParticleEffect
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import AppRunnerGlobal
import os
class CarSmoke(NodePath):
def __init__(self, parent):
NodePath.__init__(self)
notify = DirectNotifyGlobal.directNot... | [
"os.path.expandvars",
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"direct.particles.ParticleEffect.ParticleEffect"
] | [((292, 356), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""CarSmokeParticles"""'], {}), "('CarSmokeParticles')\n", (335, 356), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((522, 553), 'direct.particles.ParticleEffect.Particle... |
from flask import (render_template, Blueprint, g, redirect, Response,
request, current_app, abort, url_for, jsonify)
from flask_babel import _
from marshmallow import Schema, fields, validates, ValidationError
from config import Config as cfg
from gcode_contour_circles import GCode_Contour_Circle
fr... | [
"app.app.url_map.bind",
"flask.Blueprint",
"json.load",
"flask.abort",
"gcode_contour_rectangles.GCode_Contour_Rectangle",
"flask.request.full_path.split",
"gcode_contour_circles.GCode_Contour_Circle",
"flask.url_for",
"gcode_contour_rectangles.GCode_Contour_RoundedRectangle",
"flask.request.full_... | [((674, 770), 'flask.Blueprint', 'Blueprint', (['"""multilingual"""', '__name__'], {'template_folder': '"""templates"""', 'url_prefix': '"""/<lang_code>"""'}), "('multilingual', __name__, template_folder='templates', url_prefix\n ='/<lang_code>')\n", (683, 770), False, 'from flask import render_template, Blueprint, ... |
print('Testing ntheory...', end='\t')
from ntheory import gcd,modinv,egcd,crt
gcd_tests = [
(1,1,1),
(1,2,1),
(2,2,2),
(2,4,2),
(3*5, 3*7, 3),
(312, 182, 26)
]
for (a,b,d) in gcd_tests :
assert gcd(a,b) == d
x,y,d = egcd(a,b)
assert x*a + y*b == d
modinv_tests = [
(2,5), # 2*3... | [
"ntheory.egcd",
"ntheory.gcd",
"ntheory.crt",
"ntheory.modinv"
] | [((250, 260), 'ntheory.egcd', 'egcd', (['a', 'b'], {}), '(a, b)\n', (254, 260), False, 'from ntheory import gcd, modinv, egcd, crt\n'), ((485, 497), 'ntheory.modinv', 'modinv', (['a', 'm'], {}), '(a, m)\n', (491, 497), False, 'from ntheory import gcd, modinv, egcd, crt\n'), ((735, 746), 'ntheory.crt', 'crt', (['xs', 'p... |
# -*- coding:utf-8 -*-
# author:huawei
from python2sky.context.context_carrier import ContextCarrier
from tests.base_test_case import BaseTestCase
class TestContextCarrier(BaseTestCase):
def test_serialize(self):
self.assertEqual(self.SW6, self.context_carrier.serialize())
def test_deserialize(self... | [
"python2sky.context.context_carrier.ContextCarrier"
] | [((365, 381), 'python2sky.context.context_carrier.ContextCarrier', 'ContextCarrier', ([], {}), '()\n', (379, 381), False, 'from python2sky.context.context_carrier import ContextCarrier\n')] |
import fire
def main(input_file: str = "input.txt") -> None:
with open(input_file) as f:
data = [int(x) for x in f.read().splitlines()]
count = sum(cur > prev for prev, cur in zip(data[:-1], data[1:]))
print(count)
if __name__ == "__main__":
fire.Fire(main)
| [
"fire.Fire"
] | [((272, 287), 'fire.Fire', 'fire.Fire', (['main'], {}), '(main)\n', (281, 287), False, 'import fire\n')] |
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you 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/... | [
"unittest.main",
"PySiddhi4.DataTypes.LongType.LongType",
"logging.basicConfig",
"time.sleep",
"PySiddhi4.core.SiddhiManager.SiddhiManager",
"logging.info",
"PySiddhi4.core.util.EventPrinter.PrintEvent"
] | [((947, 986), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (966, 986), False, 'import logging\n'), ((3399, 3414), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3412, 3414), False, 'import unittest\n'), ((1109, 1124), 'PySiddhi4.core.SiddhiManager.Siddhi... |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | [
"operator.attrgetter",
"itertools.chain"
] | [((2936, 2971), 'itertools.chain', 'chain', (['self.keywords', 'self.messages'], {}), '(self.keywords, self.messages)\n', (2941, 2971), False, 'from itertools import chain\n'), ((2999, 3022), 'operator.attrgetter', 'attrgetter', (['"""_sort_key"""'], {}), "('_sort_key')\n", (3009, 3022), False, 'from operator import at... |
from datetime import datetime, timezone, date, time, timedelta
from fastapi.testclient import TestClient
from humtemp.main import app
from humtemp.database import connection, connect
client = TestClient(app)
def setup_function():
connect(host='localhost')
connection.flushdb()
def test_calculation():
... | [
"datetime.date.today",
"humtemp.database.connect",
"fastapi.testclient.TestClient",
"datetime.timedelta",
"humtemp.database.connection.flushdb"
] | [((195, 210), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (205, 210), False, 'from fastapi.testclient import TestClient\n'), ((239, 264), 'humtemp.database.connect', 'connect', ([], {'host': '"""localhost"""'}), "(host='localhost')\n", (246, 264), False, 'from humtemp.database import connec... |
# This script gets quality metrics for the outputs.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from covid_bronx.quality import fasta_files, sam_files
from covid_bronx.quality.gaps import *
primer_binding_sites = "data/external/amplicon_binding_sites.csv"
for sample_... | [
"covid_bronx.quality.fasta_files.keys"
] | [((331, 349), 'covid_bronx.quality.fasta_files.keys', 'fasta_files.keys', ([], {}), '()\n', (347, 349), False, 'from covid_bronx.quality import fasta_files, sam_files\n')] |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from torch.utils.data import DataLoader
from torch.autograd import Variable
import math, random, sys
import numpy as np
import pandas as pd
import argparse
from collections import deque
import pickle as pickl... | [
"torch.load",
"pandas.DataFrame.from_dict"
] | [((1380, 1427), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['results'], {'orient': '"""index"""'}), "(results, orient='index')\n", (1402, 1427), True, 'import pandas as pd\n'), ((562, 606), 'torch.load', 'torch.load', (['"""vae_model/model.iter-8000-04kl"""'], {}), "('vae_model/model.iter-8000-04kl')\n", ... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | [
"os.path.abspath",
"piccolo.__VERSION__.split",
"datetime.datetime.now"
] | [((621, 645), 'os.path.abspath', 'os.path.abspath', (['"""../.."""'], {}), "('../..')\n", (636, 645), False, 'import os\n'), ((735, 758), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (756, 758), False, 'import datetime\n'), ((895, 925), 'piccolo.__VERSION__.split', 'piccolo.__VERSION__.split', ([... |
import time
import sys
import json
import primality.miller_rabin as mr
import primality.solovay_strassen as ss
import prng.blum_blum_shub as bbs
import prng.mersenne_twister as mt
# Parameter
seed = 27
keys_sizes = [40, 56, 80, 128, 168, 224, 256, 512, 1024, 2048, 4096]
def test_simple_primality():
print("----... | [
"sys.stdout.write",
"prng.blum_blum_shub.set_seed",
"primality.miller_rabin.is_prob_prime",
"time.time",
"prng.mersenne_twister.set_seed",
"sys.stdout.flush",
"prng.mersenne_twister.set_as_mt19937_64",
"primality.solovay_strassen.is_prob_prime"
] | [((1550, 1566), 'prng.blum_blum_shub.set_seed', 'bbs.set_seed', (['(23)'], {}), '(23)\n', (1562, 1566), True, 'import prng.blum_blum_shub as bbs\n'), ((1571, 1593), 'prng.mersenne_twister.set_as_mt19937_64', 'mt.set_as_mt19937_64', ([], {}), '()\n', (1591, 1593), True, 'import prng.mersenne_twister as mt\n'), ((1598, 1... |
# encoding: utf-8
# Standard Library
import json
from typing import Any
from typing import Dict
from typing import List
from typing import Union
from typing import Optional
from typing import NoReturn
# 3rd Party Library
from requests import Response
# Current Folder
from .exception import ColumnException
from .exce... | [
"bktools.framework.google.session.execute",
"json.loads"
] | [((2540, 2663), 'bktools.framework.google.session.execute', 'session.execute', (['"""sheet"""', '"""get"""', '"""general"""', 'self.__spreadsheet'], {'params': "{'ranges': self.title, 'includeGridData': True}"}), "('sheet', 'get', 'general', self.__spreadsheet, params={\n 'ranges': self.title, 'includeGridData': Tru... |
from unittest import TestCase
from pbx_gs_python_utils.utils.Dev import Dev
from pbx_gs_python_utils.utils.Misc import Misc
from osbot_jupyter.api.Jupyter_Kernel import Jupyter_Kernel
from osbot_jupyter.helpers.Test_Server import Test_Server
class test_Jupyter_Session(TestCase):
def setUp(self):
self.n... | [
"pbx_gs_python_utils.utils.Dev.Dev.pprint",
"osbot_jupyter.helpers.Test_Server.Test_Server",
"pbx_gs_python_utils.utils.Misc.Misc.random_string_and_numbers"
] | [((1179, 1211), 'pbx_gs_python_utils.utils.Misc.Misc.random_string_and_numbers', 'Misc.random_string_and_numbers', ([], {}), '()\n', (1209, 1211), False, 'from pbx_gs_python_utils.utils.Misc import Misc\n'), ((631, 654), 'pbx_gs_python_utils.utils.Dev.Dev.pprint', 'Dev.pprint', (['self.result'], {}), '(self.result)\n',... |
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... | [
"torch.no_grad"
] | [((1001, 1016), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1014, 1016), False, 'import torch\n')] |
#!/usr/bin/python
import sys, os, argparse, re, json
from multiprocessing import Pool, cpu_count
from subprocess import Popen, PIPE
from signal import signal, SIGINT, SIG_IGN
#from Canvas import Line
DESCRIPTION="""
A utility to help parse results from the tgen traffic generator.
This script enables processing of tg... | [
"json.dump",
"subprocess.Popen",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.getcwd",
"os.path.basename",
"os.walk",
"argparse.ArgumentTypeError",
"os.path.exists",
"re.search",
"multiprocessing.Pool",
"signal.signal",
"os.path.expanduser",
"sys.exit",
"multiprocessin... | [((1309, 1409), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESCRIPTION', 'formatter_class': 'argparse.RawTextHelpFormatter'}), '(description=DESCRIPTION, formatter_class=argparse.\n RawTextHelpFormatter)\n', (1332, 1409), False, 'import sys, os, argparse, re, json\n'), ((3231, 3252),... |
from django import forms
from .models import Quizark
from random import randint
def random_user():
adj = ["kul", "teit", "rar", "gul", "glittrende"]
sub = ["pølse", "ku", "gris", "ape", "sykkel", "sko", "esel"]
return adj[randint(0, len(adj)-1)].capitalize() + sub[randint(0, len(sub)-1)].capitalize()
clas... | [
"django.forms.CharField",
"django.forms.IntegerField"
] | [((382, 452), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'label': '"""Kode: """', 'min_value': '(100000)', 'max_value': '(999999)'}), "(label='Kode: ', min_value=100000, max_value=999999)\n", (400, 452), False, 'from django import forms\n'), ((468, 538), 'django.forms.CharField', 'forms.CharField', ([], {... |
from datetime import datetime
import json
import os
from openpyxl import Workbook
from openpyxl.styles import Font
import re
import requests
import time
def timer(func):
"""
Print the runtime of the decorated function
:param func: function that we want to be timed
:return: value of function, but print... | [
"openpyxl.Workbook",
"datetime.datetime.today",
"openpyxl.styles.Font",
"time.sleep",
"time.time",
"requests.get",
"functools.wraps",
"re.sub",
"os.getenv"
] | [((404, 425), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (419, 425), False, 'import functools\n'), ((1347, 1369), 'os.getenv', 'os.getenv', (['"""USER_NAME"""'], {}), "('USER_NAME')\n", (1356, 1369), False, 'import os\n'), ((1382, 1408), 'os.getenv', 'os.getenv', (['"""DISCOGS_TOKEN"""'], {}), "(... |
'''
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Array/quality_mosaic.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank" hre... | [
"ee.ImageCollection",
"ee.Initialize",
"folium.Map"
] | [((2130, 2145), 'ee.Initialize', 'ee.Initialize', ([], {}), '()\n', (2143, 2145), False, 'import ee\n'), ((2503, 2548), 'folium.Map', 'folium.Map', ([], {'location': '[40, -100]', 'zoom_start': '(4)'}), '(location=[40, -100], zoom_start=4)\n', (2513, 2548), False, 'import folium\n'), ((4265, 4306), 'ee.ImageCollection'... |
# -*- coding: utf-8 -*-
import io
import os
import shutil
import itertools
import gzip
import warnings
import tempfile
import atexit
import zarr
import h5py
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from pytest import approx
from allel.io.vcf_read import ... | [
"atexit.register",
"numpy.load",
"os.remove",
"pandas.read_csv",
"numpy.isnan",
"allel.io.vcf_read.read_vcf",
"allel.io.vcf_read.vcf_to_dataframe",
"shutil.rmtree",
"numpy.testing.assert_array_almost_equal",
"os.path.join",
"zarr.open_group",
"allel.io.vcf_read.vcf_to_csv",
"allel.io.vcf_rea... | [((617, 641), 'warnings.resetwarnings', 'warnings.resetwarnings', ([], {}), '()\n', (639, 641), False, 'import warnings\n'), ((642, 673), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""'], {}), "('always')\n", (663, 673), False, 'import warnings\n'), ((715, 733), 'tempfile.mkdtemp', 'tempfile.mkdtemp'... |
# -*- coding: utf-8 -*-
import os
import unittest
from datetime import datetime
from AbstractHandle.Utils.TokenCache import TokenCache
class TokenCacheTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.token = os.environ.get('KB_AUTH_TOKEN', None)
CACHE_EXPIRE_TIME = 300
... | [
"os.environ.get",
"datetime.datetime.utcnow",
"AbstractHandle.Utils.TokenCache.TokenCache"
] | [((242, 279), 'os.environ.get', 'os.environ.get', (['"""KB_AUTH_TOKEN"""', 'None'], {}), "('KB_AUTH_TOKEN', None)\n", (256, 279), False, 'import os\n'), ((338, 373), 'AbstractHandle.Utils.TokenCache.TokenCache', 'TokenCache', (['(1000)', 'CACHE_EXPIRE_TIME'], {}), '(1000, CACHE_EXPIRE_TIME)\n', (348, 373), False, 'from... |
import os
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.test import TestCase
from ralph.accounts.models import Region
from ralph.assets.models.assets import (
AssetModel,
Environment,
Service,
Se... | [
"ralph.assets.models.assets.ServiceEnvironment",
"ralph.accounts.models.Region.objects.get",
"ralph.assets.models.assets.AssetModel",
"os.path.join",
"os.path.abspath",
"ralph.data_importer.models.ImportedObjects.objects.filter",
"ralph.back_office.models.Warehouse",
"django.core.management.call_comma... | [((1017, 1029), 'ralph.assets.models.assets.AssetModel', 'AssetModel', ([], {}), '()\n', (1027, 1029), False, 'from ralph.assets.models.assets import AssetModel, Environment, Service, ServiceEnvironment\n'), ((1184, 1229), 'django.contrib.contenttypes.models.ContentType.objects.get_for_model', 'ContentType.objects.get_... |
import torch
import torch.nn as nn
class VGG16(nn.Module):
def __init__(self, input_shape: tuple, output_dim: int):
super().__init__()
fc_dim = int((input_shape[1] * 0.5**5) *
(input_shape[2] * 0.5 ** 5) * 512)
self.maxpool = nn.MaxPool2d((2, 2), 2)
self.relu =... | [
"torch.flatten",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.functional.softmax",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | [((277, 300), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2, 2)', '(2)'], {}), '((2, 2), 2)\n', (289, 300), True, 'import torch.nn as nn\n'), ((321, 330), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (328, 330), True, 'import torch.nn as nn\n'), ((355, 415), 'torch.nn.Conv2d', 'nn.Conv2d', (['input_shape[0]', '(64)'], {... |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"arch.api.utils.log_utils.getLogger",
"json.loads",
"federatedml.nn.hetero_nn.model.hetero_nn_bottom_model.HeteroNNBottomModel",
"federatedml.nn.hetero_nn.model.hetero_nn_top_model.HeteroNNTopModel",
"federatedml.nn.hetero_nn.model.interactive_layer.InterActiveGuestDenseLayer",
"federatedml.protobuf.gener... | [((1557, 1578), 'arch.api.utils.log_utils.getLogger', 'log_utils.getLogger', ([], {}), '()\n', (1576, 1578), False, 'from arch.api.utils import log_utils\n'), ((2357, 2410), 'federatedml.nn.homo_nn.nn_model.get_nn_builder', 'nn_model.get_nn_builder', ([], {'config_type': 'self.config_type'}), '(config_type=self.config_... |
#!/usr/bin/env python
import urllib2
import zipfile
import os
import sys
import shutil
import fnmatch
import json
import tempfile
import re
import subprocess
import requests
import urlparse
import hashlib
import yaml
from argparse import ArgumentParser
from contextlib import contextmanager
import lunr
from lunr import... | [
"os.mkdir",
"os.remove",
"argparse.ArgumentParser",
"os.walk",
"json.dumps",
"shutil.rmtree",
"os.path.join",
"urllib2.urlopen",
"os.path.dirname",
"os.path.exists",
"tempfile.mkdtemp",
"requests.get",
"markdown.Markdown",
"shutil.copyfile",
"re.sub",
"json.dump",
"hashlib.md5",
"o... | [((655, 695), 'os.path.join', 'os.path.join', (['"""_data"""', '"""assetindex.json"""'], {}), "('_data', 'assetindex.json')\n", (667, 695), False, 'import os\n'), ((709, 744), 'os.path.join', 'os.path.join', (['"""_data"""', '"""games.json"""'], {}), "('_data', 'games.json')\n", (721, 744), False, 'import os\n'), ((764... |
from itertools import combinations
import sys
def func(arr):
answer = []
for i in arr:
if sum(i) - max(i) > max(i):
if len(answer) == 0:
answer += i
elif sum(answer) < sum(i):
answer = i
if len(answer) == 0:
return "-1"
else:
... | [
"itertools.combinations",
"sys.stdin.readline"
] | [((443, 465), 'itertools.combinations', 'combinations', (['array', '(3)'], {}), '(array, 3)\n', (455, 465), False, 'from itertools import combinations\n'), ((406, 426), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (424, 426), False, 'import sys\n')] |
import discord
from discord.ext import commands
from discord.ext.commands.context import Context
from discord.commands import slash_command
from discord.commands import Option
class SlashExample(commands.Cog):
def __init__(self, bot):
self.bot = bot
@slash_command(
guild_ids=[...]... | [
"discord.commands.slash_command"
] | [((281, 374), 'discord.commands.slash_command', 'slash_command', ([], {'guild_ids': '[...]', 'name': '"""ping"""', 'description': '"""check the latency of the bot!"""'}), "(guild_ids=[...], name='ping', description=\n 'check the latency of the bot!')\n", (294, 374), False, 'from discord.commands import slash_command... |
from torch import nn
from torchvision.models import MobileNetV2
class MobileNetV2Encoder(MobileNetV2):
"""
MobileNetV2Encoder inherits from torchvision's official MobileNetV2. It is modified to
use dilation on the last block to maintain output stride 16, and deleted the
classifier block that was origi... | [
"torch.nn.Conv2d"
] | [((682, 729), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', '(32)', '(3)', '(2)', '(1)'], {'bias': '(False)'}), '(in_channels, 32, 3, 2, 1, bias=False)\n', (691, 729), False, 'from torch import nn\n')] |
import requests
import threading
from multiprocessing.pool import ThreadPool
import time
import sys
URL = "http://192.168.219.158:80/facerec"
webcamStreamURL="192.168.219.142:8090/?action=snapshot"
def faceAuthRequest(requestParams,retJson):
res = requests.get(URL,params=requestParams,timeout=20)
res.status_code
re... | [
"threading.Thread",
"sys.exit",
"requests.get"
] | [((250, 301), 'requests.get', 'requests.get', (['URL'], {'params': 'requestParams', 'timeout': '(20)'}), '(URL, params=requestParams, timeout=20)\n', (262, 301), False, 'import requests\n'), ((476, 544), 'threading.Thread', 'threading.Thread', ([], {'target': 'faceAuthRequest', 'args': '(jsonParams, retJson)'}), '(targ... |
"""
Tests module image_io
# Author: <NAME>
# $Id:$
"""
from __future__ import unicode_literals
from __future__ import print_function
__version__ = "$Revision:$"
from copy import copy, deepcopy
import pickle
import os.path
import unittest
import numpy
import numpy.testing as np_test
import scipy
from pyto.io.ima... | [
"unittest.TextTestRunner",
"numpy.testing.assert_almost_equal",
"numpy.dtype",
"pyto.io.image_io.ImageIO",
"numpy.array",
"unittest.TestLoader",
"numpy.testing.assert_equal",
"numpy.arange"
] | [((928, 937), 'pyto.io.image_io.ImageIO', 'ImageIO', ([], {}), '()\n', (935, 937), False, 'from pyto.io.image_io import ImageIO\n'), ((1170, 1179), 'pyto.io.image_io.ImageIO', 'ImageIO', ([], {}), '()\n', (1177, 1179), False, 'from pyto.io.image_io import ImageIO\n'), ((1256, 1354), 'numpy.array', 'numpy.array', (['[[-... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from sam.models import Tag, Post, SiteImage
from django.core.cache import cache
from django.db.models import Q
def education(request):
education = cache.get("education")
if not education:
tag = Tag.objects.filte... | [
"sam.models.SiteImage.objects.get",
"django.core.cache.cache.set",
"django.db.models.Q",
"django.core.cache.cache.get",
"django.template.RequestContext",
"sam.models.Tag.objects.filter",
"sam.models.Post.objects.filter"
] | [((244, 266), 'django.core.cache.cache.get', 'cache.get', (['"""education"""'], {}), "('education')\n", (253, 266), False, 'from django.core.cache import cache\n'), ((303, 342), 'sam.models.Tag.objects.filter', 'Tag.objects.filter', ([], {'tag': '"""top_education"""'}), "(tag='top_education')\n", (321, 342), False, 'fr... |
#
# imitation_frames.py, doom-net
#
# Created by <NAME> on 01/21/17.
#
import os
import time
import h5py
import torch
import torch.nn as nn
import torch.optim as optim
from device import device
import argparse
from doom_instance import *
from aac import BaseModel
def data_generator(args, screens, variables, labels, e... | [
"h5py.File",
"argparse.ArgumentParser",
"torch.load",
"torch.nn.CrossEntropyLoss",
"time.time",
"torch.save",
"os.path.isfile",
"os.path.expanduser",
"torch.from_numpy"
] | [((1973, 2001), 'h5py.File', 'h5py.File', (['args.h5_path', '"""r"""'], {}), "(args.h5_path, 'r')\n", (1982, 2001), False, 'import h5py\n'), ((2802, 2823), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (2821, 2823), True, 'import torch.nn as nn\n'), ((2970, 2981), 'time.time', 'time.time', ([], ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 The HERA Collaboration
# Licensed under the 2-clause BSD License
"""
Setup file for bda_utils.
"""
import os
import glob
from setuptools import setup, find_packages
setup_args = {
"name": "bda_utils",
"author": "The HERA Collaboration",
"url": "https://github.... | [
"os.path.isdir",
"setuptools.setup",
"glob.glob"
] | [((738, 757), 'setuptools.setup', 'setup', ([], {}), '(**setup_args)\n', (743, 757), False, 'from setuptools import setup, find_packages\n'), ((519, 541), 'glob.glob', 'glob.glob', (['"""scripts/*"""'], {}), "('scripts/*')\n", (528, 541), False, 'import glob\n'), ((549, 566), 'os.path.isdir', 'os.path.isdir', (['fl'], ... |
import networkx as nx
import numpy as np
import pickle
G = nx.Graph()
node1, node2 = np.loadtxt(graph_input, usecols=(0,1), unpack=True)
for i in range(len(node1)):
G.add_edge(node1[i], node2[i])
graph_num_node = G.number_of_nodes()
print(f"This graph contains {graph_num_node} nodes. ")
graph_num_edge = G.numbe... | [
"networkx.set_node_attributes",
"networkx.betweenness_centrality",
"numpy.column_stack",
"networkx.Graph",
"numpy.loadtxt",
"numpy.array",
"networkx.get_node_attributes"
] | [((60, 70), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (68, 70), True, 'import networkx as nx\n'), ((86, 138), 'numpy.loadtxt', 'np.loadtxt', (['graph_input'], {'usecols': '(0, 1)', 'unpack': '(True)'}), '(graph_input, usecols=(0, 1), unpack=True)\n', (96, 138), True, 'import numpy as np\n'), ((408, 436), 'network... |
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import asyncio
from pycquery_krb.protocol.asn1_structs import KerberosResponse
from pycquery_krb.common.constants import KerberosSocketType
from asysocks.client import SOCKSClient
from asysocks.common.comms import SocksQueueComms
class AIOKerberosClientSocks... | [
"pycquery_krb.protocol.asn1_structs.KerberosResponse.load",
"asysocks.client.SOCKSClient",
"asyncio.Queue",
"asysocks.common.comms.SocksQueueComms"
] | [((615, 630), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (628, 630), False, 'import asyncio\n'), ((649, 664), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (662, 664), False, 'import asyncio\n'), ((675, 721), 'asysocks.common.comms.SocksQueueComms', 'SocksQueueComms', (['self.out_queue', 'self.in_queue']... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from pickle import dumps, load, loads
class PyMimeData(QMimeData):
"""
The PyMimeData wraps a Python instance as MIME data.
"""
# The MIME type for instances.
MIME_TYPE = 'application/x-ets-qt4-instance'
def __init__(self, data... | [
"pickle.load",
"pickle.dumps"
] | [((645, 656), 'pickle.dumps', 'dumps', (['data'], {}), '(data)\n', (650, 656), False, 'from pickle import dumps, load, loads\n'), ((1739, 1747), 'pickle.load', 'load', (['io'], {}), '(io)\n', (1743, 1747), False, 'from pickle import dumps, load, loads\n'), ((1807, 1815), 'pickle.load', 'load', (['io'], {}), '(io)\n', (... |
# Generated by Django 2.0.5 on 2018-09-01 12:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('abyssal_modules', '0002_remove_ownershiprecord'),
]
operations = [
migrations.RemoveField(
mode... | [
"django.db.models.ManyToManyField",
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((280, 346), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""moduletype"""', 'name': '"""attributes"""'}), "(model_name='moduletype', name='attributes')\n", (302, 346), False, 'from django.db import migrations, models\n'), ((1052, 1204), 'django.db.models.ManyToManyField', 'models... |
import komand
import dumbno
from .schema import ConnectionSchema
# Custom imports below
class Connection(komand.Connection):
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
def connect(self, params={}):
self.host = params.get("host")
self.port = par... | [
"dumbno.ACLClient"
] | [((364, 407), 'dumbno.ACLClient', 'dumbno.ACLClient', (['self.host'], {'port': 'self.port'}), '(self.host, port=self.port)\n', (380, 407), False, 'import dumbno\n')] |
#
# Copyright (c) 2019 UCT Prague.
#
# propertyvalue_acls.py is part of Invenio Explicit ACLs
# (see https://github.com/oarepo/invenio-explicit-acls).
#
# 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 ... | [
"logging.getLogger",
"invenio_db.db.String",
"invenio_db.db.relationship",
"invenio_db.db.backref",
"invenio_db.db.ForeignKey"
] | [((1557, 1584), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1574, 1584), False, 'import logging\n'), ((2733, 2802), 'invenio_db.db.relationship', 'db.relationship', (['"""PropertyValueACL"""'], {'back_populates': '"""property_values"""'}), "('PropertyValueACL', back_populates='propert... |
"""
Misc helper function
"""
from django.utils.translation import ugettext as _
def to_set(obj):
"""
Converts an object to a set if it isn't already
"""
if obj is None:
return set()
if isinstance(obj, set):
return obj
if not hasattr(obj, '__iter__') or isi... | [
"django.utils.translation.ugettext"
] | [((822, 843), 'django.utils.translation.ugettext', '_', (['"""%s and %d others"""'], {}), "('%s and %d others')\n", (823, 843), True, 'from django.utils.translation import ugettext as _\n'), ((654, 664), 'django.utils.translation.ugettext', '_', (['""" and """'], {}), "(' and ')\n", (655, 664), True, 'from django.utils... |
# Copyright 2020-present <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 ... | [
"asyncio.gather",
"discord.ext.commands.command",
"asyncio.sleep",
"contextlib.suppress",
"datetime.datetime.utcnow",
"random.randrange",
"discord.ext.commands.group",
"discord.ext.commands.guild_only",
"fractions.Fraction",
"logging.getLogger",
"discord.ext.commands.CheckFailure"
] | [((1067, 1116), 'logging.getLogger', 'logging.getLogger', (['"""salamander.contrib_exts.qotw"""'], {}), "('salamander.contrib_exts.qotw')\n", (1084, 1116), False, 'import logging\n'), ((8070, 8091), 'discord.ext.commands.guild_only', 'commands.guild_only', ([], {}), '()\n', (8089, 8091), False, 'from discord.ext import... |