code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
from chiapos import DiskProver, DiskPlotter, Verifier
from hashlib import sha256
import secrets
import os
challenge: bytes = bytes([i for i in range(0, 32)])
plot_id: bytes = bytes([5, 104, 52, 4, 51, 55, 23, 84, 91, 10, 111, 12, 13,
222, 151, 16, 228, 211, 254, 45, 92, 198, 204, 10, 9,
... | [
"chiapos.DiskProver",
"chiapos.DiskPlotter",
"os.remove",
"chiapos.Verifier"
] | [((401, 414), 'chiapos.DiskPlotter', 'DiskPlotter', ([], {}), '()\n', (412, 414), False, 'from chiapos import DiskProver, DiskPlotter, Verifier\n'), ((487, 507), 'chiapos.DiskProver', 'DiskProver', (['filename'], {}), '(filename)\n', (497, 507), False, 'from chiapos import DiskProver, DiskPlotter, Verifier\n'), ((560, ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 19 23:34:40 2021
@author: tran_l8
"""
from keras.preprocessing import image
import os
import pathlib
from keras.preprocessing.image import ImageDataGenerator
import matplotlib.pyplot as plt
datagen = ImageDataGenerator()
cur = pathlib.Path("Project3.py").parent.absolut... | [
"keras.preprocessing.image.ImageDataGenerator",
"matplotlib.pyplot.show",
"keras.preprocessing.image.array_to_img",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"matplotlib.pyplot.figure",
"pathlib.Path",
"os.path.join",
"os.listdir",
"matplotlib.pyplot.savefig"
... | [((250, 270), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (268, 270), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((331, 357), 'os.path.join', 'os.path.join', (['cur', '"""train"""'], {}), "(cur, 'train')\n", (343, 357), False, 'import os\n'), ((371,... |
import RPi.GPIO as GPIO
from datetime import datetime
import time
import setup
import config
from components.led import Single_Led
from components.led import Multi_Led
from components.weather_api import darkSky_api as API
# API
apiKey = config.darksky_key
location = setup.lindholmen
api = API(location, apiKey, setup.p... | [
"components.weather_api.darkSky_api",
"RPi.GPIO.setwarnings",
"RPi.GPIO.setmode",
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.input",
"components.led.Multi_Led",
"datetime.datetime.now",
"components.led.Single_Led"
] | [((291, 330), 'components.weather_api.darkSky_api', 'API', (['location', 'apiKey', 'setup.preference'], {}), '(location, apiKey, setup.preference)\n', (294, 330), True, 'from components.weather_api import darkSky_api as API\n'), ((350, 451), 'components.led.Multi_Led', 'Multi_Led', (['"""multi led"""', "setup.multi_led... |
# Flipping Images - Horizontally, Vertically, Horizontally & Vertically
# Import Computer Vision package - cv2
import cv2
# Read the image using imread built in function
image = cv2.imread('image_2.jpg')
# Display original image using imshow built in function
cv2.imshow("Original", image)
# Wait until an... | [
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.flip",
"cv2.imshow"
] | [((186, 211), 'cv2.imread', 'cv2.imread', (['"""image_2.jpg"""'], {}), "('image_2.jpg')\n", (196, 211), False, 'import cv2\n'), ((272, 301), 'cv2.imshow', 'cv2.imshow', (['"""Original"""', 'image'], {}), "('Original', image)\n", (282, 301), False, 'import cv2\n'), ((338, 352), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}... |
import functools
def s(x,y): return int(y+x)-int(x+y)
input();print(int("".join(sorted(input().split(),key=functools.cmp_to_key(s))))) | [
"functools.cmp_to_key"
] | [((107, 130), 'functools.cmp_to_key', 'functools.cmp_to_key', (['s'], {}), '(s)\n', (127, 130), False, 'import functools\n')] |
# Copyright (C) 2018 <NAME>
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... | [
"phonopy.harmonic.dynmat_to_fc.DynmatToForceConstants",
"numpy.random.seed",
"phonopy.harmonic.dynmat_to_fc.get_commensurate_points_in_integers",
"numpy.abs",
"phonopy.harmonic.dynamical_matrix.get_dynamical_matrix",
"numpy.zeros",
"numpy.linalg.eigh",
"numpy.where",
"numpy.array",
"numpy.linalg.i... | [((4979, 5038), 'phonopy.harmonic.dynamical_matrix.get_dynamical_matrix', 'get_dynamical_matrix', (['force_constants', 'supercell', 'primitive'], {}), '(force_constants, supercell, primitive)\n', (4999, 5038), False, 'from phonopy.harmonic.dynamical_matrix import get_dynamical_matrix\n'), ((5473, 5502), 'numpy.linalg.i... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"core.domain.stats_services.get_top_improvable_states",
"core.domain.exp_services.get_editable_explorations",
"core.platform.models.Registry.import_user_services",
"core.domain.exp_services.get_all_explorations"
] | [((831, 869), 'core.platform.models.Registry.import_user_services', 'models.Registry.import_user_services', ([], {}), '()\n', (867, 869), False, 'from core.platform import models\n'), ((1395, 1430), 'core.domain.exp_services.get_all_explorations', 'exp_services.get_all_explorations', ([], {}), '()\n', (1428, 1430), Fal... |
from django.shortcuts import render
from .settings import INSTALLED_APPS
from django.http import (
Http404, HttpResponse,
)
def index(request):
app_list = [item.split('.')[0] for item in INSTALLED_APPS if 'Config' in item]
app_list.append('admin')
context = {
'app_list': app_list
}
r... | [
"django.shortcuts.render"
] | [((326, 364), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', 'context'], {}), "(request, 'index.html', context)\n", (332, 364), False, 'from django.shortcuts import render\n')] |
from setuptools import find_packages, setup
tests_requirements = [
'pytest',
'pytest-cov',
'pytest-flake8',
'pytest-isort',
]
setup(
name="WeasySuite",
version="0.1.dev0",
description="Test WeasyPrint with the W3C test suites.",
url="http://test.weasyprint.org",
author="Kozea",
... | [
"setuptools.find_packages"
] | [((330, 345), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (343, 345), False, 'from setuptools import find_packages, setup\n')] |
#! /usr/bin/env python
# coding=utf-8
# /************************************************************************************
# ***
# *** File Author: Dell, 2018年 09月 10日 星期一 21:27:08 CST
# ***
# ************************************************************************************/
import os
import argparse
import ... | [
"argparse.ArgumentParser",
"data.translate_dataloader",
"os.makedirs",
"data.save_vocab",
"os.path.isdir",
"torch.load",
"model.Decoder",
"os.path.exists",
"model",
"model.parameters",
"model.Seq2Seq",
"torch.save",
"torch.cuda.is_available",
"model.Encoder",
"model.train"
] | [((488, 553), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Training Translation Model"""'}), "(description='Training Translation Model')\n", (511, 553), False, 'import argparse\n'), ((1404, 1432), 'torch.save', 'torch.save', (['model', 'save_path'], {}), '(model, save_path)\n', (1414, ... |
__author__ = '<NAME>'
import urllib.request
import ResponseParser
import io
class ImageGrabber():
@staticmethod
def grab_images(page_name):
response_page = urllib.request.urlopen(page_name)
parser = ResponseParser.ImageParser(strict=False)
response_body = response_page.read()
... | [
"ResponseParser.ImageParser",
"io.open"
] | [((226, 266), 'ResponseParser.ImageParser', 'ResponseParser.ImageParser', ([], {'strict': '(False)'}), '(strict=False)\n', (252, 266), False, 'import ResponseParser\n'), ((621, 706), 'io.open', 'io.open', (["('C:\\\\Users\\\\Abdullah AA\\\\FourChanImages\\\\' + image_names[counter])", '"""wb"""'], {}), "('C:\\\\Users\\... |
"""Test project's batches create command."""
# pylint: disable=wrong-import-order, import-error
import io
import operator
import sys
from uuid import uuid4
from click import echo
from click.testing import CliRunner
from gencove.client import APIClient, APIClientError # noqa: I100
from gencove.command.projects.cli im... | [
"io.BytesIO",
"uuid.uuid4",
"gencove.models.ProjectBatches",
"pytest.fixture",
"gencove.tests.utils.get_vcr_response",
"gencove.client.APIClientError",
"click.testing.CliRunner",
"pytest.mark.default_cassette",
"vcr.VCR.ensure_suffix"
] | [((795, 825), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (809, 825), False, 'import pytest\n'), ((1608, 1655), 'pytest.mark.default_cassette', 'pytest.mark.default_cassette', (['"""jwt-create.yaml"""'], {}), "('jwt-create.yaml')\n", (1636, 1655), False, 'import pytest\n')... |
"""
Tests that ascertain that the API is working. Everything short of actually running a DAG (expensive and
difficult-to-test, see `dag_tests.py`) is tested here.
"""
import sys; sys.path.append("../")
from airscooter.depositor import Depositor
from airscooter.transform import Transform
from airscooter import orchestr... | [
"sys.path.append",
"airscooter.orchestration.deserialize_from_file",
"os.remove",
"os.path.abspath",
"os.listdir",
"airflow.DAG",
"os.mkdir",
"airscooter.depositor.Depositor",
"airscooter.orchestration.serialize_to_file",
"os.environ.copy",
"datetime.datetime",
"airscooter.transform.Transform"... | [((180, 202), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (195, 202), False, 'import sys\n'), ((564, 584), 'datetime.datetime', 'datetime', (['(2015)', '(6)', '(1)'], {}), '(2015, 6, 1)\n', (572, 584), False, 'from datetime import datetime\n'), ((1076, 1095), 'os.remove', 'os.remove', (['"""... |
from unity_build_pipeline.Support.logger import color_print, GREEN
from unity_build_pipeline.Support.shell import run
from unity_build_pipeline.Support.fileutils import replace_string_entries
class Fastlane:
def __init__(self, project):
self.project = project
def execute(self, args):
project_... | [
"unity_build_pipeline.Support.shell.run",
"unity_build_pipeline.Support.logger.color_print",
"unity_build_pipeline.Support.fileutils.replace_string_entries"
] | [((415, 456), 'unity_build_pipeline.Support.logger.color_print', 'color_print', (['"""Starting fastlane.."""', 'GREEN'], {}), "('Starting fastlane..', GREEN)\n", (426, 456), False, 'from unity_build_pipeline.Support.logger import color_print, GREEN\n'), ((465, 525), 'unity_build_pipeline.Support.shell.run', 'run', (["(... |
r"""Convert a tensorflow frozen graph object detection model to Core ML.
Example usage:
python convert_to_coreml.py \
--inference-graph=/path/to/export/optimized_inference_graph.pb \
--output=/path/to/export/object_detector.mlmodel
"""
import argparse
import sys
from coremltools.proto import Model_pb2
import tfcoreml... | [
"tfcoreml.convert",
"argparse.ArgumentParser",
"coremltools.proto.Model_pb2.Model"
] | [((770, 787), 'coremltools.proto.Model_pb2.Model', 'Model_pb2.Model', ([], {}), '()\n', (785, 787), False, 'from coremltools.proto import Model_pb2\n'), ((1205, 1526), 'tfcoreml.convert', 'tfcoreml.convert', ([], {'tf_model_path': 'inference_graph_path', 'mlmodel_path': 'output_path', 'output_feature_names': "['concat:... |
# Copyright 2020 <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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | [
"os.mkdir",
"pickle.dump",
"google.auth.transport.requests.Request",
"os.path.exists",
"absl.logging.info",
"absl.app.run",
"pickle.load",
"googleapiclient.discovery.build",
"absl.logging.fatal",
"google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file",
"os.path.join",
"os.getenv"... | [((954, 994), 'os.path.join', 'os.path.join', (['CONFIG_DIR', '"""token.pickle"""'], {}), "(CONFIG_DIR, 'token.pickle')\n", (966, 994), False, 'import os\n'), ((1014, 1058), 'os.path.join', 'os.path.join', (['CONFIG_DIR', '"""credentials.json"""'], {}), "(CONFIG_DIR, 'credentials.json')\n", (1026, 1058), False, 'import... |
#!/usr/bin/python3
#-*- coding: utf-8 -*-
# This code is PEP8-compliant. See http://www.python.org/dev/peps/pep-0008/.
"""
Wyrd In: Time tracker and task manager
CC-Share Alike 2012 © The Wyrd In team
https://github.com/WyrdIn
"""
import argparse
import os.path
import pytz
from datetime import datetime, timedelta
imp... | [
"pickle.dump",
"backend.xml.XmlBackend.read_workslots",
"csv.reader",
"argparse.ArgumentParser",
"pickle.load",
"pprint.pprint",
"frontend.cli.Cli.get_task",
"util.format_timedelta",
"backend.xml.XmlBackend.write_workslots",
"backend.xml.XmlBackend.write_all",
"datetime.timedelta",
"worktime.W... | [((18811, 18830), 'frontend.cli.Cli.get_task', 'frontend.get_task', ([], {}), '()\n', (18828, 18830), True, 'from frontend.cli import Cli as frontend\n'), ((20449, 20472), 'frontend.cli.Cli.get_workslot', 'frontend.get_workslot', ([], {}), '()\n', (20470, 20472), True, 'from frontend.cli import Cli as frontend\n'), ((2... |
import numpy as np
from ..utils import complex_exponential_sum, simple_complex_exponential_sum
import pytest
from numpy.testing import assert_allclose
@pytest.mark.parametrize('yshape', [(), (1,), (2,), (1, 2)])
@pytest.mark.parametrize('method', ['auto', 'slow', 'ndft', 'nfft'])
@pytest.mark.parametrize('Nf', [50, ... | [
"pytest.mark.parametrize",
"numpy.testing.assert_allclose",
"numpy.random.RandomState"
] | [((155, 214), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""yshape"""', '[(), (1,), (2,), (1, 2)]'], {}), "('yshape', [(), (1,), (2,), (1, 2)])\n", (178, 214), False, 'import pytest\n'), ((216, 283), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "['auto', 'slow', 'ndft', 'nfft']"... |
import os, sys
if not ('__file__' in locals() or '__file__' in globals()):
__file__='.'
full_path = os.path.realpath(__file__)
currPath, configFilename = os.path.split(full_path)
#region: Paths
path_base = currPath + '/../../'
path_DF = path_base + "data/"
path_results = path_base + 'plots/'
fname_feedback ... | [
"os.path.realpath",
"os.path.split"
] | [((107, 133), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (123, 133), False, 'import os, sys\n'), ((161, 185), 'os.path.split', 'os.path.split', (['full_path'], {}), '(full_path)\n', (174, 185), False, 'import os, sys\n')] |
# Copyright 2019 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
import re
from network_insight_sdk_generic_datasources.parsers.text.pre_post_processor import PrePostProcessor
class UBNTVersionPrePostProcessor(PrePostProcessor):
def pre_process(self, data):
return data
def post_process(self,... | [
"re.finditer",
"re.match"
] | [((2988, 3008), 're.match', 're.match', (['"""^C"""', 'line'], {}), "('^C', line)\n", (2996, 3008), False, 'import re\n'), ((1542, 1582), 're.match', 're.match', (['"""eth\\\\d+\\\\.(\\\\d+)"""', "d['Iface']"], {}), "('eth\\\\d+\\\\.(\\\\d+)', d['Iface'])\n", (1550, 1582), False, 'import re\n'), ((3138, 3176), 're.find... |
# IMPORTS
import time
import socket
import os
# END OF IMPORTS
# ATTACKER CLIENT
#########################
class FileGrab(object):
def __init__(self, bind_ip, dir="grabbed_files/", bind_port=2367):
self.bind_ip = bind_ip
self.bind_port = bind_port
self.s = socket.socket(socket.AF_INET, ... | [
"socket.socket",
"os.system",
"time.sleep"
] | [((290, 339), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (303, 339), False, 'import socket\n'), ((1820, 1833), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1830, 1833), False, 'import time\n'), ((1842, 1885), 'os.system', 'os.syste... |
from metadata.globalconfig import globalconfig
import unittest
class globalconfig_test(unittest.TestCase):
def testSetKV(self):
x = globalconfig()
x.setKV('a',1)
x.setKV('b', 3)
y = globalconfig()
y.setKV('dd',4)
result = {'a': 1, 'b': 3, 'dd': 4}
self.assertEqual(y.getKVs(), result... | [
"unittest.main",
"metadata.globalconfig.globalconfig"
] | [((400, 415), 'unittest.main', 'unittest.main', ([], {}), '()\n', (413, 415), False, 'import unittest\n'), ((144, 158), 'metadata.globalconfig.globalconfig', 'globalconfig', ([], {}), '()\n', (156, 158), False, 'from metadata.globalconfig import globalconfig\n'), ((207, 221), 'metadata.globalconfig.globalconfig', 'glob... |
import datetime
import re
from logging import getLogger
from textwrap import shorten
from typing import Optional, Union
from natsort import humansorted
from schwifty import IBAN
from ..exceptions import ParsingError
logger = getLogger("statement_reader.booking_base")
class BookingBase:
type_convert = {
... | [
"natsort.humansorted",
"schwifty.IBAN",
"datetime.datetime.strptime",
"re.sub",
"logging.getLogger"
] | [((228, 270), 'logging.getLogger', 'getLogger', (['"""statement_reader.booking_base"""'], {}), "('statement_reader.booking_base')\n", (237, 270), False, 'from logging import getLogger\n'), ((3460, 3486), 're.sub', 're.sub', (['"""[ ]+"""', '""" """', 'value'], {}), "('[ ]+', ' ', value)\n", (3466, 3486), False, 'import... |
import threading
import socket
import json
import os
import time
import subprocess
import random
import queue
import logging
log = logging.getLogger('mpv-jsonipc')
if os.name == "nt":
import _winapi
from multiprocessing.connection import PipeConnection
TIMEOUT = 120
# Older MPV versions do not allow us to d... | [
"threading.Thread.__init__",
"subprocess.Popen",
"os.remove",
"random.randint",
"json.loads",
"socket.socket",
"os.path.exists",
"json.dumps",
"time.sleep",
"threading.Lock",
"threading.Event",
"_winapi.CreateFile",
"multiprocessing.connection.PipeConnection",
"queue.Queue",
"logging.get... | [((132, 164), 'logging.getLogger', 'logging.getLogger', (['"""mpv-jsonipc"""'], {}), "('mpv-jsonipc')\n", (149, 164), False, 'import logging\n'), ((2959, 2986), 'multiprocessing.connection.PipeConnection', 'PipeConnection', (['pipe_handle'], {}), '(pipe_handle)\n', (2973, 2986), False, 'from multiprocessing.connection ... |
# The main example from README: fetch multiple properties from the page
from pprint import pprint
from wikipedia_ql import media_wiki
wikipedia = media_wiki.Wikipedia(cache_folder='tmp/cache')
pprint(wikipedia.query(r'''
from "Guardians of the Galaxy (film)" {
page@title as "title";
section[headi... | [
"wikipedia_ql.media_wiki.Wikipedia"
] | [((148, 194), 'wikipedia_ql.media_wiki.Wikipedia', 'media_wiki.Wikipedia', ([], {'cache_folder': '"""tmp/cache"""'}), "(cache_folder='tmp/cache')\n", (168, 194), False, 'from wikipedia_ql import media_wiki\n')] |
import math
import os
import random
import re
import sys
# Complete the lilysHomework function below.
# [2, 5, 3, 1] -> [1, 2, 5, 3] -> [1, 2, 3, 5]
def countSwaps(arr):
# Create a list of sets with index, value -> [(3, 1), (0, 2), (2, 3), (1, 5)]
pos = sorted(list(enumerate(arr)), key=lambda i: i[1])
swap... | [
"os.getcwd"
] | [((717, 728), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (726, 728), False, 'import os\n')] |
from flask import jsonify
from flask.ext.restful import Resource
from model.abc import db
from model import User
from client import superhero
from util import parse_params
class UserListAPI(Resource):
def get(self):
return jsonify(data=[user.json for user in User.query])
@parse_params(
{'nam... | [
"util.parse_params",
"model.abc.db.session.commit",
"model.User",
"client.superhero.is_superhero",
"model.User.query.get",
"flask.jsonify",
"model.abc.db.session.add"
] | [((293, 412), 'util.parse_params', 'parse_params', (["{'name': 'email', 'type': str, 'required': True}", "{'name': 'password', 'type': str, 'required': True}"], {}), "({'name': 'email', 'type': str, 'required': True}, {'name':\n 'password', 'type': str, 'required': True})\n", (305, 412), False, 'from util import par... |
from abc import ABC, abstractmethod
import threading
import rx
import rx.operators as op
from rx.subject.subject import Subject
from ..frames import Frame_ABC
class AbstractConnection(ABC):
_expected_exceptions = (ConnectionError, OSError)
def __init__(self):
super().__init__()
self._send_p... | [
"threading.Lock",
"rx.subject.subject.Subject"
] | [((395, 411), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (409, 411), False, 'import threading\n'), ((438, 454), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (452, 454), False, 'import threading\n'), ((555, 571), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (569, 571), False, 'import threadi... |
import requests
import time
import hmac
import hashlib
from threading import Lock
from datetime import datetime
from binanceapi.constant import RequestMethod, Interval, OrderSide, OrderStatus, OrderType
class FutureClient(object):
def __init__(self, api_key=None, secret=None, timeout=5, try_counts=5):
se... | [
"datetime.datetime.now",
"time.sleep",
"threading.Lock",
"time.time",
"requests.request"
] | [((508, 514), 'threading.Lock', 'Lock', ([], {}), '()\n', (512, 514), False, 'from threading import Lock\n'), ((1218, 1305), 'requests.request', 'requests.request', (['req_method.value'], {'url': 'url', 'headers': 'headers', 'timeout': 'self.timeout'}), '(req_method.value, url=url, headers=headers, timeout=self.\n t... |
import sys
def outcome_likelihood(x, sigma, states, transition, emission):
# The transitions from the initial state occur with equal probability: Prob(P0 = Si) = 1/|states| * Pr(x = x0 | P0)
M = [ [ emission[ states[s] ][ x[0] ]/len(states) if p == 0 else 0 for p in range(len(x))] for s in range(len(state... | [
"sys.stdin.readline"
] | [((922, 942), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (940, 942), False, 'import sys\n'), ((1009, 1029), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1027, 1029), False, 'import sys\n'), ((1097, 1117), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1115, 1117), Fa... |
from dataclasses import dataclass, field
from typing import List
from random import sample
RANKS = '2 3 4 5 6 7 8 9 10 J Q K A'.split()
SUITS = '♣ ♢ ♡ ♠'.split()
@dataclass(order=True)
class PlayingCard:
sort_index: int = field(init=False, repr=False)
rank: str
suit: str
def __post_init__(self):
... | [
"dataclasses.field",
"dataclasses.dataclass"
] | [((166, 187), 'dataclasses.dataclass', 'dataclass', ([], {'order': '(True)'}), '(order=True)\n', (175, 187), False, 'from dataclasses import dataclass, field\n'), ((229, 258), 'dataclasses.field', 'field', ([], {'init': '(False)', 'repr': '(False)'}), '(init=False, repr=False)\n', (234, 258), False, 'from dataclasses i... |
###############################################################################
# Language Modeling on Penn Tree Bank
#
# This file generates new sentences sampled from the language model
#
###############################################################################
import argparse
import torch
import data
import o... | [
"os.remove",
"argparse.ArgumentParser",
"data.Corpus",
"torch.manual_seed",
"torch.load",
"os.path.exists",
"torch.cuda.manual_seed",
"utils.repackage_hidden",
"torch.cuda.is_available",
"utils.batchify",
"utils.get_batch",
"bleu.cal_bleu"
] | [((415, 480), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch PTB Language Model"""'}), "(description='PyTorch PTB Language Model')\n", (438, 480), False, 'import argparse\n'), ((1575, 1603), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1592, 16... |
import numpy as np
import collections
import base64
import zlib
import json
import os
# uses OS entropy rather than MT
from Crypto.Random import random
# the pad consists of 8 bit unsigned integers
# this is to correspond to ASCII charecters
dtype_pad = np.uint8
# messages consist of indexes in ... | [
"json.loads",
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.asanyarray",
"os.path.exists",
"numpy.unique",
"base64.b64decode",
"json.dumps",
"numpy.nonzero",
"numpy.array",
"zlib.decompress",
"numpy.fromstring",
"collections.deque"
] | [((1313, 1332), 'collections.deque', 'collections.deque', ([], {}), '()\n', (1330, 1332), False, 'import collections\n'), ((1410, 1429), 'collections.deque', 'collections.deque', ([], {}), '()\n', (1427, 1429), False, 'import collections\n'), ((2405, 2425), 'numpy.array', 'np.array', (['statistics'], {}), '(statistics)... |
import re
import time
from django.conf import settings
from docker import Client
from marathon import MarathonClient
from marathon.models import MarathonApp
from . import AbstractSchedulerClient
from .fleet import FleetHTTPClient
from .states import JobState
# turn down standard marathon logging
MATCH = re.compile(... | [
"marathon.MarathonClient",
"re.match",
"marathon.models.MarathonApp",
"time.sleep",
"re.compile"
] | [((309, 418), 're.compile', 're.compile', (['"""(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\\\\.?(?P<c_type>[a-z-_]+)?.(?P<c_num>[0-9]+)"""'], {}), "(\n '(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\\\\.?(?P<c_type>[a-z-_]+)?.(?P<c_num>[0-9]+)'\n )\n", (319, 418), False, 'import re\n'), ((790, 839), 'marathon.Marath... |
import jarray
import inspect
from java.lang import System
from java.util.logging import Level
from org.sleuthkit.datamodel import SleuthkitCase
from org.sleuthkit.datamodel import AbstractFile
from org.sleuthkit.datamodel import ReadContentInputStream
from org.sleuthkit.datamodel import BlackboardArtifact
from org.sleu... | [
"org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID",
"org.sleuthkit.autopsy.ingest.IngestServices.getInstance",
"inspect.stack",
"org.sleuthkit.autopsy.coreutils.Logger.getLogger",
"org.sleuthkit.autopsy.ingest.ModuleDataEvent"
] | [((1656, 1714), 'org.sleuthkit.autopsy.coreutils.Logger.getLogger', 'Logger.getLogger', (['FileMarkerIngestModuleFactory.moduleName'], {}), '(FileMarkerIngestModuleFactory.moduleName)\n', (1672, 1714), False, 'from org.sleuthkit.autopsy.coreutils import Logger\n'), ((2425, 2484), 'org.sleuthkit.datamodel.BlackboardAttr... |
import torch
import time
from models import Generator
from utils.log_utils import log, load_model, save_images
from utils.sampler_utils import retrieve_autoencoder_components_state_dicts, latent_ids_to_onehot
from tqdm import tqdm
from train_sampler import get_sampler
import os
@torch.no_grad()
def generate_images_fro... | [
"utils.sampler_utils.latent_ids_to_onehot",
"os.makedirs",
"utils.log_utils.log",
"utils.sampler_utils.retrieve_autoencoder_components_state_dicts",
"torch.matmul",
"models.Generator",
"torch.split",
"torch.cat",
"time.time",
"torch.save",
"train_sampler.get_sampler",
"torch.no_grad",
"utils... | [((281, 296), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (294, 296), False, 'import torch\n'), ((1120, 1135), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1133, 1135), False, 'import torch\n'), ((3298, 3313), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3311, 3313), False, 'import torch\n'), ((... |
from __future__ import unicode_literals
import base64
import kgb
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import six
from djblets.features.testing import override_feature_check
from djblets.webapi.errors import INVALID_ATTRIBUTE, INVALID_FORM_DATA
from djblets.webapi.testing.dec... | [
"reviewboard.reviews.models.DefaultReviewer.objects.create",
"reviewboard.webapi.tests.urls.get_draft_diff_item_url",
"reviewboard.diffviewer.models.DiffSet.objects.get",
"django.core.files.uploadedfile.SimpleUploadedFile",
"djblets.features.testing.override_feature_check",
"reviewboard.diffviewer.models.... | [((4379, 4417), 'reviewboard.diffviewer.models.DiffSet.objects.get', 'DiffSet.objects.get', ([], {'pk': "item_rsp['id']"}), "(pk=item_rsp['id'])\n", (4398, 4417), False, 'from reviewboard.diffviewer.models import DiffSet, FileDiff\n'), ((5543, 5633), 'django.core.files.uploadedfile.SimpleUploadedFile', 'SimpleUploadedF... |
"""Get NTP servers."""
import logging
logger = logging.getLogger("arubaoss.helper.get_ntp_servers")
def get_ntp_servers(self):
"""
Get NTP servers.
# TODO: add IPv6 support, currently getting 404 from the API
:param self: object from class
:return:
"""
base_url = self.connection.config... | [
"logging.getLogger"
] | [((49, 101), 'logging.getLogger', 'logging.getLogger', (['"""arubaoss.helper.get_ntp_servers"""'], {}), "('arubaoss.helper.get_ntp_servers')\n", (66, 101), False, 'import logging\n')] |
import re
def run():
dev = __proxy__['junos.conn']()
op1 = dev.rpc.request_shell_execute(command="sysctl net.tunnel.nonrpf_tunid_cnt")
re1 = re.search('\d+', op1.text)
obj1 = int(re1.group())
op2 = dev.rpc.request_shell_execute(command="sysctl net.tunnel.nonrpf_tunid_max")
re2 = re.search('\d+'... | [
"re.search"
] | [((154, 181), 're.search', 're.search', (['"""\\\\d+"""', 'op1.text'], {}), "('\\\\d+', op1.text)\n", (163, 181), False, 'import re\n'), ((305, 332), 're.search', 're.search', (['"""\\\\d+"""', 'op2.text'], {}), "('\\\\d+', op2.text)\n", (314, 332), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# Import packages
from collections import namedtuple
from pathlib import Path
from sklearn.preprocessing import LabelEncoder, LabelBinarizer
from sklearn.utils.class_weight import compute_class_weight
from torch.utils import data
import cv2
import dgl
import json
import networkx as nx
import nu... | [
"sklearn.preprocessing.LabelBinarizer",
"numpy.sum",
"torch.cat",
"pathlib.Path",
"numpy.round",
"numpy.unique",
"cv2.contourArea",
"torch.FloatTensor",
"sklearn.preprocessing.LabelEncoder",
"networkx.set_edge_attributes",
"cv2.boundingRect",
"numpy.average",
"networkx.set_node_attributes",
... | [((644, 693), 'collections.namedtuple', 'namedtuple', (['"""AI2D_RSTBatch"""', "['graphs', 'labels']"], {}), "('AI2D_RSTBatch', ['graphs', 'labels'])\n", (654, 693), False, 'from collections import namedtuple\n'), ((973, 1002), 'numpy.array', 'np.array', (['[0]'], {'dtype': 'np.int32'}), '([0], dtype=np.int32)\n', (981... |
import media
import fresh_tomatoes
# Blade Runner movie: title, storyline, poster image and trailer
blade_runner = media.Movie(
"Blade Runner",
("TA blade runner must pursue and try to terminate four replicants "
"who stole a ship in space and have returned to Earth to find their "
"creator."),
(... | [
"fresh_tomatoes.open_movies_page",
"media.Movie"
] | [((116, 517), 'media.Movie', 'media.Movie', (['"""Blade Runner"""', '"""TA blade runner must pursue and try to terminate four replicants who stole a ship in space and have returned to Earth to find their creator."""', '"""https://images-na.ssl-images-amazon.com/images/M/MV5BNzQzMzJhZTEtOWM4NS00MTdhLTg0YjgtMjM4MDRkZjUwZ... |
import numpy as np
import sympy
from typing import Union, Callable, Collection, List, Iterable
from beluga.numeric.compilation import LocalCompiler, jit_compile_func
from beluga.symbolic.special_functions import custom_functions, tables
# default_tol = 1e-4
sym_zero = sympy.Integer(0)
sym_one = sympy.Integer(1)
cl... | [
"sympy.Symbol",
"beluga.symbolic.special_functions.tables.TableSpline1D",
"sympy.sympify",
"beluga.symbolic.special_functions.custom_functions.CustomFunctionGenerator",
"numpy.array",
"beluga.symbolic.special_functions.tables.SymTableGenerator",
"sympy.exp",
"sympy.Integer",
"beluga.numeric.compilat... | [((272, 288), 'sympy.Integer', 'sympy.Integer', (['(0)'], {}), '(0)\n', (285, 288), False, 'import sympy\n'), ((299, 315), 'sympy.Integer', 'sympy.Integer', (['(1)'], {}), '(1)\n', (312, 315), False, 'import sympy\n'), ((8820, 8850), 'numpy.array', 'np.array', (['data'], {'dtype': 'np.float'}), '(data, dtype=np.float)\... |
#!/usr/bin/python3
# -*- coding_ utf-8 -*-
""" This program implements a viewer for the LPO data structure.
A LPO is a partial ordered set of events. If two events are ordered
this order is represented by an arrow. If there is an arrow form an
event a to an event b this means event b occurs after event a.
Usage: pyt... | [
"tkinter.Tk",
"tkinter.Canvas",
"tkinter.Frame.__init__",
"tkinter.Menu",
"tkinter.filedialog.Open",
"math.fabs",
"os.path.exists",
"partialorder.parse_lpo_file",
"tkinter.ttk.Notebook"
] | [((7066, 7070), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (7068, 7070), False, 'from tkinter import Tk, Frame, Menu, Canvas, BOTH, LAST, filedialog\n'), ((7210, 7241), 'os.path.exists', 'os.path.exists', (['"""../abcabc.lpo"""'], {}), "('../abcabc.lpo')\n", (7224, 7241), False, 'import os\n'), ((867, 895), 'tkinter.Frame._... |
""" hide data and files in a docx, pptx etc
Functions:
- Add data as a comment in xml such as [Content_Types].xml
- Add a file and update [Content_Types].xml
Limitations:
- These do not persist modification. i.e. the data will be lost in the event of
a user modifying the document (tested in LibreOffice and Microsoft Wo... | [
"stegstash.zipfile.detectSteg",
"mutablezip.MutableZipFile",
"zipfile.ZipFile",
"stegstash.utils.toBin",
"stegstash.zipfile.decodeComment",
"stegstash.zipfile.encodeComment",
"shutil.copyfile",
"stegstash.utils.toFile"
] | [((882, 930), 'stegstash.zipfile.encodeComment', 'zipfile.encodeComment', (['openPath', 'writePath', 'data'], {}), '(openPath, writePath, data)\n', (903, 930), False, 'from stegstash import zipfile\n'), ((1227, 1258), 'stegstash.zipfile.decodeComment', 'zipfile.decodeComment', (['openPath'], {}), '(openPath)\n', (1248,... |
import torch
import torch.nn as nn
import torch.optim as optim
import pytorch_lightning as pl
# from torchvision.models import
import torchvision.models as models
import torchmetrics
class MobileNetV2(pl.LightningModule):
def __init__(self, pretrained=True, num_classes=2, lr=0.005, **kwargs):
super().__... | [
"torch.nn.Dropout",
"torchmetrics.AverageMeter",
"torch.nn.CrossEntropyLoss",
"torchmetrics.Accuracy",
"torch.nn.init.zeros_",
"torch.nn.Linear",
"torch.nn.init.normal_",
"torch.rand",
"torchvision.models.mobilenet_v2"
] | [((3217, 3243), 'torch.rand', 'torch.rand', (['(2)', '(3)', '(224)', '(224)'], {}), '(2, 3, 224, 224)\n', (3227, 3243), False, 'import torch\n'), ((630, 653), 'torchmetrics.Accuracy', 'torchmetrics.Accuracy', ([], {}), '()\n', (651, 653), False, 'import torchmetrics\n'), ((706, 733), 'torchmetrics.AverageMeter', 'torch... |
# stdlib
from typing import Any as TypeAny
from typing import List as TypeList
from typing import Tuple as TypeTuple
import functools
# third party
import openmined_psi
# syft relative
from ..util import generic_update_ast
from ...ast import add_classes
from ...ast import add_methods
from ...ast import add_modules
fr... | [
"functools.partial"
] | [((2549, 2608), 'functools.partial', 'functools.partial', (['generic_update_ast', 'LIB_NAME', 'create_ast'], {}), '(generic_update_ast, LIB_NAME, create_ast)\n', (2566, 2608), False, 'import functools\n')] |
"""The nuts and bolts of sparkbot"""
# Copyright 2018 <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 applica... | [
"textwrap.dedent",
"functools.partial",
"ciscosparkapi.Webhook",
"shlex.split",
"inspect.signature"
] | [((7439, 7457), 'ciscosparkapi.Webhook', 'Webhook', (['json_data'], {}), '(json_data)\n', (7446, 7457), False, 'from ciscosparkapi import CiscoSparkAPI, Webhook, Room\n'), ((16264, 16299), 'functools.partial', 'functools.partial', (['respond', 'room_id'], {}), '(respond, room_id)\n', (16281, 16299), False, 'import func... |
# graph_web_server.py
# Example code for serving a web page over a local network to display
# graphs showing environment data read from the Metriful MS430. A CSV
# data file is also downloadable from the page.
# This example is designed to run with Python 3 on a Raspberry Pi.
# The web page can be viewed from ... | [
"socketserver.TCPServer"
] | [((3847, 3902), 'socketserver.TCPServer', 'socketserver.TCPServer', (["('', port)", 'GraphWebpageHandler'], {}), "(('', port), GraphWebpageHandler)\n", (3869, 3902), False, 'import socketserver\n')] |
import re
import sys
import cv2
from algo import tools
from settings import *
if __name__ == '__main__':
try:
folder = os.path.join(LOG_DIR, sys.argv[1])
assert os.path.isdir(folder), 'invalid folder path given: %s'%(folder,)
regex = sys.argv[2]
target_file = sys.argv... | [
"cv2.VideoWriter_fourcc",
"re.compile"
] | [((555, 572), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (565, 572), False, 'import re\n'), ((951, 982), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DIVX'"], {}), "(*'DIVX')\n", (973, 982), False, 'import cv2\n')] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import torch
import torch.nn as nn
class SimulatedWorldModel(nn.Module):
"""
A world model used for simulation. Underlying is an RNN with fixed
parameters. Given a sequence of actions and states, it outputs the ... | [
"torch.manual_seed",
"torch.cat",
"torch.nn.init.normal_",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM"
] | [((944, 1076), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': '(self.action_dim + self.state_dim)', 'hidden_size': 'self.lstm_num_hiddens', 'num_layers': 'self.lstm_num_hidden_layers'}), '(input_size=self.action_dim + self.state_dim, hidden_size=self.\n lstm_num_hiddens, num_layers=self.lstm_num_hidden_layers)\n', ... |
# coding: utf-8
import sys
from python_environment_check import check_packages
from sklearn.datasets import fetch_openml
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import numpy as np
# # Machine Learning with PyTorch and Scikit-Learn
# # -- Code Examples
# ## Package vers... | [
"numpy.random.seed",
"numpy.sum",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"sklearn.datasets.fetch_openml",
"matplotlib.pyplot.tight_layout",
"python_environment_check.check_packages",
"numpy.random.RandomState",
"matplotlib.pyplot.... | [((408, 432), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (423, 432), False, 'import sys\n'), ((558, 575), 'python_environment_check.check_packages', 'check_packages', (['d'], {}), '(d)\n', (572, 575), False, 'from python_environment_check import check_packages\n'), ((2809, 2862), 's... |
import random
from telegram.ext import CommandHandler
def punish(update, context):
punish = ["啊喔!你丢掉了90XP! \nAh Oh! You lose 90XP!", "去死吧!你失去了80XP! \nBecause of your death, you lose 80XP!", "你没有得到任何惩罚!\nYou didn't get any punish!", "减掉100XP,今天不是你的幸运日哦!\nSubtract 100XP, it's not your day oh!"]
context.bot.send_m... | [
"telegram.ext.CommandHandler",
"random.choice"
] | [((443, 475), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""punish"""', 'punish'], {}), "('punish', punish)\n", (457, 475), False, 'from telegram.ext import CommandHandler\n'), ((366, 387), 'random.choice', 'random.choice', (['punish'], {}), '(punish)\n', (379, 387), False, 'import random\n')] |
# coding: utf-8
"""
SMDBA package setup
"""
__author__="bo"
__date__ ="$May 8, 2012 2:54:34 PM$"
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='SUSE Manager Database Control',
version='1.7.5',
package_dir= {'': 'src'},
package_data={'smdba': ['scen... | [
"distutils.core.setup"
] | [((195, 649), 'distutils.core.setup', 'setup', ([], {'name': '"""SUSE Manager Database Control"""', 'version': '"""1.7.5"""', 'package_dir': "{'': 'src'}", 'package_data': "{'smdba': ['scenarios/*.scn']}", 'packages': "['smdba']", 'data_files': "[('/usr/bin/', ['src/smdba/smdba-netswitch', 'src/smdba/smdba-pgarchive'])... |
'''
Script for building Falcor on a build agent
'''
import sys
import os
import argparse
import msbuild
tests_dir = '../Tests/'
# Enable importing core from Tests/testing
# Ugly, but effective
sys.path.insert(0, os.path.join(tests_dir, 'testing'))
from core import Environment, config
def build_falcor(env, rebuild=... | [
"msbuild.build_solution",
"argparse.ArgumentParser",
"core.config.BUILD_CONFIGS.keys",
"core.Environment",
"os.path.join",
"sys.exit"
] | [((215, 249), 'os.path.join', 'os.path.join', (['tests_dir', '"""testing"""'], {}), "(tests_dir, 'testing')\n", (227, 249), False, 'import os\n'), ((793, 860), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Utility for building Falcor."""'}), "(description='Utility for building Falcor.')... |
from django.db import models
class Level(models.Model):
no = models.IntegerField(default=1)
text = models.CharField(max_length=1500, blank=True)
picture = models.ImageField(upload_to='clues', default='', blank=True)
hiddenHTML = models.CharField(max_length=1500, blank=True)
answer = models.CharFiel... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.ImageField"
] | [((66, 96), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}), '(default=1)\n', (85, 96), False, 'from django.db import models\n'), ((108, 153), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1500)', 'blank': '(True)'}), '(max_length=1500, blank=True)\n', (124, 15... |
# flake8: noqa
import sys
import zipfile
import yaml
sys.path.append('/home/chris/src/provenance_py')
if __name__ == "__main__" and __package__ is None:
__package__ = "provenance_lib"
from .parse import ProvDAG, Config
if __name__ == '__main__':
# To begin, we'll read in exactly one fp
if len(sys.argv)... | [
"sys.path.append"
] | [((55, 103), 'sys.path.append', 'sys.path.append', (['"""/home/chris/src/provenance_py"""'], {}), "('/home/chris/src/provenance_py')\n", (70, 103), False, 'import sys\n')] |
import pytest
from pytest_mock import MockerFixture
from pystratis.api.rpc import RPC
from pystratis.api.rpc.responsemodels import *
from pystratis.core.networks import StraxMain, CirrusMain
@pytest.mark.parametrize('network', [StraxMain(), CirrusMain()], ids=['StraxMain', 'CirrusMain'])
def test_call_by_name(mocker:... | [
"pystratis.core.networks.StraxMain",
"pystratis.core.networks.CirrusMain"
] | [((230, 241), 'pystratis.core.networks.StraxMain', 'StraxMain', ([], {}), '()\n', (239, 241), False, 'from pystratis.core.networks import StraxMain, CirrusMain\n'), ((243, 255), 'pystratis.core.networks.CirrusMain', 'CirrusMain', ([], {}), '()\n', (253, 255), False, 'from pystratis.core.networks import StraxMain, Cirru... |
import sys
from PyQt5.QtWidgets import QApplication, QMenu, QSystemTrayIcon, QAction, qApp
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSignal
class TrayIcon(QSystemTrayIcon):
exitSignal = pyqtSignal()
openSignal = pyqtSignal()
traySignal = pyqtSignal()
def __init__(self, p... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QAction",
"PyQt5.QtWidgets.QApplication.desktop"
] | [((218, 230), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (228, 230), False, 'from PyQt5.QtCore import pyqtSignal\n'), ((249, 261), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (259, 261), False, 'from PyQt5.QtCore import pyqtSignal\n'), ((280, 292), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal',... |
from typing import Any, List, Literal, TypedDict
from .FHIR_Element import FHIR_Element
from .FHIR_string import FHIR_string
# A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.
FHIR_AuditEvent_Network = Ty... | [
"typing.TypedDict"
] | [((318, 572), 'typing.TypedDict', 'TypedDict', (['"""FHIR_AuditEvent_Network"""', "{'id': FHIR_string, 'extension': List[Any], 'modifierExtension': List[Any],\n 'address': FHIR_string, '_address': FHIR_Element, 'type': Literal['1',\n '2', '3', '4', '5'], '_type': FHIR_Element}"], {'total': '(False)'}), "('FHIR_Au... |
from jax.config import config
config.update("jax_enable_x64", True)
import jax.numpy as jnp
from jax import jit, grad, vmap, value_and_grad, random
from jax import lax
from jax import random
from jax.lax import stop_gradient
from jax.flatten_util import ravel_pytree
from jax.scipy import stats
from jax.scipy.special ... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"jax.random.PRNGKey",
"matplotlib.pyplot.figure",
"jax.scipy.stats.pareto.logpdf",
"jax.random.uniform",
"jax.numpy.mean",
"jax.scipy.special.gammaln",
"jax.config.config.update",
"jax.numpy.sum",
"jax.vmap",
"slicereparam.functional.setup_slice_sa... | [((30, 67), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (43, 67), False, 'from jax.config import config\n'), ((519, 558), 'pandas.read_csv', 'pd.read_csv', (['"""efron-morris-75-data.csv"""'], {}), "('efron-morris-75-data.csv')\n", (530, 558), Tru... |
#!/usr/bin/python3
import brownie
def test_enumeration_support(nft):
enumeration_interface_id = "0x780e9d63"
assert nft.supportsInterface(enumeration_interface_id) is True
def test_token_by_index_reverts(nft, accounts):
with brownie.reverts():
nft.tokenByIndex(6)
def test_token_of_owner_by_in... | [
"brownie.reverts"
] | [((242, 259), 'brownie.reverts', 'brownie.reverts', ([], {}), '()\n', (257, 259), False, 'import brownie\n'), ((625, 642), 'brownie.reverts', 'brownie.reverts', ([], {}), '()\n', (640, 642), False, 'import brownie\n'), ((814, 831), 'brownie.reverts', 'brownie.reverts', ([], {}), '()\n', (829, 831), False, 'import brown... |
# LIBTBX_SET_DISPATCHER_NAME yamtbx.eiger_binning
"""
(c) RIKEN 2016. All rights reserved.
Author: <NAME>
This software is released under the new BSD License; see LICENSE.
"""
from yamtbx.dataproc.command_line import eiger_binning
if __name__ == "__main__":
import sys
eiger_binning.run_from_args(sys.argv[1:... | [
"yamtbx.dataproc.command_line.eiger_binning.run_from_args"
] | [((281, 322), 'yamtbx.dataproc.command_line.eiger_binning.run_from_args', 'eiger_binning.run_from_args', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (308, 322), False, 'from yamtbx.dataproc.command_line import eiger_binning\n')] |
'''
Created on Jan 13, 2014
@author: <NAME>
@version: 0.2.5
This is the main BiBler module.
Execute this module from the command line to start the application.
@note: It assumes that the L{app} package has a L{statechart.BiBler_Statechart} class
and a L{UserInterface.UserInterface} class that implements L{gui.app_int... | [
"gui.controller.Controller",
"gui.gui.MainWindow",
"wx.App",
"app.user_interface.UserInterface"
] | [((873, 886), 'wx.App', 'wx.App', (['(False)'], {}), '(False)\n', (879, 886), False, 'import wx\n'), ((904, 916), 'gui.controller.Controller', 'Controller', ([], {}), '()\n', (914, 916), False, 'from gui.controller import Controller\n'), ((940, 962), 'gui.gui.MainWindow', 'MainWindow', (['controller'], {}), '(controlle... |
# -*- coding: utf-8 -*-
#
#
# Project name: OpenVAS2Report: A set of tools to manager OpenVAS XML report files.
# Project URL: https://github.com/cr0hn/openvas_to_report
#
# Copyright (c) 2015, cr0hn<-AT->cr0hn.<EMAIL>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modific... | [
"os.getcwd",
"os.remove",
"pytest.raises"
] | [((6196, 6213), 'os.remove', 'os.remove', (['W_FILE'], {}), '(W_FILE)\n', (6205, 6213), False, 'import os\n'), ((1928, 1939), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1937, 1939), False, 'import os\n'), ((6528, 6574), 'pytest.raises', 'pytest.raises', (['TypeError', 'openvas_parser', 'None'], {}), '(TypeError, open... |
"""
A target encapsulates the logic for finding devices over a particular medium and
then talking to them over that medium.
"""
from photons_transport.session.discovery_options import discovery_options_spec
from photons_transport.session.network import NetworkSession
from photons_transport.targets.base import Target
fr... | [
"photons_transport.retry_options.Gaps",
"delfick_project.norms.dictobj.Field",
"delfick_project.norms.sb.string_spec"
] | [((982, 1019), 'delfick_project.norms.dictobj.Field', 'dictobj.Field', (['discovery_options_spec'], {}), '(discovery_options_spec)\n', (995, 1019), False, 'from delfick_project.norms import dictobj, sb\n'), ((703, 819), 'photons_transport.retry_options.Gaps', 'Gaps', ([], {'gap_between_results': '(0.4)', 'gap_between_a... |
import unittest
import mock
from main import *
class Test(unittest.TestCase):
def test_initialization(self):
board = setup()
# test_board_size
assert len(board.grid) == globalVar.HT
assert len(board.grid[0]) == globalVar.WIDTH
# test_initial_level
assert globalVar.level == 1
def test_ball_func(self):... | [
"unittest.main"
] | [((357, 372), 'unittest.main', 'unittest.main', ([], {}), '()\n', (370, 372), False, 'import unittest\n')] |
from datetime import datetime
import threading
import sys
import os
import pickle
import re
import requests
from bs4 import BeautifulSoup
import json
import numpy as np
import pandas as pd
# Import parent class
from .FomcBase import FomcBase
class FomcTestimony(FomcBase):
'''
A convenient class for extracti... | [
"sys.stdout.write",
"json.loads",
"datetime.datetime.today",
"datetime.datetime.strptime",
"sys.stdout.flush",
"requests.get",
"bs4.BeautifulSoup",
"re.compile"
] | [((1538, 1555), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1550, 1555), False, 'import requests\n'), ((1575, 1595), 'json.loads', 'json.loads', (['res.text'], {}), '(res.text)\n', (1585, 1595), False, 'import json\n'), ((4995, 5029), 'requests.get', 'requests.get', (['(self.base_url + link)'], {}), '(se... |
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from numbers import Number
import numpy as np
from six import string_types
from odin.utils import as_tuple
from odin.visual.plot_utils import (check_arg_length, generate_palette_colors,
... | [
"numpy.abs",
"numpy.mean",
"numpy.arange",
"odin.visual.plot_utils.to_axis",
"numpy.prod",
"numpy.unique",
"numpy.full",
"numpy.full_like",
"matplotlib.colors.Normalize",
"odin.backend.interpolation.const",
"numpy.random.RandomState",
"odin.utils.as_tuple",
"matplotlib.pyplot.cm.ScalarMappab... | [((768, 781), 'numpy.squeeze', 'np.squeeze', (['x'], {}), '(x)\n', (778, 781), True, 'import numpy as np\n'), ((3193, 3205), 'numpy.max', 'np.max', (['size'], {}), '(size)\n', (3199, 3205), True, 'import numpy as np\n'), ((3505, 3521), 'numpy.unique', 'np.unique', (['color'], {}), '(color)\n', (3514, 3521), True, 'impo... |
"""Target function for cosym analysis."""
from __future__ import absolute_import, division, print_function
import copy
import logging
import math
from orderedset import OrderedSet
from scipy import sparse
import cctbx.sgtbx.cosets
from cctbx import miller, sgtbx
from cctbx.array_family import flex
from libtbx import... | [
"cctbx.array_family.flex.select",
"cctbx.array_family.flex.sort_permutation",
"cctbx.array_family.flex.grid",
"cctbx.miller.map_to_asu",
"cctbx.array_family.flex.sum",
"math.sqrt",
"cctbx.sgtbx.change_of_basis_op",
"cctbx.array_family.flex.miller_index",
"scipy.sparse.coo_matrix",
"orderedset.Orde... | [((339, 366), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (356, 366), False, 'import logging\n'), ((2676, 2710), 'cctbx.array_family.flex.sort_permutation', 'flex.sort_permutation', (['lattice_ids'], {}), '(lattice_ids)\n', (2697, 2710), False, 'from cctbx.array_family import flex\n'),... |
#
# Copyright (c) 2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... | [
"os.remove",
"service.models.Task.objects.values_list",
"reports.models.CoverageArchive.objects.filter",
"reports.coverage.FillCoverageStatistics",
"os.path.isfile",
"marks.models.MarkSafeReport.objects.filter",
"caches.utils.RecalculateUnknownCache",
"django.utils.translation.ugettext_lazy",
"os.pa... | [((2595, 2631), 'marks.tasks.connect_safe_report.delay', 'connect_safe_report.delay', (['report_id'], {}), '(report_id)\n', (2620, 2631), False, 'from marks.tasks import connect_safe_report, connect_unsafe_report, connect_unknown_report\n'), ((2863, 2901), 'marks.tasks.connect_unsafe_report.delay', 'connect_unsafe_repo... |
import datetime, functools, re
import unittest
from disco.dPickle import dumps, loads
def f():
def g():
pass
return g
def h(*args, **kwargs):
return args, kwargs
p = functools.partial(h, 1, extra='d')
class PickleTestCase(unittest.TestCase):
def test_dpickle(self):
now = datetime.dat... | [
"functools.partial",
"datetime.datetime.now",
"disco.dPickle.dumps",
"re.compile"
] | [((189, 223), 'functools.partial', 'functools.partial', (['h', '(1)'], {'extra': '"""d"""'}), "(h, 1, extra='d')\n", (206, 223), False, 'import datetime, functools, re\n'), ((308, 331), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (329, 331), False, 'import datetime, functools, re\n'), ((681, 706... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from PIL import Image
from random import shuffle
import numpy as np
#import pickle
import cPickle as pickle
from imageFilesTools import getImageData
from co... | [
"random.shuffle",
"os.path.dirname",
"numpy.array",
"imageFilesTools.getImageData",
"os.listdir"
] | [((5701, 5714), 'random.shuffle', 'shuffle', (['data'], {}), '(data)\n', (5708, 5714), False, 'from random import shuffle\n'), ((6034, 6055), 'numpy.array', 'np.array', (['y[:trainNb]'], {}), '(y[:trainNb])\n', (6042, 6055), True, 'import numpy as np\n'), ((6175, 6218), 'numpy.array', 'np.array', (['y[trainNb:trainNb +... |
import os
import shutil
import time
import sys
import argparse
########## first step: prepare results
import json
mode = 0 # 0 segm 1 kes
if mode == 0:
with open("bo.json", 'r') as f:
data = json.load(f)
with open('all_detcors.txt', 'w') as f2:
for ix in range(len(data)):
print('Processing: '+str(ix... | [
"os.mkdir",
"os.remove",
"json.load",
"os.path.isdir",
"os.popen",
"os.path.exists",
"sys.stdout.flush",
"shutil.rmtree",
"os.path.join",
"os.chdir"
] | [((1161, 1179), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1177, 1179), False, 'import sys\n'), ((1187, 1215), 'os.path.exists', 'os.path.exists', (['"""mb_ch4.zip"""'], {}), "('mb_ch4.zip')\n", (1201, 1215), False, 'import os\n'), ((1247, 1279), 'os.path.exists', 'os.path.exists', (['"""mb_ch4_results"... |
#!/usr/bin/env python
from pilex import ImageDraw
import Image
import ImageFont
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-a", "--halign", default='left')
options, args = parser.parse_args()
lines = open('../LICENSE', 'r').read()
image = Image.new('RGB', (512, 512), 'white')
font = ... | [
"ImageFont.truetype",
"Image.new",
"optparse.OptionParser",
"pilex.ImageDraw.Draw"
] | [((124, 138), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (136, 138), False, 'from optparse import OptionParser\n'), ((275, 312), 'Image.new', 'Image.new', (['"""RGB"""', '(512, 512)', '"""white"""'], {}), "('RGB', (512, 512), 'white')\n", (284, 312), False, 'import Image\n'), ((320, 360), 'ImageFont.tru... |
# -*- coding: utf-8 -*-
"""
**gfeedclient.py**
- Copyright (c) 2019, KNC Solutions Private Limited.
- License: 'Apache License, Version 2.0'.
- version: 1.0.3
"""
from twisted.python import log
from autobahn.twisted.websocket import WebSocketClientProtocol
from autobahn.twisted.websocket import WebSock... | [
"twisted.python.log.startLogging",
"json.loads",
"json.dumps",
"autobahn.twisted.websocket.connectWS",
"autobahn.twisted.websocket.WebSocketClientFactory.__init__",
"twisted.internet.reactor.run"
] | [((2877, 2931), 'autobahn.twisted.websocket.WebSocketClientFactory.__init__', 'WebSocketClientFactory.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (2908, 2931), False, 'from autobahn.twisted.websocket import WebSocketClientFactory, connectWS\n'), ((10035, 10088), 'autobahn.twisted.websocket.connectW... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# check_fasta_object_pos.py
# made by <NAME>
# 2020-01-13 21:33:52
#########################
import sys
import os
from pyfaidx import Fasta
SVRNAME = os.uname()[1]
if "MBI" in SVRNAME.upper():
sys_path = "/Users/pcaso/bin/python_lib"
elif SVRNAME == "T7":
sys_path =... | [
"sys.path.append",
"os.uname",
"pyfaidx.Fasta",
"file_util.gzopen"
] | [((393, 418), 'sys.path.append', 'sys.path.append', (['sys_path'], {}), '(sys_path)\n', (408, 418), False, 'import sys\n'), ((196, 206), 'os.uname', 'os.uname', ([], {}), '()\n', (204, 206), False, 'import os\n'), ((504, 526), 'file_util.gzopen', 'file_util.gzopen', (['cadd'], {}), '(cadd)\n', (520, 526), False, 'impor... |
import re
import os
import numpy as np
import torch
from torch import nn
from torchvision import models
import argparse
from skimage import io
import cv2
from ref.grad_cam import GradCAM
from ref.guided_back_propagation import GuidedBackPropagation
import pydicom
from PIL import Image
def get_net(net_n... | [
"cv2.resize",
"numpy.uint8",
"argparse.ArgumentParser",
"pydicom.read_file",
"os.path.basename",
"ref.guided_back_propagation.GuidedBackPropagation",
"torchvision.models.densenet121",
"numpy.transpose",
"torch.load",
"numpy.float32",
"ref.grad_cam.GradCAM",
"numpy.max",
"numpy.min",
"numpy... | [((1511, 1542), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (1519, 1542), True, 'import numpy as np\n'), ((1555, 1586), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (1563, 1586), True, 'import numpy as np\n'), ((1773, 1812), 'torch... |
# Generated by Django 2.2.4 on 2019-11-05 03:11
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('userhandling... | [
"django.db.migrations.swappable_dependency",
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.UUIDField"
] | [((239, 296), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (270, 296), False, 'from django.db import migrations, models\n'), ((389, 449), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name... |
import time
import traceback
from coinmetrics.utils import pipelines
from coinmetrics.utils.postgres import PostgresAccess
from coinmetrics.bitsql.schema import *
from coinmetrics.bitsql.query import *
from coinmetrics.bitsql.exporter import *
from coinmetrics.bitsql.node import *
from coinmetrics.bitsql.aggregator imp... | [
"coinmetrics.utils.pipelines.OrderingConnector",
"coinmetrics.bitsql.omni.exporter.OmniExporter",
"coinmetrics.bitsql.omni.aggregator.OmniCrowdsalePropertyAggregator",
"coinmetrics.bitsql.omni.node.OmniNode",
"coinmetrics.bitsql.omni.query.MaidSafeCoinQuery",
"coinmetrics.utils.pipelines.LinearMultithread... | [((793, 818), 'coinmetrics.utils.postgres.PostgresAccess', 'PostgresAccess', (['*dbParams'], {}), '(*dbParams)\n', (807, 818), False, 'from coinmetrics.utils.postgres import PostgresAccess\n'), ((5162, 5177), 'coinmetrics.bitsql.omni.node.OmniNode', 'OmniNode', (['*args'], {}), '(*args)\n', (5170, 5177), False, 'from c... |
import math
def default_decay(num_epochs):
step_epoch = min(num_epochs // 5, 50)
def decay(epoch):
if epoch < step_epoch:
return 1e-4
else:
return 1e-5
return decay
def cyclic_learning_rate(learning_rate=0.01,
max_lr=0.1,
... | [
"math.pow",
"math.floor",
"math.fabs"
] | [((1979, 2017), 'math.floor', 'math.floor', (['(1 + step / (2 * step_size))'], {}), '(1 + step / (2 * step_size))\n', (1989, 2017), False, 'import math\n'), ((2030, 2073), 'math.fabs', 'math.fabs', (['(step / step_size - 2 * cycle + 1)'], {}), '(step / step_size - 2 * cycle + 1)\n', (2039, 2073), False, 'import math\n'... |
# Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"launch_testing.asserts.assertExitCodes",
"launch_testing.util.KeepAliveProc",
"launch_testing.actions.ReadyToTest",
"ament_index_python.packages.get_package_share_directory",
"os.path.join",
"launch_testing.post_shutdown_test"
] | [((1631, 1666), 'launch_testing.post_shutdown_test', 'launch_testing.post_shutdown_test', ([], {}), '()\n', (1664, 1666), False, 'import launch_testing\n'), ((895, 948), 'ament_index_python.packages.get_package_share_directory', 'get_package_share_directory', (['"""joint_limits_interface"""'], {}), "('joint_limits_inte... |
# Create ReadyLingua Corpus
import argparse
import math
import os
import sys
from collections import Counter
from os import makedirs, walk
from os.path import exists, join, splitext, basename
from pathlib import Path
from shutil import copyfile
import pandas as pd
from lxml import etree
from tqdm import tqdm
from con... | [
"pandas.DataFrame",
"util.log_util.create_args_str",
"os.path.join",
"argparse.ArgumentParser",
"os.path.basename",
"os.makedirs",
"os.walk",
"os.path.exists",
"util.audio_util.resample",
"util.string_util.contains_numeric",
"pathlib.Path",
"util.string_util.normalize",
"lxml.etree.parse",
... | [((770, 849), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create ReadyLingua corpus from raw files"""'}), "(description='Create ReadyLingua corpus from raw files')\n", (793, 849), False, 'import argparse\n'), ((2238, 2267), 'os.path.join', 'join', (['target_dir', '"""index.csv"""'], {... |
import sublime
from sublime import Region
from sublime_plugin import WindowCommand, TextCommand, EventListener
from .show import show, refresh_sym_view, get_sidebar_views_groups, get_sidebar_status
class OutlineCommand(WindowCommand):
def run(self, immediate=False, single_pane=False, project=False, other_group=False,... | [
"sublime.Region"
] | [((2454, 2500), 'sublime.Region', 'Region', (['region_position[0]', 'region_position[1]'], {}), '(region_position[0], region_position[1])\n', (2460, 2500), False, 'from sublime import Region\n')] |
import os
import subprocess
import board
import time
def clear_console():
"""Function clears the console."""
if os.name in ('nt', 'dos'):
subprocess.call("cls")
elif os.name in ('linux', 'osx', 'posix'):
subprocess.call("clear")
else:
print("\n" * 120)
def is_mode_correct(mod... | [
"os.path.realpath",
"os.path.exists",
"time.sleep",
"board.Board",
"subprocess.call",
"os.path.join"
] | [((5309, 5340), 'os.path.join', 'os.path.join', (['current_dir', 'file'], {}), '(current_dir, file)\n', (5321, 5340), False, 'import os\n'), ((5349, 5374), 'os.path.exists', 'os.path.exists', (['data_line'], {}), '(data_line)\n', (5363, 5374), False, 'import os\n'), ((5823, 5840), 'board.Board', 'board.Board', (['"""P1... |
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description='')
parser.add_argument('--sdx', default='8', help='')
parser.add_argument('--sdy', default='4', help='')
args = parser.parse_args()
'''
Generate in pairs
Fill up switchbox quad for now
Create random connections between the LUTs
See ho... | [
"argparse.ArgumentParser"
] | [((49, 88), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (72, 88), False, 'import argparse\n')] |
#!/usr/bin/env python
"""
accumulator class
Designed to be used as an expandable numpy array, to accumulate values, rather
than a python list.
Note that slices return copies, rather than views, unlike regular numpy arrays.
This is so that the buffer can be re-allocated without messing up any views.
"""
import numpy... | [
"numpy.empty",
"numpy.array"
] | [((2739, 2800), 'numpy.array', 'np.array', (['self.__buffer[:self.length]'], {'dtype': 'dtype', 'copy': '(True)'}), '(self.__buffer[:self.length], dtype=dtype, copy=True)\n', (2747, 2800), True, 'import numpy as np\n'), ((1575, 1602), 'numpy.empty', 'np.empty', (['(0,)'], {'dtype': 'dtype'}), '((0,), dtype=dtype)\n', (... |
from collections import Counter
import numpy as np
UNKNOWN = "<unk>"
def build_label_index(labels: iter,
start_from: int = 0
) -> (dict, Counter):
label_counter = Counter()
label_index = {}
for label in labels:
label_counter[label] += 1
if lab... | [
"numpy.random.rand",
"collections.Counter"
] | [((216, 225), 'collections.Counter', 'Counter', ([], {}), '()\n', (223, 225), False, 'from collections import Counter\n'), ((746, 755), 'collections.Counter', 'Counter', ([], {}), '()\n', (753, 755), False, 'from collections import Counter\n'), ((1406, 1435), 'numpy.random.rand', 'np.random.rand', (['embedding_dim'], {... |
#!/usr/bin/env python
'''
This makes a printable grade list from a downloaded roster. Choose the
for grade submission roster to ensure all important fields are present.
To run:
.. code:bash
$ ./makelist.py -s clips_nro4.WBY
$ pdflatex list.tex
$ evince list.pdf
'''
from __future__ import print_function
f... | [
"plumbum.cli.ExistingFile",
"functools.partial",
"plumbum.cli.Range",
"plumbum.cli.Flag",
"datetime.datetime.now",
"pandas.notnull",
"plumbum.cli.switch"
] | [((1260, 1333), 'plumbum.cli.Flag', 'cli.Flag', (["['-r', '--roster']"], {'help': '"""Makes a single column roster instead"""'}), "(['-r', '--roster'], help='Makes a single column roster instead')\n", (1268, 1333), False, 'from plumbum import cli, local, FG\n'), ((1478, 1528), 'plumbum.cli.switch', 'cli.switch', (["['-... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for polynomials."""
import unittest
import numpy as np
from scipy import sparse
from sknetwork.data.test_graphs import test_graph
from sknetwork.linalg import Polynome
class TestPolynome(unittest.TestCase):
def test_init(self):
adjacency = test_g... | [
"numpy.random.randn",
"sknetwork.data.test_graphs.test_graph",
"numpy.linalg.norm",
"numpy.arange",
"numpy.array",
"scipy.sparse.eye"
] | [((314, 326), 'sknetwork.data.test_graphs.test_graph', 'test_graph', ([], {}), '()\n', (324, 326), False, 'from sknetwork.data.test_graphs import test_graph\n'), ((469, 481), 'sknetwork.data.test_graphs.test_graph', 'test_graph', ([], {}), '()\n', (479, 481), False, 'from sknetwork.data.test_graphs import test_graph\n'... |
import logging
from django.shortcuts import Http404, get_object_or_404
from rest_framework import status
from rest_framework.generics import ListAPIView, CreateAPIView, RetrieveAPIView, UpdateAPIView, RetrieveUpdateAPIView, \
RetrieveUpdateDestroyAPIView
from rest_framework.permissions import IsAdminUser, Is... | [
"logging.FileHandler",
"logging.Formatter",
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response",
"biz.models.Issue.objects.all",
"logging.getLogger"
] | [((571, 598), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (588, 598), False, 'import logging\n'), ((646, 705), 'logging.FileHandler', 'logging.FileHandler', (["(settings.BASE_DIR + '/logs/issues.log')"], {}), "(settings.BASE_DIR + '/logs/issues.log')\n", (665, 705), False, 'import logg... |
"""Support for deCONZ binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from pydeconz.sensor import (
Alarm,
CarbonMonoxide,
Fire,
GenericFlag,
OpenClose,
Presence,
SensorResources,
Vibration,
Water,
)
from... | [
"homeassistant.helpers.dispatcher.async_dispatcher_connect"
] | [((6530, 6605), 'homeassistant.helpers.dispatcher.async_dispatcher_connect', 'async_dispatcher_connect', (['hass', 'gateway.signal_new_sensor', 'async_add_sensor'], {}), '(hass, gateway.signal_new_sensor, async_add_sensor)\n', (6554, 6605), False, 'from homeassistant.helpers.dispatcher import async_dispatcher_connect\n... |
import subprocess
def list_gpus():
try:
stdout = subprocess.check_output(['nvidia-smi', '-L']).decode('utf-8')
return list(map(lambda line: int(line.split(':')[0].replace('GPU ', '')),
[x for x in stdout.splitlines() if x.startswith('GPU ')]))
except subprocess.CalledPr... | [
"subprocess.check_output"
] | [((510, 631), 'subprocess.check_output', 'subprocess.check_output', (["['nvidia-smi', '--query-gpu=memory.total', '--format=csv,noheader,nounits',\n '--id=%d' % gpu]"], {}), "(['nvidia-smi', '--query-gpu=memory.total',\n '--format=csv,noheader,nounits', '--id=%d' % gpu])\n", (533, 631), False, 'import subprocess\... |
import pandas as pd
from ydata_synthetic.synthesizers.regular import CGAN
from typing import List
from src.pipeline.config import Config
from src.pipeline.model.paths import GERMAN_CREDIT_GEN_CGAN_MODEL_PATH
from src.pipeline.datasets.training_datasets import GermanCreditDataset, BankMarketingDataset
from src.pipeline.... | [
"src.pipeline.preprocessing.label_preprocessor.LabelProcessor",
"src.pipeline.datasets.training_datasets.GermanCreditDataset",
"src.pipeline.datasets.training_datasets.BankMarketingDataset",
"src.pipeline.data_generation.data_generation_manager.MultipleDatasetGenerationManager",
"src.pipeline.config.Config"... | [((2661, 2703), 'src.pipeline.data_generation.data_generation_manager.MultipleDatasetGenerationManager', 'MultipleDatasetGenerationManager', (['info_lst'], {}), '(info_lst)\n', (2693, 2703), False, 'from src.pipeline.data_generation.data_generation_manager import MultipleDatasetGenerationManager\n'), ((1324, 1346), 'sr... |
from __future__ import (absolute_import, division, print_function)
class serviceBase(object):
def __init__(self, session_factory, debug=False):
"""Must send in either a session_factory."""
self._session_factory = session_factory
self._session = self._session_factory.getSession()
... | [
"sqlalchemy.ext.declarative.declarative_base"
] | [((1464, 1490), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {'cls': 'Base'}), '(cls=Base)\n', (1480, 1490), False, 'from sqlalchemy.ext.declarative import declarative_base\n')] |
## Imports
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
import handybeam.samplers.clist_sampler as clist_sampler
# Global variables
acoustic_impedance = 420
rms_factor = (np.sqrt(2) / 2)
# Please use this as reference for opencv thresholding functions.
# https://docs.opencv.org/3.4/d7... | [
"cv2.contourArea",
"numpy.abs",
"numpy.sum",
"numpy.power",
"cv2.threshold",
"cv2.copyMakeBorder",
"numpy.float",
"cv2.fillPoly",
"numpy.max",
"numpy.array",
"cv2.drawContours",
"cv2.inRange",
"cv2.findContours",
"numpy.sqrt"
] | [((203, 213), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (210, 213), True, 'import numpy as np\n'), ((1938, 1987), 'numpy.array', 'np.array', (['(self.afi_3d, self.ali_3d, self.ahi_3d)'], {}), '((self.afi_3d, self.ali_3d, self.ahi_3d))\n', (1946, 1987), True, 'import numpy as np\n'), ((2421, 2450), 'numpy.max', '... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>
# *****************************************************************************/
##########################################################################################... | [
"threading.Timer",
"optparse.OptionParser",
"os.environ.copy",
"uuid.uuid5",
"builtins.range",
"os.path.join",
"os.path.exists",
"datetime.datetime.now",
"threading.Thread",
"subprocess.Popen",
"time.sleep",
"platform.system",
"builtins.str",
"queue.Queue",
"os.getpgid",
"os.getpid",
... | [((2093, 2110), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (2108, 2110), False, 'import os, os.path, subprocess, sys, platform, threading, uuid, queue, time, signal\n'), ((2127, 2144), 'platform.system', 'platform.system', ([], {}), '()\n', (2142, 2144), False, 'import os, os.path, subprocess, sys, platfor... |
import os
import shutil
import sys
import tempfile
from typing import List, Tuple
import numpy
from scipy.sparse.csr import csr_matrix
from labours.cors_web_server import web_server
IDEAL_SHARD_SIZE = 4096
def train_embeddings(
index: List[str],
matrix: csr_matrix,
tmpdir: None,
shard_size: int = I... | [
"tempfile.TemporaryDirectory",
"labours._vendor.swivel.main",
"shutil.which",
"os.system",
"numpy.percentile",
"numpy.argsort",
"numpy.fromstring",
"sys.argv.extend",
"labours.cors_web_server.web_server.start",
"os.path.join",
"os.getenv"
] | [((580, 613), 'numpy.percentile', 'numpy.percentile', (['matrix.data', '(99)'], {}), '(matrix.data, 99)\n', (596, 613), False, 'import numpy\n'), ((1413, 1488), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {'prefix': '"""hercules_labours_"""', 'dir': '(tmpdir or None)'}), "(prefix='hercules_labour... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Загружает текст рассказа с samlib.ru, создаёт из него упрощённый fb2.
# Для дальнейшей обработки gen_database, чтобы название/имя_автора не терять.
import argparse
from lxml import html
from lxml import etree
import requests
from bs4 import BeautifulSoup
#-------------... | [
"bs4.BeautifulSoup",
"argparse.ArgumentParser",
"requests.get",
"lxml.etree.HTMLParser"
] | [((474, 499), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (497, 499), False, 'import argparse\n'), ((1483, 1510), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page', '"""lxml"""'], {}), "(page, 'lxml')\n", (1496, 1510), False, 'from bs4 import BeautifulSoup\n'), ((924, 941), 'requests.get', 'req... |
from ..Task import Task
from ...Crawler import Crawler
class GafferScene(Task):
"""
Executes a gaffer scene by triggering the task nodes.
Required options: scene (full path of gaffer scene)
All options defined in the task are resolved (in case the value contains a template string)
then assigned t... | [
"Gaffer.Context",
"Gaffer.ScriptNode"
] | [((1208, 1227), 'Gaffer.ScriptNode', 'Gaffer.ScriptNode', ([], {}), '()\n', (1225, 1227), False, 'import Gaffer\n'), ((1571, 1587), 'Gaffer.Context', 'Gaffer.Context', ([], {}), '()\n', (1585, 1587), False, 'import Gaffer\n')] |
#from re import T
#from contextlib import ContextDecorator
import socket
import _thread
import json
from time import time
from datetime import datetime
import zmq
import sys
import time
from sqlalchemy.orm import sessionmaker
from db import *
IP_ADDRESS = '127.0.0.1'
TOPIC = None
fila_msgs = []
# Recebe os dados do c... | [
"json.loads",
"_thread.start_new_thread",
"datetime.datetime.strptime",
"sqlalchemy.orm.sessionmaker",
"datetime.datetime.now",
"zmq.Context"
] | [((974, 987), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (985, 987), False, 'import zmq\n'), ((7542, 7581), '_thread.start_new_thread', '_thread.start_new_thread', (['cadastrar', '()'], {}), '(cadastrar, ())\n', (7566, 7581), False, 'import _thread\n'), ((7585, 7620), '_thread.start_new_thread', '_thread.start_new... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.