code stringlengths 20 1.05M | apis list | extract_api stringlengths 75 5.24M |
|---|---|---|
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Validator for HWID configs."""
from typing import List
from cros.factory.hwid.service.appengine.config import CONFIG
from cros.factory.hwid.service.ap... | [
"cros.factory.hwid.v3.database.Database.ChecksumForText",
"cros.factory.hwid.service.appengine.config.CONFIG.vpg_targets.get",
"cros.factory.hwid.service.appengine.verification_payload_generator.GenerateVerificationPayload",
"cros.factory.hwid.v3.contents_analyzer.ContentsAnalyzer"
] | [((1060, 1115), 'cros.factory.hwid.v3.database.Database.ChecksumForText', 'database.Database.ChecksumForText', (['hwid_config_contents'], {}), '(hwid_config_contents)\n', (1093, 1115), False, 'from cros.factory.hwid.v3 import database\n'), ((1146, 1231), 'cros.factory.hwid.v3.contents_analyzer.ContentsAnalyzer', 'conte... |
import re
sentence = input().lower()
word = input().lower()
pattern = f'{word}\\b'
matches = re.findall(pattern, sentence)
count = len(matches)
print(count)
| [
"re.findall"
] | [((101, 130), 're.findall', 're.findall', (['pattern', 'sentence'], {}), '(pattern, sentence)\n', (111, 130), False, 'import re\n')] |
#!/usr/bin/python
import os
import sys
import time
import xlwt
from lwt_testcasereader import TestCaseReader
from lwt_testhost import TestHost
from lwt_testcase import TestCase
from lwtestssh import mysshError
from lwt_config import *
CONN_RST = "Connection reset by peer"
class TestHarness:
def __init__(self, ... | [
"lwt_testhost.TestHost",
"time.sleep",
"lwt_testcasereader.TestCaseReader",
"lwt_testcase.TestCase",
"os.system",
"xlwt.Workbook"
] | [((658, 689), 'lwt_testcasereader.TestCaseReader', 'TestCaseReader', (['self.__testfile'], {}), '(self.__testfile)\n', (672, 689), False, 'from lwt_testcasereader import TestCaseReader\n'), ((878, 909), 'xlwt.Workbook', 'xlwt.Workbook', ([], {'encoding': '"""utf-8"""'}), "(encoding='utf-8')\n", (891, 909), False, 'impo... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plot
plot.style.use('seaborn-whitegrid')
import numpy as np
import mvpissues
issues = mvpissues.issues
issues['morley'] = []
import gitlabprs
import mvpprs
import pprint
prs = mvpprs.prs
prs['morley'] = gitlabprs.prs['morley']
pp = pprint... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"pprint.PrettyPrinter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((82, 117), 'matplotlib.pyplot.style.use', 'plot.style.use', (['"""seaborn-whitegrid"""'], {}), "('seaborn-whitegrid')\n", (96, 117), True, 'import matplotlib.pyplot as plot\n'), ((314, 344), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(2)'}), '(indent=2)\n', (334, 344), False, 'import pprint\n'),... |
#C:\Python27\python.exe
#!/usr/bin/env python
# encoding: utf-8
import os, csv
"""
**** WRITE RESULTS TO FILE FUNCTIONS
"""
def WriteResultsToFile(resultDict, bcDict, seqDict, workdir, indexFile, customTxt=''):
indexString = os.path.basename(indexFile).split(".")[0].split("_")[1]
csvFile = os.path.join(workdir... | [
"csv.DictWriter",
"os.path.basename"
] | [((3022, 3047), 'os.path.basename', 'os.path.basename', (['csvFile'], {}), '(csvFile)\n', (3038, 3047), False, 'import os, csv\n'), ((3932, 3957), 'os.path.basename', 'os.path.basename', (['csvFile'], {}), '(csvFile)\n', (3948, 3957), False, 'import os, csv\n'), ((617, 678), 'csv.DictWriter', 'csv.DictWriter', (['handl... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'Folder synchronization over (S)FTP',
'author': '<NAME>',
'url': 'https://github.com/marccarre/sftpsync',
'download_url': 'https://github.com/marccarre/sftpsync',
'author_email':... | [
"distutils.core.setup"
] | [((729, 744), 'distutils.core.setup', 'setup', ([], {}), '(**config)\n', (734, 744), False, 'from distutils.core import setup\n')] |
from google.cloud import firestore
import os
class Firestore:
def __init__(self,data:dict):
self.instance_name = data['instance_name']
self.project = data['project']
self.machine_type = data['machine_type']
self.deployment_status = data['deployment_status']
... | [
"google.cloud.firestore.Client",
"os.getenv"
] | [((1198, 1221), 'os.getenv', 'os.getenv', (['"""PROJECT_ID"""'], {}), "('PROJECT_ID')\n", (1207, 1221), False, 'import os\n'), ((1237, 1263), 'os.getenv', 'os.getenv', (['"""instance_name"""'], {}), "('instance_name')\n", (1246, 1263), False, 'import os\n'), ((581, 611), 'google.cloud.firestore.Client', 'firestore.Clie... |
import os
import sys
import pathlib
import subprocess
import pandas as pd
from datetime import datetime
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
from module.neuralnetwork.MLP import MLP
from module.reader.Reader import Reader
def learn_using_single_series(mlp, no_of_last_samples, learn... | [
"matplotlib.pyplot.savefig",
"pandas.DataFrame",
"matplotlib.use",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"module.reader.Reader.Reader",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.draw"
] | [((123, 144), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (137, 144), False, 'import matplotlib\n'), ((1919, 1928), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1926, 1928), True, 'import matplotlib.pyplot as plt\n'), ((1933, 2019), 'matplotlib.pyplot.plot', 'plt.plot', (['[row[0] fo... |
import inspect
from numpydoc.docscrape import ClassDoc, FunctionDoc
def numpydoc_type_desc(thing):
if inspect.isfunction(thing) or inspect.ismethod(thing):
docs = FunctionDoc(thing)
elif inspect.isclass(thing):
docs = ClassDoc(thing)
else:
raise RuntimeError("Don't know how to handle... | [
"inspect.ismethod",
"numpydoc.docscrape.ClassDoc",
"numpydoc.docscrape.FunctionDoc",
"inspect.isclass",
"inspect.isfunction"
] | [((106, 131), 'inspect.isfunction', 'inspect.isfunction', (['thing'], {}), '(thing)\n', (124, 131), False, 'import inspect\n'), ((135, 158), 'inspect.ismethod', 'inspect.ismethod', (['thing'], {}), '(thing)\n', (151, 158), False, 'import inspect\n'), ((175, 193), 'numpydoc.docscrape.FunctionDoc', 'FunctionDoc', (['thin... |
import json
import random
from mock import Mock
from hamcrest import (
assert_that, has_properties, has_entries,
equal_to
)
from stagecraft.apps.dashboards.models import Dashboard, Module
from stagecraft.apps.dashboards.tests.factories.factories import(
ModuleTypeFactory, DashboardFactory)
from stagecraf... | [
"stagecraft.apps.dashboards.models.Dashboard",
"random.randrange",
"mock.Mock",
"hamcrest.has_entries",
"stagecraft.apps.datasets.tests.factories.DataSetFactory",
"stagecraft.apps.dashboards.tests.factories.factories.DashboardFactory",
"hamcrest.has_properties",
"stagecraft.apps.dashboards.tests.facto... | [((1185, 1191), 'mock.Mock', 'Mock', ([], {}), '()\n', (1189, 1191), False, 'from mock import Mock\n'), ((1356, 1362), 'mock.Mock', 'Mock', ([], {}), '()\n', (1360, 1362), False, 'from mock import Mock\n'), ((1574, 1585), 'stagecraft.apps.dashboards.models.Dashboard', 'Dashboard', ([], {}), '()\n', (1583, 1585), False,... |
"""Tests for seq_io module.
"""
from collections import OrderedDict
import logging
import tempfile
from os import unlink
import unittest
from adapt.utils import seq_io
__author__ = '<NAME> <<EMAIL>>'
class TestFastaRead(unittest.TestCase):
"""Tests reading a fasta file.
"""
def setUp(self):
# ... | [
"collections.OrderedDict",
"adapt.utils.seq_io.write_fasta",
"adapt.utils.seq_io.read_fasta",
"os.unlink",
"tempfile.NamedTemporaryFile",
"logging.disable"
] | [((344, 373), 'logging.disable', 'logging.disable', (['logging.INFO'], {}), '(logging.INFO)\n', (359, 373), False, 'import logging\n'), ((437, 488), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'mode': '"""w"""', 'delete': '(False)'}), "(mode='w', delete=False)\n", (464, 488), False, 'import temp... |
from setuptools import setup, find_packages
import tensorhive
import os
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='tensorhive',
version=tensorhive.__version__,
licens... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((106, 131), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (121, 131), False, 'import os\n'), ((143, 184), 'os.path.join', 'os.path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (155, 184), False, 'import os\n'), ((357, 372), 'setuptools.find_package... |
import copy
import functools
import logging
import os
from distutils.util import strtobool
from typing import Any, Callable, Dict
from aws_xray_sdk.core import models, patch_all, xray_recorder
is_cold_start = True
logger = logging.getLogger(__name__)
class Tracer:
"""Tracer using AWS-XRay to provide decorators ... | [
"logging.getLogger",
"distutils.util.strtobool",
"aws_xray_sdk.core.patch_all",
"os.getenv",
"aws_xray_sdk.core.models.dummy_entities.DummySegment",
"functools.wraps",
"aws_xray_sdk.global_sdk_config.set_sdk_enabled",
"copy.copy",
"aws_xray_sdk.core.models.dummy_entities.DummySubsegment"
] | [((225, 252), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (242, 252), False, 'import logging\n'), ((4003, 4029), 'copy.copy', 'copy.copy', (['_default_config'], {}), '(_default_config)\n', (4012, 4029), False, 'import copy\n'), ((5373, 5404), 'functools.wraps', 'functools.wraps', (['la... |
import pacmap
import numpy as np
import matplotlib.pyplot as plt
# loading preprocessed coil_20 dataset
# you can change it with any dataset that is in the ndarray format, with the shape (N, D)
# where N is the number of samples and D is the dimension of each sample
X = np.load("../data/coil_20.npy", allow_pickle=True... | [
"numpy.load",
"matplotlib.pyplot.subplots",
"pacmap.PaCMAP"
] | [((272, 321), 'numpy.load', 'np.load', (['"""../data/coil_20.npy"""'], {'allow_pickle': '(True)'}), "('../data/coil_20.npy', allow_pickle=True)\n", (279, 321), True, 'import numpy as np\n'), ((356, 411), 'numpy.load', 'np.load', (['"""./data/coil_20_labels.npy"""'], {'allow_pickle': '(True)'}), "('./data/coil_20_labels... |
from django.db import models
# Create your models here.
class Country(models.Model):
country_name = models.CharField(max_length=50, blank=False)
country_short_name = models.CharField(max_length=4, blank=False)
country_img_url = models.CharField(max_length=120, blank=False)
def __str__(self):
r... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((105, 149), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'blank': '(False)'}), '(max_length=50, blank=False)\n', (121, 149), False, 'from django.db import models\n'), ((175, 218), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(4)', 'blank': '(False)'}), '(max_... |
from __future__ import print_function
from random import randint
import numpy as np
from Candy import *
from Move import Move
from uncertainty_exception import UncertaintyException
class Board:
DEFAULT_NUM_OF_CANDIES = 6
DEFAULT_HEIGHT = 9
DEFAULT_WIDTH = 9
DEFAULT_STRIKE = 3
NO_SCORE... | [
"Move.Move",
"numpy.array",
"numpy.zeros",
"numpy.ndarray",
"random.randint"
] | [((373, 403), 'Move.Move', 'Move', (['(-1, -1)', '(-1, -2)', '(True)'], {}), '((-1, -1), (-1, -2), True)\n', (377, 403), False, 'from Move import Move\n'), ((21479, 21566), 'numpy.array', 'np.array', (['[[4, 2, 23, 2, 2], [2, 23, 2, 8, 6], [4, 8, 23, 4, 2], [12, 2, 4, 0, 6]]'], {}), '([[4, 2, 23, 2, 2], [2, 23, 2, 8, 6... |
import hashlib
import jpype
import os
import struct
from array import array
from os.path import dirname, abspath
def start_jvm():
jvm_path = jpype.getDefaultJVMPath()
jars_path = os.path.join(dirname(abspath(__file__)), "jars")
load_modules = ["commons-codec-1.6", "jpbc-plaf-1.2.0", "jpbc-api-1.2.0", "ni... | [
"array.array",
"jpype.getDefaultJVMPath",
"os.path.join",
"struct.unpack",
"os.path.abspath",
"jpype.JClass"
] | [((148, 173), 'jpype.getDefaultJVMPath', 'jpype.getDefaultJVMPath', ([], {}), '()\n', (171, 173), False, 'import jpype\n'), ((782, 841), 'jpype.JClass', 'jpype.JClass', (['"""nics.crypto.proxy.afgh.AFGHGlobalParameters"""'], {}), "('nics.crypto.proxy.afgh.AFGHGlobalParameters')\n", (794, 841), False, 'import jpype\n'),... |
#!/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.
"""
Fastext Common Crawl vectors, e.g. use with filename
"models:fasttext_fi_vectors/crawl-300d-fi.vec".
"""
import os
i... | [
"os.path.join"
] | [((547, 602), 'os.path.join', 'os.path.join', (['datapath', '"""models"""', '"""fasttext_fi_vectors"""'], {}), "(datapath, 'models', 'fasttext_fi_vectors')\n", (559, 602), False, 'import os\n')] |
from django.urls import path
from . import views
app_name = 'twitteruser'
urlpatterns = [
path('', views.home_view, name='home_view'),
path('profile/<int:user_id>/', views.profile_view, name='profile_view'),
path('follow/<int:user_id>/', views.follow_user, name='follow_user'),
path('unfollow/<int:user... | [
"django.urls.path"
] | [((96, 139), 'django.urls.path', 'path', (['""""""', 'views.home_view'], {'name': '"""home_view"""'}), "('', views.home_view, name='home_view')\n", (100, 139), False, 'from django.urls import path\n'), ((145, 216), 'django.urls.path', 'path', (['"""profile/<int:user_id>/"""', 'views.profile_view'], {'name': '"""profile... |
"""newskylabs/tools/bookblock/__main__.py:
Main entry point for the `bookblock` tool.
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2019 <NAME>"
__license__ = "Apache License 2.0, http://www.apache.org/licenses/LICENSE-2.0"
__date__ = "2019/10/11"
__version__ ... | [
"newskylabs.tools.bookblock.scripts.bookblock.bookblock"
] | [((568, 579), 'newskylabs.tools.bookblock.scripts.bookblock.bookblock', 'bookblock', ([], {}), '()\n', (577, 579), False, 'from newskylabs.tools.bookblock.scripts.bookblock import bookblock\n')] |
import requests
from pprint import pprint
client_id = "58efa175549cbbe34857"
client_secret = "a70cc1472f395ffe456b64b6ab018644"
concrete_params = {
"client_id": client_id,
"client_secret": client_secret
}
base_url = "https://api.artsy.net/api/tokens/xapp_token"
r = requests.post(base_url, params=concrete_para... | [
"requests.post",
"pprint.pprint",
"requests.get"
] | [((276, 323), 'requests.post', 'requests.post', (['base_url'], {'params': 'concrete_params'}), '(base_url, params=concrete_params)\n', (289, 323), False, 'import requests\n'), ((324, 338), 'pprint.pprint', 'pprint', (['r.text'], {}), '(r.text)\n', (330, 338), False, 'from pprint import pprint\n'), ((437, 471), 'request... |
from misc_math import convert_to_base, base_to_dec
from dictionary import dict_sort
class Converter:
"""A class to convert strings to compact integers using a custom codec/lookup."""
def __init__(self, lookup=None):
if lookup == None:
self.lookup = {}
else:
self.lookup ... | [
"dictionary.dict_sort"
] | [((358, 375), 'dictionary.dict_sort', 'dict_sort', (['lookup'], {}), '(lookup)\n', (367, 375), False, 'from dictionary import dict_sort\n'), ((1336, 1358), 'dictionary.dict_sort', 'dict_sort', (['self.lookup'], {}), '(self.lookup)\n', (1345, 1358), False, 'from dictionary import dict_sort\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.