code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2016 Cisco Systems, 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 or agreed to in writing... | [
"imcsdk.apis.server.storage._pd_min_size_get",
"imcsdk.apis.server.storage.physical_drive_set_jbod_mode",
"imcsdk.apis.server.storage._human_to_bytes",
"time.sleep",
"imcsdk.apis.server.storage.controller_encryption_key_generate",
"imcsdk.apis.server.storage.physical_drive_encryption_disable",
"nose.too... | [((2786, 2803), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (2792, 2803), False, 'from nose.tools import assert_equal, raises\n'), ((11514, 11531), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (11520, 11531), False, 'from nose.tools import assert_equal, raises\n'), ((283... |
from parsel import Selector
from utils import (
download,
remove_big_whitespaces_selector,
find_id_in_url,
catch_errors,
get_last_part_url,
)
from data import VideoContent, GalleryContent, ImageContent, Meme, Author, Page
import re
ROOT = "https://m.demotywatory.pl"
def scrap(url):
html = do... | [
"utils.catch_errors",
"parsel.Selector",
"data.VideoContent",
"data.Page",
"utils.download",
"utils.find_id_in_url",
"data.ImageContent",
"data.GalleryContent"
] | [((318, 331), 'utils.download', 'download', (['url'], {}), '(url)\n', (326, 331), False, 'from utils import download, remove_big_whitespaces_selector, find_id_in_url, catch_errors, get_last_part_url\n'), ((389, 408), 'parsel.Selector', 'Selector', ([], {'text': 'html'}), '(text=html)\n', (397, 408), False, 'from parsel... |
__all__ = ('FlexSlider', )
import os
import sys
root = os.path.abspath(
os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.realpath(__file__)))))
sys.path.insert(0,root)
from kivy.lang import Builder
from kivy_modules.widget.widget import Widget
from kivy.properties import (NumericPrope... | [
"kivy.properties.BoundedNumericProperty",
"sys.path.insert",
"kivy.properties.NumericProperty",
"kivy.lang.Builder.load_string",
"os.path.realpath",
"kivy.properties.OptionProperty",
"kivy.properties.ListProperty",
"kivy.properties.BooleanProperty",
"kivy.properties.ReferenceListProperty",
"kivy.p... | [((178, 202), 'sys.path.insert', 'sys.path.insert', (['(0)', 'root'], {}), '(0, root)\n', (193, 202), False, 'import sys\n'), ((5858, 7481), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['"""\n<FlexSlider>:\n canvas:\n Color:\n rgb: 1, 1, 1\n RoundedRectangle:\n radius... |
import pytest
from query_flight import utils
from query_flight.models import Search, Flight, Layover, Airport
from django.utils import timezone
# @pytest.fixture
# def basic_search():
# return Search.objects.create()
@pytest.fixture
def basic_sw_inputs():
return {'browser': 1, 'originationAirportCode': ['ATL... | [
"query_flight.utils.SW_Sel_Multiple",
"query_flight.models.Search.objects.count",
"django.utils.timezone.now",
"pytest.mark.parametrize",
"query_flight.utils.SW_Sel_base",
"pytest.raises",
"query_flight.models.Search.objects.create"
] | [((454, 649), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input,iterable"""', "[(['ATL', 'BOI', 'DEN'], True), ([1, 2, 3], True), ((1, 2, 3), True), (\n 'string of garbage', False), (b'string of garbage', False), (1, False)]"], {}), "('input,iterable', [(['ATL', 'BOI', 'DEN'], True), (\n [1, 2, 3]... |
from django.contrib.auth import get_user_model
from django.db import migrations
from compte.models import UserPreferences
def add_preferences_to_users(apps, schema_editor):
users = get_user_model().objects.all()
for user in users:
UserPreferences.objects.create(user=user)
class Migration(migrations... | [
"django.contrib.auth.get_user_model",
"django.db.migrations.RunPython",
"compte.models.UserPreferences.objects.create"
] | [((250, 291), 'compte.models.UserPreferences.objects.create', 'UserPreferences.objects.create', ([], {'user': 'user'}), '(user=user)\n', (280, 291), False, 'from compte.models import UserPreferences\n'), ((433, 479), 'django.db.migrations.RunPython', 'migrations.RunPython', (['add_preferences_to_users'], {}), '(add_pre... |
""" es_runners for coordinate scans
"""
import automol
import elstruct
from mechroutines.es.runner import scan
from mechroutines.es.runner import qchem_params
from mechlib.amech_io import printer as ioprinter
from phydat import phycon
def hindered_rotor_scans(
zma, spc_info, mod_thy_info, thy_save_fs,
... | [
"mechlib.amech_io.printer.run_rotors",
"automol.zmat.set_constraint_names",
"automol.rotor.names",
"automol.rotor.grids",
"automol.zmat.string",
"automol.zmat.constraint_dct",
"mechroutines.es.runner.qchem_params",
"mechroutines.es.runner.scan.execute_scan"
] | [((883, 910), 'automol.rotor.names', 'automol.rotor.names', (['rotors'], {}), '(rotors)\n', (902, 910), False, 'import automol\n'), ((932, 980), 'automol.rotor.grids', 'automol.rotor.grids', (['rotors'], {'increment': 'increment'}), '(rotors, increment=increment)\n', (951, 980), False, 'import automol\n'), ((1022, 1088... |
import subprocess
wsl = "wsl python3.7 /mnt/" + YOUR_PATH_TO_HARVESTER
# to = "--timeout 900 -z"
to = "-p2 ai.terran.hard"
to2 = "-p2 ai.zerg.hard"
to3 = "-p2 ai.protoss.hard"
def ai_opponents(difficulty: str) -> str:
text = ""
for race in ["zerg", "protoss", "terran"]:
for build in ["rush", "timing",... | [
"subprocess.Popen"
] | [((1702, 1724), 'subprocess.Popen', 'subprocess.Popen', (['cmds'], {}), '(cmds)\n', (1718, 1724), False, 'import subprocess\n')] |
import re
welcome_message = """
Welcome to the Mad Libs game! YOu will be prompted to enter certain types of words. These words will be used in a mad lib and printed out for you.
"""
def fill_mad_lib(file):
new_mad_lib = ''
#import pdb; pdb.set_trace()
with open('text.txt', 'r+') as f:
try:
... | [
"re.findall"
] | [((995, 1018), 're.findall', 're.findall', (['regex', 'line'], {}), '(regex, line)\n', (1005, 1018), False, 'import re\n')] |
import sys
import os
import argparse
import numpy as np
parser = argparse.ArgumentParser(
description="""Command-line bin abundance estimator.
Print the median RPKM abundance for each bin in each sample to STDOUT.
Will read the RPKM file into memory - beware.""",
formatter_class=argparse.RawDescriptionHelpForm... | [
"numpy.median",
"argparse.ArgumentParser",
"vamb.vambtools.read_npz",
"vamb.vambtools.read_clusters",
"os.path.isfile",
"sys.exit",
"sys.path.append"
] | [((66, 343), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Command-line bin abundance estimator.\nPrint the median RPKM abundance for each bin in each sample to STDOUT.\nWill read the RPKM file into memory - beware."""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'add_he... |
from pupa.scrape import Scraper
from pupa.scrape import Event
import lxml.html
from datetime import datetime
import pytz
DUPLICATE_EVENT_URLS = ('http://miamidade.gov/wps/Events/EventDetail.jsp?eventID=445731',
'http://miamidade.gov/wps/Events/EventDetail.jsp?eventID=452515',
... | [
"datetime.datetime.strptime",
"pytz.timezone",
"pupa.scrape.Event"
] | [((642, 669), 'pytz.timezone', 'pytz.timezone', (['"""US/Eastern"""'], {}), "('US/Eastern')\n", (655, 669), False, 'import pytz\n'), ((2310, 2433), 'pupa.scrape.Event', 'Event', ([], {'name': 'title', 'start_time': 'when', 'timezone': '"""US/Eastern"""', 'location_name': 'where', 'description': 'description', 'status':... |
# Generated by Django 2.2.7 on 2019-11-12 16:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('research_note', '0005_auto_20191112_2255'),
]
operations = [
migrations.RemoveField(
model_name='researchnote',
name='is_wri... | [
"django.db.migrations.RemoveField"
] | [((233, 301), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""researchnote"""', 'name': '"""is_written"""'}), "(model_name='researchnote', name='is_written')\n", (255, 301), False, 'from django.db import migrations\n')] |
from datetime import datetime, date
from marqeta.response_models.address_response_model import AddressResponseModel
from marqeta.response_models.identification_response_model import IdentificationResponseModel
from marqeta.response_models import datetime_object
import json
import re
class BusinessProprietorResponseMod... | [
"marqeta.response_models.identification_response_model.IdentificationResponseModel",
"marqeta.response_models.datetime_object",
"json.dumps",
"marqeta.response_models.address_response_model.AddressResponseModel"
] | [((454, 510), 'json.dumps', 'json.dumps', (['self.json_response'], {'default': 'self.json_serial'}), '(self.json_response, default=self.json_serial)\n', (464, 510), False, 'import json\n'), ((1243, 1291), 'marqeta.response_models.address_response_model.AddressResponseModel', 'AddressResponseModel', (["self.json_respons... |
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView
from .views import MainPage
urlpatterns = [
path('admin/', admin.site.urls),
path('', MainPage.as_view(), name='books'),
]
| [
"django.urls.path"
] | [((157, 188), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (161, 188), False, 'from django.urls import path\n')] |
from __future__ import unicode_literals
import os.path
from django.core.files.storage import default_storage as storage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.six import StringIO
from django.utils.encoding import smart_text
try:
import Image
except ImportError:
try:
... | [
"PIL.Image.open",
"django.core.files.storage.default_storage.exists",
"django.utils.six.StringIO",
"django.utils.encoding.smart_text",
"django.core.files.storage.default_storage.open"
] | [((1395, 1421), 'django.core.files.storage.default_storage.exists', 'storage.exists', (['image_path'], {}), '(image_path)\n', (1409, 1421), True, 'from django.core.files.storage import default_storage as storage\n'), ((1439, 1474), 'django.core.files.storage.default_storage.open', 'storage.open', (['image_field.name', ... |
import os
import re
from pathlib import Path
from urllib.parse import urlparse
from github import Github
class CommitParser(object):
github_access_token: str
repository: str
jira_project: str
jira_server: str
def __init__(self, repository, jira_project, jira_server, github_access_token):
... | [
"os.popen",
"urllib.parse.urlparse",
"github.Github",
"re.compile"
] | [((982, 1036), 'os.popen', 'os.popen', (["('git log --pretty=%s ' + start + '...' + end)"], {}), "('git log --pretty=%s ' + start + '...' + end)\n", (990, 1036), False, 'import os\n'), ((1151, 1175), 're.compile', 're.compile', (['regex_format'], {}), '(regex_format)\n', (1161, 1175), False, 'import re\n'), ((1277, 130... |
import numpy as np
from numpy import linalg as LA
import pickle
from collections import Counter
import csv
class Vocabulary(object):
def __init__(self, vocab_file, emb_file='', dim_emb=0):
with open(vocab_file, 'rb') as f:
self.size, self.word2id, self.id2word = pickle.load(f)
self.dim_emb = dim_emb
... | [
"csv.DictWriter",
"pickle.dump",
"numpy.random.random_sample",
"pickle.load",
"collections.Counter",
"numpy.linalg.norm"
] | [((1050, 1064), 'collections.Counter', 'Counter', (['words'], {}), '(words)\n', (1057, 1064), False, 'from collections import Counter\n'), ((1271, 1342), 'pickle.dump', 'pickle.dump', (['(vocab_size, word2id, id2word)', 'f', 'pickle.HIGHEST_PROTOCOL'], {}), '((vocab_size, word2id, id2word), f, pickle.HIGHEST_PROTOCOL)\... |
from datetime import datetime
import pytz
if __name__ == '__main__':
places_tz = ['Asia/Tokyo', 'Europe/Madrid', 'America/Argentina/Buenos_Aires', 'US/eastern', 'US/Pacific', 'UTC']
cities_name = ['Tokyo', 'Madrid', 'Buenos Aires', 'New York', 'California', 'UTC']
for place_tz, city_name in zip(places_tz, ... | [
"pytz.timezone"
] | [((367, 390), 'pytz.timezone', 'pytz.timezone', (['place_tz'], {}), '(place_tz)\n', (380, 390), False, 'import pytz\n')] |
import json
from unittest import TestCase
from mock import Mock, patch, call
from nose_parameterized import parameterized
from samcli.lib.logs.formatter import LogsFormatter, LambdaLogMsgFormatters, KeywordHighlighter, JSONMsgFormatter
from samcli.lib.logs.event import LogEvent
class TestLogsFormatter_pretty_print_... | [
"samcli.lib.logs.formatter.KeywordHighlighter",
"mock.call",
"mock.Mock",
"samcli.lib.logs.formatter.LambdaLogMsgFormatters.colorize_errors",
"samcli.lib.logs.formatter.LogsFormatter",
"json.dumps",
"mock.patch.object",
"nose_parameterized.parameterized.expand",
"samcli.lib.logs.event.LogEvent",
"... | [((1777, 1854), 'mock.patch.object', 'patch.object', (['LogsFormatter', '"""_pretty_print_event"""'], {'wraps': '_passthru_formatter'}), "(LogsFormatter, '_pretty_print_event', wraps=_passthru_formatter)\n", (1789, 1854), False, 'from mock import Mock, patch, call\n'), ((2698, 2775), 'mock.patch.object', 'patch.object'... |
#!/usr/bin/env python3
import argparse, pexpect
from getpass import getpass
from time import sleep
# Set up argument parser
parser = argparse.ArgumentParser(prog='openconnect-cli', description='Automate logins to the OpenConnect SSL VPN client')
# Type of VPN to initiate
parser_type = parser.add_mutually_exclusive_g... | [
"getpass.getpass",
"time.sleep",
"pexpect.spawnu",
"argparse.ArgumentParser"
] | [((135, 252), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""openconnect-cli"""', 'description': '"""Automate logins to the OpenConnect SSL VPN client"""'}), "(prog='openconnect-cli', description=\n 'Automate logins to the OpenConnect SSL VPN client')\n", (158, 252), False, 'import argparse,... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... | [
"meltingpot.python.human_players.level_playing_utils.run_episode",
"absl.testing.parameterized.parameters",
"absl.testing.absltest.main",
"collections.defaultdict",
"unittest.mock.patch.object",
"meltingpot.python.human_players.level_playing_utils.ActionReader"
] | [((3223, 3840), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["({'move': level_playing_utils.get_direction_pressed}, pygame.K_w, 0, {\n '1.move': 1, '2.move': 0, '3.move': 0})", "({'move': level_playing_utils.get_direction_pressed}, pygame.K_s, 2, {\n '1.move': 0, '2.move': 0, '3.move': 3... |
from pyNastran.bdf.bdf import BDF
model = BDF()
model.is_nx = True
section = 5
#filename = r'D:\SNC IAS\01 - FAST Program\05 - Modified Sections\01 - AeroComBAT Files\section_{}.dat'.format(section)
filename = r'C:\Users\benna\Desktop\Work Temp\SNC\FAST\SIMPLE_SECTIONS\CTRIA6_1_100.dat'
model.read_bdf(filename, xref=T... | [
"pyNastran.bdf.bdf.BDF"
] | [((43, 48), 'pyNastran.bdf.bdf.BDF', 'BDF', ([], {}), '()\n', (46, 48), False, 'from pyNastran.bdf.bdf import BDF\n')] |
## @file
## @defgroup flask flask
## @brief minimized Flask-based backend
## @ingroup web
import config
from core.env import *
from core.io import Dir
from .web import Web
from core.meta import Module
from core.time import *
from gen.js import jsFile
from gen.s import S
from web.html import htmlFile
import os, re
... | [
"flask.render_template",
"flask.Flask",
"core.meta.Module.__init__",
"re.match",
"flask_socketio.SocketIO",
"web.html.htmlFile",
"core.io.Dir",
"flask.redirect",
"gen.js.jsFile"
] | [((392, 405), 'core.io.Dir', 'Dir', (['"""static"""'], {}), "('static')\n", (395, 405), False, 'from core.io import Dir\n'), ((425, 441), 'core.io.Dir', 'Dir', (['"""templates"""'], {}), "('templates')\n", (428, 441), False, 'from core.io import Dir\n'), ((605, 629), 'core.meta.Module.__init__', 'Module.__init__', (['s... |
import logging
import sys
from datetime import datetime
import requests
from tqdm import tqdm
import log
from datamodel.advisory import AdvisoryRecord
from datamodel.commit import Commit
from filtering.filter import filter_commits
from git.git import GIT_CACHE, Git
from git.version_to_tag import get_tag_for_version
f... | [
"log.util.init_local_logger",
"datamodel.advisory.AdvisoryRecord",
"sys.exit",
"requests.post",
"git.version_to_tag.get_tag_for_version",
"datetime.datetime.strptime",
"filtering.filter.filter_commits",
"tqdm.tqdm",
"datamodel.commit.Commit.parse_obj",
"ranking.rules.apply_rules",
"stats.executi... | [((676, 695), 'log.util.init_local_logger', 'init_local_logger', ([], {}), '()\n', (693, 695), False, 'from log.util import init_local_logger\n'), ((841, 884), 'stats.execution.execution_statistics.sub_collection', 'execution_statistics.sub_collection', (['"""core"""'], {}), "('core')\n", (876, 884), False, 'from stats... |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_data_dir():
data_dir._set_default()
return data_dir.path
def default_config_path():
return os.path.join(default_data_dir(... | [
"StringIO.StringIO",
"os.path.exists",
"ConfigParser.ConfigParser",
"uuid.uuid1",
"pyethereum.utils.data_dir._set_default"
] | [((202, 225), 'pyethereum.utils.data_dir._set_default', 'data_dir._set_default', ([], {}), '()\n', (223, 225), False, 'from pyethereum.utils import data_dir\n'), ((1770, 1789), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (1787, 1789), False, 'import StringIO\n'), ((1846, 1873), 'ConfigParser.ConfigParse... |
from sqlmodel import SQLModel
from sb_backend.app.service.base.base_service import ServiceBase
from sb_backend.app.crud.setup.crud_noseriesline import CRUDBase, noseriesline
class ServiceBase(ServiceBase[CRUDBase, SQLModel, SQLModel]):
pass
noseriesline_s = ServiceBase(noseriesline)
| [
"sb_backend.app.service.base.base_service.ServiceBase"
] | [((264, 289), 'sb_backend.app.service.base.base_service.ServiceBase', 'ServiceBase', (['noseriesline'], {}), '(noseriesline)\n', (275, 289), False, 'from sb_backend.app.service.base.base_service import ServiceBase\n')] |
# coding=utf-8
from selenium import webdriver
import time
driver = webdriver.PhantomJS(executable_path=r'E:\Documents\Apps\phantomjs-2.1.1-windows\bin\phantomjs.exe')
driver.get("https://movie.douban.com/typerank?type_name=剧情&type=11&interval_id=100:90&action=")
# 向下滚动10000像素
js = "document.body.scrollTop=10000"
#js... | [
"selenium.webdriver.PhantomJS",
"time.sleep"
] | [((69, 177), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {'executable_path': '"""E:\\\\Documents\\\\Apps\\\\phantomjs-2.1.1-windows\\\\bin\\\\phantomjs.exe"""'}), "(executable_path=\n 'E:\\\\Documents\\\\Apps\\\\phantomjs-2.1.1-windows\\\\bin\\\\phantomjs.exe')\n", (88, 177), False, 'from selenium im... |
import sys
from collections import defaultdict
sys.stdin.readline()
my_results = defaultdict(int)
def add_contact(contact):
for index, _ in enumerate(contact):
my_contact = contact[0:index]
my_results[my_contact] +=1
for line in sys.stdin.readlines():
operation, contact = line.strip().split... | [
"sys.stdin.readline",
"collections.defaultdict",
"sys.stdin.readlines"
] | [((48, 68), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (66, 68), False, 'import sys\n'), ((82, 98), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (93, 98), False, 'from collections import defaultdict\n'), ((254, 275), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n... |
import copy
from troposphere import (
Ref, FindInMap, Not, Equals, And, Condition, Join, ec2, autoscaling,
If, GetAtt, Output
)
from troposphere import elasticloadbalancing as elb
from troposphere.autoscaling import Tag as ASTag
from troposphere.route53 import RecordSetType
from stacker.blueprints.base import... | [
"troposphere.GetAtt",
"troposphere.Ref",
"stacker.blueprints.variables.types.TroposphereType",
"troposphere.elasticloadbalancing.Listener",
"troposphere.If",
"troposphere.elasticloadbalancing.HealthCheck",
"troposphere.Condition",
"copy.deepcopy",
"troposphere.autoscaling.Tag"
] | [((5543, 5579), 'troposphere.If', 'If', (['"""UseIAMCert"""', 'iam_cert', 'acm_cert'], {}), "('UseIAMCert', iam_cert, acm_cert)\n", (5545, 5579), False, 'from troposphere import Ref, FindInMap, Not, Equals, And, Condition, Join, ec2, autoscaling, If, GetAtt, Output\n'), ((5600, 5621), 'copy.deepcopy', 'copy.deepcopy', ... |
# Generated by Django 2.1.1 on 2019-05-24 00:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0015_auto_20190524_0052'),
]
operations = [
migrations.AlterField(
model_name='post',
name='c... | [
"django.db.models.DateTimeField"
] | [((346, 381), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (366, 381), False, 'from django.db import migrations, models\n')] |
import os
import logging
import requests
import ambari.api as api
from utils.utils import logmethodcall
class RangerRequestError(Exception):
pass
class Ranger:
def __init__(self, request_timeout=10):
self.timeout = request_timeout
self.ranger_schema = os.environ.get('RANGER_SCHEMA', 'http'... | [
"logging.basicConfig",
"logging.getLogger",
"os.environ.get",
"requests.get",
"ambari.api.Api"
] | [((282, 321), 'os.environ.get', 'os.environ.get', (['"""RANGER_SCHEMA"""', '"""http"""'], {}), "('RANGER_SCHEMA', 'http')\n", (296, 321), False, 'import os\n'), ((349, 405), 'os.environ.get', 'os.environ.get', (['"""RANGER_HOST"""', '"""sandbox.hortonworks.com"""'], {}), "('RANGER_HOST', 'sandbox.hortonworks.com')\n", ... |
import os
import numpy as np
import csv
import matplotlib.pyplot as plt
from moviepy.editor import *
from matplotlib.image import imsave
import matplotlib
matplotlib.use('Agg')
# import tensorflow as tf
# from stable_baselines.common.callbacks import BaseCallback, EvalCallback
# from stable_baselines.common.vec_env im... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"numpy.ones",
"os.makedirs",
"matplotlib.use",
"matplotlib.pyplot.cm.tab20",
"numpy.std",
"os.path.join",
"matplotlib.pyplot.cm.tab20c",
"matplotlib.image.imsave",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.sum",
"matplotlib.pyplot.figure",
... | [((155, 176), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (169, 176), False, 'import matplotlib\n'), ((1675, 1710), 'os.path.join', 'os.path.join', (['log_dir', '"""best_model"""'], {}), "(log_dir, 'best_model')\n", (1687, 1710), False, 'import os\n'), ((4490, 4504), 'matplotlib.pyplot.close',... |
# Solution of;
# Project Euler Problem 685: Inverse Digit Sum II
# https://projecteuler.net/problem=685
#
# Writing down the numbers which have a digit sum of 10 in ascending order, we
# get:$19, 28, 37, 46,55,64,73,82,91,109, 118,\dots$Let $f(n,m)$ be the
# $m^{\text{th}}$ occurrence of the digit sum $n$. For examp... | [
"timed.caller"
] | [((723, 757), 'timed.caller', 'timed.caller', (['dummy', 'n', 'i', 'prob_id'], {}), '(dummy, n, i, prob_id)\n', (735, 757), False, 'import timed\n')] |
import logging
import signal
import gevent
import msgpack
from zerorpc import Publisher, Puller, Pusher, Server
import numpy as np
import jsonpickle
from .store import store
from .data import Data
from .operations.operation import Operation
from .utils.singleton import Singleton
__all__ = ['ServerAPI']
class Serve... | [
"zerorpc.Publisher",
"gevent.signal",
"numpy.linspace",
"numpy.random.sample",
"astropy.io.registry.get_formats",
"logging.info",
"gevent.spawn"
] | [((2766, 2777), 'zerorpc.Publisher', 'Publisher', ([], {}), '()\n', (2775, 2777), False, 'from zerorpc import Publisher, Puller, Pusher, Server\n'), ((2984, 3087), 'logging.info', 'logging.info', (['"""Server is now listening on %s and sending on %s."""', 'server_address', 'publisher_address'], {}), "('Server is now li... |
# -*- coding: utf-8 -*-
# Author: t0pep0
# e-mail: <EMAIL>
# Jabber: <EMAIL>
# BTC : 1ipEA2fcVyjiUnBqUx7PVy5efktz2hucb
# donate free =)
# Forked and modified by <NAME>
# Compatible Python3
import hmac
import hashlib
import time
import urllib.request, urllib.parse, urllib.error
import json
class Api(object):
__... | [
"hmac.new",
"time.time"
] | [((963, 1025), 'hmac.new', 'hmac.new', (['byte_secret', 'encode_string'], {'digestmod': 'hashlib.sha256'}), '(byte_secret, encode_string, digestmod=hashlib.sha256)\n', (971, 1025), False, 'import hmac\n'), ((668, 679), 'time.time', 'time.time', ([], {}), '()\n', (677, 679), False, 'import time\n')] |
import numpy as np
from GeneralUtils import list_to_sum
class Fourier:
def __init__(self,amp=[1],freq=[1],ph=[0]):
self.amp = amp
self.freq = freq
self.ph = ph
def __str__(self):
out = []
for i in range(len(self.amp)):
if self.amp[i] != 1:
... | [
"numpy.sin",
"numpy.zeros_like",
"GeneralUtils.list_to_sum"
] | [((966, 982), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (979, 982), True, 'import numpy as np\n'), ((740, 756), 'GeneralUtils.list_to_sum', 'list_to_sum', (['out'], {}), '(out)\n', (751, 756), False, 'from GeneralUtils import list_to_sum\n'), ((1095, 1112), 'numpy.sin', 'np.sin', (['(x * f + p)'], {}),... |
from rest_framework.decorators import api_view
from rest_framework.views import APIView
from rest_framework import status
from rest_framework.response import Response
from .models import Book
from .serializers import BookSerializer
# Create your views here.
class GetAllData(APIView):
def get(self, request):
... | [
"rest_framework.response.Response",
"rest_framework.decorators.api_view"
] | [((500, 517), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (508, 517), False, 'from rest_framework.decorators import api_view\n'), ((753, 771), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (761, 771), False, 'from rest_framework.decorators ... |
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', '... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((308, 350), 'django.conf.urls.url', 'url', (['"""^$"""', '"""polls.views.home"""'], {'name': '"""home"""'}), "('^$', 'polls.views.home', name='home')\n", (311, 350), False, 'from django.conf.urls import include, url\n'), ((442, 487), 'django.conf.urls.url', 'url', (['"""^accounts/login/$"""', '"""polls.views.login"""... |
from functools import partial
from matplotlib.pyplot import xcorr
import numpy as np
import jax
import jax.numpy as jnp
import flax
from flax import linen as nn
import distrax
from .jax_utils import batch_to_jax, extend_and_repeat, next_rng
def update_target_network(main_params, target_params, tau):
return jax.... | [
"flax.linen.Dense",
"jax.nn.initializers.variance_scaling",
"jax.numpy.shape",
"jax.numpy.tanh",
"jax.tree_multimap",
"flax.linen.tanh",
"jax.numpy.concatenate",
"jax.numpy.split",
"distrax.Tanh",
"jax.numpy.clip",
"jax.nn.initializers.orthogonal",
"jax.device_get",
"flax.linen.leaky_relu",
... | [((316, 405), 'jax.tree_multimap', 'jax.tree_multimap', (['(lambda x, y: tau * x + (1.0 - tau) * y)', 'main_params', 'target_params'], {}), '(lambda x, y: tau * x + (1.0 - tau) * y, main_params,\n target_params)\n', (333, 405), False, 'import jax\n'), ((22184, 22243), 'functools.partial', 'partial', (['jax.jit'], {'... |
"""Place fixtures in this file for use across all test files"""
import pytest
@pytest.fixture(scope="function")
def logger(caplog):
caplog.set_level("DEBUG")
return caplog
@pytest.fixture
def log_and_exit_mock(mocker):
return mocker.patch("scripts.generate_pipeline.log_and_exit")
| [
"pytest.fixture"
] | [((81, 113), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (95, 113), False, 'import pytest\n')] |
import numpy as np
import moch
import soch
import os
import sys
import scipy.io
import thorns
def main(parseID):
parseIn = parseID + 'In.mat'
parseOut = parseID + 'Out.mat'
parse = scipy.io.loadmat(parseIn)
os.remove(parseIn)
lagSpace = 1. * parse['lagSpace'] / 1000
parsStruct =... | [
"moch.peripheral",
"moch.peripheralSpikes",
"thorns.show",
"soch.createStimulus",
"thorns.plot_raster",
"moch.subcortical",
"numpy.arange",
"os.remove"
] | [((234, 252), 'os.remove', 'os.remove', (['parseIn'], {}), '(parseIn)\n', (243, 252), False, 'import os\n'), ((2726, 2777), 'numpy.arange', 'np.arange', ([], {'start': 'dti', 'stop': '(duration + dti)', 'step': 'dti'}), '(start=dti, stop=duration + dti, step=dti)\n', (2735, 2777), True, 'import numpy as np\n'), ((3065,... |
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... | [
"cartopy.io.img_tiles.MapboxStyleTiles",
"numpy.testing.assert_array_almost_equal",
"cartopy.io.img_tiles.GoogleTiles",
"cartopy.io.img_tiles.MapQuestOpenAerial",
"shapely.geometry.box",
"cartopy.io.img_tiles.MapboxTiles",
"cartopy.crs.PlateCarree",
"cartopy.io.img_tiles.QuadtreeTiles",
"numpy.array... | [((3086, 3105), 'cartopy.io.img_tiles.GoogleTiles', 'cimgt.GoogleTiles', ([], {}), '()\n', (3103, 3105), True, 'import cartopy.io.img_tiles as cimgt\n'), ((3209, 3242), 'cartopy.io.img_tiles.GoogleTiles', 'cimgt.GoogleTiles', ([], {'style': '"""street"""'}), "(style='street')\n", (3226, 3242), True, 'import cartopy.io.... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | [
"os.path.join",
"subprocess.check_output",
"doctest.testmod",
"argparse.ArgumentParser"
] | [((3736, 3753), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (3751, 3753), False, 'import doctest\n'), ((3820, 3845), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3843, 3845), False, 'import argparse\n'), ((4005, 4050), 'os.path.join', 'os.path.join', (['args.install_dir', 'args.f... |
from tornado.testing import AsyncHTTPTestCase
import unittest
def run_tests(application):
BaseAsyncTest.application = application
BaseAsyncTest.database_name = application.settings['database_name']
BaseAsyncTest.conn = application.settings['conn']
testsuite = unittest.TestLoader().discover('test')
... | [
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((278, 299), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (297, 299), False, 'import unittest\n'), ((328, 364), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (351, 364), False, 'import unittest\n')] |
# C O D E A Z/ Samil
from userbot import BOT_USERNAME
from userbot.events import register
# ██████ LANGUAGE CONSTANTS ██████ #
from userbot.language import get_value
LANG = get_value("__helpme")
# ████████████████████████████████ #
@register(outgoing=True, pattern="^.yard[iı]m|^.help")
async def yardim(event):
... | [
"userbot.events.register",
"userbot.language.get_value"
] | [((177, 198), 'userbot.language.get_value', 'get_value', (['"""__helpme"""'], {}), "('__helpme')\n", (186, 198), False, 'from userbot.language import get_value\n'), ((239, 292), 'userbot.events.register', 'register', ([], {'outgoing': '(True)', 'pattern': '"""^.yard[iı]m|^.help"""'}), "(outgoing=True, pattern='^.yard[i... |
from dataclasses import dataclass
import struct
from typing import Tuple
from plugins.mgba_bridge.script_disassembler.utils import barray_to_u16_hex, u16_to_hex
from plugins.mgba_bridge.script_disassembler.definitions import get_pointer, commands, parameters, get_script_label, used_labels
# Disassembler for tmc scrip... | [
"struct.unpack",
"plugins.mgba_bridge.script_disassembler.utils.barray_to_u16_hex",
"plugins.mgba_bridge.script_disassembler.utils.u16_to_hex"
] | [((1373, 1422), 'struct.unpack', 'struct.unpack', (['"""H"""', 'ctx.data[ctx.ptr:ctx.ptr + 2]'], {}), "('H', ctx.data[ctx.ptr:ctx.ptr + 2])\n", (1386, 1422), False, 'import struct\n'), ((1834, 1883), 'struct.unpack', 'struct.unpack', (['"""H"""', 'ctx.data[ctx.ptr:ctx.ptr + 2]'], {}), "('H', ctx.data[ctx.ptr:ctx.ptr + ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"django.http.JsonResponse",
"gcloud.contrib.analysis.analyse_items.task_flow_instance.dispatch",
"ujson.loads",
"gcloud.apigw.decorators.api_verify_proj_perms",
"gcloud.apigw.views.utils.logger.error"
] | [((1564, 1618), 'gcloud.apigw.decorators.api_verify_proj_perms', 'api_verify_proj_perms', (['[project_resource.actions.view]'], {}), '([project_resource.actions.view])\n', (1585, 1618), False, 'from gcloud.apigw.decorators import api_verify_proj_perms\n'), ((3069, 3115), 'gcloud.contrib.analysis.analyse_items.task_flow... |
# -*- coding: utf-8 -
#
# This file is part of gaffer. See the NOTICE for more information.
import os
import time
import pytest
import pyuv
from gaffer import __version__
from gaffer.manager import Manager
from gaffer.http_handler import HttpEndpoint, HttpHandler
from gaffer.httpclient import (Server, Process, Proce... | [
"gaffer.http_handler.HttpHandler",
"test_manager.dummy_cmd",
"gaffer.manager.Manager",
"time.sleep",
"pyuv.Timer",
"gaffer.http_handler.HttpEndpoint",
"pytest.raises",
"os.getpid",
"gaffer.httpclient.Server"
] | [((554, 604), 'gaffer.http_handler.HttpEndpoint', 'HttpEndpoint', ([], {'uri': "('%s:%s' % (TEST_HOST, TEST_PORT))"}), "(uri='%s:%s' % (TEST_HOST, TEST_PORT))\n", (566, 604), False, 'from gaffer.http_handler import HttpEndpoint, HttpHandler\n'), ((624, 662), 'gaffer.http_handler.HttpHandler', 'HttpHandler', ([], {'endp... |
from app import app
from flask import render_template, redirect, session, request, send_from_directory
from app import models, db, reqs
from flask_socketio import SocketIO, emit
import json
from xhtml2pdf import pisa
import os
from datetime import datetime
socketio = SocketIO(app)
if __name__ == '__main__':
socke... | [
"xhtml2pdf.pisa.CreatePDF",
"app.db.session.commit",
"flask.render_template",
"app.models.Item.query.all",
"app.models.Stock.query.filter_by",
"app.models.Item_groups.query.filter_by",
"app.models.Carrier.query.filter_by",
"app.models.Contacts.query.all",
"app.models.User",
"flask_socketio.SocketI... | [((269, 282), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (277, 282), False, 'from flask_socketio import SocketIO, emit\n'), ((4374, 4388), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (4383, 4388), False, 'from app import app\n'), ((4390, 4409), 'app.app.route', 'app.route', (['"""/... |
import numpy as np
x = np.array([0,1])
w = np.array([0.5,0.5])
b = -0.7
print(w*x)
print(np.sum(w*x))
print(np.sum(w*x)+b)
def AND(x1,x2):
x = np.array([x1,x2])
w = np.array([0.5,0.5])
b = -0.7
tmp = np.sum(w*x)+b
if tmp <= 0:
return 0
else:
return 1
def NAND(x1,x2):
x = n... | [
"numpy.array",
"numpy.sum"
] | [((23, 39), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (31, 39), True, 'import numpy as np\n'), ((43, 63), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (51, 63), True, 'import numpy as np\n'), ((90, 103), 'numpy.sum', 'np.sum', (['(w * x)'], {}), '(w * x)\n', (96, 103), True, 'impo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(
in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
s... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear"
] | [((216, 302), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=\n False)\n', (225, 302), True, 'import torch.nn as nn\n'), ((330, 352), 'torch.nn.BatchNorm2d',... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Detectron2 training script with a plain training loop.
This script reads a given config file and runs the training or evaluation.
It is an entry point that is able to train standard models in detectron2.
In order to let one script support tr... | [
"logging.getLogger",
"detectron2.evaluation.print_csv_format",
"detectron2.evaluation.COCOPanopticEvaluator",
"torch.cuda.device_count",
"torch.cuda.synchronize",
"torch.cuda.is_available",
"datetime.timedelta",
"detectron2.utils.events.EventStorage",
"detectron2.evaluation.COCOEvaluator",
"detect... | [((2282, 2313), 'logging.getLogger', 'logging.getLogger', (['"""detectron2"""'], {}), "('detectron2')\n", (2299, 2313), False, 'import logging\n'), ((4348, 4381), 'detectron2.evaluation.DatasetEvaluators', 'DatasetEvaluators', (['evaluator_list'], {}), '(evaluator_list)\n', (4365, 4381), False, 'from detectron2.evaluat... |
"""
Author: <NAME>, Rice ECE (nkg2 at rice.edu)
Code for converting ocean drifter data from Schaub's format to ours.
"""
import h5py
from trajectory_analysis.synthetic_data_gen import *
dataset_folder = 'buoy'
f = h5py.File('dataBuoys.jld2', 'r')
print(f.keys())
### Load arrays from file
## Graph
# elist (edge l... | [
"h5py.File"
] | [((218, 250), 'h5py.File', 'h5py.File', (['"""dataBuoys.jld2"""', '"""r"""'], {}), "('dataBuoys.jld2', 'r')\n", (227, 250), False, 'import h5py\n')] |
import os
import csv
pollresults = os.path.join(".","raw_data","election_data_1.csv")
output = os.path.join(".","results.txt")
with open(pollresults, newline = '') as polldata:
pollreader = csv.reader(polldata, delimiter = ",")
firstline = polldata.readline()
votes = 0
poll_results = {}
for row... | [
"os.path.join",
"csv.reader"
] | [((36, 88), 'os.path.join', 'os.path.join', (['"""."""', '"""raw_data"""', '"""election_data_1.csv"""'], {}), "('.', 'raw_data', 'election_data_1.csv')\n", (48, 88), False, 'import os\n'), ((96, 128), 'os.path.join', 'os.path.join', (['"""."""', '"""results.txt"""'], {}), "('.', 'results.txt')\n", (108, 128), False, 'i... |
# !/usr/bin/env python
#
# dates.py
"""
Utilities for working with dates and times.
.. extras-require:: dates
:pyproject:
**Data:**
.. autosummary::
~domdf_python_tools.dates.months
~domdf_python_tools.dates.month_full_names
~domdf_python_tools.dates.month_short_names
"""
#
# Copyright © 2020 <NAME> <<EMAI... | [
"pytz.timezone",
"collections.OrderedDict",
"datetime.datetime.fromtimestamp",
"datetime.datetime.utcnow",
"domdf_python_tools.words.word_join",
"datetime.datetime.now",
"datetime.date"
] | [((4909, 5100), 'collections.OrderedDict', 'OrderedDict', ([], {'Jan': '"""January"""', 'Feb': '"""February"""', 'Mar': '"""March"""', 'Apr': '"""April"""', 'May': '"""May"""', 'Jun': '"""June"""', 'Jul': '"""July"""', 'Aug': '"""August"""', 'Sep': '"""September"""', 'Oct': '"""October"""', 'Nov': '"""November"""', 'De... |
'''
Copyright 2013 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicens... | [
"mock.Mock",
"sqlalchemy.schema.Column",
"fantastico.mvc.models.model_filter_compound.ModelFilterOr",
"fantastico.mvc.models.model_filter.ModelFilter"
] | [((1737, 1743), 'mock.Mock', 'Mock', ([], {}), '()\n', (1741, 1743), False, 'from mock import Mock\n'), ((1769, 1790), 'sqlalchemy.schema.Column', 'Column', (['"""id"""', 'Integer'], {}), "('id', Integer)\n", (1775, 1790), False, 'from sqlalchemy.schema import Column\n'), ((3092, 3098), 'mock.Mock', 'Mock', ([], {}), '... |
import json
import os
class Notifyer():
def __init__(self):
self.subscribers = []
def add_subscriber(self, subscriber):
self.subscribers.append(subscriber)
def notify(self, triggerId):
for sub in self.subscribers:
sub.notify(triggerId)
global_characters = []
global_it... | [
"json.load",
"os.system"
] | [((5241, 5257), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (5250, 5257), False, 'import os\n'), ((4385, 4407), 'json.load', 'json.load', (['layout_file'], {}), '(layout_file)\n', (4394, 4407), False, 'import json\n')] |
"""
Added DAG master table and DAG permissions table
Revision ID: f3bee20314a2
Revises: <KEY>
Create Date: 2021-12-14 14:41:16.096297
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f3bee20314a2"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.TEXT",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String"
] | [((1666, 1697), 'alembic.op.drop_table', 'op.drop_table', (['"""permission_dag"""'], {}), "('permission_dag')\n", (1679, 1697), False, 'from alembic import op\n'), ((1702, 1732), 'alembic.op.drop_table', 'op.drop_table', (['"""deployed_dags"""'], {}), "('deployed_dags')\n", (1715, 1732), False, 'from alembic import op\... |
__author__ = "<NAME>, <NAME> and <NAME>"
__version__ = "0.0.1"
__license__ = "BSD"
from autoPyTorch.core.api import AutoNet
class AutoNetFeatureData(AutoNet):
@classmethod
def get_default_pipeline(cls):
from autoPyTorch.pipeline.base.pipeline import Pipeline
from autoPyTorch.pipeline.nodes.a... | [
"autoPyTorch.pipeline.nodes.log_functions_selector.LogFunctionsSelector",
"autoPyTorch.pipeline.nodes.network_selector.NetworkSelector",
"autoPyTorch.pipeline.nodes.metric_selector.MetricSelector",
"autoPyTorch.pipeline.nodes.preprocessor_selector.PreprocessorSelector.get_name",
"autoPyTorch.pipeline.nodes.... | [((4122, 4153), 'autoPyTorch.pipeline.nodes.preprocessor_selector.PreprocessorSelector.get_name', 'PreprocessorSelector.get_name', ([], {}), '()\n', (4151, 4153), False, 'from autoPyTorch.pipeline.nodes.preprocessor_selector import PreprocessorSelector\n'), ((4515, 4555), 'autoPyTorch.pipeline.nodes.normalization_strat... |
from typing import List, Optional
from fastapi.encoders import jsonable_encoder
from sqlalchemy.sql.expression import true
from .models import IncidentPriority, IncidentPriorityCreate, IncidentPriorityUpdate
def get(*, db_session, incident_priority_id: int) -> Optional[IncidentPriority]:
"""Returns an incident ... | [
"sqlalchemy.sql.expression.true",
"fastapi.encoders.jsonable_encoder"
] | [((1868, 1903), 'fastapi.encoders.jsonable_encoder', 'jsonable_encoder', (['incident_priority'], {}), '(incident_priority)\n', (1884, 1903), False, 'from fastapi.encoders import jsonable_encoder\n'), ((692, 698), 'sqlalchemy.sql.expression.true', 'true', ([], {}), '()\n', (696, 698), False, 'from sqlalchemy.sql.express... |
#!/usr/bin/env python3
from functools import partial
def combine(qubit_count, gates):
return [partial(g, i) for g in gates for i in range(qubit_count)]
def repeat_none(index, count):
return [partial(apply_none, index)] * count
def apply_none(index, circuit):
pass
def apply_not(index, circuit):
qr... | [
"functools.partial"
] | [((102, 115), 'functools.partial', 'partial', (['g', 'i'], {}), '(g, i)\n', (109, 115), False, 'from functools import partial\n'), ((204, 230), 'functools.partial', 'partial', (['apply_none', 'index'], {}), '(apply_none, index)\n', (211, 230), False, 'from functools import partial\n')] |
import sys
from itertools import chain
from pathlib import Path
import pytest
import acconeer.exptool as et
HERE = Path(__file__).parent
path = (HERE / ".." / ".." / "utils").resolve()
sys.path.append(path.as_posix())
from convert_to_csv import record_to_csv # noqa: E402
@pytest.mark.parametrize("test_file", ch... | [
"convert_to_csv.record_to_csv",
"acconeer.exptool.recording.load",
"pytest.skip",
"pathlib.Path"
] | [((119, 133), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (123, 133), False, 'from pathlib import Path\n'), ((571, 599), 'acconeer.exptool.recording.load', 'et.recording.load', (['test_file'], {}), '(test_file)\n', (588, 599), True, 'import acconeer.exptool as et\n'), ((797, 818), 'convert_to_csv.record... |
"""
Copyright (c) Django Software Foundation and individual contributors.
Copyright (c) Dependable Systems Laboratory, EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of sour... | [
"importlib.import_module",
"s2e_env.utils.log.configure_logging",
"s2e_env.command.CommandParser",
"os.path.dirname",
"sys.stderr.write",
"os.path.basename",
"sys.exit",
"pkgutil.iter_modules"
] | [((1795, 1820), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1810, 1820), False, 'import os\n'), ((2393, 2444), 'importlib.import_module', 'importlib.import_module', (['f"""s2e_env.commands.{name}"""'], {}), "(f's2e_env.commands.{name}')\n", (2416, 2444), False, 'import importlib\n'), ((67... |
import tensorflow as tf
def cosine_similarity(x, y, eps=1e-6):
z = tf.batch_matmul(x, tf.transpose(y, perm=[0,2,1]))
z /= tf.sqrt(tf.multiply(tf.expand_dims(tf.reduce_sum(tf.multiply(x,x), 2), 2),tf.expand_dims(tf.reduce_sum(tf.multiply(y,y), 2), 1)) + eps)
return z
| [
"tensorflow.multiply",
"tensorflow.transpose"
] | [((88, 119), 'tensorflow.transpose', 'tf.transpose', (['y'], {'perm': '[0, 2, 1]'}), '(y, perm=[0, 2, 1])\n', (100, 119), True, 'import tensorflow as tf\n'), ((174, 191), 'tensorflow.multiply', 'tf.multiply', (['x', 'x'], {}), '(x, x)\n', (185, 191), True, 'import tensorflow as tf\n'), ((228, 245), 'tensorflow.multiply... |
#!/usr/bin/env python3
#
# Copyright (c) 2019 LG Electronics, Inc.
#
# This software contains code licensed as described in LICENSE.
#
import os
import lgsvl
sim = lgsvl.Simulator(os.environ.get("SIMULATOR_HOST", "127.0.0.1"), 8181)
if sim.current_scene == "BorregasAve":
sim.reset()
else:
sim.load("BorregasAve")
... | [
"lgsvl.utils.transform_to_up",
"os.environ.get",
"lgsvl.utils.transform_to_forward",
"lgsvl.utils.transform_to_right",
"lgsvl.AgentState"
] | [((409, 427), 'lgsvl.AgentState', 'lgsvl.AgentState', ([], {}), '()\n', (425, 427), False, 'import lgsvl\n'), ((466, 515), 'lgsvl.utils.transform_to_forward', 'lgsvl.utils.transform_to_forward', (['state.transform'], {}), '(state.transform)\n', (498, 515), False, 'import lgsvl\n'), ((524, 571), 'lgsvl.utils.transform_t... |
import argparse, sys
__version__ = '1.0.2'
class CSArgParser(argparse.ArgumentParser):
""" Argument parser that shows help if there is an error """
def error(self, message, exit=False):
sys.stderr.write('Error: {}\n'.format(message))
self.print_help()
if exit:
sys.exit(2)
| [
"sys.exit"
] | [((308, 319), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (316, 319), False, 'import argparse, sys\n')] |
"""Sensor platform for Google Home"""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, STATE_UNAVAILABLE
from homeassistant.core import HomeAssistant
from homeassistant.helpers impor... | [
"logging.getLogger",
"voluptuous.Required",
"homeassistant.helpers.entity_platform.current_platform.get"
] | [((1160, 1190), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (1177, 1190), False, 'import logging\n'), ((2382, 2420), 'homeassistant.helpers.entity_platform.current_platform.get', 'entity_platform.current_platform.get', ([], {}), '()\n', (2418, 2420), False, 'from homeassistant.he... |
import redis
import json
from . import config
redis_instance = None
def set_up(host, port, db):
global redis_instance
redis_instance = redis.StrictRedis(host=host, port=port, db=db)
class ModuleStorage():
def __init__(self, module_id):
self.key_prefix = "module:" + config.config.enabled_modules... | [
"json.loads",
"json.dumps",
"redis.StrictRedis"
] | [((146, 192), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': 'host', 'port': 'port', 'db': 'db'}), '(host=host, port=port, db=db)\n', (163, 192), False, 'import redis\n'), ((645, 666), 'json.loads', 'json.loads', (['data_json'], {}), '(data_json)\n', (655, 666), False, 'import json\n'), ((751, 778), 'json.dump... |
#!/usr/bin/env python
import argparse
import os
import sys
import pickle
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('filename')
args = parser.parse_args()
if os.path.splitext(args.filename)[1] != '.abc':
# We can not read this file type
sys.exit(... | [
"os.path.splitext",
"pickle.load",
"argparse.ArgumentParser",
"sys.exit"
] | [((115, 140), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (138, 140), False, 'import argparse\n'), ((311, 322), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (319, 322), False, 'import sys\n'), ((379, 393), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (390, 393), False, 'import pick... |
"""=========================================
Read Mapping parameter titration pipeline
=========================================
* align reads to the genome using a range of different parameters
* calculate alignment statistics
Requirements
------------
On top of the default CGAT setup, the pipeline requires ... | [
"CGATPipelines.Pipeline.main",
"os.path.exists",
"CGATPipelines.Pipeline.run",
"CGATPipelines.PipelineMapping.Bowtie",
"os.path.splitext",
"CGATPipelines.Pipeline.getTempFile",
"CGATPipelines.Pipeline.toTable",
"CGAT.Experiment.info",
"os.unlink",
"CGATPipelines.Pipeline.run_report",
"pysam.Samf... | [((4096, 4120), 'CGATPipelines.PipelineMapping.Bowtie', 'PipelineMapping.Bowtie', ([], {}), '()\n', (4118, 4120), True, 'import CGATPipelines.PipelineMapping as PipelineMapping\n'), ((4261, 4268), 'CGATPipelines.Pipeline.run', 'P.run', ([], {}), '()\n', (4266, 4268), True, 'import CGATPipelines.Pipeline as P\n'), ((454... |
from src.deployment import Deployment
from src.end_point import EndPoint
from src.etcd import Etcd
from src.pod import Pod
from src.pid_controller import PIDController
from src.request import Request
from src.worker_node import WorkerNode
import threading
import random
#The APIServer handles the communication between ... | [
"src.etcd.Etcd",
"src.end_point.EndPoint",
"threading.Lock",
"src.pod.Pod",
"threading.Event",
"src.deployment.Deployment",
"src.worker_node.WorkerNode",
"src.pid_controller.PIDController",
"src.request.Request",
"random.randint"
] | [((491, 497), 'src.etcd.Etcd', 'Etcd', ([], {}), '()\n', (495, 497), False, 'from src.etcd import Etcd\n'), ((516, 532), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (530, 532), False, 'import threading\n'), ((582, 599), 'threading.Event', 'threading.Event', ([], {}), '()\n', (597, 599), False, 'import threadi... |
import new_module as nm
if __name__ == '__main__':
nm.say_hi() | [
"new_module.say_hi"
] | [((56, 67), 'new_module.say_hi', 'nm.say_hi', ([], {}), '()\n', (65, 67), True, 'import new_module as nm\n')] |
import gzip
import pickle
import os
def analyze(data_path):
"""
Run the comparison on the given data file
:param data_path:
:return:
"""
if data_path.endswith(".gz"):
with gzip.open(data_path, 'r') as f:
S, true_model = pickle.load(f)
else:
with open(data_path... | [
"pickle.load",
"os.path.join",
"gzip.open"
] | [((724, 801), 'os.path.join', 'os.path.join', (['"""data"""', '"""synthetic"""', "('synthetic_K%d_C%d_T%d.pkl.gz' % (K, C, T))"], {}), "('data', 'synthetic', 'synthetic_K%d_C%d_T%d.pkl.gz' % (K, C, T))\n", (736, 801), False, 'import os\n'), ((208, 233), 'gzip.open', 'gzip.open', (['data_path', '"""r"""'], {}), "(data_p... |
# Run Keras on CPU
import os
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
# os.environ["CUDA_VISIBLE_DEVICES"] = " " # -1 if CPU
# Importations
from IPython.display import Image
# Compressed pickle
import pickle
from compress_pickle import dump as cdump
from compress_pickle import load ... | [
"sys.path.append"
] | [((2066, 2087), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (2081, 2087), False, 'import sys\n')] |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"logging.getLogger",
"openstack_dashboard.test.integration_tests.pages.loginpage.LoginPage"
] | [((742, 769), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (759, 769), False, 'import logging\n'), ((819, 874), 'openstack_dashboard.test.integration_tests.pages.loginpage.LoginPage', 'loginpage.LoginPage', (['test_case.driver', 'test_case.CONFIG'], {}), '(test_case.driver, test_case.CO... |
#!/usr/bin/env python
"""
Computer practical 6.1. Fresnel diffraction, plane wavefront.
=============================================================
This is part of the 'computer practical' set of assignments.
Demonstrates Fresnel diffraction when a plane wavefront enters
a round hole.
Measur... | [
"matplotlib.use",
"webbrowser.open_new",
"matplotlib.pyplot.figure",
"tkinter.Tk",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] | [((486, 509), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (500, 509), False, 'import matplotlib\n'), ((805, 812), 'tkinter.Tk', 'Tk.Tk', ([], {}), '()\n', (810, 812), True, 'import tkinter as Tk\n'), ((1088, 1114), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(fi... |
"""Router and Logic for the Recipe of the Website"""
from datetime import timedelta
from typing import Union
import fastapi
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session
from starlette.requests import Request
from starlette.templating import Jinja2Templates
from db.database import get_... | [
"schemes.scheme_cuisine.PydanticCuisine",
"services.service_rec.search_recipe",
"fastapi.APIRouter",
"datetime.timedelta",
"starlette.templating.Jinja2Templates",
"fastapi.Depends"
] | [((520, 548), 'starlette.templating.Jinja2Templates', 'Jinja2Templates', (['"""templates"""'], {}), "('templates')\n", (535, 548), False, 'from starlette.templating import Jinja2Templates\n'), ((558, 577), 'fastapi.APIRouter', 'fastapi.APIRouter', ([], {}), '()\n', (575, 577), False, 'import fastapi\n'), ((762, 785), '... |
print("From python: Within python module")
import os,sys
HERE = os.getcwd()
sys.path.insert(0,HERE)
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
data_array = np.zeros(shape=(2001,258)) # Very important that this matches the number of timesteps in the main solver
x = np.arange(start=0,st... | [
"sys.path.insert",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.getcwd",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.matmul",
"numpy.linalg.svd",
"matplotlib.pyplot.title",
"numpy.shape",
... | [((65, 76), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (74, 76), False, 'import os, sys\n'), ((77, 101), 'sys.path.insert', 'sys.path.insert', (['(0)', 'HERE'], {}), '(0, HERE)\n', (92, 101), False, 'import os, sys\n'), ((191, 218), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2001, 258)'}), '(shape=(2001, 258))\n', (1... |
""" This is a forms.py that helps to work on the payload of front-end """
from django import forms
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from django.forms import ModelForm
from django.forms.models import inlineformse... | [
"django.forms.models.inlineformset_factory"
] | [((838, 985), 'django.forms.models.inlineformset_factory', 'inlineformset_factory', (['Evaluation', 'EvaluationSkill'], {'form': 'EvaluationSkillForm', 'fields': "['evaluation', 'skill', 'grade']", 'extra': '(1)', 'can_delete': '(True)'}), "(Evaluation, EvaluationSkill, form=EvaluationSkillForm,\n fields=['evaluatio... |
# Copyright 2015 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 a... | [
"imperative.Env",
"tensorflow.python.ops.math_ops.round",
"pdb.post_mortem",
"tensorflow.python.ops.math_ops.reduce_sum",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.ops.math_ops.squared_difference",
"numpy.array",
"sys.exc_info",
"tensorflow.python.platform.googletest.mai... | [((1291, 1309), 'imperative.Env', 'imperative.Env', (['tf'], {}), '(tf)\n', (1305, 1309), False, 'import imperative\n'), ((3592, 3609), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (3607, 3609), False, 'from tensorflow.python.platform import googletest\n'), ((1439, 1487), 'numpy.ar... |
import keyboard
from logparser import parselog, validate_log
import os
from psutil import process_iter
from pyautogui import click
import subprocess
from turnhandler import backupturn, clonegame, cleanturns, delete_log, delete_temp
import yaml
from time import sleep
import threading
import time
import win32gui
import w... | [
"turnhandler.backupturn",
"yaml.load",
"logparser.parselog",
"win32gui.SetForegroundWindow",
"subprocess.Popen",
"pyautogui.click",
"turnhandler.clonegame",
"keyboard.press_and_release",
"os.system",
"win32gui.PostMessage",
"turnhandler.delete_log",
"os.path.getmtime",
"threading.Thread",
... | [((1370, 1407), 'win32gui.ClientToScreen', 'win32gui.ClientToScreen', (['hwnd', '(0, 0)'], {}), '(hwnd, (0, 0))\n', (1393, 1407), False, 'import win32gui\n'), ((1465, 1490), 'pyautogui.click', 'click', (['(x + 400, y + 280)'], {}), '((x + 400, y + 280))\n', (1470, 1490), False, 'from pyautogui import click\n'), ((1718,... |
"""
this script contains the function to compute z from sparse v , pi and w
"""
import torch
from estimation.truncated_poisson import TruncatedPoisson
def compute_z(log_w: torch.tensor, pi: torch.sparse, c: torch.sparse):
"""
This function computes the class indicators given cluster proportion vector pi and ... | [
"torch.index_select",
"torch.log",
"torch.exp",
"torch.where"
] | [((999, 1068), 'torch.where', 'torch.where', (['(indices_0 == indices_1)', 'poisson_para', '(poisson_para * 2.0)'], {}), '(indices_0 == indices_1, poisson_para, poisson_para * 2.0)\n', (1010, 1068), False, 'import torch\n'), ((631, 670), 'torch.index_select', 'torch.index_select', (['log_w', '(1)', 'indices_0'], {}), '... |
# Third-party modules
try:
import simplejson as json
except ImportError:
import json
import sqlalchemy
from sqlalchemy.ext import mutable
# Custom modules
from . import track
class NestedMutable(mutable.MutableDict, track.TrackedDict):
"""SQLAlchemy `mutable` extension dictionary with nested change tracking."... | [
"sqlalchemy.ext.mutable.MutableDict.associate_with",
"json.dumps",
"json.loads"
] | [((1292, 1338), 'sqlalchemy.ext.mutable.MutableDict.associate_with', 'mutable.MutableDict.associate_with', (['JsonObject'], {}), '(JsonObject)\n', (1326, 1338), False, 'from sqlalchemy.ext import mutable\n'), ((961, 978), 'json.dumps', 'json.dumps', (['value'], {}), '(value)\n', (971, 978), False, 'import json\n'), ((1... |
import cupy as cp
from csrc.activation import SoftMax
from csrc.layers.layer import Layer
# Cu sinapsa comparativa GPU
from csrc.comp_syn import cp_comp
class C2FullyConnected(Layer):
"""Densely connected layer (comparative).
Attributes
----------
size : int
Number of neurons.
activa... | [
"csrc.comp_syn.cp_comp",
"cupy.sqrt",
"cupy.dot",
"cupy.random.randn",
"cupy.zeros"
] | [((3326, 3344), 'cupy.dot', 'cp.dot', (['dz', 'self.w'], {}), '(dz, self.w)\n', (3332, 3344), True, 'import cupy as cp\n'), ((1261, 1286), 'csrc.comp_syn.cp_comp', 'cp_comp', (['a_prev', 'self.w.T'], {}), '(a_prev, self.w.T)\n', (1268, 1286), False, 'from csrc.comp_syn import cp_comp\n'), ((2110, 2130), 'cupy.dot', 'cp... |
"""LiveSimulator: This class reads in various Bro IDS logs. The class utilizes
the BroLogReader and simply loops over the static bro log
file, replaying rows and changing any time stamps
Args:
eps (int): Events Per Second that the simulator will emit events (default... | [
"brothon.bro_log_reader.BroLogReader",
"brothon.utils.file_utils.relative_dir",
"os.path.join",
"datetime.datetime.utcnow"
] | [((2786, 2830), 'brothon.utils.file_utils.relative_dir', 'file_utils.relative_dir', (['__file__', '"""../data"""'], {}), "(__file__, '../data')\n", (2809, 2830), False, 'from brothon.utils import file_utils\n'), ((2847, 2882), 'os.path.join', 'os.path.join', (['data_path', '"""conn.log"""'], {}), "(data_path, 'conn.log... |
import jq
from dotenv import load_dotenv
from gh_projects import (
update_project_with_repo_issues,
fetch_all_issues,
push_issues_to_project_next,
)
load_dotenv()
PROJECT_ID = "PN_kwHOACdIos4AAto7"
# fetch_project_item_issue_ids("PN_kwHOACdIos4AAYbQ")
all_issues = fetch_all_issues("machow", "pins-pyth... | [
"gh_projects.push_issues_to_project_next",
"gh_projects.update_project_with_repo_issues",
"dotenv.load_dotenv",
"jq.compile",
"gh_projects.fetch_all_issues"
] | [((164, 177), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (175, 177), False, 'from dotenv import load_dotenv\n'), ((283, 359), 'gh_projects.fetch_all_issues', 'fetch_all_issues', (['"""machow"""', '"""pins-python"""', "['projectNext(number: 1) { id }']"], {}), "('machow', 'pins-python', ['projectNext(number:... |
import nltk
from nltk import word_tokenize
def create_POS_tags(sentence):
parsedSentence = word_tokenize(sentence)
return nltk.pos_tag(parsedSentence)
| [
"nltk.pos_tag",
"nltk.word_tokenize"
] | [((97, 120), 'nltk.word_tokenize', 'word_tokenize', (['sentence'], {}), '(sentence)\n', (110, 120), False, 'from nltk import word_tokenize\n'), ((133, 161), 'nltk.pos_tag', 'nltk.pos_tag', (['parsedSentence'], {}), '(parsedSentence)\n', (145, 161), False, 'import nltk\n')] |
import matplotlib.pyplot as plt
import numpy.random as rnd
from matplotlib.patches import Ellipse
NUM = 250
ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360)
for i in range(NUM)]
fig = plt.figure(0)
ax = fig.add_subplot(111, aspect='equal')
for e in ells:
ax.ad... | [
"matplotlib.pyplot.figure",
"numpy.random.rand",
"matplotlib.pyplot.show"
] | [((240, 253), 'matplotlib.pyplot.figure', 'plt.figure', (['(0)'], {}), '(0)\n', (250, 253), True, 'import matplotlib.pyplot as plt\n'), ((461, 471), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (469, 471), True, 'import matplotlib.pyplot as plt\n'), ((376, 386), 'numpy.random.rand', 'rnd.rand', ([], {}), '()... |
# <NAME> 1.0 by Adam
# http://robotgame.net/viewrobot/7819
import rg
escapeSquares = []
globTurn = 0
class Robot:
def act(self, game):
# reset the escape squares for this turn
global escapeSquares
global globTurn
if globTurn != game.turn:
globTurn = game.turn
... | [
"rg.loc_types",
"rg.wdist",
"rg.locs_around",
"rg.toward"
] | [((710, 751), 'rg.toward', 'rg.toward', (['self.location', 'rg.CENTER_POINT'], {}), '(self.location, rg.CENTER_POINT)\n', (719, 751), False, 'import rg\n'), ((7400, 7427), 'rg.loc_types', 'rg.loc_types', (['self.location'], {}), '(self.location)\n', (7412, 7427), False, 'import rg\n'), ((8274, 8301), 'rg.loc_types', 'r... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the CLI tools classes."""
import argparse
import io
import sys
import unittest
from plaso.cli import tools
from plaso.lib import errors
from tests.cli import test_lib
class CLIToolTest(test_lib.CLIToolTestCase):
"""Tests for the CLI tool base class."""
_E... | [
"tests.cli.test_lib.TestOutputWriter",
"sys.stdin.encoding.upper",
"argparse.ArgumentParser",
"io.BytesIO",
"plaso.cli.tools.CLITool",
"tests.cli.test_lib.TestOptions",
"unittest.main",
"plaso.cli.tools.StdinInputReader"
] | [((10134, 10149), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10147, 10149), False, 'import unittest\n'), ((1761, 1924), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'u"""tool_test.py"""', 'description': 'u"""Test argument parser."""', 'add_help': '(False)', 'formatter_class': 'argparse.... |
"""
Core implementation of :mod:`sklearndf.transformation.wrapper`
"""
import logging
from abc import ABCMeta, abstractmethod
from typing import Any, Generic, List, Optional, TypeVar, Union
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin
from sklearn.compose import ColumnTransformer
f... | [
"logging.getLogger",
"pandas.Series",
"pandas.Index",
"numpy.argwhere",
"numpy.isnan",
"numpy.all",
"typing.TypeVar"
] | [((679, 706), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (696, 706), False, 'import logging\n'), ((1360, 1408), 'typing.TypeVar', 'TypeVar', (['"""T_Transformer"""'], {'bound': 'TransformerMixin'}), "('T_Transformer', bound=TransformerMixin)\n", (1367, 1408), False, 'from typing impor... |
import re
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import RedirectView
from localshop.apps.packages.xmlrpc import handle_request
admin.autodiscover()
static_prefix = re.escape(settings.STATIC_URL.lstrip('/'))
... | [
"django.conf.urls.url",
"django.conf.urls.include",
"django.conf.settings.STATIC_URL.lstrip",
"django.views.generic.base.RedirectView.as_view",
"django.contrib.admin.autodiscover"
] | [((239, 259), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (257, 259), False, 'from django.contrib import admin\n'), ((287, 318), 'django.conf.settings.STATIC_URL.lstrip', 'settings.STATIC_URL.lstrip', (['"""/"""'], {}), "('/')\n", (313, 318), False, 'from django.conf import settings\n')... |
#!/usr/bin/env python
"""Tests for ais.util."""
import unittest
from ais import util
import six
class UtilTest(unittest.TestCase):
def testMaybeToNumber(self):
self.assertEqual(util.MaybeToNumber(None), None)
self.assertEqual(util.MaybeToNumber([]), [])
self.assertEqual(util.MaybeToNumber({}), {})
... | [
"unittest.main",
"ais.util.MaybeToNumber"
] | [((1134, 1149), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1147, 1149), False, 'import unittest\n'), ((187, 211), 'ais.util.MaybeToNumber', 'util.MaybeToNumber', (['None'], {}), '(None)\n', (205, 211), False, 'from ais import util\n'), ((240, 262), 'ais.util.MaybeToNumber', 'util.MaybeToNumber', (['[]'], {}),... |
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
import matplotlib.pyplot as plt
num = np.array(['3.14','-2.7','30'], dtype=np.string_) #코드 이해 쉽게 : dtype=np.string_
# num=num.astype(int)
# print(num)
# ValueError: invalid literal for int() with base 10: '3.14'
num=num.astype(float).... | [
"pandas.Series",
"pandas.isnull",
"numpy.exp",
"numpy.array",
"pandas.DataFrame",
"random.randint",
"numpy.arange"
] | [((115, 165), 'numpy.array', 'np.array', (["['3.14', '-2.7', '30']"], {'dtype': 'np.string_'}), "(['3.14', '-2.7', '30'], dtype=np.string_)\n", (123, 165), True, 'import numpy as np\n'), ((1457, 1478), 'pandas.Series', 'Series', (['[1, 2, -3, 4]'], {}), '([1, 2, -3, 4])\n', (1463, 1478), False, 'from pandas import Data... |
#! -*- coding: utf-8 -*-
# SimBERT_v2预训练代码stage2,把simbert的相似度蒸馏到roformer-sim上
# 官方项目:https://github.com/ZhuiyiTechnology/roformer-sim
import json
import numpy as np
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
import torch.nn.functional as F
from bert4torch.models import build_trans... | [
"jieba.initialize",
"torch.max",
"bert4torch.tokenizers.Tokenizer",
"torch.cuda.is_available",
"torch.sum",
"bert4torch.snippets.AutoRegressiveDecoder.wraps",
"jieba.lcut",
"torch.mean",
"numpy.random.random",
"torch.matmul",
"torch.ones_like",
"json.loads",
"numpy.random.choice",
"bert4to... | [((533, 551), 'jieba.initialize', 'jieba.initialize', ([], {}), '()\n', (549, 551), False, 'import jieba\n'), ((1057, 1097), 'bert4torch.tokenizers.Tokenizer', 'Tokenizer', (['dict_path'], {'do_lower_case': '(True)'}), '(dict_path, do_lower_case=True)\n', (1066, 1097), False, 'from bert4torch.tokenizers import Tokenize... |
from fastapi import APIRouter
router_helloworld = APIRouter()
@router_helloworld.get("/")
def get_helloworld():
return {"Hello": "World"}
| [
"fastapi.APIRouter"
] | [((51, 62), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (60, 62), False, 'from fastapi import APIRouter\n')] |
from random import sample, randint
"""
Randomizer for available lists
plus radio broadcasting randomizer
"""
# Available lists randomizer class
class Randomize_and_pop_on_call:
"""
Randomize given array and on call pop given value from array.
If array is empty - returns None
"""
# created only to ea... | [
"random.randint"
] | [((600, 613), 'random.randint', 'randint', (['(1)', '(4)'], {}), '(1, 4)\n', (607, 613), False, 'from random import sample, randint\n')] |
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
x = 0
y = 0
# use a (r, g, b) tuple for color
yellow = (255, 255, 0)
# create the basic window/screen and a title/caption
# default is a black background
screen = pygame.display.set_mode((640, 280))
pygame.... | [
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock",
"pygame.key.get_pressed",
"pygame.display.set_caption",
"pygame.font.SysFont"
] | [((26, 39), 'pygame.init', 'pygame.init', ([], {}), '()\n', (37, 39), False, 'import pygame\n'), ((49, 84), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(640, 480)'], {}), '((640, 480))\n', (72, 84), False, 'import pygame\n'), ((93, 112), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (110, 112... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME> and <NAME>.
JRC Biomass Project.
Unit D1 Bioeconomy.
This script will rename the header column of the file:
* /common/associations.csv
Before running this script the headers are simply "A", "B", "C".
After running this script, the new headers wi... | [
"tqdm.tqdm"
] | [((1391, 1405), 'tqdm.tqdm', 'tqdm', (['renamers'], {}), '(renamers)\n', (1395, 1405), False, 'from tqdm import tqdm\n')] |
# https://www.hackerrank.com/challenges/matching-anything-but-new-line/problem
import re
# Inputs
standard_input = """123.456.abc.def"""
regex_pattern = r".{3}\..{3}\..{3}\..{3}$" # Do not delete 'r'.
test_string = input()
# 123.456.abc.def
match = re.match(regex_pattern, test_string) is not None
print(str(m... | [
"re.match"
] | [((259, 295), 're.match', 're.match', (['regex_pattern', 'test_string'], {}), '(regex_pattern, test_string)\n', (267, 295), False, 'import re\n')] |
import time
import numpy as np
import tensorflow as tf
from yalenet import YaleNet
from Mybase.solver import Solver
"""
def test():
mdl = YaleNet(cls_num=1000, reg=1e-4, typ=tf.float32)
sov = Solver(mdl,
opm_cfg={
'lr_base': 0.005,
'decay_rul... | [
"yalenet.YaleNet",
"Mybase.solver.Solver"
] | [((1587, 1634), 'yalenet.YaleNet', 'YaleNet', ([], {'cls_num': '(21)', 'reg': '(0.0001)', 'typ': 'tf.float32'}), '(cls_num=21, reg=0.0001, typ=tf.float32)\n', (1594, 1634), False, 'from yalenet import YaleNet\n'), ((1643, 2149), 'Mybase.solver.Solver', 'Solver', (['mdl'], {'opm_cfg': "{'lr_base': 1e-05, 'decay_rule': '... |