code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
class CommandError(Exception):
def __init__(self, message):
super().__init__(message)
self.message = message
class BaseCommand:
def run(self):
parser = self.get_optparser()
(options, names) = parser.parse_args()
try:
self.handle(names, options)
... | [
"sys.exit"
] | [((428, 439), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (436, 439), False, 'import sys\n')] |
import unittest.mock
import pytest
import requests
from lektor_twitter_embed import _init_params, _tweet
def _mock_request_valid(url, params):
return {"html": "<blockquote..."}
def _mock_request_exception(url, params):
raise requests.exceptions.HTTPError()
_tweet_url = "https://twitter.com/thisstuartlaw... | [
"lektor_twitter_embed._tweet",
"requests.exceptions.HTTPError",
"lektor_twitter_embed._init_params",
"pytest.raises"
] | [((239, 270), 'requests.exceptions.HTTPError', 'requests.exceptions.HTTPError', ([], {}), '()\n', (268, 270), False, 'import requests\n'), ((392, 422), 'lektor_twitter_embed._init_params', '_init_params', (['_tweet_url', 'None'], {}), '(_tweet_url, None)\n', (404, 422), False, 'from lektor_twitter_embed import _init_pa... |
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
For Citibike rebancing simulation
"""
import simpy
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
order_threshold = 2.0
order_up_to = 5.0
delivery_delay = 20 # in minutes
SIM_RUN = 1000 #number of simulation runs
initial_bikes = 15
operat... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"scipy.stats.norm.ppf",
"numpy.random.exponential",
"simpy.Environment",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"scipy.stats.sem",
"matplotlib.pyplot.step",
... | [((4533, 4573), 'scipy.stats.norm.ppf', 'stats.norm.ppf', (['(1 - confidence_level / 2)'], {}), '(1 - confidence_level / 2)\n', (4547, 4573), True, 'import scipy.stats as stats\n'), ((684, 720), 'numpy.random.exponential', 'np.random.exponential', (['(1.0 / _lambda)'], {}), '(1.0 / _lambda)\n', (705, 720), True, 'impor... |
# Generated by Django 3.0.4 on 2020-04-01 14:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0002_mymodel'),
]
operations = [
migrations.CreateModel(
name='ADStest',
fields=[
('id', m... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((319, 412), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (335, 412), False, 'from django.db import migrations, models\... |
import pandas as pd
import numpy as np
from sklearn.preprocessing import Imputer, LabelBinarizer, StandardScaler
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import StratifiedShuffleSplit, GridSearchCV, train_test_split, c... | [
"sklearn.pipeline.FeatureUnion",
"sklearn.preprocessing.LabelBinarizer",
"sklearn.metrics.f1_score",
"sklearn.neural_network.MLPClassifier",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.Imputer",
"sklearn.linear_model.LogisticRegression",
"sklearn.preprocessi... | [((445, 463), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (459, 463), True, 'import numpy as np\n'), ((1583, 1683), 'sklearn.pipeline.FeatureUnion', 'FeatureUnion', ([], {'transformer_list': "[('num_pipeline', num_pipeline), ('cat_pipeline', cat_pipeline)]"}), "(transformer_list=[('num_pipeline', n... |
import tarfile
import os
tar_content_files = [ {"name": "config", "arc_name": "config"},
{"name": "out/chart-verifier", "arc_name": "chart-verifier"} ]
def create(release):
tgz_name = f"chart-verifier-{release}.tgz"
if os.path.exists(tgz_name):
os.remove(tgz_name)
with tarfile.ope... | [
"os.path.exists",
"os.getcwd",
"tarfile.open",
"os.remove"
] | [((245, 269), 'os.path.exists', 'os.path.exists', (['tgz_name'], {}), '(tgz_name)\n', (259, 269), False, 'import os\n'), ((279, 298), 'os.remove', 'os.remove', (['tgz_name'], {}), '(tgz_name)\n', (288, 298), False, 'import os\n'), ((309, 339), 'tarfile.open', 'tarfile.open', (['tgz_name', '"""x:gz"""'], {}), "(tgz_name... |
# Copyright The OpenTelemetry 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 agreed to in ... | [
"opentelemetry.sdk._metrics.measurement_consumer.SynchronousMeasurementConsumer",
"unittest.mock.patch",
"opentelemetry.sdk._metrics.MeterProvider",
"unittest.mock.Mock"
] | [((1027, 1093), 'unittest.mock.patch', 'patch', (['"""opentelemetry.sdk._metrics.SynchronousMeasurementConsumer"""'], {}), "('opentelemetry.sdk._metrics.SynchronousMeasurementConsumer')\n", (1032, 1093), False, 'from unittest.mock import Mock, patch\n'), ((1277, 1343), 'unittest.mock.patch', 'patch', (['"""opentelemetr... |
import numpy as np
import pandas as pd
import pytest
from sklearn.base import is_classifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import OneHotEncoder
from sklearndf.classification import RandomForestClassifierDF
from sklearndf.pipeline import ClassifierPipelineDF
from test.skl... | [
"sklearn.base.is_classifier",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.ensemble.RandomForestClassifier",
"pytest.raises",
"sklearndf.classification.RandomForestClassifierDF"
] | [((848, 871), 'sklearn.base.is_classifier', 'is_classifier', (['cls_p_df'], {}), '(cls_p_df)\n', (861, 871), False, 'from sklearn.base import is_classifier\n'), ((1015, 1039), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (1028, 1039), False, 'import pytest\n'), ((536, 562), 'sklearndf.classif... |
from uuid import uuid4
class Products:
def __init__(self, name, price, description, quantity):
self.__products_id = str(uuid4())
self.__image = None
self.__name = name
self.__price = price
self.__description = description
self.__quantity = quantity
def get_produ... | [
"uuid.uuid4"
] | [((132, 139), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (137, 139), False, 'from uuid import uuid4\n')] |
from yaml.serializer import Serializer as YamlSerializer
from yaml.events import DocumentStartEvent, DocumentEndEvent
# override serialzier class to store data needed
# for extra data on anchor lines
class Serializer(YamlSerializer):
def __init__(self, encoding=None,
explicit_start=None, explicit_end=... | [
"yaml.events.DocumentEndEvent",
"yaml.events.DocumentStartEvent"
] | [((770, 873), 'yaml.events.DocumentStartEvent', 'DocumentStartEvent', ([], {'explicit': 'self.use_explicit_start', 'version': 'self.use_version', 'tags': 'self.use_tags'}), '(explicit=self.use_explicit_start, version=self.\n use_version, tags=self.use_tags)\n', (788, 873), False, 'from yaml.events import DocumentSta... |
import os.path
import shutil
from django.conf import settings
from django.core import management
from django.core.files import File
from django.template import TemplateSyntaxError
from django.template.loader import render_to_string
from django.test import TestCase
from testapp.models import Item
DATA_DIR = os.path.... | [
"testapp.models.Item.objects.get_or_create",
"django.core.management.call_command",
"shutil.copytree",
"testapp.models.Item",
"shutil.rmtree",
"django.template.loader.render_to_string"
] | [((596, 630), 'shutil.rmtree', 'shutil.rmtree', (['settings.MEDIA_ROOT'], {}), '(settings.MEDIA_ROOT)\n', (609, 630), False, 'import shutil\n'), ((731, 737), 'testapp.models.Item', 'Item', ([], {}), '()\n', (735, 737), False, 'from testapp.models import Item\n'), ((1708, 1759), 'testapp.models.Item.objects.get_or_creat... |
#!/usr/bin/python
## File : strip_comments.py
## Created : <2017-08-03>
## Updated: Time-stamp: <2017-08-03 18:12:22>
## Description :
## For a block of string, remove useless stuff
## 1. Remove leading whitespace
## 2. Remove tailing whitespace
## 3. Remove any lines start with #
##
## Sample:
## ... | [
"sys.stdin.read"
] | [((1005, 1021), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1019, 1021), False, 'import os, sys\n')] |
#!/usr/bin/env python
'''
'''
__author__ = 'M@Campbell'
import os
import requests
import json
from cmislib.model import CmisClient
import re
from flask import current_app
class AlfrescoCMIS(object):
def __init__(self):
object.__init__(self)
'''
Set up the config variables.
'''
... | [
"cmislib.model.CmisClient",
"re.split",
"json.dumps",
"os.environ.get"
] | [((1265, 1330), 'cmislib.model.CmisClient', 'CmisClient', (['self.ALFRESCO_URL', 'self.ALFRESCO_UN', 'self.ALFRESCO_PW'], {}), '(self.ALFRESCO_URL, self.ALFRESCO_UN, self.ALFRESCO_PW)\n', (1275, 1330), False, 'from cmislib.model import CmisClient\n'), ((2228, 2293), 'cmislib.model.CmisClient', 'CmisClient', (['self.ALF... |
import os
import sys
import string
import pyfiglet
import random
def save(code):
file = open("combo.txt", 'a')
write_code = code + "\n"
file.write(write_code)
file.close()
os.system("cls")
result = pyfiglet.figlet_format("Discord Combo Maker", font = "slant")
print(result)
print("\n ... | [
"os.system",
"pyfiglet.figlet_format",
"random.choices"
] | [((202, 218), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (211, 218), False, 'import os\n'), ((229, 288), 'pyfiglet.figlet_format', 'pyfiglet.figlet_format', (['"""Discord Combo Maker"""'], {'font': '"""slant"""'}), "('Discord Combo Maker', font='slant')\n", (251, 288), False, 'import pyfiglet\n'), ((95... |
from rest_framework.test import APITestCase
from camphoric import models
class RegisterTests(APITestCase):
def setUp(self):
self.organization = models.Organization.objects.create(name="Test Organization")
def test_dataSchema(self):
event = models.Event.objects.create(
organizatio... | [
"camphoric.models.Event.objects.create",
"camphoric.models.Organization.objects.create"
] | [((159, 219), 'camphoric.models.Organization.objects.create', 'models.Organization.objects.create', ([], {'name': '"""Test Organization"""'}), "(name='Test Organization')\n", (193, 219), False, 'from camphoric import models\n'), ((268, 578), 'camphoric.models.Event.objects.create', 'models.Event.objects.create', ([], {... |
import logging
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s: %(message)s',
level=logging.INFO) | [
"logging.basicConfig"
] | [((17, 119), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(name)s %(levelname)s: %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s %(name)s %(levelname)s: %(message)s', level=logging.INFO)\n", (36, 119), False, 'import logging\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# import python libs
import re
import json
import argparse
import json
import random
from os import listdir
from os.path import isfile, join
from pprint import pprint as pp
from collections import deque
# import project libs
import create_annotated_corpus
# defining g... | [
"os.listdir",
"collections.deque",
"random.shuffle",
"create_annotated_corpus.maximum_chunk_length",
"random.choice",
"json.dumps",
"os.path.join",
"create_annotated_corpus.earliest_chunk_start_index",
"json.JSONDecoder"
] | [((10011, 10031), 'json.dumps', 'json.dumps', (['document'], {}), '(document)\n', (10021, 10031), False, 'import json\n'), ((1416, 1429), 'os.listdir', 'listdir', (['path'], {}), '(path)\n', (1423, 1429), False, 'from os import listdir\n'), ((3816, 3853), 'random.shuffle', 'random.shuffle', (['annotation_class_list'], ... |
from viewstate import ViewState
from src import config
import requests_html
from datetime import datetime, timedelta
import re
base_url = "https://appiris.infofer.ro/MyTrainRO.aspx?tren={}"
def get_station_id_by_name(name):
if name in config.global_station_list:
return config.global_station_list[name]
... | [
"viewstate.ViewState",
"datetime.datetime.strptime",
"datetime.timedelta",
"requests_html.HTMLSession",
"datetime.datetime.timestamp",
"re.findall"
] | [((7951, 7978), 'requests_html.HTMLSession', 'requests_html.HTMLSession', ([], {}), '()\n', (7976, 7978), False, 'import requests_html\n'), ((8139, 8161), 'viewstate.ViewState', 'ViewState', (['state_value'], {}), '(state_value)\n', (8148, 8161), False, 'from viewstate import ViewState\n'), ((726, 776), 're.findall', '... |
import turtle
wn = turtle.Screen() # Turtle screen
print("#Creates a playground for turtle. Not must?")
tess=turtle.Turtle() # Turtle assigned variables
alex=turtle.Turtle() # Turtle assigned variables
alex.speed(1)
alex.pen()
alex.pendown()
alex.hideturtle()
alex.left(60)
alex.forward(100)
ale... | [
"turtle.Screen",
"turtle.Turtle"
] | [((22, 37), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (35, 37), False, 'import turtle\n'), ((116, 131), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (129, 131), False, 'import turtle\n'), ((169, 184), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (182, 184), False, 'import turtle\n')] |
from librosa import cqt, icqt
import numpy as np
def gl_cqt(S, n_iter=32, sr=22050, hop_length=512, bins_per_octave=12, fmin=None, window='hann',
dtype=np.float32, length=None, momentum=0.99, random_state=None, res_type='kaiser_fast'):
if fmin is None:
fmin = librosa.note_to_hz('C1')
... | [
"numpy.abs",
"librosa.cqt",
"numpy.random.RandomState",
"librosa.icqt"
] | [((1807, 1956), 'librosa.icqt', 'icqt', (['(S * angles)'], {'sr': 'sr', 'hop_length': 'hop_length', 'bins_per_octave': 'bins_per_octave', 'fmin': 'fmin', 'window': 'window', 'length': 'length', 'res_type': 'res_type'}), '(S * angles, sr=sr, hop_length=hop_length, bins_per_octave=\n bins_per_octave, fmin=fmin, window... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^circuitos/$', views.circuitos, name='circuitos'),
url(r'^circuitos/(?P<circuito_id>[0-9]+)/$', views.circuito_detail,
name='circuito_detail'),
url(r'^grandes_premios/$', views.gra... | [
"django.conf.urls.url"
] | [((75, 111), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (78, 111), False, 'from django.conf.urls import url\n'), ((118, 172), 'django.conf.urls.url', 'url', (['"""^circuitos/$"""', 'views.circuitos'], {'name': '"""circuitos"""'}), "('^ci... |
import logging
import pandas as pd
logger = logging.getLogger('nodes.data_viz')
def update(client, params):
''' Esta funcao faz extracao de dados no database e salva os dados extraidos
em arquivo csv.
Parameters
----------
client : class
parametros de conexao da pipeline.
para... | [
"logging.getLogger",
"pandas.read_sql"
] | [((45, 80), 'logging.getLogger', 'logging.getLogger', (['"""nodes.data_viz"""'], {}), "('nodes.data_viz')\n", (62, 80), False, 'import logging\n'), ((1522, 1557), 'pandas.read_sql', 'pd.read_sql', (['query'], {'con': 'client.conn'}), '(query, con=client.conn)\n', (1533, 1557), True, 'import pandas as pd\n')] |
from civicboom.lib.base import *
from civicboom.model import User, Group, PaymentAccount
from civicboom.model.payment import country_codes
from civicboom.lib.form_validators.validator_factory import build_schema
from civicboom.lib.form_validators.dict_overlay import validate_dict
from civicboom.controllers.paymen... | [
"formencode.validators.Regex",
"formencode.validators.UnicodeString",
"re.compile",
"civicboom.controllers.payment_actions.PaymentActionsController",
"civicboom.model.PaymentAccount",
"civicboom.model.payment.country_codes.keys",
"formencode.validators.OneOf"
] | [((392, 418), 'civicboom.controllers.payment_actions.PaymentActionsController', 'PaymentActionsController', ([], {}), '()\n', (416, 418), False, 'from civicboom.controllers.payment_actions import PaymentActionsController\n'), ((892, 1489), 're.compile', 're.compile', (['"""^(((EE|EL|DE|PT)([0-9]{9}))|((FI|HU|LU|MT|SI)(... |
from PyQt5.QtWidgets import (QPushButton, QLabel, QFileDialog,
QComboBox, QWizard, QWizardPage, QLineEdit,
QVBoxLayout, QApplication, QHBoxLayout)
from ..services.actions import Call
from ..func import get_pattern
from ..statics import NODECNAMES, EDGECNAMES
#... | [
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QFileDialog.Options"
] | [((2189, 2220), 'PyQt5.QtWidgets.QPushButton', 'QPushButton', (['"""Import Node List"""'], {}), "('Import Node List')\n", (2200, 2220), False, 'from PyQt5.QtWidgets import QPushButton, QLabel, QFileDialog, QComboBox, QWizard, QWizardPage, QLineEdit, QVBoxLayout, QApplication, QHBoxLayout\n'), ((2246, 2254), 'PyQt5.QtWi... |
import sys
import os
from quart import Quart, Response, jsonify, request, exceptions
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from common import MemoryRepo # noqa
repo = MemoryRepo()
repo.add_fixtures()
app = Quart(__name__)
# returns json on errors rather than html
class JsonException(exceptions.HTTP... | [
"quart.jsonify",
"os.path.join",
"quart.Response",
"quart.request.get_json",
"common.MemoryRepo",
"quart.Quart"
] | [((185, 197), 'common.MemoryRepo', 'MemoryRepo', ([], {}), '()\n', (195, 197), False, 'from common import MemoryRepo\n'), ((225, 240), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'from quart import Quart, Response, jsonify, request, exceptions\n'), ((106, 137), 'os.path.join', 'os.pat... |
# Generated by Django 3.2.2 on 2021-05-09 15:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('application', '0019_alter_member_telegram_username'),
]
operations = [
migrations.RemoveField(
model_name='member',
... | [
"django.db.models.DateTimeField",
"django.db.migrations.RemoveField",
"django.db.models.BooleanField"
] | [((251, 313), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""member"""', 'name': '"""is_warning"""'}), "(model_name='member', name='is_warning')\n", (273, 313), False, 'from django.db import migrations, models\n'), ((474, 505), 'django.db.models.DateTimeField', 'models.DateTimeFie... |
import sys
sys.path.append('C:/Python37/Lib/site-packages')
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import random
from pyOpenBCI import OpenBCICyton
import threading
import time
import numpy as np
from scipy import signal
import random
import numpy as np
from PIL import Image
im... | [
"pyOpenBCI.OpenBCICyton",
"PIL.Image.open",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"numpy.average",
"numpy.fft.fftfreq",
"numpy.nditer",
"pyqtgraph.ImageItem",
"scipy.signal.butter",
"numpy.fft.fft",
"numpy.array",
"pyqtgraph.Qt.QtGui.QApplication",
"scipy.signal.lfilter",
"numpy.std",
... | [((12, 60), 'sys.path.append', 'sys.path.append', (['"""C:/Python37/Lib/site-packages"""'], {}), "('C:/Python37/Lib/site-packages')\n", (27, 60), False, 'import sys\n'), ((373, 386), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (381, 386), True, 'import numpy as np\n'), ((447, 461), 'numpy.array', 'np.array', (... |
"""integration_code_unique_false
Revision ID: 3b88f8ca0cb7
Revises: <KEY>
Create Date: 2021-02-24 22:56:55.068279
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### c... | [
"alembic.op.f",
"alembic.op.create_index",
"alembic.op.drop_index"
] | [((379, 488), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_Integration_DataIntegration_Code"""'], {'table_name': '"""DataIntegration"""', 'schema': '"""Integration"""'}), "('ix_Integration_DataIntegration_Code', table_name=\n 'DataIntegration', schema='Integration')\n", (392, 488), False, 'from alembic import ... |
"""Code specifically used by Jinja for rendering HTML
from Jinja templates.
"""
# TODO: move all the model stuff that's templating into here
import re
import os
import copy
import datetime
import base64
from urllib.parse import urlparse
from typing import Tuple
from flask import request
from bs4 import BeautifulSoup... | [
"re.search",
"os.path.exists",
"markdown.Markdown",
"urllib.parse.urlparse",
"os.makedirs",
"re.compile",
"datetime.datetime.utcnow",
"scrypt.hash",
"markdown.extensions.smarty.SmartyExtension",
"os.path.join",
"mdx_unimoji.UnimojiExtension",
"bs4.BeautifulSoup",
"flask.request.cookies.get",... | [((1626, 1663), 'bs4.BeautifulSoup', 'BeautifulSoup', (['message', '"""html.parser"""'], {}), "(message, 'html.parser')\n", (1639, 1663), False, 'from bs4 import BeautifulSoup\n'), ((1686, 1707), 're.compile', 're.compile', (['"""@(\\\\d+)"""'], {}), "('@(\\\\d+)')\n", (1696, 1707), False, 'import re\n'), ((3454, 3501)... |
# [1차]프렌츠4블록
import numpy as np
def new_borad(m, n, board):
remove = np.array([[True for _ in range(m)] for _ in range(n)])
count = 0
for i in range(n - 1):
for j in range(m - 1):
cur = board[i,j]
if cur == "-1":
break
if cur == board[i,j+1] and ... | [
"numpy.array",
"numpy.transpose"
] | [((915, 930), 'numpy.transpose', 'np.transpose', (['b'], {}), '(b)\n', (927, 930), True, 'import numpy as np\n'), ((1101, 1116), 'numpy.array', 'np.array', (['new_b'], {}), '(new_b)\n', (1109, 1116), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
# coding:utf-8
from helper import ListNode
class Solution:
def __init__(self):
self.acceptStack = []
self.outputStack = []
def push(self, node):
self.acceptStack.append(node)
def pop(self):
if self.outputStack == []:
while self.acceptSt... | [
"helper.ListNode"
] | [((543, 554), 'helper.ListNode', 'ListNode', (['(1)'], {}), '(1)\n', (551, 554), False, 'from helper import ListNode\n'), ((564, 575), 'helper.ListNode', 'ListNode', (['(2)'], {}), '(2)\n', (572, 575), False, 'from helper import ListNode\n'), ((585, 596), 'helper.ListNode', 'ListNode', (['(3)'], {}), '(3)\n', (593, 596... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 with... | [
"random.choice",
"Algorithms.sway_sampler.cont_dominate",
"gmpy2.mpz",
"Algorithms.sway_sampler.sway",
"warnings.filterwarnings"
] | [((1443, 1461), 'random.choice', 'random.choice', (['pop'], {}), '(pop)\n', (1456, 1461), False, 'import random\n'), ((2598, 2631), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (2621, 2631), False, 'import warnings\n'), ((2643, 2695), 'Algorithms.sway_sampler.sway', 'swa... |
__author__ = 'Veronica'
from random import randint
header = [0xeb, 0x95, 0x4, 0xfa, 0x0, 0x0, 0x0, 0x0, 0x0]
def checksum(frame):
return 0xFF - (sum(frame[4:]) & 0xFF)
def acknowledge():
ack = [0xeb, 0x95, 0x3, 0x0, 0x55, 0xAA]
#ack.append(checksum(ack))
return ack
def housekeeping(n, t):
n_Vp ... | [
"random.randint"
] | [((1338, 1351), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (1345, 1351), False, 'from random import randint\n'), ((1558, 1571), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (1565, 1571), False, 'from random import randint\n'), ((1823, 1836), 'random.randint', 'randint', (['(1)', '(... |
import math
import numpy
def hill_chart_parametrisation(h, turbine_specs):
"""
Calculates power and flow rate through bulb turbines based on Aggidis and Feather (2012)
f_g = grid frequency, g_p = generator poles,
t_cap = Turbine capacity, h = head difference, dens = water density
"""
turb_sp ... | [
"math.sqrt",
"numpy.sign"
] | [((484, 496), 'math.sqrt', 'math.sqrt', (['h'], {}), '(h)\n', (493, 496), False, 'import math\n'), ((631, 643), 'math.sqrt', 'math.sqrt', (['h'], {}), '(h)\n', (640, 643), False, 'import math\n'), ((1346, 1383), 'math.sqrt', 'math.sqrt', (["(2 * turbine_specs['g'] * h)"], {}), "(2 * turbine_specs['g'] * h)\n", (1355, 1... |
# Copyright (c) 2011, <NAME> [see LICENSE.txt]
# This software is funded in part by NIH Grant P20 RR016454.
import unittest
import warnings
import os
import math
from random import shuffle, random
from collections import Counter,OrderedDict
from dictset import DictSet,_rep_generator
from math import isnan, isinf, fl... | [
"unittest.makeSuite",
"unittest.TextTestRunner",
"pyvttbl.DataFrame"
] | [((5018, 5043), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (5041, 5043), False, 'import unittest\n'), ((3730, 3741), 'pyvttbl.DataFrame', 'DataFrame', ([], {}), '()\n', (3739, 3741), False, 'from pyvttbl import DataFrame\n'), ((4890, 4927), 'unittest.makeSuite', 'unittest.makeSuite', (['Tes... |
""" Contains TaskState class """
from tasksupervisor.endpoint.fiware_orion.entities.entity import FiwareEntity
from tasksupervisor.endpoint.fiware_orion.entities.task import Task
class TaskState(FiwareEntity):
""" Represents the current state of the Task """
def __init__(self, _task):
if not isinstanc... | [
"tasksupervisor.endpoint.fiware_orion.entities.entity.FiwareEntity.__init__"
] | [((389, 429), 'tasksupervisor.endpoint.fiware_orion.entities.entity.FiwareEntity.__init__', 'FiwareEntity.__init__', (['self'], {'id': '_task.id'}), '(self, id=_task.id)\n', (410, 429), False, 'from tasksupervisor.endpoint.fiware_orion.entities.entity import FiwareEntity\n')] |
# standard library imports
import io
import logging
import struct
import warnings
# 3rd party library imports
import numpy as np
from uuid import UUID
# local imports
from glymur import Jp2k
from .lib import tiff as libtiff
from .jp2box import UUIDBox
# Map the numeric TIFF datatypes to the format string used by th... | [
"logging.getLogger",
"numpy.ceil",
"logging.StreamHandler",
"uuid.UUID",
"numpy.flipud",
"glymur.Jp2k",
"io.BytesIO",
"struct.pack",
"numpy.zeros",
"struct.unpack",
"warnings.warn"
] | [((1982, 2011), 'logging.getLogger', 'logging.getLogger', (['"""tiff2jp2"""'], {}), "('tiff2jp2')\n", (1999, 2011), False, 'import logging\n'), ((2065, 2088), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (2086, 2088), False, 'import logging\n'), ((2672, 2684), 'io.BytesIO', 'io.BytesIO', ([], {})... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from mr_database import DataTypes
from mr_database import Table
from mr_database import Column
class TableTemplate(Table):
id = Column(DataTypes.integer, pk=True)
myCol = Column(DataTypes.varchar(16), default='Hello World')
class BrokenTable(Table):
id = Col... | [
"mr_database.DataTypes.char",
"mr_database.DataTypes.varchar",
"mr_database.Column"
] | [((179, 213), 'mr_database.Column', 'Column', (['DataTypes.integer'], {'pk': '(True)'}), '(DataTypes.integer, pk=True)\n', (185, 213), False, 'from mr_database import Column\n'), ((317, 351), 'mr_database.Column', 'Column', (['DataTypes.integer'], {'pk': '(True)'}), '(DataTypes.integer, pk=True)\n', (323, 351), False, ... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from config_settings import Args
# %load_ext autoreload
# %autoreload 2
args=Args()
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print("device=",device)
def hidden_init(layer):
fan_in = layer.weight.d... | [
"torch.manual_seed",
"numpy.sqrt",
"config_settings.Args",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.cat"
] | [((165, 171), 'config_settings.Args', 'Args', ([], {}), '()\n', (169, 171), False, 'from config_settings import Args\n'), ((206, 231), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (229, 231), False, 'import torch\n'), ((349, 364), 'numpy.sqrt', 'np.sqrt', (['fan_in'], {}), '(fan_in)\n', (356,... |
"""Constants for the DLNA DMR component."""
import logging
from typing import Final
LOGGER = logging.getLogger(__package__)
DOMAIN: Final = "dlna_dmr"
CONF_LISTEN_PORT: Final = "listen_port"
CONF_CALLBACK_URL_OVERRIDE: Final = "callback_url_override"
CONF_POLL_AVAILABILITY: Final = "poll_availability"
DEFAULT_NAME... | [
"logging.getLogger"
] | [((95, 125), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (112, 125), False, 'import logging\n')] |
#!/usr/bin/python
import unittest
import db
import system
import accessrules
import json
class TestAccessRules(unittest.TestCase):
def createMock(self):
mdb = db.MemoryDB()
obj = system.System()
obj.setDB(mdb)
return accessrules.AccessRules(obj)
def testAdminUser(self):
... | [
"unittest.main",
"accessrules.AccessRules",
"system.System",
"db.MemoryDB"
] | [((5858, 5873), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5871, 5873), False, 'import unittest\n'), ((174, 187), 'db.MemoryDB', 'db.MemoryDB', ([], {}), '()\n', (185, 187), False, 'import db\n'), ((202, 217), 'system.System', 'system.System', ([], {}), '()\n', (215, 217), False, 'import system\n'), ((256, 28... |
# -*- coding: utf-8 -*-
"""
General description
-------------------
These are supplementary routines used in the power market model POMMES.
Installation requirements
-------------------------
Python version >= 3.8
@author: <NAME>, <NAME>
"""
import math
from datetime import datetime
import pandas as pd
def days_be... | [
"datetime.datetime.strptime",
"math.floor"
] | [((623, 665), 'datetime.datetime.strptime', 'datetime.strptime', (['d1', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(d1, '%Y-%m-%d %H:%M:%S')\n", (640, 665), False, 'from datetime import datetime\n'), ((675, 717), 'datetime.datetime.strptime', 'datetime.strptime', (['d2', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(d2, '%Y-%m-%d %H:%M:%... |
from itertools import chain
from burrito.cmdsprovider import CmdsProvider
from burrito.utils import reply_to_user
class HelpCommands(CmdsProvider):
def __init__(self):
self.cmds = {'commands': {'function': self.cmd_list,
'aliases': ['comms', ],
... | [
"burrito.cmdsprovider.CmdsProvider.get_plugins",
"burrito.utils.reply_to_user"
] | [((820, 846), 'burrito.cmdsprovider.CmdsProvider.get_plugins', 'CmdsProvider.get_plugins', ([], {}), '()\n', (844, 846), False, 'from burrito.cmdsprovider import CmdsProvider\n'), ((995, 1020), 'burrito.utils.reply_to_user', 'reply_to_user', (['data', 'cmds'], {}), '(data, cmds)\n', (1008, 1020), False, 'from burrito.u... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
Licensed under the terms of the MIT License
https://github.com/luchko/QCodeEditor
@author: <NAME> (<EMAIL>)
Python Highlighting added by:
https://github.com/unihernandez22/QCodeEditor
@author: unihernandez22
Adapted to Binary Ninja by:
@author: <NAME> (https://github... | [
"binaryninjaui.getThemeColor",
"PySide2.QtGui.QFont",
"PySide2.QtWidgets.QPlainTextEdit.resizeEvent",
"PySide2.QtGui.QPainter",
"PySide2.QtWidgets.QTextEdit.ExtraSelection",
"PySide2.QtWidgets.QWidget.paintEvent",
"PySide2.QtGui.QTextCharFormat",
"PySide2.QtWidgets.QWidget.__init__",
"PySide2.QtCore... | [((1107, 1124), 'PySide2.QtGui.QTextCharFormat', 'QTextCharFormat', ([], {}), '()\n', (1122, 1124), False, 'from PySide2.QtGui import QPainter, QFont, QSyntaxHighlighter, QTextFormat, QTextCharFormat\n'), ((1686, 1740), 'binaryninjaui.getThemeColor', 'getThemeColor', (['ThemeColor.BackgroundHighlightDarkColor'], {}), '... |
from math import sqrt
from numpy import arange
from universal_constants import MARS_RADIUS
from universal_functions import mars_density
class Simulation:
@property
def xs(self):
return [v.x for v in self.ps]
@property
def ys(self):
return [v.y for v in self.ps]
@property
def... | [
"csv.writer",
"universal_functions.mars_density",
"numpy.arange"
] | [((871, 890), 'numpy.arange', 'arange', (['(0)', 'time', 'dt'], {}), '(0, time, dt)\n', (877, 890), False, 'from numpy import arange\n'), ((2073, 2092), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (2083, 2092), False, 'import csv\n'), ((3587, 3606), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csv... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
from collections import deque
# Import configuration parameters
import config as cfg
# Define a class to receive the characteristics of each line detection
class Line:
def __init__(self, buf_len = 5):
# x values of the last n fits of the line
... | [
"cv2.rectangle",
"numpy.dstack",
"numpy.mean",
"numpy.abs",
"collections.deque",
"numpy.polyfit",
"numpy.hstack",
"numpy.zeros_like",
"numpy.argmax",
"numpy.max",
"numpy.sum",
"numpy.array",
"numpy.linspace",
"cv2.addWeighted",
"numpy.vstack",
"numpy.concatenate",
"numpy.int_",
"nu... | [((917, 979), 'numpy.sum', 'np.sum', (['binary_warped[binary_warped.shape[0] // 2:, :]'], {'axis': '(0)'}), '(binary_warped[binary_warped.shape[0] // 2:, :], axis=0)\n', (923, 979), True, 'import numpy as np\n'), ((1059, 1115), 'numpy.dstack', 'np.dstack', (['(binary_warped, binary_warped, binary_warped)'], {}), '((bin... |
"""
Utility used to extract information from the source code of `./models.py`
for the "Database" section of the Sami Paper.
The processed document is output in the local file `models.md`.
"""
from pathlib import Path
from models import all_models
from numpydoc.docscrape import ClassDoc
output_file = Path(__file__).pa... | [
"numpydoc.docscrape.ClassDoc",
"pathlib.Path"
] | [((555, 570), 'numpydoc.docscrape.ClassDoc', 'ClassDoc', (['model'], {}), '(model)\n', (563, 570), False, 'from numpydoc.docscrape import ClassDoc\n'), ((303, 317), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (307, 317), False, 'from pathlib import Path\n')] |
# Spell checker support
try:
import enchant
except ImportError:
enchant = None
pre_processing = {r"\binclude\b": (),
r"\bdefine\b": (r"\b-DFLEXIBLE\b", r"\b-DPOSRES\b")}
run_control = {r"\bintegrator\b": (r"\bmd\b", r"\bmd-vv\b",
"\bmd-vv-avek\b", r"\bsd\b"... | [
"enchant.pypwl.PyPWL"
] | [((10494, 10515), 'enchant.pypwl.PyPWL', 'enchant.pypwl.PyPWL', ([], {}), '()\n', (10513, 10515), False, 'import enchant\n')] |
import Image
import os, sys
from glob import glob
top_folder = sys.argv[1]
size = 256, 256
input_image_dir = top_folder + '/jpg'
output_image_dir = top_folder + '/thumbnails'
if not os.path.isdir(output_image_dir):
os.mkdir(output_image_dir)
for infile in glob(input_image_dir + '/*.jpg'):
filename, ext = o... | [
"os.path.splitext",
"Image.open",
"os.path.isdir",
"os.mkdir",
"os.path.basename",
"glob.glob"
] | [((265, 297), 'glob.glob', 'glob', (["(input_image_dir + '/*.jpg')"], {}), "(input_image_dir + '/*.jpg')\n", (269, 297), False, 'from glob import glob\n'), ((186, 217), 'os.path.isdir', 'os.path.isdir', (['output_image_dir'], {}), '(output_image_dir)\n', (199, 217), False, 'import os, sys\n'), ((223, 249), 'os.mkdir', ... |
import os
import webapp2
import jinja2
from google.appengine.api import users
import logging
#Jinja Loader
template_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.getcwd()))
class HeaderHandler(webapp2.RequestHandler):
def get(self):
template = template_env.get_template('templates/dynamic/... | [
"webapp2.WSGIApplication",
"os.getcwd"
] | [((885, 1050), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/navigation/header', HeaderHandler), ('/navigation/sidebar',\n SideBarHandler), ('/navigation/footer', FooterHandler)]"], {'debug': '(True)'}), "([('/navigation/header', HeaderHandler), (\n '/navigation/sidebar', SideBarHandler), ('/naviga... |
import pdb
import os
import torch
import tqdm
import argparse
import sys
sys.path.append('../utils/')
sys.path.append('../models/')
from torch.utils.data import DataLoader
from distances.euclidean import euclidean_distance
from distances.mahalanobis import mahalanobis_distance
from distances.kullback_leibler import k... | [
"dataloader.OmniglotLoader",
"argparse.ArgumentParser",
"dataloader.MiniImageNetLoader",
"preprocess.preprocess",
"torch.no_grad",
"sys.path.append",
"prototypical.ProtoNet"
] | [((74, 102), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (89, 102), False, 'import sys\n'), ((103, 132), 'sys.path.append', 'sys.path.append', (['"""../models/"""'], {}), "('../models/')\n", (118, 132), False, 'import sys\n'), ((687, 712), 'argparse.ArgumentParser', 'argparse.Arg... |
import base64
import flask
from marshmallow import ValidationError
import sqlalchemy as sa
from . import meta
from .exceptions import ApiError
from .utils import if_none, iter_validation_errors
# -----------------------------------------------------------------------------
class PaginationBase(object):
def get... | [
"flask.request.args.get",
"sqlalchemy.and_",
"base64.urlsafe_b64decode",
"base64.urlsafe_b64encode"
] | [((1680, 1718), 'flask.request.args.get', 'flask.request.args.get', (['self.limit_arg'], {}), '(self.limit_arg)\n', (1702, 1718), False, 'import flask\n'), ((2999, 3038), 'flask.request.args.get', 'flask.request.args.get', (['self.offset_arg'], {}), '(self.offset_arg)\n', (3021, 3038), False, 'import flask\n'), ((4112,... |
import yaml
import sys
from os import path
import tempfile
from subprocess import check_output
from os import listdir
from os.path import isfile, join
from shutil import copyfile
import json
import logging
global LOGGER
MANDATORY_GENERAL_PARAMETERS = [
'pr-name',
'branch-name',
'commit-message',
'git-add',
'play... | [
"logging.getLogger",
"os.path.exists",
"subprocess.check_output",
"logging.StreamHandler",
"os.listdir",
"logging.Formatter",
"json.dumps",
"os.path.join",
"yaml.load",
"shutil.copyfile",
"logging.FileHandler",
"tempfile.mkdtemp"
] | [((405, 437), 'logging.getLogger', 'logging.getLogger', (['"""git-manager"""'], {}), "('git-manager')\n", (422, 437), False, 'import logging\n'), ((530, 569), 'logging.FileHandler', 'logging.FileHandler', (['"""git-manager.logs"""'], {}), "('git-manager.logs')\n", (549, 569), False, 'import logging\n'), ((654, 677), 'l... |
from psycopg2 import sql
from django.core.management.base import CommandError
from django.db import connections
from psycopg2_extension.base_command import PsycopgBaseCommand
from psycopg2_extension.utils import init_database, comma_separated_strings
class Command(PsycopgBaseCommand):
help = 'Initialize the dat... | [
"psycopg2_extension.utils.init_database",
"psycopg2.sql.Identifier",
"django.core.management.base.CommandError",
"psycopg2.sql.SQL"
] | [((2555, 2620), 'psycopg2_extension.utils.init_database', 'init_database', (['connection', 'self.stdout.write', 'connection_settings'], {}), '(connection, self.stdout.write, connection_settings)\n', (2568, 2620), False, 'from psycopg2_extension.utils import init_database, comma_separated_strings\n'), ((1609, 1653), 'dj... |
import utils
from os import listdir
from os.path import join
import datetime as dt
import copy
def parse(historical_crypto_prices, holdings, ticker_info, dividends):
all_data_files = [f for f in listdir('Data/CoinbasePro')]
files = [f for f in all_data_files if f.startswith("coinbase")]
for f in files:
... | [
"os.listdir",
"os.path.join",
"utils.removeCommasWithinQuotes",
"utils.addCryptoTicker",
"utils.getCryptoAssetPrice"
] | [((200, 227), 'os.listdir', 'listdir', (['"""Data/CoinbasePro"""'], {}), "('Data/CoinbasePro')\n", (207, 227), False, 'from os import listdir\n'), ((486, 522), 'utils.removeCommasWithinQuotes', 'utils.removeCommasWithinQuotes', (['line'], {}), '(line)\n', (516, 522), False, 'import utils\n'), ((1184, 1249), 'utils.getC... |
# The following example creates a CodeArtifact domain named my-domain to store repositories. It also creates two CodeArtifact repositories: my-repo and my-upstream-repo within the domain. my-repo has my-upstream-repo configured as an upstream repository, and my-upstream-repo has an external connection to the public rep... | [
"aws_cdk.aws_codeartifact.CfnRepository",
"aws_cdk.aws_codeartifact.CfnDomain"
] | [((1110, 1180), 'aws_cdk.aws_codeartifact.CfnDomain', 'codeartifact.CfnDomain', (['self', '"""myDomain"""'], {'domain_name': '"""thisismydomain"""'}), "(self, 'myDomain', domain_name='thisismydomain')\n", (1132, 1180), True, 'from aws_cdk import core as cdk, aws_codeartifact as codeartifact\n'), ((1241, 1407), 'aws_cdk... |
import traceback
from flask import abort
from flask_login import current_user
from ims import db
from ims.service.mappers.comUserMapper import selectComUser as __getUser
from ims.service.mappers.travelExpensesMapper import selectTraTravelExpensesList as __getList
from ims.service.mappers.travelExpensesMapper import s... | [
"ims.service.mappers.travelExpensesMapper.selectTraTravelExpensesList",
"ims.service.mappers.comUserMapper.selectComUser",
"ims.db.session.commit",
"ims.service.mappers.travelExpensesMapper.selectTraTravelExpensesDetails",
"ims.db.session.close",
"ims.service.mappers.travelExpensesMapper.deleteTraTravelEx... | [((740, 770), 'ims.service.mappers.travelExpensesMapper.selectTraTravelExpensesList', '__getList', (['userId', 'year', 'month'], {}), '(userId, year, month)\n', (749, 770), True, 'from ims.service.mappers.travelExpensesMapper import selectTraTravelExpensesList as __getList\n'), ((978, 994), 'ims.service.mappers.travelE... |
#!/hive/groups/recon/local/bin/python
# Requires Python 2.6, current default python on hgwdev is 2.4
"""CGI script that outputs the ENCODE status based upon a specified
field.
"""
import cgi, cgitb
import datetime
import json
import sys
# Import local modules found in "/hive/groups/encode/dcc/charts"
sys.path.append... | [
"gviz_api.DataTable",
"encodeReportLib.getRecentReport",
"encodeReportLib.parseFreezeLabel",
"cgi.FieldStorage",
"sys.exit",
"json.dumps",
"encodeReportLib.renderHtml",
"encodeReportLib.dateIntToDateStr",
"cgitb.enable",
"sys.path.append"
] | [((305, 354), 'sys.path.append', 'sys.path.append', (['"""/hive/groups/encode/dcc/charts"""'], {}), "('/hive/groups/encode/dcc/charts')\n", (320, 354), False, 'import sys\n'), ((465, 479), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (477, 479), False, 'import cgi, cgitb\n'), ((1958, 1976), 'cgi.FieldStorage', 'cg... |
# -*- coding: utf-8 -*-
"""
...
"""
import LibraryTT.txt2array as conversion
import numpy as np
from numpy import sqrt
import pandas as pd
import matplotlib.pyplot as plt
import random
import math
from mpl_toolkits.mplot3d import Axes3D
# import open3d as o3d
# %matplotlib inline
D = conversion.txt2... | [
"numpy.copy",
"LibraryTT.txt2array.usar",
"LibraryTT.txt2array.imprimir3D",
"LibraryTT.txt2array.centros",
"numpy.delete",
"LibraryTT.txt2array.imprimirObjetos",
"math.degrees",
"numpy.append",
"numpy.array",
"math.atan2",
"LibraryTT.txt2array.rnsc",
"LibraryTT.txt2array.RObjetos",
"LibraryT... | [((305, 327), 'LibraryTT.txt2array.txt2array', 'conversion.txt2array', ([], {}), '()\n', (325, 327), True, 'import LibraryTT.txt2array as conversion\n'), ((336, 346), 'numpy.copy', 'np.copy', (['D'], {}), '(D)\n', (343, 346), True, 'import numpy as np\n'), ((486, 526), 'LibraryTT.txt2array.RObjetos', 'conversion.RObjet... |
import sys
import os
import numpy as np
import pandas as pd
from Globals import *
#-------- Create directories ------------
os.makedirs(dir_data,exist_ok=True)
os.makedirs(dir_chain,exist_ok=True)
os.makedirs(dir_plots,exist_ok=True)
os.makedirs(dir_outs,exist_ok=True)
#------------- Load data -----------------------... | [
"numpy.repeat",
"os.makedirs",
"pandas.read_csv",
"numpy.where",
"numpy.floor",
"numpy.isnan",
"numpy.isfinite",
"numpy.concatenate"
] | [((125, 161), 'os.makedirs', 'os.makedirs', (['dir_data'], {'exist_ok': '(True)'}), '(dir_data, exist_ok=True)\n', (136, 161), False, 'import os\n'), ((161, 198), 'os.makedirs', 'os.makedirs', (['dir_chain'], {'exist_ok': '(True)'}), '(dir_chain, exist_ok=True)\n', (172, 198), False, 'import os\n'), ((198, 235), 'os.ma... |
from estimator_adaptative import EstimatorAdaptative
from mpl_toolkits.mplot3d import Axes3D
from grid_search import GridSearch
from sklearn import metrics
import matplotlib.pyplot as plt
import matplotlib as mpl
from utils import *
import numpy as np
import os
import sys
data_path = '../../databases'
PlotsDirectory =... | [
"os.path.exists",
"matplotlib.pyplot.savefig",
"estimator_adaptative.EstimatorAdaptative",
"os.makedirs",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure"
] | [((353, 383), 'os.path.exists', 'os.path.exists', (['PlotsDirectory'], {}), '(PlotsDirectory)\n', (367, 383), False, 'import os\n'), ((389, 416), 'os.makedirs', 'os.makedirs', (['PlotsDirectory'], {}), '(PlotsDirectory)\n', (400, 416), False, 'import os\n'), ((501, 523), 'numpy.array', 'np.array', (['[1050, 1200]'], {}... |
"""
Links content subjects together.
"""
import re
from django.core.management.base import BaseCommand, CommandError
from croftair.models import Subject
class Command(BaseCommand):
"""
Command class.
"""
def handle(self, *args, **kwargs):
"""
Handler method.
"""
for... | [
"croftair.models.Subject.objects.exclude",
"croftair.models.Subject.objects.all"
] | [((332, 353), 'croftair.models.Subject.objects.all', 'Subject.objects.all', ([], {}), '()\n', (351, 353), False, 'from croftair.models import Subject\n'), ((433, 471), 'croftair.models.Subject.objects.exclude', 'Subject.objects.exclude', ([], {'pk': 'subject.pk'}), '(pk=subject.pk)\n', (456, 471), False, 'from croftair... |
#!/usr/bin
# -*- coding: utf-8 -*-
"""
DelftStack Python Tkinter Tutorial
Author: <NAME>
URL: https://www.delftstack.com/tutorial/tkinter-tutorial/tkinter-button/
Website: https://www.delftstack.com
"""
from sys import version_info
if version_info.major == 2:
import Tkinter as tk
elif version_info.major == 3:
... | [
"tkinter.Tk",
"functools.partial",
"tkinter.Button"
] | [((394, 401), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (399, 401), True, 'import tkinter as tk\n'), ((417, 441), 'tkinter.Button', 'tk.Button', (['app'], {'text': '"""0"""'}), "(app, text='0')\n", (426, 441), True, 'import tkinter as tk\n'), ((677, 708), 'functools.partial', 'partial', (['change_label_number', '(2)'], ... |
# Generated by Django 2.0.2 on 2018-02-15 19:41
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fiel... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((348, 441), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (364, 441), False, 'from django.db import migrations, models\... |
import math
import unittest
from py_range_parse import parse_range
class ParseTest(unittest.TestCase):
def test_parse_equal_values(self):
parsed_range = parse_range("[-inf..-inf]")
self.assertIn(-math.inf, parsed_range)
def test_parse_spaces(self):
parsed_range = parse_range("[ -8.3... | [
"py_range_parse.parse_range"
] | [((169, 196), 'py_range_parse.parse_range', 'parse_range', (['"""[-inf..-inf]"""'], {}), "('[-inf..-inf]')\n", (180, 196), False, 'from py_range_parse import parse_range\n'), ((301, 333), 'py_range_parse.parse_range', 'parse_range', (['"""[ -8.3 .. +18.3 ]"""'], {}), "('[ -8.3 .. +18.3 ]')\n", (312, 333), False, 'from ... |
import importlib
import ipaddress
classes_cache = {}
instance_cache = {}
def get_class(type:str):
cls = classes_cache.get(type)
if cls:
return cls
raise TypeError(f'wrong type {type}. not subclass of BaseType')
def get_instance(type:str,**option):
key = ','.join('{}={}'.format(k,v) for k, v ... | [
"ipaddress.ip_address"
] | [((1703, 1730), 'ipaddress.ip_address', 'ipaddress.ip_address', (['value'], {}), '(value)\n', (1723, 1730), False, 'import ipaddress\n')] |
import collections
import heapq
from typing import List
class Solution:
def networkDelayTime1(self, times: List[List[int]], N: int, K: int) -> int:
"""
DFS
"""
# build adjacent list
graph = collections.defaultdict(list)
for u, v, w in times:
graph[u]... | [
"heapq.heappop",
"heapq.heappush",
"collections.defaultdict"
] | [((240, 269), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (263, 269), False, 'import collections\n'), ((876, 905), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (899, 905), False, 'import collections\n'), ((1290, 1309), 'heapq.heappop', 'heapq.he... |
#!/usr/bin/env python3
import argparse
import os
import re
import shlex
import subprocess
from collections import defaultdict, namedtuple
######################################################################
# Common actions that may be reused for multiple devices.
#
# Need help? Try these:
# * xinput --help
# * ma... | [
"collections.namedtuple",
"argparse.ArgumentParser",
"re.compile",
"subprocess.run",
"collections.defaultdict",
"shlex.quote"
] | [((18276, 18318), 'collections.namedtuple', 'namedtuple', (['"""XInputDevice"""', '"""type id name"""'], {}), "('XInputDevice', 'type id name')\n", (18286, 18318), False, 'from collections import defaultdict, namedtuple\n'), ((18380, 18483), 're.compile', 're.compile', (['"""^. ↳ (.*[^ ]) *\\\\tid=([0-9]+)\\\\t\\\\[s... |
import hashlib
from os import mkdir, rename
import re
import requests
from bs4 import BeautifulSoup as bs
import pdfkit
from cred import DOWNLOADS
BASE_URL = "https://studente.unimi.it/graduatorie/selezioneCorso/it/"
ENTRY = "P.html"
def find_pdf(data):
ris = []
soup = bs(data, "lxml")
for row in soup... | [
"requests.Session",
"hashlib.md5",
"pdfkit.from_string",
"bs4.BeautifulSoup",
"os.mkdir"
] | [((284, 300), 'bs4.BeautifulSoup', 'bs', (['data', '"""lxml"""'], {}), "(data, 'lxml')\n", (286, 300), True, 'from bs4 import BeautifulSoup as bs\n'), ((478, 494), 'bs4.BeautifulSoup', 'bs', (['data', '"""lxml"""'], {}), "(data, 'lxml')\n", (480, 494), True, 'from bs4 import BeautifulSoup as bs\n'), ((662, 678), 'bs4.B... |
from infi.systray import SysTrayIcon
from traylert.traylert_crypto import encrypt, decrypt
from win10toast import ToastNotifier
import click
import configparser
import json
import jsonpickle
import requests
import time
import os
from pathlib import Path
def fetch_system_info(config, endpoint_override=Fal... | [
"json.loads",
"configparser.ConfigParser",
"click.option",
"win10toast.ToastNotifier",
"jsonpickle.decode",
"requests.get",
"os.path.dirname",
"infi.systray.SysTrayIcon",
"click.command"
] | [((701, 716), 'click.command', 'click.command', ([], {}), '()\n', (714, 716), False, 'import click\n'), ((719, 792), 'click.option', 'click.option', (['"""--config_file"""'], {'default': '(False)', 'help': '"""A configuration .ini"""'}), "('--config_file', default=False, help='A configuration .ini')\n", (731, 792), Fal... |
from django.contrib import messages
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse, reverse_lazy
from django.http.response import HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from django.views.g... | [
"django.http.response.Http404",
"django.shortcuts.get_object_or_404",
"django.core.urlresolvers.reverse_lazy",
"django.core.urlresolvers.reverse"
] | [((1400, 1427), 'django.core.urlresolvers.reverse_lazy', 'reverse_lazy', (['"""groups:list"""'], {}), "('groups:list')\n", (1412, 1427), False, 'from django.core.urlresolvers import reverse, reverse_lazy\n'), ((800, 822), 'django.core.urlresolvers.reverse', 'reverse', (['"""groups:list"""'], {}), "('groups:list')\n", (... |
#!/usr/bin/env python
""" Tests of Larch Scripts """
import unittest
import time
import ast
import numpy as np
import os
from sys import version_info
from utils import TestCase
from larch import Interpreter
class TestScripts(TestCase):
'''tests'''
def test_basic_interp(self):
self.runscript('interp.l... | [
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((658, 679), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (677, 679), False, 'import unittest\n'), ((717, 754), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(13)'}), '(verbosity=13)\n', (740, 754), False, 'import unittest\n')] |
import numpy as np
a = np.arange(15).reshape(3,5)
print(a)
print(a.shape) | [
"numpy.arange"
] | [((23, 36), 'numpy.arange', 'np.arange', (['(15)'], {}), '(15)\n', (32, 36), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
############################################################
## <NAME> ##
## Copyright (C) 2019-2020 Lauro Sumoy Lab, IGTP, Spain ##
############################################################
"""
Get frequence of reads for each type, variant, etc
"""
## ... | [
"random.sample",
"argparse.ArgumentParser",
"numpy.isnan",
"HCGB.functions.main_functions.get_data",
"pandas.DataFrame"
] | [((997, 1336), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""mod_freq.py"""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': '"""\n\nmod_freq.py: Modified given frequencies and select isomiRs\n\nVersion: 0.1\nLicense: GPLv3\n\nUSAGE: python mod_freq.py --freq table.f... |
# -*- coding: utf-8 -*-
"""CUBI+Snakemake wrapper code for applying the filter list.
"""
import gzip
import re
import sys
import textwrap
from snakemake import shell
config = snakemake.config["step_config"]["somatic_variant_filtration"]["filter_sets"]
params = snakemake.params.args
print("DEBUG- params = {}".format(... | [
"textwrap.dedent",
"gzip.open",
"re.compile",
"snakemake.shell.executable",
"sys.exit"
] | [((380, 409), 'snakemake.shell.executable', 'shell.executable', (['"""/bin/bash"""'], {}), "('/bin/bash')\n", (396, 409), False, 'from snakemake import shell\n'), ((419, 523), 're.compile', 're.compile', (['"""^#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER(\tINFO)?(\tFORMAT)?\t([^\t]+)\t([^\t]+)"""'], {}), "(\n '^#CHROM\\... |
import hydra
import os
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
def timeToSeconds(t: str) -> int:
"""
Convert the parsed time string from config.yaml to seconds
Args:
t (str): Supported format "hh:mm:ss"
Returns:
int: Total of seconds
"""
n = [int(x) f... | [
"os.path.isfile",
"moviepy.video.io.ffmpeg_tools.ffmpeg_extract_subclip",
"hydra.main"
] | [((411, 460), 'hydra.main', 'hydra.main', ([], {'config_path': '"""."""', 'config_name': '"""config"""'}), "(config_path='.', config_name='config')\n", (421, 460), False, 'import hydra\n'), ((906, 929), 'os.path.isfile', 'os.path.isfile', (['newName'], {}), '(newName)\n', (920, 929), False, 'import os\n'), ((1200, 1267... |
import argparse
import os
import yaml
import pprint
from lib.fast_rcnn.config import cfg_from_file, get_output_dir, get_log_dir
from lib.datasets.factory import get_imdb
from lib.networks.factory import get_network
from lib.fast_rcnn.train import get_training_roidb
from lib.fast_rcnn.config import cfg
from l... | [
"lib.fast_rcnn.config.cfg_from_file",
"lib.fast_rcnn.train.get_training_roidb",
"lib.fast_rcnn.config.get_output_dir",
"argparse.ArgumentParser",
"lib.datasets.factory.get_imdb",
"lib.fast_rcnn.config.get_log_dir",
"lib.networks.factory.get_network",
"pprint.pprint"
] | [((425, 450), 'lib.fast_rcnn.config.cfg_from_file', 'cfg_from_file', (['input_yaml'], {}), '(input_yaml)\n', (438, 450), False, 'from lib.fast_rcnn.config import cfg_from_file, get_output_dir, get_log_dir\n'), ((488, 506), 'pprint.pprint', 'pprint.pprint', (['cfg'], {}), '(cfg)\n', (501, 506), False, 'import pprint\n')... |
import os
from openspeechcorpus_cli.utils import get_all_file_names_and_relative_paths
def execute_script(
transcription_file,
output_file,
wav_folder,
output_folder,
include_source=True,
verify_existing=True,
extension='mfc',
):
relative_paths = get_all_fi... | [
"os.path.abspath",
"os.path.exists",
"openspeechcorpus_cli.utils.get_all_file_names_and_relative_paths"
] | [((310, 367), 'openspeechcorpus_cli.utils.get_all_file_names_and_relative_paths', 'get_all_file_names_and_relative_paths', (['transcription_file'], {}), '(transcription_file)\n', (347, 367), False, 'from openspeechcorpus_cli.utils import get_all_file_names_and_relative_paths\n'), ((553, 580), 'os.path.abspath', 'os.pat... |
"""
Provides a default QA configuration for the projects, by reading the configuration file and the environment variables.
"""
import os
import sys
import datetime
from getpass import getuser
from pathlib import Path, PurePosixPath
from typing import Dict, Any, Tuple, List, Optional, Union
import yaml
import click
fr... | [
"click.secho",
"pathlib.Path",
"os.environ.get",
"yaml.load",
"datetime.datetime.now",
"getpass.getuser"
] | [((5272, 5281), 'getpass.getuser', 'getuser', ([], {}), '()\n', (5279, 5281), False, 'from getpass import getuser\n'), ((15617, 15740), 'os.environ.get', 'os.environ.get', (['"""QA_SECRETS"""', "('/home/ispq/.secrets.yaml' if os.name != 'nt' else\n '//mars/raid/users/ispq/.secrets.yaml')"], {}), "('QA_SECRETS', '/ho... |
# Copyright (c) 2020, <NAME>.
# Distributed under the MIT License. See LICENSE for more info.
"""An example of generating a heat map of correlations."""
from matplotlib import pyplot as plt
import pandas as pd
from sklearn.datasets import load_wine as load_data
from psynlig import plot_correlation_heatmap
plt.style.use... | [
"psynlig.plot_correlation_heatmap",
"matplotlib.pyplot.style.use",
"sklearn.datasets.load_wine",
"pandas.DataFrame",
"matplotlib.pyplot.show"
] | [((307, 336), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-talk"""'], {}), "('seaborn-talk')\n", (320, 336), True, 'from matplotlib import pyplot as plt\n'), ((350, 361), 'sklearn.datasets.load_wine', 'load_data', ([], {}), '()\n', (359, 361), True, 'from sklearn.datasets import load_wine as load_data\... |
###############################################
##### Multiple Choice Question Autograder #####
###############################################
import os
import string
import re
import runpy
from utils import *
class Notebook:
"""Multiple choice question autograder for Jupyter Notebook"""
def __init__(self, tests=... | [
"os.path.isfile",
"os.path.exists",
"runpy.run_path"
] | [((727, 765), 'os.path.exists', 'os.path.exists', (['""".MCAUTOGRADER_STATUS"""'], {}), "('.MCAUTOGRADER_STATUS')\n", (741, 765), False, 'import os\n'), ((770, 808), 'os.path.isfile', 'os.path.isfile', (['""".MCAUTOGRADER_STATUS"""'], {}), "('.MCAUTOGRADER_STATUS')\n", (784, 808), False, 'import os\n'), ((933, 954), 'r... |
"""
Blizzard API CLI - Cache class.
<NAME> 01/07/19
"""
# built-in
import argparse
import json
import logging
import os
class CacheError(Exception):
""" Custom exception for use with the Cache class. """
class Cache:
""" Disk-based cache implementation. """
log = logging.getLogger(__name__)
def _... | [
"logging.getLogger",
"os.listdir",
"os.makedirs",
"os.access",
"json.dumps",
"argparse.ArgumentTypeError",
"os.path.isdir",
"json.load"
] | [((282, 309), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (299, 309), False, 'import logging\n'), ((669, 699), 'os.path.isdir', 'os.path.isdir', (['cache_directory'], {}), '(cache_directory)\n', (682, 699), False, 'import os\n'), ((947, 984), 'os.access', 'os.access', (['cache_director... |
# sqlite3 is part of python base install, still must import
import sqlite3
# create the sqlite connection - input param is the name of the DB
connection = sqlite3.connect('data.db')
# create cursor - think computer cursor
# allows you to select & start things
# responsible for executing queries
# (selection from, ins... | [
"sqlite3.connect"
] | [((156, 182), 'sqlite3.connect', 'sqlite3.connect', (['"""data.db"""'], {}), "('data.db')\n", (171, 182), False, 'import sqlite3\n')] |
import os
import argparse
import torch
import numpy
import random
from datetime import datetime
def format_time():
now = datetime.now() # current date and time
date_time = now.strftime("%m-%d-%H:%M:%S")
return date_time
def ensure_dir(path):
if not os.path.exists(path):
os.makedirs(path)
... | [
"torch.manual_seed",
"os.path.exists",
"os.makedirs",
"random.seed",
"argparse.ArgumentTypeError",
"datetime.datetime.now",
"numpy.random.seed",
"torch.cuda.manual_seed"
] | [((127, 141), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (139, 141), False, 'from datetime import datetime\n'), ((668, 691), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (685, 691), False, 'import torch\n'), ((696, 719), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), ... |
import os
import boto3
from boto3.s3.transfer import S3Transfer
import settings
class Uploader(object):
"""Amazon S3 File Uploader"""
def __init__(self,
file_path,
s3_filepath=None,
s3_http_prefix=None,
s3_bucket=None,
s3_... | [
"boto3.s3.transfer.S3Transfer",
"boto3.client",
"os.path.basename"
] | [((1289, 1389), 'boto3.client', 'boto3.client', (['"""s3"""'], {'aws_access_key_id': 'self.aws_access_key', 'aws_secret_access_key': 'self.aws_secret'}), "('s3', aws_access_key_id=self.aws_access_key,\n aws_secret_access_key=self.aws_secret)\n", (1301, 1389), False, 'import boto3\n'), ((1669, 1696), 'os.path.basenam... |
###############################################################################
# Copyright (c) 2019 Uber Technologies, Inc. #
# #
# Licensed under the Uber Non-Commercial License (the "License"); #
... | [
"numpy.ones",
"numpy.where",
"numpy.zeros",
"numpy.isfinite",
"numpy.vstack",
"math.fabs",
"copy.deepcopy",
"numpy.argmin",
"sys.stdout.flush"
] | [((3611, 3638), 'numpy.zeros', 'np.zeros', (['(0, 1)'], {'dtype': 'int'}), '((0, 1), dtype=int)\n', (3619, 3638), True, 'import numpy as np\n'), ((3727, 3768), 'numpy.zeros', 'np.zeros', (['self.n_trust_regions'], {'dtype': 'int'}), '(self.n_trust_regions, dtype=int)\n', (3735, 3768), True, 'import numpy as np\n'), ((3... |
import random
from tts import tts
def who_are_you():
messages = ["I'm Aida, your personal assistant", "Aida, I thought I told you before", "My Name is Aida and I'm a personal assistant"]
tts(random.choice(messages))
def how_am_i():
replies = ["You Seem Nice", "A Good Person", "You Sound Kind"]
tts(ran... | [
"tts.tts",
"random.choice"
] | [((365, 617), 'tts.tts', 'tts', (['"""I can take notes for you, read the latest news headlines, play audio files on your computer, tell you the time & weather outside, gather information about anything from Wikipedia, search for anything online, check your e-mail & open Firefox"""'], {}), "('I can take notes for you, r... |
import pygame
import random
import sys
import model as m
import view as v
v.initialize_pygame()
def game_loop():
#declare width and height of screen
WIDTH = 800
HEIGHT = 600
#rgb codes of various colours
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
BLUE = (0, 0, 255)
BACKGROUND_COLOUR = ... | [
"model.collision_check",
"view.update_screen",
"view.draw_player",
"sys.exit",
"model.drop_enemies",
"pygame.display.set_mode",
"view.fill_background",
"random.randint",
"model.not_overflow_left",
"view.set_fps",
"view.print_score",
"view.initialize_pygame",
"pygame.time.Clock",
"pygame.fo... | [((76, 97), 'view.initialize_pygame', 'v.initialize_pygame', ([], {}), '()\n', (95, 97), True, 'import view as v\n'), ((588, 628), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (611, 628), False, 'import pygame\n'), ((657, 676), 'pygame.time.Clock', 'pygame.time... |
import numpy as np
import pathlib
import Vox
import os
import sys
sys.path.append("../base")
import JSONHelper
def save_output(batch_size, rootdir, samples, outputs, is_testtime=False):
for i in range(batch_size):
is_match = outputs["match"][i].item()
if True:
sdf_scan = samples["sdf... | [
"pathlib.Path",
"JSONHelper.write",
"os.symlink",
"Vox.write_vox",
"Vox.Vox",
"sys.path.append",
"os.remove"
] | [((67, 93), 'sys.path.append', 'sys.path.append', (['"""../base"""'], {}), "('../base')\n", (82, 93), False, 'import sys\n'), ((2292, 2320), 'os.symlink', 'os.symlink', (['target', 'linkname'], {}), '(target, linkname)\n', (2302, 2320), False, 'import os\n'), ((1135, 1202), 'Vox.Vox', 'Vox.Vox', (['dims_cad', 'voxres_c... |
#
# file: gd_1d.py
#
# 1D example of GD
#
# RTK, 14-Feb-2021
# Last update: 14-Feb-2021
#
################################################################
import sys
import os
import numpy as np
import matplotlib.pylab as plt
# The function and its derivative
def f(x):
return 6*x**2 - 12*x + 3
def d(x):
... | [
"matplotlib.pylab.savefig",
"matplotlib.pylab.tight_layout",
"matplotlib.pylab.xlabel",
"numpy.linspace",
"matplotlib.pylab.plot",
"matplotlib.pylab.close",
"matplotlib.pylab.ylabel"
] | [((392, 416), 'numpy.linspace', 'np.linspace', (['(-1)', '(3)', '(1000)'], {}), '(-1, 3, 1000)\n', (403, 416), True, 'import numpy as np\n'), ((424, 455), 'matplotlib.pylab.plot', 'plt.plot', (['x', 'y'], {'color': '"""#1f77b4"""'}), "(x, y, color='#1f77b4')\n", (432, 455), True, 'import matplotlib.pylab as plt\n'), ((... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 14:33:25 2020
@author: <NAME>
"""
import json
name = str(input('Please give the name of cookie file,like xxxx.json: \n'))
site = str(input('Please give the name of PH\'s website,like AdidasGB: \n'))
site_pd = str(
input('Please give the name of PD\'s website,like... | [
"json.load",
"json.dump"
] | [((423, 435), 'json.load', 'json.load', (['f'], {}), '(f)\n', (432, 435), False, 'import json\n'), ((644, 667), 'json.dump', 'json.dump', (['ph_cookie', 'f'], {}), '(ph_cookie, f)\n', (653, 667), False, 'import json\n')] |
import unittest
from src import wheel
from src import table
from src import bet
from src import outcome
from src import invalid_bet_exception
from src import roulette_game
class TestTable(unittest.TestCase):
def setUp(self):
self.wheel = wheel.Wheel()
self.table = table.Table(minimum=1, maximum=10... | [
"src.table.Table",
"src.wheel.Wheel",
"src.outcome.Outcome",
"unittest.main",
"src.roulette_game.RouletteGame"
] | [((1382, 1397), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1395, 1397), False, 'import unittest\n'), ((252, 265), 'src.wheel.Wheel', 'wheel.Wheel', ([], {}), '()\n', (263, 265), False, 'from src import wheel\n'), ((287, 323), 'src.table.Table', 'table.Table', ([], {'minimum': '(1)', 'maximum': '(1000)'}), '(m... |
"""
Datetime operations.
date_to_str,
str_to_datetime,
datetime_to_str,
datetime_to_min,
min_to_datetime,
to_day_of_week_int,
working_day,
now_str,
deltatime_str,
timestamp_to_millis,
millis_to_timestamp,
time_to_str,
str_to_time,
elapsed_time_dt,
diff_time,
create_time_slot_in_minute,
generate_time_statistics,
thresh... | [
"datetime.datetime.utcfromtimestamp",
"holidays.CountryHoliday",
"datetime.datetime",
"datetime.datetime.strptime",
"datetime.datetime.now",
"pandas.Timestamp"
] | [((4317, 4356), 'datetime.datetime.utcfromtimestamp', 'datetime.utcfromtimestamp', (['(minutes * 60)'], {}), '(minutes * 60)\n', (4342, 4356), False, 'from datetime import datetime\n'), ((8948, 8982), 'pandas.Timestamp', 'Timestamp', (['milliseconds'], {'unit': '"""ms"""'}), "(milliseconds, unit='ms')\n", (8957, 8982),... |
from nn_analysis.constants import ACTS_CONFIGS_PATH
from nn_analysis import utils
from nn_analysis import acts as ac
def main():
acts_configs = utils.load_config(ACTS_CONFIGS_PATH)
for acts_name in acts_configs.keys():
for version in acts_configs[acts_name].keys():
version = int(versio... | [
"nn_analysis.utils.load_config",
"nn_analysis.acts.utils.assert_consistent_x"
] | [((149, 185), 'nn_analysis.utils.load_config', 'utils.load_config', (['ACTS_CONFIGS_PATH'], {}), '(ACTS_CONFIGS_PATH)\n', (166, 185), False, 'from nn_analysis import utils\n'), ((335, 383), 'nn_analysis.acts.utils.assert_consistent_x', 'ac.utils.assert_consistent_x', (['acts_name', 'version'], {}), '(acts_name, version... |
import threading
import MqttProcessor
import logging
import time
class Heartbeat(threading.Thread):
def __init__(self, config, pubQueue):
super().__init__()
self.config = config
self.pubQueue = pubQueue
# self.daemon = True
self.logger = logging.getLogger('Heartbeat')
... | [
"logging.getLogger",
"time.sleep"
] | [((284, 314), 'logging.getLogger', 'logging.getLogger', (['"""Heartbeat"""'], {}), "('Heartbeat')\n", (301, 314), False, 'import logging\n'), ((529, 568), 'time.sleep', 'time.sleep', (['self.config.heartbeatPeriod'], {}), '(self.config.heartbeatPeriod)\n', (539, 568), False, 'import time\n')] |
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
# Create your models here.
class User(models.Model):
sex_choice = (
(0, '男'),
(1, '女'),
)
id = models.AutoField(primary_key=True) # 用户ID
role = models.ForeignKey('Role', on_delete=models.CASCADE, defaul... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.models.PositiveSmallIntege... | [((208, 242), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (224, 242), False, 'from django.db import models\n'), ((262, 324), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Role"""'], {'on_delete': 'models.CASCADE', 'default': '(1)'}), "('Role', o... |
"""This module provides a writer for serialising data to the local filesystem."""
import json
import os
import re
from csv import DictWriter
from deprecation import deprecated
from hashlib import sha256
from lxml import etree
from pandas import DataFrame
from polymatheia import __version__
class JSONWriter():
"... | [
"lxml.etree.Element",
"deprecation.deprecated",
"re.match",
"os.path.dirname",
"pandas.DataFrame",
"re.sub",
"re.findall",
"json.dump",
"lxml.etree.tostring"
] | [((1890, 2039), 'deprecation.deprecated', 'deprecated', ([], {'deprecated_in': '"""0.2.0"""', 'removed_in': '"""1.0.0"""', 'current_version': '__version__', 'details': '"""Replaced by the polymatheia.data.writer.JSONWriter"""'}), "(deprecated_in='0.2.0', removed_in='1.0.0', current_version=\n __version__, details='R... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"json.dumps",
"django.utils.encoding.force_unicode",
"django.utils.translation.ugettext_lazy"
] | [((1800, 1812), 'django.utils.translation.ugettext_lazy', '_', (['u"""记录唯一标识"""'], {}), "(u'记录唯一标识')\n", (1801, 1812), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1867, 1877), 'django.utils.translation.ugettext_lazy', '_', (['u"""应用编码"""'], {}), "(u'应用编码')\n", (1868, 1877), True, 'from django.... |
###
# Copyright 2022-present MongoDB, 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 t... | [
"logging.getLogger",
"pytest.mark.filterwarnings"
] | [((761, 863), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:In astroid 3.0.0 NodeNG.statement\\\\(\\\\).*:DeprecationWarning"""'], {}), "(\n 'ignore:In astroid 3.0.0 NodeNG.statement\\\\(\\\\).*:DeprecationWarning')\n", (787, 863), False, 'import pytest\n'), ((2027, 2064), 'logging.getLogg... |
import sys
import mock
import pytest
def test_setup_not_present():
sys.modules['smbus'] = mock.MagicMock()
from lsm303d import LSM303D
lsm303d = LSM303D()
with pytest.raises(RuntimeError):
lsm303d.setup()
def test_setup_mock_present():
from tools import SMBusFakeDevice
smbus = mock.M... | [
"mock.Mock",
"lsm303d.LSM303D",
"pytest.raises",
"mock.MagicMock"
] | [((96, 112), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (110, 112), False, 'import mock\n'), ((159, 168), 'lsm303d.LSM303D', 'LSM303D', ([], {}), '()\n', (166, 168), False, 'from lsm303d import LSM303D\n'), ((314, 325), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (323, 325), False, 'import mock\n'), ((439, 4... |