code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# This file contains the main handler function that will be run by the AWS Lambda upon trigger.
# It copies data from an S3 folder and put them into a BigQuery dataset.
import boto3
import os
import psycopg2
from google.cloud import bigquery
from google.cloud.exceptions import NotFound
def lambda_handler(event, cont... | [
"boto3.client",
"google.cloud.bigquery.Client",
"google.cloud.bigquery.LoadJobConfig",
"os.getenv",
"psycopg2.connect"
] | [((406, 438), 'os.getenv', 'os.getenv', (['"""BIGQUERY_PROJECT_ID"""'], {}), "('BIGQUERY_PROJECT_ID')\n", (415, 438), False, 'import os\n'), ((456, 488), 'os.getenv', 'os.getenv', (['"""BIGQUERY_DATASET_ID"""'], {}), "('BIGQUERY_DATASET_ID')\n", (465, 488), False, 'import os\n'), ((511, 539), 'os.getenv', 'os.getenv', ... |
import http.client
import ast
token = '964615920:<KEY>'
conn = http.client.HTTPSConnection("covid-19-data.p.rapidapi.com")
headers = {
'x-rapidapi-host': "covid-19-data.p.rapidapi.com",
'x-rapidapi-key': "62acce0ea1mshf007f9b817ad5fcp190835jsndb975b7e65b0"
}
conn.request("GET", "/country?for... | [
"ast.literal_eval"
] | [((477, 501), 'ast.literal_eval', 'ast.literal_eval', (['corona'], {}), '(corona)\n', (493, 501), False, 'import ast\n')] |
###
# Copyright (c) 2010, <NAME>
# Copyright (c) 2010-2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... | [
"supybot.i18n.PluginInternationalization",
"supybot.callbacks.Plugin.__init__",
"collections.namedtuple",
"supybot.callbacks.tokenize",
"supybot.i18n.internationalizeDocstring"
] | [((11196, 11234), 'supybot.i18n.internationalizeDocstring', 'internationalizeDocstring', (['Conditional'], {}), '(Conditional)\n', (11221, 11234), False, 'from supybot.i18n import internationalizeDocstring\n'), ((1938, 1979), 'supybot.i18n.PluginInternationalization', 'PluginInternationalization', (['"""Conditional"""'... |
import ast
from snippeteer.parse.imports import Imports
from snippeteer.parse.function import Function
def test_tiny():
code = "def f(arg): pass"
parsed_code = ast.parse(code, mode="exec")
function = Function.from_ast(imports=Imports(), function_def=parsed_code.body[0])
assert function == Function(
... | [
"snippeteer.parse.imports.Imports.Alias",
"ast.parse",
"snippeteer.parse.imports.Imports"
] | [((170, 198), 'ast.parse', 'ast.parse', (['code'], {'mode': '"""exec"""'}), "(code, mode='exec')\n", (179, 198), False, 'import ast\n'), ((651, 679), 'ast.parse', 'ast.parse', (['code'], {'mode': '"""exec"""'}), "(code, mode='exec')\n", (660, 679), False, 'import ast\n'), ((1128, 1156), 'ast.parse', 'ast.parse', (['cod... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.params import ParlaiParser
from parlai.mturk.core.mturk_manager import MTurkManager
from worlds import (
MTurkPersonalityCap... | [
"parlai.tasks.personality_captions.agents.PersonalityCaptionsTeacher.add_cmdline_args",
"os.path.abspath",
"os.path.basename",
"os.getcwd",
"worlds.ExampleGenerator",
"parlai.core.params.ParlaiParser",
"parlai.mturk.core.mturk_manager.MTurkManager",
"worlds.RoleOnboardWorld",
"os.path.join"
] | [((2300, 2326), 'parlai.core.params.ParlaiParser', 'ParlaiParser', (['(False)', '(False)'], {}), '(False, False)\n', (2312, 2326), False, 'from parlai.core.params import ParlaiParser\n'), ((3762, 3816), 'parlai.tasks.personality_captions.agents.PersonalityCaptionsTeacher.add_cmdline_args', 'PersonalityCaptionsTeacher.a... |
import time
from datetime import datetime
import curses
from curses import wrapper
import math
import random
from .world import Entity
from .settings import Color
from .settings import settings
from .menu import menu_show
from .utils import utils
from .state import state
from .utils import scr
class Main:
def __ini... | [
"curses.noecho",
"curses.initscr",
"curses.wrapper",
"datetime.datetime.now",
"curses.endwin",
"curses.start_color",
"time.sleep",
"curses.cbreak",
"curses.mousemask",
"curses.curs_set",
"curses.init_pair"
] | [((376, 392), 'curses.initscr', 'curses.initscr', ([], {}), '()\n', (390, 392), False, 'import curses\n'), ((401, 419), 'curses.curs_set', 'curses.curs_set', (['(0)'], {}), '(0)\n', (416, 419), False, 'import curses\n'), ((428, 443), 'curses.noecho', 'curses.noecho', ([], {}), '()\n', (441, 443), False, 'import curses\... |
""" This module will test the functionality of samply.BallSampler
"""
import unittest
import samply
from scipy.stats import kstest, uniform
import numpy as np
import math
class TestBallSampler(unittest.TestCase):
""" Class for testing the Ball sampler
"""
def setup(self):
"""
"""
... | [
"unittest.main",
"scipy.stats.kstest",
"numpy.random.seed",
"numpy.arctan2",
"samply.ball.uniform",
"numpy.max",
"numpy.linalg.norm"
] | [((984, 999), 'unittest.main', 'unittest.main', ([], {}), '()\n', (997, 999), False, 'import unittest\n'), ((406, 423), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (420, 423), True, 'import numpy as np\n'), ((442, 471), 'samply.ball.uniform', 'samply.ball.uniform', (['(10000)', '(2)'], {}), '(10000, ... |
from django.db import close_old_connections
from rest_framework_simplejwt.tokens import UntypedToken
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from jwt import decode as jwt_decode
from django.conf import settings
from django.contrib.auth import get_user_model
from urllib.parse import pars... | [
"django.contrib.auth.get_user_model",
"rest_framework_simplejwt.tokens.UntypedToken",
"django.db.close_old_connections",
"jwt.decode"
] | [((506, 529), 'django.db.close_old_connections', 'close_old_connections', ([], {}), '()\n', (527, 529), False, 'from django.db import close_old_connections\n'), ((671, 690), 'rest_framework_simplejwt.tokens.UntypedToken', 'UntypedToken', (['token'], {}), '(token)\n', (683, 690), False, 'from rest_framework_simplejwt.to... |
from __future__ import print_function, absolute_import
import os
import glob
import re
import sys
import urllib
import tarfile
import zipfile
import os.path as osp
from scipy.io import loadmat
import numpy as np
import h5py
from scipy.misc import imsave
from utils import mkdir_if_missing, write_json, read_json
"""Ima... | [
"scipy.io.loadmat",
"numpy.mean",
"numpy.arange",
"scipy.misc.imsave",
"utils.write_json",
"os.path.join",
"utils.mkdir_if_missing",
"os.path.exists",
"numpy.max",
"urllib.urlretrieve",
"tarfile.open",
"numpy.random.shuffle",
"h5py.File",
"os.path.basename",
"numpy.sort",
"numpy.min",
... | [((782, 814), 'os.path.join', 'osp.join', (['root', 'self.dataset_dir'], {}), '(root, self.dataset_dir)\n', (790, 814), True, 'import os.path as osp\n'), ((840, 888), 'os.path.join', 'osp.join', (['self.dataset_dir', '"""bounding_box_train"""'], {}), "(self.dataset_dir, 'bounding_box_train')\n", (848, 888), True, 'impo... |
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.ForeignKey",
"django.db.models.DateField"
] | [((810, 848), 'django.db.models.CharField', 'CharField', ([], {'max_length': '(300)', 'unique': '(True)'}), '(max_length=300, unique=True)\n', (819, 848), False, 'from django.db.models import CharField, DateField, DateTimeField\n'), ((2576, 2608), 'django.db.models.DateTimeField', 'DateTimeField', ([], {'auto_now_add':... |
# Copyright 2018 Google LLC
#
# 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, ... | [
"tensorflow_data_validation.utils.batch_util.BatchExamples",
"absl.testing.absltest.main",
"apache_beam.Create",
"apache_beam.Pipeline",
"numpy.array"
] | [((2832, 2847), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2845, 2847), False, 'from absl.testing import absltest\n'), ((2559, 2574), 'apache_beam.Pipeline', 'beam.Pipeline', ([], {}), '()\n', (2572, 2574), True, 'import apache_beam as beam\n'), ((1011, 1050), 'numpy.array', 'np.array', (['[1.0, ... |
from knx_stack import Octect, Msg
from knx_stack.definition.cemi import MessageCode
from knx_stack.encode.usb_hid import emi_id
def encode(state: "knx_stack.State", msg: "knx_stack.Msg") -> "knx_stack.Msg":
message_code = Octect(value=MessageCode.L_Data_ind)
additional_info_length = Octect(value=0)
new_ms... | [
"knx_stack.Octect",
"knx_stack.Msg",
"knx_stack.encode.usb_hid.emi_id.encode"
] | [((228, 264), 'knx_stack.Octect', 'Octect', ([], {'value': 'MessageCode.L_Data_ind'}), '(value=MessageCode.L_Data_ind)\n', (234, 264), False, 'from knx_stack import Octect, Msg\n'), ((294, 309), 'knx_stack.Octect', 'Octect', ([], {'value': '(0)'}), '(value=0)\n', (300, 309), False, 'from knx_stack import Octect, Msg\n'... |
# -*- coding: utf-8 -*-
"""Unit tests for Properties class"""
import pytest
from ga4gh.refget.config.defaults import \
DEFAULT_PROPERTIES, DEFAULT_ALLOWED_PROPERTY_KEYS
from ga4gh.refget.config.properties import Properties
from ga4gh.refget.config.exceptions import RefgetInvalidPropertyException
testdata = [
... | [
"ga4gh.refget.config.properties.Properties",
"pytest.mark.parametrize"
] | [((847, 911), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""props_dict,raises_exception"""', 'testdata'], {}), "('props_dict,raises_exception', testdata)\n", (870, 911), False, 'import pytest\n'), ((998, 1020), 'ga4gh.refget.config.properties.Properties', 'Properties', (['props_dict'], {}), '(props_dict)\... |
##!/usr/bin/python
#
# ============================================================================
#
# 10.04.18 <-- Date of Last Modification.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ----------------------------------------------------------------------------
#
# ICAT UPDATE MODULE
#
# Copyright (C... | [
"os.makedirs",
"os.path.basename",
"os.path.exists",
"json.dumps",
"time.sleep",
"suds.client.Client",
"requests.get",
"shutil.copyfile",
"requests.post",
"shutil.copyfileobj",
"os.path.join",
"sys.stdin.readline"
] | [((5206, 5231), 'os.path.exists', 'os.path.exists', (['cachePath'], {}), '(cachePath)\n', (5220, 5231), False, 'import os\n'), ((5380, 5416), 'os.path.join', 'os.path.join', (['cacheDir', "f['dirpath']"], {}), "(cacheDir, f['dirpath'])\n", (5392, 5416), False, 'import os\n'), ((10290, 10326), 'os.path.join', 'os.path.j... |
import json
import logging
import os
import re
import time
import urllib.parse
import urllib.request
import config
import pycdlib
import yaml
from definitions import PS2Game
from galaxy.api.types import LocalGame, LocalGameState
QUERY_URL = "https://www.giantbomb.com/api/search/?api_key={}&field_list=id,name&format=j... | [
"logging.exception",
"logging.debug",
"os.path.basename",
"galaxy.api.types.LocalGame",
"time.time",
"os.path.expandvars",
"re.search",
"os.path.join",
"pycdlib.PyCdlib"
] | [((3140, 3157), 'pycdlib.PyCdlib', 'pycdlib.PyCdlib', ([], {}), '()\n', (3155, 3157), False, 'import pycdlib\n'), ((6174, 6315), 'os.path.expandvars', 'os.path.expandvars', (['"""%LOCALAPPDATA%\\\\GOG.com\\\\Galaxy\\\\plugins\\\\installed\\\\ps2_1e814707-1fe3-4e1e-86fe-1b8d1b7fac2e\\\\GameIndex.yaml"""'], {}), "(\n ... |
import sys
from typing import Dict, Callable
import pygame
from pygame.math import Vector2
from game_objects.entities.player_management import PlayerManagement
from music_manager import MusicManager
from scene import Scene
class SceneManagement:
__scenes: Dict[str, Callable[..., Scene]]
active_scene: Scene
... | [
"pygame.math.Vector2",
"pygame.display.get_surface",
"music_manager.MusicManager.play_music",
"music_manager.MusicManager.stop_music",
"sys.exit"
] | [((948, 961), 'pygame.math.Vector2', 'Vector2', (['(0)', '(0)'], {}), '(0, 0)\n', (955, 961), False, 'from pygame.math import Vector2\n'), ((1216, 1241), 'music_manager.MusicManager.stop_music', 'MusicManager.stop_music', ([], {}), '()\n', (1239, 1241), False, 'from music_manager import MusicManager\n'), ((1250, 1275),... |
import dash_core_components as dcc
import dash_html_components as html
from dash import Dash
from dash.dependencies import Input, Output, State
app = Dash(suppress_callback_exceptions=True)
app.layout=html.Div(
id='output',
children=[
html.Div("Default thing"),
html.Button("Load more",id='loa... | [
"dash.Dash",
"dash_html_components.Div",
"dash_html_components.Button",
"dash.dependencies.State",
"dash.dependencies.Input",
"dash.dependencies.Output"
] | [((152, 191), 'dash.Dash', 'Dash', ([], {'suppress_callback_exceptions': '(True)'}), '(suppress_callback_exceptions=True)\n', (156, 191), False, 'from dash import Dash\n'), ((377, 405), 'dash.dependencies.Output', 'Output', (['"""output"""', '"""children"""'], {}), "('output', 'children')\n", (383, 405), False, 'from d... |
import torch
def batched_forward(
model: torch.nn.Module, data: torch.Tensor, device: torch.device, batch_size: int = 128, **kwargs
) -> torch.Tensor:
r"""Convenience function, which allows to run the forward in micro-batches.
When the just model.forward(data) does not fit into device memory, e.g. on lap... | [
"torch.cat"
] | [((1697, 1723), 'torch.cat', 'torch.cat', (['out_list'], {'dim': '(0)'}), '(out_list, dim=0)\n', (1706, 1723), False, 'import torch\n')] |
from appyter.ext.socketio import AsyncServer
socketio = AsyncServer(async_mode='aiohttp')
| [
"appyter.ext.socketio.AsyncServer"
] | [((57, 90), 'appyter.ext.socketio.AsyncServer', 'AsyncServer', ([], {'async_mode': '"""aiohttp"""'}), "(async_mode='aiohttp')\n", (68, 90), False, 'from appyter.ext.socketio import AsyncServer\n')] |
# Copyright 2017 OpenStack Foundation
# 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 requ... | [
"magnum.common.rpc.cleanup",
"unittest.mock.patch.object",
"magnum.common.context.to_dict.assert_called_once_with",
"magnum.common.rpc.add_extra_exmods",
"magnum.common.rpc.get_client",
"magnum.common.rpc.get_transport_url",
"unittest.mock.Mock",
"magnum.common.rpc.RequestContextSerializer",
"magnum... | [((913, 953), 'unittest.mock.patch.object', 'mock.patch.object', (['rpc', '"""profiler"""', 'None'], {}), "(rpc, 'profiler', None)\n", (930, 953), False, 'from unittest import mock\n'), ((959, 1009), 'unittest.mock.patch.object', 'mock.patch.object', (['rpc', '"""RequestContextSerializer"""'], {}), "(rpc, 'RequestConte... |
def ftp_server(other):
try:
import wifi
wifi.try_connect()
import time
while wifi.isconnected() is False:
time.sleep(1)
import ftptiny
ftp = ftptiny.FtpTiny()
ftp.start()
other()
finally:
print('ftp.stop()')
f... | [
"ftptiny.FtpTiny",
"wifi.isconnected",
"wifi.try_connect",
"time.sleep"
] | [((61, 79), 'wifi.try_connect', 'wifi.try_connect', ([], {}), '()\n', (77, 79), False, 'import wifi\n'), ((206, 223), 'ftptiny.FtpTiny', 'ftptiny.FtpTiny', ([], {}), '()\n', (221, 223), False, 'import ftptiny\n'), ((114, 132), 'wifi.isconnected', 'wifi.isconnected', ([], {}), '()\n', (130, 132), False, 'import wifi\n')... |
# Generated by Django 2.2.20 on 2021-05-11 15:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('content_libraries', '00... | [
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((228, 285), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (259, 285), False, 'from django.db import migrations, models\n'), ((482, 575), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
from __future__ import absolute_import, print_function
import six
from time import time
from sentry.api.serializers import serialize, app_platform_event
from sentry.http import safe_urlopen
from sentry.models import Group, SentryAppInstallation, ServiceHook
from sentry.tasks.base import instrumented_task, retry
from... | [
"sentry.api.serializers.serialize",
"sentry.models.ServiceHook.objects.get",
"sentry.tasks.base.instrumented_task",
"sentry.utils.json.dumps",
"sentry.tsdb.incr",
"sentry.models.ServiceHook.objects.filter",
"time.time",
"sentry.tasks.base.retry",
"sentry.models.SentryAppInstallation.objects.get"
] | [((814, 918), 'sentry.tasks.base.instrumented_task', 'instrumented_task', (['"""sentry.tasks.process_resource_change"""'], {'default_retry_delay': '(60 * 5)', 'max_retries': '(5)'}), "('sentry.tasks.process_resource_change',\n default_retry_delay=60 * 5, max_retries=5)\n", (831, 918), False, 'from sentry.tasks.base ... |
import wget
import sys
import os
from helen.modules.python.FileManager import FileManager
from helen.modules.python.TextColor import TextColor
def download_models(output_dir):
output_dir = FileManager.handle_output_directory(output_dir)
sys.stderr.write(TextColor.YELLOW + "DOWNLOADING MODEL DESCRIPTION FILE" ... | [
"os.remove",
"wget.download",
"helen.modules.python.FileManager.FileManager.handle_output_directory",
"sys.stderr.write",
"sys.stderr.flush"
] | [((195, 242), 'helen.modules.python.FileManager.FileManager.handle_output_directory', 'FileManager.handle_output_directory', (['output_dir'], {}), '(output_dir)\n', (230, 242), False, 'from helen.modules.python.FileManager import FileManager\n'), ((247, 347), 'sys.stderr.write', 'sys.stderr.write', (["(TextColor.YELLOW... |
# Copyright 2018 Tensorforce Team. 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 la... | [
"tensorflow.control_dependencies",
"tensorforce.util.identity_operation"
] | [((2696, 2731), 'tensorforce.util.identity_operation', 'util.identity_operation', ([], {'x': 'variable'}), '(x=variable)\n', (2719, 2731), False, 'from tensorforce import util\n'), ((2818, 2876), 'tensorflow.control_dependencies', 'tf.control_dependencies', ([], {'control_inputs': 'previous_variables'}), '(control_inpu... |
import os
import requests
from vortexasdk.endpoints.endpoints import API_FQDN
all_tests_pass = True
def check_api_key_present():
global all_tests_pass
api_key = os.getenv("VORTEXA_API_KEY")
if api_key is None:
print("Environment variable VORTEXA_API_KEY is not set.")
print(
"... | [
"vortexasdk.Geographies",
"os.getenv",
"requests.get"
] | [((173, 201), 'os.getenv', 'os.getenv', (['"""VORTEXA_API_KEY"""'], {}), "('VORTEXA_API_KEY')\n", (182, 201), False, 'import os\n'), ((912, 929), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (924, 929), False, 'import requests\n'), ((1961, 1974), 'vortexasdk.Geographies', 'Geographies', ([], {}), '()\n', (... |
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.runtime.queries.update_entity_query import UpdateEntityQuery
from office365.sharepoint.publishing.site_page_metadata import SitePageMetadata
class SitePage(SitePageMetadata):
"""Represents a site Page."""
def c... | [
"office365.runtime.queries.service_operation_query.ServiceOperationQuery"
] | [((482, 554), 'office365.runtime.queries.service_operation_query.ServiceOperationQuery', 'ServiceOperationQuery', (['self', '"""CheckoutPage"""', 'None', 'None', 'None', 'site_page'], {}), "(self, 'CheckoutPage', None, None, None, site_page)\n", (503, 554), False, 'from office365.runtime.queries.service_operation_query... |
import base64
from unittest import TestCase
from gw_bot.Deploy import Deploy
from osbot_aws.apis.Lambda import Lambda
from osbot_jupyter.osbot.Jupyter_Web_Commands import Jupyter_Web_Commands
from osbot_utils.utils import Misc
from osbot_utils.utils.Dev import Dev
class test_Jupyter_Web_Commands(TestCase):
def ... | [
"osbot_jupyter.osbot.Jupyter_Web_Commands.Jupyter_Web_Commands.update_notebook",
"osbot_jupyter.osbot.Jupyter_Web_Commands.Jupyter_Web_Commands.exec",
"osbot_jupyter.osbot.Jupyter_Web_Commands.Jupyter_Web_Commands.preview",
"osbot_jupyter.osbot.Jupyter_Web_Commands.Jupyter_Web_Commands.create_file",
"osbot_... | [((972, 1042), 'osbot_jupyter.osbot.Jupyter_Web_Commands.Jupyter_Web_Commands.screenshot', 'Jupyter_Web_Commands.screenshot', ([], {'params': 'params', 'headless': 'self.headless'}), '(params=params, headless=self.headless)\n', (1003, 1042), False, 'from osbot_jupyter.osbot.Jupyter_Web_Commands import Jupyter_Web_Comma... |
from django import template
register = template.Library()
@register.filter
def div(x,y):
return int(x)/int(y) | [
"django.template.Library"
] | [((40, 58), 'django.template.Library', 'template.Library', ([], {}), '()\n', (56, 58), False, 'from django import template\n')] |
"""LIFE, but not as we know it."""
# Project initiation March 2017, just got my Raspberry Pi SenseHat.
# Becomming a mad hatter....
# Developing a script which runs LIFE on a Raspberry Pi 8x8 grid.
# Using colors
# http://www.python-course.eu/tkinter_labels.php
# https://en.wikipedia.org/wiki/Conway%27s_Gam... | [
"sense_hat.SenseHat",
"math.floor",
"random.randint",
"time.sleep"
] | [((793, 803), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (801, 803), False, 'from sense_hat import SenseHat\n'), ((9942, 9955), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (9952, 9955), False, 'import time\n'), ((10022, 10035), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (10032, 10035), False, ... |
from bs4 import BeautifulSoup
import requests
r=requests.get('https://www.myntra.com/dresses?f=Gender%3Amen%20women%2Cwomen')
soup=BeautifulSoup(r.content,'lxml')
title=soup.find_all("h3",{"class": "product-brand"})
price=soup.find_all("h4",{"class": "product-price"})
images=soup.find_all("div",{"class":"product... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((51, 128), 'requests.get', 'requests.get', (['"""https://www.myntra.com/dresses?f=Gender%3Amen%20women%2Cwomen"""'], {}), "('https://www.myntra.com/dresses?f=Gender%3Amen%20women%2Cwomen')\n", (63, 128), False, 'import requests\n'), ((135, 167), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""lxml"""'], {}),... |
from cloudant.client import Cloudant
from cloudant.error import CloudantException
from cloudant.result import Result, ResultByKey
serviceUsername = ""
servicePassword = ""
serviceURL = ""
client = Cloudant(serviceUsername, servicePassword, url=serviceURL)
client.connect()
print ("Successfully connected to C... | [
"cloudant.client.Cloudant"
] | [((207, 265), 'cloudant.client.Cloudant', 'Cloudant', (['serviceUsername', 'servicePassword'], {'url': 'serviceURL'}), '(serviceUsername, servicePassword, url=serviceURL)\n', (215, 265), False, 'from cloudant.client import Cloudant\n')] |
import MySQLdb
import csv
import codecs
def get_conn():
db = MySQLdb.connect(host='172.16.50.145', port=4000, user='shtelecom_query',
passwd='<PASSWORD>', db='telecom-wx')
return db
def execute_all(cursor, sql, args):
cursor.execute(sql, args)
return cursor.fetchall()
def ... | [
"csv.writer",
"codecs.open",
"MySQLdb.connect"
] | [((67, 181), 'MySQLdb.connect', 'MySQLdb.connect', ([], {'host': '"""172.16.50.145"""', 'port': '(4000)', 'user': '"""shtelecom_query"""', 'passwd': '"""<PASSWORD>"""', 'db': '"""telecom-wx"""'}), "(host='172.16.50.145', port=4000, user='shtelecom_query',\n passwd='<PASSWORD>', db='telecom-wx')\n", (82, 181), False,... |
#////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
# Name :
# Author : Avi
# Revision : $Revision: #10 $
#
# Copyright 2009-2020 ECMWF.
# This software is licensed under the terms of the Apache Licence version 2.0
# which can be obtained at http://www.apache.org/licenses/LIC... | [
"ecflow.Client",
"ecflow.debug_build",
"argparse.ArgumentParser",
"time.time"
] | [((1645, 1745), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESC', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=DESC, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (1668, 1745), False, 'import argparse\n'), ((2396, 2424), 'ecflow.Client', '... |
## 该脚本主要用于对表情包文件重命名
## 防止评论加载不同类别表情包文件时产生命名冲突
import os
import shutil
import argparse
IMAGE_SUFFIX = ['.png', '.jpg', '.jpeg', '.gif', '.webp']
# 对表情包文件重命名
def rename(dir, args):
count = 0
name = os.path.basename(dir)
for file in os.listdir(dir):
suffix = os.path.splitext(file)[-1]
if suf... | [
"os.path.abspath",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.isdir",
"os.rename",
"os.path.exists",
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((207, 228), 'os.path.basename', 'os.path.basename', (['dir'], {}), '(dir)\n', (223, 228), False, 'import os\n'), ((245, 260), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (255, 260), False, 'import os\n'), ((678, 703), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (701, 703), False,... |
from typing import TypeVar, List
from jmetal.algorithm.adaptive.adaptive import DiversityBasedMechanismAdaptation
from jmetal.algorithm.singleobjective.shade import SHADE
from jmetal.config import store
from jmetal.core.problem import Problem
from jmetal.operator import RankingAndCrowdingDistanceSelection
from jmetal.... | [
"jmetal.operator.selection.MOpBest",
"numpy.sum",
"jmetal.operator.RankingAndCrowdingDistanceSelection",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.mean",
"numpy.array",
"numpy.random.choice",
"typing.TypeVar"
] | [((553, 565), 'typing.TypeVar', 'TypeVar', (['"""S"""'], {}), "('S')\n", (560, 565), False, 'from typing import TypeVar, List\n'), ((570, 582), 'typing.TypeVar', 'TypeVar', (['"""R"""'], {}), "('R')\n", (577, 582), False, 'from typing import TypeVar, List\n'), ((1524, 1533), 'jmetal.operator.selection.MOpBest', 'MOpBes... |
"""
.. module:: dj-stripe.tests.test_context_managers
:synopsis: dj-stripe Context Manager Tests.
.. moduleauthor:: <NAME> (@wahuneke)
.. moduleauthor:: <NAME> (@akavanau)
"""
import stripe
from django.test import TestCase
from djstripe.context_managers import stripe_temporary_api_version
class TestTemporaryVer... | [
"djstripe.context_managers.stripe_temporary_api_version"
] | [((795, 853), 'djstripe.context_managers.stripe_temporary_api_version', 'stripe_temporary_api_version', (['"""newversion"""'], {'validate': '(False)'}), "('newversion', validate=False)\n", (823, 853), False, 'from djstripe.context_managers import stripe_temporary_api_version\n'), ((477, 519), 'djstripe.context_managers... |
# -*- coding: utf-8 -*-
from odoo.exceptions import UserError
from odoo import models, fields, api
class LibraryBook(models.Model):
_name = 'library.book'
_description = 'Library Book'
name = fields.Char('Title', required=True)
date_release = fields.Date('Release Date')
author_ids = fields.Many2m... | [
"odoo.fields.Text",
"odoo.fields.Char",
"odoo.fields.Many2many",
"odoo.exceptions.UserError",
"odoo.fields.Date"
] | [((207, 242), 'odoo.fields.Char', 'fields.Char', (['"""Title"""'], {'required': '(True)'}), "('Title', required=True)\n", (218, 242), False, 'from odoo import models, fields, api\n'), ((262, 289), 'odoo.fields.Date', 'fields.Date', (['"""Release Date"""'], {}), "('Release Date')\n", (273, 289), False, 'from odoo import... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, o10c and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, cint, nowdate, nowtime, add_days, comma_and
from frappe import msgprint, _
from frappe.model.document import... | [
"frappe.utils.flt",
"erpnext.manufacturing.doctype.bom.bom.validate_bom_no",
"erpnext.utilities.transaction_base.validate_uom_is_integer",
"frappe.db.sql",
"frappe.utils.cstr",
"frappe.db.get_value",
"frappe.new_doc",
"frappe.bold",
"frappe._dict",
"erpnext.manufacturing.doctype.production_order.p... | [((8014, 8071), 'erpnext.utilities.transaction_base.validate_uom_is_integer', 'validate_uom_is_integer', (['self', '"""stock_uom"""', '"""planned_qty"""'], {}), "(self, 'stock_uom', 'planned_qty')\n", (8037, 8071), False, 'from erpnext.utilities.transaction_base import validate_uom_is_integer\n'), ((10969, 10992), 'erp... |
import os
import numpy as np
import pandas as pd
from McOne import McOne
from McTwo import McTwo
from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import KFold
def evalua... | [
"McTwo.McTwo",
"sklearn.naive_bayes.GaussianNB",
"os.path.join",
"sklearn.model_selection.KFold",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.where",
"numpy.array",
"sklearn.svm.SVC",
"McOne.McOne",
"os.listdir"
] | [((1069, 1090), 'os.listdir', 'os.listdir', (['DATA_PATH'], {}), '(DATA_PATH)\n', (1079, 1090), False, 'import os\n'), ((365, 382), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': '(5)'}), '(n_splits=5)\n', (370, 382), False, 'from sklearn.model_selection import KFold\n'), ((1409, 1436), 'McOne.McOne', 'McO... |
import os
import sys
import argparse
import torch
import torch.nn.init as init
import torch.optim as optim
from loss import weight_decay_l2, lw_pyramid_loss
sys.path.append('./network')
from dataset import snow_dataset
from general import sort_nicely
from network.DesnowNet import DesnowNet, TR
sys.path.append('./netw... | [
"sys.path.append",
"os.mkdir",
"general.sort_nicely",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"dataset.snow_dataset",
"network.DesnowNet.DesnowNet",
"torch.nn.init.xavier_normal_",
"os.path.exists",
"torch.nn.init.constant_",
"loss.lw_pyramid_loss",
"network.DesnowNet.TR",
... | [((158, 186), 'sys.path.append', 'sys.path.append', (['"""./network"""'], {}), "('./network')\n", (173, 186), False, 'import sys\n'), ((297, 325), 'sys.path.append', 'sys.path.append', (['"""./network"""'], {}), "('./network')\n", (312, 325), False, 'import sys\n'), ((370, 424), 'argparse.ArgumentParser', 'argparse.Arg... |
import random
from unittest.mock import Mock, patch
import requests
from eth_utils import to_checksum_address
from raiden.routing import get_best_routes
from raiden.tests.utils import factories
from raiden.transfer import token_network
from raiden.transfer.state import (
NODE_NETWORK_REACHABLE,
NODE_NETWORK_U... | [
"unittest.mock.patch.object",
"eth_utils.to_checksum_address",
"raiden.transfer.token_network.state_transition",
"raiden.tests.utils.factories.make_transaction_hash",
"requests.RequestException",
"random.Random",
"unittest.mock.Mock",
"raiden.routing.get_best_routes",
"raiden.tests.utils.factories.m... | [((798, 813), 'random.Random', 'random.Random', ([], {}), '()\n', (811, 813), False, 'import random\n'), ((829, 853), 'raiden.tests.utils.factories.make_address', 'factories.make_address', ([], {}), '()\n', (851, 853), False, 'from raiden.tests.utils import factories\n'), ((869, 893), 'raiden.tests.utils.factories.make... |
from plot import *
x = 'clock'
from sklearn.preprocessing import MinMaxScaler, RobustScaler
from sklearn import datasets, linear_model
new_df = df_total
tidy = new_df[new_df['sec_level'] == 3].groupby(['algo','type','run']).last().reset_index().sort_values(x)[['algo',x,'type']]
scaler = MinMaxScaler()
#ax = sns.boxp... | [
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.MinMaxScaler"
] | [((290, 304), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (302, 304), False, 'from sklearn.preprocessing import MinMaxScaler, RobustScaler\n'), ((3271, 3302), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {}), '()\n', (3300, 3302), False, 'from sklearn import... |
import math
d = 10
def search(pattern, text, q):
# pat -> pattern
# txt -> text
# q -> A prime number
m = len(pattern)
n = len(text)
p = 0 # hash value for pattern
t = 0 # hash value for txt
h = 1
i = 0
j = 0
# for i in range(m-1):
# h = (h*d) % q
h = (math.p... | [
"math.pow"
] | [((314, 332), 'math.pow', 'math.pow', (['d', '(m - 1)'], {}), '(d, m - 1)\n', (322, 332), False, 'import math\n')] |
from django import forms
from .models import Comment
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
exclude = ['create_at', 'post']
widgets = {
'name': forms.TextInput(attrs={'placeholder': 'name'}),
'email': forms.EmailInput(attrs={'placeholder': '... | [
"django.forms.EmailInput",
"django.forms.TextInput",
"django.forms.Textarea"
] | [((211, 257), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder': 'name'}"}), "(attrs={'placeholder': 'name'})\n", (226, 257), False, 'from django import forms\n'), ((280, 328), 'django.forms.EmailInput', 'forms.EmailInput', ([], {'attrs': "{'placeholder': 'email'}"}), "(attrs={'placeholder': '... |
###############################################################################
#
# unet_roc.py
#
# <EMAIL>
#
# A simple convenience tool for generating ROC curves and AUC metrics from
# the probabalistic (i.e. not thresholded binary) output from the UNet CNN.
#
# You must specify the path to the unpadded (original di... | [
"matplotlib.pyplot.title",
"yaml.load",
"getopt.getopt",
"matplotlib.pyplot.figure",
"numpy.arange",
"os.path.join",
"pandas.DataFrame",
"numpy.set_printoptions",
"numpy.append",
"matplotlib.pyplot.legend",
"sklearn.metrics.roc_auc_score",
"matplotlib.pyplot.ylabel",
"os.listdir",
"sys.exi... | [((1277, 1322), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (1299, 1322), False, 'import numpy\n'), ((1335, 1354), 're.compile', 're.compile', (['""".*tif"""'], {}), "('.*tif')\n", (1345, 1354), False, 'import re\n'), ((2636, 2673), 'yaml.load', '... |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import unittest
from unittest import mock
from vdk.plugin.control_api_auth.auth_exception import VDKInvalidAuthParamError
from vdk_provider.hooks.vdk import VDKHook
log = logging.getLogger(__name__)
class TestVDKHookAuth(unittest.Tes... | [
"vdk_provider.hooks.vdk.VDKHook",
"unittest.mock.patch.dict",
"logging.getLogger"
] | [((256, 283), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'import logging\n'), ((333, 476), 'unittest.mock.patch.dict', 'mock.patch.dict', (['"""os.environ"""'], {'AIRFLOW_CONN_CONN_VDK': '"""http://https%3A%2F%2Fwww.vdk-endpoint.org?auth_type=api_token&token=<PASSWO... |
"""
ecoinvent_modification.py exposes methods to create a database, perform transformations on it,
as well as export it back.
"""
SUPPORTED_EI_VERSIONS = ["3.5", "3.6", "3.7", "3.7.1", "3.8"]
LIST_REMIND_REGIONS = [
"CAZ",
"CHA",
"EUR",
"IND",
"JPN",
"LAM",
"MEA",
"NEU",
"OAS",
"... | [
"copy.deepcopy",
"os.makedirs",
"sys.stdout.close",
"os.path.exists",
"datetime.date.today",
"wurst.write_brightway2_database",
"pathlib.Path",
"prettytable.PrettyTable"
] | [((5530, 5544), 'pathlib.Path', 'Path', (['filepath'], {}), '(filepath)\n', (5534, 5544), False, 'from pathlib import Path\n'), ((7761, 7771), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (7765, 7771), False, 'from pathlib import Path\n'), ((13281, 13305), 'prettytable.PrettyTable', 'PrettyTable', (["['Warning']... |
import FWCore.ParameterSet.Config as cms
process = cms.Process('FibreAnalyser')
process.maxEvents = cms.untracked.PSet ( input = cms.untracked.int32 ( 3564 ) )
#Input file
process.source = cms.Source ( "EmptySource" )
#Logger
#process.MessageLogger = cms.Service (
# destinations = cms.untracked.vstring ( "detail... | [
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.InputTag",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.bool",
"FWCore.ParameterSet.Config.Source",
"FWCore.ParameterSet.Confi... | [((52, 80), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""FibreAnalyser"""'], {}), "('FibreAnalyser')\n", (63, 80), True, 'import FWCore.ParameterSet.Config as cms\n'), ((192, 217), 'FWCore.ParameterSet.Config.Source', 'cms.Source', (['"""EmptySource"""'], {}), "('EmptySource')\n", (202, 217), True, 'impor... |
# coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# #
# version 1.0 ... | [
"sqlite3.connect"
] | [((1139, 1166), 'sqlite3.connect', 'sqlite3.connect', (['"""first.db"""'], {}), "('first.db')\n", (1154, 1166), False, 'import sqlite3\n')] |
#!/usr/bin/env python
"""
Useful functions
Developer:
<NAME>
Description:
useful functions for the partitioned least squares algorithm
"""
from numpy import zeros, sum
def checkalpha(a, p):
"""
checkalpha funtion
Parameters
----------
alpha : Array
p : Matrix
R... | [
"numpy.zeros",
"numpy.sum"
] | [((422, 431), 'numpy.sum', 'sum', (['p', '(0)'], {}), '(p, 0)\n', (425, 431), False, 'from numpy import zeros, sum\n'), ((997, 1010), 'numpy.zeros', 'zeros', (['(1, n)'], {}), '((1, n))\n', (1002, 1010), False, 'from numpy import zeros, sum\n'), ((1867, 1880), 'numpy.sum', 'sum', (['pbeta', '(1)'], {}), '(pbeta, 1)\n',... |
# Copyright 2022 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is
# distrib... | [
"re.search"
] | [((14309, 14342), 're.search', 're.search', (['path_regex', 'event_path'], {}), '(path_regex, event_path)\n', (14318, 14342), False, 'import re\n'), ((18718, 18759), 're.search', 're.search', (['value_pattern', 'parameters[key]'], {}), '(value_pattern, parameters[key])\n', (18727, 18759), False, 'import re\n'), ((23819... |
"""Schemathesis tests."""
import contextlib
import schemathesis
from app import app
from library import config
from library.facades import seed
schema = schemathesis.loaders.from_wsgi("/v1/openapi.json", app.app)
@contextlib.contextmanager
def default_seed():
"""Generate the default seed."""
name = config.... | [
"library.config.get_env",
"schemathesis.loaders.from_wsgi",
"library.facades.seed.get_seed"
] | [((156, 215), 'schemathesis.loaders.from_wsgi', 'schemathesis.loaders.from_wsgi', (['"""/v1/openapi.json"""', 'app.app'], {}), "('/v1/openapi.json', app.app)\n", (186, 215), False, 'import schemathesis\n'), ((313, 329), 'library.config.get_env', 'config.get_env', ([], {}), '()\n', (327, 329), False, 'from library impor... |
import datetime
import json
import os
from flask import Blueprint
from flask import current_app
from flask import flash
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from flask_login import current_user
from flask_login import login_required
from flask... | [
"os.path.abspath",
"json.load",
"flask.Blueprint",
"flask_login.current_user.confirm_token",
"flask.redirect",
"flask.request.args.get",
"flask_login.login_user",
"shopyo.api.html.notify_warning",
"flask_login.logout_user",
"flask_login.current_user.generate_confirmation_token",
"flask.url_for",... | [((876, 974), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'url_prefix': "module_info['url_prefix']", 'template_folder': '"""templates"""'}), "('auth', __name__, url_prefix=module_info['url_prefix'],\n template_folder='templates')\n", (885, 974), False, 'from flask import Blueprint\n'), ((742, 767),... |
"""Implements the DCM Region API"""
from mixcoatl.resource import Resource
from mixcoatl.decorators.lazy import lazy_property
from mixcoatl.utils import camelize, camel_keys, uncamel_keys
class Region(Resource):
"""A region is a logical sub-infrastructure within a cloud"""
PATH = 'geography/Region'
COLLE... | [
"mixcoatl.utils.camelize",
"mixcoatl.resource.Resource",
"mixcoatl.resource.Resource.__init__",
"mixcoatl.utils.uncamel_keys"
] | [((454, 496), 'mixcoatl.resource.Resource.__init__', 'Resource.__init__', (['self'], {'endpoint': 'endpoint'}), '(self, endpoint=endpoint)\n', (471, 496), False, 'from mixcoatl.resource import Resource\n'), ((2408, 2445), 'mixcoatl.resource.Resource', 'Resource', (['cls.PATH'], {'endpoint': 'endpoint'}), '(cls.PATH, en... |
#!/usr/bin/python
# Written by <NAME>
# ( <EMAIL> )
# by the exercises from <NAME> - Perfect Pitch Ear Traning Supercourse
# Thanks to <NAME> ( <EMAIL> ) for snd-virmidi example
# ( <EMAIL> )
import random
import sys
sys.path.append("/home/schef/github/schef.github.io/source/")
from pptraning import *
print ("Exercis... | [
"sys.path.append",
"random.choice"
] | [((218, 279), 'sys.path.append', 'sys.path.append', (['"""/home/schef/github/schef.github.io/source/"""'], {}), "('/home/schef/github/schef.github.io/source/')\n", (233, 279), False, 'import sys\n'), ((503, 533), 'random.choice', 'random.choice', (['blackNotes[:-2]'], {}), '(blackNotes[:-2])\n', (516, 533), False, 'imp... |
# Process management
import os, sys
import code, traceback, signal
def debug(sig, frame):
"""Interrupt running process, and provide a python prompt for
interactive debugging."""
d={'_frame':frame} # Allow access to frame object.
d.update(frame.f_globals) # Unless shadowed by global
d.updat... | [
"traceback.format_stack",
"numpy.abs",
"torch.load",
"modules.hyperparameters.randomsearch.generate_ann",
"signal.signal",
"logging.getLogger",
"torch.device",
"code.InteractiveConsole",
"sys.exit"
] | [((347, 373), 'code.InteractiveConsole', 'code.InteractiveConsole', (['d'], {}), '(d)\n', (370, 373), False, 'import code, traceback, signal\n'), ((556, 592), 'signal.signal', 'signal.signal', (['signal.SIGUSR1', 'debug'], {}), '(signal.SIGUSR1, debug)\n', (569, 592), False, 'import code, traceback, signal\n'), ((694, ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
__author__ = 'andyguo'
from uuid import uuid4
class TwoEndPoints(object):
def __init__(self, left=None, right=None):
super(TwoEndPoints, self).__init__()
self.left = left
self.right = right
def __setattr__(self, key, value):
if... | [
"dayu_ffmpeg.ffscript.parse_ffscript_data",
"copy.deepcopy",
"uuid.uuid4"
] | [((2779, 2802), 'copy.deepcopy', 'deepcopy', (['self.__dict__'], {}), '(self.__dict__)\n', (2787, 2802), False, 'from copy import deepcopy\n'), ((3398, 3434), 'dayu_ffmpeg.ffscript.parse_ffscript_data', 'parse_ffscript_data', (['instance.parent'], {}), '(instance.parent)\n', (3417, 3434), False, 'from dayu_ffmpeg.ffscr... |
import json
import logging
import os
import sys
import boto3
from botocore.exceptions import ClientError
COGNITO_USER_POOL_CLIENT_ID = os.environ.get("COGNITO_USER_POOL_CLIENT_ID")
# remove AWS pre-config that interferes with custom config
root = logging.getLogger()
if root.handlers:
for handler in root.handle... | [
"json.loads",
"logging.basicConfig",
"boto3.client",
"json.dumps",
"os.environ.get",
"logging.getLogger"
] | [((138, 183), 'os.environ.get', 'os.environ.get', (['"""COGNITO_USER_POOL_CLIENT_ID"""'], {}), "('COGNITO_USER_POOL_CLIENT_ID')\n", (152, 183), False, 'import os\n'), ((252, 271), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (269, 271), False, 'import logging\n'), ((389, 516), 'logging.basicConfig', 'log... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 19 13:11:21 2018
@author: haoxiangyang
"""
# This is the CAOE module for:
# - reading the power loss data from txt files (done)
# - reading the LCD observation data from csv files (done)
# - reading the HWM observation data from a csv file (d... | [
"csv.reader",
"re.findall",
"numpy.exp",
"os.chdir",
"os.path.join",
"os.listdir"
] | [((603, 662), 'os.chdir', 'os.chdir', (['"""/Users/haoxiangyang/Desktop/Git/DFSC_FLORIDA/IO"""'], {}), "('/Users/haoxiangyang/Desktop/Git/DFSC_FLORIDA/IO')\n", (611, 662), False, 'import os\n'), ((1159, 1178), 'os.listdir', 'os.listdir', (['fileAdd'], {}), '(fileAdd)\n', (1169, 1178), False, 'import os\n'), ((2397, 241... |
from __future__ import print_function
import codecs
import time
from argparse import ArgumentParser
import tensorflow as tf
from tagger import Model
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--task', dest='task')
parser.add_argument('--input', dest='input')
parser.add... | [
"codecs.open",
"argparse.ArgumentParser",
"tagger.Model",
"tensorflow.Session",
"time.time",
"tensorflow.ConfigProto"
] | [((193, 209), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (207, 209), False, 'from argparse import ArgumentParser\n'), ((654, 692), 'codecs.open', 'codecs.open', (['args.output', '"""wb"""', '"""utf8"""'], {}), "(args.output, 'wb', 'utf8')\n", (665, 692), False, 'import codecs\n'), ((707, 723), 'tens... |
import math
import heapq
def euclidean_dist(a_coor_lst, b_coor_lst):
return math.sqrt(sum([(a - b)**2 for a, b in zip(a_coor_lst, b_coor_lst)]))
def create_graph(m):
adj_lst = [list() for _ in range(len(m.roads))]
for source in range(len(m.roads)):
for dest in m.roads[source]:
cost = ... | [
"heapq.heappush",
"heapq.heappop"
] | [((751, 770), 'heapq.heappop', 'heapq.heappop', (['heap'], {}), '(heap)\n', (764, 770), False, 'import heapq\n'), ((1199, 1234), 'heapq.heappush', 'heapq.heappush', (['heap', '(p, neighbor)'], {}), '(heap, (p, neighbor))\n', (1213, 1234), False, 'import heapq\n')] |
from django.db import migrations
from django.db.migrations import RunPython
def add_gov_analyst_view_compliance_report_permission(apps, schema_editor):
"""
Adds the View Compliance Report to the Gov Analyst role
"""
db_alias = schema_editor.connection.alias
permission = apps.get_model(
'a... | [
"django.db.migrations.RunPython"
] | [((1362, 1480), 'django.db.migrations.RunPython', 'RunPython', (['add_gov_analyst_view_compliance_report_permission', 'remove_gov_analyst_view_compliance_report_permission'], {}), '(add_gov_analyst_view_compliance_report_permission,\n remove_gov_analyst_view_compliance_report_permission)\n', (1371, 1480), False, 'fr... |
import tensorflow as tf
from tensorflow import keras
import numpy as np
import os
import random
import cv2
import data_generators.augmentations as augmentations
import math
class SegmentationDataGenerator(keras.utils.Sequence):
'Generates data for segmentation (test)'
def __init__(self, config, is_training_s... | [
"cv2.cvtColor",
"random.shuffle",
"cv2.waitKey",
"numpy.zeros",
"numpy.expand_dims",
"dotmap.DotMap",
"random.seed",
"os.path.splitext",
"numpy.array",
"data_generators.augmentations.init_augmenter",
"data_generators.augmentations.process_augmentation_segmentation",
"cv2.imshow",
"os.path.jo... | [((7551, 7565), 'dotmap.DotMap', 'DotMap', (['config'], {}), '(config)\n', (7557, 7565), False, 'from dotmap import DotMap\n'), ((1455, 1524), 'data_generators.augmentations.init_augmenter', 'augmentations.init_augmenter', ([], {'img_mode': 'self.config.generator.img_mode'}), '(img_mode=self.config.generator.img_mode)\... |
from django import forms
from django.contrib import admin
from django.contrib.admin.util import unquote
from django.utils.safestring import mark_safe
from ckeditor.widgets import CKEditorWidget
from .models import BitGroup, PageBit, PageEdit, PageTemplate, Page
class PageBitInline(admin.StackedInline):
model = ... | [
"django.forms.ImageField",
"django.contrib.admin.site.register",
"django.utils.safestring.mark_safe",
"ckeditor.widgets.CKEditorWidget",
"django.contrib.admin.util.unquote",
"django.forms.CharField",
"django.forms.Textarea"
] | [((1274, 1318), 'django.contrib.admin.site.register', 'admin.site.register', (['BitGroup', 'BitGroupAdmin'], {}), '(BitGroup, BitGroupAdmin)\n', (1293, 1318), False, 'from django.contrib import admin\n'), ((4627, 4671), 'django.contrib.admin.site.register', 'admin.site.register', (['PageEdit', 'PageEditAdmin'], {}), '(... |
import json
import os
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from oauth2client import client, tools, file
import boto3
import base64
TABLE_NAME = os.environ['DYNAMODB_TABLE']
HASH_KEY = os.environ['DYNAMODB... | [
"oauth2client.client.GoogleCredentials",
"boto3.client",
"json.dumps",
"boto3.resource",
"googleapiclient.discovery.build"
] | [((345, 401), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'region_name': '"""ap-northeast-1"""'}), "('dynamodb', region_name='ap-northeast-1')\n", (359, 401), False, 'import boto3\n'), ((1140, 1291), 'oauth2client.client.GoogleCredentials', 'client.GoogleCredentials', (['None', 'client_id', 'client_secret... |
#!/usr/bin/env python
import sys, os, re, pkg_resources, subprocess, inspect
from natsort import natsorted
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
import lib.library as lib
def perlVersion():
proc ... | [
"pkg_resources.get_distribution",
"subprocess.Popen",
"sys.version.split",
"os.path.dirname",
"sys.path.insert",
"lib.library.get_version",
"inspect.currentframe",
"re.search",
"re.sub",
"sys.exit"
] | [((207, 234), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (222, 234), False, 'import sys, os, re, pkg_resources, subprocess, inspect\n'), ((235, 264), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (250, 264), False, 'import sys, os, re, pkg_resou... |
import os
import json
import torch
import utils
class Trainer:
def __init__(self, opt, model, train_loader, val_loader=None):
self.num_iters = opt.num_iters
self.run_dir = opt.run_dir
self.display_every = opt.display_every
self.checkpoint_every = opt.checkpoint_every
self... | [
"json.dump",
"os.path.join"
] | [((2317, 2360), 'os.path.join', 'os.path.join', (['self.run_dir', '"""checkpoint.pt"""'], {}), "(self.run_dir, 'checkpoint.pt')\n", (2329, 2360), False, 'import os\n'), ((2462, 2489), 'json.dump', 'json.dump', (['self.stats', 'fout'], {}), '(self.stats, fout)\n', (2471, 2489), False, 'import json\n')] |
import MDAnalysis as mda
import numpy as np
import pandas as pd
import seaborn as sns
from collections import OrderedDict
from matplotlib import rcParams
from base import *
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Helvetica Neue']
sns.set(font_scale=2, font='sans-serif')
sns.set_style(... | [
"seaborn.set_style",
"numpy.asarray",
"seaborn.set"
] | [((265, 305), 'seaborn.set', 'sns.set', ([], {'font_scale': '(2)', 'font': '"""sans-serif"""'}), "(font_scale=2, font='sans-serif')\n", (272, 305), True, 'import seaborn as sns\n'), ((306, 328), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (319, 328), True, 'import seaborn as sns\n'), ((5... |
import random
class ReservoirSampler():
def __init__(self, generator, k):
self.generator = generator # generator
self.k = k # number of samples we want to keep
self.R = []
self.count = 0
def sample(self):
for item in self.generator:
if self.count < self.k:
... | [
"random.randint"
] | [((394, 423), 'random.randint', 'random.randint', (['(0)', 'self.count'], {}), '(0, self.count)\n', (408, 423), False, 'import random\n')] |
from typing import List, Optional
from credmark.cmf.model import Model
from credmark.cmf.types import (
Address,
Contract,
Token,
Position,
Portfolio,
)
from credmark.cmf.types.series import BlockSeries
from credmark.dto import DTO, IterableListGenericDTO
from models.tmp_abi_lookup import (
AAV... | [
"credmark.cmf.types.Position",
"credmark.cmf.types.Address",
"credmark.cmf.types.Token",
"credmark.cmf.types.Contract",
"credmark.cmf.model.Model.describe"
] | [((829, 1059), 'credmark.cmf.model.Model.describe', 'Model.describe', ([], {'slug': '"""contrib.aave-overall-liabilities-portfolio"""', 'version': '"""1.0"""', 'display_name': '"""Aave V2 Lending Pool overall liabilities"""', 'description': '"""Aave V2 liabilities for the main lending pool"""', 'output': 'Portfolio'}),... |
from marshmallow import pre_dump, pre_load, post_dump, post_load, fields as base_fields
from server.app import ma
from server.main.models import (
ZoneModel,
RecordModel,
RecordTypeModel
)
from server.extensions.celery.tasks import dns as dns_task
from ...http_exceptions import *
from ..records.schema impo... | [
"server.main.models.ZoneModel",
"math.ceil",
"server.main.models.ZoneModel.get_name",
"server.extensions.celery.tasks.dns.import_record.delay",
"server.main.models.RecordTypeModel.get",
"server.app.ma.Field",
"server.app.ma.Nested"
] | [((1851, 1890), 'server.app.ma.Field', 'ma.Field', ([], {'load_only': '(True)', 'required': '(True)'}), '(load_only=True, required=True)\n', (1859, 1890), False, 'from server.app import ma\n'), ((1906, 1945), 'server.app.ma.Field', 'ma.Field', ([], {'load_only': '(True)', 'required': '(True)'}), '(load_only=True, requi... |
import pygame
from pygame.sprite import Sprite
#from random import randint
class Star(Sprite):
def __init__(self, ai_game):
super().__init__()
self.screen = ai_game.screen
# load the star image
self.image = pygame.image.load('images/star.png')
self.rect = self.image.get_rect... | [
"pygame.image.load"
] | [((244, 280), 'pygame.image.load', 'pygame.image.load', (['"""images/star.png"""'], {}), "('images/star.png')\n", (261, 280), False, 'import pygame\n')] |
# Copyright 2012-2017 Intel Corporation.
#
# This software is supplied under the terms of a license agreement or
# nondisclosure agreement with Intel Corporation and may not be copied
# or disclosed except in accordance with the terms of that agreement.
import copy
import ctypes
import os
import pprint
import struct
i... | [
"sys.stdout.write",
"os.read",
"os.open",
"pprint.pformat",
"sys_utils.FIND_LIBRARY_CMD.format",
"copy.deepcopy",
"ctypes.c_size_t",
"os.walk",
"ctypes.cdll.LoadLibrary",
"os.lseek",
"os.close",
"sys.exc_info",
"sys.stderr.write",
"os.path.join"
] | [((30300, 30325), 'sys.stdout.write', 'sys.stdout.write', (['mem_cfg'], {}), '(mem_cfg)\n', (30316, 30325), False, 'import sys\n'), ((30330, 30352), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (30346, 30352), False, 'import sys\n'), ((30357, 30387), 'sys.stdout.write', 'sys.stdout.write', (... |
# Copyright (c) 2022 Seagate Technology LLC and/or its Affiliates
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later versio... | [
"logging.debug"
] | [((878, 909), 'logging.debug', 'logging.debug', (['"""Inside HaEvent"""'], {}), "('Inside HaEvent')\n", (891, 909), False, 'import logging\n')] |
"""Inbound connection handling classes."""
import asyncio
import logging
from typing import Callable, Sequence, Union
from ...core.profile import Profile
from ...multitenant.manager import MultitenantManager
from ..error import WireFormatError
from ..outbound.message import OutboundMessage
from ..wire_format import ... | [
"asyncio.Event",
"logging.getLogger"
] | [((418, 445), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (435, 445), False, 'import logging\n'), ((1815, 1830), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (1828, 1830), False, 'import asyncio\n')] |
from datetime import date
ano = int(input('Digite o ano em que você nasceu:'))
atual = date.today().year
result = atual - ano
if result == 18:
print('Ta na hora de se alistar ')
elif result < 18:
v1 = 18 - result
print('falta {} anos para você se alistar'.format(v1))
else:
v2 = result -18
print('ja ... | [
"datetime.date.today"
] | [((87, 99), 'datetime.date.today', 'date.today', ([], {}), '()\n', (97, 99), False, 'from datetime import date\n')] |
import nose
import angr
import os
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
bina = os.path.join(test_location, "x86_64/test_project_resolve_simproc")
"""
We voluntarily don't use SimProcedures for 'rand' and 'sleep' because we want
to step into their lib co... | [
"os.path.realpath",
"os.path.join",
"nose.tools.assert_equal",
"angr.Project"
] | [((145, 211), 'os.path.join', 'os.path.join', (['test_location', '"""x86_64/test_project_resolve_simproc"""'], {}), "(test_location, 'x86_64/test_project_resolve_simproc')\n", (157, 211), False, 'import os\n'), ((354, 462), 'angr.Project', 'angr.Project', (['bina'], {'exclude_sim_procedures_list': "['rand', 'sleep']", ... |
# -*- coding: utf-8 -*-
"""
This is a collection of helper functions that can be used within the tests.
This file is part of project DHNx (). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location.
SPDX-License-Identifier: MIT
"""
import os
imp... | [
"os.mkdir",
"os.path.join",
"pandas.read_csv",
"os.path.isdir",
"os.walk",
"os.path.expanduser"
] | [((1120, 1132), 'os.walk', 'os.walk', (['dir'], {}), '(dir)\n', (1127, 1132), False, 'import os\n'), ((1325, 1348), 'pandas.read_csv', 'pd.read_csv', (['csv_file_a'], {}), '(csv_file_a)\n', (1336, 1348), True, 'import pandas as pd\n'), ((1359, 1382), 'pandas.read_csv', 'pd.read_csv', (['csv_file_b'], {}), '(csv_file_b)... |
from datetime import date
from openpyxl import load_workbook, Workbook
try:
wb = load_workbook('expenses.xlsx')
ws1 = wb['2019']
except FileNotFoundError:
wb = Workbook()
ws1 = wb.create_sheet('2019')
item = input('What do you buy? ')
cost = input('How much? ')
ws1.append([date.today(), item, float(... | [
"datetime.date.today",
"openpyxl.load_workbook",
"openpyxl.Workbook"
] | [((88, 118), 'openpyxl.load_workbook', 'load_workbook', (['"""expenses.xlsx"""'], {}), "('expenses.xlsx')\n", (101, 118), False, 'from openpyxl import load_workbook, Workbook\n'), ((175, 185), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (183, 185), False, 'from openpyxl import load_workbook, Workbook\n'), ((294,... |
import torch
from torch import nn
import torch.nn.functional as F
from typing import List
"""
AttentionMatching:
<NAME> and <NAME>.
Paying more at-tention to attention: Improving the performance of convolutional neural networks via attention transfer.
International Conference on Learning Representations, ... | [
"torch.nn.KLDivLoss",
"torch.nn.functional.log_softmax",
"torch.nn.functional.softmax"
] | [((2104, 2143), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['(output_s / self.T)'], {'dim': '(1)'}), '(output_s / self.T, dim=1)\n', (2117, 2143), True, 'import torch.nn.functional as F\n'), ((2168, 2203), 'torch.nn.functional.softmax', 'F.softmax', (['(output_t / self.T)'], {'dim': '(1)'}), '(output_t / self... |
import re
import pymysql
import sys
def hostNameHandle(hostName):
"""
input hostname ,return node name of this host.
:param hostName: lt-shan3xi-xianyang-sn1-172-31-123-54
:return: 移动-陕西-咸阳-小姐点1
"""
hostNameList = hostName.split("-")
nodeNameEn = hostNameList[:len(hostNameLis... | [
"pymysql.connect",
"re.search",
"re.findall",
"sys.exit"
] | [((958, 1060), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""sick.pwall.icu"""', 'user': '"""white"""', 'password': '"""<PASSWORD>&"""', 'database': '"""testMySQL"""'}), "(host='sick.pwall.icu', user='white', password='<PASSWORD>&',\n database='testMySQL')\n", (973, 1060), False, 'import pymysql\n'), ((111... |
# Generated by Django 2.2.4 on 2019-09-09 02:58
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Feature',
fields=[
('id', model... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.models.UUIDField"
] | [((315, 406), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid1', 'editable': '(False)', 'primary_key': '(True)', 'serialize': '(False)'}), '(default=uuid.uuid1, editable=False, primary_key=True,\n serialize=False)\n', (331, 406), False, 'from django.db import migrations, models\n'), ((4... |
_D='strict'
_C=True
_B=False
_A=None
import os,sys
from ._compat import _default_text_stderr,_default_text_stdout,_find_binary_writer,auto_wrap_for_ansi,binary_streams,filename_to_ui,get_filesystem_encoding,get_strerror,is_bytes,open_stream,should_strip_ansi,strip_ansi,text_streams,WIN
from .globals import resolve_colo... | [
"os.path.expanduser",
"warnings._f.close",
"warnings.open",
"os.path.basename",
"warnings.close",
"warnings",
"os.environ.get",
"warnings.close_intelligently",
"warnings.decode",
"warnings.wrapped.flush",
"warnings.warn",
"os.path.join",
"warnings.append"
] | [((2922, 2925), 'warnings', 'A', ([], {}), '()\n', (2923, 2925), True, 'import warnings as A\n'), ((3074, 3093), 'warnings', 'A', (['encoding', 'errors'], {}), '(encoding, errors)\n', (3075, 3093), True, 'import warnings as A\n'), ((3369, 3518), 'warnings.warn', 'A.warn', (['"""\'get_os_args\' is deprecated and will be... |
# helpers
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, ResNet50
from tqdm import tqdm
import cv2
import numpy as np
def path_to_tensor(img_path):
# loads RGB image as PIL.Image.Image type
img = image.load_img(img_path, target_size=(224, 224)... | [
"keras.applications.xception.Xception",
"tqdm.tqdm",
"cv2.cvtColor",
"numpy.expand_dims",
"keras.applications.inception_v3.preprocess_input",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"keras.applications.resnet50.ResNet50",
"cv2.imread",
"keras.applications.vg... | [((273, 321), 'keras.preprocessing.image.load_img', 'image.load_img', (['img_path'], {'target_size': '(224, 224)'}), '(img_path, target_size=(224, 224))\n', (287, 321), False, 'from keras.preprocessing import image\n'), ((405, 428), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['img'], {}), '(img)\n... |
import codecs
import re
from mafan import simplify
NEW_VERSION_PREFIX_REGEXP = re.compile('^Q[0-9]+:.*$')
def join_elements(candidate):
seen = set()
for name in candidate:
name = simplify(''.join(name.split()))
seen.add(name)
return seen
def write_file(output_filename, phrase_list):
o... | [
"codecs.open",
"re.compile"
] | [((80, 106), 're.compile', 're.compile', (['"""^Q[0-9]+:.*$"""'], {}), "('^Q[0-9]+:.*$')\n", (90, 106), False, 'import re\n'), ((325, 367), 'codecs.open', 'codecs.open', (['output_filename', '"""w"""', '"""utf-8"""'], {}), "(output_filename, 'w', 'utf-8')\n", (336, 367), False, 'import codecs\n'), ((1667, 1711), 'codec... |
# -*- coding: utf-8 -*-
from json import loads
from django.test import TestCase
from hexbytes import HexBytes
from ..decoder import Decoder
class TestDecoder(TestCase):
test_abi = loads(
'[{"inputs": [{"type": "address", "name": ""}], "constant": true, "name": "isInstantiation", "payable": '
'fa... | [
"hexbytes.HexBytes",
"json.loads"
] | [((188, 1251), 'json.loads', 'loads', (['"""[{"inputs": [{"type": "address", "name": ""}], "constant": true, "name": "isInstantiation", "payable": false, "outputs": [{"type": "bool", "name": ""}], "type": "function"}, {"inputs": [{"type": "address[]", "name": "_owners"}, {"type": "uint256", "name": "_required"}, {"type... |
# The particle filter, prediciton only.
#
# slam_08_a_particle_prediciton.
# <NAME>, 04.01.2013
from lego_robot import *
from math import sin, cos, pi, sqrt
import random
class ParticleFilter:
def __init__(self, initial_particles,
robot_width, scanner_displacement,
cont... | [
"math.sin",
"random.gauss",
"math.cos",
"math.sqrt"
] | [((1499, 1560), 'math.sqrt', 'sqrt', (['((alpha_1 * left) ** 2 + (alpha_2 * (right - left)) ** 2)'], {}), '((alpha_1 * left) ** 2 + (alpha_2 * (right - left)) ** 2)\n', (1503, 1560), False, 'from math import sin, cos, pi, sqrt\n'), ((1571, 1633), 'math.sqrt', 'sqrt', (['((alpha_1 * right) ** 2 + (alpha_2 * (right - lef... |
from pyrates.utility.grid_search import grid_search
from pyrates.utility.visualization import plot_connectivity
import numpy as np
import matplotlib.pyplot as plt
# Parameters
############
# general parameters
dt = 1e-4
dts = 1e-2
T = 400.
# model parameters
n_etas = 100
n_alphas = 5
etas = np.linspace(-6.5, -4.5, ... | [
"pyrates.utility.grid_search.grid_search",
"matplotlib.pyplot.tight_layout",
"numpy.zeros_like",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.zeros",
"numpy.linspace",
"numpy.round",
"matplotlib.pyplot.subplots"
] | [((296, 331), 'numpy.linspace', 'np.linspace', (['(-6.5)', '(-4.5)'], {'num': 'n_etas'}), '(-6.5, -4.5, num=n_etas)\n', (307, 331), True, 'import numpy as np\n'), ((341, 376), 'numpy.linspace', 'np.linspace', (['(0.0)', '(0.2)'], {'num': 'n_alphas'}), '(0.0, 0.2, num=n_alphas)\n', (352, 376), True, 'import numpy as np\... |
# coding: utf-8
import errno
import logging
import os
import subprocess
from datetime import datetime
from threading import Timer
from contesto import config
from contesto.globals import current_test
from contesto.exceptions import ScreenCastError
log = logging.getLogger(__name__)
class ScreencastRecorder:
devi... | [
"contesto.globals.current_test.screencast_recorder.stop",
"contesto.config.logging.get",
"contesto.config.utils.get",
"subprocess.Popen",
"contesto.exceptions.ScreenCastError",
"threading.Timer",
"contesto.globals.current_test.screencast_recorder.start",
"os.path.abspath",
"contesto.globals.current_... | [((256, 283), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'import logging\n'), ((5421, 5464), 'contesto.globals.current_test.screencast_recorder.is_alive', 'current_test.screencast_recorder.is_alive', ([], {}), '()\n', (5462, 5464), False, 'from contesto.globals impo... |
#!/usr/bin/env python
from setuptools import find_packages, setup
from reviewbot import get_package_version
PACKAGE_NAME = "ReviewBot"
setup(
name=PACKAGE_NAME,
version=get_package_version(),
license="MIT",
description="ReviewBot, the automated code reviewer",
author="<NAME>",
author_email=... | [
"reviewbot.get_package_version",
"setuptools.find_packages"
] | [((182, 203), 'reviewbot.get_package_version', 'get_package_version', ([], {}), '()\n', (201, 203), False, 'from reviewbot import get_package_version\n'), ((401, 416), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (414, 416), False, 'from setuptools import find_packages, setup\n')] |
from control import Control
from Tkinter import Scrollbar as TkScrollbar
HORIZONTAL = 'horizontal'
VERTICAL = 'vertical'
class BaseScrollBar(Control):
def __init__(self, parent, **kwargs):
Control.__init__(self, TkScrollbar(parent._frame), **kwargs)
@property
def orientation(self):
re... | [
"Tkinter.Scrollbar"
] | [((226, 252), 'Tkinter.Scrollbar', 'TkScrollbar', (['parent._frame'], {}), '(parent._frame)\n', (237, 252), True, 'from Tkinter import Scrollbar as TkScrollbar\n')] |
from webdriver_manager import utils
from webdriver_manager.driver import GeckoDriver
from webdriver_manager.manager import DriverManager
from webdriver_manager.logger import logger
class GeckoDriverManager(DriverManager):
def __init__(self, version="latest",
os_type=utils.os_type(),
... | [
"webdriver_manager.utils.os_type",
"webdriver_manager.driver.GeckoDriver"
] | [((290, 305), 'webdriver_manager.utils.os_type', 'utils.os_type', ([], {}), '()\n', (303, 305), False, 'from webdriver_manager import utils\n'), ((857, 1009), 'webdriver_manager.driver.GeckoDriver', 'GeckoDriver', ([], {'version': 'version', 'os_type': 'os_type', 'name': 'name', 'url': 'url', 'latest_release_url': 'lat... |
from plugin import Plugin
import os
import shutil
import pafy
import asyncio
import discord
import styrobot
import logging
import commands
class Song:
def __init__(self, author, channel, song):
self.requester = author
self.channel = channel
self.song = song
class Music(Plugin):
async ... | [
"os.mkdir",
"os.remove",
"asyncio.Event",
"pafy.new",
"styrobot.plugincommand",
"shutil.rmtree",
"asyncio.Queue",
"os.listdir"
] | [((606, 666), 'styrobot.plugincommand', 'styrobot.plugincommand', (['"""Play the queued songs"""'], {'name': '"""play"""'}), "('Play the queued songs', name='play')\n", (628, 666), False, 'import styrobot\n'), ((867, 939), 'styrobot.plugincommand', 'styrobot.plugincommand', (['"""Display currently playing song"""'], {'... |
#!/usr/bin/env python
from __future__ import print_function
import base64, os, random, struct, sys
import ed25519
import ecdsa
import hashlib
from ripple.util import Base58
from ripple.ledger import SField
ED25519_BYTE = chr(0xed)
WRAP_COLUMNS = 72
USAGE = """\
Usage:
create
Create a new master public/s... | [
"ripple.util.Base58.decode_version",
"ripple.util.Base58.version_name",
"ecdsa.SigningKey.generate",
"struct.pack",
"base64.b64encode",
"ecdsa.SigningKey.from_string",
"hashlib.sha512",
"ed25519.signature",
"ed25519.publickey",
"ripple.util.Base58.check_version",
"ripple.util.Base58.encode_versi... | [((783, 803), 'struct.pack', 'struct.pack', (['""">I"""', 'i'], {}), "('>I', i)\n", (794, 803), False, 'import base64, os, random, struct, sys\n'), ((1126, 1191), 'ecdsa.SigningKey.generate', 'ecdsa.SigningKey.generate', ([], {'curve': 'ecdsa.SECP256k1', 'entropy': 'urandom'}), '(curve=ecdsa.SECP256k1, entropy=urandom)... |
# Generated by Django 3.0.6 on 2020-05-27 19:34
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Author",
... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateField",
"django.db.models.DateTimeField"
] | [((401, 494), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (417, 494), False, 'from django.db import migrations, models\... |
import wx
import wx.grid
import wx.lib.gizmos as gizmos
import CustomGridRenderer as cgr
import wx.propgrid as wxpg
import wx.lib.scrolledpanel as scrolled
import sqlite3
import time
import os
import typing
from typing import List
from typing import Union
from typing import Tuple
from typing import Dict
from typing imp... | [
"Debug.debug",
"Links.GenericDoubleLink",
"ToolsTab.Tool",
"CustomGridRenderer.HeaderBitmapColLabelRenderer",
"os.path.exists",
"wx.Panel",
"ToolsTab.ToolMaterial",
"wx.TextCtrl",
"wx.ListItem",
"CustomGridRenderer.ImageTextCellRenderer",
"CustomGridRenderer.HeaderBitmapGrid",
"wx.BoxSizer",
... | [((463, 494), 'typing.NewType', 'NewType', (['"""wxTreeListItem"""', 'None'], {}), "('wxTreeListItem', None)\n", (470, 494), False, 'from typing import NewType\n'), ((742, 793), 'wx.Bitmap', 'wx.Bitmap', (['"""images/unknown.png"""', 'wx.BITMAP_TYPE_ANY'], {}), "('images/unknown.png', wx.BITMAP_TYPE_ANY)\n", (751, 793)... |
# coding=utf-8
# Copyright (C) 2020 Artefact
# <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... | [
"stop_words.LANGUAGE_MAPPING.keys",
"stop_words.get_stop_words"
] | [((1970, 1994), 'stop_words.LANGUAGE_MAPPING.keys', '_LANGUAGE_MAPPING.keys', ([], {}), '()\n', (1992, 1994), True, 'from stop_words import LANGUAGE_MAPPING as _LANGUAGE_MAPPING\n'), ((2233, 2254), 'stop_words.get_stop_words', '_get_stop_words', (['lang'], {}), '(lang)\n', (2248, 2254), True, 'from stop_words import ge... |
""" Game of life """
import evodynamic.experiment as experiment
import evodynamic.connection.cellular_automata as ca
import evodynamic.cells.activation as act
import evodynamic.connection as connection
width = 200
height = 150
exp = experiment.Experiment()
g_ca = exp.add_group_cells(name="g_ca", amount=width*height)... | [
"matplotlib.pyplot.title",
"evodynamic.connection.cellular_automata.create_count_neighbors_ca2d",
"matplotlib.pyplot.show",
"evodynamic.experiment.Experiment",
"matplotlib.animation.FuncAnimation",
"evodynamic.connection.WeightedConnection",
"matplotlib.pyplot.figure",
"evodynamic.connection.cellular_... | [((236, 259), 'evodynamic.experiment.Experiment', 'experiment.Experiment', ([], {}), '()\n', (257, 259), True, 'import evodynamic.experiment as experiment\n'), ((345, 381), 'evodynamic.connection.cellular_automata.create_count_neighbors_ca2d', 'ca.create_count_neighbors_ca2d', (['(3)', '(3)'], {}), '(3, 3)\n', (375, 38... |
from app_ccf.encoder import ApplicationEncoder
from app_ccf.models import Application
from datetime import datetime, timezone
from django.db import models
from django.contrib.postgres.fields import JSONField
class AdminAction(models.Model):
"""
Represents and action taken by an administrator on an Application... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.contrib.postgres.fields.JSONField",
"django.db.models.DateTimeField",
"app_ccf.models.Application"
] | [((500, 556), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Application'], {'on_delete': 'models.CASCADE'}), '(Application, on_delete=models.CASCADE)\n', (517, 556), False, 'from django.db import models\n'), ((568, 599), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_leng... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.