code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"subprocess.check_output",
"os.getenv",
"os.path.join",
"ast.literal_eval",
"os.path.dirname"
] | [((3305, 3334), 'subprocess.check_output', 'subprocess.check_output', (['args'], {}), '(args)\n', (3328, 3334), False, 'import subprocess\n'), ((5504, 5531), 'os.getenv', 'os.getenv', (['LOCAL_REMOTE_ENV'], {}), '(LOCAL_REMOTE_ENV)\n', (5513, 5531), False, 'import os\n'), ((5545, 5572), 'os.getenv', 'os.getenv', (['LOC... |
import pandas as pd
import numpy as np
import csv
csv_file_loc = './/data//for-full-text-annotation.csv'
"""
Read in the CSV file and get the required data from it. Format the data.
"""
def get_file_description():
data = {}
all_rows = pd.read_csv(csv_file_loc)
all_rows = np.asarray(all_rows)
lab... | [
"numpy.asarray",
"pandas.read_csv",
"csv.reader"
] | [((246, 271), 'pandas.read_csv', 'pd.read_csv', (['csv_file_loc'], {}), '(csv_file_loc)\n', (257, 271), True, 'import pandas as pd\n'), ((287, 307), 'numpy.asarray', 'np.asarray', (['all_rows'], {}), '(all_rows)\n', (297, 307), True, 'import numpy as np\n'), ((815, 864), 'csv.reader', 'csv.reader', (['csvfile'], {'deli... |
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
UTILS
Utility functions.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2021 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to any person obtaining a
copy of this ... | [
"pygame.event.post",
"PIL.Image.open",
"pygame.mouse.get_cursor",
"traceback.print_stack",
"pygame.Color",
"pygame.mouse.get_pos",
"pygame.Surface.convert_alpha",
"sys._getframe",
"uuid.uuid4",
"pygame.event.Event",
"pygame.image.load",
"pygame.key.get_pressed",
"pygame.error",
"warnings.w... | [((16492, 16514), 'pygame.mouse.get_pos', 'pygame.mouse.get_pos', ([], {}), '()\n', (16512, 16514), False, 'import pygame\n'), ((23210, 23246), 'warnings.warn', 'warnings.warn', (['message'], {'stacklevel': '(2)'}), '(message, stacklevel=2)\n', (23223, 23246), False, 'import warnings\n'), ((8380, 8432), 'pygame.event.E... |
from pydub import AudioSegment
class Frame():
def __init__(self, start=0, end=0, audio=AudioSegment.empty()):
self.start = start
self.end = end
self.audio = audio
def __eq__(self, frame):
return self.start == frame.start and self.end == frame.end
def __len__(self):
... | [
"pydub.AudioSegment.empty"
] | [((93, 113), 'pydub.AudioSegment.empty', 'AudioSegment.empty', ([], {}), '()\n', (111, 113), False, 'from pydub import AudioSegment\n')] |
#
# SPDX-License-Identifier: MIT
#
import os
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake
class ManifestEntry:
'''A manifest item of a collection able to list missing packages'''
def __init__(self, entry):
self.file = entry
... | [
"os.path.exists",
"os.path.join",
"os.path.isfile",
"os.path.isdir",
"oeqa.utils.commands.bitbake",
"oeqa.utils.commands.get_bb_var"
] | [((1508, 1534), 'oeqa.utils.commands.get_bb_var', 'get_bb_var', (['bb_var', 'target'], {}), '(bb_var, target)\n', (1518, 1534), False, 'from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake\n'), ((2121, 2146), 'oeqa.utils.commands.bitbake', 'bitbake', (['self.buildtarget'], {}), '(self.buildtarget)\n', (2128... |
import gym
from vel.api.base import LinearBackboneModel, Model, ModelFactory
from vel.rl.modules.dueling_q_head import DuelingQHead
class QDuelingModel(Model):
""" Wraps a backbone model into API we need for Deep Q-Learning """
def __init__(self, backbone: LinearBackboneModel, action_space: gym.Space):
... | [
"vel.rl.modules.dueling_q_head.DuelingQHead"
] | [((399, 469), 'vel.rl.modules.dueling_q_head.DuelingQHead', 'DuelingQHead', ([], {'input_dim': 'backbone.output_dim', 'action_space': 'action_space'}), '(input_dim=backbone.output_dim, action_space=action_space)\n', (411, 469), False, 'from vel.rl.modules.dueling_q_head import DuelingQHead\n')] |
# Minimal example showing how to reuse the exported c-code with
# different time-steps.
#
# There are two use-cases demonstrated here. One use-case is to change
# the length of the time-stamp vector (this results in a different
# N). Another use-case is to change the final time but keep the number
# of shooting nodes i... | [
"numpy.tile",
"numpy.eye",
"sys.path.insert",
"acados_template.AcadosOcpSolver",
"acados_template.AcadosOcp",
"utils.plot_pendulum",
"numpy.diag",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.ndarray",
"pendulum_model.export_pendulum_ode_model",
"numpy.cumsum"
] | [((2088, 2119), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../common"""'], {}), "(0, '../common')\n", (2103, 2119), False, 'import sys\n'), ((2426, 2437), 'acados_template.AcadosOcp', 'AcadosOcp', ([], {}), '()\n', (2435, 2437), False, 'from acados_template import AcadosOcp, AcadosOcpSolver\n'), ((2459, 2486), ... |
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# Main, three machines (image - KMC, text - Logistic Regression, features - RF) and all white pdfs files
# @Authors: <NAME> and <NAME>
# @Version: 1.0
# @Date ... | [
"csv.DictWriter",
"sklearn.feature_extraction.text.TfidfTransformer",
"sklearn.metrics.classification_report",
"sklearn.ensemble.AdaBoostClassifier",
"sklearn.ensemble.AdaBoostRegressor",
"numpy.array",
"sys.exit",
"xgboost.sklearn.XGBRegressor",
"os.path.exists",
"sklearn.ensemble.RandomForestReg... | [((1825, 1850), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1848, 1850), False, 'import argparse\n'), ((2805, 2816), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2814, 2816), False, 'import os\n'), ((2836, 2878), 'os.path.join', 'os.path.join', (['folder_path', "args['dataset']"], {}), "(fo... |
from __future__ import absolute_import
import numpy as np
import chainer
import tqdm
import glob
import warnings
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from ..data import load_image # NOQA
class BaseDataset(chainer.dataset.DatasetMixin, metaclass=ABCMeta):
""" Base class of ... | [
"collections.OrderedDict",
"numpy.delete",
"tqdm.tqdm",
"numpy.asarray",
"pandas.read_excel",
"warnings.warn",
"distutils.version.LooseVersion",
"numpy.arange"
] | [((2079, 2092), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2090, 2092), False, 'from collections import OrderedDict\n'), ((5263, 5291), 'distutils.version.LooseVersion', 'LooseVersion', (['pd.__version__'], {}), '(pd.__version__)\n', (5275, 5291), False, 'from distutils.version import LooseVersion\n')... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.compat.v2.control_dependencies",
"tensorflow.compat.v2.as_dtype",
"tensorflow.compat.v2.compat.v1.assert_equal",
"tensorflow.compat.v2.multiply",
"tensorflow.compat.v2.identity",
"tensorflow.compat.v2.nest.flatten",
"keras.regularizers.serialize",
"tensorflow.compat.v2.reduce_sum",
"tens... | [((1821, 1835), 'tensorflow.compat.v2.identity', 'tf.identity', (['x'], {}), '(x)\n', (1832, 1835), True, 'import tensorflow.compat.v2 as tf\n'), ((3708, 3722), 'tensorflow.compat.v2.identity', 'tf.identity', (['x'], {}), '(x)\n', (3719, 3722), True, 'import tensorflow.compat.v2 as tf\n'), ((6779, 6820), 'keras.regular... |
import json
import logging
import math
from MySQLdb.connections import Connection
import pandas as pd
import random
import re
import sys
import traceback
import typing
from datetime import datetime, timedelta
from typing import Dict, List, Tuple, Union
from sshtunnel import SSHTunnelForwarder
# # import local files
im... | [
"realtime.ModelManager.ModelManager",
"json.loads",
"utils.Logger.toStdOut",
"interfaces.MySQLInterface.MySQLInterface",
"schemas.GameSchema.GameSchema",
"pandas.read_csv",
"managers.Request.ExporterFiles",
"interfaces.MySQLInterface.SQL.disconnectMySQLViaSSH",
"traceback.print_tb",
"interfaces.My... | [((2108, 2122), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2120, 2122), False, 'from datetime import datetime, timedelta\n'), ((2307, 2321), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2319, 2321), False, 'from datetime import datetime, timedelta\n'), ((3376, 3390), 'datetime.datetime.n... |
import commit
import json
import urllib2
import base64
from util import bytes
class RainerClient:
def __init__(self, base_uri):
if not base_uri:
raise ValueError("base_uri is required")
self.base_uri = base_uri
def commit_uri(self, key, version=None):
"""Base URI for a commit key, possibly at ... | [
"base64.b64decode",
"urllib2.urlopen",
"commit.RainerCommit"
] | [((549, 609), 'urllib2.urlopen', 'urllib2.urlopen', (["(self.base_uri + ('?all=yes' if all else ''))"], {}), "(self.base_uri + ('?all=yes' if all else ''))\n", (564, 609), False, 'import urllib2\n'), ((777, 865), 'urllib2.urlopen', 'urllib2.urlopen', (["(self.base_uri + '?payload_base64=yes' + ('&all=yes' if all else '... |
from huffman_classes import HuffmanCoding
#input file path
path = "./sample.txt"
h = HuffmanCoding(path)
output_path = h.compress()
h.decompress(output_path)
| [
"huffman_classes.HuffmanCoding"
] | [((87, 106), 'huffman_classes.HuffmanCoding', 'HuffmanCoding', (['path'], {}), '(path)\n', (100, 106), False, 'from huffman_classes import HuffmanCoding\n')] |
from urllib.parse import unquote
def get_groups(request):
from .models.groups import Group
# groups_string = list(map(lambda group: str(group), Group.objects.all()))
cur_group = get_current_group(request)
groups = []
for group in Group.objects.all().order_by('title'):
groups.append({
'id' : group.id... | [
"urllib.parse.unquote"
] | [((939, 960), 'urllib.parse.unquote', 'unquote', (['cookie_value'], {}), '(cookie_value)\n', (946, 960), False, 'from urllib.parse import unquote\n')] |
import os
from appdirs import AppDirs
from cihai.config import Configurator, expand_config
#: XDG App directory locations
dirs = AppDirs("cihai", "cihai team") # appname # app author
def test_configurator(tmpdir):
c = Configurator()
isinstance(c.dirs, AppDirs)
assert c
def test_expand_config_xdg_v... | [
"cihai.config.Configurator",
"cihai.config.expand_config",
"os.path.join",
"os.environ.get",
"appdirs.AppDirs",
"os.path.expanduser"
] | [((132, 162), 'appdirs.AppDirs', 'AppDirs', (['"""cihai"""', '"""cihai team"""'], {}), "('cihai', 'cihai team')\n", (139, 162), False, 'from appdirs import AppDirs\n'), ((229, 243), 'cihai.config.Configurator', 'Configurator', ([], {}), '()\n', (241, 243), False, 'from cihai.config import Configurator, expand_config\n'... |
import bisect
N = int(input())
A, B, C = [sorted(map(int, input().split())) for _ in range(3)]
ans, idx_b, idx_c = 0, 0, 0
for b in B:
idx_a = bisect.bisect_left(A, b)
idx_c = bisect.bisect_right(C, b)
ans += idx_a * (N - idx_c)
print(ans)
| [
"bisect.bisect_right",
"bisect.bisect_left"
] | [((148, 172), 'bisect.bisect_left', 'bisect.bisect_left', (['A', 'b'], {}), '(A, b)\n', (166, 172), False, 'import bisect\n'), ((185, 210), 'bisect.bisect_right', 'bisect.bisect_right', (['C', 'b'], {}), '(C, b)\n', (204, 210), False, 'import bisect\n')] |
import tkinter
from tkinter import ttk
from tkinter.scrolledtext import ScrolledText
class PopUp(tkinter.Toplevel):
def __init__(self, message: str):
super(PopUp, self).__init__()
self.geometry('800x600')
self.wm_title('Message')
btn = ttk.Button(self, text='Ok', command=self.de... | [
"tkinter.scrolledtext.ScrolledText",
"tkinter.ttk.Button"
] | [((277, 326), 'tkinter.ttk.Button', 'ttk.Button', (['self'], {'text': '"""Ok"""', 'command': 'self.destroy'}), "(self, text='Ok', command=self.destroy)\n", (287, 326), False, 'from tkinter import ttk\n'), ((415, 475), 'tkinter.scrolledtext.ScrolledText', 'ScrolledText', (['self'], {'width': '(360)', 'height': '(230)', ... |
import uuid
from django.db import models
from db.models.cart_model import Cart
# Create your models here.
class Order(models.Model):
PROCESSING_STOCK = 'Processing Stock'
DELIVERY_IN_PROGRESS = 'Delivery in Progress'
DELIVERED = 'Delivered'
NOT_DELIVERED = 'Not Delivered'
RETURNED = 'Returned'
... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.UUIDField",
"django.db.models.ForeignKey"
] | [((570, 640), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (586, 640), False, 'from django.db import models\n'), ((655, 704), 'django.db.models.ForeignKey', 'models.ForeignKe... |
from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from ...account import models
from ...account.error_codes import AccountErrorCode
from ...core.permissions import AccountPermissions
from ..core.mutations import BaseBulkMutation, ModelBulkDeleteMutation
from ..core... | [
"django.core.exceptions.ValidationError",
"collections.defaultdict",
"graphene.Boolean"
] | [((2120, 2137), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2131, 2137), False, 'from collections import defaultdict\n'), ((2926, 3023), 'graphene.Boolean', 'graphene.Boolean', ([], {'required': '(True)', 'description': '"""Determine if users will be set active or not."""'}), "(required=True,... |
## @package tools
# Bunch of tool functions.
#@author <NAME>
#@version 2.0
#TODO clean with only necessary functions.
import csv, glob
import subprocess, os, errno, sys, shutil
from contextlib import contextmanager
## Locking mechanism.
# Usage: with fileLock('lockFile.lock'):
# Source : http://amix.dk/blog/post/195... | [
"os.path.exists",
"shutil.copy2",
"csv.writer",
"os.path.isfile",
"os.path.isdir",
"subprocess.call",
"sys.exit",
"os.path.abspath",
"csv.reader",
"glob.glob",
"os.remove"
] | [((370, 394), 'os.path.exists', 'os.path.exists', (['lockFile'], {}), '(lockFile)\n', (384, 394), False, 'import subprocess, os, errno, sys, shutil\n'), ((3393, 3412), 'os.path.isfile', 'os.path.isfile', (['dst'], {}), '(dst)\n', (3407, 3412), False, 'import subprocess, os, errno, sys, shutil\n'), ((3442, 3464), 'shuti... |
import torch
import torch.nn as nn
def projection(u):
# return np.maximum(-1, np.minimum(u, 1))
return torch.clamp(torch.clamp(u, max=1), min=-1)
class MyLoss(torch.autograd.Function):
@staticmethod
def forward(ctx, x, weight, bias, y, lam):
y_hat = torch.sigmoid(x.mv(weight) + bias)
... | [
"torch.log",
"torch.mean",
"torch.sigmoid",
"torch.norm",
"torch.zeros",
"torch.clamp"
] | [((124, 145), 'torch.clamp', 'torch.clamp', (['u'], {'max': '(1)'}), '(u, max=1)\n', (135, 145), False, 'import torch\n'), ((888, 909), 'torch.mean', 'torch.mean', (['(y_hat - y)'], {}), '(y_hat - y)\n', (898, 909), False, 'import torch\n'), ((1848, 1864), 'torch.sigmoid', 'torch.sigmoid', (['a'], {}), '(a)\n', (1861, ... |
from django.forms import Textarea
from import_export.admin import ExportActionMixin
class SuperUserAdminMixin:
"""
Добавляет поля, которые не доступны пользователю
если он не являются суперпользователем
"""
list_readonly_not_superuser_fields = ()
def get_form(self, request, obj=None, **kwarg... | [
"django.forms.Textarea"
] | [((862, 872), 'django.forms.Textarea', 'Textarea', ([], {}), '()\n', (870, 872), False, 'from django.forms import Textarea\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 14:46:59 2017
Some personal numpy array filtering and finding intersections with indices
@author: <NAME>
"""
import numpy as np
import glob
import os
import shutil
def idx_filter(idx, *array_list):
new_array_list = []
for array in array_list:
new_arra... | [
"numpy.in1d",
"os.path.join",
"os.path.isfile",
"shutil.copyfile",
"os.path.basename"
] | [((760, 783), 'os.path.join', 'os.path.join', (['dir1', '"""*"""'], {}), "(dir1, '*')\n", (772, 783), False, 'import os\n'), ((836, 865), 'os.path.basename', 'os.path.basename', (['curFullFile'], {}), '(curFullFile)\n', (852, 865), False, 'import os\n'), ((890, 917), 'os.path.join', 'os.path.join', (['dir2', 'curFile']... |
from sdl2 import SDL_GetKeyboardState, SDL_PumpEvents, SDL_GetKeyFromName, SDL_GetScancodeFromKey
from collections import OrderedDict
from ctypes import ArgumentError
from .EventsListenerClass import EventsListener
from .eventClasses import *
class EventsManager(object):
def __init__(self):
self._listene... | [
"collections.OrderedDict",
"sdl2.SDL_GetKeyFromName",
"sdl2.SDL_GetScancodeFromKey",
"sdl2.SDL_PumpEvents",
"sdl2.SDL_GetKeyboardState"
] | [((325, 338), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (336, 338), False, 'from collections import OrderedDict\n'), ((365, 391), 'sdl2.SDL_GetKeyboardState', 'SDL_GetKeyboardState', (['None'], {}), '(None)\n', (385, 391), False, 'from sdl2 import SDL_GetKeyboardState, SDL_PumpEvents, SDL_GetKeyFromNa... |
from .utils import is_growing_season
from datetime import timedelta
from django.db import models
from django.conf import settings
from django.utils import timezone
from users.models import CustomUser
class House(models.Model):
owner = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, blank=True, null=True)... | [
"django.db.models.OneToOneField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.db.models.DateTimeField",
"datetime.timedelta",
"django.db.models.CharField"
] | [((241, 320), 'django.db.models.ForeignKey', 'models.ForeignKey', (['CustomUser'], {'on_delete': 'models.SET_NULL', 'blank': '(True)', 'null': '(True)'}), '(CustomUser, on_delete=models.SET_NULL, blank=True, null=True)\n', (258, 320), False, 'from django.db import models\n'), ((338, 370), 'django.db.models.CharField', ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, time
import pytz
from dateutil import rrule
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.addon... | [
"odoo._",
"dateutil.rrule.weekday",
"pytz.utc.localize",
"dateutil.relativedelta.relativedelta",
"dateutil.rrule.rrulestr",
"datetime.datetime.combine",
"odoo.fields.Date",
"odoo.fields.Datetime",
"odoo.fields.Many2one",
"odoo.api.depends",
"odoo.fields.Integer",
"odoo.fields.One2many",
"odo... | [((1906, 1954), 'odoo.fields.Char', 'fields.Char', ([], {'compute': '"""_compute_name"""', 'store': '(True)'}), "(compute='_compute_name', store=True)\n", (1917, 1954), False, 'from odoo import api, fields, models, _\n'), ((1975, 2041), 'odoo.fields.Many2one', 'fields.Many2one', (['"""calendar.event"""'], {'ondelete': ... |
import torch.nn as nn
import torch
import numpy as np
import torch.nn.functional as F
from ..utils import box_utils
class SSDLite(nn.Module):
def __init__(self, num_classes, base_net, extras, classification_headers, regression_headers, is_test=False, config=None, device=None):
"""Compose a SSD model usin... | [
"torch.nn.init.xavier_uniform_",
"torch.load",
"torch.from_numpy",
"torch.nn.functional.softmax",
"torch.cat",
"torch.device"
] | [((685, 707), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (697, 707), False, 'import torch\n'), ((1398, 1423), 'torch.cat', 'torch.cat', (['confidences', '(1)'], {}), '(confidences, 1)\n', (1407, 1423), False, 'import torch\n'), ((1444, 1467), 'torch.cat', 'torch.cat', (['locations', '(1)'],... |
######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"lib.boto3_util.create_client",
"ipaddress.ip_address",
"backoff.on_exception"
] | [((1700, 1722), 'lib.boto3_util.create_client', 'create_client', (['"""wafv2"""'], {}), "('wafv2')\n", (1713, 1722), False, 'from lib.boto3_util import create_client\n'), ((3652, 3739), 'backoff.on_exception', 'on_exception', (['expo', 'client.exceptions.WAFInternalErrorException'], {'max_time': 'MAX_TIME'}), '(expo, c... |
from quantworks.bitstamp import barfeed
from quantworks.bitstamp import broker
from quantworks import strategy
from quantworks.technical import ma
from quantworks.technical import cross
class Strategy(strategy.BaseStrategy):
def __init__(self, feed, brk):
super(Strategy, self).__init__(feed, brk)
... | [
"quantworks.technical.cross.cross_above",
"quantworks.bitstamp.barfeed.LiveTradeFeed",
"quantworks.technical.ma.SMA",
"quantworks.technical.cross.cross_below",
"quantworks.bitstamp.broker.PaperTradingBroker"
] | [((2584, 2607), 'quantworks.bitstamp.barfeed.LiveTradeFeed', 'barfeed.LiveTradeFeed', ([], {}), '()\n', (2605, 2607), False, 'from quantworks.bitstamp import barfeed\n'), ((2618, 2658), 'quantworks.bitstamp.broker.PaperTradingBroker', 'broker.PaperTradingBroker', (['(1000)', 'barFeed'], {}), '(1000, barFeed)\n', (2643,... |
import numpy as np
import torch
import torch.nn as nn
from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims
from rlpyt.models.mlp import MlpModel
from rlpyt.models.conv2d import Conv2dModel
import torch.nn.functional as F
def init(module, weight_init, bias_init, gain=1):
weight_init(module.weig... | [
"rlpyt.utils.tensor.restore_leading_dims",
"torch.nn.init.constant_",
"torch.nn.Conv2d",
"torch.chunk",
"rlpyt.utils.tensor.infer_leading_dims",
"torch.nn.Linear",
"torch.nn.init.calculate_gain",
"torch.cat"
] | [((515, 545), 'torch.nn.init.calculate_gain', 'nn.init.calculate_gain', (['"""relu"""'], {}), "('relu')\n", (537, 545), True, 'import torch.nn as nn\n'), ((3188, 3226), 'torch.cat', 'torch.cat', (['[obs, action_latent]'], {'dim': '(1)'}), '([obs, action_latent], dim=1)\n', (3197, 3226), False, 'import torch\n'), ((3974... |
import tinyflow as tf
from tinyflow.datasets import get_cifar10
import numpy as np
num_epoch = 10
num_batch = 600
batch_size = 100
def conv_factory(x, filter_size, in_filters, out_filters):
x = tf.nn.conv2d(x, num_filter=out_filters,
ksize=[1, filter_size, filter_size, 1], padding='SAME')
x = t... | [
"tinyflow.nn.linear",
"tinyflow.datasets.get_cifar10",
"tinyflow.train.AdamOptimizer",
"tinyflow.tanh",
"tinyflow.nn.flatten_layer",
"tinyflow.placeholder",
"tinyflow.initialize_all_variables",
"tinyflow.Session",
"tinyflow.nn.batch_normalization",
"tinyflow.reduce_mean",
"tinyflow.nn.conv2d",
... | [((1460, 1486), 'tinyflow.placeholder', 'tf.placeholder', (['tf.float32'], {}), '(tf.float32)\n', (1474, 1486), True, 'import tinyflow as tf\n'), ((1495, 1561), 'tinyflow.nn.conv2d', 'tf.nn.conv2d', (['x'], {'num_filter': '(16)', 'ksize': '[1, 5, 5, 1]', 'padding': '"""SAME"""'}), "(x, num_filter=16, ksize=[1, 5, 5, 1]... |
import warnings
from . import LRUCache
warnings.warn(
"cachetools.lru is deprecated, please use cachetools.LRUCache", DeprecationWarning
)
| [
"warnings.warn"
] | [((41, 142), 'warnings.warn', 'warnings.warn', (['"""cachetools.lru is deprecated, please use cachetools.LRUCache"""', 'DeprecationWarning'], {}), "('cachetools.lru is deprecated, please use cachetools.LRUCache',\n DeprecationWarning)\n", (54, 142), False, 'import warnings\n')] |
"""
Copyright 2015 <NAME>, <NAME>, <NAME> and <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | [
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.BooleanField"
] | [((832, 855), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (853, 855), False, 'from rest_framework import serializers\n'), ((1159, 1182), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1180, 1182), False, 'from rest_framework import serializers\... |
from itsdangerous import TimestampSigner
from time import time
import base64
import hashlib
import string
LOGIN_WINDOW_S = 60
CODE_WINDOW_S = 30
SHORT_SIG_LENGTH = 18
MIN_USERNAME_LENGTH = 3
USERNAME_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
SHUFFLED_CHARS = 'NGthMiXu2xmnfzVROkEjvaUPYg... | [
"string.maketrans",
"hashlib.sha256",
"string.translate",
"itsdangerous.TimestampSigner",
"time.time"
] | [((371, 419), 'string.maketrans', 'string.maketrans', (['USERNAME_CHARS', 'SHUFFLED_CHARS'], {}), '(USERNAME_CHARS, SHUFFLED_CHARS)\n', (387, 419), False, 'import string\n'), ((434, 482), 'string.maketrans', 'string.maketrans', (['SHUFFLED_CHARS', 'USERNAME_CHARS'], {}), '(SHUFFLED_CHARS, USERNAME_CHARS)\n', (450, 482)... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | [
"pulumi.get",
"pulumi.Alias",
"pulumi.getter",
"warnings.warn",
"pulumi.ResourceOptions",
"pulumi.ResourceOptions.merge"
] | [((7666, 7699), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""displayName"""'}), "(name='displayName')\n", (7679, 7699), False, 'import pulumi\n'), ((8302, 8333), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""lockLevel"""'}), "(name='lockLevel')\n", (8315, 8333), False, 'import pulumi\n'), ((8506, 8537), 'p... |
# Written by <NAME>, 2018
import numpy as np
import bisect
class SDR_Classifier:
"""Maximum Likelyhood classifier for SDRs."""
def __init__(self, alpha, input_sdr, num_labels):
"""
Argument alpha is the small constant used by the exponential moving
average which tracks input-output co... | [
"numpy.product",
"numpy.random.random",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.nonzero",
"numpy.random.uniform",
"numpy.cumsum"
] | [((544, 647), 'numpy.random.uniform', 'np.random.uniform', (['(0.1 * self.alpha)', '(0.2 * self.alpha)'], {'size': '(self.input_sdr.size, self.num_labels)'}), '(0.1 * self.alpha, 0.2 * self.alpha, size=(self.input_sdr.\n size, self.num_labels))\n', (561, 647), True, 'import numpy as np\n'), ((2357, 2377), 'numpy.zer... |
from flask import jsonify
from flask import request
from flask import current_app as capp
from typing import Any
from datetime import datetime
from datetime import timezone
from app.views.auth.functions.utils import loginRequired
from app.model.tables.cars import Car
class CarResources:
@classmethod
# r... | [
"app.model.tables.cars.Car",
"app.model.tables.cars.Car.query.filter_by",
"flask.current_app.db.session.commit",
"datetime.datetime.now",
"flask.request.form.to_dict",
"flask.current_app.db.session.add",
"flask.current_app.db.session.delete",
"flask.jsonify"
] | [((2925, 2951), 'datetime.datetime.now', 'datetime.now', (['timezone.utc'], {}), '(timezone.utc)\n', (2937, 2951), False, 'from datetime import datetime\n'), ((2966, 2975), 'app.model.tables.cars.Car', 'Car', (['data'], {}), '(data)\n', (2969, 2975), False, 'from app.model.tables.cars import Car\n'), ((2984, 3008), 'fl... |
import argparse
import torch as t
import torch.nn as nn
import torchvision.transforms as transforms
# from tensorboardX import SummaryWriter
from torch.autograd import Variable
from torch.optim import Adam
from torchvision import datasets
from models import *
if __name__ == "__main__":
parser = argparse.Argumen... | [
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable"
] | [((304, 348), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""train"""'}), "(description='train')\n", (327, 348), False, 'import argparse\n'), ((1666, 1740), 'torch.utils.data.DataLoader', 't.utils.data.DataLoader', (['dataset'], {'batch_size': 'args.batch_size', 'shuffle': '(True)'}), '(... |
#coding:utf8
#authors : yqq
import logging
import json
from utils import decimal_default,get_linenumber
from base_handler import BaseHandler
from .proxy import AuthServiceProxy
from cashaddress import convert
import traceback
#设置精度
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 8
f... | [
"decimal.getcontext",
"utils.json2dict",
"utils.get_linenumber",
"base_handler.BaseHandler.success_ret_with_data",
"cashaddress.convert.to_legacy_address",
"base_handler.BaseHandler.error_ret_with_data",
"utils.accumulate",
"utils.filtered",
"utils.recommended",
"decimal.Decimal",
"base_handler.... | [((296, 308), 'decimal.getcontext', 'getcontext', ([], {}), '()\n', (306, 308), False, 'from decimal import getcontext\n'), ((11889, 11917), 'utils.json2dict', 'json2dict', (['self.request.body'], {}), '(self.request.body)\n', (11898, 11917), False, 'from utils import json2dict\n'), ((15097, 15125), 'utils.json2dict', ... |
# Copyright 2018 Platform9 Systems, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wr... | [
"logging.getLogger",
"qbertconfig.kubeconfig.Kubeconfig"
] | [((742, 769), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (759, 769), False, 'import logging\n'), ((1016, 1061), 'qbertconfig.kubeconfig.Kubeconfig', 'Kubeconfig', ([], {'kcfg': 'samples.BASE_TEST_KUBECONFIG'}), '(kcfg=samples.BASE_TEST_KUBECONFIG)\n', (1026, 1061), False, 'from qbertc... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
"gbpservice.neutron.services.servicechain.plugins.ncp.config.cfg.CONF.set_override",
"mock.patch.object",
"neutron.db.model_base.BASEV2.metadata.create_all",
"oslo_serialization.jsonutils.dumps",
"neutron.db.api.get_engine"
] | [((4046, 4086), 'oslo_serialization.jsonutils.dumps', 'jsonutils.dumps', (['DEFAULT_VPN_CONFIG_DICT'], {}), '(DEFAULT_VPN_CONFIG_DICT)\n', (4061, 4086), False, 'from oslo_serialization import jsonutils\n'), ((5501, 5540), 'oslo_serialization.jsonutils.dumps', 'jsonutils.dumps', (['DEFAULT_LB_CONFIG_DICT'], {}), '(DEFAU... |
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | [
"designateclient.functionaltests.config.read_config",
"designateclient.functionaltests.client.DesignateCLI.as_user"
] | [((828, 848), 'designateclient.functionaltests.config.read_config', 'config.read_config', ([], {}), '()\n', (846, 848), False, 'from designateclient.functionaltests import config\n'), ((864, 902), 'designateclient.functionaltests.client.DesignateCLI.as_user', 'client.DesignateCLI.as_user', (['"""default"""'], {}), "('d... |
from itertools import product
import ConvexHullMaxPairOfPoints as convHull
from Data_and_Dicts import dictOfTonnetz
from FirstNotePosition import TonnetzToString
from TrajectoryClass import TrajectoryClass
""" Import convex Hull Comparison on set of cartesian points """
""" Import function that turn a Tonnetz list to ... | [
"itertools.product",
"ConvexHullMaxPairOfPoints.diameter",
"FirstNotePosition.TonnetzToString"
] | [((8949, 8974), 'ConvexHullMaxPairOfPoints.diameter', 'convHull.diameter', (['graph1'], {}), '(graph1)\n', (8966, 8974), True, 'import ConvexHullMaxPairOfPoints as convHull\n'), ((4321, 4342), 'itertools.product', 'product', (['chord', 'chord'], {}), '(chord, chord)\n', (4328, 4342), False, 'from itertools import produ... |
from django.urls import path
from share.views import sharepage
urlpatterns = [
path('',sharepage.as_view(),name='sharepage')
] | [
"share.views.sharepage.as_view"
] | [((88, 107), 'share.views.sharepage.as_view', 'sharepage.as_view', ([], {}), '()\n', (105, 107), False, 'from share.views import sharepage\n')] |
#!/usr/bin/env python3
from __future__ import annotations
import math
import os
import random
import unittest
import torch
import linear_operator
from linear_operator import settings
from linear_operator.test.utils import approx_equal
from linear_operator.utils import pivoted_cholesky
def rbf_kernel(x1, x2=None):... | [
"math.log",
"torch.cuda.is_available",
"torch.get_rng_state",
"torch.sum",
"unittest.main",
"torch.DoubleTensor",
"linear_operator.test.utils.approx_equal",
"linear_operator.utils.pivoted_cholesky.pivoted_cholesky",
"torch.cholesky",
"torch.solve",
"torch.set_rng_state",
"torch.linspace",
"t... | [((5912, 5927), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5925, 5927), False, 'import unittest\n'), ((1114, 1140), 'torch.linspace', 'torch.linspace', (['(0)', '(1)', 'size'], {}), '(0, 1, size)\n', (1128, 1140), False, 'import torch\n'), ((1212, 1263), 'linear_operator.utils.pivoted_cholesky.pivoted_cholesk... |
import os, sys
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]=""
import pandas as pd
import numpy as np
eps = 0.004
desired = {
0: 0.36239782,
1: 0.043841336,
2: 0.075268817,
3: 0.059322034,
4: 0.075268817,
5: 0.075268817,
6: 0.043841336,
7: 0.07526881... | [
"numpy.mean",
"keras.models.load_model",
"pandas.read_csv",
"Christof.utils.f1_sub",
"numpy.stack",
"numpy.zeros",
"numpy.linspace",
"numpy.transpose",
"numpy.arange",
"numpy.load"
] | [((752, 790), 'numpy.load', 'np.load', (["(MODEL_PATH + 'pred_ul_40.npy')"], {}), "(MODEL_PATH + 'pred_ul_40.npy')\n", (759, 790), True, 'import numpy as np\n'), ((801, 839), 'numpy.load', 'np.load', (["(MODEL_PATH + 'pred_ur_40.npy')"], {}), "(MODEL_PATH + 'pred_ur_40.npy')\n", (808, 839), True, 'import numpy as np\n'... |
import pyPROPOSAL as pp
import numpy as np
photo_real = [
pp.parametrization.photonuclear.Zeus,
pp.parametrization.photonuclear.BezrukovBugaev,
pp.parametrization.photonuclear.Rhode,
pp.parametrization.photonuclear.Kokoulin
]
particle_defs = [
pp.particle.MuMinusDef.get(),
pp.particle.TauMinus... | [
"pyPROPOSAL.particle.TauMinusDef.get",
"pyPROPOSAL.parametrization.photonuclear.ShadowButkevichMikhailov",
"os.makedirs",
"pyPROPOSAL.InterpolationDef",
"pyPROPOSAL.EnergyCutSettings",
"pyPROPOSAL.crosssection.PhotoIntegral",
"pyPROPOSAL.parametrization.photonuclear.ShadowDuttaRenoSarcevicSeckel",
"os... | [((1369, 1395), 'numpy.logspace', 'np.logspace', (['(4)', '(13)'], {'num': '(10)'}), '(4, 13, num=10)\n', (1380, 1395), True, 'import numpy as np\n'), ((1411, 1432), 'pyPROPOSAL.InterpolationDef', 'pp.InterpolationDef', ([], {}), '()\n', (1430, 1432), True, 'import pyPROPOSAL as pp\n'), ((266, 294), 'pyPROPOSAL.particl... |
"""
CGI Base Session Manager
Provides a scheme for maintaining user sessions accross script executions in a CGI environment.
"""
import cgitb
cgitb.enable()
import cgi, Cookie, time, os
from cgiLib.baseInterface import BaseInterface
class BaseSession:
def __init__(self):
self.cookieTimeout = 10 #14400 ... | [
"cgi.FieldStorage",
"Cookie.SimpleCookie",
"cgitb.enable",
"time.time",
"os.environ.has_key"
] | [((144, 158), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (156, 158), False, 'import cgitb\n'), ((429, 450), 'Cookie.SimpleCookie', 'Cookie.SimpleCookie', ([], {}), '()\n', (448, 450), False, 'import cgi, Cookie, time, os\n'), ((515, 533), 'cgi.FieldStorage', 'cgi.FieldStorage', ([], {}), '()\n', (531, 533), Fals... |
# UVA10035 - Primary Arithmetic - Accepted
# goo.gl/NwwuvQ
# @author: <NAME>
# 'People worry that computers will get too smart and take over the world, but the real problem is that they're too stupid and they've already taken over the world.' -- <NAME>
from sys import stdin
if __name__ == '__main__':
a,b = map(int... | [
"sys.stdin.readline"
] | [((322, 338), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (336, 338), False, 'from sys import stdin\n'), ((657, 673), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (671, 673), False, 'from sys import stdin\n')] |
#!/usr/bin/env python
# Copyright 2019 Orange
#
# 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... | [
"base_test.P4rtOVSBaseTest.setUp",
"ptf.packet.IP",
"ptf.testutils.send_packet",
"ptf.testutils.simple_ip_packet",
"ptf.testutils.verify_packets",
"ptf.mask.Mask",
"ptf.packet.Ether",
"ptf.packet.TCP"
] | [((834, 861), 'base_test.P4rtOVSBaseTest.setUp', 'P4rtOVSBaseTest.setUp', (['self'], {}), '(self)\n', (855, 861), False, 'from base_test import P4rtOVSBaseTest\n'), ((1459, 1472), 'ptf.mask.Mask', 'Mask', (['exp_pkt'], {}), '(exp_pkt)\n', (1463, 1472), False, 'from ptf.mask import Mask\n'), ((1531, 1561), 'ptf.testutil... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights
# Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or i... | [
"copy.deepcopy"
] | [((4010, 4055), 'copy.deepcopy', 'deepcopy', (['request_envelope.session.attributes'], {}), '(request_envelope.session.attributes)\n', (4018, 4055), False, 'from copy import deepcopy\n')] |
from rest_framework.test import APITestCase
from core.models import SensorAttribute, Service, User
class ServiceTest(APITestCase):
def setUp(self):
User.objects.create_user(username="nkha", password="<PASSWORD>")
SensorAttribute.objects.create(uri='test uri', description='test description')
... | [
"core.models.User.objects.create_user",
"core.models.Service.objects.create",
"core.models.SensorAttribute.objects.create"
] | [((163, 227), 'core.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""nkha"""', 'password': '"""<PASSWORD>"""'}), "(username='nkha', password='<PASSWORD>')\n", (187, 227), False, 'from core.models import SensorAttribute, Service, User\n'), ((237, 315), 'core.models.SensorAttribute.obje... |
# coding: utf-8
"""
IdCheck.IO API
Check identity documents
OpenAPI spec version: 0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may... | [
"setuptools.find_packages"
] | [((1488, 1503), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1501, 1503), False, 'from setuptools import setup, find_packages\n')] |
import schedule
import subprocess
import time
def job():
start_time = time.strftime("%Y-%m-%d-%H-%M-%S")
print("Calling cronscript.sh at:", start_time)
rc = subprocess.call("./cronscript.sh", shell=True)
schedule.every(15).minutes.do(job)
while True:
schedule.run_pending()
time.sleep(1)
| [
"schedule.run_pending",
"time.strftime",
"time.sleep",
"schedule.every",
"subprocess.call"
] | [((75, 109), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d-%H-%M-%S"""'], {}), "('%Y-%m-%d-%H-%M-%S')\n", (88, 109), False, 'import time\n'), ((170, 216), 'subprocess.call', 'subprocess.call', (['"""./cronscript.sh"""'], {'shell': '(True)'}), "('./cronscript.sh', shell=True)\n", (185, 216), False, 'import subprocess... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-15 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0207_multiuseinvite_invited_as'),
]
operations = [
migrations.Ad... | [
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((416, 536), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('D', 'Default to Zulip'), ('U', 'Uploaded by administrator')]", 'default': '"""D"""', 'max_length': '(1)'}), "(choices=[('D', 'Default to Zulip'), ('U',\n 'Uploaded by administrator')], default='D', max_length=1)\n", (432, 536), Fals... |
"""
dolbyio_rest_apis.media.diagnose
~~~~~~~~~~~~~~~
This module contains the functions to work with the Diagnose APIs.
"""
from dolbyio_rest_apis.media.internal.http_context import MediaHttpContext
from dolbyio_rest_apis.media.models.diagnose_response import DiagnoseJob
async def start(
api_key: str,
... | [
"dolbyio_rest_apis.media.models.diagnose_response.DiagnoseJob",
"dolbyio_rest_apis.media.internal.http_context.MediaHttpContext"
] | [((2961, 2995), 'dolbyio_rest_apis.media.models.diagnose_response.DiagnoseJob', 'DiagnoseJob', (['job_id', 'json_response'], {}), '(job_id, json_response)\n', (2972, 2995), False, 'from dolbyio_rest_apis.media.models.diagnose_response import DiagnoseJob\n'), ((1457, 1475), 'dolbyio_rest_apis.media.internal.http_context... |
#About print Students Management System
import os
# 保存学生的数据
all_dict = {}
# 定义一个变量 -> 全局变量
file_name = "student.txt"
# 加载文件中的数据
def load_info():
# 判断文件是否存在
if not os.path.exists(file_name):
# 创建一个
f = open(file_name, "w", encoding="utf-8")
# 写入数据
f.write("{}")
f.close... | [
"os.path.exists"
] | [((175, 200), 'os.path.exists', 'os.path.exists', (['file_name'], {}), '(file_name)\n', (189, 200), False, 'import os\n')] |
import tensorflow as tf
from netvlad_tf.net_from_mat import netFromMat
from netvlad_tf.nets import defaultCheckpoint
tf.reset_default_graph()
layers = netFromMat()
saver = tf.train.Saver()
sess = tf.Session()
tf.global_variables_initializer().run(session=sess)
saver.save(sess, defaultCheckpoint()) | [
"tensorflow.reset_default_graph",
"netvlad_tf.nets.defaultCheckpoint",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer",
"netvlad_tf.net_from_mat.netFromMat"
] | [((120, 144), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (142, 144), True, 'import tensorflow as tf\n'), ((154, 166), 'netvlad_tf.net_from_mat.netFromMat', 'netFromMat', ([], {}), '()\n', (164, 166), False, 'from netvlad_tf.net_from_mat import netFromMat\n'), ((175, 191), 'tensorflow.... |
print("################################################################################")
print("# Implementation of a multivariate pattern analysis based on the scikitlearn ")
print("# toolbox (http://scikit-learn.org/stable/). It reads a matlab file containing ")
print("# Xm: a matrix of trials x chans x... | [
"sklearn.cross_validation.KFold",
"scipy.io.savemat",
"scipy.io.loadmat",
"sys.stdout.write",
"numpy.reshape",
"scipy.stats.scoreatpercentile",
"numpy.empty",
"sklearn.cross_validation.LeaveOneOut",
"sklearn.feature_selection.SelectPercentile",
"sys.stdout.flush",
"numpy.ones",
"sklearn.prepro... | [((1364, 1386), 'scipy.io.loadmat', 'sio.loadmat', (['filenameX'], {}), '(filenameX)\n', (1375, 1386), True, 'import scipy.io as sio\n'), ((1456, 1478), 'scipy.io.loadmat', 'sio.loadmat', (['filenamey'], {}), '(filenamey)\n', (1467, 1478), True, 'import scipy.io as sio\n'), ((1645, 1680), 'numpy.reshape', 'np.reshape',... |
# coding: utf-8
"""
Test case for MongoEngine
Adapted from https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/django/tests.py
MongoEngine's license: https://github.com/MongoEngine/mongoengine/blob/master/LICENSE
"""
from __future__ import unicode_literals
from django.test import TestCase
from django... | [
"mongoengine.Document.__subclasses__",
"mongoengine.connection.connect",
"mongoengine.connection.disconnect"
] | [((716, 728), 'mongoengine.connection.disconnect', 'disconnect', ([], {}), '()\n', (726, 728), False, 'from mongoengine.connection import connect, disconnect\n'), ((1384, 1409), 'mongoengine.Document.__subclasses__', 'Document.__subclasses__', ([], {}), '()\n', (1407, 1409), False, 'from mongoengine import Document\n')... |
"""
Helmoltz coils
==============
A script that computes the magnetic field generated by a pair of Helmoltz
coils.
"""
import numpy as np
from scipy import special, linalg
##############################################################################
# Function to caculate the field of a loop
def base_vectors(n):
... | [
"numpy.sqrt",
"numpy.cross",
"scipy.special.ellipe",
"numpy.sin",
"numpy.zeros_like",
"numpy.square",
"scipy.special.ellipk",
"numpy.array",
"numpy.dot",
"numpy.vstack",
"numpy.cos",
"numpy.ravel",
"scipy.linalg.inv",
"numpy.round",
"numpy.arctan"
] | [((3661, 3681), 'numpy.vstack', 'np.vstack', (['(r0, -r0)'], {}), '((r0, -r0))\n', (3670, 3681), True, 'import numpy as np\n'), ((3703, 3720), 'numpy.vstack', 'np.vstack', (['(n, n)'], {}), '((n, n))\n', (3712, 3720), True, 'import numpy as np\n'), ((3918, 3934), 'numpy.zeros_like', 'np.zeros_like', (['r'], {}), '(r)\n... |
from .pandas_vb_common import *
from random import shuffle
class Reindexing(object):
goal_time = 0.2
def setup(self):
self.rng = DatetimeIndex(start='1/1/1970', periods=10000, freq='1min')
self.df = DataFrame(np.random.rand(10000, 10), index=self.rng,
columns=range... | [
"random.shuffle"
] | [((5491, 5507), 'random.shuffle', 'shuffle', (['sampler'], {}), '(sampler)\n', (5498, 5507), False, 'from random import shuffle\n')] |
# Copyright 2020 Regents of the University of Colorado. All Rights Reserved.
# Released under the MIT license.
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
# Verify current version before use at: https://github.com/MAVENSDC/PyTplot
import pytplot
from copy... | [
"pytplot.data_quants.keys",
"pytplot.store_data",
"copy.deepcopy"
] | [((1229, 1274), 'copy.deepcopy', 'deepcopy', (['pytplot.data_quants[old_name].attrs'], {}), '(pytplot.data_quants[old_name].attrs)\n', (1237, 1274), False, 'from copy import deepcopy\n'), ((1693, 1737), 'pytplot.store_data', 'pytplot.store_data', (['new_name'], {'data': 'data_dict'}), '(new_name, data=data_dict)\n', (1... |
# Generated by Django 3.0.6 on 2020-05-15 14:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Position',
fields=[
... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((337, 430), '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", (353, 430), False, 'from django.db import migrations, models\... |
import os
import requests
import subprocess
from ruamel.yaml import YAML
from .base import Migrator
YAML = YAML()
def _get_num_builds(appveyor_name):
HEADERS = {"Authorization": "Bearer " + os.environ['APPVEYOR_TOKEN']}
r = requests.get(
"https://ci.appveyor.com/api/projects/conda-forge/"
... | [
"os.path.exists",
"subprocess.run",
"requests.get",
"ruamel.yaml.YAML",
"ruamel.yaml.YAML.load",
"requests.put"
] | [((110, 116), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (114, 116), False, 'from ruamel.yaml import YAML\n'), ((238, 373), 'requests.get', 'requests.get', (["('https://ci.appveyor.com/api/projects/conda-forge/%s/history?recordsNumber=10'\n % appveyor_name)"], {'headers': 'HEADERS'}), "(\n 'https://ci.appveyo... |
import random
__all__ = ("__version__", "ball")
__version__ = "3.0"
class ballException(Exception):
pass
"""
Here we start the ball
"""
class ball:
def __init__(self):
self.responses_list=["As I see it, yes.",
"Ask again later.",
"Better not tell you now.",
... | [
"random.choice",
"random.randint"
] | [((1768, 1802), 'random.choice', 'random.choice', (['self.responses_list'], {}), '(self.responses_list)\n', (1781, 1802), False, 'import random\n'), ((1736, 1757), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (1750, 1757), False, 'import random\n')] |
"""
Tunnel generator
Generates actually two tunnels. One of glass
(so we can see through), on of air (so we can walk inside).
Positioning of player can still be improved.
"""
import mcpi.minecraft as minecraft
import mcpi.block as block
def generate_tunnel():
mc = minecraft.Minecraft.create()
position = mc... | [
"mcpi.minecraft.Minecraft.create"
] | [((274, 302), 'mcpi.minecraft.Minecraft.create', 'minecraft.Minecraft.create', ([], {}), '()\n', (300, 302), True, 'import mcpi.minecraft as minecraft\n')] |
import os
import shutil
root_dir = 'D:\\Github\\Final-year-project\\Datasets\\EMOTIW_face'
output_dir = 'D:\\Github\\Final-year-project\\Datasets\\EMOTIW_face_full'
count = 0
count_list = []
for set in os.listdir(root_dir):
set_path = os.path.join(root_dir, set)
for catg in os.listdir(set_path):... | [
"os.path.exists",
"os.listdir",
"shutil.copy2",
"os.path.join",
"os.mkdir"
] | [((216, 236), 'os.listdir', 'os.listdir', (['root_dir'], {}), '(root_dir)\n', (226, 236), False, 'import os\n'), ((254, 281), 'os.path.join', 'os.path.join', (['root_dir', 'set'], {}), '(root_dir, set)\n', (266, 281), False, 'import os\n'), ((299, 319), 'os.listdir', 'os.listdir', (['set_path'], {}), '(set_path)\n', (3... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((9001, 9026), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (9020, 9026), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
# ===========================================================================
# FILE : switcher.py
# AUTHOR : callmekohei <call<EMAIL> at g<EMAIL>>
# License : MIT license
# ===========================================================================
import neovim
from AppKit import NSTextInputContext , NSTextVi... | [
"neovim.function",
"AppKit.NSTextInputContext.alloc",
"AppKit.NSTextView.new"
] | [((518, 562), 'neovim.function', 'neovim.function', (['"""SwitchEnglish"""'], {'sync': '(False)'}), "('SwitchEnglish', sync=False)\n", (533, 562), False, 'import neovim\n'), ((493, 509), 'AppKit.NSTextView.new', 'NSTextView.new', ([], {}), '()\n', (507, 509), False, 'from AppKit import NSTextInputContext, NSTextView\n'... |
import itertools
import numpy as np
import torch
from ..math import complex_mult, conj_complex_mult
def get_interpob(model):
"""Retrieves the interpolation dictionary from model.
Different nufft objects use different interpolation objects. This function
only extracts the minimum amount necessary for sp... | [
"torch.floor",
"itertools.product",
"torch.prod",
"numpy.array",
"torch.remainder",
"torch.zeros",
"torch.arange",
"torch.ones"
] | [((2134, 2183), 'torch.zeros', 'torch.zeros', (['tm.shape'], {'dtype': 'dtype', 'device': 'device'}), '(tm.shape, dtype=dtype, device=device)\n', (2145, 2183), False, 'import torch\n'), ((2201, 2253), 'torch.zeros', 'torch.zeros', (['tm.shape'], {'dtype': 'int_type', 'device': 'device'}), '(tm.shape, dtype=int_type, de... |
# Copyright (c) 2021 Horizon Robotics and ALF Contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | [
"alf.data_structures.AlgStep",
"alf.tensor_specs.TensorSpec",
"alf.config",
"alf.data_structures.LossInfo",
"torch.all"
] | [((2040, 2102), 'alf.config', 'alf.config', (['"""create_environment"""'], {'num_parallel_environments': '(10)'}), "('create_environment', num_parallel_environments=10)\n", (2050, 2102), False, 'import alf\n'), ((2104, 2346), 'alf.config', 'alf.config', (['"""TrainerConfig"""'], {'algorithm_ctor': 'MyOffPolicyAlgorithm... |
# Modifications Copyright 2016-2017 Reddit, Inc.
#
# Copyright 2013-2016 DataStax, 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
#
# Unle... | [
"cqlmapper.management.create_keyspace_simple",
"cqlmapper.columns.Text",
"cqlmapper.management.drop_keyspace",
"uuid.uuid1",
"cqlmapper.columns.TimeUUID",
"cqlmapper.columns.BigInt",
"cqlmapper.columns.Integer",
"cqlmapper.management.drop_table",
"cqlmapper.management.sync_table"
] | [((2830, 2878), 'cqlmapper.management.create_keyspace_simple', 'create_keyspace_simple', (['self.conn', '"""keyspace"""', '(1)'], {}), "(self.conn, 'keyspace', 1)\n", (2852, 2878), False, 'from cqlmapper.management import sync_table, drop_table, create_keyspace_simple, drop_keyspace\n'), ((3107, 3132), 'cqlmapper.manag... |
# Generated by Django 2.2.8 on 2019-12-07 02:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ontask', '0004_auto_20191206_2039'),
]
operations = [
migrations.RemoveField(
model_name='scheduledoperation',
name=... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((234, 311), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""scheduledoperation"""', 'name': '"""periodic_task"""'}), "(model_name='scheduledoperation', name='periodic_task')\n", (256, 311), False, 'from django.db import migrations, models\n'), ((468, 561), 'django.db.models.CharF... |
#!/usr/bin/env python3
"""
Someone's Mattermost API v4 bindings.
Copyright (c) 2016-2021 by Someone <<EMAIL>> (aka. <NAME> <<EMAIL>>)
published under MIT-License
"""
import logging
import json
import asyncio
import threading
import traceback
import websockets
logger = logging.getLogger("mattermost.ws")
class MM... | [
"logging.getLogger",
"traceback.format_exc",
"threading.Timer",
"asyncio.new_event_loop",
"websockets.connect"
] | [((275, 309), 'logging.getLogger', 'logging.getLogger', (['"""mattermost.ws"""'], {}), "('mattermost.ws')\n", (292, 309), False, 'import logging\n'), ((521, 545), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (543, 545), False, 'import asyncio\n'), ((853, 895), 'threading.Timer', 'threading.Time... |
from unittest.mock import Mock, call
from pytest import fixture, raises, mark
from pyviews.core.observable import ObservableEntity, InheritedDict
class TestObservable(ObservableEntity):
def __init__(self, private, name, value):
super().__init__()
self._private = private
self.name = name
... | [
"unittest.mock.Mock",
"unittest.mock.call",
"pytest.mark.parametrize",
"pytest.raises",
"pytest.mark.usefixtures",
"pyviews.core.observable.InheritedDict"
] | [((605, 643), 'pytest.mark.usefixtures', 'mark.usefixtures', (['"""observable_fixture"""'], {}), "('observable_fixture')\n", (621, 643), False, 'from pytest import fixture, raises, mark\n'), ((557, 563), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (561, 563), False, 'from unittest.mock import Mock, call\n'), ((595,... |
import torch
from torch import optim
from torchvision import datasets, transforms
from vision import LeNet, CNN, weights_init
from PIL import Image
from utils import label_to_onehot, cross_entropy_for_onehot
import torch.nn.functional as F
import numpy as np
from skimage.metrics import structural_similarity as ssim
imp... | [
"torch.manual_seed",
"PIL.Image.open",
"utils.label_to_onehot",
"torchvision.transforms.ToPILImage",
"skimage.metrics.structural_similarity",
"vision.LeNet",
"torch.load",
"torch.Tensor",
"numpy.asarray",
"matplotlib.pyplot.figure",
"torch.cuda.is_available",
"federated_utils.PQclass",
"torc... | [((593, 619), 'sys.path.append', 'sys.path.append', (['elad_path'], {}), '(elad_path)\n', (608, 619), False, 'import sys\n'), ((620, 647), 'sys.path.append', 'sys.path.append', (['tomer_path'], {}), '(tomer_path)\n', (635, 647), False, 'import sys\n'), ((970, 983), 'federated_utils.PQclass', 'PQclass', (['args'], {}), ... |
#
# Copyright © 2019 <NAME>
# Licensed under Apache License, Version 2.0, January 2004
#
# Updates kernels with residue modification information
#
# idX version 2019.08.10.01
#
import ujson
import time
import gzip
import sys
import copy
import itertools
import hashlib
import re
def sites_process(_os,_of,_mhash,_sdict... | [
"hashlib.sha256",
"gzip.open",
"ujson.dumps",
"itertools.combinations",
"ujson.loads",
"copy.deepcopy",
"re.sub",
"sys.stdout.flush"
] | [((2252, 2268), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (2266, 2268), False, 'import hashlib\n'), ((1132, 1150), 'copy.deepcopy', 'copy.deepcopy', (['_os'], {}), '(_os)\n', (1145, 1150), False, 'import copy\n'), ((2130, 2144), 'ujson.loads', 'ujson.loads', (['l'], {}), '(l)\n', (2141, 2144), False, 'impor... |
from janome.tokenizer import Tokenizer
def analysis(message):
t=Tokenizer()
morpheme=[]
taboo={"タイトル":0,"作者":1,"日付":2} #発売日は辞書登録しなければならないため一応日付
tabooset = 0
for token in t.tokenize(message):
if token.part_of_speech.split(',')[0] == "名詞":
tabooflag = 0
if ... | [
"janome.tokenizer.Tokenizer"
] | [((72, 83), 'janome.tokenizer.Tokenizer', 'Tokenizer', ([], {}), '()\n', (81, 83), False, 'from janome.tokenizer import Tokenizer\n'), ((699, 710), 'janome.tokenizer.Tokenizer', 'Tokenizer', ([], {}), '()\n', (708, 710), False, 'from janome.tokenizer import Tokenizer\n')] |
#!/usr/bin/env python3
import argparse
import coloredlogs
import logging
import time
import sys
logger = logging.getLogger(__name__)
def log_sample(args: argparse.Namespace):
logger.debug("debug message.")
logger.info("info message.")
logger.warning("warning message.")
logger.error("error message.")
... | [
"logging.getLogger",
"argparse.ArgumentParser",
"coloredlogs.install"
] | [((106, 133), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'import logging\n'), ((1062, 1214), 'coloredlogs.install', 'coloredlogs.install', ([], {'stream': 'sys.stdout', 'level': '"""DEBUG"""', 'fmt': '"""%(asctime)s %(name)s %(levelname)s %(message)s"""', 'datefmt':... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Cloud.com, Inc
# Copyright (c) 2012 Cloudbase Solutions Srl
#
# 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
#
# ... | [
"nova.virt.hyperv.livemigrationops.LiveMigrationOps",
"nova.virt.hyperv.snapshotops.SnapshotOps",
"nova.virt.hyperv.volumeops.VolumeOps",
"nova.virt.hyperv.vmops.VMOps",
"nova.openstack.common.log.getLogger"
] | [((3162, 3189), 'nova.openstack.common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3179, 3189), True, 'from nova.openstack.common import log as logging\n'), ((3330, 3351), 'nova.virt.hyperv.volumeops.VolumeOps', 'volumeops.VolumeOps', ([], {}), '()\n', (3349, 3351), False, 'from nova.virt.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import getopt
import os
license_content = '''/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 TH<NAME>, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you ma... | [
"getopt.getopt",
"os.rename",
"sys.exit",
"os.path.abspath",
"os.system",
"os.walk"
] | [((1209, 1242), 'os.rename', 'os.rename', (['temp_file', 'target_file'], {}), '(temp_file, target_file)\n', (1218, 1242), False, 'import os\n'), ((1247, 1303), 'os.system', 'os.system', (["('gofmt -w ' + temp_file + ' > /dev/null 2>&1')"], {}), "('gofmt -w ' + temp_file + ' > /dev/null 2>&1')\n", (1256, 1303), False, '... |
import tensorflow as tf
import numpy as np
from model_fn.model_fn_nlp.util_nlp.attention import MultiHeadAttention
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(d_model))
return pos * angle_rates
def positional_encoding(position, d_model):
angle_rads = ge... | [
"tensorflow.shape",
"numpy.arange",
"model_fn.model_fn_nlp.util_nlp.attention.MultiHeadAttention",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.layers.Dense",
"numpy.cos",
"numpy.sin",
"tensorflow.cast",
"numpy.float32",
"tensorflow.keras.layers.Layer... | [((541, 568), 'numpy.sin', 'np.sin', (['angle_rads[:, 0::2]'], {}), '(angle_rads[:, 0::2])\n', (547, 568), True, 'import numpy as np\n'), ((646, 673), 'numpy.cos', 'np.cos', (['angle_rads[:, 1::2]'], {}), '(angle_rads[:, 1::2])\n', (652, 673), True, 'import numpy as np\n'), ((734, 773), 'tensorflow.cast', 'tf.cast', ([... |
#!/usr/bin/env python
"""
Example of training DCGAN on MNIST using PBT with Tune's function API.
"""
import ray
from ray import tune
from ray.tune.schedulers import PopulationBasedTraining
import argparse
import os
from filelock import FileLock
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.o... | [
"ray.tune.report",
"torch.cuda.is_available",
"common.train",
"common.Discriminator",
"ray.init",
"os.path.exists",
"argparse.ArgumentParser",
"ray.tune.checkpoint_dir",
"os.path.expanduser",
"ray.tune.choice",
"os.path.dirname",
"common.demo_gan",
"common.get_data_loader",
"torch.device",... | [((702, 745), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (714, 745), False, 'import torch\n'), ((892, 904), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (902, 904), True, 'import torch.nn as nn\n'), ((2657, 2682), 'argparse.ArgumentParser', 'ar... |
#!/usr/bin/env python
import os
import boto3
import subprocess
import urllib
def get_role_credentials():
os.environ["AWS_PROFILE"] = "cdo"
sts = boto3.client('sts')
return sts.assume_role(
RoleArn='arn:aws:iam::475661607190:role/admin/Developer',
RoleSessionName='role',
)
def set_keys_for_child_proces... | [
"boto3.client",
"subprocess.call"
] | [((758, 816), 'subprocess.call', 'subprocess.call', (["['python', 'manage.py', 'runserver_plus']"], {}), "(['python', 'manage.py', 'runserver_plus'])\n", (773, 816), False, 'import subprocess\n'), ((150, 169), 'boto3.client', 'boto3.client', (['"""sts"""'], {}), "('sts')\n", (162, 169), False, 'import boto3\n')] |
#!/usr/bin/env python
# Written by: DGC
# python imports
import sys
import logging
import unittest
# local imports
sys.path.append("..")
import Log
LOG = Log.log_file()
#==============================================================================
class utest_Log(unittest.TestCase):
def test_exception(sel... | [
"logging.debug",
"Log.log_file",
"logging.warning",
"logging.info",
"Log.__init_logfile",
"unittest.main",
"sys.path.append",
"Log.start_logging"
] | [((117, 138), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (132, 138), False, 'import sys\n'), ((157, 171), 'Log.log_file', 'Log.log_file', ([], {}), '()\n', (169, 171), False, 'import Log\n'), ((1589, 1615), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1602... |
import os
import copy
import json
def get_all_files(root, ext=None):
result = []
for (new_path, dirs, files) in os.walk(root):
result += [ os.path.abspath(os.path.join(new_path, f)) for f in files if ext is None or os.path.splitext(f)[1] == ext]
return result
def obj_to_deep_dict(obj, classkey=Non... | [
"os.path.splitext",
"os.path.join",
"os.walk"
] | [((121, 134), 'os.walk', 'os.walk', (['root'], {}), '(root)\n', (128, 134), False, 'import os\n'), ((172, 197), 'os.path.join', 'os.path.join', (['new_path', 'f'], {}), '(new_path, f)\n', (184, 197), False, 'import os\n'), ((232, 251), 'os.path.splitext', 'os.path.splitext', (['f'], {}), '(f)\n', (248, 251), False, 'im... |
# 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.
import os
import copy
import numpy as np
import torch
from lottery.branch import base
import models.registry
from pruning.mask import Mask
from... | [
"lottery.branch.morphism.change_depth",
"pruning.mask.Mask.ones_like",
"pruning.mask.Mask.load",
"os.path.join",
"numpy.linspace",
"pruning.pruned_model.PrunedModel",
"copy.deepcopy",
"training.train.standard_train",
"torch.all"
] | [((516, 545), 'copy.deepcopy', 'copy.deepcopy', (['pruned_model_a'], {}), '(pruned_model_a)\n', (529, 545), False, 'import copy\n'), ((2821, 2847), 'pruning.mask.Mask.load', 'Mask.load', (['self.level_root'], {}), '(self.level_root)\n', (2830, 2847), False, 'from pruning.mask import Mask\n'), ((3227, 3273), 'copy.deepc... |
import getpass
print(getpass.getuser())
SQLALCHEMY_DATABASE_URI = 'postgresql://'+getpass.getuser()+':dbpasswd@localhost/bookbagging'
SQLALCHEMY_ECHO = True
DEBUG = True
| [
"getpass.getuser"
] | [((22, 39), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (37, 39), False, 'import getpass\n'), ((83, 100), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (98, 100), False, 'import getpass\n')] |
from decimal import Decimal
from pydantic import (
BaseModel,
NegativeFloat,
NegativeInt,
PositiveFloat,
PositiveInt,
NonNegativeFloat,
NonNegativeInt,
NonPositiveFloat,
NonPositiveInt,
conbytes,
condecimal,
confloat,
conint,
conlist,
conset,
constr,
... | [
"pydantic.conlist",
"pydantic.Field",
"pydantic.constr",
"pydantic.confloat",
"pydantic.conbytes",
"pydantic.conint",
"pydantic.condecimal",
"pydantic.conset",
"decimal.Decimal"
] | [((372, 409), 'pydantic.conbytes', 'conbytes', ([], {'min_length': '(2)', 'max_length': '(10)'}), '(min_length=2, max_length=10)\n', (380, 409), False, 'from pydantic import BaseModel, NegativeFloat, NegativeInt, PositiveFloat, PositiveInt, NonNegativeFloat, NonNegativeInt, NonPositiveFloat, NonPositiveInt, conbytes, c... |
from peg import metagrammar, infer_types, gen_converter, generate_py_parser
def main():
grammar = """
Start <- _ Expr !.
Expr <- Mult ((ADD / SUB)<:left Mult:right)*
Mult <- Term ((MUL / DIV)<:left Term:right)*
Term <- LP Expr RP / Number / NEG Term:expr
Number <- ... | [
"peg.gen_converter",
"peg.infer_types",
"peg.generate_py_parser",
"peg.metagrammar.parse"
] | [((609, 635), 'peg.metagrammar.parse', 'metagrammar.parse', (['grammar'], {}), '(grammar)\n', (626, 635), False, 'from peg import metagrammar, infer_types, gen_converter, generate_py_parser\n'), ((648, 665), 'peg.infer_types', 'infer_types', (['tree'], {}), '(tree)\n', (659, 665), False, 'from peg import metagrammar, i... |
from django.contrib.auth import get_user_model
from rest_framework import serializers
from rest_framework.reverse import reverse
from .models import Sprint, Task
# Fetch the user model
User = get_user_model()
class SprintSerializer(serializers.ModelSerializer):
# Get own links
links = serializers.SerializerMethodF... | [
"django.contrib.auth.get_user_model",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.SlugRelatedField",
"rest_framework.serializers.CharField",
"rest_framework.reverse.reverse"
] | [((194, 210), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (208, 210), False, 'from django.contrib.auth import get_user_model\n'), ((291, 326), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (324, 326), False, 'from rest_framework ... |
from flask import Flask, request
import os
import time
app = Flask(__name__)
app.debug = True
@app.route("/")
def delay():
delay = request.args.get("delay")
if delay:
time.sleep(float(delay))
return "delay app"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8888)
| [
"flask.request.args.get",
"flask.Flask"
] | [((64, 79), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (69, 79), False, 'from flask import Flask, request\n'), ((140, 165), 'flask.request.args.get', 'request.args.get', (['"""delay"""'], {}), "('delay')\n", (156, 165), False, 'from flask import Flask, request\n')] |
# ===============================================================================
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"numpy.ones",
"numpy.hstack",
"numpy.random.random",
"numpy.zeros",
"numpy.vstack"
] | [((2740, 2761), 'numpy.random.random', 'random', ([], {'size': 'nsamples'}), '(size=nsamples)\n', (2746, 2761), False, 'from numpy.random import random\n'), ((2869, 2883), 'numpy.ones', 'ones', (['nsamples'], {}), '(nsamples)\n', (2873, 2883), False, 'from numpy import ones, vstack, zeros, hstack\n'), ((3026, 3041), 'n... |
import logging
import h5py
import event_model
from suitcase import nxsas
from suitcase.nxsas.tests.rsoxs_run_documents import (
rsoxs_start_doc,
rsoxs_descriptor_en_doc,
rsoxs_event_page_en_doc,
)
techniques_md = {
"md": {
"techniques": [
# SAXS technique
{
... | [
"event_model.compose_run",
"suitcase.nxsas.export",
"h5py.File"
] | [((2911, 2957), 'event_model.compose_run', 'event_model.compose_run', ([], {'metadata': 'start_doc_md'}), '(metadata=start_doc_md)\n', (2934, 2957), False, 'import event_model\n'), ((3134, 3167), 'suitcase.nxsas.export', 'nxsas.export', (['documents', 'tmp_path'], {}), '(documents, tmp_path)\n', (3146, 3167), False, 'f... |
#!/usr/bin/env python
# encoding: UTF-8
import ast
from setuptools import setup
import os.path
try:
import pyspike.ops.__version__ as version
except ImportError:
# Pip evals this file prior to running setup.
# This causes ImportError in a fresh virtualenv.
version = str(ast.literal_eval(
... | [
"setuptools.setup"
] | [((570, 1528), 'setuptools.setup', 'setup', ([], {'name': '"""pyspike-ops"""', 'version': 'version', 'description': '"""PoC for container deployment of Python3 apps. Ops package."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/ONSdigital/pyspike-ops"""', 'long_description':... |
import unittest
from datetime import date, datetime
from localstack.utils.aws import aws_stack
TEST_TEMPLATE_ATTRIBUTES = {
'TemplateName': 'hello-world',
'SubjectPart': 'Subject test',
'TextPart': 'hello\nworld',
'HtmlPart': 'hello<br/>world',
}
class SESTest(unittest.TestCase):
def test_list_... | [
"localstack.utils.aws.aws_stack.connect_to_service"
] | [((354, 389), 'localstack.utils.aws.aws_stack.connect_to_service', 'aws_stack.connect_to_service', (['"""ses"""'], {}), "('ses')\n", (382, 389), False, 'from localstack.utils.aws import aws_stack\n'), ((1221, 1256), 'localstack.utils.aws.aws_stack.connect_to_service', 'aws_stack.connect_to_service', (['"""ses"""'], {})... |
import numpy as np
import zmq
class Subscriber:
def __init__(self, address='tcp://127.0.0.1', port=9999):
self.context = zmq.Context()
self.socket = self.context.socket(zmq.SUB)
self.socket.setsockopt(zmq.SUBSCRIBE, b'')
self.socket.connect(f'{address}:{port}')
def recv(self):... | [
"numpy.frombuffer",
"zmq.Context"
] | [((135, 148), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (146, 148), False, 'import zmq\n'), ((415, 462), 'numpy.frombuffer', 'np.frombuffer', (['message'], {'dtype': "metadata['dtype']"}), "(message, dtype=metadata['dtype'])\n", (428, 462), True, 'import numpy as np\n')] |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import re
from uw_pws import PWS
from myuw.dao.admin import can_override, is_admin
from myuw.dao import pws
INVALID_STRING = "Username not a valid netid"
NO_USER = "No override user supplied, please enter a UWNetID"
def validate_... | [
"myuw.dao.admin.is_admin",
"myuw.dao.admin.can_override",
"uw_pws.PWS"
] | [((736, 750), 'myuw.dao.admin.can_override', 'can_override', ([], {}), '()\n', (748, 750), False, 'from myuw.dao.admin import can_override, is_admin\n'), ((1005, 1015), 'myuw.dao.admin.is_admin', 'is_admin', ([], {}), '()\n', (1013, 1015), False, 'from myuw.dao.admin import can_override, is_admin\n'), ((399, 404), 'uw_... |
import os
import fnmatch
import re
import glob
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
class Project:
"""
This classes is used to mine a cloned repository and extract matches between tests and classes
under test
"""
def __init__(self, project, include_pattern, exclude_pa... | [
"fnmatch.fnmatch",
"os.path.basename",
"glob.glob",
"re.search"
] | [((4389, 4424), 'glob.glob', 'glob.glob', (['look_for'], {'recursive': '(True)'}), '(look_for, recursive=True)\n', (4398, 4424), False, 'import glob\n'), ((5225, 5260), 'glob.glob', 'glob.glob', (['look_for'], {'recursive': '(True)'}), '(look_for, recursive=True)\n', (5234, 5260), False, 'import glob\n'), ((3054, 3089)... |