code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
from mock import Mock
from botocore.exceptions import NoCredentialsError
from formica import cli
from tests.unit.constants import STACK, STACK_ID, PROFILE, REGION, CHANGESETNAME, EVENT_ID
@pytest.fixture
def logger(mocker):
return mocker.patch('formica.cli.logger')
def test_catches_common_aws_ex... | [
"botocore.exceptions.NoCredentialsError",
"pytest.raises",
"formica.cli.main"
] | [((379, 399), 'botocore.exceptions.NoCredentialsError', 'NoCredentialsError', ([], {}), '()\n', (397, 399), False, 'from botocore.exceptions import NoCredentialsError\n'), ((1189, 1274), 'formica.cli.main', 'cli.main', (["['deploy', '--stack', STACK, '--profile', PROFILE, '--region', REGION]"], {}), "(['deploy', '--sta... |
import time
from utils import xbridge_utils
from interface import xbridge_client
"""
- WE WANT TO TEST SCENARIOS IN WHICH USERS POLL CONSTANTLY THE DX TO GET INFORMATION.
- SO WE FOCUS ON GET_TX_LIST + GET_TRANSACTION_HISTORY + CHECK_GET_CURRENCY_LIST
- THIS TEST WILL HAVE TO BE COMPLETED WITH T... | [
"interface.xbridge_client.CHECK_GET_TX_HISTORY_LIST",
"interface.xbridge_client.CHECK_GET_CURRENCY_LIST",
"utils.xbridge_utils.export_data",
"interface.xbridge_client.CHECK_GET_TX_LIST",
"time.time"
] | [((1296, 1383), 'utils.xbridge_utils.export_data', 'xbridge_utils.export_data', (['"""defined_seq_get_info_api_calls.xlsx"""', 'time_distribution'], {}), "('defined_seq_get_info_api_calls.xlsx',\n time_distribution)\n", (1321, 1383), False, 'from utils import xbridge_utils\n'), ((1874, 1948), 'utils.xbridge_utils.ex... |
import asyncio
import logging
import typing
import urllib.parse
import sprockets.mixins.http
import tornado.web
import yarl
from imbi import errors, models, version
def generate_key(project: models.Project) -> str:
"""Generate a SonarQube project key for `project`."""
return ':'.join([project.namespace.slug... | [
"imbi.errors.InternalServerError",
"yarl.URL",
"logging.getLogger"
] | [((599, 630), 'yarl.URL', 'yarl.URL', (["sonar_settings['url']"], {}), "(sonar_settings['url'])\n", (607, 630), False, 'import yarl\n'), ((1436, 1466), 'yarl.URL', 'yarl.URL', (["self.settings['url']"], {}), "(self.settings['url'])\n", (1444, 1466), False, 'import yarl\n'), ((2330, 2343), 'yarl.URL', 'yarl.URL', (['url... |
"""Brainfuck language: conversions between brainfuck and MWOT bits.
Instructions are mapped to bits in the following order:
> 000
< 001
+ 010
- 011
. 100
, 101
[ 110
] 111
"""
import itertools
from ..exceptions import CompilerError
from ..util import chunks, joinable
c... | [
"itertools.product"
] | [((356, 391), 'itertools.product', 'itertools.product', (['(0, 1)'], {'repeat': '(3)'}), '((0, 1), repeat=3)\n', (373, 391), False, 'import itertools\n')] |
from __future__ import annotations
from abc import ABC, abstractmethod
import time
from datetime import datetime
import statistics
class Subject(ABC):
@abstractmethod
def attach(self, observer: Observer):
pass
@abstractmethod
def detach(self, observer: Observer):
pass
@abstractme... | [
"statistics.median",
"datetime.datetime.now",
"time.sleep"
] | [((774, 787), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (784, 787), False, 'import time\n'), ((1795, 1827), 'statistics.median', 'statistics.median', (['subject.array'], {}), '(subject.array)\n', (1812, 1827), False, 'import statistics\n'), ((1411, 1425), 'datetime.datetime.now', 'datetime.now', ([], {}), '()... |
# -*- coding: UTF-8 -*-
"""
This file is part of Pondus, a personal weight manager.
Copyright (C) 2007-10 <NAME> <<EMAIL>>
This program is free software licensed under the MIT license. For details
see LICENSE or http://www.opensource.org/licenses/mit-license.php
"""
import gi
gi.require_version('Gtk', '3.0')
from ... | [
"gi.repository.Gtk.MessageDialog",
"gi.require_version"
] | [((281, 313), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (299, 313), False, 'import gi\n'), ((609, 685), 'gi.repository.Gtk.MessageDialog', 'Gtk.MessageDialog', ([], {'type': 'Gtk.MessageType.ERROR', 'buttons': 'Gtk.ButtonsType.CLOSE'}), '(type=Gtk.MessageType.ERRO... |
import torch
import torch.nn as nn
import numpy as np
from sklearn.linear_model import LogisticRegression as Logit
from scipy.optimize import brentq
from models.layers import StochasticLinear as SLinear
from models.layers import NotStochasticLinear as Linear
from models.layers import BoundedStochasticModel
class SMin... | [
"scipy.optimize.brentq",
"models.layers.StochasticLinear",
"torch.nn.Linear",
"numpy.linalg.norm",
"models.layers.NotStochasticLinear"
] | [((512, 554), 'models.layers.StochasticLinear', 'SLinear', (['input_dim', 'output_dim'], {'bias': '(False)'}), '(input_dim, output_dim, bias=False)\n', (519, 554), True, 'from models.layers import StochasticLinear as SLinear\n'), ((855, 896), 'models.layers.NotStochasticLinear', 'Linear', (['input_dim', 'output_dim'], ... |
"""
Dice notation grammar
PyParsing is patched to make it easier to work with, by removing features
that get in the way of development and debugging. See the dice.utilities
module for more information.
"""
from __future__ import absolute_import, print_function, unicode_literals
from pyparsing import (CaselessLiteral... | [
"dice.utilities.patch_pyparsing",
"pyparsing.Suppress",
"pyparsing.Forward",
"dice.elements.RandomElement.DICE_MAP.keys",
"pyparsing.Word",
"pyparsing.StringStart",
"dice.utilities.wrap_string",
"pyparsing.OneOrMore",
"pyparsing.StringEnd"
] | [((846, 863), 'dice.utilities.patch_pyparsing', 'patch_pyparsing', ([], {}), '()\n', (861, 863), False, 'from dice.utilities import patch_pyparsing, wrap_string\n'), ((3195, 3205), 'pyparsing.Word', 'Word', (['nums'], {}), '(nums)\n', (3199, 3205), False, 'from pyparsing import CaselessLiteral, Forward, Literal, OneOrM... |
import numpy as np
class surface:
def __init__(self, vertices=[[0.,0.,0.], [1.,0.,0.], [0.,1.,0.]], reflectivity=1.):
if (type(vertices) != list):
raise ValueError("vertices must be of type list")
if (len(vertices) != 3):
raise ValueError("Surface must have ... | [
"numpy.roll",
"numpy.cross",
"numpy.argmax",
"numpy.invert",
"numpy.sum",
"numpy.array",
"numpy.dot"
] | [((550, 568), 'numpy.array', 'np.array', (['vertices'], {}), '(vertices)\n', (558, 568), True, 'import numpy as np\n'), ((650, 737), 'numpy.cross', 'np.cross', (['(self.vertices[1] - self.vertices[0])', '(self.vertices[2] - self.vertices[0])'], {}), '(self.vertices[1] - self.vertices[0], self.vertices[2] - self.\n v... |
# -*- coding: utf-8 -*-
# @Brief: 实现模型分类的网络,MAML与网络结构无关,重点在训练过程
from tensorflow.keras import layers, models, losses
import tensorflow as tf
import numpy as np
class MAML:
def __init__(self, input_shape, num_classes):
"""
MAML模型类,需要两个模型,一个是作为真实更新的权重θ,另一个是用来做θ'的更新
:param input_shape: 模型输入sh... | [
"tensorflow.keras.layers.Conv2D",
"numpy.argmax",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.GradientTape",
"numpy.array",
"tensorflow.keras.losses.sparse_categorical_crossentropy",
"tensorflow.keras.layers.Dense",
"tensorflow.reduce_mean",
"tensorflow.keras.layers.Flatten",
"tensor... | [((774, 883), 'tensorflow.keras.layers.Conv2D', 'layers.Conv2D', ([], {'filters': '(64)', 'kernel_size': '(3)', 'padding': '"""same"""', 'activation': '"""relu"""', 'input_shape': 'self.input_shape'}), "(filters=64, kernel_size=3, padding='same', activation='relu',\n input_shape=self.input_shape)\n", (787, 883), Fal... |
from django.conf import settings
from django.core.mail import EmailMessage
try:
from django.urls import reverse
except:
from django.core.urlresolver import reverse
def send(to,subject,body):
from_email_address = settings.EMAIL_HOST_USER
if '@' not in from_email_address:
from_email_address = set... | [
"django.core.mail.EmailMessage"
] | [((422, 459), 'django.core.mail.EmailMessage', 'EmailMessage', (['subject', 'body', 'From', 'to'], {}), '(subject, body, From, to)\n', (434, 459), False, 'from django.core.mail import EmailMessage\n')] |
import socket
import time
PORT = 5050
SERVER = "localhost"
ADDR = (SERVER, PORT)
FORMAT = "utf-8"
DISCONNECT_MESSAGE = "!DISCONNECT"
def connect():
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
return client
def send(client, msg):
message = msg.enc... | [
"time.sleep",
"socket.socket"
] | [((175, 224), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (188, 224), False, 'import socket\n'), ((706, 719), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (716, 719), False, 'import time\n')] |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | [
"StringIO.StringIO",
"os.path.dirname",
"cloudinary.utils.cloudinary_url",
"webapp2.WSGIApplication",
"cloudinary.uploader.upload",
"google.appengine.ext.webapp.template.render"
] | [((2067, 2124), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/', MainHandler)]"], {'debug': '(True)'}), "([('/', MainHandler)], debug=True)\n", (2090, 2124), False, 'import webapp2\n'), ((865, 890), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (880, 890), False, 'import os\n'... |
"""
__/\\\\\\\\\\\\______________________/\\\\\\\\\\\____/\\\________/\\\_
_\/\\\////////\\\__________________/\\\/////////\\\_\/\\\_______\/\\\_
_\/\\\______\//\\\________________\//\\\______\///__\/\\\_______\/\\\_
_\/\\\_______\/\\\_____/\\\\\______\////\\\_________\/\\\_______\/\\\_
_\/\\\_______\/\\\___/... | [
"random.choice",
"dosu.helpers.str_random",
"dosu.__main__.process_args",
"dosu.__main__.get_args",
"unittest.main"
] | [((1383, 1398), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1396, 1398), False, 'import unittest\n'), ((1006, 1040), 'dosu.__main__.get_args', '__main__.get_args', (["['-w', subject]"], {}), "(['-w', subject])\n", (1023, 1040), False, 'from dosu import __main__\n'), ((1049, 1076), 'dosu.__main__.process_args',... |
# -*- coding: utf-8 -*-
"""This module returns index for transportation"""
import re
from libs import write_logs, get_url_response
from config import FUEL_LITTERS_PER_MONTH, TRAIN_TICKETS_PER_MONTH, URL_TO_PARSE_FUEL, MCD_PRICE
def get_fuel_price(response: object, fuel_type: str = 'ai95') -> float:
"""
This ... | [
"libs.write_logs",
"libs.get_url_response",
"re.compile"
] | [((528, 559), 're.compile', 're.compile', (['"""var toolbarFuel ="""'], {}), "('var toolbarFuel =')\n", (538, 559), False, 'import re\n'), ((928, 999), 'libs.write_logs', 'write_logs', (['"""Fuel price index has been calculated successfully"""', '"""INFO"""'], {}), "('Fuel price index has been calculated successfully',... |
# Generated by Django 3.0.4 on 2020-04-23 00:55
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsorApp', '0020_auto_20200421_2139'),
]
operations = [
migrations.AlterField(
model_name='loggeduser',
... | [
"datetime.datetime",
"django.db.models.IntegerField"
] | [((583, 655), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)', 'verbose_name': '"""Purpose Index"""'}), "(blank=True, null=True, verbose_name='Purpose Index')\n", (602, 655), False, 'from django.db import migrations, models\n'), ((398, 448), 'datetime.datetime', 'dateti... |
from database.mariadb import Database
from broker.fxcm.session import FXCMBroker
from threading import Thread
from queue import Queue, Empty
from subprocess_reader import SubprocessReader
import sys
import time
class SubprocessWorker(object):
def __init__(self, offer):
self._s = input
self._q = Qu... | [
"broker.fxcm.session.FXCMBroker",
"queue.Queue",
"time.sleep",
"subprocess_reader.SubprocessReader",
"sys.stdout.flush",
"sys.stdout.write"
] | [((318, 325), 'queue.Queue', 'Queue', ([], {}), '()\n', (323, 325), False, 'from queue import Queue, Empty\n'), ((572, 688), 'subprocess_reader.SubprocessReader', 'SubprocessReader', ([], {'identifer': 'self._o', 'stream': 'self._s', 'events_queue': 'self._q', 'expected': '(5)', 'log': '(False)', 'option': '"""input"""... |
"""
Double entry accounting system:
A debit is an accounting entry that either increases an asset or expense account,
or decreases a liability or equity account. It is positioned to the left in an accounting entry.
Debit means "left", dividends/expenses/assets/losses increased with debit.
A credit is an accounting en... | [
"jutil.format.choices_label",
"django.utils.translation.gettext_lazy",
"jacc.helpers.sum_queryset",
"django.utils.timezone.now",
"django.db.models.Q",
"datetime.timedelta",
"decimal.Decimal"
] | [((8457, 8469), 'django.utils.translation.gettext_lazy', '_', (['"""balance"""'], {}), "('balance')\n", (8458, 8469), True, 'from django.utils.translation import gettext_lazy as _\n'), ((9338, 9352), 'django.utils.translation.gettext_lazy', '_', (['"""liability"""'], {}), "('liability')\n", (9339, 9352), True, 'from dj... |
import pdb
from datetime import datetime
import pandas as pd
from shapely.geometry import LineString, Point
from shapely import wkb
import psycopg2
from psycopg2.extras import execute_values
#from postgis.psycopg import register
#from postgis import Point
class PostgresInterface(object):
def __init__(self, dbname... | [
"psycopg2.connect",
"datetime.datetime.fromtimestamp",
"shapely.geometry.Point",
"pdb.set_trace",
"pandas.DataFrame",
"psycopg2.extras.execute_values"
] | [((655, 681), 'psycopg2.connect', 'psycopg2.connect', (['conn_str'], {}), '(conn_str)\n', (671, 681), False, 'import psycopg2\n'), ((1410, 1436), 'psycopg2.connect', 'psycopg2.connect', (['conn_str'], {}), '(conn_str)\n', (1426, 1436), False, 'import psycopg2\n'), ((1846, 1920), 'pandas.DataFrame', 'pd.DataFrame', (["{... |
from sklearn.feature_extraction.text import CountVectorizer
import seaborn as sns
import matplotlib.pyplot as plt
def create(corpus, n=1, length=10):
corpus.clean()
text = [corpus.clean_text]
vec = CountVectorizer(stop_words='english',
ngram_range=(n,n)).fit(text)
words = ... | [
"sklearn.feature_extraction.text.CountVectorizer",
"seaborn.barplot"
] | [((951, 995), 'seaborn.barplot', 'sns.barplot', ([], {'x': 'count', 'y': 'words', 'palette': 'color'}), '(x=count, y=words, palette=color)\n', (962, 995), True, 'import seaborn as sns\n'), ((213, 270), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', ([], {'stop_words': '"""english"""', 'ngram_rang... |
# Generated by Django 3.2.5 on 2021-10-03 15:55
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Food', '0007_auto_20211003_1829'),
... | [
"django.db.migrations.swappable_dependency",
"django.db.models.BigAutoField",
"django.db.models.ForeignKey"
] | [((322, 379), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (353, 379), False, 'from django.db import migrations, models\n'), ((511, 607), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '... |
# Generated by Django 2.2.13 on 2020-06-19 14:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("goods", "0010_auto_20200420_1430"),
]
operations = [
migrations.AddField(
model_name="good",
name="component_detail... | [
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.db.models.CharField"
] | [((342, 412), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': 'None', 'max_length': '(2000)', 'null': '(True)'}), '(blank=True, default=None, max_length=2000, null=True)\n', (358, 412), False, 'from django.db import migrations, models\n'), ((552, 622), 'django.db.models.TextField',... |
import os
import numpy as np
import json
import random
from PIL import Image
from PIL import ImageDraw
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
class DatasetBase(Dataset):
"""Base dataset for VITON-GAN.
"""
def __init__(self, opt, mode, data_... | [
"PIL.Image.open",
"PIL.Image.new",
"os.path.join",
"torch.from_numpy",
"numpy.array",
"PIL.ImageDraw.Draw",
"torch.flip",
"torchvision.transforms.Normalize",
"json.load",
"random.random",
"torchvision.transforms.ToTensor",
"torch.zeros",
"torch.cat"
] | [((6153, 6168), 'random.random', 'random.random', ([], {}), '()\n', (6166, 6168), False, 'import random\n'), ((408, 441), 'os.path.join', 'os.path.join', (['opt.data_root', 'mode'], {}), '(opt.data_root, mode)\n', (420, 441), False, 'import os\n'), ((3027, 3084), 'torch.zeros', 'torch.zeros', (['point_num', 'self.fine_... |
"""
This is for Kaggle's Northeastern SMILE Lab - Recognizing Faces in the Wild playground competition:
https://www.kaggle.com/c/recognizing-faces-in-the-wild
The general model will be to create feature vectors of each face, then
compare their Euclidean distance to get a value.
I will use a second NN to make the fina... | [
"tensorflow.keras.backend.epsilon",
"pandas.read_csv",
"tensorflow.python.keras.preprocessing.image.load_img",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"os.walk",
"os.path.exists",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"numpy.stack",
"pandas.DataFrame",
"t... | [((1253, 1325), 'os.path.join', 'os.path.join', (['"""E:\\\\"""', '"""datasets"""', '"""kaggle-recognizing-faces-in-the-wild"""'], {}), "('E:\\\\', 'datasets', 'kaggle-recognizing-faces-in-the-wild')\n", (1265, 1325), False, 'import os\n'), ((1339, 1372), 'os.path.join', 'os.path.join', (['dataset_dir', '"""test"""'], ... |
import mmcv
import numpy as np
import pytest
from os import path as osp
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet3d.datasets.pipelines import (LoadAnnotations3D, LoadPointsFromFile,
LoadPointsFromMultiSweeps)
def test_load_points_from_indoor_file():
sun... | [
"mmdet3d.datasets.pipelines.LoadPointsFromMultiSweeps",
"os.path.join",
"numpy.equal",
"numpy.array",
"numpy.zeros",
"pytest.raises",
"mmdet3d.core.bbox.DepthInstance3DBoxes",
"mmcv.load",
"mmdet3d.datasets.pipelines.LoadAnnotations3D",
"mmdet3d.datasets.pipelines.LoadPointsFromFile"
] | [((332, 383), 'mmcv.load', 'mmcv.load', (['"""./tests/data/sunrgbd/sunrgbd_infos.pkl"""'], {}), "('./tests/data/sunrgbd/sunrgbd_infos.pkl')\n", (341, 383), False, 'import mmcv\n'), ((420, 460), 'mmdet3d.datasets.pipelines.LoadPointsFromFile', 'LoadPointsFromFile', (['(6)'], {'shift_height': '(True)'}), '(6, shift_heigh... |
"""keyword_spotting
**********************
Keyword spotting for 10 words
- Source code: `keyword_spotting.py <https://github.com/siliconlabs/mltk/blob/master/mltk/models/tinyml/keyword_spotting.py>`_
- Pre-trained model: `keyword_spotting.mltk.zip <https://github.com/siliconlabs/mltk/blob/master/mltk/models/tinyml/ke... | [
"mltk.models.shared.DepthwiseSeparableConv2D_ARM",
"mltk.core.preprocess.image.parallel_generator.ParallelImageDataGenerator",
"mltk.utils.archive_downloader.download_verify_extract"
] | [((15739, 15936), 'mltk.core.preprocess.image.parallel_generator.ParallelImageDataGenerator', 'ParallelImageDataGenerator', ([], {'cores': '(0.35)', 'max_batches_pending': '(32)', 'rotation_range': '(0)', 'width_shift_range': '(0.05)', 'height_shift_range': '(0.05)', 'zoom_range': '(0.95, 1.05)', 'validation_split': 'v... |
import numpy as np
from collections import deque
import random
class Buffer:
def __init__(self, max_size=1000, seed=None):
self.buffer = deque(maxlen=max_size)
self.max_size = max_size
random.seed(seed)
@property
def size(self):
return len(self.buffer)
def sam... | [
"random.sample",
"collections.deque",
"random.seed",
"numpy.array",
"numpy.float32",
"numpy.random.RandomState"
] | [((151, 173), 'collections.deque', 'deque', ([], {'maxlen': 'max_size'}), '(maxlen=max_size)\n', (156, 173), False, 'from collections import deque\n'), ((215, 232), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (226, 232), False, 'import random\n'), ((383, 413), 'random.sample', 'random.sample', (['self.buf... |
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
class TestPermissions(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.run_sql_file("test/integration/010_permission_tests/seed.sql")
def tearDown(self):
self.run_sql_fi... | [
"test.integration.base.DBTIntegrationTest.setUp",
"test.integration.base.DBTIntegrationTest.tearDown",
"nose.plugins.attrib.attr"
] | [((600, 621), 'nose.plugins.attrib.attr', 'attr', ([], {'type': '"""postgres"""'}), "(type='postgres')\n", (604, 621), False, 'from nose.plugins.attrib import attr\n'), ((164, 194), 'test.integration.base.DBTIntegrationTest.setUp', 'DBTIntegrationTest.setUp', (['self'], {}), '(self)\n', (188, 194), False, 'from test.in... |
# -*- coding: utf-8 -*-
"""
:mod:`pymorphy2.opencorpora_dict.parse` is a
module for OpenCorpora XML dictionaries parsing.
"""
from __future__ import absolute_import, unicode_literals, division
import logging
import collections
try:
from lxml.etree import iterparse
def xml_clear_elem(elem):
elem.clear... | [
"logging.getLogger",
"collections.namedtuple"
] | [((627, 654), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (644, 654), False, 'import logging\n'), ((675, 765), 'collections.namedtuple', 'collections.namedtuple', (['"""ParsedDictionary"""', '"""lexemes links grammemes version revision"""'], {}), "('ParsedDictionary',\n 'lexemes lin... |
import os
from telegram.ext import Updater
updater = Updater(token=os.environ.get('TG_TOKEN') or "")
dispatcher = updater.dispatcher
| [
"os.environ.get"
] | [((71, 97), 'os.environ.get', 'os.environ.get', (['"""TG_TOKEN"""'], {}), "('TG_TOKEN')\n", (85, 97), False, 'import os\n')] |
from __future__ import print_function
from os import system
from time import sleep
# system = print
# sleep = print
'''
3 MT, 2 MW, 3 MC
'''
num_reps = 3
num_thread = 64
shard_modes = [True, False]
multi_gets = [1, 3, 6, 9]
def start_vms():
print("starting VMs")
for i in range(1, 9):
print("Starting ... | [
"os.system",
"time.sleep"
] | [((3567, 3576), 'time.sleep', 'sleep', (['(20)'], {}), '(20)\n', (3572, 3576), False, 'from time import sleep\n'), ((6006, 6016), 'time.sleep', 'sleep', (['(120)'], {}), '(120)\n', (6011, 6016), False, 'from time import sleep\n'), ((2637, 2652), 'os.system', 'system', (['command'], {}), '(command)\n', (2643, 2652), Fal... |
import cv2
import numpy as np
from PIL import Image
import random
import datetime
import os
from shutil import copyfile
MATE_PROBABILTY = 0.35
MUTATION_PROBABILITY = 0.45
HARD_MUTATION_PROBABILITY = 0.6
ADD_GEN = 5
POPULATION = 10
CIRCLES = 1
FILENAME = "monalisa"
ref = Image.open("../img/" + FILENAME + ".jpg")
r... | [
"random.sample",
"PIL.Image.open",
"random.uniform",
"PIL.Image.fromarray",
"os.makedirs",
"numpy.array",
"numpy.zeros",
"cv2.addWeighted",
"shutil.copyfile",
"cv2.circle",
"datetime.datetime.now",
"random.randint"
] | [((277, 318), 'PIL.Image.open', 'Image.open', (["('../img/' + FILENAME + '.jpg')"], {}), "('../img/' + FILENAME + '.jpg')\n", (287, 318), False, 'from PIL import Image\n'), ((325, 338), 'numpy.array', 'np.array', (['ref'], {}), '(ref)\n', (333, 338), True, 'import numpy as np\n'), ((348, 381), 'numpy.zeros', 'np.zeros'... |
import torch
from tqdm import tqdm
def eval(model, data_loader, criterion):
"""
Function for evaluation step
Args:
model ([]): tranformer model
data_loader (BucketIterator): data_loader to evaluate
criterion (Loss Object): criterion to calculate the loss
"""
losses = ... | [
"torch.no_grad",
"tqdm.tqdm",
"torch.tensor",
"torch.exp"
] | [((1201, 1245), 'tqdm.tqdm', 'tqdm', ([], {'total': 'epochs', 'desc': '"""Epoch"""', 'position': '(0)'}), "(total=epochs, desc='Epoch', position=0)\n", (1205, 1245), False, 'from tqdm import tqdm\n'), ((332, 347), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (345, 347), False, 'import torch\n'), ((2212, 2236), '... |
# -*- coding = utf-8 -*-
# @Time : 2022/2/3 10:17
# @Author : 戎昱
# @File : makeImageSets.py
# @Software : PyCharm
# @Contact : <EMAIL>
# @github : https://github.com/SekiroRong
import os
import random
import numpy as np
from config import kitti_root
# kitti_root = r'G:\carla'
video_path = kitti_root + r'\... | [
"numpy.random.choice",
"os.listdir",
"os.path.join"
] | [((346, 381), 'os.path.join', 'os.path.join', (['video_path', '"""image_2"""'], {}), "(video_path, 'image_2')\n", (358, 381), False, 'import os\n'), ((962, 1025), 'numpy.random.choice', 'np.random.choice', (['images_filenames', 'train_length'], {'replace': '(False)'}), '(images_filenames, train_length, replace=False)\n... |
from abc import ABCMeta, abstractmethod
import discord
import core
class BasePlayer(metaclass=ABCMeta):
user: int
team: int
async def getUser( self ) -> discord.User:
return await core.Bot.instance.client.fetch_user(self.user)
| [
"core.Bot.instance.client.fetch_user"
] | [((190, 236), 'core.Bot.instance.client.fetch_user', 'core.Bot.instance.client.fetch_user', (['self.user'], {}), '(self.user)\n', (225, 236), False, 'import core\n')] |
from django import forms
from django.conf import settings
from django_select2 import forms as s2forms
from .models import Mapeamento
class PostCityForm(forms.ModelForm):
data_inicial = forms.DateField(label='Qual a data do arquivo mais antigo disponível online?',
help_text='O ... | [
"django.forms.DateInput"
] | [((631, 835), 'django.forms.DateInput', 'forms.DateInput', ([], {'attrs': '{\'placeholder\': \'DD/MM/AAAA\', \'onkeyup\':\n "this.value=this.value.replace(/^(\\\\d\\\\d)(\\\\d)$/g,\'$1/$2\').replace(/^(\\\\d\\\\d\\\\/\\\\d\\\\d)(\\\\d+)$/g,\'$1/$2\').replace(/[^\\\\d\\\\/]/g,\'\')"\n }'}), '(attrs={\'placeholder\... |
# Copyright 2014 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"openhtf.util.argv.ModuleParser",
"logging.getLogger",
"collections.deque",
"openhtf.plugs.usb.usb_exceptions.AdbTimeoutError",
"threading.Lock",
"threading.RLock",
"openhtf.util.timeouts.PolledTimeout.from_millis",
"queue.Queue",
"openhtf.plugs.usb.usb_exceptions.AdbStreamClosedError",
"openhtf.p... | [((3520, 3539), 'openhtf.util.argv.ModuleParser', 'argv.ModuleParser', ([], {}), '()\n', (3537, 3539), False, 'from openhtf.util import argv\n'), ((3857, 3884), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3874, 3884), False, 'import logging\n'), ((9235, 9285), 'enum.Enum', 'Enum', (['... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Test for smoothing with kernels """
import numpy as np
from numpy.random import random_integers as randint
from nipy import load_image
from nipy.algorithms.kernel_smooth import LinearFilter
from nipy.c... | [
"nipy.algorithms.kernel_smooth.LinearFilter",
"nipy.core.api.Image",
"numpy.product",
"nipy.algorithms.kernel_smooth.fwhm2sigma",
"numpy.corrcoef",
"numpy.random.random_integers",
"nipy.load_image",
"numpy.argmax",
"numpy.indices",
"numpy.zeros",
"nipy.testing.assert_equal",
"nipy.algorithms.k... | [((637, 657), 'nipy.load_image', 'load_image', (['anatfile'], {}), '(anatfile)\n', (647, 657), False, 'from nipy import load_image\n'), ((673, 712), 'nipy.algorithms.kernel_smooth.LinearFilter', 'LinearFilter', (['anat.coordmap', 'anat.shape'], {}), '(anat.coordmap, anat.shape)\n', (685, 712), False, 'from nipy.algorit... |
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.models.programdb.mission.mission_integration_test.py is part of The RAMSTK
# Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for testing Mission module... | [
"pubsub.pub.subscribe",
"pubsub.pub.unsubscribe",
"pytest.mark.skip",
"pubsub.pub.sendMessage",
"pytest.mark.usefixtures"
] | [((706, 780), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""test_attributes"""', '"""integration_test_table_model"""'], {}), "('test_attributes', 'integration_test_table_model')\n", (729, 780), False, 'import pytest\n'), ((1054, 1128), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""test_attri... |
import numpy as np
import pandas as pd
# list 1
a = [2, 3, 2.7, 3.2, 4.1]
# list 2
b = [10, 14, 12, 15, 20]
# storing average of a
av_a = sum(a)/len(a)
# storing average of b
av_b = sum(b)/len(b)
# making series from list a
a = pd.Series(a)
# making series from list b
b = pd.Series(b)
# covariance through pand... | [
"pandas.Series"
] | [((235, 247), 'pandas.Series', 'pd.Series', (['a'], {}), '(a)\n', (244, 247), True, 'import pandas as pd\n'), ((281, 293), 'pandas.Series', 'pd.Series', (['b'], {}), '(b)\n', (290, 293), True, 'import pandas as pd\n')] |
import json
import logging
import os
import tempfile
import pandas as pd
import warnings
from io import StringIO
from os import getcwd
from os.path import abspath, dirname, join
from pathlib import Path
from shutil import rmtree
from numpy.testing import assert_array_equal
from pandas.testing import assert_frame_equa... | [
"logging.getLogger",
"logging.StreamHandler",
"nose.tools.eq_",
"pandas.read_csv",
"nose.tools.assert_equal",
"pathlib.Path",
"nose.tools.raises",
"os.unlink",
"tempfile.NamedTemporaryFile",
"io.StringIO",
"numpy.testing.assert_array_equal",
"rsmtool.configuration_parser.ConfigurationParser",
... | [((694, 711), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (701, 711), False, 'from os.path import abspath, dirname, join\n'), ((786, 811), 'nose.tools.raises', 'raises', (['FileNotFoundError'], {}), '(FileNotFoundError)\n', (792, 811), False, 'from nose.tools import assert_equal, assert_not_equal,... |
from app import db
from app.models import Peer
from datetime import datetime
class PeerController:
@staticmethod
def create(peer):
"""Create peer by peer dict."""
if type(peer) is dict:
peer = Peer.new_dict(peer)
else:
peer = Peer(peer)
db.session.add(p... | [
"app.db.session.commit",
"app.db.session.delete",
"app.models.Peer",
"app.models.Peer.query.all",
"datetime.datetime.now",
"app.models.Peer.query.get",
"app.db.session.add",
"app.models.Peer.new_dict"
] | [((304, 324), 'app.db.session.add', 'db.session.add', (['peer'], {}), '(peer)\n', (318, 324), False, 'from app import db\n'), ((333, 352), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (350, 352), False, 'from app import db\n'), ((460, 483), 'app.models.Peer.query.get', 'Peer.query.get', (['peer_id'],... |
from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket('first-ml-project-222122-mlengine')
# for blob in bucket.list_blobs(delimiter="/"):
# for blob in bucket.list_blobs(prefix='sample-data/train/real', delimiter='/'):
# print(blob.name)
iterator = bucket.list_blobs(prefix='sample-da... | [
"google.cloud.storage.Client"
] | [((43, 59), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (57, 59), False, 'from google.cloud import storage\n')] |
# pew in databasetools-venv python /home/hayj/wm-dist-tmp/DatabaseTools/databasetools/projectiontest.py
import sys, os; sys.path.append("/".join(os.path.abspath(__file__).split("/")[0:-2]))
import pymongo
import random
import string
import time
from systemtools.system import *
from systemtools.duration import *
# W... | [
"os.path.abspath",
"pymongo.MongoClient",
"random.choice",
"time.time"
] | [((817, 859), 'pymongo.MongoClient', 'pymongo.MongoClient', (['mongoConnectionScheme'], {}), '(mongoConnectionScheme)\n', (836, 859), False, 'import pymongo\n'), ((1382, 1393), 'time.time', 'time.time', ([], {}), '()\n', (1391, 1393), False, 'import time\n'), ((146, 171), 'os.path.abspath', 'os.path.abspath', (['__file... |
# Copyright 2017 <NAME> Society
# Distributed under the BSD-3 Software license,
# (See accompanying file ./LICENSE.txt or copy at
# https://opensource.org/licenses/BSD-3-Clause)
"""
Wasserstein Auto-Encoder models
"""
import sys
import time
import os
import logging
from math import sqrt, cos, sin, pi
import numpy as... | [
"utils.create_dir",
"tensorflow.shape",
"loss_functions.moments_loss",
"tensorflow.reduce_sum",
"numpy.array2string",
"model_nn.continuous_decoder",
"tensorflow.gfile.IsDirectory",
"numpy.array",
"tensorflow.nn.softmax",
"tensorflow.cast",
"logging.error",
"tensorflow.log",
"tensorflow.clip_... | [((960, 1006), 'logging.error', 'logging.error', (['"""Building the Tensorflow Graph"""'], {}), "('Building the Tensorflow Graph')\n", (973, 1006), False, 'import logging\n'), ((1057, 1069), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1067, 1069), True, 'import tensorflow as tf\n'), ((1457, 1478), 'tensorflo... |
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
from estimators import npeet_entropy, gcmi_entropy
from utils.algebra import entropy_normal_theoretic
from utils.common import set_seed, timer_profile, Timer
from utils.constants import RESULTS_DIR
IMAGES_ENT... | [
"estimators.npeet_entropy",
"utils.algebra.entropy_normal_theoretic",
"matplotlib.pyplot.ylabel",
"numpy.log",
"numpy.random.exponential",
"numpy.repeat",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"utils.common.set_seed",
"numpy.linspace",
"matplotlib.pyplot.savefig",
"numpy.random... | [((1823, 1890), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(0)', 'high': 'sigma', 'size': '(n_features, n_features)'}), '(low=0, high=sigma, size=(n_features, n_features))\n', (1840, 1890), True, 'import numpy as np\n'), ((2013, 2077), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal',... |
import binascii
import os
import pytest
from stellar_sdk.exceptions import MemoInvalidException
from stellar_sdk.memo import NoneMemo, Memo, TextMemo, IdMemo, HashMemo, ReturnHashMemo
class TestMemo:
def test_none_memo(self):
memo = NoneMemo()
assert memo.to_xdr_object().to_xdr() == "AAAAAA=="
... | [
"stellar_sdk.memo.TextMemo",
"stellar_sdk.memo.IdMemo",
"stellar_sdk.memo.HashMemo",
"os.urandom",
"stellar_sdk.memo.ReturnHashMemo",
"pytest.mark.parametrize",
"stellar_sdk.memo.NoneMemo",
"pytest.raises",
"binascii.unhexlify"
] | [((500, 688), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text, xdr"""', "[('Hello, Eno!', 'AAAAAQAAAAtIZWxsbywgRW5vIQA='), ('星星之火。',\n 'AAAAAQAAAA/mmJ/mmJ/kuYvngavjgIIA'), (b'Stellar',\n 'AAAAAQAAAAdTdGVsbGFyAA==')]"], {}), "('text, xdr', [('Hello, Eno!',\n 'AAAAAQAAAAtIZWxsbywgRW5vIQA='), ('星... |
"""
Script for showing results of GFDL-CM3 experiments
Author : <NAME>
Date : 21 July 2021
Version : 4 - subsamples random weight class (#8) for mmmean
"""
### Import packages
import sys
import matplotlib.pyplot as plt
import numpy as np
import cmocean as cmocean
import warnings
warnings.simplefilter(ac... | [
"numpy.arange",
"numpy.asarray",
"sys.exit",
"warnings.simplefilter",
"numpy.genfromtxt",
"warnings.filterwarnings",
"matplotlib.pyplot.rc",
"numpy.set_printoptions"
] | [((296, 358), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (317, 358), False, 'import warnings\n'), ((359, 421), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'Depre... |
import webbrowser
import selenium
webbrowser.open("https://twitch.tv/overwatchleague",new=1, autoraise=False)
| [
"webbrowser.open"
] | [((35, 111), 'webbrowser.open', 'webbrowser.open', (['"""https://twitch.tv/overwatchleague"""'], {'new': '(1)', 'autoraise': '(False)'}), "('https://twitch.tv/overwatchleague', new=1, autoraise=False)\n", (50, 111), False, 'import webbrowser\n')] |
#!/usr/bin/env python
"""Manga Dither widget
History:
2014-10-23 ROwen
2015-11-03 ROwen Replace "== None" with "is None" and "!= None" with "is not None" to modernize the code.
"""
import Tkinter
import RO.Constants
import RO.DS9
import RO.MathUtil
import RO.PhysConst
import RO.OS
import RO.Prefs
import RO.StringU... | [
"Tkinter.Frame.__init__",
"GuideTest.tuiModel.reactor.run",
"GuideTest.start"
] | [((3032, 3049), 'GuideTest.start', 'GuideTest.start', ([], {}), '()\n', (3047, 3049), False, 'import GuideTest\n'), ((3059, 3091), 'GuideTest.tuiModel.reactor.run', 'GuideTest.tuiModel.reactor.run', ([], {}), '()\n', (3089, 3091), False, 'import GuideTest\n'), ((599, 635), 'Tkinter.Frame.__init__', 'Tkinter.Frame.__ini... |
#!/usr/bin/env python.pyre
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2019 all rights reserved
#
# the framework
import pyre
# the app
class configure(pyre.application):
"""
A sample configuration utility
"""
postgres = pyre.externals.postgres()
postgres.doc = "the postgres clien... | [
"pyre.externals.postgres"
] | [((256, 281), 'pyre.externals.postgres', 'pyre.externals.postgres', ([], {}), '()\n', (279, 281), False, 'import pyre\n')] |
import _tkinter
import PIL
import numpy as np
from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
# global variables
path = ''
message = ''
img = None
img_as_np_array = None
width = None
height = None
popup_window = None
popup_window2 = None
# create window and set title
window = Tk()
... | [
"numpy.packbits",
"PIL.Image.open",
"PIL.ImageTk.PhotoImage",
"numpy.stack",
"numpy.ndarray.flatten",
"numpy.dtype",
"tkinter.filedialog.askopenfilename"
] | [((821, 958), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""/"""', 'title': '"""Select image:"""', 'filetype': "(('png', '*.png'), ('jpg', '*.jpg'), ('jpeg', '*.jpeg'))"}), "(initialdir='/', title='Select image:', filetype=\n (('png', '*.png'), ('jpg', '*.jpg'), ('jpeg',... |
from flask import request
from flask_login import current_user
from sqlalchemy import not_
from sqlalchemy.orm.exc import NoResultFound
from main.users.models import OrganizationUser
from main.users.auth import find_key
from main.resources.models import Resource
# access level defintions
ACCESS_LEVEL_NONE = 0
ACCESS_... | [
"sqlalchemy.not_",
"main.users.auth.find_key",
"main.users.models.OrganizationUser.query.filter"
] | [((1372, 1412), 'main.users.auth.find_key', 'find_key', (['request.authorization.password'], {}), '(request.authorization.password)\n', (1380, 1412), False, 'from main.users.auth import find_key\n'), ((2267, 2388), 'main.users.models.OrganizationUser.query.filter', 'OrganizationUser.query.filter', (['(OrganizationUser.... |
# Copyright 2016 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, s... | [
"google.cloud.bigtable.column_family.MaxVersionsGCRule",
"google.cloud.bigtable.row_data.PartialRowData",
"google.cloud.bigtable.client.Client",
"datetime.timedelta",
"google.cloud.bigtable.row_filters.RowFilterChain",
"test_utils.system.EmulatorCreds",
"google.cloud.bigtable.row_filters.TimestampRangeF... | [((1526, 1549), 'test_utils.system.unique_resource_id', 'unique_resource_id', (['"""-"""'], {}), "('-')\n", (1544, 1549), False, 'from test_utils.system import unique_resource_id\n'), ((2442, 2470), 'os.getenv', 'os.getenv', (['BIGTABLE_EMULATOR'], {}), '(BIGTABLE_EMULATOR)\n', (2451, 2470), False, 'import os\n'), ((25... |
import numpy as np
import matplotlib.pyplot as plt
from ..wind_profile_clustering.read_requested_data import get_wind_data
from .single_loc_plots import plot_figure_5a
from .plot_maps import plot_all
# TODO import all functions needed
# TODO add processing functionality
# TODO add plot maps single functions
# TODO c... | [
"numpy.amax",
"numpy.sqrt",
"numpy.argmax"
] | [((4325, 4394), 'numpy.sqrt', 'np.sqrt', (["(data['wind_speed_east'] ** 2 + data['wind_speed_north'] ** 2)"], {}), "(data['wind_speed_east'] ** 2 + data['wind_speed_north'] ** 2)\n", (4332, 4394), True, 'import numpy as np\n'), ((4866, 4920), 'numpy.amax', 'np.amax', (['v_req_alt[:, floor_id:ceiling_id + 1]'], {'axis':... |
# Insert `m` into `n` between `i` and `j`.
def insertion(n, m, i, j):
cleared_n = n & ~((1 << (j+1)) - (1 << i))
shifted_m = m << i
return cleared_n | shifted_m
import unittest
class Test(unittest.TestCase):
def test_insertion(self):
self.assertEqual(insertion(0b11111111, 0b10, 2, 5), 0b11001011)
se... | [
"unittest.main"
] | [((414, 429), 'unittest.main', 'unittest.main', ([], {}), '()\n', (427, 429), False, 'import unittest\n')] |
from torch.utils.data.sampler import Sampler
from torch.utils.data.sampler import BatchSampler
import torch
import numpy as np
import itertools
from collections import OrderedDict
class _RepeatSampler(object):
"""
Sampler that repeats forever.
Args:
sampler (Sampler)
"""
def __init__(sel... | [
"torch.cholesky_solve",
"torch.unique",
"collections.OrderedDict.fromkeys",
"torch.eye",
"torch.cholesky",
"itertools.chain.from_iterable",
"numpy.sum",
"torch.cuda.is_available",
"torch.matmul",
"torch.reshape",
"torch.zeros",
"numpy.arange",
"numpy.random.shuffle"
] | [((8288, 8326), 'torch.reshape', 'torch.reshape', (['prediction_x', '[P, T, Q]'], {}), '(prediction_x, [P, T, Q])\n', (8301, 8326), False, 'import torch\n'), ((8354, 8394), 'torch.reshape', 'torch.reshape', (['mu', '[latent_dim, P, T, 1]'], {}), '(mu, [latent_dim, P, T, 1])\n', (8367, 8394), False, 'import torch\n'), (... |
"""pypyr step that executes a cmd as a sub-process.
You cannot use things like exit, return, shell pipes, filename wildcards,
environment,variable expansion, and expansion of ~ to a user’s home
directory.
"""
import logging
from pypyr.steps.dsl.cmd import CmdStep
# logger means the log level will be set correctly
log... | [
"logging.getLogger",
"pypyr.steps.dsl.cmd.CmdStep"
] | [((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((1595, 1634), 'pypyr.steps.dsl.cmd.CmdStep', 'CmdStep', ([], {'name': '__name__', 'context': 'context'}), '(name=__name__, context=context)\n', (1602, 1634), False, 'from pypyr.steps.dsl.... |
import json
from couchbase_helper.cluster import Cluster
from couchbase_helper.documentgenerator import DocumentGenerator
from membase.api.esrest_client import EsRestConnection
from membase.api.exception import XDCRCheckpointException
from membase.api.rest_client import RestConnection
from membase.helper.cluster_helpe... | [
"json.loads",
"memcached.helper.data_helper.VBucketAwareMemcached",
"membase.api.esrest_client.EsRestConnection",
"couchbase_helper.cluster.Cluster",
"remote.remote_util.RemoteMachineShellConnection",
"membase.helper.cluster_helper.ClusterOperationHelper.find_orchestrator",
"membase.api.rest_client.Rest... | [((756, 765), 'couchbase_helper.cluster.Cluster', 'Cluster', ([], {}), '()\n', (763, 765), False, 'from couchbase_helper.cluster import Cluster\n'), ((1731, 1762), 'membase.api.rest_client.RestConnection', 'RestConnection', (['self.src_master'], {}), '(self.src_master)\n', (1745, 1762), False, 'from membase.api.rest_cl... |
import click
import frida
from frida.core import Session, Device, Script
allow_script = "js/allow.js"
signature_script = "js/signature.js"
patche10_script = "js/patch_e10.js"
class FridaWrapper:
def __init__(self, device: Device, session: Session):
self.device = device
self.session = session
... | [
"click.group",
"click.option",
"frida.get_usb_device"
] | [((769, 782), 'click.group', 'click.group', ([], {}), '()\n', (780, 782), False, 'import click\n'), ((1111, 1189), 'click.option', 'click.option', (['"""-p"""', '"""--package"""', '"""package"""'], {'help': '"""Package name"""', 'required': '(True)'}), "('-p', '--package', 'package', help='Package name', required=True)... |
"""
uxd async io (nonblocking) module
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import socket
import errno
from binascii import hexlify
# Import ioflo libs
from ...aid.sixing import *
from ...aid.consoling import getConsole
console = getConsole()
class SocketUxdNb(ob... | [
"os.path.exists",
"socket.socket",
"binascii.hexlify",
"os.path.dirname",
"os.umask",
"os.unlink"
] | [((1535, 1583), 'socket.socket', 'socket.socket', (['socket.AF_UNIX', 'socket.SOCK_DGRAM'], {}), '(socket.AF_UNIX, socket.SOCK_DGRAM)\n', (1548, 1583), False, 'import socket\n'), ((2327, 2347), 'os.umask', 'os.umask', (['self.umask'], {}), '(self.umask)\n', (2335, 2347), False, 'import os\n'), ((3106, 3124), 'os.umask'... |
import os
import ntpath
from pathlib import Path, PureWindowsPath, PurePath
from PathOperations import is_path_absolute, common_prefix
import formats
import re
import shutil
def valid_m3u_playlist(filepath):
""" validates if the playlist is an acceptable *.m3u playlist file
Args:
filepath (Path): The ... | [
"shutil.copy2",
"pathlib.Path",
"PathOperations.is_path_absolute",
"pathlib.PureWindowsPath",
"ntpath.split",
"PathOperations.common_prefix"
] | [((1494, 1512), 'pathlib.Path', 'Path', (['playlistpath'], {}), '(playlistpath)\n', (1498, 1512), False, 'from pathlib import Path, PureWindowsPath, PurePath\n'), ((3140, 3148), 'pathlib.Path', 'Path', (['""""""'], {}), "('')\n", (3144, 3148), False, 'from pathlib import Path, PureWindowsPath, PurePath\n'), ((4146, 417... |
from dassl.engine import TRAINER_REGISTRY,TrainerXU
from dassl.data import DataManager
from torch.utils.data import Dataset as TorchDataset
from dassl.optim import build_optimizer, build_lr_scheduler
from dassl.utils import count_num_param
import torch
import torch.nn as nn
from torch.nn import functional as F
from das... | [
"dassl.engine.TRAINER_REGISTRY.register",
"dassl.engine.trainer_tmp.SimpleNet",
"torch.nn.CrossEntropyLoss",
"dassl.optim.build_optimizer",
"dassl.utils.count_num_param",
"dassl.utils.MetricMeter",
"numpy.array",
"torch.nn.Linear",
"torch.no_grad",
"dassl.optim.build_lr_scheduler"
] | [((416, 443), 'dassl.engine.TRAINER_REGISTRY.register', 'TRAINER_REGISTRY.register', ([], {}), '()\n', (441, 443), False, 'from dassl.engine import TRAINER_REGISTRY, TrainerXU\n'), ((4324, 4339), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4337, 4339), False, 'import torch\n'), ((647, 668), 'torch.nn.CrossEntr... |
import os
import time
import threading
LK = threading.Lock()
Ni = 20 + 1
Nj = 20 + 1
Np = 4
FF = []
CC = []
for i in range( Ni ):
for j in range( Nj ):
CC.append( ( i, j ) )
FF.append( not os.path.isfile( "pes.%d.%d"%( i, j ) ) )
NN = len( FF )
def worker( num ):
global LK, CC, FF, NN
... | [
"threading.Lock",
"time.sleep",
"os.path.isfile",
"os.system",
"threading.Thread"
] | [((46, 62), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (60, 62), False, 'import threading\n'), ((1589, 1602), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1599, 1602), False, 'import time\n'), ((1447, 1460), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1457, 1460), False, 'import time\n'), ((... |
#
# This file is part of Land Cover Classification System Database Model.
# Copyright (C) 2019-2020 INPE.
#
# Land Cover Classification System Database Model is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Config test fixtures."""... | [
"subprocess.call",
"flask.Flask"
] | [((455, 470), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (460, 470), False, 'from flask import Flask\n'), ((941, 999), 'subprocess.call', 'subprocess.call', (['f"""lccs-db db destroy --force"""'], {'shell': '(True)'}), "(f'lccs-db db destroy --force', shell=True)\n", (956, 999), False, 'import subproce... |
#!/usr/bin/env python3
import os
import sys
import argparse
import operator
import math
import numpy as np
parser = argparse.ArgumentParser(description='Process output of Kraken run on contigs.')
parser.add_argument('-c','--contig', default="", help='per-contig output from Kraken')
parser.add_argument('-r','--report'... | [
"operator.itemgetter",
"numpy.setdiff1d",
"argparse.ArgumentParser",
"math.log"
] | [((118, 197), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process output of Kraken run on contigs."""'}), "(description='Process output of Kraken run on contigs.')\n", (141, 197), False, 'import argparse\n'), ((6404, 6437), 'numpy.setdiff1d', 'np.setdiff1d', (['all_ranks', 'ranklist']... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2018 OneLogin, Inc.
# MIT License
from base64 import b64encode
import json
from os.path import dirname, join, exists
import unittest
from teamcity import is_running_under_teamcity
from teamcity.unittestpy import TeamcityTestRunner
from onelogin.saml2.response import OneLo... | [
"os.path.exists",
"teamcity.unittestpy.TeamcityTestRunner",
"base64.b64encode",
"os.path.join",
"onelogin.saml2.settings.OneLogin_Saml2_Settings",
"json.load",
"os.path.dirname",
"teamcity.is_running_under_teamcity",
"unittest.main",
"unittest.TextTestRunner"
] | [((2310, 2337), 'teamcity.is_running_under_teamcity', 'is_running_under_teamcity', ([], {}), '()\n', (2335, 2337), False, 'from teamcity import is_running_under_teamcity\n'), ((2434, 2466), 'unittest.main', 'unittest.main', ([], {'testRunner': 'runner'}), '(testRunner=runner)\n', (2447, 2466), False, 'import unittest\n... |
import json
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.http import QueryDict
from django.utils.http import urlquote
import mock
from nose.tools import eq_
from pyquery import PyQuery as pq
import search as constants
from forums.t... | [
"questions.tests.answervote",
"django.http.QueryDict",
"nose.tools.eq_",
"search.es_utils.get_documents",
"django.utils.http.urlquote",
"wiki.tests.document",
"pyquery.PyQuery",
"datetime.timedelta",
"datetime.datetime",
"wiki.tests.revision",
"questions.tests.questionvote",
"products.tests.pr... | [((855, 891), 'mock.patch.object', 'mock.patch.object', (['Question', '"""index"""'], {}), "(Question, 'index')\n", (872, 891), False, 'import mock\n'), ((1208, 1244), 'mock.patch.object', 'mock.patch.object', (['Question', '"""index"""'], {}), "(Question, 'index')\n", (1225, 1244), False, 'import mock\n'), ((32533, 32... |
import json
import logging
import sys
import traceback
from time import sleep
import utils
sourceToken = "USDC"
targetToken = "DUSD"
totalAmount = 0
batchSize = 2000
address = ""
maxPrice = 1.016
logToConsole = True
logToFile = False
logId = ""
'''
sample settings:
{
"NODE_USER": "RPC_USER",
"NODE_PASSWORD": ... | [
"traceback.format_exc",
"utils.waitForTx",
"utils.blockcount",
"time.sleep",
"utils.waitBlocks",
"utils.send_telegram",
"utils.rpc",
"json.load",
"utils.get_balance",
"utils.setup_logger"
] | [((1746, 1852), 'utils.setup_logger', 'utils.setup_logger', (["('tradebot_' + logId)", 'logging.INFO'], {'logToConsole': 'logToConsole', 'logToFile': 'logToFile'}), "('tradebot_' + logId, logging.INFO, logToConsole=\n logToConsole, logToFile=logToFile)\n", (1764, 1852), False, 'import utils\n'), ((3585, 3625), 'util... |
from profiles import *
import numpy as np
import matplotlib.pyplot as plt
NUM_GENS = 35
NUM_ROUNDS = 100
INITIAL_PROFILE = defectors_with_some_tft()
def run_simulation(init_profile: dict, num_gens, num_rounds):
dist = {
'gens': np.linspace(1, num_gens, num_gens)
}
init_gen = populationize(init_pr... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.zeros",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((990, 1058), 'matplotlib.pyplot.title', 'plt.title', (['"""Changes to population distribution with respect to time"""'], {}), "('Changes to population distribution with respect to time')\n", (999, 1058), True, 'import matplotlib.pyplot as plt\n'), ((1063, 1087), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Generat... |
import os
import re
import nltk
import numpy as np
from sklearn import feature_extraction
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.metrics import jaccard_similarity_score
from tqdm import tqdm
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import pickle
_wnl = nltk.Wor... | [
"vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer",
"pickle.dump",
"sklearn.metrics.pairwise.cosine_similarity",
"nltk.word_tokenize",
"nltk.WordNetLemmatizer",
"numpy.asarray",
"numpy.argmax",
"pickle.load",
"os.path.isfile",
"numpy.array",
"sklearn.feature_extraction.text.TfidfVectoriz... | [((312, 336), 'nltk.WordNetLemmatizer', 'nltk.WordNetLemmatizer', ([], {}), '()\n', (334, 336), False, 'import nltk\n'), ((1004, 1025), 'numpy.load', 'np.load', (['feature_file'], {}), '(feature_file)\n', (1011, 1025), True, 'import numpy as np\n'), ((3261, 3272), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (3269,... |
#!/usr/bin/env python
import os
from sys import stdout, stderr
import chpl_platform, chpl_comm, chpl_comm_substrate
from utils import memoize
# this one doesnt really need to cache anything, but it doesnt need to run more
# than once to print out any warnings
@memoize
def check():
platform_val = chpl_platform.get... | [
"chpl_platform.get",
"chpl_comm.get",
"chpl_comm_substrate.get",
"os.environ.get"
] | [((303, 330), 'chpl_platform.get', 'chpl_platform.get', (['"""target"""'], {}), "('target')\n", (320, 330), False, 'import chpl_platform, chpl_comm, chpl_comm_substrate\n'), ((392, 407), 'chpl_comm.get', 'chpl_comm.get', ([], {}), '()\n', (405, 407), False, 'import chpl_platform, chpl_comm, chpl_comm_substrate\n'), ((4... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
"ironic_inspector.utils.iso_timestamp",
"unittest.mock.Mock",
"ironic_inspector.node_cache.NodeInfo",
"ironic_inspector.utils.getProcessingLogger",
"ironic_inspector.utils.processing_logger_prefix",
"unittest.mock.patch.object",
"ironic_inspector.utils.check_auth",
"ironic_inspector.utils.add_auth_mid... | [((1017, 1077), 'unittest.mock.patch.object', 'mock.patch.object', (['auth_token', '"""AuthProtocol"""'], {'autospec': '(True)'}), "(auth_token, 'AuthProtocol', autospec=True)\n", (1034, 1077), False, 'from unittest import mock\n'), ((1466, 1503), 'unittest.mock.Mock', 'mock.Mock', ([], {'wsgi_app': 'mock.sentinel.app'... |
# coding: utf-8
# # Model
# In[551]:
get_ipython().run_line_magic('config', "InlineBackend.figure_format = 'retina'")
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
from itertools import groupby
from math import sqrt
# ### C... | [
"numpy.mean",
"pandas.read_csv",
"numpy.average",
"numpy.square",
"matplotlib.pyplot.suptitle",
"numpy.array_split",
"numpy.sum",
"numpy.apply_along_axis",
"numpy.setdiff1d",
"numpy.take",
"collections.Counter",
"numpy.std",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((8777, 8898), 'pandas.read_csv', 'pd.read_csv', (["(directoryPath + '/iris.data')"], {'names': "['sepalLength', 'sepalWidth', 'petalLength', 'petalWidth', 'target']"}), "(directoryPath + '/iris.data', names=['sepalLength',\n 'sepalWidth', 'petalLength', 'petalWidth', 'target'])\n", (8788, 8898), True, 'import pand... |
import os
import errno
try:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
except:
from PySide.QtCore import *
from PySide.QtGui import *
def printText(text, name="Print"):
QMessageBox.warning(QWidget(), str(name), str(text))
def mkdir_p(path):
... | [
"os.path.isdir",
"os.makedirs"
] | [((333, 350), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (344, 350), False, 'import os\n'), ((434, 453), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (447, 453), False, 'import os\n')] |
from celery import Celery
app = Celery('tasks')
'''
This file is used to create
'''
| [
"celery.Celery"
] | [((33, 48), 'celery.Celery', 'Celery', (['"""tasks"""'], {}), "('tasks')\n", (39, 48), False, 'from celery import Celery\n')] |
#!/usr/bin/env python
"""Training on a single process."""
import os
import shutil
import torch
from onmt.inputters.inputter import build_dataset_iter, \
load_old_vocab, old_style_vocab, build_dataset_iter_multiple, make_tgt, reload_news_fields
from onmt.inputters.news_dataset import load_pretrained_tokenizer
from... | [
"onmt.utils.parse.ArgumentParser.validate_model_opts",
"onmt.trainer.build_trainer",
"onmt.inputters.inputter.load_old_vocab",
"onmt.utils.logging.logger.warn",
"os.path.exists",
"shutil.copy2",
"onmt.utils.logging.init_logger",
"onmt.utils.parse.ArgumentParser.ckpt_model_opts",
"onmt.inputters.inpu... | [((983, 1014), 'os.path.abspath', 'os.path.abspath', (['opt.save_model'], {}), '(opt.save_model)\n', (998, 1014), False, 'import os\n'), ((1035, 1067), 'os.path.dirname', 'os.path.dirname', (['save_model_path'], {}), '(save_model_path)\n', (1050, 1067), False, 'import os\n'), ((2577, 2618), 'onmt.utils.misc.set_random_... |
import queue
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
#DFS Way (Run Time - O(n), Space Time - Constant O(1))
class Solution:
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
stack = [(p,q)]
... | [
"queue.extend",
"queue.dequeue",
"queue.popleft"
] | [((722, 743), 'queue.dequeue', 'queue.dequeue', (['[p, q]'], {}), '([p, q])\n', (735, 743), False, 'import queue\n'), ((783, 798), 'queue.popleft', 'queue.popleft', ([], {}), '()\n', (796, 798), False, 'import queue\n'), ((950, 1002), 'queue.extend', 'queue.extend', (['[(p.left, q.left), (p.right, q.right)]'], {}), '([... |
# excel link : https://blog.naver.com/montrix/221378282753
import sys, os
import mxdevtool as mx
import mxdevtool.xenarix as xen
import numpy as np
filename = 'D:/test_vasicek1f.npz'
ref_date = mx.Date.todaysDate()
def model():
r0 = 0.02
alpha = 0.1
longterm = 0.042
sigma = 0.03
vasicek1f = xen.Vasicek1F('va... | [
"mxdevtool.Date.todaysDate",
"mxdevtool.TimeEqualGrid",
"mxdevtool.xenarix.Rsg",
"mxdevtool.xenarix.generate1d",
"mxdevtool.xenarix.Vasicek1F"
] | [((196, 216), 'mxdevtool.Date.todaysDate', 'mx.Date.todaysDate', ([], {}), '()\n', (214, 216), True, 'import mxdevtool as mx\n'), ((303, 357), 'mxdevtool.xenarix.Vasicek1F', 'xen.Vasicek1F', (['"""vasicek1f"""', 'r0', 'alpha', 'longterm', 'sigma'], {}), "('vasicek1f', r0, alpha, longterm, sigma)\n", (316, 357), True, '... |
"""
A dict subclass for Python 3 that behaves like Python 2's dict
Example use:
>>> from past.builtins import dict
>>> d1 = dict() # instead of {} for an empty dict
>>> d2 = dict(key1='value1', key2='value2')
The keys, values and items methods now return lists on Python 3.x and there are
methods for iterkeys, ite... | [
"past.utils.with_metaclass"
] | [((752, 794), 'past.utils.with_metaclass', 'with_metaclass', (['BaseOldDict', '_builtin_dict'], {}), '(BaseOldDict, _builtin_dict)\n', (766, 794), False, 'from past.utils import with_metaclass\n')] |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | [
"django.db.migrations.RunPython",
"django.db.models.CharField"
] | [((1250, 1287), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_runtime'], {}), '(migrate_runtime)\n', (1270, 1287), False, 'from django.db import migrations, models\n'), ((1160, 1229), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'db_index': '(True)', 'max_length': '(... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import numpy as np
def mixup_data(x, y, alpha):
# https://github.com/vikasverma1077/manifold_mixup/blob/master/supervised/utils.py
'''Compute the mixup data. Return mixed inputs, pairs of targets... | [
"numpy.clip",
"numpy.random.beta",
"torch.randperm",
"torch.eye",
"torch.exp",
"torch.pow",
"numpy.exp",
"torch.nn.functional.log_softmax",
"torch.zeros"
] | [((371, 399), 'numpy.random.beta', 'np.random.beta', (['alpha', 'alpha'], {}), '(alpha, alpha)\n', (385, 399), True, 'import numpy as np\n'), ((1441, 1471), 'numpy.clip', 'np.clip', (['(1 - lam)', 'eps', '(1 - eps)'], {}), '(1 - lam, eps, 1 - eps)\n', (1448, 1471), True, 'import numpy as np\n'), ((1114, 1128), 'torch.z... |
from array import array
import numpy as np
import struct
import sys
import os
class MNISTLoader:
def __init__(self, path):
self.path = path
self.train_img_fname = 'train-images-idx3-ubyte'
self.train_lbl_fname = 'train-labels-idx1-ubyte'
self.train_images, self.train_labels = [], ... | [
"numpy.array",
"os.path.join"
] | [((674, 719), 'os.path.join', 'os.path.join', (['self.path', 'self.train_img_fname'], {}), '(self.path, self.train_img_fname)\n', (686, 719), False, 'import os\n'), ((733, 778), 'os.path.join', 'os.path.join', (['self.path', 'self.train_lbl_fname'], {}), '(self.path, self.train_lbl_fname)\n', (745, 778), False, 'import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Aerodynamic loads
# <NAME>
class Loads:
def __init__(self):
self.ys = [] # spanwise stations
self.chds = [] # chord
self.data = {} # coordinates and pressure coefficient
self.cls = [] # lift
self.cms = [] # moment positive no... | [
"numpy.hstack",
"numpy.sin",
"numpy.deg2rad",
"numpy.zeros",
"numpy.vstack",
"numpy.savetxt",
"numpy.min",
"numpy.cos",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((610, 637), 'numpy.zeros', 'np.zeros', (['(pts.shape[0], 1)'], {}), '((pts.shape[0], 1))\n', (618, 637), True, 'import numpy as np\n'), ((726, 751), 'numpy.hstack', 'np.hstack', (['(pts, x_c, cp)'], {}), '((pts, x_c, cp))\n', (735, 751), True, 'import numpy as np\n'), ((905, 922), 'numpy.deg2rad', 'np.deg2rad', (['al... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Test case ID : C14861500
Test Case Title : Verify Default shape is Physics Asset
"""
# fmt: off
class Tests():
... | [
"editor_python_test_tools.editor_entity_utils.EditorEntity.create_editor_entity",
"editor_python_test_tools.hydra_editor_utils.open_base_level",
"editor_python_test_tools.utils.Report.result",
"editor_python_test_tools.utils.Report.start_test"
] | [((1845, 1868), 'editor_python_test_tools.hydra_editor_utils.open_base_level', 'hydra.open_base_level', ([], {}), '()\n', (1866, 1868), True, 'import editor_python_test_tools.hydra_editor_utils as hydra\n'), ((1961, 2000), 'editor_python_test_tools.editor_entity_utils.EditorEntity.create_editor_entity', 'Entity.create_... |
from pathlib import Path
from textwrap import dedent
from jupyter_client.kernelspec import find_kernel_specs
SUPPORTED_FILE_SUFFIXES = [".ipynb", ".md", ".markdown", ".myst", ".Rmd", ".py"]
def _filename_to_title(filename, split_char="_"):
"""Convert a file path into a more readable title."""
filename = Path... | [
"jupyter_client.kernelspec.find_kernel_specs",
"textwrap.dedent",
"jupytext.cli.jupytext",
"pathlib.Path"
] | [((1220, 1231), 'textwrap.dedent', 'dedent', (['msg'], {}), '(msg)\n', (1226, 1231), False, 'from textwrap import dedent\n'), ((3163, 3177), 'jupytext.cli.jupytext', 'jupytext', (['args'], {}), '(args)\n', (3171, 3177), False, 'from jupytext.cli import jupytext\n'), ((1401, 1412), 'textwrap.dedent', 'dedent', (['box'],... |
import os
from utils import debug, ranges, is_authorized, print_unauthorized
if not is_authorized():
print_unauthorized()
for item in ranges:
for r in item:
cmd = 'python parser.py --folder "%s" --range %s --letter %s' % (
r['folder'], r['range'], r['letter'])
if debug:
... | [
"os.system",
"utils.is_authorized",
"utils.print_unauthorized"
] | [((86, 101), 'utils.is_authorized', 'is_authorized', ([], {}), '()\n', (99, 101), False, 'from utils import debug, ranges, is_authorized, print_unauthorized\n'), ((107, 127), 'utils.print_unauthorized', 'print_unauthorized', ([], {}), '()\n', (125, 127), False, 'from utils import debug, ranges, is_authorized, print_una... |
from django.contrib import admin
# Register your models here.
from .models import Tag, My_post
# admin.site.register(Tag)
# admin.site.register(My_post)
def set_active(modelAdmin, request, queryset):
queryset.update(is_active = True)
def set_inactive(modelAdmin, request, queryset):
queryset.update(is_active ... | [
"django.contrib.admin.site.register"
] | [((614, 648), 'django.contrib.admin.site.register', 'admin.site.register', (['Tag', 'TagAdmin'], {}), '(Tag, TagAdmin)\n', (633, 648), False, 'from django.contrib import admin\n'), ((649, 691), 'django.contrib.admin.site.register', 'admin.site.register', (['My_post', 'My_postAdmin'], {}), '(My_post, My_postAdmin)\n', (... |
import io
import re
import setuptools
import sys
with io.open('myo/__init__.py', encoding='utf8') as fp:
version = re.search(r"__version__\s*=\s*'(.*)'", fp.read()).group(1)
with open('README.md') as fp:
readme = fp.read()
requirements = ['cffi>=1.11.5', 'six>=1.11.0']
if sys.version < '3.4':
requirements.app... | [
"setuptools.setup",
"io.open"
] | [((335, 754), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""myo-python"""', 'version': 'version', 'description': '"""Python bindings for the Thalmic Labs Myo SDK"""', 'long_description': 'readme', 'long_description_content_type': '"""text/markdown"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>""... |
from sympy import *
from matplotlib import pyplot as plt
import numpy as np
from random import randint
y, n = symbols('y n')
f = cos(y*log(n+1))/cos(y*log(n))*(1+1/n)**(-1/2)
# print(limit(f,n,oo)) maximum recursion limit exceeded ....
print(
cos(y*log(n+1))/cos(y*log(n)) ==
cos(y*log(1+1/n))-tan(y*log(n))*sin... | [
"numpy.log",
"numpy.linspace",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((359, 383), 'numpy.linspace', 'np.linspace', (['(2)', 'M', '(M - 1)'], {}), '(2, M, M - 1)\n', (370, 383), True, 'import numpy as np\n'), ((619, 635), 'matplotlib.pyplot.plot', 'plt.plot', (['n1', 'y1'], {}), '(n1, y1)\n', (627, 635), True, 'from matplotlib import pyplot as plt\n'), ((635, 651), 'matplotlib.pyplot.pl... |
""" Modul, dass die Gesamtnote fuer einen Schueler bestimmt """
import configparser
from statistics import mean
def endnote(schueler, klasserc):
""" Berechnet die Gesamtnote (klappt nur, wenn es nur schriftlich un mündlich gibt"""
# Schritt 1: loesche in allen Listen die leeren Noten
for art in schueler:
... | [
"statistics.mean",
"configparser.ConfigParser"
] | [((471, 498), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (496, 498), False, 'import configparser\n'), ((1422, 1441), 'statistics.mean', 'mean', (['schueler[art]'], {}), '(schueler[art])\n', (1426, 1441), False, 'from statistics import mean\n')] |
### tensorflow==2.3.0
### https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html
### https://google.github.io/mediapipe/solutions/pose
### https://www.tensorflow.org/api_docs/python/tf/keras/Model
### https://www.tensorflow.org/lite/guide/ops_compatibility
### https://www.tensorflow.org/api_do... | [
"tensorflow.python.keras.backend.concatenate",
"tensorflow.shape",
"tensorflow.raw_ops.MaxPoolWithArgmax",
"tensorflow.python.framework.convert_to_constants.convert_variables_to_constants_v2",
"tensorflow.cast",
"tensorflow.python.keras.utils.conv_utils.normalize_tuple",
"tensorflow.size",
"tensorflow... | [((6431, 6490), 'tensorflow.keras.Input', 'Input', ([], {'shape': '(height, width, 4)', 'batch_size': '(1)', 'name': '"""input"""'}), "(shape=(height, width, 4), batch_size=1, name='input')\n", (6436, 6490), False, 'from tensorflow.keras import Model, Input\n'), ((9183, 9289), 'tensorflow.raw_ops.MaxPoolWithArgmax', 't... |
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup, find_packages
import versioneer
setup(
name="hrlam",
packages=find_packages("src"),
package_dir={"": "src"},
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=[],
e... | [
"versioneer.get_cmdclass",
"setuptools.find_packages",
"versioneer.get_version"
] | [((161, 181), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (174, 181), False, 'from setuptools import setup, find_packages\n'), ((224, 248), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (246, 248), False, 'import versioneer\n'), ((263, 288), 'versioneer.get_cmd... |
from iiwaPy.sunrisePy import sunrisePy
import time
import numpy as np
from gripper import RobotiqGripper
from math import pi
class Robot:
def __init__(self):
ip = '172.31.1.148'
self.iiwa = sunrisePy(ip)
self.grip = RobotiqGripper("/dev/ttyUSB0")
self.iiwa.setBlueOn()
self.g... | [
"gripper.RobotiqGripper",
"time.sleep",
"iiwaPy.sunrisePy.sunrisePy"
] | [((211, 224), 'iiwaPy.sunrisePy.sunrisePy', 'sunrisePy', (['ip'], {}), '(ip)\n', (220, 224), False, 'from iiwaPy.sunrisePy import sunrisePy\n'), ((245, 275), 'gripper.RobotiqGripper', 'RobotiqGripper', (['"""/dev/ttyUSB0"""'], {}), "('/dev/ttyUSB0')\n", (259, 275), False, 'from gripper import RobotiqGripper\n'), ((369,... |
# -*- coding: utf-8 -*-
import os
import logging
log = logging.getLogger()
# ----------------------------------------------------------------------
def cmd_list_wordlists(config):
"""
Get all internal wordlist
"""
base_wordlists = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "resources",... | [
"logging.getLogger",
"os.path.dirname",
"os.listdir"
] | [((58, 77), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (75, 77), False, 'import logging\n'), ((384, 410), 'os.listdir', 'os.listdir', (['base_wordlists'], {}), '(base_wordlists)\n', (394, 410), False, 'import os\n'), ((269, 294), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n',... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.azclierror.InvalidTemplateError",
"knack.log.get_logger",
"azure.cli.core.azclierror.FileOperationError",
"certifi.where",
"datetime.timedelta",
"azure.cli.core.azclierror.ClientRequestError",
"os.remove",
"semver.compare",
"os.path.exists",
"re.search",
"subprocess.run",
"plat... | [((1709, 1725), 'azure.cli.core.api.get_config_dir', 'get_config_dir', ([], {}), '()\n', (1723, 1725), False, 'from azure.cli.core.api import get_config_dir\n'), ((1752, 1784), 'os.path.join', 'os.path.join', (['_config_dir', '"""bin"""'], {}), "(_config_dir, 'bin')\n", (1764, 1784), False, 'import os\n'), ((1818, 1869... |
from torch.utils.data import DataLoader
class Data:
def load_datasets(self): # Loads self.dataset_{train,val,test}
raise NotImplementedError
def custom_collate_fn(self):
raise NotImplementedError
def get_loaders(self, batch_size, shuffle_train=False, num_workers=0,
... | [
"torch.utils.data.DataLoader"
] | [((504, 632), 'torch.utils.data.DataLoader', 'DataLoader', (['self.dataset_train'], {'batch_size': 'batch_size', 'shuffle': 'shuffle_train', 'num_workers': 'num_workers', 'collate_fn': 'collate_fn'}), '(self.dataset_train, batch_size=batch_size, shuffle=shuffle_train,\n num_workers=num_workers, collate_fn=collate_fn... |
"""
Author: <NAME>, PhD - Higher Education Specialist at Education & Research at Esri Canada.
Date: Remodified Q1 - 2022.
About: From per transit route and trip_id, this geoprocessing operation identifies where along
the transit route was the vehicle at.
Warning Note: This operation runs while in P... | [
"arcgis.features.GeoAccessor.from_featureclass",
"pandas.json_normalize",
"arcgis.geometry.Polyline",
"pandas.concat",
"pandas.DataFrame",
"arcgis.geometry.Point"
] | [((10376, 10441), 'arcgis.geometry.Point', 'Point', (["{'spatialReference': {'latestWkid': wkid}, 'x': x, 'y': y}"], {}), "({'spatialReference': {'latestWkid': wkid}, 'x': x, 'y': y})\n", (10381, 10441), False, 'from arcgis.geometry import Point, Polyline\n'), ((10993, 11016), 'pandas.json_normalize', 'json_normalize',... |
from django.conf.urls import url
from usaspending_api.awards.v2.views.transactions import TransactionViewSet
urlpatterns = [
url(r'^$', TransactionViewSet.as_view())
]
| [
"usaspending_api.awards.v2.views.transactions.TransactionViewSet.as_view"
] | [((141, 169), 'usaspending_api.awards.v2.views.transactions.TransactionViewSet.as_view', 'TransactionViewSet.as_view', ([], {}), '()\n', (167, 169), False, 'from usaspending_api.awards.v2.views.transactions import TransactionViewSet\n')] |
from dataclasses import field, dataclass
from typing import Optional
@dataclass
class FileLocationPackage:
name: str
section: Optional[str] = None
area: Optional[str] = None
def __str__(self):
result = "/".join(
[
self.area or "",
self.section or ""... | [
"dataclasses.field"
] | [((502, 529), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (507, 529), False, 'from dataclasses import field, dataclass\n')] |