code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
if(GPIO.input(2) ==1):
print('NO')
else:
print('YES')
GPIO.cleanup()
| [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.setwarnings",
"RPi.GPIO.input",
"RPi.GPIO.setmode"
] | [((43, 66), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (59, 66), True, 'import RPi.GPIO as GPIO\n'), ((67, 89), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (79, 89), True, 'import RPi.GPIO as GPIO\n'), ((90, 138), 'RPi.GPIO.setup', 'GPIO.setup', (['(2)', 'GPI... |
import os.path as osp
import random
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal, assert_array_equal
from mmaction.core import (ActivityNetLocalization,
average_recall_at_avg_proposals, confusion_matrix,
get_weighted_score, ... | [
"mmaction.core.average_recall_at_avg_proposals",
"numpy.array",
"numpy.arange",
"numpy.mean",
"numpy.testing.assert_array_almost_equal",
"numpy.int64",
"mmaction.core.mmit_mean_average_precision",
"numpy.delete",
"mmaction.core.top_k_accuracy",
"mmaction.core.mean_class_accuracy",
"numpy.diff",
... | [((739, 795), 'numpy.zeros', 'np.zeros', (['(max_index + 1, max_index + 1)'], {'dtype': 'np.int64'}), '((max_index + 1, max_index + 1), dtype=np.int64)\n', (747, 795), True, 'import numpy as np\n'), ((1057, 1100), 'numpy.delete', 'np.delete', (['confusion_mat', 'del_index'], {'axis': '(0)'}), '(confusion_mat, del_index... |
import os
import asyncio
import sys
import logging
import logging.handlers
import traceback
import aiohttp
import config
import discord
from discord.ext import commands
script_name = os.path.basename(__file__).split('.')[0]
log_file_name = f"{script_name}.log"
# Limit of discord (non-nitro) is 8MB (not MiB)
max_fil... | [
"logging.getLogger",
"aiohttp.ClientSession",
"os.path.exists",
"logging.StreamHandler",
"discord.ext.commands.when_mentioned_or",
"os.makedirs",
"discord.ext.commands.Bot",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"sys.exc_info",
"traceback.print_exc",
"discord.Activity",
... | [((377, 492), 'logging.handlers.RotatingFileHandler', 'logging.handlers.RotatingFileHandler', ([], {'filename': 'log_file_name', 'maxBytes': 'max_file_size', 'backupCount': 'backup_count'}), '(filename=log_file_name, maxBytes=\n max_file_size, backupCount=backup_count)\n', (413, 492), False, 'import logging\n'), ((5... |
import numpy as np
import sys
import os
import pytest
from knnFeat import _distance
sys.path.append(os.getcwd())
@pytest.mark.success
def test_distance():
a = np.array([0, 0])
b = np.array([3, 4])
expected = _distance(a, b)
actual = 5
assert expected == actual
| [
"numpy.array",
"knnFeat._distance",
"os.getcwd"
] | [((100, 111), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (109, 111), False, 'import os\n'), ((165, 181), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (173, 181), True, 'import numpy as np\n'), ((190, 206), 'numpy.array', 'np.array', (['[3, 4]'], {}), '([3, 4])\n', (198, 206), True, 'import numpy as np\n'... |
import json
from django.http import HttpResponse
from lxml import etree
import requests
from app_spider.models import Proxy
def processing(request):
"""
获取代理
channel: nn-国内高匿/nt-国内普通/wn-国内https/wt-国内http
:return:
"""
channel = 'nn'
headers = {
'User-Agent': 'Mozilla/5.0 (Window... | [
"app_spider.models.Proxy",
"json.dumps",
"lxml.etree.HTML",
"requests.get"
] | [((426, 497), 'requests.get', 'requests.get', (["('http://www.xicidaili.com/%s/' % channel)"], {'headers': 'headers'}), "('http://www.xicidaili.com/%s/' % channel, headers=headers)\n", (438, 497), False, 'import requests\n'), ((538, 556), 'lxml.etree.HTML', 'etree.HTML', (['r.text'], {}), '(r.text)\n', (548, 556), Fals... |
import numpy as np
import os
import pdb
import sys
import time
import pickle
from create_pair_set import create
from mediator import train_mediator, test_mediator
def get_hist(cmt):
cmt = [idx for c in cmt for idx in c]
hist = {}
for i in cmt:
if i == -1:
continue
if i in hist.k... | [
"numpy.ones",
"numpy.unique",
"numpy.where",
"numpy.sort",
"pickle.load",
"os.path.isfile",
"numpy.array",
"mediator.test_mediator",
"multiprocessing.Pool",
"create_pair_set.create",
"mediator.train_mediator",
"numpy.load",
"numpy.save"
] | [((979, 1003), 'multiprocessing.Pool', 'multiprocessing.Pool', (['(16)'], {}), '(16)\n', (999, 1003), False, 'import multiprocessing\n'), ((1241, 1256), 'numpy.array', 'np.array', (['pairs'], {}), '(pairs)\n', (1249, 1256), True, 'import numpy as np\n'), ((1270, 1286), 'numpy.array', 'np.array', (['scores'], {}), '(sco... |
from scipy import stats
from scipy import optimize
from scipy.special import logsumexp
from scipy.cluster import hierarchy
import scipy
import warnings
import numpy as np
import sys
import collections
import operator
import itertools
from time import perf_counter
from datetime import timedelta
from enum import Enum
fr... | [
"numpy.log",
"scipy.stats.beta.logcdf",
"numpy.array",
"scipy.stats.pearsonr",
"operator.itemgetter",
"scipy.special.logsumexp",
"scipy.cluster.hierarchy.fcluster",
"numpy.mean",
"numpy.full_like",
"numpy.where",
"time.perf_counter",
"numpy.max",
"numpy.exp",
"scipy.cluster.hierarchy.linka... | [((16173, 16297), 'collections.namedtuple', 'collections.namedtuple', (['"""_BestCluster"""', '"""cluster_i n_reliable info_content likelihood psv_f_values sample_gt_probs"""'], {}), "('_BestCluster',\n 'cluster_i n_reliable info_content likelihood psv_f_values sample_gt_probs'\n )\n", (16195, 16297), False, 'imp... |
from django.urls import path
from .views import (
UserApiView,
RegisterApiView,
BudgetListApiView,
BudgetDetailApiView,
TransactionListApiView,
TransactionDetailApiView)
from rest_framework.authtoken import views
urlpatterns = [
path(
'user/<int:pk>',
UserApiView.as_view(),... | [
"django.urls.path"
] | [((445, 483), 'django.urls.path', 'path', (['"""login"""', 'views.obtain_auth_token'], {}), "('login', views.obtain_auth_token)\n", (449, 483), False, 'from django.urls import path\n')] |
# Guestivus: The Git client for the rest of us!
# MIT License
# Copyright (c) Microsoft Corporation. All rights reserved.
# See https://github.com/microsoft/Guestivus/blob/master/LICENSE for license details.
# This is the library that contains the functional layer and Git integration.
# This library is used by the Gue... | [
"os.path.exists",
"subprocess.run"
] | [((1950, 2048), 'subprocess.run', 'subprocess.run', (["(['git'] + args)"], {'cwd': 'self.localRoot', 'shell': '(True)', 'text': '(True)', 'capture_output': '(True)'}), "(['git'] + args, cwd=self.localRoot, shell=True, text=True,\n capture_output=True)\n", (1964, 2048), False, 'import subprocess\n'), ((3566, 3596), '... |
from itertools import chain
def dutch_flag_sort2(items, order=colours_in_order):
'return summed filter of items using the given order'
return list(chain.from_iterable([c for c in items if c==colour]
for colour in order))
| [
"itertools.chain.from_iterable"
] | [((155, 229), 'itertools.chain.from_iterable', 'chain.from_iterable', (['([c for c in items if c == colour] for colour in order)'], {}), '([c for c in items if c == colour] for colour in order)\n', (174, 229), False, 'from itertools import chain\n')] |
# Homework Assignment 09
# from <NAME> 20005242
# pseudocode #
# Define a function with given word and guessed word as input
# In word guesser function {
# initialise ansList and input answer into this list
# initialise guessList and input guessed word into this list
# initialise arr_guess array with clue marks defined... | [
"sys.exc_info"
] | [((2372, 2386), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (2384, 2386), False, 'import sys\n')] |
"""
Ubuntu 20.04 might not always do a good job of picking audio devices as they are plugged in/out (bluetooth headset,
external speakers/mic conected through a docking station, etc). So this script can automate the selection based on the
rules configuration up above (list of preferred output/input devices in order).
... | [
"os.system",
"subprocess.run",
"re.search"
] | [((1026, 1093), 'subprocess.run', 'subprocess.run', (["[f'pacmd', f'list-{type}s']"], {'stdout': 'subprocess.PIPE'}), "([f'pacmd', f'list-{type}s'], stdout=subprocess.PIPE)\n", (1040, 1093), False, 'import subprocess, re\n'), ((1274, 1299), 're.search', 're.search', (['""""(.*)\\""""', 'line'], {}), '(\'"(.*)"\', line)... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
This test checks simple acceptance of bigger blocks via p2... | [
"test_framework.comptool.TestInstance"
] | [((3347, 3383), 'test_framework.comptool.TestInstance', 'TestInstance', ([], {'sync_every_block': '(False)'}), '(sync_every_block=False)\n', (3359, 3383), False, 'from test_framework.comptool import TestManager, TestInstance, RejectResult\n')] |
'''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
# pylint: disable=invalid-name,too-many-branches,too-many-statements
import os
import sys
import uuid
from torch import nn
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
try:
import PlainNet
from PlainNet import _get_ri... | [
"torch.nn.ModuleList",
"uuid.uuid4",
"PlainNet.create_netblock_list_from_str",
"os.path.abspath",
"PlainNet._get_right_parentheses_index_",
"global_utils.smart_round"
] | [((3997, 4116), 'PlainNet.create_netblock_list_from_str', 'PlainNet.create_netblock_list_from_str', (['full_str'], {'no_create': 'no_create', 'no_reslink': 'no_reslink', 'no_BN': 'no_BN'}), '(full_str, no_create=no_create,\n no_reslink=no_reslink, no_BN=no_BN, **kwargs)\n', (4035, 4116), False, 'import PlainNet\n'),... |
import json
import os
import random
def train_val_split(anno,ratio=0.2,num=200):
random.shuffle(anno)
n = len(anno)
val = anno[:int(n*ratio)]
train = anno[int(n*ratio):]
trainval = train[:min(num,int(len(train)*ratio))]
print(len(val),len(train),len(trainval))
return val,train,trainval
dat... | [
"random.shuffle"
] | [((86, 106), 'random.shuffle', 'random.shuffle', (['anno'], {}), '(anno)\n', (100, 106), False, 'import random\n')] |
#!/usr/bin/env python
'''
Script to generate ntrials number of background only test statistics and save
information about each trial to outfile
@options:
--i index: alert event index
--ntrials: number of trials to perform
'''
import time, pickle, argparse, os
import numpy as np
import pandas as pd
from fr... | [
"os.path.exists",
"pickle.dump",
"argparse.ArgumentParser",
"pandas.read_csv",
"francis.utils.get_francis_path",
"os.path.expandvars",
"francis.time_integrated_scripts.config_steady.config",
"os.mkdir",
"time.time"
] | [((413, 437), 'francis.utils.get_francis_path', 'utils.get_francis_path', ([], {}), '()\n', (435, 437), False, 'from francis import utils\n'), ((1055, 1111), 'pandas.read_csv', 'pd.read_csv', (["(f_path + 'icecube_misc/alert_dataframe.csv')"], {}), "(f_path + 'icecube_misc/alert_dataframe.csv')\n", (1066, 1111), True, ... |
# author: <NAME>
# for rscs
from context import Output
import unittest
import RPi.GPIO as GPIO
class test_simple_output(unittest.TestCase):
def setUp(self):
self.out_pin = 2
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def test_init_errs(self):
# try to initialize output with illegal location
with sel... | [
"RPi.GPIO.cleanup",
"context.Output",
"RPi.GPIO.setwarnings",
"RPi.GPIO.input",
"unittest.main",
"RPi.GPIO.setmode"
] | [((934, 949), 'unittest.main', 'unittest.main', ([], {}), '()\n', (947, 949), False, 'import unittest\n'), ((181, 203), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (193, 203), True, 'import RPi.GPIO as GPIO\n'), ((206, 229), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(Fa... |
#!/usr/bin/env python
"""
Copyright 2012-2013 The MASTIFF Project, All Rights Reserved.
This software, having been partly or wholly developed and/or
sponsored by KoreLogic, Inc., is hereby released under the terms
and conditions set forth in the project's "README.LICENSE" file.
For a list of all contributors... | [
"mastiff.plugins.output.MastiffOutputPlugin.__init__",
"mastiff.plugins.output.MastiffOutputPlugin.deactivate",
"logging.getLogger",
"mastiff.plugins.output.MastiffOutputPlugin.activate"
] | [((1479, 1523), 'mastiff.plugins.output.MastiffOutputPlugin.__init__', 'masOutput.MastiffOutputPlugin.__init__', (['self'], {}), '(self)\n', (1517, 1523), True, 'import mastiff.plugins.output as masOutput\n'), ((1592, 1636), 'mastiff.plugins.output.MastiffOutputPlugin.activate', 'masOutput.MastiffOutputPlugin.activate'... |
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
from bson import ObjectId
from .util import ObjID
class DateTimeModelMixin(BaseModel):
created_at: Optional[datetime] = Field(None, alias="createdAt")
updated_at: Optional[datetime] = Field(None, alias="updatedAt"... | [
"pydantic.Field"
] | [((223, 253), 'pydantic.Field', 'Field', (['None'], {'alias': '"""createdAt"""'}), "(None, alias='createdAt')\n", (228, 253), False, 'from pydantic import BaseModel, Field\n'), ((291, 321), 'pydantic.Field', 'Field', (['None'], {'alias': '"""updatedAt"""'}), "(None, alias='updatedAt')\n", (296, 321), False, 'from pydan... |
import pathlib
import typing
import click
from . import constants as cst
from . import formatutils as fmt
from .helpers import Templates, Writer
from .project import create_project
def add_package_param(ctx: click.Context, param: str, value: str) -> str:
package = value.replace("-", "_")
if not package.isi... | [
"click.argument",
"click.secho",
"click.group",
"click.option",
"pathlib.Path",
"click.Path",
"click.BadParameter"
] | [((542, 555), 'click.group', 'click.group', ([], {}), '()\n', (553, 555), False, 'import click\n'), ((775, 825), 'click.argument', 'click.argument', (['"""name"""'], {'callback': 'add_package_param'}), "('name', callback=add_package_param)\n", (789, 825), False, 'import click\n'), ((1055, 1149), 'click.option', 'click.... |
from typing import final
from bs4 import BeautifulSoup
from selenium import webdriver
import time
import csv
import requests
starturl = "https://en.wikipedia.org/wiki/List_of_brown_dwarfs"
browser = webdriver.Chrome("F:/api/c127-c128/venv/chromedriver.exe")
browser.get(starturl)
time.sleep(10)
headers =... | [
"selenium.webdriver.Chrome",
"csv.writer",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup"
] | [((208, 266), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""F:/api/c127-c128/venv/chromedriver.exe"""'], {}), "('F:/api/c127-c128/venv/chromedriver.exe')\n", (224, 266), False, 'from selenium import webdriver\n'), ((293, 307), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (303, 307), False, 'import tim... |
# Generated by Django 3.1.4 on 2020-12-19 12:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('picture', '0002_image_link'),
]
operations = [
migrations.RemoveField(
model_name='image',
name='link',
),
... | [
"django.db.models.ImageField",
"django.db.migrations.RemoveField"
] | [((227, 282), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""image"""', 'name': '"""link"""'}), "(model_name='image', name='link')\n", (249, 282), False, 'from django.db import migrations, models\n'), ((424, 475), 'django.db.models.ImageField', 'models.ImageField', ([], {'null': '... |
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"model.UsageCounter.create"
] | [((813, 847), 'model.UsageCounter.create', 'model.UsageCounter.create', (['"""haiti"""'], {}), "('haiti')\n", (838, 847), False, 'import model\n')] |
# -*- coding: <utf-8> -*-
from .config import config
from datetime import timedelta
import os
from time import sleep
from .master_import import HDHomeRun
from .master_import import RecordingManager
from .master_import import Scheduler
from .server import app
_config_recordings_path = config.get('SimplePVR', 'recor... | [
"datetime.timedelta",
"time.sleep"
] | [((863, 883), 'datetime.timedelta', 'timedelta', ([], {'days': '(6000)'}), '(days=6000)\n', (872, 883), False, 'from datetime import timedelta\n'), ((888, 902), 'time.sleep', 'sleep', (['forever'], {}), '(forever)\n', (893, 902), False, 'from time import sleep\n')] |
# -*- coding: utf-8 -*-
# Copyright 2017 <NAME> <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... | [
"math.tan",
"pandas.DataFrame",
"datetime.datetime.strptime",
"math.log",
"math.radians",
"math.atan2",
"geopy.Point",
"warnings.warn",
"pandas.concat",
"geopy.distance.distance"
] | [((1480, 1649), 'warnings.warn', 'warnings.warn', (['"""The getBearing function is deprecated and will be removed in version 2.0.0. Use the get_bearing function instead."""', 'FutureWarning'], {'stacklevel': '(8)'}), "(\n 'The getBearing function is deprecated and will be removed in version 2.0.0. Use the get_bearin... |
# Copyright 2012-2018 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | [
"io.StringIO"
] | [((997, 1007), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1005, 1007), False, 'from io import StringIO\n')] |
import matplotlib, os
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from flarestack.analyses.ccsn.necker_2019.ccsn_helpers import (
updated_sn_catalogue_name,
sn_cats,
sn_times,
pdf_names,
raw_output_dir,
)
import logging
from flarestack.shared import plot_output_dir
pl... | [
"flarestack.analyses.ccsn.necker_2019.ccsn_helpers.updated_sn_catalogue_name",
"os.makedirs",
"matplotlib.use",
"flarestack.shared.plot_output_dir",
"matplotlib.pyplot.close",
"numpy.array",
"os.path.isdir",
"flarestack.analyses.ccsn.necker_2019.ccsn_helpers.pdf_names",
"matplotlib.pyplot.subplots"
... | [((23, 44), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (37, 44), False, 'import matplotlib, os\n'), ((329, 408), 'flarestack.shared.plot_output_dir', 'plot_output_dir', (["(raw_output_dir + '/catalogue_visualization/difference_stasik/')"], {}), "(raw_output_dir + '/catalogue_visualization/dif... |
from ctypes import Structure, c_int, c_char_p, POINTER
from .dll import _bind
from .stdinc import Sint16, Sint32, Uint8, SDL_bool
__all__ = ["SDL_Joystick", "SDL_JoystickGUID", "SDL_JoystickID",
"SDL_NumJoysticks", "SDL_JoystickNameForIndex", "SDL_JoystickOpen",
"SDL_JoystickName", "SDL_JoystickG... | [
"ctypes.POINTER"
] | [((1349, 1370), 'ctypes.POINTER', 'POINTER', (['SDL_Joystick'], {}), '(SDL_Joystick)\n', (1356, 1370), False, 'from ctypes import Structure, c_int, c_char_p, POINTER\n'), ((1418, 1439), 'ctypes.POINTER', 'POINTER', (['SDL_Joystick'], {}), '(SDL_Joystick)\n', (1425, 1439), False, 'from ctypes import Structure, c_int, c_... |
import random
import math
import sys
import time
from interface import Application
from no import No
from individuo import Individuo
import copy
class AlgoritmoGenetico:
def __init__(self):
self.operadores = ['+', '-', '*', '%']
self.termos = ['x', -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
... | [
"random.choice",
"individuo.Individuo",
"random.shuffle",
"no.No",
"interface.Application",
"copy.deepcopy",
"random.randint"
] | [((762, 799), 'random.choice', 'random.choice', (['self.possiveis_valores'], {}), '(self.possiveis_valores)\n', (775, 799), False, 'import random\n'), ((821, 833), 'no.No', 'No', (['v1', 'raiz'], {}), '(v1, raiz)\n', (823, 833), False, 'from no import No\n'), ((985, 1022), 'random.choice', 'random.choice', (['self.poss... |
# -*- coding: utf-8 -*-
from noval import GetApp,_,NewId
import noval.iface as iface
import noval.plugin as plugin
from noval.project.basebrowser import *
import noval.consts as consts
import os
import noval.python.project.viewer as projectviewer
import noval.python.project.rundocument as runprojectdocument
im... | [
"noval.python.project.viewer.PythonProjectView",
"noval.plugin.Implements",
"noval.python.project.sched.SchedulerRun",
"noval.GetApp",
"noval._",
"os.path.basename",
"noval.NewId"
] | [((6935, 6973), 'noval.plugin.Implements', 'plugin.Implements', (['iface.CommonPluginI'], {}), '(iface.CommonPluginI)\n', (6952, 6973), True, 'import noval.plugin as plugin\n'), ((3229, 3266), 'noval.python.project.viewer.PythonProjectView', 'projectviewer.PythonProjectView', (['self'], {}), '(self)\n', (3260, 3266), T... |
from fileIO import experiment_item_name
def test_experiment_item_name():
path = "some-file.lp"
assert experiment_item_name(path) == "some-file"
nested_path = "/some-dir/some-file.lp"
assert experiment_item_name(nested_path) == "some-file"
different_extension = "some-file.txt"
assert experimen... | [
"fileIO.experiment_item_name"
] | [((111, 137), 'fileIO.experiment_item_name', 'experiment_item_name', (['path'], {}), '(path)\n', (131, 137), False, 'from fileIO import experiment_item_name\n'), ((208, 241), 'fileIO.experiment_item_name', 'experiment_item_name', (['nested_path'], {}), '(nested_path)\n', (228, 241), False, 'from fileIO import experimen... |
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from core import db_config
conn_str = 'postgresql+psycopg2://{username}:{password}@{host}/{db}'.format(
username=db_config['user'],
password=db_config['password'],
host=db_co... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base"
] | [((369, 404), 'sqlalchemy.create_engine', 'create_engine', (['conn_str'], {'echo': '(False)'}), '(conn_str, echo=False)\n', (382, 404), False, 'from sqlalchemy import create_engine\n'), ((412, 430), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (428, 430), False, 'from sqlalchemy.... |
from nltk.corpus import wordnet
from nltk.corpus import semcor
from semcor_chunk import semcor_chunk
import argparse
#debug function to print out the matrix
#taken from https://stackoverflow.com/questions/13214809/pretty-print-2d-python-list
def print_matrix(matrix):
s = [[str(e) for e in row] for row in matrix]
le... | [
"argparse.ArgumentParser",
"nltk.corpus.semcor.tagged_sents",
"semcor_chunk.semcor_chunk",
"nltk.corpus.semcor.sents",
"nltk.corpus.wordnet.synsets"
] | [((521, 687), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute the \t\tedit distance between one untagged and one tagged sentence \t\tin the SemCor corpus at input indices."""'}), "(description=\n 'Compute the \\t\\tedit distance between one untagged and one tagged sentence \\t\... |
import numpy as np
import pytest
from ephysiopy.common import utils
def test_smooth():
x = np.random.rand(100)
x = list(x)
with pytest.raises(ValueError):
utils.smooth(np.atleast_2d(x))
with pytest.raises(ValueError):
utils.smooth(x, window_len=len(x)+1)
utils.smooth(x, window_len=... | [
"ephysiopy.common.utils.polar",
"ephysiopy.common.utils.bwperim",
"numpy.atleast_2d",
"numpy.random.rand",
"numpy.random.default_rng",
"ephysiopy.common.utils.blurImage",
"ephysiopy.common.utils.smooth",
"ephysiopy.common.utils.repeat_ind",
"numpy.array",
"numpy.random.randint",
"pytest.raises",... | [((97, 116), 'numpy.random.rand', 'np.random.rand', (['(100)'], {}), '(100)\n', (111, 116), True, 'import numpy as np\n'), ((293, 322), 'ephysiopy.common.utils.smooth', 'utils.smooth', (['x'], {'window_len': '(2)'}), '(x, window_len=2)\n', (305, 322), False, 'from ephysiopy.common import utils\n'), ((327, 356), 'ephysi... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"cirq.ops.XXPowGate"
] | [((1296, 1355), 'cirq.ops.XXPowGate', 'ops.XXPowGate', ([], {'exponent': '(rads * 2 / np.pi)', 'global_shift': '(-0.5)'}), '(exponent=rads * 2 / np.pi, global_shift=-0.5)\n', (1309, 1355), False, 'from cirq import ops\n')] |
import numpy as np
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegressionCV
from sklearn.decomposition import DictionaryLearning, NMF, PCA
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.preprocessing import scale, normalize
from sklearn.model_selection import G... | [
"sklearn.model_selection.GridSearchCV",
"json.loads",
"sklearn.svm.SVC",
"numpy.mean",
"numpy.shape",
"sklearn.metrics.classification_report",
"numpy.squeeze",
"numpy.array",
"sklearn.preprocessing.normalize",
"ENWrapper.ENSim",
"numpy.random.shuffle"
] | [((5401, 5467), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""', 'C': '(10)', 'verbose': '(False)', 'class_weight': '"""balanced"""'}), "(kernel='linear', C=10, verbose=False, class_weight='balanced')\n", (5404, 5467), False, 'from sklearn.svm import SVC\n'), ((1643, 1663), 'json.loads', 'json.loads', (['json_... |
from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from django.views.static import serve
from django.views.i18n import javascript_catalog
from rest_framework.documentation import include_docs_urls
from experiments import views
from experiments import api_urls
f... | [
"experiments.views.NepPasswordResetDoneView.as_view",
"django.conf.urls.url",
"experiments.views.NepPasswordResetConfirmView.as_view",
"experiments.views.NepSearchView.as_view",
"experiments.views.NepPasswordResetCompleteView.as_view",
"experiments.views.NepPasswordResetView.as_view",
"django.conf.urls.... | [((502, 533), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (505, 533), False, 'from django.conf.urls import url, include\n'), ((1559, 1598), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.home_page'], {'name': '"""home"""'}), "('^$', views.home_page, ... |
# Generated by Django 3.1.1 on 2020-11-30 20:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0003_profile_users_footprint"),
]
operations = [
migrations.AddField(
model_name="profile",
name="diet_l... | [
"django.db.models.IntegerField"
] | [((345, 557), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(0, 'Not Applicable'), (1, 'Learning Level'), (2, 'Listening Level'), (3,\n 'Action Level')]", 'default': '(0)', 'help_text': '"""Which level of Diet Missions to recommend for this player."""'}), "(choices=[(0, 'Not Applicable')... |
import os
import warnings
from argparse import ArgumentParser
import torch
import torch.nn as nn
import torch.optim as optim
from ignite.contrib.handlers import ProgressBar
from ignite.contrib.handlers.tensorboard_logger import *
from ignite.engine import Events, Engine
from ignite.metrics import RunningAverage, Loss,... | [
"lilanet.datasets.KITTI",
"ignite.metrics.Loss",
"lilanet.datasets.KITTI.class_weights",
"torch.cuda.device_count",
"ignite.engine.Engine",
"torch.cuda.is_available",
"lilanet.datasets.KITTI.num_classes",
"ignite.metrics.ConfusionMatrix",
"lilanet.datasets.transforms.ToTensor",
"argparse.ArgumentP... | [((1550, 1569), 'lilanet.datasets.KITTI.num_classes', 'KITTI.num_classes', ([], {}), '()\n', (1567, 1569), False, 'from lilanet.datasets import KITTI, Normalize, Compose, RandomHorizontalFlip\n'), ((1582, 1602), 'lilanet.model.LiLaNet', 'LiLaNet', (['num_classes'], {}), '(num_classes)\n', (1589, 1602), False, 'from lil... |
# -*- coding: utf-8 -*-
"""
convert compas dataset into S, X1, X2, y quadraple
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import time
import datetime
import sys
import os
import copy
import itertools
from sklearn import svm
from sklearn import tree
from sklearn import ensemble
from sklear... | [
"pandas.read_csv",
"numpy.corrcoef",
"os.path.join",
"io.open",
"numpy.array",
"pandas.get_dummies",
"pandas.concat",
"pandas.to_datetime"
] | [((697, 770), 'os.path.join', 'os.path.join', (['conf.datadir', '"""compas-analysis/compas-scores-two-years.csv"""'], {}), "(conf.datadir, 'compas-analysis/compas-scores-two-years.csv')\n", (709, 770), False, 'import os\n'), ((956, 975), 'io.open', 'open', (['filename', '"""w"""'], {}), "(filename, 'w')\n", (960, 975),... |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
import argparse
# Contains the argumen... | [
"argparse.FileType",
"argparse.ArgumentParser"
] | [((409, 473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test an OpenSearch Bundle"""'}), "(description='Test an OpenSearch Bundle')\n", (432, 473), False, 'import argparse\n'), ((528, 550), 'argparse.FileType', 'argparse.FileType', (['"""r"""'], {}), "('r')\n", (545, 550), False, 'i... |
import asyncio
import os.path
import transmissionrpc
from wcpan.logger import DEBUG, INFO, WARNING, EXCEPTION
from . import settings
from .drive import DriveUploader
class DiskSpaceListener(object):
def __init__(self):
self._timer = None
def __enter__(self):
self._timer = asyncio.create_ta... | [
"wcpan.logger.INFO",
"wcpan.logger.DEBUG",
"asyncio.sleep",
"wcpan.logger.WARNING",
"wcpan.logger.EXCEPTION"
] | [((1787, 1799), 'wcpan.logger.INFO', 'INFO', (['"""duld"""'], {}), "('duld')\n", (1791, 1799), False, 'from wcpan.logger import DEBUG, INFO, WARNING, EXCEPTION\n'), ((2000, 2013), 'wcpan.logger.DEBUG', 'DEBUG', (['"""duld"""'], {}), "('duld')\n", (2005, 2013), False, 'from wcpan.logger import DEBUG, INFO, WARNING, EXCE... |
from tkinter import *
from PIL import ImageTk, Image
from tkinter import filedialog
root = Tk()
root.title("Tk New Window")
root.iconbitmap("tabicon.ico")
def OpenFile():
global myImage
# We need to read the file first
root.filename = filedialog.askopenfilename(
initialdir="C:\\Users\\MSI\\Doc... | [
"PIL.Image.open",
"tkinter.filedialog.askopenfilename"
] | [((253, 486), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""C:\\\\Users\\\\MSI\\\\Documents\\\\GitHub Repos\\\\Portfolio\\\\Images\\\\PythonImagestest"""', 'title': '"""Select A File"""', 'filetype': "(('jpg files', '*.jpg'), ('All Files', '*.*'), ('Suk dic', '*.dic'))"}), ... |
# Copyright 2017 The TensorFlow Authors. 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 applica... | [
"tensorflow.python.ops.distributions.util.gen_new_seed",
"numpy.log",
"numpy.int32",
"tensorflow.python.ops.math_ops.equal",
"tensorflow.python.ops.math_ops.range",
"tensorflow.python.framework.ops.name_scope",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.ops.array_ops.ones_like",
"... | [((1535, 1763), 'collections.namedtuple', 'collections.namedtuple', (['"""KernelResults"""', "['log_accept_ratio', 'current_grads_target_log_prob',\n 'current_target_log_prob', 'is_accepted',\n 'proposed_grads_target_log_prob', 'proposed_state',\n 'proposed_target_log_prob']"], {}), "('KernelResults', ['log_ac... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9b1 on 2016-01-28 17:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scheduling', '0008_auto_20160126_1343'),
]
operations = [
migrations.AlterMo... | [
"django.db.migrations.AlterModelOptions",
"django.db.models.BooleanField"
] | [((302, 399), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""equipment"""', 'options': "{'verbose_name_plural': 'equipment'}"}), "(name='equipment', options={\n 'verbose_name_plural': 'equipment'})\n", (330, 399), False, 'from django.db import migrations, models\n'), ((54... |
import argparse
import logging
import os
import json
import pickle
import random
import time
import numpy as np
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler, Dataset
from transformers import AdamW, get_linear_schedule_with_warmup, set_seed
from utils import set_l... | [
"logging.getLogger",
"os.path.exists",
"utils.set_logger",
"argparse.ArgumentParser",
"os.makedirs",
"train_and_eval.train",
"os.path.join",
"processor.sentiment_convert_examples_to_features",
"numpy.array",
"torch.cuda.is_available",
"time.time",
"processor.SentimentDataset",
"logging.info"... | [((956, 983), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (973, 983), False, 'import logging\n'), ((1381, 1406), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1404, 1406), False, 'import argparse\n'), ((3947, 4014), 'os.path.join', 'os.path.join', (['args.out... |
from discord.ext import commands
class Watchafaboulas:
def __init__(self, Human_Boi):
self.Human_Boi = Human_Boi
@commands.command(name="ping")
async def ping(self, ctx):
await ctx.send("pong")
def setup(Human_Boi):
Human_Boi.add_cog(Watchafaboulas(Human_Boi))
| [
"discord.ext.commands.command"
] | [((142, 171), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""ping"""'}), "(name='ping')\n", (158, 171), False, 'from discord.ext import commands\n')] |
#
# Copyright 2017 the original author or 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"twisted.internet.reactor.callLater",
"voltha.adapters.asfvolt16_olt.protos.bal_pb2.BalErr"
] | [((1299, 1315), 'voltha.adapters.asfvolt16_olt.protos.bal_pb2.BalErr', 'bal_pb2.BalErr', ([], {}), '()\n', (1313, 1315), False, 'from voltha.adapters.asfvolt16_olt.protos import bal_model_types_pb2, bal_errno_pb2, bal_pb2, bal_model_ids_pb2\n'), ((2018, 2138), 'twisted.internet.reactor.callLater', 'reactor.callLater', ... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
ASSIGNEE = "assignee"
ATTRIBUTES = "attributes"
DUE_DATE = "due_date"
ESCALATED = "escalated"
ESCALATEE = "escalatee"
ESCALATION_DATE = "escalation_date"
NAME = "name"
OVERDUE = "overdue"
REMINDED = "rem... | [
"json.loads"
] | [((531, 2781), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "assignee": {\n "type": "string",\n "title": "Assignee",\n "description": "Task Assignee",\n "order": 11\n },\n "attributes": {\n "type": "array",\n "title": ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os.path
import shutil
import subprocess
import unittest
class TestProcessBase(object):
def setUp(self):
self.copy_test_project()
self.set_db()
def tearDown(self):
self.delet... | [
"shutil.copytree",
"subprocess.check_call",
"psycopg2.connect",
"shutil.rmtree"
] | [((2664, 2721), 'shutil.copytree', 'shutil.copytree', (['"""tests/test_project_src"""', '"""test_project"""'], {}), "('tests/test_project_src', 'test_project')\n", (2679, 2721), False, 'import shutil\n'), ((2790, 2839), 'shutil.rmtree', 'shutil.rmtree', (['"""test_project"""'], {'ignore_errors': '(True)'}), "('test_pro... |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def home_page(request):
if request.method == 'POST':
return render(request, 'home.html',
{'new_item_text': request.POST['item_text']})
return render(request, 'home.html')
| [
"django.shortcuts.render"
] | [((271, 299), 'django.shortcuts.render', 'render', (['request', '"""home.html"""'], {}), "(request, 'home.html')\n", (277, 299), False, 'from django.shortcuts import render\n'), ((173, 247), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', "{'new_item_text': request.POST['item_text']}"], {}), "(requ... |
import datetime
from os import environ
import mohawk
import pytest
from freezegun import freeze_time
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APIClient
from django.conf import settings
from export_readiness.tests.factories import ArticlePageFactory
... | [
"mohawk.Sender",
"rest_framework.test.APIClient",
"datetime.datetime.now",
"pytest.raises",
"freezegun.freeze_time",
"datetime.timedelta",
"rest_framework.reverse.reverse"
] | [((348, 374), 'rest_framework.reverse.reverse', 'reverse', (['"""activity-stream"""'], {}), "('activity-stream')\n", (355, 374), False, 'from rest_framework.reverse import reverse\n'), ((419, 445), 'rest_framework.reverse.reverse', 'reverse', (['"""activity-stream"""'], {}), "('activity-stream')\n", (426, 445), False, ... |
"""
Program to generate random pseudowords based on an n-gram model learnt from
a dictionary file.
Examples
--------
Generate four random pseudowords:
% python pseudoword.py -n 4
spheatable
soregia
gaded
shiosoprilin
Generate fourty random pseudowords packed in 60 columns:
% python pseudowo... | [
"signal.signal",
"argparse.ArgumentParser",
"re.compile",
"collections.Counter",
"collections.defaultdict",
"textwrap.wrap",
"random.random"
] | [((1598, 1642), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal.SIG_DFL'], {}), '(signal.SIGINT, signal.SIG_DFL)\n', (1611, 1642), False, 'import signal\n'), ((2115, 2133), 're.compile', 're.compile', (['"""\\\\W+"""'], {}), "('\\\\W+')\n", (2125, 2133), False, 'import re\n'), ((2616, 2683), 'argparse.Argu... |
from django.conf import settings
from corehq.util.es.elasticsearch import NotFoundError
from corehq.util.test_utils import unit_testing_only, trap_extra_setup
from pillowtop.es_utils import initialize_index_and_mapping
TEST_ES_PREFIX = 'test_'
def es_index(index):
prefix = '' if not settings.UNIT_TESTING else T... | [
"corehq.elastic.get_es_new",
"corehq.util.test_utils.trap_extra_setup"
] | [((436, 469), 'corehq.util.test_utils.trap_extra_setup', 'trap_extra_setup', (['ConnectionError'], {}), '(ConnectionError)\n', (452, 469), False, 'from corehq.util.test_utils import unit_testing_only, trap_extra_setup\n'), ((921, 933), 'corehq.elastic.get_es_new', 'get_es_new', ([], {}), '()\n', (931, 933), False, 'fro... |
import numpy as np
import torch
import torch.nn as nn
# =============================================================
# Interface for the losses
# =============================================================
class GANLoss:
""" Base class for all losses
@args:
dis: Discriminator used for calcu... | [
"torch.nn.Softplus",
"torch.mul",
"torch.autograd.Variable"
] | [((1623, 1676), 'torch.autograd.Variable', 'torch.autograd.Variable', (['real_img'], {'requires_grad': '(True)'}), '(real_img, requires_grad=True)\n', (1646, 1676), False, 'import torch\n'), ((2158, 2191), 'torch.mul', 'torch.mul', (['real_grads', 'real_grads'], {}), '(real_grads, real_grads)\n', (2167, 2191), False, '... |
"""The classic exhibitor of chaos, consisting of 3 coupled ODEs.
The ODEs are derived by modelling, with many simplifications,
the fluid convection between horizontal plates with different temperatures.
Its phase-plot (with typical param settings) looks like a butterfly.
See demo.py for more info.
"""
import numpy... | [
"numpy.array",
"dapper.mods.with_rk4"
] | [((478, 510), 'numpy.array', 'np.array', (['[1.509, -1.531, 25.46]'], {}), '([1.509, -1.531, 25.46])\n', (486, 510), True, 'import numpy as np\n'), ((760, 798), 'dapper.mods.with_rk4', 'modelling.with_rk4', (['dxdt'], {'autonom': '(True)'}), '(dxdt, autonom=True)\n', (778, 798), True, 'import dapper.mods as modelling\n... |
"""Lesson model"""
import uuid
from django.db import models
from .classroom import Classroom
class Lesson(models.Model):
"""Model that is an abstraction of a lesson inside the platform
Args:
name: Lesson name.
classroom_id: classroom id to which the lesson must be assigned.
average_scor... | [
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.UUIDField"
] | [((379, 466), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)', 'unique': '(True)'}), '(primary_key=True, default=uuid.uuid4, editable=False,\n unique=True)\n', (395, 466), False, 'from django.db import models\n'), ((474, 518), 'django.db... |
#import cProfile
from time import sleep, time
import os
import sys
from io import StringIO
from casim.casim import CancerSimulatorParameters, CancerSimulator, HANDLER, LOGGER
import logging
level = logging.WARNING
HANDLER.setLevel(level)
LOGGER.setLevel(level)
##generations = [10,15,23,45,67,100,150,230,450,670,1000]... | [
"casim.casim.CancerSimulator",
"casim.casim.LOGGER.setLevel",
"os.path.join",
"time.sleep",
"casim.casim.CancerSimulatorParameters",
"time.time",
"casim.casim.HANDLER.setLevel"
] | [((215, 238), 'casim.casim.HANDLER.setLevel', 'HANDLER.setLevel', (['level'], {}), '(level)\n', (231, 238), False, 'from casim.casim import CancerSimulatorParameters, CancerSimulator, HANDLER, LOGGER\n'), ((239, 261), 'casim.casim.LOGGER.setLevel', 'LOGGER.setLevel', (['level'], {}), '(level)\n', (254, 261), False, 'fr... |
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
x_train = mni... | [
"keras.models.Sequential",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"keras.optimizers.SGD",
"keras.layers.Dense",
"keras.layers.Dropout"
] | [((251, 305), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data/"""'], {'one_hot': '(True)'}), "('MNIST_data/', one_hot=True)\n", (276, 305), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((428, 440), 'keras.models.Sequential', 'Sequ... |
from gui import Gui
myGui: Gui = Gui()
myGui.run()
| [
"gui.Gui"
] | [((35, 40), 'gui.Gui', 'Gui', ([], {}), '()\n', (38, 40), False, 'from gui import Gui\n')] |
# coding=utf-8
from pyecharts.components import Table
def table_base():
table = Table()
headers = ["City name", "Area", "Population", "Annual Rainfall"]
rows = [
["Brisbane", 5905, 1857594, 1146.4],
["Adelaide", 1295, 1158259, 600.5],
["Darwin", 112, 120900, 1714.7],
["Hob... | [
"pyecharts.components.Table"
] | [((86, 93), 'pyecharts.components.Table', 'Table', ([], {}), '()\n', (91, 93), False, 'from pyecharts.components import Table\n')] |
import matplotlib
#matplotlib.use('TkAgg')
from config import *
from plot_utils import *
from shared_utils import *
import pickle as pkl
import numpy as np
from collections import OrderedDict
from matplotlib import pyplot as plt
from pymc3.stats import quantiles
import os
import pandas as pd
from pathlib import Path
#... | [
"numpy.mean",
"numpy.reshape",
"pandas.DataFrame",
"matplotlib.pyplot.xticks",
"pathlib.Path",
"pandas.Timedelta",
"pickle.load",
"matplotlib.pyplot.close",
"matplotlib.pyplot.GridSpec",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"pymc3.stats.quantiles",
"pandas.Timestamp"... | [((2132, 2159), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (2142, 2159), True, 'from matplotlib import pyplot as plt\n'), ((2171, 2263), 'matplotlib.pyplot.GridSpec', 'plt.GridSpec', (['(1)', '(1)'], {'top': '(0.9)', 'bottom': '(0.2)', 'left': '(0.07)', 'right': '(0.9... |
from torchsummary import summary
import torch
import torch.nn as nn
import torch.nn.functional as F
from ModelTrainer import ModelTrainer
import Resnet as rn
class Net():
"""
Base network that defines helper functions, summary and mapping to device
"""
def __init__(self, model):
... | [
"torch.load",
"torchsummary.summary",
"ModelTrainer.ModelTrainer"
] | [((439, 481), 'torchsummary.summary', 'summary', (['self.model'], {'input_size': 'input_size'}), '(self.model, input_size=input_size)\n', (446, 481), False, 'from torchsummary import summary\n'), ((690, 831), 'ModelTrainer.ModelTrainer', 'ModelTrainer', (['self.model', 'optimizer', 'train_loader', 'test_loader', 'datal... |
from detectron2.engine import DefaultTrainer, HookBase
from detectron2.config import get_cfg
from detectron2.data.datasets import register_coco_instances, load_coco_json
from detectron2.modeling import build_model
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.data import DatasetCatalog, Metada... | [
"detectron2.modeling.build_model",
"detectron2.config.get_cfg",
"detectron2.engine.DefaultTrainer",
"cv2.waitKey",
"detectron2.checkpoint.DetectionCheckpointer",
"detectron2.data.MetadataCatalog.get",
"cv2.imread",
"detectron2.data.datasets.load_coco_json",
"detectron2.data.DatasetCatalog.get"
] | [((543, 617), 'detectron2.data.datasets.load_coco_json', 'load_coco_json', (['f_path_annotation', 'imgs_root'], {'dataset_name': 'name_of_dataset'}), '(f_path_annotation, imgs_root, dataset_name=name_of_dataset)\n', (557, 617), False, 'from detectron2.data.datasets import register_coco_instances, load_coco_json\n'), ((... |
import itertools
import re
from collections import defaultdict
from watson_developer_cloud.assistant_v1 import CreateIntent, CreateExample, Mentions, CreateEntity
from hovor.outcome_determiners.unified_workspace_outcome_determiner import UnifiedWorkspaceOutcomeDeterminer
from hovor.runtime.outcome_determination_progr... | [
"watson_developer_cloud.assistant_v1.CreateIntent",
"itertools.product",
"watson_developer_cloud.assistant_v1.CreateEntity",
"watson_developer_cloud.assistant_v1.CreateExample",
"collections.defaultdict",
"watson_developer_cloud.assistant_v1.Mentions",
"re.findall"
] | [((4373, 4407), 'itertools.product', 'itertools.product', (['*value_examples'], {}), '(*value_examples)\n', (4390, 4407), False, 'import itertools\n'), ((6245, 6289), 're.findall', 're.findall', (['"""(([^ .?,]+)|([,?.]+))"""', 'example'], {}), "('(([^ .?,]+)|([,?.]+))', example)\n", (6255, 6289), False, 'import re\n')... |
"""
A simple wrapper to invoke pbundler without needing to install it, making debugging easier in an IDE
"""
import sys
from pbundler import PBCli
def main():
sys.exit(PBCli().run(sys.argv))
if __name__ == '__main__':
main() | [
"pbundler.PBCli"
] | [((175, 182), 'pbundler.PBCli', 'PBCli', ([], {}), '()\n', (180, 182), False, 'from pbundler import PBCli\n')] |
import pickle
import argparse
import sys
import onmt
from codit.clone_based_model import clone_based_structural_transformation
from codit.grammar import JavaGrammar
from translate_structure import translate_all as structure_translate
import os
from defj_experiment.translate_token import main as token_translate
from u... | [
"os.path.exists",
"onmt.opts.translate_opts",
"defj_experiment.translate_token.main",
"argparse.ArgumentParser",
"translate_structure.translate_all",
"pickle.load",
"codit.clone_based_model.clone_based_structural_transformation",
"util.debug",
"os.mkdir",
"onmt.opts.add_md_help_argument"
] | [((405, 524), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""full_translation.py"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='full_translation.py', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (428, 524), False, 'import argparse\... |
'''
2020, Copyright <NAME>
LUT University
============================
This is a module for communicating with RL algorithm.
'''
import zmq
import json
class Worker:
def __init__(self, port):
self.port = port
# Create zmq socket on specific port
self.context = zmq.Contex... | [
"zmq.Context.instance",
"json.loads",
"json.dumps",
"zmq.Context"
] | [((310, 323), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (321, 323), False, 'import zmq\n'), ((583, 604), 'json.loads', 'json.loads', (['b_request'], {}), '(b_request)\n', (593, 604), False, 'import json\n'), ((363, 385), 'zmq.Context.instance', 'zmq.Context.instance', ([], {}), '()\n', (383, 385), False, 'import ... |
# encoding: utf-8
#
# Task worker - design 2
# Adds pub-sub flow to receive and respond to kill signal
#
# Author: <NAME> (brainsik) <spork(dash)zmq(at)theory(dot)org>
#
import sys
import time
import zmq
context = zmq.Context()
# Socket to receive messages on
receiver = context.socket(zmq.PULL)
receiver.connec... | [
"time.sleep",
"zmq.Poller",
"sys.stdout.flush",
"zmq.Context",
"sys.stdout.write"
] | [((222, 235), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (233, 235), False, 'import zmq\n'), ((657, 669), 'zmq.Poller', 'zmq.Poller', ([], {}), '()\n', (667, 669), False, 'import zmq\n'), ((1021, 1050), 'time.sleep', 'time.sleep', (['(workload / 1000.0)'], {}), '(workload / 1000.0)\n', (1031, 1050), False, 'import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Visualizing the Mandelbrot Set Using Python by <NAME>, Nov 29, 2020.
https://medium.com/swlh/visualizing-the-mandelbrot-set-using-python-50-lines-f6aa5a05cf0f
Base code (no-JIT); Adapted from Blake Sanie's demonstration.
"""
from PIL import Image
from os.path import ... | [
"PIL.Image.new",
"timeit.default_timer",
"colorsys.hsv_to_rgb"
] | [((739, 803), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['(const + scale * color)', '(1 - 0.6 * color)', '(0.9)'], {}), '(const + scale * color, 1 - 0.6 * color, 0.9)\n', (758, 803), False, 'import colorsys, os, sys\n'), ((1591, 1639), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(width, height)'], {'color': '"""... |
#!/usr/bin/env python3
# created by <NAME>, 12-09-2020, ver.1.2
import sys
import os
import glob
import csv
import pathlib
from tqdm import tqdm
import textgrids
print("What is the path to the folder containing target TextGrids?")
path_in = input()
if os.path.isfile(path_in+"/0_durations.csv"):
print("Are you sur... | [
"textgrids.TextGrid",
"pathlib.Path",
"csv.writer",
"tqdm.tqdm",
"os.path.isfile",
"sys.exit",
"glob.glob"
] | [((254, 298), 'os.path.isfile', 'os.path.isfile', (["(path_in + '/0_durations.csv')"], {}), "(path_in + '/0_durations.csv')\n", (268, 298), False, 'import os\n'), ((437, 458), 'pathlib.Path', 'pathlib.Path', (['path_in'], {}), '(path_in)\n', (449, 458), False, 'import pathlib\n'), ((764, 777), 'csv.writer', 'csv.writer... |
from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
class GroupCreationParams(ClientValue):
def __init__(self, classification="", description=""):
super(GroupCreationParams, self).__init__()
self.Classification = class... | [
"office365.runtime.client_value_collection.ClientValueCollection"
] | [((400, 426), 'office365.runtime.client_value_collection.ClientValueCollection', 'ClientValueCollection', (['str'], {}), '(str)\n', (421, 426), False, 'from office365.runtime.client_value_collection import ClientValueCollection\n')] |
from sklearn.decomposition import PCA
import numpy as np
import matplotlib.pyplot as plt
from .img_util import avg_spectra
def normalize(data):
""" Normalizes data by shifting origin to mean"""
orig_mean = np.mean(data, axis=0)
norm_data = data - orig_mean
return norm_data
def get_PC(im, show_plo... | [
"numpy.mean",
"numpy.abs",
"numpy.reshape",
"numpy.arange",
"sklearn.decomposition.PCA",
"numpy.argsort",
"numpy.dot",
"numpy.round"
] | [((215, 236), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (222, 236), True, 'import numpy as np\n'), ((999, 1055), 'numpy.reshape', 'np.reshape', (['im', '(im.shape[0] * im.shape[1], im.shape[2])'], {}), '(im, (im.shape[0] * im.shape[1], im.shape[2]))\n', (1009, 1055), True, 'import numpy ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 15:37:07 2020
@author: aoust
"""
import numpy as np
import math
class QuadraticPolynomial():
def __init__(self,n,tuples, coefs):
self.n = n
assert(len(tuples)==len(coefs))
self.tuples = tuples
self.coefs = coefs
... | [
"numpy.array",
"numpy.linalg.norm"
] | [((544, 564), 'numpy.array', 'np.array', (['self.coefs'], {}), '(self.coefs)\n', (552, 564), True, 'import numpy as np\n'), ((1071, 1100), 'numpy.linalg.norm', 'np.linalg.norm', (['self.coefs', '(2)'], {}), '(self.coefs, 2)\n', (1085, 1100), True, 'import numpy as np\n'), ((1174, 1203), 'numpy.linalg.norm', 'np.linalg.... |
from socket import socket
from threading import Thread
def main():
class RefreshScreenThread(Thread):
def __init__(self, client):
super().__init__()
self._client = client
def run(self):
while running:
data = self._client.recv(1024)
... | [
"socket.socket"
] | [((401, 409), 'socket.socket', 'socket', ([], {}), '()\n', (407, 409), False, 'from socket import socket\n')] |
from square_board import SquareBoard
from oracle import BaseOracle
from player import Player, _is_int, _is_non_full_column, _is_within_column_range
def test_valid_column():
board = SquareBoard.fromList([['x', None, None, None, ],
['x', 'o', 'x', 'o', ],
... | [
"square_board.SquareBoard.fromList",
"player._is_int",
"player._is_within_column_range",
"player._is_non_full_column"
] | [((187, 307), 'square_board.SquareBoard.fromList', 'SquareBoard.fromList', (["[['x', None, None, None], ['x', 'o', 'x', 'o'], ['o', 'o', 'x', 'x'], ['o',\n None, None, None]]"], {}), "([['x', None, None, None], ['x', 'o', 'x', 'o'], ['o',\n 'o', 'x', 'x'], ['o', None, None, None]])\n", (207, 307), False, 'from sq... |
# (C) Copyright 2019-2020 by <NAME>
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distribut... | [
"xdis.opcodes.base.nargs_op",
"xdis.opcodes.base.init_opdata",
"xdis.opcodes.base.finalize_opcodes"
] | [((1302, 1336), 'xdis.opcodes.base.init_opdata', 'init_opdata', (['l', 'opcode_15', 'version'], {}), '(l, opcode_15, version)\n', (1313, 1336), False, 'from xdis.opcodes.base import init_opdata, nargs_op, finalize_opcodes, format_CALL_FUNCTION_pos_name_encoded, format_MAKE_FUNCTION_default_argc, format_extended_arg, up... |
#!/usr/bin/env python
# Tested with both Python 2.7.6 and Python 3.4.3
#
# This Python code collects the source code for testing acados
# on microcontrollers, putting all the necessary C files in
# one directory, and header files in the sub-directory include.
#
# The idea is that when compiling the testing code of aca... | [
"os.system",
"os.path.exists",
"glob.glob"
] | [((6590, 6620), 'glob.glob', 'glob.glob', (["(target_dir + '/*.c')"], {}), "(target_dir + '/*.c')\n", (6599, 6620), False, 'import glob\n'), ((6926, 6964), 'glob.glob', 'glob.glob', (["(target_dir + '/include/*.h')"], {}), "(target_dir + '/include/*.h')\n", (6935, 6964), False, 'import glob\n'), ((8086, 8193), 'os.syst... |
from mwa_pb import config
from mwa_pb.beam_full_EE import ApertureArray
from mwa_pb.beam_full_EE import Beam
from pyrem.radiotelescope import ideal_gaussian_beam
import numpy as np
from scipy.constants import c
def mwa_fee_model(theta, phi, nu = 150e6):
h5filepath = config.h5file # recent version was MWA_embedde... | [
"numpy.ones",
"mwa_pb.beam_full_EE.ApertureArray",
"mwa_pb.beam_full_EE.Beam",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.isnan",
"pyrem.radiotelescope.ideal_gaussian_beam"
] | [((356, 385), 'mwa_pb.beam_full_EE.ApertureArray', 'ApertureArray', (['h5filepath', 'nu'], {}), '(h5filepath, nu)\n', (369, 385), False, 'from mwa_pb.beam_full_EE import ApertureArray\n'), ((433, 450), 'numpy.zeros', 'np.zeros', (['[2, 16]'], {}), '([2, 16])\n', (441, 450), True, 'import numpy as np\n'), ((475, 491), '... |
import discord
from discord.ext import commands
from discord.ext.commands.core import group
import json
async def loadJson():
data = json.loads(open("json/serverConfig.json", "r").read())
suggestions = json.loads(open("json/suggestions.json", "r").read())
return data, suggestions
async def wr... | [
"discord.ext.commands.core.group",
"discord.Embed",
"discord.ext.commands.has_permissions",
"json.dump"
] | [((523, 530), 'discord.ext.commands.core.group', 'group', ([], {}), '()\n', (528, 530), False, 'from discord.ext.commands.core import group\n'), ((536, 582), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'manage_channels': '(True)'}), '(manage_channels=True)\n', (560, 582), False, 'from disc... |
import numpy as np
from utils.data.handling import set_value_from_var_column
def create_columns(
data,
prev_meta,
years=["2050", "2100"],
cprices=[130.3, 1441.3],
policy_scenario="diag-c80-gr5",
mute=False,
):
meta = prev_meta.copy()
created_columns = []
## Calculate policy cost... | [
"utils.data.handling.set_value_from_var_column"
] | [((520, 619), 'utils.data.handling.set_value_from_var_column', 'set_value_from_var_column', (['data', 'meta', '"""Policy cost variable"""', 'col_costs', 'year', 'policy_scenario'], {}), "(data, meta, 'Policy cost variable', col_costs,\n year, policy_scenario)\n", (545, 619), False, 'from utils.data.handling import s... |
# -*- test-case-name: txweb2.dav.test.test_static -*-
##
# Copyright (c) 2005-2015 Apple Inc. All rights reserved.
#
# 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, inclu... | [
"txweb2.dav.util.bindMethods",
"txweb2.static.File.__init__",
"txweb2.dav.noneprops.NonePropertyStore",
"twext.python.log.Logger",
"txweb2.http.StatusResponse",
"twisted.internet.defer.deferredGenerator",
"txweb2.dav.resource.DAVResource.__init__",
"twisted.internet.defer.succeed"
] | [((1735, 1743), 'twext.python.log.Logger', 'Logger', ([], {}), '()\n', (1741, 1743), False, 'from twext.python.log import Logger\n'), ((6814, 6853), 'txweb2.dav.util.bindMethods', 'bindMethods', (['txweb2.dav.method', 'DAVFile'], {}), '(txweb2.dav.method, DAVFile)\n', (6825, 6853), False, 'from txweb2.dav.util import b... |
import warnings
import cv2
import imageio
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision
from PIL import Image
import model
import opt
import train
import pdb
def set_deterministic():
import random
import numpy
import torch
torch.manual_seed(0)
random.seed(... | [
"cv2.applyColorMap",
"torch.manual_seed",
"opt.get_opts",
"torch.load",
"imageio.mimwrite",
"random.seed",
"numpy.max",
"train.NeuralDiffSystem",
"numpy.random.seed",
"numpy.min",
"model.load_state_dict",
"torchvision.transforms.ToTensor",
"numpy.nan_to_num"
] | [((283, 303), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (300, 303), False, 'import torch\n'), ((308, 322), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (319, 322), False, 'import random\n'), ((327, 347), 'numpy.random.seed', 'numpy.random.seed', (['(0)'], {}), '(0)\n', (344, 347), False... |
import logging
from collections import Collection
from multipledispatch import dispatch
from dialogue_state import DialogueState
from example_domains.negotiation.negotiation_functions import generate_user_utterance, update_dialogue_history, \
generate_user_selection
from modules.module import Module
class Negot... | [
"logging.getLogger",
"example_domains.negotiation.negotiation_functions.update_dialogue_history",
"example_domains.negotiation.negotiation_functions.generate_user_selection",
"multipledispatch.dispatch",
"example_domains.negotiation.negotiation_functions.generate_user_utterance"
] | [((357, 388), 'logging.getLogger', 'logging.getLogger', (['"""PyOpenDial"""'], {}), "('PyOpenDial')\n", (374, 388), False, 'import logging\n'), ((894, 929), 'multipledispatch.dispatch', 'dispatch', (['DialogueState', 'Collection'], {}), '(DialogueState, Collection)\n', (902, 929), False, 'from multipledispatch import d... |
import yaml
import xlsxwriter
import random
from datetime import datetime
if __name__ == '__main__':
with open('./etc/ordabok.yaml', 'rt', encoding='utf') as f:
ordabok = yaml.safe_load(f.read())
allnafnord = ordabok['karlkyns'] + \
ordabok['kvenkyns'] + ordabok['hvorugkyns']
shuffled_ord... | [
"datetime.datetime.now",
"random.shuffle",
"xlsxwriter.Workbook"
] | [((349, 381), 'random.shuffle', 'random.shuffle', (['shuffled_ordabok'], {}), '(shuffled_ordabok)\n', (363, 381), False, 'import random\n'), ((527, 556), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['xslxfile'], {}), '(xslxfile)\n', (546, 556), False, 'import xlsxwriter\n'), ((393, 407), 'datetime.datetime.now', 'da... |
#!/usr/bin/python
# <NAME> 2010
"""
Support for converting linked targets to ihex, srec or binary files using
objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx'
feature. The 'objcopy' feature uses the following attributes:
objcopy_bfdname Target object format name (eg. ihex, srec, binary).
... | [
"waflib.Utils.def_attrs",
"waflib.TaskGen.after_method",
"waflib.TaskGen.feature"
] | [((845, 863), 'waflib.TaskGen.feature', 'feature', (['"""objcopy"""'], {}), "('objcopy')\n", (852, 863), False, 'from waflib.TaskGen import feature, after_method\n'), ((865, 891), 'waflib.TaskGen.after_method', 'after_method', (['"""apply_link"""'], {}), "('apply_link')\n", (877, 891), False, 'from waflib.TaskGen impor... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (3,0,0):
new_instancemethod = lambda func, inst, cls: _STEPCon... | [
"_STEPConstruct.STEPConstruct_Part_SetPDdescription",
"_STEPConstruct.STEPConstruct_UnitContext_VolumeFactor",
"_STEPConstruct.STEPConstruct_Part_PDS",
"_STEPConstruct.SWIG_PyInstanceMethod_New",
"_STEPConstruct.new_STEPConstruct_Styles",
"new.instancemethod",
"_STEPConstruct.STEPConstruct_ContextTool_S... | [((3034, 3111), 'new.instancemethod', 'new_instancemethod', (['_STEPConstruct.SwigPyIterator_value', 'None', 'SwigPyIterator'], {}), '(_STEPConstruct.SwigPyIterator_value, None, SwigPyIterator)\n', (3052, 3111), True, 'from new import instancemethod as new_instancemethod\n'), ((3132, 3208), 'new.instancemethod', 'new_i... |
from __future__ import absolute_import
from outset import celery_app
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
@celery_app.task
def accelerator_soft_delete_cascade(pk):
logger.info('Starting accelerator_soft_delete_cascade({})...'.format(pk))
from safedelete.config im... | [
"outset.accelerators.models.Cohort.objects.all_with_deleted",
"celery.utils.log.get_task_logger",
"outset.accelerators.models.Accelerator.objects.all_with_deleted"
] | [((126, 151), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (141, 151), False, 'from celery.utils.log import get_task_logger\n'), ((419, 457), 'outset.accelerators.models.Accelerator.objects.all_with_deleted', 'Accelerator.objects.all_with_deleted', ([], {}), '()\n', (455, 4... |
"""Resource for EC2 Network Interfaces."""
from typing import Type
from botocore.client import BaseClient
from altimeter.aws.resource.resource_spec import ListFromAWSResult
from altimeter.aws.resource.ec2 import EC2ResourceSpec
from altimeter.aws.resource.ec2.vpc import VPCResourceSpec
from altimeter.core.graph.field... | [
"altimeter.aws.resource.resource_spec.ListFromAWSResult",
"altimeter.core.graph.field.resource_link_field.ResourceLinkField",
"altimeter.core.graph.field.scalar_field.ScalarField"
] | [((916, 942), 'altimeter.core.graph.field.scalar_field.ScalarField', 'ScalarField', (['"""Description"""'], {}), "('Description')\n", (927, 942), False, 'from altimeter.core.graph.field.scalar_field import ScalarField\n'), ((952, 980), 'altimeter.core.graph.field.scalar_field.ScalarField', 'ScalarField', (['"""Interfac... |
import turtle
t = turtle.Turtle()
turtle.title("I Love You")
screen = turtle.Screen()
screen.bgcolor("white")
t.color("red")
t.begin_fill()
t.fillcolor("black")
t.left(140)
t.forward(180)
t.circle(-90, 200)
t.setheading(60) # t.left
t.circle(-90, 200)
t.forward(180)
t.end_fill()
t.hideturtle()
| [
"turtle.Screen",
"turtle.title",
"turtle.Turtle"
] | [((19, 34), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (32, 34), False, 'import turtle\n'), ((35, 61), 'turtle.title', 'turtle.title', (['"""I Love You"""'], {}), "('I Love You')\n", (47, 61), False, 'import turtle\n'), ((71, 86), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (84, 86), False, 'import tur... |
from django.db import models
class Challenge(models.Model):
name = models.CharField(max_length=60)
city = models.CharField(max_length=60, default='Unknown')
organizer = models.CharField(max_length=60, default='Anonymous')
duration = models.PositiveIntegerField(default=30)
reward = models.PositiveIn... | [
"django.db.models.PositiveIntegerField",
"django.db.models.ManyToManyField",
"django.db.models.CharField"
] | [((72, 103), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(60)'}), '(max_length=60)\n', (88, 103), False, 'from django.db import models\n'), ((115, 165), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(60)', 'default': '"""Unknown"""'}), "(max_length=60, default='Unknow... |
"""Initial models
Revision ID: b41a0816fcda
Revises:
Create Date: 2020-04-14 07:29:41.924866
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated ... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Unicode",
"sqlalchemy.Integer",
"sqlalchemy.UnicodeText"
] | [((2564, 2603), 'alembic.op.drop_table', 'op.drop_table', (['"""effect_to_effect_group"""'], {}), "('effect_to_effect_group')\n", (2577, 2603), False, 'from alembic import op\n'), ((2608, 2653), 'alembic.op.drop_table', 'op.drop_table', (['"""effect_group_to_effect_stack"""'], {}), "('effect_group_to_effect_stack')\n",... |
# Commandes.py
import Variables
from tkinter import*
from Outils import*
from Fenetre import*
import Quoridor
"""
## Fonction appelée par la flèche de droite
@event--
"""
def cliqueDroite(event):
# Cas de sélection d'un pion
if (Variables.selectionType == 1):
# Ne pas sortir du plateau
if(V... | [
"Variables.fenetre.bind",
"Quoridor.jeu"
] | [((5463, 5510), 'Variables.fenetre.bind', 'Variables.fenetre.bind', (['"""<Right>"""', 'cliqueDroite'], {}), "('<Right>', cliqueDroite)\n", (5485, 5510), False, 'import Variables\n'), ((5514, 5560), 'Variables.fenetre.bind', 'Variables.fenetre.bind', (['"""<Left>"""', 'cliqueGauche'], {}), "('<Left>', cliqueGauche)\n",... |
import codecs
import json
import os
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()
with open("info.json", "r") as file:
info_json = json.loads(file.read(... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((105, 130), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (120, 130), False, 'import os\n'), ((150, 181), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (162, 181), False, 'import os\n'), ((701, 716), 'setuptools.find_packages', 'find_packages',... |
import sys
from pyspark import SparkContext
sc = SparkContext.getOrCreate()
file = sc.textFile(sys.argv[1], 1)
lines = file.map(lambda line: line.split(','))
fa = lines.map(lambda x: float(x[15])).filter(lambda x: x < 0).count()
output = sc.parallelize([fa])
output.saveAsTextFile("task3a.out")
sc.stop()
'''
module ... | [
"pyspark.SparkContext.getOrCreate"
] | [((50, 76), 'pyspark.SparkContext.getOrCreate', 'SparkContext.getOrCreate', ([], {}), '()\n', (74, 76), False, 'from pyspark import SparkContext\n')] |
import tensorflow as tf
import os
import zipfile
from os import path, getcwd, chdir
import os
train_happy_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/happy/') # the zip file had the folders called horses and humans
train_sad_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/sad/')
... | [
"keras.preprocessing.image.img_to_array",
"os.listdir",
"tensorflow.keras.optimizers.RMSprop",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"os.path.join",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.Dense",
"numpy.vstack",
"nump... | [((114, 180), 'os.path.join', 'os.path.join', (['"""/Users/seanjudelyons/Downloads/happy-or-sad/happy/"""'], {}), "('/Users/seanjudelyons/Downloads/happy-or-sad/happy/')\n", (126, 180), False, 'import os\n'), ((255, 319), 'os.path.join', 'os.path.join', (['"""/Users/seanjudelyons/Downloads/happy-or-sad/sad/"""'], {}), ... |
import numpy as np
import time
import math
# from cassie_env import CassieEnv
from cassiemujoco import *
from trajectory.trajectory import CassieTrajectory
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
from mpl_too... | [
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.load"
] | [((437, 455), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (444, 455), True, 'import numpy as np\n'), ((1148, 1160), 'matplotlib.pyplot.plot', 'plt.plot', (['[]'], {}), '([])\n', (1156, 1160), True, 'import matplotlib.pyplot as plt\n'), ((1165, 1176), 'matplotlib.pyplot.close', 'plt.close', ([], {}), ... |
from deepspeech import Model
import gradio as gr
import numpy as np
model_file_path = "deepspeech-0.8.2-models.pbmm"
lm_file_path = "deepspeech-0.8.2-models.scorer"
beam_width = 100
lm_alpha = 0.93
lm_beta = 1.18
model = Model(model_file_path)
model.enableExternalScorer(lm_file_path)
model.setScorerAlphaBeta(lm_alpha... | [
"gradio.Interface",
"deepspeech.Model",
"numpy.max"
] | [((223, 245), 'deepspeech.Model', 'Model', (['model_file_path'], {}), '(model_file_path)\n', (228, 245), False, 'from deepspeech import Model\n'), ((987, 1066), 'gradio.Interface', 'gr.Interface', (['transcribe', "['microphone', 'state']", "['text', 'state']"], {'live': '(True)'}), "(transcribe, ['microphone', 'state']... |
"""Brings up a set of Global Registry nodes along with databases.
They can create separate clusters.
"""
import copy
import json
import common
import docker
def _tweak_config(config, name, uid):
cfg = copy.deepcopy(config)
cfg['nodes'] = {'node': cfg['nodes'][name]}
sys_config = cfg['nodes']['node']['s... | [
"common.parse_json_file",
"json.dumps",
"common.merge",
"docker.run",
"copy.deepcopy",
"common.format_nodename",
"common.set_up_dns",
"common.format_dockername"
] | [((209, 230), 'copy.deepcopy', 'copy.deepcopy', (['config'], {}), '(config)\n', (222, 230), False, 'import copy\n'), ((525, 569), 'common.format_nodename', 'common.format_nodename', (["vm_args['name']", 'uid'], {}), "(vm_args['name'], uid)\n", (547, 569), False, 'import common\n'), ((908, 946), 'common.format_dockernam... |
import xml.etree.ElementTree as ET
from programy.parser.template.nodes.base import TemplateNode
from programy.parser.template.nodes.rest import TemplateRestNode
from programy.parser.template.nodes.word import TemplateWordNode
from programytest.parser.base import ParserTestsBaseClass
class MockTemplateRestNode(Templ... | [
"programy.parser.template.nodes.rest.TemplateRestNode.__init__",
"xml.etree.ElementTree.tostring",
"programy.parser.template.nodes.word.TemplateWordNode",
"programy.parser.template.nodes.base.TemplateNode",
"programy.parser.template.nodes.rest.TemplateRestNode"
] | [((366, 397), 'programy.parser.template.nodes.rest.TemplateRestNode.__init__', 'TemplateRestNode.__init__', (['self'], {}), '(self)\n', (391, 397), False, 'from programy.parser.template.nodes.rest import TemplateRestNode\n'), ((578, 592), 'programy.parser.template.nodes.base.TemplateNode', 'TemplateNode', ([], {}), '()... |