code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import math
import requests
import pandas as pd
def fetch_data(ids):
'''
A function to fetch data from the API.
Parameters:
ids (list): A list of ids (integrs) to fetch
Returns:
text (dict): A dictionary where keys are the ids and values are the... | [
"requests.post",
"json.loads",
"json.dumps",
"pandas.read_csv"
] | [((1216, 1256), 'pandas.read_csv', 'pd.read_csv', (['"""files/dialect_dataset.csv"""'], {}), "('files/dialect_dataset.csv')\n", (1227, 1256), True, 'import pandas as pd\n'), ((720, 760), 'json.dumps', 'json.dumps', (['ids[i * 1000:1000 * (i + 1)]'], {}), '(ids[i * 1000:1000 * (i + 1)])\n', (730, 760), False, 'import js... |
from booking.models import Schedule, ParkingSpace
from datetime import datetime as dt
from django import forms
class ReservingForm(forms.ModelForm):
reserving_dates = forms.ModelMultipleChoiceField(
queryset=Schedule.objects.filter(reserving_date__gte=dt.today()),
widget=forms.CheckboxSelectMult... | [
"datetime.datetime.today",
"booking.models.Schedule.objects.all",
"booking.models.ParkingSpace.objects.all",
"django.forms.CheckboxSelectMultiple"
] | [((296, 326), 'django.forms.CheckboxSelectMultiple', 'forms.CheckboxSelectMultiple', ([], {}), '()\n', (324, 326), False, 'from django import forms\n'), ((529, 551), 'booking.models.Schedule.objects.all', 'Schedule.objects.all', ([], {}), '()\n', (549, 551), False, 'from booking.models import Schedule, ParkingSpace\n')... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"google.protobuf.field_mask_pb2.FieldMask",
"uuid.UUID",
"unittest.mock.Mock",
"google.cloud.aiplatform.MatchingEngineIndexEndpoint.list",
"google.cloud.aiplatform.MatchingEngineIndexEndpoint",
"google.cloud.aiplatform.MatchingEngineIndex",
"google.cloud.aiplatform.compat.types.index_endpoint.DeployedIn... | [((11432, 11475), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""google_auth_mock"""'], {}), "('google_auth_mock')\n", (11455, 11475), False, 'import pytest\n'), ((2782, 2949), 'google.cloud.aiplatform.compat.types.index_endpoint.IndexEndpoint', 'gca_index_endpoint.IndexEndpoint', ([], {'name': '_TEST_INDE... |
#! /usr/bin/python
'''
Test for session module
'''
import unittest
import uestc_eams
from .mock_server import LoginMockServer
from .utils import HookedMethod, MakeResponse
mock_login = LoginMockServer()
class TestSession(unittest.TestCase):
@mock_login.Patch
def test_Session(self):
self.__s... | [
"uestc_eams.EAMSSession"
] | [((329, 353), 'uestc_eams.EAMSSession', 'uestc_eams.EAMSSession', ([], {}), '()\n', (351, 353), False, 'import uestc_eams\n')] |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"itertools.chain",
"tensorflow.python.distribute.multi_process_runner.test_main",
"tensorflow.python.ops.array_ops.stack",
"tensorflow.python.compat.v2_compat.enable_v2_behavior",
"tensorflow.python.ops.array_ops.expand_dims_v2",
"tensorflow.python.framework.config.set_logical_device_configuration",
"te... | [((2668, 2704), 'tensorflow.python.framework.config.list_physical_devices', 'config.list_physical_devices', (['device'], {}), '(device)\n', (2696, 2704), False, 'from tensorflow.python.framework import config\n'), ((3451, 3529), 'tensorflow.python.framework.config.set_logical_device_configuration', 'config.set_logical_... |
import csv
class ExperimentDataCannotBeParsedError(Exception):
"""
Defining custom exception type that will be thrown when something fails here
"""
def __init__(self, msg: str = "ERROR"):
self.message = msg
def __str__(self):
"""
Defines what to show when exception is pri... | [
"csv.DictReader"
] | [((2122, 2146), 'csv.DictReader', 'csv.DictReader', (['csv_file'], {}), '(csv_file)\n', (2136, 2146), False, 'import csv\n')] |
import sys
import numpy as np
import scipy.integrate
import scipy.special
from ._dblquad import dblquad
HAVE_PYGSL = False
try:
import pygsl.integrate
import pygsl.sf
HAVE_PYGSL = True
except ImportError:
pass
class BinEB(object):
def __init__(
self, tmin, tmax, Nb, windows=None, linear... | [
"numpy.power",
"numpy.log",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.sum",
"sys.stdout.flush",
"numpy.logspace",
"numpy.arange",
"sys.stdout.write"
] | [((15257, 15284), 'numpy.logspace', 'np.logspace', (['(0.0)', '(5.5)', '(1500)'], {}), '(0.0, 5.5, 1500)\n', (15268, 15284), True, 'import numpy as np\n'), ((17918, 17940), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (17934, 17940), False, 'import sys\n'), ((22001, 22020), 'numpy.dot', 'np.... |
import unittest
from unittest.mock import mock_open, patch
from aoc.d8.main import metadata_sum, supervalue
DATA = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2\n"
class TestCase(unittest.TestCase):
def test_metadata_sum(self):
with patch("builtins.open", mock_open(read_data=DATA)):
self.assertEqual(... | [
"unittest.main",
"unittest.mock.mock_open",
"aoc.d8.main.supervalue",
"aoc.d8.main.metadata_sum"
] | [((517, 532), 'unittest.main', 'unittest.main', ([], {}), '()\n', (530, 532), False, 'import unittest\n'), ((263, 288), 'unittest.mock.mock_open', 'mock_open', ([], {'read_data': 'DATA'}), '(read_data=DATA)\n', (272, 288), False, 'from unittest.mock import mock_open, patch\n'), ((325, 339), 'aoc.d8.main.metadata_sum', ... |
import stko
import pytest
try:
from openbabel import openbabel
except ImportError:
openbabel = None
def test_open_babel_energy(unoptimized_mol):
if openbabel is None:
with pytest.raises(stko.WrapperNotInstalledException):
calculator = stko.OpenBabelEnergy('uff')
else:
ca... | [
"stko.OpenBabelEnergy",
"pytest.raises"
] | [((331, 358), 'stko.OpenBabelEnergy', 'stko.OpenBabelEnergy', (['"""uff"""'], {}), "('uff')\n", (351, 358), False, 'import stko\n'), ((491, 519), 'stko.OpenBabelEnergy', 'stko.OpenBabelEnergy', (['"""gaff"""'], {}), "('gaff')\n", (511, 519), False, 'import stko\n'), ((651, 683), 'stko.OpenBabelEnergy', 'stko.OpenBabelE... |
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import GenericAPIView
from ..permissions import IsAuthenticated
from django.core.cache import cache
from django.conf import settings
from ..authentication import TokenAuthentication
from ..app_settings import (... | [
"django.core.cache.cache.delete",
"rest_framework.response.Response"
] | [((603, 658), 'rest_framework.response.Response', 'Response', (['{}'], {'status': 'status.HTTP_405_METHOD_NOT_ALLOWED'}), '({}, status=status.HTTP_405_METHOD_NOT_ALLOWED)\n', (611, 658), False, 'from rest_framework.response import Response\n'), ((711, 766), 'rest_framework.response.Response', 'Response', (['{}'], {'sta... |
import batoid
import numpy as np
import math
from test_helpers import timer, do_pickle, all_obj_diff
@timer
def test_properties():
import random
random.seed(5)
for i in range(100):
R = random.gauss(0.7, 0.8)
sphere = batoid.Sphere(R)
assert sphere.R == R
do_pickle(sphere)
... | [
"batoid.Ray",
"batoid.Plane",
"random.uniform",
"numpy.sqrt",
"test_helpers.do_pickle",
"numpy.testing.assert_allclose",
"batoid.RayVector",
"math.sqrt",
"random.seed",
"test_helpers.all_obj_diff",
"numpy.random.uniform",
"batoid.Sphere",
"random.gauss"
] | [((155, 169), 'random.seed', 'random.seed', (['(5)'], {}), '(5)\n', (166, 169), False, 'import random\n'), ((366, 381), 'random.seed', 'random.seed', (['(57)'], {}), '(57)\n', (377, 381), False, 'import random\n'), ((1331, 1347), 'random.seed', 'random.seed', (['(577)'], {}), '(577)\n', (1342, 1347), False, 'import ran... |
from django.http.response import HttpResponseForbidden
from .models import Counter, VisitLog
from .utils import get_client_ip
class SiteStatistics(object):
visit_log = None
def process_request(self, request):
if request.path_info.startswith('/admin/'):
return
counter = Counter.o... | [
"django.http.response.HttpResponseForbidden"
] | [((2312, 2346), 'django.http.response.HttpResponseForbidden', 'HttpResponseForbidden', (['"""Banned IP"""'], {}), "('Banned IP')\n", (2333, 2346), False, 'from django.http.response import HttpResponseForbidden\n'), ((2467, 2505), 'django.http.response.HttpResponseForbidden', 'HttpResponseForbidden', (['"""Banned openid... |
#
# Copyright (c) 2019-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"bdb_tools.readers.build_reader"
] | [((976, 1128), 'bdb_tools.readers.build_reader', 'build_reader', ([], {'data_format': "config['file_format']", 'basepath': "config['data_dir']", 'split_row_groups': "config['split_row_groups']", 'backend': "config['backend']"}), "(data_format=config['file_format'], basepath=config['data_dir'],\n split_row_groups=con... |
# Copyright 2019 Google LLC. 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 or a... | [
"tfx.utils.types.TfxArtifact",
"tfx.utils.channel.as_channel",
"tfx.utils.channel.Channel",
"tensorflow.test.main"
] | [((2811, 2825), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2823, 2825), True, 'import tensorflow as tf\n'), ((973, 1004), 'tfx.utils.types.TfxArtifact', 'types.TfxArtifact', (['"""MyTypeName"""'], {}), "('MyTypeName')\n", (990, 1004), False, 'from tfx.utils import types\n'), ((1022, 1053), 'tfx.utils.ty... |
from functools import partial
class counter:
"""
A counter decorator to track how many times a function is called.
"""
def __init__(self, func):
self.func = func
self.count = 0
def __call__(self, *args, **kwargs):
self.count += 1
return self.func(*args, **kwargs)
... | [
"functools.partial"
] | [((694, 724), 'functools.partial', 'partial', (['func', '*args'], {}), '(func, *args, **kwargs)\n', (701, 724), False, 'from functools import partial\n'), ((740, 770), 'functools.partial', 'partial', (['func', '*args'], {}), '(func, *args, **kwargs)\n', (747, 770), False, 'from functools import partial\n')] |
#|-----------------------------------------------------------------------------
#| This source code is provided under the Apache 2.0 license --
#| and is provided AS IS with no warranty or guarantee of fit for purpose. --
#| See the project's LICENSE.md for details. --
... | [
"getopt.getopt",
"json.loads",
"requests.packages.urllib3.disable_warnings",
"json.dumps",
"websocket.WebSocketApp",
"time.sleep",
"sys.exit",
"threading.Thread",
"socket.gethostname"
] | [((823, 889), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', (['InsecureRequestWarning'], {}), '(InsecureRequestWarning)\n', (865, 889), False, 'import requests\n'), ((1049, 1069), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1067, 1069), False, 'import soc... |
from django.urls import reverse_lazy, reverse
from django.shortcuts import get_object_or_404, render, HttpResponse, HttpResponseRedirect
from requests.auth import HTTPBasicAuth
from .models import User, Node
from .forms import CustomUserCreationForm, UserCreationForm
from django.views.generic import ListView
from djan... | [
"django.shortcuts.render",
"json.loads",
"requests.auth.HTTPBasicAuth",
"django.shortcuts.HttpResponse",
"django.shortcuts.get_object_or_404",
"json.dumps",
"django.urls.reverse_lazy",
"django.urls.reverse"
] | [((6322, 6343), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""login"""'], {}), "('login')\n", (6334, 6343), False, 'from django.urls import reverse_lazy, reverse\n'), ((1795, 1852), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['User'], {'username': "self.kwargs['username']"}), "(User, username=self.... |
#from weakref import WeakValueDictionary
import random, operator, weakref
def format_service_group(group):
"""pretty prints the group"""
rstr = '%s [%s]'
if group.cover != None: # Spy for IntSec
return rstr % (group.cover, group.cover.firm)
elif group.spyon != None:
return rstr % (group.spyon, group.spyon.firm... | [
"random.choice"
] | [((1349, 1389), 'random.choice', 'random.choice', (['weightedchoice.cache[lid]'], {}), '(weightedchoice.cache[lid])\n', (1362, 1389), False, 'import random, operator, weakref\n'), ((1529, 1569), 'random.choice', 'random.choice', (['weightedchoice.cache[lid]'], {}), '(weightedchoice.cache[lid])\n', (1542, 1569), False, ... |
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
st.title("Relatório de Aula")
df = pd.read_csv('data/emocoes.csv')
agg = pd.read_csv('data/agg.csv')
Engajado = df[df['emocao'] == 'Engajado']
Engajado_agg = Engajado.groupby(['emocao', 'pessoa']).size().reset_index(name='size')... | [
"plotly.express.pie",
"streamlit.markdown",
"pandas.read_csv",
"streamlit.balloons",
"streamlit.write",
"streamlit.empty",
"plotly.express.line",
"streamlit.info",
"streamlit.plotly_chart",
"streamlit.title"
] | [((91, 120), 'streamlit.title', 'st.title', (['"""Relatório de Aula"""'], {}), "('Relatório de Aula')\n", (99, 120), True, 'import streamlit as st\n'), ((126, 157), 'pandas.read_csv', 'pd.read_csv', (['"""data/emocoes.csv"""'], {}), "('data/emocoes.csv')\n", (137, 157), True, 'import pandas as pd\n'), ((164, 191), 'pan... |
import argparse
import json
import os
from os import listdir
from os.path import isfile, join
class RegisterOtherNominate:
# Register the prize winners of each award to the formatting style.
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--directory",
... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"json.load",
"json.dump"
] | [((240, 265), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (263, 265), False, 'import argparse\n'), ((1533, 1552), 'json.load', 'json.load', (['jsonfile'], {}), '(jsonfile)\n', (1542, 1552), False, 'import json\n'), ((2696, 2786), 'json.dump', 'json.dump', (['self.output', 'jsonfile'], {'ensu... |
import dataclasses as dc
from typing import Any, Dict, Iterable, List, Optional
from loguru import logger
from mate3.field_values import FieldValue, ModelValues
from mate3.read import AllModelReads
from mate3.sunspec.fields import IntegerField
from mate3.sunspec.model_base import Model
from mate3.sunspec.models impor... | [
"loguru.logger.warning",
"dataclasses.field",
"mate3.field_values.FieldValue"
] | [((1340, 1375), 'dataclasses.field', 'dc.field', ([], {'metadata': "{'field': False}"}), "(metadata={'field': False})\n", (1348, 1375), True, 'import dataclasses as dc\n'), ((1564, 1599), 'dataclasses.field', 'dc.field', ([], {'metadata': "{'field': False}"}), "(metadata={'field': False})\n", (1572, 1599), True, 'impor... |
#!/usr/bin/env python
import rospy
from srv_sub_pub.srv import *
NAME = "add_two_ints_server"
def add_two_ints(req):
print("Returning [%s + %s = %s]" % (req.a, req.b, (req.a + req.b)))
return AddTwoIntsResponse(req.a + req.b)
def add_two_ints_server():
rospy.init_node(NAME)
s = rospy.Service('add_t... | [
"rospy.init_node",
"rospy.Service",
"rospy.spin"
] | [((270, 291), 'rospy.init_node', 'rospy.init_node', (['NAME'], {}), '(NAME)\n', (285, 291), False, 'import rospy\n'), ((300, 355), 'rospy.Service', 'rospy.Service', (['"""add_two_ints"""', 'AddTwoInts', 'add_two_ints'], {}), "('add_two_ints', AddTwoInts, add_two_ints)\n", (313, 355), False, 'import rospy\n'), ((423, 43... |
import multiprocessing as mp
class ModuleRecursion(object):
"""Class to handle recursion.
Simple class to handle tracking and storing prior
sub-domains discovred.
"""
def __init__(self):
"""class init.
"""
self.recursion_queue = mp.Queue()
def add_subdomain(self, domain):
"""add subdomain to Q.
... | [
"multiprocessing.Queue"
] | [((248, 258), 'multiprocessing.Queue', 'mp.Queue', ([], {}), '()\n', (256, 258), True, 'import multiprocessing as mp\n')] |
import os
from pyspark import StorageLevel
from geospark.core.SpatialRDD import PolygonRDD
from geospark.core.enums import IndexType, FileDataSplitter
from geospark.core.geom.envelope import Envelope
from geospark.core.spatialOperator import RangeQuery
from tests.test_base import TestBase
from tests.tools import test... | [
"geospark.core.SpatialRDD.PolygonRDD",
"geospark.core.spatialOperator.RangeQuery.SpatialRangeQuery",
"os.path.join",
"geospark.core.geom.envelope.Envelope"
] | [((345, 407), 'os.path.join', 'os.path.join', (['tests_path', '"""resources/primaryroads-polygon.csv"""'], {}), "(tests_path, 'resources/primaryroads-polygon.csv')\n", (357, 407), False, 'import os\n'), ((555, 593), 'geospark.core.geom.envelope.Envelope', 'Envelope', (['(-85.01)', '(-60.01)', '(34.01)', '(50.01)'], {})... |
from open_publishing.core import FieldGroup
from open_publishing.core import FieldDescriptor
from open_publishing.core.enums import CatalogType, VLBCategory, AcademicCategory
from open_publishing.core import SimpleField
from open_publishing.extendable_enum_field import ExtendableEnumField
from open_publishing.genre im... | [
"open_publishing.bisac.BisacList",
"open_publishing.genre.GenresList",
"open_publishing.core.FieldDescriptor",
"open_publishing.extendable_enum_field.ExtendableEnumField",
"open_publishing.core.SimpleField"
] | [((814, 839), 'open_publishing.core.FieldDescriptor', 'FieldDescriptor', (['"""series"""'], {}), "('series')\n", (829, 839), False, 'from open_publishing.core import FieldDescriptor\n'), ((852, 876), 'open_publishing.core.FieldDescriptor', 'FieldDescriptor', (['"""thema"""'], {}), "('thema')\n", (867, 876), False, 'fro... |
import urllib.request,json
from .models import Source,Article
# Getting Api Key
api_key = None
#Getting the base urls
source_base_url = None
article_base_url = None
def configure_request(app):
global api_key,source_base_url,article_base_url
api_key = app.config['SOURCE_API_KEY']
source_base_url = app.conf... | [
"json.loads"
] | [((690, 718), 'json.loads', 'json.loads', (['get_sources_data'], {}), '(get_sources_data)\n', (700, 718), False, 'import urllib.request, json\n'), ((1990, 2018), 'json.loads', 'json.loads', (['get_article_data'], {}), '(get_article_data)\n', (2000, 2018), False, 'import urllib.request, json\n')] |
#!/usr/bin/env/python3
"""Recipe for training a wav2vec-based ctc ASR system with librispeech.
The system employs wav2vec as its encoder. Decoding is performed with
ctc greedy decoder.
To run this recipe, do the following:
> python train_with_wav2vec.py hparams/train_with_wav2vec.yaml
The neural network is trained on C... | [
"logging.getLogger",
"speechbrain.nnet.schedulers.update_learning_rate",
"speechbrain.dataio.dataio.read_audio",
"torch.LongTensor",
"speechbrain.decoders.ctc_greedy_decode",
"speechbrain.dataio.dataset.DynamicItemDataset.from_csv",
"speechbrain.create_experiment_directory",
"pathlib.Path",
"speechb... | [((785, 812), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (802, 812), False, 'import logging\n'), ((7132, 7253), 'speechbrain.dataio.dataset.DynamicItemDataset.from_csv', 'sb.dataio.dataset.DynamicItemDataset.from_csv', ([], {'csv_path': "hparams['train_csv']", 'replacements': "{'data_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 18:28:54 2020
@author: Dr <NAME> (CIMAT-CONACYT, Mexico) jac at cimat.mx
Instantaneous reproduction numbers calculations.
Rts_P, Implementation of Cori et al (2013)
Rts_AR, new filtering version using an autoregressive linear model of Capistrá... | [
"scipy.stats.erlang",
"scipy.stats.gamma.rvs",
"numpy.sqrt",
"plotfrozen.PlotFrozenDist",
"numpy.log",
"scipy.stats.beta.logcdf",
"numpy.array",
"datetime.timedelta",
"scipy.stats.uniform.rvs",
"numpy.arange",
"numpy.flip",
"numpy.where",
"matplotlib.pyplot.close",
"numpy.exp",
"numpy.li... | [((1114, 1138), 'scipy.stats.erlang', 'erlang', ([], {'a': '(3)', 'scale': '(8 / 3)'}), '(a=3, scale=8 / 3)\n', (1120, 1138), False, 'from scipy.stats import erlang, gamma, nbinom, uniform, beta\n'), ((2711, 2718), 'numpy.flip', 'flip', (['w'], {}), '(w)\n', (2715, 2718), False, 'from numpy import arange, diff, loadtxt... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("ProcessOne")
process.load("CondCore.DBCommon.CondDBCommon_cfi")
process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb'
#
# Choose the output database
#
process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_42X_ECAL_... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.bool",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.Path",
"FWCore.Parameter... | [((52, 77), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""ProcessOne"""'], {}), "('ProcessOne')\n", (63, 77), True, 'import FWCore.ParameterSet.Config as cms\n'), ((2957, 2980), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['process.Test1'], {}), '(process.Test1)\n', (2965, 2980), True, 'import FWCore.P... |
from algosdk import logic
from algosdk.future.transaction import ApplicationOptInTxn, AssetOptInTxn, ApplicationNoOpTxn, PaymentTxn, AssetTransferTxn
from ..contract_strings import algofi_manager_strings as manager_strings
from .prepend import get_init_txns
from ..utils import TransactionGroup, Transactions, randint, i... | [
"algosdk.logic.get_application_address",
"algosdk.future.transaction.ApplicationOptInTxn",
"algosdk.future.transaction.PaymentTxn",
"algosdk.future.transaction.AssetTransferTxn"
] | [((1659, 1749), 'algosdk.future.transaction.ApplicationOptInTxn', 'ApplicationOptInTxn', ([], {'sender': 'storage_address', 'sp': 'suggested_params', 'index': 'market_app_id'}), '(sender=storage_address, sp=suggested_params, index=\n market_app_id)\n', (1678, 1749), False, 'from algosdk.future.transaction import App... |
import rumps
import requests
import json
API_URL = 'https://koinex.in/api/ticker'
UPDATE_INTERVAL = 60
CURRENCIES = {
'Bitcoin': 'BTC',
'Ethereum': 'ETH',
'Ripple': 'XRP',
'Litecoin': 'LTC',
'Bitcoin Cash': 'BCH',
}
class KoinexStatusBarApp(rumps.App):
def __init__(self):
super(Koin... | [
"rumps.clicked",
"json.loads",
"rumps.timer",
"requests.get"
] | [((819, 847), 'rumps.timer', 'rumps.timer', (['UPDATE_INTERVAL'], {}), '(UPDATE_INTERVAL)\n', (830, 847), False, 'import rumps\n'), ((897, 918), 'requests.get', 'requests.get', (['API_URL'], {}), '(API_URL)\n', (909, 918), False, 'import requests\n'), ((997, 1025), 'json.loads', 'json.loads', (['response.content'], {})... |
import numpy as np
from numpy.core.fromnumeric import mean
from numpy.core.numeric import True_
from numpy.testing._private.utils import rand
from polynomial_regression import PolynomialRegression
from generate_regression_data import generate_regression_data
from metrics import mean_squared_error # mse
from math impor... | [
"generate_regression_data.generate_regression_data",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"numpy.reshape",
"matplotlib.pyplot.ylabel",
"numpy.random.choice",
"matplotlib.use",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"polynomial_regression.PolynomialRegression",
"nu... | [((637, 693), 'generate_regression_data.generate_regression_data', 'generate_regression_data', (['degree', 'N'], {'amount_of_noise': '(0.1)'}), '(degree, N, amount_of_noise=0.1)\n', (661, 693), False, 'from generate_regression_data import generate_regression_data\n'), ((712, 749), 'numpy.random.choice', 'np.random.choi... |
# EG10-20 Twinkle Twinkle classes
import time
import snaps
class Note:
def __init__(self, note, duration):
self.__note = note
self.__duration = duration
def play(self):
snaps.play_note(self.__note)
time.sleep(self.__duration)
tune = [Note(note=0, duration=0.4), Note(note=0, d... | [
"time.sleep",
"snaps.play_note"
] | [((204, 232), 'snaps.play_note', 'snaps.play_note', (['self.__note'], {}), '(self.__note)\n', (219, 232), False, 'import snaps\n'), ((241, 268), 'time.sleep', 'time.sleep', (['self.__duration'], {}), '(self.__duration)\n', (251, 268), False, 'import time\n')] |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
# LavaVu conf based on conf.py from underworld2
#
# 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 ------------... | [
"mock.Mock",
"os.path.dirname",
"subprocess.call"
] | [((7645, 7694), 'subprocess.call', 'subprocess.call', (['"""./run-nb-to-rst.sh"""'], {'shell': '(True)'}), "('./run-nb-to-rst.sh', shell=True)\n", (7660, 7694), False, 'import subprocess\n'), ((7045, 7070), 'os.path.dirname', 'os.path.dirname', (['__name__'], {}), '(__name__)\n', (7060, 7070), False, 'import os\n'), ((... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
import mkkm_mr
import networkx as nx
from sklearn.cluster import KMeans, SpectralClustering
from snf_simple import SNF
from pamogk import config
from pamogk import label_mapper
from pamogk.data_processor import rnaseq_processor as rp, synapse_rppa_pro... | [
"sklearn.cluster.SpectralClustering",
"snf_simple.SNF",
"pamogk.label_mapper.mark_cont_label_on_pathways",
"mkkm_mr.mkkm_mr",
"mkkm_mr.lib.combine_kernels",
"pamogk.pathway_reader.cx_pathway_reader.read_pathways",
"mkkm_mr.lib.normalize_unit_row",
"pamogk.result_processor.label_analysis.LabelAnalysis"... | [((4840, 4929), 'pamogk.data_processor.rnaseq_processor.process', 'rp.process', (['self.args.rnaseq_patient_data', 'self.args.continuous', 'self.args.threshold'], {}), '(self.args.rnaseq_patient_data, self.args.continuous, self.args.\n threshold)\n', (4850, 4929), True, 'from pamogk.data_processor import rnaseq_proc... |
from .constants import SPECIAL_TOKENS
try:
import re2 as re
except ImportError:
import re
def twitter_sentiment_token_matching(token):
"""Special token matching function for twitter sentiment data."""
if 'URL_TOKEN' in SPECIAL_TOKENS and re.match(r'https?:\/\/[^\s]+', token):
return SPECIAL_TO... | [
"re.match"
] | [((256, 295), 're.match', 're.match', (['"""https?:\\\\/\\\\/[^\\\\s]+"""', 'token'], {}), "('https?:\\\\/\\\\/[^\\\\s]+', token)\n", (264, 295), False, 'import re\n'), ((382, 414), 're.match', 're.match', (['""":-?(\\\\)|D|p)+"""', 'token'], {}), "(':-?(\\\\)|D|p)+', token)\n", (390, 414), False, 'import re\n'), ((506... |
#
# Solver class using Scipy's adaptive time stepper
#
import casadi
import pybamm
import scipy.integrate as it
import numpy as np
class ScipySolver(pybamm.BaseSolver):
"""Solve a discretised model, using scipy._integrate.solve_ivp.
Parameters
----------
method : str, optional
The method to ... | [
"pybamm.SolverError",
"pybamm.citations.register",
"numpy.any",
"numpy.max",
"numpy.array",
"pybamm.Solution"
] | [((748, 794), 'pybamm.citations.register', 'pybamm.citations.register', (['"""virtanen2020scipy"""'], {}), "('virtanen2020scipy')\n", (773, 794), False, 'import pybamm\n'), ((1734, 1775), 'numpy.any', 'np.any', (['[self.method in implicit_methods]'], {}), '([self.method in implicit_methods])\n', (1740, 1775), True, 'im... |
import datetime
from dateutil.parser import parse
from mongoengine import DateTimeField, FileField
from mongoengine.connection import DEFAULT_CONNECTION_NAME
#from mongoengine.python_support import str_types
from six import string_types as str_types
import io
from django.conf import settings
if settings.FILE_DB == se... | [
"mongoengine.FileField",
"dateutil.parser.parse",
"crits.core.s3_tools.delete_file_s3",
"datetime.datetime.now",
"crits.core.s3_tools.put_file_s3",
"crits.core.s3_tools.get_file_s3"
] | [((2267, 2320), 'crits.core.s3_tools.delete_file_s3', 'S3.delete_file_s3', (['self.grid_id', 'self.collection_name'], {}), '(self.grid_id, self.collection_name)\n', (2284, 2320), True, 'import crits.core.s3_tools as S3\n'), ((2992, 3038), 'crits.core.s3_tools.put_file_s3', 'S3.put_file_s3', (['file_obj', 'self.collecti... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import unittest
COLOR = "shiny gold"
FNAME = "input.txt"
N_ITER = 1e7
TEST_FNAME = "test_input.txt"
def main():
"""Main function."""
data = load_input(FNAME)
part1(data)
part2(data)
print("\nUnittests")
unittest.main()
def part1(d... | [
"unittest.main"
] | [((292, 307), 'unittest.main', 'unittest.main', ([], {}), '()\n', (305, 307), False, 'import unittest\n')] |
#!/usr/bin/env python3
#coding: UTF-8
import os
import sys
import time
import json
import argparse
from os.path import join, exists, dirname
from upgrade import check_upgrade
from utils import call, get_conf, get_script, get_command_output, get_install_dir
installdir = get_install_dir()
topdir = dirname(installdir)
... | [
"os.path.exists",
"utils.get_conf",
"argparse.ArgumentParser",
"os.path.join",
"time.sleep",
"os.chdir",
"os.path.dirname",
"utils.get_command_output",
"utils.get_script",
"os.unlink",
"sys.exit",
"utils.call",
"json.dump",
"utils.get_install_dir"
] | [((273, 290), 'utils.get_install_dir', 'get_install_dir', ([], {}), '()\n', (288, 290), False, 'from utils import call, get_conf, get_script, get_command_output, get_install_dir\n'), ((300, 319), 'os.path.dirname', 'dirname', (['installdir'], {}), '(installdir)\n', (307, 319), False, 'from os.path import join, exists, ... |
import sys, os
import nltk
import numpy as np
class Patch():
def __init__(self):
self.id = -1
self.parent_code = ''
self.child_code = ''
self.patches = []
self.verdict = False
self.distance = 0
self.verdict_token = False
pass
def __repr__(self):
... | [
"numpy.sum",
"numpy.asarray"
] | [((1726, 1745), 'numpy.asarray', 'np.asarray', (['patches'], {}), '(patches)\n', (1736, 1745), True, 'import numpy as np\n'), ((3701, 3759), 'numpy.sum', 'np.sum', (['[(1 if p.verdict else 0) for p in unified_patches]'], {}), '([(1 if p.verdict else 0) for p in unified_patches])\n', (3707, 3759), True, 'import numpy as... |
# Copyright (c) 2016-2018 <NAME>. All rights reserved. A
# copyright license for redistribution and use in source and binary forms,
# with or without modification, is hereby granted for non-commercial,
# experimental and research purposes, provided that the following conditions
# are met:
# - Redistributions of source ... | [
"os.path.isfile",
"sys.exit"
] | [((2574, 2585), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (2582, 2585), False, 'import sys\n'), ((4734, 4745), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (4742, 4745), False, 'import sys\n'), ((2175, 2198), 'os.path.isfile', 'os.path.isfile', (['mskfile'], {}), '(mskfile)\n', (2189, 2198), False, 'import os\... |
import os
import platform
import unittest
# ZODB >= 3.9. The blob directory can be a private cache.
shared_blob_dir_choices = (False, True)
RUNNING_ON_TRAVIS = os.environ.get('TRAVIS')
RUNNING_ON_APPVEYOR = os.environ.get('APPVEYOR')
RUNNING_ON_CI = RUNNING_ON_TRAVIS or RUNNING_ON_APPVEYOR
def _do_not_skip(reason):... | [
"unittest.TestSuite",
"unittest.makeSuite",
"relstorage.tests.blob.testblob.storage_reusable_suite",
"os.environ.get",
"relstorage.storage.RelStorage",
"relstorage.options.Options",
"platform.system",
"os.path.abspath"
] | [((163, 187), 'os.environ.get', 'os.environ.get', (['"""TRAVIS"""'], {}), "('TRAVIS')\n", (177, 187), False, 'import os\n'), ((210, 236), 'os.environ.get', 'os.environ.get', (['"""APPVEYOR"""'], {}), "('APPVEYOR')\n", (224, 236), False, 'import os\n'), ((1989, 2048), 'os.environ.get', 'os.environ.get', (['"""RS_DB_HOST... |
'''
MIT License
Copyright (c) 2020 Autonomous Vision Group (AVG), Max Planck Institute for Intelligent Systems Tübingen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, inclu... | [
"torch.nn.Parameter",
"torch.zeros",
"torch.nn.functional.sigmoid"
] | [((2935, 2978), 'torch.nn.Parameter', 'nn.Parameter', (['template'], {'requires_grad': '(False)'}), '(template, requires_grad=False)\n', (2947, 2978), True, 'import torch.nn as nn\n'), ((3030, 3044), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (3041, 3044), False, 'import torch\n'), ((3074, 3101), 'torch.nn.P... |
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2012 <NAME>, <NAME>
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import logging
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.base import BasePlugin, register_plugin
log = logging.getLogg... | [
"logging.getLogger",
"slixmpp.plugins.base.register_plugin"
] | [((305, 332), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (322, 332), False, 'import logging\n'), ((4807, 4832), 'slixmpp.plugins.base.register_plugin', 'register_plugin', (['XEP_0223'], {}), '(XEP_0223)\n', (4822, 4832), False, 'from slixmpp.plugins.base import BasePlugin, register_pl... |
#! python3
# Combines all the pafs in the current working directory into a single pdf
import PyPDF2, os, sys, logging
class Merge ():
"""
Merge all pdfs in the current folder, or specific list of files,
by name, into a single pdf file
"""
def __init__ (self, file_output = "", replace = False, d... | [
"logging.basicConfig",
"os.listdir",
"logging.debug",
"os.path.join",
"os.path.isfile",
"os.path.isdir",
"os.path.basename",
"PyPDF2.PdfFileWriter",
"PyPDF2.PdfFileReader",
"logging.disable"
] | [((488, 586), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '""" %(asctime)s - %(levelname)s - %(message)s"""'}), "(level=logging.DEBUG, format=\n ' %(asctime)s - %(levelname)s - %(message)s')\n", (507, 586), False, 'import PyPDF2, os, sys, logging\n'), ((1462, 1480), 'os.li... |
"""Index related entity names
Revision ID: 323f8d77567b
Revises: 82b34e2<PASSWORD>
Create Date: 2016-11-16 13:00:25.782487
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '82b34e2777a4'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by... | [
"alembic.op.f"
] | [((370, 400), 'alembic.op.f', 'op.f', (['"""ix_related_entity_name"""'], {}), "('ix_related_entity_name')\n", (374, 400), False, 'from alembic import op\n'), ((578, 608), 'alembic.op.f', 'op.f', (['"""ix_related_entity_name"""'], {}), "('ix_related_entity_name')\n", (582, 608), False, 'from alembic import op\n')] |
import random
high_score = 0
def dice_game():
global high_score
while True:
print("Current High Score: ", high_score)
print("1) Roll Dice")
print("2) Leave Game")
choice = input("Enter your choice: ")
if choice == "2":
print("Goodbye")
break
... | [
"random.randint"
] | [((367, 387), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (381, 387), False, 'import random\n'), ((407, 427), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (421, 427), False, 'import random\n')] |
# Author <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | [
"mptb.BertClassifier",
"argparse.ArgumentParser"
] | [((3956, 4048), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""BERT classification."""', 'usage': '"""%(prog)s [options]"""'}), "(description='BERT classification.', usage=\n '%(prog)s [options]')\n", (3979, 4048), False, 'import argparse\n'), ((1685, 2200), 'mptb.BertClassifier', 'Be... |
from django.urls import path
from dev.views import FindMyIp,FindMyGps
app_name = 'dev'
urlpatterns = [
# path('', Main.as_view(), name = 'index'),
path('findmyip', FindMyIp.as_view(), name = 'findmyip'),
path('findmygps', FindMyGps.as_view(), name = 'findmygps'),
] | [
"dev.views.FindMyGps.as_view",
"dev.views.FindMyIp.as_view"
] | [((174, 192), 'dev.views.FindMyIp.as_view', 'FindMyIp.as_view', ([], {}), '()\n', (190, 192), False, 'from dev.views import FindMyIp, FindMyGps\n'), ((236, 255), 'dev.views.FindMyGps.as_view', 'FindMyGps.as_view', ([], {}), '()\n', (253, 255), False, 'from dev.views import FindMyIp, FindMyGps\n')] |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 处理html和xml文本
Desc :
"""
import html
def html_xml():
s = 'Elements are written as "<tag>text</tag>".'
print(s)
print(html.escape(s))
# Disable escaping of quotes
print(html.escape(s, quote=False))
s = 'Spicy Jalapeño'
print(s.enc... | [
"html.escape"
] | [((190, 204), 'html.escape', 'html.escape', (['s'], {}), '(s)\n', (201, 204), False, 'import html\n'), ((250, 277), 'html.escape', 'html.escape', (['s'], {'quote': '(False)'}), '(s, quote=False)\n', (261, 277), False, 'import html\n')] |
import csv, pylab as pl, re
DB = dict();
BD = dict();
whales_ = [];
classes = [];
line_num = 0;
with open('data/train.csv', 'rb') as train_class_data:
data = csv.reader(train_class_data, delimiter=',');
for line in data:
if (line_num == 0):
line_num += 1;
continue;
keys... | [
"pylab.plot",
"pylab.array",
"pylab.savetxt",
"re.sub",
"csv.reader"
] | [((880, 904), 'pylab.plot', 'pl.plot', (['frequency_table'], {}), '(frequency_table)\n', (887, 904), True, 'import csv, pylab as pl, re\n'), ((1637, 1658), 'pylab.array', 'pl.array', (['match_table'], {}), '(match_table)\n', (1645, 1658), True, 'import csv, pylab as pl, re\n'), ((1660, 1722), 'pylab.savetxt', 'pl.savet... |
import numpy as np
import matplotlib.pyplot as plt
#Dahlquist test
#sol1ex = lambda t: np.exp(-t)
#sol2ex = lambda t: np.exp(-2*t)
#oscillator 1
sol1ex = lambda t: np.cos(t**2/2)
sol2ex = lambda t: np.sin(t**2/2)
#oscillator 2
#sol1ex = lambda t: np.exp(np.sin(t**2))
#sol2ex = lambda t: np.exp(np.cos(t**2))
name = 'O... | [
"numpy.fromfile",
"numpy.zeros",
"numpy.cos",
"matplotlib.pyplot.tight_layout",
"numpy.sin",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((329, 367), 'numpy.fromfile', 'np.fromfile', (["('../out/%s_snap_t' % name)"], {}), "('../out/%s_snap_t' % name)\n", (340, 367), True, 'import numpy as np\n'), ((390, 408), 'numpy.zeros', 'np.zeros', (['(nsnap,)'], {}), '((nsnap,))\n', (398, 408), True, 'import numpy as np\n'), ((553, 588), 'matplotlib.pyplot.subplot... |
#!/usr/bin/env python3
"""Interpret an L-String as a set of 3D Turtle commands and record the turtle's path.
Multiple lines of input will be treated as a continuation of a single L-String.
Default commandset:
F,G - Step forward while drawing
f,g - Step forward without drawing
-,+ - Yaw around the normal ... | [
"logging.getLogger",
"argparse.FileType",
"generative.lsystem.interpreter.LSystemInterpeter",
"argparse.ArgumentParser",
"pathlib.Path",
"generative.wkio.serialize_geometries"
] | [((1021, 1124), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (1044, 1124), False, 'import argparse\n'), ((2935, 2996), 'generative.... |
"""
@author: yuboya
"""
### pins position to be sent to robot
## from TransformationCalculation:
import numpy as np
import math
def PointsToRobot(alpha, deltax,deltay,deltaz,xyzc):
sina = math.sin(alpha)
cosa = math.cos(alpha)
pointrs = []
for pointc in xyzc:
# ... | [
"math.cos",
"numpy.array",
"numpy.transpose",
"math.sin"
] | [((222, 237), 'math.sin', 'math.sin', (['alpha'], {}), '(alpha)\n', (230, 237), False, 'import math\n'), ((250, 265), 'math.cos', 'math.cos', (['alpha'], {}), '(alpha)\n', (258, 265), False, 'import math\n'), ((396, 446), 'numpy.array', 'np.array', (['[cosa, -sina, 0, sina, cosa, 0, 0, 0, 1]'], {}), '([cosa, -sina, 0, ... |
import requests
import json
from json import JSONDecodeError
base_uri = "https://api.github.com/"
licenses = ['afl-3.0', 'apache-2.0', 'artistic-2.0', 'bsl-1.0', 'bsd-2-clause', 'license bsd-3-clause', 'bsd-3-clause-clear', 'cc', 'cc0-1.0', 'cc-by-4.0', 'cc-by-sa-4.0', 'wtfpl', 'ecl-2.0', 'epl-1.0', 'epl-2.0', 'eu... | [
"json.loads",
"json.dumps",
"requests.request"
] | [((1361, 1418), 'requests.request', 'requests.request', (["request['method']", 'uri'], {'headers': 'headers'}), "(request['method'], uri, headers=headers)\n", (1377, 1418), False, 'import requests\n'), ((1447, 1472), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (1457, 1472), False, 'import ... |
import os
import tempfile
import transaction
from onegov.core import log
from onegov.core.utils import safe_move
class MailDataManager(object):
""" Takes a postman and an envelope and sends it when the transaction
is commited.
Since we can't really know if a mail can be sent until it happens, we
sim... | [
"os.path.exists",
"transaction.addAfterCommitHook",
"onegov.core.utils.safe_move",
"onegov.core.log.exception",
"tempfile.NamedTemporaryFile",
"transaction.get",
"os.remove"
] | [((889, 938), 'transaction.addAfterCommitHook', 'transaction.addAfterCommitHook', (['after_commit_hook'], {}), '(after_commit_hook)\n', (919, 938), False, 'import transaction\n'), ((2714, 2739), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (2728, 2739), False, 'import os\n'), ((3021, 3054),... |
from django.conf import settings
from django.db import models
from django.dispatch import receiver
from django.urls import Resolver404, resolve
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from cms import operations
from cms.models import CMSPlugin, Placeho... | [
"cms.models.fields.PlaceholderField",
"django.utils.translation.gettext_lazy",
"cms.utils.plugins.get_bound_plugins",
"cms.models.CMSPlugin.get_tree",
"django.dispatch.receiver",
"django.urls.resolve"
] | [((564, 599), 'django.dispatch.receiver', 'receiver', (['pre_placeholder_operation'], {}), '(pre_placeholder_operation)\n', (572, 599), False, 'from django.dispatch import receiver\n'), ((1896, 1944), 'cms.models.fields.PlaceholderField', 'PlaceholderField', ([], {'slotname': '_get_placeholder_slot'}), '(slotname=_get_... |
#!/usr/bin/env python
#coding=utf-8
import json
from lib.sqs import zhihufav_sqs
from lib.tasks import add_note
def get_sqs_queue():
sqs_info = zhihufav_sqs.get_messages(10)
for sqs in sqs_info:
sqs_body = sqs.get_body()
receipt_handle = sqs.receipt_handle
sqs_json = json.loads(sqs_bo... | [
"lib.tasks.add_note.delay",
"json.loads",
"lib.sqs.zhihufav_sqs.get_messages"
] | [((151, 180), 'lib.sqs.zhihufav_sqs.get_messages', 'zhihufav_sqs.get_messages', (['(10)'], {}), '(10)\n', (176, 180), False, 'from lib.sqs import zhihufav_sqs\n'), ((303, 323), 'json.loads', 'json.loads', (['sqs_body'], {}), '(sqs_body)\n', (313, 323), False, 'import json\n'), ((424, 476), 'lib.tasks.add_note.delay', '... |
from subprocess import Popen, PIPE
cmd = "echo hello world"
p = Popen(cmd, shell=True, stdout=PIPE)
ret, err = p.communicate() | [
"subprocess.Popen"
] | [((65, 100), 'subprocess.Popen', 'Popen', (['cmd'], {'shell': '(True)', 'stdout': 'PIPE'}), '(cmd, shell=True, stdout=PIPE)\n', (70, 100), False, 'from subprocess import Popen, PIPE\n')] |
# Generated by Django 2.1.3 on 2018-11-18 02:34
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Conversation',
fields=[
('id', models.AutoF... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((308, 401), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (324, 401), False, 'from django.db import migrations, models\... |
import requests
from bs4 import BeautifulSoup
import json
def loadMasterStock():
url = "http://www.supremenewyork.com/mobile_stock.json"
user = {"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"}
# user = {"User-Ag... | [
"json.loads",
"json.dump",
"requests.get"
] | [((455, 486), 'requests.get', 'requests.get', (['url'], {'headers': 'user'}), '(url, headers=user)\n', (467, 486), False, 'import requests\n'), ((502, 520), 'json.loads', 'json.loads', (['r.text'], {}), '(r.text)\n', (512, 520), False, 'import json\n'), ((571, 628), 'json.dump', 'json.dump', (['masterStock', 'outfile']... |
from API.models import GoesWellWith, Menu
def get_goeswellwith_items(menuitem1):
entries = GoesWellWith.objects.filter(menuitem1=menuitem1)
result = []
if entries.count() <= 0:
result.append('None')
return result
else:
for e in entries:
result.append(Menu.objects.g... | [
"API.models.Menu.objects.get",
"API.models.GoesWellWith.objects.filter"
] | [((97, 145), 'API.models.GoesWellWith.objects.filter', 'GoesWellWith.objects.filter', ([], {'menuitem1': 'menuitem1'}), '(menuitem1=menuitem1)\n', (124, 145), False, 'from API.models import GoesWellWith, Menu\n'), ((306, 341), 'API.models.Menu.objects.get', 'Menu.objects.get', ([], {'id': 'e.menuitem2_id'}), '(id=e.men... |
from typing import Optional
from algorithms.basic_testing import BasicTesting
from simulator.controllers.main_controller import MainController
from simulator.controllers.map.map_controller import MapController
from simulator.controllers.gui.gui_controller import GuiController
from simulator.models.main_model import M... | [
"simulator.views.map.map_view.MapView",
"simulator.models.map_model.MapModel",
"simulator.controllers.gui.gui_controller.GuiController",
"simulator.views.gui.gui_view.GuiView",
"simulator.models.main_model.MainModel",
"simulator.controllers.map.map_controller.MapController",
"simulator.views.main_view.M... | [((2599, 2625), 'simulator.models.main_model.MainModel', 'MainModel', (['self.__services'], {}), '(self.__services)\n', (2608, 2625), False, 'from simulator.models.main_model import MainModel\n'), ((2675, 2719), 'simulator.views.main_view.MainView', 'MainView', (['self.__services', 'self.__main', 'None'], {}), '(self._... |
import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Lebanon"
def get_gen_file(self):
return "{}/lbn_processedmap.json".format(settings.CARTOGRAM_DATA_DIR)
def validate_values(self, val... | [
"csv.reader"
] | [((841, 860), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (851, 860), False, 'import csv\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
@click.command()
@click.option('-n', '--name', default='World', help='Greeting partner')
def cmd(name):
"""
Show greeting message.
:type name: str
"""
msg = 'Hello, {name}!'.format(name=name)
click.echo(msg)
def main():
cmd()
... | [
"click.option",
"click.echo",
"click.command"
] | [((63, 78), 'click.command', 'click.command', ([], {}), '()\n', (76, 78), False, 'import click\n'), ((80, 150), 'click.option', 'click.option', (['"""-n"""', '"""--name"""'], {'default': '"""World"""', 'help': '"""Greeting partner"""'}), "('-n', '--name', default='World', help='Greeting partner')\n", (92, 150), False, ... |
# Copyright 2014 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.
import mojo_lexer
import unittest
# Try to load the ply module, if not, then assume it is in the third_party
# directory.
try:
# Disable lint check which ... | [
"unittest.main",
"ply.lex.LexToken",
"mojo_lexer.Lexer",
"unittest.TestCase.__init__"
] | [((1345, 1359), 'ply.lex.LexToken', 'lex.LexToken', ([], {}), '()\n', (1357, 1359), False, 'from ply import lex\n'), ((7166, 7181), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7179, 7181), False, 'import unittest\n'), ((1744, 1793), 'unittest.TestCase.__init__', 'unittest.TestCase.__init__', (['self', '*args']... |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, Inc.
# 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... | [
"pyeapi.config_for",
"syslog.openlog",
"pyeapi.client.make_connection",
"pyeapi.client.Node",
"pyeapi.load_config"
] | [((5396, 5435), 'pyeapi.client.make_connection', 'pyeapi.client.make_connection', ([], {}), '(**config)\n', (5425, 5435), False, 'import pyeapi\n'), ((5451, 5491), 'pyeapi.client.Node', 'pyeapi.client.Node', (['connection'], {}), '(connection, **config)\n', (5469, 5491), False, 'import pyeapi\n'), ((13693, 13732), 'pye... |
"""Setup configuration."""
import setuptools
from furystoolbox import __version__
with open("README.md", "r") as fh:
LONG = fh.read()
REQUIRES = ['click>=7.0',
'requests>=2.21.0',
'PyGithub>=1.43.4']
setuptools.setup(
name="furystoolbox",
version=__version__,
author="<NAME>",
... | [
"setuptools.find_packages"
] | [((563, 589), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (587, 589), False, 'import setuptools\n')] |
"""
This is the script containing the calibration module, basically calculating homography matrix.
This code and data is released under the Creative Commons Attribution-NonCommercial 4.0 International license (CC BY-NC.) In a nutshell:
# The license is only for non-commercial use (commercial licenses can be obtain... | [
"cv2.findCirclesGrid",
"cv2.SimpleBlobDetector_create",
"cv2.findHomography",
"cv2.medianBlur",
"cv2.morphologyEx",
"cv2.adaptiveThreshold",
"cv2.SimpleBlobDetector_Params",
"numpy.array",
"numpy.zeros",
"cv2.cvtColor",
"matplotlib.pyplot.figure",
"cv2.drawChessboardCorners",
"cv2.getStructu... | [((1681, 1704), 'cv2.medianBlur', 'cv2.medianBlur', (['img', '(15)'], {}), '(img, 15)\n', (1695, 1704), False, 'import cv2\n'), ((1742, 1837), 'cv2.adaptiveThreshold', 'cv2.adaptiveThreshold', (['img', '(255)', 'cv2.ADAPTIVE_THRESH_GAUSSIAN_C', 'cv2.THRESH_BINARY', '(121)', '(0)'], {}), '(img, 255, cv2.ADAPTIVE_THRESH_... |
'''
# Amazon Kinesis Construct Library
<!--BEGIN STABILITY BANNER-->---


---
<!--END STABILITY B... | [
"publication.publish",
"jsii.create",
"jsii.invoke",
"jsii.interface",
"jsii.implements",
"jsii.sget",
"jsii.proxy_for",
"jsii.set",
"jsii.data_type",
"jsii.sinvoke",
"jsii.enum",
"jsii.get",
"jsii.member",
"typing.cast"
] | [((7926, 7968), 'jsii.implements', 'jsii.implements', (['aws_cdk.core.IInspectable'], {}), '(aws_cdk.core.IInspectable)\n', (7941, 7968), False, 'import jsii\n'), ((16464, 16506), 'jsii.implements', 'jsii.implements', (['aws_cdk.core.IInspectable'], {}), '(aws_cdk.core.IInspectable)\n', (16479, 16506), False, 'import j... |
import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
super(EncoderCNN, self).__init__()
resnet = models.resnet50(pretrained=True)
for param in resnet.parameters... | [
"torch.nn.Sequential",
"torch.nn.LSTM",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torchvision.models.resnet50",
"torch.zeros",
"torch.nn.Embedding"
] | [((249, 281), 'torchvision.models.resnet50', 'models.resnet50', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (264, 281), True, 'import torchvision.models as models\n'), ((442, 465), 'torch.nn.Sequential', 'nn.Sequential', (['*modules'], {}), '(*modules)\n', (455, 465), True, 'import torch.nn as nn\n'), ((487,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 14:36:46 2019
@author: Tawanda
"""
import sys
import argparse
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_arg... | [
"selenium.webdriver.Chrome",
"argparse.ArgumentParser",
"sys.exit"
] | [((276, 301), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (299, 301), False, 'import argparse\n'), ((553, 598), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'args.driver'}), '(executable_path=args.driver)\n', (569, 598), False, 'from selenium import webdriver\n')... |
"""Learn ideal points with the text-based ideal point model (TBIP).
Let y_{dv} denote the counts of word v in document d. Let x_d refer to the
ideal point of the author of document d. Then we model:
theta, beta ~ Gamma(alpha, alpha)
x, eta ~ N(0, 1)
y_{dv} ~ Pois(sum_k theta_dk beta_kv exp(x_d * eta_kv).
We perform... | [
"numpy.sqrt",
"tensorflow.get_variable",
"tensorflow.initializers.random_normal",
"tensorflow.reduce_sum",
"numpy.int32",
"numpy.log",
"numpy.argsort",
"numpy.array",
"tensorflow.nn.softplus",
"tensorflow.gfile.MakeDirs",
"tensorflow.reduce_mean",
"tensorflow.sparse.to_dense",
"tensorflow.se... | [((1743, 1820), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""learning_rate"""'], {'default': '(0.01)', 'help': '"""Adam learning rate."""'}), "('learning_rate', default=0.01, help='Adam learning rate.')\n", (1761, 1820), False, 'from absl import flags\n'), ((1859, 1955), 'absl.flags.DEFINE_integer', 'flags.DE... |
from tkinter import *
from tax_profiler import TaxProfile
from tkinter import messagebox as mb
class Example(Frame, TaxProfile):
def __init__(self, parent):
TaxProfile.__init__(self)
Frame.__init__(self, parent, background="lightblue")
parent.minsize(width=500, height=200)
parent.m... | [
"tkinter.messagebox.showerror",
"tax_profiler.TaxProfile.__init__"
] | [((171, 196), 'tax_profiler.TaxProfile.__init__', 'TaxProfile.__init__', (['self'], {}), '(self)\n', (190, 196), False, 'from tax_profiler import TaxProfile\n'), ((1068, 1121), 'tkinter.messagebox.showerror', 'mb.showerror', (['"""Error"""', '"""Введите квартал числом (1-4)"""'], {}), "('Error', 'Введите квартал числом... |
from django.contrib import admin
from lms_app.models import Professor
admin.site.register(Professor)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((72, 102), 'django.contrib.admin.site.register', 'admin.site.register', (['Professor'], {}), '(Professor)\n', (91, 102), False, 'from django.contrib import admin\n')] |
from JDI.web.selenium.elements.composite.web_site import WebSite
from tests.jdi_uitests_webtests.main.page_objects.w3c_site.frame_page import FramePage
class W3cSite(WebSite):
domain = "https://www.w3schools.com"
frame_page = FramePage(url="/tags/tag_button.asp", domain=domain)
| [
"tests.jdi_uitests_webtests.main.page_objects.w3c_site.frame_page.FramePage"
] | [((237, 289), 'tests.jdi_uitests_webtests.main.page_objects.w3c_site.frame_page.FramePage', 'FramePage', ([], {'url': '"""/tags/tag_button.asp"""', 'domain': 'domain'}), "(url='/tags/tag_button.asp', domain=domain)\n", (246, 289), False, 'from tests.jdi_uitests_webtests.main.page_objects.w3c_site.frame_page import Fram... |
import copy
import logging
import numpy as np
import six
import tensorflow as tf
from functools import wraps
from contextlib import contextmanager
from .backend_base import BackendBase, FunctionBase, DeviceDecorator
try:
from tensorflow.contrib.distributions import fill_triangular
except:
print("Cannot find fi... | [
"tensorflow.tile",
"tensorflow.matrix_diag_part",
"tensorflow.multiply",
"tensorflow.einsum",
"tensorflow.gradients",
"tensorflow.nn.softplus",
"tensorflow.nn.conv2d_transpose",
"tensorflow.while_loop",
"tensorflow.scan",
"tensorflow.pow",
"tensorflow.Session",
"functools.wraps",
"tensorflow... | [((899, 933), 'six.add_metaclass', 'six.add_metaclass', (['DeviceDecorator'], {}), '(DeviceDecorator)\n', (916, 933), False, 'import six\n'), ((1297, 1310), 'functools.wraps', 'wraps', (['method'], {}), '(method)\n', (1302, 1310), False, 'from functools import wraps\n'), ((1545, 1572), 'tensorflow.enable_eager_executio... |
from __future__ import absolute_import, division, print_function
import cv2
import pandas as pd
import numpy as np
import six
import ubelt as ub
from six.moves import zip_longest
from os.path import join, dirname
import warnings
def multi_plot(xdata=None, ydata=[], **kwargs):
r"""
plots multiple lines, bars, ... | [
"numpy.sqrt",
"sys.platform.startswith",
"io.BytesIO",
"colorsys.hsv_to_rgb",
"matplotlib.collections.LineCollection",
"numpy.array",
"matplotlib.colors.CSS4_COLORS.keys",
"numpy.isfinite",
"cv2.imdecode",
"matplotlib.pyplot.switch_backend",
"netharn.util.imutil.ensure_float01",
"netharn.util.... | [((8034, 8054), 'numpy.array', 'np.array', (['ydata_list'], {}), '(ydata_list)\n', (8042, 8054), True, 'import numpy as np\n'), ((12667, 12686), 'matplotlib.rcParams.copy', 'mpl.rcParams.copy', ([], {}), '()\n', (12684, 12686), True, 'import matplotlib as mpl\n'), ((14038, 14099), 'matplotlib.font_manager.FontPropertie... |
from torchvision.transforms import transforms
from torch.utils.data import DataLoader
from torchvision.datasets import ImageFolder
import torch as T
import torch.optim as optim
from model import Generator, Discriminator
from loss_fn import GeneratorLoss, TVLoss
from utils import show_progress, save
import datetime
impo... | [
"utils.save",
"os.listdir",
"model.Discriminator",
"torchvision.datasets.ImageFolder",
"datetime.datetime.now",
"torch.cuda.is_available",
"torchvision.transforms.transforms.Resize",
"os.mkdir",
"gc.collect",
"torch.utils.data.DataLoader",
"torchvision.transforms.transforms.ToTensor",
"torchvi... | [((1034, 1079), 'torchvision.datasets.ImageFolder', 'ImageFolder', (['rootpath'], {'transform': 'transform_hr'}), '(rootpath, transform=transform_hr)\n', (1045, 1079), False, 'from torchvision.datasets import ImageFolder\n'), ((1459, 1504), 'torchvision.datasets.ImageFolder', 'ImageFolder', (['rootpath'], {'transform':... |
"""This algorithm implements the Wang Generalization algotithm with constraint checking
This algorithm simplifies lines. It detects for each line the bends. It analyze the bend and
remove the bends that are below a certain diameter. The point and lines that do not need
to be simplified are still used to... | [
"shapely.geometry.LinearRing",
"shapely.affinity.scale",
"math.acos",
"lib_geosim.GenUtil.calculate_adjusted_area",
"math.sqrt",
"lib_geosim.GenUtil.angle_vecor",
"shapely.geometry.Point.coords.__set__",
"math.cos",
"shapely.geometry.Polygon",
"shapely.geometry.LineString",
"lib_geosim.GenUtil.o... | [((18132, 18166), 'shapely.geometry.Point.coords.__set__', 'Point.coords.__set__', (['self', 'coords'], {}), '(self, coords)\n', (18152, 18166), False, 'from shapely.geometry import Point, LineString, LinearRing, Polygon\n'), ((20591, 20676), 'shapely.affinity.scale', 'affinity.scale', (['new_sub_line'], {'xfact': '(1.... |
#!/usr/bin/env python3
import socket
port = 12345
MAX_SIZE = 65535
target_address = '127.0.0.1'
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((target_address,port))
s.listen(2)
conn, addr = s.accept()
# conn: socket is the client socket.
print(addr, "Now Connected")
text = "Thank you for connecting fro... | [
"socket.socket"
] | [((103, 152), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (116, 152), False, 'import socket\n')] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 30 20:11:19 2016
@author: stephen
"""
from __future__ import print_function
from keras.models import Model
from keras.utils import np_utils
import numpy as np
import os
from keras.callbacks import ModelCheckpoint
import pandas as pd
import sys
i... | [
"keras.optimizers.Adam",
"keras.layers.pooling.GlobalAveragePooling1D",
"numpy.unique",
"keras.callbacks.ModelCheckpoint",
"keras.layers.normalization.BatchNormalization",
"keras.callbacks.ReduceLROnPlateau",
"keras.layers.Dense",
"keras.layers.Input",
"keras.utils.np_utils.to_categorical",
"keras... | [((420, 455), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'delimiter': '""","""'}), "(filename, delimiter=',')\n", (430, 455), True, 'import numpy as np\n'), ((1683, 1727), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['y_train', 'nb_classes'], {}), '(y_train, nb_classes)\n', (1706, 1727), Fals... |
import os
indentSize=1 #size of the indent
class calcs():
def __init__(self):
self.indent=0
self.txt=[] #text for each line
def clear(self):
self.txt.clear()
self.indent=0
def addCalcs(self,calc):
s=[' ' * self.indent+ t for t in calc.txt]
self.txt += s
... | [
"os.linesep.join"
] | [((447, 472), 'os.linesep.join', 'os.linesep.join', (['self.txt'], {}), '(self.txt)\n', (462, 472), False, 'import os\n')] |
#!/usr/bin/env python
from __future__ import division
"""MODULE_DESCRIPTION"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2015, Cohrint"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import logging
from cop... | [
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.colorbar",
"numpy.log",
"numpy.linspace",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"copy.deepcopy",
"matplotlib.pyplot.axis"
] | [((6354, 6372), 'matplotlib.pyplot.axis', 'plt.axis', (['"""scaled"""'], {}), "('scaled')\n", (6362, 6372), True, 'import matplotlib.pyplot as plt\n'), ((7099, 7113), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (7107, 7113), False, 'from copy import deepcopy\n'), ((4944, 4972), 'mpl_toolkits.axes_grid1.mak... |
from __future__ import print_function
import numpy as np
import pandas as pd
from sklearn import metrics
class Options(object):
"""Options used by the model."""
def __init__(self):
# Model options.
# Embedding dimension.
self.embedding_size = 32
# The initial learning rate.
... | [
"pandas.read_csv",
"numpy.random.choice",
"sklearn.metrics.auc",
"numpy.random.random",
"numpy.array",
"numpy.random.randint",
"sklearn.metrics.log_loss",
"sklearn.metrics.roc_curve",
"numpy.ndarray"
] | [((2763, 2802), 'numpy.random.randint', 'np.random.randint', (['temp_sequence_length'], {}), '(temp_sequence_length)\n', (2780, 2802), True, 'import numpy as np\n'), ((5627, 5666), 'sklearn.metrics.roc_curve', 'metrics.roc_curve', (['y', 'pred'], {'pos_label': '(1)'}), '(y, pred, pos_label=1)\n', (5644, 5666), False, '... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import versioneer
def read(path):
"""
Read the contents of a file.
"""
with open(path) as f:
return f.read()
setup(
classifiers=[
'Intended Audience :: Developers',
'License ::... | [
"versioneer.get_cmdclass",
"versioneer.get_version"
] | [((813, 837), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (835, 837), False, 'import versioneer\n'), ((852, 877), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (875, 877), False, 'import versioneer\n')] |
from tkinter import Tk, Frame, Scrollbar, Label, Text, Button, Entry, StringVar, IntVar, TclError
from tkinter.messagebox import showerror, showwarning
from client import Client
from threading import Thread
from socket import error as socket_error
destroy = False
def on_closing():
global destroy
destroy = Tr... | [
"tkinter.messagebox.showwarning",
"tkinter.IntVar",
"tkinter.messagebox.showerror",
"tkinter.Entry",
"tkinter.Button",
"tkinter.StringVar",
"tkinter.Tk",
"tkinter.Scrollbar",
"tkinter.Label",
"threading.Thread",
"tkinter.Text",
"tkinter.Frame"
] | [((1855, 1859), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (1857, 1859), False, 'from tkinter import Tk, Frame, Scrollbar, Label, Text, Button, Entry, StringVar, IntVar, TclError\n'), ((1888, 1899), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (1897, 1899), False, 'from tkinter import Tk, Frame, Scrollbar, Label, Tex... |
import inspect
import threading
import time
from six.moves import urllib
from ..errors import ConfigurationError
from ..util import get_dependency
from .base import Storage
class MemcachedStorage(Storage):
"""
Rate limit storage with memcached as backend.
Depends on the `pymemcache` library.
"""
... | [
"six.moves.urllib.parse.urlparse",
"time.time",
"threading.local",
"inspect.getargspec"
] | [((811, 837), 'six.moves.urllib.parse.urlparse', 'urllib.parse.urlparse', (['uri'], {}), '(uri)\n', (832, 837), False, 'from six.moves import urllib\n'), ((1726, 1743), 'threading.local', 'threading.local', ([], {}), '()\n', (1741, 1743), False, 'import threading\n'), ((2259, 2283), 'inspect.getargspec', 'inspect.getar... |
from __future__ import division
import pandas as pd
import numpy as np
import calendar
import os.path as op
import sys
from datetime import datetime
from dateutil.relativedelta import relativedelta
from scipy.stats import percentileofscore
from scipy.stats import scoreatpercentile, pearsonr
from math import *
import t... | [
"numpy.ones"
] | [((598, 667), 'numpy.ones', 'np.ones', (['(TARGET_FCST_EYR - TARGET_FCST_SYR + 1, LEAD_FINAL, ENS_NUM)'], {}), '((TARGET_FCST_EYR - TARGET_FCST_SYR + 1, LEAD_FINAL, ENS_NUM))\n', (605, 667), True, 'import numpy as np\n'), ((4583, 4670), 'numpy.ones', 'np.ones', (['(TARGET_FCST_EYR - TARGET_FCST_SYR + 1, LEAD_FINAL, ENS... |
###################################
# Created on 22:20, Nov. 16th, 2020
# Author: fassial
# Filename: utils.py
###################################
# dep
import os
import pandas as pd
import scanpy as sp
from collections import defaultdict
# local dep
# macro
# def get_data_lm func
def get_data_lm(sce_fname, sparse = ... | [
"os.path.splitext",
"collections.defaultdict",
"pandas.read_csv",
"scanpy.read_loom"
] | [((677, 762), 'collections.defaultdict', 'defaultdict', (['(lambda : get_data_csv)', "{'.loom': get_data_lm, '.csv': get_data_csv}"], {}), "(lambda : get_data_csv, {'.loom': get_data_lm, '.csv': get_data_csv}\n )\n", (688, 762), False, 'from collections import defaultdict\n'), ((353, 391), 'scanpy.read_loom', 'sp.re... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | [
"flask.request.args.get",
"requests.Session",
"flask.Flask",
"re.compile",
"pickle.dumps",
"base64.b64encode",
"io.BytesIO",
"pickle.loads",
"tweepy.AppAuthHandler",
"redis.from_url",
"json.dumps",
"dotenv.load_dotenv",
"tweepy.API",
"xml.etree.ElementTree.fromstring",
"traceback.print_e... | [((1437, 1457), 'dotenv.load_dotenv', 'dotenv.load_dotenv', ([], {}), '()\n', (1455, 1457), False, 'import dotenv\n'), ((1695, 1716), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (1706, 1716), False, 'import flask\n'), ((2054, 2159), 'requests.adapters.HTTPAdapter', 'requests.adapters.HTTPAdapter',... |
# Generated by Django 1.10.6 on 2017-03-13 04:46
# Modified by <NAME> on 2019-06-22 16:48
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
import apps.core.models
class Migration(migrations.Migration):
initial = True
de... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.migrations.swappable_dependency"
] | [((402, 459), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (433, 459), False, 'from django.db import migrations, models\n'), ((632, 725), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# -*- coding: utf-8 -*-
"""
obspy.io.nied.knet - K-NET/KiK-net read support for ObsPy
=========================================================
Reading of the K-NET and KiK-net ASCII format as defined on
http://www.kyoshin.bosai.go.jp.
"""
from __future__ import (absolute_import, division, print_function,
... | [
"obspy.Stream",
"obspy.UTCDateTime.strptime",
"numpy.array",
"doctest.testmod",
"obspy.Trace",
"obspy.core.trace.Stats",
"re.search"
] | [((3927, 3972), 'obspy.UTCDateTime.strptime', 'UTCDateTime.strptime', (['dt', '"""%Y/%m/%d %H:%M:%S"""'], {}), "(dt, '%Y/%m/%d %H:%M:%S')\n", (3947, 3972), False, 'from obspy import UTCDateTime, Stream, Trace\n'), ((6132, 6160), 're.search', 're.search', (['"""[0-9]*"""', 'freqstr'], {}), "('[0-9]*', freqstr)\n", (6141... |
from flask import Blueprint, jsonify, request, redirect, abort, url_for, render_template
main = Blueprint('main', __name__)
# routes
@main.route('/', methods = ['GET'])
def Abort():
return redirect(url_for('main.index'))
# abort(403)
@main.route('/default.tpl', methods = ['GET'])
def index():
title = 'DE A... | [
"flask.render_template",
"flask.Blueprint",
"flask.url_for"
] | [((96, 123), 'flask.Blueprint', 'Blueprint', (['"""main"""', '__name__'], {}), "('main', __name__)\n", (105, 123), False, 'from flask import Blueprint, jsonify, request, redirect, abort, url_for, render_template\n'), ((335, 376), 'flask.render_template', 'render_template', (['"""dflt.html"""'], {'title': 'title'}), "('... |
from Artist import Artist
class Artwork:
def __init__(self, title='None', year_created=0,\
artist=Artist()):
self.title = title
self.year_created = year_created
self.artist = artist
def print_info(self):
self.artist.print_info()
print('Title: %s, %d' % (self.title,... | [
"Artist.Artist"
] | [((108, 116), 'Artist.Artist', 'Artist', ([], {}), '()\n', (114, 116), False, 'from Artist import Artist\n')] |
import datetime
from django.contrib.auth.models import User, Group
from django.utils import timezone
from rest_framework.test import APITestCase
import fvh_courier.models.base
from fvh_courier import models
class FVHAPITestCase(APITestCase):
def assert_dict_contains(self, superset, subset, path=''):
for... | [
"fvh_courier.models.Address.objects.create",
"datetime.timedelta",
"django.utils.timezone.now",
"django.contrib.auth.models.User.objects.create",
"fvh_courier.models.CourierCompany.objects.create"
] | [((1422, 1436), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (1434, 1436), False, 'from django.utils import timezone\n'), ((871, 929), 'fvh_courier.models.CourierCompany.objects.create', 'models.CourierCompany.objects.create', ([], {'name': '"""Couriers r us"""'}), "(name='Couriers r us')\n", (907, 92... |
# -*- coding: utf-8 -*-
import glob
import os
import json
from collections import OrderedDict
import itertools
import re
from datetime import datetime
import six
from six import iteritems
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import or_
from .. import field_names, localization
from ..models impo... | [
"datetime.datetime",
"collections.OrderedDict",
"os.listdir",
"six.moves.input",
"re.compile",
"os.path.join",
"datetime.datetime.now",
"flask.ext.sqlalchemy.SQLAlchemy",
"functools.partial",
"six.iteritems",
"sqlalchemy.or_"
] | [((551, 564), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (562, 564), False, 'from collections import OrderedDict\n'), ((616, 658), 're.compile', 're.compile', (['"""Accidents Type (?P<type>\\\\d)"""'], {}), "('Accidents Type (?P<type>\\\\d)')\n", (626, 658), False, 'import re\n'), ((1230, 1245), 'flask... |
# Copyright 2020 Google LLC. 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 or a... | [
"os.path.join"
] | [((1458, 1503), 'os.path.join', 'os.path.join', (['"""gs://"""', 'GCS_BUCKET_NAME', '"""tmp"""'], {}), "('gs://', GCS_BUCKET_NAME, 'tmp')\n", (1470, 1503), False, 'import os\n')] |
"""A run_fn method called by the TFX Trainer component."""
import os
import logging
from tfx import v1 as tfx
from tfx_taxifare_tips.model_training import defaults
from tfx_taxifare_tips.model_training import model_trainer
from tfx_taxifare_tips.model_training import model_exporter
# TFX Trainer will call ... | [
"tfx_taxifare_tips.model_training.model_trainer.train",
"tfx_taxifare_tips.model_training.defaults.update_hyperparameters",
"os.path.dirname",
"tfx_taxifare_tips.model_training.model_trainer.evaluate",
"tfx_taxifare_tips.model_training.model_exporter.export_serving_model",
"logging.info"
] | [((606, 645), 'logging.info', 'logging.info', (['"""Model Runner started..."""'], {}), "('Model Runner started...')\n", (618, 645), False, 'import logging\n'), ((651, 687), 'logging.info', 'logging.info', (['"""fn_args: %s"""', 'fn_args'], {}), "('fn_args: %s', fn_args)\n", (663, 687), False, 'import logging\n'), ((693... |