code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import django_filters
from django.core.mail import send_mail
from django.db.models import Sum, OuterRef, Subquery
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.vary import vary_o... | [
"django.db.models.Subquery",
"django.db.models.OuterRef",
"django.utils.decorators.method_decorator",
"django.core.mail.send_mail",
"oauth.views.hash_username",
"django.db.models.Sum",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"django.views.decorators.cache.cache_page",... | [((13955, 13973), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (13963, 13973), False, 'from rest_framework.decorators import action, api_view\n'), ((2720, 2739), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)'}), '(detail=True)\n', (2726, 2739), False, 'fr... |
from encyclopaedia.encyclopaedia import Encyclopaedia
from encyclopaedia.encentry import EncEntry
def test_viewed_callback_set_entry():
enc = Encyclopaedia()
e = EncEntry(
parent=enc,
name="<NAME>",
text=["Test Text"]
)
global i
i = 0
@e.on("viewed")
def cb(entry... | [
"encyclopaedia.encyclopaedia.Encyclopaedia",
"encyclopaedia.encentry.EncEntry"
] | [((148, 163), 'encyclopaedia.encyclopaedia.Encyclopaedia', 'Encyclopaedia', ([], {}), '()\n', (161, 163), False, 'from encyclopaedia.encyclopaedia import Encyclopaedia\n'), ((173, 228), 'encyclopaedia.encentry.EncEntry', 'EncEntry', ([], {'parent': 'enc', 'name': '"""<NAME>"""', 'text': "['Test Text']"}), "(parent=enc,... |
# Create by Packetsss
# Personal use is allowed
# Commercial use is prohibited
import requests
import cProfile
import asyncio
import pathlib
import pstats
import httpx
import time
import math
import re
import os
# Profiling means time every function call and rank by time
def slower_function(x):
def fibonacci(x):... | [
"asyncio.gather",
"pstats.Stats",
"cProfile.Profile",
"httpx.AsyncClient",
"time.sleep",
"math.log10",
"re.findall",
"pathlib.Path",
"requests.get"
] | [((442, 455), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (452, 455), False, 'import time\n'), ((1139, 1154), 'time.sleep', 'time.sleep', (['(2.0)'], {}), '(2.0)\n', (1149, 1154), False, 'import time\n'), ((3587, 3603), 'pstats.Stats', 'pstats.Stats', (['pr'], {}), '(pr)\n', (3599, 3603), False, 'import pstats\... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import json
from datadog import initialize, api
import requests
(
EVENT_PATH_ENV_VAR,
TRELLO_LIST_ID,
TRELLO_KEY_ENV_VAR,
TRELLO_TOKEN_ENV_VAR,
DD_API_KEY_ENV_VAR
) = ENV_VARS = (
... | [
"requests.post",
"datadog.initialize",
"datadog.api.Event.create",
"json.loads"
] | [((1008, 1029), 'datadog.initialize', 'initialize', ([], {}), '(**options)\n', (1018, 1029), False, 'from datadog import initialize, api\n'), ((1171, 1222), 'datadog.api.Event.create', 'api.Event.create', ([], {'title': 'title', 'text': 'text', 'tags': 'tags'}), '(title=title, text=text, tags=tags)\n', (1187, 1222), Fa... |
#!/usr/bin/env python3
#
import sys
import struct
import math
import time
import argparse
import os
import subprocess
import zlib
import gzip
class MKFS:
def __init__(self, src, dest):
self._src = src
self._dest = dest
self._fileCount = 0
self.data=bytearray()
self.offset=0
def output_writeln(self,li... | [
"os.walk",
"os.path.join",
"argparse.ArgumentParser",
"zlib.compressobj"
] | [((3100, 3172), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ROM FS make from dir"""', 'prog': '"""mkfs"""'}), "(description='ROM FS make from dir', prog='mkfs')\n", (3123, 3172), False, 'import argparse\n'), ((1492, 1510), 'os.walk', 'os.walk', (['self._src'], {}), '(self._src)\n', (1... |
from rest_framework import serializers
from django.utils import timezone
from core.models import Visit
from core.participants.serializers import ParticipantSerializer
class VisitSerializer(serializers.ModelSerializer):
class Meta:
model = Visit
fields = ('id', 'participant', 'program', 'created_at... | [
"core.participants.serializers.ParticipantSerializer"
] | [((402, 439), 'core.participants.serializers.ParticipantSerializer', 'ParticipantSerializer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (423, 439), False, 'from core.participants.serializers import ParticipantSerializer\n')] |
import json
import re
from requests.exceptions import HTTPError
from ..server import Server
from ..util.media_type import MediaType
from ..util.name_parser import (get_media_name_from_file,
get_number_from_file_name)
class GenericHumbleBundle(Server):
alias = "humblebundle"
p... | [
"re.compile"
] | [((701, 742), 're.compile', 're.compile', (['""""gamekeys": (\\\\[[^\\\\]]+\\\\])"""'], {}), '(\'"gamekeys": (\\\\[[^\\\\]]+\\\\])\')\n', (711, 742), False, 'import re\n'), ((765, 819), 're.compile', 're.compile', (['"""dl.humble.com/(\\\\w*).\\\\s*?gamekey=(\\\\w*)"""'], {}), "('dl.humble.com/(\\\\w*).\\\\s*?gamekey=(... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 3 19:49:16 2021
@author: ghiggi
"""
import os
import glob
import shutil
import time
import torch
import zarr
import dask
import numpy as np
import xarray as xr
from modules.dataloader_autoregressive import remove_unused_Y
from modules.dataloader_... | [
"numpy.isin",
"modules.utils_zarr.rechunk_Dataset",
"modules.utils_autoregressive.check_ar_settings",
"modules.utils_torch.check_prefetch_factor",
"shutil.rmtree",
"modules.dataloader_autoregressive.AutoregressiveDataset",
"os.path.join",
"zarr.Blosc",
"torch.no_grad",
"os.path.dirname",
"os.pat... | [((5528, 5582), 'numpy.stack', 'np.stack', (['list_to_stack'], {'axis': "dim_info_dynamic['time']"}), "(list_to_stack, axis=dim_info_dynamic['time'])\n", (5536, 5582), True, 'import numpy as np\n'), ((5923, 5955), 'modules.utils_io._get_feature_order', '_get_feature_order', (['data_dynamic'], {}), '(data_dynamic)\n', (... |
# -*- coding: utf-8 -*-
"""Main runtime program for analysis
TODO
- Signal is very weak, it should be more distinct on a log scale
- Endveco accelerometers have too similar main frequencies (possible processing artifact or measurement issue)
- May need to correct for the accelerometer mounting having damping, e... | [
"flutter_other.make_default_directories",
"flutter_input.check_config_file"
] | [((775, 794), 'flutter_input.check_config_file', 'check_config_file', ([], {}), '()\n', (792, 794), False, 'from flutter_input import import_data_acc, import_data_atmos, check_config_file\n'), ((944, 970), 'flutter_other.make_default_directories', 'make_default_directories', ([], {}), '()\n', (968, 970), False, 'from f... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
import dsz
import dsz.cmd
import dsz.data
import dsz.lp
class Route(dsz.data.Task):
def __init__(self, cmd=None):
dsz.data.... | [
"dsz.cmd.data.ObjectGet",
"dsz.data.Task.__init__",
"dsz.cmd.data.Get",
"dsz.data.RegisterCommand"
] | [((2551, 2591), 'dsz.data.RegisterCommand', 'dsz.data.RegisterCommand', (['"""Route"""', 'Route'], {}), "('Route', Route)\n", (2575, 2591), False, 'import dsz\n'), ((311, 344), 'dsz.data.Task.__init__', 'dsz.data.Task.__init__', (['self', 'cmd'], {}), '(self, cmd)\n', (333, 344), False, 'import dsz\n'), ((433, 475), 'd... |
#!/usr/bin/python3
# This code write by Mr.nope
import os
import time
import sys
#############################3
class color:
green = '\033[92m'
red = '\033[91m'
End = '\033[0m'
org = '\033[33m'
darkblue = '\033[34m'
blue = '\033[96m'
def cls():
os.system("clear")
def banner():
... | [
"os.system",
"sys.exit",
"time.sleep"
] | [((285, 303), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (294, 303), False, 'import os\n'), ((322, 359), 'os.system', 'os.system', (['"""printf \'\x1b]2;Hack\x07\'"""'], {}), '("printf \'\\x1b]2;Hack\\x07\'")\n', (331, 359), False, 'import os\n'), ((1232, 1242), 'sys.exit', 'sys.exit', ([], {}), '(... |
#!/usr/bin/env python
import pdb
#pdb.set_trace()
import glob
import os
from argparse import ArgumentParser
from multiprocessing import Pool,cpu_count,active_children,Manager
from subprocess import Popen
import time
from Concatenate_contigs_all_v4_extend_for_HCbk import *
import multiprocessing
script_path = os.path.di... | [
"os.path.abspath",
"subprocess.Popen",
"argparse.ArgumentParser",
"os.path.exists",
"time.sleep",
"multiprocessing.Pool",
"glob.glob",
"multiprocessing.active_children",
"multiprocessing.cpu_count"
] | [((395, 454), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""run local assembly by spades:"""'}), "(description='run local assembly by spades:')\n", (409, 454), False, 'from argparse import ArgumentParser\n'), ((326, 351), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', ... |
"""Utility functions for saved queries."""
from sys import stderr
from django.conf import settings
from django.db import DatabaseError
from .models import Query
from services.es import get_document_ids, count_search_results
from texcavator.utils import json_response_message
def get_query_object(query_id):
"""
... | [
"texcavator.utils.json_response_message",
"services.es.get_document_ids",
"services.es.count_search_results"
] | [((1204, 1429), 'services.es.get_document_ids', 'get_document_ids', (['settings.ES_INDEX', 'settings.ES_DOCTYPE', "query_dict['query']", "query_dict['dates']", 'resolution', "query_dict['exclude_distributions']", "query_dict['exclude_article_types']", "query_dict['selected_pillars']"], {}), "(settings.ES_INDEX, setting... |
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from probflow.modules import Dense, Sequential
from probflow.parameters import Parameter
from probflow.utils.settings import Sampling
tfd = tfp.distributions
def is_close(a, b, tol=1e-3):
return np.abs(a - b) < tol
def test_Sequen... | [
"probflow.modules.Dense",
"probflow.utils.settings.Sampling",
"numpy.abs",
"tensorflow.random.normal"
] | [((642, 666), 'tensorflow.random.normal', 'tf.random.normal', (['[4, 5]'], {}), '([4, 5])\n', (658, 666), True, 'import tensorflow as tf\n'), ((283, 296), 'numpy.abs', 'np.abs', (['(a - b)'], {}), '(a - b)\n', (289, 296), True, 'import numpy as np\n'), ((908, 921), 'probflow.utils.settings.Sampling', 'Sampling', ([], {... |
# 0210.py
import cv2
cap = cv2.VideoCapture(0) # 0번 카메라
frame_size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
print('frame_size = ', frame_size)
fourcc = cv2.VideoWriter_fourcc(*'DVIX') #('D','V','I','X')
#fourcc = cv2.VideoWriter_fourcc(*'XVID')
out... | [
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.VideoWriter",
"cv2.destroyAllWindows"
] | [((31, 50), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (47, 50), False, 'import cv2\n'), ((220, 251), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DVIX'"], {}), "(*'DVIX')\n", (242, 251), False, 'import cv2\n'), ((324, 389), 'cv2.VideoWriter', 'cv2.VideoWriter', (['"""./result/record0.m... |
#!/usr/bin/python3
# coding: utf-8
import os
import subprocess,signal
import time
process_name_to_kill = []
process_name_to_kill.append('script')
process_name_to_kill.append('bash')
process_name_to_kill.append('xterm')
#check kill list
p = subprocess.Popen(['ps','-A'],stdout=subprocess.PIPE)
out,err = p.communicate()... | [
"subprocess.Popen",
"os.popen",
"os.path.exists",
"os.system",
"time.sleep"
] | [((242, 296), 'subprocess.Popen', 'subprocess.Popen', (["['ps', '-A']"], {'stdout': 'subprocess.PIPE'}), "(['ps', '-A'], stdout=subprocess.PIPE)\n", (258, 296), False, 'import subprocess, signal\n'), ((854, 868), 'time.sleep', 'time.sleep', (['(60)'], {}), '(60)\n', (864, 868), False, 'import time\n'), ((963, 1103), 'o... |
import io
from collections import defaultdict
count = 0
by_length = defaultdict(lambda: 0)
with io.open('/home/kurazu/workspace/pycon2013/CSW12.txt', 'r', encoding='utf-8') as input_:
with io.open('/home/kurazu/workspace/pycon2013/scrabble.txt', 'w', encoding='utf-8') as output:
lines = iter(input_)
next(lines) ... | [
"collections.defaultdict",
"io.open"
] | [((69, 92), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (80, 92), False, 'from collections import defaultdict\n'), ((98, 174), 'io.open', 'io.open', (['"""/home/kurazu/workspace/pycon2013/CSW12.txt"""', '"""r"""'], {'encoding': '"""utf-8"""'}), "('/home/kurazu/workspace/pycon2013... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import s4d
setup(
name='s4d',
version=s4d.__version__,
packages=find_packages(),
author="<NAME>",
author_email="<EMAIL>",
description="S4D: SIDEKIT for Diarization",
long_description=open('README.md')... | [
"setuptools.find_packages"
] | [((168, 183), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (181, 183), False, 'from setuptools import setup, find_packages\n')] |
# coding: utf-8
"""
BuildtasksApi.py
Copyright 2015 SmartBear Software
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 require... | [
"six.iteritems"
] | [((2853, 2880), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2862, 2880), False, 'from six import iteritems\n'), ((6335, 6362), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (6344, 6362), False, 'from six import iteritems\n'), ((9583, 9610), 'six... |
from pop_finder import __version__
from pop_finder import pop_finder
from pop_finder import contour_classifier
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import os
import shutil
import pytest
# helper data
infile_all = "tests/test_inputs/onlyAtl_500.recode.vcf.locato... | [
"numpy.load",
"os.remove",
"pandas.read_csv",
"pop_finder.contour_classifier.cont_finder",
"os.path.isfile",
"matplotlib.pyplot.figure",
"shutil.rmtree",
"pop_finder.contour_classifier.kfcv",
"pandas.DataFrame",
"pop_finder.contour_classifier.contour_classifier",
"matplotlib.pyplot.close",
"po... | [((766, 806), 'numpy.load', 'np.load', (['"""tests/test_inputs/X_train.npy"""'], {}), "('tests/test_inputs/X_train.npy')\n", (773, 806), True, 'import numpy as np\n'), ((823, 840), 'numpy.zeros', 'np.zeros', ([], {'shape': '(0)'}), '(shape=0)\n', (831, 840), True, 'import numpy as np\n'), ((851, 895), 'pandas.read_csv'... |
from os import environ
from slack import WebClient
from slackblocks import Attachment, Color, ImageBlock, Message, SectionBlock
def test_basic_attachment_message() -> None:
block = SectionBlock("Hello, world!", block_id="block1")
attachment = Attachment(blocks=block, color=Color.BLACK)
message = Message(c... | [
"slackblocks.SectionBlock",
"slackblocks.Message",
"slackblocks.Attachment",
"slack.WebClient",
"slackblocks.ImageBlock"
] | [((187, 235), 'slackblocks.SectionBlock', 'SectionBlock', (['"""Hello, world!"""'], {'block_id': '"""block1"""'}), "('Hello, world!', block_id='block1')\n", (199, 235), False, 'from slackblocks import Attachment, Color, ImageBlock, Message, SectionBlock\n'), ((253, 296), 'slackblocks.Attachment', 'Attachment', ([], {'b... |
#!/usr/bin/env python3
from ingest import tweet
tweet.main()
| [
"ingest.tweet.main"
] | [((50, 62), 'ingest.tweet.main', 'tweet.main', ([], {}), '()\n', (60, 62), False, 'from ingest import tweet\n')] |
# Compatibility Python 2/3
from __future__ import division, print_function, absolute_import
from builtins import range
# ----------------------------------------------------------------------------------------------------------------------
import opto
from dotmap import DotMap
import matplotlib.pyplot as plt
import nu... | [
"opto.opto.plot.paretoFront",
"matplotlib.pyplot.show",
"logging.FileHandler",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.scatter",
"opto.PAREGO",
"opto.opto.classes.StopCriteria",
"dotmap.DotMap",
"opto.utils.create_folder",
"matplotlib.pyplot.figure",
"numpy.array",
"opto.data.load",
"op... | [((438, 457), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (455, 457), False, 'import logging\n'), ((510, 551), 'opto.utils.create_folder', 'rutils.create_folder', ([], {'nameFolder': 'NAMEFILE'}), '(nameFolder=NAMEFILE)\n', (530, 551), True, 'import opto.utils as rutils\n'), ((572, 615), 'logging.FileHa... |
# This code demonstrates subtle crime I with Compressed sensing
# Run the *fast* experiment to see the images & NRMSE valus on top of them.
# Run the *long* experiment (10 slices x 3 samlpling mask realizations each) to get statistics.
# Then run the script CS_DL_knee_prep_NRMSE_figure.py to produce the statistics g... | [
"h5py.File",
"numpy.save",
"numpy.ones_like",
"os.makedirs",
"sigpy.ifft",
"numpy.multiply",
"os.path.exists",
"numpy.expand_dims",
"numpy.isnan",
"sigpy.mri.app.L1WaveletRecon",
"subtle_data_crimes.functions.sampling_funcs.gen_2D_var_dens_mask",
"numpy.rot90",
"numpy.array",
"os.listdir"
... | [((935, 951), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (943, 951), True, 'import numpy as np\n'), ((975, 991), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (983, 991), True, 'import numpy as np\n'), ((10189, 10222), 'numpy.save', 'np.save', (['gold_filename', 'gold_dict'], {}), '(gold_fi... |
import os
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from environs import Env
from hypothesis import HealthCheck, settings
from loguru import logger
from marshmallow.validate import OneOf
if TYPE_CHECKING:
from types import ModuleType
from _pytest.config import Config
from _p... | [
"marshmallow.validate.OneOf",
"hypothesis.settings.register_profile",
"loguru.logger.add",
"config.__dict__.update",
"holdmypics.create_app",
"pytest.fixture",
"hypothesis.settings.load_profile",
"loguru.logger.info",
"pathlib.Path",
"environs.Env",
"os.path.join"
] | [((1450, 1496), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'name': '"""config"""'}), "(scope='session', name='config')\n", (1464, 1496), False, 'import pytest\n'), ((2291, 2307), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (2305, 2307), False, 'import pytest\n'), ((2428, 2444), 'pytes... |
import torch
from losses import MetricLoss
import torch.nn.functional as F
cri = MetricLoss()
x = torch.ones(4, 5)
# x = F.one_hot(torch.arange(0, 5)).float()
print(x)
loss = cri.orth_reg(x)
print(loss)
| [
"torch.ones",
"losses.MetricLoss"
] | [((82, 94), 'losses.MetricLoss', 'MetricLoss', ([], {}), '()\n', (92, 94), False, 'from losses import MetricLoss\n'), ((101, 117), 'torch.ones', 'torch.ones', (['(4)', '(5)'], {}), '(4, 5)\n', (111, 117), False, 'import torch\n')] |
from .Qt import QtGui,QtCore,QtWidgets
from .templates import ui_tracesRow as tracesRow
import sys
import re
class AnimatedLabel(QtWidgets.QLabel):
def __init__(self,args):
QtWidgets.QLabel.__init__(self)
color1 = QtGui.QColor(255, 0, 0)
color2 = QtGui.QColor(255, 144, 0)
color3... | [
"re.search"
] | [((1573, 1611), 're.search', 're.search', (['"""\\\\Abackground-color:"""', 'sty'], {}), "('\\\\Abackground-color:', sty)\n", (1582, 1611), False, 'import re\n'), ((3311, 3338), 're.search', 're.search', (['"""\\\\Acolor:"""', 'sty'], {}), "('\\\\Acolor:', sty)\n", (3320, 3338), False, 'import re\n')] |
#!/usr/bin/python
import glob
import os
import re
import sys
for filename in glob.glob("../htmlObjectHarness/*.html"):
# used to test the first file
#if filename != "../htmlObjectHarness/full-color-prof-01-f.html":
# continue
if filename == "../htmlObjectHarness/tiny-index.html":
continue
... | [
"os.rename",
"re.sub",
"glob.glob"
] | [((79, 119), 'glob.glob', 'glob.glob', (['"""../htmlObjectHarness/*.html"""'], {}), "('../htmlObjectHarness/*.html')\n", (88, 119), False, 'import glob\n'), ((598, 633), 're.sub', 're.sub', (['"""\\\\.html"""', '""".svg"""', 'filename'], {}), "('\\\\.html', '.svg', filename)\n", (604, 633), False, 'import re\n'), ((651... |
"""Get Google Storage bucket ID and Authorization Domain/s for a given workspace and workspace namespace.
Usage:
> python3 get_workspace_bucket.py -t TSV_FILE """
import argparse
import pandas as pd
from utils import get_access_token, \
get_workpace_bucket, \
get_workspace_auth... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv",
"utils.get_workpace_bucket",
"utils.get_workspace_authorization_domain",
"utils.write_dataframe_to_file"
] | [((528, 554), 'pandas.read_csv', 'pd.read_csv', (['tsv'], {'sep': '"""\t"""'}), "(tsv, sep='\\t')\n", (539, 554), True, 'import pandas as pd\n'), ((577, 651), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['workspace_name', 'workspace_project', 'bucket_id']"}), "(columns=['workspace_name', 'workspace_project', ... |
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.attach_decorator import AttachDecorator
from ..types import UNSET, Unset
T = TypeVar("T", bound="DIDXRequest")
@attr.s(auto_attribs=True)
class DIDXRequest:
""" """
label: str
id: Union[Unset, str] = UNSET
type: Uni... | [
"attr.s",
"typing.TypeVar",
"attr.ib"
] | [((163, 196), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""DIDXRequest"""'}), "('T', bound='DIDXRequest')\n", (170, 196), False, 'from typing import Any, Dict, List, Type, TypeVar, Union\n'), ((200, 225), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (206, 225), False, 'impo... |
# -*- coding: utf-8 -*-
import re
import scrapy
import json
from locations.items import GeojsonPointItem
class BoostMobileSpider(scrapy.Spider):
# download_delay = 0.2
name = "boost_mobile"
item_attributes = {"brand": "Boost Mobile", "brand_wikidata": "Q4943790"}
allowed_domains = ["boostmobile.com"... | [
"locations.items.GeojsonPointItem"
] | [((2056, 2086), 'locations.items.GeojsonPointItem', 'GeojsonPointItem', ([], {}), '(**properties)\n', (2072, 2086), False, 'from locations.items import GeojsonPointItem\n')] |
import json
import re
import pprint
import os
import argparse
import pandas as pd
import random
import numpy as np
from tqdm import tqdm
def strip(sent):
return sent.strip(" ").rstrip('.').rstrip('?').rstrip('!').rstrip('"')
blacklist = ["of the", "is a", "is the", "did the"]
wh = {
"(what|what's)": 0,
... | [
"tqdm.tqdm",
"json.load",
"argparse.ArgumentParser",
"random.sample",
"random.shuffle",
"random.seed",
"re.search"
] | [((3844, 3868), 'random.shuffle', 'random.shuffle', (['examples'], {}), '(examples)\n', (3858, 3868), False, 'import random\n'), ((4453, 4473), 'tqdm.tqdm', 'tqdm', (["source['data']"], {}), "(source['data'])\n", (4457, 4473), False, 'from tqdm import tqdm\n'), ((4850, 4871), 'random.shuffle', 'random.shuffle', (['head... |
import toml
import jinja2
from markdown2 import Markdown
INPUT = 'keys.toml'
OUTPUT = 'index.html'
TEMPLATE = "template.html.jinja"
DIR = "web/"
# load our TOML file
with open(DIR + INPUT, 'r') as file:
data = toml.load(file)
# process and generate badge
def make_badge(str, color):
# it's a badge!
# det... | [
"jinja2.FileSystemLoader",
"markdown2.Markdown",
"toml.load",
"jinja2.Environment"
] | [((910, 920), 'markdown2.Markdown', 'Markdown', ([], {}), '()\n', (918, 920), False, 'from markdown2 import Markdown\n'), ((1007, 1046), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', ([], {'searchpath': 'DIR'}), '(searchpath=DIR)\n', (1030, 1046), False, 'import jinja2\n'), ((1062, 1104), 'jinja2.Environment', ... |
# Classifier for predicting a number in a 28x28 Image
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from tensorflow.python import keras
from keras.models import Sequential, model_from_json
class DigitRecognizer(object):
de... | [
"keras.models.model_from_json",
"matplotlib.pyplot.imread"
] | [((670, 704), 'keras.models.model_from_json', 'model_from_json', (['loaded_model_json'], {}), '(loaded_model_json)\n', (685, 704), False, 'from keras.models import Sequential, model_from_json\n'), ((845, 876), 'matplotlib.pyplot.imread', 'plt.imread', (['"""./input/input.jpg"""'], {}), "('./input/input.jpg')\n", (855, ... |
from sanic import response
from spf import SanicPlugin
from .priority import PRIORITY
# pylint: disable=unused-argument
class CORS(SanicPlugin):
async def route_wrapper(
self,
route,
request,
context,
request_args,
request_kw,
*decorator_args,
with_... | [
"sanic.response.HTTPResponse"
] | [((624, 657), 'sanic.response.HTTPResponse', 'response.HTTPResponse', ([], {'status': '(204)'}), '(status=204)\n', (645, 657), False, 'from sanic import response\n'), ((423, 456), 'sanic.response.HTTPResponse', 'response.HTTPResponse', ([], {'status': '(204)'}), '(status=204)\n', (444, 456), False, 'from sanic import r... |
import numpy as np
import torch as th
from tpp.processes.hawkes import neg_log_likelihood_old as nll_old
from tpp.processes.hawkes import neg_log_likelihood as nll_new
from tpp.utils.keras_preprocessing.sequence import pad_sequences
def test_nll():
n_seq = 10
my_alpha = 0.7
my_mu = 0.1
pad_id = -1.
... | [
"torch.stack",
"tpp.utils.keras_preprocessing.sequence.pad_sequences",
"numpy.allclose",
"tpp.processes.hawkes.neg_log_likelihood_old",
"numpy.random.randint",
"torch.rand",
"tpp.processes.hawkes.neg_log_likelihood",
"torch.from_numpy"
] | [((609, 631), 'torch.stack', 'th.stack', (['nll_1'], {'dim': '(0)'}), '(nll_1, dim=0)\n', (617, 631), True, 'import torch as th\n'), ((656, 728), 'tpp.utils.keras_preprocessing.sequence.pad_sequences', 'pad_sequences', (['my_points'], {'padding': '"""post"""', 'dtype': 'np.float32', 'value': 'pad_id'}), "(my_points, pa... |
#!/usr/bin/env python
"""GithubApiTest
Takes a url, requests it's content, prints it's content to stdout
Optionally prints to a file"""
import os, sys
import pathlib
import argparse
import json
from pprint import pprint
from requests import request
req = request
parser = argparse.ArgumentParser(description='Optional... | [
"pprint.pprint",
"argparse.ArgumentParser",
"json.loads"
] | [((275, 338), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Optionally write to file"""'}), "(description='Optionally write to file')\n", (298, 338), False, 'import argparse\n'), ((339, 353), 'pprint.pprint', 'pprint', (['parser'], {}), '(parser)\n', (345, 353), False, 'from pprint impo... |
"""
https://www.reddit.com/r/dailyprogrammer/comments/8s0cy1/20180618_challenge_364_easy_create_a_dice_roller/
Your input will contain one or more lines, where each line will be in the form
of "NdM"; for example:
3d6
4d12
1d10
5d4
You should output the sum of all the rolls of that specified die, each on ... | [
"re.match",
"random.randint"
] | [((837, 861), 'random.randint', 'random.randint', (['(1)', 'sides'], {}), '(1, sides)\n', (851, 861), False, 'import random, re\n'), ((1172, 1211), 're.match', 're.match', (['"""^[0-9]*d[0-9]*$"""', 'dice_input'], {}), "('^[0-9]*d[0-9]*$', dice_input)\n", (1180, 1211), False, 'import random, re\n')] |
import numpy as np
def is_sklearn_linear_classifier(obj):
"""
Checks if object is a sklearn linear classifier for a binary outcome
:param obj: object
"""
binary_flag = hasattr(obj, 'classes_') and len(obj.classes_) == 2
linear_flag = hasattr(obj, 'coef_') and hasattr(obj, 'intercept_'... | [
"numpy.array",
"numpy.isfinite"
] | [((2083, 2097), 'numpy.isfinite', 'np.isfinite', (['t'], {}), '(t)\n', (2094, 2097), True, 'import numpy as np\n'), ((1998, 2009), 'numpy.array', 'np.array', (['w'], {}), '(w)\n', (2006, 2009), True, 'import numpy as np\n'), ((2050, 2064), 'numpy.isfinite', 'np.isfinite', (['w'], {}), '(w)\n', (2061, 2064), True, 'impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter.ttk
import tkinter
root = tkinter.Tk()
tkinter.ttk.Style().configure("TButton", padding=6, relief="flat",
background="#ccc")
count = 0
def show_hello():
tkinter.ttk.Label(text="Hello World!!").pack()
btn = tkinter.ttk.Button... | [
"tkinter.ttk.Label",
"tkinter.Tk",
"tkinter.ttk.Style",
"tkinter.ttk.Button"
] | [((90, 102), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (100, 102), False, 'import tkinter\n'), ((302, 355), 'tkinter.ttk.Button', 'tkinter.ttk.Button', ([], {'text': '"""Sample"""', 'command': 'show_hello'}), "(text='Sample', command=show_hello)\n", (320, 355), False, 'import tkinter\n'), ((104, 123), 'tkinter.ttk.... |
# ===============================================================================
# Copyright 2021 ross
#
# 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/LICE... | [
"pywatlow.watlow.Watlow"
] | [((957, 979), 'pywatlow.watlow.Watlow', 'Watlow', ([], {'port': 'self.port'}), '(port=self.port)\n', (963, 979), False, 'from pywatlow.watlow import Watlow\n')] |
# Generated by Django 4.0.3 on 2022-03-24 15:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('inventory', '0010_publication_article'),
]
operations = [
migrations.RemoveField(
model_name='membership',
name='group',
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((230, 291), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""membership"""', 'name': '"""group"""'}), "(model_name='membership', name='group')\n", (252, 291), False, 'from django.db import migrations\n'), ((336, 399), 'django.db.migrations.RemoveField', 'migrations.RemoveField', (... |
from tkinter import*
from tkinter import filedialog
import tkinter.messagebox
from pygame import mixer
from mutagen.id3 import ID3
import os
font =('verdana',15, 'bold', 'italic')
root = Tk()
mixer.init() #Initializing the mixer
#Create the menubar
menubar = Menu(root)
root.config(menu=menubar,relief=GROOVE)
def ope... | [
"os.listdir",
"mutagen.id3.ID3",
"os.path.basename",
"pygame.mixer.music.unpause",
"os.path.realpath",
"pygame.mixer.init",
"pygame.mixer.music.play",
"tkinter.filedialog.askopenfilename",
"tkinter.filedialog.askdirectory",
"pygame.mixer.music.set_volume",
"pygame.mixer.music.get_busy",
"pygam... | [((194, 206), 'pygame.mixer.init', 'mixer.init', ([], {}), '()\n', (204, 206), False, 'from pygame import mixer\n'), ((5579, 5606), 'pygame.mixer.music.set_volume', 'mixer.music.set_volume', (['(0.7)'], {}), '(0.7)\n', (5601, 5606), False, 'from pygame import mixer\n'), ((365, 393), 'tkinter.filedialog.askopenfilename'... |
from bs4 import BeautifulSoup
import requests
from flask import jsonify
from difflib import SequenceMatcher
url_base = 'https://www.chances.com.br'
busca = '/chances/oportunidades/'
def get_jobs(palavra):
req = requests.get(url_base + busca + palavra)
soup = BeautifulSoup(req.text, 'html.parser')
vagas =... | [
"bs4.BeautifulSoup",
"flask.jsonify",
"requests.get",
"difflib.SequenceMatcher"
] | [((218, 258), 'requests.get', 'requests.get', (['(url_base + busca + palavra)'], {}), '(url_base + busca + palavra)\n', (230, 258), False, 'import requests\n'), ((270, 308), 'bs4.BeautifulSoup', 'BeautifulSoup', (['req.text', '"""html.parser"""'], {}), "(req.text, 'html.parser')\n", (283, 308), False, 'from bs4 import ... |
import os
from pyngrok import ngrok
import json
import logging
debug_env_path = os.path.join(os.path.dirname(__file__), "debug_env.json")
workers = 1
if os.path.exists(debug_env_path):
with open(debug_env_path) as r:
os.environ.update(json.load(r))
os.environ["HOST_URL"] = ngrok.connect(addr=os.environ... | [
"logging.error",
"json.load",
"os.path.dirname",
"os.path.exists",
"logging.info",
"os.path.join",
"pyngrok.ngrok.connect"
] | [((154, 184), 'os.path.exists', 'os.path.exists', (['debug_env_path'], {}), '(debug_env_path)\n', (168, 184), False, 'import os\n'), ((94, 119), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (109, 119), False, 'import os\n'), ((757, 824), 'logging.info', 'logging.info', (['f"""Flushing match... |
import string
from django import forms
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.dispatch import receiver
from django.shortcuts import render
from django.utils.decorators import method_decorator
from bs4 import BeautifulSoup
from modelcluster.fie... | [
"django.db.models.TextField",
"wagtail.images.edit_handlers.ImageChooserPanel",
"tbx.core.blocks.StoryBlock",
"tbx.core.models.Tag.objects.get",
"django.db.models.ForeignKey",
"django.dispatch.receiver",
"django.db.models.BooleanField",
"wagtail.admin.edit_handlers.StreamFieldPanel",
"wagtail.snippe... | [((5933, 5974), 'django.dispatch.receiver', 'receiver', (['page_published'], {'sender': 'WorkPage'}), '(page_published, sender=WorkPage)\n', (5941, 5974), False, 'from django.dispatch import receiver\n'), ((1117, 1166), 'modelcluster.fields.ParentalKey', 'ParentalKey', (['"""work.WorkPage"""'], {'related_name': '"""tag... |
from django.shortcuts import render_to_response
from django.template import RequestContext
def home(request):
return render_to_response('doodle/index.html', context_instance=RequestContext(request))
| [
"django.template.RequestContext"
] | [((179, 202), 'django.template.RequestContext', 'RequestContext', (['request'], {}), '(request)\n', (193, 202), False, 'from django.template import RequestContext\n')] |
''' module for testing Zaif API '''
import json
from sys import path
from unittest import TestCase
from nose.tools import ok_
import nose
from hokonui.exchanges.zaif import Zaif as zf
from hokonui.utils.helpers import docstring_parameter as docparams
LIBPATH = '../hokonui'
if LIBPATH not in path:
path.append(LI... | [
"sys.path.append",
"hokonui.exchanges.zaif.Zaif.get_current_price",
"hokonui.exchanges.zaif.Zaif.get_current_bid",
"hokonui.exchanges.zaif.Zaif.get_current_orders",
"hokonui.exchanges.zaif.Zaif.get_current_ask",
"nose.tools.ok_",
"nose.runmodule",
"hokonui.exchanges.zaif.Zaif.get_current_ticker",
"h... | [((306, 326), 'sys.path.append', 'path.append', (['LIBPATH'], {}), '(LIBPATH)\n', (317, 326), False, 'from sys import path\n'), ((416, 447), 'hokonui.utils.helpers.docstring_parameter', 'docparams', (['zf.__name__', '"""setup"""'], {}), "(zf.__name__, 'setup')\n", (425, 447), True, 'from hokonui.utils.helpers import do... |
from typing import List, AnyStr
from command_factory import CommandFactory
from colorama import Fore, Style
from constant import MAIN_CYCLE, LINUX
def print_yellow(txt: str, bold=True):
print(((Fore.YELLOW + (Style.BRIGHT if bold else "")) if LINUX else "") + txt + (Fore.RESET if LINUX else ""))
def print_prompt(... | [
"command_factory.CommandFactory.get_instance"
] | [((658, 691), 'command_factory.CommandFactory.get_instance', 'CommandFactory.get_instance', (['line'], {}), '(line)\n', (685, 691), False, 'from command_factory import CommandFactory\n'), ((545, 584), 'command_factory.CommandFactory.get_instance', 'CommandFactory.get_instance', (['"""commands"""'], {}), "('commands')\n... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.module_loading import import_string
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from cms.toolbar_base import CMSToolbar
from cmsplugin_cascade import app_settings
@toolbar_pool.reg... | [
"django.utils.module_loading.import_string",
"django.utils.translation.ugettext_lazy"
] | [((452, 469), 'django.utils.translation.ugettext_lazy', '_', (['"""Segmentation"""'], {}), "('Segmentation')\n", (453, 469), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((577, 598), 'django.utils.module_loading.import_string', 'import_string', (['sgm[1]'], {}), '(sgm[1])\n', (590, 598), False, '... |
from testil import eq
from ..corrupt_couch import find_missing_ids
def test_find_missing_ids():
def test(result_sets, expected_missing, expected_tries, min_tries=5):
def get_ids():
while len(results) > 1:
return results.pop()
return results[0]
results = li... | [
"testil.eq"
] | [((416, 445), 'testil.eq', 'eq', (['missing', 'expected_missing'], {}), '(missing, expected_missing)\n', (418, 445), False, 'from testil import eq\n'), ((454, 479), 'testil.eq', 'eq', (['tries', 'expected_tries'], {}), '(tries, expected_tries)\n', (456, 479), False, 'from testil import eq\n')] |
import os
import unittest
import uuid
import papermill
import pandas as pd
from tests import datasets, server
EXPERIMENT_ID = str(uuid.uuid4())
OPERATOR_ID = str(uuid.uuid4())
RUN_ID = str(uuid.uuid4())
TEMPORARY_DIR = "tmp"
LOCAL_TEST_DATA_PATH = f"/{TEMPORARY_DIR}/data/paracrawl_en_pt_test.csv"
EXPERIMENT_NOTEBOO... | [
"uuid.uuid4",
"tests.datasets.paracrawl",
"pandas.read_csv",
"tests.server.Server",
"tests.datasets.paracrawl_test_data",
"tests.datasets.clean",
"papermill.execute_notebook",
"os.chdir"
] | [((133, 145), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (143, 145), False, 'import uuid\n'), ((165, 177), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (175, 177), False, 'import uuid\n'), ((192, 204), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (202, 204), False, 'import uuid\n'), ((675, 695), 'tests.datasets.pa... |
from pathlib import Path
import subprocess
import argparse
PLUGINS = 'plugins'
def start_analysis(command: list):
try:
subprocess.run(args=command, stderr=subprocess.STDOUT, cwd=str(Path.cwd()))
except subprocess.CalledProcessError as err:
print('Status : FAIL', err.returncode)
def build_com... | [
"pathlib.Path.cwd",
"argparse.ArgumentParser",
"pathlib.Path"
] | [((434, 444), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (442, 444), False, 'from pathlib import Path\n'), ((1145, 1155), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1149, 1155), False, 'from pathlib import Path\n'), ((1359, 1369), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1363, 1369), False,... |
import numpy as np
def generate_features(draw_graphs, raw_data, axes, sampling_freq, scale_axes):
# features is a 1D array, reshape so we have a matrix
raw_data = raw_data.reshape(int(len(raw_data) / len(axes)), len(axes))
features = []
graphs = []
# split out the data from all axes
for ax in... | [
"numpy.array"
] | [((511, 522), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (519, 522), True, 'import numpy as np\n')] |
import os
from random import randint, seed
import torch
import numpy as np
import cv2
'''
Code adapted from https://github.com/MathiasGruber/PConv-Keras/blob/master/libs/util.py
'''
class MaskGenerator:
def __init__(self, channels=1, rand_seed=None, filepath=None, channels_first=True):
"""Convenience fun... | [
"cv2.line",
"os.listdir",
"numpy.moveaxis",
"cv2.circle",
"random.randint",
"numpy.zeros",
"numpy.ones",
"cv2.warpAffine",
"cv2.ellipse",
"random.seed",
"numpy.random.randint",
"numpy.random.choice",
"cv2.erode",
"cv2.getRotationMatrix2D",
"torch.tensor"
] | [((1585, 1645), 'numpy.zeros', 'np.zeros', (['(self.height, self.width, self.channels)', 'np.uint8'], {}), '((self.height, self.width, self.channels), np.uint8)\n', (1593, 1645), True, 'import numpy as np\n'), ((2940, 2959), 'torch.tensor', 'torch.tensor', (['img_1'], {}), '(img_1)\n', (2952, 2959), False, 'import torc... |
from html.parser import HTMLParser
from typing import Set
import requests
class SimpleFormatParser(HTMLParser):
def __init__(self):
super().__init__()
self.__in_a_tag = False
self.all_packages = set()
def handle_starttag(self, tag, attrs):
self.__in_a_tag = tag == "a"
de... | [
"requests.get"
] | [((503, 543), 'requests.get', 'requests.get', (['"""https://pypi.org/simple/"""'], {}), "('https://pypi.org/simple/')\n", (515, 543), False, 'import requests\n')] |
import os
import shutil
import subprocess
import argparse
def adapt_env_file(name,env_file):
print("we'll adapt the environment file so the newly created conda environment will be named {}".format(name))
with open(env_file,'r') as file:
filedata = file.read()
# Replace the target string
filedata ... | [
"subprocess.run",
"os.sync",
"argparse.ArgumentParser"
] | [((1055, 1130), 'subprocess.run', 'subprocess.run', (["['conda', '-c']"], {'capture_output': '(True)', 'text': '(True)', 'shell': '(True)'}), "(['conda', '-c'], capture_output=True, text=True, shell=True)\n", (1069, 1130), False, 'import subprocess\n'), ((1601, 1720), 'subprocess.run', 'subprocess.run', (["['conda', 'e... |
import json
import os
from os.path import join
from pipeline.data.download_HuBMAP_data import *
from pipeline.segmentation.methods.installation.install_all_methods import *
if __name__ == '__main__':
config = {}
package_utilization = input('How would you like to utilize this package?\n'
'1. Reproduce ... | [
"json.dump"
] | [((3233, 3253), 'json.dump', 'json.dump', (['config', 'f'], {}), '(config, f)\n', (3242, 3253), False, 'import json\n')] |
from programytest.parser.pattern.base import PatternTestBaseClass
from programy.parser.exceptions import ParserException
from programy.parser.pattern.nodes.word import PatternWordNode
from programy.parser.pattern.nodes.base import PatternNode
from programy.parser.template.nodes.base import TemplateNode
from programy.... | [
"programy.parser.pattern.nodes.topic.PatternTopicNode",
"programy.parser.pattern.nodes.word.PatternWordNode",
"programy.parser.pattern.nodes.root.PatternRootNode",
"programy.parser.template.nodes.base.TemplateNode",
"programy.parser.pattern.nodes.that.PatternThatNode",
"programy.parser.pattern.nodes.base.... | [((660, 677), 'programy.parser.pattern.nodes.root.PatternRootNode', 'PatternRootNode', ([], {}), '()\n', (675, 677), False, 'from programy.parser.pattern.nodes.root import PatternRootNode\n'), ((1671, 1688), 'programy.parser.pattern.nodes.root.PatternRootNode', 'PatternRootNode', ([], {}), '()\n', (1686, 1688), False, ... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 28 10:58:32 2020
@author: seba
"""
# Prueba con serial
# Recordar instalar la libreria serial
#pip install pyserial
#from serial import Serial
#python -m serial.tools.list_ports # Hace una lista de los puertos
import serial
import time
import numpy... | [
"serial.Serial",
"statistics.median",
"statistics.stdev",
"numpy.zeros",
"time.time",
"time.sleep",
"sys.stdout.flush",
"math.trunc"
] | [((904, 919), 'serial.Serial', 'serial.Serial', ([], {}), '()\n', (917, 919), False, 'import serial\n'), ((999, 1012), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1009, 1012), False, 'import time\n'), ((1146, 1162), 'numpy.zeros', 'np.zeros', (['(3, 1)'], {}), '((3, 1))\n', (1154, 1162), True, 'import numpy as... |
import requests
from bs4 import BeautifulSoup as bs
def pub_text_parse(url, htmlel1, htmlel2):
all_data = []
r = requests.get(url)
html = bs(r.content, 'html.parser')
for el in html.select(htmlel1):
data = el.select(htmlel2)
all_data.append(data[0].text)
return all_data | [
"bs4.BeautifulSoup",
"requests.get"
] | [((121, 138), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (133, 138), False, 'import requests\n'), ((148, 176), 'bs4.BeautifulSoup', 'bs', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n", (150, 176), True, 'from bs4 import BeautifulSoup as bs\n')] |
from src.BLDC import *
from src.customComponents import *
from PyQt5.QtWidgets import QCheckBox, QFrame, QProgressBar
from PyQt5.QtCore import QObject, pyqtSignal, QSettings
import sys
from math import pi
class TreadMotor(QObject):
startClock = pyqtSignal()
stopClock = pyqtSignal()
def __init__(self,saveN... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtWidgets.QProgressBar",
"PyQt5.QtWidgets.QCheckBox",
"sys.stderr.write"
] | [((250, 262), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (260, 262), False, 'from PyQt5.QtCore import QObject, pyqtSignal, QSettings\n'), ((279, 291), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (289, 291), False, 'from PyQt5.QtCore import QObject, pyqtSignal, QSettings\n'), ((1062, 1089)... |
import grpc
import gate_control_pb2
import gate_control_pb2_grpc
import time
channel = grpc.insecure_channel('localhost:50007')
stub = gate_control_pb2_grpc.GateServiceStub(channel)
while True:
time.sleep(2)
goRequest = gate_control_pb2.GoRequest(userId = '1702005', goOut = True)
result = stub.Go(goRequ... | [
"gate_control_pb2.GoRequest",
"gate_control_pb2_grpc.GateServiceStub",
"grpc.insecure_channel",
"time.sleep"
] | [((88, 128), 'grpc.insecure_channel', 'grpc.insecure_channel', (['"""localhost:50007"""'], {}), "('localhost:50007')\n", (109, 128), False, 'import grpc\n'), ((137, 183), 'gate_control_pb2_grpc.GateServiceStub', 'gate_control_pb2_grpc.GateServiceStub', (['channel'], {}), '(channel)\n', (174, 183), False, 'import gate_c... |
from django.contrib import admin
from .models import Listing
admin.site.register(Listing) | [
"django.contrib.admin.site.register"
] | [((62, 90), 'django.contrib.admin.site.register', 'admin.site.register', (['Listing'], {}), '(Listing)\n', (81, 90), False, 'from django.contrib import admin\n')] |
from flask import Flask, request
from json import dumps, loads
from flask_cors import CORS
from spothole_service import pothole_results
app = Flask(__name__)
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
@app.route('/api/getResults', methods=['GET'])
def app_get_unit_tests():
return pothole_results()
... | [
"flask_cors.CORS",
"flask.Flask",
"spothole_service.pothole_results"
] | [((143, 158), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (148, 158), False, 'from flask import Flask, request\n'), ((166, 215), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/api/*': {'origins': '*'}}"}), "(app, resources={'/api/*': {'origins': '*'}})\n", (170, 215), False, 'from flask_cors imp... |
# ******************************************************************************
#
# utils.py: utilities for allauth_2f2a
#
# SPDX-License-Identifier: Apache-2.0
#
# django-allauth-2f2a, a 2fa adapter for django-allauth.
#
# ******************************************************************************
#
# Copyright 2... | [
"io.BytesIO",
"importlib.import_module",
"urllib.parse.urlencode",
"urllib.parse.quote",
"base64.b32encode",
"qrcode.make",
"django.contrib.sites.shortcuts.get_current_site"
] | [((1845, 1897), 'qrcode.make', 'qrcode.make', (['otpauth_url'], {'image_factory': 'SvgPathImage'}), '(otpauth_url, image_factory=SvgPathImage)\n', (1856, 1897), False, 'import qrcode\n'), ((1907, 1916), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1914, 1916), False, 'from io import BytesIO\n'), ((2178, 2203), 'django.c... |
# -*- coding: utf-8 -*-
# https://gist.github.com/mikalv/3947ccf21366669ac06a01f39d7cff05
# http://cv-tricks.com/tensorflow-tutorial/save-restore-tensorflow-models-quick-complete-tutorial/
import tensorflow as tf
import numpy as np
import os, sys
import re
import collections
#set hyperparameters
max_len = 40
step = ... | [
"os.mkdir",
"numpy.sum",
"numpy.argmax",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"numpy.random.multinomial",
"tensorflow.reshape",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.matmul",
"tensorflow.contrib.rnn.static_rnn",
"tensorflow.train.latest_checkpoint",
"numpy.... | [((708, 734), 'collections.Counter', 'collections.Counter', (['WORDS'], {}), '(WORDS)\n', (727, 734), False, 'import collections\n'), ((450, 475), 'os.path.exists', 'os.path.exists', (['SAVE_PATH'], {}), '(SAVE_PATH)\n', (464, 475), False, 'import os, sys\n'), ((481, 500), 'os.mkdir', 'os.mkdir', (['SAVE_PATH'], {}), '... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from rdmo.questions.models import Catalog
# Create your models here.
class Catalog2ExternalDatamodel(models.Model):
catalog = models.ForeignKey(
Catalog, related_name='usesDatamodel', on_delete=models.CASCADE, null=False,
... | [
"django.db.models.IntegerField",
"django.utils.translation.ugettext_lazy",
"django.db.models.UniqueConstraint"
] | [((449, 493), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(False)', 'null': '(False)'}), '(blank=False, null=False)\n', (468, 493), False, 'from django.db import models\n'), ((341, 353), 'django.utils.translation.ugettext_lazy', '_', (['"""Catalog"""'], {}), "('Catalog')\n", (342, 353), True... |
# backend
from selenium import webdriver
import random
import string
import math
user_input = []
words: list[str] = []
with open('lots of uk words.txt', 'r') as f:
re = f.read()
re = re.splitlines()
words = [x for x in re if x.strip()]
def stop():
global x1
x1 = False
def m... | [
"math.pow",
"random.randrange",
"random.choice",
"selenium.webdriver.Chrome"
] | [((482, 504), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['PATH'], {}), '(PATH)\n', (498, 504), False, 'from selenium import webdriver\n'), ((668, 691), 'random.randrange', 'random.randrange', (['(10000)'], {}), '(10000)\n', (684, 691), False, 'import random\n'), ((17788, 17816), 'random.choice', 'random.choice'... |
#!/usr/bin/python
# Copyright (C) 2007-2009 <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 ... | [
"os.makedirs",
"os.spawnvp"
] | [((2712, 2750), 'os.spawnvp', 'os.spawnvp', (['os.P_WAIT', 'parts[0]', 'parts'], {}), '(os.P_WAIT, parts[0], parts)\n', (2722, 2750), False, 'import sys, os\n'), ((2841, 2858), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (2852, 2858), False, 'import sys, os\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Emulate running of test setup script, is_good.py should fail without this."""
from __future__ import pr... | [
"sys.exit"
] | [((501, 517), 'sys.exit', 'sys.exit', (['retval'], {}), '(retval)\n', (509, 517), False, 'import sys\n')] |
from unittest.mock import MagicMock
import pytest
from butterfree.clients import CassandraClient
from butterfree.hooks.schema_compatibility import CassandraTableSchemaCompatibilityHook
class TestCassandraTableSchemaCompatibilityHook:
def test_run_compatible_schema(self, spark_session):
cassandra_client ... | [
"pytest.raises",
"butterfree.clients.CassandraClient",
"unittest.mock.MagicMock",
"butterfree.hooks.schema_compatibility.CassandraTableSchemaCompatibilityHook"
] | [((322, 379), 'butterfree.clients.CassandraClient', 'CassandraClient', ([], {'host': "['mock']", 'keyspace': '"""dummy_keyspace"""'}), "(host=['mock'], keyspace='dummy_keyspace')\n", (337, 379), False, 'from butterfree.clients import CassandraClient\n'), ((412, 530), 'unittest.mock.MagicMock', 'MagicMock', ([], {'retur... |
import os
__all__ = ['default_data_directory']
def default_data_directory():
return os.path.expanduser('~/.indiecoin/data')
| [
"os.path.expanduser"
] | [((91, 130), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.indiecoin/data"""'], {}), "('~/.indiecoin/data')\n", (109, 130), False, 'import os\n')] |
# coding=utf-8
# date: 2018/12/24, 15:27
# name: smz
import numpy as np
import tensorflow as tf
from LinearModel.modules.model import TumorModel
from LinearModel.configuration.options import opts
def TumorModelTrain():
data_X = np.load("../data/train_data_X.npy")
data_Y = np.load("../data/train_data_Y.npy") ... | [
"numpy.load",
"tensorflow.global_variables_initializer",
"LinearModel.modules.model.TumorModel",
"tensorflow.Session",
"numpy.expand_dims"
] | [((235, 270), 'numpy.load', 'np.load', (['"""../data/train_data_X.npy"""'], {}), "('../data/train_data_X.npy')\n", (242, 270), True, 'import numpy as np\n'), ((284, 319), 'numpy.load', 'np.load', (['"""../data/train_data_Y.npy"""'], {}), "('../data/train_data_Y.npy')\n", (291, 319), True, 'import numpy as np\n'), ((359... |
import requests
import unittest
from hoverpy import HoverPy, capture, simulate
import time
import json
import logging
import os
class TestVirt(unittest.TestCase):
endpoint = 'http://localhost:8000/'
def testCapture(self):
with HoverPy(capture=True) as hp:
r = requests.get("http://time.iolo... | [
"unittest.main",
"hoverpy.HoverPy",
"logging.debug",
"os.unlink",
"hoverpy.simulate",
"time.sleep",
"hoverpy.capture",
"requests.get"
] | [((2017, 2032), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2030, 2032), False, 'import unittest\n'), ((1305, 1336), 'hoverpy.capture', 'capture', ([], {'dbpath': '"""decorators.db"""'}), "(dbpath='decorators.db')\n", (1312, 1336), False, 'from hoverpy import HoverPy, capture, simulate\n'), ((1604, 1636), 'hov... |
# coding=utf-8
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this di... | [
"unittest.TestSuite",
"doctest.DocTestSuite",
"unittest.makeSuite",
"Products.XWFCore.cache.caches.get",
"Products.XWFCore.cache.caches.has_key",
"Products.XWFCore.cache.simplecache",
"os.path.join",
"zope.app.testing.placelesssetup.setUp"
] | [((1094, 1165), 'Products.XWFCore.cache.simplecache', 'simplecachedecorator', (['"""mycache.return_same_input"""', "(lambda *args: ':foo')"], {}), "('mycache.return_same_input', lambda *args: ':foo')\n", (1114, 1165), True, 'from Products.XWFCore.cache import simplecache as simplecachedecorator\n'), ((1238, 1349), 'Pro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of walt
# https://github.com/scorphus/walt
# Licensed under the BSD-3-Clause license:
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2021, <NAME> <<EMAIL>>
import asyncio
import contextlib
import re
from unittest.mock import ANY
from u... | [
"walt.action_runners.Producer",
"unittest.mock.MagicMock",
"asyncio.sleep",
"walt.result.ResultSerde.from_bytes",
"asyncio.all_tasks",
"unittest.mock.AsyncMock",
"contextlib.suppress",
"pytest.mark.parametrize",
"unittest.mock.call",
"re.compile"
] | [((4810, 4859), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""concurrent"""', '[1, 5, 10]'], {}), "('concurrent', [1, 5, 10])\n", (4833, 4859), False, 'import pytest\n'), ((6975, 7286), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""regexp, side_effect, pattern"""', "[('', None, result.Patter... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.db.models.deletion import CASCADE
# Create your models here.
class User(AbstractUser):
is_student = models.BooleanField(default=False)
is_teacher = models.BooleanField(default=False)
first_name = models.CharField(... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((199, 233), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (218, 233), False, 'from django.db import models\n'), ((251, 285), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (270, 285), False, 'from ... |
# -*- coding: utf-8 -*-
"""
Created on 2020.05.19
@author: <NAME>, <NAME>, <NAME>, <NAME>
Code based on:
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
class RandomForest:
"""docstring for RandomForest"""
def __init__(self, model_configs, task_type='Regre... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.random.seed",
"sklearn.ensemble.RandomForestRegressor"
] | [((726, 763), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'self.random_seed'}), '(seed=self.random_seed)\n', (740, 763), True, 'import numpy as np\n'), ((921, 1161), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'self.n_estimators', 'max_features': 'self.max_feature... |
import tensorflow as tf
from commons.net import Net
class WAE_GAN(Net):
pass
class WAE_WGAN(Net):
def __init__(self,
x,
p_z,
Q_arch, #Encoder
G_arch, #Decoder
D_arch, #Discriminator
D_lambda, #Lambda for grad... | [
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"dataset.MNIST",
"tensorflow.InteractiveSession",
"tensorflow.summary.merge",
"tensorflow.abs",
"dataset.CelebA"... | [((5418, 5434), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (5432, 5434), True, 'import tensorflow as tf\n'), ((5489, 5525), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {'config': 'config'}), '(config=config)\n', (5510, 5525), True, 'import tensorflow as tf\n'), ((5574, 5616), 'tens... |
import math
import Gestion_jeton
from Partie import *
def evaluation_quadruplet(quadruplet, couleur_jeton):
nb_vide = 0
nb_jeton = 0
nb_jeton_adv = 0
for incr in range(len(quadruplet)):
if quadruplet[incr] is None:
nb_vide += 1
else:
if quadrup... | [
"Gestion_jeton.Jeton.decremente_nombre_jeton"
] | [((4988, 5033), 'Gestion_jeton.Jeton.decremente_nombre_jeton', 'Gestion_jeton.Jeton.decremente_nombre_jeton', ([], {}), '()\n', (5031, 5033), False, 'import Gestion_jeton\n')] |
"""
Geographical measurement and analysis
Provides Point, Line, and Polygon classes, and their Multipart equivalents,
with methods for simple measurements such as distance, area, and direction.
"""
from __future__ import division
import math
import itertools
import numbers
import numpy as np
from coordstring import C... | [
"numpy.sum",
"numpy.linalg.lstsq",
"math.sqrt",
"numpy.eye",
"math.atan2",
"numpy.zeros",
"math.sin",
"numpy.argmin",
"numpy.equal",
"numpy.min",
"numpy.array",
"math.cos",
"numpy.reshape",
"numpy.dot",
"coordstring.CoordString",
"itertools.chain",
"numpy.vstack"
] | [((63355, 63391), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['A', 'vecp'], {'rcond': 'None'}), '(A, vecp, rcond=None)\n', (63370, 63391), True, 'import numpy as np\n'), ((63403, 63424), 'numpy.reshape', 'np.reshape', (['M', '[2, 3]'], {}), '(M, [2, 3])\n', (63413, 63424), True, 'import numpy as np\n'), ((1746, 1780), '... |
from __future__ import division, print_function
from os import mkdir
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
import sys
import time
import torch.utils.data
from torchvision import transforms, datasets
from torch._six import with_metaclass
from torch._C import _ImperativeEngi... | [
"os.mkdir",
"torch.distributions.Categorical",
"torch.mm",
"sys.stdout.flush",
"torchvision.transforms.Normalize",
"torch._C._ImperativeEngine",
"torch.utils.data.DataLoader",
"torch.load",
"torch.Tensor",
"torch.nn.functional.nll_loss",
"torch.log",
"torch.manual_seed",
"torch.norm",
"tor... | [((1316, 1374), 'torch._six.with_metaclass', 'with_metaclass', (['VariableMeta', 'torch._C._LegacyVariableBase'], {}), '(VariableMeta, torch._C._LegacyVariableBase)\n', (1330, 1374), False, 'from torch._six import with_metaclass\n'), ((1417, 1435), 'torch._C._ImperativeEngine', 'ImperativeEngine', ([], {}), '()\n', (14... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
import hashlib
import json
import httplib
import urlparse
import urllib
import logging
import time
import random
import string
DEFAULT_API_SERVER = 'http://api.varena.com'
_logger = logging
logging.getLogger().setLevel("INFO")
class FundataApiException... | [
"hashlib.md5",
"json.loads",
"urlparse.urlsplit",
"httplib.HTTPConnection",
"random.choice",
"json.dumps",
"time.time",
"urllib.urlencode",
"httplib.HTTPSConnection",
"logging.getLogger"
] | [((1434, 1447), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (1445, 1447), False, 'import hashlib\n'), ((257, 276), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (274, 276), False, 'import logging\n'), ((1666, 1699), 'urlparse.urlsplit', 'urlparse.urlsplit', (['self._base_url'], {}), '(self._base_url)\... |
import torch
try:
import fused_gatconv
def fused_gat_func(attn_row, attn_col, row_ptr, col_ind, col_ptr, row_ind, negative_slope, in_feat):
return FusedGATFunction.apply(attn_row, attn_col, row_ptr, col_ind, col_ptr, row_ind, negative_slope, in_feat)
except Exception:
fused_gat_func = None
cla... | [
"fused_gatconv.gat_forward",
"fused_gatconv.gat_backward"
] | [((526, 618), 'fused_gatconv.gat_forward', 'fused_gatconv.gat_forward', (['attn_row', 'attn_col', 'row_ptr', 'col_ind', 'negative_slope', 'in_feat'], {}), '(attn_row, attn_col, row_ptr, col_ind,\n negative_slope, in_feat)\n', (551, 618), False, 'import fused_gatconv\n'), ((1075, 1220), 'fused_gatconv.gat_backward', ... |
# This file is a part of the Pepper project, https://github.com/devosoft/Pepper
# (C) Michigan State University, under the MIT License
# See LICENSE.txt for more information
"""
This module contains the functions necessary to run only the preprocessor
It primarily serves as the entry point to Pepper
"""
import argp... | [
"argparse.ArgumentParser",
"pepper.symbol_table.FILE_STACK.append",
"pepper.symbol_table.SYSTEM_INCLUDE_PATHS.append",
"pepper.parser.parse",
"pepper.symbol_table.PepperInternalError",
"pepper.parser.parse_args",
"pepper.symbol_table.FILE_STACK.pop",
"pepper.parser.add_argument",
"os.path.split",
... | [((584, 609), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (607, 609), False, 'import argparse\n'), ((894, 1023), 'pepper.parser.add_argument', 'parser.add_argument', (['"""--version"""'], {'help': '"""output Pepper\'s version and halt."""', 'action': '"""version"""', 'version': 'f"""Pepper {... |
#!/usr/bin/python3
##########################################################################################
# File Name : stats.py #
# #
# Author : <NAM... | [
"pandas.read_csv"
] | [((2303, 2336), 'pandas.read_csv', 'pd.read_csv', (['"""ID3/adult.data.csv"""'], {}), "('ID3/adult.data.csv')\n", (2314, 2336), True, 'import pandas as pd\n'), ((2775, 2807), 'pandas.read_csv', 'pd.read_csv', (['"""ID3/bupa.data.csv"""'], {}), "('ID3/bupa.data.csv')\n", (2786, 2807), True, 'import pandas as pd\n')] |
from flask import request, jsonify
from . import api_bp
from app import models
from app import db
@api_bp.route('/publishers', methods=['GET'])
def get_publishers():
return jsonify(models.Publisher.to_collection_json())
@api_bp.route('/publishers/', methods=['POST'])
def add_publisher():
publisher = mode... | [
"app.models.Publisher.query.get_or_404",
"app.models.Publisher.to_collection_json",
"app.db.session.commit",
"app.db.session.add",
"flask.request.get_json"
] | [((359, 384), 'app.db.session.add', 'db.session.add', (['publisher'], {}), '(publisher)\n', (373, 384), False, 'from app import db\n'), ((389, 408), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (406, 408), False, 'from app import db\n'), ((187, 224), 'app.models.Publisher.to_collection_json', 'models... |
#!/usr/bin/env python
import pathlib
import sys
def fix_name(name):
for _ in range(3):
name = name.replace(" ", " ")
return name.strip()
def get_artist_and_album(p, artist=None):
name = fix_name(p.name)
if artist is not None and " - " not in name:
return "", name
S = name.split... | [
"pathlib.Path"
] | [((1570, 1585), 'pathlib.Path', 'pathlib.Path', (['p'], {}), '(p)\n', (1582, 1585), False, 'import pathlib\n')] |
from atomicpress.app import app
from flask import request, url_for
def is_url_showing(route=None, **kwargs):
url = url_for(route, **kwargs).strip("/")
freeze_url = app.config["FREEZER_BASE_URL"].strip("/")+request.path
urls = (freeze_url.strip("/"),
request.path.strip("/"),)
if url in url... | [
"flask.url_for",
"atomicpress.app.app.jinja_env.globals.update",
"flask.request.path.strip"
] | [((363, 422), 'atomicpress.app.app.jinja_env.globals.update', 'app.jinja_env.globals.update', ([], {'is_url_showing': 'is_url_showing'}), '(is_url_showing=is_url_showing)\n', (391, 422), False, 'from atomicpress.app import app\n'), ((474, 521), 'atomicpress.app.app.jinja_env.globals.update', 'app.jinja_env.globals.upda... |
# -*- coding: utf-8 -*-
from os import path
import numpy as np
from mrsimulator.models import CzjzekDistribution
from mrsimulator.models import ExtCzjzekDistribution
from mrsimulator.models.utils import x_y_from_zeta_eta
from mrsimulator.models.utils import x_y_to_zeta_eta
__author__ = "<NAME>"
__email__ = "<EMAIL>"
... | [
"os.path.abspath",
"numpy.meshgrid",
"numpy.load",
"numpy.testing.assert_almost_equal",
"mrsimulator.models.CzjzekDistribution",
"numpy.histogram",
"mrsimulator.models.ExtCzjzekDistribution",
"numpy.arange",
"numpy.exp",
"mrsimulator.models.utils.x_y_to_zeta_eta",
"os.path.join"
] | [((347, 369), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (359, 369), False, 'from os import path\n'), ((452, 502), 'os.path.join', 'path.join', (['MODULE_DIR', '"""test_data"""', '"""eps=0.05.npy"""'], {}), "(MODULE_DIR, 'test_data', 'eps=0.05.npy')\n", (461, 502), False, 'from os import pat... |
import os
import re
from fix_blocks import fix_blocks
output_path = '../docs/docs/'
def get_slug(contents):
matches = re.search('id: (.*)', contents)
if not matches:
raise RuntimeError("no slug")
return matches.groups()[0].replace('"', '').strip()
def slugify(s):
return s.lower().replace(" "... | [
"os.path.join",
"os.makedirs",
"os.path.dirname",
"os.walk",
"os.path.exists",
"fix_blocks.fix_blocks",
"re.search"
] | [((1719, 1735), 'os.walk', 'os.walk', (['rootDir'], {}), '(rootDir)\n', (1726, 1735), False, 'import os\n'), ((125, 156), 're.search', 're.search', (['"""id: (.*)"""', 'contents'], {}), "('id: (.*)', contents)\n", (134, 156), False, 'import re\n'), ((756, 787), 'os.path.join', 'os.path.join', (['output_path', 'path'], ... |
from __future__ import print_function
import argparse
import sys
import time
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import torch.utils.data as data
import torchvision
import torchvision.transforms as transforms
from config import Config_market, Config_pku
f... | [
"config.Config_pku",
"config.Config_market",
"random.seed",
"torch.utils.data.DataLoader"
] | [((441, 458), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (452, 458), False, 'import random\n'), ((536, 548), 'config.Config_pku', 'Config_pku', ([], {}), '()\n', (546, 548), False, 'from config import Config_market, Config_pku\n'), ((823, 838), 'config.Config_market', 'Config_market', ([], {}), '()\n',... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from tensorflow.keras.preprocessing import image
import os
import glob
import PIL
#PIL.Image.MAX_IMAGE_PIXELS = 933120000
images = "F:/Datasets/DigestPath/mask_npy"
outfolder = "F:/Datasets/DigestPath/masks"
paths = glob.glob(os.path.join(images,"*.... | [
"numpy.load",
"os.makedirs",
"os.path.exists",
"os.path.split",
"os.path.join"
] | [((297, 326), 'os.path.join', 'os.path.join', (['images', '"""*.npy"""'], {}), "(images, '*.npy')\n", (309, 326), False, 'import os\n'), ((335, 360), 'os.path.exists', 'os.path.exists', (['outfolder'], {}), '(outfolder)\n', (349, 360), False, 'import os\n'), ((370, 392), 'os.makedirs', 'os.makedirs', (['outfolder'], {}... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 2 15:23:15 2018
@author: Manuel
"""
import dlib # dlib for accurate face detection
import cv2 # opencv
import imutils # helper functions from pyimagesearch.com
import serial
import time
## Grab video from your webcam
stream = cv2.VideoCapture(0)
## Face detector
dete... | [
"cv2.line",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.addWeighted",
"cv2.VideoCapture",
"cv2.ellipse",
"dlib.get_frontal_face_detector",
"imutils.resize",
"cv2.destroyAllWindows"
] | [((277, 296), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (293, 296), False, 'import cv2\n'), ((327, 359), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (357, 359), False, 'import dlib\n'), ((3336, 3359), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], ... |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... | [
"uuid.uuid4",
"logging.info",
"logging.error",
"tornado.options.define"
] | [((749, 817), 'tornado.options.define', 'define', (['"""port"""'], {'default': '(8888)', 'help': '"""run on the given port"""', 'type': 'int'}), "('port', default=8888, help='run on the given port', type=int)\n", (755, 817), False, 'from tornado.options import define\n'), ((7894, 7925), 'logging.info', 'logging.info', ... |
import sys
import camelot
import matplotlib.pyplot as plt
import ast
args = sys.argv
option = {'copy_text':['v'], 'line_scale':40, 'split_text':True}
if len(args[3]) > 0:
optionPlus = ast.literal_eval(args[3])
option.update(optionPlus)
tables = camelot.read_pdf('rawpdf\\'+args[1]+'\\'+args[2]+'.pdf', **option)
... | [
"ast.literal_eval",
"camelot.read_pdf"
] | [((252, 326), 'camelot.read_pdf', 'camelot.read_pdf', (["('rawpdf\\\\' + args[1] + '\\\\' + args[2] + '.pdf')"], {}), "('rawpdf\\\\' + args[1] + '\\\\' + args[2] + '.pdf', **option)\n", (268, 326), False, 'import camelot\n'), ((188, 213), 'ast.literal_eval', 'ast.literal_eval', (['args[3]'], {}), '(args[3])\n', (204, 2... |
import cv2
import numpy as np
import pytest
from ..utils import vis, display
@pytest.mark.vis
def test_vis_line_scalar_positive():
image = np.zeros((120, 160, 3), np.uint8)
vis_image = vis.vis_line_scalar(image, 0.5)
assert not np.array_equal(vis_image, image)
cv2.imshow("test_vis_line_scalar_positi... | [
"numpy.array_equal",
"pytest.raises",
"cv2.imshow",
"numpy.zeros"
] | [((146, 179), 'numpy.zeros', 'np.zeros', (['(120, 160, 3)', 'np.uint8'], {}), '((120, 160, 3), np.uint8)\n', (154, 179), True, 'import numpy as np\n'), ((281, 335), 'cv2.imshow', 'cv2.imshow', (['"""test_vis_line_scalar_positive"""', 'vis_image'], {}), "('test_vis_line_scalar_positive', vis_image)\n", (291, 335), False... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 1 10:13:37 2021
@author: kundankantisaha
"""
from elasticsearch import Elasticsearch
import time
from os import popen
import subprocess
import logging
import uuid
def start_cluster():
subprocess.Popen('C:\\Users\\kundansa\\Downloads\\elasticsea... | [
"elasticsearch.Elasticsearch",
"subprocess.Popen",
"uuid.uuid4",
"logging.basicConfig",
"time.sleep"
] | [((260, 366), 'subprocess.Popen', 'subprocess.Popen', (['"""C:\\\\Users\\\\kundansa\\\\Downloads\\\\elasticsearch-7.10.2\\\\bin\\\\elasticsearch.bat"""'], {}), "(\n 'C:\\\\Users\\\\kundansa\\\\Downloads\\\\elasticsearch-7.10.2\\\\bin\\\\elasticsearch.bat'\n )\n", (276, 366), False, 'import subprocess\n'), ((362, ... |
#!/usr/bin/python3
import os
from brownie import ArtBottest, accounts, network, config
import time
def main():
dev = accounts.add(config["wallets"]["from_key"])
print(network.show_active())
publish_source = True if os.getenv("ETHERSCAN_TOKEN") else False
ArtBottest.deploy({"from": dev}, publish_source... | [
"brownie.ArtBottest.deploy",
"os.getenv",
"brownie.network.show_active",
"brownie.accounts.add"
] | [((123, 166), 'brownie.accounts.add', 'accounts.add', (["config['wallets']['from_key']"], {}), "(config['wallets']['from_key'])\n", (135, 166), False, 'from brownie import ArtBottest, accounts, network, config\n'), ((273, 336), 'brownie.ArtBottest.deploy', 'ArtBottest.deploy', (["{'from': dev}"], {'publish_source': 'pu... |