code stringlengths 72 8.78M | code_en stringlengths 72 8.78M | language stringclasses 1
value | file_path stringlengths 36 164 | license stringclasses 1
value | token_count int64 26 8.41M |
|---|---|---|---|---|---|
#!/usr/bin/python3
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | #!/usr/bin/python3
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | en | 001094926_google-oss-fuzz_fuzz_closest_e002221dbed6.py | unknown | 523 |
"""Flow Graph Transformation
The difference between simplification and transformation is that
transformation is based on annotations; it runs after the annotator
completed.
"""
from rpython.flowspace.model import (
SpaceOperation, Variable, Constant, Link, checkgraph)
from rpython.annotator import model as annmod... | """Flow Graph Transformation
The difference between simplification and transformation is that
transformation is based on annotations; it runs after the annotator
completed.
"""
from rpython.flowspace.model import (
SpaceOperation, Variable, Constant, Link, checkgraph)
from rpython.annotator import model as annmod... | en | 005470812_mesalock-linux-mesapy_transform_24a4da21f6ef.py | unknown | 3,266 |
from typing import Dict
from botocore.waiter import Waiter
class DeploymentSuccessful(Waiter):
def wait(self, deploymentId: str, WaiterConfig: Dict = None):
"""
Polls :py:meth:`CodeDeploy.Client.get_deployment` every 15 seconds until a successful state is reached. An error is returned after 120 fa... | from typing import Dict
from botocore.waiter import Waiter
class DeploymentSuccessful(Waiter):
def wait(self, deploymentId: str, WaiterConfig: Dict = None):
"""
Polls :py:meth:`CodeDeploy.Client.get_deployment` every 15 seconds until a successful state is reached. An error is returned after 120 fa... | en | 002633936_alliefitter-boto3_type_annotations_waiter_e18aa2774111.py | unknown | 329 |
import os
import argparse
from tqdm import tqdm
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from transformers import BertTokenizer, BertForSequenceClassification
from transformers import AdamW
def read_example_file(path):
examples = []
# Read examp... | import os
import argparse
from tqdm import tqdm
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from transformers import BertTokenizer, BertForSequenceClassification
from transformers import AdamW
def read_example_file(path):
examples = []
# Read examp... | en | 004574120_wietsedv-bertje_run_110kDBRD_9d53a393ae78.py | unknown | 2,828 |
import logging
from orchestra.google_apps.convenience import create_document_from_template
from orchestra.google_apps.convenience import create_folder_with_permissions
from orchestra.google_apps.permissions import write_with_link_permission
logger = logging.getLogger(__name__)
def create_documents(project_data, pre... | import logging
from orchestra.google_apps.convenience import create_document_from_template
from orchestra.google_apps.convenience import create_folder_with_permissions
from orchestra.google_apps.permissions import write_with_link_permission
logger = logging.getLogger(__name__)
def create_documents(project_data, pre... | en | 003715737_b12io-orchestra_documents_af83c1e3e739.py | unknown | 332 |
import argparse
import os
import subprocess
import sys
from multiprocessing import Pool
from ann_benchmarks.main import positive_int
def build(library, args):
print("Building %s..." % library)
if args is not None and len(args) != 0:
q = " ".join(["--build-arg " + x.replace(" ", "\\ ") for x in args])... | import argparse
import os
import subprocess
import sys
from multiprocessing import Pool
from ann_benchmarks.main import positive_int
def build(library, args):
print("Building %s..." % library)
if args is not None and len(args) != 0:
q = " ".join(["--build-arg " + x.replace(" ", "\\ ") for x in args])... | en | 003422725_erikbern-ann-benchmarks_install_b9c72d95e037.py | unknown | 676 |
from typing import Callable, Tuple, TypeVar, cast
from ..config import registry
from ..model import Model
from ..types import List2d, Padded
InT = TypeVar("InT", bound=List2d)
OutT = Padded
@registry.layers("list2padded.v1")
def list2padded() -> Model[InT, OutT]:
"""Create a layer to convert a list of array inp... | from typing import Callable, Tuple, TypeVar, cast
from ..config import registry
from ..model import Model
from ..types import List2d, Padded
InT = TypeVar("InT", bound=List2d)
OutT = Padded
@registry.layers("list2padded.v1")
def list2padded() -> Model[InT, OutT]:
"""Create a layer to convert a list of array inp... | en | 002799452_explosion-thinc_list2padded_7c28a3762137.py | unknown | 222 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 19 20:08:11 2019
@author: uzaymacar
Script containing custom layer implementations for a family of attention mechanisms in TensorFlow
with Keras integration (tested for TF 2.0). Comments next to each operation in each layer indicate
the output shapes. For ease of notatio... | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 19 20:08:11 2019
@author: uzaymacar
Script containing custom layer implementations for a family of attention mechanisms in TensorFlow
with Keras integration (tested for TF 2.0). Comments next to each operation in each layer indicate
the output shapes. For ease of notatio... | en | 000523328_uzaymacar-attention-mechanisms_layers_807cffe7b114.py | unknown | 5,347 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from multiprocessing import Pool
import multiprocessing
import os
import logging
import argparse
import sys
sys.path.append("..")
from pytorch_pretrained_bert.tokenization import BertTokenizer
from dataset im... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from multiprocessing import Pool
import multiprocessing
import os
import logging
import argparse
import sys
sys.path.append("..")
from pytorch_pretrained_bert.tokenization import BertTokenizer
from dataset im... | en | 000374907_microsoft-AzureML-BERT_create_pretraining_59967d55f26e.py | unknown | 843 |
from dataclasses import dataclass
from typing import Optional, List
from pokemontcgsdk.ability import Ability
from pokemontcgsdk.ancienttrait import AncientTrait
from pokemontcgsdk.attack import Attack
from pokemontcgsdk.cardimage import CardImage
from pokemontcgsdk.legality import Legality
from pokemontcgsdk.querybui... | from dataclasses import dataclass
from typing import Optional, List
from pokemontcgsdk.ability import Ability
from pokemontcgsdk.ancienttrait import AncientTrait
from pokemontcgsdk.attack import Attack
from pokemontcgsdk.cardimage import CardImage
from pokemontcgsdk.legality import Legality
from pokemontcgsdk.querybui... | en | 002098884_PokemonTCG-pokemon-tcg-sdk-python_card_ef7967eb2d9f.py | unknown | 634 |
import textwrap
import validation
mywidth = 70
myindent = " " * 4
wrapper = textwrap.TextWrapper(initial_indent=myindent, subsequent_indent=myindent, width=mywidth)
rsthdr = ["*", "#", "=", "-", "^", "~", "%"]
def get_type_string(indict):
outstr = ""
if indict["type"] == "number":
outstr = "Float"
... | import textwrap
import validation
mywidth = 70
myindent = " " * 4
wrapper = textwrap.TextWrapper(initial_indent=myindent, subsequent_indent=myindent, width=mywidth)
rsthdr = ["*", "#", "=", "-", "^", "~", "%"]
def get_type_string(indict):
outstr = ""
if indict["type"] == "number":
outstr = "Float"
... | en | 004350868_WISDEM-WISDEM_schema2rst_ffb005c86bf1.py | unknown | 1,586 |
# Copyright 2019 MLBenchmark Group. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # Copyright 2019 MLBenchmark Group. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | en | 000789772_Ascend-ModelZoo-PyTorch_result_summarizer_1ac964e7250a.py | unknown | 3,581 |
'''
Venn diagram plotting routines.
Two-circle venn plotter.
Copyright 2012, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
import numpy as np
from matplotlib.patches import Circle
from matplotlib.colors import ColorConverter
from matplotlib.pyplot import gca
from _math import *
from _venn... | '''
Venn diagram plotting routines.
Two-circle venn plotter.
Copyright 2012, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
import numpy as np
from matplotlib.patches import Circle
from matplotlib.colors import ColorConverter
from matplotlib.pyplot import gca
from _math import *
from _venn... | en | 005318500_mc-imperial-sctbench_venn2_b3de547aa6ad.py | unknown | 3,645 |
r"""
Disallows to use incorrect magic comments.
That's how a basic ``comment`` type token looks like:
.. code:: python
TokenInfo(
type=57 (COMMENT),
string='# noqa: WPS100',
start=(1, 4),
end=(1, 16),
line="u'' # noqa: WPS100\n",
)
All comments have the same type.
"""... | r"""
Disallows to use incorrect magic comments.
That's how a basic ``comment`` type token looks like:
.. code:: python
TokenInfo(
type=57 (COMMENT),
string='# noqa: WPS100',
start=(1, 4),
end=(1, 16),
line="u'' # noqa: WPS100\n",
)
All comments have the same type.
"""... | en | 000146305_wemake-services-wemake-python-styleguide_comments_44252edce3d3.py | unknown | 3,083 |
"""linking consent files to questionnaire responses
Revision ID: 24f6c59ecd4c
Revises: ee2270c92d0e
Create Date: 2022-01-26 14:16:02.633457
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, Ord... | """linking consent files to questionnaire responses
Revision ID: 24f6c59ecd4c
Revises: ee2270c92d0e
Create Date: 2022-01-26 14:16:02.633457
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, Ord... | en | 001658997_all-of-us-raw-data-repository_24f6c59ecd4c_linking_consent_files_to_questionnaire_c17573477839.py | unknown | 822 |
"""Internal classes used by the gzip, lzma and bz2 modules"""
import io
BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE
class BaseStream(io.BufferedIOBase):
"""Mode-checking helper functions."""
def _check_not_closed(self):
if self.closed:
raise ValueError('I/O operation on closed file')
def _c... | """Internal classes used by the gzip, lzma and bz2 modules"""
import io
BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE
class BaseStream(io.BufferedIOBase):
"""Mode-checking helper functions."""
def _check_not_closed(self):
if self.closed:
raise ValueError('I/O operation on closed file')
def _c... | en | 002756604_emilyemorehouse-ast-and-me_compression_30601c9ebe2d.py | unknown | 1,111 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# This file is part of my-weather-indicator
#
# Copyright (c) 2012 Lorenzo Carbonell Cerezo <a.k.a. atareao>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# This file is part of my-weather-indicator
#
# Copyright (c) 2012 Lorenzo Carbonell Cerezo <a.k.a. atareao>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | en | 003542478_atareao-my-weather-indicator_myweatherindicator_2de8f051d423.py | unknown | 11,336 |
"""
twtxt.twfile
~~~~~~~~~~~~
This module handles interaction with the local twtxt file.
:copyright: (c) 2016-2022 by buckket.
:license: MIT, see LICENSE for more details.
"""
import logging
from twtxt.parser import parse_tweets
logger = logging.getLogger(__name__)
def get_local_tweets(source... | """
twtxt.twfile
~~~~~~~~~~~~
This module handles interaction with the local twtxt file.
:copyright: (c) 2016-2022 by buckket.
:license: MIT, see LICENSE for more details.
"""
import logging
from twtxt.parser import parse_tweets
logger = logging.getLogger(__name__)
def get_local_tweets(source... | en | 001208656_buckket-twtxt_twfile_994aa9234724.py | unknown | 282 |
from __future__ import annotations
import typing as t
import uuid
import click
from globus_cli.login_manager import LoginManager
from globus_cli.parsing import command, endpoint_id_arg
from globus_cli.termio import display
@command(
"is-activated",
short_help="Check if an endpoint is activated",
adoc_e... | from __future__ import annotations
import typing as t
import uuid
import click
from globus_cli.login_manager import LoginManager
from globus_cli.parsing import command, endpoint_id_arg
from globus_cli.termio import display
@command(
"is-activated",
short_help="Check if an endpoint is activated",
adoc_e... | en | 002724715_globus-globus-cli_is_activated_6a75514f6c18.py | unknown | 1,281 |
# coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class CacheRules:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... | # coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class CacheRules:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
... | en | 004581651_huaweicloud-huaweicloud-sdk-python-v3_cache_rules_c6dc286c76cc.py | unknown | 3,822 |
"""
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import numpy as np
from ..pdfs.plda import FRPLDA, SPLDA, PLDA
class PLDAFactory(object):
"""Class to create PLDA objects."""
@staticmethod
def create_plda(
plda... | """
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import numpy as np
from ..pdfs.plda import FRPLDA, SPLDA, PLDA
class PLDAFactory(object):
"""Class to create PLDA objects."""
@staticmethod
def create_plda(
plda... | en | 000810822_hyperion-ml-hyperion_plda_factory_7f2372105953.py | unknown | 1,811 |
"""Module containing the report formatter.
This also includes the code to map parsed error back to the
original notebook and the cell the code in.
"""
from __future__ import annotations
import os
from typing import cast
from flake8.formatting.default import Default
from flake8.style_guide import Violation
from fla... | """Module containing the report formatter.
This also includes the code to map parsed error back to the
original notebook and the cell the code in.
"""
from __future__ import annotations
import os
from typing import cast
from flake8.formatting.default import Default
from flake8.style_guide import Violation
from fla... | en | 001170767_s-weigand-flake8-nb_formatter_ba153d3dd182.py | unknown | 1,000 |
"""The main views and error handlers."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, cast
from django.conf import settings
from django.db.models import Prefetch
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.utils impor... | """The main views and error handlers."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, cast
from django.conf import settings
from django.db.models import Prefetch
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.utils impor... | en | 004757388_mangadventure-MangAdventure_views_cb41938da5ef.py | unknown | 2,412 |
# ---------------------------------------------------------------------
# TracebackPlugin
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC modules
fro... | # ---------------------------------------------------------------------
# TracebackPlugin
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC modules
fro... | en | 004488408_nocproject-noc_traceback_89067122f7bf.py | unknown | 153 |
#!/usr/bin/env python
# Copyright 2021 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | #!/usr/bin/env python
# Copyright 2021 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | en | 001845445_googleapis-python-analytics-admin_account_summaries_list_e3f9dbaa090a.py | unknown | 540 |
# Copyright 2023 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2023 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | en | 002289127_google-timesketch_sigma_test_76263ae36fd7.py | unknown | 481 |
from pynitrokey.nethsm.client.paths.users_user_id.get import ApiForget
from pynitrokey.nethsm.client.paths.users_user_id.put import ApiForput
from pynitrokey.nethsm.client.paths.users_user_id.delete import ApiFordelete
class UsersUserID(
ApiForget,
ApiForput,
ApiFordelete,
):
pass
| from pynitrokey.nethsm.client.paths.users_user_id.get import ApiForget
from pynitrokey.nethsm.client.paths.users_user_id.put import ApiForput
from pynitrokey.nethsm.client.paths.users_user_id.delete import ApiFordelete
class UsersUserID(
ApiForget,
ApiForput,
ApiFordelete,
):
pass
| en | 001267982_Nitrokey-pynitrokey_users_user_id_082f2e34da19.py | unknown | 102 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for module csv_pivot_table_merger."""
import csv_pivot_table_merger
import os
import tempfile
import test_utils
import un... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for module csv_pivot_table_merger."""
import csv_pivot_table_merger
import os
import tempfile
import test_utils
import un... | en | 002924062_google-skia-buildbot_csv_pivot_table_merger_test_536fa1ea6c95.py | unknown | 704 |
"""Contains the parent class for custom code classes."""
from mpf.core.delays import DelayManager
from mpf.core.logging import LogMixin
class CustomCode(LogMixin):
"""Baseclass for custom code in a machine."""
__slots__ = ["machine", "name", "delay"]
def __init__(self, machine, name):
"""Initia... | """Contains the parent class for custom code classes."""
from mpf.core.delays import DelayManager
from mpf.core.logging import LogMixin
class CustomCode(LogMixin):
"""Baseclass for custom code in a machine."""
__slots__ = ["machine", "name", "delay"]
def __init__(self, machine, name):
"""Initia... | en | 001719945_missionpinball-mpf_custom_code_87c10ba2042c.py | unknown | 235 |
from django.db import migrations
import logging
logger = logging.getLogger(__name__)
def copy_images(apps, schema_editor):
# Here we copy and initialise our new image models and their renditions
CustomImage = apps.get_model("images", "CustomImage")
Rendition = apps.get_model("images", "Rendition")
... | from django.db import migrations
import logging
logger = logging.getLogger(__name__)
def copy_images(apps, schema_editor):
# Here we copy and initialise our new image models and their renditions
CustomImage = apps.get_model("images", "CustomImage")
Rendition = apps.get_model("images", "Rendition")
... | en | 005675933_torchbox-wagtail-torchbox_0002_copy_custom_images_a6901ed4edac.py | unknown | 589 |
# coding: utf-8
import re
import uuid
import graphviz as gv
from collections import defaultdict
from .graphviz_style import *
# index of subgraph
CLUSTER_INDEX = 0
ADD_DIGRAPH_FUNC = None
ADD_DIGRAPH_NODE_FUNC = None
ADD_DIGRAPH_EDGE_FUNC = None
def add_digraph(name=None, name_scope=None, style=True):
"""
R... | # coding: utf-8
import re
import uuid
import graphviz as gv
from collections import defaultdict
from .graphviz_style import *
# index of subgraph
CLUSTER_INDEX = 0
ADD_DIGRAPH_FUNC = None
ADD_DIGRAPH_NODE_FUNC = None
ADD_DIGRAPH_EDGE_FUNC = None
def add_digraph(name=None, name_scope=None, style=True):
"""
R... | en | 002258113_akimach-tfgraphviz_graphviz_wrapper_a61a88fd92a0.py | unknown | 2,979 |
import argparse
import nox
nox.options.sessions = ["tests-3.11"]
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def tests(session):
session.install(".[test]")
command = ["pytest", "tests"] + list(session.posargs)
session.run(*command)
@nox.session
def lint(session):
session.install(".[d... | import argparse
import nox
nox.options.sessions = ["tests-3.11"]
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def tests(session):
session.install(".[test]")
command = ["pytest", "tests"] + list(session.posargs)
session.run(*command)
@nox.session
def lint(session):
session.install(".[d... | en | 003839684_sixty-north-cosmic-ray_noxfile_9f025ad72953.py | unknown | 630 |
#!/usr/bin/env python3
# setreverse -- set up rDNS PTR records for a hostname using DNS UPDATE
import argparse
import dns.name
import dns.resolver
import ipaddress
import logging
import sys
import subprocess
def lookup_suffix(name):
ans = dns.resolver.resolve(name,
search=True,
... | #!/usr/bin/env python3
# setreverse -- set up rDNS PTR records for a hostname using DNS UPDATE
import argparse
import dns.name
import dns.resolver
import ipaddress
import logging
import sys
import subprocess
def lookup_suffix(name):
ans = dns.resolver.resolve(name,
search=True,
... | en | 001800770_grawity-code_setreverse_bba699d9461f.py | unknown | 1,691 |
from checkov.common.vcs.vcs_schema import VCSSchema
class RepositoryCollaboratorsSchema(VCSSchema):
def __init__(self) -> None:
schema = {
"type": "array",
"items": {
"title": "Collaborator",
"description": "Collaborator",
"type": "ob... | from checkov.common.vcs.vcs_schema import VCSSchema
class RepositoryCollaboratorsSchema(VCSSchema):
def __init__(self) -> None:
schema = {
"type": "array",
"items": {
"title": "Collaborator",
"description": "Collaborator",
"type": "ob... | en | 000206793_bridgecrewio-checkov_repository_collaborators_ea832cd5df2d.py | unknown | 1,376 |
import numpy as np
import io
def ABAQUSread(filename):
'''
Import an abaqus file
'''
def ABAQUScellType(cellType):
if cellType.upper() in ("B21", "B21H", "T2D2"):
return "BAR2"
elif cellType.upper() in ("S3R","STRI3","CPE3", "CPE3R", "CPE3S", "CPS3", "CPS3R", "CPS3S"):
... | import numpy as np
import io
def ABAQUSread(filename):
'''
Import an abaqus file
'''
def ABAQUScellType(cellType):
if cellType.upper() in ("B21", "B21H", "T2D2"):
return "BAR2"
elif cellType.upper() in ("S3R","STRI3","CPE3", "CPE3R", "CPE3S", "CPS3", "CPS3R", "CPS3S"):
... | en | 002965782_bourdin-mef90_mef90ABAQUS_28ce22aa9e72.py | unknown | 1,859 |
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | en | 005448572_grpc-grpc_channelz_servicer_test_079bfa3f8f9d.py | unknown | 6,527 |
# -*- coding: utf-8 -*-
import io
import numpy as np
import binarybrain as bb
import binarybrain.core as core
def make_lut_func_name(name, node):
return "%s_lut_%d"%(name, node)
def dump_hls_lut_node(f, name, lut, node):
f.write("\ninline ap_uint<1> %s(\n"%(make_lut_func_name(name, node)))
n = lu... | # -*- coding: utf-8 -*-
import io
import numpy as np
import binarybrain as bb
import binarybrain.core as core
def make_lut_func_name(name, node):
return "%s_lut_%d"%(name, node)
def dump_hls_lut_node(f, name, lut, node):
f.write("\ninline ap_uint<1> %s(\n"%(make_lut_func_name(name, node)))
n = lu... | en | 002155415_ryuz-BinaryBrain_hls_49eafb8241bf.py | unknown | 869 |
from vsutil import core, vs, depth, join, split, get_depth
def Deband(clip: vs.VideoNode, radius: int = 17, threshold: float = 4,
iterations: int = 1, grain: float = 4, chroma: bool = True)-> vs.VideoNode:
"""Wrapper for placebo.Deband because at the moment, processing one plane is faster.
Args:
... | from vsutil import core, vs, depth, join, split, get_depth
def Deband(clip: vs.VideoNode, radius: int = 17, threshold: float = 4,
iterations: int = 1, grain: float = 4, chroma: bool = True)-> vs.VideoNode:
"""Wrapper for placebo.Deband because at the moment, processing one plane is faster.
Args:
... | en | 000193520_Ichunjo-encode-scripts_placebo_447d379c2570.py | unknown | 290 |
import argparse
import copy
import logging
import os
import sys
import time
from pathlib import Path
from typing import Callable, Iterable, List, Union
import pytorch_lightning as pl
import wandb
from hydra import compose, initialize, initialize_config_dir
from hydra.utils import instantiate, to_absolute_path
from ome... | import argparse
import copy
import logging
import os
import sys
import time
from pathlib import Path
from typing import Callable, Iterable, List, Union
import pytorch_lightning as pl
import wandb
from hydra import compose, initialize, initialize_config_dir
from hydra.utils import instantiate, to_absolute_path
from ome... | en | 000993477_hughplay-TVR_test_30505025d5db.py | unknown | 1,623 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | en | 001417910_cairis-platform-cairis_GoalEnvironmentProperties_cfa74045a1dd.py | unknown | 651 |
"""
Project Euler problem 1 in cpmpy.
http://projecteuler.net/index.php?section=problems&id=1
'''
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
'''
Using Constraint Modeling fo... | """
Project Euler problem 1 in cpmpy.
http://projecteuler.net/index.php?section=problems&id=1
'''
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
'''
Using Constraint Modeling fo... | en | 004792103_hakank-hakank_euler1_909bb4f7b810.py | unknown | 557 |
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .. import models
if TYPE_CHECKING:
from ..catalog import Catalog
from ..package import Package
# NOTE:
# There should be a way to check the supported functionality of a concrete adapter
# For example, does it suport `read_catalog... | from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .. import models
if TYPE_CHECKING:
from ..catalog import Catalog
from ..package import Package
# NOTE:
# There should be a way to check the supported functionality of a concrete adapter
# For example, does it suport `read_catalog... | en | 000025574_frictionlessdata-frictionless-py_adapter_2f91f13adc77.py | unknown | 213 |
foo = []
def f1():
global foo
foo = [1, 2, 3]
def f2(x):
global foo
foo = foo + [x]
if 1 in foo:
return f<caret>oo
def f3(x):
return foo + [x]
def f4(x):
global foo
return foo + [x]
def f5(foo):
return foo
| foo = []
def f1():
global foo
foo = [1, 2, 3]
def f2(x):
global foo
foo = foo + [x]
if 1 in foo:
return f<caret>oo
def f3(x):
return foo + [x]
def f4(x):
global foo
return foo + [x]
def f5(foo):
return foo
| en | 005438157_JetBrains-intellij-community_renameGlobal_d1c83ab732a3.py | unknown | 113 |
import random
import warnings
from typing import (
Callable,
Iterable,
List,
Mapping,
Optional,
SupportsFloat,
Union,
cast,
)
import dask
import dask.dataframe as dd
import numpy as np
import pandas as pd
from kartothek.core.common_metadata import empty_dataframe_from_schema
from karto... | import random
import warnings
from typing import (
Callable,
Iterable,
List,
Mapping,
Optional,
SupportsFloat,
Union,
cast,
)
import dask
import dask.dataframe as dd
import numpy as np
import pandas as pd
from kartothek.core.common_metadata import empty_dataframe_from_schema
from karto... | en | 002589715_JDASoftwareGroup-kartothek_dataframe_95e008989cac.py | unknown | 6,382 |
import json
import os
from warnings import warn
def temperature_only_data_prep(observations, predictors, for_prediction=False,
verbose=True):
"""Create a numpy array of shape (a,b), where b
is equal to the sample size in observations, and a is
equal to the number of days in ... | import json
import os
from warnings import warn
def temperature_only_data_prep(observations, predictors, for_prediction=False,
verbose=True):
"""Create a numpy array of shape (a,b), where b
is equal to the sample size in observations, and a is
equal to the number of days in ... | en | 001948345_sdtaylor-pyPhenology_misc_f13a4e48f0e2.py | unknown | 1,257 |
import torch
from .convert import to_var
def sequence_mask(sequence_length, max_len=None):
"""
Args:
sequence_length (Variable, LongTensor) [batch_size]
- list of sequence length of each batch
max_len (int)
Return:
masks (bool): [batch_size, max_len]
- True ... | import torch
from .convert import to_var
def sequence_mask(sequence_length, max_len=None):
"""
Args:
sequence_length (Variable, LongTensor) [batch_size]
- list of sequence length of each batch
max_len (int)
Return:
masks (bool): [batch_size, max_len]
- True ... | en | 003877599_declare-lab-conv-emotion_mask_f0c27c49d57a.py | unknown | 438 |
# Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | en | 000322643_openstack-mistral_workbook_a70e79b40986.py | unknown | 2,224 |
import os
import os.path as osp
import scipy.io as sio
import numpy as np
import cv2
import random
import json
import math
from tqdm import tqdm
root_dir = './images' # define path here
save_dir = './annotations' # define path here
joint_num = 17
subject_list = [1, 5, 6, 7, 8, 9, 11]
action_idx = (2, 3, 4, 5, 6, 7, 8... | import os
import os.path as osp
import scipy.io as sio
import numpy as np
import cv2
import random
import json
import math
from tqdm import tqdm
root_dir = './images' # define path here
save_dir = './annotations' # define path here
joint_num = 17
subject_list = [1, 5, 6, 7, 8, 9, 11]
action_idx = (2, 3, 4, 5, 6, 7, 8... | en | 001243776_mks0601-3DMPPE_POSENET_RELEASE_h36m2coco_d90899441d7c.py | unknown | 1,883 |
#!/usr/bin/python3
import json
import tkinter as tk
from tkinter import ttk
from brownie.project import get_loaded_projects
from .console import Console, ConsoleButton
from .opcodes import OpcodeList, ScopingButton
from .report import HighlightSelect, ReportSelect
from .source import ContractSelect, SourceNoteBook
f... | #!/usr/bin/python3
import json
import tkinter as tk
from tkinter import ttk
from brownie.project import get_loaded_projects
from .console import Console, ConsoleButton
from .opcodes import OpcodeList, ScopingButton
from .report import HighlightSelect, ReportSelect
from .source import ContractSelect, SourceNoteBook
f... | en | 004154425_eth-brownie-brownie_root_cface55a8a51.py | unknown | 1,437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.