code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Entry point for TwitOff Flask application."""
from web_app.app import create_app
APP = create_app() | [
"web_app.app.create_app"
] | [((91, 103), 'web_app.app.create_app', 'create_app', ([], {}), '()\n', (101, 103), False, 'from web_app.app import create_app\n')] |
import pickle
import numpy as np
import pandas as pd
from numpy import linalg as LA
from scipy import stats
import sys
def compute_rmse(target, prediction):
"""Compute rmse between the ground truth and forecasts
Args:
target: a numpy array with ground truth
forecasts: a numpy array with forecasted val... | [
"numpy.quantile",
"numpy.sum",
"numpy.median",
"numpy.zeros",
"scipy.stats.gaussian_kde",
"numpy.percentile",
"numpy.mean",
"numpy.linalg.norm",
"scipy.stats.sem",
"numpy.dot",
"numpy.concatenate",
"numpy.sqrt"
] | [((1232, 1262), 'numpy.sum', 'np.sum', (['((y_true - y_pred) ** 2)'], {}), '((y_true - y_pred) ** 2)\n', (1238, 1262), True, 'import numpy as np\n'), ((1271, 1301), 'numpy.sum', 'np.sum', (['((y_true - y_mean) ** 2)'], {}), '((y_true - y_mean) ** 2)\n', (1277, 1301), True, 'import numpy as np\n'), ((2691, 2710), 'numpy... |
"""
Description: Test the default which validates core and extensions
"""
__authors__ = "<NAME>", "<NAME>"
from stac_validator import stac_validator
def test_default_v070():
stac_file = "https://radarstac.s3.amazonaws.com/stac/catalog.json"
stac = stac_validator.StacValidate(stac_file)
stac.run()
as... | [
"stac_validator.stac_validator.StacValidate"
] | [((260, 298), 'stac_validator.stac_validator.StacValidate', 'stac_validator.StacValidate', (['stac_file'], {}), '(stac_file)\n', (287, 298), False, 'from stac_validator import stac_validator\n'), ((773, 811), 'stac_validator.stac_validator.StacValidate', 'stac_validator.StacValidate', (['stac_file'], {}), '(stac_file)\... |
from django.db import models
from core.models import BaseModel
from django.utils.translation import gettext as _
# Create your models here.
class GalleryImage(BaseModel):
name = models.CharField(_("Picture Name"), max_length=50)
picture = models.ImageField(_("Image"), upload_to="img/gallery")
def __str... | [
"django.utils.translation.gettext"
] | [((203, 220), 'django.utils.translation.gettext', '_', (['"""Picture Name"""'], {}), "('Picture Name')\n", (204, 220), True, 'from django.utils.translation import gettext as _\n'), ((269, 279), 'django.utils.translation.gettext', '_', (['"""Image"""'], {}), "('Image')\n", (270, 279), True, 'from django.utils.translatio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 11:19:57 2018
@author: rwilson
"""
import pygmsh
import meshio
import numpy as np
import pickle
class utilities():
'''A collection of functions for interacting with the mesh object
'''
def meshOjfromDisk(meshObjectPath='cly.Mesh')... | [
"pickle.dump",
"pygmsh.generate_mesh",
"meshio.write",
"pickle.load",
"numpy.array",
"pygmsh.opencascade.Geometry",
"meshio.Mesh"
] | [((2184, 2213), 'pygmsh.opencascade.Geometry', 'pygmsh.opencascade.Geometry', ([], {}), '()\n', (2211, 2213), False, 'import pygmsh\n'), ((2589, 2615), 'pygmsh.generate_mesh', 'pygmsh.generate_mesh', (['geom'], {}), '(geom)\n', (2609, 2615), False, 'import pygmsh\n'), ((3385, 3447), 'meshio.Mesh', 'meshio.Mesh', (['sel... |
"""Test function for who_likes_it module."""
import pytest
TEST_DATA = [([], "no one likes this"),
(["Peter"], "Peter likes this"),
(["Jacob", "Alex"], "Jacob and Alex like this"),
(["Max", "John", "Mark"], "Max, John and Mark like this"),
(["Alex", "Jacob", "Mark",... | [
"pytest.mark.parametrize",
"who_likes_it.likes"
] | [((2356, 2408), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""string, result"""', 'TEST_DATA'], {}), "('string, result', TEST_DATA)\n", (2379, 2408), False, 'import pytest\n'), ((2522, 2535), 'who_likes_it.likes', 'likes', (['string'], {}), '(string)\n', (2527, 2535), False, 'from who_likes_it import like... |
import itertools
from typing import List, DefaultDict, Tuple
import numpy as np
import pandas as pd
from sklearn.base import clone
from sklearn.metrics import roc_auc_score
# from sklearn.metrics import recall_score, accuracy_score, confusion_matrix
from sklearn.model_selection import KFold
from .categorical_encoders... | [
"pandas.DataFrame",
"pandas.get_dummies",
"sklearn.model_selection.KFold",
"sklearn.metrics.roc_auc_score",
"numpy.mean",
"pandas.concat",
"sklearn.base.clone"
] | [((1195, 1209), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1207, 1209), True, 'import pandas as pd\n'), ((4373, 4435), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'self.n_folds', 'shuffle': '(False)', 'random_state': 'None'}), '(n_splits=self.n_folds, shuffle=False, random_state=None)\n', (4... |
import sdi_utils.gensolution as gs
import subprocess
import io
import logging
import os
import string
import secrets
import base64
try:
api
except NameError:
class api:
queue = list()
class Message:
def __init__(self, body=None, attributes=""):
self.body = body
... | [
"io.StringIO",
"logging.basicConfig",
"secrets.choice",
"logging.StreamHandler",
"os.path.join",
"logging.getLogger"
] | [((1282, 1379), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s - %(levelname)s - %(message)s')\n", (1301, 1379), False, 'import logging\n'), ((1388, 1401), 'io.StringIO', 'io.St... |
import ast
import inspect
import textwrap
from .base import TohuBaseGenerator
from .ipython_support import get_ast_node_for_classes_defined_interactively_in_ipython
__all__ = ["Placeholder", "placeholder", "foreach"]
class Placeholder:
def __init__(self, name):
self.name = name
placeholder = Placeholde... | [
"inspect.isclass",
"ast.parse",
"inspect.getsource",
"inspect.currentframe"
] | [((482, 508), 'ast.parse', 'ast.parse', (['orig_cls_source'], {}), '(orig_cls_source)\n', (491, 508), False, 'import ast\n'), ((434, 456), 'inspect.getsource', 'inspect.getsource', (['cls'], {}), '(cls)\n', (451, 456), False, 'import inspect\n'), ((2052, 2074), 'inspect.currentframe', 'inspect.currentframe', ([], {}), ... |
# coding: utf-8
import random
from hpopt.datasets.uci.dexter import load_corpus
from ..sklearn import SklearnClassifier
def main():
X, y = load_corpus()
random.seed(0)
classifier = SklearnClassifier(popsize=100, select=20, iters=10, timeout=10, verbose=True)
classifier.fit(X, y)
if __name__ == "__... | [
"random.seed",
"hpopt.datasets.uci.dexter.load_corpus"
] | [((146, 159), 'hpopt.datasets.uci.dexter.load_corpus', 'load_corpus', ([], {}), '()\n', (157, 159), False, 'from hpopt.datasets.uci.dexter import load_corpus\n'), ((165, 179), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (176, 179), False, 'import random\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 16:12:40 2021
@author: Administrator
"""
import alphalens
import pandas as pd
import numpy as np
# import warnings
# warnings.filterwarnings('ignore')
ticker_sector = {
"ACN" : 0, "ATVI" : 0, "ADBE" : 0, "AMD" : 0, "AKAM" : 0, "ADS" : 0, "GOOGL" : 0, "GOOG" : 0... | [
"alphalens.utils.get_clean_factor_and_forward_returns"
] | [((3350, 3515), 'alphalens.utils.get_clean_factor_and_forward_returns', 'alphalens.utils.get_clean_factor_and_forward_returns', (['predictive_factor', 'pricing'], {'quantiles': '(5)', 'bins': 'None', 'groupby': 'ticker_sector', 'groupby_labels': 'sector_names'}), '(predictive_factor,\n pricing, quantiles=5, bins=Non... |
# ============LICENSE_START====================================================
# org.onap.dcae
# =============================================================================
# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
# ========================================================================... | [
"setuptools.find_packages"
] | [((1224, 1267), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests.*', 'tests']"}), "(exclude=['tests.*', 'tests'])\n", (1237, 1267), False, 'from setuptools import setup, find_packages\n')] |
import os
import shutil
import tempfile
def ensure_dir(path):
dirpath = os.path.dirname(path)
if dirpath and not os.path.exists(dirpath):
os.makedirs(dirpath)
def move_file(source, target):
ensure_dir(target)
shutil.move(source, target)
def copy_file(source, target):
if isinstance(sour... | [
"tempfile.NamedTemporaryFile",
"os.makedirs",
"os.path.dirname",
"os.path.exists",
"shutil.move",
"os.path.join",
"shutil.copy"
] | [((78, 99), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (93, 99), False, 'import os\n'), ((237, 264), 'shutil.move', 'shutil.move', (['source', 'target'], {}), '(source, target)\n', (248, 264), False, 'import shutil\n'), ((487, 514), 'shutil.copy', 'shutil.copy', (['source', 'target'], {}), '(sour... |
import rapprentice, os, os.path as osp
from rapprentice.call_and_print import call_and_print
assert osp.basename(os.getcwd()) == "test"
call_and_print("python tps_unit_tests.py")
call_and_print("python ../scripts/download_sampledata.py ~/Data --use_rsync")
call_and_print("python ../scripts/generate_h5.py ~/Data/sampled... | [
"os.getcwd",
"rapprentice.call_and_print.call_and_print"
] | [((136, 178), 'rapprentice.call_and_print.call_and_print', 'call_and_print', (['"""python tps_unit_tests.py"""'], {}), "('python tps_unit_tests.py')\n", (150, 178), False, 'from rapprentice.call_and_print import call_and_print\n'), ((179, 256), 'rapprentice.call_and_print.call_and_print', 'call_and_print', (['"""python... |
from collections import deque
def main():
N, Q = map(int, input().split())
path_dat = [list(map(int, input().split())) for _ in range(N - 1)]
queries = [list(map(int, input().split())) for _ in range(Q)]
paths = [[] for _ in range(N)]
for a, b in path_dat:
a -= 1
b -= 1
pa... | [
"collections.deque"
] | [((413, 423), 'collections.deque', 'deque', (['[0]'], {}), '([0])\n', (418, 423), False, 'from collections import deque\n')] |
#!/usr/bin/python
# Copyright 2002 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
import re
def match_re(actual, expected):
return re.match(expected, actual, re.DOTALL) != None
t = BoostBu... | [
"re.match",
"BoostBuild.Tester"
] | [((313, 346), 'BoostBuild.Tester', 'BoostBuild.Tester', ([], {'match': 'match_re'}), '(match=match_re)\n', (330, 346), False, 'import BoostBuild\n'), ((262, 299), 're.match', 're.match', (['expected', 'actual', 're.DOTALL'], {}), '(expected, actual, re.DOTALL)\n', (270, 299), False, 'import re\n')] |
import pytest
from dz4.calculator.calculator import Calculator
@pytest.fixture()
def calculator() -> Calculator:
return Calculator()
| [
"dz4.calculator.calculator.Calculator",
"pytest.fixture"
] | [((67, 83), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (81, 83), False, 'import pytest\n'), ((127, 139), 'dz4.calculator.calculator.Calculator', 'Calculator', ([], {}), '()\n', (137, 139), False, 'from dz4.calculator.calculator import Calculator\n')] |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: actions.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.prot... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor_pb2.FileOptions",
"google.protobuf.descriptor.FileDescriptor"
] | [((394, 420), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (418, 420), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((438, 931), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""actions.proto"""', 'pac... |
from typing import Optional
from psychopy import core, visual
from katona.logic import eventsmeasures
from katona.logic.datasaver import DataSaver
from katona.logic.movement import StickMover
from katona.logic import eventhandler
from katona.logic import essential
from katona.visual import optional
from katona.visual... | [
"katona.logic.eventhandler.PositiveSoundFeedback",
"katona.visual.optional.FakeButton",
"katona.logic.eventhandler.NegativeImageFeedback",
"katona.visual.grid.VisualGrid",
"katona.logic.essential.AnswerChecker",
"katona.logic.movement.StickMover",
"katona.visual.optional.ScreenCover",
"katona.logic.ev... | [((1030, 1042), 'psychopy.core.Clock', 'core.Clock', ([], {}), '()\n', (1040, 1042), False, 'from psychopy import core, visual\n'), ((1339, 1472), 'katona.visual.grid.VisualGrid', 'VisualGrid', ([], {'window': 'window', 'stick_length': 'stick_length', 'stick_width': 'stick_width', 'field_size': 'field_size', 'grid_colo... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 8 22:09:19 2017
@author: LinZhang
"""
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves impo... | [
"numpy.argmax",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.Variable",
"numpy.arange",
"tensorflow.nn.conv2d",
"tensorflow.truncated_normal",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"six.moves.range",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.placeholder"... | [((2536, 2546), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2544, 2546), True, 'import tensorflow as tf\n'), ((844, 882), 'tensorflow.truncated_normal', 'tf.truncated_normal', (['shape'], {'stddev': '(0.1)'}), '(shape, stddev=0.1)\n', (863, 882), True, 'import tensorflow as tf\n'), ((894, 914), 'tensorflow.Varia... |
import os
import subprocess
import sys
from bs4 import BeautifulSoup
class CloverCoveredLine:
def __init__(self, image_tag, filepath, filename, line_number):
self.image_tag = image_tag
self.filepath = filepath
self.filename = filename
self.line_number = line_number
def __memb... | [
"os.path.isdir",
"subprocess.Popen",
"os.path.exists",
"sys.exit"
] | [((3409, 3498), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE', 'shell': '(True)'}), '(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n shell=True)\n', (3425, 3498), False, 'import subprocess\n'), ((5010, 5021), 'sys.exit', 'sys.exit', (['(1)... |
import os
import random
from contextlib import contextmanager
from typing import Generator
import numpy as np
import tensorflow as tf
from tensorflow.python.eager import context
from tensorflow.python.framework import config, ops
DIGITS = frozenset(str(i) for i in range(10))
@contextmanager
def tensorflow_random... | [
"tensorflow.random.set_seed",
"tensorflow.python.framework.config.is_op_determinism_enabled",
"numpy.random.seed",
"numpy.random.get_state",
"tensorflow.python.framework.config.enable_op_determinism",
"tensorflow.python.eager.context.global_seed",
"tensorflow.python.framework.ops.get_default_graph",
"... | [((409, 453), 'os.environ.get', 'os.environ.get', (['"""TF_DETERMINISTIC_OPS"""', 'None'], {}), "('TF_DETERMINISTIC_OPS', None)\n", (423, 453), False, 'import os\n'), ((478, 495), 'random.getstate', 'random.getstate', ([], {}), '()\n', (493, 495), False, 'import random\n'), ((523, 544), 'numpy.random.get_state', 'np.ra... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import operator
import os
import json
import math
def parseargs():
msg = "Merge translation options"
usage = "m... | [
"argparse.ArgumentParser"
] | [((384, 437), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'msg', 'usage': 'usage'}), '(description=msg, usage=usage)\n', (407, 437), False, 'import argparse\n')] |
import threading
from os import path
from os.path import dirname
from typing import Optional
from sleuthdeck.deck import Deck
from sleuthdeck.deck import Key
from sleuthdeck.plugins.sleuth import Sleuth
class RepositoryLockKey(Key):
def __init__(self, sleuth: Sleuth, project: str, deployment: Optional[str] = Non... | [
"threading.Thread",
"os.path.dirname"
] | [((471, 508), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._update'}), '(target=self._update)\n', (487, 508), False, 'import threading\n'), ((571, 588), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (578, 588), False, 'from os.path import dirname\n')] |
# -*- coding: utf-8 -*-
from csv import reader, writer
from pathlib import Path
from random import sample
from typing import Any, List
import requests as requests
from resources.constants import BROWSER_USER_AGENT
def handle_request(url: str) -> Any:
headers = {'User-Agent': BROWSER_USER_AGENT, 'Upgrade-Insecu... | [
"csv.reader",
"csv.writer",
"random.sample",
"pathlib.Path",
"requests.get"
] | [((2009, 2076), 'pathlib.Path', 'Path', (['path_cache_folder', 'f"""{treebank_set_size}-{sampling_size}.csv"""'], {}), "(path_cache_folder, f'{treebank_set_size}-{sampling_size}.csv')\n", (2013, 2076), False, 'from pathlib import Path\n'), ((3574, 3641), 'pathlib.Path', 'Path', (['path_cache_folder', 'f"""{treebank_set... |
import logging
def get_logger(module_name: str):
suffix = ""
if module_name != "__main__":
suffix = "." + module_name
# logger = logging.getLogger("serving.model-server" + suffix)
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
logger.setLevel("INFO")
return... | [
"logging.getLogger",
"logging.basicConfig"
] | [((207, 247), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (226, 247), False, 'import logging\n'), ((261, 280), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (278, 280), False, 'import logging\n')] |
#!/usr/bin/env python3
from typing import Sequence, Union
import pdb
import torch
from ignite.exceptions import NotComputableError
from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce
class ForwardLoss(Metric):
r"""Loss metric that simply records the loss calculated
in forward pass
... | [
"ignite.exceptions.NotComputableError",
"torch.sum",
"torch.tensor",
"ignite.metrics.metric.sync_all_reduce"
] | [((688, 746), 'ignite.metrics.metric.sync_all_reduce', 'sync_all_reduce', (['"""_sum_of_squared_errors"""', '"""_num_examples"""'], {}), "('_sum_of_squared_errors', '_num_examples')\n", (703, 746), False, 'from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce\n'), ((419, 457), 'torch.tensor', 't... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class AMSoftmaxClsHead(ClsHead):
"""AMSoftmax classifier head.
Args:
num_classes (int): Number of categories excludin... | [
"torch.ger",
"torch.zeros_like",
"torch.norm",
"torch.nn.init.xavier_uniform_",
"torch.mm",
"torch.randn",
"torch.nn.functional.softmax",
"torch.onnx.is_in_onnx_export"
] | [((1405, 1423), 'torch.mm', 'torch.mm', (['x1', 'x2.T'], {}), '(x1, x2.T)\n', (1413, 1423), False, 'import torch\n'), ((1437, 1459), 'torch.norm', 'torch.norm', (['x1', '(2)', 'dim'], {}), '(x1, 2, dim)\n', (1447, 1459), False, 'import torch\n'), ((1473, 1495), 'torch.norm', 'torch.norm', (['x2', '(2)', 'dim'], {}), '(... |
#######
#
# classify_images.py
#
# This is a test driver for running our species classifiers and detectors.
# The script classifies one or more hard-coded image files.
#
# Because the inference code has not been assembled into a formal package yet,
# you should define API_ROOT to point to the base of our repo. This
# ... | [
"api.DetectionClassificationAPI",
"pandas.read_csv",
"sys.path.insert",
"os.path.isfile",
"os.path.splitext",
"os.path.join"
] | [((4215, 4256), 'os.path.isfile', 'os.path.isfile', (['CLASSIFICATION_MODEL_PATH'], {}), '(CLASSIFICATION_MODEL_PATH)\n', (4229, 4256), False, 'import os\n'), ((4370, 4482), 'api.DetectionClassificationAPI', 'speciesapi.DetectionClassificationAPI', (['CLASSIFICATION_MODEL_PATH', 'DETECTION_MODEL_PATH', 'IMAGE_SIZES', '... |
#!/usr/bin/env python3.5
# coding=utf-8
'''
@date = '17/12/1'
@author = 'lynnchan'
@email = '<EMAIL>'
'''
import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET
from gconfig import *
train_path = Train_Data_Path
test_path = Test_Data_Path
def xml_to_csv(path):
xml_list =... | [
"pandas.DataFrame",
"xml.etree.ElementTree.parse",
"glob.glob"
] | [((345, 371), 'glob.glob', 'glob.glob', (["(path + '/*.xml')"], {}), "(path + '/*.xml')\n", (354, 371), False, 'import glob\n'), ((1607, 1650), 'pandas.DataFrame', 'pd.DataFrame', (['xml_list'], {'columns': 'column_name'}), '(xml_list, columns=column_name)\n', (1619, 1650), True, 'import pandas as pd\n'), ((389, 407), ... |
import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
from .ops import *
class DCGANGenerator(chainer.Chain):
def __init__(self, latent=128,... | [
"chainer.initializers.Normal",
"chainer.functions.reshape"
] | [((1230, 1283), 'chainer.functions.reshape', 'F.reshape', (['h', '(h.data.shape[0], self.base_size, 4, 4)'], {}), '(h, (h.data.shape[0], self.base_size, 4, 4))\n', (1239, 1283), True, 'import chainer.functions as F\n'), ((578, 611), 'chainer.initializers.Normal', 'chainer.initializers.Normal', (['(0.02)'], {}), '(0.02)... |
import csv
from pathlib import Path
folder = 'recent_changes'
all_csv = [pth for pth in Path(folder).iterdir()
if pth.suffix == '.csv']
header = None
rows = []
for f_csv in all_csv:
with open(f_csv) as csvfile:
reader = csv.reader(csvfile)
header = next(reader) # read header
... | [
"pathlib.Path",
"csv.reader",
"csv.writer"
] | [((403, 422), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (413, 422), False, 'import csv\n'), ((248, 267), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (258, 267), False, 'import csv\n'), ((90, 102), 'pathlib.Path', 'Path', (['folder'], {}), '(folder)\n', (94, 102), False, 'from pathl... |
#############################################
# global imports
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import unquote
import sys
import os
import json
#############################################
#############################################
# local imports
from serverutils import... | [
"urllib.parse.unquote",
"http.server.HTTPServer",
"json.loads",
"serverutils.utils.postjson",
"os.path.join",
"serverutils.process.PopenProcess"
] | [((502, 559), 'os.path.join', 'os.path.join', (['"""engines"""', "os.environ['SIMPLE_ENGINE_NAME']"], {}), "('engines', os.environ['SIMPLE_ENGINE_NAME'])\n", (514, 559), False, 'import os\n'), ((3080, 3137), 'http.server.HTTPServer', 'HTTPServer', (['server_address', 'testHTTPServer_RequestHandler'], {}), '(server_addr... |
"""
Search using NASA CMR
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import json
import logging
import requests
import numpy as np
_logger = logging.getLogger(__name__)
from podpac.core.utils import _get_from_url
CMR_URL = r"https://cmr.earthdata.nasa.gov/search/"
def ... | [
"numpy.any",
"podpac.core.utils._get_from_url",
"logging.getLogger"
] | [((188, 215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'import logging\n'), ((3485, 3632), 'numpy.any', 'np.any', (["[(m not in kwargs) for m in ['provider', 'provider_id', 'concept_id',\n 'collection_concept_id', 'short_name', 'version', 'entry_title']]"], {})... |
import requests
from bs4 import BeautifulSoup
url = input()
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
print(soup.find("h1").text)
| [
"bs4.BeautifulSoup",
"requests.get"
] | [((67, 84), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (79, 84), False, 'import requests\n'), ((92, 131), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n", (105, 131), False, 'from bs4 import BeautifulSoup\n')] |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, January 2017
import os
import numpy as np
import pandas as pd
import scipy.io as sio
import util... | [
"pandas.DataFrame",
"scipy.io.loadmat",
"numpy.hstack",
"utils.datasets.load_data_from_pickle",
"os.path.split"
] | [((717, 759), 'utils.datasets.load_data_from_pickle', 'utils.load_data_from_pickle', (['__pickle_path'], {}), '(__pickle_path)\n', (744, 759), True, 'import utils.datasets as utils\n'), ((1102, 1126), 'scipy.io.loadmat', 'sio.loadmat', (['__data_path'], {}), '(__data_path)\n', (1113, 1126), True, 'import scipy.io as si... |
import pygame
import flappy
from thread import callback
import speech_recognition as sr
import sys
if __name__ == '__main__':
if len(sys.argv) == 3 and sys.argv[2] == "False":
r = sr.Recognizer()
m = sr.Microphone()
with m as source:
r.adjust_for_ambient_noise(source) # we only... | [
"pygame.init",
"speech_recognition.Microphone",
"flappy.play_game",
"pygame.display.set_caption",
"speech_recognition.Recognizer"
] | [((545, 558), 'pygame.init', 'pygame.init', ([], {}), '()\n', (556, 558), False, 'import pygame\n'), ((584, 649), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Flappy Birds For Handicapped People"""'], {}), "('Flappy Birds For Handicapped People')\n", (610, 649), False, 'import pygame\n'), ((654, 67... |
'''
This example will print the gesture name
'''
from communitysdk import list_connected_devices, MotionSensorKit
devices = list_connected_devices()
msk_filter = filter(lambda device: isinstance(device, MotionSensorKit), devices)
msk = next(msk_filter, None) # Get first Motion Sensor Kit
if msk == None:
print('No M... | [
"communitysdk.list_connected_devices"
] | [((126, 150), 'communitysdk.list_connected_devices', 'list_connected_devices', ([], {}), '()\n', (148, 150), False, 'from communitysdk import list_connected_devices, MotionSensorKit\n')] |
# encoding: utf-8
from zope.interface import implements
from zope.schema.vocabulary import SimpleVocabulary
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from plone.memoize.instance import memoize
class TestingVocabulary(object):
implements(IVocabularyFactor... | [
"zope.schema.vocabulary.SimpleVocabulary",
"zope.schema.vocabulary.SimpleTerm",
"zope.interface.implements"
] | [((292, 322), 'zope.interface.implements', 'implements', (['IVocabularyFactory'], {}), '(IVocabularyFactory)\n', (302, 322), False, 'from zope.interface import implements\n'), ((807, 837), 'zope.interface.implements', 'implements', (['IVocabularyFactory'], {}), '(IVocabularyFactory)\n', (817, 837), False, 'from zope.in... |
#!/usr/bin/env python3
import numpy as np
import pickle
from PIL import Image
w = pickle.load(open("weights1000.pkl", "rb"))
def Classify(example):
return w.dot(example)
#Seems to get 2, 3, 4 correct...
for i in range(0, 5):
image = Image.open("test_images/{}.jpg".format(i)).convert("L")
x = np.asarray(i... | [
"numpy.argmax"
] | [((464, 476), 'numpy.argmax', 'np.argmax', (['y'], {}), '(y)\n', (473, 476), True, 'import numpy as np\n')] |
import unittest
from awacs import s3, ec2, iam
from awacs.aws import PolicyDocument, Statement, Action, Condition
from awacs.aws import StringEquals, StringLike
class TestEquality(unittest.TestCase):
def test_condition_equality(self):
self.assertEqualWithHash(
Condition(StringLike("s3:prefix"... | [
"awacs.s3.ARN",
"awacs.aws.StringEquals",
"awacs.aws.Action",
"awacs.aws.StringLike",
"awacs.ec2.ARN",
"awacs.iam.ARN"
] | [((891, 909), 'awacs.s3.ARN', 's3.ARN', (['"""myBucket"""'], {}), "('myBucket')\n", (897, 909), False, 'from awacs import s3, ec2, iam\n'), ((911, 929), 'awacs.s3.ARN', 's3.ARN', (['"""myBucket"""'], {}), "('myBucket')\n", (917, 929), False, 'from awacs import s3, ec2, iam\n'), ((981, 999), 'awacs.s3.ARN', 's3.ARN', ([... |
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... | [
"json.loads",
"javcra.libs.log.logger.error",
"javcra.libs.log.logger.warning",
"datetime.date.today",
"datetime.timedelta",
"requests.get",
"javcra.libs.log.logger.info",
"requests.post",
"retrying.retry",
"datetime.datetime.now",
"re.compile"
] | [((12740, 12806), 're.compile', 're.compile', (['"""openEuler评分.*?(?P<euler_score>[0-9\\\\.]+)"""'], {'flags': 're.S'}), "('openEuler评分.*?(?P<euler_score>[0-9\\\\.]+)', flags=re.S)\n", (12750, 12806), False, 'import re\n'), ((13509, 13566), 're.compile', 're.compile', (['"""修复是否涉及abi变化.*?(?P<abi>.*)[\\\\n$]"""'], {'fla... |
# -*- coding: utf-8 -*-
#
# Tests for ``sim.py``
# These tests were hand calculated by <NAME>: <EMAIL>
#
from clusim.clustering import Clustering
import clusim.sim as sim
from clusim.dag import DAG
import clusim.clusimelement as clusimelement
from numpy.testing import assert_approx_equal
from numpy import mean
def ... | [
"clusim.sim.expected_mi",
"clusim.sim.expected_rand_index",
"clusim.clusimelement.element_sim_elscore",
"clusim.dag.DAG",
"clusim.clustering.Clustering",
"numpy.testing.assert_approx_equal",
"clusim.sim.count_pairwise_cooccurence"
] | [((499, 539), 'clusim.clustering.Clustering', 'Clustering', ([], {'elm2clu_dict': 'c1_elm2clu_dict'}), '(elm2clu_dict=c1_elm2clu_dict)\n', (509, 539), False, 'from clusim.clustering import Clustering\n'), ((549, 589), 'clusim.clustering.Clustering', 'Clustering', ([], {'elm2clu_dict': 'c2_elm2clu_dict'}), '(elm2clu_dic... |
from HystrixBox.Tools.recursiveDecompression import extract_recursive
import filecmp
import os
TEST1 = '''File not found\n'''
TEST2 = '''Not a zip file or corrupted zip file\n'''
def compareDir(dir1, dir2):
"""
Compare two directory trees content.
Return False if they differ, True is they are the... | [
"HystrixBox.Tools.recursiveDecompression.extract_recursive",
"os.path.join",
"filecmp.dircmp"
] | [((354, 380), 'filecmp.dircmp', 'filecmp.dircmp', (['dir1', 'dir2'], {}), '(dir1, dir2)\n', (368, 380), False, 'import filecmp\n'), ((750, 805), 'HystrixBox.Tools.recursiveDecompression.extract_recursive', 'extract_recursive', (['"""../examples/recursivezip.zip"""', 'path'], {}), "('../examples/recursivezip.zip', path)... |
"""Generate files to declare fortran functions"""
import os
import re
import logging
import importlib
from docutils.statemachine import string2lines
from sphinx.util.docutils import SphinxDirective
path_pat_mod_dir = os.path.join("{gendir}", "{mod_name}")
path_pat_mod_file = os.path.join(path_pat_mod_dir, "index.rs... | [
"docutils.statemachine.string2lines",
"os.makedirs",
"importlib.import_module",
"logging.warning",
"os.path.dirname",
"os.path.exists",
"re.match",
"logging.info",
"os.path.join",
"re.compile"
] | [((221, 259), 'os.path.join', 'os.path.join', (['"""{gendir}"""', '"""{mod_name}"""'], {}), "('{gendir}', '{mod_name}')\n", (233, 259), False, 'import os\n'), ((280, 323), 'os.path.join', 'os.path.join', (['path_pat_mod_dir', '"""index.rst"""'], {}), "(path_pat_mod_dir, 'index.rst')\n", (292, 323), False, 'import os\n'... |
# -*- coding: utf-8 -*-
"""
co2usa_load_netCDF: Load the CO2-USA Data Synthesis files from netCDF
USAGE:
The CO2-USA synthesis data is available to download from the ORNL DAAC:
https://doi.org/10.3334/ORNLDAAC/1743
To download the data, first sign into your account (or create one if you don't have one).
Next, click... | [
"matplotlib.pyplot.title",
"netCDF4.Dataset",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"os.getcwd",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"pandas.to_datetime",
"glob.glob",
"matplotlib.pyplot.grid"
] | [((1463, 1474), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1472, 1474), False, 'import os\n'), ((1669, 1723), 'glob.glob', 'glob.glob', (["(read_folder + city + '_' + species + '*.nc')"], {}), "(read_folder + city + '_' + species + '*.nc')\n", (1678, 1723), False, 'import glob\n'), ((3131, 3144), 'matplotlib.pyplot.f... |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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
#
# Unles... | [
"tempest.common.tempest_fixtures.LockFixture",
"tempest.test.is_extension_enabled",
"tempest.test.idempotent_id"
] | [((3813, 3871), 'tempest.test.idempotent_id', 'test.idempotent_id', (['"""df259771-7104-4ffa-b77f-bd183600d7f9"""'], {}), "('df259771-7104-4ffa-b77f-bd183600d7f9')\n", (3831, 3871), False, 'from tempest import test\n'), ((4301, 4359), 'tempest.test.idempotent_id', 'test.idempotent_id', (['"""81d9dc45-19f8-4c6e-88b8-401... |
from PIL import Image, ImageDraw, ImageFont
class ImageAnnotator(object):
def __init__(self,
img_path: str,
font: str = None,
font_size: int = 5):
assert isinstance(img_path, str)
self._img = Image.open(img_path).convert('RGBA')
self._img... | [
"PIL.ImageDraw.Draw",
"PIL.ImageFont.truetype",
"PIL.Image.open"
] | [((328, 353), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['self._img'], {}), '(self._img)\n', (342, 353), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((490, 525), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['font', 'font_size'], {}), '(font, font_size)\n', (508, 525), False, 'from PIL import Image, Ima... |
import pytest
def test_fx_cycle(argv, GPIO):
"""Test that set_sequence supports the output of a PlasmaFX Sequence"""
from plasma import auto
from plasma.apa102 import PlasmaAPA102
from plasmafx import Sequence
from plasmafx.plugins import FXCycle
sequence = Sequence(10)
sequence.set_plugi... | [
"plasmafx.Sequence",
"plasmafx.plugins.FXCycle",
"plasma.auto"
] | [((285, 297), 'plasmafx.Sequence', 'Sequence', (['(10)'], {}), '(10)\n', (293, 297), False, 'from plasmafx import Sequence\n'), ((350, 385), 'plasma.auto', 'auto', (['"""APA102:14:15:pixel_count=10"""'], {}), "('APA102:14:15:pixel_count=10')\n", (354, 385), False, 'from plasma import auto\n'), ((325, 334), 'plasmafx.pl... |
from rest_framework import serializers
from meeting.models import Meeting
class BaseSerializer(serializers.Serializer):
def create(self, validated_data):
pass
def update(self, instance, validated_data):
pass
class NewMeetingIn(BaseSerializer):
name = serializers.CharField(max_length=12... | [
"rest_framework.serializers.ChoiceField",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.BooleanField",
"rest_framework.serializers.DateTimeField"
] | [((285, 322), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (306, 322), False, 'from rest_framework import serializers\n'), ((338, 365), 'rest_framework.serializers.DateTimeField', 'serializers.DateTimeField', ([], {}), '()\n', (363, 365), False, '... |
import string
import random
import hashlib
import os
# import requests
import urllib
from typing import Union
import time
def steady_download_and_compute_hash(url: str, algorithm: str, target_path: str) -> str:
remote = urllib.request.urlopen(url)
str0 = ''.join(random.sample(string.ascii_lowercase, 8))
pa... | [
"os.remove",
"random.sample",
"os.rename",
"os.path.exists",
"urllib.request.urlopen"
] | [((225, 252), 'urllib.request.urlopen', 'urllib.request.urlopen', (['url'], {}), '(url)\n', (247, 252), False, 'import urllib\n'), ((600, 632), 'os.rename', 'os.rename', (['path_tmp', 'target_path'], {}), '(path_tmp, target_path)\n', (609, 632), False, 'import os\n'), ((272, 312), 'random.sample', 'random.sample', (['s... |
import sys
sys.path.insert(0, r'C:\Users\Brooks\github\splitr')# access library code from outside /models
# library functions:
import torch
import time
import pandas as pd
# Splitr modules:
import model_utils
# this is really a constructor for a bidirectional LSTM but i figured
# BD_LSTM was only 2 letters off of B... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.LogSoftmax",
"torch.nn.Tanh",
"torch.nn.Conv2d",
"sys.path.insert",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.LeakyReLU",
"torch.nn.LSTM"
] | [((11, 66), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\Brooks\\\\github\\\\splitr"""'], {}), "(0, 'C:\\\\Users\\\\Brooks\\\\github\\\\splitr')\n", (26, 66), False, 'import sys\n'), ((577, 687), 'torch.nn.LSTM', 'torch.nn.LSTM', (['num_inputs', 'num_hidden_layers'], {'num_layers': 'layer_count', '... |
# Modified from SUTD and https://github.com/bentrevett/pytorch-sentiment-analysis
# Sentiment Analysis on IMDB with FashionMNIST
# We're using packed sequences for training
# For more info: https://stackoverflow.com/questions/51030782/why-do-we-pack-the-sequences-in-pytorch
import torch.nn as nn
import torchtext
impo... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.no_grad",
"torch.load",
"spacy.load",
"random.seed",
"torch.nn.Linear",
"torch.zeros",
"torchtext.legacy.datasets.IMDB.splits",
"torch.nn.LSTM",
"torch.nn.BCEWithLogitsLoss",
"torchtext.... | [((4070, 4093), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (4087, 4093), False, 'import torch\n'), ((4289, 4339), 'torchtext.legacy.data.Field', 'data.Field', ([], {'tokenize': '"""spacy"""', 'include_lengths': '(True)'}), "(tokenize='spacy', include_lengths=True)\n", (4299, 4339), False, 'fr... |
##################################################
## Notify VMDK export request
##################################################
import os
import boto3
from botocore.exceptions import ClientError
import json
import logging
def lambda_handler(event, context):
# set logging
logger = logging.getLogger()
l... | [
"json.dumps",
"logging.getLogger",
"boto3.client"
] | [((295, 314), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (312, 314), False, 'import logging\n'), ((623, 652), 'boto3.client', 'boto3.client', (['"""stepfunctions"""'], {}), "('stepfunctions')\n", (635, 652), False, 'import boto3\n'), ((398, 425), 'json.dumps', 'json.dumps', (['event'], {'indent': '(2)'... |
from lensesio.core.endpoints import getEndpoints
from lensesio.core.exec_action import exec_request
class Policy:
def __init__(self, verify_cert=True):
getEndpoints.__init__(self, "policyEndpoints")
self.verify_cert=verify_cert
self.lenses_policies_endpoint = self.url + self.lensesPolicie... | [
"lensesio.core.exec_action.exec_request",
"lensesio.core.endpoints.getEndpoints.__init__"
] | [((166, 212), 'lensesio.core.endpoints.getEndpoints.__init__', 'getEndpoints.__init__', (['self', '"""policyEndpoints"""'], {}), "(self, 'policyEndpoints')\n", (187, 212), False, 'from lensesio.core.endpoints import getEndpoints\n'), ((564, 716), 'lensesio.core.exec_action.exec_request', 'exec_request', ([], {'__METHOD... |
from setuptools import find_packages, setup
with open("README.md") as readme_file:
readme = readme_file.read()
with open("requirements.txt") as reqs_file:
requirements = reqs_file.read().split("\n")
setup(
name="braincode",
version="0.1.0",
description="an investigation of computer program repres... | [
"setuptools.find_packages"
] | [((458, 490), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""braincode"""'}), "(where='braincode')\n", (471, 490), False, 'from setuptools import find_packages, setup\n')] |
# Data Worker
# %%
import os
import pandas as pd
import plotly.express as px
from pypinyin import lazy_pinyin
locations_url = 'https://blog.csdn.net/envbox/article/details/80290103'
filename = 'locations.json'
sync_folder = os.environ.get('Sync', '.')
mapbox = dict(
mapbox_accesstoken=open(os.path.joi... | [
"pandas.read_html",
"pandas.DataFrame",
"pypinyin.lazy_pinyin",
"plotly.express.scatter_mapbox",
"os.environ.get",
"os.path.join",
"pandas.concat"
] | [((236, 263), 'os.environ.get', 'os.environ.get', (['"""Sync"""', '"""."""'], {}), "('Sync', '.')\n", (250, 263), False, 'import os\n'), ((456, 483), 'pandas.read_html', 'pd.read_html', (['locations_url'], {}), '(locations_url)\n', (468, 483), True, 'import pandas as pd\n'), ((1711, 1766), 'pandas.concat', 'pd.concat',... |
from ismain import is_main
if is_main():
print("Hello from main.")
| [
"ismain.is_main"
] | [((31, 40), 'ismain.is_main', 'is_main', ([], {}), '()\n', (38, 40), False, 'from ismain import is_main\n')] |
import numpy as np
import scipy as sp
import scipy.spatial
import matplotlib as mpl
import matplotlib.path
from ..kernels.high_level.cauchy import Cauchy_Layer_Apply
from ..point_set import PointSet
def find_interior_points(source, target, boundary_acceptable=False):
"""
quick finding of which points in targe... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.logical_not",
"numpy.zeros",
"numpy.logical_and.reduce",
"numpy.isnan",
"numpy.isinf",
"numpy.ones",
"numpy.logical_or",
"numpy.column_stack"
] | [((530, 626), 'numpy.logical_and.reduce', 'np.logical_and.reduce', (['[target.x > xmin, target.x < xmax, target.y > ymin, target.y < ymax]'], {}), '([target.x > xmin, target.x < xmax, target.y > ymin, \n target.y < ymax])\n', (551, 626), True, 'import numpy as np\n'), ((692, 723), 'numpy.logical_not', 'np.logical_no... |
# !usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
from __future__ import print_function, division, absolute_import
import flask
import jinja2
jinjablue = flask.Blueprint('jinja_filters', __name__)
@jinja2.contextfilter
@jinjablue.app_template_filter()
def split(context, val... | [
"flask.Blueprint"
] | [((198, 240), 'flask.Blueprint', 'flask.Blueprint', (['"""jinja_filters"""', '__name__'], {}), "('jinja_filters', __name__)\n", (213, 240), False, 'import flask\n')] |
# Copyright 2021 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"utils.get_resnet_layer.get_resnet_depth_from_name",
"tensorflow.keras.optimizers.SGD",
"tensorflow.keras.optimizers.Adam",
"tensorflow.python.keras.utils.multi_gpu_utils.multi_gpu_model",
"utils.dataset.Dataset",
"os.path.join"
] | [((2412, 2540), 'os.path.join', 'os.path.join', (["self.config['saved_model_dir']", 'f"""{self.model_name}"""', 'f"""{self.model_name}_{self.data_name}_{\'{epoch:03d}\'}.h5"""'], {}), '(self.config[\'saved_model_dir\'], f\'{self.model_name}\',\n f"{self.model_name}_{self.data_name}_{\'{epoch:03d}\'}.h5")\n', (2424, ... |
import re
from logging import Logger
from typing import Dict
import yaml
OptionValue = int or float or bool or str
class BasePreprocessor():
'''Base preprocessor. All preprocessors must inherit from this one.'''
# pylint: disable=too-many-instance-attributes
defaults = {}
tags = ()
@staticmetho... | [
"re.compile"
] | [((662, 762), 're.compile', 're.compile', (['"""(?P<key>[A-Za-z_:][0-9A-Za-z_:\\\\-\\\\.]*)=(\\\\\'|")(?P<value>.+?)\\\\2"""'], {'flags': 're.DOTALL'}), '(\'(?P<key>[A-Za-z_:][0-9A-Za-z_:\\\\-\\\\.]*)=(\\\\\\\'|")(?P<value>.+?)\\\\2\',\n flags=re.DOTALL)\n', (672, 762), False, 'import re\n')] |
from .db import db
from sqlalchemy.sql import func
class Comment(db.Model):
__tablename__ = "comments"
id = db.Column(db.Integer, nullable=False, primary_key=True)
commentBody = db.Column(db.String(255), nullable=False)
createdAt = db.Column(db.DateTime(timezone=True), nullable=False, server_default=... | [
"sqlalchemy.sql.func.now"
] | [((320, 330), 'sqlalchemy.sql.func.now', 'func.now', ([], {}), '()\n', (328, 330), False, 'from sqlalchemy.sql import func\n')] |
import json
import unittest
from jsonschema import validate, ValidationError
from views import app
import os
import urllib.parse
from urllib.parse import urlencode
def testget(url):
client = app.test_client()
client.testing = True
return json.loads(client.get(url).get_data(as_text=True))
class Response... | [
"jsonschema.validate",
"views.app.test_client",
"urllib.parse.urlencode"
] | [((199, 216), 'views.app.test_client', 'app.test_client', ([], {}), '()\n', (214, 216), False, 'from views import app\n'), ((391, 408), 'views.app.test_client', 'app.test_client', ([], {}), '()\n', (406, 408), False, 'from views import app\n'), ((612, 633), 'jsonschema.validate', 'validate', (['obj', 'schema'], {}), '(... |
import subprocess
FILE = "/opt/protostar/bin/format1"
#9 bytes
ADDRESS = "BBBB\x38\x96\x04\x08B"
def craft_payload(string):
string += ADDRESS
string += "%130$n"
return string
def main():
payload = craft_payload("", NUM_POINTERS)
subprocess.call([FILE, payload])
if __name... | [
"subprocess.call"
] | [((276, 308), 'subprocess.call', 'subprocess.call', (['[FILE, payload]'], {}), '([FILE, payload])\n', (291, 308), False, 'import subprocess\n')] |
# coding: iso-8859-1 -*-
import random
from time import sleep
jogar ='sim'
print("_________________________")
print("!!Bem-vindo ao Jokenpo!!")
print("_________________________")
resultado = ['Vitória do CPU!', 'Houve um empate!', 'O usuário venceu!']
jogadas = ['pedra', 'papel', 'tesoura']
pontos_user = 0
... | [
"random.choice",
"time.sleep"
] | [((588, 610), 'random.choice', 'random.choice', (['jogadas'], {}), '(jogadas)\n', (601, 610), False, 'import random\n'), ((616, 624), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (621, 624), False, 'from time import sleep\n'), ((665, 673), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (670, 673), False, 'from time i... |
import os
# in a real project, this script probably wouldn't make so many assumptions
# about the inputs and outputs
NG_DIST_DIR_PATH = '/ng-notebook/angular/dist/'
OUTFILE_PATH = '/hostmount/output/index.html'
# ng build's index.html will be a small, single-line file
with open(os.path.join(NG_DIST_DIR_PATH, 'index.h... | [
"os.path.join"
] | [((281, 325), 'os.path.join', 'os.path.join', (['NG_DIST_DIR_PATH', '"""index.html"""'], {}), "(NG_DIST_DIR_PATH, 'index.html')\n", (293, 325), False, 'import os\n'), ((708, 759), 'os.path.join', 'os.path.join', (['NG_DIST_DIR_PATH', '"""styles.bundle.css"""'], {}), "(NG_DIST_DIR_PATH, 'styles.bundle.css')\n", (720, 75... |
import string
from typing import List
from envinorma.models import ArreteMinisteriel, StructuredText
from text_diff import TextDifferences, text_differences
from unidecode import unidecode
_SIMPLE_CHARS = set(string.ascii_letters + string.digits + string.whitespace)
def _clean_line(line: str) -> str:
res = str(... | [
"unidecode.unidecode",
"text_diff.text_differences"
] | [((915, 958), 'text_diff.text_differences', 'text_differences', (['lines_before', 'lines_after'], {}), '(lines_before, lines_after)\n', (931, 958), False, 'from text_diff import TextDifferences, text_differences\n'), ((1157, 1200), 'text_diff.text_differences', 'text_differences', (['lines_before', 'lines_after'], {}),... |
from clawpack import pyclaw
from clawpack.pyclaw.solution import Solution
class Solution(Solution):
""" Parallel Solution class.
"""
__doc__ += pyclaw.util.add_parent_doc(pyclaw.Solution)
def get_read_func(self, file_format):
from clawpack.petclaw import io
if file_format == 'petsc':
... | [
"clawpack.pyclaw.util.add_parent_doc"
] | [((157, 200), 'clawpack.pyclaw.util.add_parent_doc', 'pyclaw.util.add_parent_doc', (['pyclaw.Solution'], {}), '(pyclaw.Solution)\n', (183, 200), False, 'from clawpack import pyclaw\n')] |
import re
from dataclasses import dataclass
from datetime import date, datetime
from typing import Iterator
import requests
from bs4 import BeautifulSoup
@dataclass
class Counters:
tests: int
positive: int
recoveries: int
deaths: int
vaccines: int
@dataclass
class CaseImage:
url: str
da... | [
"datetime.datetime.strptime",
"requests.Session",
"re.search"
] | [((405, 423), 'requests.Session', 'requests.Session', ([], {}), '()\n', (421, 423), False, 'import requests\n'), ((2434, 2464), 're.search', 're.search', (['""".*\\\\((.*)\\\\).*"""', 'd'], {}), "('.*\\\\((.*)\\\\).*', d)\n", (2443, 2464), False, 'import re\n'), ((2488, 2523), 'datetime.datetime.strptime', 'datetime.st... |
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
# Module for building transfer learning framework #
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #
import tensorflow as tf
import tensorflow.keras.layers as kl
import tensorflow.keras.regularizers as kreg
import tensorflow.keras.initializers as kini
def bu... | [
"tensorflow.keras.regularizers.l2",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.ELU",
"tensorflow.keras.layers.GlobalAvgPool2D",
"tensorflow.keras.layers.PReLU",
"t... | [((822, 859), 'tensorflow.keras.layers.Input', 'kl.Input', ([], {'shape': '(img_dim, img_dim, 3)'}), '(shape=(img_dim, img_dim, 3))\n', (830, 859), True, 'import tensorflow.keras.layers as kl\n'), ((3180, 3228), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'all_inputs', 'outputs': 'out_y'}), '(inputs=all... |
import os.path as osp
import os
import time
from collections import defaultdict
import numpy as np
import tensorflow as tf
import moviepy.editor as mpy
import tqdm
from contextlib import contextmanager
from mpi4py import MPI
import imageio
from baselines import logger
import baselines.common.tf_util as U
from baselin... | [
"baselines.common.mpi_adam.MpiAdam",
"baselines.common.tf_util.get_session",
"baselines.common.tf_util.initialize",
"collections.defaultdict",
"tensorflow.assign",
"tensorflow.Variable",
"numpy.mean",
"numpy.linalg.norm",
"os.path.join",
"imageio.mimsave",
"baselines.common.tf_util.function",
... | [((847, 914), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'name': '"""global_step"""', 'dtype': 'tf.int64', 'trainable': '(False)'}), "(0, name='global_step', dtype=tf.int64, trainable=False)\n", (858, 914), True, 'import tensorflow as tf\n'), ((950, 999), 'tensorflow.assign', 'tf.assign', (['self.global_step', '(... |
# GUI Tkinter grid file.
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from PIL import Image, ImageTk # pip install pillow (<- in terminal if not already installed)
import tkinter as tk
import csv
# OTHER PYTHON FILES (OURS)
import menuFunctions
import openData
# import moreFunctions
i... | [
"tkinter.StringVar",
"tkinter.LabelFrame",
"csv.reader",
"tkinter.Menu",
"tkinter.Button",
"openData.getFilePath",
"tkinter.Scrollbar",
"tkinter.OptionMenu",
"tkinter.filedialog.asksaveasfile",
"tkinter.Label",
"tkinter.Tk"
] | [((439, 446), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (444, 446), True, 'import tkinter as tk\n'), ((2598, 2684), 'tkinter.LabelFrame', 'tk.LabelFrame', (['root'], {'text': '"""Student Data"""', 'pady': '(2)', 'padx': '(5)', 'width': '(1300)', 'height': '(1000)'}), "(root, text='Student Data', pady=2, padx=5, width=13... |
'''
Lo que hace este script es bajar la data de https://www.coingecko.com por medio de su API con ayuda del
data.JSON, el cual funge como una lista de las crypto que acutlamente tradeo, esa lista es actualizada
manualmente. En cuanto a los precios, no baja margenes de precio de entrada y cierre solo es data para una pr... | [
"bin.time.localtime",
"bin.np.array",
"bin.CoinGeckoAPI",
"bin.pd.DataFrame",
"bin.json.load"
] | [((688, 706), 'bin.json.load', 'json.load', (['_lista_'], {}), '(_lista_)\n', (697, 706), False, 'from bin import pd, np, time, json, CoinGeckoAPI\n'), ((912, 966), 'bin.pd.DataFrame', 'pd.DataFrame', ([], {'columns': "['name_file', 'crypto_api_name']"}), "(columns=['name_file', 'crypto_api_name'])\n", (924, 966), Fals... |
from typing import Union
from selenium.webdriver.support.ui import Select as SelSelect
from ..actor import Actor
from ..pacing import beat, MINOR
from ..target import Target
class Select:
"""
Selects an option from a dropdown menu. This is a superclass that will
create the correct specific Select action... | [
"selenium.webdriver.support.ui.Select"
] | [((3343, 3361), 'selenium.webdriver.support.ui.Select', 'SelSelect', (['element'], {}), '(element)\n', (3352, 3361), True, 'from selenium.webdriver.support.ui import Select as SelSelect\n'), ((5043, 5061), 'selenium.webdriver.support.ui.Select', 'SelSelect', (['element'], {}), '(element)\n', (5052, 5061), True, 'from s... |
import pymc as pm
import matplotlib.pyplot as plt
import numpy as np
plt.rc('font', family='Malgun Gothic')
lambda_ = pm.Exponential("poisson_param", 1)
data_generator = pm.Poisson("data_generater", lambda_)
data_plus_one = data_generator + 1
print(lambda_.children)
print(data_generator.parents)
# value
print(lambda... | [
"pymc.Poisson",
"matplotlib.pyplot.bar",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"pymc.rexponential",
"pymc.rpoisson",
"matplotlib.pyplot.rc",
"pymc.DiscreteUniform",
"pymc.Exponential",
"matplotlib.pyplot.show",
"pymc.Uniform",
"matplotlib.pyplot.legend",
"matplotlib.pyp... | [((70, 108), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""Malgun Gothic"""'}), "('font', family='Malgun Gothic')\n", (76, 108), True, 'import matplotlib.pyplot as plt\n'), ((119, 153), 'pymc.Exponential', 'pm.Exponential', (['"""poisson_param"""', '(1)'], {}), "('poisson_param', 1)\n", (133, 153), ... |
import re
from django.conf.urls import url, patterns, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView
from dicom_review.views import review
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', review),
url(r'^login/$', 'django.contr... | [
"django.contrib.admin.autodiscover",
"django.conf.urls.include",
"django.conf.settings.STATIC_URL.lstrip",
"django.conf.urls.url",
"django.conf.settings.MEDIA_URL.lstrip"
] | [((213, 233), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (231, 233), False, 'from django.contrib import admin\n'), ((266, 283), 'django.conf.urls.url', 'url', (['"""^$"""', 'review'], {}), "('^$', review)\n", (269, 283), False, 'from django.conf.urls import url, patterns, include\n'), ... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
chrome_driver_location = "E:\Development\chromedriver.exe"
driver = webdriver.Chrome(executable_path=chrome_driver_location)
driver.get("https://tinder.com/app/recs")
base_window = driver.window_handles[0]
login = driver.find_ele... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((159, 215), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'chrome_driver_location'}), '(executable_path=chrome_driver_location)\n', (175, 215), False, 'from selenium import webdriver\n'), ((446, 459), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (456, 459), False, 'import time\n'), ... |
import sys
from src.bot import logger
from src.bot.messages import (
AVAILABLE_COMMANDS_MESSAGE,
GREETINGS_MESSAGE,
NON_INFORMED_CHANNEL_ID_MESSAGE,
SUBSCRIPTION_ERROR_MESSAGE,
SUBSCRIPTION_MESSAGE,
UNKNOWN_MESSAGE,
)
from src.bot.requester import subscribe_in_pubsubhubbub
from src.database.uti... | [
"src.bot.logger.warning",
"src.bot.requester.subscribe_in_pubsubhubbub",
"telegram.ext.Updater",
"src.bot.messages.GREETINGS_MESSAGE.format",
"src.database.utils.subscribe_user",
"telegram.ext.MessageHandler",
"src.database.utils.save_channel",
"src.bot.logger.info",
"telegram.ext.CommandHandler",
... | [((3290, 3361), 'src.bot.logger.info', 'logger.info', (['"""Channel subscription requested. Initializing processing."""'], {}), "('Channel subscription requested. Initializing processing.')\n", (3301, 3361), False, 'from src.bot import logger\n'), ((3406, 3424), 'src.database.utils.save_user', 'save_user', (['chat_id']... |
import datetime
import os
import certifi
import urllib3
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
# 写入文件
def write_file(file_path, text_content):
with open(file_path, 'w', encoding='utf-8') as f:
f.write(datetime.datetime.now().strftime('<!-- [store... | [
"selenium.webdriver.Firefox",
"os.path.getsize",
"os.path.exists",
"datetime.datetime.now",
"os.path.isfile",
"urllib3.PoolManager",
"selenium.webdriver.firefox.options.Options",
"certifi.where"
] | [((1456, 1465), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (1463, 1465), False, 'from selenium.webdriver.firefox.options import Options\n'), ((1509, 1543), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'options': 'options'}), '(options=options)\n', (1526, 1543), False, 'from s... |
# -*- coding: utf-8 -*-
"""Trello plugin for pomito."""
import logging
from trello import TrelloClient
from pomito.plugins import task
from pomito.task import Task
__all__ = ['TrelloTask']
logger = logging.getLogger('pomito.plugins.task.trello')
def _create_trello_client(api_key, api_secret):
"""Create defau... | [
"pomito.task.Task",
"trello.TrelloClient",
"logging.getLogger"
] | [((203, 250), 'logging.getLogger', 'logging.getLogger', (['"""pomito.plugins.task.trello"""'], {}), "('pomito.plugins.task.trello')\n", (220, 250), False, 'import logging\n'), ((360, 412), 'trello.TrelloClient', 'TrelloClient', ([], {'api_key': 'api_key', 'api_secret': 'api_secret'}), '(api_key=api_key, api_secret=api_... |
"""
Unit tests
"""
from django.test import TestCase
from django.conf import settings
class BasicTests(TestCase):
def test_configuration(self):
"""
Test that the configuration is sane.
"""
self.assertTrue('ROLLBAR' in dir(settings),
msg='The ROLLBAR setting is not present... | [
"django.conf.settings.ROLLBAR.get"
] | [((348, 384), 'django.conf.settings.ROLLBAR.get', 'settings.ROLLBAR.get', (['"""access_token"""'], {}), "('access_token')\n", (368, 384), False, 'from django.conf import settings\n')] |
import io
import json
import socket
from typing import Dict, Tuple, Union
import boto3
import pytest
import yaml
from botocore.client import BaseClient
from botocore.response import StreamingBody
from botocore.session import Session
from botocore.stub import Stubber
from pydantic import BaseModel, ValidationError
from... | [
"pydantic_appconfig.AppConfigHelper",
"yaml.dump",
"json.dumps",
"socket.gethostname",
"pytest.raises"
] | [((1252, 1362), 'pydantic_appconfig.AppConfigHelper', 'AppConfigHelper', (['"""AppConfig-App"""', '"""AppConfig-Env"""', '"""AppConfig-Profile"""', '(15)'], {'config_schema_model': 'TestConfig'}), "('AppConfig-App', 'AppConfig-Env', 'AppConfig-Profile', 15,\n config_schema_model=TestConfig)\n", (1267, 1362), False, ... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import FlightViewSet,TicketViewSet
router = DefaultRouter()
router.register('ticket', TicketViewSet)
router.register('flight', FlightViewSet)
urlpatterns = [
path('', include(router.urls))
]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((147, 162), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (160, 162), False, 'from rest_framework.routers import DefaultRouter\n'), ((276, 296), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (283, 296), False, 'from django.urls import path, include\n')] |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib2tikz.save as tikz_save
import math
def derivative(y, h, n: int=1):
if n == 1:
return lambda x: (y(x + h) - y(x - h)) / (2 * h)
else:
return derivative(derivative(y, h, n - 1), h, 1)
def integral(y, h, a, b):
ret = 0
sgn = 1
if a > b:
... | [
"matplotlib.pyplot.title",
"numpy.vectorize",
"matplotlib.pyplot.axis",
"numpy.sin",
"numpy.arange",
"numpy.cos",
"matplotlib.pyplot.grid",
"numpy.sqrt"
] | [((1563, 1585), 'numpy.arange', 'np.arange', (['(-4)', '(4)', '(0.01)'], {}), '(-4, 4, 0.01)\n', (1572, 1585), True, 'import numpy as np\n'), ((1926, 1950), 'matplotlib.pyplot.axis', 'plt.axis', (['[-4, 4, -5, 5]'], {}), '([-4, 4, -5, 5])\n', (1934, 1950), True, 'import matplotlib.pyplot as plt\n'), ((1952, 1971), 'mat... |
"""Unit tests for the Trello issues collector."""
from datetime import datetime
from .base import TrelloTestCase
class TrelloIssuesTest(TrelloTestCase):
"""Unit tests for the Trello issues collector."""
METRIC_TYPE = "issues"
async def test_issues(self):
"""Test that the number of issues and t... | [
"datetime.datetime.now"
] | [((1356, 1370), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1368, 1370), False, 'from datetime import datetime\n')] |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
#hello_constant = tf.constant('Hello World!')
#with tf.Session() as sess:
# output = sess.run(hello_constant)
# print(output)
# this is how you create an input field in Tensorflow
# not the tf.string part but the tf.placeholder part
# the... | [
"tensorflow.placeholder",
"tensorflow.Session"
] | [((400, 425), 'tensorflow.placeholder', 'tf.placeholder', (['tf.string'], {}), '(tf.string)\n', (414, 425), True, 'import tensorflow as tf\n'), ((430, 454), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {}), '(tf.int32)\n', (444, 454), True, 'import tensorflow as tf\n'), ((459, 485), 'tensorflow.placeholde... |
"""Test the lambda assigning visitor."""
import ast
import pytest
from lime_lynter.Violations.correctness import LambdaAssigningViolation
from lime_lynter.Visitors.Correctness.correctness import LambdaAssigningVisitor
lambda_assigning = """
f = lambda x: 2 * x
"""
@pytest.mark.parametrize('code', [lambda_assigning... | [
"pytest.mark.parametrize",
"ast.parse",
"lime_lynter.Visitors.Correctness.correctness.LambdaAssigningVisitor"
] | [((271, 322), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""code"""', '[lambda_assigning]'], {}), "('code', [lambda_assigning])\n", (294, 322), False, 'import pytest\n'), ((455, 470), 'ast.parse', 'ast.parse', (['code'], {}), '(code)\n', (464, 470), False, 'import ast\n'), ((485, 509), 'lime_lynter.Visito... |
# -*- coding: utf-8 -*-
import re
def minify(code: str) -> str:
# Mark end of directives
code = re.sub(r"([^\S\n]*#[^\n]+)", "%NEWLINE%\\1%NEWLINE%", code)
# Remove comments
code = re.sub(r"//[^\n]*", "", code)
code = re.sub(r"/\*(?:\*[^/]|[^*])*\*/", "", code)
# Remove newlines
code = re... | [
"re.sub"
] | [((105, 166), 're.sub', 're.sub', (['"""([^\\\\S\\\\n]*#[^\\\\n]+)"""', '"""%NEWLINE%\\\\1%NEWLINE%"""', 'code'], {}), "('([^\\\\S\\\\n]*#[^\\\\n]+)', '%NEWLINE%\\\\1%NEWLINE%', code)\n", (111, 166), False, 'import re\n'), ((199, 228), 're.sub', 're.sub', (['"""//[^\\\\n]*"""', '""""""', 'code'], {}), "('//[^\\\\n]*', ... |
# Generated by Django 2.0 on 2020-05-02 10:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('store', '0008_variation'),
]
operations = [
migrations.AddField(
model_name='variation',
... | [
"django.db.models.ForeignKey",
"django.db.models.DecimalField"
] | [((356, 489), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""images"""', 'to': '"""store.Product"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, related_name='images',... |
from django.db import models
import hashlib
from django.core.validators import RegexValidator
from inventario.models import DetallesProducto
class Cliente(models.Model):
TIPO_DOC = {
('PAS','Pasaporte'),
('CC','Cedula de Ciudadania'),
('TI','Tarjeta de Identidad'),
}
nombre = mo... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.core.validators.RegexValidator",
"django.db.models.DateField"
] | [((318, 381), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)', 'unique': '(True)', 'primary_key': '(True)'}), '(max_length=128, unique=True, primary_key=True)\n', (334, 381), False, 'from django.db import models\n'), ((394, 441), 'django.db.models.CharField', 'models.CharField', ([], {'max... |
import experiments
import stages
from nose.tools import assert_equals
import factory
rows = None
def setup_module():
global rows
data = factory.Stages()
rows = data.indexed_rows()
class TestExperiments:
@classmethod
def setup_class(cls):
stgs = [stages.stage_from(r) for r in rows]
... | [
"stages.stage_from",
"factory.Stages",
"experiments.experiments_from"
] | [((147, 163), 'factory.Stages', 'factory.Stages', ([], {}), '()\n', (161, 163), False, 'import factory\n'), ((330, 364), 'experiments.experiments_from', 'experiments.experiments_from', (['stgs'], {}), '(stgs)\n', (358, 364), False, 'import experiments\n'), ((279, 299), 'stages.stage_from', 'stages.stage_from', (['r'], ... |
import regex as re
import requests
from time import sleep
from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice, XBee64BitAddress
from digi.xbee.exception import TimeoutException
from datetime import datetime
class MSG_TYPES:
ACKN = 0
SYNC = 1
UPDA = 2
SYNACK = 3
class UpdatePayload:
lightI... | [
"time.sleep",
"datetime.datetime",
"datetime.datetime.utcnow",
"digi.xbee.devices.XBeeDevice",
"requests.post",
"datetime.datetime.now"
] | [((1391, 1433), 'requests.post', 'requests.post', (['self.nodeUrl'], {'data': 'postData'}), '(self.nodeUrl, data=postData)\n', (1404, 1433), False, 'import requests\n'), ((1731, 1773), 'requests.post', 'requests.post', (['self.dataUrl'], {'data': 'postData'}), '(self.dataUrl, data=postData)\n', (1744, 1773), False, 'im... |
#!/usr/bin/env python
import os
import sys
import argparse
from glob import glob
from textwrap import dedent
from collections import namedtuple
__version__ = 20200612
__doc__ = """Pack multiple small jobs into large queue jobs
* How it works
* The script merely generates a queue job script and a (mpi-aware) pyth... | [
"sys.stdout.write",
"textwrap.dedent",
"os.remove",
"argparse.ArgumentParser",
"os.path.isdir",
"os.system",
"os.path.isfile",
"collections.namedtuple",
"os.path.split",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((1640, 1736), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawTextHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawTextHelpFormatter)\n', (1663, 1736), False, 'import argparse\n'), ((4391, 4417), 'os.path.isdir', 'os.path.... |
# -*- coding: utf-8 -*-
'''
Custom theano class to query the search engine.
'''
import numpy as np
import theano
from theano import gof
from theano import tensor
import parameters as prm
import utils
import average_precision
import random
class Search(theano.Op):
__props__ = ()
def __init__(self,options):
... | [
"theano.tensor.as_tensor_variable",
"numpy.log",
"theano.tensor.itensor3",
"theano.Apply",
"theano.tensor.imatrix",
"theano.tensor.zeros_like",
"numpy.arange",
"theano.tensor.fmatrix",
"numpy.random.choice"
] | [((554, 583), 'theano.tensor.as_tensor_variable', 'tensor.as_tensor_variable', (['x1'], {}), '(x1)\n', (579, 583), False, 'from theano import tensor\n'), ((597, 626), 'theano.tensor.as_tensor_variable', 'tensor.as_tensor_variable', (['x2'], {}), '(x2)\n', (622, 626), False, 'from theano import tensor\n'), ((640, 669), ... |
#!/usr/bin/env python
"""
Fetch profile changes from nightscout and display their contents
"""
# Make it work on both python 2 and 3
# Probably a bit wide, but I'm still learning
from __future__ import absolute_import, with_statement, print_function, unicode_literals
# Built-in modules
import argparse
from datetime i... | [
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"json.loads",
"datetime.datetime.strptime",
"requests.get",
"texttable.Texttable"
] | [((431, 470), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (450, 470), False, 'import logging\n'), ((864, 909), 'logging.debug', 'logging.debug', (['"""Normalizing entry: %s"""', 'entry'], {}), "('Normalizing entry: %s', entry)\n", (877, 909), False, 'import l... |
import hashlib
import logging
import os
import shutil
import sys
LOGGER = logging.getLogger()
_MISSING_FILE_PATH_MSG = "Missing parameter file_path: %s"
def generate_sha256_checksum(file_path):
'''
Purpose: Calculate the SHA256 checksum of a given file
Parameters: Path to file
Returns: The SHA2... | [
"hashlib.sha256",
"os.path.isfile",
"hashlib.md5",
"logging.getLogger"
] | [((75, 94), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (92, 94), False, 'import logging\n'), ((549, 565), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (563, 565), False, 'import hashlib\n'), ((1143, 1168), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (1157, 1168), ... |
# -*- coding: utf-8 -*-
import json
import logging
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Tuple, Dict, Set, Callable
from warnings import warn
from pandas import DataFrame, merge, Series, concat
from .exceptions import FileLoaderError, ValidationError, ConfigurationError
from ... | [
"pandas.DataFrame",
"pandas.merge",
"json.dumps",
"pathlib.Path",
"warnings.warn",
"pandas.concat",
"logging.getLogger"
] | [((433, 460), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (450, 460), False, 'import logging\n'), ((567, 608), 'pathlib.Path', 'Path', (['"""/usr/src/evaluation/ground-truth/"""'], {}), "('/usr/src/evaluation/ground-truth/')\n", (571, 608), False, 'from pathlib import Path\n'), ((643, ... |
import pygame
def load(manager, params):
return pygame.quit()
| [
"pygame.quit"
] | [((53, 66), 'pygame.quit', 'pygame.quit', ([], {}), '()\n', (64, 66), False, 'import pygame\n')] |
import httptools
import unittest
from unittest import mock
RESPONSE1_HEAD = b'''HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7
(Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
ETag: "3f80f-1b6-3e1cb03b"
Content-Type: text/html;
charset=UTF-8
Content-Length: 13... | [
"httptools.parse_url",
"unittest.mock.Mock",
"httptools.HttpRequestParser",
"httptools.HttpResponseParser"
] | [((835, 846), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (844, 846), False, 'from unittest import mock\n'), ((936, 967), 'httptools.HttpResponseParser', 'httptools.HttpResponseParser', (['m'], {}), '(m)\n', (964, 967), False, 'import httptools\n'), ((2857, 2891), 'httptools.HttpResponseParser', 'httptools.Htt... |