code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Initial tables
Revision ID: <KEY>
Revises:
Create Date: 2017-12-31 22:34:41.574013
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'manufacturer... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Column"
] | [((331, 374), 'sqlalchemy.Column', 'sa.Column', (['"""id"""', 'sa.Integer'], {'nullable': '(False)'}), "('id', sa.Integer, nullable=False)\n", (340, 374), True, 'import sqlalchemy as sa\n'), ((384, 426), 'sqlalchemy.Column', 'sa.Column', (['"""name"""', 'sa.Text'], {'nullable': '(False)'}), "('name', sa.Text, nullable=... |
#!/usr/bin/env python3
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility to manipulate Chrome OS disk & firmware images for manufacturing.
Run "image_tool help" for more info and a list of sub... | [
"cros.factory.utils.pygpt.GPTCommands.Prioritize",
"re.escape",
"logging.debug",
"re.compile",
"yaml.load",
"sys.stderr.isatty",
"time.sleep",
"cros.factory.tools.netboot_firmware_settings.NetbootFirmwareSettings",
"cros.factory.utils.pygpt.GPT.LoadFromFile",
"copy.deepcopy",
"logging.info",
"... | [((2417, 2464), 'os.path.join', 'os.path.join', (['"""dev_image"""', '"""etc"""', '"""lsb-factory"""'], {}), "('dev_image', 'etc', 'lsb-factory')\n", (2429, 2464), False, 'import os\n'), ((2635, 2703), 'os.path.join', 'os.path.join', (['"""dev_image"""', '"""etc"""', "('%s.json' % PREFLASH_DEFAULT_BOARD)"], {}), "('dev... |
# -*- coding: utf-8 -*-
"""03 Fetching data.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1IYGWv5misDPAulnG_jfYOCtx5hxKl3Fr
# Accessing and downloading Data
* Finding the route to get hold of the data
* Converting spreadsheets to CSV
"""... | [
"IPython.display.HTML",
"requests.get"
] | [((3203, 3274), 'IPython.display.HTML', 'HTML', (['("<a href=\'" + download_link + "\'>Download + " + filename + \'</a>\')'], {}), '("<a href=\'" + download_link + "\'>Download + " + filename + \'</a>\')\n', (3207, 3274), False, 'from IPython.display import HTML\n'), ((3939, 3997), 'requests.get', 'requests.get', (['li... |
#!/usr/bin/env python
import time
import rospy
import math
import copy
import numpy
from std_msgs.msg import Float64
from sensor_msgs.msg import JointState
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Point
from tf.transformations import euler_from_quaternion
class CubeRLUtils(object):
def __i... | [
"tf.transformations.euler_from_quaternion",
"rospy.logerr",
"rospy.Subscriber",
"std_msgs.msg.Float64",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.wait_for_message",
"time.sleep",
"numpy.array",
"geometry_msgs.msg.Point",
"rospy.Rate",
"numpy.linalg.norm",
"rospy.Publisher",
"rospy.log... | [((5196, 5283), 'rospy.init_node', 'rospy.init_node', (['"""cube_rl_systems_test_node"""'], {'anonymous': '(True)', 'log_level': 'rospy.INFO'}), "('cube_rl_systems_test_node', anonymous=True, log_level=\n rospy.INFO)\n", (5211, 5283), False, 'import rospy\n'), ((5325, 5362), 'rospy.loginfo', 'rospy.loginfo', (['"""M... |
import psycopg2
import sys
from handHud import *
import time
from psycopg2.extensions import AsIs
import copy
from multiprocessing import Pool
import os
def connection():
try:
conn = psycopg2.connect(database="new", user="postgres",
password="<PASSWORD>", host='localhost',
... | [
"psycopg2.connect",
"os.listdir",
"re.compile",
"os.rename",
"os.getcwd",
"sys.exc_info",
"multiprocessing.Pool",
"sys.exit",
"copy.copy",
"time.time"
] | [((7686, 7725), 're.compile', 're.compile', (['"""^PokerStars Hand #\\\\d+:.*"""'], {}), "('^PokerStars Hand #\\\\d+:.*')\n", (7696, 7725), False, 'import re\n'), ((8916, 8927), 'time.time', 'time.time', ([], {}), '()\n', (8925, 8927), False, 'import time\n'), ((197, 304), 'psycopg2.connect', 'psycopg2.connect', ([], {... |
from django.db import models
# Create your models here.
class Note(models.Model):
title = models.CharField(max_length=60)
color = models.CharField(max_length=10)
authorID = models.IntegerField()
noteType = models.IntegerField()
createTime = models.DateTimeField()
content = models.TextField()
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((97, 128), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(60)'}), '(max_length=60)\n', (113, 128), False, 'from django.db import models\n'), ((141, 172), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (157, 172), False, 'from django.db imp... |
import datetime
import os
from common import settings
# environment variables must be set
TEST_USE_STATIC_DATA = os.getenv('TEST_USE_STATIC_DATA', True)
test_api_key = os.getenv('TEST_API_KEY')
NUMBER_OF_ADS = 5029
DAWN_OF_TIME = '1971-01-01T00:00:01'
current_time_stamp = datetime.datetime.now().strftime(settings.DAT... | [
"datetime.datetime.now",
"os.getenv"
] | [((114, 153), 'os.getenv', 'os.getenv', (['"""TEST_USE_STATIC_DATA"""', '(True)'], {}), "('TEST_USE_STATIC_DATA', True)\n", (123, 153), False, 'import os\n'), ((169, 194), 'os.getenv', 'os.getenv', (['"""TEST_API_KEY"""'], {}), "('TEST_API_KEY')\n", (178, 194), False, 'import os\n'), ((415, 457), 'os.getenv', 'os.geten... |
# -*- coding:utf-8 -*-
from django.urls import path
from access_control import views
urlpatterns = (
path(r'console', views.Console.as_view()),
path(r'button', views.Button.as_view()),
path(r'role', views.RoleListView.as_view()),
path(r'permission', views.PermissionListView.as_view()),
path(r'base... | [
"access_control.views.RoleUserListView.as_view",
"access_control.views.RoleListView.as_view",
"access_control.views.Button.as_view",
"access_control.views.Console.as_view",
"access_control.views.PermissionListView.as_view",
"access_control.views.BaseRoleUserListView.as_view"
] | [((124, 147), 'access_control.views.Console.as_view', 'views.Console.as_view', ([], {}), '()\n', (145, 147), False, 'from access_control import views\n'), ((170, 192), 'access_control.views.Button.as_view', 'views.Button.as_view', ([], {}), '()\n', (190, 192), False, 'from access_control import views\n'), ((213, 241), ... |
from south.db import db
from django.db import models
from apps.analyzer.models import *
class Migration:
def forwards(self, orm):
# Adding model 'FeatureCategory'
db.create_table('analyzer_featurecategory', (
('id', orm['analyzer.FeatureCategory:id']),
('user'... | [
"south.db.db.create_table",
"south.db.db.send_create_signal",
"south.db.db.delete_table"
] | [((199, 574), 'south.db.db.create_table', 'db.create_table', (['"""analyzer_featurecategory"""', "(('id', orm['analyzer.FeatureCategory:id']), ('user', orm[\n 'analyzer.FeatureCategory:user']), ('feed', orm[\n 'analyzer.FeatureCategory:feed']), ('feature', orm[\n 'analyzer.FeatureCategory:feature']), ('categor... |
import sklearn
from sklearn import metrics
import numpy as np
import pandas as pd
import re
class MetricsCls:
"""
Requirement: metric functions under the class should always have the y_true, and y_pred args.
Examples:
>>> obj=MetricsCls(config={'MAPE__version':'sklearn'})
>... | [
"numpy.abs",
"numpy.average",
"numpy.diff",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"sklearn.metrics.mean_absolute_percentage_error",
"pandas.DataFrame",
"sklearn.metrics.mean_absolute_error",
"numpy.round"
] | [((2860, 2970), 'sklearn.metrics.mean_absolute_error', 'sklearn.metrics.mean_absolute_error', (['y_true', 'y_pred'], {'sample_weight': 'sample_weight', 'multioutput': 'multioutput'}), '(y_true, y_pred, sample_weight=\n sample_weight, multioutput=multioutput)\n', (2895, 2970), False, 'import sklearn\n'), ((3111, 3237... |
# Copyright 2021 The Vitess 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 writing,... | [
"unittest.main"
] | [((1634, 1649), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1647, 1649), False, 'import unittest\n')] |
import json
import os.path
class Scheme(dict):
"""Represents all of the data associated with a given scheme. In addition
to storing whether or not a scheme is roman, :class:`Scheme` partitions
a scheme's characters into important functional groups.
:class:`Scheme` is just a subclass of :class:`dict... | [
"json.load",
"codecs.open",
"indic_transliteration.sanscript.transliterate"
] | [((1792, 1877), 'indic_transliteration.sanscript.transliterate', 'sanscript.transliterate', ([], {'data': 'data_in', '_from': 'self.name', '_to': 'sanscript.DEVANAGARI'}), '(data=data_in, _from=self.name, _to=sanscript.DEVANAGARI\n )\n', (1815, 1877), False, 'from indic_transliteration import sanscript\n'), ((2022, ... |
import InstrumentDriver
import numpy as np
class Driver(InstrumentDriver.InstrumentWorker):
""" This class implements a simple signal generator driver"""
def performOpen(self, options={}):
"""Perform the operation of opening the instrument connection"""
pass
def performClose(self, b... | [
"numpy.sin",
"numpy.linspace"
] | [((1218, 1241), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(1000)'], {}), '(0, 1, 1000)\n', (1229, 1241), True, 'import numpy as np\n'), ((1267, 1322), 'numpy.sin', 'np.sin', (['(freq * time * 2 * np.pi + phase * np.pi / 180.0)'], {}), '(freq * time * 2 * np.pi + phase * np.pi / 180.0)\n', (1273, 1322), True, 'i... |
from Library.Tree import BinarySearchTree
def lca(root, v1, v2):
if v1 < root.value and v2 < root.value:
return lca(root.left, v1, v2)
elif v1 > root.value and v2 > root.value:
return lca(root.right, v1, v2)
else:
return root
tree = BinarySearchTree.BinarySearchTree()
nodesList =... | [
"Library.Tree.BinarySearchTree.BinarySearchTree"
] | [((273, 308), 'Library.Tree.BinarySearchTree.BinarySearchTree', 'BinarySearchTree.BinarySearchTree', ([], {}), '()\n', (306, 308), False, 'from Library.Tree import BinarySearchTree\n')] |
from __future__ import unicode_literals
import collections
import six
from egnyte import base, exc
class FileOrFolder(base.Resource):
"""Things that are common to both files and folders."""
_url_template = "pubapi/v1/fs%(path)s"
_lazy_attributes = {'name', 'folder_id', 'is_folder'}
def _action(sel... | [
"six.BytesIO",
"egnyte.base.split_file_into_chunks",
"egnyte.base.date_format",
"egnyte.base.FileDownload",
"six.text_type",
"egnyte.exc.ChecksumError",
"egnyte.base.Resource.delete",
"egnyte.exc.default.check_response",
"egnyte.base.get_file_size",
"egnyte.base._FileChunk",
"egnyte.exc.InvalidP... | [((6502, 6528), 'egnyte.base.FileDownload', 'base.FileDownload', (['r', 'self'], {}), '(r, self)\n', (6519, 6528), False, 'from egnyte import base, exc\n'), ((8330, 8356), 'egnyte.base.Resource.delete', 'base.Resource.delete', (['self'], {}), '(self)\n', (8350, 8356), False, 'from egnyte import base, exc\n'), ((9992, 1... |
from typing import Union
import numpy as np
def moore_n(
n: int, position: tuple, grid: np.ndarray, invariant: Union[int, np.ndarray] = 0
):
"""Gets the N Moore neighborhood at given postion."""
row, col = position
nrows, ncols = grid.shape
# Target offsets from position.
ofup, ofdo = row +... | [
"numpy.array",
"collections.namedtuple",
"numpy.repeat"
] | [((5197, 5315), 'collections.namedtuple', 'namedtuple', (['"""Neighbors"""', "['up_left', 'up', 'up_right', 'left', 'self', 'right', 'down_left', 'down',\n 'down_right']"], {}), "('Neighbors', ['up_left', 'up', 'up_right', 'left', 'self',\n 'right', 'down_left', 'down', 'down_right'])\n", (5207, 5315), False, 'fr... |
#! /usr/bin/env python
"""
Display information from an ULog file
"""
from __future__ import print_function
import argparse
from .core import ULog
#pylint: disable=too-many-locals, unused-wildcard-import, wildcard-import
#pylint: disable=invalid-name
def show_info(ulog, verbose):
"""Show general information fro... | [
"argparse.ArgumentParser"
] | [((2572, 2648), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Display information from an ULog file"""'}), "(description='Display information from an ULog file')\n", (2595, 2648), False, 'import argparse\n')] |
from nose.plugins.attrib import attr
import os
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import trackpy
from trackpy import plots
from trackpy.utils import suppress_plotting, fit_powerlaw
from trackpy.tests.common import StrictTestCase
import nose
# Quiet warnings about Axes not be... | [
"pandas.Series",
"trackpy.plots.plot_traj",
"nose.plugins.attrib.attr",
"pandas.DataFrame",
"os.path.join",
"trackpy.utils.fit_powerlaw",
"nose.runmodule",
"nose.SkipTest",
"numpy.random.randint",
"trackpy.utils.suppress_plotting",
"trackpy.plots.annotate3d",
"trackpy.plots.annotate",
"os.pa... | [((369, 486), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""This figure includes Axes that are not compatible with tight_layout"""'}), "('ignore', message=\n 'This figure includes Axes that are not compatible with tight_layout')\n", (392, 486), False, 'import warnings\n'), ... |
# Run as local
import sys, random
from fabric.api import *
from os.path import exists
def add_module():
prompt('Specify exiting app name:', 'app_name', validate=r'^[a-z\_]+$')
prompt('Specify new module name (model class name):', 'module_name', validate=r'^[a-zA-Z\_]+$')
with settings(warn_only=True):
... | [
"os.path.exists"
] | [((1235, 1287), 'os.path.exists', 'exists', (["('%s/tests/public/__init__.py' % env.app_name)"], {}), "('%s/tests/public/__init__.py' % env.app_name)\n", (1241, 1287), False, 'from os.path import exists\n'), ((4115, 4166), 'os.path.exists', 'exists', (["('%s/urls/public/__init__.py' % env.app_name)"], {}), "('%s/urls/p... |
import moment
import os
import pandas
import pyarrow as pa
import pyarrow.parquet as pq
import requests
from func_timeout import func_set_timeout, FunctionTimedOut
from pandas import DataFrame
from pathlib import Path
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, lit
from pyspark.sql.types... | [
"time.sleep",
"pyarrow.parquet.ParquetWriter",
"os.listdir",
"pathlib.Path",
"pyarrow.Table.from_pandas",
"moment.now",
"pyarrow.int64",
"pyarrow.parquet.read_table",
"pandas.DataFrame",
"func_timeout.func_set_timeout",
"pyarrow.float64",
"pyarrow.bool_",
"pyspark.sql.functions.lit",
"pyar... | [((591, 612), 'func_timeout.func_set_timeout', 'func_set_timeout', (['(180)'], {}), '(180)\n', (607, 612), False, 'from func_timeout import func_set_timeout, FunctionTimedOut\n'), ((10090, 10115), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (10105, 10115), False, 'import os\n'), ((10140, 1... |
import pyautogui as pag
from getpass import getpass
import sys
import json
import requests
import keyboard
import time
import random
import webbrowser
from os import system, name
from colorama import Fore, Back, Style
import os
os.system('cls')
def clear():
if name == 'nt':
_ = system('cls')
def add():... | [
"keyboard.read_key",
"pyautogui.typewrite",
"pyautogui.moveTo",
"webbrowser.open_new",
"getpass.getpass",
"time.sleep",
"pyautogui.click",
"pyautogui.mouseDown",
"sys.exit",
"os.system",
"pyautogui.position",
"pyautogui.mouseUp"
] | [((229, 245), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (238, 245), False, 'import os\n'), ((931, 944), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (941, 944), False, 'import time\n'), ((1135, 1148), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1145, 1148), False, 'import time\n'), ((1... |
import torch
import os
import time
import numpy as np
from tqdm import tqdm
from collections import OrderedDict
from torch import optim
from torch import nn
from torchvision.utils import save_image
class Base:
def _get_stats(self, dict_, mode):
stats = OrderedDict({})
for key in dict_.keys():
... | [
"numpy.mean",
"collections.OrderedDict",
"os.path.exists",
"os.makedirs",
"time.time"
] | [((267, 282), 'collections.OrderedDict', 'OrderedDict', (['{}'], {}), '({})\n', (278, 282), False, 'from collections import OrderedDict\n'), ((341, 360), 'numpy.mean', 'np.mean', (['dict_[key]'], {}), '(dict_[key])\n', (348, 360), True, 'import numpy as np\n'), ((1298, 1309), 'time.time', 'time.time', ([], {}), '()\n',... |
# Copyright 2019 NaplesPU
#
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the fo... | [
"argparse.ArgumentParser",
"time.sleep",
"struct.unpack",
"serial.Serial",
"sys.exit",
"threading.Thread",
"Queue.Queue"
] | [((1701, 1755), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Nu+ UART loader"""'}), "(description='Nu+ UART loader')\n", (1724, 1755), False, 'import argparse\n'), ((6368, 6393), 'serial.Serial', 'serial.Serial', (['serialPort'], {}), '(serialPort)\n', (6381, 6393), False, 'import seri... |
from torch.nn import CrossEntropyLoss
from datasets.utils import NOISE_CONTRASTIVE_LOSSES
from rankers.loss.loss_functions import BCEWithLogitsLossWrapper, RankNetLoss, BinaryNCELoss, RankingNCELoss, MarginRankingLossWrapper
from tools.config import ChainConfig
class LossRelay:
def __init__(self, config: ChainC... | [
"rankers.loss.loss_functions.BCEWithLogitsLossWrapper",
"torch.nn.CrossEntropyLoss",
"rankers.loss.loss_functions.BinaryNCELoss",
"rankers.loss.loss_functions.MarginRankingLossWrapper",
"rankers.loss.loss_functions.RankNetLoss",
"rankers.loss.loss_functions.RankingNCELoss"
] | [((564, 580), 'rankers.loss.loss_functions.RankingNCELoss', 'RankingNCELoss', ([], {}), '()\n', (578, 580), False, 'from rankers.loss.loss_functions import BCEWithLogitsLossWrapper, RankNetLoss, BinaryNCELoss, RankingNCELoss, MarginRankingLossWrapper\n'), ((699, 714), 'rankers.loss.loss_functions.BinaryNCELoss', 'Binar... |
"""
This example uses addfruit_display_text.label to display text using a custom font
loaded by adafruit_bitmap_font
"""
import board
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font
display = board.DISPLAY
# Set text, font, and color
text = "<NAME>"
font = bitmap_fon... | [
"adafruit_bitmap_font.bitmap_font.load_font",
"adafruit_display_text.label.Label"
] | [((310, 353), 'adafruit_bitmap_font.bitmap_font.load_font', 'bitmap_font.load_font', (['"""fonts/Arial-16.bdf"""'], {}), "('fonts/Arial-16.bdf')\n", (331, 353), False, 'from adafruit_bitmap_font import bitmap_font\n'), ((411, 452), 'adafruit_display_text.label.Label', 'label.Label', (['font'], {'text': 'text', 'color':... |
# Copyright 2021 DeepMind Technologies Limited.
#
# 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... | [
"neural_lns.data_utils.get_features",
"collections.deque",
"neural_lns.mip_utils.is_var_binary",
"neural_lns.local_branching_expert.get_lns_lp_solution",
"os.path.join",
"ml_collections.ConfigDict",
"absl.logging.warning",
"numpy.zeros",
"numpy.concatenate",
"neural_lns.local_branching_expert.impr... | [((1221, 1311), 'ml_collections.ConfigDict', 'ml_collections.ConfigDict', (["{'seed': 42, 'time_limit_seconds': 1800, 'relative_gap': 0}"], {}), "({'seed': 42, 'time_limit_seconds': 1800,\n 'relative_gap': 0})\n", (1246, 1311), False, 'import ml_collections\n'), ((1554, 1590), 'os.path.join', 'os.path.join', (['data... |
import threading
import time
import abc
import yfinance as yf
class TradingSystem(abc.ABC):
@abc.abstractclassmethod
def abstractloop(self):
pass
def mainloop(self):
while(True):
self.abstractloop()
time.sleep(self.timeframe)
def ... | [
"threading.Thread",
"yfinance.Ticker",
"time.sleep"
] | [((434, 472), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.mainloop'}), '(target=self.mainloop)\n', (450, 472), False, 'import threading\n'), ((694, 716), 'yfinance.Ticker', 'yf.Ticker', (['self.ticker'], {}), '(self.ticker)\n', (703, 716), True, 'import yfinance as yf\n'), ((270, 296), 'time.sleep', '... |
from typing import Any, Generic, Iterator, TypeVar
T = TypeVar("T")
class Peekable(Generic[T]):
def __init__(self, items: Iterator[T]) -> None:
self.items = items
self.at_end = False
try:
self.peek = next(items)
except StopIteration:
self.at_end = True
... | [
"typing.TypeVar"
] | [((57, 69), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (64, 69), False, 'from typing import Any, Generic, Iterator, TypeVar\n')] |
import os
import pandas as pd
import numpy as np
import pickle
import argparse
## torch packages
import torch
from transformers import BertTokenizer,AutoTokenizer
import re
## for visualisation
import matplotlib.pyplot as plt
import collections
## custom packages
from extract_lexicon import get_arousal_vec,get_valenc... | [
"pickle.dump",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.join",
"extract_lexicon.get_valence_vec",
"pandas.DataFrame.from_dict",
"extract_lexicon.get_arousal_vec",
"extract_lexicon.get_dom_vec",
"numpy.zeros",
"utils.tweet_preprocess",
"transformers.AutoTokenizer.from_pretrained"
] | [((538, 558), 'numpy.zeros', 'np.zeros', (['class_size'], {}), '(class_size)\n', (546, 558), True, 'import numpy as np\n'), ((4752, 4797), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['tokenizer_type'], {}), '(tokenizer_type)\n', (4781, 4797), False, 'from transformers import BertTok... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.common.initializer.Uniform",
"mindspore.common.initializer.HeUniform",
"mindspore.nn.SequentialCell",
"numpy.ones",
"mindspore.nn.AvgPool2d",
"mindspore.nn.MaxPool2d",
"mindspore.ops.operations.Transpose",
"mindspore.nn.BatchNorm2d",
"math.sqrt",
"mindspore.common.initializer.HeNormal",... | [((1096, 1154), 'mindspore.nn.Conv2d', 'nn.Conv2d', (['inplanes', 'planes'], {'kernel_size': '(1)', 'has_bias': '(False)'}), '(inplanes, planes, kernel_size=1, has_bias=False)\n', (1105, 1154), True, 'import mindspore.nn as nn\n'), ((1174, 1196), 'mindspore.nn.BatchNorm2d', 'nn.BatchNorm2d', (['planes'], {}), '(planes)... |
# Generated by Django 2.1.3 on 2018-12-27 15:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scheduler', '0024_auto_20181227_0744'),
]
operations = [
migrations.AlterField(
model_name='cho... | [
"django.db.models.DateField",
"django.db.models.TimeField",
"django.db.models.ForeignKey"
] | [((369, 417), 'django.db.models.DateField', 'models.DateField', ([], {'null': '(True)', 'verbose_name': '"""Date"""'}), "(null=True, verbose_name='Date')\n", (385, 417), False, 'from django.db import migrations, models\n'), ((537, 585), 'django.db.models.TimeField', 'models.TimeField', ([], {'null': '(True)', 'verbose_... |
# Copyright 2012 NEC Corporation
#
# 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 ag... | [
"openstack_dashboard.dashboards.admin.networks.subnets.tables.SubnetsTable",
"django.core.urlresolvers.reverse"
] | [((1311, 1380), 'openstack_dashboard.dashboards.admin.networks.subnets.tables.SubnetsTable', 'admin_tables.SubnetsTable', (['self.request'], {'network_id': 'subnet.network_id'}), '(self.request, network_id=subnet.network_id)\n', (1336, 1380), True, 'from openstack_dashboard.dashboards.admin.networks.subnets import tabl... |
"""Cli module."""
import click
from fpl.data import BlobImporter, DataConverter
@click.group()
def data():
"""CLI group."""
print("This is the command group of data operations!")
@data.command(name="download", help="Download all new blobs from container.")
def download():
"""Download all blobs."""
... | [
"fpl.data.DataConverter",
"click.Choice",
"click.group",
"fpl.data.BlobImporter",
"click.Path"
] | [((84, 97), 'click.group', 'click.group', ([], {}), '()\n', (95, 97), False, 'import click\n'), ((334, 348), 'fpl.data.BlobImporter', 'BlobImporter', ([], {}), '()\n', (346, 348), False, 'from fpl.data import BlobImporter, DataConverter\n'), ((922, 974), 'fpl.data.DataConverter', 'DataConverter', ([], {'entity': 'entit... |
"""General Grail preferences panel."""
__version__ = "$Revision: 1.12 $"
import grailutil
import PrefsPanels
import string
import Tkinter
GROUP = "printing"
LABEL_WIDTH = 16
class FontSizeVar(Tkinter.StringVar):
_default = "10.0 / 10.7"
def get(self):
sizes = grailutil.conv_fontsize(Tkinter.String... | [
"string.capitalize",
"Tkinter.StringVar.set",
"grailutil.conv_fontsize",
"Tkinter.Frame",
"Tkinter.StringVar.get"
] | [((411, 441), 'grailutil.conv_fontsize', 'grailutil.conv_fontsize', (['value'], {}), '(value)\n', (434, 441), False, 'import grailutil\n'), ((457, 503), 'Tkinter.StringVar.set', 'Tkinter.StringVar.set', (['self', "('%s / %s' % sizes)"], {}), "(self, '%s / %s' % sizes)\n", (478, 503), False, 'import Tkinter\n'), ((664, ... |
from string import Template
my_string = Template('Data science has been called $identifier')
my_string.substitute(identifier="sexiest job of the 21st century")
job= "Datascience"
name ="sexiest job of the 21st century"
my_string2= Template('$title has been called $description')
my_string2.substitute(title=job, desc... | [
"string.Template"
] | [((42, 94), 'string.Template', 'Template', (['"""Data science has been called $identifier"""'], {}), "('Data science has been called $identifier')\n", (50, 94), False, 'from string import Template\n'), ((235, 282), 'string.Template', 'Template', (['"""$title has been called $description"""'], {}), "('$title has been ca... |
''' Controller para fornecer dados da CEE '''
from flask_restful_swagger_2 import swagger
from flask import request
from resources.base import BaseResource
from model.municipio import Municipio
class MunicipiosResource(BaseResource):
''' Classe de múltiplos Municípios '''
CUSTOM_SWAGGER_PARAMS = [
{"na... | [
"flask_restful_swagger_2.swagger.doc",
"model.municipio.Municipio"
] | [((1338, 1612), 'flask_restful_swagger_2.swagger.doc', 'swagger.doc', (["{'tags': ['municipio'], 'description':\n 'Obtém todos os Municípios, de acordo com os parâmetros informados'\n , 'parameters': CUSTOM_SWAGGER_PARAMS + BaseResource.\n DEFAULT_SWAGGER_PARAMS, 'responses': {'200': {'description': 'M... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 16:06:04 2019
@author: <NAME>
"""
# https://realpython.com/python-web-scraping-practical-introduction/
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import string
import time
import math
import datetime
abstracts = []
from nltk.corpus import sto... | [
"webscraper_functions.simple_get",
"nltk.corpus.stopwords.words",
"pandas.read_csv",
"datetime.datetime.strptime",
"webscraper_functions.get_abstract",
"time.sleep",
"bs4.BeautifulSoup",
"webscraper_functions.string_parse2",
"string.capwords",
"webscraper_functions.string_parse1",
"pandas.DataFr... | [((2772, 2787), 'numpy.arange', 'np.arange', (['(0)', '(1)'], {}), '(0, 1)\n', (2781, 2787), True, 'import numpy as np\n'), ((9705, 9914), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'Topics_split': topics_split, 'Topics': topics, 'Authors': authors,\n 'Titles': titles, 'Journals': journals, 'Years': years, ... |
import unittest
import sys
from solution.binary_tree import BinaryTree
from solution.huffman_encoding import HuffmanEncoding
from solution.huffman_decoding import HuffmanDecoding
class TestCasesHuffmanDecoding(unittest.TestCase):
def execute_tests_decode_none_input(self: object) -> None:
# Arrange
... | [
"solution.huffman_decoding.HuffmanDecoding",
"sys.getsizeof",
"solution.huffman_encoding.HuffmanEncoding"
] | [((367, 384), 'solution.huffman_decoding.HuffmanDecoding', 'HuffmanDecoding', ([], {}), '()\n', (382, 384), False, 'from solution.huffman_decoding import HuffmanDecoding\n'), ((670, 687), 'solution.huffman_encoding.HuffmanEncoding', 'HuffmanEncoding', ([], {}), '()\n', (685, 687), False, 'from solution.huffman_encoding... |
from .pyomexmeta import PersonalInformation
from .pyomexmeta import EnergyDiff
from .pyomexmeta import PhysicalProcess
from .pyomexmeta import RDF, Editor, PhysicalEntity
from .pyomexmeta import SingularAnnotation
from .pyomexmeta import OmexMetaException
from .pyomexmeta_api import PyOmexMetaAPI, get_version, eUriType... | [
"os.path.dirname",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((426, 447), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (445, 447), False, 'import unittest\n'), ((559, 584), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (582, 584), False, 'import unittest\n'), ((480, 505), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
import os, random, sys, time
import torch
from os import path as osp
from pprint import pprint
import numpy as np
from torch import nn
from torch.backends import cudnn
import utils.loss as loss
from models import get_baseline_model
from utils.meters import AverageMeter
from utils.loss import TripletLoss
from utils.seri... | [
"models.get_baseline_model",
"torch.cuda.is_available",
"utils.loss.item",
"os.remove",
"os.path.exists",
"os.listdir",
"tester.evaluate_model",
"tester.pickle_write",
"tester.get_feature",
"random.randint",
"random.shuffle",
"utils.loss.TripletLoss",
"utils.loss.backward",
"tester.pickle_... | [((497, 519), 'torch.load', 'torch.load', (['model_path'], {}), '(model_path)\n', (507, 519), False, 'import torch\n'), ((955, 985), 'random.shuffle', 'random.shuffle', (['processed_imgs'], {}), '(processed_imgs)\n', (969, 985), False, 'import os, random, sys, time\n'), ((1197, 1219), 'tester.pickle_read', 'pickle_read... |
from jsonmodels.collections import ModelCollection
from jsonmodels.fields import ListField
from funcy import iterable, suppress
class LazyModelCollection(ModelCollection):
def _repr(self):
return super(LazyModelCollection, self).__repr__()
def __repr__(self):
# TODO if self is empty, then ch... | [
"funcy.suppress",
"funcy.iterable"
] | [((709, 728), 'funcy.suppress', 'suppress', (['Exception'], {}), '(Exception)\n', (717, 728), False, 'from funcy import iterable, suppress\n'), ((1091, 1107), 'funcy.iterable', 'iterable', (['values'], {}), '(values)\n', (1099, 1107), False, 'from funcy import iterable, suppress\n')] |
import setuptools
with open("docs/README.md", "r", encoding="utf-8") as readmefile:
long_description = readmefile.read()
# Set up all things
setuptools.setup(
name = "lexicon-gauthamkrishna9991",
version = "0.1.1",
author = "<NAME>",
author_email = "<EMAIL>",
description = "A Verilog Project ... | [
"setuptools.find_packages"
] | [((1134, 1171), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (1158, 1171), False, 'import setuptools\n')] |
# -*- encoding: utf-8 -*-
"""
Query the S3 bucket containing Sierra progress reports, and log
a report in Slack
"""
import datetime as dt
import itertools
import json
import os
import boto3
import requests
from interval_arithmetic import combine_overlapping_intervals, get_intervals
def get_matching_s3_keys(s3_clie... | [
"itertools.islice",
"interval_arithmetic.combine_overlapping_intervals",
"boto3.client",
"json.dumps",
"datetime.datetime.now",
"interval_arithmetic.get_intervals"
] | [((4592, 4610), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (4604, 4610), False, 'import boto3\n'), ((975, 999), 'interval_arithmetic.get_intervals', 'get_intervals', ([], {'keys': 'keys'}), '(keys=keys)\n', (988, 999), False, 'from interval_arithmetic import combine_overlapping_intervals, get_inter... |
# SnippetApp/urls.py
from django.conf.urls import url, include
from SnippetApp import views
urlpatterns = [
url(r'^$', views.HomePageView.as_view()),
] | [
"SnippetApp.views.HomePageView.as_view"
] | [((124, 152), 'SnippetApp.views.HomePageView.as_view', 'views.HomePageView.as_view', ([], {}), '()\n', (150, 152), False, 'from SnippetApp import views\n')] |
#!/usr/bin/env python3
import optparse
import pathlib
import subprocess
import os
import shutil
from tools.utils import prompt as pmt
from tools.utils.subprocess_runner import subprocess_runner
_file_path = pathlib.Path(__file__).parent
_add_script = _file_path.joinpath("./tools/leetcode_add.py")
_del_script = _file_... | [
"optparse.OptionGroup",
"pathlib.Path.exists",
"tools.utils.prompt.ask",
"pathlib.Path",
"optparse.OptionParser",
"tools.leetcode.question.LeetCodeQuestion",
"pathlib.Path.mkdir",
"tools.utils.subprocess_runner.subprocess_runner",
"os.path.basename",
"shutil.rmtree",
"tools.utils.prompt.hi"
] | [((209, 231), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (221, 231), False, 'import pathlib\n'), ((3472, 3530), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'usage': '"""%prog [options] id1 id2 ..."""'}), "(usage='%prog [options] id1 id2 ...')\n", (3493, 3530), False, 'import optpars... |
try:
import cv2
import numpy as np
except ImportError as e:
from pip._internal import main as install
packages = ["numpy", "opencv-python"]
for package in packages:
install(["install", package])
finally:
pass
# read an image and a video
image = cv2.imread("avatar.jpg")
capture = cv2.Vi... | [
"cv2.medianBlur",
"cv2.imshow",
"cv2.waitKey",
"pip._internal.main",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.GaussianBlur",
"cv2.imread",
"cv2.blur"
] | [((279, 303), 'cv2.imread', 'cv2.imread', (['"""avatar.jpg"""'], {}), "('avatar.jpg')\n", (289, 303), False, 'import cv2\n'), ((314, 344), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""video1.mp4"""'], {}), "('video1.mp4')\n", (330, 344), False, 'import cv2\n'), ((402, 428), 'cv2.blur', 'cv2.blur', (['image', '(5, 7)',... |
from django import forms
from django.utils.translation import pgettext_lazy
from ...account.models import CustomerNote, User
class CustomerForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user', None)
super().__init__(*args, **kwargs)
# disable 'is_activ... | [
"django.forms.Textarea",
"django.utils.translation.pgettext_lazy"
] | [((760, 776), 'django.forms.Textarea', 'forms.Textarea', ([], {}), '()\n', (774, 776), False, 'from django import forms\n'), ((820, 858), 'django.utils.translation.pgettext_lazy', 'pgettext_lazy', (['"""Customer note"""', '"""Note"""'], {}), "('Customer note', 'Note')\n", (833, 858), False, 'from django.utils.translati... |
# Generated by Django 3.2.12 on 2022-03-06 16:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.BigAutoField",
"django.db.models.ImageField",
"django.db.migrations.swappable_dependency",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import migrations, models\n'), ((437, 533), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.gdscript
~~~~~~~~~~~~~~~~~~~~~~
Lexer for GDScript.
:copyright: Copyright 2xxx by The Godot Engine Community
:license: MIT.
modified by <NAME> <<EMAIL>> based on the original python.py pygment
"""
import re
from pygments.lexer import Lexer, RegexL... | [
"re.compile",
"pygments.lexer.include",
"pygments.lexer.default",
"pygments.lexer.words",
"pygments.lexer.combined",
"pygments.lexer.bygroups"
] | [((656, 675), 're.compile', 're.compile', (['""".*?\n"""'], {}), "('.*?\\n')\n", (666, 675), False, 'import re\n'), ((2077, 2096), 'pygments.lexer.include', 'include', (['"""keywords"""'], {}), "('keywords')\n", (2084, 2096), False, 'from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, default, words... |
"""
Services
----------------
An example showing how to fetch all services and print them.
Updated on 2019-03-25 by hbldh <<EMAIL>>
"""
import asyncio
import platform
from bleak import BleakClient
async def print_services(mac_addr: str):
async with BleakClient(mac_addr) as client:
svcs = await client... | [
"platform.system",
"asyncio.get_event_loop",
"bleak.BleakClient"
] | [((502, 526), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (524, 526), False, 'import asyncio\n'), ((260, 281), 'bleak.BleakClient', 'BleakClient', (['mac_addr'], {}), '(mac_addr)\n', (271, 281), False, 'from bleak import BleakClient\n'), ((415, 432), 'platform.system', 'platform.system', ([], ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 12:05:08 2018
@author: Alexandre
"""
###############################################################################
import numpy as np
###############################################################################
from pyro.dynamic import pendulum
from pyro.control ... | [
"numpy.array",
"pyro.control.linear.PIDController",
"numpy.zeros",
"pyro.dynamic.pendulum.SinglePendulum.h"
] | [((967, 999), 'pyro.control.linear.PIDController', 'linear.PIDController', (['kp', 'ki', 'kd'], {}), '(kp, ki, kd)\n', (987, 999), False, 'from pyro.control import linear\n'), ((1024, 1040), 'numpy.array', 'np.array', (['[3.14]'], {}), '([3.14])\n', (1032, 1040), True, 'import numpy as np\n'), ((725, 765), 'pyro.dynami... |
'''
Copyright (c) 2011 Ansvia. http://www.ansvia.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.environ.get",
"os.path.isdir",
"os.unlink"
] | [((6259, 6287), 'os.environ.get', 'os.environ.get', (['"""SCALA_HOME"""'], {}), "('SCALA_HOME')\n", (6273, 6287), False, 'import os\n'), ((7557, 7577), 'os.path.join', 'os.path.join', (['*paths'], {}), '(*paths)\n', (7569, 7577), False, 'import os\n'), ((7722, 7742), 'os.path.join', 'os.path.join', (['*paths'], {}), '(... |
# https://docs.aws.amazon.com/code-samples/latest/catalog/python-secretsmanager-secrets_manager.py.html
import boto3
from abc import ABC
import logging
import json
class SecretsManager(ABC):
def __init__(self, secret_id: str):
self._secret_id = secret_id
self._logger = logging.getLogger(SecretsMan... | [
"logging.getLogger",
"json.loads",
"boto3.session.Session"
] | [((292, 334), 'logging.getLogger', 'logging.getLogger', (['SecretsManager.__name__'], {}), '(SecretsManager.__name__)\n', (309, 334), False, 'import logging\n'), ((381, 404), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (402, 404), False, 'import boto3\n'), ((465, 488), 'boto3.session.Session', '... |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.fetchtext
~~~~~~~~~~~~~~~~~~~~~~
Provides functions for fetching text data sources.
Accesses and extracts data from text sources on the web. This data can then be
merged with other data in your Pipe.
Examples:
basic usage::
>>> from riko... | [
"riko.utils.get_abspath",
"riko.bado.return_value",
"riko.utils.fetch",
"pygogo.Gogo",
"riko.utils.auto_close",
"riko.bado.io.async_url_open"
] | [((909, 942), 'pygogo.Gogo', 'gogo.Gogo', (['__name__'], {'monolog': '(True)'}), '(__name__, monolog=True)\n', (918, 942), True, 'import pygogo as gogo\n'), ((2409, 2429), 'riko.bado.return_value', 'return_value', (['stream'], {}), '(stream)\n', (2421, 2429), False, 'from riko.bado import coroutine, return_value, io\n'... |
import unittest
import libraries.morflessLibs as libs
# import test values and expected outputs
# main includes sidebar data
from unit.lists_test_io.lists_supplemental import POSTLIST_1, CONTACT_PAGE_POST
from unit.lists_test_io.lists_supplemental import TEMPLATE_SEARCH_CONTENT
from unit.lists_test_io.lists_supplemen... | [
"libraries.morflessLibs.lists.pcom_create_posts_pages_array",
"libraries.morflessLibs.lists.pcom_find_sticky_posts",
"libraries.morflessLibs.lists.pcom_find_sticky_posts_by_meta",
"libraries.morflessLibs.lists.pcom_calculate_posts_per_page",
"libraries.morflessLibs.lists.pcom_find_sub_list",
"libraries.mo... | [((15624, 15639), 'unittest.main', 'unittest.main', ([], {}), '()\n', (15637, 15639), False, 'import unittest\n'), ((646, 720), 'libraries.morflessLibs.string_processes.pcom_build_dictionary', 'libs.string_processes.pcom_build_dictionary', (['libs.globals.DEFAULT_SETTINGS'], {}), '(libs.globals.DEFAULT_SETTINGS)\n', (6... |
#
# This code is for detecting proper region of the plate
# with the combined approach
#
# imports
import cv2
import imutils
import numpy as np
from imutils import paths
# import RDetectPlates as detplt
from imutils import perspective
import matplotlib.pyplot as plt
import sklearn as sk
from sklearn.decomposition impor... | [
"cv2.rectangle",
"imutils.perspective.four_point_transform",
"numpy.array",
"imutils.paths.list_images",
"matplotlib.pyplot.imshow",
"cv2.threshold",
"cv2.erode",
"numpy.max",
"matplotlib.pyplot.close",
"cv2.minAreaRect",
"numpy.min",
"Regressor_01.Regression_plt",
"cv2.boxPoints",
"cv2.mo... | [((722, 743), 'cv2.imread', 'cv2.imread', (['imgs[rnd]'], {}), '(imgs[rnd])\n', (732, 743), False, 'import cv2\n'), ((749, 765), 'matplotlib.pyplot.imshow', 'plt.imshow', (['gimg'], {}), '(gimg)\n', (759, 765), True, 'import matplotlib.pyplot as plt\n'), ((770, 781), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '(... |
# Generated by Django 2.2.7 on 2019-11-16 23:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cadastro', '0005_auto_20191116_2034'),
]
operations = [
migrations.CreateModel(
name='historicocacamba',
fields=[
... | [
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((341, 392), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (357, 392), False, 'from django.db import migrations, models\n'), ((426, 512), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max... |
import ast
import copy
import json
import logging
import uuid
from datetime import datetime
import pytz
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.db.models import Count
from django.db.models i... | [
"django.http.HttpResponseBadRequest",
"logging.debug",
"django.db.models.Count",
"contentcuration.models.Channel.objects.exclude",
"rest_framework.decorators.authentication_classes",
"contentcuration.models.ContentNode.objects.prefetch_related",
"contentcuration.models.ContentNode.objects.delay_mptt_upd... | [((1869, 1937), 'rest_framework.decorators.authentication_classes', 'authentication_classes', (['(TokenAuthentication, SessionAuthentication)'], {}), '((TokenAuthentication, SessionAuthentication))\n', (1891, 1937), False, 'from rest_framework.decorators import authentication_classes\n'), ((1939, 1977), 'rest_framework... |
# Import the required modules
from IPython.display import clear_output
import socket
import sys
import cv2
import matplotlib.pyplot as plt
import pickle
import numpy as np
import struct ## new
import zlib
from PIL import Image, ImageOps
class Receiver:
def __init__(self, HOST, PORT_send, PORT_receive,):
se... | [
"struct.calcsize",
"socket.socket",
"struct.unpack",
"cv2.imdecode",
"pickle.loads",
"cv2.waitKey"
] | [((447, 496), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (460, 496), False, 'import socket\n'), ((585, 634), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (598, ... |
import os
import textwrap
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
required_conan_version = ">=1.36.0"
class TensorflowLiteConan(ConanFile):
name = "tensorflow-lite"
license = "Apache-2.0"
homepage = "https://www.tensorflow.org/lite/guide"
url = ... | [
"textwrap.dedent",
"conans.tools.remove_files_by_mask",
"conans.CMake",
"conans.errors.ConanInvalidConfiguration",
"os.path.join",
"conans.tools.patch",
"conans.tools.check_min_cppstd",
"conans.tools.get",
"conans.tools.save",
"conans.tools.collect_libs"
] | [((1295, 1323), 'os.path.join', 'os.path.join', (['"""lib"""', '"""cmake"""'], {}), "('lib', 'cmake')\n", (1307, 1323), False, 'import os\n'), ((3370, 3480), 'conans.tools.get', 'tools.get', ([], {'strip_root': '(True)', 'destination': 'self._source_subfolder'}), "(**self.conan_data['sources'][self.version], strip_root... |
#import CV libraries
import numpy
import cv2
img=cv2.imread("/home/udayan/Downloads/J.png", 0) #read image, 0=read as grayscale, -1=read as color
ret,thresh=cv2.threshold(img, 127, 255, cv2.THRESH_BINARY) #threshold image
kernel=cv2.getStructuringElement(cv2.MORPH_RECT, (5,5)) #get 5x5 structuring element,... | [
"cv2.threshold",
"cv2.erode",
"cv2.imshow",
"cv2.morphologyEx",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.dilate",
"cv2.getStructuringElement",
"cv2.imread"
] | [((50, 95), 'cv2.imread', 'cv2.imread', (['"""/home/udayan/Downloads/J.png"""', '(0)'], {}), "('/home/udayan/Downloads/J.png', 0)\n", (60, 95), False, 'import cv2\n'), ((162, 209), 'cv2.threshold', 'cv2.threshold', (['img', '(127)', '(255)', 'cv2.THRESH_BINARY'], {}), '(img, 127, 255, cv2.THRESH_BINARY)\n', (175, 209),... |
"""Utilities for working with parsers from other applications"""
from stevedore.extension import ExtensionManager
from stevedore.driver import DriverManager
from typing import Iterator, Union, Dict, List
from collections import namedtuple
from copy import deepcopy
from materials_io.adapters.base import BaseAdapter
fr... | [
"logging.getLogger",
"collections.namedtuple",
"stevedore.extension.ExtensionManager",
"stevedore.driver.DriverManager",
"copy.deepcopy"
] | [((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((427, 485), 'collections.namedtuple', 'namedtuple', (['"""ParseResult"""', "['group', 'parser', 'metadata']"], {}), "('ParseResult', ['group', 'parser', 'metadata'])\n", (437, 485), False... |
from functools import partial
from unittest.mock import ANY
import pytest
from bs4 import BeautifulSoup, element
from flask import url_for
from freezegun import freeze_time
from app.main.views.feedback import (
PROBLEM_TICKET_TYPE,
QUESTION_TICKET_TYPE,
has_live_services,
in_business_hours,
)
from tes... | [
"app.main.views.feedback.has_live_services",
"app.main.views.feedback.in_business_hours",
"flask.url_for",
"pytest.mark.parametrize",
"functools.partial",
"freezegun.freeze_time"
] | [((419, 493), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""endpoint"""', "['main.old_feedback', 'main.support']"], {}), "('endpoint', ['main.old_feedback', 'main.support'])\n", (442, 493), False, 'import pytest\n'), ((801, 842), 'freezegun.freeze_time', 'freeze_time', (['"""2016-12-12 12:00:00.000000"""'... |
import gspread_dataframe as gd
import gspread as gs
import csv
import pandas as pd
gc = gs.service_account(filename='test.json')
def export_to_sheets(df, mode='r'):
sh = gc.open_by_key('<KEY>').worksheet('main')
if(mode == 'w'):
sh.clear()
gd.set_with_dataframe(worksheet=sh, dataframe=df, incl... | [
"gspread.service_account",
"gspread_dataframe.set_with_dataframe",
"gspread_dataframe.get_as_dataframe"
] | [((89, 129), 'gspread.service_account', 'gs.service_account', ([], {'filename': '"""test.json"""'}), "(filename='test.json')\n", (107, 129), True, 'import gspread as gs\n'), ((266, 381), 'gspread_dataframe.set_with_dataframe', 'gd.set_with_dataframe', ([], {'worksheet': 'sh', 'dataframe': 'df', 'include_index': '(False... |
from unittest import TestCase
from slybot.starturls import FragmentGenerator
class FragmentGeneratorTest(TestCase):
def test_generated_url_list(self):
github_start_urls = [
'https://github.com/scrapinghub',
'https://github.com/scrapy',
'https://github.com/scrapy-plugin... | [
"slybot.starturls.FragmentGenerator"
] | [((572, 591), 'slybot.starturls.FragmentGenerator', 'FragmentGenerator', ([], {}), '()\n', (589, 591), False, 'from slybot.starturls import FragmentGenerator\n'), ((1062, 1081), 'slybot.starturls.FragmentGenerator', 'FragmentGenerator', ([], {}), '()\n', (1079, 1081), False, 'from slybot.starturls import FragmentGenera... |
#!/usr/bin/env python3
import numpy as np
from gym import spaces
from gym.utils import seeding
from learn2learn.gym.envs.meta_env import MetaEnv
class Particles2DEnv(MetaEnv):
"""
[[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/gym/envs/particles/particles_2d.py)
**Descript... | [
"numpy.clip",
"numpy.abs",
"numpy.sqrt",
"gym.spaces.Box",
"numpy.zeros",
"gym.utils.seeding.np_random"
] | [((756, 822), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-np.inf)', 'high': 'np.inf', 'shape': '(2,)', 'dtype': 'np.float32'}), '(low=-np.inf, high=np.inf, shape=(2,), dtype=np.float32)\n', (766, 822), False, 'from gym import spaces\n'), ((895, 955), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-0.1)', 'high': '(... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
The purpose of this script is to add the module wrappers around the
contents of each of the javascript files locate... | [
"os.path.exists",
"argparse.ArgumentParser"
] | [((564, 589), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (587, 589), False, 'import argparse\n'), ((785, 801), 'os.path.exists', 'path.exists', (['arg'], {}), '(arg)\n', (796, 801), False, 'from os import path\n')] |
# Copyright (c) 2018 Sony Pictures Imageworks 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... | [
"PySide2.QtWidgets.QMenu",
"PySide2.QtGui.qApp.request_update.connect",
"PySide2.QtWidgets.QApplication.clipboard",
"opencue.search.ProcSearch",
"opencue.api.getProcs",
"time.time"
] | [((3093, 3120), 'opencue.search.ProcSearch', 'opencue.search.ProcSearch', ([], {}), '()\n', (3118, 3120), False, 'import opencue\n'), ((3494, 3547), 'PySide2.QtGui.qApp.request_update.connect', 'QtGui.qApp.request_update.connect', (['self.updateRequest'], {}), '(self.updateRequest)\n', (3527, 3547), False, 'from PySide... |
import gym
import model
import exp_replay
import random
from wrappers import *
import torch
import torch.nn.functional as F
from collections import namedtuple
from tqdm import tqdm
from itertools import count
class Agent():
def __init__(self,action_space,frame_history_len,env,device,buffer_size,\
epsilon_start... | [
"model.DQN",
"collections.namedtuple",
"torch.as_tensor",
"torch.from_numpy",
"torch.nn.functional.smooth_l1_loss",
"torch.no_grad",
"torch.tensor",
"itertools.count",
"torch.cuda.is_available",
"torch.save",
"exp_replay.ExperienceReplay",
"random.random",
"gym.make",
"torch.cat"
] | [((5231, 5261), 'gym.make', 'gym.make', (['"""PongNoFrameskip-v4"""'], {}), "('PongNoFrameskip-v4')\n", (5239, 5261), False, 'import gym\n'), ((5611, 5657), 'torch.save', 'torch.save', (['myagent.policy_qnet', '"""saved_model"""'], {}), "(myagent.policy_qnet, 'saved_model')\n", (5621, 5657), False, 'import torch\n'), (... |
"""
demo.py - demonstration program for freq2note.py
by <NAME> | <EMAIL> | http://groverlab.org
"""
import freq2note as f2n
freqs = [23, 120.0, 345.0, 440.1, 5001.1]
notes = ""
for f in freqs:
notes = notes + f2n.lilypond(f2n.find_closest_note(f))
f2n.write(notes)
| [
"freq2note.write",
"freq2note.find_closest_note"
] | [((256, 272), 'freq2note.write', 'f2n.write', (['notes'], {}), '(notes)\n', (265, 272), True, 'import freq2note as f2n\n'), ((229, 253), 'freq2note.find_closest_note', 'f2n.find_closest_note', (['f'], {}), '(f)\n', (250, 253), True, 'import freq2note as f2n\n')] |
import pytest
from genutil import datatypes
class TestIsListOfStrings:
@pytest.mark.parametrize(
"test_parameter,expected",
[
pytest.param(["this", "is", "a", "list", "of", "strings"], True, id="Param1 - List of Strings"),
pytest.param("no list, but string", False, id="Para... | [
"genutil.datatypes.is_list_of_strings",
"pytest.param"
] | [((588, 632), 'genutil.datatypes.is_list_of_strings', 'datatypes.is_list_of_strings', (['test_parameter'], {}), '(test_parameter)\n', (616, 632), False, 'from genutil import datatypes\n'), ((160, 260), 'pytest.param', 'pytest.param', (["['this', 'is', 'a', 'list', 'of', 'strings']", '(True)'], {'id': '"""Param1 - List ... |
#!/usr/bin/python
"""
The analyser is the entrypoint for the analysis
>>> analyser = GitAnalyser('repos/django')
>>> analyser.analyse()
>>> analyser.output_html('django_analysis.html')
"""
import git
import datetime as dt
import argparse
import json
__version__ = '0.0.1'
class AnalysisEmptyError(E... | [
"argparse.ArgumentParser",
"datetime.datetime.strptime",
"json.dumps",
"datetime.date",
"git.Repo"
] | [((4990, 5105), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('Analyse repository and generate analysis report in ' + 'given html file')"}), "(description=\n 'Analyse repository and generate analysis report in ' + 'given html file')\n", (5013, 5105), False, 'import argparse\n'), ((569,... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 applicab... | [
"os.path.join"
] | [((1040, 1142), 'os.path.join', 'os.path.join', (['self.base_path', '"""default_thumbnails"""', 'default_top_level', 'default_sub_type', 'file_name'], {}), "(self.base_path, 'default_thumbnails', default_top_level,\n default_sub_type, file_name)\n", (1052, 1142), False, 'import os\n'), ((1235, 1328), 'os.path.join',... |
import json
import numpy as np
import os
import pickle
import sklearn.metrics
import time
from chapydette import cp_estimation
def load_features(cruise, features_dir, projection_dim, subsample_num=1, subsample_of=1):
"""
Load features for a cruise.
:param cruise: Cruise to load features for.
:param ... | [
"numpy.median",
"numpy.sqrt",
"os.path.join",
"numpy.percentile",
"time.time",
"numpy.round"
] | [((1742, 1758), 'numpy.median', 'np.median', (['dists'], {}), '(dists)\n', (1751, 1758), True, 'import numpy as np\n'), ((1890, 1915), 'numpy.sqrt', 'np.sqrt', (['(1 / (2 * gammas))'], {}), '(1 / (2 * gammas))\n', (1897, 1915), True, 'import numpy as np\n'), ((10935, 10946), 'time.time', 'time.time', ([], {}), '()\n', ... |
import numpy as np
import skimage.segmentation
import skimage.io
import keras.backend as K
import tensorflow as tf
debug = False
def channel_precision(channel, name):
def precision_func(y_true, y_pred):
y_pred_tmp = K.cast(tf.equal( K.argmax(y_pred, axis=-1), channel), "float32")
true_positives = ... | [
"keras.backend.clip",
"numpy.argmax",
"numpy.max",
"keras.backend.argmax",
"numpy.sum",
"numpy.empty",
"keras.backend.epsilon",
"numpy.full",
"numpy.zeros_like"
] | [((1574, 1588), 'numpy.max', 'np.max', (['labels'], {}), '(labels)\n', (1580, 1588), True, 'import numpy as np\n'), ((1637, 1675), 'numpy.zeros_like', 'np.zeros_like', (['labels'], {'dtype': 'np.uint16'}), '(labels, dtype=np.uint16)\n', (1650, 1675), True, 'import numpy as np\n'), ((2484, 2554), 'numpy.argmax', 'np.arg... |
"""
Add samples
This script takes a wav file that must have n peaks and create n different files for each peak.
"""
import numpy as np
from scipy.io.wavfile import read,write
import peakutils, os
# average
# 3169 / 2 = 1584.5
side = 10000
# The stander for the peaks
stander = 0
"""
Write the .wav file
"""
def exp... | [
"numpy.array",
"scipy.io.wavfile.read",
"scipy.io.wavfile.write",
"os.getcwd"
] | [((353, 380), 'scipy.io.wavfile.write', 'write', (['filename', 'rate', 'data'], {}), '(filename, rate, data)\n', (358, 380), False, 'from scipy.io.wavfile import read, write\n'), ((1462, 1476), 'scipy.io.wavfile.read', 'read', (['filenmae'], {}), '(filenmae)\n', (1466, 1476), False, 'from scipy.io.wavfile import read, ... |
# flake8: noqa
"""
Perspective example using the lower level rendering API.
This is definitely in the advanced section, but it can be
a useful tool to learn. Sometimes we want perspective
projection for things like backgrounds. This can be
done very efficiently with shaders.
In this example we render content into a f... | [
"pyglet.math.Mat4.from_rotation",
"pyglet.math.Mat4.perspective_projection",
"array.array",
"pyglet.math.Mat4.from_translation",
"arcade.set_viewport",
"arcade.gl.BufferDescription",
"arcade.SpriteList",
"arcade.Sprite"
] | [((1565, 1629), 'pyglet.math.Mat4.perspective_projection', 'Mat4.perspective_projection', (['self.aspect_ratio', '(0.1)', '(100)'], {'fov': '(75)'}), '(self.aspect_ratio, 0.1, 100, fov=75)\n', (1592, 1629), False, 'from pyglet.math import Mat4\n'), ((2811, 2830), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\... |
import warnings
import csv
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from models.cnn_models import CNN1
from sklearn.model_selection import train_test_split
from tensorflow.keras.utils import to_categorical, plot_model
# gpus = tf.config.experimental.li... | [
"matplotlib.pyplot.imshow",
"tensorflow.keras.utils.to_categorical",
"matplotlib.pyplot.savefig",
"tensorflow.config.experimental.set_memory_growth",
"sklearn.model_selection.train_test_split",
"csv.writer",
"models.cnn_models.CNN1",
"numpy.argmax",
"tensorflow.keras.utils.plot_model",
"numpy.arra... | [((412, 463), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (456, 463), True, 'import tensorflow as tf\n'), ((485, 536), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['gpu', '(... |
#!/usr/bin/python
# Copyright 2020 Northern.tech AS
#
# 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 ap... | [
"subprocess.Popen",
"os.path.join",
"os.symlink",
"os.getcwd",
"os.remove",
"requests.head",
"subprocess.call",
"os.unlink",
"os.path.abspath",
"re.search"
] | [((777, 866), 'subprocess.call', 'subprocess.call', (["['s3cmd', '--follow-symlinks', 'put', artifact, 's3://mender/temp/']"], {}), "(['s3cmd', '--follow-symlinks', 'put', artifact,\n 's3://mender/temp/'])\n", (792, 866), False, 'import subprocess\n'), ((893, 983), 'subprocess.call', 'subprocess.call', (["['s3cmd', ... |
# Generated by Django 3.1.2 on 2020-10-12 22:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('documents', '0008_fieldcategory_count'),
]
operations = [
migrations.AddField(
model_name='document',
name='related'... | [
"django.db.models.ManyToManyField"
] | [((340, 512), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'help_text': '"""This document is related to (or part of) another document/incident"""', 'related_name': '"""_document_related_+"""', 'to': '"""documents.Document"""'}), "(help_text=\n 'This document is related to (or part of) another ... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Tue Jul 2 13:23:21 2013
# by: The Resource Compiler for PyQt (Qt v4.8.3)
#
# WARNING! All changes made in this file will be lost!
# this line manually edited
from enaml.qt import QtCore
qt_resource_data = b"\
\x00\x00\x02\x61\
\x89\
\x50\x4e\x47\x0d\x0... | [
"enaml.qt.QtCore.qUnregisterResourceData",
"enaml.qt.QtCore.qRegisterResourceData"
] | [((32798, 32889), 'enaml.qt.QtCore.qRegisterResourceData', 'QtCore.qRegisterResourceData', (['(1)', 'qt_resource_struct', 'qt_resource_name', 'qt_resource_data'], {}), '(1, qt_resource_struct, qt_resource_name,\n qt_resource_data)\n', (32826, 32889), False, 'from enaml.qt import QtCore\n'), ((32919, 33012), 'enaml.q... |
from BS.utils import read_src_socket_bs, save_list_to_file, read_src_bs
def get_adjusted_participles_bg():
socket_group_word_form_list = read_src_socket_bs('src_dict/БГ 28.01.21.txt')
adjusted_participles_list = []
for group in socket_group_word_form_list:
for sub_group in group.sub_groups:
... | [
"BS.utils.read_src_bs",
"BS.utils.save_list_to_file",
"BS.utils.read_src_socket_bs"
] | [((143, 189), 'BS.utils.read_src_socket_bs', 'read_src_socket_bs', (['"""src_dict/БГ 28.01.21.txt"""'], {}), "('src_dict/БГ 28.01.21.txt')\n", (161, 189), False, 'from BS.utils import read_src_socket_bs, save_list_to_file, read_src_bs\n'), ((921, 960), 'BS.utils.read_src_bs', 'read_src_bs', (['"""src_dict/БС 28.01.21.t... |
import argparse
import datetime
import hashlib
import imghdr
import json
import os
import shutil
import tqdm
from PIL import Image
def get_date_taken(path):
try:
if os.path.exists(path + ".json"):
j = json.load(open(path + ".json", "rt"))
if "photoTakenTime" in j:
... | [
"os.path.exists",
"datetime.datetime.fromtimestamp",
"PIL.Image.open",
"os.makedirs",
"argparse.ArgumentParser",
"shutil.move",
"tqdm.tqdm",
"os.path.join",
"os.path.split",
"os.path.isdir",
"imghdr.what",
"os.path.basename",
"os.path.getmtime",
"os.walk"
] | [((873, 910), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""imgtimeloc"""'], {}), "('imgtimeloc')\n", (896, 910), False, 'import argparse\n'), ((1187, 1202), 'os.walk', 'os.walk', (['srcdir'], {}), '(srcdir)\n', (1194, 1202), False, 'import os\n'), ((1977, 1996), 'tqdm.tqdm', 'tqdm.tqdm', (['picfiles'], {... |
import json
import numbers
import fhirpathpy.engine.util as util
from fhirpathpy.engine.evaluators import evaluators
from fhirpathpy.engine.invocations import invocations
def check_integer_param(val):
data = util.get_data(val)
if int(data) != data:
raise Exception("Expected integer, got: " + json.dump... | [
"fhirpathpy.engine.evaluators.evaluators.get",
"fhirpathpy.engine.util.get_data",
"json.dumps",
"fhirpathpy.engine.util.is_nullable",
"fhirpathpy.engine.util.arraify",
"fhirpathpy.engine.util.is_empty"
] | [((214, 232), 'fhirpathpy.engine.util.get_data', 'util.get_data', (['val'], {}), '(val)\n', (227, 232), True, 'import fhirpathpy.engine.util as util\n'), ((387, 405), 'fhirpathpy.engine.util.get_data', 'util.get_data', (['val'], {}), '(val)\n', (400, 405), True, 'import fhirpathpy.engine.util as util\n'), ((579, 597), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script doing the actual virtual screening of a library of compounds over a previously built Bayesian model.
"""
import argparse
import logging
import numpy as np
import csv
import json
import math
from rdkit import Chem
import common
__author__ = "<NA... | [
"numpy.mean",
"argparse.ArgumentParser",
"math.floor",
"common.to_float",
"common.fragments_extraction",
"math.log",
"common.delete_files",
"numpy.array",
"common.init_logging",
"common.descriptors_extraction",
"json.load",
"common.open_file",
"math.isnan"
] | [((1746, 1791), 'math.log', 'math.log', (["(probs['active'] / probs['inactive'])"], {}), "(probs['active'] / probs['inactive'])\n", (1754, 1791), False, 'import math\n'), ((4903, 4921), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (4911, 4921), True, 'import numpy as np\n'), ((6717, 6738), 'common.ini... |
# Copyright (c) 2019-2020, <NAME>
# License: MIT License
from ezdxf.math import BoundingBox, BoundingBox2d
class TestBoundingBox:
def test_init(self):
bbox = BoundingBox([(0, 0, 0), (10, 10, 10)])
assert bbox.extmin == (0, 0, 0)
assert bbox.extmax == (10, 10, 10)
bbox = BoundingBo... | [
"ezdxf.math.BoundingBox",
"ezdxf.math.BoundingBox2d"
] | [((172, 210), 'ezdxf.math.BoundingBox', 'BoundingBox', (['[(0, 0, 0), (10, 10, 10)]'], {}), '([(0, 0, 0), (10, 10, 10)])\n', (183, 210), False, 'from ezdxf.math import BoundingBox, BoundingBox2d\n'), ((310, 348), 'ezdxf.math.BoundingBox', 'BoundingBox', (['[(10, 10, 10), (0, 0, 0)]'], {}), '([(10, 10, 10), (0, 0, 0)])\... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 23:52:15 2019
@author: Admin
"""
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, accuracy_score,classification_report
from sklearn.decomposition import FastICA
from sklearn.svm import SVC
import numpy as np
import pandas as pd... | [
"matplotlib.pyplot.imshow",
"sklearn.svm.SVC",
"sklearn.metrics.classification_report",
"seaborn.heatmap",
"matplotlib.pyplot.figure",
"sklearn.decomposition.FastICA",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.confusion_matrix"
] | [((667, 702), 'matplotlib.pyplot.imshow', 'plt.imshow', (['ica_c[300]'], {'cmap': '"""gray"""'}), "(ica_c[300], cmap='gray')\n", (677, 702), True, 'import matplotlib.pyplot as plt\n'), ((757, 777), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""'}), "(kernel='linear')\n", (760, 777), False, 'from sklearn.svm im... |
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
path('login/', obtain_jwt_token),
] | [
"django.urls.path"
] | [((104, 136), 'django.urls.path', 'path', (['"""login/"""', 'obtain_jwt_token'], {}), "('login/', obtain_jwt_token)\n", (108, 136), False, 'from django.urls import path\n')] |
""" impyute.imputation.ts.locf """
import numpy as np
from impyute.util import find_null
from impyute.util import checks
from impyute.util import preprocess
@preprocess
@checks
def locf(data, axis=0):
""" Last Observation Carried Forward
For each set of missing indices, use the value of one row before(same
... | [
"numpy.shape",
"numpy.transpose",
"impyute.util.find_null",
"numpy.isnan"
] | [((1025, 1040), 'impyute.util.find_null', 'find_null', (['data'], {}), '(data)\n', (1034, 1040), False, 'from impyute.util import find_null\n'), ((958, 976), 'numpy.transpose', 'np.transpose', (['data'], {}), '(data)\n', (970, 976), True, 'import numpy as np\n'), ((1398, 1426), 'numpy.isnan', 'np.isnan', (['data[x_i + ... |
# Copyright 2015 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... | [
"collections.OrderedDict",
"google.cloud.bigquery._helpers._SCALAR_VALUE_TO_JSON_PARAM.get",
"copy.deepcopy"
] | [((12505, 12548), 'google.cloud.bigquery._helpers._SCALAR_VALUE_TO_JSON_PARAM.get', '_SCALAR_VALUE_TO_JSON_PARAM.get', (['self.type_'], {}), '(self.type_)\n', (12536, 12548), False, 'from google.cloud.bigquery._helpers import _SCALAR_VALUE_TO_JSON_PARAM\n'), ((20672, 20685), 'collections.OrderedDict', 'OrderedDict', ([... |
# Copyright 2018 - The Android Open Source Project
#
# 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 ... | [
"acloud.create.create_common.ParseHWPropertyArgs",
"os.path.exists",
"acloud.errors.InvalidHWPropertyError",
"acloud.errors.UnsupportedMultiAdbPort",
"acloud.errors.CheckPathError",
"acloud.errors.UnsupportedCreateArgs",
"argparse.ArgumentTypeError",
"acloud.errors.UnsupportedFlavor",
"acloud.intern... | [((21648, 21699), 'acloud.create.create_common.ParseHWPropertyArgs', 'create_common.ParseHWPropertyArgs', (['args.hw_property'], {}), '(args.hw_property)\n', (21681, 21699), False, 'from acloud.create import create_common\n'), ((17243, 17296), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (["(arg + ' is n... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="sopn-publish-date",
url="https://github.com/mrwilson/sopn-publish-date",
version="1.4.3",
description="Derive publish dates of Statements of Persons Nominated for UK elections",... | [
"setuptools.find_packages"
] | [((492, 507), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (505, 507), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 1.9.6 on 2016-08-30 21:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coderdojochi', '0005_auto_20160817_2313'),
]
operations = [
migrations.AddField(
model_name='session',
name='gender... | [
"django.db.models.CharField"
] | [((352, 465), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[(b'male', b'Male'), (b'female', b'Female')]", 'max_length': '(255)', 'null': '(True)'}), "(blank=True, choices=[(b'male', b'Male'), (b'female',\n b'Female')], max_length=255, null=True)\n", (368, 465), False, 'from ... |
'''
Codes for loading the MNIST data
'''
import numpy
import torch
from torchvision import datasets, transforms
class PartDataset(torch.utils.data.Dataset):
'''
Partial Dataset:
Extract the examples from the given dataset,
starting from the offset.
Stop if reach the length.
'''
... | [
"torchvision.transforms.ToTensor"
] | [((1135, 1156), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (1154, 1156), False, 'from torchvision import datasets, transforms\n'), ((1302, 1323), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (1321, 1323), False, 'from torchvision import datasets, transform... |
# Generated by Django 3.1.1 on 2021-05-20 12:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('me2ushop', '0079_auto_20210520_1340'),
]
operations = [
migrations.AlterField(
model_name='address',
name='payment_o... | [
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((346, 490), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('D', 'Debit Card'), ('C', 'Cash On Delivery'), ('M', 'M-Pesa'), ('S',\n 'Stripe'), ('P', 'Paypal')]", 'max_length': '(2)'}), "(choices=[('D', 'Debit Card'), ('C', 'Cash On Delivery'), (\n 'M', 'M-Pesa'), ('S', 'Stripe'), ('P', 'Pa... |
import itertools
import re
from eth_utils import (
remove_0x_prefix,
to_dict,
)
from .filesystem import (
is_under_path,
)
from .string import (
normalize_class_name,
)
def is_project_contract(contracts_source_dirs, contract_data):
return any(
is_under_path(source_dir, contract_data['sou... | [
"itertools.chain",
"re.sub",
"re.match",
"eth_utils.remove_0x_prefix"
] | [((3522, 3544), 'eth_utils.remove_0x_prefix', 'remove_0x_prefix', (['left'], {}), '(left)\n', (3538, 3544), False, 'from eth_utils import remove_0x_prefix, to_dict\n'), ((3568, 3591), 'eth_utils.remove_0x_prefix', 'remove_0x_prefix', (['right'], {}), '(right)\n', (3584, 3591), False, 'from eth_utils import remove_0x_pr... |
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'AC<KEY>'
auth_token = '<PASSWORD>'
# client = Client(account_sid, auth_tok... | [
"twilio.rest.Client"
] | [((380, 411), 'twilio.rest.Client', 'Client', (['account_sid', 'auth_token'], {}), '(account_sid, auth_token)\n', (386, 411), False, 'from twilio.rest import Client\n')] |
#!/usr/bin/env python
import os
import sys
actual_filename = 'actual'
result_filename = 'result'
def read_textfile(filename):
return [line.rstrip('\n').split(' ') for line in open(filename)]
def compare(result_fn, actual_fn):
print ('Loading actual results into memory. Please wait a moment...')
res... | [
"os.path.isfile",
"os.getppid",
"os.path.join"
] | [((1393, 1418), 'os.path.isfile', 'os.path.isfile', (['result_fn'], {}), '(result_fn)\n', (1407, 1418), False, 'import os\n'), ((1759, 1817), 'os.path.join', 'os.path.join', (['path', "(actual_fn + (actual_filename + '.txt'))"], {}), "(path, actual_fn + (actual_filename + '.txt'))\n", (1771, 1817), False, 'import os\n'... |
"""
actual class which do the file name cleanup functions
:copyright: 2020 <NAME>
:license: The MIT License
"""
import os
import shutil
import pathlib
from .helper_enums import FileNameCase
from .script_utils import ScriptUtils
class FileNameCleaner(object):
def __init__(self, input):
sel... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.splitext",
"os.walk"
] | [((1371, 1388), 'os.walk', 'os.walk', (['src_path'], {}), '(src_path)\n', (1378, 1388), False, 'import os\n'), ((3645, 3676), 'os.path.splitext', 'os.path.splitext', (['old_full_path'], {}), '(old_full_path)\n', (3661, 3676), False, 'import os\n'), ((1659, 1690), 'os.path.join', 'os.path.join', (['src_path', 'old_dir']... |
import sqlalchemy as sa
CERT = b"""-----<KEY>
-----END CERTIFICATE-----
"""
def test_ssl_args():
engine = sa.create_engine('redshift+psycopg2://test')
dialect = engine.dialect
url = engine.url
cargs, cparams = dialect.create_connect_args(url)
assert cargs == []
assert cparams.pop('host') =... | [
"sqlalchemy.create_engine"
] | [((114, 158), 'sqlalchemy.create_engine', 'sa.create_engine', (['"""redshift+psycopg2://test"""'], {}), "('redshift+psycopg2://test')\n", (130, 158), True, 'import sqlalchemy as sa\n')] |