code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from argparse import Namespace
from io import StringIO
from pathlib import Path
import shutil
import sys
import tempfile
from types import SimpleNamespace
import unittest
from .helpers import create_migration
import migrator
class TestMigrateEnvironmentUp(unittest.TestCase):
def setUp(self):
self.stdout =... | [
"pathlib.Path",
"types.SimpleNamespace",
"migrator.db.Database",
"tempfile.mkdtemp",
"argparse.Namespace",
"shutil.rmtree",
"unittest.main",
"sys.stdout.getvalue",
"io.StringIO",
"migrator.main.migrate_environment"
] | [((13280, 13295), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13293, 13295), False, 'import unittest\n'), ((353, 363), 'io.StringIO', 'StringIO', ([], {}), '()\n', (361, 363), False, 'from io import StringIO\n'), ((383, 401), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (399, 401), False, 'import ... |
import json
import django_rq
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.generics import ListAPIView, GenericAPIView
from rest_framework.mixins import RetrieveModelMixin
from rest_framework.response import Response
from src.clustering.models import Clustering
f... | [
"src.jobs.job_creator.generate",
"src.jobs.job_creator.update",
"src.encoding.models.Encoding.objects.all",
"src.encoding.common.retrieve_proper_encoder",
"src.clustering.models.Clustering.objects.all",
"src.jobs.job_creator.generate_labelling",
"src.predictive_model.models.PredictiveModel.objects.all",... | [((7620, 7638), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (7628, 7638), False, 'from rest_framework.decorators import api_view\n'), ((8827, 8844), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (8835, 8844), False, 'from rest_framework.dec... |
import os
from restapi.connectors import sqlalchemy
from restapi.services.authentication import Role
from restapi.utilities.logs import log
from restapi.utilities.uuid import getUUID
class Initializer:
def __init__(self):
sql = sqlalchemy.get_instance()
if sql is None:
log.critical(... | [
"restapi.utilities.logs.log.info",
"restapi.utilities.logs.log.warning",
"os.getenv",
"restapi.utilities.uuid.getUUID",
"restapi.connectors.sqlalchemy.get_instance",
"restapi.utilities.logs.log.critical"
] | [((244, 269), 'restapi.connectors.sqlalchemy.get_instance', 'sqlalchemy.get_instance', ([], {}), '()\n', (267, 269), False, 'from restapi.connectors import sqlalchemy\n'), ((397, 434), 'os.getenv', 'os.getenv', (['"""SEADATA_PRIVILEGED_USERS"""'], {}), "('SEADATA_PRIVILEGED_USERS')\n", (406, 434), False, 'import os\n')... |
# !/usr/bin/python
# coding: utf_8
""" Authenticate your Google APIs """
import os
import httplib2
from googleapiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
class GoogleApiOAuth(object):
def __init__(self, scope, app_name, app_se... | [
"oauth2client.client.flow_from_clientsecrets",
"os.path.dirname",
"oauth2client.file.Storage",
"httplib2.Http",
"oauth2client.tools.run_flow"
] | [((900, 930), 'oauth2client.file.Storage', 'Storage', (['user_credentials_path'], {}), '(user_credentials_path)\n', (907, 930), False, 'from oauth2client.file import Storage\n'), ((1096, 1156), 'oauth2client.client.flow_from_clientsecrets', 'client.flow_from_clientsecrets', (['self.app_secrets', 'self.scope'], {}), '(s... |
from functools import partial
from tsfresh.feature_extraction.extraction import _do_extraction_on_chunk
from tsfresh.feature_extraction.settings import ComprehensiveFCParameters
import pandas as pd
def _feature_extraction_on_chunk_helper(df, column_id, column_kind,
column_sor... | [
"tsfresh.feature_extraction.settings.ComprehensiveFCParameters",
"pyspark.sql.functions.pandas_udf",
"functools.partial",
"pandas.DataFrame",
"tsfresh.feature_extraction.extraction._do_extraction_on_chunk"
] | [((1088, 1212), 'tsfresh.feature_extraction.extraction._do_extraction_on_chunk', '_do_extraction_on_chunk', (['chunk'], {'default_fc_parameters': 'default_fc_parameters', 'kind_to_fc_parameters': 'kind_to_fc_parameters'}), '(chunk, default_fc_parameters=default_fc_parameters,\n kind_to_fc_parameters=kind_to_fc_param... |
import pylab as plt
import matplotlib
import numpy as np
import pylab as plt
import matplotlib
from itertools import product
import numpy as np
import pandas as pd
import os
from sklearn.metrics.pairwise import pairwise_distances
from matplotlib.ticker import ScalarFormatter, FuncFormatter
matplotlib.style.use('bmh')... | [
"numpy.log10",
"numpy.log",
"sklearn.metrics.pairwise.pairwise_distances",
"numpy.array",
"matplotlib.style.use",
"matplotlib.ticker.ScalarFormatter",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.arange",
"matplotlib.ticker.FuncFormatter",
"itertools.product",
"numpy.max",
"numpy.linspace",
... | [((293, 320), 'matplotlib.style.use', 'matplotlib.style.use', (['"""bmh"""'], {}), "('bmh')\n", (313, 320), False, 'import matplotlib\n'), ((15378, 15401), 'pylab.tight_layout', 'plt.tight_layout', ([], {'pad': '(0)'}), '(pad=0)\n', (15394, 15401), True, 'import pylab as plt\n'), ((15679, 15706), 'numpy.zeros', 'np.zer... |
import time
import copy
import numpy as np
from functools import reduce
from operator import indexOf, iconcat
from sysidentpy.utils.display_results import results
from sysidentpy.model_structure_selection import FROLS
def narmax_state_space(nx_model:FROLS, X_train, X_test, states_names):
xlag = nx_model.xlag if ... | [
"operator.indexOf",
"sysidentpy.utils.display_results.results",
"numpy.hstack",
"functools.reduce",
"numpy.delete",
"numpy.sort",
"numpy.zeros",
"numpy.vstack",
"copy.deepcopy",
"time.time"
] | [((1651, 1668), 'numpy.vstack', 'np.vstack', (['coeffs'], {}), '(coeffs)\n', (1660, 1668), True, 'import numpy as np\n'), ((1718, 1732), 'numpy.hstack', 'np.hstack', (['sim'], {}), '(sim)\n', (1727, 1732), True, 'import numpy as np\n'), ((581, 604), 'copy.deepcopy', 'copy.deepcopy', (['nx_model'], {}), '(nx_model)\n', ... |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
import uuid
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
from c7n_azure.utils import StringUtils, PortsRangeHelper
from azure.core.exceptions import AzureError
from c7n_azur... | [
"logging.getLogger",
"c7n_azure.utils.ThreadHelper.execute_in_parallel",
"c7n_azure.provider.resources.register",
"c7n.filters.core.PolicyValidationError",
"c7n_azure.utils.StringUtils.equal",
"c7n_azure.utils.PortsRangeHelper.get_ports_strings_from_list",
"c7n_azure.utils.PortsRangeHelper.validate_port... | [((530, 589), 'logging.getLogger', 'logging.getLogger', (['"""custodian.azure.network_security_group"""'], {}), "('custodian.azure.network_security_group')\n", (547, 589), False, 'import logging\n'), ((593, 635), 'c7n_azure.provider.resources.register', 'resources.register', (['"""networksecuritygroup"""'], {}), "('net... |
import os
import random, string
class Config(object):
CSRF_ENABLED = True
SECRET = '<KEY>'
TEMPLATE_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
APP = None
SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://root:lea... | [
"os.path.abspath",
"os.getenv"
] | [((1021, 1043), 'os.getenv', 'os.getenv', (['"""FLASK_ENV"""'], {}), "('FLASK_ENV')\n", (1030, 1043), False, 'import os\n'), ((223, 248), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (238, 248), False, 'import os\n'), ((151, 176), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Softbank Robotics Europe
# 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, t... | [
"strong_typing.ObjectDisplayWidget"
] | [((3315, 3336), 'strong_typing.ObjectDisplayWidget', 'ObjectDisplayWidget', ([], {}), '()\n', (3334, 3336), False, 'from strong_typing import ObjectDisplayWidget\n')] |
from honeybee_schema.energy.programtype import ProgramTypeAbridged
import os
# target folder where all of the samples live
root = os.path.dirname(os.path.dirname(__file__))
target_folder = os.path.join(root, 'samples', 'program_type')
def test_program_type_plenum():
file_path = os.path.join(target_folder, 'progr... | [
"os.path.dirname",
"honeybee_schema.energy.programtype.ProgramTypeAbridged.parse_file",
"os.path.join"
] | [((190, 235), 'os.path.join', 'os.path.join', (['root', '"""samples"""', '"""program_type"""'], {}), "(root, 'samples', 'program_type')\n", (202, 235), False, 'import os\n'), ((147, 172), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (162, 172), False, 'import os\n'), ((286, 341), 'os.path.j... |
import requests
import json
import csv
from geopy.geocoders import Nominatim
geocoder = Nominatim()
fo = file('Var.csv','r')
headers = {'content-type': 'application/json'}
url = 'https://rkyai.herokuapp.com/api/v1/map'
for ligne in fo:
commune = ligne.split(",")[0]
address, (latitude, longitude) = geocoder.geocode... | [
"json.dumps",
"geopy.geocoders.Nominatim"
] | [((89, 100), 'geopy.geocoders.Nominatim', 'Nominatim', ([], {}), '()\n', (98, 100), False, 'from geopy.geocoders import Nominatim\n'), ((509, 528), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (519, 528), False, 'import json\n')] |
from typing import Any, Callable, MutableMapping
import toml
def ManipulateFile(toml_file_path:str,
new_toml: MutableMapping[Any,Any]):
try:
with open(toml_file_path, "w", encoding="utf-8") as file:
toml.dump(new_toml,file)
except:
pass
def TomlBaseManipulation(t... | [
"toml.load",
"toml.dump"
] | [((416, 441), 'toml.load', 'toml.load', (['toml_file_path'], {}), '(toml_file_path)\n', (425, 441), False, 'import toml\n'), ((243, 268), 'toml.dump', 'toml.dump', (['new_toml', 'file'], {}), '(new_toml, file)\n', (252, 268), False, 'import toml\n')] |
# Copyright (C) 2018-19 Freie Universität Berlin
# 2017 <NAME> <<EMAIL>>
# 2016 <NAME> <<EMAIL>>
# 2014 <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for m... | [
"sys.exc_info",
"functools.partial",
"os.environ.get"
] | [((2253, 2313), 'functools.partial', 'partial', (['check_unittests'], {'timeout': 'timeout', 'nb_tests': 'nb_tests'}), '(check_unittests, timeout=timeout, nb_tests=nb_tests)\n', (2260, 2313), False, 'from functools import partial\n'), ((793, 828), 'os.environ.get', 'os.environ.get', (['"""RIOT_TEST_TIMEOUT"""'], {}), "... |
import smtplib
import ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
import os
import csv
import time
sender_email = "<EMAIL>"
# receiver_email = "<EMAIL>"
password = '<PASSWORD>'
context = ssl.create_default_context()
server ... | [
"smtplib.SMTP_SSL",
"ssl.create_default_context",
"time.sleep",
"email.mime.multipart.MIMEMultipart",
"os.path.basename",
"csv.reader",
"email.mime.text.MIMEText"
] | [((284, 312), 'ssl.create_default_context', 'ssl.create_default_context', ([], {}), '()\n', (310, 312), False, 'import ssl\n'), ((322, 378), 'smtplib.SMTP_SSL', 'smtplib.SMTP_SSL', (['"""smtp.gmail.com"""', '(465)'], {'context': 'context'}), "('smtp.gmail.com', 465, context=context)\n", (338, 378), False, 'import smtpl... |
# -*- coding: utf-8 -*-
"""AG module containing portfolio class
Todo:
* Improve portfolio analysis tools
"""
# Standard imports
from __future__ import annotations
from datetime import datetime
from numbers import Number
from copy import copy, deepcopy
from datetime import timedelta
import math
# Third party imp... | [
"math.floor",
"pandas.DatetimeIndex",
"numpy.array",
"copy.deepcopy",
"copy.copy",
"typing.TypeVar"
] | [((672, 719), 'typing.TypeVar', 'TypeVar', (['"""Asset_T"""'], {'bound': 'Asset', 'covariant': '(True)'}), "('Asset_T', bound=Asset, covariant=True)\n", (679, 719), False, 'from typing import TYPE_CHECKING, Any, TypeVar, Union, Optional, Literal, Generic, Iterable\n'), ((3652, 3666), 'copy.deepcopy', 'deepcopy', (['sel... |
#vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
from project import *
#from project.tables import db,User
from Authentication import UserAuth
from contacts import *
class UserAuthentication(Resource):
def get(self):
headers = {'Content-Type': 'text/html'}
return make_response(render_template(... | [
"Authentication.UserAuth"
] | [((388, 448), 'Authentication.UserAuth', 'UserAuth', (["request.form['username']", "request.form['password']"], {}), "(request.form['username'], request.form['password'])\n", (396, 448), False, 'from Authentication import UserAuth\n')] |
from django.contrib import admin
from django.contrib import auth
from django.urls import include
from django.urls import path
from django.urls import re_path
from django.views.generic import RedirectView
import exams
from exams.views import logout_view
urlpatterns = [
path("admin/", admin.site.urls),
path("ex... | [
"django.views.generic.RedirectView.as_view",
"django.contrib.auth.views.LoginView.as_view",
"django.urls.path",
"django.urls.include"
] | [((275, 306), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (279, 306), False, 'from django.urls import path\n'), ((562, 605), 'django.urls.path', 'path', (['"""logout/"""', 'logout_view'], {'name': '"""logout"""'}), "('logout/', logout_view, name='logout')\n", ... |
import os
import argparse
import pandas as pd
from sklearn.model_selection import train_test_split
from src.data.make_dataset import read_params
def split_and_save_data(config_path):
config = read_params(config_path)
test_data_path = config['split_data']['test_path']
train_data_path = config['split_data']... | [
"sklearn.model_selection.train_test_split",
"src.data.make_dataset.read_params",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((198, 222), 'src.data.make_dataset.read_params', 'read_params', (['config_path'], {}), '(config_path)\n', (209, 222), False, 'from src.data.make_dataset import read_params\n'), ((508, 543), 'pandas.read_csv', 'pd.read_csv', (['raw_data_path'], {'sep': '""","""'}), "(raw_data_path, sep=',')\n", (519, 543), True, 'impo... |
# -----------------------------------------------------------------------------
# Code adapted from:
# https://github.com/ThibaultGROUEIX/ChamferDistancePytorch/blob/719b0f1ca5ba370616cb837c03ab88d9a88173ff/chamfer_python.py
#
# MIT License
#
# Copyright (c) 2019 ThibaultGROUEIX
#
# Permission is hereby granted, fr... | [
"torch.pow",
"torch.min"
] | [((2287, 2302), 'torch.pow', 'torch.pow', (['x', '(2)'], {}), '(x, 2)\n', (2296, 2302), False, 'import torch\n'), ((2319, 2334), 'torch.pow', 'torch.pow', (['y', '(2)'], {}), '(y, 2)\n', (2328, 2334), False, 'import torch\n'), ((2609, 2624), 'torch.min', 'torch.min', (['P', '(2)'], {}), '(P, 2)\n', (2618, 2624), False,... |
import os
import gzip
import json
import torch
import tables as tb
import pandas as pd
DATASET_DIR = "/mnt/nfs/scratch1/neerajsharma/amazon_data/"
META_PREFIX = "meta_"
REVIEW_PREFIX = "review_"
HDF5_DATASET = "new_5_dataset.h5"
DATASET_NAME = {
'phone': 'Cell_Phones_and_Accessories.json.gz',
'beauty': 'All_Be... | [
"tables.Float64Col",
"json.loads",
"torch.logical_xor",
"gzip.open",
"os.path.join",
"pandas.DataFrame.from_dict",
"tables.StringCol"
] | [((504, 529), 'tables.StringCol', 'tb.StringCol', ([], {'itemsize': '(20)'}), '(itemsize=20)\n', (516, 529), True, 'import tables as tb\n'), ((551, 580), 'tables.Float64Col', 'tb.Float64Col', ([], {'shape': '(1, 128)'}), '(shape=(1, 128))\n', (564, 580), True, 'import tables as tb\n'), ((786, 811), 'tables.StringCol', ... |
# -*-coding: utf-8-*-
import io
import pathlib
import setuptools
README = (pathlib.Path(__file__).parent / "README.md").read_text()
REQUIRES = [
dep_line
for line in io.StringIO((pathlib.Path(__file__).parent / "requirements.txt").read_text())
if (dep_line := line.strip())
]
setuptools.setup(
name="... | [
"setuptools.find_packages",
"pathlib.Path"
] | [((590, 616), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (614, 616), False, 'import setuptools\n'), ((77, 99), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (89, 99), False, 'import pathlib\n'), ((190, 212), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__fil... |
from functools import wraps
def autoProperty(func, strict: dict = None):
assert func.__name__ == "__init__"
parg_name = func.__code__.co_varnames[1:]
arg_name: list = parg_name[:func.__code__.co_argcount - 1]
if (i := func.__defaults__) is None:
defaults = {}
else:
defaults = {k: v... | [
"traceback.print_exc",
"functools.wraps"
] | [((437, 448), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (442, 448), False, 'from functools import wraps\n'), ((1146, 1157), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1151, 1157), False, 'from functools import wraps\n'), ((1341, 1352), 'traceback.print_exc', 'print_exc', ([], {}), '()\n', (1... |
import pytest
import gym
from gym import spaces
import numpy as np
from stable_baselines.common.env_checker import check_env
from stable_baselines.common.bit_flipping_env import BitFlippingEnv
from stable_baselines.common.identity_env import IdentityEnv, IdentityEnvBox
@pytest.mark.parametrize("env_id", ['CartPole-v... | [
"numpy.ones",
"stable_baselines.common.env_checker.check_env",
"gym.spaces.Discrete",
"gym.spaces.Box",
"pytest.mark.parametrize",
"pytest.raises",
"stable_baselines.common.identity_env.IdentityEnvBox",
"gym.make",
"pytest.warns"
] | [((274, 369), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""env_id"""', "['CartPole-v0', 'Pendulum-v0', 'BreakoutNoFrameskip-v4']"], {}), "('env_id', ['CartPole-v0', 'Pendulum-v0',\n 'BreakoutNoFrameskip-v4'])\n", (297, 369), False, 'import pytest\n'), ((851, 938), 'pytest.mark.parametrize', 'pytest.ma... |
import numpy as np
import tvm
from tvm.contrib import graph_runtime
import topi
import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list
def helper(symbol, inputs, dtype,
np_forward, np_backward=None, need_input=True, need_head_grads=True):
ishapes = {}
input_syms = [... | [
"numpy.clip",
"nnvm.symbol.full",
"numpy.less_equal",
"nnvm.symbol.reshape",
"numpy.greater_equal",
"numpy.flip",
"numpy.greater",
"nnvm.symbol.ones",
"numpy.reshape",
"numpy.less",
"tvm.contrib.graph_runtime.create",
"nnvm.symbol.zeros",
"nnvm.testing.config.ctx_list",
"nnvm.symbol.greate... | [((546, 556), 'nnvm.testing.config.ctx_list', 'ctx_list', ([], {}), '()\n', (554, 556), False, 'from nnvm.testing.config import ctx_list\n'), ((1986, 2003), 'nnvm.symbol.Variable', 'sym.Variable', (['"""x"""'], {}), "('x')\n", (1998, 2003), True, 'import nnvm.symbol as sym\n'), ((2155, 2165), 'nnvm.testing.config.ctx_l... |
import math
import pytest
from haystack import Document
from haystack.reader.base import BaseReader
from haystack.reader.farm import FARMReader
def test_reader_basic(reader):
assert reader is not None
assert isinstance(reader, BaseReader)
def test_output(prediction):
assert prediction is not None
... | [
"pytest.mark.parametrize",
"haystack.Document.from_dict",
"math.isclose"
] | [((2470, 2528), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""reader"""', "['farm']"], {'indirect': '(True)'}), "('reader', ['farm'], indirect=True)\n", (2493, 2528), False, 'import pytest\n'), ((2530, 2582), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""window_size"""', '[10, 15, 20]'], {})... |
from django.contrib import admin
from .models import Userdb
admin.site.register(Userdb)
| [
"django.contrib.admin.site.register"
] | [((61, 88), 'django.contrib.admin.site.register', 'admin.site.register', (['Userdb'], {}), '(Userdb)\n', (80, 88), False, 'from django.contrib import admin\n')] |
import requests as rq
from requests.exceptions import HTTPError
from bs4 import BeautifulSoup
import warnings
def get_dom(url):
"""returns document from url as a BS DOM"""
response = rq.get(url)
response.raise_for_status()
return BeautifulSoup(response.content, "html.parser")
def _abs_link(link, bas... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((193, 204), 'requests.get', 'rq.get', (['url'], {}), '(url)\n', (199, 204), True, 'import requests as rq\n'), ((248, 294), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""html.parser"""'], {}), "(response.content, 'html.parser')\n", (261, 294), False, 'from bs4 import BeautifulSoup\n')] |
# *****************************************************************************
#
# 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
#
# ... | [
"subrun.TestCase",
"jpype.shutdownJVM",
"_jpype._hasClass",
"common.JPypeTestCase.setUp",
"jpype.onJVMStart",
"jpype._jinit.runJVMInitializers",
"_jpype.isPackage",
"jpype.startJVM",
"unittest.mock.patch",
"_jpype._getClass"
] | [((964, 996), 'subrun.TestCase', 'subrun.TestCase', ([], {'individual': '(True)'}), '(individual=True)\n', (979, 996), False, 'import subrun\n'), ((2443, 2479), 'jpype.startJVM', 'jpype.startJVM', ([], {'convertStrings': '(False)'}), '(convertStrings=False)\n', (2457, 2479), False, 'import jpype\n'), ((2488, 2507), 'jp... |
import os
import csv
import sqlite3
import threading
# XXX (orainha) How to use "threading" word here?
from threading import *
from bs4 import BeautifulSoup
import utils.files as utils
# XXX (ricardoapl) Fix this non-pythonic mess!
CONTACTS_TEMPLATE_FILE_PATH = os.path.join(os.path.dirname(__file__), r'..\templat... | [
"os.path.exists",
"sqlite3.connect",
"os.makedirs",
"csv.writer",
"utils.files.get_output_file_path",
"bs4.BeautifulSoup",
"os.path.dirname",
"utils.files.get_suspect_db_path",
"utils.files.get_input_file_path",
"threading.Thread",
"utils.files.get_filetype"
] | [((281, 306), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (296, 306), False, 'import os\n'), ((757, 781), 'sqlite3.connect', 'sqlite3.connect', (['DB_PATH'], {}), '(DB_PATH)\n', (772, 781), False, 'import sqlite3\n'), ((976, 1028), 'bs4.BeautifulSoup', 'BeautifulSoup', (['template_file'], ... |
"""Tests for the Monopile Wisdem API"""
__author__ = ["<NAME>"]
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import openmdao.api as om
from ORBIT.api.wisdem import OrbitWisdemFixed
def test_wisdem_monopile_api_default():
prob = om.Prob... | [
"openmdao.api.Problem",
"ORBIT.api.wisdem.OrbitWisdemFixed"
] | [((313, 325), 'openmdao.api.Problem', 'om.Problem', ([], {}), '()\n', (323, 325), True, 'import openmdao.api as om\n'), ((343, 361), 'ORBIT.api.wisdem.OrbitWisdemFixed', 'OrbitWisdemFixed', ([], {}), '()\n', (359, 361), False, 'from ORBIT.api.wisdem import OrbitWisdemFixed\n')] |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | [
"ansible.module_utils.connection.Connection"
] | [((2071, 2102), 'ansible.module_utils.connection.Connection', 'Connection', (['module._socket_path'], {}), '(module._socket_path)\n', (2081, 2102), False, 'from ansible.module_utils.connection import Connection\n'), ((2460, 2491), 'ansible.module_utils.connection.Connection', 'Connection', (['module._socket_path'], {})... |
#!/usr/bin/env python3
from fastapi import FastAPI
from backend.api.routes import router as NoteRouter
app = FastAPI(
title="Parsig service backend",
description="The backend api for parsig service",
version="0.1.0",
docs_url='/docs',
openapi_url='/docs/openapi.json',
redoc_url='/redocs'
)
a... | [
"fastapi.FastAPI"
] | [((112, 300), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""Parsig service backend"""', 'description': '"""The backend api for parsig service"""', 'version': '"""0.1.0"""', 'docs_url': '"""/docs"""', 'openapi_url': '"""/docs/openapi.json"""', 'redoc_url': '"""/redocs"""'}), "(title='Parsig service backend', descript... |
'''
@author: <NAME>
@summary: A module to perform batch request processing.
'''
from __future__ import absolute_import, unicode_literals
import json
import logging
from datetime import datetime
import six
from concurrent.futures import TimeoutError
from django.conf import settings
from django.http.response import (
... | [
"logging.getLogger",
"json.loads",
"django.http.response.HttpResponseNotFound",
"django.http.response.HttpResponse",
"batch_requests.utils.get_wsgi_request_object",
"batch_requests.settings.br_settings.as_dict",
"six.itervalues",
"json.dumps",
"django.views.decorators.http.require_http_methods",
"... | [((798, 825), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (815, 825), False, 'import logging\n'), ((5772, 5802), 'django.views.decorators.http.require_http_methods', 'require_http_methods', (["['POST']"], {}), "(['POST'])\n", (5792, 5802), False, 'from django.views.decorators.http impo... |
import os,sys
import re
import sympy
import math
import cmath
from math import factorial as fact
from sympy import factorial as symb_fact
from sympy import factorial2 as symb_fact2
from scipy.special import binom as binomial
from sympy import exp as symb_exp
from sympy import I as symb_I
def generate_cartesian_ls( L )... | [
"sympy.Integer",
"sympy.factorial",
"sympy.sqrt",
"math.factorial",
"sympy.simplify",
"math.pow",
"sympy.factorial2",
"math.sqrt",
"scipy.special.binom",
"sympy.symbols",
"sympy.diff",
"re.findall",
"sympy.conjugate"
] | [((1211, 1231), 'math.sqrt', 'math.sqrt', (['prefactor'], {}), '(prefactor)\n', (1220, 1231), False, 'import math\n'), ((2103, 2119), 'sympy.Integer', 'sympy.Integer', (['j'], {}), '(j)\n', (2116, 2119), False, 'import sympy\n'), ((2132, 2148), 'sympy.Integer', 'sympy.Integer', (['l'], {}), '(l)\n', (2145, 2148), False... |
# -*- coding: utf-8 -*-
"""
Using TorchScript to serialize and deploy model
===============================================
Models in TorchANI's model zoo support TorchScript. TorchScript is a way to create
serializable and optimizable models from PyTorch code. It allows users to saved their
models from a Python proce... | [
"torch.jit.script",
"torch.jit.load",
"torchani.models.ANI1ccx",
"torch.tensor",
"torch.jit.save"
] | [((774, 799), 'torchani.models.ANI1ccx', 'torchani.models.ANI1ccx', ([], {}), '()\n', (797, 799), False, 'import torchani\n'), ((965, 988), 'torch.jit.script', 'torch.jit.script', (['model'], {}), '(model)\n', (981, 988), False, 'import torch\n'), ((989, 1040), 'torch.jit.save', 'torch.jit.save', (['compiled_model', '"... |
from enum import Enum
from os import (getcwd, path as osp)
import sys
import click
import cv2
from .conf import (get_config, print_config)
from .detect.opencv import HaarCascadeDetector
from .meme.basic import Meme
from .meme.thug import ThugMeme
MEME_RESULT_DIR = getcwd()
CONTEXT = dict(help_option_names=['-h', '-... | [
"click.Choice",
"click.argument",
"click.option",
"os.path.splitext",
"os.path.join",
"os.getcwd",
"cv2.destroyAllWindows",
"click.version_option",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"click.Path",
"click.command",
"cv2.waitKey"
] | [((268, 276), 'os.getcwd', 'getcwd', ([], {}), '()\n', (274, 276), False, 'from os import getcwd, path as osp\n'), ((1530, 1569), 'click.command', 'click.command', ([], {'context_settings': 'CONTEXT'}), '(context_settings=CONTEXT)\n', (1543, 1569), False, 'import click\n'), ((2026, 2065), 'click.command', 'click.comman... |
from pyqode.qt.QtCore import QObject, QTimer, Signal, Qt
from pyqode.qt.QtWidgets import QAction
from pyqode.qt.QtGui import QTextCursor
from pyqode.core.api import Mode, TextHelper, TextDecoration, DelayJobRunner
class GoToDefinitionMode(Mode, QObject):
"""
Go to the definition of the symbol under the word c... | [
"pyqode.core.api.DelayJobRunner",
"pyqode.core.api.TextDecoration",
"pyqode.core.api.TextHelper",
"pyqode.core.api.Mode.__init__",
"pyqode.qt.QtCore.QTimer.singleShot",
"pyqode.qt.QtCore.Signal",
"pyqode.qt.QtCore.QObject.__init__"
] | [((486, 505), 'pyqode.qt.QtCore.Signal', 'Signal', (['QTextCursor'], {}), '(QTextCursor)\n', (492, 505), False, 'from pyqode.qt.QtCore import QObject, QTimer, Signal, Qt\n'), ((539, 561), 'pyqode.qt.QtCore.QObject.__init__', 'QObject.__init__', (['self'], {}), '(self)\n', (555, 561), False, 'from pyqode.qt.QtCore impor... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import os
import multiprocessing
import multiprocessing.dummy
import signal
import io
try:
from capstone import Cs
from capstone import CS_ARCH_X86
from capstone import CS_MODE_32
from capstone import CS_MODE_64
except ImportError:
... | [
"sys.setrecursionlimit",
"os.path.exists",
"signal.signal",
"re.compile",
"capstone.Cs",
"io.BytesIO",
"os.path.basename",
"io.StringIO",
"pefile.PE",
"multiprocessing.dummy.Pool"
] | [((32594, 32623), 'multiprocessing.dummy.Pool', 'multiprocessing.dummy.Pool', (['(1)'], {}), '(1)\n', (32620, 32623), False, 'import multiprocessing\n'), ((2542, 2566), 'capstone.Cs', 'Cs', (['self.arch', 'self.mode'], {}), '(self.arch, self.mode)\n', (2544, 2566), False, 'from capstone import Cs\n'), ((9897, 9921), 'r... |
# Copyright (c) 2016-2018, <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the foll... | [
"sys.intern",
"collections.namedtuple"
] | [((2890, 2947), 'collections.namedtuple', 'namedtuple', (['"""EnvData"""', "('user_functions', 'error_router')"], {}), "('EnvData', ('user_functions', 'error_router'))\n", (2900, 2947), False, 'from collections import namedtuple\n'), ((1814, 1832), 'sys.intern', 'sys.intern', (['symbol'], {}), '(symbol)\n', (1824, 1832... |
from unittest import TestCase
from datetime import datetime
import django
from django.urls import reverse
from django.utils import timezone
from faker import Faker
from rest_framework.test import APIClient
from rest_framework import status
from core.models import WatchListModel
from watchlist_app.api.serializers impo... | [
"core.models.WatchListModel.objects.filter",
"watchlist_app.tests.factories.WatchListFactory",
"rest_framework.test.APIClient",
"faker.Faker",
"core.models.WatchListModel.objects.all",
"watchlist_app.tests.factories.StreamPlatformFactory",
"django.urls.reverse",
"watchlist_app.api.serializers.WatchLis... | [((439, 460), 'django.urls.reverse', 'reverse', (['"""movie_list"""'], {}), "('movie_list')\n", (446, 460), False, 'from django.urls import reverse\n'), ((1228, 1235), 'faker.Faker', 'Faker', ([], {}), '()\n', (1233, 1235), False, 'from faker import Faker\n'), ((496, 538), 'django.urls.reverse', 'reverse', (['"""movie_... |
import os
import matplotlib.pyplot as plt
import torch
import util
import seaborn as sns
import argparse
def plot_memory(path, memory, support_size):
fig, axs = plt.subplots(1, 2, figsize=(12, 4))
ax = axs[0]
# ax.hist(
# memory[0], bins=torch.linspace(-0.5, support_size + 0.5, support_size + 1),... | [
"torch.sort",
"torch.unique",
"util.logging.info",
"argparse.ArgumentParser",
"util.get_memory_prob",
"util.get_save_dir",
"util.empirical_discrete_probs",
"os.path.isfile",
"util.load_checkpoint",
"torch.cuda.is_available",
"torch.linspace",
"util.get_checkpoint_paths",
"util.save_fig",
"... | [((167, 202), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(12, 4)'}), '(1, 2, figsize=(12, 4))\n', (179, 202), True, 'import matplotlib.pyplot as plt\n'), ((972, 996), 'util.save_fig', 'util.save_fig', (['fig', 'path'], {}), '(fig, path)\n', (985, 996), False, 'import util\n'), ((1340, 1... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from __future__ import print_function, unicode_literals, division, absolute_import
from future import standard_library
standard_library.install... | [
"re.split",
"nipy.algorithms.registration.aff2euler",
"builtins.next",
"nipy.algorithms.registration.to_matrix44",
"numpy.asarray",
"builtins.str",
"future.standard_library.install_aliases",
"numpy.zeros",
"numpy.ravel"
] | [((296, 330), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (328, 330), False, 'from future import standard_library\n'), ((3432, 3441), 'builtins.str', 'str', (['cont'], {}), '(cont)\n', (3435, 3441), False, 'from builtins import next, str\n'), ((1019, 1042), 'builtins... |
import threading
import random
import time
import os
from ffpyplayer.player import MediaPlayer
import playsound
import plyer
from youtube_dl import YoutubeDL
streams = [
"https://www.youtube.com/watch?v=grBFMP3HDZA",
"https://www.youtube.com/watch?v=RDbvC5I9wtw",
"https://www.youtube.com/watch?v=sca4VG9b0... | [
"plyer.notification.notify",
"random.shuffle",
"time.sleep",
"youtube_dl.YoutubeDL",
"threading._start_new_thread",
"threading.Thread",
"random.randint"
] | [((1271, 1320), 'youtube_dl.YoutubeDL', 'YoutubeDL', (["{'quiet': True, 'format': 'bestaudio'}"], {}), "({'quiet': True, 'format': 'bestaudio'})\n", (1280, 1320), False, 'from youtube_dl import YoutubeDL\n'), ((1647, 1660), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (1657, 1660), False, 'import time\n'), ((360... |
''' one_line_description
DESCRIPTION:
Insert a paragraph-long description of the module here.
FUNCTIONS:
This module contains the following (main) functions:
* fun_name : one_line_description
(only add user-facing ones)
'''
import numpy as np
import matplotlib as mpl
import matplotlib.colors
imp... | [
"numpy.unique",
"matplotlib.collections.PolyCollection",
"numpy.where",
"matplotlib.pyplot.colorbar",
"numpy.max",
"matplotlib.ticker.MaxNLocator",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.min"
] | [((1189, 1236), 'matplotlib.collections.PolyCollection', 'mpl.collections.PolyCollection', (['verts'], {}), '(verts, **kwargs)\n', (1219, 1236), True, 'import matplotlib as mpl\n'), ((4019, 4042), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (4038, 4042), False, 'from mp... |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
import os,glob
# from dotenv import find_dotenv, load_dotenv
import process_rna as process_rna
import process_hichip as process_hichip
import process_atac as process_atac
import process_bedtools as process_bedtools
import process_crms as proce... | [
"logging.getLogger",
"logging.basicConfig",
"process_crms.create_crm_batch",
"pathlib.Path",
"os.path.join",
"click.Path",
"click.command"
] | [((403, 418), 'click.command', 'click.command', ([], {}), '()\n', (416, 418), False, 'import click\n'), ((889, 916), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (906, 916), False, 'import logging\n'), ((2503, 2569), 'os.path.join', 'os.path.join', (['external_filepath', '"""promoter_hg... |
# tests replica set connection with read preferences
# import needed classes
import pprint
from pymongo import MongoClient
# set up client
hosts = ['member1.biglittle.local','member2.biglittle.local','member3.biglittle.local']
replName = 'learn_mongodb'
readPref = 'nearest'
client = MongoClient(hosts, replicaSet... | [
"pymongo.MongoClient",
"pprint.pprint"
] | [((291, 355), 'pymongo.MongoClient', 'MongoClient', (['hosts'], {'replicaSet': 'replName', 'readPreference': 'readPref'}), '(hosts, replicaSet=replName, readPreference=readPref)\n', (302, 355), False, 'from pymongo import MongoClient\n'), ((513, 534), 'pprint.pprint', 'pprint.pprint', (['result'], {}), '(result)\n', (5... |
from flask import Flask
app = Flask(__name__)
# make the route
@app.route('/')
# now define a function
def hello():
return render_template('home.html')
# make a second route
@app.route('/about')
# now make a function that goes with about
def preds():
return render_template('about.html') | [
"flask.Flask"
] | [((31, 46), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (36, 46), False, 'from flask import Flask\n')] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 9 10:35:31 2017
@author: stu
"""
import openmc
# materials
uo2 = openmc.Material(name='uo2')
uo2.add_element('U',1.0,enrichment=3.0)
uo2.add_nuclide('O16',2.0)
uo2.set_density('g/cm3',10.0)
zirconium = openmc.Material(name='zirconium')
zirconium... | [
"openmc.run",
"openmc.stats.Box",
"openmc.Material",
"openmc.YPlane",
"openmc.Universe",
"openmc.Materials",
"openmc.RectLattice",
"openmc.MeshFilter",
"openmc.Tally",
"openmc.DistribcellFilter",
"openmc.XPlane",
"openmc.Mesh",
"openmc.Geometry",
"openmc.Tallies",
"openmc.Settings",
"o... | [((139, 166), 'openmc.Material', 'openmc.Material', ([], {'name': '"""uo2"""'}), "(name='uo2')\n", (154, 166), False, 'import openmc\n'), ((277, 310), 'openmc.Material', 'openmc.Material', ([], {'name': '"""zirconium"""'}), "(name='zirconium')\n", (292, 310), False, 'import openmc\n'), ((388, 417), 'openmc.Material', '... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import, division, unicode_literals
import argparse
import logging
import os
import os.path as ... | [
"logging.basicConfig",
"os.getpgid",
"sys.path.insert",
"senteval.engine.SE",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.join",
"numpy.array",
"threading.Thread",
"queue.Queue"
] | [((510, 532), 'os.path.join', 'osp.join', (['""".."""', '"""data"""'], {}), "('..', 'data')\n", (518, 532), True, 'import os.path as osp\n'), ((559, 595), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PATH_TO_SENTEVAL'], {}), '(0, PATH_TO_SENTEVAL)\n', (574, 595), False, 'import sys\n'), ((642, 655), 'queue.Queue', '... |
import matplotlib.pyplot as plt
from psi.data.io import dpoae
def main(filename):
fh = dpoae.load(filename)
data = fh.results[['f1_frequency', 'f1_level', 'meas_f1_level']]
freqs = data['f1_frequency'].unique()
figure, axes = plt.subplots(1, len(freqs), sharex=True, sharey=True, figsize=(10, 3))
... | [
"psi.data.io.dpoae.load",
"matplotlib.pyplot.show"
] | [((94, 114), 'psi.data.io.dpoae.load', 'dpoae.load', (['filename'], {}), '(filename)\n', (104, 114), False, 'from psi.data.io import dpoae\n'), ((640, 650), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (648, 650), True, 'import matplotlib.pyplot as plt\n')] |
from pyrogram import Client, filters
from pyrogram.types import CallbackQuery
from bot_errors_logger import logging_errors
import constants
@Client.on_callback_query(filters.regex(r"^back"))
@logging_errors
async def backtostart(bot: Client, query: CallbackQuery):
await query.message.edit(
constants.start... | [
"pyrogram.filters.regex"
] | [((168, 190), 'pyrogram.filters.regex', 'filters.regex', (['"""^back"""'], {}), "('^back')\n", (181, 190), False, 'from pyrogram import Client, filters\n'), ((461, 483), 'pyrogram.filters.regex', 'filters.regex', (['"""^help"""'], {}), "('^help')\n", (474, 483), False, 'from pyrogram import Client, filters\n'), ((695, ... |
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Importing the Kratos Library
import KratosMultiphysics
from KratosMultiphysics.json_utilities import read_external_json, write_external_json
# Importing the base class
from KratosMul... | [
"KratosMultiphysics.json_utilities.write_external_json",
"KratosMultiphysics.KratosGlobals.GetVariable",
"KratosMultiphysics.json_utilities.read_external_json",
"KratosMultiphysics.KratosGlobals.GetVariableType"
] | [((3451, 3499), 'KratosMultiphysics.json_utilities.write_external_json', 'write_external_json', (['self.output_file_name', 'data'], {}), '(self.output_file_name, data)\n', (3470, 3499), False, 'from KratosMultiphysics.json_utilities import read_external_json, write_external_json\n'), ((3560, 3601), 'KratosMultiphysics.... |
import sys
from enum import Enum
import dataclasses
import serial
import mp
import mp.micropythonshell
from mp.mpfshell import RemoteIOError
from mp.firmware.update import URL_README
FILENAME_IDENTIFICATION = mp.micropythonshell.FILENAME_IDENTIFICATION
class BoardqueryException(Exception):
pass
@dataclasses.da... | [
"serial.tools.list_ports.comports",
"mp.micropythonshell.MicropythonShell",
"dataclasses.fields"
] | [((1418, 1442), 'dataclasses.fields', 'dataclasses.fields', (['self'], {}), '(self)\n', (1436, 1442), False, 'import dataclasses\n'), ((11193, 11227), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {}), '()\n', (11225, 11227), False, 'import serial\n'), ((7051, 7085), 'serial.tools.list_po... |
import views
__author__ = 'tmehta'
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^login/$', views.login_user, name='login'),
url(r'^logout/$', views.logout_user, name='logout'),
url(r'^signup/$', views.signup, name='si... | [
"django.conf.urls.url"
] | [((131, 178), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'views.login_user'], {'name': '"""login"""'}), "('^login/$', views.login_user, name='login')\n", (134, 178), False, 'from django.conf.urls import patterns, url\n'), ((204, 254), 'django.conf.urls.url', 'url', (['"""^logout/$"""', 'views.logout_user'], {'n... |
import sys
import logging
import os
from scipy.stats.mstats import *
from optparse import OptionParser
import pysam
from Poperalib.FRegion import *
from Poperalib.Hotspot import *
from Poperalib.hotspotscount import *
from Poperalib.bgcount import *
# from Poperalib.peakcount import *
from Poperalib.pope... | [
"optparse.OptionParser",
"os.path.isfile",
"sys.stderr.write",
"sys.exit",
"pysam.Samfile",
"logging.error"
] | [((3965, 4064), 'optparse.OptionParser', 'OptionParser', ([], {'version': '"""%prog 0.03"""', 'description': 'description', 'usage': 'usage', 'add_help_option': '(False)'}), "(version='%prog 0.03', description=description, usage=usage,\n add_help_option=False)\n", (3977, 4064), False, 'from optparse import OptionPar... |
'''VELOCITYCONTROLS RESOURCE WITH CRU PARAMETERS'''
from marqeta.resources.collection import Collection
from marqeta.response_models.velocity_control_response import VelocityControlResponse
class VelocityControlsCollection(object):
'''
Marqeta API 'velocitycontrols' endpoint list, create, find and update ope... | [
"marqeta.resources.collection.Collection"
] | [((563, 611), 'marqeta.resources.collection.Collection', 'Collection', (['self.client', 'VelocityControlResponse'], {}), '(self.client, VelocityControlResponse)\n', (573, 611), False, 'from marqeta.resources.collection import Collection\n')] |
# Script to show your public ip
# Author: <NAME> <<EMAIL>>
# MIT License
from requests import get
ip = get('https://api.ipify.org').text
print ('My public IP address is: '+ ip)
| [
"requests.get"
] | [((111, 139), 'requests.get', 'get', (['"""https://api.ipify.org"""'], {}), "('https://api.ipify.org')\n", (114, 139), False, 'from requests import get\n')] |
"""Data Preprocessors."""
import numpy as np
from typing import Optional
class Normalization(object):
"""Rescale the data via a normalization.
Produce:
- Bring all values into the range [0, 1]
"""
def __call__(self, X, axis: int = 0):
min_x = np.amin(X, axis=axis)
max_x = np.am... | [
"numpy.mean",
"numpy.ones_like",
"numpy.amin",
"numpy.any",
"numpy.std",
"numpy.amax",
"numpy.divide"
] | [((277, 298), 'numpy.amin', 'np.amin', (['X'], {'axis': 'axis'}), '(X, axis=axis)\n', (284, 298), True, 'import numpy as np\n'), ((315, 336), 'numpy.amax', 'np.amax', (['X'], {'axis': 'axis'}), '(X, axis=axis)\n', (322, 336), True, 'import numpy as np\n'), ((963, 997), 'numpy.divide', 'np.divide', (['(X - self.mu)', 's... |
import requests
def pull_data_from_team(team_num):
key = "12345"
end_point = f"team/frc{team_num}/matches/2017"
url = f"https://www.thebluealliance.com/api/v3/{end_point}"
request_headers = {"X-TBA-Auth-Key": key}
request = requests.get(url, headers=request_headers)
data = request.json()
... | [
"requests.get"
] | [((247, 289), 'requests.get', 'requests.get', (['url'], {'headers': 'request_headers'}), '(url, headers=request_headers)\n', (259, 289), False, 'import requests\n')] |
#-----------------------------------------------------
# Mimas: conference submission and review system
# (c) <NAME> 2016-2020 http://www.allankelly.net
# Licensed under MIT License, see LICENSE file
# -----------------------------------------------------
# system imports
# framework imports
import logging
from googl... | [
"submissionrecord.SubmissionRecord.query",
"submission_lib.submissionrecord.SubmissionRecord.query",
"submissionrecord.retrieve_conference_submissions_keys",
"submissionrecord.retrieve_conference_submissions",
"google.appengine.ext.ndb.AND",
"submissionrecord.retrieve_conference_submissions_orderby_track"... | [((1003, 1066), 'submissionrecord.retrieve_conference_submissions_keys', 'submissionrecord.retrieve_conference_submissions_keys', (['conf_key'], {}), '(conf_key)\n', (1056, 1066), False, 'import submissionrecord\n'), ((1205, 1263), 'submissionrecord.SubmissionRecord.query', 'submissionrecord.SubmissionRecord.query', ([... |
import os
import yaml
settings = False
cwd = os.getcwd()
path = "%s/%s" % (os.getcwd(), '/.gitconsensus.yaml')
def getSettings():
global settings
return settings
def reloadSettings():
global settings
if os.path.isfile(path):
with open(path, 'r') as f:
settings =... | [
"os.path.isfile",
"yaml.load",
"os.getcwd"
] | [((50, 61), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (59, 61), False, 'import os\n'), ((239, 259), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (253, 259), False, 'import os\n'), ((81, 92), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (90, 92), False, 'import os\n'), ((321, 333), 'yaml.load', 'yaml... |
#!/usr/bin/env python3
# encoding: utf-8
'''
copy_raw_data.py -- copy raw data to test pasefilter pachage
Copy some data to test the commands available in PHASEfilter package.
@author: mmp
@copyright: 2019 iBiMED. All rights reserved.
@license: license
@contact: <EMAIL>
@deffield updated: Updated
'''
from PHASE... | [
"os.path.exists",
"optparse.OptionParser",
"PHASEfilter.lib.utils.util.Utils",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"os.system"
] | [((795, 802), 'PHASEfilter.lib.utils.util.Utils', 'Utils', ([], {}), '()\n', (800, 802), False, 'from PHASEfilter.lib.utils.util import Utils\n'), ((821, 850), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (837, 850), False, 'import os, sys, glob\n'), ((455, 480), 'os.path.abspath', ... |
'''
Copyright 2022 Airbus SAS
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, sof... | [
"value_assessment.sos_wrapping.post_processing.post_proc_output.ValueAssessmentCharts",
"copy.deepcopy",
"sos_trades_core.sos_wrapping.sum_valueblock_discipline.SumValueBlockDiscipline.run",
"value_assessment.core.toolbox.toolboxsumCF.toolboxsumCF",
"sos_trades_core.tools.post_processing.charts.chart_filter... | [((1228, 1242), 'value_assessment.core.toolbox.toolboxsumCF.toolboxsumCF', 'toolboxsumCF', ([], {}), '()\n', (1240, 1242), False, 'from value_assessment.core.toolbox.toolboxsumCF import toolboxsumCF\n'), ((1274, 1307), 'sos_trades_core.sos_wrapping.sum_valueblock_discipline.SumValueBlockDiscipline.run', 'SumValueBlockD... |
import cv2
import numpy as np
from basic import imshow, rescale
def circular(img):
if img.shape[2] < 4:
img = np.concatenate(
[
img,
np.ones((img.shape[0], img.shape[1], 1), dtype = img.dtype) * 255
],
axis = 2,
... | [
"numpy.zeros_like",
"numpy.ones"
] | [((340, 367), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 3]'], {}), '(img[:, :, 3])\n', (353, 367), True, 'import numpy as np\n'), ((204, 261), 'numpy.ones', 'np.ones', (['(img.shape[0], img.shape[1], 1)'], {'dtype': 'img.dtype'}), '((img.shape[0], img.shape[1], 1), dtype=img.dtype)\n', (211, 261), True, 'import... |
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from getdist import plots
mpl.use("Agg")
roots = ["mcmc"]
params = ["beta", "alpha100", "alpha143", "alpha217", "alpha353"]
g = plots.get_subplot_plotter(
chain_dir=os.path.join(os.getcwd(), "chains"),
analysis_settings={... | [
"matplotlib.pyplot.savefig",
"matplotlib.rc_context",
"matplotlib.use",
"os.getcwd",
"numpy.max",
"numpy.linspace",
"scipy.stats.norm.pdf"
] | [((114, 128), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (121, 128), True, 'import matplotlib as mpl\n'), ((2002, 2042), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""EB_plot_chain_results.png"""'], {}), "('EB_plot_chain_results.png')\n", (2013, 2042), True, 'import matplotlib.pyplot as plt\n'),... |
#!/usr/bin/env python3.9
from Tuffix.Configuration import DEBUG_BUILD_CONFIG, read_state, State
from Tuffix.Commands import InitCommand
from Tuffix.Editors import EditorBaseKeyword
import unittest
class EditorBaseKeywordTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.state = State(DE... | [
"Tuffix.Configuration.State",
"Tuffix.Editors.EditorBaseKeyword",
"Tuffix.Commands.InitCommand",
"Tuffix.Configuration.read_state"
] | [((312, 373), 'Tuffix.Configuration.State', 'State', (['DEBUG_BUILD_CONFIG', 'DEBUG_BUILD_CONFIG.version', '[]', '[]'], {}), '(DEBUG_BUILD_CONFIG, DEBUG_BUILD_CONFIG.version, [], [])\n', (317, 373), False, 'from Tuffix.Configuration import DEBUG_BUILD_CONFIG, read_state, State\n'), ((445, 476), 'Tuffix.Commands.InitCom... |
"""
ChatterBot utility functions
"""
def clean_whitespace(text):
"""
Remove any extra whitespace and line breaks as needed.
"""
import re
# Replace linebreaks with spaces
text = text.replace('\n', ' ').replace('\r', ' ').replace('\t', ' ')
# Remove any leeding or trailing whitespace
t... | [
"HTMLParser.HTMLParser",
"nltk.data.find",
"nltk.corpus.stopwords.words",
"importlib.import_module",
"nltk.download",
"html.unescape",
"unicodedata.normalize",
"re.sub"
] | [((383, 406), 're.sub', 're.sub', (['""" +"""', '""" """', 'text'], {}), "(' +', ' ', text)\n", (389, 406), False, 'import re\n'), ((1520, 1556), 'importlib.import_module', 'importlib.import_module', (['module_path'], {}), '(module_path)\n', (1543, 1556), False, 'import importlib\n'), ((2921, 2946), 'nltk.corpus.stopwo... |
"""autogenerated by genpy from pi_face_tracker/SetROIRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import sensor_msgs.msg
class SetROIRequest(genpy.Message):
_md5sum = "9586986cb2458d45fdbda6087252affd"
_type = "pi_face_tracker/SetROIRe... | [
"struct.Struct",
"genpy.DeserializationError"
] | [((4887, 4908), 'struct.Struct', 'struct.Struct', (['"""<4IB"""'], {}), "('<4IB')\n", (4900, 4908), False, 'import struct\n'), ((3504, 3533), 'genpy.DeserializationError', 'genpy.DeserializationError', (['e'], {}), '(e)\n', (3530, 3533), False, 'import genpy\n'), ((4785, 4814), 'genpy.DeserializationError', 'genpy.Dese... |
# -*- coding: utf-8 -*-
r"""
Subsets of Topological Manifolds
The class :class:`ManifoldSubset` implements generic subsets of a
topological manifold. Open subsets are implemented by the class
:class:`~sage.manifolds.manifold.TopologicalManifold` (since an
open subset of a manifold is a manifold by itself), which inher... | [
"sage.categories.sets_cat.Sets",
"sage.graphs.digraph.DiGraph",
"sage.manifolds.family.ManifoldSubsetFiniteFamily",
"itertools.combinations",
"collections.defaultdict",
"sage.manifolds.family.ManifoldSubsetFiniteFamily.from_subsets_or_families",
"sage.misc.superseded.deprecation",
"sage.structure.pare... | [((6563, 6614), 'sage.structure.parent.Parent.__init__', 'Parent.__init__', (['self'], {'base': 'base', 'category': 'category'}), '(self, base=base, category=category)\n', (6578, 6614), False, 'from sage.structure.parent import Parent\n'), ((29102, 29229), 'sage.misc.superseded.deprecation', 'deprecation', (['(31727)',... |
from typing import TYPE_CHECKING
from eth_utils import to_bytes, to_canonical_address, to_checksum_address, to_hex
from raiden.constants import UINT256_MAX
from raiden.transfer.architecture import (
ContractSendEvent,
ContractSendExpirableEvent,
Event,
SendMessageEvent,
)
from raiden.transfer.identifi... | [
"raiden.utils.typing.TokenNetworkAddress",
"raiden.utils.serialization.deserialize_secret_hash",
"eth_utils.to_bytes",
"raiden.transfer.identifiers.CanonicalIdentifier.from_dict",
"eth_utils.to_checksum_address",
"raiden.utils.sha3",
"raiden.utils.serialization.serialize_bytes",
"raiden.utils.serializ... | [((2436, 2499), 'raiden.utils.typing.TokenNetworkID', 'TokenNetworkID', (['self.canonical_identifier.token_network_address'], {}), '(self.canonical_identifier.token_network_address)\n', (2450, 2499), False, 'from raiden.utils.typing import Address, Any, BlockExpiration, BlockHash, ChannelID, Dict, InitiatorAddress, Mes... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018 Red Hat
# Copyright © 2014-2016 eNovance
#
# 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
#
#... | [
"pecan.jsonify.jsonify.register",
"os.path.exists",
"os.path.isabs",
"paste.deploy.loadapp",
"gnocchi.incoming.get_driver",
"threading.Lock",
"gnocchi.indexer.get_driver",
"oslo_policy.policy.Enforcer",
"gnocchi.storage.get_driver",
"pkg_resources.resource_filename",
"uuid.uuid4",
"oslo_middle... | [((1224, 1252), 'daiquiri.getLogger', 'daiquiri.getLogger', (['__name__'], {}), '(__name__)\n', (1242, 1252), False, 'import daiquiri\n'), ((1304, 1336), 'pecan.jsonify.jsonify.register', 'jsonify.jsonify.register', (['object'], {}), '(object)\n', (1328, 1336), False, 'from pecan import jsonify\n'), ((6640, 6732), 'pas... |
# encoding: utf-8
import pytest
from cinje import fragment, flatten
CODE = """
: def _wrapper
prefix
: yield
postfix
: end
: def consumer
: using _wrapper
content
: end
: end
"""
@pytest.fixture
def tmpl():
return fragment(CODE)
def test_using(tmpl):
assert flatten(tmpl()) == "prefix\ncontent\npostfix\n"
| [
"cinje.fragment"
] | [((221, 235), 'cinje.fragment', 'fragment', (['CODE'], {}), '(CODE)\n', (229, 235), False, 'from cinje import fragment, flatten\n')] |
from unittest import TestCase
from unittest.mock import call, MagicMock, patch
from bringscript import parser
@patch("bringscript.parser.Path")
class ExistingDirPathTestCase(TestCase):
def test_when_path_dir_exists(self, pathlib_path):
path_str = MagicMock(spec=str)
pathlib_path.return_value.is_d... | [
"bringscript.parser.parse_args",
"unittest.mock.MagicMock",
"unittest.mock.call",
"bringscript.parser.existing_dir_path",
"unittest.mock.patch"
] | [((114, 146), 'unittest.mock.patch', 'patch', (['"""bringscript.parser.Path"""'], {}), "('bringscript.parser.Path')\n", (119, 146), False, 'from unittest.mock import call, MagicMock, patch\n'), ((975, 1017), 'unittest.mock.patch', 'patch', (['"""bringscript.parser.ArgumentParser"""'], {}), "('bringscript.parser.Argumen... |
import os
from src.model_manager import ModelManager
dir_path = os.path.dirname(os.path.realpath(__file__))
config_file = '{}/data/config/config_1.json'.format(dir_path)
model_dir = '{}/data/models'.format(dir_path)
def test_init():
mm = ModelManager(config_file, model_dir)
def test_predict():
pass
| [
"os.path.realpath",
"src.model_manager.ModelManager"
] | [((82, 108), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (98, 108), False, 'import os\n'), ((246, 282), 'src.model_manager.ModelManager', 'ModelManager', (['config_file', 'model_dir'], {}), '(config_file, model_dir)\n', (258, 282), False, 'from src.model_manager import ModelManager\n')] |
import numpy as np
f_src=open('nodes_list.txt','r')
# imported node information
nodes=[] # info: [{'node':'x', 'x':pos_x, 'z':pos_z}]
len_nodes=0 # amount
while(True):
linetmp=f_src.readline()
if(not linetmp):
break
line=linetmp.split('\t')
if(len(line)!=3):
break
nodes.append({'node':line[0],'x':i... | [
"numpy.full"
] | [((490, 536), 'numpy.full', 'np.full', (['(len_nodes, len_nodes)', '(-1)'], {'dtype': 'int'}), '((len_nodes, len_nodes), -1, dtype=int)\n', (497, 536), True, 'import numpy as np\n')] |
"""
for strictly pure Python (no Numpy) only modules
Python >= 2.7
"""
import pytest
from pytest import approx
from math import radians
import pymap3d.math as pm
lla0 = (42, -82, 200)
rlla0 = (radians(lla0[0]), radians(lla0[1]), lla0[2])
aer0 = (33, 70, 1000)
raer0 = (radians(aer0[0]), radians(aer0[1]), aer0[2])
enu0... | [
"pytest.approx",
"pymap3d.math.aer2ecef",
"pymap3d.math.enu2ecef",
"pytest.main",
"pymap3d.math.aer2enu",
"math.radians"
] | [((195, 211), 'math.radians', 'radians', (['lla0[0]'], {}), '(lla0[0])\n', (202, 211), False, 'from math import radians\n'), ((213, 229), 'math.radians', 'radians', (['lla0[1]'], {}), '(lla0[1])\n', (220, 229), False, 'from math import radians\n'), ((271, 287), 'math.radians', 'radians', (['aer0[0]'], {}), '(aer0[0])\n... |
# -*-coding: utf-8 -*-
'''
Created on 17 Mar 2016
@author: BurakKerim
'''
from nltk.tokenize import WordPunctTokenizer
from nltk.tag import SennaChunkTagger
senna_path = '/media/burak/Data/Workspace/Library/senna'
chunker = SennaChunkTagger(senna_path)
tokenizer = WordPunctTokenizer()
def tokenize... | [
"nltk.tokenize.WordPunctTokenizer",
"nltk.tag.SennaChunkTagger"
] | [((240, 268), 'nltk.tag.SennaChunkTagger', 'SennaChunkTagger', (['senna_path'], {}), '(senna_path)\n', (256, 268), False, 'from nltk.tag import SennaChunkTagger\n'), ((282, 302), 'nltk.tokenize.WordPunctTokenizer', 'WordPunctTokenizer', ([], {}), '()\n', (300, 302), False, 'from nltk.tokenize import WordPunctTokenizer\... |
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import ListableAPIResource
from stripe.api_resources.abstract import UpdateableAPIResource
class Dispute(ListableAPIResource, UpdateableAPIResource):
OBJECT_NAME = 'dispute'
def close(... | [
"stripe.util.populate_headers"
] | [((422, 460), 'stripe.util.populate_headers', 'util.populate_headers', (['idempotency_key'], {}), '(idempotency_key)\n', (443, 460), False, 'from stripe import util\n')] |
import copy
import json
import urllib.parse
import io
from swiftclient.service import SwiftService, SwiftUploadObject, SwiftError
from anchore_engine import utils
from anchore_engine.subsys.object_store.drivers.interface import ObjectStorageDriver
from anchore_engine.subsys.object_store.exc import DriverBackendError, ... | [
"logging.getLogger",
"anchore_engine.subsys.logger.exception",
"swiftclient.service.SwiftService",
"io.BytesIO",
"anchore_engine.subsys.object_store.exc.ObjectKeyNotFoundError",
"anchore_engine.subsys.object_store.exc.ObjectStorageDriverError",
"anchore_engine.subsys.object_store.exc.DriverConfiguration... | [((535, 567), 'logging.getLogger', 'logging.getLogger', (['"""swiftclient"""'], {}), "('swiftclient')\n", (552, 567), False, 'import logging\n'), ((1431, 1460), 'copy.copy', 'copy.copy', (['self.client_config'], {}), '(self.client_config)\n', (1440, 1460), False, 'import copy\n'), ((1681, 1720), 'swiftclient.service.Sw... |
import tensorflow as tf
def conv_layer(input, size_in, size_out, name="conv"):
with tf.name_scope(name):
w = tf.Variable(tf.truncated_normal([5, 5, size_in, size_out], stddev=0.1), name="W")
b = tf.Variable(tf.constant(0.1, shape=[size_out]), name="B")
conv = tf.nn.conv2d(input, w, strides... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.nn.relu",
"tensorflow.summary.histogram",
"tensorflow.name_scope",
"tensorflow.constant",
"tensorflow.matmul",
"tensorflow.reshape",
"tensorflow.truncated_normal",
"tensorflow.summary.image"
] | [((90, 109), 'tensorflow.name_scope', 'tf.name_scope', (['name'], {}), '(name)\n', (103, 109), True, 'import tensorflow as tf\n'), ((290, 350), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['input', 'w'], {'strides': '[1, 1, 1, 1]', 'padding': '"""SAME"""'}), "(input, w, strides=[1, 1, 1, 1], padding='SAME')\n", (302, 350)... |
# coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team and Facebook, 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
#
# Un... | [
"oscar.run_captioning.evaluate",
"apex.amp.scale_loss",
"torch.utils.data.BatchSampler",
"psutil.virtual_memory",
"torch.nn.MSELoss",
"torch.utils.data.distributed.DistributedSampler",
"apex.amp.initialize",
"torch.nn.functional.softmax",
"torch.distributed.barrier",
"json.dump",
"apex.amp.maste... | [((2544, 2620), 'torch.utils.data.BatchSampler', 'BatchSampler', ([], {'sampler': 'sampler', 'batch_size': 'params.batch_size', 'drop_last': '(False)'}), '(sampler=sampler, batch_size=params.batch_size, drop_last=False)\n', (2556, 2620), False, 'from torch.utils.data import BatchSampler, DataLoader, RandomSampler\n'), ... |
# This code is released to public domain.
# It is part of open-tamil project examples.
#
# Code to show fontbased encoding tables in Open-TAMIL
# Ref: https://github.com/Ezhil-Language-Foundation/open-tamil/issues/216
import sys
import unicodedata
# requires installing fontTools
# Ref: https://fonttools.readthedocs.io... | [
"unicodedata.name",
"fontTools.ttLib.TTFont",
"pprint.pprint",
"sys.exit"
] | [((416, 438), 'fontTools.ttLib.TTFont', 'ttLib.TTFont', (['fontname'], {}), '(fontname)\n', (428, 438), False, 'from fontTools import ttLib\n'), ((470, 482), 'pprint.pprint', 'pprint', (['cmap'], {}), '(cmap)\n', (476, 482), False, 'from pprint import pprint\n'), ((884, 896), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-... |
import os
from subprocess import run, PIPE
try:
version = os.environ['ELASTIC_VERSION']
except KeyError:
version = run('./bin/elastic-version', stdout=PIPE).stdout.decode().strip()
| [
"subprocess.run"
] | [((124, 165), 'subprocess.run', 'run', (['"""./bin/elastic-version"""'], {'stdout': 'PIPE'}), "('./bin/elastic-version', stdout=PIPE)\n", (127, 165), False, 'from subprocess import run, PIPE\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.autograd import Variable
from rl_agent.film_utils import ResidualBlock, FiLMedResBlock
from .gpu_utils import FloatTensor
class DRQNText(nn.Module):
def __init__(self, config, n_actions, state_dim, is_multi_objec... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.bmm",
"torch.nn.functional.softmax",
"numpy.random.random",
"torch.nn.ModuleList",
"torch.nn.LSTM",
"rl_agent.film_utils.ResidualBlock",
"torch.optim.RMSprop",
"torch.nn.Embedding",
"torch.optim.SGD",
"torch.nn.functional.max_pool2d",
"torch.cat... | [((14602, 14634), 'numpy.random.random', 'np.random.random', (['(1, 3, 28, 28)'], {}), '((1, 3, 28, 28))\n', (14618, 14634), True, 'import numpy as np\n'), ((14642, 14675), 'numpy.random.random', 'np.random.random', (['(1, 15, 28, 28)'], {}), '((1, 15, 28, 28))\n', (14658, 14675), True, 'import numpy as np\n'), ((2231,... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='monotonic_cffi',
version='0.1',
license='Apache',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/rkyoto/monotonic_cffi',
classifiers=(
'Development Status ... | [
"distutils.core.setup"
] | [((98, 649), 'distutils.core.setup', 'setup', ([], {'name': '"""monotonic_cffi"""', 'version': '"""0.1"""', 'license': '"""Apache"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/rkyoto/monotonic_cffi"""', 'classifiers': "('Development Status :: 4 - Beta',\n 'License :: O... |
"""Web server implementation"""
from pathlib import Path
import functools
import logging
import typing
import urllib
from hat import aio
from hat import juggler
from hat.syslog.server import common
import hat.syslog.server.backend
mlog: logging.Logger = logging.getLogger(__name__)
"""Module logger"""
package_path... | [
"logging.getLogger",
"urllib.parse.urlparse",
"pathlib.Path",
"hat.syslog.server.common.Filter",
"hat.aio.Queue",
"functools.partial",
"hat.syslog.server.common.entry_to_json",
"hat.syslog.server.common.filter_from_json",
"hat.juggler.listen"
] | [((259, 286), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (276, 286), False, 'import logging\n'), ((329, 343), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (333, 343), False, 'from pathlib import Path\n'), ((805, 832), 'urllib.parse.urlparse', 'urllib.parse.urlparse', ([... |
import sys
from setuptools import setup, find_packages
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
sys.exit('Error: AVA only runs on Python 3.5 and above.')
setup(
name='ava',
version='1.0.0',
packages=find_packages(),
author='<NAME>',
author_email='<EMAIL>',
install_requires=[... | [
"setuptools.find_packages",
"sys.exit"
] | [((116, 173), 'sys.exit', 'sys.exit', (['"""Error: AVA only runs on Python 3.5 and above."""'], {}), "('Error: AVA only runs on Python 3.5 and above.')\n", (124, 173), False, 'import sys\n'), ((232, 247), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (245, 247), False, 'from setuptools import setup, fi... |
__author__ = 'marcoantonioalberoalbero'
import multiprocessing
class Threads:
def __init__(self):
pass
@staticmethod
def run_detached(routine):
p = multiprocessing.current_process()
name = "worker-" + str(p.pid)
cc = multiprocessing.Process(name=name, target=routine)
... | [
"multiprocessing.Process",
"multiprocessing.current_process"
] | [((180, 213), 'multiprocessing.current_process', 'multiprocessing.current_process', ([], {}), '()\n', (211, 213), False, 'import multiprocessing\n'), ((265, 315), 'multiprocessing.Process', 'multiprocessing.Process', ([], {'name': 'name', 'target': 'routine'}), '(name=name, target=routine)\n', (288, 315), False, 'impor... |
#!/usr/bin/python3.7 -I
import time
import os
import pwd
me = pwd.getpwuid(int(os.environ['ouid'])).pw_name
os.environ['HOME']='/var/portforwarder'
os.environ['USER']='portforwarder'
with open('/var/portforwarder/list.log', 'a') as f:
print(time.strftime("%Y-%m-%dT%H:%M:%S%z:"), "port forard list requested by", m... | [
"os.system",
"time.strftime"
] | [((332, 420), 'os.system', 'os.system', (['"""ssh -i $HOME/.ssh/id_rsa root@192.168.1.1 micropython list_forwards.py"""'], {}), "(\n 'ssh -i $HOME/.ssh/id_rsa root@192.168.1.1 micropython list_forwards.py')\n", (341, 420), False, 'import os\n'), ((247, 284), 'time.strftime', 'time.strftime', (['"""%Y-%m-%dT%H:%M:%S%... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, validators
from wtforms.validators import DataRequired
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
... | [
"wtforms.validators.required",
"wtforms.validators.DataRequired",
"wtforms.SubmitField"
] | [((403, 423), 'wtforms.SubmitField', 'SubmitField', (['"""Login"""'], {}), "('Login')\n", (414, 423), False, 'from wtforms import StringField, PasswordField, SubmitField, validators\n'), ((230, 244), 'wtforms.validators.DataRequired', 'DataRequired', ([], {}), '()\n', (242, 244), False, 'from wtforms.validators import ... |
import argparse
import sys
import zup
@zup.command
def config(args):
args = zup,
zup.commands.config(*args)
@zup.command
def ls(args):
args = (getattr(args.cfg, 'index_url', args.index),
args.remote,
getattr(args.cfg, 'install_dir', zup.config.default_install_dir()))
zup.com... | [
"argparse.ArgumentParser",
"zup.commands.ls",
"zup.commands.remove",
"zup.commands.config",
"zup.config.default_symlink_dir",
"zup.host.target",
"zup.config.default_index_url",
"sys.exit",
"zup.config.default_install_dir",
"zup.commands.default",
"zup.config.load",
"zup.commands.install"
] | [((92, 118), 'zup.commands.config', 'zup.commands.config', (['*args'], {}), '(*args)\n', (111, 118), False, 'import zup\n'), ((313, 335), 'zup.commands.ls', 'zup.commands.ls', (['*args'], {}), '(*args)\n', (328, 335), False, 'import zup\n'), ((691, 718), 'zup.commands.install', 'zup.commands.install', (['*args'], {}), ... |
import pygame
class TextObject:
def __init__(self, x, y, text_func, color, font_name, font_size):
self.pos = (x, y)
self.text_func = text_func
self.color = color
self.font = pygame.font.SysFont(font_name, font_size)
self.bounds = self.get_surface(text_func())
def draw(... | [
"pygame.font.SysFont"
] | [((212, 253), 'pygame.font.SysFont', 'pygame.font.SysFont', (['font_name', 'font_size'], {}), '(font_name, font_size)\n', (231, 253), False, 'import pygame\n')] |
from setuptools import setup, find_packages
setup(
name="lr-reader",
version="0.3",
packages=find_packages('src'),
py_modules=['lr_reader', ],
install_requires=[],
python_requires='>=3.6',
# metadata to display on PyPI
author="<NAME>",
author_email="<EMAIL>",
license='MIT',
... | [
"setuptools.find_packages"
] | [((106, 126), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (119, 126), False, 'from setuptools import setup, find_packages\n')] |
import os
from celery.result import AsyncResult
from fastapi import APIRouter, Depends, Request
from fastapi.responses import FileResponse, JSONResponse
from services.database.user_database import UserDatabase
from services.pandi import Pandi
from services.schemas import User
from tasks import fetch_for_accounting, fe... | [
"fastapi.responses.FileResponse",
"celery.result.AsyncResult",
"services.database.user_database.UserDatabase",
"fastapi.responses.JSONResponse",
"fastapi.APIRouter",
"os.path.abspath",
"tasks.fetch_profit_margin.delay",
"fastapi.Depends",
"tasks.fetch_for_accounting.delay"
] | [((350, 364), 'services.database.user_database.UserDatabase', 'UserDatabase', ([], {}), '()\n', (362, 364), False, 'from services.database.user_database import UserDatabase\n'), ((376, 404), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/reports"""'}), "(prefix='/reports')\n", (385, 404), False, 'from fastapi i... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 12 13:33:45 2018
@author: tghosh
"""
import config
from dataloader.loader import Loader
from preprocessing.utils import Preprocess, remove_empty_docs
from dataloader.embeddings import GloVe
from model.cnn_document_model import DocumentModel, TrainingParameters
from keras... | [
"keras.optimizers.Adam",
"model.cnn_document_model.TrainingParameters",
"preprocessing.utils.remove_empty_docs",
"preprocessing.utils.Preprocess",
"model.cnn_document_model.DocumentModel.load_model",
"pandas.read_csv",
"keras.callbacks.ModelCheckpoint",
"numpy.array",
"sklearn.feature_extraction.tex... | [((515, 835), 'model.cnn_document_model.TrainingParameters', 'TrainingParameters', (['"""imdb_transfer_tanh_activation"""'], {'model_file_path': "(config.MODEL_DIR + '/imdb/transfer_model_10.hdf5')", 'model_hyper_parameters': "(config.MODEL_DIR + '/imdb/transfer_model_10.json')", 'model_train_parameters': "(config.MODE... |
import networkx as nx
import string
import random
random.seed(1)
def nxg_gnp_random(directed):
return nx.gnp_random_graph(100, 0.3, seed=1234, directed=directed)
def named_graph(directed, multigraph):
if directed and not multigraph:
g = nx.DiGraph()
elif directed and multigraph:
g = nx.Mu... | [
"networkx.MultiDiGraph",
"networkx.davis_southern_women_graph",
"networkx.gnp_random_graph",
"networkx.DiGraph",
"networkx.Graph",
"random.seed",
"networkx.MultiGraph",
"networkx.karate_club_graph"
] | [((51, 65), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (62, 65), False, 'import random\n'), ((108, 167), 'networkx.gnp_random_graph', 'nx.gnp_random_graph', (['(100)', '(0.3)'], {'seed': '(1234)', 'directed': 'directed'}), '(100, 0.3, seed=1234, directed=directed)\n', (127, 167), True, 'import networkx as nx... |
import os
from unittest import TestCase
from zulip_bots import finder
class FinderTestCase(TestCase):
def test_resolve_bot_path(self) -> None:
current_directory = os.path.dirname(os.path.abspath(__file__))
expected_bot_path = os.path.abspath(current_directory + '/../bots/helloworld/helloworld.py... | [
"os.path.abspath",
"zulip_bots.finder.resolve_bot_path"
] | [((250, 322), 'os.path.abspath', 'os.path.abspath', (["(current_directory + '/../bots/helloworld/helloworld.py')"], {}), "(current_directory + '/../bots/helloworld/helloworld.py')\n", (265, 322), False, 'import os\n'), ((475, 512), 'zulip_bots.finder.resolve_bot_path', 'finder.resolve_bot_path', (['"""helloworld"""'], ... |
#! /usr/bin/env python2
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/monitoring-plugins/blob/main/CONTRIBUTING... | [
"smbclient.scandir",
"smbclient.open_file",
"smbclient._os.SMBDirEntry.from_path",
"warnings.filterwarnings"
] | [((758, 835), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning', 'module': '"""smbprotocol"""'}), "('ignore', category=UserWarning, module='smbprotocol')\n", (781, 835), False, 'import warnings\n'), ((2031, 2160), 'smbclient._os.SMBDirEntry.from_path', 'smbclient._os.SM... |
from pympler import asizeof
from dataclasses import dataclass
from timeit import timeit
"""
Slots can be used to make classes faster and use less memory.
Data classes have no explicit syntax for working with slots, but the
normal way of creating slots works for data classes as well. (They really are
just regular c... | [
"pympler.asizeof.asizesof"
] | [((1006, 1036), 'pympler.asizeof.asizesof', 'asizeof.asizesof', (['simple', 'slot'], {}), '(simple, slot)\n', (1022, 1036), False, 'from pympler import asizeof\n')] |