uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
287bef4a9bec0978aab38f76 | train | function | @wallet_cmd.command("send", short_help="Send chia to another wallet")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set t... | @wallet_cmd.command("send", short_help="Send chia to another wallet")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set t... | extra_params = {"id": id, "amount": amount, "memo": memo, "fee": fee, "address": address, "override": override}
import asyncio
from .wallet_funcs import execute_with_wallet, send
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, send))
| @wallet_cmd.command("send", short_help="Send chia to another wallet")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set t... | 315 | 114 | 383 | 315 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | send_cmd | send_cmd | 90 | 129 | 90 | 124 | 7140566611eb637b9dc6c02b9af616642fefce59 | bigcode/the-stack | train |
c502088eb88ee87cf66c1691 | train | function | @wallet_cmd.command("get_address", short_help="Get a wallet receive address")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-i", "--id", help="Id of ... | @wallet_cmd.command("get_address", short_help="Get a wallet receive address")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-i", "--id", help="Id of ... | extra_params = {"id": id}
import asyncio
from .wallet_funcs import execute_with_wallet, get_address
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, get_address))
| @wallet_cmd.command("get_address", short_help="Get a wallet receive address")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-i", "--id", help="Id of ... | 140 | 64 | 185 | 140 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | get_address_cmd | get_address_cmd | 148 | 163 | 148 | 158 | fef7d833672ef2754637f2a65a7eaa118c3bc7a4 | bigcode/the-stack | train |
2830ead9df6d3c947360fbed | train | function | @wallet_cmd.command("take_offer", short_help="Examine or take an offer")
@click.argument("path_or_hex", type=str, nargs=1, required=True)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | @wallet_cmd.command("take_offer", short_help="Examine or take an offer")
@click.argument("path_or_hex", type=str, nargs=1, required=True)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | extra_params = {"file": path_or_hex, "examine_only": examine_only, "fee": fee}
import asyncio
from .wallet_funcs import execute_with_wallet, take_offer
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, take_offer))
| @wallet_cmd.command("take_offer", short_help="Examine or take an offer")
@click.argument("path_or_hex", type=str, nargs=1, required=True)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | 196 | 76 | 256 | 196 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | take_offer_cmd | take_offer_cmd | 301 | 320 | 301 | 315 | c7af540f13831e191b7844a30029c567932a921d | bigcode/the-stack | train |
337c827ba3bf00d767011a74 | train | function | @wallet_cmd.command("get_transactions", short_help="Get all transactions")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | @wallet_cmd.command("get_transactions", short_help="Get all transactions")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | extra_params = {"id": id, "verbose": verbose, "offset": offset, "paginate": paginate, "limit": limit}
import asyncio
from .wallet_funcs import execute_with_wallet, get_transactions
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, get_transactions))
# The flush/close avoi... | @wallet_cmd.command("get_transactions", short_help="Get all transactions")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | 308 | 135 | 453 | 308 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | get_transactions_cmd | get_transactions_cmd | 32 | 87 | 32 | 74 | 8915a7c6bb38a1f144d57b6f93529ddf7f0f6bdf | bigcode/the-stack | train |
897d0018db23c5ce6e639fd3 | train | function | @click.group("wallet", short_help="Manage your wallet")
def wallet_cmd() -> None:
pass
| @click.group("wallet", short_help="Manage your wallet")
def wallet_cmd() -> None:
| pass
| import sys
from typing import Optional, Tuple
import click
@click.group("wallet", short_help="Manage your wallet")
def wallet_cmd() -> None:
| 32 | 64 | 22 | 19 | 12 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | wallet_cmd | wallet_cmd | 7 | 9 | 7 | 8 | be36aaa7f3a4527bbaad1eae91ee2ee183f570ea | bigcode/the-stack | train |
59f51ab864ac55f47c7eeb17 | train | function | @wallet_cmd.command("cancel_offer", short_help="Cancel an existing offer")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | @wallet_cmd.command("cancel_offer", short_help="Cancel an existing offer")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | extra_params = {"id": id, "insecure": insecure, "fee": fee}
import asyncio
from .wallet_funcs import execute_with_wallet, cancel_offer
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, cancel_offer))
| @wallet_cmd.command("cancel_offer", short_help="Cancel an existing offer")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="... | 187 | 72 | 243 | 187 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | cancel_offer_cmd | cancel_offer_cmd | 323 | 340 | 323 | 335 | cf89320800fdf656f2bde4298714154f1ea45392 | bigcode/the-stack | train |
582f2db6dc25e6e8d4479a74 | train | function | @wallet_cmd.command("make_offer", short_help="Create an offer of XCH/CATs for XCH/CATs")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--finger... | @wallet_cmd.command("make_offer", short_help="Create an offer of XCH/CATs for XCH/CATs")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--finger... | extra_params = {"offers": offer, "requests": request, "filepath": filepath, "fee": fee}
import asyncio
from .wallet_funcs import execute_with_wallet, make_offer
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, make_offer))
| @wallet_cmd.command("make_offer", short_help="Create an offer of XCH/CATs for XCH/CATs")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--finger... | 274 | 100 | 334 | 274 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | make_offer_cmd | make_offer_cmd | 220 | 252 | 220 | 247 | 04f2d7e0762b5345014d0339e21b23eaa12d1098 | bigcode/the-stack | train |
414e328eb28312d7704439df | train | function | @wallet_cmd.command("show", short_help="Show wallet information")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set the f... | @wallet_cmd.command("show", short_help="Show wallet information")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set the f... | import asyncio
from .wallet_funcs import execute_with_wallet, print_balances
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, {}, print_balances))
| @wallet_cmd.command("show", short_help="Show wallet information")
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
default=None,
)
@click.option("-f", "--fingerprint", help="Set the f... | 103 | 64 | 139 | 103 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | show_cmd | show_cmd | 132 | 145 | 132 | 141 | 18e7739251e50be5f3c879dbb83a01371229c3c7 | bigcode/the-stack | train |
0e37b023722975b314a8ff52 | train | function | @wallet_cmd.command(
"delete_unconfirmed_transactions", short_help="Deletes all unconfirmed transactions for this wallet ID"
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
def... | @wallet_cmd.command(
"delete_unconfirmed_transactions", short_help="Deletes all unconfirmed transactions for this wallet ID"
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
def... | extra_params = {"id": id}
import asyncio
from .wallet_funcs import execute_with_wallet, delete_unconfirmed_transactions
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, delete_unconfirmed_transactions))
| @wallet_cmd.command(
"delete_unconfirmed_transactions", short_help="Deletes all unconfirmed transactions for this wallet ID"
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
def... | 151 | 64 | 200 | 151 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | delete_unconfirmed_transactions_cmd | delete_unconfirmed_transactions_cmd | 166 | 183 | 166 | 178 | c6478903e9524f7de673dea94a9ad4783410ab4d | bigcode/the-stack | train |
6b2b2c12360b1c5f9bff6c71 | train | function | @wallet_cmd.command(
"get_offers", short_help="Get the status of existing offers. Displays only active/pending offers by default."
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | @wallet_cmd.command(
"get_offers", short_help="Get the status of existing offers. Displays only active/pending offers by default."
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | extra_params = {
"id": id,
"filepath": filepath,
"exclude_my_offers": exclude_my_offers,
"exclude_taken_offers": exclude_taken_offers,
"include_completed": include_completed,
"summaries": summaries,
"reverse": reverse,
}
import asyncio
from .wallet... | @wallet_cmd.command(
"get_offers", short_help="Get the status of existing offers. Displays only active/pending offers by default."
)
@click.option(
"-wp",
"--wallet-rpc-port",
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
type=int,
... | 349 | 135 | 451 | 349 | 0 | ageorge95/chia-blockchain | chia/cmds/wallet.py | Python | get_offers_cmd | get_offers_cmd | 255 | 298 | 255 | 285 | 3bbf56b770aae082a34b002775cd924e7c3bf70f | bigcode/the-stack | train |
bf2c6ab3d4f8df08f351a92f | train | function | def _item_from_first_of(providers, looking_for):
"""Returns item from the *first* successful container extraction."""
for (provider, container) in providers:
try:
return (provider, _item_from(container, provider.index))
except _EXTRACTION_EXCEPTIONS:
pass
providers = ... | def _item_from_first_of(providers, looking_for):
| """Returns item from the *first* successful container extraction."""
for (provider, container) in providers:
try:
return (provider, _item_from(container, provider.index))
except _EXTRACTION_EXCEPTIONS:
pass
providers = [p[0] for p in providers]
raise exceptions.No... | exceptions.raise_with_cause(
exceptions.NotFound,
"Unable to find result %r, expected to be able to find it"
" created by %s but was unable to perform successful"
" extraction" % (looking_for, provider))
def _item_from_first_of(providers, looking_for):
| 64 | 64 | 126 | 12 | 52 | ToolsForHumans/taskflow | zag/storage.py | Python | _item_from_first_of | _item_from_first_of | 257 | 268 | 257 | 257 | 18d253a4e946127b7a9607c8760c6d77e2f8f37e | bigcode/the-stack | train |
fb40da703cf39b4f7ddc6c9a | train | function | def _item_from_single(provider, container, looking_for):
"""Returns item from a *single* provider."""
try:
return _item_from(container, provider.index)
except _EXTRACTION_EXCEPTIONS:
exceptions.raise_with_cause(
exceptions.NotFound,
"Unable to find result %r, expected... | def _item_from_single(provider, container, looking_for):
| """Returns item from a *single* provider."""
try:
return _item_from(container, provider.index)
except _EXTRACTION_EXCEPTIONS:
exceptions.raise_with_cause(
exceptions.NotFound,
"Unable to find result %r, expected to be able to find it"
" created by %s but w... | __ne__(self, other):
return not self.__eq__(other)
def _item_from(container, index):
"""Attempts to fetch a index/key from a given container."""
if index is None:
return container
return container[index]
def _item_from_single(provider, container, looking_for):
| 64 | 64 | 99 | 12 | 52 | ToolsForHumans/taskflow | zag/storage.py | Python | _item_from_single | _item_from_single | 245 | 254 | 245 | 245 | 6901a675177c9ee8919c225b08d4246bc4d3415b | bigcode/the-stack | train |
bfa07097486906642718a1ee | train | class | class _ProviderLocator(object):
"""Helper to start to better decouple the finding logic from storage.
WIP: part of the larger effort to cleanup/refactor the finding of named
arguments so that the code can be more unified and easy to
follow...
"""
def __init__(self, transient_results,... | class _ProviderLocator(object):
| """Helper to start to better decouple the finding logic from storage.
WIP: part of the larger effort to cleanup/refactor the finding of named
arguments so that the code can be more unified and easy to
follow...
"""
def __init__(self, transient_results,
providers_fetc... | TODO(harlowja): do this better (via a singleton or something else...)
_TRANSIENT_PROVIDER = object()
# Only for these intentions will we cache any failures that happened...
_SAVE_FAILURE_INTENTIONS = (states.EXECUTE, states.REVERT)
# NOTE(harlowja): Perhaps the container is a dictionary-like object and that
# key do... | 256 | 256 | 1,080 | 6 | 250 | ToolsForHumans/taskflow | zag/storage.py | Python | _ProviderLocator | _ProviderLocator | 88 | 206 | 88 | 88 | d7882c830209063ed8e8b6fb0727c9379d4d30bd | bigcode/the-stack | train |
19f4961ba6e7c10b3d58dade | train | class | class _Provider(object):
"""A named symbol provider that produces a output at the given index."""
def __init__(self, name, index):
self.name = name
self.index = index
def __repr__(self):
# TODO(harlowja): clean this up...
if self.name is _TRANSIENT_PROVIDER:
bas... | class _Provider(object):
| """A named symbol provider that produces a output at the given index."""
def __init__(self, name, index):
self.name = name
self.index = index
def __repr__(self):
# TODO(harlowja): clean this up...
if self.name is _TRANSIENT_PROVIDER:
base = "<TransientProvider"
... | )
def find(self, looking_for, scope_walker=None, short_circuit=True):
"""Returns the accessible providers."""
return self._find(looking_for, scope_walker=scope_walker,
short_circuit=short_circuit,
find_potentials=False)
class _Provider(object):
| 64 | 64 | 188 | 5 | 59 | ToolsForHumans/taskflow | zag/storage.py | Python | _Provider | _Provider | 209 | 235 | 209 | 209 | a54351106249c65937a3d11c38c15d365c67fee0 | bigcode/the-stack | train |
25dc1086b06cf8252aff0580 | train | class | class Storage(object):
"""Interface between engines and logbook and its backend (if any).
This class provides a simple interface to save atoms of a given flow and
associated activity and results to persistence layer (logbook,
atom_details, flow_details) for use by engines. This makes it easier to
i... | class Storage(object):
| """Interface between engines and logbook and its backend (if any).
This class provides a simple interface to save atoms of a given flow and
associated activity and results to persistence layer (logbook,
atom_details, flow_details) for use by engines. This makes it easier to
interact with the underl... | """Attempts to fetch a index/key from a given container."""
if index is None:
return container
return container[index]
def _item_from_single(provider, container, looking_for):
"""Returns item from a *single* provider."""
try:
return _item_from(container, provider.index)
except _EX... | 256 | 256 | 7,967 | 4 | 252 | ToolsForHumans/taskflow | zag/storage.py | Python | Storage | Storage | 271 | 1,190 | 271 | 271 | 99b641b2a11a71a3dffbf453503d792e3418d1ef | bigcode/the-stack | train |
0df8606cc1652a8cbac1f4c1 | train | function | def _item_from(container, index):
"""Attempts to fetch a index/key from a given container."""
if index is None:
return container
return container[index]
| def _item_from(container, index):
| """Attempts to fetch a index/key from a given container."""
if index is None:
return container
return container[index]
| self):
return hash((self.name, self.index))
def __eq__(self, other):
return (self.name, self.index) == (other.name, other.index)
def __ne__(self, other):
return not self.__eq__(other)
def _item_from(container, index):
| 64 | 64 | 36 | 8 | 56 | ToolsForHumans/taskflow | zag/storage.py | Python | _item_from | _item_from | 238 | 242 | 238 | 238 | 20b7d06fa6fd242b9a24b91f1a034fe8b116ee96 | bigcode/the-stack | train |
003572f36537b72758ba261d | train | class | class Migration(migrations.Migration):
dependencies = [
("example", "0009_labresults_author"),
]
operations = [
migrations.AlterModelOptions(
name="labresults",
options={"ordering": ("id",)},
),
]
| class Migration(migrations.Migration):
| dependencies = [
("example", "0009_labresults_author"),
]
operations = [
migrations.AlterModelOptions(
name="labresults",
options={"ordering": ("id",)},
),
]
| # Generated by Django 3.0.9 on 2021-07-14 08:09
from django.db import migrations
class Migration(migrations.Migration):
| 36 | 64 | 53 | 7 | 28 | MsMansiDhruv/django-rest-framework-json-api | example/migrations/0010_auto_20210714_0809.py | Python | Migration | Migration | 6 | 17 | 6 | 7 | c41900f0185c163a6fb2e9bae0563bf37227dc28 | bigcode/the-stack | train |
6583348ea1b5a8e0fc7ec3fe | train | class | class SaltRun(parsers.SaltRunOptionParser):
'''
Used to execute Salt runners
'''
def run(self):
'''
Execute salt-run
'''
import salt.runner
self.parse_args()
# Setup file logging!
self.setup_logfile_logger()
verify_log(self.config)
... | class SaltRun(parsers.SaltRunOptionParser):
| '''
Used to execute Salt runners
'''
def run(self):
'''
Execute salt-run
'''
import salt.runner
self.parse_args()
# Setup file logging!
self.setup_logfile_logger()
verify_log(self.config)
profiling_enabled = self.options.profiling... | absolute_import
from salt.utils import parsers
from salt.utils import activate_profile
from salt.utils import output_profile
from salt.utils.verify import check_user, verify_log
from salt.exceptions import SaltClientError
import salt.defaults.exitcodes # pylint: disable=W0611
class SaltRun(parsers.SaltRunOptionParse... | 68 | 68 | 228 | 11 | 56 | dlanderson/salt | salt/cli/run.py | Python | SaltRun | SaltRun | 13 | 51 | 13 | 13 | f50b3e258311442fa01d68d0b5761fff0373c596 | bigcode/the-stack | train |
2f2a31dbfabc84fadbf8fee9 | train | class | class MiscellaneousEventHandler(VoyagerEventHandler):
def __init__(self, config):
super().__init__(config=config)
self.message_counter = 0
self.i18n = self.config.i18n.messages
def interested_in_all_events(self):
return True
def handle_event(self, event_name: str, message: ... | class MiscellaneousEventHandler(VoyagerEventHandler):
| def __init__(self, config):
super().__init__(config=config)
self.message_counter = 0
self.i18n = self.config.i18n.messages
def interested_in_all_events(self):
return True
def handle_event(self, event_name: str, message: Dict):
self.message_counter += 1
if ev... | from typing import Dict
from data_structure.host_info import HostInfo, VoyagerConnectionStatus
from event_emitter import ee
from event_handlers.voyager_event_handler import VoyagerEventHandler
from event_names import BotEvent
class MiscellaneousEventHandler(VoyagerEventHandler):
| 56 | 75 | 250 | 11 | 44 | sly9/VoyagerTelegramBot | event_handlers/misc_event_handler.py | Python | MiscellaneousEventHandler | MiscellaneousEventHandler | 9 | 34 | 9 | 9 | 45c8eaa38a0218fdccbfeada45b7bc534ce0418d | bigcode/the-stack | train |
fc74237b6d1eb5d04e3cb21d | train | function | def compute_model (analysis, starts):
""" Computes a Markov model from the given analysis and list of start tokens.
Args:
analysis (dict): The analysis to build the model from
starts (list of str): The list of starting tokens
Returns:
MarkovModel: The computer Markov model.
"""
model = {}
for root, successo... | def compute_model (analysis, starts):
| """ Computes a Markov model from the given analysis and list of start tokens.
Args:
analysis (dict): The analysis to build the model from
starts (list of str): The list of starting tokens
Returns:
MarkovModel: The computer Markov model.
"""
model = {}
for root, successors in analysis.items():
successor_co... | _token].append(token)
if prev_token.endswith((".", "?", "!")) and token[0].isupper(): # Remember sentence start tokens.
starts.append(token)
prev_token = token
return (analysis, starts) # Return analysis and starting token tuple.
def compute_model (analysis, starts):
| 64 | 64 | 146 | 8 | 56 | lambdacasserole/markov-text-generator | genmodel.py | Python | compute_model | compute_model | 61 | 75 | 61 | 61 | 18934688b388191fde57854d89d9b82948ecf8ec | bigcode/the-stack | train |
9c67c9b7be0b10597e8c12c7 | train | function | def analyze (filepaths, line_filters=[], token_filters=[], continuation_char=None):
""" Returns an analysis of the specified filed necessary to construct a Markov model.
Args:
filepaths (list of str): Paths of the files to analyse
line_filters (list of str): Regexes to match lines to ignore
token_filters (list ... | def analyze (filepaths, line_filters=[], token_filters=[], continuation_char=None):
| """ Returns an analysis of the specified filed necessary to construct a Markov model.
Args:
filepaths (list of str): Paths of the files to analyse
line_filters (list of str): Regexes to match lines to ignore
token_filters (list of str): Regexes to match tokens to ignore
continuation_char (str): The token cont... | def tokenize (text):
""" Tokenizes a text sample.
Args:
text (str): The text sample
Returns:
list of str: A list of tokens
"""
replacements = ["\r", "\n", "\t"]
output = text
for replacement in replacements:
output = output.replace(replacement, " ") # Convert whitespace to spaces only.
return list(filter(... | 122 | 122 | 408 | 16 | 106 | lambdacasserole/markov-text-generator | genmodel.py | Python | analyze | analyze | 22 | 58 | 22 | 22 | 7f473782e5c732f650135516bba65f194044cfb9 | bigcode/the-stack | train |
8a4be36ea8fd849ce4e491fd | train | function | def tokenize (text):
""" Tokenizes a text sample.
Args:
text (str): The text sample
Returns:
list of str: A list of tokens
"""
replacements = ["\r", "\n", "\t"]
output = text
for replacement in replacements:
output = output.replace(replacement, " ") # Convert whitespace to spaces only.
return list(filter(... | def tokenize (text):
| """ Tokenizes a text sample.
Args:
text (str): The text sample
Returns:
list of str: A list of tokens
"""
replacements = ["\r", "\n", "\t"]
output = text
for replacement in replacements:
output = output.replace(replacement, " ") # Convert whitespace to spaces only.
return list(filter(lambda s: len(s) > 0,... | import sys
import re
import os
from markov_text_generator.markov import MarkovModel
def tokenize (text):
| 26 | 64 | 106 | 5 | 20 | lambdacasserole/markov-text-generator | genmodel.py | Python | tokenize | tokenize | 8 | 19 | 8 | 8 | 3ae5a2df4678e1348abc7be99488693810bea5c4 | bigcode/the-stack | train |
c5c02130e33741ce1ea166eb | train | function | def coordinates():
"""Getting coordinates"""
try:
number_of_structures = 0
with open('geo') as f:
for line in f:
finded = line.find('BIOGRF')
if finded != -1:
number_of_structures += 1
coordinates = []
... | def coordinates():
| """Getting coordinates"""
try:
number_of_structures = 0
with open('geo') as f:
for line in f:
finded = line.find('BIOGRF')
if finded != -1:
number_of_structures += 1
coordinates = []
try:
... | def coordinates():
| 3 | 85 | 285 | 3 | 0 | mertyigit/INEEDopt | coordinates.py | Python | coordinates | coordinates | 1 | 49 | 1 | 1 | a1e242bd2c61f95518428b55ce33dc61de9d5a7a | bigcode/the-stack | train |
383f60db56a0734321c15b0b | train | function | def GetNowTime():
cstTime = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))
strTime = cstTime.strftime("%H:%M:%S")
return strTime
| def GetNowTime():
| cstTime = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))
strTime = cstTime.strftime("%H:%M:%S")
return strTime
| ...')
WechatPush(
title,
'https://sc.ftqq.com/' +
sckey[0] +
'.send',
success,
fail,
result)
except BaseException:
print("微信推送出错!")
# 时间函数
def GetNowTime():
| 64 | 64 | 42 | 5 | 58 | itliujia/17wanxiao_AutoSignIn | main.py | Python | GetNowTime | GetNowTime | 120 | 123 | 120 | 120 | bb6239e7788194138c1b617bf0308e99e9be86d0 | bigcode/the-stack | train |
a7982f0bf2ecdea9c17ab71a | train | function | def check_in(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token):
sign_url = "https://reportedh5.17wanxiao.com/sass/api/epmpics"
jsons = GetUserJson(
deptId,
text,
stuNum,
... | def check_in(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token):
| sign_url = "https://reportedh5.17wanxiao.com/sass/api/epmpics"
jsons = GetUserJson(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token)
# 提交打卡
response = requests.post(sign_url, json=jsons,... | ],
"gpsType": 0,
"token": token}}
# 打卡提交函数
def check_in(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token):
| 64 | 64 | 135 | 42 | 21 | itliujia/17wanxiao_AutoSignIn | main.py | Python | check_in | check_in | 213 | 238 | 213 | 223 | 93f3958ac994cbf439ee0d62b9153e2a3f502ac6 | bigcode/the-stack | train |
cdc8e38eb4179c56cebd81ae | train | function | def GetUserJson(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token):
return {"businessType": "epmpics",
"method": "submitUpInfo",
"jsonData": {"deptStr": {"deptid": deptId,
... | def GetUserJson(
deptId,
text,
stuNum,
userName,
phone,
egcP,
guardianPhone,
userId,
customerId,
token):
| return {"businessType": "epmpics",
"method": "submitUpInfo",
"jsonData": {"deptStr": {"deptid": deptId,
"text": text},
"areaStr": {"streetNumber": "",
"street": "公园巷",
... | title = "成功: %s 人,失败: %s 人" % (len(success), len(fail))
try:
if len(sckey[0]) > 2:
print('主用户开始微信推送...')
WechatPush(
title,
'https://sc.ftqq.com/' +
sckey[0] +
'.send',
success,
fail,
... | 201 | 201 | 673 | 43 | 157 | itliujia/17wanxiao_AutoSignIn | main.py | Python | GetUserJson | GetUserJson | 128 | 208 | 128 | 138 | f4a26f96b94c0c4faaec4b299f8d39a39036c7a3 | bigcode/the-stack | train |
b1d3168a3c88a196ca128cd2 | train | function | def WechatPush(title, sckey, success, fail, result):
strTime = GetNowTime()
page = json.dumps(
result.json(),
sort_keys=True,
indent=4,
separators=(
',',
': '),
ensure_ascii=False)
content = f"""
`{strTime}`
#### 打卡成功用户:
`{success}`
#### 打卡失败用户... | def WechatPush(title, sckey, success, fail, result):
| strTime = GetNowTime()
page = json.dumps(
result.json(),
sort_keys=True,
indent=4,
separators=(
',',
': '),
ensure_ascii=False)
content = f"""
`{strTime}`
#### 打卡成功用户:
`{success}`
#### 打卡失败用户:
`{fail}`
#### 主用户打卡信息:
```
{page}
```
"""
... | ,
egcP,
guardianPhone,
userId,
customerId,
token)
# 提交打卡
response = requests.post(sign_url, json=jsons,)
return response
# 微信通知
def WechatPush(title, sckey, success, fail, result):
| 64 | 64 | 190 | 16 | 47 | itliujia/17wanxiao_AutoSignIn | main.py | Python | WechatPush | WechatPush | 243 | 275 | 243 | 243 | 7d17f0cdf7fc49802443cc0d702be87f9f629b5e | bigcode/the-stack | train |
3c2932e805989ec66f3e97ff | train | function | def main():
# sectets字段录入
sckey, success, failure, result, phone, password, guardianPhone, egcP, sckey = [
], [], [], [], [], [], [], [], []
# 多人循环录入
while True:
try:
users = input()
info = users.split(',')
phone.append(info[0])
password.append... | def main():
# sectets字段录入
| sckey, success, failure, result, phone, password, guardianPhone, egcP, sckey = [
], [], [], [], [], [], [], [], []
# 多人循环录入
while True:
try:
users = input()
info = users.split(',')
phone.append(info[0])
password.append(info[1])
egcP.app... | import time
import json
import requests
import random
import datetime
import os
import sys
from campus import CampusCard
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
fro... | 133 | 219 | 733 | 11 | 122 | itliujia/17wanxiao_AutoSignIn | main.py | Python | main | main | 24 | 116 | 24 | 25 | ef64f7a8eecedea9dc54cc344608d3030f8c3994 | bigcode/the-stack | train |
bbca805e7fe263f9977a5cd5 | train | class | class StealthTest(VpubTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
self.extra_args = [ ['-debug','-noacceptnonstdtxn','-reservebalance=10000000'] for i in range(self.num_nodes)]
def skip_test_if_missing_module(self):
self.skip_if_no... | class StealthTest(VpubTestFramework):
| def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
self.extra_args = [ ['-debug','-noacceptnonstdtxn','-reservebalance=10000000'] for i in range(self.num_nodes)]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self,... | #!/usr/bin/env python3
# Copyright (c) 2017-2018 The Vpub Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import json
from test_framework.test_vpub import VpubTestFramework, isclose
from test_framework.util import... | 94 | 256 | 2,803 | 9 | 84 | John-Tonny/vircle-core | test/functional/feature_part_stealth.py | Python | StealthTest | StealthTest | 12 | 218 | 12 | 12 | e02c045ed84408b414ebefc8255d05847a6ade12 | bigcode/the-stack | train |
b53d6a59755b8b891f209a2f | train | class | class TestModel(TestCase):
def test_imread(self):
try:
im = self.get_labeled_image()
im.image.show("original image")
im.to_grayscale()
im.image.show("gray scaled")
im.crop_from_center(400, 400)
im.image.show("crop image")
... | class TestModel(TestCase):
| def test_imread(self):
try:
im = self.get_labeled_image()
im.image.show("original image")
im.to_grayscale()
im.image.show("gray scaled")
im.crop_from_center(400, 400)
im.image.show("crop image")
im.downscale(200)
... | import os
import shutil
from unittest import TestCase
from mlimages.model import LabeledImage, LabelFile
import numpy as np
import testss.env as env
class TestModel(TestCase):
| 43 | 145 | 486 | 6 | 36 | icoxfog417/imageset | tests/test_model.py | Python | TestModel | TestModel | 9 | 85 | 9 | 10 | 9e587583ab91c9f9fac17240e50a233abea86612 | bigcode/the-stack | train |
61f43c9e44168afc63d030d5 | train | function | def main(tuple):
i=0
while len(tuple)>i:
if not isinstance(tuple[i], dict):
main(tuple[i])
i+=1
continue
out = None
value = None
if "in" in tuple[i]:
if "out" in tuple[i]:
out = tuple[i]["out"]
value ... | def main(tuple):
| i=0
while len(tuple)>i:
if not isinstance(tuple[i], dict):
main(tuple[i])
i+=1
continue
out = None
value = None
if "in" in tuple[i]:
if "out" in tuple[i]:
out = tuple[i]["out"]
value = input(tuple[i][... | def main(tuple):
| 4 | 139 | 466 | 4 | 0 | aiooq/Functions | modules/main.py | Python | main | main | 1 | 73 | 1 | 1 | af8605e698d1d008549080b61d0a7581f5203c47 | bigcode/the-stack | train |
1ec33f36dae2cd65f77be152 | train | function | def check_error(db, s):
if s != SQLITE_OK:
raise Error(s, sqlite3_errmsg(db))
| def check_error(db, s):
| if s != SQLITE_OK:
raise Error(s, sqlite3_errmsg(db))
|
SQLITE_DONE = 101
SQLITE_INTEGER = 1
SQLITE_FLOAT = 2
SQLITE_TEXT = 3
SQLITE_BLOB = 4
SQLITE_NULL = 5
class Error(Exception):
pass
def check_error(db, s):
| 64 | 64 | 25 | 7 | 56 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | check_error | check_error | 59 | 61 | 59 | 59 | 2b49ee84ab25771212ebc0d7a07903cddfa2147d | bigcode/the-stack | train |
c110f562a4ab77a2108d7898 | train | class | class Cursor:
def __init__(self, h):
self.h = h
self.stmnt = None
def execute(self, sql, params=None):
if params:
params = [quote(v) for v in params]
sql = sql % tuple(params)
print(sql)
b = bytearray(4)
s = sqlite3_prepare(self.h, sql, -... | class Cursor:
| def __init__(self, h):
self.h = h
self.stmnt = None
def execute(self, sql, params=None):
if params:
params = [quote(v) for v in params]
sql = sql % tuple(params)
print(sql)
b = bytearray(4)
s = sqlite3_prepare(self.h, sql, -1, b, None)
... | 1
SQLITE_FLOAT = 2
SQLITE_TEXT = 3
SQLITE_BLOB = 4
SQLITE_NULL = 5
class Error(Exception):
pass
def check_error(db, s):
if s != SQLITE_OK:
raise Error(s, sqlite3_errmsg(db))
class Connections:
def __init__(self, h):
self.h = h
def cursor(self):
return Curso... | 121 | 121 | 406 | 3 | 118 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | Cursor | Cursor | 77 | 128 | 77 | 78 | ba4564608466d14a5622a5e507eedc8fa8cb2cd1 | bigcode/the-stack | train |
fbaeae1a2d3c69a4f086f75e | train | class | class Connections:
def __init__(self, h):
self.h = h
def cursor(self):
return Cursor(self.h)
def close(self):
s = sqlite3_close(self.h)
check_error(self.h, s)
| class Connections:
| def __init__(self, h):
self.h = h
def cursor(self):
return Cursor(self.h)
def close(self):
s = sqlite3_close(self.h)
check_error(self.h, s)
| = 2
SQLITE_TEXT = 3
SQLITE_BLOB = 4
SQLITE_NULL = 5
class Error(Exception):
pass
def check_error(db, s):
if s != SQLITE_OK:
raise Error(s, sqlite3_errmsg(db))
class Connections:
| 64 | 64 | 51 | 3 | 61 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | Connections | Connections | 64 | 74 | 64 | 65 | 2c5b1a2b0d047475c6e128f55f0d3bf4926bc6af | bigcode/the-stack | train |
1486c289f0c82e99a643ceef | train | function | def connect(fname):
b = bytearray(4)
sqlite3_open(fname, b)
h = int.from_bytes(b, sys.byteorder)
return Connections(h)
| def connect(fname):
| b = bytearray(4)
sqlite3_open(fname, b)
h = int.from_bytes(b, sys.byteorder)
return Connections(h)
| return tuple(res)
def fetchone(self):
res = sqlite3_step(self.stmnt)
#print("step:", res)
if res == SQLITE_DONE:
return None
if res == SQLITE_ROW:
return self.make_row()
check_error(self.h, res)
def connect(fname):
| 64 | 64 | 37 | 4 | 60 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | connect | connect | 131 | 135 | 131 | 131 | 9cecf02577a0214418f2a07f33ef1c9489de1008 | bigcode/the-stack | train |
7d8cc2ecc6fc354d2678e58a | train | class | class Error(Exception):
pass
| class Error(Exception):
| pass
| 21
SQLITE_ROW = 100
SQLITE_DONE = 101
SQLITE_INTEGER = 1
SQLITE_FLOAT = 2
SQLITE_TEXT = 3
SQLITE_BLOB = 4
SQLITE_NULL = 5
class Error(Exception):
| 64 | 64 | 7 | 4 | 59 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | Error | Error | 55 | 56 | 55 | 55 | 160058a98b17b07e9da440ff05d449add408aac2 | bigcode/the-stack | train |
4ea83d1f43474c20535caab4 | train | function | def quote(val):
if isinstance(val, str):
return "'%s'" % val
return str(val)
| def quote(val):
| if isinstance(val, str):
return "'%s'" % val
return str(val)
| None
if res == SQLITE_ROW:
return self.make_row()
check_error(self.h, res)
def connect(fname):
b = bytearray(4)
sqlite3_open(fname, b)
h = int.from_bytes(b, sys.byteorder)
return Connections(h)
def quote(val):
| 64 | 64 | 25 | 4 | 60 | fossabot/OpenPython | src/main/resources/assets/openpython/opos/v1.1/lib/micropython/sqlite3.py | Python | quote | quote | 138 | 141 | 138 | 138 | 37988c5f76d715580f97b3a689594b20a909750b | bigcode/the-stack | train |
54314bf50480dba78d855c34 | train | function | def fit(config, device, train_loader, val_loader, num_epochs, start_epoch=1, best_err=1.1):
"""
train and evaluate the model
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
train_loader (torch.utils.data.DataLoader): DataL... | def fit(config, device, train_loader, val_loader, num_epochs, start_epoch=1, best_err=1.1):
| """
train and evaluate the model
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
train_loader (torch.utils.data.DataLoader): DataLoader instance object for training set
val_loader (torch.utils.data.DataLoader): Dat... | _dict(checkpoint['scheduler'])
err = checkpoint['err']
epoch = checkpoint['epoch'] + 1
else:
model.load_state_dict(checkpoint)
return err, epoch
def log(config, msg):
if config.verbose:
print(msg)
log_path = os.path.join(config.log_dir, 'log.txt')
with open(log_pa... | 119 | 119 | 399 | 27 | 92 | longrootchen/cifar100-pytorch | train.py | Python | fit | fit | 155 | 188 | 155 | 155 | 22876231c0fbe3d37a9ca25e5d61e83d8e469a2f | bigcode/the-stack | train |
6fcbb521f47bbd17f2b765b2 | train | function | def load(path):
checkpoint = torch.load(path)
# whether the checkpoint contains other training info
if isinstance(checkpoint, dict):
model.load_state_dict(checkpoint['model'])
optimizer.load_state_dict(checkpoint['optimizer'])
scheduler.load_state_dict(checkpoint['scheduler'])
... | def load(path):
| checkpoint = torch.load(path)
# whether the checkpoint contains other training info
if isinstance(checkpoint, dict):
model.load_state_dict(checkpoint['model'])
optimizer.load_state_dict(checkpoint['optimizer'])
scheduler.load_state_dict(checkpoint['scheduler'])
err = checkpo... | return evaluator.error()
def save(err, epoch, path):
model.eval()
torch.save({
'model': model.state_dict(),
'optimizer': optimizer.state_dict(),
'scheduler': scheduler.state_dict(),
'err': err,
'epoch': epoch
}, path)
def load(path):
| 64 | 64 | 94 | 4 | 60 | longrootchen/cifar100-pytorch | train.py | Python | load | load | 130 | 143 | 130 | 130 | 2d005e10cf4ed2ee4dae3e245c59ad2c45942e96 | bigcode/the-stack | train |
0f7761792ceb2f20f4ddc94b | train | function | def log(config, msg):
if config.verbose:
print(msg)
log_path = os.path.join(config.log_dir, 'log.txt')
with open(log_path, 'a+') as logger:
logger.write(f'{msg}\n')
| def log(config, msg):
| if config.verbose:
print(msg)
log_path = os.path.join(config.log_dir, 'log.txt')
with open(log_path, 'a+') as logger:
logger.write(f'{msg}\n')
| ['model'])
optimizer.load_state_dict(checkpoint['optimizer'])
scheduler.load_state_dict(checkpoint['scheduler'])
err = checkpoint['err']
epoch = checkpoint['epoch'] + 1
else:
model.load_state_dict(checkpoint)
return err, epoch
def log(config, msg):
| 64 | 64 | 51 | 6 | 57 | longrootchen/cifar100-pytorch | train.py | Python | log | log | 146 | 152 | 146 | 146 | 2011f825de6183a89af4a993ead829de1e570bce | bigcode/the-stack | train |
4b2845731ec44d4af6910095 | train | function | def validate(config, device, val_loader, epoch):
"""
validate the model
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
val_loader (torch.utils.data.DataLoader): a DataLoader instance object for validation set
epoc... | def validate(config, device, val_loader, epoch):
| """
validate the model
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
val_loader (torch.utils.data.DataLoader): a DataLoader instance object for validation set
epoch (int): current epoch
Returns:
err: ... | .update()
# visualization with TensorBoard
total_iter = (epoch - 1) * len(train_loader) + step + 1
writer.add_scalar('training_loss', losses.val, total_iter)
# update confusion matrix
true = target.cpu().numpy()
pred = output.max(dim=1)[1].cpu().... | 97 | 97 | 325 | 11 | 86 | longrootchen/cifar100-pytorch | train.py | Python | validate | validate | 76 | 116 | 76 | 76 | baa0c896143bc91a919c5de02a97d60fda627000 | bigcode/the-stack | train |
40ec81bd51e9cc3efc9fc485 | train | function | def train(config, device, train_loader, epoch):
"""
train an epoch
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
train_loader (torch.utils.data.DataLoader): a DataLoader instance object for training set
epoch (in... | def train(config, device, train_loader, epoch):
| """
train an epoch
Args:
config (EasyDict): configurations for training
device (torch.device): the GPU or CPU used for training
train_loader (torch.utils.data.DataLoader): a DataLoader instance object for training set
epoch (int): current epoch
Returns:
err (floa... | warnings
from collections import OrderedDict
from argparse import ArgumentParser
from easydict import EasyDict
from tqdm import tqdm
import pandas as pd
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.data import DataLoad... | 114 | 114 | 380 | 11 | 103 | longrootchen/cifar100-pytorch | train.py | Python | train | train | 25 | 73 | 25 | 25 | 673684fae8150d3b175009d3d3322b0adf036369 | bigcode/the-stack | train |
f04dfddc92e51ac8ad3c4d79 | train | function | def save(err, epoch, path):
model.eval()
torch.save({
'model': model.state_dict(),
'optimizer': optimizer.state_dict(),
'scheduler': scheduler.state_dict(),
'err': err,
'epoch': epoch
}, path)
| def save(err, epoch, path):
| model.eval()
torch.save({
'model': model.state_dict(),
'optimizer': optimizer.state_dict(),
'scheduler': scheduler.state_dict(),
'err': err,
'epoch': epoch
}, path)
| _postfix(ordered_dict=postfix)
pbar.update()
# update confusion matrix
true = target.cpu().numpy()
pred = output.max(dim=1)[1].cpu().numpy()
evaluator.update_matrix(true, pred)
return evaluator.error()
def save(err, epoch, path):
| 64 | 64 | 56 | 8 | 56 | longrootchen/cifar100-pytorch | train.py | Python | save | save | 119 | 127 | 119 | 119 | 084e5d16c9d640a79e6e08436f7d64c460aedb29 | bigcode/the-stack | train |
cc7191eeb1a42ae3e8170e75 | train | class | class Xedit(AutotoolsPackage):
"""Xedit is a simple text editor for X."""
homepage = "https://cgit.freedesktop.org/xorg/app/xedit"
url = "https://www.x.org/archive/individual/app/xedit-1.2.2.tar.gz"
version('1.2.2', '9fb9d6f63b574e5a4937384fbe6579c1')
depends_on('libxaw')
depends_on('lib... | class Xedit(AutotoolsPackage):
| """Xedit is a simple text editor for X."""
homepage = "https://cgit.freedesktop.org/xorg/app/xedit"
url = "https://www.x.org/archive/individual/app/xedit-1.2.2.tar.gz"
version('1.2.2', '9fb9d6f63b574e5a4937384fbe6579c1')
depends_on('libxaw')
depends_on('libxmu')
depends_on('libxt@1.0... | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xedit(AutotoolsPackage):
| 63 | 64 | 155 | 9 | 54 | HaochengLIU/spack | var/spack/repos/builtin/packages/xedit/package.py | Python | Xedit | Xedit | 9 | 23 | 9 | 9 | 03e397535cc0ae79bf09085ed37cc901535271a3 | bigcode/the-stack | train |
8ae5b17aba25e1cc48b72623 | train | class | class AmazonSpeech(PySSML):
def __init__(self):
super().__init__()
def whisper(self, words):
if words is None:
raise TypeError('Parameter words must not be None')
try:
words = words.strip()
if len(words) == 0:
raise ValueError('Parame... | class AmazonSpeech(PySSML):
| def __init__(self):
super().__init__()
def whisper(self, words):
if words is None:
raise TypeError('Parameter words must not be None')
try:
words = words.strip()
if len(words) == 0:
raise ValueError('Parameter words must not be empty')... | retrieve ssml with <speak> wrapper
s.ssml(True) # to retrieve ssml without <speak> wrapper
s.to_object() # to retrieve complete speach output object
"""
from pyssml.PySSML import PySSML
class AmazonSpeech(PySSML):
| 64 | 64 | 118 | 7 | 56 | sumsted/pyssml | pyssml/AmazonSpeech.py | Python | AmazonSpeech | AmazonSpeech | 19 | 33 | 19 | 20 | 0d7edc9e769633297f0a8d175a3a0d0486f8a2b1 | bigcode/the-stack | train |
cf19067670c1cf11e98dde7d | train | function | def _postprocess_non_flat_outputs(outputs):
"""Validates non-flat outputs, add backs device assignments and other attrs.
Args:
outputs: Output from `computation` inside `tpu.rewrite`.
Returns:
Tensors extracted from outputs and an empty list because Operations are not
allowed in non-flat outputs..
... | def _postprocess_non_flat_outputs(outputs):
| """Validates non-flat outputs, add backs device assignments and other attrs.
Args:
outputs: Output from `computation` inside `tpu.rewrite`.
Returns:
Tensors extracted from outputs and an empty list because Operations are not
allowed in non-flat outputs..
"""
# Flatten output items.
flat_outpu... | TODO(phawkins): extend the rewrite to elide these nodes instead.
new_output_tensors = []
for t in output_tensors:
with ops.device(t.device if t.device else core(0)):
o = array_ops.identity(t)
# pylint: disable=protected-access
o.op._set_attr("_tpu_output_identity", attr_value_pb2.AttrValue(b=... | 119 | 119 | 399 | 9 | 109 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | _postprocess_non_flat_outputs | _postprocess_non_flat_outputs | 1,023 | 1,066 | 1,023 | 1,023 | 6fe91f16b56130308ae5596ad31750dcd259a41f | bigcode/the-stack | train |
c0499d985b55e7902b6a1b4e | train | function | def split_compile_and_shard(computation,
inputs=None,
num_shards=1,
input_shard_axes=None,
outputs_from_all_shards=True,
output_shard_axes=None,
infeed_... | def split_compile_and_shard(computation,
inputs=None,
num_shards=1,
input_shard_axes=None,
outputs_from_all_shards=True,
output_shard_axes=None,
infeed_... | """Shards `computation` for parallel execution.
`inputs` must be a list of Tensors or None (equivalent to an empty list), each
of which has a corresponding split axis (from `input_shard_axes`). Each input
is split into `num_shards` pieces along the corresponding axis, and
computation is applied to each shard... | Error(
"TPU function return values must all either be Operations or "
'convertible to Tensors. Got error: "%s"' % str(e))
# Wraps outputs in Identity ops. Otherwise a replicated input copied
# straight to an output would bypass the replicate(). This would be bad
# because the TPUReplica... | 255 | 256 | 1,526 | 57 | 198 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | split_compile_and_shard | split_compile_and_shard | 1,069 | 1,216 | 1,069 | 1,077 | 42a9cc3b8d4a0db26b681c0e1bac3fcb140cf1a1 | bigcode/the-stack | train |
c0f64172699fea98d4073502 | train | function | def shard(computation,
inputs=None,
num_shards=1,
input_shard_axes=None,
outputs_from_all_shards=True,
output_shard_axes=None,
infeed_queue=None,
device_assignment=None,
name=None):
"""Shards `computation` for parallel execution.
`inpu... | def shard(computation,
inputs=None,
num_shards=1,
input_shard_axes=None,
outputs_from_all_shards=True,
output_shard_axes=None,
infeed_queue=None,
device_assignment=None,
name=None):
| """Shards `computation` for parallel execution.
`inputs` must be a list of Tensors or None (equivalent to an empty list), each
of which has a corresponding split axis (from `input_shard_axes`). Each input
is split into `num_shards` pieces along the corresponding axis, and
computation is applied to each shard... | = [outputs_from_all_shards] * num_outputs
if num_outputs != len(outputs_from_all_shards):
raise ValueError("Length of outputs_from_all_shards must be equal to the "
"number of outputs.")
results = []
for (axis, all_shards, x) in zip(output_shard_axes, outputs_from_all_shards,
... | 246 | 246 | 822 | 53 | 192 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | shard | shard | 1,219 | 1,296 | 1,219 | 1,227 | fa8b693e142234375e35dbc42dec6630c2bb4bfb | bigcode/the-stack | train |
57f6eff44e0ba873cab82d0a | train | function | @experimental
def validate_inference_rewrite_for_variables(graph):
"""Validates whether rewrite_for_inference() 'worked' for variables.
The rewrite_for_inference() method is supposed to append GuaranteeConstOps
after ReadVariableOps, but this mechanism works only if you are using
tf.get_variable() to ... | @experimental
def validate_inference_rewrite_for_variables(graph):
| """Validates whether rewrite_for_inference() 'worked' for variables.
The rewrite_for_inference() method is supposed to append GuaranteeConstOps
after ReadVariableOps, but this mechanism works only if you are using
tf.get_variable() to create and access variables in your tpu computation.
This vali... | val):
result = val
if self._outer_context:
result = self._outer_context.AddValue(val)
return result
def AddInnerOp(self, op):
self._AddOpInternal(op)
@property
def grad_state(self):
return None
@experimental
def validate_inference_rewrite_for_variables(graph):
| 73 | 73 | 246 | 13 | 59 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | validate_inference_rewrite_for_variables | validate_inference_rewrite_for_variables | 1,470 | 1,496 | 1,470 | 1,471 | a0221d81c6da682f1ed922d78d55e419f7d9d9c3 | bigcode/the-stack | train |
9677953ea78cb99ceacc3459 | train | function | def core(num):
"""Returns the device name for a core in a replicated TPU computation.
Args:
num: the virtual core number within each replica to which operators should
be assigned.
Returns:
A device name, suitable for passing to `tf.device()`.
"""
return "device:TPU_REPLICATED_CORE:{}".format(num)... | def core(num):
| """Returns the device name for a core in a replicated TPU computation.
Args:
num: the virtual core number within each replica to which operators should
be assigned.
Returns:
A device name, suitable for passing to `tf.device()`.
"""
return "device:TPU_REPLICATED_CORE:{}".format(num)
| (embedding_config=config_string)
def shutdown_system(job=None):
"""Shuts down a running a distributed TPU system."""
with ops.device(_tpu_system_device_name(job)):
shutdown_distributed_tpu = tpu_ops.shutdown_distributed_tpu()
return shutdown_distributed_tpu
def core(num):
| 64 | 64 | 76 | 4 | 59 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | core | core | 110 | 119 | 110 | 110 | bb31345709613b86cb54a94fb92a2bb741286e7a | bigcode/the-stack | train |
f50d8fb9e29a0cbf64f214b0 | train | function | def shutdown_system(job=None):
"""Shuts down a running a distributed TPU system."""
with ops.device(_tpu_system_device_name(job)):
shutdown_distributed_tpu = tpu_ops.shutdown_distributed_tpu()
return shutdown_distributed_tpu
| def shutdown_system(job=None):
| """Shuts down a running a distributed TPU system."""
with ops.device(_tpu_system_device_name(job)):
shutdown_distributed_tpu = tpu_ops.shutdown_distributed_tpu()
return shutdown_distributed_tpu
| .run` before it can be used.
"""
config_string = ("" if embedding_config is None else
embedding_config.SerializeToString())
with ops.device(_tpu_system_device_name(job)):
return tpu_ops.configure_distributed_tpu(embedding_config=config_string)
def shutdown_system(job=None):
| 64 | 64 | 54 | 6 | 58 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | shutdown_system | shutdown_system | 103 | 107 | 103 | 103 | 80b34fd188138822b30b8ccdf3d281bcebbc583b | bigcode/the-stack | train |
f8322bd63f32623871516b4d | train | function | def _tpu_system_device_name(job):
"""Returns the device name for the TPU_SYSTEM device of `job`."""
if job is None:
return "/device:TPU_SYSTEM:0"
else:
return "/job:%s/device:TPU_SYSTEM:0" % job
| def _tpu_system_device_name(job):
| """Returns the device name for the TPU_SYSTEM device of `job`."""
if job is None:
return "/device:TPU_SYSTEM:0"
else:
return "/job:%s/device:TPU_SYSTEM:0" % job
| 2",
])
_MAX_WARNING_LINES = 5
_TPU_REPLICATE_ATTR = "_tpu_replicate"
_TPU_COMPILATION_STATUS_ATTR = "_tpu_compilation_status"
_OUTSIDE_COMPILATION_ATTR = "_xla_outside_compilation"
def _tpu_system_device_name(job):
| 64 | 64 | 62 | 9 | 55 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | _tpu_system_device_name | _tpu_system_device_name | 74 | 79 | 74 | 74 | 5ca2c76d2fd222a2fd066807e9bf3bffd94a0693 | bigcode/the-stack | train |
4cebd67bb9f009f220bb4d73 | train | function | def under_tpu_inference_context():
"""Check if it is currently under `tpu.rewrite_for_inference()`."""
graph = ops.get_default_graph()
context = graph._get_control_flow_context() # pylint: disable=protected-access
while context:
if isinstance(context, _TPUInferenceContext):
return True
context =... | def under_tpu_inference_context():
| """Check if it is currently under `tpu.rewrite_for_inference()`."""
graph = ops.get_default_graph()
context = graph._get_control_flow_context() # pylint: disable=protected-access
while context:
if isinstance(context, _TPUInferenceContext):
return True
context = context.outer_context
return Fa... | inference graph.
_BLACKLISTED_INFERENCE_OPS = set([
"ReadVariableOp",
"AssignVariableOp",
"AssignAddVariableOp",
"AssignSubVariableOp",
"VarHandleOp",
"Variable",
"VariableV2",
])
def under_tpu_inference_context():
| 64 | 64 | 83 | 8 | 56 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | under_tpu_inference_context | under_tpu_inference_context | 1,419 | 1,429 | 1,419 | 1,419 | 9a18b691c394885650a866599e45d42460045e16 | bigcode/the-stack | train |
396b97263d31d503b6f41fe1 | train | function | def rewrite(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None):
"""Rewrites `computation` for execution on a TPU system.
Args:
computation: A Python function that builds a computation to apply to the
input. If the function takes... | def rewrite(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None):
| """Rewrites `computation` for execution on a TPU system.
Args:
computation: A Python function that builds a computation to apply to the
input. If the function takes n inputs, 'inputs' should be a list of n
tensors.
`computation` may return a list of operations and tensors. Tensors must
... | the TPU topology. Uses a default device assignment if `None`. The
`DeviceAssignment` may be omitted if each shard of the computation uses
only one core, and there is either only one shard, or the number of shards
is equal to the number of cores in the TPU system.
name: (Deprecated) Does noth... | 161 | 161 | 539 | 24 | 137 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | rewrite | rewrite | 1,355 | 1,404 | 1,355 | 1,359 | 92467f67a199e0a4cd9dee30ad2f12c76011dc3b | bigcode/the-stack | train |
c577f9f463d8dc009f56fb23 | train | function | def _postprocess_flat_outputs(outputs):
"""Validates non-flat outputs, add backs device assignments and other attrs.
Args:
outputs: Output from `computation` inside `tpu.rewrite`.
Returns:
Tensors and Operations extracted from outputs.
"""
# Following code segment is to preserve legacy behavior. Pre... | def _postprocess_flat_outputs(outputs):
| """Validates non-flat outputs, add backs device assignments and other attrs.
Args:
outputs: Output from `computation` inside `tpu.rewrite`.
Returns:
Tensors and Operations extracted from outputs.
"""
# Following code segment is to preserve legacy behavior. Previously we only
# supported flat outpu... | ReplicatedOutput node for each output.
ys = tpu_ops.tpu_replicated_output(
t, num_replicas, name="output{}".format(i))
# Wraps the outputs in identity operators so the names of any possible
# `fetch` nodes are preserved by the replication rewrite.
with ops.control_dependencies(control_deps):
... | 171 | 171 | 570 | 8 | 163 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | _postprocess_flat_outputs | _postprocess_flat_outputs | 962 | 1,020 | 962 | 962 | 7b99455b0b1a17a86315a572227cf944db1e90e1 | bigcode/the-stack | train |
9ee4ac7ede715b337a636f8f | train | function | def split_compile_and_replicate(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
use_tpu=True,
ma... | def split_compile_and_replicate(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
use_tpu=True,
ma... | """Builds graph operators that runs compilation and replicated computation.
This is a lower level interface than replicate that returns a separate compile
and execute output tensor. In the generated graph the compile op feeds into
the execute op and no additional compilation is incurred when running the
comp... | adding_map)
real_shapes[core_idx].append(
math_ops.cast(input_shape_tensor[i], dtypes.uint32))
paddings = []
for i, s in enumerate(padded_shape):
if input_shape[i].value:
# Don't pad if input shape is already static.
padding = [0, 0]
... | 256 | 256 | 2,971 | 40 | 215 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | split_compile_and_replicate | split_compile_and_replicate | 659 | 959 | 659 | 665 | 85ad9277a814891cb9c6fd93589a110ee05ce8ed | bigcode/the-stack | train |
2ca5f14fa51bc8578cfce92a | train | function | @experimental
def rewrite_for_inference(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None):
"""Rewrites `computation` for inference on a TPU system.
Other than 'rewriting' the com... | @experimental
def rewrite_for_inference(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None):
| """Rewrites `computation` for inference on a TPU system.
Other than 'rewriting' the computation to run on a TPU, if using variables
in your computation, it moves the ReadVariableOps outside the TPU
computation, and adds GuaranteeConst ops just after the ReadVariableOps.
This mechanism works only ... | _inference() to check whether GuaranteeConstOps where added
to the graph.
Typical usages:
tpu.validate_inference_rewrite_for_variables(tf.get_default_graph())
tpu.validate_inference_rewrite_for_variables(sess.graph)
Args:
graph: The graph which needs to be validated.
Raises:
Runti... | 182 | 183 | 611 | 30 | 152 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | rewrite_for_inference | rewrite_for_inference | 1,499 | 1,565 | 1,499 | 1,504 | 2c98a1a56555847fd27c6c38f97ddc8902af975a | bigcode/the-stack | train |
21229247cf9f2d15557ceca7 | train | function | def replicate(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
maximum_shapes=None):
"""Builds a graph operator that runs a replicated TPU computation.
Args:
computation: A Python function that builds the compu... | def replicate(computation,
inputs=None,
infeed_queue=None,
device_assignment=None,
name=None,
maximum_shapes=None):
| """Builds a graph operator that runs a replicated TPU computation.
Args:
computation: A Python function that builds the computation to replicate.
inputs: A list of lists of input tensors or `None` (equivalent to
`[[]]`), indexed by `[replica_num][input_num]`. All replicas must
have the same num... | initial_context
while context:
if isinstance(context, TPUReplicateContext):
context._EnterOutsideCompilationScope() # pylint: disable=protected-access
context = context.outer_context
retval = computation(*args, **kwargs)
# If we are in a TPUReplicateContext, signal that we are no longer
# outs... | 210 | 210 | 700 | 29 | 180 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | replicate | replicate | 512 | 573 | 512 | 517 | 8c02af5a67b41201977cc81eef17ac4428a59b77 | bigcode/the-stack | train |
1664e003158f5669946e1433 | train | function | def outside_compilation(computation, *args, **kwargs):
"""Builds part of a computation outside any current TPU replicate scope.
Args:
computation: A Python function that builds the computation to
place on the host.
*args: the positional arguments for the computation.
**kwargs: the keyword argumen... | def outside_compilation(computation, *args, **kwargs):
| """Builds part of a computation outside any current TPU replicate scope.
Args:
computation: A Python function that builds the computation to
place on the host.
*args: the positional arguments for the computation.
**kwargs: the keyword arguments for the computation.
Returns:
The Tensors ret... | licateContext affect the graph inside so the
# grad_state should be as if this is the top-level gradient state.
return None
@property
def back_prop(self):
"""Forwards to the enclosing while context, if any."""
if self.GetWhileContext():
return self.GetWhileContext().back_prop
return False... | 99 | 99 | 331 | 13 | 85 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | outside_compilation | outside_compilation | 470 | 509 | 470 | 470 | edc660a27061c63a64a4ab4fc8e9507009367538 | bigcode/the-stack | train |
d833b250dd12231386b8650d | train | function | def initialize_system(embedding_config=None, job=None):
"""Initializes a distributed TPU system for use with TensorFlow.
Args:
embedding_config: If not None, a `TPUEmbeddingConfiguration` proto
describing the desired configuration of the hardware embedding lookup
tables. If embedding_config is None... | def initialize_system(embedding_config=None, job=None):
| """Initializes a distributed TPU system for use with TensorFlow.
Args:
embedding_config: If not None, a `TPUEmbeddingConfiguration` proto
describing the desired configuration of the hardware embedding lookup
tables. If embedding_config is None, no hardware embeddings can be used.
job: The job (... | (job):
"""Returns the device name for the TPU_SYSTEM device of `job`."""
if job is None:
return "/device:TPU_SYSTEM:0"
else:
return "/job:%s/device:TPU_SYSTEM:0" % job
def initialize_system(embedding_config=None, job=None):
| 66 | 66 | 221 | 11 | 54 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | initialize_system | initialize_system | 82 | 100 | 82 | 82 | a5e225148ce736ab64e2ed68f5bce997ceb3a682 | bigcode/the-stack | train |
9877807d740f6e9d50c1313b | train | function | def _pad_all_input(inputs, padded_shapes):
"""Pad all input tensors given padded_shapes.
The real shape tensors will be concatenated with the padded original inputs.
Args:
inputs: The original inputs.
padded_shapes: A list of padded shapes for each input.
Returns:
The padded inputs and a PaddingM... | def _pad_all_input(inputs, padded_shapes):
| """Pad all input tensors given padded_shapes.
The real shape tensors will be concatenated with the padded original inputs.
Args:
inputs: The original inputs.
padded_shapes: A list of padded shapes for each input.
Returns:
The padded inputs and a PaddingMap list which maps the padded input
dim... | ) Single value output: A tuple containing the value would be returned.
3) Operation-only outputs: a NoOp would be returned which
control-depends on computation.
TODO(b/121383831): Investigate into removing these special cases.
Raises:
ValueError: If all replicas do not have equal numbers of ... | 194 | 194 | 648 | 10 | 184 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | _pad_all_input | _pad_all_input | 576 | 656 | 576 | 576 | 82678fa48f81d046bd363dba9773a4bcdeed7f46 | bigcode/the-stack | train |
0731e6e437eb2d7ba1b8162a | train | function | def batch_parallel(computation,
inputs=None,
num_shards=1,
infeed_queue=None,
device_assignment=None,
name=None):
"""Shards `computation` along the batch dimension for parallel execution.
Convenience wrapper around shard... | def batch_parallel(computation,
inputs=None,
num_shards=1,
infeed_queue=None,
device_assignment=None,
name=None):
| """Shards `computation` along the batch dimension for parallel execution.
Convenience wrapper around shard().
`inputs` must be a list of Tensors or None (equivalent to an empty list).
Each input is split into `num_shards` pieces along the 0-th dimension, and
computation is applied to each shard in parallel.... | (input_shard_axes) != len(inputs)
ValueError: If len(output_shard_axes) != len(outputs from `computation`)
"""
return split_compile_and_shard(
computation,
inputs=inputs,
num_shards=num_shards,
input_shard_axes=input_shard_axes,
outputs_from_all_shards=outputs_from_all_shards,
... | 140 | 140 | 469 | 32 | 108 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | batch_parallel | batch_parallel | 1,299 | 1,352 | 1,299 | 1,304 | 0c98726193cc5567c0745fa3806669587d3c7435 | bigcode/the-stack | train |
f5c0bc540a22813cc61e8662 | train | class | class TPUReplicateContext(control_flow_ops.XLAControlFlowContext):
"""A `ControlFlowContext` for nodes inside a TPU computation.
The primary role of `TPUReplicateContext` is to mark operators inside a
tpu.replicate() computation with the attribute "_tpu_replicate=XYZ", where XYZ
is a unique name.
We use a `... | class TPUReplicateContext(control_flow_ops.XLAControlFlowContext):
| """A `ControlFlowContext` for nodes inside a TPU computation.
The primary role of `TPUReplicateContext` is to mark operators inside a
tpu.replicate() computation with the attribute "_tpu_replicate=XYZ", where XYZ
is a unique name.
We use a `ControlFlowContext` to perform the annotation since it integrates
... | assumed there is only one job in the TensorFlow flock, and an error will
be returned if this assumption does not hold.
Returns:
A serialized `TopologyProto` that describes the TPU system. Note:
the topology must be evaluated using `Session.run` before it can be used.
"""
config_string = ("" if em... | 256 | 256 | 3,075 | 14 | 242 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | TPUReplicateContext | TPUReplicateContext | 122 | 467 | 122 | 122 | 0daafc4f66d000e6435d815af042ba5c14d80108 | bigcode/the-stack | train |
afa21090743f5f75e7243977 | train | class | class _TPUInferenceContext(control_flow_ops.XLAControlFlowContext):
"""A `ControlFlowContext` for nodes inside a TPU inference computation.
The primary role of `TPUReplicateContext` is to sanity check operators inside
a tpu.rewrite_for_inference() computation.
"""
def __init__(self, name):
super(_TPUInf... | class _TPUInferenceContext(control_flow_ops.XLAControlFlowContext):
| """A `ControlFlowContext` for nodes inside a TPU inference computation.
The primary role of `TPUReplicateContext` is to sanity check operators inside
a tpu.rewrite_for_inference() computation.
"""
def __init__(self, name):
super(_TPUInferenceContext, self).__init__()
self._name = name
def AddOp(s... | currently under `tpu.rewrite_for_inference()`."""
graph = ops.get_default_graph()
context = graph._get_control_flow_context() # pylint: disable=protected-access
while context:
if isinstance(context, _TPUInferenceContext):
return True
context = context.outer_context
return False
class _TPUInfer... | 84 | 84 | 283 | 15 | 68 | khodges42/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu.py | Python | _TPUInferenceContext | _TPUInferenceContext | 1,432 | 1,467 | 1,432 | 1,432 | 7afe6c51e9e3dae71c9daa9a074bb1aa2446b925 | bigcode/the-stack | train |
8843f0206f7cc7f23e11c451 | train | class | class Globals:
Kobo = None
Settings = None | class Globals:
| Kobo = None
Settings = None | class Globals:
| 3 | 64 | 12 | 3 | 0 | Nebopolis/kobo-book-downloader | kobo-book-downloader/Globals.py | Python | Globals | Globals | 1 | 3 | 1 | 1 | c31575db4ced6f4d15d8abc4224a82cceb13efc6 | bigcode/the-stack | train |
c67e4dc8249d5cf2d43706a2 | train | class | class IdentificationErrorRate(UEMSupportMixin, BaseMetric):
"""Identification error rate
``ier = (wc x confusion + wf x false_alarm + wm x miss) / total``
where
- `confusion` is the total confusion duration in seconds
- `false_alarm` is the total hypothesis duration where there are
... | class IdentificationErrorRate(UEMSupportMixin, BaseMetric):
| """Identification error rate
``ier = (wc x confusion + wf x false_alarm + wm x miss) / total``
where
- `confusion` is the total confusion duration in seconds
- `false_alarm` is the total hypothesis duration where there are
- `miss` is
- `total` is the total duration of all ... | NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# AUTHORS
# Hervé BREDIN - http://herve.niderb.fr
fro... | 239 | 239 | 799 | 12 | 227 | hadware/pyannote-metrics | pyannote/metrics/identification.py | Python | IdentificationErrorRate | IdentificationErrorRate | 45 | 159 | 45 | 45 | 6b0df872063d11a36b1c4444f6f9d6801973f812 | bigcode/the-stack | train |
18b339213fda0ac53ce752bc | train | class | class IdentificationRecall(UEMSupportMixin, Recall):
"""Identification Recall
Parameters
----------
collar : float, optional
Duration (in seconds) of collars removed from evaluation around
boundaries of reference segments.
skip_overlap : bool, optional
Set to True to not eva... | class IdentificationRecall(UEMSupportMixin, Recall):
| """Identification Recall
Parameters
----------
collar : float, optional
Duration (in seconds) of collars removed from evaluation around
boundaries of reference segments.
skip_overlap : bool, optional
Set to True to not evaluate overlap regions.
Defaults to False (i.e... | = R.get_labels(segment, unique=False)
# list of IDs in hypothesis segment
h = H.get_labels(segment, unique=False)
counts, _ = self.matcher_(r, h)
detail[PRECISION_RETRIEVED] += duration * len(h)
detail[PRECISION_RELEVANT_RETRIEVED] += \
dur... | 95 | 95 | 319 | 10 | 84 | hadware/pyannote-metrics | pyannote/metrics/identification.py | Python | IdentificationRecall | IdentificationRecall | 211 | 256 | 211 | 211 | 251eddee1ac90e17f1b055180ebadeb0877ad18e | bigcode/the-stack | train |
f38b3242c78c5a37d416789e | train | class | class IdentificationPrecision(UEMSupportMixin, Precision):
"""Identification Precision
Parameters
----------
collar : float, optional
Duration (in seconds) of collars removed from evaluation around
boundaries of reference segments.
skip_overlap : bool, optional
Set to True t... | class IdentificationPrecision(UEMSupportMixin, Precision):
| """Identification Precision
Parameters
----------
collar : float, optional
Duration (in seconds) of collars removed from evaluation around
boundaries of reference segments.
skip_overlap : bool, optional
Set to True to not evaluate overlap regions.
Defaults to False (... | .confusion * detail[IER_CONFUSION] +
self.false_alarm * detail[IER_FALSE_ALARM] +
self.miss * detail[IER_MISS]
)
denominator = 1. * detail[IER_TOTAL]
if denominator == 0.:
if numerator == 0:
return 0.
else:
return 1.... | 96 | 96 | 320 | 10 | 85 | hadware/pyannote-metrics | pyannote/metrics/identification.py | Python | IdentificationPrecision | IdentificationPrecision | 162 | 208 | 162 | 162 | 4e029bcba9d23dd90fb82ebe82ec48e87ae06d27 | bigcode/the-stack | train |
0db743add044e9256b6b9380 | train | class | class EPROCESS_QUOTA_BLOCK(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.QuotaEntry = vstruct.VArray([ EPROCESS_QUOTA_ENTRY() for i in xrange(3) ])
self.QuotaList = LIST_ENTRY()
self.ReferenceCount = v_uint32()
self.ProcessCount = v_uint32()
| class EPROCESS_QUOTA_BLOCK(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.QuotaEntry = vstruct.VArray([ EPROCESS_QUOTA_ENTRY() for i in xrange(3) ])
self.QuotaList = LIST_ENTRY()
self.ReferenceCount = v_uint32()
self.ProcessCount = v_uint32()
| struct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.List = LIST_ENTRY()
self.Size = v_uint32()
self.Signature = v_uint32()
self.Owner = v_ptr32()
class EPROCESS_QUOTA_BLOCK(vstruct.VStruct):
| 64 | 64 | 80 | 11 | 53 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | EPROCESS_QUOTA_BLOCK | EPROCESS_QUOTA_BLOCK | 4,975 | 4,981 | 4,975 | 4,975 | fab66d919957877407b10e509588ceebd840e073 | bigcode/the-stack | train |
d76954715dd8438a1918f923 | train | class | class GDI_TEB_BATCH(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Offset = v_uint32()
self.HDC = v_uint32()
self.Buffer = vstruct.VArray([ v_uint32() for i in xrange(310) ])
| class GDI_TEB_BATCH(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Offset = v_uint32()
self.HDC = v_uint32()
self.Buffer = vstruct.VArray([ v_uint32() for i in xrange(310) ])
| NonPagedPoolAllocations = v_uint32()
self.PagedBytes = v_uint32()
self.NonPagedBytes = v_uint32()
self.PeakPagedBytes = v_uint32()
self.PeakNonPagedBytes = v_uint32()
class GDI_TEB_BATCH(vstruct.VStruct):
| 64 | 64 | 66 | 11 | 53 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | GDI_TEB_BATCH | GDI_TEB_BATCH | 6,226 | 6,231 | 6,226 | 6,226 | 1fe3a06169ef6ff2f7be9a55aa78ddb737d0b249 | bigcode/the-stack | train |
2da1a31de672f7bf64530f00 | train | class | class PCI_HEADER_TYPE_1(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.BaseAddresses = vstruct.VArray([ v_uint32() for i in xrange(2) ])
self.PrimaryBus = v_uint8()
self.SecondaryBus = v_uint8()
self.SubordinateBus = v_uint8()
self.Secondary... | class PCI_HEADER_TYPE_1(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.BaseAddresses = vstruct.VArray([ v_uint32() for i in xrange(2) ])
self.PrimaryBus = v_uint8()
self.SecondaryBus = v_uint8()
self.SubordinateBus = v_uint8()
self.SecondaryLatency = v_uint8()
self.IOBase = ... | self.SubordinateBus = v_uint8()
self.SecondaryLatency = v_uint8()
self.Range = vstruct.VArray([ _unnamed_15560() for i in xrange(4) ])
self.InterruptLine = v_uint8()
self.InterruptPin = v_uint8()
self.BridgeControl = v_uint16()
class PCI_HEADER_TYPE_1(vstruct.VStruct):
| 84 | 84 | 281 | 11 | 73 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | PCI_HEADER_TYPE_1 | PCI_HEADER_TYPE_1 | 3,735 | 3,759 | 3,735 | 3,735 | 2a97a3e2b69f531608763a591d65007a95a3f476 | bigcode/the-stack | train |
0e96459e5d4a23f09418832b | train | class | class OBJECT_NAME_INFORMATION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Name = UNICODE_STRING()
| class OBJECT_NAME_INFORMATION(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Name = UNICODE_STRING()
| ._pad0010 = v_bytes(size=4)
class PP_LOOKASIDE_LIST(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.P = v_ptr32()
self.L = v_ptr32()
class OBJECT_NAME_INFORMATION(vstruct.VStruct):
| 64 | 64 | 34 | 9 | 55 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | OBJECT_NAME_INFORMATION | OBJECT_NAME_INFORMATION | 1,771 | 1,774 | 1,771 | 1,771 | 8bf66b5eefa5e47d92cbe947362bd209adc0f484 | bigcode/the-stack | train |
9b2f20e5a7fa190a5baa1cb2 | train | class | class OBJECT_DIRECTORY(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.HashBuckets = vstruct.VArray([ v_ptr32() for i in xrange(37) ])
self.Lock = EX_PUSH_LOCK()
self.DeviceMap = v_ptr32()
self.SessionId = v_uint32()
self.Reserved = v_uint16(... | class OBJECT_DIRECTORY(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.HashBuckets = vstruct.VArray([ v_ptr32() for i in xrange(37) ])
self.Lock = EX_PUSH_LOCK()
self.DeviceMap = v_ptr32()
self.SessionId = v_uint32()
self.Reserved = v_uint16()
self.SymbolicLinkUsageCount = v... | __(self):
vstruct.VStruct.__init__(self)
self.Size = v_uint16()
self.Version = v_uint16()
self.Context = v_ptr32()
self.InterfaceReference = v_ptr32()
self.InterfaceDereference = v_ptr32()
class OBJECT_DIRECTORY(vstruct.VStruct):
| 64 | 64 | 94 | 8 | 56 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | OBJECT_DIRECTORY | OBJECT_DIRECTORY | 6,258 | 6,266 | 6,258 | 6,258 | 24ffd565429b2673bcb43c23ae4f4ee3fe9dfabd | bigcode/the-stack | train |
fb27912878012494e7476050 | train | class | class OBJECT_HANDLE_INFORMATION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.HandleAttributes = v_uint32()
self.GrantedAccess = v_uint32()
| class OBJECT_HANDLE_INFORMATION(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.HandleAttributes = v_uint32()
self.GrantedAccess = v_uint32()
| = v_uint32()
class _unnamed_16247(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.AllocatedResources = v_ptr32()
self.AllocatedResourcesTranslated = v_ptr32()
class OBJECT_HANDLE_INFORMATION(vstruct.VStruct):
| 64 | 64 | 45 | 9 | 55 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | OBJECT_HANDLE_INFORMATION | OBJECT_HANDLE_INFORMATION | 1,012 | 1,016 | 1,012 | 1,012 | 5703cab561541926061ea6aa4cf3a680335d2453 | bigcode/the-stack | train |
9caafb536dd65b3f9a7beed9 | train | class | class PCI_PMC(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Version = v_uint8()
self.Support = PM_SUPPORT()
| class PCI_PMC(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Version = v_uint8()
self.Support = PM_SUPPORT()
| WriteCombined = 2
MI_PFN_CACHE_ATTRIBUTE.MiNotMapped = 3
class KEXECUTE_OPTIONS(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ExecuteDisable = v_uint8()
class PCI_PMC(vstruct.VStruct):
| 64 | 64 | 41 | 9 | 55 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | PCI_PMC | PCI_PMC | 561 | 565 | 561 | 561 | 3846b0a75c24af16cdcec389d2403a2657ca24e2 | bigcode/the-stack | train |
23454501da9031547a11b8c8 | train | class | class _unnamed_14103(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.LongFlags2 = v_uint32()
| class _unnamed_14103(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.LongFlags2 = v_uint32()
| init__(self)
self.ContinueStatus = v_uint32()
class _unnamed_14102(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.LongFlags = v_uint32()
class _unnamed_14103(vstruct.VStruct):
| 64 | 64 | 39 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_14103 | _unnamed_14103 | 2,269 | 2,272 | 2,269 | 2,269 | 1985a281c1cb0d32258e2e11aaccb7b4674e8fd9 | bigcode/the-stack | train |
10b75df4e35700d7059a2e87 | train | class | class _unnamed_16069(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Length = v_uint32()
self.FileName = v_ptr32()
self.FileInformationClass = v_uint32()
self.FileIndex = v_uint32()
| class _unnamed_16069(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Length = v_uint32()
self.FileName = v_ptr32()
self.FileInformationClass = v_uint32()
self.FileIndex = v_uint32()
| .Unused = vstruct.VArray([ v_uint16() for i in xrange(1) ])
self.KernBase = v_uint64()
self.PsLoadedModuleList = v_uint64()
self.DebuggerDataList = v_uint64()
class _unnamed_16069(vstruct.VStruct):
| 64 | 64 | 65 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_16069 | _unnamed_16069 | 2,167 | 2,173 | 2,167 | 2,167 | b473c767495b370929d2b7ebb08c1d98ac469812 | bigcode/the-stack | train |
bbd53218ceeac053eef2d895 | train | class | class CM_INDEX_HINT_BLOCK(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Count = v_uint32()
self.HashKey = vstruct.VArray([ v_uint32() for i in xrange(1) ])
| class CM_INDEX_HINT_BLOCK(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Count = v_uint32()
self.HashKey = vstruct.VArray([ v_uint32() for i in xrange(1) ])
| _uint32()
self.HardwareSegSs = v_uint32()
self.V86Es = v_uint32()
self.V86Ds = v_uint32()
self.V86Fs = v_uint32()
self.V86Gs = v_uint32()
class CM_INDEX_HINT_BLOCK(vstruct.VStruct):
| 64 | 64 | 57 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | CM_INDEX_HINT_BLOCK | CM_INDEX_HINT_BLOCK | 1,341 | 1,345 | 1,341 | 1,341 | 993925d921d7628229486b358a47c87b2efcf38a | bigcode/the-stack | train |
6bd7347139fc8a810b4f808e | train | class | class _unnamed_12520(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.LongFlags = v_uint32()
| class _unnamed_12520(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.LongFlags = v_uint32()
| PROCESSOR_POWER_POLICY_INFO() for i in xrange(3) ])
class _unnamed_11597(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Long = v_uint32()
class _unnamed_12520(vstruct.VStruct):
| 64 | 64 | 38 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_12520 | _unnamed_12520 | 749 | 752 | 749 | 749 | 94b9dd99c6dcc318eb3cb0afdd2d5143c461eb03 | bigcode/the-stack | train |
345881b39ba792792e6065a4 | train | class | class THERMAL_INFORMATION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ThermalStamp = v_uint32()
self.ThermalConstant1 = v_uint32()
self.ThermalConstant2 = v_uint32()
self.Processors = v_uint32()
self.SamplingPeriod = v_uint32()
se... | class THERMAL_INFORMATION(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.ThermalStamp = v_uint32()
self.ThermalConstant1 = v_uint32()
self.ThermalConstant2 = v_uint32()
self.Processors = v_uint32()
self.SamplingPeriod = v_uint32()
self.CurrentTemperature = v_uint32()
s... | __(self)
self.NextResourceDeviceNode = v_ptr32()
class _unnamed_12916(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.LegacyDeviceNode = v_ptr32()
class THERMAL_INFORMATION(vstruct.VStruct):
| 64 | 64 | 159 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | THERMAL_INFORMATION | THERMAL_INFORMATION | 4,187 | 4,200 | 4,187 | 4,187 | 95006b4118cb6fbf8dd8241b291c577e8b036230 | bigcode/the-stack | train |
0a4bbe40a10f0a3618df3a21 | train | class | class INITIAL_PRIVILEGE_SET(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.PrivilegeCount = v_uint32()
self.Control = v_uint32()
self.Privilege = vstruct.VArray([ LUID_AND_ATTRIBUTES() for i in xrange(3) ])
| class INITIAL_PRIVILEGE_SET(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.PrivilegeCount = v_uint32()
self.Control = v_uint32()
self.Privilege = vstruct.VArray([ LUID_AND_ATTRIBUTES() for i in xrange(3) ])
| self.Port = v_ptr32()
class IO_CLIENT_EXTENSION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.NextExtension = v_ptr32()
self.ClientIdentificationAddress = v_ptr32()
class INITIAL_PRIVILEGE_SET(vstruct.VStruct):
| 64 | 64 | 71 | 11 | 53 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | INITIAL_PRIVILEGE_SET | INITIAL_PRIVILEGE_SET | 4,502 | 4,507 | 4,502 | 4,502 | 85fe1a59187a0248c777aec0bd8861b7c6d1dad9 | bigcode/the-stack | train |
d6036416bf731265b5f2ed99 | train | class | class CURDIR(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.DosPath = UNICODE_STRING()
self.Handle = v_ptr32()
| class CURDIR(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.DosPath = UNICODE_STRING()
self.Handle = v_ptr32()
| oMapBase = v_uint16()
self.IoMaps = vstruct.VArray([ KiIoAccessMap() for i in xrange(1) ])
self.IntDirectionMap = vstruct.VArray([ v_uint8() for i in xrange(32) ])
class CURDIR(vstruct.VStruct):
| 63 | 64 | 43 | 8 | 55 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | CURDIR | CURDIR | 696 | 700 | 696 | 696 | 7db12b6b37929ac33d4d3aea501d02ae7a89592f | bigcode/the-stack | train |
8f6d6e23591209a397a33641 | train | class | class DBGKD_MANIPULATE_STATE64(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ApiNumber = v_uint32()
self.ProcessorLevel = v_uint16()
self.Processor = v_uint16()
self.ReturnStatus = v_uint32()
self._pad0010 = v_bytes(size=4)
self.u =... | class DBGKD_MANIPULATE_STATE64(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.ApiNumber = v_uint32()
self.ProcessorLevel = v_uint16()
self.Processor = v_uint16()
self.ReturnStatus = v_uint32()
self._pad0010 = v_bytes(size=4)
self.u = _unnamed_11794()
| DESCRIPTOR(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Pad = v_uint16()
self.Limit = v_uint16()
self.Base = v_uint32()
class DBGKD_MANIPULATE_STATE64(vstruct.VStruct):
| 64 | 64 | 92 | 14 | 50 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | DBGKD_MANIPULATE_STATE64 | DBGKD_MANIPULATE_STATE64 | 3,544 | 3,552 | 3,544 | 3,544 | cd84966520239b1ad611f20fc1f29399236501d9 | bigcode/the-stack | train |
591b29f04d795ed96f1c5e51 | train | class | class IO_SECURITY_CONTEXT(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.SecurityQos = v_ptr32()
self.AccessState = v_ptr32()
self.DesiredAccess = v_uint32()
self.FullCreateOptions = v_uint32()
| class IO_SECURITY_CONTEXT(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.SecurityQos = v_ptr32()
self.AccessState = v_ptr32()
self.DesiredAccess = v_uint32()
self.FullCreateOptions = v_uint32()
| _uint8()
self.HeaderType = v_uint8()
self.BIST = v_uint8()
self.u = _unnamed_14629()
self.DeviceSpecific = vstruct.VArray([ v_uint8() for i in xrange(192) ])
class IO_SECURITY_CONTEXT(vstruct.VStruct):
| 63 | 64 | 65 | 9 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | IO_SECURITY_CONTEXT | IO_SECURITY_CONTEXT | 4,479 | 4,485 | 4,479 | 4,479 | 8b3ec0cd7fa99b87e4465420ee3bac8f970e44ff | bigcode/the-stack | train |
30e6919ffe3e2021b17f9f53 | train | class | class VACB_LEVEL_REFERENCE(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Reference = v_uint32()
self.SpecialReference = v_uint32()
| class VACB_LEVEL_REFERENCE(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Reference = v_uint32()
self.SpecialReference = v_uint32()
| = v_ptr32()
self.DeleteProcedure = v_ptr32()
self.ParseProcedure = v_ptr32()
self.SecurityProcedure = v_ptr32()
self.QueryNameProcedure = v_ptr32()
self.OkayToCloseProcedure = v_ptr32()
class VACB_LEVEL_REFERENCE(vstruct.VStruct):
| 64 | 64 | 44 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | VACB_LEVEL_REFERENCE | VACB_LEVEL_REFERENCE | 1,477 | 1,481 | 1,477 | 1,477 | 51302aaf93436a7351b344affb085201da806b86 | bigcode/the-stack | train |
8d35e59f03c4b5aa67b6a809 | train | class | class _unnamed_13252(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.VirtualAddress = v_ptr32()
| class _unnamed_13252(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.VirtualAddress = v_ptr32()
| (vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.TargetBaseAddress = v_uint32()
self.TransferCount = v_uint32()
self.ActualBytesWritten = v_uint32()
class _unnamed_13252(vstruct.VStruct):
| 64 | 64 | 38 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_13252 | _unnamed_13252 | 786 | 789 | 786 | 786 | 3143d8572e6781d95ad5dce74305910052261aed | bigcode/the-stack | train |
d1e012dd5a3d762596b0aa75 | train | class | class CM_KEY_SECURITY_CACHE(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Cell = v_uint32()
self.ConvKey = v_uint32()
self.List = LIST_ENTRY()
self.DescriptorLength = v_uint32()
self.Descriptor = SECURITY_DESCRIPTOR_RELATIVE()
| class CM_KEY_SECURITY_CACHE(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Cell = v_uint32()
self.ConvKey = v_uint32()
self.List = LIST_ENTRY()
self.DescriptorLength = v_uint32()
self.Descriptor = SECURITY_DESCRIPTOR_RELATIVE()
| for i in xrange(64) ])
class EXCEPTION_POINTERS(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ExceptionRecord = v_ptr32()
self.ContextRecord = v_ptr32()
class CM_KEY_SECURITY_CACHE(vstruct.VStruct):
| 64 | 64 | 71 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | CM_KEY_SECURITY_CACHE | CM_KEY_SECURITY_CACHE | 7,059 | 7,066 | 7,059 | 7,059 | 620385aaabe9c7a357b1e4fc0c26ba092c6095c8 | bigcode/the-stack | train |
e6aef69beef45b9f454423fb | train | class | class _unnamed_15247(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.TestAllocation = _unnamed_16554()
self._pad0010 = v_bytes(size=4)
| class _unnamed_15247(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.TestAllocation = _unnamed_16554()
self._pad0010 = v_bytes(size=4)
| amed_12606()
self.PrototypePte = v_ptr32()
self.ThePtes = vstruct.VArray([ MMPTE() for i in xrange(1) ])
self._pad0040 = v_bytes(size=4)
class _unnamed_15247(vstruct.VStruct):
| 64 | 64 | 54 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_15247 | _unnamed_15247 | 1,757 | 1,761 | 1,757 | 1,757 | da0849582671938c1aad649dd9311c1085551626 | bigcode/the-stack | train |
6efc863c6e3e287a22c99bd3 | train | class | class EXCEPTION_REGISTRATION_RECORD(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Next = v_ptr32()
self.Handler = v_ptr32()
| class EXCEPTION_REGISTRATION_RECORD(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Next = v_ptr32()
self.Handler = v_ptr32()
| .VStruct.__init__(self)
self.SessionSpace = v_uint32()
class HEAP_LOCK(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Lock = _unnamed_12162()
class EXCEPTION_REGISTRATION_RECORD(vstruct.VStruct):
| 64 | 64 | 44 | 11 | 53 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | EXCEPTION_REGISTRATION_RECORD | EXCEPTION_REGISTRATION_RECORD | 5,432 | 5,436 | 5,432 | 5,432 | ec626f08c3542873ad397f06c04f66479008af03 | bigcode/the-stack | train |
82d573b176f0ee9867d5627c | train | class | class KWAIT_BLOCK(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.WaitListEntry = LIST_ENTRY()
self.Thread = v_ptr32()
self.Object = v_ptr32()
self.NextWaitBlock = v_ptr32()
self.WaitKey = v_uint16()
self.WaitType = v_uint16()
| class KWAIT_BLOCK(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.WaitListEntry = LIST_ENTRY()
self.Thread = v_ptr32()
self.Object = v_ptr32()
self.NextWaitBlock = v_ptr32()
self.WaitKey = v_uint16()
self.WaitType = v_uint16()
| self):
vstruct.VStruct.__init__(self)
self.StartTime = v_uint64()
self.EndTime = v_uint64()
self.IdleHandlerReserved = vstruct.VArray([ v_uint32() for i in xrange(4) ])
class KWAIT_BLOCK(vstruct.VStruct):
| 63 | 64 | 79 | 9 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | KWAIT_BLOCK | KWAIT_BLOCK | 4,592 | 4,600 | 4,592 | 4,592 | 12e22aa3ff38194dbdce9c467fd58667c03dd8eb | bigcode/the-stack | train |
340651a1507fd28049d7ce03 | train | class | class DBGKD_READ_MEMORY32(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.TargetBaseAddress = v_uint32()
self.TransferCount = v_uint32()
self.ActualBytesRead = v_uint32()
| class DBGKD_READ_MEMORY32(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.TargetBaseAddress = v_uint32()
self.TransferCount = v_uint32()
self.ActualBytesRead = v_uint32()
| _uint32()
self.ExceptionRecord = v_uint32()
self.ExceptionAddress = v_uint32()
self.NumberParameters = v_uint32()
self.ExceptionInformation = vstruct.VArray([ v_uint32() for i in xrange(15) ])
class DBGKD_READ_MEMORY32(vstruct.VStruct):
| 63 | 64 | 58 | 11 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | DBGKD_READ_MEMORY32 | DBGKD_READ_MEMORY32 | 7,003 | 7,008 | 7,003 | 7,003 | 97969920480b5be6f1cae8ecd73f3d3c4a1ffae5 | bigcode/the-stack | train |
358c23859784129a8a110be3 | train | class | class KDEVICE_QUEUE_ENTRY(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.DeviceListEntry = LIST_ENTRY()
self.SortKey = v_uint32()
self.Inserted = v_uint8()
self._pad0010 = v_bytes(size=3)
| class KDEVICE_QUEUE_ENTRY(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.DeviceListEntry = LIST_ENTRY()
self.SortKey = v_uint32()
self.Inserted = v_uint8()
self._pad0010 = v_bytes(size=3)
| ()
class _unnamed_16115(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Length = v_ptr32()
self.Key = v_uint32()
self.ByteOffset = LARGE_INTEGER()
class KDEVICE_QUEUE_ENTRY(vstruct.VStruct):
| 64 | 64 | 67 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | KDEVICE_QUEUE_ENTRY | KDEVICE_QUEUE_ENTRY | 4,001 | 4,007 | 4,001 | 4,001 | e1516052cfdfca545ff678ee153a4a81553f4b2f | bigcode/the-stack | train |
0d74de940030425a5aa4c9a1 | train | class | class PROCESSOR_POWER_POLICY(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Revision = v_uint32()
self.DynamicThrottle = v_uint8()
self.Spare = vstruct.VArray([ v_uint8() for i in xrange(3) ])
self.DisableCStates = v_uint32()
self.PolicyCoun... | class PROCESSOR_POWER_POLICY(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Revision = v_uint32()
self.DynamicThrottle = v_uint8()
self.Spare = vstruct.VArray([ v_uint8() for i in xrange(3) ])
self.DisableCStates = v_uint32()
self.PolicyCount = v_uint32()
self.Policy = vstruct.VA... | _11882()
class _unnamed_11075(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ListEntry = LIST_ENTRY()
self._pad0028 = v_bytes(size=32)
class PROCESSOR_POWER_POLICY(vstruct.VStruct):
| 64 | 64 | 109 | 10 | 54 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | PROCESSOR_POWER_POLICY | PROCESSOR_POWER_POLICY | 732 | 740 | 732 | 732 | c0be4c016eb8f00db9d086ab2a53bc5b3cbeecf9 | bigcode/the-stack | train |
28fcbd431e56f960c2fb277b | train | class | class IMAGE_OPTIONAL_HEADER(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Magic = v_uint16()
self.MajorLinkerVersion = v_uint8()
self.MinorLinkerVersion = v_uint8()
self.SizeOfCode = v_uint32()
self.SizeOfInitializedData = v_uint32()
... | class IMAGE_OPTIONAL_HEADER(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Magic = v_uint16()
self.MajorLinkerVersion = v_uint8()
self.MinorLinkerVersion = v_uint8()
self.SizeOfCode = v_uint32()
self.SizeOfInitializedData = v_uint32()
self.SizeOfUninitializedData = v_uint32()
... | ()
self.Processors = v_uint32()
self.SamplingPeriod = v_uint32()
self.CurrentTemperature = v_uint32()
self.PassiveTripPoint = v_uint32()
self.CriticalTripPoint = v_uint32()
self.ActiveTripPointCount = v_uint8()
self._pad0024 = v_bytes(size=3)
self.ActiveTr... | 108 | 109 | 366 | 10 | 98 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | IMAGE_OPTIONAL_HEADER | IMAGE_OPTIONAL_HEADER | 4,203 | 4,236 | 4,203 | 4,203 | 49cb0df96788ceb5809b19e3c7889949391c02ee | bigcode/the-stack | train |
28409379c047ee1b5183863d | train | class | class _unnamed_16115(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Length = v_ptr32()
self.Key = v_uint32()
self.ByteOffset = LARGE_INTEGER()
| class _unnamed_16115(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Length = v_ptr32()
self.Key = v_uint32()
self.ByteOffset = LARGE_INTEGER()
| .AddressSpace = v_uint32()
self.Flags = v_uint32()
class PCI_SLOT_NUMBER(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.u = _unnamed_14357()
class _unnamed_16115(vstruct.VStruct):
| 64 | 64 | 53 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_16115 | _unnamed_16115 | 3,993 | 3,998 | 3,993 | 3,993 | a4dc18276b1441247bd0bbc462ddf85b1e3de7df | bigcode/the-stack | train |
b2bb33dd999ba2d6bf057f1f | train | class | class SEGMENT_OBJECT(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.BaseAddress = v_ptr32()
self.TotalNumberOfPtes = v_uint32()
self.SizeOfSegment = LARGE_INTEGER()
self.NonExtendedPtes = v_uint32()
self.ImageCommitment = v_uint32()
... | class SEGMENT_OBJECT(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.BaseAddress = v_ptr32()
self.TotalNumberOfPtes = v_uint32()
self.SizeOfSegment = LARGE_INTEGER()
self.NonExtendedPtes = v_uint32()
self.ImageCommitment = v_uint32()
self.ControlArea = v_ptr32()
se... | .Owner = v_ptr32()
class _unnamed_16779(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.EndingOffset = v_ptr32()
self.ResourceToRelease = v_ptr32()
class SEGMENT_OBJECT(vstruct.VStruct):
| 64 | 64 | 142 | 9 | 55 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | SEGMENT_OBJECT | SEGMENT_OBJECT | 588 | 601 | 588 | 588 | 5bbb5981f44eebb26b9ab21e40ad0c63d2ddf973 | bigcode/the-stack | train |
7e611340a15c2669d3265cf9 | train | class | class _unnamed_14793(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.PhysicalAddress = v_uint32()
| class _unnamed_14793(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.PhysicalAddress = v_uint32()
| self.PfnDereferenceSListHead = SLIST_HEADER()
self.PfnDeferredList = v_ptr32()
self.Seed = v_uint8()
self.Flags = flags()
self._pad0030 = v_bytes(size=2)
class _unnamed_14793(vstruct.VStruct):
| 64 | 64 | 39 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_14793 | _unnamed_14793 | 7,291 | 7,294 | 7,291 | 7,291 | c353ca2f195910d2ba66f7093045403b30171385 | bigcode/the-stack | train |
25f15d93e87e8337f1bd05af | train | class | class DBGKD_BREAKPOINTEX(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.BreakPointCount = v_uint32()
self.ContinueStatus = v_uint32()
| class DBGKD_BREAKPOINTEX(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.BreakPointCount = v_uint32()
self.ContinueStatus = v_uint32()
| link = v_uint32()
self.Blink = v_uint32()
class MMWSLE(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.u1 = _unnamed_13252()
class DBGKD_BREAKPOINTEX(vstruct.VStruct):
| 64 | 64 | 49 | 11 | 53 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | DBGKD_BREAKPOINTEX | DBGKD_BREAKPOINTEX | 3,950 | 3,954 | 3,950 | 3,950 | 562703355fc75236d1cff74cccaa30ce3fc2ad12 | bigcode/the-stack | train |
b7c5d2b229aa28dace83fceb | train | class | class _unnamed_16559(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ArbitrationList = v_ptr32()
| class _unnamed_16559(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.ArbitrationList = v_ptr32()
| __(self):
vstruct.VStruct.__init__(self)
self.SFreeListEntry = SINGLE_LIST_ENTRY()
self.HeapHandle = v_ptr32()
self.SizeIndex = v_uint32()
self.Signature = v_uint32()
class _unnamed_16559(vstruct.VStruct):
| 64 | 64 | 40 | 12 | 52 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | _unnamed_16559 | _unnamed_16559 | 4,742 | 4,745 | 4,742 | 4,742 | a5870f98c081adf3af6499648777cfd64d8a7cec | bigcode/the-stack | train |
273cb5588ea21c15e53ee562 | train | class | class INTERFACE(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Size = v_uint16()
self.Version = v_uint16()
self.Context = v_ptr32()
self.InterfaceReference = v_ptr32()
self.InterfaceDereference = v_ptr32()
| class INTERFACE(vstruct.VStruct):
| def __init__(self):
vstruct.VStruct.__init__(self)
self.Size = v_uint16()
self.Version = v_uint16()
self.Context = v_ptr32()
self.InterfaceReference = v_ptr32()
self.InterfaceDereference = v_ptr32()
| _uint8()
self.Alignment = v_uint8()
self.LoggerId = v_uint16()
class MMSUBSECTION_FLAGS(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.ReadOnly = v_uint32()
class INTERFACE(vstruct.VStruct):
| 64 | 64 | 68 | 8 | 56 | cmaruti/vivisect | vstruct/defs/windows/win_5_1_i386/ntoskrnl.py | Python | INTERFACE | INTERFACE | 6,248 | 6,255 | 6,248 | 6,248 | 6bf985b697427cbc7a67e2f9a6909b1f8121ffe6 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.