code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pandas_datareader.data as data
from pandas_datareader.famafrench import get_available_datasets
import statsmodels.api as sm
class FamaFrench:
"""
FamaFrench class is implementation of the Fama-French three factor model.
"""
def __init__(self, portfolioSet):
self.portSet = portfolioSet
... | [
"statsmodels.api.OLS",
"statsmodels.api.add_constant",
"pandas_datareader.famafrench.get_available_datasets",
"pandas_datareader.data.DataReader"
] | [((631, 655), 'pandas_datareader.famafrench.get_available_datasets', 'get_available_datasets', ([], {}), '()\n', (653, 655), False, 'from pandas_datareader.famafrench import get_available_datasets\n'), ((1133, 1243), 'pandas_datareader.data.DataReader', 'data.DataReader', (['self.ff3DataList[datasetIdx]', '"""famafrenc... |
"""
syntax: "update"
syntax_description: ""
---
Discord Package Botをアップデートします。
"""
import os
import shlex
import subprocess
import zipfile
from glob import glob
import requests
from colorama import Fore, Style # , Back
from .utils import token
def download_zip(version):
tags = requests.get(
"https://a... | [
"os.path.exists",
"zipfile.ZipFile",
"shlex.split",
"requests.get",
"os.replace",
"os.path.isdir",
"glob.glob",
"os.remove"
] | [((288, 442), 'requests.get', 'requests.get', (['"""https://api.github.com/repos/discord-package-bot/discord-package-bot/tags"""'], {'headers': "{'authorization': token.github_authorization}"}), "(\n 'https://api.github.com/repos/discord-package-bot/discord-package-bot/tags'\n , headers={'authorization': token.gi... |
import numpy as np
import pp
def test_connect_bundle_optical2():
"""FIXME. Actual length of the route = 499
for some reason the route length is 10um shorter than the layout.
b = 15.708
route_length = 10+35+95.05+35+b+35+208+35+b+15
print(route_length) = 499.46
route_length = 10+t+89.55+t+b+... | [
"pp.Component",
"numpy.isclose",
"pp.routing.link_optical_ports",
"pp.c.waveguide_array",
"pp.show",
"pp.c.nxn"
] | [((386, 400), 'pp.Component', 'pp.Component', ([], {}), '()\n', (398, 400), False, 'import pp\n'), ((687, 765), 'pp.routing.link_optical_ports', 'pp.routing.link_optical_ports', (['ports1', 'ports2'], {'sort_ports': '(True)', 'bend_radius': '(10)'}), '(ports1, ports2, sort_ports=True, bend_radius=10)\n', (716, 765), Fa... |
#
# Modified source: https://github.com/timsainb/tensorflow2-generative-models/blob/master/3.0-WGAN-GP-fashion-mnist.ipynb
# Source reference: https://github.com/LynnHo/DCGAN-LSGAN-WGAN-GP-DRAGAN-Tensorflow-2/
# Original paper: https://arxiv.org/abs/1701.07875
import tensorflow as tf
class WGAN(tf.keras.Model):
... | [
"tensorflow.random.uniform",
"tensorflow.random.normal",
"tensorflow.reduce_sum",
"tensorflow.keras.optimizers.Adam",
"tensorflow.GradientTape",
"tensorflow.reduce_mean",
"tensorflow.keras.optimizers.RMSprop"
] | [((896, 969), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', (['self.generator_lr'], {'beta_1': 'self.generator_beta_1'}), '(self.generator_lr, beta_1=self.generator_beta_1)\n', (920, 969), True, 'import tensorflow as tf\n'), ((1013, 1063), 'tensorflow.keras.optimizers.RMSprop', 'tf.keras.optimizers.RM... |
from pathlib import Path
from file_groups.compare_files import CompareFiles
from .conftest import same_content_files, different_content_files
@same_content_files("Hi", 'df/f11', 'ki/f12')
def test_compare_same(duplicates_dir):
fcmp = CompareFiles()
assert fcmp.compare(Path('df/f11'), Path('ki/f12'))
@diff... | [
"file_groups.compare_files.CompareFiles",
"pathlib.Path"
] | [((242, 256), 'file_groups.compare_files.CompareFiles', 'CompareFiles', ([], {}), '()\n', (254, 256), False, 'from file_groups.compare_files import CompareFiles\n'), ((439, 453), 'file_groups.compare_files.CompareFiles', 'CompareFiles', ([], {}), '()\n', (451, 453), False, 'from file_groups.compare_files import Compare... |
import os
import tensorflow_datasets as tfds
import tensorflow as tf
import numpy as np
from common.inputs.data_input import DataInfo
bxs_m2 = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
def parse_multi_mnist1(serialized_example):
""" Data parsing function.
"""
features = tf.io.parse_single_example(serialized... | [
"tensorflow.one_hot",
"tensorflow.data.TFRecordDataset",
"matplotlib.pyplot.imshow",
"os.path.join",
"numpy.squeeze",
"tensorflow.concat",
"matplotlib.pyplot.figure",
"tensorflow.io.FixedLenFeature",
"tensorflow_datasets.features.ClassLabel",
"tensorflow.argmax",
"tensorflow.io.decode_raw",
"t... | [((1229, 1280), 'tensorflow.io.decode_raw', 'tf.io.decode_raw', (["features['image_raw_1']", 'tf.uint8'], {}), "(features['image_raw_1'], tf.uint8)\n", (1245, 1280), True, 'import tensorflow as tf\n'), ((1299, 1341), 'tensorflow.reshape', 'tf.reshape', (['image_raw_1'], {'shape': '[36, 36, 1]'}), '(image_raw_1, shape=[... |
"""Console-based sudoku game."""
import pickle
import random
from typing import List, Optional
class SudokuField:
"""Sudoku game state."""
cells: List[Optional[int]]
row_width: int
filled_count: int
def __init__(self, cells: List[Optional[int]], row_width: int):
"""Initialize game state.... | [
"pickle.dump",
"pickle.load",
"random.randint"
] | [((3185, 3205), 'random.randint', 'random.randint', (['(0)', '(8)'], {}), '(0, 8)\n', (3199, 3205), False, 'import random\n'), ((3230, 3250), 'random.randint', 'random.randint', (['(0)', '(8)'], {}), '(0, 8)\n', (3244, 3250), False, 'import random\n'), ((3357, 3377), 'random.randint', 'random.randint', (['(1)', '(9)'],... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
import copy
import json
class StructEncoder(json.JSONEncoder):
"""Extends built-in JSONEncoder to support Struct serialization."""
def default(self, o):
... | [
"json.dumps"
] | [((1519, 1593), 'json.dumps', 'json.dumps', (['self'], {'cls': 'StructEncoder', 'separators': "(',', ':')", 'sort_keys': '(True)'}), "(self, cls=StructEncoder, separators=(',', ':'), sort_keys=True)\n", (1529, 1593), False, 'import json\n')] |
#!/usr/bin/env python
import rospy
import sys
import unittest
from std_msgs.msg import Empty, String
PKG = 'scalable_individual_tests'
NAME = 'test_vfk_msb_client'
class TestVFKMSBClient(unittest.TestCase):
@classmethod
def setUpClass(cls):
rospy.init_node('vfk_msb_testing_node')
cls.start ... | [
"rostest.rosrun",
"rospy.init_node",
"rospy.wait_for_message",
"rospy.sleep",
"rospy.Publisher",
"unittest.TestLoader"
] | [((1283, 1344), 'rostest.rosrun', 'rostest.rosrun', (['PKG', 'NAME', '"""test_vfk_msb.SuiteTest"""', 'sys.argv'], {}), "(PKG, NAME, 'test_vfk_msb.SuiteTest', sys.argv)\n", (1297, 1344), False, 'import rostest\n'), ((262, 301), 'rospy.init_node', 'rospy.init_node', (['"""vfk_msb_testing_node"""'], {}), "('vfk_msb_testin... |
#
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License 2.0;
# you may not use this file except in compliance with the Elastic License 2.0.
#
"""sync_sharepoint module allows to sync data to Elastic Enterprise Search.
... | [
"dateutil.parser.parse",
"os.path.dirname",
"threading.get_ident",
"urllib.parse.urljoin",
"re.sub"
] | [((765, 790), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (780, 790), False, 'import os\n'), ((8952, 8999), 'urllib.parse.urljoin', 'urljoin', (['self.sharepoint_host', 'f"""{site}/Lists/"""'], {}), "(self.sharepoint_host, f'{site}/Lists/')\n", (8959, 8999), False, 'from urllib.parse impor... |
__author__ = '<NAME>'
from renderchan.module import RenderChanModule
from renderchan.utils import which
import subprocess
import os
import random
class RenderChanFfmpegModule(RenderChanModule):
def __init__(self):
RenderChanModule.__init__(self)
self.conf['binary']=self.findBinary("ffmpeg")
... | [
"renderchan.module.RenderChanModule.__init__",
"os.path.exists",
"subprocess.check_call",
"os.path.join",
"os.mkdir"
] | [((230, 261), 'renderchan.module.RenderChanModule.__init__', 'RenderChanModule.__init__', (['self'], {}), '(self)\n', (255, 261), False, 'from renderchan.module import RenderChanModule\n'), ((845, 879), 'subprocess.check_call', 'subprocess.check_call', (['commandline'], {}), '(commandline)\n', (866, 879), False, 'impor... |
"""Contains transformer embedding layers.
"""
__author__ = '<NAME>'
from typing import List, Dict, Tuple
from dataclasses import dataclass, field
import logging
import itertools as it
import torch
from torch import Tensor
from torch import nn
from zensols.deeplearn import DropoutNetworkSettings
from zensols.deeplearn... | [
"logging.getLogger",
"itertools.islice",
"zensols.deeplearn.layer.DeepLinear",
"torch.stack",
"zensols.deeplearn.model.SequenceNetworkOutput",
"torch.tensor",
"dataclasses.field"
] | [((748, 775), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (765, 775), False, 'import logging\n'), ((2686, 2693), 'dataclasses.field', 'field', ([], {}), '()\n', (2691, 2693), False, 'from dataclasses import dataclass, field\n'), ((3517, 3544), 'zensols.deeplearn.layer.DeepLinear', 'Dee... |
""" Control Assertions
Objects provided by this module:
* `AssertRaises`: assert Callable raises expected exception
* `AssertWarns`: assert Callable raises a warning
"""
import logging
from dataclasses import (
dataclass,
field,
)
from typing import (
Callable,
ContextManager,
Union,
Ty... | [
"unittest.TestCase"
] | [((1279, 1289), 'unittest.TestCase', 'TestCase', ([], {}), '()\n', (1287, 1289), False, 'from unittest import TestCase\n'), ((3102, 3112), 'unittest.TestCase', 'TestCase', ([], {}), '()\n', (3110, 3112), False, 'from unittest import TestCase\n'), ((4379, 4389), 'unittest.TestCase', 'TestCase', ([], {}), '()\n', (4387, ... |
#!/usr/bin/env python
# coding=utf-8
import numpy as np
import os
import site
site.addsitedir('../lib/')
import htools
import hdm
###########################################################################
class parameters:
def __init__(self):
self.N = 10
self.d = 4
self.n_del = 0
s... | [
"hdm.sensitivity",
"numpy.linspace",
"htools.edgeCnt",
"hdm.FindMaxSprs",
"site.addsitedir"
] | [((78, 104), 'site.addsitedir', 'site.addsitedir', (['"""../lib/"""'], {}), "('../lib/')\n", (93, 104), False, 'import site\n'), ((1518, 1549), 'hdm.sensitivity', 'hdm.sensitivity', (['param', 'K', 'M', 'R'], {}), '(param, K, M, R)\n', (1533, 1549), False, 'import hdm\n'), ((720, 745), 'numpy.linspace', 'np.linspace', ... |
# -*- coding: utf8 -*-
import json
import os
import requests
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
class FreeMobileSMS(object):
def __init__(self, config=None):
self._URL = "https://smsapi.free-mobile.fr/sendmsg?user={0}&pass={1}&msg={2}"
self._c... | [
"json.load",
"requests.get"
] | [((1575, 1594), 'requests.get', 'requests.get', (['route'], {}), '(route)\n', (1587, 1594), False, 'import requests\n'), ((653, 673), 'json.load', 'json.load', (['conf_file'], {}), '(conf_file)\n', (662, 673), False, 'import json\n')] |
from django.urls import path
from . import views
app_name = 'pickles'
urlpatterns = [
path('', views.pickles_all, name='index'),
path('get_all', views.pickles_get_all, name='get all'),
path('review/<int:review_id>', views.review, name='review'),
path('review/new', views.review_new, name='new review'),... | [
"django.urls.path"
] | [((92, 133), 'django.urls.path', 'path', (['""""""', 'views.pickles_all'], {'name': '"""index"""'}), "('', views.pickles_all, name='index')\n", (96, 133), False, 'from django.urls import path\n'), ((139, 193), 'django.urls.path', 'path', (['"""get_all"""', 'views.pickles_get_all'], {'name': '"""get all"""'}), "('get_al... |
from agent import agent
from trade_env import StockTradingEnv
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
if __name__=='__main__':
"""
流通股本1亿,初始价格10元
100个agent,每个agent 20万现金,100万股
"""
agent_count = 100
ep = 20
env = StockTradingEnv(1e9,10,0.1,0.01,0.01,6... | [
"trade_env.StockTradingEnv",
"matplotlib.pyplot.ylabel",
"numpy.delete",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"datetime.datetime.now",
"matplotlib.pyplot.title",
"agent.agent",
"matplotlib.pyplot.show"
] | [((282, 338), 'trade_env.StockTradingEnv', 'StockTradingEnv', (['(1000000000.0)', '(10)', '(0.1)', '(0.01)', '(0.01)', '(6)', '(4)'], {}), '(1000000000.0, 10, 0.1, 0.01, 0.01, 6, 4)\n', (297, 338), False, 'from trade_env import StockTradingEnv\n'), ((1977, 2002), 'matplotlib.pyplot.plot', 'plt.plot', (['index_', 'price... |
from django.urls import path
from webdev.users import views
from django.contrib.auth import views as auth_views
urlpatterns = [
path('login/', views.login_view, name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('password-reset/', auth_views.PasswordResetView.as_view(templ... | [
"django.contrib.auth.views.PasswordResetDoneView.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"django.contrib.auth.views.PasswordResetConfirmView.as_view",
"django.urls.path",
"django.contrib.auth.views.PasswordResetView.as_view"
] | [((133, 179), 'django.urls.path', 'path', (['"""login/"""', 'views.login_view'], {'name': '"""login"""'}), "('login/', views.login_view, name='login')\n", (137, 179), False, 'from django.urls import path\n'), ((201, 232), 'django.contrib.auth.views.LogoutView.as_view', 'auth_views.LogoutView.as_view', ([], {}), '()\n',... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
from typing import Generic, Any, TypeVar, TYPE_CHECKING
from qlib.typehint import final
if TYPE_CHECKING:
from .utils.env_wrapper import EnvWrapper
SimulatorState = TypeVar("SimulatorState")
class Rewa... | [
"typing.TypeVar"
] | [((282, 307), 'typing.TypeVar', 'TypeVar', (['"""SimulatorState"""'], {}), "('SimulatorState')\n", (289, 307), False, 'from typing import Generic, Any, TypeVar, TYPE_CHECKING\n')] |
"""pyopversion package."""
import asyncio
import async_timeout
from .base import OpVersionBase
from .consts import (
DATA_CURRENT_VERSION,
DATA_RELEASE_DATE,
DATA_RELEASE_DESCRIPTION,
DATA_RELEASE_NOTES,
DATA_RELEASE_TITLE,
DEFAULT_HEADERS,
)
from .exceptions import OpVersionInputException
UR... | [
"asyncio.get_running_loop"
] | [((818, 844), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (842, 844), False, 'import asyncio\n')] |
import requests
from bs4 import BeautifulSoup
import smtplib
import os
from dotenv import load_dotenv
from email.message import EmailMessage
import numpy as np
import pandas as pd
import time
from datetime import datetime
import gspread
from oauth2client.service_account import ServiceAccountCredentials
while(True):
... | [
"smtplib.SMTP",
"gspread.authorize",
"pandas.read_csv",
"os.environ.get",
"time.sleep",
"dotenv.load_dotenv",
"requests.get",
"datetime.datetime.now",
"bs4.BeautifulSoup",
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"pandas.DataFrame",
"email.message.EmailM... | [((326, 340), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (338, 340), False, 'from datetime import datetime\n'), ((393, 406), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (404, 406), False, 'from dotenv import load_dotenv\n'), ((424, 454), 'os.environ.get', 'os.environ.get', (['"""SENDER_EMAIL"... |
"""
The module `core.vectorlist` defines a `VectorList` object, normally used
to store the module vectors.
Module class executes `_register_vectors()` at init to initialize the `VectorList`
object as `self.vectors` module attribute.
The methods exposed by VectorList can be used to get the result of a
given vector exe... | [
"traceback.format_exc",
"core.loggers.log.debug",
"core.weexceptions.DevException"
] | [((2037, 2088), 'core.weexceptions.DevException', 'DevException', (['messages.vectors.wrong_condition_type'], {}), '(messages.vectors.wrong_condition_type)\n', (2049, 2088), False, 'from core.weexceptions import DevException\n'), ((2151, 2203), 'core.weexceptions.DevException', 'DevException', (['messages.vectors.wrong... |
"""
Created on Apr 1, 2016
@author: korolo
"""
import requests
import unittest
import yaml
from config import config_root
from api.FeatureTypeApi import FeatureTypeApi
class TestFeatureTypeApi(unittest.TestCase):
@classmethod
def setUpClass(cls):
with open(config_root.path() +
'/c... | [
"unittest.main",
"yaml.safe_load",
"api.FeatureTypeApi.FeatureTypeApi",
"config.config_root.path"
] | [((3037, 3052), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3050, 3052), False, 'import unittest\n'), ((381, 408), 'yaml.safe_load', 'yaml.safe_load', (['config_file'], {}), '(config_file)\n', (395, 408), False, 'import yaml\n'), ((435, 528), 'api.FeatureTypeApi.FeatureTypeApi', 'FeatureTypeApi', ([], {'api_ke... |
import copy
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple
import numpy
import torch
import torch.nn as nn
import torch.nn.functional as F
from allennlp.modules import FeedForward, InputVariationalDropout
from allennlp.modules.matrix_attention.bilinear_matrix_attention import \
... | [
"torch.nn.EmbeddingBag",
"torch.nn.functional.nll_loss",
"allennlp.nn.Activation.by_name",
"allennlp.nn.util.get_device_of",
"torch.nn.modules.Bilinear",
"torch.cat",
"numpy.stack",
"torch.nn.Linear",
"copy.deepcopy",
"allennlp.nn.util.masked_log_softmax",
"allennlp.modules.InputVariationalDropo... | [((1234, 1296), 'torch.nn.Linear', 'nn.Linear', (['config.decoder_config.output_dim', 'config.num_labels'], {}), '(config.decoder_config.output_dim, config.num_labels)\n', (1243, 1296), True, 'import torch.nn as nn\n'), ((1954, 1979), 'torch.nn.functional.nll_loss', 'F.nll_loss', (['logits', 'label'], {}), '(logits, la... |
from PIL import Image, ImageFilter
import pymeanshift as pms
import os
import sys
if __name__ == "__main__":
directory = os.fsencode(sys.argv[1])
outdir = sys.argv[2]
count = 0
for file in os.listdir(directory):
filename = os.fsdecode(file)
original_image = Image.open(os.fsdecode(direc... | [
"PIL.Image.new",
"os.listdir",
"os.fsencode",
"os.fsdecode"
] | [((126, 150), 'os.fsencode', 'os.fsencode', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (137, 150), False, 'import os\n'), ((206, 227), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (216, 227), False, 'import os\n'), ((248, 265), 'os.fsdecode', 'os.fsdecode', (['file'], {}), '(file)\n', (259, 265), Fa... |
import tkinter as tk
class NewWindow:
def __init__(self, master, count):
window = tk.Toplevel(master)
text_value = "zażółć gęślą jaźń #%s" % count
label = tk.Label(window, text=text_value)
label.pack(side="top", fill="both", padx=10, pady=10)
| [
"tkinter.Toplevel",
"tkinter.Label"
] | [((96, 115), 'tkinter.Toplevel', 'tk.Toplevel', (['master'], {}), '(master)\n', (107, 115), True, 'import tkinter as tk\n'), ((185, 218), 'tkinter.Label', 'tk.Label', (['window'], {'text': 'text_value'}), '(window, text=text_value)\n', (193, 218), True, 'import tkinter as tk\n')] |
from django.contrib import admin
from videoApp.models import Video, Comments
admin.site.register(Video)
admin.site.register(Comments) | [
"django.contrib.admin.site.register"
] | [((79, 105), 'django.contrib.admin.site.register', 'admin.site.register', (['Video'], {}), '(Video)\n', (98, 105), False, 'from django.contrib import admin\n'), ((106, 135), 'django.contrib.admin.site.register', 'admin.site.register', (['Comments'], {}), '(Comments)\n', (125, 135), False, 'from django.contrib import ad... |
# coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.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 obtain a copy of... | [
"unittest.main",
"billforward.apis.subscriptions_api.SubscriptionsApi"
] | [((13377, 13392), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13390, 13392), False, 'import unittest\n'), ((1058, 1111), 'billforward.apis.subscriptions_api.SubscriptionsApi', 'billforward.apis.subscriptions_api.SubscriptionsApi', ([], {}), '()\n', (1109, 1111), False, 'import billforward\n')] |
#!/usr/bin/env python
"""
_New_
Oracle implementation of JobGroup.New
"""
__all__ = []
import time
from WMCore.WMBS.MySQL.JobGroup.New import New as NewJobGroupMySQL
class New(NewJobGroupMySQL):
sql = """INSERT INTO wmbs_jobgroup (id, subscription, guid, output,
last_update) VALUES (wmbs_jobgrou... | [
"time.time"
] | [((388, 399), 'time.time', 'time.time', ([], {}), '()\n', (397, 399), False, 'import time\n')] |
"""
Sort by file creation time.
Copyright (c) 2014 - 2016 <NAME> <<EMAIL>>
License: MIT
"""
import sys
import time
from os.path import basename, exists
from TabsExtra import tab_sort_helper as tsh
if sys.platform.startswith('win'):
_PLATFORM = "windows"
elif sys.platform == "darwin":
_PLATFORM = "osx"
else:
... | [
"os.path.exists",
"ctypes.POINTER",
"os.path.getctime",
"sys.platform.startswith",
"ctypes.CDLL",
"ctypes.pointer",
"time.time"
] | [((202, 232), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (225, 232), False, 'import sys\n'), ((1274, 1299), 'ctypes.CDLL', 'ctypes.CDLL', (['"""libc.dylib"""'], {}), "('libc.dylib')\n", (1285, 1299), False, 'import ctypes\n'), ((2554, 2565), 'time.time', 'time.time', ([], {}... |
import pkgutil
from tornado.ioloop import PeriodicCallback
class _Routine:
PERIOD = None
@classmethod
def callback(cls):
cls._exec()
@classmethod
def _exec(cls, *args, **kwargs):
raise NotImplemented
def init():
# init routines
for loader, mod_name, is_pkg in pkgutil.wa... | [
"tornado.ioloop.PeriodicCallback",
"pkgutil.walk_packages"
] | [((310, 341), 'pkgutil.walk_packages', 'pkgutil.walk_packages', (['__path__'], {}), '(__path__)\n', (331, 341), False, 'import pkgutil\n'), ((463, 505), 'tornado.ioloop.PeriodicCallback', 'PeriodicCallback', (['mod.callback', 'mod.PERIOD'], {}), '(mod.callback, mod.PERIOD)\n', (479, 505), False, 'from tornado.ioloop im... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import absolute_import, division, print_function
import sympy.physics.units as spu
from scipy import constants as sc
from sympy.matrices import eye
from sympy.physics.matrices import msigma
from sympy.physics... | [
"sympy.physics.units.convert_to",
"types.SimpleNamespace",
"sympy.physics.quantum.TensorProduct",
"sympy.matrices.eye",
"sympy.physics.matrices.msigma"
] | [((969, 1372), 'types.SimpleNamespace', 'SimpleNamespace', ([], {'nm': 'spu.nm', 'um': 'spu.um', 'angstrom': '(spu.nm / 10)', 'erg': '(spu.cm * spu.cm * spu.g / spu.s / spu.s)', 'kg': 'spu.kg', 'g': 'spu.g', 'eV': 'spu.eV', 'meV': '(spu.eV / 1000.0)', 'microeV': '(spu.eV / 1000000.0)', 'coulomb': 'spu.coulomb', 'tesla'... |
import sys
from datetime import datetime
from common_utils import get_env_var
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def is_error_log(log_level):
return any(log_level.upper() == l for l in ['ERROR', 'FATAL'])
LOG_LEVEL = get_env_var('LOG_LEVEL', 'INFO').upper()
def is_log_enab... | [
"datetime.datetime.now",
"common_utils.get_env_var"
] | [((263, 295), 'common_utils.get_env_var', 'get_env_var', (['"""LOG_LEVEL"""', '"""INFO"""'], {}), "('LOG_LEVEL', 'INFO')\n", (274, 295), False, 'from common_utils import get_env_var\n'), ((582, 596), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (594, 596), False, 'from datetime import datetime\n')] |
import pandas as pd
from flask import Flask, request
app = Flask(__name__)
from flask_cors import CORS
CORS(app)
from flask import Flask
app = Flask(__name__)
#dataset.shape
@app.route('/getWeeklyReports/', methods=["GET"])
def get_weekly_hours():
#dataset = pd.read_csv('C:\\Users\\Priya\\Desktop\\Sivisoft\\Time Mo... | [
"pandas.read_csv",
"flask_cors.CORS",
"flask.Flask"
] | [((59, 74), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (64, 74), False, 'from flask import Flask\n'), ((103, 112), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (107, 112), False, 'from flask_cors import CORS\n'), ((143, 158), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (148, 158... |
#!/usr/bin/env python
import json, pymongo
from pymongo import MongoClient
import random
import datetime
import locale
""" a script to append timestamps to our transactions and insert them to the transactions collection of mongo_book database in the default localhost:27017 MongoDB database"""
locale.setlocale(locale.... | [
"datetime.datetime",
"json.loads",
"locale.setlocale",
"pymongo.MongoClient",
"random.randint"
] | [((296, 342), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '"""en_US.UTF-8"""'], {}), "(locale.LC_ALL, 'en_US.UTF-8')\n", (312, 342), False, 'import locale\n'), ((353, 366), 'pymongo.MongoClient', 'MongoClient', ([], {}), '()\n', (364, 366), False, 'from pymongo import MongoClient\n'), ((844, 864), 'rando... |
import numpy as np
from .layer_base import LayerBase
class ReluLayer(LayerBase):
def __init__(self):
super().__init__()
self.cache = {}
def id(self):
return "Relu"
def forward(self, x):
y = np.maximum(x, 0)
self.cache["is_negative"] = (x < 0)
return y
... | [
"numpy.power",
"numpy.log",
"numpy.tanh",
"numpy.max",
"numpy.exp",
"numpy.maximum"
] | [((240, 256), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (250, 256), True, 'import numpy as np\n'), ((1014, 1024), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (1021, 1024), True, 'import numpy as np\n'), ((1441, 1450), 'numpy.max', 'np.max', (['x'], {}), '(x)\n', (1447, 1450), True, 'import numpy... |
from django.contrib import admin
from .models import UserWeight
@admin.register(UserWeight)
class UserweightAdmin(admin.ModelAdmin):
list_display = ('id', 'user_id', 'day', 'weight')
empty_value_display = '-пусто-'
| [
"django.contrib.admin.register"
] | [((68, 94), 'django.contrib.admin.register', 'admin.register', (['UserWeight'], {}), '(UserWeight)\n', (82, 94), False, 'from django.contrib import admin\n')] |
import matplotlib.pyplot as plt
import generate
import convert
import analyse
import equilibrate
import yaml
from pathlib import Path
def main(settings: str, run: bool = False):
if run:
generate.run(settings)
with open(settings, 'r') as f:
params = yaml.safe_load(f)
N = params['initial... | [
"convert.write_bild",
"equilibrate.run_equilibration",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"pathlib.Path",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"generate.run",
"yaml.safe_load",
"convert.write_xyz",
"matplotlib.pyplot.bar",
"con... | [((470, 541), 'convert.read', 'convert.read', (['f"""{params[\'folders\'][\'bonds\']}/{params[\'main\'][\'bonds\']}"""'], {}), '(f"{params[\'folders\'][\'bonds\']}/{params[\'main\'][\'bonds\']}")\n', (482, 541), False, 'import convert\n'), ((663, 708), 'convert.write_bild', 'convert.write_bild', (['f"""{prefix}.bild"""... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 15:46:25 2021
@author: ali_d
"""
import numpy as np
import pandas as pd
# plotly
from plotly.offline import init_notebook_mode, iplot, plot
import plotly as py
init_notebook_mode(connected=True)
import plotly.graph_objs as go
from wordcloud import WordCloud
# matp... | [
"pandas.read_csv",
"plotly.offline.plot",
"plotly.offline.init_notebook_mode",
"plotly.graph_objs.Scatter",
"plotly.graph_objs.Figure"
] | [((214, 248), 'plotly.offline.init_notebook_mode', 'init_notebook_mode', ([], {'connected': '(True)'}), '(connected=True)\n', (232, 248), False, 'from plotly.offline import init_notebook_mode, iplot, plot\n'), ((368, 395), 'pandas.read_csv', 'pd.read_csv', (['"""cwurData.csv"""'], {}), "('cwurData.csv')\n", (379, 395),... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | [
"os.path.dirname",
"codecs.open",
"setuptools.find_packages"
] | [((324, 346), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (336, 346), False, 'from os import path\n'), ((429, 443), 'codecs.open', 'open', (['filename'], {}), '(filename)\n', (433, 443), False, 'from codecs import open\n'), ((691, 706), 'setuptools.find_packages', 'find_packages', ([], {}), '... |
import os, sys
from setuptools import find_packages, setup
install_requires = ['boto>=2.2.1']
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
except IOError:
README = "boto-rsync is a rou... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((591, 1466), 'setuptools.setup', 'setup', ([], {'name': '"""boto_rsync3"""', 'version': '"""0.8.1"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '("An rsync-like wrapper for boto\'s S3 and Google Storage " + \'interfaces.\')', 'long_description': "(README + '\\n\\n' + CHANGES)", 'url':... |
# Generated by Django 3.2 on 2021-06-30 01:38
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.migrations.AlterModelOptions",
"django.db.models.ImageField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((257, 314), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (288, 314), False, 'from django.db import migrations, models\n'), ((398, 518), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], ... |
#%%
from user_agents import parse
user_agent = "Mozilla/5.0 (Linux; Android 10; SM-N960F Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2889 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/1696 MicroMessenger/8.0.15.2001(0x28000F41) Process/to"
ua = parse(user_a... | [
"user_agents.parse"
] | [((308, 325), 'user_agents.parse', 'parse', (['user_agent'], {}), '(user_agent)\n', (313, 325), False, 'from user_agents import parse\n'), ((689, 702), 'user_agents.parse', 'parse', (['row[0]'], {}), '(row[0])\n', (694, 702), False, 'from user_agents import parse\n')] |
# importing library
from time import sleep
import requests
import cv2
import json
from asip.serial_mirto_robot import SerialMirtoRobot
robot = SerialMirtoRobot()
def readTrafficLight():
cap = cv2.VideoCapture(1)
while (True):
ret, frame = cap.read()
rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BG... | [
"asip.serial_mirto_robot.SerialMirtoRobot",
"cv2.imwrite",
"json.loads",
"requests.post",
"time.sleep",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.waitKey"
] | [((143, 161), 'asip.serial_mirto_robot.SerialMirtoRobot', 'SerialMirtoRobot', ([], {}), '()\n', (159, 161), False, 'from asip.serial_mirto_robot import SerialMirtoRobot\n'), ((199, 218), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(1)'], {}), '(1)\n', (215, 218), False, 'import cv2\n'), ((497, 520), 'cv2.destroyAllWindo... |
#!/bin/python
#Takes a measurement file and calculates some quantities of the system based on
# the system file that is passed.
import numpy as np
from fileUtility import getRoot,getGraph,getKeyFrames
from binaryNumberUtility import numberOfParticles,occupiedLevels
def totalNumberOfParticles(pathToData):
root = ge... | [
"fileUtility.getGraph",
"fileUtility.getKeyFrames",
"binaryNumberUtility.numberOfParticles",
"binaryNumberUtility.occupiedLevels",
"fileUtility.getRoot"
] | [((318, 337), 'fileUtility.getRoot', 'getRoot', (['pathToData'], {}), '(pathToData)\n', (325, 337), False, 'from fileUtility import getRoot, getGraph, getKeyFrames\n'), ((365, 383), 'fileUtility.getKeyFrames', 'getKeyFrames', (['root'], {}), '(root)\n', (377, 383), False, 'from fileUtility import getRoot, getGraph, get... |
##############################################################################
# Copyright (c) 2016 <NAME> and others
# <EMAIL>
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is availab... | [
"yardstick.benchmark.scenarios.availability.scenario_general.ScenarioGeneral",
"mock.patch.object",
"mock.Mock"
] | [((1384, 1441), 'yardstick.benchmark.scenarios.availability.scenario_general.ScenarioGeneral', 'scenario_general.ScenarioGeneral', (['self.scenario_cfg', 'None'], {}), '(self.scenario_cfg, None)\n', (1416, 1441), False, 'from yardstick.benchmark.scenarios.availability import scenario_general\n'), ((1473, 1520), 'mock.p... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', mode... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((316, 409), '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", (332, 409), False, 'from django.db import migrations, models\... |
# !/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Test flex channels on Bpod r2+
"""
from pybpodapi.protocol import Bpod, StateMachine
my_bpod = Bpod() # For Bpod r2+ (with flex channels), do not provide the serial_port parameter. It will auto-detect.
my_bpod.set_flex_channel_types([2, 2, 3, 3])
my_bpod.set_analog... | [
"pybpodapi.protocol.Bpod",
"pybpodapi.protocol.StateMachine"
] | [((148, 154), 'pybpodapi.protocol.Bpod', 'Bpod', ([], {}), '()\n', (152, 154), False, 'from pybpodapi.protocol import Bpod, StateMachine\n'), ((775, 796), 'pybpodapi.protocol.StateMachine', 'StateMachine', (['my_bpod'], {}), '(my_bpod)\n', (787, 796), False, 'from pybpodapi.protocol import Bpod, StateMachine\n')] |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ShipManagerConfig(AppConfig):
"""
Register Ship Manager app in project.
"""
default_auto_field = "django.db.models.BigAutoField"
name = "coding_challenge.ship_manager"
verbose_name = _("Ship Manager... | [
"django.utils.translation.gettext_lazy"
] | [((305, 322), 'django.utils.translation.gettext_lazy', '_', (['"""Ship Manager"""'], {}), "('Ship Manager')\n", (306, 322), True, 'from django.utils.translation import gettext_lazy as _\n')] |
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, renderers, permissions
from rest_framework.decorators import action
from rest_framework.response import Response
from .models import Actor
from .serializers import (
ActorListSerializer,
ActorDetailSerializer,
)
class ActorVi... | [
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((1192, 1235), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'methods': "['get', 'put']"}), "(detail=True, methods=['get', 'put'])\n", (1198, 1235), False, 'from rest_framework.decorators import action\n'), ((490, 515), 'rest_framework.response.Response', 'Response', (['serializer.data'], {})... |
from django.db import models
from easy_tenants.conf import settings
class TenantMixin(models.Model):
users = models.ManyToManyField(
to=settings.AUTH_USER_MODEL,
related_name='tenants'
)
class Meta:
abstract = True
class TenantAbstract(models.Model):
tenant = models.Foreign... | [
"django.db.models.Manager",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((116, 191), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'to': 'settings.AUTH_USER_MODEL', 'related_name': '"""tenants"""'}), "(to=settings.AUTH_USER_MODEL, related_name='tenants')\n", (138, 191), False, 'from django.db import models\n'), ((306, 381), 'django.db.models.ForeignKey', 'models.Fore... |
import re
import pytest
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import responses
def request_body():
return responses.calls[0].request.body
def request_query():
return urlparse(responses.calls[0].request.url).query
def request_user_agent():
r... | [
"re.search",
"pytest.fail",
"responses.add",
"urlparse.urlparse"
] | [((606, 706), 'responses.add', 'responses.add', (['method', 'url'], {'body': '"""{"key":"value"}"""', 'status': '(200)', 'content_type': '"""application/json"""'}), '(method, url, body=\'{"key":"value"}\', status=200, content_type\n =\'application/json\')\n', (619, 706), False, 'import responses\n'), ((240, 280), 'u... |
"""
This file contains the keras implementations of all the optimizers
proposed in
Variants of RMSProp and Adagrad with Logarithmic Regret Bounds
(http://arxiv.org/abs/1706.05507), <NAME> and <NAME>
I used the format used in keras optimizers.py file.
I appreciate all the authors who contributed to keras.
"""
from ... | [
"keras.backend.get_value",
"keras.backend.sqrt",
"keras.backend.square",
"keras.backend.get_variable_shape",
"keras.backend.variable",
"keras.backend.exp",
"keras.backend.update_add",
"keras.backend.update"
] | [((1042, 1074), 'keras.backend.variable', 'K.variable', (['(0)'], {'name': '"""iterations"""'}), "(0, name='iterations')\n", (1052, 1074), True, 'from keras import backend as K\n'), ((1093, 1118), 'keras.backend.variable', 'K.variable', (['lr'], {'name': '"""lr"""'}), "(lr, name='lr')\n", (1103, 1118), True, 'from kera... |
import smtplib
from email.mime.text import MIMEText
from django.conf import settings
try:
from celery import shared_task
except ImportError:
raise ImportError('you need to install celery and setup celery configuration')
from django.utils.http import urlsafe_base64_encode
from django.contrib.auth.tokens impor... | [
"django.utils.encoding.force_bytes",
"django.contrib.auth.tokens.default_token_generator.make_token",
"email.mime.text.MIMEText"
] | [((1745, 1770), 'email.mime.text.MIMEText', 'MIMEText', (['body', 'body_type'], {}), '(body, body_type)\n', (1753, 1770), False, 'from email.mime.text import MIMEText\n'), ((1133, 1173), 'django.contrib.auth.tokens.default_token_generator.make_token', 'default_token_generator.make_token', (['user'], {}), '(user)\n', (1... |
from atcodertools.fmtprediction.models.calculator import CalcNode
class Index:
"""
The model to store index information of a variable, which has a likely the minimal / maximal value and for each dimension.
Up to 2 indices are now supported.
In most cases, the minimal value is 1 and the m... | [
"atcodertools.fmtprediction.models.calculator.CalcNode.parse"
] | [((1164, 1189), 'atcodertools.fmtprediction.models.calculator.CalcNode.parse', 'CalcNode.parse', (['new_value'], {}), '(new_value)\n', (1178, 1189), False, 'from atcodertools.fmtprediction.models.calculator import CalcNode\n'), ((1301, 1326), 'atcodertools.fmtprediction.models.calculator.CalcNode.parse', 'CalcNode.pars... |
from datetime import datetime, timedelta
from django.test import TestCase
from icalendar import Event as VEvent, vDDDTypes
from events.models import Event
from calendars.models import CalendarFeed
def dummy_event(**kwargs):
default = {
'UID': 'uid',
'SUMMARY': 'event name',
'DESCRIPTION':... | [
"events.models.Event.objects.get",
"calendars.models.CalendarFeed.objects.create",
"events.models.Event.objects.create",
"datetime.datetime.now",
"events.models.Event.objects.all",
"datetime.datetime.today",
"datetime.timedelta"
] | [((790, 806), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (804, 806), False, 'from datetime import datetime, timedelta\n'), ((1448, 1496), 'calendars.models.CalendarFeed.objects.create', 'CalendarFeed.objects.create', ([], {'name': '"""Test"""', 'url': '""""""'}), "(name='Test', url='')\n", (1475, 14... |
# -*- coding: utf-8 -*-
"""Upload demo."""
from rayvision_api import RayvisionAPI
from rayvision_sync.upload import RayvisionUpload
api = RayvisionAPI(access_id="xxxxx",
access_key="xxxxx",
domain="task.renderbus.com",
platform="2")
CONFIG_PATH = [
r"C:\wo... | [
"rayvision_api.RayvisionAPI",
"rayvision_sync.upload.RayvisionUpload"
] | [((140, 239), 'rayvision_api.RayvisionAPI', 'RayvisionAPI', ([], {'access_id': '"""xxxxx"""', 'access_key': '"""xxxxx"""', 'domain': '"""task.renderbus.com"""', 'platform': '"""2"""'}), "(access_id='xxxxx', access_key='xxxxx', domain=\n 'task.renderbus.com', platform='2')\n", (152, 239), False, 'from rayvision_api i... |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2018 <NAME>
#
# 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, c... | [
"median_voting.MedianVote",
"schulze_voting.SchulzeVote",
"csv.reader",
"re.compile"
] | [((1408, 1468), 're.compile', 're.compile', (['"""\\\\s*[*]\\\\s+(?P<name>.+?):\\\\s*(?P<weight>\\\\d+)$"""'], {}), "('\\\\s*[*]\\\\s+(?P<name>.+?):\\\\s*(?P<weight>\\\\d+)$')\n", (1418, 1468), False, 'import re\n'), ((2779, 2816), 're.compile', 're.compile', (['"""\\\\s*#\\\\s+(?P<title>.+)$"""'], {}), "('\\\\s*#\\\\s... |
from typing import List, Optional
from lin import BaseModel, ParameterError
from pydantic import EmailStr, Field, validator
class EmailSchema(BaseModel):
email: Optional[str] = Field(description="用户邮箱")
@validator("email")
def check_email(cls, v, values, **kwargs):
return EmailStr.validate(v) if... | [
"pydantic.Field",
"lin.ParameterError",
"pydantic.EmailStr.validate",
"pydantic.validator"
] | [((184, 209), 'pydantic.Field', 'Field', ([], {'description': '"""用户邮箱"""'}), "(description='用户邮箱')\n", (189, 209), False, 'from pydantic import EmailStr, Field, validator\n'), ((216, 234), 'pydantic.validator', 'validator', (['"""email"""'], {}), "('email')\n", (225, 234), False, 'from pydantic import EmailStr, Field,... |
# Copyright 2019 The TensorNetwork 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 ... | [
"numpy.abs",
"tensornetwork.matrixproductstates.base_mps.BaseMPS",
"numpy.ones",
"tensornetwork.contract_between",
"numpy.testing.assert_allclose",
"numpy.tensordot",
"tensorflow.compat.v1.enable_v2_behavior",
"tensornetwork.backends.backend_factory.get_backend",
"pytest.fixture",
"numpy.array",
... | [((930, 967), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (943, 967), False, 'from jax.config import config\n'), ((968, 1001), 'tensorflow.compat.v1.enable_v2_behavior', 'tf.compat.v1.enable_v2_behavior', ([], {}), '()\n', (999, 1001), True, 'impo... |
import torch
from torch import nn
class BertEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings.
"""
def __init__(self, model_config):
super(BertEmbeddings, self).__init__()
self.word_embeddings = nn.Embedding(model_config.vocab_size, m... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.nn.LayerNorm",
"torch.cat",
"torch.nn.Linear",
"torch.zeros_like",
"torch.arange"
] | [((281, 359), 'torch.nn.Embedding', 'nn.Embedding', (['model_config.vocab_size', 'model_config.hidden_size'], {'padding_idx': '(0)'}), '(model_config.vocab_size, model_config.hidden_size, padding_idx=0)\n', (293, 359), False, 'from torch import nn\n'), ((396, 491), 'torch.nn.Embedding', 'nn.Embedding', (['model_config.... |
#! /usr/bin/python3
"""Visualisation script for Git repositories.
Requires the `evince` and `dot` command line tools.
"""
import time
import subprocess
import tempfile
from pathlib import Path
import sys
from itertools import groupby
from collections import namedtuple
ENCODING = sys.getdefaultencoding()
class Ref(n... | [
"tempfile.TemporaryDirectory",
"sys.getdefaultencoding",
"pathlib.Path",
"subprocess.run",
"time.sleep"
] | [((282, 306), 'sys.getdefaultencoding', 'sys.getdefaultencoding', ([], {}), '()\n', (304, 306), False, 'import sys\n'), ((3771, 3849), 'subprocess.run', 'subprocess.run', (['args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(args, **kwargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n', (3785, ... |
import hsmm4acc.hsmm as hsmm
import numpy as np
def test_initialize_model():
Nmax = 2
dim = 3
model = hsmm.initialize_model(Nmax, dim)
assert len(model.obs_distns) == Nmax
def test_colormap():
num_states = 5
colormap, cmap = hsmm.get_color_map(num_states)
assert len(colormap.keys()) == n... | [
"hsmm4acc.hsmm.initialize_model",
"numpy.random.normal",
"numpy.random.rand",
"numpy.zeros",
"numpy.random.randint",
"hsmm4acc.hsmm.get_color_map",
"hsmm4acc.hsmm.train_hsmm"
] | [((116, 148), 'hsmm4acc.hsmm.initialize_model', 'hsmm.initialize_model', (['Nmax', 'dim'], {}), '(Nmax, dim)\n', (137, 148), True, 'import hsmm4acc.hsmm as hsmm\n'), ((253, 283), 'hsmm4acc.hsmm.get_color_map', 'hsmm.get_color_map', (['num_states'], {}), '(num_states)\n', (271, 283), True, 'import hsmm4acc.hsmm as hsmm\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
pandas 学习
字典形式的numpy
"""
from __future__ import print_function
import numpy as np
import pandas as pd
dates = pd.date_range('20130101', periods=6)
df = pd.DataFrame(np.arange(24).reshape((6,4)),index=dates, columns=['A','B','C','D'])
"""
A B C ... | [
"pandas.date_range",
"numpy.arange"
] | [((166, 202), 'pandas.date_range', 'pd.date_range', (['"""20130101"""'], {'periods': '(6)'}), "('20130101', periods=6)\n", (179, 202), True, 'import pandas as pd\n'), ((221, 234), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (230, 234), True, 'import numpy as np\n')] |
"""Blueprint for a micropub endpoint implementation.
Kept separate from indieauth, but note that it must know of the indieauth token
endpoint in advance, so there is some coupling.
"""
import json
import os.path
import re
import typing
from urllib.parse import unquote
from flask import (
Blueprint,
Request,
... | [
"flask.render_template",
"flask.request.args.get",
"flask.current_app.logger.debug",
"interpersonal.blueprints.indieauth.util.bearer_verify_token",
"flask.request.headers.get",
"flask.wrappers.Response",
"flask.jsonify",
"flask.send_from_directory",
"flask.request.form.get",
"interpersonal.bluepri... | [((1003, 1089), 'flask.Blueprint', 'Blueprint', (['"""micropub"""', '__name__'], {'url_prefix': '"""/micropub"""', 'template_folder': '"""temple"""'}), "('micropub', __name__, url_prefix='/micropub', template_folder=\n 'temple')\n", (1012, 1089), False, 'from flask import Blueprint, Request, current_app, jsonify, re... |
import types
import datetime
from nose.tools import eq_ as orig_eq_
from unittest import skip
from allmychanges.utils import first, html_document_fromstring
from allmychanges.parsing.pipeline import (
get_markup,
extract_metadata,
group_by_path,
strip_outer_tag,
prerender_items,
highlight_keywo... | [
"allmychanges.parsing.pipeline.filter_versions",
"allmychanges.parsing.pipeline.parse_plain_file",
"allmychanges.parsing.pipeline.prerender_items",
"allmychanges.parsing.pipeline.get_markup",
"allmychanges.parsing.pipeline.parse_file",
"allmychanges.utils.html_document_fromstring",
"allmychanges.parsing... | [((927, 961), 'allmychanges.env.Environment', 'Environment', ([], {'type': '"""root"""', 'title': '""""""'}), "(type='root', title='')\n", (938, 961), False, 'from allmychanges.env import Environment\n'), ((15268, 15302), 'unittest.skip', 'skip', (['"""waiting for implementation"""'], {}), "('waiting for implementation... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import h5py
import sys
if __name__ == '__main__' :
EXIT_FAILURE = 1
EXIT_SUCCESS = 0
# Check if we have a program argument, otherwise terminate
if len(sys.argv) <= 1 :
print("Usage: " + sys.argv[0] + " H5FILE\n")
sys.exit(EXIT_FAILURE)
file... | [
"sys.exit",
"h5py.File"
] | [((369, 393), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (378, 393), False, 'import h5py\n'), ((292, 314), 'sys.exit', 'sys.exit', (['EXIT_FAILURE'], {}), '(EXIT_FAILURE)\n', (300, 314), False, 'import sys\n')] |
import sys, json, os, subprocess as sp, getpass, logging, argparse
from pathlib import Path
import paramiko
# silence deprecation warnings
# https://github.com/paramiko/paramiko/issues/1386
import warnings
warnings.filterwarnings(action='ignore',module='.*paramiko.*')
logger = logging.getLogger()
logger.setLevel(log... | [
"logging.getLogger",
"os.set_inheritable",
"json.loads",
"os.execvp",
"argparse.ArgumentParser",
"pathlib.Path",
"os.close",
"json.dumps",
"getpass.getpass",
"os.pipe",
"paramiko.SSHClient",
"warnings.filterwarnings",
"os.set_blocking"
] | [((207, 270), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'module': '""".*paramiko.*"""'}), "(action='ignore', module='.*paramiko.*')\n", (230, 270), False, 'import warnings\n'), ((281, 300), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (298, 300), False, 'import... |
"""This module contains njitted routines and data structures to:
- Find the best possible split of a node. For a given node, a split is
characterized by a feature and a bin.
- Apply a split to a node, i.e. split the indices of the samples at the node
into the newly created left and right childs.
"""
import numpy a... | [
"numpy.int64",
"numpy.full",
"numba.njit",
"numba.jitclass",
"numpy.zeros",
"numpy.empty",
"numpy.cumsum",
"numpy.empty_like",
"numba.prange",
"numpy.zeros_like",
"numpy.arange"
] | [((566, 1016), 'numba.jitclass', 'jitclass', (["[('gain', float32), ('feature_idx', uint32), ('bin_idx', uint8), (\n 'left_g_hf', float32), ('left_gx_hfx', float32), ('left_h', float32), (\n 'left_hx', float32), ('left_hx2', float32), ('if_left_linear', boolean),\n ('right_g_hf', float32), ('right_gx_hfx', flo... |
import matplotlib.pyplot as plt
import numpy as np
def load_values(filename):
values = []
with open(filename) as file:
lines = file.readlines()
values = [list(map(float, line.split(','))) for line in lines]
return np.array(values).mean(axis=0)
if __name__ == "__main__":
fi... | [
"numpy.array",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((329, 363), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'figsize': '(8, 8)'}), '(2, 1, figsize=(8, 8))\n', (341, 363), True, 'import matplotlib.pyplot as plt\n'), ((1143, 1153), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1151, 1153), True, 'import matplotlib.pyplot as plt\n'), ((255,... |
from osbot_aws.Dependencies import load_dependency
from osbot_aws.helpers.Lambda_Helpers import log_to_elk
def run(event, context):
try:
load_dependency("elastic")
from osbot_jira.api.elk.Elk_To_Slack import ELK_to_Slack
return ELK_to_Slack().handle_lambda_event(event)
except Exception... | [
"osbot_jira.api.elk.Elk_To_Slack.ELK_to_Slack",
"osbot_aws.Dependencies.load_dependency"
] | [((151, 177), 'osbot_aws.Dependencies.load_dependency', 'load_dependency', (['"""elastic"""'], {}), "('elastic')\n", (166, 177), False, 'from osbot_aws.Dependencies import load_dependency\n'), ((258, 272), 'osbot_jira.api.elk.Elk_To_Slack.ELK_to_Slack', 'ELK_to_Slack', ([], {}), '()\n', (270, 272), False, 'from osbot_j... |
import random
from django.core import serializers
from django.shortcuts import HttpResponse
from .models import DemoData
TEMP = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-"
# Create your views here.
def demo_views(request):
result = DemoData.objects.filter(
name="".joi... | [
"random.randrange"
] | [((345, 369), 'random.randrange', 'random.randrange', (['(1)', '(254)'], {}), '(1, 254)\n', (361, 369), False, 'import random\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
================
Network Rewiring
================
:Author:
<NAME>
:Date:
2011-03-01
:Copyright:
Copyright(c) 2011 Jacobs University of Bremen. All rights reserved.
:File:
randomisation.py
"""
import numpy
import networkx as nx
def standard_direct... | [
"numpy.array",
"numpy.zeros",
"networkx.NetworkXError",
"numpy.nonzero"
] | [((570, 634), 'networkx.NetworkXError', 'nx.NetworkXError', (['"""the standard setup does not allow self-links"""'], {}), "('the standard setup does not allow self-links')\n", (586, 634), True, 'import networkx as nx\n'), ((6617, 6660), 'numpy.zeros', 'numpy.zeros', ([], {'shape': '(len_sets, 4)', 'dtype': 'int'}), '(s... |
from werkzeug.utils import find_modules, import_string
def import_all(import_name):
for module in find_modules(import_name, include_packages=True, recursive=True):
import_string(module)
| [
"werkzeug.utils.import_string",
"werkzeug.utils.find_modules"
] | [((104, 168), 'werkzeug.utils.find_modules', 'find_modules', (['import_name'], {'include_packages': '(True)', 'recursive': '(True)'}), '(import_name, include_packages=True, recursive=True)\n', (116, 168), False, 'from werkzeug.utils import find_modules, import_string\n'), ((178, 199), 'werkzeug.utils.import_string', 'i... |
import torch
from torch import nn
import torch.nn.functional as F
import math
import numpy as np
import logging
class BaseUCLoss(nn.Module):
def __init__(self, margin=0, lm=0.05, um=0.25, lambda_g=1.0, la=10, ua=110, reg_type='exp_3', shift_margin=False,
normalize=True, uc=True, metric='arc', *a... | [
"torch.log",
"torch.rand",
"torch.max",
"torch.cosine_similarity",
"torch.sin",
"torch.exp",
"torch.cdist",
"torch.nn.functional.normalize",
"torch.min",
"torch.cos",
"torch.nn.functional.softplus",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.relu",
"torch.zeros_like",
"tor... | [((14104, 14121), 'torch.rand', 'torch.rand', (['(4)', '(10)'], {}), '(4, 10)\n', (14114, 14121), False, 'import torch\n'), ((14187, 14202), 'torch.arange', 'torch.arange', (['(4)'], {}), '(4)\n', (14199, 14202), False, 'import torch\n'), ((1091, 1161), 'torch.cdist', 'torch.cdist', (['feat1', 'feat2'], {'compute_mode'... |
#
# Copyright (c) 2021 The GPflux Contributors.
#
# 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 agr... | [
"gpflow.default_float",
"gpflow.utilities.deepcopy",
"inspect.getmembers",
"gpflow.mean_functions.Linear",
"gpflow.inducing_variables.SeparateIndependentInducingVariables",
"gpflow.inducing_variables.InducingPoints",
"warnings.warn",
"gpflow.mean_functions.Identity",
"gpflow.kernels.SharedIndependen... | [((11766, 11778), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (11773, 11778), False, 'from typing import List, Optional, Type, TypeVar, Union\n'), ((2923, 2951), 'gpflow.kernels.SeparateIndependent', 'SeparateIndependent', (['kernels'], {}), '(kernels)\n', (2942, 2951), False, 'from gpflow.kernels import... |
#
# Copyright (C) 2016-2020 by <NAME>, <NAME>, <NAME>, and contributors
#
# This file is part of Power Sequencer.
#
# Power Sequencer is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# Lic... | [
"bpy.props.IntProperty",
"bpy.props.PointerProperty",
"bpy.props.StringProperty",
"bpy.utils.unregister_class",
"bpy.props.EnumProperty",
"bpy.utils.register_class"
] | [((846, 1080), 'bpy.props.EnumProperty', 'bpy.props.EnumProperty', ([], {'items': "[('NORMAL', 'Normal (1x)', ''), ('FAST', 'Fast (1.33x)', ''), ('FASTER',\n 'Faster (1.66x)', ''), ('DOUBLE', 'Double (2x)', ''), ('TRIPLE',\n 'Triple (3x)', '')]", 'name': '"""Playback"""', 'default': '"""NORMAL"""'}), "(items=[('N... |
# pylint: disable=protected-access, unused-argument, no-value-for-parameter
from unittest import mock, TestCase
from .test_common import setUp
from radical.pilot.agent.launch_method.rsh import RSH
# ------------------------------------------------------------------------------
#
class TestRSH(TestCase):
# ----... | [
"unittest.mock.patch",
"radical.pilot.agent.launch_method.rsh.RSH",
"unittest.mock.patch.object"
] | [((402, 455), 'unittest.mock.patch.object', 'mock.patch.object', (['RSH', '"""__init__"""'], {'return_value': 'None'}), "(RSH, '__init__', return_value=None)\n", (419, 455), False, 'from unittest import mock, TestCase\n'), ((461, 523), 'unittest.mock.patch', 'mock.patch', (['"""radical.utils.which"""'], {'return_value'... |
# Simple HiveMQ Client built with PyCharm
# excellent resource here:
# https://github.com/eclipse/paho.mqtt.python#id3
import paho.mqtt.client as paho # pip install paho.mqtt
from datetime import datetime
import time
import argparse
import random
from json import JSONEncoder
import json
import signal
keepRunning = Tr... | [
"datetime.datetime",
"json.loads",
"signal.signal",
"argparse.FileType",
"json.JSONEncoder.default",
"argparse.ArgumentParser",
"paho.mqtt.client.Client",
"datetime.datetime.now",
"random.randint"
] | [((2004, 2036), 'paho.mqtt.client.Client', 'paho.Client', (['name'], {'userdata': 'name'}), '(name, userdata=name)\n', (2015, 2036), True, 'import paho.mqtt.client as paho\n'), ((2732, 2746), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2744, 2746), False, 'from datetime import datetime\n'), ((2759, 2779... |
import os
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class ReplayBuffer:
def __init__(self, state_dim, action_dim,max_size=1e6, device = torch.device('cpu')):
self.state_dim = state_dim
self.action_dim = action_dim
self.max_size = max_size
... | [
"os.path.exists",
"torch.nn.ReLU",
"torch.as_tensor",
"numpy.sqrt",
"torch.rand_like",
"torch.nn.functional.mse_loss",
"os.makedirs",
"torch.load",
"os.path.join",
"numpy.random.randint",
"numpy.zeros",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.no_grad",
"torch.empty",
"torc... | [((6024, 6039), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6037, 6039), False, 'import torch\n'), ((185, 204), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (197, 204), False, 'import torch\n'), ((367, 437), 'torch.empty', 'torch.empty', (['(max_size, state_dim)'], {'dtype': 'torch.float32... |
"""
Utility script for modifying @module attributes in serialized beep
classes, e. g.
Usage:
beep_compatibility.py [DIRECTORY]
Options:
-h --help Show this screen
--version Show version
"""
import json
from tqdm import tqdm
from docopt import docopt
from monty.os.path import find_exts
def... | [
"json.dumps",
"tqdm.tqdm",
"docopt.docopt",
"monty.os.path.find_exts"
] | [((577, 605), 'monty.os.path.find_exts', 'find_exts', (['directory', '"""json"""'], {}), "(directory, 'json')\n", (586, 605), False, 'from monty.os.path import find_exts\n'), ((623, 635), 'tqdm.tqdm', 'tqdm', (['fnames'], {}), '(fnames)\n', (627, 635), False, 'from tqdm import tqdm\n'), ((1061, 1076), 'docopt.docopt', ... |
from __future__ import unicode_literals
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
url(r'^$', 'xue.bandexams.views.my_view'),
url(r'add/$', 'xue.bandexams.views.add_view'),
)
# vim:ai:et:ts=4:sw=4:sts=4:fenc=utf8:
| [
"django.conf.urls.defaults.url"
] | [((175, 215), 'django.conf.urls.defaults.url', 'url', (['"""^$"""', '"""xue.bandexams.views.my_view"""'], {}), "('^$', 'xue.bandexams.views.my_view')\n", (178, 215), False, 'from django.conf.urls.defaults import patterns, include, url\n'), ((223, 267), 'django.conf.urls.defaults.url', 'url', (['"""add/$"""', '"""xue.ba... |
from collections import deque
from ..library.number_theory.pythagorean_triples import PythagoreanTriplet
def solve(bound: int=1_000_000_000) -> int:
accumulate = 0
def process(triplet: PythagoreanTriplet) -> bool:
nonlocal accumulate
minimal = triplet[0] if triplet[0] <= triplet[1] else tri... | [
"collections.deque"
] | [((599, 606), 'collections.deque', 'deque', ([], {}), '()\n', (604, 606), False, 'from collections import deque\n')] |
#!/usr/bin/env python
# coding: utf-8
import argparse
import tensorflow as tf
import logging
import os
from nnrecsys.data.yoochoose.input import get_feature_columns, train_input_fn
from nnrecsys.data.yoochoose import constants
from nnrecsys.models.rnn import model_fn
from nnrecsys.training.hooks import ValidationMetr... | [
"logging.getLogger",
"nnrecsys.utils.file_len",
"argparse.ArgumentParser",
"nnrecsys.data.yoochoose.input.train_input_fn",
"nnrecsys.data.yoochoose.input.get_feature_columns",
"os.path.join",
"os.path.realpath",
"tensorflow.contrib.estimator.stop_if_no_decrease_hook",
"logging.info"
] | [((436, 462), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (452, 462), False, 'import os\n'), ((507, 542), 'nnrecsys.utils.file_len', 'file_len', (['constants.VOCABULARY_FILE'], {}), '(constants.VOCABULARY_FILE)\n', (515, 542), False, 'from nnrecsys.utils import file_len\n'), ((1016, 1203... |
import argparse
import os
import time
import sys
import sqlite3
from src.analysis.tms_entropy import add_tms_entropy
argparser = argparse.ArgumentParser(
description='Calculate and add TMS-Entropy to database file; BACKUP YOUR FILES'
)
argparser.add_argument(
'folders',
type=str,
nargs='+',
help=... | [
"os.listdir",
"src.analysis.tms_entropy.add_tms_entropy",
"argparse.ArgumentParser",
"os.path.join",
"sys.exit",
"time.time"
] | [((131, 240), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Calculate and add TMS-Entropy to database file; BACKUP YOUR FILES"""'}), "(description=\n 'Calculate and add TMS-Entropy to database file; BACKUP YOUR FILES')\n", (154, 240), False, 'import argparse\n'), ((1436, 1454), 'os.l... |
from setuptools import setup
setup(name='gym_icy_gridworld',
version='0.0.1',
install_requires=['gym', 'opencv-python']
)
| [
"setuptools.setup"
] | [((30, 125), 'setuptools.setup', 'setup', ([], {'name': '"""gym_icy_gridworld"""', 'version': '"""0.0.1"""', 'install_requires': "['gym', 'opencv-python']"}), "(name='gym_icy_gridworld', version='0.0.1', install_requires=['gym',\n 'opencv-python'])\n", (35, 125), False, 'from setuptools import setup\n')] |
# -*- coding: utf-8 -*-
from django.db import models
from shop.util.fields import CurrencyField
class Category(models.Model):
'''
This should be a node in a tree (mptt?) structure representing categories
of products.
Ideally, this should be usable as a tag cloud too (tags are just categories
that ... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"shop.util.fields.CurrencyField",
"django.db.models.CharField"
] | [((429, 461), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (445, 461), False, 'from django.db import models\n'), ((473, 491), 'django.db.models.SlugField', 'models.SlugField', ([], {}), '()\n', (489, 491), False, 'from django.db import models\n'), ((514, 587), '... |
# Generated by Django 4.0 on 2021-12-26 07:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stats', '0025_alter_player_created_by'),
]
operations = [
migrations.AlterField(
model_name='player',
name='hash_redee... | [
"django.db.models.BooleanField"
] | [((346, 422), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""May be redeemed by a user"""'}), "(default=False, verbose_name='May be redeemed by a user')\n", (365, 422), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
"""
Created on Monday 28 Sept 2020
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 ... | [
"pathlib.Path",
"PyQt5.QtWidgets.QMessageBox.critical",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWidgets.QApplication",
"cgt.util.utils.timestamp",
"os.path.expanduser",
"PyQt5.QtWidgets.QMessageBox.warning"
] | [((1707, 1720), 'PyQt5.QtCore.pyqtSlot', 'qc.pyqtSlot', ([], {}), '()\n', (1718, 1720), True, 'import PyQt5.QtCore as qc\n'), ((2221, 2234), 'PyQt5.QtCore.pyqtSlot', 'qc.pyqtSlot', ([], {}), '()\n', (2232, 2234), True, 'import PyQt5.QtCore as qc\n'), ((2884, 2897), 'PyQt5.QtCore.pyqtSlot', 'qc.pyqtSlot', ([], {}), '()\... |
# -*- coding: utf-8 -*-
#
# Copyright © Simphony Project Contributors
# Licensed under the terms of the MIT License
# (see simphony/__init__.py for details)
import pytest
import os
from simphony.plugins.siepic.parser import load_spi
#==============================================================================
# T... | [
"os.path.dirname",
"simphony.plugins.siepic.parser.load_spi"
] | [((18907, 18925), 'simphony.plugins.siepic.parser.load_spi', 'load_spi', (['filename'], {}), '(filename)\n', (18915, 18925), False, 'from simphony.plugins.siepic.parser import load_spi\n'), ((19088, 19106), 'simphony.plugins.siepic.parser.load_spi', 'load_spi', (['filename'], {}), '(filename)\n', (19096, 19106), False,... |
import ipopt
ipopt.setLoggingLevel(50)
import numpy as np
from collections import namedtuple
from pycalphad.core.constants import MIN_SITE_FRACTION
SolverResult = namedtuple('SolverResult', ['converged', 'x', 'chemical_potentials'])
class SolverBase(object):
""""Base class for solvers."""
ignore_convergence =... | [
"ipopt.setLoggingLevel",
"collections.namedtuple",
"numpy.abs",
"ipopt.problem"
] | [((13, 38), 'ipopt.setLoggingLevel', 'ipopt.setLoggingLevel', (['(50)'], {}), '(50)\n', (34, 38), False, 'import ipopt\n'), ((164, 233), 'collections.namedtuple', 'namedtuple', (['"""SolverResult"""', "['converged', 'x', 'chemical_potentials']"], {}), "('SolverResult', ['converged', 'x', 'chemical_potentials'])\n", (17... |
"""
PVANet mainly consists of two different kinds of blocks:
1. conv-crelu-bn blocks
2. inception blocks
"""
from collections import namedtuple
import tensorflow as tf
slim = tf.contrib.slim
BLOCK_TYPE_MCRELU = 'BLOCK_TYPE_MCRELU'
BLOCK_TYPE_INCEP = 'BLOCK_TYPE_INCEP'
BlockConfig = namedtuple('BlockConfig',... | [
"collections.namedtuple",
"tensorflow.variable_scope",
"tensorflow.nn.relu",
"tensorflow.get_variable",
"tensorflow.concat",
"tensorflow.ones_initializer",
"tensorflow.name_scope",
"tensorflow.zeros_initializer"
] | [((295, 366), 'collections.namedtuple', 'namedtuple', (['"""BlockConfig"""', '"""stride, num_outputs, preact_bn, block_type"""'], {}), "('BlockConfig', 'stride, num_outputs, preact_bn, block_type')\n", (305, 366), False, 'from collections import namedtuple\n'), ((2618, 2646), 'tensorflow.nn.relu', 'tf.nn.relu', (['net'... |
# Copyright 2017 Square, 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,... | [
"behave.when",
"behave.then"
] | [((594, 651), 'behave.when', 'behave.when', (['"""I write {value} to ICE register {register}"""'], {}), "('I write {value} to ICE register {register}')\n", (605, 651), False, 'import behave\n'), ((1090, 1143), 'behave.when', 'behave.when', (['"""I write {value} to register {register}"""'], {}), "('I write {value} to re... |
import dash_mantine_components as dmc
from dash_iconify import DashIconify
component = dmc.Group(
children=[
dmc.ThemeIcon(
DashIconify(icon="tabler:photo", width=20),
variant="gradient",
gradient={"from": "indigo", "to": "cyan"},
size="lg",
),
... | [
"dash_iconify.DashIconify"
] | [((149, 191), 'dash_iconify.DashIconify', 'DashIconify', ([], {'icon': '"""tabler:photo"""', 'width': '(20)'}), "(icon='tabler:photo', width=20)\n", (160, 191), False, 'from dash_iconify import DashIconify\n'), ((349, 391), 'dash_iconify.DashIconify', 'DashIconify', ([], {'icon': '"""tabler:photo"""', 'width': '(20)'})... |
# -*- coding: utf-8 -*-
# Copyright: <NAME> <<EMAIL>>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import zipfile, os
import unicodedata
from anki.utils import tmpfile, json
from anki.importing.anki2 import Anki2Importer
class AnkiPackageImporter(Anki2Importer):
def run(self):
... | [
"os.path.exists",
"zipfile.ZipFile",
"anki.importing.anki2.Anki2Importer.run",
"unicodedata.normalize",
"anki.utils.tmpfile"
] | [((387, 413), 'zipfile.ZipFile', 'zipfile.ZipFile', (['self.file'], {}), '(self.file)\n', (402, 413), False, 'import zipfile, os\n'), ((473, 497), 'anki.utils.tmpfile', 'tmpfile', ([], {'suffix': '""".anki2"""'}), "(suffix='.anki2')\n", (480, 497), False, 'from anki.utils import tmpfile, json\n'), ((841, 864), 'anki.im... |
import os
import shutil
from xc.logger import printInfo, printError
import plistlib
from typing import List, Tuple
def parsePlist(plist_file_path) -> dict:
obj = {}
if os.path.exists(plist_file_path):
try:
with open(plist_file_path, 'rb') as f:
obj = plistlib.load(f)
... | [
"os.path.exists",
"os.listdir",
"plistlib.load",
"xc.logger.printError",
"os.path.join",
"os.path.isdir",
"os.path.basename",
"shutil.rmtree",
"xc.logger.printInfo",
"os.path.expanduser"
] | [((178, 209), 'os.path.exists', 'os.path.exists', (['plist_file_path'], {}), '(plist_file_path)\n', (192, 209), False, 'import os\n'), ((2272, 2332), 'os.path.expanduser', 'os.path.expanduser', (['"""~/Library/Developer/Xcode/DerivedData/"""'], {}), "('~/Library/Developer/Xcode/DerivedData/')\n", (2290, 2332), False, '... |
'''
Created on 3 Oct. 2018
@author: <NAME> - Geoscience Australia
Hacky utility to cache EVERYTHING from OPeNDAP & WMS endpoints.
WARNING: This will take some time to run to completion and consume a considerable amount of bandwidth. Do NOT try this at home.
'''
import os
import sys
import tempfile
import ... | [
"logging.getLogger",
"logging.StreamHandler",
"os.makedirs",
"geophys_utils.dataset_metadata_cache.get_dataset_metadata_cache",
"logging.Formatter",
"geophys_kml_server.cache_image_file",
"tempfile.gettempdir",
"os.path.basename",
"re.sub"
] | [((584, 603), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (601, 603), False, 'import logging\n'), ((1106, 1239), 'geophys_utils.dataset_metadata_cache.get_dataset_metadata_cache', 'get_dataset_metadata_cache', ([], {'db_engine': "settings['global_settings']['database_engine']", 'debug': "settings['globa... |
import unittest
import os
import numpy as np
from platform import python_implementation
from sentinelhub import read_data, write_data, TestSentinelHub
class TestIO(TestSentinelHub):
class IOTestCase:
def __init__(self, filename, mean, shape=(2048, 2048, 3)):
self.filename = filename
... | [
"platform.python_implementation",
"numpy.mean",
"os.path.join",
"numpy.array_equal",
"unittest.main",
"sentinelhub.write_data",
"sentinelhub.read_data"
] | [((2033, 2048), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2046, 2048), False, 'import unittest\n'), ((1000, 1051), 'os.path.join', 'os.path.join', (['self.INPUT_FOLDER', 'test_case.filename'], {}), '(self.INPUT_FOLDER, test_case.filename)\n', (1012, 1051), False, 'import os\n'), ((1074, 1094), 'sentinelhub.r... |
from flask import jsonify,request ,current_app, url_for, render_template, flash
from app.view_models.trade import TradeInfo
from app.forms.book import SearchForm
from app.libs.helper import is_isbn_or_key
from app.models.shupiao_book import ShuPiaoBook
from app.view_models.book import BookViewModel,BookCollection
from ... | [
"flask.render_template",
"app.view_models.trade.TradeInfo",
"flask.flash",
"app.libs.helper.is_isbn_or_key",
"app.models.wish.Wish.query.filter_by",
"app.view_models.book.BookViewModel",
"app.view_models.book.BookCollection",
"app.models.shupiao_book.ShuPiaoBook",
"app.models.gift.Gift.query.filter_... | [((548, 572), 'app.forms.book.SearchForm', 'SearchForm', (['request.args'], {}), '(request.args)\n', (558, 572), False, 'from app.forms.book import SearchForm\n'), ((585, 601), 'app.view_models.book.BookCollection', 'BookCollection', ([], {}), '()\n', (599, 601), False, 'from app.view_models.book import BookViewModel, ... |
#!/usr/bin/env python3
from math import sqrt
import fileinput
# Write a program that computes typical stats
# Count, Min, Max, Mean, Std. Dev, Median
# No, you cannot import any other modules!
scores = []
for line in fileinput.input():
if line.startswith('#'): continue
scores.append(float(line))
mean = sum(scores... | [
"math.sqrt",
"fileinput.input"
] | [((220, 237), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (235, 237), False, 'import fileinput\n'), ((427, 436), 'math.sqrt', 'sqrt', (['val'], {}), '(val)\n', (431, 436), False, 'from math import sqrt\n')] |