code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import unittest
import logging
import functools
import concurrent.futures
from io import StringIO
from hypothesis import given, strategies as st
from eolearn.core import EOTask, EOWorkflow, Dependency, WorkflowResults, LinearWorkflow
from eolearn.core.eoworkflow import CyclicDependencyError, _UniqueIdGenerator
from e... | [
"unittest.main",
"eolearn.core.graph.DirectedGraph._is_cyclic",
"io.StringIO",
"eolearn.core.EOWorkflow._schedule_dependencies",
"logging.basicConfig",
"eolearn.core.Dependency",
"eolearn.core.LinearWorkflow",
"eolearn.core.EOWorkflow",
"functools.reduce",
"eolearn.core.graph.DirectedGraph.from_ed... | [((361, 400), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (380, 400), False, 'import logging\n'), ((6362, 6377), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6375, 6377), False, 'import unittest\n'), ((2611, 2654), 'eolearn.core.LinearWorkflow', 'Line... |
import numpy as np
from util import get_new_item, get_n_different_items
from util import vi, vi_On, not_vi, create_csv
from util import vi_pt, vi_On_pt, not_vi_pt
from vocab import male_names, female_names, cities_and_states, countries
from vocab_pt import male_names_pt, female_names_pt, cities_pt, countries_pt
def ... | [
"util.get_n_different_items",
"util.create_csv",
"util.get_new_item",
"numpy.random.choice"
] | [((692, 721), 'numpy.random.choice', 'np.random.choice', (['person_list'], {}), '(person_list)\n', (708, 721), True, 'import numpy as np\n'), ((735, 771), 'util.get_n_different_items', 'get_n_different_items', (['place_list', 'n'], {}), '(place_list, n)\n', (756, 771), False, 'from util import get_new_item, get_n_diffe... |
"""
Manually move the stage using arrow keys.
Measure the dx, dy offsets via the matcher.
@author: jayb
"""
from ctypes import *
import logging
import threading
import time
import os
import sys
import yaml
import subprocess
import numpy as np
import cv2
from temca_graph import *
import msvcrt
from pytemca.stage.stage... | [
"msvcrt.kbhit",
"logging.basicConfig",
"msvcrt.getch",
"pytemca.scope.scope.ScopeConnection",
"pytemca.scope.scope.beep",
"pytemca.scope.scope.htcond"
] | [((484, 591), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (503, 591), False, 'import logging\n'), ((1692, 1716), 'pyte... |
#!/usr/bin/env python3
"""
Polynomial regression with exponent of 3, in which the polynomial looks like:
y=a+bx+cx^2+dx^3
For N of samples, we have
y1=a+bx1+cx1^2+dx1^3
y2=a+bx2+cx2^2+dx2^3
...
yN=a+bxN+cxN^2+dxN^3
Using a simple linear algebraic representation, we have:
y1=[1 x1 x1^2 x1^3]... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.random.normal",
"numpy.cos"
] | [((682, 704), 'numpy.arange', 'np.arange', (['(0)', '(1)', '(0.001)'], {}), '(0, 1, 0.001)\n', (691, 704), True, 'import numpy as np\n'), ((706, 719), 'numpy.cos', 'np.cos', (['(3 * x)'], {}), '(3 * x)\n', (712, 719), True, 'import numpy as np\n'), ((720, 767), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'y... |
import base64
import glob
import json
import os
import random
import string
from shutil import copy
from unittest import TestCase, mock
from unittest.mock import call
from uuid import UUID
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils.common.text.converters import to_native
from... | [
"unittest.mock.call.v",
"os.remove",
"ansible_collections.dszryan.keepass.plugins.module_utils.keepass_database.EntryDump",
"os.path.basename",
"ansible_collections.dszryan.keepass.plugins.module_utils.keepass_database.KeepassDatabase",
"unittest.mock.Mock",
"os.path.dirname",
"unittest.mock.call.vvv"... | [((2056, 2100), 'uuid.UUID', 'UUID', (['"""9366b38f-2ee9-412f-a6ba-b2ab10d1f100"""'], {}), "('9366b38f-2ee9-412f-a6ba-b2ab10d1f100')\n", (2060, 2100), False, 'from uuid import UUID\n'), ((2145, 2189), 'uuid.UUID', 'UUID', (['"""00000000-0000-0000-0000-000000000000"""'], {}), "('00000000-0000-0000-0000-000000000000')\n"... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from .models import DiscussionMarker
from sqlalchemy.orm import load_only
def main():
for marker in DiscussionMarker.query.options(load_only("id", "identifier")).all():
print(marker.identifier)
if __name__ == "__main__":
main()
| [
"sqlalchemy.orm.load_only"
] | [((198, 227), 'sqlalchemy.orm.load_only', 'load_only', (['"""id"""', '"""identifier"""'], {}), "('id', 'identifier')\n", (207, 227), False, 'from sqlalchemy.orm import load_only\n')] |
from .exceptions import *
import random
class GuessAttempt(object):
def __init__(self,guess,hit=None,miss=None):
self.guess = guess
self.hit = hit
self.miss = miss
if hit and miss:
raise InvalidGuessAttempt()
def is_hit(self):
if self.hit:
r... | [
"random.choice"
] | [((1745, 1767), 'random.choice', 'random.choice', (['l_words'], {}), '(l_words)\n', (1758, 1767), False, 'import random\n')] |
# Generated by Django 3.2.7 on 2021-12-09 11:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('upload_file', '0003_auto_20210430_0925'),
]
operations = [
migrations.AlterField(
model_name='fileupload',
name='doc... | [
"django.db.models.CharField"
] | [((351, 578), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('actuals', 'Actuals'), ('budget', 'Budget'), ('previousyear',\n 'Previous Year'), ('projectpercentage', 'Project Percentages'), {\n 'Forecast', 'forecast'}]", 'default': '"""actuals"""', 'max_length': '(100)'}), "(choices=[('actua... |
import os
import tempfile
from typing import Optional, Callable, cast
import torch
import torch.nn as nn
from captum.influence._core.tracincp import TracInCP
from captum.influence._core.tracincp_fast_rand_proj import (
TracInCPFast,
TracInCPFastRandProj,
)
from parameterized import parameterized
from tests.hel... | [
"torch.nn.MSELoss",
"tempfile.TemporaryDirectory",
"tests.helpers.basic.assertTensorAlmostEqual",
"torch.sum",
"typing.cast",
"tests.influence._utils.common.RangeDataset",
"tests.influence._utils.common.IdentityDataset",
"tests.influence._utils.common.CoefficientNet",
"tests.influence._utils.common.... | [((743, 776), 'tests.influence._utils.common.RangeDataset', 'RangeDataset', (['low', 'high', 'features'], {}), '(low, high, features)\n', (755, 776), False, 'from tests.influence._utils.common import RangeDataset, CoefficientNet, isSorted, DataInfluenceConstructor, build_test_name_func, IdentityDataset\n'), ((791, 827)... |
import argparse
config_path = './output/config'
output_path = './output/proc0' # append id.output later, id<=9
def read_config():
f = open(config_path,"r")
data = f.readlines()
m = 0
dict = {}
count = 0
for line in data:
splited = line.split(" ")
if count == 0:
m ... | [
"argparse.ArgumentParser"
] | [((4182, 4207), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4205, 4207), False, 'import argparse\n')] |
from unittest import TestCase
import numpy
from nptyping import Bool
class TestBool(TestCase):
def test_isinstance(self):
self.assertIsInstance(True, Bool)
self.assertIsInstance(False, Bool)
self.assertIsInstance(numpy.bool_(True), Bool)
self.assertIsInstance(numpy.bool_(False)... | [
"numpy.bool_",
"nptyping.Bool.type_of"
] | [((247, 264), 'numpy.bool_', 'numpy.bool_', (['(True)'], {}), '(True)\n', (258, 264), False, 'import numpy\n'), ((302, 320), 'numpy.bool_', 'numpy.bool_', (['(False)'], {}), '(False)\n', (313, 320), False, 'import numpy\n'), ((557, 575), 'nptyping.Bool.type_of', 'Bool.type_of', (['(True)'], {}), '(True)\n', (569, 575),... |
import numpy as np
import pandas as pd
import precise
import NNS
from NNS.Partial_Moments import PM_matrix
def _NNS_pcov_init(s:dict=None, x:[[float]]=None, n_dim=None):
""" NNS population covariance"""
n_dim = len(x[-1]) if x is not None else n_dim
if s is None:
s = dict()
s['n_dim']=n_dim
... | [
"numpy.broadcast_to",
"numpy.zeros",
"numpy.ones",
"NNS.Partial_Moments.PM_matrix"
] | [((362, 376), 'numpy.ones', 'np.ones', (['n_dim'], {}), '(n_dim)\n', (369, 376), True, 'import numpy as np\n'), ((416, 436), 'numpy.zeros', 'np.zeros', (["s['shape']"], {}), "(s['shape'])\n", (424, 436), True, 'import numpy as np\n'), ((1714, 1757), 'numpy.broadcast_to', 'np.broadcast_to', (['flat_mean_diff', "s['shape... |
"""
Arithmetic Expressions
"""
import hashlib
import re
P = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1
A = 0
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
G = (Gx, Gy)
def inv(a, n):
... | [
"hashlib.sha256",
"hashlib.new",
"re.match"
] | [((3661, 3685), 'hashlib.new', 'hashlib.new', (['"""ripemd160"""'], {}), "('ripemd160')\n", (3672, 3685), False, 'import hashlib\n'), ((3613, 3635), 'hashlib.sha256', 'hashlib.sha256', (['string'], {}), '(string)\n', (3627, 3635), False, 'import hashlib\n'), ((3990, 4018), 're.match', 're.match', (["'^\\x00*'", 'inp_fm... |
import pyblish.api
from reveries import plugins
class RepairInvalid(plugins.RepairInstanceAction):
label = "Remove Namespaces"
class ValidateNoNamespace(pyblish.api.InstancePlugin):
"""Ensure the nodes don't have a namespace"""
families = [
"reveries.model",
"reveries.rig",
"r... | [
"pymel.core.ls",
"maya.cmds.ls"
] | [((1598, 1612), 'pymel.core.ls', 'pm.ls', (['invalid'], {}), '(invalid)\n', (1603, 1612), True, 'import pymel.core as pm\n'), ((834, 862), 'maya.cmds.ls', 'cmds.ls', (['instance'], {'long': '(True)'}), '(instance, long=True)\n', (841, 862), False, 'from maya import cmds\n')] |
# write_BEA_Use_from_useeior.py (scripts)
# !/usr/bin/env python3
# coding=utf-8
"""
A script to get Use table transactions from a useeior EEIOmodel.
- Store them as .csv
- Depends on rpy2 and tzlocal as well as having R installed and useeior installed.
The BEA_2012_Detail_Use_PRO_BeforeRedef was pulled from
USEEI... | [
"rpy2.robjects.pandas2ri.activate",
"rpy2.robjects.packages.importr",
"rpy2.robjects.pandas2ri.ri2py_dataframe"
] | [((1505, 1525), 'rpy2.robjects.pandas2ri.activate', 'pandas2ri.activate', ([], {}), '()\n', (1523, 1525), False, 'from rpy2.robjects import pandas2ri\n'), ((1537, 1555), 'rpy2.robjects.packages.importr', 'importr', (['"""useeior"""'], {}), "('useeior')\n", (1544, 1555), False, 'from rpy2.robjects.packages import import... |
"""
Tests for Hyperparameters Distributions
========================================
..
Copyright 2019, Neuraxio 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:/... | [
"pytest.mark.parametrize",
"pytest.raises",
"collections.Counter"
] | [((1592, 1649), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ctor"""', '[Choice, PriorityChoice]'], {}), "('ctor', [Choice, PriorityChoice])\n", (1615, 1649), False, 'import pytest\n'), ((2472, 2497), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (2485, 2497), False, 'import p... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv("iris.csv")
df.drop(['Id'], 1, inplace=True)
print('Dataset : \n')
print(df)
#dividing the dataset
x = df.iloc[:,:-1].values #input
y = df.iloc[:,-1].values #expected output
#splitting the dataset into train set and test set... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.metrics.confusion_matrix"
] | [((77, 100), 'pandas.read_csv', 'pd.read_csv', (['"""iris.csv"""'], {}), "('iris.csv')\n", (88, 100), True, 'import pandas as pd\n'), ((408, 462), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(x, y, test_size=0.25, random_state=0)\n', (42... |
import torch
import torch.nn as nn
import pytorch_lightning as pl
from torchmetrics import Accuracy
from collections import OrderedDict
from feeder.tools import process_stream
from net.aimclr import AimCLR
from net.byol_aimclr import BYOLAimCLR
class LinearEvalLearner(pl.LightningModule):
def __init__(self, cfg... | [
"feeder.tools.process_stream",
"torch.load",
"torch.nn.CrossEntropyLoss",
"torchmetrics.Accuracy",
"torch.optim.lr_scheduler.MultiStepLR"
] | [((658, 679), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (677, 679), True, 'import torch.nn as nn\n'), ((709, 726), 'torchmetrics.Accuracy', 'Accuracy', ([], {'top_k': '(1)'}), '(top_k=1)\n', (717, 726), False, 'from torchmetrics import Accuracy\n'), ((756, 773), 'torchmetrics.Accuracy', 'Acc... |
import hashlib
import logging
import os
import shutil
import subprocess
import closure
import cssmin
import htmlmin
import jinja2
import jsmin
import mdx_clickhouse
def copy_icons(args):
logging.info('Copying icons')
icons_dir = os.path.join(args.output_dir, 'images', 'icons')
os.makedirs(icons_dir)
... | [
"shutil.ignore_patterns",
"logging.debug",
"os.makedirs",
"cssmin.cssmin",
"jsmin.jsmin",
"subprocess.check_output",
"os.walk",
"shutil.copy2",
"closure.run",
"htmlmin.minify",
"logging.info",
"jinja2.FileSystemLoader",
"mdx_clickhouse.get_translations",
"os.path.join"
] | [((195, 224), 'logging.info', 'logging.info', (['"""Copying icons"""'], {}), "('Copying icons')\n", (207, 224), False, 'import logging\n'), ((241, 289), 'os.path.join', 'os.path.join', (['args.output_dir', '"""images"""', '"""icons"""'], {}), "(args.output_dir, 'images', 'icons')\n", (253, 289), False, 'import os\n'), ... |
import re
import os
from collections import Counter
data = """
4 = NEWS STORIES
49 = #3840.doc
47 = #3295.doc
11 = The Internet
48 = register.html
46 = #3276.doc
45 = #3250.doc
44 = #3276.docx
12 = foryou.txt
43 = Local Disk (C:)
42 = stuff.txt
20 = Links.docx
14 = Local Disk (P:)
19 = Siam... | [
"collections.Counter",
"re.compile"
] | [((1801, 1819), 'collections.Counter', 'Counter', (['doc_types'], {}), '(doc_types)\n', (1808, 1819), False, 'from collections import Counter\n'), ((1550, 1614), 're.compile', 're.compile', (['"""(.*)\\\\.([a-z]{3,4})\\\\Z"""', '(re.IGNORECASE | re.VERBOSE)'], {}), "('(.*)\\\\.([a-z]{3,4})\\\\Z', re.IGNORECASE | re.VER... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"apache_beam.metrics.Metrics.counter",
"apache_beam.Map",
"sentencepiece.SentencePieceProcessor",
"official.projects.triviaqa.evaluation.normalize_answer",
"re.finditer",
"os.path.join",
"apache_beam.metrics.Metrics.distribution",
"apache_beam.MapTuple",
"nltk.data.load",
"re.escape",
"absl.logg... | [((5629, 5683), 'bisect.bisect_left', 'bisect.bisect_left', (['features.token_offsets', 'span.begin'], {}), '(features.token_offsets, span.begin)\n', (5647, 5683), False, 'import bisect\n'), ((3205, 3227), 'tensorflow.io.gfile.GFile', 'gfile.GFile', (['json_path'], {}), '(json_path)\n', (3216, 3227), True, 'import tens... |
import numpy as np
import torch
from config import MINIMAL_EDGE_LENGTH
class SegmentedImage(torch.utils.data.Dataset):
def __init__(self, img, transform=None):
self.patches = self.segment_image(img)
self.transform = transform
def segment_image(self, img):
assert img.shape[0] % MINI... | [
"numpy.empty"
] | [((548, 641), 'numpy.empty', 'np.empty', (['(n_rows, n_cols, MINIMAL_EDGE_LENGTH, MINIMAL_EDGE_LENGTH, 3)'], {'dtype': 'np.float32'}), '((n_rows, n_cols, MINIMAL_EDGE_LENGTH, MINIMAL_EDGE_LENGTH, 3),\n dtype=np.float32)\n', (556, 641), True, 'import numpy as np\n')] |
"""
Dataset: https://travistorrent.testroots.org/page_access/
"""
import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
RECURSIVE_B... | [
"sklearn.impute.SimpleImputer",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.hist",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.legend",
"sklearn.tree.DecisionTreeClassifier",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabe... | [((1854, 1916), 'sklearn.impute.SimpleImputer', 'SimpleImputer', ([], {'missing_values': 'np.nan', 'strategy': '"""most_frequent"""'}), "(missing_values=np.nan, strategy='most_frequent')\n", (1867, 1916), False, 'from sklearn.impute import SimpleImputer\n'), ((2078, 2131), 'sklearn.model_selection.train_test_split', 't... |
"""Frequently used Theano expressions."""
from theano import tensor
def l2_norm(tensors):
"""Computes the total L2 norm of a set of tensors.
Converts all operands to :class:`~tensor.TensorVariable`
(see :func:`~tensor.as_tensor_variable`).
Parameters
----------
tensors : iterable of :class:`... | [
"theano.tensor.as_tensor_variable",
"theano.tensor.Rop",
"theano.tensor.stack",
"theano.tensor.sum"
] | [((482, 503), 'theano.tensor.stack', 'tensor.stack', (['*summed'], {}), '(*summed)\n', (494, 503), False, 'from theano import tensor\n'), ((1253, 1292), 'theano.tensor.Rop', 'tensor.Rop', (['gradient', 'parameter', 'vector'], {}), '(gradient, parameter, vector)\n', (1263, 1292), False, 'from theano import tensor\n'), (... |
import json
import os
import urllib
from urllib import request
count = 0
link_name = []
all_links = []
total_dic = {}
last_count = {}
last_counts = []
def input_data():
print("=========================")
get_name = input("Enter a Name: ")
get_link = input("Enter the Link: ")
# if get_name == "" or g... | [
"json.dump",
"json.load",
"os.stat",
"os.path.exists",
"urllib.request.urlopen"
] | [((1873, 1901), 'os.path.exists', 'os.path.exists', (['"""total.json"""'], {}), "('total.json')\n", (1887, 1901), False, 'import os\n'), ((3379, 3409), 'json.dump', 'json.dump', (['last_count', 'outfile'], {}), '(last_count, outfile)\n', (3388, 3409), False, 'import json\n'), ((590, 621), 'os.path.exists', 'os.path.exi... |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <NAME> <<EMAIL>>
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... | [
"os.path.dirname",
"scipy.interpolate.interp2d",
"collections.namedtuple",
"scipy.interpolate.interp1d",
"math.log",
"os.path.join"
] | [((4783, 4903), 'scipy.interpolate.interp2d', 'interp2d', (['[0.016, 0.125, 0.25, 0.42, 0.5, 0.75, 1]', '[3, 5, 10, 20, 30, 50, 60, 75, 100, 200, 400]', 'VFD_efficiencies'], {}), '([0.016, 0.125, 0.25, 0.42, 0.5, 0.75, 1], [3, 5, 10, 20, 30, 50, \n 60, 75, 100, 200, 400], VFD_efficiencies)\n', (4791, 4903), False, '... |
from typing import Optional
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt.bitvec import BitVec
from ithildin.analysis.base import AnalysisStrategy
from ithildin.report.analysis import Result
class Caller:
""" Class to be used as annotation for CALLER elements. """
... | [
"ithildin.report.analysis.Result"
] | [((2979, 3055), 'ithildin.report.analysis.Result', 'Result', (['state.environment.active_function_name'], {'_index_owner': 'storage_address'}), '(state.environment.active_function_name, _index_owner=storage_address)\n', (2985, 3055), False, 'from ithildin.report.analysis import Result\n')] |
import os
import re
from rdkit.Chem.rdmolfiles import MolFromMol2Block
# Read in a mol2 file with meta property lines at the top
# as would be found in the poses.mol2 at the end of a docking run:
# ########## Name: 12878478.0.94645
# ########## Protonation: none
# ######... | [
"rdkit.Chem.rdmolfiles.MolFromMol2Block",
"re.compile"
] | [((677, 724), 're.compile', 're.compile', (['"""##########\\\\s+([^:]+):\\\\s+(.+)\\\\n"""'], {}), "('##########\\\\s+([^:]+):\\\\s+(.+)\\\\n')\n", (687, 724), False, 'import re\n'), ((942, 993), 'rdkit.Chem.rdmolfiles.MolFromMol2Block', 'MolFromMol2Block', (['molecule_block'], {'sanitize': 'sanitize'}), '(molecule_blo... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 13:20:17 2020
@author: Daniel
"""
import sys
from Cell_State import CellState
from neighborhood_acquisition import NeighborhoodAcquisition
from colors import ConsoleColor
from neighborhood_acquisition_algoritms import NeighborhoodAcquisitionTypes
class Rule:
... | [
"sys.stdout.write",
"sys.stderr.write",
"neighborhood_acquisition.NeighborhoodAcquisition.get_neighborhood"
] | [((1093, 1129), 'sys.stdout.write', 'sys.stdout.write', (['ConsoleColor.GREEN'], {}), '(ConsoleColor.GREEN)\n', (1109, 1129), False, 'import sys\n'), ((1214, 1250), 'sys.stdout.write', 'sys.stdout.write', (['ConsoleColor.RESET'], {}), '(ConsoleColor.RESET)\n', (1230, 1250), False, 'import sys\n'), ((2613, 2649), 'sys.s... |
# CubETL
# Copyright (c) 2013-2019 <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, copy, modify, merge, publish,... | [
"os.path.abspath",
"cubetl.olap.sqlschema.SQLToOLAP",
"logging.basicConfig",
"getopt.gnu_getopt",
"cubetl.cubes.cubes10.Cubes10ModelWriter",
"cubetl.util.config.CreateTemplateConfig",
"cubetl.util.config.PrintConfig",
"cubetl.util.PrettyPrint",
"cubetl.olap.PrintMappings",
"cubetl.core.context.Con... | [((1571, 1598), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1588, 1598), False, 'import logging\n'), ((2434, 2575), 'sys.stderr.write', 'sys.stderr.write', (['"""cubetl [-dd] [-q] [-h] [-r filename] [-p property=value] [-m attribute=value] [config.py ...] <start-node>\n"""'], {}), '(\... |
import discord
from discord.ext import commands
class List(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name = 'listCommands', aliases = ['List', 'list'])
async def listCommands(self, ctx):
await ctx.send("List of Command:\n1. Ban: Can be used to ban a... | [
"discord.ext.commands.command"
] | [((143, 206), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""listCommands"""', 'aliases': "['List', 'list']"}), "(name='listCommands', aliases=['List', 'list'])\n", (159, 206), False, 'from discord.ext import commands\n')] |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from textwrap import dedent
from pants.backend.jvm.register import build_file_aliases as register_jvm
from pants.backend.project_info.tasks.depmap import Depmap
from pants.backend.python.... | [
"textwrap.dedent",
"pants.backend.python.register.build_file_aliases",
"pants.backend.jvm.register.build_file_aliases",
"pants.testutil.subsystem.util.init_subsystem",
"pants.build_graph.register.build_file_aliases"
] | [((930, 967), 'pants.testutil.subsystem.util.init_subsystem', 'init_subsystem', (['PythonBinary.Defaults'], {}), '(PythonBinary.Defaults)\n', (944, 967), False, 'from pants.testutil.subsystem.util import init_subsystem\n'), ((867, 884), 'pants.backend.python.register.build_file_aliases', 'register_python', ([], {}), '(... |
from pyplan.pyplan.common.baseService import BaseService
from pyplan.pyplan.usercompanies.models import UserCompany
from .models import Activity, ActivityType
from django.conf import settings
import os
class ActivityService(BaseService):
def registerOpenModel(self, file):
self.client_session.userCompanyI... | [
"os.path.join"
] | [((1931, 1992), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', '"""models"""', 'model.model_path'], {}), "(settings.MEDIA_ROOT, 'models', model.model_path)\n", (1943, 1992), False, 'import os\n')] |
import functools
import time
import json
from flask import (
Blueprint, request
)
from hiscore_server.db import (get_db, db_add_row, db_get_hiscore_data)
bp = Blueprint('hiscores', __name__, url_prefix='/hiscores')
@bp.route('/')
def hello_world():
return 'Hello, this is the Hi Scores Server!'
@bp.route('/li... | [
"flask.Blueprint",
"flask.request.args.get",
"hiscore_server.db.db_get_hiscore_data",
"json.dumps",
"hiscore_server.db.db_add_row"
] | [((164, 219), 'flask.Blueprint', 'Blueprint', (['"""hiscores"""', '__name__'], {'url_prefix': '"""/hiscores"""'}), "('hiscores', __name__, url_prefix='/hiscores')\n", (173, 219), False, 'from flask import Blueprint, request\n'), ((423, 447), 'flask.request.args.get', 'request.args.get', (['"""game"""'], {}), "('game')\... |
import json
from importlib import import_module
import six
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from rest_framework import serializers
from task_api.models import TaskInfo
from task_api.params import ParameterNotValidError
BACKGROUND_TASKS = getattr(settings, 'TASK... | [
"django.core.exceptions.ImproperlyConfigured",
"json.loads",
"importlib.import_module",
"rest_framework.serializers.ListField",
"six.text_type",
"rest_framework.serializers.DictField",
"rest_framework.serializers.ValidationError"
] | [((418, 473), 'rest_framework.serializers.DictField', 'serializers.DictField', ([], {'allow_null': '(True)', 'write_only': '(True)'}), '(allow_null=True, write_only=True)\n', (439, 473), False, 'from rest_framework import serializers\n'), ((488, 525), 'rest_framework.serializers.DictField', 'serializers.DictField', ([]... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
import re
import numpy as np
import pytest
import six
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import patheffects
from matplotlib.testing.determinis... | [
"matplotlib.testing.determinism._determinism_source_date_epoch",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"shutil.rmtree",
"os.path.join",
"six.moves.StringIO",
"matplotlib.rcParams.update",
"tempfile.mkdtemp",
"matplotlib.pyplot.rc",
"matplotlib.checkdep_usetex",
"matplotlib.p... | [((760, 787), 'pytest.mark.flaky', 'pytest.mark.flaky', ([], {'reruns': '(3)'}), '(reruns=3)\n', (777, 787), False, 'import pytest\n'), ((1491, 1527), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (['rcParams'], {}), '(rcParams)\n', (1517, 1527), False, 'import matplotlib\n'), ((1543, 1557), 'matplotlib.p... |
from django.db import models
from django.conf import settings
import os
from django.core.validators import FileExtensionValidator
User = settings.AUTH_USER_MODEL
def smarket_directory_path(instance, filename):
banner_pic_name="smarket/products/{0}/{1}".format(instance.name, filename)
full_path = os.path.join(... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.URLField",
"os.remove",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"os.path.exists",
"django.db.models.SlugField",
"django.db.models.BooleanField",
"django.db.... | [((307, 357), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', 'banner_pic_name'], {}), '(settings.MEDIA_ROOT, banner_pic_name)\n', (319, 357), False, 'import os\n'), ((393, 418), 'os.path.exists', 'os.path.exists', (['full_path'], {}), '(full_path)\n', (407, 418), False, 'import os\n'), ((518, 592), 'django.db... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"asyncio.gather",
"asl_workflow_engine.logger.init_logging",
"asyncio.get_event_loop",
"asl_workflow_engine.amqp_0_9_1_messaging_asyncio.Connection"
] | [((7160, 7184), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (7182, 7184), False, 'import asyncio, json, time\n'), ((1599, 1626), 'asl_workflow_engine.logger.init_logging', 'init_logging', ([], {'log_name': 'name'}), '(log_name=name)\n', (1611, 1626), False, 'from asl_workflow_engine.logger imp... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 05 14:23:22 2018
@author: a002028
"""
import os
from collections import Mapping
from ctdpy.core import readers, mapping
def recursive_dict_update(d, u):
"""Recursive dictionary update.
Copied from:
http://stackoverflow.com/questions/3232943/update-value... | [
"os.path.expanduser",
"os.makedirs",
"os.path.isdir",
"ctdpy.core.readers.YAMLreader",
"os.path.realpath",
"os.walk",
"os.path.exists",
"ctdpy.core.mapping.ShipMapping",
"ctdpy.core.mapping.ParameterMapping",
"os.path.join",
"os.listdir"
] | [((2426, 2502), 'os.path.join', 'os.path.join', (["self.settings_paths['archive_structure_path']", '"""received_data"""'], {}), "(self.settings_paths['archive_structure_path'], 'received_data')\n", (2438, 2502), False, 'import os\n'), ((4959, 4985), 'ctdpy.core.mapping.ParameterMapping', 'mapping.ParameterMapping', ([]... |
import random
import json
from sklearn.model_selection import train_test_split
import argparse
import json
from os.path import exists
from tqdm import tqdm
from underthesea import sent_tokenize
import random
with open('zalo_v2.0.json','r',encoding='utf-8') as json_file:
data = json.load(json_file)
da... | [
"json.dump",
"tqdm.tqdm",
"json.load",
"random.shuffle",
"json.dumps",
"underthesea.sent_tokenize"
] | [((489, 510), 'random.shuffle', 'random.shuffle', (['index'], {}), '(index)\n', (503, 510), False, 'import random\n'), ((296, 316), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (305, 316), False, 'import json\n'), ((834, 860), 'json.dump', 'json.dump', (['train_new', 'file'], {}), '(train_new, file)\... |
# Copyright 2019 DeepMind Technologies Ltd. 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 appl... | [
"open_spiel.python.rl_environment.TimeStep",
"open_spiel.python.mfg.algorithms.policy_value.PolicyValue",
"logging.info",
"open_spiel.python.rl_environment.Environment",
"open_spiel.python.mfg.algorithms.distribution.DistributionPolicy",
"open_spiel.python.mfg.algorithms.nash_conv.NashConv",
"open_spiel... | [((1671, 1769), 'open_spiel.python.rl_environment.TimeStep', 'rl_environment.TimeStep', ([], {'observations': 'self._obs', 'rewards': 'None', 'discounts': 'None', 'step_type': 'None'}), '(observations=self._obs, rewards=None, discounts=\n None, step_type=None)\n', (1694, 1769), False, 'from open_spiel.python import ... |
from django.urls import path
from Apps.Main.views import login, menu
from django.contrib.auth import views
urlpatterns = [
path(r'', login),
path('menu', menu),
path('login/',views.LoginView.as_view(template_name='Main/login.html')),
] | [
"django.contrib.auth.views.LoginView.as_view",
"django.urls.path"
] | [((128, 143), 'django.urls.path', 'path', (['""""""', 'login'], {}), "('', login)\n", (132, 143), False, 'from django.urls import path\n'), ((150, 168), 'django.urls.path', 'path', (['"""menu"""', 'menu'], {}), "('menu', menu)\n", (154, 168), False, 'from django.urls import path\n'), ((188, 244), 'django.contrib.auth.v... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2017,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the ab... | [
"serial.Serial",
"rospy.Subscriber",
"SabertoothSerial.msg.SabertoothMotor",
"Queue.Queue",
"rospy.Publisher",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.spin",
"rospy.get_caller_id"
] | [((2033, 2046), 'Queue.Queue', 'Queue.Queue', ([], {}), '()\n', (2044, 2046), False, 'import rospy, serial, Queue\n'), ((2780, 2809), 'SabertoothSerial.msg.SabertoothMotor', 'SabertoothMotor', (['motor', 'power'], {}), '(motor, power)\n', (2795, 2809), False, 'from SabertoothSerial.msg import SabertoothMotor\n'), ((244... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
remove_end,
)
class MailRuIE(InfoExtractor):
IE_NAME = 'mailru'
IE_DESC = '<EMAIL>'
_VALID_URL = r'https?://(?:(?:www|m)\.)?my\.mail\.ru/(?:video/.*#video=/?(?P<... | [
"re.match"
] | [((2450, 2480), 're.match', 're.match', (['self._VALID_URL', 'url'], {}), '(self._VALID_URL, url)\n', (2458, 2480), False, 'import re\n')] |
import torch
import torch.nn as nn
from .midas.midas_net import MidasNet
class DoepdNet(torch.nn.Module):
"""
There are 3 run modes available for this model.
1. Yolo : Trains/Inferences only yolo layer, while ignoring midas and planeRCNN
2. PlaneRCNN : Trains/Inferences only PlaneRCN... | [
"torch.nn.Parameter",
"torch.load",
"torch.nn.Conv2d"
] | [((6929, 6978), 'torch.load', 'torch.load', (['yolo_weight_file'], {'map_location': 'device'}), '(yolo_weight_file, map_location=device)\n', (6939, 6978), False, 'import torch\n'), ((1217, 1287), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': '(512)', 'out_channels': '(256)', 'kernel_size': '(1)', 'padding': '(0)... |
import numpy as np
from shapely.geometry import Polygon
# Pad and unpack the transformation matrix to be 3x1 or 3x3,
# necessary for it to handle both rotation and translation
pad = lambda x: np.hstack([x, np.ones((x.shape[0], 1))])
unpad = lambda x: x[:, :-1]
def norm(pri):
pri = pri.copy()
pri[:, 0] = pri[:... | [
"numpy.abs",
"shapely.geometry.Polygon",
"math.sqrt",
"numpy.ones",
"numpy.array"
] | [((1474, 1490), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1482, 1490), True, 'import numpy as np\n'), ((207, 231), 'numpy.ones', 'np.ones', (['(x.shape[0], 1)'], {}), '((x.shape[0], 1))\n', (214, 231), True, 'import numpy as np\n'), ((545, 575), 'numpy.array', 'np.array', (['poly.exterior.coords'], {}... |
import pyb
# USR button is controlled using a Switch object
# This is the one closer to the center of the pyboard
sw = pyb.Switch()
led = pyb.LED(4) # 4 is the blue LED
# toggles the LED when the USR button is released
# no need for while True: statement to keep this running
# read up on interrupts to understand how ... | [
"pyb.LED",
"pyb.Switch"
] | [((120, 132), 'pyb.Switch', 'pyb.Switch', ([], {}), '()\n', (130, 132), False, 'import pyb\n'), ((139, 149), 'pyb.LED', 'pyb.LED', (['(4)'], {}), '(4)\n', (146, 149), False, 'import pyb\n')] |
# This file is being contributed to pyasn1-modules software.
#
# Created by <NAME> with assistance from the asn1ate tool, with manual
# changes to implement appropriate constraints and added comments.
# Modified by <NAME> to add maps for use with opentypes.
#
# Copyright (c) 2019, Vigil Security, LLC
# License... | [
"pyasn1.type.char.UTF8String",
"pyasn1.type.constraint.ValueRangeConstraint",
"pyasn1_modules.rfc5280.certificateExtensionsMap.update",
"pyasn1.type.constraint.PermittedAlphabetConstraint",
"pyasn1.type.tag.Tag",
"pyasn1.type.constraint.ValueSizeConstraint",
"pyasn1.type.univ.Integer",
"pyasn1.type.un... | [((1197, 1235), 'pyasn1.type.constraint.ValueSizeConstraint', 'constraint.ValueSizeConstraint', (['(1)', 'MAX'], {}), '(1, MAX)\n', (1227, 1235), False, 'from pyasn1.type import constraint\n'), ((1765, 1803), 'pyasn1.type.constraint.ValueSizeConstraint', 'constraint.ValueSizeConstraint', (['(1)', 'MAX'], {}), '(1, MAX)... |
#!/usr/bin/env python
import time
from pytest import fixture
from aci_tasks.cloud.aci_container import AciContainer
from aci_tasks.cloud.aci_container_group import AciContainerGroup
from aci_tasks.cloud.aci_resource_group import AciResourceGroup
from aci_tasks.logger import Logger
from aci_tasks.config import Co... | [
"aci_tasks.config.Config",
"pytest.fixture",
"aci_tasks.logger.Logger",
"time.sleep"
] | [((341, 379), 'pytest.fixture', 'fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (348, 379), False, 'from pytest import fixture\n'), ((1682, 1696), 'time.sleep', 'time.sleep', (['(60)'], {}), '(60)\n', (1692, 1696), False, 'import time\n'), ((421, 429), 'aci_tasks.l... |
import re
import xml.etree.ElementTree as ET
from pyplwnxml.enums import Domain, RelationType, PartOfSpeech, Qualifier, SentimentType
from pyplwnxml.utils import regex_escaped_joined_enum_values
from pyplwnxml.wordnet import LexicalUnit, Synset, Wordnet, Sentiment
class PlwnxmlParser:
__LEXICAL_RELATIONS = 'lexi... | [
"pyplwnxml.enums.SentimentType",
"xml.etree.ElementTree.parse",
"pyplwnxml.wordnet.Sentiment",
"pyplwnxml.wordnet.Wordnet",
"pyplwnxml.enums.RelationType",
"pyplwnxml.utils.regex_escaped_joined_enum_values",
"pyplwnxml.enums.Qualifier",
"re.compile"
] | [((469, 487), 're.compile', 're.compile', (['"""[,;]"""'], {}), "('[,;]')\n", (479, 487), False, 'import re\n'), ((629, 676), 'pyplwnxml.utils.regex_escaped_joined_enum_values', 'regex_escaped_joined_enum_values', (['SentimentType'], {}), '(SentimentType)\n', (661, 676), False, 'from pyplwnxml.utils import regex_escape... |
"""Unit tests for the database initialization."""
import pathlib
import unittest
from unittest.mock import Mock, mock_open, patch
from initialization.database import init_database
class DatabaseInitTest(unittest.TestCase):
"""Unit tests for database initialization."""
def setUp(self):
"""Override t... | [
"unittest.mock.patch",
"unittest.mock.mock_open",
"unittest.mock.Mock",
"initialization.database.init_database"
] | [((382, 388), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (386, 388), False, 'from unittest.mock import Mock, mock_open, patch\n'), ((413, 419), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (417, 419), False, 'from unittest.mock import Mock, mock_open, patch\n'), ((1106, 1127), 'unittest.mock.Mock', 'Mock', ([],... |
import platform
import os.path
import subprocess # nosec - see usage below
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
BIN_PATH = (
'http://download.gna.org', 'wkhtmltopdf', '0.12', '0.12.3',
'wkhtmltox-0.12.3_linux-generic-amd64.tar.xz',
)
class Com... | [
"platform.system",
"django.core.management.base.CommandError",
"subprocess.check_call"
] | [((621, 638), 'platform.system', 'platform.system', ([], {}), '()\n', (636, 638), False, 'import platform\n'), ((669, 813), 'django.core.management.base.CommandError', 'CommandError', (['"""The `wkhtmltox` command only handles linux; to install on another platform, see http://wkhtmltopdf.org/downloads.html."""'], {}), ... |
"""
A tool used to fork repositories and configure members for RISC-V
"""
import argparse
import requests
import sys
import yaml
def load_yaml(file_path):
"""
Load yaml file
:param file_path: path of the yaml file ready to load
:return: content of the file
"""
try:
with open(file_path,... | [
"argparse.ArgumentParser",
"requests.get",
"requests.put",
"requests.post",
"sys.exit"
] | [((811, 833), 'requests.get', 'requests.get', (['diff_url'], {}), '(diff_url)\n', (823, 833), False, 'import requests\n'), ((1385, 1414), 'requests.post', 'requests.post', (['fork_url', 'data'], {}), '(fork_url, data)\n', (1398, 1414), False, 'import requests\n'), ((1847, 1885), 'requests.put', 'requests.put', (['add_m... |
import os
__tests_location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__))
)
| [
"os.getcwd",
"os.path.dirname"
] | [((67, 78), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (76, 78), False, 'import os\n'), ((80, 105), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (95, 105), False, 'import os\n')] |
#!/usr/bin/python
from ctypes import CDLL
from ctypes import c_char_p, c_uint16, c_uint32
import copy
import os
__libasdd_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'libasdd.so')
__libasdd = CDLL(__libasdd_path)
def __init_fn(name, res, args):
getattr(__libasdd, name).restype = res
getat... | [
"os.path.realpath",
"ctypes.CDLL"
] | [((214, 234), 'ctypes.CDLL', 'CDLL', (['__libasdd_path'], {}), '(__libasdd_path)\n', (218, 234), False, 'from ctypes import CDLL\n'), ((159, 185), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n')] |
""" Train GIN model with or without pretrained parameters.
"""
import os
import os.path as osp
from datetime import datetime
import random
import logging
import torch
import yaml
from slgnn.configs.base import Grid, Config
from slgnn.configs.arg_parsers import ModelTrainingArgs
from slgnn.data_processing.covid19_data... | [
"slgnn.models.decoder.model.GINDecoder",
"slgnn.data_processing.utils.AtomFeaturesOneHotTransformer",
"os.path.join",
"logging.basicConfig",
"os.makedirs",
"torch.manual_seed",
"torch.load",
"yaml.dump",
"slgnn.configs.base.Config.from_dict",
"random.seed",
"slgnn.data_processing.loaders.Oversam... | [((1091, 1126), 'os.path.join', 'os.path.join', (['args.pretrained_model'], {}), '(args.pretrained_model)\n', (1103, 1126), False, 'import os\n'), ((761, 801), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (780, 801), False, 'import logging\n'), ((701, 720), ... |
"""
table_data.table_data_list
table data list
author: <NAME>
"""
from __future__ import print_function, absolute_import
from ._table_data import TableData, DummyTableData
from fem.utilities import MrSignal
from fem.utilities.error_handling import MyExceptions
from fem.utilities.debug import debuginfo, show_calle... | [
"fem.utilities.MrSignal",
"numpy.zeros",
"numpy.insert",
"numpy.copyto",
"numpy.delete"
] | [((723, 752), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'self.dtype'}), '(1, dtype=self.dtype)\n', (731, 752), True, 'import numpy as np\n'), ((774, 803), 'numpy.zeros', 'np.zeros', (['(0)'], {'dtype': 'self.dtype'}), '(0, dtype=self.dtype)\n', (782, 803), True, 'import numpy as np\n'), ((919, 929), 'fem.utilities... |
"""
运算符重载 - 自定义分数类
Version: 0.1
Author: BDFD
Date: 2018-03-12
"""
from math import gcd
class Rational(object):
def __init__(self, num, den=1):
if den == 0:
raise ValueError('分母不能为0')
self._num = num
self._den = den
self.normalize()
def simplify(self):
x ... | [
"math.gcd"
] | [((381, 390), 'math.gcd', 'gcd', (['x', 'y'], {}), '(x, y)\n', (384, 390), False, 'from math import gcd\n')] |
import hashlib
from abc import ABCMeta, abstractmethod
from enum import Enum
from core.exceptions import BaseError
class HashingAlgorithm(Enum):
SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
class HashingError(BaseError):
"""Raised in the case of... | [
"hashlib.sha256",
"hashlib.sha512"
] | [((1009, 1030), 'hashlib.sha256', 'hashlib.sha256', (['value'], {}), '(value)\n', (1023, 1030), False, 'import hashlib\n'), ((1160, 1181), 'hashlib.sha512', 'hashlib.sha512', (['value'], {}), '(value)\n', (1174, 1181), False, 'import hashlib\n')] |
from flask import render_template
from app import app, db, models
import sys
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html', title='Home')
@app.route('/contact')
def contact():
return render_template('contact.html', title='Contact')
@app.route('/faq')
def faq():
... | [
"app.models.UniqueVictims.query.all",
"app.app.route",
"flask.render_template"
] | [((80, 94), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (89, 94), False, 'from app import app, db, models\n'), ((96, 115), 'app.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (105, 115), False, 'from app import app, db, models\n'), ((187, 208), 'app.app.route', 'app.route', (['"""/cont... |
import re
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
from django.shortcuts import get_object_or_404
from .models import FoiRequest
from .filt... | [
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.utils.translation.ugettext_lazy",
"re.compile"
] | [((373, 422), 're.compile', 're.compile', (['"""[\\\\x00-\\\\x08\\\\x0B-\\\\x0C\\\\x0E-\\\\x1F]"""'], {}), "('[\\\\x00-\\\\x08\\\\x0B-\\\\x0C\\\\x0E-\\\\x1F]')\n", (383, 422), False, 'import re\n'), ((3400, 3453), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['FoiRequest'], {'slug': 'slug', 'public': '(T... |
"""
Base loss definitions
"""
from collections import OrderedDict
import copy
import torch
import torch.nn as nn
from mixmo.utils import misc, logger
LOGGER = logger.get_logger(__name__, level="DEBUG")
class AbstractLoss(nn.modules.loss._Loss):
"""
Base loss class defining printing and logging utilies
"... | [
"copy.deepcopy",
"torch.stack",
"mixmo.utils.misc.clean_update",
"torch.nn.LogSoftmax",
"mixmo.utils.logger.get_logger",
"mixmo.utils.misc.is_none",
"torch.nn.modules.loss._Loss.__init__",
"torch.pow",
"collections.OrderedDict"
] | [((161, 203), 'mixmo.utils.logger.get_logger', 'logger.get_logger', (['__name__'], {'level': '"""DEBUG"""'}), "(__name__, level='DEBUG')\n", (178, 203), False, 'from mixmo.utils import misc, logger\n'), ((566, 602), 'torch.nn.modules.loss._Loss.__init__', 'nn.modules.loss._Loss.__init__', (['self'], {}), '(self)\n', (5... |
#!/usr/bin/env python3
import re
def is_nice_string(s):
# It contains a pair of any two letters that appears at least twice
# in the string without overlapping
matches = re.findall(r"([a-zA-Z]{2}).*\1", s)
if len(matches) == 0:
return False
# It contains at least one letter which repeats... | [
"re.findall",
"re.search"
] | [((185, 220), 're.findall', 're.findall', (['"""([a-zA-Z]{2}).*\\\\1"""', 's'], {}), "('([a-zA-Z]{2}).*\\\\1', s)\n", (195, 220), False, 'import re\n'), ((372, 402), 're.search', 're.search', (['"""([a-zA-Z]).\\\\1"""', 's'], {}), "('([a-zA-Z]).\\\\1', s)\n", (381, 402), False, 'import re\n')] |
#!/usr/bin/python
import sdk_common
import slackclient
# Block in charge of notifying of a new release
class ReleaseNotifier(sdk_common.BuildStep):
def __init__(self, logger=None):
super(ReleaseNotifier, self).__init__('Release notification', logger)
self.token = self.common_config.get_config().ge... | [
"slackclient.SlackClient"
] | [((1379, 1414), 'slackclient.SlackClient', 'slackclient.SlackClient', (['self.token'], {}), '(self.token)\n', (1402, 1414), False, 'import slackclient\n')] |
import json
from gpiozero import LED
from time import sleep
from channels.generic.websocket import WebsocketConsumer
from .mailSender import MailSender
class GateTriggerConsumer(WebsocketConsumer):
def connect(self):
sleep(0.5)
self.accept()
def disconnect(self, close_code):
... | [
"gpiozero.LED",
"json.loads",
"json.dumps",
"time.sleep"
] | [((238, 248), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (243, 248), False, 'from time import sleep\n'), ((390, 411), 'json.loads', 'json.loads', (['text_data'], {}), '(text_data)\n', (400, 411), False, 'import json\n'), ((622, 647), 'gpiozero.LED', 'LED', (['(2)'], {'active_high': '(False)'}), '(2, active_high... |
import numpy as np
from .utils import p_value, create_anova_table, multiple_comparisons
class RandomizedCompleteBlockDesign:
def __init__(self, data):
self.data = np.array(data)
n_treatments, n_blocks = self.data.shape
if hasattr(self, "num_missing"):
num_missing = self.num_... | [
"numpy.nansum",
"numpy.sum",
"numpy.square",
"numpy.isnan",
"numpy.array",
"numpy.sqrt"
] | [((178, 192), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (186, 192), True, 'import numpy as np\n'), ((574, 599), 'numpy.sum', 'np.sum', (['self.data'], {'axis': '(1)'}), '(self.data, axis=1)\n', (580, 599), True, 'import numpy as np\n'), ((778, 803), 'numpy.sum', 'np.sum', (['self.data'], {'axis': '(0)'}), ... |
# Generated by Django 2.2.6 on 2019-12-28 22:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('FoodStore', '0002_auto_20191209_0246'),
]
operations = [
migrations.AddField(
model_name='foodhomepagemodel',
name='... | [
"django.db.models.BooleanField"
] | [((353, 387), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (372, 387), False, 'from django.db import migrations, models\n'), ((524, 558), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (543, 558), F... |
# Solution of;
# Project Euler Problem 564: Maximal polygons
# https://projecteuler.net/problem=564
#
# A line segment of length $2n-3$ is randomly split into $n$ segments of
# integer length ($n \ge 3$). In the sequence given by this split, the
# segments are then used as consecutive sides of a convex $n$-polygon, ... | [
"timed.caller"
] | [((1564, 1598), 'timed.caller', 'timed.caller', (['dummy', 'n', 'i', 'prob_id'], {}), '(dummy, n, i, prob_id)\n', (1576, 1598), False, 'import timed\n')] |
from datetime import datetime, timedelta
from django.test import TestCase
from mock import patch
from corehq.apps.domain.models import Domain
from corehq.apps.hqcase.utils import update_case
from corehq.apps.sms.mixin import PhoneNumberInUseException
from corehq.apps.sms.models import (
PhoneNumber,
SQLMobil... | [
"corehq.apps.sms.models.SQLMobileBackendMapping.set_default_domain_backend",
"datetime.datetime.utcnow",
"corehq.apps.sms.tasks.sync_case_phone_number",
"corehq.apps.sms.tests.util.delete_domain_phone_numbers",
"corehq.apps.sms.models.PhoneNumber.by_extensive_search",
"corehq.util.test_utils.create_test_c... | [((1620, 1664), 'corehq.apps.sms.models.PhoneNumber.get_two_way_number', 'PhoneNumber.get_two_way_number', (['phone_search'], {}), '(phone_search)\n', (1650, 1664), False, 'from corehq.apps.sms.models import PhoneNumber, SQLMobileBackend, SQLMobileBackendMapping\n'), ((1739, 1794), 'corehq.apps.sms.models.PhoneNumber.g... |
from time import sleep
from os import system
chars = "abcdefghijklmnopqrstuvwxyz1234567890"
morseCode = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", ".----", "..---", "...--... | [
"os.system",
"time.sleep"
] | [((1182, 1195), 'os.system', 'system', (['"""cls"""'], {}), "('cls')\n", (1188, 1195), False, 'from os import system\n'), ((1282, 1293), 'time.sleep', 'sleep', (['unit'], {}), '(unit)\n', (1287, 1293), False, 'from time import sleep\n'), ((1307, 1320), 'os.system', 'system', (['"""cls"""'], {}), "('cls')\n", (1313, 132... |
# -*- coding: utf-8 -*-
#================================================================
# Don't go gently into that good night.
#
# author: klaus
# description:
#
#================================================================
import os
import sys
CURRENT_FILE_DIRECTORY = os.path.abspath(os.path.dirname(__f... | [
"dlhammer.bootstrap",
"os.path.dirname",
"os.path.join",
"dlhammer.logger.info"
] | [((490, 501), 'dlhammer.bootstrap', 'bootstrap', ([], {}), '()\n', (499, 501), False, 'from dlhammer import bootstrap, logger\n'), ((503, 530), 'dlhammer.logger.info', 'logger.info', (['"""dummy output"""'], {}), "('dummy output')\n", (514, 530), False, 'from dlhammer import bootstrap, logger\n'), ((301, 326), 'os.path... |
# Generated by Django 3.1.2 on 2020-10-18 02:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rosters', '0035_auto_20200827_0124'),
]
operations = [
migrations.AlterUniqueTogether(
name='daygroupday',
unique_together={... | [
"django.db.migrations.AlterUniqueTogether"
] | [((227, 321), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""daygroupday"""', 'unique_together': "{('daygroup', 'day')}"}), "(name='daygroupday', unique_together={(\n 'daygroup', 'day')})\n", (257, 321), False, 'from django.db import migrations\n')] |
"""
Tests for snn.Input.
"""
import unittest
from unittest import mock
from unit_tests import ModuleTest
import numpy as np
from spikey.snn import input
N_STATES = 10
PROCESSING_TIME = 100
state_rate_map = np.arange(N_STATES) / N_STATES
state_spike_map = np.random.uniform(
(N_STATES, PROCESSING_TIME)
) <= state_... | [
"unittest.main",
"numpy.random.uniform",
"unittest.mock.Mock",
"numpy.arange",
"numpy.array"
] | [((209, 228), 'numpy.arange', 'np.arange', (['N_STATES'], {}), '(N_STATES)\n', (218, 228), True, 'import numpy as np\n'), ((258, 304), 'numpy.random.uniform', 'np.random.uniform', (['(N_STATES, PROCESSING_TIME)'], {}), '((N_STATES, PROCESSING_TIME))\n', (275, 304), True, 'import numpy as np\n'), ((2094, 2109), 'unittes... |
# Copyright (c) 2020 Aiven, Helsinki, Finland. https://aiven.io/
from .object_storage.gcs import GCSProvider
from argparse import ArgumentParser
from tempfile import TemporaryDirectory
import codecs
import datetime
import dateutil
import gzip
import json
import kafka
import logging
import os
import re
class KafkaRe... | [
"codecs.encode",
"dateutil.parser.parse",
"json.load",
"argparse.ArgumentParser",
"logging.basicConfig",
"tempfile.TemporaryDirectory",
"os.unlink",
"gzip.open",
"kafka.KafkaProducer",
"re.escape",
"logging.getLogger"
] | [((6103, 6199), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(name)-20s %(levelname)-8s %(message)s"""'}), "(level=logging.INFO, format=\n '%(name)-20s %(levelname)-8s %(message)s')\n", (6122, 6199), False, 'import logging\n'), ((6209, 6225), 'argparse.ArgumentParse... |
# -*- coding: utf-8 -*-
# vim: ts=2 sw=2 et ai
###############################################################################
# Copyright (c) 2012,2013-2021 <NAME> <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Soft... | [
"hashlib.md5",
"avnav_handlerList.registerHandler"
] | [((11450, 11502), 'avnav_handlerList.registerHandler', 'avnav_handlerList.registerHandler', (['AVNUserAppHandler'], {}), '(AVNUserAppHandler)\n', (11483, 11502), False, 'import avnav_handlerList\n'), ((3515, 3528), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (3526, 3528), False, 'import hashlib\n')] |
#!/usr/bin/env python3
# coding: utf-8
# Sort and Clean award data.
# It writes to `sorted_data.yml` and `cleaned_data.yml`, copy those to the papers.yml after screening.
import yaml
import datetime
import sys
from shutil import copyfile
from builtins import input
# import pytz
import pdb
try:
# for python new... | [
"sys.stdout.write",
"yaml.load",
"yaml.dump",
"yaml.Loader.add_constructor",
"builtins.input",
"datetime.datetime.utcnow",
"datetime.datetime.strptime",
"yaml.Dumper.add_representer"
] | [((871, 924), 'yaml.Dumper.add_representer', 'Dumper.add_representer', (['OrderedDict', 'dict_representer'], {}), '(OrderedDict, dict_representer)\n', (893, 924), False, 'from yaml import Loader, Dumper\n'), ((925, 979), 'yaml.Loader.add_constructor', 'Loader.add_constructor', (['_mapping_tag', 'dict_constructor'], {})... |
"""hka import operator
"""
import os
import subprocess
import bpy
from bpy.props import BoolProperty
from bpy_extras.io_utils import ImportHelper
from .hka_import import import_hkafile
class hkaImportOperator(bpy.types.Operator, ImportHelper):
"""Import a hkaAnimationContainer file
"""
bl_idname = "imp... | [
"bpy.props.BoolProperty",
"subprocess.run",
"os.path.abspath",
"os.path.basename",
"os.path.splitext",
"bpy.props.StringProperty"
] | [((408, 469), 'bpy.props.StringProperty', 'bpy.props.StringProperty', ([], {'default': '"""*.hkx"""', 'options': "{'HIDDEN'}"}), "(default='*.hkx', options={'HIDDEN'})\n", (432, 469), False, 'import bpy\n'), ((485, 590), 'bpy.props.BoolProperty', 'BoolProperty', ([], {'name': '"""Import to Animation"""', 'description':... |
from django.dispatch import Signal
# Sent right after user is created
facebook_user_registered = Signal(providing_args=['user', 'facebook_data'])
# Sent after user is created, before profile is updated with data from Facebook
facebook_pre_update = Signal(providing_args=['profile', 'facebook_data'])
facebook_post_upd... | [
"django.dispatch.Signal"
] | [((99, 147), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['user', 'facebook_data']"}), "(providing_args=['user', 'facebook_data'])\n", (105, 147), False, 'from django.dispatch import Signal\n'), ((251, 302), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['profile', 'facebook_data']"}), "... |
import sys
import base64
import json
import os.path
if len(sys.argv) < 3:
print("USAGE: pdfp-extract.py [pdf_path] [output_path]")
sys.exit()
f = open(sys.argv[1], 'rb')
pdf = f.read()
f.close()
pdfp = {}
pdfp['slide'] = os.path.split(sys.argv[1])[1][:-4]
pdfp['pdf'] = base64.b64encode(pdf).decode('utf-8')... | [
"base64.b64encode",
"sys.exit",
"json.dumps"
] | [((141, 151), 'sys.exit', 'sys.exit', ([], {}), '()\n', (149, 151), False, 'import sys\n'), ((283, 304), 'base64.b64encode', 'base64.b64encode', (['pdf'], {}), '(pdf)\n', (299, 304), False, 'import base64\n'), ((329, 345), 'json.dumps', 'json.dumps', (['pdfp'], {}), '(pdfp)\n', (339, 345), False, 'import json\n')] |
# -*- coding: utf-8 -*-
import argparse
import os
import mmap
import re
import pip
import io
from pip._internal.utils.misc import get_installed_distributions
from pathlib import Path
def install(package):
if hasattr(pip, 'main'):
pip.main(['install', package])
else:
pip._internal.main(['instal... | [
"argparse.ArgumentParser",
"re.finditer",
"pip._internal.utils.misc.get_installed_distributions",
"pip.main",
"pip._internal.main",
"pathlib.Path",
"io.open",
"googletrans.Translator",
"re.sub"
] | [((690, 719), 'pip._internal.utils.misc.get_installed_distributions', 'get_installed_distributions', ([], {}), '()\n', (717, 719), False, 'from pip._internal.utils.misc import get_installed_distributions\n'), ((826, 851), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (849, 851), False, 'import... |
"""
Django settings for inventory project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
im... | [
"os.path.abspath",
"logging.getLogger",
"django.core.exceptions.ImproperlyConfigured",
"logging.basicConfig"
] | [((3813, 3874), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': 'logFormatter'}), '(level=logging.DEBUG, format=logFormatter)\n', (3832, 3874), False, 'import logging\n'), ((3884, 3905), 'logging.getLogger', 'logging.getLogger', (['""""""'], {}), "('')\n", (3901, 3905), False, 'i... |
import sshclient
from launch_db import get_constellation_data
from launch_db import log_msg
def log(msg, channel=__name__, severity="info"):
log_msg(msg, channel, severity)
def run_tc_command(constellation_name, machine_name_key,
keyPairName,
ip_address_key,
... | [
"launch_db.get_constellation_data",
"launch_db.log_msg",
"sshclient.SshClient"
] | [((147, 178), 'launch_db.log_msg', 'log_msg', (['msg', 'channel', 'severity'], {}), '(msg, channel, severity)\n', (154, 178), False, 'from launch_db import log_msg\n'), ((407, 449), 'launch_db.get_constellation_data', 'get_constellation_data', (['constellation_name'], {}), '(constellation_name)\n', (429, 449), False, '... |
# -*- coding: utf-8 -*-
"""
@Author : Horizon
@Date : 2021-03-28 15:54:32
"""
import os
import cv2
import json
import random
import argparse
import matplotlib.pyplot as plt
def get_msvd_item(msvd_path, anno):
question = anno['question']
answer = anno['answer']
video_id = anno['video_... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"json.load",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"random.randint",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.figure",
"os.path.join"
] | [((501, 545), 'cv2.cvtColor', 'cv2.cvtColor', (['first_frame', 'cv2.COLOR_BGR2RGB'], {}), '(first_frame, cv2.COLOR_BGR2RGB)\n', (513, 545), False, 'import cv2\n'), ((662, 711), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""check data"""'}), "(description='check data')\n", (685, 711), Fa... |
# Landsat Util
# License: CC0 1.0 Universal
"""Tests for search"""
import unittest
from jsonschema import validate
from landsat.search import Search
from tests import geojson_schema
class TestSearchHelper(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.s = Search()
def test_search(... | [
"unittest.main",
"jsonschema.validate",
"landsat.search.Search"
] | [((4741, 4756), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4754, 4756), False, 'import unittest\n'), ((290, 298), 'landsat.search.Search', 'Search', ([], {}), '()\n', (296, 298), False, 'from landsat.search import Search\n'), ((1777, 1809), 'jsonschema.validate', 'validate', (['result', 'geojson_schema'], {})... |
'''
@author - mrdrivingduck
@version - 2018.12.31
@function -
The sniffer thread.
Pushing the captured packets into buffer.
'''
import threading
import json
from serverglob import conf
from serverglob import buff
from logger import serverLogger
from message.packetmessage import PacketMessa... | [
"message.packetmessage.PacketMessage",
"logger.serverLogger.warning",
"serverglob.buff.length",
"serverglob.buff.push"
] | [((829, 896), 'message.packetmessage.PacketMessage', 'PacketMessage', (['src_mac', 'dst_mac', 'src_ip', 'dst_ip', 'src_port', 'dst_port'], {}), '(src_mac, dst_mac, src_ip, dst_ip, src_port, dst_port)\n', (842, 896), False, 'from message.packetmessage import PacketMessage\n'), ((917, 940), 'serverglob.buff.push', 'buff.... |
#
# Copyright 2013 Intel
#
# 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, sof... | [
"ceilometer.sample.Sample.from_notification",
"oslo_log.log.getLogger",
"oslo_utils.timeutils.parse_strtime",
"ceilometer.i18n._"
] | [((830, 853), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (843, 853), False, 'from oslo_log import log\n'), ((2094, 2382), 'ceilometer.sample.Sample.from_notification', 'sample.Sample.from_notification', ([], {'name': "('compute.node.%s' % self.metric)", 'type': 'self.sample_type', 'u... |
import pandas as pd
import tensorflow as tf
from gluonnlp.data import PadSequence
from gluonnlp import Vocab
from tensorflow.keras.preprocessing.sequence import pad_sequences
from typing import Tuple
from configs import FLAGS
class Corpus():
def __init__(self, vocab, tokenizer):
self._vocab = vocab
... | [
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tensorflow.io.decode_csv",
"tensorflow.convert_to_tensor"
] | [((406, 475), 'tensorflow.io.decode_csv', 'tf.io.decode_csv', (['item'], {'record_defaults': "[[''], [0]]", 'field_delim': '"""\t"""'}), "(item, record_defaults=[[''], [0]], field_delim='\\t')\n", (422, 475), True, 'import tensorflow as tf\n'), ((638, 759), 'tensorflow.keras.preprocessing.sequence.pad_sequences', 'pad_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy import and_
from .common import Base, session_scope
class GoalieGame(Base):
__tablename__ = 'goalie_games'
__autoload__ = True
HUMAN_READABLE = 'goalie game'
STANDARD_ATTRS = [
"no", "shots_against", "goals_against", "saves", "e... | [
"sqlalchemy.and_"
] | [((1257, 1327), 'sqlalchemy.and_', 'and_', (['(GoalieGame.game_id == game_id)', '(GoalieGame.player_id == player_id)'], {}), '(GoalieGame.game_id == game_id, GoalieGame.player_id == player_id)\n', (1261, 1327), False, 'from sqlalchemy import and_\n')] |
# Generated by Django 3.1.2 on 2020-10-27 20:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_auto_20201023_2211'),
]
operations = [
migrations.AlterField(
model_name='userdetail',
name='city',... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((339, 381), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'null': '(True)'}), '(max_length=30, null=True)\n', (355, 381), False, 'from django.db import migrations, models\n'), ((506, 536), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n'... |
import threading
import requests
# encryption
import Encrypt
import unicodedata
from ttk import Style, Button, Label, Entry, Progressbar, Checkbutton
from Tkinter import Tk, Frame, RIGHT, BOTH, RAISED
from Tkinter import TOP, X, N, LEFT
from Tkinter import END, Listbox, MULTIPLE
from Tkinter import Toplevel, DISABLE... | [
"Tkinter.Tk",
"multiprocessing.Queue",
"ttk.Progressbar",
"unicodedata.normalize",
"threading.Thread.__init__",
"random.randint",
"Tkinter.Listbox",
"Tkinter.StringVar",
"requests.session",
"ttk.Label",
"ttk.Entry",
"Tkinter.Toplevel",
"Encrypt.encrypt",
"Tkinter.Scrollbar",
"Tkinter.Fra... | [((18809, 18813), 'Tkinter.Tk', 'Tk', ([], {}), '()\n', (18811, 18813), False, 'from Tkinter import Tk, Frame, RIGHT, BOTH, RAISED\n'), ((1604, 1622), 'requests.session', 'requests.session', ([], {}), '()\n', (1620, 1622), False, 'import requests\n'), ((1932, 1939), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (... |
from collections.abc import Mapping
import numpy as np
from pickydict import PickyDict
from .utils import load_known_key_conversions
_key_regex_replacements = {r"\s": "_",
r"[!?.,;:]": ""}
_key_replacements = load_known_key_conversions()
class Metadata:
"""Class to handle spectrum met... | [
"pickydict.PickyDict"
] | [((1791, 1804), 'pickydict.PickyDict', 'PickyDict', (['{}'], {}), '({})\n', (1800, 1804), False, 'from pickydict import PickyDict\n'), ((1874, 1893), 'pickydict.PickyDict', 'PickyDict', (['metadata'], {}), '(metadata)\n', (1883, 1893), False, 'from pickydict import PickyDict\n'), ((4285, 4304), 'pickydict.PickyDict', '... |
#!/usr/bin/env python3
# Requires PyAudio and PySpeech and more.
import speech_recognition as sr
from time import ctime
import time
import os
from gtts import gTTS
import random
from pygame import mixer
from pyicloud import PyiCloudService
from datetime import date
import re
from re import findall, finditer
from urlli... | [
"gtts.gTTS",
"pygame.mixer.init",
"time.ctime",
"os.system",
"pygame.mixer.music.play",
"speech_recognition.Microphone",
"datetime.date.today",
"urllib.request.urlopen",
"re.findall",
"pygame.mixer.music.load",
"pyicloud.PyiCloudService",
"speech_recognition.Recognizer"
] | [((422, 474), 'pyicloud.PyiCloudService', 'PyiCloudService', (['"""icloudemail.com"""', '"""icloudPassword"""'], {}), "('icloudemail.com', 'icloudPassword')\n", (437, 474), False, 'from pyicloud import PyiCloudService\n'), ((546, 561), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (559, 561), True... |
import re
from typing import NamedTuple
from adventofcode2020.utils.abstract import FileReaderSolution
class PassPol(NamedTuple):
at_least: int
at_most: int
letter: str
password: str
class Day02:
@staticmethod
def split(input_password) -> PassPol:
"""
Input `7-9 r: rrrkrrrrr... | [
"re.match"
] | [((387, 440), 're.match', 're.match', (['"""(\\\\d*)-(\\\\d*) (.): (\\\\w*)"""', 'input_password'], {}), "('(\\\\d*)-(\\\\d*) (.): (\\\\w*)', input_password)\n", (395, 440), False, 'import re\n')] |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import glob
import pickle
# read in all the images in the calibration folder
calib_images = glob.glob(".\camera_cal\*.jpg")
#define chess board parameters:
nx = 9
ny = 6
# Arrays to store image point and opbject points
imgpoints = []
objpoints = []
def g... | [
"cv2.findChessboardCorners",
"cv2.cvtColor",
"numpy.zeros",
"cv2.imread",
"cv2.calibrateCamera",
"glob.glob"
] | [((155, 188), 'glob.glob', 'glob.glob', (['""".\\\\camera_cal\\\\*.jpg"""'], {}), "('.\\\\camera_cal\\\\*.jpg')\n", (164, 188), False, 'import glob\n'), ((518, 552), 'numpy.zeros', 'np.zeros', (['(nx * ny, 3)', 'np.float32'], {}), '((nx * ny, 3), np.float32)\n', (526, 552), True, 'import numpy as np\n'), ((800, 837), '... |
def rotcir(ns):
lista = [ns]
for i in range(len(ns) - 1):
a = ns[0]
ns = ns[1:len(ns)+1]
ns += a
lista.append(ns)
return(lista)
def cyclic_number(ns):
rotaciones = rotcir(ns)
for n in range(1, len(ns)):
Ns = str(n*int(ns))
while len(Ns) != len(ns):
Ns = '0' + Ns
if Ns not in rotaciones:
ret... | [
"itertools.product"
] | [((392, 433), 'itertools.product', 'itertools.product', (['"""0123456789"""'], {'repeat': 'n'}), "('0123456789', repeat=n)\n", (409, 433), False, 'import itertools\n')] |
import setuptools
import urllib.request
DESCRIPTION = 'A standardized collection of python libs and tools'
try:
with open('README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
except FileNotFoundError:
LONG_DESCRIPTION = DESCRIPTION
try:
with open('VERSION', 'r') as f:
VERSION = f.read()
e... | [
"setuptools.find_packages"
] | [((1398, 1455), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""', 'exclude': "['tests*']"}), "(where='src', exclude=['tests*'])\n", (1422, 1455), False, 'import setuptools\n')] |
# =============================================================================
# Step1: Input
# =============================================================================
import numpy as np
from PyLMDI import PyLMDI
if __name__=='__main__':
#--- Step1: Input
Ct = 794.6119504871361 # Carbon emi... | [
"numpy.array",
"PyLMDI.PyLMDI"
] | [((983, 1005), 'PyLMDI.PyLMDI', 'PyLMDI', (['Ct', 'C0', 'Xt', 'X0'], {}), '(Ct, C0, Xt, X0)\n', (989, 1005), False, 'from PyLMDI import PyLMDI\n'), ((815, 849), 'numpy.array', 'np.array', (['[Pt, gt, st, it, et, kt]'], {}), '([Pt, gt, st, it, et, kt])\n', (823, 849), True, 'import numpy as np\n'), ((870, 904), 'numpy.a... |
import logging
import os
import pprint
from googleads import ad_manager
from dfp.client import get_client
logger = logging.getLogger(__name__)
def create_creatives(creatives):
"""
Creates creatives in DFP.
Args:
creatives (arr): an array of objects, each a creative configuration
Returns:
an array... | [
"os.path.dirname",
"logging.getLogger",
"dfp.client.get_client"
] | [((120, 147), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'import logging\n'), ((376, 388), 'dfp.client.get_client', 'get_client', ([], {}), '()\n', (386, 388), False, 'from dfp.client import get_client\n'), ((1081, 1106), 'os.path.dirname', 'os.path.dirname', (['__f... |
from rest_framework.viewsets import ModelViewSet
from .models import Profile, Group
from .serializers import ProfileSerializers, GroupSerializers
from rest_framework.response import Response
from rest_framework.decorators import action
from itertools import chain
class ProfileViewSet(ModelViewSet):
serializer_cla... | [
"rest_framework.response.Response",
"rest_framework.decorators.action",
"itertools.chain"
] | [((575, 612), 'rest_framework.decorators.action', 'action', ([], {'methods': "['post']", 'detail': '(True)'}), "(methods=['post'], detail=True)\n", (581, 612), False, 'from rest_framework.decorators import action\n'), ((993, 1032), 'rest_framework.decorators.action', 'action', ([], {'methods': "['delete']", 'detail': '... |
from influxdb import InfluxDBClient
class InfluxConnection:
points = []
def __init__(self):
self.points = []
self.host = "host"
self.port = "port"
self.username = "user"
self.password = "<PASSWORD>"
self.database = "base"
self.client = InfluxDBClient(se... | [
"influxdb.InfluxDBClient"
] | [((303, 389), 'influxdb.InfluxDBClient', 'InfluxDBClient', (['self.host', 'self.port', 'self.username', 'self.password', 'self.database'], {}), '(self.host, self.port, self.username, self.password, self.\n database)\n', (317, 389), False, 'from influxdb import InfluxDBClient\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.