code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
'''
Author: <NAME>
Description:
Autocolorization
'''
import cv2
image = cv2.imread('data/original.png')
cv2.imshow('original',image)
cv2.waitKey(0)
cv2.destroyAllWindows()
image = cv2.cvtColor(image, cv2.COLOR_BGR2LAB)
cv2.imshow('lab',image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('lab2b... | [
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread"
] | [((91, 122), 'cv2.imread', 'cv2.imread', (['"""data/original.png"""'], {}), "('data/original.png')\n", (101, 122), False, 'import cv2\n'), ((123, 152), 'cv2.imshow', 'cv2.imshow', (['"""original"""', 'image'], {}), "('original', image)\n", (133, 152), False, 'import cv2\n'), ((152, 166), 'cv2.waitKey', 'cv2.waitKey', (... |
'''
Create a list of tables with different features such as:
- number of columns
- number of rows
- number of words per cell
- contains a specific word
- ...
A column 'is_table' is computed from the features to predict if a table is an actual table.
Majority of extracted tables are not actual and table, but simpl... | [
"pandas.read_csv",
"re.compile",
"os.path.join",
"os.path.split",
"pandas.DataFrame",
"re.sub",
"re.findall",
"pandas.concat"
] | [((4813, 4839), 'pandas.DataFrame', 'pd.DataFrame', (['feature_list'], {}), '(feature_list)\n', (4825, 4839), True, 'import pandas as pd\n'), ((4849, 4889), 'pandas.concat', 'pd.concat', (['[tables, features_df]'], {'axis': '(1)'}), '([tables, features_df], axis=1)\n', (4858, 4889), True, 'import pandas as pd\n'), ((12... |
"""Computation of quadrature points and weights for different schemes.
Attributes
----------
DEFAULT_COLLOCATION_POINTS_MAX : int
Constant default limitation on the maximum number of collocation points
per mesh section that a user can specify. The value of 20 has been chosen
as above this the algorithms th... | [
"numpy.insert",
"numpy.linalg.solve",
"numpy.ones",
"numpy.hstack",
"numpy.delete",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.count_nonzero",
"numpy.concatenate",
"numpy.polynomial.legendre.Legendre",
"pyproprop.Options"
] | [((1165, 1233), 'pyproprop.Options', 'Options', (['(GAUSS, LOBATTO, RADAU)'], {'default': 'LOBATTO', 'unsupported': 'GAUSS'}), '((GAUSS, LOBATTO, RADAU), default=LOBATTO, unsupported=GAUSS)\n', (1172, 1233), False, 'from pyproprop import Options\n'), ((4125, 4170), 'numpy.polynomial.legendre.Legendre', 'np.polynomial.l... |
"""Provides utilities for creating and working with Databases in ESPEI
"""
import logging
from typing import Dict, Union
import sympy
from pycalphad import Database, variables as v
import espei.refdata
from espei.utils import extract_aliases
_log = logging.getLogger(__name__)
def _get_ser_data(element, ref_state, fa... | [
"logging.getLogger",
"pycalphad.variables.Species",
"espei.utils.extract_aliases",
"pycalphad.Database"
] | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((2808, 2837), 'espei.utils.extract_aliases', 'extract_aliases', (['phase_models'], {}), '(phase_models)\n', (2823, 2837), False, 'from espei.utils import extract_aliases\n'), ((2658, 2668... |
#!/usr/bin/python3
'''
NAME:
lf_json_test.py
PURPOSE:
EXAMPLE:
./lf_json_test.py -
NOTES:
TO DO NOTES:
'''
import os
import sys
if sys.version_info[0] != 3:
print("This script requires Python3")
exit()
from time import sleep
import argparse
import json
#if 'py-json' not in sys.path:
# sys.path.ap... | [
"os.path.abspath",
"argparse.ArgumentParser",
"LANforge.lf_json_autogen.LFJsonGet"
] | [((754, 1494), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""lf_json_test.py"""', 'formatter_class': 'argparse.RawTextHelpFormatter', 'epilog': '""" lf_json_test.py : lf json test\n """', 'description': '"""lf_json_test.py\n-----------\n\nSummary :\n---------\n\n\n./lf_da... |
from django.shortcuts import render,redirect
# Create your views here.
from django.http import HttpResponse
from django.http import JsonResponse
import requests
import json
def getResponseProducts(request):
try:
getResponse = requests.get('https://testbankapi.firebaseio.com/products.json')
arrayJson = list... | [
"django.shortcuts.render",
"django.http.JsonResponse",
"json.dumps",
"requests.get",
"requests.delete",
"django.shortcuts.redirect"
] | [((486, 563), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'arrayJson': arrayJson, 'sumvalue': sumvalue}"], {}), "(request, 'index.html', {'arrayJson': arrayJson, 'sumvalue': sumvalue})\n", (492, 563), False, 'from django.shortcuts import render, redirect\n'), ((2062, 2082), 'requests.delete'... |
"""
Certificate service
"""
import logging
from django.core.exceptions import ObjectDoesNotExist
from opaque_keys.edx.keys import CourseKey
from lms.djangoapps.certificates.generation_handler import is_on_certificate_allowlist
from lms.djangoapps.certificates.models import GeneratedCertificate
from lms.djangoapps.u... | [
"logging.getLogger",
"lms.djangoapps.utils._get_key",
"lms.djangoapps.certificates.models.GeneratedCertificate.objects.get",
"lms.djangoapps.certificates.generation_handler.is_on_certificate_allowlist"
] | [((348, 375), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (365, 375), False, 'import logging\n'), ((697, 734), 'lms.djangoapps.utils._get_key', '_get_key', (['course_key_or_id', 'CourseKey'], {}), '(course_key_or_id, CourseKey)\n', (705, 734), False, 'from lms.djangoapps.utils import _... |
import marshmallow
import pytest
from marshmallow import fields
from queue_messaging.data import structures
class FancyModelSchema(marshmallow.Schema):
uuid_field = fields.UUID(required=True)
string_field = fields.String(required=False)
class FancyModel(structures.Model):
class Meta:
schema = F... | [
"pytest.raises",
"marshmallow.fields.String",
"marshmallow.fields.UUID"
] | [((172, 198), 'marshmallow.fields.UUID', 'fields.UUID', ([], {'required': '(True)'}), '(required=True)\n', (183, 198), False, 'from marshmallow import fields\n'), ((218, 247), 'marshmallow.fields.String', 'fields.String', ([], {'required': '(False)'}), '(required=False)\n', (231, 247), False, 'from marshmallow import f... |
from line import Line
from matrix import Matrix
def str_to_point(str):
p = str.split(',')
point = (int(p[0]),int(p[1]))
return point
def process_file():
lines = open('input','r').readlines()
rects = []
for line in lines:
parts = line.split("->")
p1 = str_to_point(parts[0])
... | [
"line.Line",
"matrix.Matrix"
] | [((443, 451), 'matrix.Matrix', 'Matrix', ([], {}), '()\n', (449, 451), False, 'from matrix import Matrix\n'), ((377, 389), 'line.Line', 'Line', (['p1', 'p2'], {}), '(p1, p2)\n', (381, 389), False, 'from line import Line\n')] |
import visa
import numpy as np
class Agilent54845A:
def __init__(self,instrument,chan_num=1):
"""
Default constructor only requires direct access to the underlyign visa
handler. See the method fromResourceManager for a more user-friendly way
of constructing the class.
"""
... | [
"numpy.array",
"numpy.sqrt",
"numpy.abs"
] | [((5140, 5173), 'numpy.array', 'np.array', (['query[1:7]'], {'dtype': 'float'}), '(query[1:7], dtype=float)\n', (5148, 5173), True, 'import numpy as np\n'), ((5345, 5379), 'numpy.array', 'np.array', (['query[8:14]'], {'dtype': 'float'}), '(query[8:14], dtype=float)\n', (5353, 5379), True, 'import numpy as np\n'), ((554... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = [
dict(doctype='Item', item_code='Food Item 1',
item_group='Products', is_stock_item=0),
dict(doctype='Item', item_cod... | [
"frappe.get_doc",
"frappe.db.get_value"
] | [((1132, 1193), 'frappe.get_doc', 'frappe.get_doc', (['"""Restaurant Menu"""', '"""Test Restaurant 1 Menu 1"""'], {}), "('Restaurant Menu', 'Test Restaurant 1 Menu 1')\n", (1146, 1193), False, 'import frappe\n'), ((1220, 1281), 'frappe.get_doc', 'frappe.get_doc', (['"""Restaurant Menu"""', '"""Test Restaurant 1 Menu 2"... |
# Generated by Django 3.1.4 on 2021-01-09 17:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('beers', '0034_matchfiltercollab'),
]
operations = [
migrations.DeleteModel(
name='MatchFilterCollab',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((236, 284), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""MatchFilterCollab"""'}), "(name='MatchFilterCollab')\n", (258, 284), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python3
import argparse
import pickle
import numpy as np
import os.path
from tqdm import tqdm
from props import getNode
from lib import matcher
from lib import match_cleanup
from lib import project
# Reset all match point locations to their original direct
# georeferenced locations based on estimated... | [
"lib.match_cleanup.link_matches",
"lib.match_cleanup.check_for_pair_dups",
"argparse.ArgumentParser",
"lib.matcher.Matcher",
"lib.match_cleanup.make_match_structure",
"lib.project.ProjectMgr",
"lib.match_cleanup.merge_duplicates",
"lib.match_cleanup.check_for_1vn_dups"
] | [((383, 442), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Keypoint projection."""'}), "(description='Keypoint projection.')\n", (406, 442), False, 'import argparse\n'), ((532, 549), 'lib.matcher.Matcher', 'matcher.Matcher', ([], {}), '()\n', (547, 549), False, 'from lib import matcher... |
import torch
import torch.nn as nn
import physics_aware_training.digital_twin_utils
class SplitInputParameterNet(nn.Module):
def __init__(self,
input_dim,
nparams,
output_dim,
parameterNunits = [100,100,100],
internalNunits =... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.relu",
"torch.nn.Linear",
"torch.bmm",
"torch.zeros"
] | [((1782, 1803), 'torch.nn.Sequential', 'torch.nn.Sequential', ([], {}), '()\n', (1801, 1803), False, 'import torch\n'), ((2533, 2572), 'torch.nn.Linear', 'nn.Linear', (['input_dim', 'internalNunits[0]'], {}), '(input_dim, internalNunits[0])\n', (2542, 2572), True, 'import torch.nn as nn\n'), ((2594, 2635), 'torch.nn.Li... |
'''
Provider for dataset
'''
import os
import os.path
import numpy as np
import time
class SceneflowDataset():
def __init__(self, root='/tmp/FlyingThings3D_subset_processed_35m', npoints=8192, mode = 'train_ft3d'):
self.npoints = npoints
self.mode = mode
self.root = root
if se... | [
"os.listdir",
"numpy.logical_and",
"numpy.random.choice",
"numpy.where",
"numpy.logical_not",
"os.path.join",
"numpy.logical_or",
"os.walk",
"os.path.split",
"os.path.dirname",
"numpy.random.seed",
"numpy.load",
"os.path.expanduser"
] | [((895, 912), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (909, 912), True, 'import numpy as np\n'), ((1120, 1147), 'os.path.join', 'os.path.join', (['fn', '"""pc1.npy"""'], {}), "(fn, 'pc1.npy')\n", (1132, 1147), False, 'import os\n'), ((1161, 1188), 'os.path.join', 'os.path.join', (['fn', '"""pc2.n... |
import numpy as np
import pandas as pd
import torch
import torchvision
from am_utils.utils import walk_dir
from torch.utils.data import DataLoader
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from tqdm import tqdm
from ..dataset.dataset_object_inference import DatasetObjectInference, DatasetO... | [
"numpy.round_",
"torch.load",
"tqdm.tqdm",
"torchvision.models.detection.faster_rcnn.FastRCNNPredictor",
"am_utils.utils.walk_dir",
"torch.tensor",
"torchvision.models.detection.fasterrcnn_resnet50_fpn",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"pandas.DataFrame",
"pandas.concat... | [((931, 950), 'am_utils.utils.walk_dir', 'walk_dir', (['input_dir'], {}), '(input_dir)\n', (939, 950), False, 'from am_utils.utils import walk_dir\n'), ((1014, 1044), 'pandas.DataFrame', 'pd.DataFrame', (['{id_name: files}'], {}), '({id_name: files})\n', (1026, 1044), True, 'import pandas as pd\n'), ((1681, 1782), 'tor... |
# coding: utf-8
import os
from unittest import TestCase
class TestCsvFormatter(TestCase):
filename = '/tmp/test_csv_formatter_write.txt'
def setUp(self):
if os.path.exists(self.filename):
os.remove(self.filename)
tearDown = setUp
def _get_class(self, *args, **kwargs):
fr... | [
"os.path.exists",
"datafactory.formatters.csv.CsvFormatter",
"os.remove"
] | [((176, 205), 'os.path.exists', 'os.path.exists', (['self.filename'], {}), '(self.filename)\n', (190, 205), False, 'import os\n'), ((385, 414), 'datafactory.formatters.csv.CsvFormatter', 'CsvFormatter', (['*args'], {}), '(*args, **kwargs)\n', (397, 414), False, 'from datafactory.formatters.csv import CsvFormatter\n'), ... |
# pylint: disable=wrong-import-position, wrong-import-order, invalid-name
"""
Invoke build script.
Show all tasks with::
invoke -l
.. seealso::
* http://pyinvoke.org
* https://github.com/pyinvoke/invoke
"""
###############################################################################
# Catch exceptions an... | [
"logging.getLogger",
"invoke.Collection"
] | [((857, 876), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (874, 876), False, 'import logging\n'), ((883, 895), 'invoke.Collection', 'Collection', ([], {}), '()\n', (893, 895), False, 'from invoke import Collection, Context, Config\n')] |
from random import randint
from cowait.worker.worker_node import WorkerNode
from .html_logger import HTMLLogger
class NotebookNode(WorkerNode):
"""
The Notebook Node is a variant of the standard worker node meant to run in a notebook.
It simulates a running task by connecting upstream and forwarding event... | [
"random.randint"
] | [((717, 738), 'random.randint', 'randint', (['(10000)', '(60000)'], {}), '(10000, 60000)\n', (724, 738), False, 'from random import randint\n')] |
"""
Pure Python implementation of the kernel functions
"""
import numpy as np
from scipy.special import erf
from utils import numpy_trans, numpy_trans_idx
s2pi = np.sqrt(2.0 * np.pi)
s2 = np.sqrt(2.0)
@numpy_trans
def norm1d_pdf(z, out):
"""
Full-python implementation of :py:func:`normal_kernel1d.pdf`
... | [
"numpy.multiply",
"numpy.sqrt",
"numpy.power",
"numpy.exp",
"scipy.special.erf",
"numpy.isfinite",
"numpy.empty",
"numpy.divide",
"numpy.atleast_1d"
] | [((165, 185), 'numpy.sqrt', 'np.sqrt', (['(2.0 * np.pi)'], {}), '(2.0 * np.pi)\n', (172, 185), True, 'import numpy as np\n'), ((191, 203), 'numpy.sqrt', 'np.sqrt', (['(2.0)'], {}), '(2.0)\n', (198, 203), True, 'import numpy as np\n'), ((1354, 1373), 'numpy.sqrt', 'np.sqrt', (['(35.0 / 243)'], {}), '(35.0 / 243)\n', (13... |
#!/usr/bin/env python3
import gym
import ptan
import argparse
import random
import numpy as np
import torch
import torch.optim as optim
import torch.nn.functional as F
from ignite.engine import Engine
from lib import common, dqn_extra
NAME = "07_distrib"
def calc_loss(batch, net, tgt_net, gamma, device="cpu"):
... | [
"ignite.engine.Engine",
"gym.make",
"ptan.actions.EpsilonGreedyActionSelector",
"argparse.ArgumentParser",
"lib.dqn_extra.distr_projection",
"lib.dqn_extra.DistributionalDQN",
"lib.common.EpsilonTracker",
"ptan.agent.TargetNet",
"lib.common.batch_generator",
"torch.nn.functional.log_softmax",
"p... | [((379, 405), 'lib.common.unpack_batch', 'common.unpack_batch', (['batch'], {}), '(batch)\n', (398, 405), False, 'from lib import common, dqn_extra\n'), ((954, 1020), 'lib.dqn_extra.distr_projection', 'dqn_extra.distr_projection', (['next_best_distr', 'rewards', 'dones', 'gamma'], {}), '(next_best_distr, rewards, dones... |
# coding: utf-8
"""
Scubawhere API Documentation
This is the documentation for scubawhere's RMS API. This API is only to be used by authorized parties with valid auth tokens. [Learn about scubawhere](http://www.scubawhere.com) to become an authorized consumer of our API
OpenAPI spec version: 1.0.0
... | [
"six.iteritems"
] | [((4678, 4705), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (4687, 4705), False, 'from six import iteritems\n'), ((10568, 10595), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (10577, 10595), False, 'from six import iteritems\n'), ((16156, 16183)... |
import os
target_path = 'groundtruths'
mirror_path = 'detections'
files = []
for (dirpath, dirnames, filenames) in os.walk(target_path):
if len(dirnames) == 0:
files.extend([f_name for f_name in filenames])
# print(files[:10])
for filename in files:
mirror = os.path.join(mirror_path, filename)
if... | [
"os.path.exists",
"os.path.join",
"os.walk",
"os.remove"
] | [((117, 137), 'os.walk', 'os.walk', (['target_path'], {}), '(target_path)\n', (124, 137), False, 'import os\n'), ((278, 313), 'os.path.join', 'os.path.join', (['mirror_path', 'filename'], {}), '(mirror_path, filename)\n', (290, 313), False, 'import os\n'), ((321, 343), 'os.path.exists', 'os.path.exists', (['mirror'], {... |
# Generated by Django 3.1 on 2021-07-30 07:00
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import sunnysouth.lib.models
clas... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.JSONField",
"django.db.models.BooleanField",
"django.d... | [((10857, 10949), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'through': '"""marketplace.PurchaseProduct"""', 'to': '"""marketplace.Product"""'}), "(through='marketplace.PurchaseProduct', to=\n 'marketplace.Product')\n", (10879, 10949), False, 'from django.db import migrations, models\n'), ((... |
from django.db import models
from django.utils import timezone
from pymongo import MongoClient
from django.core.validators import MaxValueValidator, MinValueValidator
from decimal import Decimal
client = MongoClient()
db = client.test # base de datos
restaurantes = db.restaurants # colección
clas... | [
"pymongo.MongoClient",
"django.db.models.TextField",
"decimal.Decimal",
"django.db.models.CharField"
] | [((205, 218), 'pymongo.MongoClient', 'MongoClient', ([], {}), '()\n', (216, 218), False, 'from pymongo import MongoClient\n'), ((590, 635), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(200)', 'blank': '(False)'}), '(max_length=200, blank=False)\n', (606, 635), False, 'from django.db import mo... |
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='192.168.13.201'))
channel = connection.channel()
channel.exchange_declare(exchange='logs',
exchange_type='fanout')
result = channel.queue_declare(exclusive=True, queue='')
queue_name = result.method.que... | [
"pika.ConnectionParameters"
] | [((50, 98), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""192.168.13.201"""'}), "(host='192.168.13.201')\n", (75, 98), False, 'import pika\n')] |
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
# author:CT
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.utils.data import Dataset, DataLoader
class MNIST(nn.Module):
"""
main block
"""
def __init__(self):
super().__init__()
... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.Softmax",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.randn"
] | [((1880, 1905), 'torch.randn', 'torch.randn', (['(3)', '(1)', '(28)', '(28)'], {}), '(3, 1, 28, 28)\n', (1891, 1905), False, 'import torch\n'), ((1375, 1409), 'torch.nn.init.kaiming_normal_', 'init.kaiming_normal_', (['layer.weight'], {}), '(layer.weight)\n', (1395, 1409), True, 'import torch.nn.init as init\n'), ((141... |
#!/usr/bin/env python3
#return classes the student is enrolled in,
#return the current assignments for each of those classes
import StudentData
import CourseData
class WebData:
def __init__(self, studentID):
self._studentID=studentID
self._student_data=StudentData.StudentData()
self._course_data... | [
"StudentData.StudentData",
"CourseData.CourseData"
] | [((271, 296), 'StudentData.StudentData', 'StudentData.StudentData', ([], {}), '()\n', (294, 296), False, 'import StudentData\n'), ((321, 344), 'CourseData.CourseData', 'CourseData.CourseData', ([], {}), '()\n', (342, 344), False, 'import CourseData\n')] |
# encoding: utf-8
import logging
log = logging.getLogger(__name__)
def metadata_standard_show(context, data_dict):
return {'success': True}
def metadata_schema_show(context, data_dict):
return {'success': True}
def infrastructure_show(context, data_dict):
return {'success': True}
def metadata_coll... | [
"logging.getLogger"
] | [((41, 68), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (58, 68), False, 'import logging\n')] |
from django.shortcuts import render, redirect
from django.http import HttpResponse
# Create your views here.
from .models import GuessNumbers
from .forms import PostForm
def index(request):
lottos = GuessNumbers.objects.all()
return render(request, "lotto/default.html", {"lottos": lottos})
def post(request):... | [
"django.shortcuts.render",
"django.shortcuts.redirect"
] | [((243, 300), 'django.shortcuts.render', 'render', (['request', '"""lotto/default.html"""', "{'lottos': lottos}"], {}), "(request, 'lotto/default.html', {'lottos': lottos})\n", (249, 300), False, 'from django.shortcuts import render, redirect\n'), ((755, 809), 'django.shortcuts.render', 'render', (['request', '"""lotto... |
import os
import shutil
import ntpath
import csv
import itertools as IT
def check_if_directory_exists(dir_path):
return os.path.isdir(dir_path)
def check_if_file_exists(file_path):
return os.path.isfile(file_path)
def make_directory(directory_path):
is_successful = True
try:
os.mkdir(direct... | [
"ntpath.basename",
"os.listdir",
"os.scandir",
"os.path.join",
"os.path.splitext",
"csv.writer",
"os.path.isfile",
"os.path.isdir",
"os.mkdir",
"shutil.rmtree",
"csv.reader",
"ntpath.split"
] | [((125, 148), 'os.path.isdir', 'os.path.isdir', (['dir_path'], {}), '(dir_path)\n', (138, 148), False, 'import os\n'), ((199, 224), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (213, 224), False, 'import os\n'), ((1148, 1166), 'ntpath.split', 'ntpath.split', (['path'], {}), '(path)\n', (116... |
from app import Application
if __name__ == '__main__':
Application.run()
| [
"app.Application.run"
] | [((62, 79), 'app.Application.run', 'Application.run', ([], {}), '()\n', (77, 79), False, 'from app import Application\n')] |
"""Generate constants files from the Unicorn headers.
This is heavily borrowed from the script in the Unicorn source repo, except modified to
work with an installed library rather than from the source code. The headers must be
present, but that's all that's required.
"""
import ast
import collections
import datetime
... | [
"logging.basicConfig",
"collections.OrderedDict",
"re.match",
"logging.warning",
"ast.literal_eval",
"datetime.datetime.now",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"logging.info",
"logging.error"
] | [((1425, 1450), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1448, 1450), False, 'import collections\n'), ((5869, 5897), 'os.path.abspath', 'os.path.abspath', (['header_file'], {}), '(header_file)\n', (5884, 5897), False, 'import os\n'), ((5902, 5950), 'logging.info', 'logging.info', (['"""P... |
import secrets
import os
# Values in this file are loaded into the flask app instance, `demo.APP` in this
# demo. This file sources values from the environment if they exist, otherwise a
# set of defaults are used. This is useful for keeping secrets secret, as well
# as facilitating configuration in a container. Defau... | [
"secrets.token_hex",
"os.environ.get"
] | [((519, 560), 'os.environ.get', 'os.environ.get', (['"""IP"""'], {'default': '"""127.0.0.1"""'}), "('IP', default='127.0.0.1')\n", (533, 560), False, 'import os\n'), ((568, 604), 'os.environ.get', 'os.environ.get', (['"""PORT"""'], {'default': '(5000)'}), "('PORT', default=5000)\n", (582, 604), False, 'import os\n'), (... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for skipping signature validation on old blocks.
Test logic for skipping signature validati... | [
"test_framework.script.CScript",
"test_framework.mininode.network_thread_join",
"test_framework.mininode.CTransaction",
"test_framework.mininode.msg_block",
"test_framework.mininode.CBlockHeader",
"test_framework.mininode.msg_headers",
"time.sleep",
"test_framework.key.CECKey",
"test_framework.minin... | [((2320, 2333), 'test_framework.mininode.msg_headers', 'msg_headers', ([], {}), '()\n', (2331, 2333), False, 'from test_framework.mininode import CBlockHeader, COutPoint, CTransaction, CTxIn, CTxOut, network_thread_join, network_thread_start, P2PInterface, msg_block, msg_headers\n'), ((4266, 4288), 'test_framework.mini... |
# -*- coding: utf-8 -*-
import unittest
from nose.tools import raises
import torch
from kraken.lib import layers
class TestLayers(unittest.TestCase):
"""
Testing custom layer implementations.
"""
def setUp(self):
torch.set_grad_enabled(False)
def test_maxpool(self):
"""
... | [
"kraken.lib.layers.TransposedSummarizingRNN",
"kraken.lib.layers.Dropout",
"kraken.lib.layers.LinSoftmax",
"kraken.lib.layers.MaxPool",
"torch.set_grad_enabled",
"kraken.lib.layers.ActConv2D",
"torch.randn"
] | [((242, 271), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (264, 271), False, 'import torch\n'), ((374, 404), 'kraken.lib.layers.MaxPool', 'layers.MaxPool', (['(3, 3)', '(2, 2)'], {}), '((3, 3), (2, 2))\n', (388, 404), False, 'from kraken.lib import layers\n'), ((600, 622), 'krake... |
#
# Copyright (c) 2016, SUSE LLC 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 above copyright notice, this
# list of conditions and the follow... | [
"logging.getLogger",
"handson.myyaml.stanza"
] | [((1580, 1607), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1597, 1607), False, 'import logging\n'), ((1803, 1822), 'handson.myyaml.stanza', 'stanza', (['"""delegates"""'], {}), "('delegates')\n", (1809, 1822), False, 'from handson.myyaml import stanza\n'), ((2337, 2356), 'handson.myy... |
"""
Cirrus
======
Handle Cirrus data.
"""
import csv
import io
import re
import pandas as pd
def read_csv_cirrus(filename): # pylint: disable=too-many-locals
"""Read a Cirrus CSV file. Currently exists support for some types of
CSV files extracted with NoiseTools. There is no support for CSVs related
... | [
"pandas.read_csv",
"csv.Sniffer",
"re.sub",
"io.StringIO",
"pandas.to_datetime",
"re.search"
] | [((928, 956), 're.sub', 're.sub', (['""" dB"""', '""""""', 'csvreader'], {}), "(' dB', '', csvreader)\n", (934, 956), False, 'import re\n'), ((2790, 2869), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': '[[0, 1]]', 'sep': 'separator', 'decimal': 'decimal_sep'}), '(filename, parse_dates=[[0, 1]], sep=s... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Configuration file (powered by YACS)."""
import os
from pycls.core.io import pathmgr
from yacs.config import CfgN... | [
"pycls.core.io.pathmgr.open",
"os.path.join",
"yacs.config.CfgNode"
] | [((399, 408), 'yacs.config.CfgNode', 'CfgNode', ([], {}), '()\n', (406, 408), False, 'from yacs.config import CfgNode\n'), ((520, 529), 'yacs.config.CfgNode', 'CfgNode', ([], {}), '()\n', (527, 529), False, 'from yacs.config import CfgNode\n'), ((1153, 1162), 'yacs.config.CfgNode', 'CfgNode', ([], {}), '()\n', (1160, 1... |
# Copyright (c) 2019 PaddlePaddle 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 app... | [
"parl.remote.Master",
"parl.remote.Worker",
"argparse.ArgumentParser"
] | [((1238, 1263), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1261, 1263), False, 'import argparse\n'), ((928, 940), 'parl.remote.Master', 'Master', (['port'], {}), '(port)\n', (934, 940), False, 'from parl.remote import Master, Worker\n'), ((1105, 1129), 'parl.remote.Worker', 'Worker', (['ad... |
"""
Combat Manager. This is where the magic happens. And by magic,
we mean characters dying, most likely due to vile sorcery.
The Combat Manager is invoked by a character starting combat
with the +fight command. Anyone set up as a defender of either
of those two characters is pulled into combat automatically.
Otherwis... | [
"operator.attrgetter",
"evennia.utils.utils.fill",
"typeclasses.scripts.combat.state_handler.CombatantStateHandler",
"typeclasses.scripts.combat.combat_settings.CombatError",
"server.utils.arx_utils.list_to_string",
"server.utils.prettytable.PrettyTable",
"traceback.print_exc",
"time.time",
"evennia... | [((9754, 9845), 'server.utils.prettytable.PrettyTable', 'PrettyTable', (["['{wCombatant{n', '{wDamage{n', '{wFatigue{n', '{wAction{n', '{wReady?{n']"], {}), "(['{wCombatant{n', '{wDamage{n', '{wFatigue{n', '{wAction{n',\n '{wReady?{n'])\n", (9765, 9845), False, 'from server.utils.prettytable import PrettyTable\n'), ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 22 23:31:26 2018
@author: <NAME>
@title: MNIST Image classification using RNN - LSTM
Developed as part of Cognitive Class - Deep Learning with Tensorflow class
"""
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import matplotlib.pyplot as plt
i... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.split",
"tensorflow.nn.dynamic_rnn",
"tensorflow.global_variables_initializer",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.argmax",
"tensorflo... | [((232, 265), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (255, 265), False, 'import warnings\n'), ((410, 454), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""."""'], {'one_hot': '(True)'}), "('.', one_hot=True)\n", (... |
# -*- coding: utf-8 -*-
# Copyright (c) The python-semanticversion project
# This code is distributed under the two-clause BSD License.
from __future__ import unicode_literals
import unittest
import sys
import semantic_version
from .setup_django import django_loaded
if django_loaded: # pragma: no cover
from ... | [
"semantic_version.django_fields.SpecField",
"django.core.serializers.deserialize",
"django.core.management.call_command",
"unittest.skipIf",
"django.test.runner.DiscoverRunner",
"django.db.connection.cursor",
"unittest.SkipTest",
"django.db.connection.introspection.get_table_list",
"django.test.util... | [((1881, 1939), 'unittest.skipIf', 'unittest.skipIf', (['(not django_loaded)', '"""Django not installed"""'], {}), "(not django_loaded, 'Django not installed')\n", (1896, 1939), False, 'import unittest\n'), ((7128, 7186), 'unittest.skipIf', 'unittest.skipIf', (['(not django_loaded)', '"""Django not installed"""'], {}),... |
#!/usr/bin/env python3
from include import QtPorting as QP
from qtpy import QtWidgets as QW
from qtpy import QtCore as QC
import locale
try: locale.setlocale( locale.LC_ALL, '' )
except: pass
from include import HydrusConstants as HC
from include import HydrusData
from include import HydrusGlobals as HG
from include... | [
"include.TestController.Controller",
"include.QtPorting.CallAfter",
"qtpy.QtWidgets.QApplication",
"traceback.format_exc",
"locale.setlocale",
"include.QtPorting.MonkeyPatchMissingMethods",
"twisted.internet.reactor.callFromThread",
"qtpy.QtWidgets.QWidget",
"threading.Thread",
"include.QtPorting.... | [((143, 178), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '""""""'], {}), "(locale.LC_ALL, '')\n", (159, 178), False, 'import locale\n'), ((747, 777), 'include.QtPorting.MonkeyPatchMissingMethods', 'QP.MonkeyPatchMissingMethods', ([], {}), '()\n', (775, 777), True, 'from include import QtPorting as QP\n'... |
import re
import sys
class BColors:
def __init__(self):
pass
# FOREGROUND
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
RESET = '\033[39m'
# SPECIAL
HEADER = '\0... | [
"re.split",
"sys.stdout.write"
] | [((4493, 4524), 'sys.stdout.write', 'sys.stdout.write', (['BColors.GREEN'], {}), '(BColors.GREEN)\n', (4509, 4524), False, 'import sys\n'), ((5132, 5163), 'sys.stdout.write', 'sys.stdout.write', (['BColors.RESET'], {}), '(BColors.RESET)\n', (5148, 5163), False, 'import sys\n'), ((962, 981), 're.split', 're.split', (['"... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import numpy as np
__all__ = ['raises', 'assert_equal', 'assert_almost_equal',
'assert_true', 'setup_function', 'teardown_function',
'has_isnan']
CWD = os.getcwd()
TEST_DIR = os.path.dirname(__file__)
has_isnan = Tru... | [
"os.chdir",
"os.path.dirname",
"numpy.allclose",
"os.getcwd"
] | [((255, 266), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (264, 266), False, 'import os\n'), ((278, 303), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (293, 303), False, 'import os\n'), ((566, 584), 'os.chdir', 'os.chdir', (['TEST_DIR'], {}), '(TEST_DIR)\n', (574, 584), False, 'import os\n'... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import asyncio
import logging
import os
import pathlib
import subprocess
import sys
import tempfile
fr... | [
"logging.getLogger",
"logging.basicConfig",
"subprocess.Popen",
"os.environ.get",
"fbpcp.service.storage.StorageService.path_type",
"os.getcwd",
"tempfile.NamedTemporaryFile",
"fbpcs.private_computation.service.run_binary_base_service.RunBinaryBaseService.wait_for_containers_async"
] | [((842, 927), 'os.environ.get', 'os.environ.get', (['"""CPP_UNION_PID_PREPARER_PATH"""', '"""cpp_bin/union_pid_data_preparer"""'], {}), "('CPP_UNION_PID_PREPARER_PATH', 'cpp_bin/union_pid_data_preparer'\n )\n", (856, 927), False, 'import os\n'), ((1474, 1501), 'logging.getLogger', 'logging.getLogger', (['__name__'],... |
import heapq
import itertools as itt
import operator as op
from collections import OrderedDict, UserDict, defaultdict
from .array import Array
from .optional import Nothing, Some
from .repr import short_repr
from .row import KeyValue, Row
from .stream import Stream
def identity(_): return _
class Map(OrderedDict):... | [
"operator.itemgetter",
"collections.defaultdict"
] | [((11997, 12013), 'collections.defaultdict', 'defaultdict', (['Map'], {}), '(Map)\n', (12008, 12013), False, 'from collections import OrderedDict, UserDict, defaultdict\n'), ((18899, 18915), 'operator.itemgetter', 'op.itemgetter', (['(1)'], {}), '(1)\n', (18912, 18915), True, 'import operator as op\n'), ((19394, 19410)... |
#!/usr/bin/python
#
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ..module_utils.dict_utils import equal_dicts, merge_dicts, copy_dict
from ..module_utils.module import BlockchainModule
from ..module_utils.proto_utils import proto_to... | [
"json.load",
"ansible.module_utils._text.to_native"
] | [((4034, 4049), 'json.load', 'json.load', (['file'], {}), '(file)\n', (4043, 4049), False, 'import json\n'), ((5865, 5877), 'ansible.module_utils._text.to_native', 'to_native', (['e'], {}), '(e)\n', (5874, 5877), False, 'from ansible.module_utils._text import to_native\n')] |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 <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 restriction,
# including without limitat... | [
"time.sleep",
"PyQt5.QtWidgets.QTreeWidget.__init__",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtCore.QThread.__init__",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QTreeWidget.keyPressEvent",
"electrum_trc.logging.get_logger",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets... | [((1889, 1909), 'electrum_trc.logging.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (1899, 1909), False, 'from electrum_trc.logging import get_logger\n'), ((21242, 21260), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['object'], {}), '(object)\n', (21252, 21260), False, 'from PyQt5.QtCore import Qt, pyqtS... |
"""bootcamp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | [
"django.conf.urls.static.static",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((1007, 1038), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (1010, 1038), False, 'from django.conf.urls import include, url\n'), ((1118, 1157), 'django.conf.urls.url', 'url', (['"""^$"""', 'core_views.home'], {'name': '"""home"""'}), "('^$', core_views.ho... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from typing import Iterable
import torch
from ._base_schedule import BaseSchedule
from colossalai.utils import conditional_context
class NonPipelineSchedule(BaseSchedule):
"""A helper schedule class for no pipeline parallelism running environment.
During one ... | [
"torch.no_grad"
] | [((2089, 2104), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2102, 2104), False, 'import torch\n')] |
from __future__ import unicode_literals
import os
import sys
import urllib
import datetime
import logging
import subprocess
import eeUtil
import time
import requests
import json
# url for bleaching alert data
SOURCE_URL = 'ftp://ftp.star.nesdis.noaa.gov/pub/sod/mecb/crw/data/5km/v3.1/nc/v1.0/daily/baa-max-7d/{year}/ct... | [
"logging.debug",
"requests.patch",
"time.sleep",
"datetime.timedelta",
"logging.info",
"eeUtil.uploadAssets",
"logging.error",
"os.remove",
"eeUtil.exists",
"urllib.request.urlretrieve",
"json.dumps",
"subprocess.call",
"eeUtil.removeAsset",
"eeUtil.ls",
"os.path.splitext",
"requests.g... | [((3538, 3558), 'requests.get', 'requests.get', (['apiUrl'], {}), '(apiUrl)\n', (3550, 3558), False, 'import requests\n'), ((3960, 4015), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['nofrag', '"""%Y-%m-%dT%H:%M:%S"""'], {}), "(nofrag, '%Y-%m-%dT%H:%M:%S')\n", (3986, 4015), False, 'import datetime\n'),... |
import argparse
import os
import pydub
def convert_file(file_path, _format, start=None, end=None, out=None):
filename, file_extension = os.path.splitext(file_path)
audio = pydub.audio_segment.AudioSegment.from_file(file_path)
start = int(start) if start is not None else 0
end = int(end) if end is not... | [
"os.listdir",
"argparse.ArgumentParser",
"pydub.audio_segment.AudioSegment.from_file",
"os.path.splitext",
"os.path.join",
"os.path.split",
"os.path.isfile",
"os.path.isdir"
] | [((143, 170), 'os.path.splitext', 'os.path.splitext', (['file_path'], {}), '(file_path)\n', (159, 170), False, 'import os\n'), ((183, 236), 'pydub.audio_segment.AudioSegment.from_file', 'pydub.audio_segment.AudioSegment.from_file', (['file_path'], {}), '(file_path)\n', (225, 236), False, 'import pydub\n'), ((1235, 1299... |
#!/usr/bin/python
"""
ZetCode PyQt6 tutorial
In the example, we draw randomly 1000 red points
on the window.
Author: <NAME>
Website: zetcode.com
"""
from PyQt6.QtWidgets import QWidget, QApplication
from PyQt6.QtGui import QPainter
from PyQt6.QtCore import Qt
import sys, random
class Example(QWidget):
def __... | [
"PyQt6.QtGui.QPainter",
"PyQt6.QtWidgets.QApplication"
] | [((963, 985), 'PyQt6.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (975, 985), False, 'from PyQt6.QtWidgets import QWidget, QApplication\n'), ((593, 603), 'PyQt6.QtGui.QPainter', 'QPainter', ([], {}), '()\n', (601, 603), False, 'from PyQt6.QtGui import QPainter\n')] |
# -*- coding: utf-8 -*-
'''
Created on 2016年2月19日
一些json的处理方法
@author: hzwangzhiwei
'''
from datetime import date
from datetime import datetime
import json
class CJsonEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.strftime('%Y-%m-%d %H:%M:%S')
... | [
"json.loads",
"json.dumps",
"json.JSONEncoder.default"
] | [((577, 610), 'json.dumps', 'json.dumps', (['obj'], {'cls': 'CJsonEncoder'}), '(obj, cls=CJsonEncoder)\n', (587, 610), False, 'import json\n'), ((707, 727), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (717, 727), False, 'import json\n'), ((429, 464), 'json.JSONEncoder.default', 'json.JSONEncoder.def... |
# encoding: utf-8
import os
import csv
from pylab import *
from numpy import *
def loadData(name):
# DATADIR='sav/'
DATADIR='/home/zhenfeng/Research/GroupEvolution/src/code201611-MZ/sav/'
if name == 'allGroups':
G={}
fpath=DATADIR+'gids-all.csv'
csvfile=open(fpath, 'rb')
dat... | [
"csv.reader"
] | [((324, 358), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (334, 358), False, 'import csv\n'), ((673, 707), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (683, 707), False, 'import csv\n'), ((1025, 1059), 'csv.rea... |
from torchvision import transforms
import torch
import torchvision.transforms.functional as TF
class RandomHorizontalFlip:
def __init__(self, p):
self.p = p
def __call__(self, sample):
image, target = sample
if torch.rand(1) < self.p:
image = transforms.RandomHorizontal... | [
"torchvision.transforms.RandomVerticalFlip",
"torchvision.transforms.functional.rotate",
"torchvision.transforms.RandomHorizontalFlip",
"torch.rand"
] | [((249, 262), 'torch.rand', 'torch.rand', (['(1)'], {}), '(1)\n', (259, 262), False, 'import torch\n'), ((560, 573), 'torch.rand', 'torch.rand', (['(1)'], {}), '(1)\n', (570, 573), False, 'import torch\n'), ((870, 883), 'torch.rand', 'torch.rand', (['(1)'], {}), '(1)\n', (880, 883), False, 'import torch\n'), ((914, 935... |
import platform
import scipy
import numpy as np
import math
from scipy import integrate
from scipy import optimize as opt
from scipy.stats import gamma
from colorama import init, Fore, Back, Style
from cell import Cell
class PopSimulator:
def __init__(self, ncells, gr, sb, steps, CV2div = 0, CV2gr = 0, lamb=1, V0... | [
"numpy.random.rand",
"numpy.log",
"numpy.array",
"math.trunc",
"scipy.stats.gamma.pdf",
"numpy.diff",
"numpy.exp",
"platform.system",
"numpy.random.gamma",
"cell.Cell",
"numpy.concatenate",
"numpy.min",
"numpy.argmin",
"numpy.round",
"scipy.stats.gamma.cdf",
"numpy.trapz",
"numpy.ran... | [((6301, 6334), 'scipy.optimize.bisect', 'opt.bisect', (['self.opti', '(0.001)', '(1.5)'], {}), '(self.opti, 0.001, 1.5)\n', (6311, 6334), True, 'from scipy import optimize as opt\n'), ((15927, 15943), 'numpy.zeros_like', 'np.zeros_like', (['u'], {}), '(u)\n', (15940, 15943), True, 'import numpy as np\n'), ((16557, 165... |
"""
file: simple_gen.py
author: <NAME>
date: 17 May 2020
notes: a most basic implementation of genetic cross breeding and mutation to attempt to improve
a neural network. Assumes the standard Keras model from Donkeycar project.
Lower score means less loss = better.
"""
import argparse
import json
import... | [
"numpy.tril_indices_from",
"argparse.ArgumentParser",
"tensorflow.keras.models.model_from_json",
"numpy.absolute",
"warnings.catch_warnings",
"tensorflow.logging.set_verbosity",
"numpy.array",
"os.path.dirname",
"numpy.random.uniform",
"json.load",
"time.time",
"warnings.filterwarnings",
"os... | [((600, 642), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (624, 642), True, 'import tensorflow as tf\n'), ((482, 507), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (505, 507), False, 'import warnings\n'), ((513, 570), 'wa... |
import nexussdk as nexus
prod = "https://bbp.epfl.ch/nexus/v1/"
staging = 'https://bbp-nexus.epfl.ch/staging/v1'
token = open('token.txt', 'r').read().strip()
nexus.config.set_token(token)
nexus.config.set_environment(staging)
# DEV with Github token
# token = open('token-gh.txt', 'r').read().strip()
# nexus.config... | [
"nexussdk.tools.pretty_print",
"nexussdk.config.set_environment",
"nexussdk.config.set_token",
"nexussdk.views.query_sparql"
] | [((162, 191), 'nexussdk.config.set_token', 'nexus.config.set_token', (['token'], {}), '(token)\n', (184, 191), True, 'import nexussdk as nexus\n'), ((192, 229), 'nexussdk.config.set_environment', 'nexus.config.set_environment', (['staging'], {}), '(staging)\n', (220, 229), True, 'import nexussdk as nexus\n'), ((2949, 2... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid blocks.
In this test we connect to one node over p2p, and test block re... | [
"test_framework.blocktools.create_transaction",
"copy.deepcopy",
"test_framework.mininode.network_thread_start",
"test_framework.blocktools.create_coinbase",
"test_framework.mininode.P2PDataStore"
] | [((1270, 1292), 'test_framework.mininode.network_thread_start', 'network_thread_start', ([], {}), '()\n', (1290, 1292), False, 'from test_framework.mininode import network_thread_start, P2PDataStore\n'), ((2658, 2710), 'test_framework.blocktools.create_transaction', 'create_transaction', (['block1.vtx[0]', '(0)', "b''"... |
"""
Support for covers which integrate with other components.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.template/
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.cover import ... | [
"logging.getLogger",
"voluptuous.Inclusive",
"voluptuous.Required",
"voluptuous.Exclusive",
"homeassistant.helpers.event.async_track_state_change",
"voluptuous.Schema",
"homeassistant.helpers.script.Script",
"homeassistant.helpers.entity.async_generate_entity_id",
"voluptuous.Optional"
] | [((1107, 1134), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1124, 1134), False, 'import logging\n'), ((1753, 1799), 'voluptuous.Inclusive', 'vol.Inclusive', (['OPEN_ACTION', 'CONF_OPEN_OR_CLOSE'], {}), '(OPEN_ACTION, CONF_OPEN_OR_CLOSE)\n', (1766, 1799), True, 'import voluptuous as vo... |
# Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# https://opensource.org/licenses/BSD-3-Clause
# Unless required by appl... | [
"turbo_transformers.BertOutput.from_torch",
"torch.abs",
"transformers.modeling_bert.BertOutput",
"turbo_transformers.config.is_compiled_with_cuda",
"transformers.modeling_bert.BertConfig",
"torch.set_num_threads",
"os.path.dirname",
"torch.cuda.is_available",
"test_helper.run_model",
"unittest.ma... | [((828, 853), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (843, 853), False, 'import os\n'), ((4160, 4175), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4173, 4175), False, 'import unittest\n'), ((1215, 1244), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '... |
import os
import glob
import pickle
import pcl
import torch
import torch.utils.data
import torch.nn as nn
import numpy as np
# global configurations:
from autolab_core import YamlConfig
from dexnet.grasping import GpgGraspSampler
from dexnet.grasping import RobotGripper
home_dir = os.environ['HOME']
yaml_config = Ya... | [
"dexnet.grasping.GpgGraspSampler",
"numpy.hstack",
"torch.initial_seed",
"numpy.array",
"numpy.linalg.norm",
"numpy.sin",
"pcl.PointCloud",
"autolab_core.YamlConfig",
"mayavi.mlab.points3d",
"mayavi.mlab.pipeline.open",
"numpy.cross",
"numpy.where",
"numpy.delete",
"numpy.dot",
"numpy.vs... | [((318, 389), 'autolab_core.YamlConfig', 'YamlConfig', (["(home_dir + '/Projects/PointNetGPD/dex-net/test/config.yaml')"], {}), "(home_dir + '/Projects/PointNetGPD/dex-net/test/config.yaml')\n", (328, 389), False, 'from autolab_core import YamlConfig\n'), ((428, 521), 'dexnet.grasping.RobotGripper.load', 'RobotGripper.... |
# -*- coding: utf-8 -*-
import pytest
from django.core.urlresolvers import reverse
from pontoon.administration.forms import (
ProjectForm,
)
from pontoon.administration.views import _create_or_update_translated_resources
from pontoon.base.models import (
Entity,
Locale,
Project,
ProjectLocale,
... | [
"pontoon.test.factories.LocaleFactory.create",
"pontoon.test.factories.TranslationFactory.create",
"pontoon.administration.views._create_or_update_translated_resources",
"pontoon.base.models.Project.objects.get",
"pontoon.test.factories.UserFactory.create",
"pontoon.base.models.Entity.for_project_locale",... | [((597, 659), 'pontoon.test.factories.ProjectFactory.create', 'ProjectFactory.create', ([], {'data_source': '"""database"""', 'repositories': '[]'}), "(data_source='database', repositories=[])\n", (618, 659), False, 'from pontoon.test.factories import EntityFactory, LocaleFactory, ProjectFactory, ResourceFactory, Trans... |
# -*- coding: utf-8 -*-
#
# This file is part of the python-chess library.
# Copyright (C) 2012-2019 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | [
"mmap.mmap",
"re.compile",
"chess.square_file",
"chess.popcount",
"os.listdir",
"collections.deque",
"chess.scan_forward",
"threading.Lock",
"threading.RLock",
"threading.Condition",
"math.factorial",
"os.close",
"os.path.splitext",
"os.path.isfile",
"struct.Struct",
"chess.square_rank... | [((1048, 1067), 'struct.Struct', 'struct.Struct', (['""">Q"""'], {}), "('>Q')\n", (1061, 1067), False, 'import struct\n'), ((1077, 1096), 'struct.Struct', 'struct.Struct', (['"""<I"""'], {}), "('<I')\n", (1090, 1096), False, 'import struct\n'), ((1109, 1128), 'struct.Struct', 'struct.Struct', (['""">I"""'], {}), "('>I'... |
from materializationengine.models import AnalysisTable, AnalysisVersion
from flask_marshmallow import Marshmallow
from marshmallow import fields, ValidationError, Schema
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
ma = Marshmallow()
class AnalysisVersionSchema(SQLAlchemyAutoSchema):
class Meta:
... | [
"flask_marshmallow.Marshmallow",
"marshmallow.fields.Str",
"marshmallow.ValidationError"
] | [((232, 245), 'flask_marshmallow.Marshmallow', 'Marshmallow', ([], {}), '()\n', (243, 245), False, 'from flask_marshmallow import Marshmallow\n'), ((794, 819), 'marshmallow.fields.Str', 'fields.Str', ([], {'required': '(True)'}), '(required=True)\n', (804, 819), False, 'from marshmallow import fields, ValidationError, ... |
import os
import jwt
import time
import unittest
from django.conf import settings
from django.test import RequestFactory
from sparrow_cloud.middleware.acl_middleware import ACLMiddleware
from django.http import JsonResponse
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.mock_settings"
def token():
private_key = ... | [
"django.test.RequestFactory",
"django.http.JsonResponse",
"unittest.main",
"sparrow_cloud.middleware.acl_middleware.ACLMiddleware",
"time.time",
"jwt.encode"
] | [((550, 601), 'jwt.encode', 'jwt.encode', (['payload', 'private_key'], {'algorithm': '"""RS256"""'}), "(payload, private_key, algorithm='RS256')\n", (560, 601), False, 'import jwt\n'), ((678, 694), 'django.test.RequestFactory', 'RequestFactory', ([], {}), '()\n', (692, 694), False, 'from django.test import RequestFacto... |
# Adafruit PN532 NFC/RFID control library.
# Author: <NAME>
#
# The MIT License (MIT)
#
# Copyright (c) 2015-2018 Adafruit Industries
#
# 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... | [
"adafruit_bus_device.spi_device.SPIDevice",
"time.monotonic",
"time.sleep",
"micropython.const"
] | [((1796, 1804), 'micropython.const', 'const', (['(2)'], {}), '(2)\n', (1801, 1804), False, 'from micropython import const\n'), ((1841, 1849), 'micropython.const', 'const', (['(1)'], {}), '(1)\n', (1846, 1849), False, 'from micropython import const\n'), ((1886, 1894), 'micropython.const', 'const', (['(3)'], {}), '(3)\n'... |
import configargparse
from lxml import etree, objectify
from rich import console
from rich.console import Console
import importlib.metadata
import re
__version__ = importlib.metadata.version('camel-xml2dsl')
ns = {"camel": "http://camel.apache.org/schema/spring"}
console = Console()
class Converter:
def __init__(... | [
"configargparse.ArgParser",
"rich.console.Console",
"lxml.objectify.parse",
"lxml.etree.XMLParser",
"re.sub",
"rich.console.log"
] | [((275, 284), 'rich.console.Console', 'Console', ([], {}), '()\n', (282, 284), False, 'from rich.console import Console\n'), ((394, 488), 'configargparse.ArgParser', 'configargparse.ArgParser', ([], {'description': "('Transforms xml routes to dsl routes ' + __version__)"}), "(description='Transforms xml routes to dsl r... |
# Text Classifiation using NLP
# Importing the libraries
import numpy as np
import re
import pickle
import nltk
from nltk.corpus import stopwords
from sklearn.datasets import load_files
nltk.download('stopwords')
# Importing the dataset
reviews = load_files('txt_sentoken/')
X,y = reviews.data,reviews.target
# Pic... | [
"pickle.dump",
"pickle.load",
"sklearn.datasets.load_files",
"nltk.download"
] | [((188, 214), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (201, 214), False, 'import nltk\n'), ((251, 278), 'sklearn.datasets.load_files', 'load_files', (['"""txt_sentoken/"""'], {}), "('txt_sentoken/')\n", (261, 278), False, 'from sklearn.datasets import load_files\n'), ((535, 552),... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.modules.admin.views import WPAdmin
from indico.util.i... | [
"indico.util.i18n._"
] | [((473, 482), 'indico.util.i18n._', '_', (['"""News"""'], {}), "('News')\n", (474, 482), False, 'from indico.util.i18n import _\n')] |
'''
@FileName : data_parser.py
@EditTime : 2021-11-29 13:59:47
@Author : <NAME>
@Email : <EMAIL>
@Description :
'''
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import sys
import os
import os.path as osp
import platform
import json... | [
"os.path.exists",
"collections.namedtuple",
"os.listdir",
"numpy.ones",
"os.path.join",
"numpy.max",
"numpy.array",
"numpy.zeros",
"torch.tensor",
"platform.system",
"numpy.concatenate",
"json.load"
] | [((452, 516), 'collections.namedtuple', 'namedtuple', (['"""Keypoints"""', "['keypoints', 'gender_gt', 'gender_pd']"], {}), "('Keypoints', ['keypoints', 'gender_gt', 'gender_pd'])\n", (462, 516), False, 'from collections import namedtuple\n'), ((676, 703), 'os.path.exists', 'os.path.exists', (['keypoint_fn'], {}), '(ke... |
"""View tests for the mailer app"""
# pylint: disable=no-value-for-parameter,invalid-name
from django.http import Http404
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from model_mommy import mommy
from mock import Mock, patch
from open_connect.accounts.utils import ... | [
"django.test.RequestFactory",
"model_mommy.mommy.make",
"mock.patch",
"django.test.utils.override_settings",
"open_connect.accounts.utils.generate_nologin_hash",
"mock.Mock",
"open_connect.mailer.views.UnsubscribeView.as_view",
"open_connect.mailer.models.Unsubscribe.objects.filter",
"open_connect.m... | [((611, 653), 'django.test.utils.override_settings', 'override_settings', ([], {'EMAIL_SECRET_KEY': '"""abcd"""'}), "(EMAIL_SECRET_KEY='abcd')\n", (628, 653), False, 'from django.test.utils import override_settings\n'), ((1676, 1722), 'mock.patch', 'patch', (['"""open_connect.mailer.views.create_open"""'], {}), "('open... |
#!/usr/bin/env python
"""
Tool for combining and converting paths within catalog files
"""
import sys
import json
import argparse
from glob import glob
from pathlib import Path
def fail(message):
print(message)
sys.exit(1)
def build_catalog():
catalog_paths = []
for source_glob in CLI_ARGS.sources:... | [
"argparse.ArgumentParser",
"pathlib.Path",
"glob.glob",
"sys.exit",
"json.load",
"json.dump"
] | [((222, 233), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (230, 233), False, 'import sys\n'), ((2927, 3076), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tool for combining catalog files and/or ordering, checking and converting paths within catalog files"""'}), "(description=\n ... |
# Copyright (C) 2016 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd... | [
"ycmd.tests.test_utils.ClearCompletionsCache",
"ycmd.tests.test_utils.StopCompleterServer",
"os.path.join",
"functools.wraps",
"ycmd.tests.test_utils.SetUpApp",
"ycmd.tests.test_utils.StartCompleterServer",
"ycmd.tests.test_utils.IsolatedApp",
"os.path.abspath",
"ycmd.tests.test_utils.WaitUntilCompl... | [((1545, 1599), 'os.path.join', 'os.path.join', (['dir_of_current_script', '"""testdata"""', '*args'], {}), "(dir_of_current_script, 'testdata', *args)\n", (1557, 1599), False, 'import os\n'), ((1921, 1931), 'ycmd.tests.test_utils.SetUpApp', 'SetUpApp', ([], {}), '()\n', (1929, 1931), False, 'from ycmd.tests.test_utils... |
from cupy import core
def argmax(a, axis=None, dtype=None, out=None, keepdims=False):
"""Returns the indices of the maximum along an axis.
Args:
a (cupy.ndarray): Array to take argmax.
axis (int): Along which axis to find the maximum. ``a`` is flattened by
default.
dtype: ... | [
"cupy.core.create_ufunc"
] | [((3435, 3667), 'cupy.core.create_ufunc', 'core.create_ufunc', (['"""cupy_where"""', "('???->?', '?bb->b', '?BB->B', '?hh->h', '?HH->H', '?ii->i', '?II->I',\n '?ll->l', '?LL->L', '?qq->q', '?QQ->Q', '?ee->e', '?ff->f', '?hd->d',\n '?Hd->d', '?dd->d')", '"""out0 = in0 ? in1 : in2"""'], {}), "('cupy_where', ('???->... |
"""
Credential implementation
"""
from typing import Dict, List, Union
from alteia.apis.provider import ExternalProviderServiceAPI
from alteia.core.resources.resource import ResourcesWithTotal
from alteia.core.utils.typing import Resource, ResourceId
class CredentialsImpl:
def __init__(self,
... | [
"alteia.core.utils.typing.Resource",
"alteia.core.resources.resource.ResourcesWithTotal"
] | [((4099, 4115), 'alteia.core.utils.typing.Resource', 'Resource', ([], {}), '(**desc)\n', (4107, 4115), False, 'from alteia.core.utils.typing import Resource, ResourceId\n'), ((2236, 2259), 'alteia.core.utils.typing.Resource', 'Resource', ([], {}), '(**credentials)\n', (2244, 2259), False, 'from alteia.core.utils.typing... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from .models import Feed
class FeedViewsTest(TestCase):
def setUp(self):
self.client = Client()
user = User.objects.create_user(
username='test_user',
email='<EMAIL>',
password... | [
"django.contrib.auth.models.User.objects.create_user",
"django.test.Client"
] | [((187, 195), 'django.test.Client', 'Client', ([], {}), '()\n', (193, 195), False, 'from django.test import TestCase, Client\n'), ((211, 302), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""test_user"""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}... |
import wandb
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from collections import OrderedDict
from transformers import BertModel
from torchmeta.modules import MetaModule, MetaSequential, MetaLinear
from torchmeta.utils.gradient_based import gradient_update_parameters
from .... | [
"torch.nn.ReLU",
"wandb.log",
"torch.max",
"torch.squeeze",
"torch.unsqueeze",
"torch.matmul",
"torch.nn.Identity",
"transformers.BertModel.from_pretrained",
"torch.transpose",
"torch.autograd.grad",
"torch.empty",
"tqdm.tqdm",
"torch.tensor",
"torch.nn.Linear",
"torch.nn.functional.cros... | [((12257, 12282), 'torch.max', 'torch.max', (['logits'], {'dim': '(-1)'}), '(logits, dim=-1)\n', (12266, 12282), False, 'import torch\n'), ((5240, 5277), 'torch.tensor', 'torch.tensor', (['(0.0)'], {'device': 'args.device'}), '(0.0, device=args.device)\n', (5252, 5277), False, 'import torch\n'), ((5296, 5333), 'torch.t... |
#coding: utf-8
from __future__ import print_function
from builtins import str
from builtins import range
from .. import ParallelSampler
import ctypes as ct
import os
import cosmosis
import numpy as np
import sys
loglike_type = ct.CFUNCTYPE(ct.c_double,
ct.POINTER(ct.c_double), #cube
ct.c_int, #ndim
ct.... | [
"ctypes.POINTER",
"ctypes.cdll.LoadLibrary",
"os.path.join",
"builtins.str",
"os.path.split",
"sys.stderr.write",
"builtins.range",
"sys.exit"
] | [((259, 282), 'ctypes.POINTER', 'ct.POINTER', (['ct.c_double'], {}), '(ct.c_double)\n', (269, 282), True, 'import ctypes as ct\n'), ((477, 500), 'ctypes.POINTER', 'ct.POINTER', (['ct.c_double'], {}), '(ct.c_double)\n', (487, 500), True, 'import ctypes as ct\n'), ((518, 541), 'ctypes.POINTER', 'ct.POINTER', (['ct.c_doub... |
from __future__ import annotations
from collections import OrderedDict
from datetime import datetime
from pathlib import Path
from typing import TYPE_CHECKING, Union, Dict, List
import pandas as pd
from pkg_resources import get_distribution
from .utils import TextBuffer
if TYPE_CHECKING:
from os import PathLike... | [
"datetime.datetime.now",
"pkg_resources.get_distribution",
"pathlib.Path"
] | [((336, 364), 'pkg_resources.get_distribution', 'get_distribution', (['"""starfile"""'], {}), "('starfile')\n", (352, 364), False, 'from pkg_resources import get_distribution\n'), ((2534, 2548), 'pathlib.Path', 'Path', (['filename'], {}), '(filename)\n', (2538, 2548), False, 'from pathlib import Path\n'), ((2960, 2974)... |
from conan.packager import ConanMultiPackager
import copy
import platform
if __name__ == "__main__":
builder = ConanMultiPackager(clang_versions=["9.0"], gcc_versions=["9.2"])
builder.add_common_builds(shared_option_name="leveldb:shared", pure_c=False)
if platform.system() == "Linux":
filtered_... | [
"platform.system",
"conan.packager.ConanMultiPackager"
] | [((116, 180), 'conan.packager.ConanMultiPackager', 'ConanMultiPackager', ([], {'clang_versions': "['9.0']", 'gcc_versions': "['9.2']"}), "(clang_versions=['9.0'], gcc_versions=['9.2'])\n", (134, 180), False, 'from conan.packager import ConanMultiPackager\n'), ((273, 290), 'platform.system', 'platform.system', ([], {}),... |
import numpy as np
import matplotlib.pyplot as plt
import math
def log(list_name):
for i in range(len(list_name)):
list_name[i] = math.log10(list_name[i])
print(list_name[i])
return list_name
size = 4
x = np.arange(size)
video_file = [11132, 21164, 34452, 45208] # 每帧视频文件大小(byte)
video_file ... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
"math.log10",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((232, 247), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (241, 247), True, 'import numpy as np\n'), ((533, 580), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Total Camera Numbers"""'], {'fontsize': '(20)'}), "('Total Camera Numbers', fontsize=20)\n", (543, 580), True, 'import matplotlib.pyplot as plt\n... |
import numpy
from chainer import cuda
import chainer.serializers as S
import chainer.links as L
from nltk.corpus import stopwords
from context_models import CbowContext, BiLstmContext
from defs import IN_TO_OUT_UNITS_RATIO, NEGATIVE_SAMPLING_NUM
class ModelReader(object):
'''
Reads a pre-trained model using ... | [
"nltk.corpus.stopwords.words",
"context_models.CbowContext",
"numpy.empty",
"context_models.BiLstmContext",
"chainer.links.NegativeSampling",
"chainer.serializers.load_npz"
] | [((2480, 2544), 'chainer.links.NegativeSampling', 'L.NegativeSampling', (['target_word_units', 'cs', 'NEGATIVE_SAMPLING_NUM'], {}), '(target_word_units, cs, NEGATIVE_SAMPLING_NUM)\n', (2498, 2544), True, 'import chainer.links as L\n'), ((2608, 2741), 'context_models.BiLstmContext', 'BiLstmContext', (['deep', 'self.gpu'... |
import requests
from operator import itemgetter
import os
url = 'https://hacker-news.firebaseio.com/v0/topstories.json'
# /Users/ldu020/workspace/github.com/mrdulin/python-codelab/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding cer... | [
"operator.itemgetter",
"requests.get"
] | [((472, 503), 'requests.get', 'requests.get', (['url'], {'verify': '(False)'}), '(url, verify=False)\n', (484, 503), False, 'import requests\n'), ((750, 781), 'requests.get', 'requests.get', (['url'], {'verify': '(False)'}), '(url, verify=False)\n', (762, 781), False, 'import requests\n'), ((1157, 1179), 'operator.item... |
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import azure.functions as func
from onefuzztypes.enums import ErrorCode, TaskState
from onefuzztypes.models import Error
from onefuzztypes.requests import CanScheduleRequest
from onefuzztypes.responses import CanSchedule
... | [
"onefuzztypes.models.Error",
"onefuzztypes.enums.TaskState.shutting_down",
"onefuzztypes.responses.CanSchedule"
] | [((1357, 1412), 'onefuzztypes.responses.CanSchedule', 'CanSchedule', ([], {'allowed': 'allowed', 'work_stopped': 'work_stopped'}), '(allowed=allowed, work_stopped=work_stopped)\n', (1368, 1412), False, 'from onefuzztypes.responses import CanSchedule\n'), ((838, 906), 'onefuzztypes.models.Error', 'Error', ([], {'code': ... |
from PIL import Image
import os
if not os.path.exists("SortedCharacters"):
os.mkdir("SortedCharacters")
order="123456789abcdefghijklmnpqrstuvwxyz"
for i in range(0,len(order)):
black=0
im1=Image.open("Chars\\"+order[i]+".png")
if not os.path.exists("SortedCharacters\\"+order[i]):
os.mkdir("Sorte... | [
"os.path.exists",
"PIL.Image.open",
"os.mkdir"
] | [((39, 73), 'os.path.exists', 'os.path.exists', (['"""SortedCharacters"""'], {}), "('SortedCharacters')\n", (53, 73), False, 'import os\n'), ((79, 107), 'os.mkdir', 'os.mkdir', (['"""SortedCharacters"""'], {}), "('SortedCharacters')\n", (87, 107), False, 'import os\n'), ((201, 242), 'PIL.Image.open', 'Image.open', (["(... |
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# Title : Root Class For PCIE Express
#-----------------------------------------------------------------------------
# File : CmbPcie.py
# Created : 2019-10-11
#-------------------------------------------... | [
"pysmurf.core.roots.Common.Common.__init__",
"pyrogue.streamConnectBiDir",
"CryoDet._MicrowaveMuxBpEthGen2.FpgaTopLevel"
] | [((2058, 2112), 'pyrogue.streamConnectBiDir', 'pyrogue.streamConnectBiDir', (['self._srp', 'self._srpStream'], {}), '(self._srp, self._srpStream)\n', (2084, 2112), False, 'import pyrogue\n'), ((3708, 4009), 'pysmurf.core.roots.Common.Common.__init__', 'Common.__init__', (['self'], {'config_file': 'config_file', 'epics_... |
import unittest
from pyparsing import ParseException
from media_management_scripts.support.search_parser import parse_and_execute, parse
class ParseTestCase():
def parse(self, query, expected, context={}):
self.assertEqual(parse_and_execute(query, context), expected)
class SimpleTest(unittest.TestCase,... | [
"media_management_scripts.support.search_parser.parse_and_execute",
"media_management_scripts.support.search_parser.parse"
] | [((2033, 2045), 'media_management_scripts.support.search_parser.parse', 'parse', (['"""a+1"""'], {}), "('a+1')\n", (2038, 2045), False, 'from media_management_scripts.support.search_parser import parse_and_execute, parse\n'), ((238, 271), 'media_management_scripts.support.search_parser.parse_and_execute', 'parse_and_ex... |
"""Completers for Python code"""
import builtins
import collections.abc as cabc
import inspect
import re
import warnings
import xonsh.lazyasd as xl
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.completers.tools import (
CompleterResult,
RichCompletion,
contextual_completer,
get_fi... | [
"re.split",
"re.compile",
"xonsh.tools.subexpr_from_unbalanced",
"inspect.signature",
"xonsh.tools.subexpr_before_unbalanced",
"xonsh.tools.is_balanced",
"xonsh.completers.tools.RichCompletion",
"xonsh.completers.tools.get_filter_function",
"warnings.filterwarnings"
] | [((458, 516), 're.compile', 're.compile', (['"""([^\\\\s\\\\(\\\\)]+(\\\\.[^\\\\s\\\\(\\\\)]+)*)\\\\.(\\\\w*)$"""'], {}), "('([^\\\\s\\\\(\\\\)]+(\\\\.[^\\\\s\\\\(\\\\)]+)*)\\\\.(\\\\w*)$')\n", (468, 516), False, 'import re\n'), ((4314, 4335), 'xonsh.completers.tools.get_filter_function', 'get_filter_function', ([], {}... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | [
"numpy.sqrt",
"numpy.log",
"numpy.exp",
"openquake.hazardlib.gsim.base.CoeffsTable",
"numpy.zeros",
"copy.deepcopy"
] | [((23450, 23869), 'openquake.hazardlib.gsim.base.CoeffsTable', 'CoeffsTable', ([], {'sa_damping': '(5)', 'table': '""" IMT MF\n pga 0.50\n pgv 1.00\n 0.05 0.44\n 0.10 0.44\n 0.15 0.53\n 0.20 0.60\n 0.25 0.72\n 0.30 0.81\n 0.40 1.00\n 0.50 1.01\n 0.60 1.02\n... |
# Lib
from setuptools import setup, find_packages
exec(open('methylprep/version.py').read())
test_requirements = [
'methylcheck', # 'git+https://github.com/FoxoTech/methylcheck.git@feature/v0.7.7#egg=methylcheck',
'pytest',
'pytest_mock',
'matplotlib',
'scikit-learn', # openpyxl uses this, and forc... | [
"setuptools.find_packages"
] | [((1736, 1751), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1749, 1751), False, 'from setuptools import setup, find_packages\n')] |
import random
class Fluctuation:
def __init__(self, percentage, baseline):
self.percentage = percentage
self.baseline = baseline
def __call__(self, value):
return self.apply(value)
def apply(self, value):
return value + self.generate(self.baseline)
def generate(self... | [
"random.randint"
] | [((460, 500), 'random.randint', 'random.randint', (['corridor[0]', 'corridor[1]'], {}), '(corridor[0], corridor[1])\n', (474, 500), False, 'import random\n')] |
from airflow.models import DAG
from airflow.utils.timezone import datetime as adt
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.bash_operator import BashOperator
def random_subdag(parent_dag_name, child_dag_name, args):
with DAG(
# subdag의 id는 이와같은 컨벤션으로 쓴답니다.
d... | [
"airflow.utils.timezone.datetime",
"airflow.operators.dummy_operator.DummyOperator"
] | [((532, 598), 'airflow.operators.dummy_operator.DummyOperator', 'DummyOperator', ([], {'task_id': "('%s-union' % child_dag_name)", 'dag': 'dag_subdag'}), "(task_id='%s-union' % child_dag_name, dag=dag_subdag)\n", (545, 598), False, 'from airflow.operators.dummy_operator import DummyOperator\n'), ((687, 766), 'airflow.o... |
import subprocess
subprocess.run("paplay --volume=65536 /home/pi/Kodo.wav", shell=True)
| [
"subprocess.run"
] | [((18, 87), 'subprocess.run', 'subprocess.run', (['"""paplay --volume=65536 /home/pi/Kodo.wav"""'], {'shell': '(True)'}), "('paplay --volume=65536 /home/pi/Kodo.wav', shell=True)\n", (32, 87), False, 'import subprocess\n')] |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.makeatoon.ToonGenerator_ITW
from direct.directnotify.DirectNotifyGlobal import directNotify
from lib.coginvasion.toon im... | [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"random.randint",
"lib.coginvasion.toon.Toon.Toon"
] | [((353, 394), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'directNotify.newCategory', (['"""ToonGenerator"""'], {}), "('ToonGenerator')\n", (377, 394), False, 'from direct.directnotify.DirectNotifyGlobal import directNotify\n'), ((472, 497), 'lib.coginvasion.toon.Toon.Toon', 'Toon.Toon', (['base.... |
import time
import pytest
from brownie import PriceExercise, network
from scripts.helpful_scripts import LOCAL_BLOCKCHAIN_ENVIRONMENTS, get_account, get_contract
@pytest.fixture
def deploy_price_exercise(get_job_id, chainlink_fee):
# Arrange / Act
price_exercise = PriceExercise.deploy(
get_contract(... | [
"scripts.helpful_scripts.get_contract",
"scripts.helpful_scripts.get_account",
"time.sleep",
"brownie.network.show_active",
"pytest.skip"
] | [((1852, 1866), 'time.sleep', 'time.sleep', (['(35)'], {}), '(35)\n', (1862, 1866), False, 'import time\n'), ((715, 736), 'brownie.network.show_active', 'network.show_active', ([], {}), '()\n', (734, 736), False, 'from brownie import PriceExercise, network\n'), ((783, 820), 'pytest.skip', 'pytest.skip', (['"""Only for ... |
# Copyright 2017 Google Inc. 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 ag... | [
"signal.signal",
"sys.stderr.write",
"googlecloudsdk.core.log.err.Print",
"os.getpid",
"sys.exit"
] | [((1421, 1465), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal.SIG_DFL'], {}), '(signal.SIGINT, signal.SIG_DFL)\n', (1434, 1465), False, 'import signal\n'), ((1543, 1554), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1551, 1554), False, 'import sys\n'), ((1195, 1217), 'googlecloudsdk.core.log.err.Prin... |