code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#<NAME>
#Weekly Task 7
#Read in a file from a Command line argument
#Return total amount of times a letter (case sensitive) appears in a file
#Program has an input option to select which letter the user wants a return for
# SYS module used for command line arguments
#Ref https://www.tutorialspoint.com/python/python_... | [
"sys.exit"
] | [((1393, 1404), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1401, 1404), False, 'import sys\n'), ((1600, 1611), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1608, 1611), False, 'import sys\n'), ((1733, 1744), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1741, 1744), False, 'import sys\n')] |
#!/usr/bin/env python
PROGRAM_NAME = "cg-add-route.py"
PROGRAM_DESCRIPTION = """
CloudGenix script
---------------------------------------
This script quickly adds a global route to a site for all elements at that site
"""
from cloudgenix import API, jd
import os
import sys
import argparse
from fuzzywuzzy import fuzz
i... | [
"ipaddress.ip_network",
"argparse.ArgumentParser",
"cloudgenix.jd",
"ipaddress.ip_address",
"os.environ.get",
"cloudgenix.API",
"sys.exit"
] | [((364, 369), 'cloudgenix.API', 'API', ([], {}), '()\n', (367, 369), False, 'from cloudgenix import API, jd\n'), ((499, 633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'PROGRAM_NAME', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': 'PROGRAM_DESCRIPTION'}), '(prog=PROG... |
from flask_restful import Resource
from models.organization import OrganizationModel
class OrganizationName(Resource):
# GET method
def get(self, name):
org = OrganizationModel.find_by_name(name)
if org:
return org.json()
return {'message': 'Organization not found'}, 404
... | [
"models.organization.OrganizationModel.find_by_name",
"models.organization.OrganizationModel.objects"
] | [((180, 216), 'models.organization.OrganizationModel.find_by_name', 'OrganizationModel.find_by_name', (['name'], {}), '(name)\n', (210, 216), False, 'from models.organization import OrganizationModel\n'), ((450, 477), 'models.organization.OrganizationModel.objects', 'OrganizationModel.objects', ([], {}), '()\n', (475, ... |
import numpy as np
import sklearn
def sequences_from_log_and_indices(log, indices):
"""
Creates sequences from log and indices.
:param log: event log.
:param indices: indices of instances in the event log.
:return: list of sequences.
"""
sequences = []
for index in indices:
s... | [
"sklearn.model_selection.train_test_split"
] | [((3931, 4029), 'sklearn.model_selection.train_test_split', 'sklearn.model_selection.train_test_split', (['sequences', 'sequences'], {'test_size': '(0.1)', 'random_state': '(0)'}), '(sequences, sequences, test_size=\n 0.1, random_state=0)\n', (3971, 4029), False, 'import sklearn\n')] |
import datetime
from django.core.management import BaseCommand
from django.conf import settings
from django.utils import timezone
from jobs.models import Job
class Command(BaseCommand):
""" Expire jobs older than settings.JOB_THRESHOLD_DAYS """
def handle(self, **options):
days = getattr(settings, ... | [
"django.utils.timezone.now",
"jobs.models.Job.objects.filter",
"datetime.timedelta"
] | [((367, 381), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (379, 381), False, 'from django.utils import timezone\n'), ((384, 413), 'datetime.timedelta', 'datetime.timedelta', ([], {'days': 'days'}), '(days=days)\n', (402, 413), False, 'import datetime\n'), ((423, 494), 'jobs.models.Job.objects.filter'... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['say_hello', 'HelloSayer', 'bubble_scatter']
# Cell
import numpy as np
import matplotlib.pyplot as plt
# Cell
def say_hello(to):
"Say hello to anybody"
return f'Hello {to}!'
# Cell
class HelloSayer:
"Say h... | [
"numpy.random.rand",
"matplotlib.pyplot.scatter",
"numpy.random.seed",
"matplotlib.pyplot.show"
] | [((526, 550), 'numpy.random.seed', 'np.random.seed', (['(19680801)'], {}), '(19680801)\n', (540, 550), True, 'import numpy as np\n'), ((557, 574), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)\n', (571, 574), True, 'import numpy as np\n'), ((581, 598), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)... |
import unittest
import os
from collections import Counter
import pandas as pd
from installed_clients.WorkspaceClient import Workspace
from installed_clients.DataFileUtilClient import DataFileUtil
class DownloadMetagenomeProteins(unittest.TestCase):
@classmethod
def setUpClass(self):
self.token = "<KE... | [
"installed_clients.WorkspaceClient.Workspace",
"installed_clients.DataFileUtilClient.DataFileUtil"
] | [((396, 431), 'installed_clients.WorkspaceClient.Workspace', 'Workspace', (['ws_url'], {'token': 'self.token'}), '(ws_url, token=self.token)\n', (405, 431), False, 'from installed_clients.WorkspaceClient import Workspace\n'), ((1064, 1126), 'installed_clients.DataFileUtilClient.DataFileUtil', 'DataFileUtil', (["os.envi... |
import os
import datetime
import weasyprint
import pandas
from jinja2 import Environment, FileSystemLoader
from ..config import SETTINGS
from .PlotsMixin.give_quotes_html_locations import give_quotes_html_locations
from ...version import __version__ as version
class PdfReportMixin:
def make_html_report(self):
... | [
"jinja2.FileSystemLoader",
"os.path.join",
"weasyprint.HTML",
"datetime.datetime.now"
] | [((5983, 6023), 'os.path.join', 'os.path.join', (['base_path', '"""static"""', '"""css"""'], {}), "(base_path, 'static', 'css')\n", (5995, 6023), False, 'import os\n'), ((6243, 6295), 'weasyprint.HTML', 'weasyprint.HTML', ([], {'string': 'html_out', 'base_url': 'base_path'}), '(string=html_out, base_url=base_path)\n', ... |
from unittest.mock import patch
from tests.test_rrpproxy_base import TestRRPProxyBase
class TestRRPProxyTransferDomain(TestRRPProxyBase):
@patch('rrpproxy.RRPProxy.call')
def test_calls_call_correctly(self, call_mock):
response = self.proxy.transfer_domain(domain='example.com', action='REQUEST', owne... | [
"unittest.mock.patch"
] | [((146, 177), 'unittest.mock.patch', 'patch', (['"""rrpproxy.RRPProxy.call"""'], {}), "('rrpproxy.RRPProxy.call')\n", (151, 177), False, 'from unittest.mock import patch\n')] |
import os
import html
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.linear_model import LogisticRegression
def train_with_reg_cv(trX, trY, vaX, vaY, teX=None, teY=None, penalty='l1',
C=2 ** np.arange(-8, 1).astype(np.float), seed=42):
scores = []
for i, c in... | [
"html.unescape",
"numpy.sum",
"numpy.argmax",
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"numpy.arange",
"os.path.join"
] | [((659, 683), 'numpy.sum', 'np.sum', (['(model.coef_ != 0)'], {}), '(model.coef_ != 0)\n', (665, 683), True, 'import numpy as np\n'), ((898, 915), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (909, 915), True, 'import pandas as pd\n'), ((1771, 1790), 'html.unescape', 'html.unescape', (['text'], {}), '(... |
# -*- coding: utf-8 -*-
import re
import pandas as pd
import scrapy
from scrapy import Request
from scrapy import Selector
from scrapy import signals
from fooltrader.api.quote import get_security_list
from fooltrader.consts import DEFAULT_KDATA_HEADER
from fooltrader.contract.files_contract import get_finance_report... | [
"pandas.DataFrame",
"scrapy.Selector",
"fooltrader.utils.utils.index_df_with_time",
"fooltrader.api.quote.get_security_list",
"pandas.Timestamp",
"scrapy.Request",
"fooltrader.contract.files_contract.get_finance_report_event_path",
"re.match"
] | [((2558, 2602), 'fooltrader.contract.files_contract.get_finance_report_event_path', 'get_finance_report_event_path', (['security_item'], {}), '(security_item)\n', (2587, 2602), False, 'from fooltrader.contract.files_contract import get_finance_report_event_path\n'), ((2617, 2631), 'pandas.DataFrame', 'pd.DataFrame', ([... |
from django.db import models
class Foo(models.Model):
bar = models.CharField(max_length=10)
| [
"django.db.models.CharField"
] | [((65, 96), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (81, 96), False, 'from django.db import models\n')] |
from __future__ import annotations
import logging
from math import floor, sqrt
import numpy as np
from numpy.linalg import inv, norm
from cctbx.array_family import flex
from dxtbx import flumpy
from scitbx import matrix
from dials.algorithms.profile_model.ellipsoid import chisq_quantile
from dials.algorithms.statis... | [
"cctbx.array_family.flex.sqrt",
"cctbx.array_family.flex.sum",
"cctbx.array_family.flex.abs",
"dials.algorithms.statistics.fast_mcd.FastMCD",
"math.floor",
"dials.algorithms.profile_model.ellipsoid.chisq_quantile",
"cctbx.array_family.flex.vec3_double",
"numpy.linalg.norm",
"numpy.linalg.inv",
"dx... | [((373, 399), 'logging.getLogger', 'logging.getLogger', (['"""dials"""'], {}), "('dials')\n", (390, 399), False, 'import logging\n'), ((711, 719), 'numpy.linalg.norm', 'norm', (['s0'], {}), '(s0)\n', (715, 719), False, 'from numpy.linalg import inv, norm\n'), ((1020, 1033), 'cctbx.array_family.flex.size_t', 'flex.size_... |
import os
import pandas as pd
import os
import logging
import json
from util import StockAnalysis, AllStocks, TightMinMax, EnvFile
class volumeSpreadAnalysis:
def __init__(self):
self.barCount:int = 5
self.averagingBarCount:int = 20
self.factor3 = 1.2
self.factor4 = 1.2
self... | [
"util.AllStocks.Run",
"logging.error",
"util.AllStocks.GetDailyStockData",
"util.StockAnalysis"
] | [((7405, 7420), 'util.StockAnalysis', 'StockAnalysis', ([], {}), '()\n', (7418, 7420), False, 'from util import StockAnalysis, AllStocks, TightMinMax, EnvFile\n'), ((8137, 8169), 'util.AllStocks.Run', 'AllStocks.Run', (['filter.Run', '(False)'], {}), '(filter.Run, False)\n', (8150, 8169), False, 'from util import Stock... |
#!/usr/bin/env python
import wfdb
import hmm
import numpy as np
import matplotlib.pyplot as plt
import pickle
def preprocess(count = 30):
print("Preprocessing")
sig, fields = wfdb.srdsamp('data/mitdb/100')
ecg = sig[:500000,0]
diff = np.diff(ecg)
emax = np.max(ecg)
emin = np.min(ecg)
co... | [
"matplotlib.pyplot.subplot",
"pickle.dump",
"hmm.probabilities",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.ion",
"numpy.max",
"numpy.diff",
"numpy.min",
"hmm.random_model",
"hmm.synt... | [((186, 216), 'wfdb.srdsamp', 'wfdb.srdsamp', (['"""data/mitdb/100"""'], {}), "('data/mitdb/100')\n", (198, 216), False, 'import wfdb\n'), ((254, 266), 'numpy.diff', 'np.diff', (['ecg'], {}), '(ecg)\n', (261, 266), True, 'import numpy as np\n'), ((279, 290), 'numpy.max', 'np.max', (['ecg'], {}), '(ecg)\n', (285, 290), ... |
def linha(simb='=',tam=42):
"""[Cria uma linha]
Args:
simb (str, optional): [O símbolo que Vai Formar a linha]. Defaults to '='.
tam (int, optional): [Tamanho da Linha]. Defaults to 42.
Criado por:
Murilo_Henrique060
"""
print(f'{simb}'*tam)
def cabeçalho(simb='=',txt='ESCRE... | [
"colorama.init"
] | [((1916, 1922), 'colorama.init', 'init', ([], {}), '()\n', (1920, 1922), False, 'from colorama import init\n')] |
import os
os.chdir("Render2018/lib/")
os.system("python3 create_config_bodyflow.py")
| [
"os.system",
"os.chdir"
] | [((10, 37), 'os.chdir', 'os.chdir', (['"""Render2018/lib/"""'], {}), "('Render2018/lib/')\n", (18, 37), False, 'import os\n'), ((38, 84), 'os.system', 'os.system', (['"""python3 create_config_bodyflow.py"""'], {}), "('python3 create_config_bodyflow.py')\n", (47, 84), False, 'import os\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
from typing import TYPE_CHECKING
from cdm.enums import CdmObjectType
from cdm.enums.cdm_operation_type import OperationTypeConvertor, CdmOperationType
from cdm.per... | [
"cdm.persistence.cdmfolder.types.OperationAddAttributeGroup",
"cdm.enums.cdm_operation_type.OperationTypeConvertor._operation_type_to_string"
] | [((1731, 1759), 'cdm.persistence.cdmfolder.types.OperationAddAttributeGroup', 'OperationAddAttributeGroup', ([], {}), '()\n', (1757, 1759), False, 'from cdm.persistence.cdmfolder.types import OperationAddAttributeGroup\n'), ((1779, 1870), 'cdm.enums.cdm_operation_type.OperationTypeConvertor._operation_type_to_string', ... |
# Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown
# at http://oss.oracle.com/licenses/upl.
import os
import unittest
from tools.decorators import skipUnlessOCI
from tools.oci_test_case import OciTestCase
os.environ['LC_ALL']... | [
"tools.decorators.skipUnlessOCI",
"unittest.TestLoader",
"unittest.TextTestRunner"
] | [((452, 467), 'tools.decorators.skipUnlessOCI', 'skipUnlessOCI', ([], {}), '()\n', (465, 467), False, 'from tools.decorators import skipUnlessOCI\n'), ((820, 835), 'tools.decorators.skipUnlessOCI', 'skipUnlessOCI', ([], {}), '()\n', (833, 835), False, 'from tools.decorators import skipUnlessOCI\n'), ((1226, 1247), 'uni... |
# -*- coding: utf-8 -*-
""" Test functions in tools.py.
"""
import os
"""License:
Copyright 2020-2022 The Cytoscape Consortium
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... | [
"unittest.main",
"os.remove",
"os.getcwd",
"os.path.samefile",
"os.path.getsize",
"os.path.exists",
"time.sleep",
"os.path.join"
] | [((23595, 23610), 'unittest.main', 'unittest.main', ([], {}), '()\n', (23608, 23610), False, 'import unittest\n'), ((21276, 21289), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (21286, 21289), False, 'import time\n'), ((21817, 21830), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (21827, 21830), False, 'im... |
from django.urls import path
from My_music_app.music_app.views import home_page, add_album, album_details, album_edit, album_delete, profile_details, \
profile_delete, create_profile
urlpatterns =(
path('',home_page,name='home page'),
path('album/add',add_album,name='add album'),
path('album/details/<... | [
"django.urls.path"
] | [((208, 245), 'django.urls.path', 'path', (['""""""', 'home_page'], {'name': '"""home page"""'}), "('', home_page, name='home page')\n", (212, 245), False, 'from django.urls import path\n'), ((249, 295), 'django.urls.path', 'path', (['"""album/add"""', 'add_album'], {'name': '"""add album"""'}), "('album/add', add_albu... |
from gym.envs.registration import register
from simglucose.sensor.cgm import CGMSensor,CGMSensorWithoutNoise
from simglucose.actuator.pump import InsulinPump
from simglucose.patient.t1dpatient import T1DPatient
from simglucose.simulation.env import T1DSimEnv
from simglucose.simulation.scenario import CustomScenario,Ze... | [
"simglucose.simulation.sim_engine.SimObjForKeras2",
"simglucose.simulation.env.T1DSimEnv",
"simglucose.simulation.sim_engine.batch_sim",
"examples.apply_customized_controller.MyController",
"simglucose.sensor.cgm.CGMSensorWithoutNoise.withName",
"datetime.timedelta",
"simglucose.actuator.pump.InsulinPum... | [((627, 756), 'gym.envs.registration.register', 'register', ([], {'id': '"""simglucose-adolescent2-v0"""', 'entry_point': '"""simglucose.envs:T1DSimEnv"""', 'kwargs': "{'patient_name': 'adolescent#002'}"}), "(id='simglucose-adolescent2-v0', entry_point=\n 'simglucose.envs:T1DSimEnv', kwargs={'patient_name': 'adolesc... |
##################################################################
# Algorithm module using look-up tables
##################################################################
import math
import numpy as np
import modelicares
from scipy.optimize import minimize
import scipy.interpolate as interpolate
from scipy.optimize... | [
"numpy.isin",
"modelicares.exps.doe.fullfact",
"scipy.optimize.minimize",
"scipy.interpolate.griddata",
"Objective_Function.DelLastTrack",
"numpy.zeros",
"Objective_Function.GetOutputVars",
"math.floor",
"Objective_Function.ChangeDir",
"Objective_Function.GetOptTrack",
"numpy.append",
"numpy.w... | [((3753, 3779), 'numpy.zeros', 'np.zeros', (['[counter + 1, 2]'], {}), '([counter + 1, 2])\n', (3761, 3779), True, 'import numpy as np\n'), ((3850, 3876), 'numpy.zeros', 'np.zeros', (['[2 * counter, 2]'], {}), '([2 * counter, 2])\n', (3858, 3876), True, 'import numpy as np\n'), ((9417, 9457), 'numpy.compress', 'np.comp... |
import factory
from sushi.models import CounterReportType
from .report_types import ReportTypeFactory
class CounterReportTypeFactory(factory.django.DjangoModelFactory):
class Meta:
model = CounterReportType
django_get_or_create = ('code',)
code = 'TR'
counter_version = 5
report_type... | [
"factory.SubFactory"
] | [((323, 360), 'factory.SubFactory', 'factory.SubFactory', (['ReportTypeFactory'], {}), '(ReportTypeFactory)\n', (341, 360), False, 'import factory\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import necessary packages.
import argparse
import logging
import os
import os.path as osp
import warnings
from keras import backend as K
from keras.models import load_model
import tensorflow as tf
from tensorflow.python.framework import graph_io
from tensorflow.python.fr... | [
"keras.models.load_model",
"os.mkdir",
"config.output_log.init_log",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"keras.backend.get_session",
"os.path.isdir",
"logging.info",
"keras.backend.set_learning_phase",
"tensorflow.python.framework.graph_util.convert_variables_to_constants",
"t... | [((438, 471), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (461, 471), False, 'import warnings\n'), ((503, 542), 'config.output_log.init_log', 'output_log.init_log', (['"""./log/update_url"""'], {}), "('./log/update_url')\n", (522, 542), False, 'from config import output... |
import unittest
import torch
from cortex.modules.backbones import *
from cortex.modules.necks import *
class TestNecks(unittest.TestCase):
def setUp(self):
self.use_cpu = False
self.cuda = False if self.use_cpu else torch.cuda.is_available()
self.device = torch.device('cuda:0' if self.cu... | [
"unittest.main",
"torch.cuda.is_available",
"torch.rand",
"torch.device"
] | [((1950, 1965), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1963, 1965), False, 'import unittest\n'), ((288, 334), 'torch.device', 'torch.device', (["('cuda:0' if self.cuda else 'cpu')"], {}), "('cuda:0' if self.cuda else 'cpu')\n", (300, 334), False, 'import torch\n'), ((240, 265), 'torch.cuda.is_available', ... |
import json
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from django.core.urlresolvers import reverse
from django.db import models
from goal.models import GlobalUser, Goal
from suggestion.models import Suggestion
from review.models import Comment, Review
from dj... | [
"django.db.models.TextField",
"json.loads",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveSmallIntegerField",
"django.shortcuts.get_object_or_404",
"urllib.urlencode",
"django.db.models.DateTimeField"
] | [((897, 955), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'choices': 'TEMPLATE_CHOICES'}), '(choices=TEMPLATE_CHOICES)\n', (929, 955), False, 'from django.db import models\n'), ((970, 988), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (986, 988), False,... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | [
"numpy.zeros_like",
"numpy.log",
"numpy.zeros",
"openquake.hazardlib.gsim.utils.mblg_to_mw_johnston_96",
"openquake.hazardlib.imt.SA",
"openquake.hazardlib.gsim.base.CoeffsTable",
"openquake.hazardlib.imt.PGA",
"openquake.hazardlib.gsim.utils.clip_mean",
"numpy.array",
"scipy.interpolate.RectBivar... | [((6389, 6414), 'numpy.linspace', 'np.linspace', (['(4.4)', '(8.2)', '(20)'], {}), '(4.4, 8.2, 20)\n', (6400, 6414), True, 'import numpy as np\n'), ((6549, 6574), 'numpy.linspace', 'np.linspace', (['(1.0)', '(3.0)', '(21)'], {}), '(1.0, 3.0, 21)\n', (6560, 6574), True, 'import numpy as np\n'), ((6615, 9731), 'numpy.arr... |
# Copyright (c) RedFantom 2017
# For license see LICENSE
from setuptools import setup
long_description = """
yandex
==========
A python wrapper around the Yandex API
License
-------
MIT License
Copyright (c) 2019 Dogeek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software... | [
"setuptools.setup"
] | [((1256, 1719), 'setuptools.setup', 'setup', ([], {'name': '"""yandex"""', 'packages': "['yandex']", 'py_modules': "['yandex']", 'version': '"""0.0.2"""', 'description': '""" A python wrapper around the Yandex API """', 'long_description': 'long_description', 'author': '"""Dogeek"""', 'url': '"""https://www.github.com/... |
import pytest
from asyncclick.testing import CliRunner
from iperon.commands.generate_openapi import generate_openapi
@pytest.mark.asyncio
async def test_generate_openapi(app):
runner = CliRunner()
await runner.invoke(generate_openapi)
| [
"asyncclick.testing.CliRunner"
] | [((192, 203), 'asyncclick.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (201, 203), False, 'from asyncclick.testing import CliRunner\n')] |
# Copyright (c) 2019 <NAME>
# License: MIT License
# Created 2019-02-15
from typing import TYPE_CHECKING, Tuple
from .dxfentity import DXFEntity, SubclassProcessor, DXFNamespace
from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass
from ezdxf.lldxf.const import DXF2004, DXF2000
from .factory import reg... | [
"ezdxf.lldxf.attributes.DXFAttr",
"ezdxf.lldxf.attributes.DXFAttributes"
] | [((2171, 2195), 'ezdxf.lldxf.attributes.DXFAttributes', 'DXFAttributes', (['class_def'], {}), '(class_def)\n', (2184, 2195), False, 'from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass\n'), ((527, 537), 'ezdxf.lldxf.attributes.DXFAttr', 'DXFAttr', (['(1)'], {}), '(1)\n', (534, 537), False, 'from ezdx... |
import argparse
import math
import random
from pathlib import Path
import h5py
import yaml
def make_random_splits(keys, num_test, num_splits):
splits = []
for _ in range(num_splits):
random.shuffle(keys)
test_keys = keys[:num_test]
train_keys = list(set(keys) - set(test_keys))
... | [
"h5py.File",
"argparse.ArgumentParser",
"math.ceil",
"random.shuffle",
"yaml.dump",
"pathlib.Path"
] | [((500, 520), 'random.shuffle', 'random.shuffle', (['keys'], {}), '(keys)\n', (514, 520), False, 'import random\n'), ((831, 856), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (854, 856), False, 'import argparse\n'), ((1600, 1628), 'h5py.File', 'h5py.File', (['args.dataset', '"""r"""'], {}), "... |
import logging
from datetime import datetime
from unittest import TestCase, skipIf
import sys
from unittest.mock import patch, mock_open, call
from tests import MockArgParse, fixture
from tests.test_providers import MockProvider
from virga.providers.abstract import AbstractProvider, SUCCESS
class TestAbstractProvid... | [
"sys.platform.startswith",
"datetime.datetime",
"unittest.mock.patch",
"tests.test_providers.MockProvider",
"tests.MockArgParse",
"tests.fixture",
"unittest.mock.call"
] | [((953, 982), 'unittest.mock.patch', 'patch', (['"""logging.addLevelName"""'], {}), "('logging.addLevelName')\n", (958, 982), False, 'from unittest.mock import patch, mock_open, call\n'), ((1271, 1297), 'unittest.mock.patch', 'patch', (['"""logging.Formatter"""'], {}), "('logging.Formatter')\n", (1276, 1297), False, 'f... |
#!/usr/bin/env python3
from utils.logger import Logger
from utils import args
import logging
import sys
#--------------------------------------------------------------------#
# GLOBAL VARIABLES #
#--------------------------------------------------------------------#
... | [
"utils.args.parseArguments",
"utils.logger.Logger"
] | [((593, 614), 'utils.args.parseArguments', 'args.parseArguments', ([], {}), '()\n', (612, 614), False, 'from utils import args\n'), ((671, 679), 'utils.logger.Logger', 'Logger', ([], {}), '()\n', (677, 679), False, 'from utils.logger import Logger\n')] |
#MAIN_DATA_CURATION--------run it with spark-submit
import time
from elasticsearch import Elasticsearch
from pyspark.sql import SQLContext, SparkSession
from pyspark.sql.functions import col
from spark_functions import elastic2df, df2elastic
start_time = time.time()
#spark connexion
sc = SparkSession.builder.appName(... | [
"elasticsearch.Elasticsearch",
"pyspark.sql.SQLContext",
"spark_functions.elastic2df",
"time.time",
"pyspark.sql.functions.col",
"spark_functions.df2elastic",
"pyspark.sql.SparkSession.builder.appName"
] | [((256, 267), 'time.time', 'time.time', ([], {}), '()\n', (265, 267), False, 'import time\n'), ((369, 383), 'pyspark.sql.SQLContext', 'SQLContext', (['sc'], {}), '(sc)\n', (379, 383), False, 'from pyspark.sql import SQLContext, SparkSession\n'), ((389, 441), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["[{'host': ... |
import cv2 as cv
import numpy as np
from PIL import Image
from util.richlog import get_logger
from . import imgops
from . import resources
from . import util
from . import ocr
LOGFILE = 'recruit.html'
logger = get_logger(__name__)
from resources.recruit_database import recruit_database
known_tagchars = set(z for x i... | [
"util.richlog.get_logger"
] | [((212, 232), 'util.richlog.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (222, 232), False, 'from util.richlog import get_logger\n')] |
from bs4 import BeautifulSoup, element # type: ignore
from typing import List
from urllib.parse import urljoin
from .base import NewsScraper
from .errors import FormatError
from .feed import NewsItem
from .utils import get_base_url, is_covid_related, parse_datetime
class SonomaNews(NewsScraper):
"""
Scrape o... | [
"bs4.BeautifulSoup",
"urllib.parse.urljoin"
] | [((2270, 2301), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html5lib"""'], {}), "(html, 'html5lib')\n", (2283, 2301), False, 'from bs4 import BeautifulSoup, element\n'), ((3023, 3045), 'urllib.parse.urljoin', 'urljoin', (['base_url', 'url'], {}), '(base_url, url)\n', (3030, 3045), False, 'from urllib.parse impo... |
from __future__ import absolute_import
import unittest
from pymaze.maze import Maze
from pymaze.cell import Cell
def generate_maze():
# Used to generate a 5x5 maze for testing, Feel free to modify as needed
cols = 5
rows = 5
return Maze(rows, cols)
class TestMaze(unittest.TestCase):... | [
"unittest.main",
"pymaze.maze.Maze"
] | [((264, 280), 'pymaze.maze.Maze', 'Maze', (['rows', 'cols'], {}), '(rows, cols)\n', (268, 280), False, 'from pymaze.maze import Maze\n'), ((1381, 1396), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1394, 1396), False, 'import unittest\n'), ((478, 494), 'pymaze.maze.Maze', 'Maze', (['rows', 'cols'], {}), '(rows,... |
import argparse
import io
import os
import shutil
import sys
import mammoth
from . import writers
def main():
args = _parse_args()
if args.style_map is None:
style_map = None
else:
with open(args.style_map) as style_map_fileobj:
style_map = style_map_fileobj.read()
... | [
"argparse.ArgumentParser",
"os.path.basename",
"io.open",
"sys.stderr.write",
"shutil.copyfileobj",
"os.path.join",
"mammoth.convert"
] | [((2107, 2132), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2130, 2132), False, 'import argparse\n'), ((768, 886), 'mammoth.convert', 'mammoth.convert', (['docx_fileobj'], {'style_map': 'style_map', 'convert_image': 'convert_image', 'output_format': 'args.output_format'}), '(docx_fileobj, s... |
from setuptools import setup
setup(
name='system monitor',
version='0.1',
description='Network enabled system monitor',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
],
keywords='Network... | [
"setuptools.setup"
] | [((30, 501), 'setuptools.setup', 'setup', ([], {'name': '"""system monitor"""', 'version': '"""0.1"""', 'description': '"""Network enabled system monitor"""', 'classifiers': "['Development Status :: 4 - Beta', 'License :: OSI Approved :: MIT License',\n 'Programming Language :: Python :: 3.6']", 'keywords': '"""Netw... |
import discord
import requests
client = discord.Client()
cmd1 = '$olc'
cmd2 = '$phrase'
@client.event
async def on_ready():
print('Logged in successfully.')
@client.event
async def on_message(message):
if message.content.startswith(cmd1):
olc = message.content[len(cmd1):] # rest ... | [
"requests.get",
"discord.Client"
] | [((44, 60), 'discord.Client', 'discord.Client', ([], {}), '()\n', (58, 60), False, 'import discord\n'), ((343, 402), 'requests.get', 'requests.get', (["('http://localhost:8000/lookup_olc?olc=' + olc)"], {}), "('http://localhost:8000/lookup_olc?olc=' + olc)\n", (355, 402), False, 'import requests\n'), ((694, 785), 'requ... |
import configparser
import logging
from pprint import pprint
import telegram
from emoji import emojize
from jira import JIRA
from jira.exceptions import JIRAError
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater
def escape(x):
special = [".", "-", "(", ")", "[", "]", ">", "<", "=", "+", ... | [
"logging.basicConfig",
"emoji.emojize",
"telegram.ext.Updater",
"telegram.ext.MessageHandler",
"pprint.pprint",
"telegram.ext.CommandHandler",
"configparser.ConfigParser",
"jira.JIRA"
] | [((419, 451), 'jira.JIRA', 'JIRA', (['"""https://bugreports.qt.io"""'], {}), "('https://bugreports.qt.io')\n", (423, 451), False, 'from jira import JIRA\n'), ((557, 571), 'pprint.pprint', 'pprint', (['update'], {}), '(update)\n', (563, 571), False, 'from pprint import pprint\n'), ((914, 955), 'emoji.emojize', 'emojize'... |
__author__ = 'oddBit'
from kivy.uix.scatterlayout import ScatterLayout
from kivy.animation import Animation
from kivy.clock import Clock
from data.gameData import *
from HexTile import HexTile
from UpDownBubble import UpDownBubble
from random import choice, shuffle, random
from kivy.properties import NumericProperty, ... | [
"random.shuffle",
"kivy.properties.BooleanProperty",
"kivy.clock.Clock.schedule_once",
"Actor.Actor",
"random.choice",
"random.random",
"kivy.animation.Animation",
"UpDownBubble.UpDownBubble",
"kivy.core.audio.SoundLoader.load",
"kivy.properties.NumericProperty"
] | [((22146, 22168), 'kivy.properties.BooleanProperty', 'BooleanProperty', (['(False)'], {}), '(False)\n', (22161, 22168), False, 'from kivy.properties import NumericProperty, BooleanProperty\n'), ((22186, 22208), 'kivy.properties.BooleanProperty', 'BooleanProperty', (['(False)'], {}), '(False)\n', (22201, 22208), False, ... |
import os
import warnings
import itertools
from operator import itemgetter
from nose.tools import assert_equal, with_setup, assert_almost_equal, assert_raises
from random import uniform, seed
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
try:
from pyne.mesh import Mes... | [
"os.remove",
"pyne.r2s.tag_e_bounds",
"numpy.empty",
"pymoab.core.Core",
"numpy.ones",
"pyne.source_sampling.AliasTable",
"warnings.simplefilter",
"os.path.exists",
"pyne.mesh.NativeMeshTag",
"random.seed",
"nose.tools.assert_raises",
"numpy.rollaxis",
"numpy.linalg.det",
"imp.load_module"... | [((845, 887), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'QAWarning'], {}), "('ignore', QAWarning)\n", (866, 887), False, 'import warnings\n'), ((423, 446), 'imp.find_module', 'imp.find_module', (['"""pyne"""'], {}), "('pyne')\n", (438, 446), False, 'import imp\n'), ((462, 497), 'imp.load_modul... |
import itertools
from elasticsearch_dsl import Index, Q, Search
import pytest
from django.conf import settings
from api.applications import helpers, models
from api.flags.enums import SystemFlags
from api.parties.enums import PartyType
from test_helpers.clients import DataTestClient
from api.external_data.documents ... | [
"api.external_data.documents.SanctionDocumentType.init",
"api.external_data.documents.SanctionDocumentType._index.refresh",
"api.applications.helpers.auto_match_sanctions",
"api.external_data.documents.SanctionDocumentType",
"api.external_data.documents.SanctionDocumentType._index.delete"
] | [((375, 423), 'api.external_data.documents.SanctionDocumentType._index.delete', 'SanctionDocumentType._index.delete', ([], {'ignore': '[404]'}), '(ignore=[404])\n', (409, 423), False, 'from api.external_data.documents import SanctionDocumentType\n'), ((428, 455), 'api.external_data.documents.SanctionDocumentType.init',... |
import json
import sys
import boto3
client = boto3.client('glue')
def lambda_handler(event, context):
print(event)
file_name = event['Records'][0]['s3']['object']['key'].split("/")[1]
if file_name == "csv":
client.start_crawler( Name='csv_crawler' )
else:
client.start_crawler( Name='json_crawler' )
... | [
"boto3.client"
] | [((49, 69), 'boto3.client', 'boto3.client', (['"""glue"""'], {}), "('glue')\n", (61, 69), False, 'import boto3\n')] |
"""Fields for Zinnia admin"""
from __future__ import unicode_literals
from django import forms
from django.utils.encoding import smart_unicode
class MPTTModelChoiceIterator(forms.models.ModelChoiceIterator):
"""
MPTT version of ModelChoiceIterator
"""
def choice(self, obj):
"""
Overl... | [
"django.utils.encoding.smart_unicode"
] | [((1193, 1211), 'django.utils.encoding.smart_unicode', 'smart_unicode', (['obj'], {}), '(obj)\n', (1206, 1211), False, 'from django.utils.encoding import smart_unicode\n')] |
"""
"""
import textwrap
import collections
from clldutils.clilib import Table, add_format
from termcolor import colored
def register(parser):
add_format(parser, 'simple')
parser.add_argument('--id', help='Issue ID', type=int, default=None)
def run(args):
issues = collections.OrderedDict([(i.id, i) for... | [
"textwrap.shorten",
"clldutils.clilib.add_format",
"clldutils.clilib.Table",
"termcolor.colored",
"collections.OrderedDict"
] | [((150, 178), 'clldutils.clilib.add_format', 'add_format', (['parser', '"""simple"""'], {}), "(parser, 'simple')\n", (160, 178), False, 'from clldutils.clilib import Table, add_format\n'), ((282, 345), 'collections.OrderedDict', 'collections.OrderedDict', (['[(i.id, i) for i in args.repos.issues]'], {}), '([(i.id, i) f... |
from django.contrib import admin
from listenclosely.models import Message, Chat, Agent, Asker
admin.site.register(Message)
admin.site.register(Chat)
admin.site.register(Agent)
admin.site.register(Asker) | [
"django.contrib.admin.site.register"
] | [((95, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['Message'], {}), '(Message)\n', (114, 123), False, 'from django.contrib import admin\n'), ((124, 149), 'django.contrib.admin.site.register', 'admin.site.register', (['Chat'], {}), '(Chat)\n', (143, 149), False, 'from django.contrib import admin... |
##########################################################################
# MediPy - Copyright (C) Universite de Strasbourg
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for de... | [
"layer.Layer.derived_classes.append",
"vtk.vtkContourFilter",
"vtk.vtkActor",
"vtk.vtkPolyDataMapper"
] | [((3530, 3572), 'layer.Layer.derived_classes.append', 'Layer.derived_classes.append', (['ContourLayer'], {}), '(ContourLayer)\n', (3558, 3572), False, 'from layer import Layer\n'), ((1171, 1181), 'vtk.vtkActor', 'vtkActor', ([], {}), '()\n', (1179, 1181), False, 'from vtk import vtkActor, vtkContourFilter, vtkPolyDataM... |
import datetime
import json
import typing
import pandas as pd
import requests
URL = "https://www.twse.com.tw/fund/T86?response=json&date={}&selectType=ALL&_={}"
# 網頁瀏覽時, 所帶的 request header 參數, 模仿瀏覽器發送 request
HEADER = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, def... | [
"pandas.DataFrame",
"datetime.datetime.now",
"json.loads"
] | [((2055, 2076), 'json.loads', 'json.loads', (['resp.text'], {}), '(resp.text)\n', (2065, 2076), False, 'import json\n'), ((2133, 2168), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'columns'}), '(data, columns=columns)\n', (2145, 2168), True, 'import pandas as pd\n'), ((2252, 2281), 'pandas.DataFrame', 'p... |
import unittest
import library
import os
import glob
class TestLibrary(unittest.TestCase):
def setUp(self):
self.lib_fn = r'v:\workspace\PersistentStorage\src\lib.shelve'
self.lib = library.Library(self.lib_fn)
self.fixture_author1 = library.Author('Octavia', 'Estelle', 'Butler')
se... | [
"unittest.main",
"os.remove",
"library.Book",
"library.Library",
"library.Author",
"glob.glob"
] | [((1365, 1380), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1378, 1380), False, 'import unittest\n'), ((203, 231), 'library.Library', 'library.Library', (['self.lib_fn'], {}), '(self.lib_fn)\n', (218, 231), False, 'import library\n'), ((263, 309), 'library.Author', 'library.Author', (['"""Octavia"""', '"""Este... |
import logging
from r2vstk.config_manager import ConfigManager
from r2vstk.house import House
import argparse
import os.path
import json
def run(conf: ConfigManager, source, output_path, scale_factor, save_previews,
save_room_json, skip_objects=False, adjust_short_walls=False,
classify_doors_and_windo... | [
"r2vstk.house.House",
"r2vstk.config_manager.ConfigManager",
"argparse.ArgumentParser",
"json.dumps"
] | [((463, 470), 'r2vstk.house.House', 'House', ([], {}), '()\n', (468, 470), False, 'from r2vstk.house import House\n'), ((6041, 6056), 'r2vstk.config_manager.ConfigManager', 'ConfigManager', ([], {}), '()\n', (6054, 6056), False, 'from r2vstk.config_manager import ConfigManager\n'), ((6070, 6159), 'argparse.ArgumentPars... |
# coding=utf-8
"""ldif3 - generate and parse LDIF data (see RFC 2849)."""
from __future__ import unicode_literals
import base64
import logging
import re
from collections import OrderedDict
try: # pragma: nocover
# noinspection PyCompatibility
from urlparse import urlparse
from urllib import urlopen
exce... | [
"base64.decodestring",
"logging.getLogger",
"collections.OrderedDict",
"urllib.parse.urlparse",
"re.compile"
] | [((680, 706), 'logging.getLogger', 'logging.getLogger', (['"""ldif3"""'], {}), "('ldif3')\n", (697, 706), False, 'import logging\n'), ((1009, 1040), 're.compile', 're.compile', (["('^%s$' % DN_PATTERN)"], {}), "('^%s$' % DN_PATTERN)\n", (1019, 1040), False, 'import re\n'), ((6744, 6757), 'collections.OrderedDict', 'Ord... |
import pytest
import pymysql
from unittest.mock import MagicMock
from prefect.tasks.mysql.mysql import MySQLExecute, MySQLFetch
class TestMySQLExecute:
def test_construction(self):
task = MySQLExecute(db_name="test", user="test", password="<PASSWORD>", host="test")
assert (task.commit is False) a... | [
"pytest.raises",
"prefect.tasks.mysql.mysql.MySQLFetch",
"prefect.tasks.mysql.mysql.MySQLExecute",
"unittest.mock.MagicMock"
] | [((203, 280), 'prefect.tasks.mysql.mysql.MySQLExecute', 'MySQLExecute', ([], {'db_name': '"""test"""', 'user': '"""test"""', 'password': '"""<PASSWORD>"""', 'host': '"""test"""'}), "(db_name='test', user='test', password='<PASSWORD>', host='test')\n", (215, 280), False, 'from prefect.tasks.mysql.mysql import MySQLExecu... |
from abc import ABC, abstractmethod
import numpy as np
from scipy import stats
import torch
class Experiment(ABC):
'''
An Experiment manages the basic train/test loop and logs results.
Args:
writer (:torch.logging.writer:): A Writer object used for logging.
quiet (bool): If False,... | [
"numpy.std",
"numpy.mean",
"scipy.stats.sem"
] | [((1956, 1981), 'numpy.mean', 'np.mean', (['self._returns100'], {}), '(self._returns100)\n', (1963, 1981), True, 'import numpy as np\n'), ((2000, 2024), 'numpy.std', 'np.std', (['self._returns100'], {}), '(self._returns100)\n', (2006, 2024), True, 'import numpy as np\n'), ((2803, 2819), 'numpy.mean', 'np.mean', (['retu... |
from google.cloud import vision
import os
import io
import time
start_time = time.time()
path = 'C:/Users/lukas/Desktop/vision_key.json'
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=path
client = vision.ImageAnnotatorClient()
path = './Resources/Photos/lady.jpg'
with io.open(path, 'rb') as image_file:
conten... | [
"google.cloud.vision.Image",
"google.cloud.vision.ImageAnnotatorClient",
"io.open",
"time.time"
] | [((78, 89), 'time.time', 'time.time', ([], {}), '()\n', (87, 89), False, 'import time\n'), ((198, 227), 'google.cloud.vision.ImageAnnotatorClient', 'vision.ImageAnnotatorClient', ([], {}), '()\n', (225, 227), False, 'from google.cloud import vision\n'), ((351, 380), 'google.cloud.vision.Image', 'vision.Image', ([], {'c... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Handy helper utils to work with XARs at runtime"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
def get_runtime_path():
# type: (...) -> str
"""Return the location ... | [
"os.getenv",
"os.access"
] | [((374, 404), 'os.getenv', 'os.getenv', (['"""XAR_RUNTIME_FILES"""'], {}), "('XAR_RUNTIME_FILES')\n", (383, 404), False, 'import os\n'), ((441, 473), 'os.access', 'os.access', (['runtime_path', 'os.R_OK'], {}), '(runtime_path, os.R_OK)\n', (450, 473), False, 'import os\n')] |
from setuptools import setup, find_packages
deps = [
"PyYAML==5.3",
"jsonschema==3.2.0",
]
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="py-bt",
version="1.2.1",
author="<NAME>",
author_email="<EMAIL>",
description="Python package for modelling and execu... | [
"setuptools.find_packages"
] | [((493, 560), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*.tests', '*.tests.*', 'tests.*', 'tests']"}), "(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests'])\n", (506, 560), False, 'from setuptools import setup, find_packages\n')] |
# Databricks CLI
# Copyright 2017 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"), except
# that the use of services to which certain application programming
# interfaces (each, an "API") connect requires that the user first obtain
# a license for the use of the APIs from Databricks,... | [
"json.loads",
"click.get_current_context",
"click.option",
"click.echo",
"mock.patch",
"click.command",
"json.dumps",
"databricks_cli.configure.provider.DatabricksConfig.from_token",
"click.testing.CliRunner",
"click.group"
] | [((1582, 1597), 'click.command', 'click.command', ([], {}), '()\n', (1595, 1597), False, 'import click\n'), ((1603, 1641), 'click.option', 'click.option', (['"""--debug-fed"""'], {'type': 'bool'}), "('--debug-fed', type=bool)\n", (1615, 1641), False, 'import click\n'), ((2210, 2225), 'click.command', 'click.command', (... |
#Local modules
from loguru import logger
from queue import Queue
import sys
import threading
from core.PortScanner import Port_Scanner
from modules.test_time import execution_time
from modules.document import create_document
from modules.ranges import get_ranges
class Scanner():
def __init__(self,start,end):
... | [
"threading.Thread",
"modules.document.create_document",
"loguru.logger.info",
"core.PortScanner.Port_Scanner",
"modules.ranges.get_ranges",
"threading.Semaphore",
"queue.Queue",
"sys.exit"
] | [((340, 362), 'modules.ranges.get_ranges', 'get_ranges', (['start', 'end'], {}), '(start, end)\n', (350, 362), False, 'from modules.ranges import get_ranges\n'), ((385, 392), 'queue.Queue', 'Queue', ([], {}), '()\n', (390, 392), False, 'from queue import Queue\n'), ((1139, 1146), 'queue.Queue', 'Queue', ([], {}), '()\n... |
#!python
import os
import jsonpickle
from jinja2 import Environment, FileSystemLoader, select_autoescape
import sys
reload(sys)
sys.setdefaultencoding('utf8')
target = 'public_html'
if not os.path.exists('%s/books' % target):
os.makedirs('%s/books' % target)
if not os.path.exists('%s/authors' % target):
os.... | [
"jinja2.FileSystemLoader",
"os.path.exists",
"os.makedirs",
"sys.setdefaultencoding"
] | [((130, 160), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (152, 160), False, 'import sys\n'), ((193, 228), 'os.path.exists', 'os.path.exists', (["('%s/books' % target)"], {}), "('%s/books' % target)\n", (207, 228), False, 'import os\n'), ((234, 266), 'os.makedirs', 'os.makedi... |
from openwebinars.Openwebinar import Openwebinar
def test_openwebinar():
taller_a = 'TallerA'
openwebinar = Openwebinar(taller_a)
assert str(openwebinar) == taller_a
taller_b = 1
openwebinar = Openwebinar(taller_b)
assert str(openwebinar) == '' | [
"openwebinars.Openwebinar.Openwebinar"
] | [((117, 138), 'openwebinars.Openwebinar.Openwebinar', 'Openwebinar', (['taller_a'], {}), '(taller_a)\n', (128, 138), False, 'from openwebinars.Openwebinar import Openwebinar\n'), ((215, 236), 'openwebinars.Openwebinar.Openwebinar', 'Openwebinar', (['taller_b'], {}), '(taller_b)\n', (226, 236), False, 'from openwebinars... |
from __future__ import absolute_import
from configparser import ConfigParser
import logging
import json
from contextlib import contextmanager
from unittest.mock import patch, Mock
from urllib.parse import urlencode
import pytest
from flask import Flask
from werkzeug.exceptions import Forbidden
from peerscout.utils.... | [
"unittest.mock.patch.object",
"logging.basicConfig",
"peerscout.shared.database.populated_in_memory_database",
"urllib.parse.urlencode",
"unittest.mock.Mock",
"pytest.fixture",
"flask.Flask",
"peerscout.utils.config.dict_to_config",
"pytest.raises",
"peerscout.server.blueprints.api.ApiAuth",
"py... | [((647, 674), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (664, 674), False, 'import logging\n'), ((2602, 2661), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""MockRecommendReviewers"""', 'autouse': '(True)'}), "(name='MockRecommendReviewers', autouse=True)\n", (2616, 2661), Fal... |
import scanpy as sc
import pandas as pd
import os, sys
working_dir = sys.argv[1]
outfile = sys.argv[2]
dataset_files = [os.path.join( working_dir, i) for i in os.listdir(working_dir)]
datasets = [sc.read(i, 'r') for i in dataset_files]
class_df = pd.concat(axis=0, objs=[ i.obs[[ 'BICCN_class_label', 'BICCN_subclass... | [
"scanpy.read",
"os.path.join",
"os.listdir"
] | [((123, 151), 'os.path.join', 'os.path.join', (['working_dir', 'i'], {}), '(working_dir, i)\n', (135, 151), False, 'import os, sys\n'), ((199, 214), 'scanpy.read', 'sc.read', (['i', '"""r"""'], {}), "(i, 'r')\n", (206, 214), True, 'import scanpy as sc\n'), ((162, 185), 'os.listdir', 'os.listdir', (['working_dir'], {}),... |
#!/usr/bin/python
import sys
import pysam
import collections
import math
import os
import vcf as py_vcf
from math import log10
from statistics import median
from version import __version__
from utils import parse_bam as bam
from utils import coverage
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__fi... | [
"statistics.median",
"os.path.realpath",
"vcf.model._Call",
"pysam.AlignmentFile",
"vcf.model._Record",
"os.popen",
"vcf.model._SV",
"math.log10",
"collections.namedtuple",
"math.log",
"utils.parse_bam.pileup"
] | [((4353, 4395), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['NanoSV.opts_bam', '"""rb"""'], {}), "(NanoSV.opts_bam, 'rb')\n", (4372, 4395), False, 'import pysam\n'), ((4424, 4483), 'utils.parse_bam.pileup', 'bam.pileup', (['self.chr', '(self.pos - 1)', 'self.pos'], {'truncate': '(True)'}), '(self.chr, self.pos - 1,... |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# 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 restrict... | [
"multiverse.server.util.Log.debug"
] | [((1849, 1898), 'multiverse.server.util.Log.debug', 'Log.debug', (['"""done with instance_load_room_goth.py"""'], {}), "('done with instance_load_room_goth.py')\n", (1858, 1898), False, 'from multiverse.server.util import Log\n')] |
# problem C
# coin jam
import math as m
from functools import lru_cache
# precompute primes
@lru_cache(maxsize=None)
def is_prime(n):
if n == 1:
return False
elif n < 4:
return True
elif n % 2 == 0:
return False
elif n < 9:
return True
elif n % 3 == 0:
return... | [
"functools.lru_cache",
"math.sqrt"
] | [((94, 117), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (103, 117), False, 'from functools import lru_cache\n'), ((357, 366), 'math.sqrt', 'm.sqrt', (['n'], {}), '(n)\n', (363, 366), True, 'import math as m\n')] |
#!/usr/bin/env python
from functools import lru_cache
import pandas as pd
from pgmpy.utils.decorators import convert_args_tuple
class BaseEstimator(object):
def __init__(self, data=None, state_names=None, complete_samples_only=True):
"""
Base class for estimators in pgmpy; `ParameterEstimator`,
... | [
"pandas.MultiIndex.from_product",
"functools.lru_cache",
"pandas.MultiIndex.from_arrays"
] | [((2763, 2786), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(2048)'}), '(maxsize=2048)\n', (2772, 2786), False, 'from functools import lru_cache\n'), ((7021, 7078), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_product', (['parents_states'], {'names': 'parents'}), '(parents_states, names=parents)\n', ... |
##########################################################################
#
# Copyright (c) 2014, <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:
#
# * Redistributions of source ... | [
"GafferScene.ScenePlug.staticTypeId",
"functools.partial",
"GafferScene.SceneProcessor",
"GafferScene.OpenGLShader",
"Gaffer.BoolPlug",
"GafferScene.ShaderAssignment",
"Gaffer.Plug",
"IECore.IgnoredExceptions",
"Gaffer.Metadata.registerValue",
"GafferSceneUI.SceneHistoryUI.appendViewContextMenuIte... | [((2041, 2054), 'Gaffer.Plug', 'Gaffer.Plug', ([], {}), '()\n', (2052, 2054), False, 'import Gaffer\n'), ((2174, 2306), 'Gaffer.Metadata.registerValue', 'Gaffer.Metadata.registerValue', (["preferences['viewer']", '"""plugValueWidget:type"""', '"""GafferUI.LayoutPlugValueWidget"""'], {'persistent': '(False)'}), "(prefer... |
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Google Compute Engine specific utility functions."""
import base64
import json
import logging
import re
import socket
import threading
import ... | [
"logging.error",
"json.loads",
"logging.warning",
"time.sleep",
"threading.Lock",
"logging.info",
"socket.gethostbyname",
"time.time",
"base64.urlsafe_b64decode",
"api.oauth.oauth2_access_token_from_url"
] | [((617, 633), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (631, 633), False, 'import threading\n'), ((755, 771), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (769, 771), False, 'import threading\n'), ((874, 904), 'base64.urlsafe_b64decode', 'base64.urlsafe_b64decode', (['data'], {}), '(data)\n', (898... |
import numpy as np
import pandas as pd
from sklearn.covariance import EmpiricalCovariance
from typing import Union
from modules.features.feature import Feature
from modules.filters.dml.map_representation import from_map_representation_to_xy
from modules.features.segment_feature import SegmentFeature
from modules.featu... | [
"numpy.full",
"modules.filters.dml.map_representation.from_map_representation_to_xy",
"numpy.sum",
"numpy.empty",
"numpy.mean",
"numpy.array",
"numpy.random.normal",
"sklearn.covariance.EmpiricalCovariance",
"numpy.vstack"
] | [((2860, 2922), 'numpy.random.normal', 'np.random.normal', (['mean', '(variance ** 0.5)'], {'size': 'self.n_particles'}), '(mean, variance ** 0.5, size=self.n_particles)\n', (2876, 2922), True, 'import numpy as np\n'), ((3108, 3126), 'numpy.vstack', 'np.vstack', (['xy_list'], {}), '(xy_list)\n', (3117, 3126), True, 'im... |
from flask import Flask, render_template
from blueprints.projects import projects
from blueprints.about import about
app = Flask(__name__)
app.register_blueprint(projects, url_prefix='/projects')
app.register_blueprint(about, url_prefix='/about')
@app.route('/')
def home():
return render_template('home.html',
... | [
"flask.Flask",
"flask.render_template"
] | [((125, 140), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (130, 140), False, 'from flask import Flask, render_template\n'), ((286, 325), 'flask.render_template', 'render_template', (['"""home.html"""'], {'home': '(True)'}), "('home.html', home=True)\n", (301, 325), False, 'from flask import Flask, rende... |
from celery_service.config import MyTask
from celery_main import app
from celery.signals import worker_process_init, worker_process_shutdown, celeryd_init
import redis
from core.config import REDIS_CONFIG
from datafilter.big_deal_filter import BigDealFilter
import pymysql
from DBUtils.PooledDB import PooledDB
from core... | [
"datafilter.big_deal_filter.BigDealFilter",
"traceback.print_exc",
"celery_main.app.task",
"redis.ConnectionPool.from_url",
"pymysql.connect"
] | [((1012, 1033), 'celery_main.app.task', 'app.task', ([], {'base': 'MyTask'}), '(base=MyTask)\n', (1020, 1033), False, 'from celery_main import app\n'), ((670, 873), 'pymysql.connect', 'pymysql.connect', ([], {'port': "MYSQL_CONFIG['port']", 'user': "MYSQL_CONFIG['user']", 'password': "MYSQL_CONFIG['<PASSWORD>']", 'data... |
from rdflib import Graph, URIRef, Literal
from rdflib.plugins.sparql import prepareQuery
from rdflib.compare import isomorphic
from nose.tools import eq_
def test_graph_prefix():
"""
This is issue https://github.com/RDFLib/rdflib/issues/313
"""
g1 = Graph()
g1.parse(data="""
@prefix : <urn:n... | [
"rdflib.compare.isomorphic",
"rdflib.Graph",
"nose.main",
"rdflib.Literal",
"rdflib.plugins.sparql.prepareQuery",
"rdflib.URIRef"
] | [((270, 277), 'rdflib.Graph', 'Graph', ([], {}), '()\n', (275, 277), False, 'from rdflib import Graph, URIRef, Literal\n'), ((376, 383), 'rdflib.Graph', 'Graph', ([], {}), '()\n', (381, 383), False, 'from rdflib import Graph, URIRef, Literal\n'), ((503, 521), 'rdflib.compare.isomorphic', 'isomorphic', (['g1', 'g2'], {}... |
from bittrex import Bittrex
import json
import time
import os
from twilio.rest import Client
# Creating an instance of the Bittrex class with our secrets.json file
with open("secrets.json") as secrets_file:
secrets = json.load(secrets_file)
secrets_file.close()
my_bittrex = Bittrex(secrets['bittrex_key'], ... | [
"time.sleep",
"twilio.rest.Client",
"bittrex.Bittrex",
"json.load"
] | [((466, 497), 'twilio.rest.Client', 'Client', (['account_sid', 'auth_token'], {}), '(account_sid, auth_token)\n', (472, 497), False, 'from twilio.rest import Client\n'), ((222, 245), 'json.load', 'json.load', (['secrets_file'], {}), '(secrets_file)\n', (231, 245), False, 'import json\n'), ((288, 346), 'bittrex.Bittrex'... |
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# 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,... | [
"json.dumps",
"six.add_metaclass",
"hpecp.cli_utils.TextOutput.dump",
"traceback.format_exc",
"hpecp.logger.Logger.get_logger",
"os.getenv",
"sys.exit"
] | [((1645, 1664), 'hpecp.logger.Logger.get_logger', 'Logger.get_logger', ([], {}), '()\n', (1662, 1664), False, 'from hpecp.logger import Logger\n'), ((4012, 4042), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (4029, 4042), False, 'import six\n'), ((1746, 1785), 'os.getenv', 'os.get... |
import numpy as np
from .GraphData import *
def intrv_log(min_val, max_val, num):
if min_val <= 0:
min_val = 0.1
return np.geomspace(min_val, max_val, num)
class PlotDict():
__instance = None
__slots__ = ['intrv', 'coll', 'graph']
def __new__(cls):
if PlotDict.__instance is None:... | [
"numpy.geomspace"
] | [((137, 172), 'numpy.geomspace', 'np.geomspace', (['min_val', 'max_val', 'num'], {}), '(min_val, max_val, num)\n', (149, 172), True, 'import numpy as np\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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
"cryptography.hazmat.primitives.ciphers.algorithms.Camellia",
"cryptography.exceptions.UnsupportedAlgorithm",
"cryptography.hazmat.primitives.ciphers.modes.CBC",
"cryptography.utils.register_interface",
"cryptography.hazmat.primitives.hashes.MD5",
"cryptography.hazmat.primitives.ciphers.algorithms.AES",
... | [((1180, 1219), 'cryptography.utils.register_interface', 'utils.register_interface', (['CipherBackend'], {}), '(CipherBackend)\n', (1204, 1219), False, 'from cryptography import utils\n'), ((1838, 1875), 'cryptography.utils.register_interface', 'utils.register_interface', (['HashBackend'], {}), '(HashBackend)\n', (1862... |
import torch
import torch.nn as nn
from torch import Tensor as T
import torch.nn.functional as F
from torch.utils.data import DataLoader
from typing import List
from module.Biencoder import Biencoder
from tqdm import tqdm
class BiencoderLoss(nn.Module):
def __init__(self):
super(BiencoderLoss, self).__ini... | [
"torch.diag",
"torch.nn.functional.softmax",
"torch.no_grad",
"torch.log",
"torch.transpose"
] | [((477, 507), 'torch.nn.functional.softmax', 'F.softmax', (['score_matrix'], {'dim': '(1)'}), '(score_matrix, dim=1)\n', (486, 507), True, 'import torch.nn.functional as F\n'), ((525, 550), 'torch.diag', 'torch.diag', (['score_softmax'], {}), '(score_softmax)\n', (535, 550), False, 'import torch\n'), ((2316, 2331), 'to... |
"""Stores implementations of input data parsers"""
from typing import List
import pandas as pd
from dataVisualizer.data_containers.compound import Compound
from dataVisualizer.exceptions import NotFound
class DataMatrix:
"""Represents Data Matrix"""
def __init__(self, compounds: List[Compound], data: pd.Da... | [
"pandas.DataFrame"
] | [((539, 562), 'pandas.DataFrame', 'pd.DataFrame', (['self.data'], {}), '(self.data)\n', (551, 562), True, 'import pandas as pd\n')] |
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2022 Beartype authors.
# See "LICENSE" for further details.
'''
**Beartype decorator parameter kind unit tests.**
This submodule unit tests the :func:`beartype.beartype` decorator with respect
a... | [
"beartype.beartype",
"beartype_test.util.mark.pytskip.skip_if_python_version_less_than",
"beartype_test.util.pytroar.raises_uncached"
] | [((5714, 5755), 'beartype_test.util.mark.pytskip.skip_if_python_version_less_than', 'skip_if_python_version_less_than', (['"""3.8.0"""'], {}), "('3.8.0')\n", (5746, 5755), False, 'from beartype_test.util.mark.pytskip import skip_if_python_version_less_than\n'), ((6376, 6419), 'beartype.beartype', 'beartype', (['pep570_... |
from flask_restful import Resource, marshal
from app import db
from app.models import Contact
from app.util.http import request
from app.schemas import contact_field
class Contacts(Resource):
def get(self):
contatos = Contact.query.all()
# object, serializer, custom_key_json
return marshal(... | [
"app.models.Contact.query.get",
"app.util.http.request.only",
"app.models.Contact.query.all",
"app.db.session.delete",
"app.db.session.commit",
"app.models.Contact",
"flask_restful.marshal",
"app.db.session.add"
] | [((231, 250), 'app.models.Contact.query.all', 'Contact.query.all', ([], {}), '()\n', (248, 250), False, 'from app.models import Contact\n'), ((397, 432), 'app.util.http.request.only', 'request.only', (["['name', 'cellphone']"], {}), "(['name', 'cellphone'])\n", (409, 432), False, 'from app.util.http import request\n'),... |
import os
import csv
csvpath = os.path.join('Resources', 'budget_data.csv')
with open(csvpath, newline='') as csvfile:
csv_reader = csv.reader(csvfile, delimiter=',')
header = next(csv_reader)
months = 0
totalprofit = 0
difference = 0
avg_change = 0
loss = 0
increase = 0
decre... | [
"csv.reader",
"os.path.join"
] | [((32, 76), 'os.path.join', 'os.path.join', (['"""Resources"""', '"""budget_data.csv"""'], {}), "('Resources', 'budget_data.csv')\n", (44, 76), False, 'import os\n'), ((138, 172), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (148, 172), False, 'import csv\n')] |
from rest_framework import serializers
from . import models
from backend.members.serializers import MemberSerializer
class AchievementSerializer(serializers.ModelSerializer):
"""Serialize Achievement model"""
members = MemberSerializer(read_only=True, many=True)
class Meta:
model = models.Achiev... | [
"backend.members.serializers.MemberSerializer"
] | [((230, 273), 'backend.members.serializers.MemberSerializer', 'MemberSerializer', ([], {'read_only': '(True)', 'many': '(True)'}), '(read_only=True, many=True)\n', (246, 273), False, 'from backend.members.serializers import MemberSerializer\n')] |
from os import environ, getcwd, mkdir
from os.path import join
from shutil import rmtree, copy
from unittest import TestCase
environ["VISION_HOME"] = join(getcwd(), "reporter")
from runtime import reporter
from core import storage, common
class Reporter(TestCase):
def setUp(self):
storage.setup()
... | [
"os.mkdir",
"os.getcwd",
"runtime.reporter.connect",
"core.common.load_config",
"core.storage.put",
"runtime.reporter.send_report",
"core.storage.setup",
"shutil.rmtree",
"runtime.reporter.register",
"os.path.join",
"core.storage.get_connection"
] | [((156, 164), 'os.getcwd', 'getcwd', ([], {}), '()\n', (162, 164), False, 'from os import environ, getcwd, mkdir\n'), ((297, 312), 'core.storage.setup', 'storage.setup', ([], {}), '()\n', (310, 312), False, 'from core import storage, common\n'), ((335, 373), 'os.path.join', 'join', (["environ['VISION_HOME']", '"""confi... |
import numpy as np
import sklearn.linear_model as lr
from sklearn import ensemble
from sklearn import svm
from sklearn.externals import joblib
from steppy.base import BaseTransformer
from steppy.utils import get_logger
logger = get_logger()
class SklearnBaseTransformer(BaseTransformer):
def __init__(self, esti... | [
"numpy.stack",
"sklearn.externals.joblib.dump",
"numpy.vectorize",
"numpy.hstack",
"steppy.utils.get_logger",
"numpy.exp",
"sklearn.externals.joblib.load"
] | [((231, 243), 'steppy.utils.get_logger', 'get_logger', ([], {}), '()\n', (241, 243), False, 'from steppy.utils import get_logger\n'), ((526, 563), 'sklearn.externals.joblib.dump', 'joblib.dump', (['self.estimator', 'filepath'], {}), '(self.estimator, filepath)\n', (537, 563), False, 'from sklearn.externals import jobli... |
import tempfile
import logging
from pathlib import Path
from ruamel.yaml import safe_load
from semantic_version import Version
from capanno_utils.classes.metadata.tool_metadata import ParentToolMetadata, SubtoolMetadata
from capanno_utils.classes.metadata.script_metadata import ScriptMetadata, CommonScriptMetadata
from... | [
"tempfile.NamedTemporaryFile",
"logging.debug",
"logging.info",
"ruamel.yaml.safe_load"
] | [((5409, 5487), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'prefix': '"""scripts_map"""', 'suffix': '""".yaml"""', 'delete': '(True)'}), "(prefix='scripts_map', suffix='.yaml', delete=True)\n", (5436, 5487), False, 'import tempfile\n'), ((5737, 5758), 'ruamel.yaml.safe_load', 'safe_load', (['sc... |
import bpy
import os
from . import node_functions
from . import constants
from bpy.app.handlers import persistent
@persistent
def save_images(self,context):
images = bpy.data.images
for img in images:
if img.is_dirty:
print(img.name)
save_image(img) # img.save()
def get... | [
"os.mkdir",
"bpy.path.abspath",
"os.path.getsize",
"os.path.dirname",
"os.path.exists"
] | [((742, 767), 'os.path.dirname', 'os.path.dirname', (['filePath'], {}), '(filePath)\n', (757, 767), False, 'import os\n'), ((781, 815), 'os.path.exists', 'os.path.exists', (["(path + '/textures')"], {}), "(path + '/textures')\n", (795, 815), False, 'import os\n'), ((825, 853), 'os.mkdir', 'os.mkdir', (["(path + '/textu... |
from .utilities import format_ft_comp, format_end2end_prompt, split_multi_answer
from .configs import ANSWER_COL, INCORRECT_COL
from datasets import load_metric
import openai
import numpy as np
import pandas as pd
import warnings
from t5.evaluation import metrics
from time import sleep
import logging
logger = logging.... | [
"t5.evaluation.metrics.rouge",
"t5.evaluation.metrics.bleu",
"pandas.isnull",
"logging.getLogger",
"time.sleep",
"datasets.load_metric",
"numpy.exp",
"openai.Completion.create"
] | [((312, 331), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (329, 331), False, 'import logging\n'), ((11906, 11948), 'datasets.load_metric', 'load_metric', (['"""bleurt"""'], {'cache_dir': 'cache_dir'}), "('bleurt', cache_dir=cache_dir)\n", (11917, 11948), False, 'from datasets import load_metric\n'), ((1... |
from datetime import datetime, timedelta
from time import sleep
from random import uniform
from pokemongo_bot.base_task import BaseTask
class SleepSchedule(BaseTask):
"""Pauses the execution of the bot every day for some time
Simulates the user going to sleep every day for some time, the sleep time
and t... | [
"time.sleep",
"datetime.timedelta",
"datetime.datetime.now",
"random.uniform"
] | [((1344, 1365), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(10)'}), '(minutes=10)\n', (1353, 1365), False, 'from datetime import datetime, timedelta\n'), ((5250, 5282), 'random.uniform', 'uniform', (['(-max_offset)', 'max_offset'], {}), '(-max_offset, max_offset)\n', (5257, 5282), False, 'from random import u... |
import serial
import os
import time
from . import (
DEBUG,
DEVICE_IDS,
BASE_PATH,
BUFFER_SIZE,
__version__
)
class Serial(serial.Serial):
def read_decoded(self):
tmp_data = self.read()
while b'>>> ' not in tmp_data:
tmp_data += self.read()
return tmp_dat... | [
"os.path.join",
"serial.tools.list_ports.comports",
"time.sleep"
] | [((2262, 2310), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""esp32_control_file.py"""'], {}), "(BASE_PATH, 'esp32_control_file.py')\n", (2274, 2310), False, 'import os\n'), ((4014, 4048), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {}), '()\n', (4046, 4048), False, 'import serial\... |
# /usr/bin/env python
# -*- coding: UTF-8 -*-
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import tensorflow as tf
from trainer import *
from trainer256 import *
from config import get_config
from utils import prepare_dirs_and_logger, save_config
import pdb, os
os.environ["TF_CPP_MIN_LOG_LEVE... | [
"utils.prepare_dirs_and_logger",
"utils.save_config",
"config.get_config",
"warnings.filterwarnings"
] | [((63, 96), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (86, 96), False, 'import warnings\n'), ((1067, 1098), 'utils.prepare_dirs_and_logger', 'prepare_dirs_and_logger', (['config'], {}), '(config)\n', (1090, 1098), False, 'from utils import prepare_dirs_and_logger, sav... |
'''
MIT License
Copyright (c) 2022 <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, merge, publish, distri... | [
"functools.partial",
"tensorboardX.SummaryWriter",
"torch.distributed.destroy_process_group",
"torch.distributed.init_process_group",
"argparse.ArgumentParser",
"torch.multiprocessing.spawn",
"datasets.CLEVRDataset",
"torch.load",
"torch.nn.functional.binary_cross_entropy_with_logits",
"train_util... | [((1830, 1920), 'torch.nn.functional.binary_cross_entropy_with_logits', 'torch.nn.functional.binary_cross_entropy_with_logits', (['logits', 'target'], {'reduction': '"""none"""'}), "(logits, target,\n reduction='none')\n", (1882, 1920), False, 'import torch\n'), ((3235, 3300), 'torch.distributed.init_process_group',... |
import copy
from typing import Dict
import numpy as np
from tree.descision_tree import DecisionTree, LeafNode, combine_two_trees
from tree.optimized_train.data_view import NodeTrainDataView
from tree.optimized_train.decision_rule_selection import DecisionRuleSelector, DynamicPruningSelector, \
ScheduledPruningSel... | [
"copy.deepcopy",
"numpy.average",
"tree.optimized_train.value_to_bins.ValuesToBins",
"tree.descision_tree.combine_two_trees",
"copy.copy",
"tree.optimized_train.decision_rule_selection.ScheduledPruningSelector",
"tree.optimized_train.params_for_optimized.print_expected_execution_statistics",
"tree.opt... | [((1123, 1144), 'copy.deepcopy', 'copy.deepcopy', (['params'], {}), '(params)\n', (1136, 1144), False, 'import copy\n'), ((1149, 1175), 'tree.optimized_train.params_for_optimized._set_defaults', '_set_defaults', (['params_copy'], {}), '(params_copy)\n', (1162, 1175), False, 'from tree.optimized_train.params_for_optimiz... |
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions
from django.urls import include
from django.urls import path
schema_view = get_schema_view(
openapi.Info(
title='{{ cookiecutter.project_slug }} API',
default_version='v1',
contac... | [
"drf_yasg.openapi.Contact",
"django.urls.include"
] | [((519, 539), 'django.urls.include', 'include', (['"""a12n.urls"""'], {}), "('a12n.urls')\n", (526, 539), False, 'from django.urls import include\n'), ((561, 582), 'django.urls.include', 'include', (['"""users.urls"""'], {}), "('users.urls')\n", (568, 582), False, 'from django.urls import include\n'), ((607, 631), 'dja... |
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | [
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.get_common_arg_spec",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class"
] | [((15938, 15981), 'ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class', 'get_custom_class', (['"""WafLogFactsHelperCustom"""'], {}), "('WafLogFactsHelperCustom')\n", (15954, 15981), False, 'from ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils import OCIResourc... |
import json
X_OFFSET = 20
Y_OFFSET = 40
with open('config.json', 'r') as f:
config = json.load(f)
config['manager'][2][0] += X_OFFSET
config['manager'][2][1] += Y_OFFSET
for anchor_config in config['anchors']:
if len(anchor_config) > 2:
anchor_config[2][0] += X_OFFSET
... | [
"json.dump",
"json.load"
] | [((91, 103), 'json.load', 'json.load', (['f'], {}), '(f)\n', (100, 103), False, 'import json\n'), ((407, 428), 'json.dump', 'json.dump', (['config', 'ff'], {}), '(config, ff)\n', (416, 428), False, 'import json\n')] |
"""Transformer."""
import math
import logging
import torch
__all__ = ('TEncoder', 'TDecoder')
logger = logging.getLogger(__name__)
class PositionalEncoding(torch.nn.Module):
def __init__(self, d_model, dropout, max_seq_len):
super(PositionalEncoding, self).__init__()
self.dropout = torch.nn.Dr... | [
"torch.nn.Dropout",
"torch.nn.TransformerDecoderLayer",
"torch.nn.TransformerEncoder",
"torch.nn.TransformerDecoder",
"torch.nn.LogSoftmax",
"torch.nn.Embedding",
"torch.nn.TransformerEncoderLayer",
"torch.cos",
"torch.arange",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.relu",
"m... | [((106, 133), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'import logging\n'), ((309, 336), 'torch.nn.Dropout', 'torch.nn.Dropout', ([], {'p': 'dropout'}), '(p=dropout)\n', (325, 336), False, 'import torch\n'), ((350, 383), 'torch.zeros', 'torch.zeros', (['max_seq_le... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos_ess.devices.kafka.status_handler.KafkaStatusHandler.doPreinit",
"streaming_data_types.deserialise_x5f2",
"nicos.core.Attach",
"json.loads",
"nicos.core.params.dictof",
"nicos.core.host",
"threading.RLock",
"nicos.core.CommunicationError",
"time.time",
"nicos.core.params.Override",
"stream... | [((3098, 3138), 'nicos_ess.devices.kafka.status_handler.KafkaStatusHandler.doPreinit', 'KafkaStatusHandler.doPreinit', (['self', 'mode'], {}), '(self, mode)\n', (3126, 3138), False, 'from nicos_ess.devices.kafka.status_handler import KafkaStatusHandler\n'), ((3160, 3177), 'threading.RLock', 'threading.RLock', ([], {}),... |