code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# 4.4.3 ガウス混合モデルにおける推論:変分推論
#%%
# 4.4.3項で利用するライブラリ
import numpy as np
from scipy.stats import multivariate_normal # 多次元ガウス分布
from scipy.special import psi # ディガンマ関数
import matplotlib.pyplot as plt
#%%
## 観測モデルの設定
# 次元数を設定:(固定)
D = 2
# クラスタ数を指定
K = 3
# K個の真の平均を指定
mu_truth_kd = np.array(
[[5.0, 35.0],
[-... | [
"matplotlib.pyplot.title",
"numpy.sum",
"numpy.argmax",
"matplotlib.pyplot.suptitle",
"numpy.empty",
"numpy.random.multinomial",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"numpy.round",
"numpy.meshgrid",
"numpy.identity",
"matplotlib.pyp... | [((284, 338), 'numpy.array', 'np.array', (['[[5.0, 35.0], [-20.0, -10.0], [30.0, -20.0]]'], {}), '([[5.0, 35.0], [-20.0, -10.0], [30.0, -20.0]])\n', (292, 338), True, 'import numpy as np\n'), ((395, 509), 'numpy.array', 'np.array', (['[[[250.0, 65.0], [65.0, 270.0]], [[125.0, -45.0], [-45.0, 175.0]], [[210.0,\n -15.... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v2ray.com/core/common/net/destination.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf impor... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.descriptor.FileDescriptor"
] | [((405, 431), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (429, 431), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((673, 1564), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""v2ray.com/core/common/... |
import Arena
from MCTS import MCTS
from kindo.KindoGame import KindoGame
from kindo.KindoPlayers import *
from kindo.pytorch.NNet import NNetWrapper as NNet
import numpy as np
from utils import *
"""
use this script to play any two agents against each other, or play manually with
any agent.
"""
# Play in 4x4 instead ... | [
"Arena.Arena",
"kindo.KindoGame.KindoGame"
] | [((1848, 1907), 'Arena.Arena', 'Arena.Arena', (['player1', 'player2', 'g'], {'display': 'KindoGame.display'}), '(player1, player2, g, display=KindoGame.display)\n', (1859, 1907), False, 'import Arena\n'), ((475, 487), 'kindo.KindoGame.KindoGame', 'KindoGame', (['(4)'], {}), '(4)\n', (484, 487), False, 'from kindo.Kindo... |
# Copyright 2018 Orange
#
# 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 t... | [
"logging.getLogger",
"octant.datalog.operations.is_primitive"
] | [((6200, 6229), 'octant.datalog.operations.is_primitive', 'operations.is_primitive', (['atom'], {}), '(atom)\n', (6223, 6229), False, 'from octant.datalog import operations\n'), ((2513, 2542), 'octant.datalog.operations.is_primitive', 'operations.is_primitive', (['atom'], {}), '(atom)\n', (2536, 2542), False, 'from oct... |
import sys, json
from collections import OrderedDict
from tabulate import tabulate
from tqdm import tqdm
# Backend code:
import server, loader, formatter, mappings
# Benchmarks the classification capabilities of the given service, and save data on correlated answers:
def benchmark(service, mapping, dataset, top_k=5,... | [
"loader.getLatexToUnicodeMap",
"mappings.getProjectedSymbol",
"loader.getSupportedServices",
"json.loads",
"server.classifyRequest",
"json.dumps",
"mappings.getServiceProjectedSymbolsSet",
"loader.loadDataset",
"tabulate.tabulate",
"loader.getSupportedMappings",
"formatter.formatStrokesTo",
"c... | [((536, 565), 'loader.getLatexToUnicodeMap', 'loader.getLatexToUnicodeMap', ([], {}), '()\n', (563, 565), False, 'import server, loader, formatter, mappings\n'), ((2702, 2758), 'mappings.getServiceProjectedSymbolsSet', 'mappings.getServiceProjectedSymbolsSet', (['service', 'mapping'], {}), '(service, mapping)\n', (2740... |
import time
import Adafruit_CharLCD as LCD
# Raspberry Pi pin configuration:
lcd_rs = 27 # Note this needs to be changed to 21 for Model B rev1 Pi's.
lcd_en = 22
lcd_d4 = 25
lcd_d5 = 24
lcd_d6 = 23
lcd_d7 = 18
lcd_backlight = 4
lcd_columns = 16
lcd_rows = 2
lcd = LCD.Ada... | [
"time.sleep",
"Adafruit_CharLCD.Adafruit_CharLCD",
"time.time"
] | [((313, 423), 'Adafruit_CharLCD.Adafruit_CharLCD', 'LCD.Adafruit_CharLCD', (['lcd_rs', 'lcd_en', 'lcd_d4', 'lcd_d5', 'lcd_d6', 'lcd_d7', 'lcd_columns', 'lcd_rows', 'lcd_backlight'], {}), '(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,\n lcd_columns, lcd_rows, lcd_backlight)\n', (333, 423), True, 'import Adafruit_C... |
import numpy as np
import matplotlib.pyplot as plt # Matplotlib
from matplotlib import rcParams # To adjust some plot settings
from empymod import bipole, utils # Load required empymod functions
from ipywidgets import interactive, FloatText, ToggleButtons, widgets
from scipy.constants import mu_0
from ipywidgets.wid... | [
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.atleast_2d",
"ipywidgets.widgets.widget_bool.Checkbox",
"numpy.meshgrid",
"numpy.zeros_like",
"numpy.cumsum",
"numpy.linspace",
"numpy.log10",
"numpy.repeat",
"matplotlib.pyplot.show",
"numpy.ones_like",
"ipywidgets.widgets.i... | [((1430, 1462), 'numpy.repeat', 'np.repeat', (['np.r_[-500, depth]', '(2)'], {}), '(np.r_[-500, depth], 2)\n', (1439, 1462), True, 'import numpy as np\n'), ((1534, 1551), 'numpy.repeat', 'np.repeat', (['res', '(2)'], {}), '(res, 2)\n', (1543, 1551), True, 'import numpy as np\n'), ((1563, 1582), 'numpy.repeat', 'np.repe... |
from collections import Counter
from typing import List, Optional
from sqlalchemy.orm.session import Session
from src.models import (
ProfileCompletionChallenge,
UserChallenge,
User,
Repost,
Follow,
Save,
)
from src.challenges.challenge import (
ChallengeManager,
ChallengeUpdater,
Fu... | [
"src.models.Follow.follower_user_id.in_",
"src.models.ProfileCompletionChallenge",
"src.models.ProfileCompletionChallenge.user_id.in_",
"src.models.Save.user_id.in_",
"src.models.User.user_id.in_",
"src.models.Repost.user_id.in_"
] | [((2408, 2617), 'src.models.ProfileCompletionChallenge', 'ProfileCompletionChallenge', ([], {'user_id': "metadata['user_id']", 'profile_description': '(False)', 'profile_name': '(False)', 'profile_picture': '(False)', 'profile_cover_photo': '(False)', 'follows': '(False)', 'reposts': '(False)', 'favorites': '(False)'})... |
"""This module contains a code example related to
Think Python, 2nd Edition
by <NAME>
http://thinkpython2.com
Copyright 2015 <NAME>
License: http://creativecommons.org/licenses/by/4.0/
"""
from __future__ import print_function, division
import random
def sort_by_length(words):
"""Sort a list of words in reve... | [
"random.random"
] | [((1267, 1282), 'random.random', 'random.random', ([], {}), '()\n', (1280, 1282), False, 'import random\n')] |
import time
import pyautogui as gui
from . import AppCtrl
from utils.screenshot import regionMatchesColor
class WowClassicApp(AppCtrl):
title = "魔兽世界"
def isCharacterSelect(self):
"""Test if in Character Select screen.
"""
rect = self.getRect()
return regionMatchesColor((rect[... | [
"pyautogui.keyDown",
"pyautogui.keyUp",
"utils.screenshot.regionMatchesColor",
"time.sleep",
"pyautogui.click",
"pyautogui.moveTo"
] | [((295, 370), 'utils.screenshot.regionMatchesColor', 'regionMatchesColor', (['(rect[0] + 857, rect[1] + 983, 22, 19)', '(117, 0, 0)', '(16)'], {}), '((rect[0] + 857, rect[1] + 983, 22, 19), (117, 0, 0), 16)\n', (313, 370), False, 'from utils.screenshot import regionMatchesColor\n'), ((459, 502), 'pyautogui.moveTo', 'gu... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import curses
import sys
import os.path
import copy
import numpy as np
import six
import gym
from pycolab import ascii_art
from pycolab import human_ui
from pycolab import things as plab_things
from pycolab i... | [
"numpy.stack",
"argparse.ArgumentParser",
"pycolab.ascii_art.ascii_art_to_game",
"pycolab.human_ui.CursesUi",
"gym.spaces.Discrete",
"copy.copy",
"gym.spaces.Box"
] | [((5727, 5771), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (5750, 5771), False, 'import argparse\n'), ((1224, 1395), 'pycolab.ascii_art.ascii_art_to_game', 'ascii_art.ascii_art_to_game', (['GAME_ART'], {'what_lies_beneath': '""" """', 'sprites': "{... |
# -*- coding: utf-8 -*-
# BSD 3-Clause License
#
# Copyright (c) <NAME> 2016,
# All rights reserved.
# ---------------------------------------------------------------------
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unle... | [
"tqdm.tqdm",
"os.path.basename",
"os.path.exists",
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((3054, 3102), 'os.path.join', 'os.path.join', (['self.root', 'self.default_devkit_dir'], {}), '(self.root, self.default_devkit_dir)\n', (3066, 3102), False, 'import os\n'), ((4525, 4604), 'os.path.join', 'os.path.join', (['self.devkit_dir', '"""data"""', '"""ILSVRC2012_validation_ground_truth.txt"""'], {}), "(self.de... |
import time
for c in range (10, 0, -1):
print(c)
time.sleep(1)
print('FO<NAME>')
| [
"time.sleep"
] | [((57, 70), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (67, 70), False, 'import time\n')] |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DebugCaseReturnHeader:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The ... | [
"huaweicloudsdkcore.utils.http_utils.sanitize_for_serialization",
"six.iteritems",
"sys.setdefaultencoding"
] | [((4281, 4314), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (4294, 4314), False, 'import six\n'), ((5299, 5330), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (5321, 5330), False, 'import sys\n'), ((5357, 5389), 'huaweicloudsdkcor... |
"""Portfolio analysis context API."""
import os
from openbb_terminal.helper_classes import ModelsNamespace as _models
# flake8: noqa
# pylint: disable=unused-import
# Context menus
from openbb_terminal.portfolio.portfolio_analysis.portfolio_view import (
display_group_holdings as group,
)
# Models
models = _mod... | [
"os.path.dirname"
] | [((340, 365), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (355, 365), False, 'import os\n')] |
# Ignore the Airflow module, it is installed in both dev and prod
from airflow import DAG # type: ignore
from airflow.utils.dates import days_ago # type: ignore
import util
_ACS_BASE_URL = 'https://api.census.gov/data/2019/acs/acs5'
_ACS_WORKFLOW_ID = 'ACS_POPULATION'
_ACS_DATASET_NAME = 'acs_population'
default_a... | [
"util.create_gcs_short_circuit_operator",
"airflow.DAG",
"util.create_exporter_operator",
"util.generate_bq_payload",
"util.create_bq_ingest_operator",
"util.generate_gcs_payload",
"util.create_aggregator_operator",
"util.create_gcs_ingest_operator",
"airflow.utils.dates.days_ago"
] | [((383, 541), 'airflow.DAG', 'DAG', (['"""acs_population_ingestion_dag"""'], {'default_args': 'default_args', 'schedule_interval': '"""@yearly"""', 'description': '"""Ingestion configuration for ACS Population"""'}), "('acs_population_ingestion_dag', default_args=default_args,\n schedule_interval='@yearly', descript... |
import asyncio
import aiozipkin as az
import pytest
from yarl import URL
@pytest.mark.asyncio
async def test_basic(jaeger_url, jaeger_api_url, client, loop):
endpoint = az.create_endpoint('simple_service', ipv4='127.0.0.1', port=80)
interval = 50
tracer = await az.create(jaeger_url, endpoint, sample_rate... | [
"yarl.URL",
"aiozipkin.create_endpoint",
"aiozipkin.create",
"asyncio.sleep"
] | [((176, 239), 'aiozipkin.create_endpoint', 'az.create_endpoint', (['"""simple_service"""'], {'ipv4': '"""127.0.0.1"""', 'port': '(80)'}), "('simple_service', ipv4='127.0.0.1', port=80)\n", (194, 239), True, 'import aiozipkin as az\n'), ((277, 364), 'aiozipkin.create', 'az.create', (['jaeger_url', 'endpoint'], {'sample_... |
'''
Project: games
Created Date: Thursday, December 20th 2018, 1:48:26 am
Author: <NAME> <<EMAIL>>
-----
Copyright (c) 2018 TBD
Do whatever you want
'''
import sys
import random
import pygame
from pygame.constants import K_UP, K_DOWN, K_SPACE
from ple.games.utils.vec2d import vec2d
from ple.games.utils import percent... | [
"pygame.quit",
"pygame.Surface",
"ple.games.base.pygamewrapper.PyGameWrapper.__init__",
"pygame.draw.rect",
"pygame.event.get",
"pygame.event.pump",
"numpy.random.RandomState",
"ple.games.utils.vec2d.vec2d",
"pygame.init",
"pygame.sprite.Group",
"pygame.display.update",
"random.randrange",
"... | [((12052, 12065), 'pygame.init', 'pygame.init', ([], {}), '()\n', (12063, 12065), False, 'import pygame\n'), ((12181, 12200), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (12198, 12200), False, 'import pygame\n'), ((12216, 12241), 'numpy.random.RandomState', 'np.random.RandomState', (['(24)'], {}), '(24)... |
from django.db import migrations
def forwards(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.RunPython(forwards, migrations.RunPython.noop),
]
| [
"django.db.migrations.RunPython"
] | [((215, 272), 'django.db.migrations.RunPython', 'migrations.RunPython', (['forwards', 'migrations.RunPython.noop'], {}), '(forwards, migrations.RunPython.noop)\n', (235, 272), False, 'from django.db import migrations\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, 2017, 2018, 2019 Sqreen. All rights reserved.
# Please refer to our terms for more information:
#
# https://www.sqreen.io/terms.html
#
""" Look for known crawlers user-agents
"""
from logging import getLogger
from ..frameworks.pyramid_framework import PyramidRequest, P... | [
"logging.getLogger"
] | [((402, 421), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (411, 421), False, 'from logging import getLogger\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import pandas as pd
import wot
import wot.ot
logger = logging.getLogger('wot')
def create_parser():
parser = argparse.ArgumentParser(
description='Computes the distance between trajectories across time')
parser.add_argum... | [
"wot.io.read_dataset",
"matplotlib.pyplot.savefig",
"wot.io.get_filename_and_extension",
"argparse.ArgumentParser",
"pandas.read_csv",
"wot.tmap.plot_trajectory_divergence",
"logging.StreamHandler",
"wot.tmap.trajectory_divergence",
"logging.getLogger"
] | [((135, 159), 'logging.getLogger', 'logging.getLogger', (['"""wot"""'], {}), "('wot')\n", (152, 159), False, 'import logging\n'), ((196, 294), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Computes the distance between trajectories across time"""'}), "(description=\n 'Computes the di... |
import numpy as np
from pprint import pprint
import sys
class Bunch:
def __init__(self, **kwds):
self.__dict__.update(kwds)
### CONSTANTS ###
digits = list('0123456789')
### molecule ###
avail_mol_type = ['SMALL', 'BIOPOLYMER', 'PROTEIN', 'NUCLEIC_ACID', 'SACCHARIDE']
avail_mstatus_bits = ['system', 'in... | [
"numpy.zeros"
] | [((4194, 4215), 'numpy.zeros', 'np.zeros', (['(natoms, 3)'], {}), '((natoms, 3))\n', (4202, 4215), True, 'import numpy as np\n')] |
import imp
from base import Report
_registry = {}
def register(slug, klass,perm=None):
_registry[slug] = (klass,perm)
def get_report(slug,user=None):
try:
report,p = _registry[slug]
if user and p:
if user.has_perm(p):return report
else:raise Exception("No such report... | [
"django.db.models.Count",
"imp.find_module"
] | [((1295, 1322), 'django.db.models.Count', 'Count', (['field'], {'distinct': '(True)'}), '(field, distinct=True)\n', (1300, 1322), False, 'from django.db.models import Count\n'), ((1060, 1108), 'imp.find_module', 'imp.find_module', (['REPORTING_SOURCE_FILE', 'app_path'], {}), '(REPORTING_SOURCE_FILE, app_path)\n', (1075... |
import sys, os
import pytest
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from main import create_app
@pytest.fixture(scope="module")
def setup():
app = create_app('test')
app.config['test'] = True
return app.test_client()
| [
"os.path.abspath",
"pytest.fixture",
"sys.path.insert",
"main.create_app"
] | [((103, 133), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent_dir'], {}), '(0, parent_dir)\n', (118, 133), False, 'import sys, os\n'), ((166, 196), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (180, 196), False, 'import pytest\n'), ((220, 238), 'main.create_app', 'cr... |
import random
import CommandGeneratorMachine
import Config
item_list = []
first_pass = True
def get(machine_list):
global item_list
global first_pass
if len(item_list) == 0:
if first_pass is False and Config.auto_quit is True:
return None
first_pass = False
item_lis... | [
"CommandGeneratorMachine.generate_command_list"
] | [((324, 383), 'CommandGeneratorMachine.generate_command_list', 'CommandGeneratorMachine.generate_command_list', (['machine_list'], {}), '(machine_list)\n', (369, 383), False, 'import CommandGeneratorMachine\n')] |
import logging
import os
from typing import Dict, List, Tuple
from autobridge.Floorplan.Partition import partition
from autobridge.Floorplan.IterativeBipartion import iterative_bipartition
from autobridge.Floorplan.Utilities import (
print_pre_assignment,
print_vertex_areas,
get_eight_way_partition_slots,
get_... | [
"autobridge.Floorplan.Utilities.print_pre_assignment",
"autobridge.Floorplan.Utilities.get_four_way_partition_slots",
"autobridge.Floorplan.Utilities.get_eight_way_partition_slots",
"autobridge.Floorplan.IterativeBipartion.iterative_bipartition",
"autobridge.Floorplan.Partition.partition",
"logging.getLog... | [((535, 566), 'logging.getLogger', 'logging.getLogger', (['"""autobridge"""'], {}), "('autobridge')\n", (552, 566), False, 'import logging\n'), ((580, 608), 'logging.getLogger', 'logging.getLogger', (['"""general"""'], {}), "('general')\n", (597, 608), False, 'import logging\n'), ((3548, 3585), 'autobridge.Floorplan.Ut... |
import ipaddress
import numpy as np
from pandas.api.types import is_list_like
from ._utils import pack, unpack
def to_ipaddress(values):
"""Convert values to IPArray
Parameters
----------
values : int, str, bytes, or sequence of those
Returns
-------
addresses : IPArray
Examples
... | [
"ipaddress.ip_network",
"numpy.asarray",
"pandas.api.types.is_list_like",
"ipaddress.ip_address",
"numpy.issubdtype"
] | [((949, 969), 'pandas.api.types.is_list_like', 'is_list_like', (['values'], {}), '(values)\n', (961, 969), False, 'from pandas.api.types import is_list_like\n'), ((1262, 1301), 'numpy.issubdtype', 'np.issubdtype', (['values.dtype', 'np.integer'], {}), '(values.dtype, np.integer)\n', (1275, 1301), True, 'import numpy as... |
# Copyright 2021 QHAna plugin runner contributors.
#
# 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 ... | [
"sqlalchemy.sql.sqltypes.TIMESTAMP",
"sqlalchemy.sql.expression.select",
"sqlalchemy.sql.sqltypes.String",
"datetime.datetime.utcnow",
"sqlalchemy.orm.relationship",
"sqlalchemy.sql.schema.ForeignKey",
"sqlalchemy.sql.sqltypes.INTEGER",
"sqlalchemy.sql.sqltypes.Text"
] | [((2679, 2696), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (2694, 2696), False, 'from datetime import datetime\n'), ((6124, 6141), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (6139, 6141), False, 'from datetime import datetime\n'), ((3303, 3365), 'sqlalchemy.orm.relationship',... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | [
"torch.max",
"torch.min"
] | [((987, 1028), 'torch.max', 'torch.max', (['bboxes1[:, :2]', 'bboxes2[:, :2]'], {}), '(bboxes1[:, :2], bboxes2[:, :2])\n', (996, 1028), False, 'import torch\n'), ((1042, 1083), 'torch.min', 'torch.min', (['bboxes1[:, 2:]', 'bboxes2[:, 2:]'], {}), '(bboxes1[:, 2:], bboxes2[:, 2:])\n', (1051, 1083), False, 'import torch\... |
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2018 <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
... | [
"JMSPCRC8.crc8FromBytes",
"struct.unpack"
] | [((2553, 2580), 'struct.unpack', 'struct.unpack', (['""">H"""', 'header'], {}), "('>H', header)\n", (2566, 2580), False, 'import struct\n'), ((3006, 3095), 'JMSPCRC8.crc8FromBytes', 'JMSPCRC8.crc8FromBytes', (['self.dataFrame', 'COM_CONFIG.DATA_POS_FRAME_LENGTH', 'frameLength'], {}), '(self.dataFrame, COM_CONFIG.DATA_P... |
"""Common verify functions for syslog"""
import re
import logging
log = logging.getLogger(__name__)
def verify_syslog_interface_shut(interface, server, output):
""" Verify log for interface shut message
Args:
interface ('str'): Interface to be verified
output ('obj'): Tcpdump ou... | [
"logging.getLogger",
"re.compile"
] | [((74, 101), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (91, 101), False, 'import logging\n'), ((604, 752), 're.compile', 're.compile', (['""".+\\\\%LINK\\\\-\\\\d+\\\\-CHANGED\\\\:\\\\s+Interface\\\\s+(?P<interface>\\\\S+)\\\\,\\\\s+changed\\\\s+state\\\\s+to\\\\s+(administratively\\... |
#!/usr/bin/env python
import sys, numpy
def read_input_file( filename ) :
x = 1
y = 1
xmax = 1
table = numpy.zeros((43,43))
for line in open( filename ) :
for element in [float(e) for e in line.split() ] :
table[ y ][ x ] = element
if x < xmax :
x +... | [
"numpy.zeros",
"sys.exit"
] | [((121, 142), 'numpy.zeros', 'numpy.zeros', (['(43, 43)'], {}), '((43, 43))\n', (132, 142), False, 'import sys, numpy\n'), ((1738, 1809), 'sys.exit', 'sys.exit', (['"""missing args: input-file table-file out-ttl-file out-r-file"""'], {}), "('missing args: input-file table-file out-ttl-file out-r-file')\n", (1746, 1809)... |
from multiprocessing import Pool
def task(n):
print(n)
def main():
with Pool(4) as p:
print(p.map(task, [2,3,4]))
if __name__ == '__main__':
main() | [
"multiprocessing.Pool"
] | [((82, 89), 'multiprocessing.Pool', 'Pool', (['(4)'], {}), '(4)\n', (86, 89), False, 'from multiprocessing import Pool\n')] |
# coding=utf-8
import logging
import pytest
from conftest import (
address, message, SomeClass
)
from mock import patch
from rfc5424logging import Rfc5424SysLogHandler, NILVALUE
@pytest.mark.parametrize("handler_kwargs,expected", [
(
{'address': address},
b'<14>1 2000-01-01T17:11:11.111111+0... | [
"mock.patch.object",
"conftest.SomeClass",
"rfc5424logging.Rfc5424SysLogHandler",
"logging.info"
] | [((2119, 2157), 'rfc5424logging.Rfc5424SysLogHandler', 'Rfc5424SysLogHandler', ([], {}), '(**handler_kwargs)\n', (2139, 2157), False, 'from rfc5424logging import Rfc5424SysLogHandler, NILVALUE\n'), ((4647, 4694), 'rfc5424logging.Rfc5424SysLogHandler', 'Rfc5424SysLogHandler', (["handler_kwargs['address']"], {}), "(handl... |
import json
from django.db.models.query import QuerySet
from django.http import HttpResponse, Http404
from django.utils.html import escape
from functions import get_object_data, get_object_list_data
from symmetric import xml
__NO_CACHE = 'max-age=0, no-cache, no-store, must-revalidate'
def __default_dumps(obj):
... | [
"symmetric.xml.dumps",
"django.http.HttpResponse",
"json.dumps",
"functions.get_object_data",
"functions.get_object_list_data",
"django.utils.html.escape"
] | [((487, 507), 'functions.get_object_data', 'get_object_data', (['obj'], {}), '(obj)\n', (502, 507), False, 'from functions import get_object_data, get_object_list_data\n'), ((745, 770), 'functions.get_object_list_data', 'get_object_list_data', (['obj'], {}), '(obj)\n', (765, 770), False, 'from functions import get_obje... |
import numpy
import numpy as np
import os
import struct
from struct import unpack
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import pickle
import pathlib
import cv2
import random
class Item(object):
__slots__ = ['x', 'y', 'id', 'cn']
def __init__(self, x, y, id, cn):
self.x ... | [
"pickle.dump",
"numpy.random.randn",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"pathlib.Path",
"pickle.load",
"numpy.array",
"numpy.min",
"numpy.max",
"os.path.join",
"os.listdir",
"numpy.random.shuffle"
] | [((1634, 1655), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (1644, 1655), False, 'import os\n'), ((4394, 4424), 'numpy.random.shuffle', 'np.random.shuffle', (['class_array'], {}), '(class_array)\n', (4411, 4424), True, 'import numpy as np\n'), ((4433, 4463), 'numpy.random.shuffle', 'np.random.shuf... |
import pytest
from mypkg.fibonacci import fibonacci
def test_fib_10():
assert(fibonacci(10) == 55)
def test_fib_not_20():
assert(fibonacci(20) != 20)
| [
"mypkg.fibonacci.fibonacci"
] | [((81, 94), 'mypkg.fibonacci.fibonacci', 'fibonacci', (['(10)'], {}), '(10)\n', (90, 94), False, 'from mypkg.fibonacci import fibonacci\n'), ((134, 147), 'mypkg.fibonacci.fibonacci', 'fibonacci', (['(20)'], {}), '(20)\n', (143, 147), False, 'from mypkg.fibonacci import fibonacci\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Radware LTD.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | [
"os.path.basename",
"vdirect_client.rest_client.Template",
"vdirect_client.rest_client.WorkflowTemplate",
"ansible.module_utils.basic.AnsibleModule",
"vdirect_client.rest_client.RestClient"
] | [((8496, 8534), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'meta_args'}), '(argument_spec=meta_args)\n', (8509, 8534), False, 'from ansible.module_utils.basic import AnsibleModule\n'), ((6261, 6653), 'vdirect_client.rest_client.RestClient', 'rest_client.RestClient', (["params['v... |
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.search import SearchVectorField
from django.contrib.postgres.indexes import GinIndex
from .base import (
OCDBase,
LinkBase,
OCDIDField,
RelatedBase,
RelatedEntityBase,
MimetypeLinkBa... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.JSONField",
"django.db.models.BooleanField",
"django.contrib.postgres.indexes.GinIndex",
"django.contrib.postgres.se... | [((517, 607), 'django.db.models.ForeignKey', 'models.ForeignKey', (['LegislativeSession'], {'related_name': '"""bills"""', 'on_delete': 'models.PROTECT'}), "(LegislativeSession, related_name='bills', on_delete=\n models.PROTECT)\n", (534, 607), False, 'from django.db import models\n'), ((695, 727), 'django.db.models... |
from __future__ import print_function
from future.utils import iteritems
from builtins import range, str, object
import os
import sys
import time
import inspect
import itertools
import numpy as np
from contextlib import contextmanager
from peri import initializers
from peri.logger import log
log = log.getChild('util'... | [
"sys.stdout.flush",
"numpy.arange",
"builtins.range",
"os.chdir",
"numpy.prod",
"inspect.getmembers",
"numpy.round",
"numpy.meshgrid",
"numpy.fft.fftn",
"types.MethodType",
"peri.initializers.load_tiff",
"numpy.fft.fftfreq",
"itertools.product",
"peri.logger.log.getChild",
"numpy.broadca... | [((301, 321), 'peri.logger.log.getChild', 'log.getChild', (['"""util"""'], {}), "('util')\n", (313, 321), False, 'from peri.logger import log\n'), ((35199, 35255), 'inspect.getmembers', 'inspect.getmembers', (['subclass'], {'predicate': 'inspect.ismethod'}), '(subclass, predicate=inspect.ismethod)\n', (35217, 35255), F... |
import datetime
import os
import re
import subprocess
def rename_files_with_whitespaces(cd, files, extra_path=""):
for file in files:
if " " in file:
renamed_file = file.replace(" ", "_")
os.rename(os.path.join(cd, extra_path, file), os.path.join(cd, extra_path, renamed_file))
de... | [
"subprocess.run",
"os.get_terminal_size",
"os.path.realpath",
"re.match",
"datetime.datetime.now",
"os.path.join",
"os.listdir"
] | [((914, 940), 'os.path.join', 'os.path.join', (['cd', '"""musics"""'], {}), "(cd, 'musics')\n", (926, 940), False, 'import os\n'), ((1033, 1056), 'os.listdir', 'os.listdir', (['musics_path'], {}), '(musics_path)\n', (1043, 1056), False, 'import os\n'), ((611, 657), 're.match', 're.match', (['"""^[0-9]{2}:[0-9]{2}$"""',... |
from ply import lex, yacc
from util import accumulate_to_list
tokens = ('SETTING_NAME', 'VALUE', 'SEPARATOR', 'CONTINUATION')
t_ignore_SEPARATOR = r'\ {2,}'
t_SETTING_NAME = r'(?i)Library|Resource'
t_ignore_CONTINUATION = r'(?m)^\.\.\.'
t_VALUE = r'(\S+\ )*\S+'
t_ignore = '\n'
def t_error(t):
print("Illegal ch... | [
"ply.yacc.yacc",
"util.accumulate_to_list",
"ply.lex.lex"
] | [((377, 386), 'ply.lex.lex', 'lex.lex', ([], {}), '()\n', (384, 386), False, 'from ply import lex, yacc\n'), ((721, 732), 'ply.yacc.yacc', 'yacc.yacc', ([], {}), '()\n', (730, 732), False, 'from ply import lex, yacc\n'), ((475, 496), 'util.accumulate_to_list', 'accumulate_to_list', (['p'], {}), '(p)\n', (493, 496), Fal... |
from . import unittest
from shapely.geometry import Point, LineString, Polygon, MultiLineString, \
GeometryCollection
from shapely.ops import shared_paths
class SharedPaths(unittest.TestCase):
def test_shared_paths_forward(self):
g1 = LineString([(0, 0), (10, 0), (10, 5), (20,... | [
"shapely.geometry.LineString",
"shapely.geometry.Point",
"shapely.ops.shared_paths"
] | [((278, 325), 'shapely.geometry.LineString', 'LineString', (['[(0, 0), (10, 0), (10, 5), (20, 5)]'], {}), '([(0, 0), (10, 0), (10, 5), (20, 5)])\n', (288, 325), False, 'from shapely.geometry import Point, LineString, Polygon, MultiLineString, GeometryCollection\n'), ((339, 368), 'shapely.geometry.LineString', 'LineStri... |
""" Collection of widget classes.
"""
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
import srllib.qtgui
class _LineEditUndo(QtGui.QUndoCommand):
__super = QtGui.QUndoCommand
def __init__(self, edit, prev_text, prev_pos, cur_text, cur_pos, cmd_text,
id_):
self.__super.__init_... | [
"PyQt4.QtGui.QIntValidator",
"PyQt4.QtGui.QDoubleValidator",
"PyQt4.QtCore.QString"
] | [((2249, 2269), 'PyQt4.QtCore.QString', 'QtCore.QString', (['text'], {}), '(text)\n', (2263, 2269), False, 'from PyQt4 import QtGui, QtCore\n'), ((3143, 3159), 'PyQt4.QtCore.QString', 'QtCore.QString', ([], {}), '()\n', (3157, 3159), False, 'from PyQt4 import QtGui, QtCore\n'), ((4601, 4617), 'PyQt4.QtCore.QString', 'Q... |
'''
Created on 2017年1月8日
@author: Think
【程序15】
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,
60分以下的用C表示。
1.程序分析:(a>b)?a:b这是条件运算符的基本例子。
2.程序源代码:
不支持这个运算符
'''
from pip._vendor.distlib.compat import raw_input
def jcp015():
score = int(raw_input('input score:\n'))
if score >= 90:
grade = 'A'
e... | [
"pip._vendor.distlib.compat.raw_input"
] | [((246, 273), 'pip._vendor.distlib.compat.raw_input', 'raw_input', (['"""input score:\n"""'], {}), "('input score:\\n')\n", (255, 273), False, 'from pip._vendor.distlib.compat import raw_input\n')] |
import pygame
import sys
from pygame.locals import *
def terminate():
pygame.quit()
sys.exit()
BLACK = pygame.Color('black')
WHITE = pygame.Color('white')
RED = pygame.Color('red')
GREEN = pygame.Color('green')
BLUE = pygame.Color('blue')
FPS = 30
SCREEN_WIDTH = 500
SCREEN_HEIGHT = 500
def main():
p... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.draw.rect",
"pygame.Color",
"pygame.init",
"pygame.display.update",
"pygame.display.set_caption",
"pygame.time.Clock",
"sys.exit"
] | [((115, 136), 'pygame.Color', 'pygame.Color', (['"""black"""'], {}), "('black')\n", (127, 136), False, 'import pygame\n'), ((145, 166), 'pygame.Color', 'pygame.Color', (['"""white"""'], {}), "('white')\n", (157, 166), False, 'import pygame\n'), ((173, 192), 'pygame.Color', 'pygame.Color', (['"""red"""'], {}), "('red')\... |
#
# Small ftp server for ESP8266 ans ESP32 Micropython
#
# Based on the work of chrisgp - <NAME> and pfalcon - <NAME>
#
# The server accepts passive mode only.
# It runs in a separated thread
#
# Start the server with:
# from ftp import ftpserver
# u = ftpserver()
# u.start_thread()
#
# Copyright (c) 2016 <NAME> ... | [
"_thread.start_new_thread",
"network.WLAN",
"socket.socket",
"uos.stat",
"uos.listdir",
"uos.rename",
"gc.collect",
"socket.getaddrinfo",
"uos.rmdir",
"uos.mkdir",
"uos.remove"
] | [((4087, 4135), '_thread.start_new_thread', '_thread.start_new_thread', (['self.thread_ftp', "('',)"], {}), "(self.thread_ftp, ('',))\n", (4111, 4135), False, 'import _thread\n'), ((4211, 4260), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (... |
import logging
from datetime import datetime
import pytz
from django.db import models
from django.utils.translation import ugettext as _
logger = logging.getLogger(__name__)
SYNC_TYPES = (
('Full', _('Full')),
('Incremental', _('Incremental')),
)
class ADldap_Sync(models.Model):
#Mi... | [
"django.utils.translation.ugettext",
"logging.getLogger",
"datetime.datetime"
] | [((155, 182), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (172, 182), False, 'import logging\n'), ((215, 224), 'django.utils.translation.ugettext', '_', (['"""Full"""'], {}), "('Full')\n", (216, 224), True, 'from django.utils.translation import ugettext as _\n'), ((248, 264), 'django.u... |
# bot.py
import os
import http.client
import json
import discord
from discord.ext import tasks
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('MPB_BOT_DISCORD_TOKEN')
client = discord.Client()
@tasks.loop(seconds=60)
async def update_price():
connection = http.client.HTTPSConnection(
'ww... | [
"discord.Activity",
"json.loads",
"json.dumps",
"dotenv.load_dotenv",
"discord.ext.tasks.loop",
"os.getenv",
"discord.Client"
] | [((128, 141), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (139, 141), False, 'from dotenv import load_dotenv\n'), ((150, 184), 'os.getenv', 'os.getenv', (['"""MPB_BOT_DISCORD_TOKEN"""'], {}), "('MPB_BOT_DISCORD_TOKEN')\n", (159, 184), False, 'import os\n'), ((194, 210), 'discord.Client', 'discord.Client', ([... |
class Basic:
@staticmethod
def pesquisar(id_client):
import sqlite3
conexao = sqlite3.connect('dadosCliente.bd')
cursor = conexao.cursor()
cursor.execute('''
select * from Cliente inner join Endereco on Cliente.id_endereco = Endereco.id_endereco where id_cliente... | [
"sqlite3.connect"
] | [((108, 142), 'sqlite3.connect', 'sqlite3.connect', (['"""dadosCliente.bd"""'], {}), "('dadosCliente.bd')\n", (123, 142), False, 'import sqlite3\n'), ((589, 623), 'sqlite3.connect', 'sqlite3.connect', (['"""dadosCliente.bd"""'], {}), "('dadosCliente.bd')\n", (604, 623), False, 'import sqlite3\n'), ((1104, 1138), 'sqlit... |
import json
import os
import platform
import random
import sys
import subprocess
import asyncio
import aiohttp
import discord
import base64
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
import time
import base64
from datetime import timedelta
from time import gmtime, strftime
#... | [
"subprocess.run",
"subprocess.Popen",
"json.load",
"discord.ext.commands.command",
"discord.Embed",
"time.gmtime",
"os.walk",
"random.choice",
"time.time",
"os.path.isfile",
"sys.stdout.buffer.write",
"sys.exit"
] | [((396, 425), 'os.path.isfile', 'os.path.isfile', (['"""config.json"""'], {}), "('config.json')\n", (410, 425), False, 'import os\n'), ((431, 496), 'sys.exit', 'sys.exit', (['"""\'config.json\' not found! Please add it and try again."""'], {}), '("\'config.json\' not found! Please add it and try again.")\n', (439, 496)... |
import requests
import time
import settings
import dbaccess
settings = settings.Settings('conf.ini')
dbaccess = dbaccess.DBAccess(settings)
def addrule(target, path):
with open(path, 'r') as file:
rule = file.read()
if target == 'cdr':
r = requests.post(settings.cdrRuleEndpoint, data=rule)
... | [
"dbaccess.printcdrrules",
"dbaccess.printaccounts",
"time.sleep",
"dbaccess.DBAccess",
"dbaccess.printbill",
"requests.get",
"dbaccess.deleterule",
"requests.post",
"dbaccess.printbillrules",
"settings.Settings"
] | [((73, 102), 'settings.Settings', 'settings.Settings', (['"""conf.ini"""'], {}), "('conf.ini')\n", (90, 102), False, 'import settings\n'), ((114, 141), 'dbaccess.DBAccess', 'dbaccess.DBAccess', (['settings'], {}), '(settings)\n', (131, 141), False, 'import dbaccess\n'), ((527, 562), 'requests.get', 'requests.get', (['s... |
import math
# Numba support for dicts is too experimental as of yet
#from numba import jitclass, int32, float32
#from numba.typed import Dict
#spec = [
# ('left', int32), # a simple scalar field
# ('top', int32),
# ('size', int32),
# ('rows', int32),
# ('cols', int32),
# ('bucketsize',... | [
"math.ceil"
] | [((1082, 1119), 'math.ceil', 'math.ceil', (['(hashTableSize / bucketSize)'], {}), '(hashTableSize / bucketSize)\n', (1091, 1119), False, 'import math\n')] |
import click
import re
import sys
domain_pattern = re.compile('[\w\-\._]+\.[A-Za-z]+')
mail_pattern = re.compile('([\w\-\._]+)@([\w\-\._]+\.[A-Za-z]+)')
@click.command()
@click.argument('from_domain')#, help='変換元のメールアドレスのドメインを指定(@の後ろ)')
@click.argument('to_domain')#, help='xxx')
def cmd(from_domain, to_domain):
... | [
"click.BadParameter",
"click.argument",
"click.echo",
"click.command",
"re.compile"
] | [((52, 91), 're.compile', 're.compile', (['"""[\\\\w\\\\-\\\\._]+\\\\.[A-Za-z]+"""'], {}), "('[\\\\w\\\\-\\\\._]+\\\\.[A-Za-z]+')\n", (62, 91), False, 'import re\n'), ((103, 160), 're.compile', 're.compile', (['"""([\\\\w\\\\-\\\\._]+)@([\\\\w\\\\-\\\\._]+\\\\.[A-Za-z]+)"""'], {}), "('([\\\\w\\\\-\\\\._]+)@([\\\\w\\\\-... |
from .models import Game
from rest_framework import serializers
from paw2018.nflteams.serializers import TeamNameSerializer
class GameSerializer(serializers.ModelSerializer):
away_team = TeamNameSerializer(read_only=True)
home_team = TeamNameSerializer(read_only=True)
class Meta:
model = Game
... | [
"paw2018.nflteams.serializers.TeamNameSerializer"
] | [((192, 226), 'paw2018.nflteams.serializers.TeamNameSerializer', 'TeamNameSerializer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (210, 226), False, 'from paw2018.nflteams.serializers import TeamNameSerializer\n'), ((243, 277), 'paw2018.nflteams.serializers.TeamNameSerializer', 'TeamNameSerializer', ([], {'re... |
# -*- coding:utf-8 -*-
from schematics.types import IntType
from tests.loading.primitives import CommonPrimitivesTests
from tests import schematics_proto3_tests_pb2 as pb2
from tests.utils.randoms import value_for_primitive
from tests.utils.wire import mimic_protobuf_wire_transfer
class TestUInt32(CommonPrimitivesTes... | [
"tests.utils.randoms.value_for_primitive",
"tests.utils.wire.mimic_protobuf_wire_transfer"
] | [((485, 520), 'tests.utils.randoms.value_for_primitive', 'value_for_primitive', (['"""uint32_field"""'], {}), "('uint32_field')\n", (504, 520), False, 'from tests.utils.randoms import value_for_primitive\n'), ((537, 570), 'tests.utils.wire.mimic_protobuf_wire_transfer', 'mimic_protobuf_wire_transfer', (['msg'], {}), '(... |
# Copyright 2007 <NAME> <<EMAIL>>
#
# 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 writ... | [
"pyactivemq.MessageListener.__init__",
"queue.Queue"
] | [((1614, 1628), 'queue.Queue', 'queue.Queue', (['(0)'], {}), '(0)\n', (1625, 1628), False, 'import queue\n'), ((1002, 1043), 'pyactivemq.MessageListener.__init__', 'pyactivemq.MessageListener.__init__', (['self'], {}), '(self)\n', (1037, 1043), False, 'import pyactivemq\n'), ((1152, 1166), 'queue.Queue', 'queue.Queue',... |
from django import template
from stage.models import App
import datetime
register = template.Library()
@register.filter(name='multiply')
def multiply(a, b):
return a*b
@register.filter(name='mod')
def mod(dividend, divisor):
return (dividend + 2) % divisor
@register.filter(name='time')
def time(creation_date):
... | [
"django.template.Library",
"datetime.datetime.now",
"datetime.datetime.fromtimestamp"
] | [((85, 103), 'django.template.Library', 'template.Library', ([], {}), '()\n', (101, 103), False, 'from django import template\n'), ((327, 373), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['creation_date'], {}), '(creation_date)\n', (358, 373), False, 'import datetime\n'), ((381, 404), 'datet... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | [
"requests.post",
"ansible.module_utils.basic.AnsibleModule"
] | [((2762, 2804), 'requests.post', 'requests.post', (['url', 'body_data'], {'verify': '(True)'}), '(url, body_data, verify=True)\n', (2775, 2804), False, 'import requests\n'), ((3207, 3269), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'fields', 'supports_check_mode': '(False)'}), '... |
__source__ = 'https://leetcode.com/problems/number-of-boomerangs/'
# Time: O(n^2)
# Space: O(n)
#
# Description: 447. Number of Boomerangs
#
# Given n points in the plane that are all pairwise distinct,
# a "boomerang" is a tuple of points (i, j, k) such that the distance
# between i and j equals the distance between ... | [
"unittest.main",
"collections.defaultdict",
"collections.Counter"
] | [((2394, 2409), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2407, 2409), False, 'import unittest\n'), ((1370, 1398), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (1393, 1398), False, 'import collections\n'), ((2120, 2149), 'collections.Counter', 'collections.Counter', (['dis_... |
import log, sim, uos, dataCall, ujson, request, usocket, net, log, modem, utime, _thread, uhashlib, ubinascii, fota, ure
import cellLocator
from machine import Pin
from misc import Power
from aLiYun import aLiYun
from TenCentYun import TXyun
from umqtt import MQTTClient
from machine import UART
log.basicConfig(level=l... | [
"modem.getDevImei",
"dataCall.setApn",
"dataCall.getInfo",
"uos.listdir",
"net.csqQueryPoll",
"machine.UART",
"utime.sleep",
"utime.sleep_ms",
"dataCall.start",
"sim.getStatus",
"log.basicConfig",
"cellLocator.getLocation",
"ujson.dumps",
"machine.Pin",
"_thread.start_new_thread",
"sim... | [((297, 328), 'log.basicConfig', 'log.basicConfig', ([], {'level': 'log.INFO'}), '(level=log.INFO)\n', (312, 328), False, 'import log, sim, uos, dataCall, ujson, request, usocket, net, log, modem, utime, _thread, uhashlib, ubinascii, fota, ure\n'), ((338, 358), 'log.getLogger', 'log.getLogger', (['"""dtu"""'], {}), "('... |
from database.rounds import Round
class Tournament(object):
def __init__(self, game_name, tc_id, join_message_id, players_per_game=4, gamers=None, rounds=None):
"""
:param game_name: The game name
:param tc_id: The ID of the text channel the tournament was created in
:param join_me... | [
"database.rounds.Round.from_dict",
"database.rounds.Round"
] | [((1812, 1867), 'database.rounds.Round', 'Round', (['(0)', 'self.gamers'], {'group_size': 'self.players_per_game'}), '(0, self.gamers, group_size=self.players_per_game)\n', (1817, 1867), False, 'from database.rounds import Round\n'), ((1238, 1260), 'database.rounds.Round.from_dict', 'Round.from_dict', (['round'], {}), ... |
# -*- coding: utf-8 -*-
import locale as _locale
from contextlib import contextmanager
from ..translator import Translator
from ..formatting import FORMATTERS
class TranslatableMixin(object):
_translator = None
@classmethod
def translator(cls):
"""
Initialize the translator instance if... | [
"locale.getlocale"
] | [((2893, 2912), 'locale.getlocale', '_locale.getlocale', ([], {}), '()\n', (2910, 2912), True, 'import locale as _locale\n')] |
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
import matplotlib.pyplot as plt
pio.tem... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"matplotlib.pyplot.show",
"pandas.read_csv",
"pandas.get_dummies",
"matplotlib.pyplot.bar",
"plotly.express.line",
"IMLearn.learners.regressors.PolynomialFitting",
"matplotlib.pyplot.figure",
"numpy.array",
"plotly.express.scatter",
"matplotlib.p... | [((641, 684), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': "['Date']"}), "(filename, parse_dates=['Date'])\n", (652, 684), True, 'import pandas as pd\n'), ((1393, 1416), 'pandas.get_dummies', 'pd.get_dummies', (['df.City'], {}), '(df.City)\n', (1407, 1416), True, 'import pandas as pd\n'), ((1426, 14... |
from django.contrib import admin
from . import models
admin.site.register(models.Profile)
admin.site.register(models.Post)
admin.site.register(models.Rate)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((55, 90), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Profile'], {}), '(models.Profile)\n', (74, 90), False, 'from django.contrib import admin\n'), ((91, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Post'], {}), '(models.Post)\n', (110, 123), False, 'from dja... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.commands.parameters.get_enum_type",
"knack.arguments.CLIArgumentType"
] | [((766, 983), 'knack.arguments.CLIArgumentType', 'CLIArgumentType', ([], {'options_list': "['--url', '-u']", 'help': '"""Base url of the TeamCloud instance. Use `az configure -d tc-url=<url>` to configure a default."""', 'configured_default': '"""tc-url"""', 'validator': 'base_url_validator'}), "(options_list=['--url',... |
import os
import sys
import pype
import importlib
import pyblish.api
import pyblish.util
import avalon.api
from avalon.tools import publish
from pype.api import Logger
log = Logger().get_logger(__name__)
def main(env):
# Registers pype's Global pyblish plugins
pype.install()
# Register Host (and it's py... | [
"pype.api.Logger",
"importlib.import_module",
"os.path.exists",
"avalon.tools.publish.show",
"os.path.normpath",
"pype.install",
"os.path.join"
] | [((272, 286), 'pype.install', 'pype.install', ([], {}), '()\n', (284, 286), False, 'import pype\n'), ((1501, 1515), 'avalon.tools.publish.show', 'publish.show', ([], {}), '()\n', (1513, 1515), False, 'from avalon.tools import publish\n'), ((175, 183), 'pype.api.Logger', 'Logger', ([], {}), '()\n', (181, 183), False, 'f... |
import os
import sys
import argparse
import json
import pkg_resources
from flask_swagger import swagger
sys.path.append(os.getcwd())
parser = argparse.ArgumentParser()
parser.add_argument('app', help='the flask app to swaggerify')
#parser.add_argument('--definitions', help='json definitions file')
parser.add_argument... | [
"argparse.ArgumentParser",
"os.getcwd",
"pkg_resources.EntryPoint.parse",
"json.dumps",
"flask_swagger.swagger"
] | [((144, 169), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (167, 169), False, 'import argparse\n'), ((121, 132), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (130, 132), False, 'import os\n'), ((749, 761), 'flask_swagger.swagger', 'swagger', (['app'], {}), '(app)\n', (756, 761), False, 'from f... |
#!/usr/bin/env python3
import os
import jieba
import logging
logger = logging.getLogger(__name__)
NGRAM_N_MIN = 2 # N-Gram, 分词的最小长度
NGRAM_N_MAX = 5 # N-Gram, 分词的最大长度
def get_stopwords():
fn = f"{os.path.dirname(__file__) or '.'}/stopwords.txt"
with open(fn, encoding='utf-8') as f:
stopwor... | [
"jieba.tokenize",
"os.path.dirname",
"logging.getLogger"
] | [((72, 99), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (89, 99), False, 'import logging\n'), ((951, 986), 'jieba.tokenize', 'jieba.tokenize', (['text'], {'mode': '"""search"""'}), "(text, mode='search')\n", (965, 986), False, 'import jieba\n'), ((214, 239), 'os.path.dirname', 'os.path... |
import re
import csv
def main():
fname = 'APT1-parsed.csv'
f = open("PEID Reports/APT1.txt", "r")
for line in f:
line = line.split("\\")
substring = line[5]
substring = re.compile("\s+::\t+").split(substring)
try:
with open(fname, 'a') as csvfile:
writer = csv.writer(csvfile)
writer.writerow([sub... | [
"csv.writer",
"re.compile"
] | [((179, 202), 're.compile', 're.compile', (['"""\\\\s+::\t+"""'], {}), "('\\\\s+::\\t+')\n", (189, 202), False, 'import re\n'), ((276, 295), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (286, 295), False, 'import csv\n')] |
# coding:utf-8
"""
Filename: utils.py
Author: @DvdNss
Created on 11/15/2021
"""
import json
import os
def dict_to_json(args_dict: dict, filename: str) -> str:
"""
Saves a dictionnary as a json file.
:param args_dict: model dictionnary
:param filename: json file name
"""
assert filename[-5:... | [
"json.dump",
"os.path.dirname"
] | [((429, 454), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (444, 454), False, 'import os\n'), ((557, 595), 'json.dump', 'json.dump', (['args_dict', 'config'], {'indent': '(2)'}), '(args_dict, config, indent=2)\n', (566, 595), False, 'import json\n')] |
import os
from copy import deepcopy
from textwrap import dedent
from typing import List
from .vba_tokenizer import tokenize, VBAToken
from pathlib import Path
class NameTransformer:
def __init__(self, name_changes):
# force lowercase matching
if isinstance(name_changes, dict):
name_c... | [
"textwrap.dedent",
"copy.deepcopy",
"pathlib.Path",
"os.remove"
] | [((2866, 2882), 'copy.deepcopy', 'deepcopy', (['tokens'], {}), '(tokens)\n', (2874, 2882), False, 'from copy import deepcopy\n'), ((4426, 4710), 'textwrap.dedent', 'dedent', (['"""\n VERSION 1.0 CLASS\n BEGIN\n MultiUse = -1 \'True\n END\n Attribute VB_Name = "__modulename__"\n Attribute VB_GlobalN... |
# -*- coding: utf-8 -*-
#
# This file is part of the pyFDA project hosted at https://github.com/chipmuenk/pyfda
#
# Copyright © pyFDA Project Contributors
# Licensed under the terms of the MIT License
# (see file LICENSE in root directory for details)
"""
Design ellip-Filters (LP, HP, BP, BS) with fixed or minimum ord... | [
"pyfda.pyfda_lib.fil_save",
"scipy.signal.ellip",
"pyfda.pyfda_qt_lib.qfilter_warning",
"pyfda.pyfda_lib.lin2unit",
"scipy.signal.ellipord"
] | [((4647, 4699), 'pyfda.pyfda_lib.lin2unit', 'lin2unit', (["fil_dict['A_PB']", '"""IIR"""', '"""A_PB"""'], {'unit': '"""dB"""'}), "(fil_dict['A_PB'], 'IIR', 'A_PB', unit='dB')\n", (4655, 4699), False, 'from pyfda.pyfda_lib import fil_save, SOS_AVAIL, lin2unit\n'), ((4720, 4772), 'pyfda.pyfda_lib.lin2unit', 'lin2unit', (... |
# Generated by Django 3.0.6 on 2022-03-25 18:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recommend', '0014_movie2'),
]
operations = [
migrations.AlterField(
model_name='movie2',
name='id',
fiel... | [
"django.db.models.IntegerField"
] | [((322, 376), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (341, 376), False, 'from django.db import migrations, models\n')] |
#import sys, os, serial, time,re,datetime
#import matplotlib.pyplot as plt
#import numpy as np
from tkinter import ttk
import tkinter as tk
from PIL import ImageTk, Image
''''********Global Variables**********'''
picname='default.png'
#This function gets a picture and puts it in a format that can be stuck in a label... | [
"PIL.ImageTk.PhotoImage",
"tkinter.Button",
"tkinter.Entry",
"PIL.Image.open",
"tkinter.Label",
"tkinter.Tk"
] | [((811, 818), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (816, 818), True, 'import tkinter as tk\n'), ((883, 931), 'tkinter.Entry', 'tk.Entry', (['master'], {'borderwidth': '(2)', 'relief': '"""groove"""'}), "(master, borderwidth=2, relief='groove')\n", (891, 931), True, 'import tkinter as tk\n'), ((1039, 1158), 'tkinter... |
import _sk_fail; _sk_fail._("xmlrpclib")
| [
"_sk_fail._"
] | [((17, 40), '_sk_fail._', '_sk_fail._', (['"""xmlrpclib"""'], {}), "('xmlrpclib')\n", (27, 40), False, 'import _sk_fail\n')] |
from typing import Tuple
from hypothesis import given
from gon.base import Compound
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.compounds)
def test_irreflexivity(compound: Compound) -> None:
assert not compound > compound
@given(strate... | [
"tests.utils.implication",
"tests.utils.equivalence",
"hypothesis.given"
] | [((190, 217), 'hypothesis.given', 'given', (['strategies.compounds'], {}), '(strategies.compounds)\n', (195, 217), False, 'from hypothesis import given\n'), ((308, 341), 'hypothesis.given', 'given', (['strategies.compounds_pairs'], {}), '(strategies.compounds_pairs)\n', (313, 341), False, 'from hypothesis import given\... |
import numpy as np
from gym import Env
from gym import spaces
import random
class PointEnv(Env):
"""
point robot on a 2-D plane with position control
tasks (aka goals) are positions on the plane
- tasks sampled from unit square
- reward is L2 distance
"""
def __init__(self, max_episode... | [
"numpy.random.uniform",
"numpy.copy",
"random.random",
"numpy.sin",
"numpy.array",
"gym.spaces.Box",
"numpy.cos"
] | [((407, 455), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-np.inf)', 'high': 'np.inf', 'shape': '(2,)'}), '(low=-np.inf, high=np.inf, shape=(2,))\n', (417, 455), False, 'from gym import spaces\n'), ((484, 526), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-1.0)', 'high': '(1.0)', 'shape': '(2,)'}), '(low=-1.0, hig... |
# Generated by Django 2.1.12 on 2019-10-03 07:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Challenge',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.migrations.AlterUniqueTogether"
] | [((2439, 2526), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""exprflag"""', 'unique_together': "{('expr', 'user')}"}), "(name='exprflag', unique_together={('expr',\n 'user')})\n", (2469, 2526), False, 'from django.db import migrations, models\n'), ((2567, 2661), 'dja... |
from typing import List
from enum import Enum
import os
from baidupcs_py.baidupcs import BaiduPCSApi
from baidupcs_py.commands.display import display_tasks
from baidupcs_py.commands.log import get_logger
from baidupcs_py.common.file_type import MEDIA_EXTS, IMAGE_EXTS, DOC_EXTS, ARCHIVE_EXTS
from baidupcs_py.common.url... | [
"baidupcs_py.common.url.is_magnet",
"baidupcs_py.commands.display.display_tasks",
"rich.print",
"os.path.splitext",
"baidupcs_py.commands.log.get_logger"
] | [((372, 392), 'baidupcs_py.commands.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (382, 392), False, 'from baidupcs_py.commands.log import get_logger\n'), ((1725, 1744), 'baidupcs_py.common.url.is_magnet', 'is_magnet', (['task_url'], {}), '(task_url)\n', (1734, 1744), False, 'from baidupcs_py.commo... |
# This is an exemplary script to run SMUTHI from within python.
#
# It evaluates the scattering response of a Si or Au NP on Au
# substrate. The system is excited by a dipole source. This is a good
# approximation to the exitation of a plasmon with a scanning
# tunneling microscope (STM).
import matplotlib.pyplot as p... | [
"matplotlib.pyplot.title",
"os.makedirs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.savetxt",
"os.path.exists",
"smuthi.optical_constants.read_refractive_index_from_yaml",
"numpy.hstack",
"matplotlib.pyplot.figure",
"numpy.... | [((8522, 8531), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (8529, 8531), True, 'import matplotlib.pyplot as plt\n'), ((8532, 8548), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (8541, 8548), True, 'import matplotlib.pyplot as plt\n'), ((2560, 2590), 'numpy.linspace', 'np.linspace... |
from telegram import bot
from decouple import config
from flask import Flask,request
TOKEN= config("TOKEN")
bot = bot.Bot(TOKEN)
chat_id=config("CHAT_ID")
app = Flask(__name__)
@app.route(f'/api/{TOKEN}/new_article',methods=["POST"])
def new_article():
data = request.get_json()
title = data["post"]["post_titl... | [
"telegram.bot.send_message",
"decouple.config",
"flask.Flask",
"telegram.bot.Bot",
"flask.request.get_json"
] | [((94, 109), 'decouple.config', 'config', (['"""TOKEN"""'], {}), "('TOKEN')\n", (100, 109), False, 'from decouple import config\n'), ((116, 130), 'telegram.bot.Bot', 'bot.Bot', (['TOKEN'], {}), '(TOKEN)\n', (123, 130), False, 'from telegram import bot\n'), ((139, 156), 'decouple.config', 'config', (['"""CHAT_ID"""'], {... |
#! /usr/bin/env python
"""
Module with sigma clipping functions.
"""
__author__ = '<NAME>', '<NAME>'
__all__ = ['clip_array',
'sigma_filter']
import numpy as np
from scipy.ndimage.filters import generic_filter
from astropy.stats import median_absolute_deviation
import warnings
try:
from numba impor... | [
"numpy.absolute",
"numpy.sum",
"numpy.median",
"numpy.std",
"numpy.floor",
"numpy.where",
"numpy.array",
"scipy.ndimage.filters.generic_filter",
"warnings.warn"
] | [((419, 452), 'warnings.warn', 'warnings.warn', (['msg', 'ImportWarning'], {}), '(msg, ImportWarning)\n', (432, 452), False, 'import warnings\n'), ((5101, 5117), 'numpy.sum', 'np.sum', (['bpix_map'], {}), '(bpix_map)\n', (5107, 5117), True, 'import numpy as np\n'), ((5366, 5378), 'numpy.where', 'np.where', (['bp'], {})... |
"""
Testing for dataio.py in mmhelper module
"""
# FILE : test_io.py
# CREATED : 11/11/16 13:04:18
# AUTHOR : <NAME> <<EMAIL>>
# DESCRIPTION : Unittests for IO functions
#
import traceback
import unittest
import os
import tempfile
import numpy as np
import skimage.io as skio
import mmhelper.dataio as mi... | [
"os.remove",
"traceback.print_exc",
"tempfile.mkstemp",
"mmhelper.dataio.load_sample_well_data",
"numpy.testing.assert_array_equal",
"numpy.dtype",
"mmhelper.dataio.split_fluorescence",
"mmhelper.dataio.load_data",
"numpy.array",
"numpy.arange",
"skimage.io.imsave"
] | [((622, 701), 'numpy.array', 'np.array', (['[[100, 200, 3], [4, 5, 6], [7, 8, 9], [100, 200, 255]]'], {'dtype': '"""uint8"""'}), "([[100, 200, 3], [4, 5, 6], [7, 8, 9], [100, 200, 255]], dtype='uint8')\n", (630, 701), True, 'import numpy as np\n'), ((821, 858), 'skimage.io.imsave', 'skio.imsave', (['self.filename', 'se... |
import calendar
import datetime as datetime_
import decimal
from typing import Generator, Optional, Sequence, Tuple, Union
import pytz
from dateutil import tz
from dateutil.relativedelta import relativedelta
from django.utils import timezone
from . import numbers, ranges
# Convenience type aliases for referencing fr... | [
"django.utils.timezone.get_current_timezone",
"django.utils.timezone.is_aware",
"pytz.utc.localize",
"datetime.time",
"django.utils.timezone.now",
"django.utils.timezone.make_aware",
"dateutil.relativedelta.relativedelta",
"dateutil.tz.tzlocal",
"datetime.datetime.utcfromtimestamp",
"datetime.time... | [((901, 931), 'pytz.timezone', 'pytz.timezone', (['"""Europe/London"""'], {}), "('Europe/London')\n", (914, 931), False, 'import pytz\n'), ((943, 970), 'datetime.timedelta', 'datetime_.timedelta', ([], {'days': '(1)'}), '(days=1)\n', (962, 970), True, 'import datetime as datetime_\n'), ((982, 1010), 'datetime.timedelta... |
#!/usr/bin/env python3
# Copyright 2020 The Pigweed Authors
#
# 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 applica... | [
"argparse.ArgumentParser",
"pw_presubmit.build.env_with_clang_vars",
"pw_presubmit.cli.add_arguments",
"pw_cli.log.install",
"pw_presubmit.python_checks.all_checks",
"os.path.isfile",
"pw_presubmit.call",
"os.path.join",
"pw_presubmit.filter_paths",
"os.path.abspath",
"pw_presubmit.cli.run",
"... | [((1354, 1381), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1371, 1381), False, 'import logging\n'), ((1652, 1778), 'pw_presubmit.build.gn_args', 'build.gn_args', ([], {'pw_target_config': '""""//targets/host/target_config.gni\\""""', 'pw_target_toolchain': '""""//pw_toolchain:host_cl... |
# Given a rod of length n inches and a table of prices T[i] for i = [1, 2, ..., n].
# Determine the maximum revenue r[n] obtainable by cutting up the rod and selling
# the pieces.
from time import perf_counter
# 1st solution: Top-down with memoization
def memoized_cut_rod(T, n):
revenue = [-1]*(n+1)
return ... | [
"time.perf_counter"
] | [((1594, 1608), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (1606, 1608), False, 'from time import perf_counter\n'), ((1646, 1660), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (1658, 1660), False, 'from time import perf_counter\n'), ((1671, 1685), 'time.perf_counter', 'perf_counter', ([], {}), '()... |
# Generated by Django 2.2.5 on 2019-12-13 07:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dockerapi', '0013_auto_20191213_1501'),
]
operations = [
migrations.AddField(
model_name='combinationimage',
name='c... | [
"django.db.models.CharField",
"django.db.models.TextField"
] | [((356, 416), 'django.db.models.TextField', 'models.TextField', ([], {'default': '""""""', 'null': '(True)', 'verbose_name': '"""环境描述"""'}), "(default='', null=True, verbose_name='环境描述')\n", (372, 416), False, 'from django.db import migrations, models\n'), ((543, 682), 'django.db.models.CharField', 'models.CharField', ... |
import unittest
from aviation_weather import Temperature
from aviation_weather.exceptions import TemperatureDecodeError
class TestTemperature(unittest.TestCase):
"""Unit tests for aviation_weather.components.temperature.Temperature"""
def _test_valid(self, raw, temperature, dew_point):
t = Temperatur... | [
"aviation_weather.Temperature"
] | [((310, 326), 'aviation_weather.Temperature', 'Temperature', (['raw'], {}), '(raw)\n', (321, 326), False, 'from aviation_weather import Temperature\n'), ((834, 850), 'aviation_weather.Temperature', 'Temperature', (['raw'], {}), '(raw)\n', (845, 850), False, 'from aviation_weather import Temperature\n')] |
# Generated by Django 2.0.1 on 2019-01-01 22:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('maingame', '0004_player_leader'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((1973, 2072), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""quiklash.QuiklashMainGame"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'quiklash.QuiklashMainGame')\n", (1990, 2072), False, 'from django.db import migrations, models\n... |
"""Testing pooling.
Author: <NAME>
Email : <EMAIL>
"""
import numpy as np
import theano
import theano.tensor as T
from snntoolbox.simulation.backends.inisim_backend import pool_same_size
x = T.tensor4("x")
y = pool_same_size(x, (2, 2), True, (1, 1))
f = theano.function([x], [y])
A = np.array([[[[1., 1., 1., 1.... | [
"snntoolbox.simulation.backends.inisim_backend.pool_same_size",
"numpy.array",
"theano.tensor.tensor4",
"theano.function"
] | [((195, 209), 'theano.tensor.tensor4', 'T.tensor4', (['"""x"""'], {}), "('x')\n", (204, 209), True, 'import theano.tensor as T\n'), ((214, 253), 'snntoolbox.simulation.backends.inisim_backend.pool_same_size', 'pool_same_size', (['x', '(2, 2)', '(True)', '(1, 1)'], {}), '(x, (2, 2), True, (1, 1))\n', (228, 253), False, ... |
from django.db import models
from django.utils import timezone
# Create your models here.
''' There will be 2 models present. 1 for the posts themselves, and another for the responses. '''
class RedditPostData(models.Model):
title = models.CharField(max_length=300) # Somewhat arbitrary limit, but RES puts t... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.URLField"
] | [((238, 270), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)'}), '(max_length=300)\n', (254, 270), False, 'from django.db import models\n'), ((360, 381), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (379, 381), False, 'from django.db import models\n'), ((396, 4... |
import socket
import sys
import time
from packet import packet
import threading
from os import walk
BUFFER_SIZE = 1024
trackerAddress = sys.argv[1]
trackerPort = int(sys.argv[2])
minAliveTime = int(sys.argv[3])
fileDic = {}
peerNum = None
isFin = False
originFilename = ""
def listenForFile(UDPSocket, ackSocket):
... | [
"threading.Thread",
"packet.packet",
"packet.packet.parse_udp_data",
"socket.socket",
"os.walk",
"socket.gethostbyname",
"socket.gethostname"
] | [((2110, 2159), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (2123, 2159), False, 'import socket\n'), ((2258, 2278), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (2276, 2278), False, 'import socket\n'), ((2296, 2326), 'socke... |
import folium
map_tileset = ('https://webrd01.is.autonavi.com/appmaptile?'
'lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}')
load_node_location = lambda x: (x.lat, x.lng)
get_avg_location = lambda x, y: ((x.lat + y.lat)/2., (x.lng + y.lng)/2.)
import uuid
gen_uuid = lambda: uuid.uuid4().hex
impor... | [
"utils.distance.gcd_distance",
"uuid.uuid4",
"os.path.dirname",
"folium.Map",
"folium.Icon"
] | [((2164, 2250), 'folium.Map', 'folium.Map', ([], {'location': 'avg_location', 'zoom_start': '(12)', 'attr': 'content', 'tiles': 'map_tileset'}), '(location=avg_location, zoom_start=12, attr=content, tiles=\n map_tileset)\n', (2174, 2250), False, 'import folium\n'), ((297, 309), 'uuid.uuid4', 'uuid.uuid4', ([], {}), ... |
from com.sun.star.table import CellRangeAddress
from com.sun.star.table.TableOrientation import ROWS
from com.sun.star.table.TableOrientation import COLUMNS
def groupRows(sheet, groupStartRow, groupEndRow):
cra = CellRangeAddress()
cra.Sheet = sheet.RangeAddress.Sheet
cra.StartRow = groupStartRow
cra.... | [
"com.sun.star.table.CellRangeAddress"
] | [((219, 237), 'com.sun.star.table.CellRangeAddress', 'CellRangeAddress', ([], {}), '()\n', (235, 237), False, 'from com.sun.star.table import CellRangeAddress\n'), ((432, 450), 'com.sun.star.table.CellRangeAddress', 'CellRangeAddress', ([], {}), '()\n', (448, 450), False, 'from com.sun.star.table import CellRangeAddres... |
from setuptools import setup
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements("requirements.in", s... | [
"setuptools.setup",
"pip.req.parse_requirements"
] | [((281, 333), 'pip.req.parse_requirements', 'parse_requirements', (['"""requirements.in"""'], {'session': '(False)'}), "('requirements.in', session=False)\n", (299, 333), False, 'from pip.req import parse_requirements\n'), ((457, 720), 'setuptools.setup', 'setup', ([], {'name': '"""funniest"""', 'version': '"""0.1"""',... |
"""Description
Setup script to install RnaChipIntegrator: analyses of peak data with
genomic feature data
Copyright (C) University of Manchester 2011-20 <NAME>, <NAME>, <NAME>
"""
from setuptools import setup
import rnachipintegrator
# Package version
version = rnachipintegrator.get_version()
download_url = 'http... | [
"glob.glob",
"setuptools.setup",
"rnachipintegrator.get_version"
] | [((267, 298), 'rnachipintegrator.get_version', 'rnachipintegrator.get_version', ([], {}), '()\n', (296, 298), False, 'import rnachipintegrator\n'), ((662, 2088), 'setuptools.setup', 'setup', ([], {'name': '"""RnaChipIntegrator"""', 'version': 'version', 'description': '"""Analyse genes against peak data, and vice versa... |
'''
<NAME>
Snippets:
pykrige
Reference:
Official documentation
'''
import numpy as np
import pykrige.kriging_tools as kt
from pykrige.ok import OrdinaryKriging
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
path = 'data/private.txt'
data = pd.re... | [
"numpy.meshgrid",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.imshow",
"pykrige.ok.OrdinaryKriging"
] | [((315, 348), 'pandas.read_csv', 'pd.read_csv', (['path'], {'delimiter': '"""\t"""'}), "(path, delimiter='\\t')\n", (326, 348), True, 'import pandas as pd\n'), ((482, 498), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (496, 498), False, 'from sklearn.preprocessing import StandardScaler\n'... |
import os
import shlex
import subprocess
import tempfile
from ..types import Config, Job
from .base import BaseBackend
from ..ctk import get_chaostoolkit_settings
from ..log import logger
__all__ = ["ShellBackend"]
class ShellBackend(BaseBackend):
def __init__(self, config: Config) -> None:
BaseBackend.... | [
"tempfile.NamedTemporaryFile",
"os.path.exists",
"shlex.split"
] | [((618, 642), 'os.path.exists', 'os.path.exists', (['self.bin'], {}), '(self.bin)\n', (632, 642), False, 'import os\n'), ((1301, 1338), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'mode': '"""w"""'}), "(mode='w')\n", (1328, 1338), False, 'import tempfile\n'), ((1801, 1822), 'shlex.split', 'shlex... |
import logging
from typing import Optional, Union
from urllib.parse import urlparse
from pysherplus.authentication import PysherAuthentication
from pysherplus.channel import Channel
from pysherplus.connection import Connection
VERSION = '2.0.1' # TODO dedup this with the one in setup.py
class PusherHost(object):
... | [
"pysherplus.channel.Channel",
"urllib.parse.urlparse"
] | [((628, 641), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (636, 641), False, 'from urllib.parse import urlparse\n'), ((3636, 3675), 'pysherplus.channel.Channel', 'Channel', (['channel_name', 'self._connection'], {}), '(channel_name, self._connection)\n', (3643, 3675), False, 'from pysherplus.channel ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.