file_path
stringlengths
10
10
code
stringlengths
79
330k
code_en
stringlengths
79
330k
language
stringclasses
1 value
license
stringclasses
0 values
token_count
int32
24
158k
0037437.py
from classes.Despachante import * from classes.Sistema import * from classes.Processo import * from tkinter import * from tkinter import ttk from tkinter.filedialog import askopenfilename as fileChooser class EscDeProcessos: def __init__(self, master=None): #Tamanho da janela master.minsize(width=7...
from classes.Despachante import * from classes.Sistema import * from classes.Processo import * from tkinter import * from tkinter import ttk from tkinter.filedialog import askopenfilename as fileChooser class EscDeProcessos: def __init__(self, master=None): #Tamanho da janela master.minsize(width=7...
en
null
3,719
0036153.py
#!/usr/bin/env python # Copyright 2020 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. """Reports binary size metrics for LaCrOS build artifacts. More information at //docs/speed/binary_size/metrics.md. """ import argpars...
#!/usr/bin/env python # Copyright 2020 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. """Reports binary size metrics for LaCrOS build artifacts. More information at //docs/speed/binary_size/metrics.md. """ import argpars...
en
null
3,750
0035653.py
""" Convert characters (chr) to integer (int) labels and vice versa. REVIEW: index 0 bug, also see: https://github.com/baidu-research/warp-ctc/tree/master/tensorflow_binding `ctc_loss`_ maps labels from 0=<unused>, 1=<space>, 2=a, ..., 27=z, 28=<blank> See: https://www.tensorflow.org/api_docs/python/tf/nn/ctc_loss "...
""" Convert characters (chr) to integer (int) labels and vice versa. REVIEW: index 0 bug, also see: https://github.com/baidu-research/warp-ctc/tree/master/tensorflow_binding `ctc_loss`_ maps labels from 0=<unused>, 1=<space>, 2=a, ..., 27=z, 28=<blank> See: https://www.tensorflow.org/api_docs/python/tf/nn/ctc_loss "...
en
null
504
0037957.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
en
null
474
0001021.py
# Write a Python program to get execution time for a Python method. import time def sum_of_n_numbers(x): start_time = time.time() s = 0 for i in range(1, x + 1): s = s + i end_time = time.time() return s, end_time - start_time n = 5 print("\nTime to sum of 1 to ", n, " and required time...
# Write a Python program to get execution time for a Python method. import time def sum_of_n_numbers(x): start_time = time.time() s = 0 for i in range(1, x + 1): s = s + i end_time = time.time() return s, end_time - start_time n = 5 print("\nTime to sum of 1 to ", n, " and required time...
en
null
130
0017967.py
import re import time from django.conf import settings from django.utils.timezone import make_aware, make_naive, utc re_pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]+', re.UNICODE) def sanitize_unicode(u): # We may not be able to store all special characters thanks # to MySQL's boneheadedness, so acce...
import re import time from django.conf import settings from django.utils.timezone import make_aware, make_naive, utc re_pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]+', re.UNICODE) def sanitize_unicode(u): # We may not be able to store all special characters thanks # to MySQL's boneheadedness, so acce...
en
null
371
0048230.py
""" Implements the DIAL-protocol to communicate with the Chromecast """ from collections import namedtuple import json import logging import socket import ssl import urllib.request from uuid import UUID import zeroconf from .const import CAST_TYPE_CHROMECAST, CAST_TYPES, SERVICE_TYPE_HOST XML_NS_UPNP_DEVICE = "{urn:...
""" Implements the DIAL-protocol to communicate with the Chromecast """ from collections import namedtuple import json import logging import socket import ssl import urllib.request from uuid import UUID import zeroconf from .const import CAST_TYPE_CHROMECAST, CAST_TYPES, SERVICE_TYPE_HOST XML_NS_UPNP_DEVICE = "{urn:...
en
null
1,839
0019568.py
# coding: utf-8 """ Mux API Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. # noqa: E501 The version of the OpenAPI document: v1 Contact: devex@mux.com Gener...
# coding: utf-8 """ Mux API Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. # noqa: E501 The version of the OpenAPI document: v1 Contact: devex@mux.com Gener...
en
null
1,109
0033287.py
import os import markdown import codecs import difflib try: import nose except ImportError as e: msg = e.args[0] msg = msg + ". The nose testing framework is required to run the Python-" \ "Markdown tests. Run `pip install nose` to install the latest version." e.args = (msg,) + e.args[1:] ra...
import os import markdown import codecs import difflib try: import nose except ImportError as e: msg = e.args[0] msg = msg + ". The nose testing framework is required to run the Python-" \ "Markdown tests. Run `pip install nose` to install the latest version." e.args = (msg,) + e.args[1:] ra...
en
null
1,860
0018939.py
# -*- coding: utf-8 -*- """ Created on Mon Dec 21 16:44:36 2020 @author: wantysal """ # Standard library import import numpy as np # Local import from mosqito.sound_level_meter.noct_spectrum._getFrequencies import _getFrequencies def _spectrum_smoothing(freqs_in, spec, noct, low_freq, high_freq, freqs_out): """...
# -*- coding: utf-8 -*- """ Created on Mon Dec 21 16:44:36 2020 @author: wantysal """ # Standard library import import numpy as np # Local import from mosqito.sound_level_meter.noct_spectrum._getFrequencies import _getFrequencies def _spectrum_smoothing(freqs_in, spec, noct, low_freq, high_freq, freqs_out): """...
en
null
914
0008742.py
#!/usr/bin/env python3 """ An example script to send data to CommCare using the Submission API Usage: $ export CCHQ_PROJECT_SPACE=my-project-space $ export CCHQ_CASE_TYPE=person $ export CCHQ_USERNAME=user@example.com $ export CCHQ_PASSWORD=MijByG_se3EcKr.t $ export CCHQ_USER_ID=c0ffeeeeeb574eb8b5...
#!/usr/bin/env python3 """ An example script to send data to CommCare using the Submission API Usage: $ export CCHQ_PROJECT_SPACE=my-project-space $ export CCHQ_CASE_TYPE=person $ export CCHQ_USERNAME=user@example.com $ export CCHQ_PASSWORD=MijByG_se3EcKr.t $ export CCHQ_USER_ID=c0ffeeeeeb574eb8b5...
en
null
1,996
0010801.py
# Copyright (c) 2012 NTT DOCOMO, 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 requ...
# Copyright (c) 2012 NTT DOCOMO, 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 requ...
en
null
881
0007285.py
import hashlib from ecdsa.curves import Ed25519, SECP256k1 from .principal import Principal import ecdsa class Identity: def __init__(self, privkey = "", type = "ed25519", anonymous = False): privkey = bytes(bytearray.fromhex(privkey)) self.anonymous = anonymous if anonymous: r...
import hashlib from ecdsa.curves import Ed25519, SECP256k1 from .principal import Principal import ecdsa class Identity: def __init__(self, privkey = "", type = "ed25519", anonymous = False): privkey = bytes(bytearray.fromhex(privkey)) self.anonymous = anonymous if anonymous: r...
en
null
908
0019223.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Feb-09-21 22:23 # @Author : Kelly Hwong (dianhuangkan@gmail.com) import numpy as np import tensorflow as tf class XOR_Dataset(tf.keras.utils.Sequence): """XOR_Dataset.""" def __init__( self, batch_size=1, shuffle=False, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Feb-09-21 22:23 # @Author : Kelly Hwong (dianhuangkan@gmail.com) import numpy as np import tensorflow as tf class XOR_Dataset(tf.keras.utils.Sequence): """XOR_Dataset.""" def __init__( self, batch_size=1, shuffle=False, ...
en
null
600
0016186.py
""" This module is for managing OMERO imports, making use of the OMERO CLI, which can be called from a Python script. Note that this code requires a properly structured import.json file, which is produced during data intake (using the intake.py module). """ import logging from ezomero import post_dataset, post_projec...
""" This module is for managing OMERO imports, making use of the OMERO CLI, which can be called from a Python script. Note that this code requires a properly structured import.json file, which is produced during data intake (using the intake.py module). """ import logging from ezomero import post_dataset, post_projec...
en
null
3,805
0026028.py
import librosa import librosa.filters import numpy as np import tensorflow as tf from scipy import signal from scipy.io import wavfile def load_wav(path, sr): return librosa.core.load(path, sr=sr)[0] def save_wav(wav, path, sr): wav *= 32767 / max(0.01, np.max(np.abs(wav))) #proposed by @dsmiller wav...
import librosa import librosa.filters import numpy as np import tensorflow as tf from scipy import signal from scipy.io import wavfile def load_wav(path, sr): return librosa.core.load(path, sr=sr)[0] def save_wav(wav, path, sr): wav *= 32767 / max(0.01, np.max(np.abs(wav))) #proposed by @dsmiller wav...
en
null
2,853
0028922.py
from buildtest.cli.help import buildtest_help def test_buildtest_help(): buildtest_help(command="build") buildtest_help(command="buildspec") buildtest_help(command="config") buildtest_help(command="cdash") buildtest_help(command="history") buildtest_help(command="inspect") buildtest_help(c...
from buildtest.cli.help import buildtest_help def test_buildtest_help(): buildtest_help(command="build") buildtest_help(command="buildspec") buildtest_help(command="config") buildtest_help(command="cdash") buildtest_help(command="history") buildtest_help(command="inspect") buildtest_help(c...
en
null
140
0037594.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test resurrection of mined transactions when # the blockchain is re-organized. # from test_framework impo...
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test resurrection of mined transactions when # the blockchain is re-organized. # from test_framework impo...
en
null
1,050
0010807.py
#!/usr/bin/env python3 import logging import sys import subprocess from taupage import configure_logging, get_config def main(): """Configure custom sysctl parameters If a sysctl section is present, add the valid parameters to sysctl and reloads. """ CUSTOM_SYSCTL_CONF = '/etc/sysctl.d/99-custom.co...
#!/usr/bin/env python3 import logging import sys import subprocess from taupage import configure_logging, get_config def main(): """Configure custom sysctl parameters If a sysctl section is present, add the valid parameters to sysctl and reloads. """ CUSTOM_SYSCTL_CONF = '/etc/sysctl.d/99-custom.co...
en
null
397
0017586.py
# flake8: noqa from typing import Any from fugue_version import __version__ from IPython import get_ipython from IPython.display import Javascript from fugue_notebook.env import NotebookSetup, _setup_fugue_notebook _HIGHLIGHT_JS = r""" require(["codemirror/lib/codemirror"]); function set(str) { var obj = {}, wor...
# flake8: noqa from typing import Any from fugue_version import __version__ from IPython import get_ipython from IPython.display import Javascript from fugue_notebook.env import NotebookSetup, _setup_fugue_notebook _HIGHLIGHT_JS = r""" require(["codemirror/lib/codemirror"]); function set(str) { var obj = {}, wor...
en
null
1,006
0003641.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController, OVSController from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch, UserSwitch from mininet.node import IVSSwitch from mininet.cli import CLI from mininet.log import setLogL...
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController, OVSController from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch, UserSwitch from mininet.node import IVSSwitch from mininet.cli import CLI from mininet.log import setLogL...
en
null
921
0042754.py
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import shutil import signal import subprocess import tempfile import unittest from pathlib import Path from unittest.mock import MagicMock...
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import shutil import signal import subprocess import tempfile import unittest from pathlib import Path from unittest.mock import MagicMock...
en
null
3,124
0008033.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
en
null
3,467
0023876.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 29 09:23:17 2017 Annotations plugin for pysigview Ing.,Mgr. (MSc.) Jan Cimbálník Biomedical engineering International Clinical Research Center St. Anne's University Hospital in Brno Czech Republic & Mayo systems electrophysiology lab Mayo Clinic 20...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 29 09:23:17 2017 Annotations plugin for pysigview Ing.,Mgr. (MSc.) Jan Cimbálník Biomedical engineering International Clinical Research Center St. Anne's University Hospital in Brno Czech Republic & Mayo systems electrophysiology lab Mayo Clinic 20...
en
null
1,734
0032740.py
#!/usr/bin/env python3 import logging import subprocess import os import time import shutil from collections import defaultdict import random import json import csv MAX_RETRY = 2 SLEEP_BETWEEN_RETRIES = 5 CLICKHOUSE_BINARY_PATH = "/usr/bin/clickhouse" CLICKHOUSE_ODBC_BRIDGE_BINARY_PATH = "/usr/bin/clickhouse-odbc-br...
#!/usr/bin/env python3 import logging import subprocess import os import time import shutil from collections import defaultdict import random import json import csv MAX_RETRY = 2 SLEEP_BETWEEN_RETRIES = 5 CLICKHOUSE_BINARY_PATH = "/usr/bin/clickhouse" CLICKHOUSE_ODBC_BRIDGE_BINARY_PATH = "/usr/bin/clickhouse-odbc-br...
en
null
6,455
0018341.py
"""Added notifications Revision ID: f0793141fd6b Revises: 9ecc68fdc92d Create Date: 2020-05-02 17:17:31.252794 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "f0793141fd6b" down_revision = "9ecc68fdc92d" branch_labels = None depends_on = None def upgrade(): ...
"""Added notifications Revision ID: f0793141fd6b Revises: 9ecc68fdc92d Create Date: 2020-05-02 17:17:31.252794 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "f0793141fd6b" down_revision = "9ecc68fdc92d" branch_labels = None depends_on = None def upgrade(): ...
en
null
521
0017869.py
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/4/6 10:55 # @Author : Yunhao Cao # @File : train_set.py import os import re import shutil import tool import config __author__ = 'Yunhao Cao' __all__ = [ '', ] level_list = config.LV_LIST classes = config.NUM_OF_LEVEL validation_rate = config....
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/4/6 10:55 # @Author : Yunhao Cao # @File : train_set.py import os import re import shutil import tool import config __author__ = 'Yunhao Cao' __all__ = [ '', ] level_list = config.LV_LIST classes = config.NUM_OF_LEVEL validation_rate = config....
en
null
1,579
0018566.py
"""Manages cached post data.""" import math import collections import logging import ujson as json from toolz import partition_all from hive.db.adapter import Db from hive.utils.post import post_basic, post_legacy, post_payout, post_stats from hive.utils.timer import Timer from hive.indexer.accounts import Accounts ...
"""Manages cached post data.""" import math import collections import logging import ujson as json from toolz import partition_all from hive.db.adapter import Db from hive.utils.post import post_basic, post_legacy, post_payout, post_stats from hive.utils.timer import Timer from hive.indexer.accounts import Accounts ...
en
null
5,596
0026306.py
#!/usr/bin/env python import rospy from std_msgs.msg import Bool from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport from geometry_msgs.msg import TwistStamped import math from twist_controller import Controller ''' You can build this node only after you have built (or partially built) th...
#!/usr/bin/env python import rospy from std_msgs.msg import Bool from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport from geometry_msgs.msg import TwistStamped import math from twist_controller import Controller ''' You can build this node only after you have built (or partially built) th...
en
null
1,498
0049122.py
import numpy as np from numpy.random import randn #This function is taken from Dr Fayyaz ul Amir Afsar Minhas (Github User: foxtrotmike) def getExamples(n=100,d=2): """ Generates n d-dimensional normally distributed examples of each class The mean of the positive class is [1] and for the negative c...
import numpy as np from numpy.random import randn #This function is taken from Dr Fayyaz ul Amir Afsar Minhas (Github User: foxtrotmike) def getExamples(n=100,d=2): """ Generates n d-dimensional normally distributed examples of each class The mean of the positive class is [1] and for the negative c...
en
null
569
0018889.py
from selenium import webdriver from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver....
from selenium import webdriver from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver....
en
null
4,216
0047805.py
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """OSX platform implementation.""" import errno import functools import os from collections import namedtuple from . import _common from . import _psposi...
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """OSX platform implementation.""" import errno import functools import os from collections import namedtuple from . import _common from . import _psposi...
en
null
4,683
0019072.py
#!/usr/bin/python # Copyright (C) 2003. Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # Test that the <dll-path> property is correctly set when using # <hardcode-dll-paths>true. import BoostBuild ...
#!/usr/bin/python # Copyright (C) 2003. Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # Test that the <dll-path> property is correctly set when using # <hardcode-dll-paths>true. import BoostBuild ...
en
null
1,542
0040242.py
#!/usr/bin/env python # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-array/blob/master/LICENSE import codecs import collections import numbers try: from collections.abc import Iterable except ImportError: from collections import Iterable import numpy import awkward.type import awkward.uti...
#!/usr/bin/env python # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-array/blob/master/LICENSE import codecs import collections import numbers try: from collections.abc import Iterable except ImportError: from collections import Iterable import numpy import awkward.type import awkward.uti...
en
null
4,309
0019711.py
import json import requests import sys import os import socket import fcntl import struct #info_device={"MAC_ADDRESS":"xx","IP_ADDRESS":"xxx","BLOCK_ID":"01","STOP_ID":"xxx"} #info_buncher={"BUNCHER_ID":"xx","BUNCH_ID":"xx","COMPOSITION_ID":"xx","TUB_ID":"xx","TxR":"xx","GR":"xx","VARIETY_ID":"xx","BLOCK_ID":"xx"} d...
import json import requests import sys import os import socket import fcntl import struct #info_device={"MAC_ADDRESS":"xx","IP_ADDRESS":"xxx","BLOCK_ID":"01","STOP_ID":"xxx"} #info_buncher={"BUNCHER_ID":"xx","BUNCH_ID":"xx","COMPOSITION_ID":"xx","TUB_ID":"xx","TxR":"xx","GR":"xx","VARIETY_ID":"xx","BLOCK_ID":"xx"} d...
en
null
839
0012306.py
""" https://leetcode.com/problems/combination-sum-iii/ Tags: Practice; Concepts; Algorithms; Recursion/BackTracking; Medium """ from typing import List class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: # Create a list of nums to choose fromx return self.combi...
""" https://leetcode.com/problems/combination-sum-iii/ Tags: Practice; Concepts; Algorithms; Recursion/BackTracking; Medium """ from typing import List class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: # Create a list of nums to choose fromx return self.combi...
en
null
443
0017198.py
from textwrap import wrap, fill from tqdm import tqdm from decimal import Decimal from json import dumps from mysql.connector.conversion import MySQLConverterBase from mysql.toolkit.utils import cols_str, wrap from mysql.toolkit.commands.dump import write_text def insert_statement(table, columns, values): """Gen...
from textwrap import wrap, fill from tqdm import tqdm from decimal import Decimal from json import dumps from mysql.connector.conversion import MySQLConverterBase from mysql.toolkit.utils import cols_str, wrap from mysql.toolkit.commands.dump import write_text def insert_statement(table, columns, values): """Gen...
en
null
870
0021698.py
import subprocess import re import os from ajenti.api import plugin from ajenti.api.sensors import Sensor from ajenti.plugins.dashboard.api import ConfigurableWidget @plugin class SMARTSensor (Sensor): id = 'smart' timeout = 5 def get_variants(self): r = [] for s in os.listdir('/dev'): ...
import subprocess import re import os from ajenti.api import plugin from ajenti.api.sensors import Sensor from ajenti.plugins.dashboard.api import ConfigurableWidget @plugin class SMARTSensor (Sensor): id = 'smart' timeout = 5 def get_variants(self): r = [] for s in os.listdir('/dev'): ...
en
null
622
0029770.py
from typing import Union, List import torch from torch import nn as nn from torch.nn import functional as F from models.layers.create_act import get_act_layer from .trace_utils import _assert class BatchNormAct2d(nn.BatchNorm2d): """BatchNorm + Activation This module performs BatchNorm + Activation in a man...
from typing import Union, List import torch from torch import nn as nn from torch.nn import functional as F from models.layers.create_act import get_act_layer from .trace_utils import _assert class BatchNormAct2d(nn.BatchNorm2d): """BatchNorm + Activation This module performs BatchNorm + Activation in a man...
en
null
1,920
0046439.py
# -*- coding: utf-8 -*- # Copyright (c) 2021. Jeffrey Nirschl. All rights reserved. # # Licensed under the MIT license. See the LICENSE file in the project # root directory for license information. # # Time-stamp: <> # ====================================================================== import argparse...
# -*- coding: utf-8 -*- # Copyright (c) 2021. Jeffrey Nirschl. All rights reserved. # # Licensed under the MIT license. See the LICENSE file in the project # root directory for license information. # # Time-stamp: <> # ====================================================================== import argparse...
en
null
774
0036677.py
""" Colouring chromosomes by ancestries inferred by a reference panel """ from __future__ import absolute_import import logging from utils import compute_referencepanel, compute_haplotypes import sys import argparse from cyvcf2 import VCF, Writer import platform import resource import random from core import hmm from ...
""" Colouring chromosomes by ancestries inferred by a reference panel """ from __future__ import absolute_import import logging from utils import compute_referencepanel, compute_haplotypes import sys import argparse from cyvcf2 import VCF, Writer import platform import resource import random from core import hmm from ...
en
null
2,339
0049376.py
from flask_wtf import FlaskForm from wtforms import StringField,PasswordField,BooleanField,SubmitField from wtforms.validators import Required,Email,EqualTo,Length from ..models import User from wtforms import ValidationError class LoginForm(FlaskForm): email = StringField('Your Email Address',validators=[Required...
from flask_wtf import FlaskForm from wtforms import StringField,PasswordField,BooleanField,SubmitField from wtforms.validators import Required,Email,EqualTo,Length from ..models import User from wtforms import ValidationError class LoginForm(FlaskForm): email = StringField('Your Email Address',validators=[Required...
en
null
322
0042882.py
""" Tests for TradingCalendarDispatcher. """ from unittest import TestCase from trading_calendars.calendar_utils import TradingCalendarDispatcher from trading_calendars.errors import ( CalendarNameCollision, CyclicCalendarAlias, InvalidCalendarName, ) from trading_calendars.exchange_calendar_iepa import IE...
""" Tests for TradingCalendarDispatcher. """ from unittest import TestCase from trading_calendars.calendar_utils import TradingCalendarDispatcher from trading_calendars.errors import ( CalendarNameCollision, CyclicCalendarAlias, InvalidCalendarName, ) from trading_calendars.exchange_calendar_iepa import IE...
en
null
1,032
0022865.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Profile mem usage envelope of IPython commands and report interactively""" from __future__ import division # 1/2 == 0.5, as in Py3 from __future__ import absolute_import # avoid hiding global modules with locals from __future__ import print_function # force use of pri...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Profile mem usage envelope of IPython commands and report interactively""" from __future__ import division # 1/2 == 0.5, as in Py3 from __future__ import absolute_import # avoid hiding global modules with locals from __future__ import print_function # force use of pri...
en
null
1,249
0031096.py
from django.conf import settings from security.json_web_token import JSONWebToken def decode_response(response): return JSONWebToken.decode( data=response.content, key=settings.OPENLDAP_JWT_KEY, audience=settings.OPENLDAP_JWT_AUDIENCE, algorithms=[settings.OPENLDAP_JWT_ALGORITHM],...
from django.conf import settings from security.json_web_token import JSONWebToken def decode_response(response): return JSONWebToken.decode( data=response.content, key=settings.OPENLDAP_JWT_KEY, audience=settings.OPENLDAP_JWT_AUDIENCE, algorithms=[settings.OPENLDAP_JWT_ALGORITHM],...
en
null
103
0043308.py
# -*- coding: utf-8 -*- ############################################################################### # # ShowUser # Returns information about given user. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ...
# -*- coding: utf-8 -*- ############################################################################### # # ShowUser # Returns information about given user. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ...
en
null
960
0002358.py
#!/usr/bin/python from flask import Flask, request, flash, redirect, render_template, jsonify from flaskext.mysql import MySQL from flask_wtf import Form from wtforms import StringField, PasswordField from wtforms.validators import DataRequired import twilio.twiml import random import requests import json import omdb ...
#!/usr/bin/python from flask import Flask, request, flash, redirect, render_template, jsonify from flaskext.mysql import MySQL from flask_wtf import Form from wtforms import StringField, PasswordField from wtforms.validators import DataRequired import twilio.twiml import random import requests import json import omdb ...
en
null
7,533
0014371.py
import pytest import unittest import os from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from ai_research.mag.mag_orm import Base from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) class TestMag(unittest.TestCase): """Check that the MAG ORM works as expected""" ...
import pytest import unittest import os from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from ai_research.mag.mag_orm import Base from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) class TestMag(unittest.TestCase): """Check that the MAG ORM works as expected""" ...
en
null
215
0025054.py
#!/usr/bin/env python # Copyright 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Make sure the base address setting is extracted properly. """ import TestGyp import re import sys if sys.platform == 'win3...
#!/usr/bin/env python # Copyright 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Make sure the base address setting is extracted properly. """ import TestGyp import re import sys if sys.platform == 'win3...
en
null
682
0035601.py
# Copyright 2021 Dynatrace 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 agreed t...
# Copyright 2021 Dynatrace 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 agreed t...
en
null
447
0035852.py
""" Dashboard para o admin com controlcenter. Nesse arquivo estao todos os widgets e funcoes para os graficos e listas. """ from controlcenter import Dashboard, widgets from likebee.core.models import Task class EmptyDashboard(Dashboard): """Funcao em branco.""" pass class MyWidget0(widgets.Widget): ...
""" Dashboard para o admin com controlcenter. Nesse arquivo estao todos os widgets e funcoes para os graficos e listas. """ from controlcenter import Dashboard, widgets from likebee.core.models import Task class EmptyDashboard(Dashboard): """Funcao em branco.""" pass class MyWidget0(widgets.Widget): ...
en
null
347
0034417.py
""" Entry point for training and evaluating a lemmatizer. This lemmatizer combines a neural sequence-to-sequence architecture with an `edit` classifier and two dictionaries to produce robust lemmas from word forms. For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf. """ import loggi...
""" Entry point for training and evaluating a lemmatizer. This lemmatizer combines a neural sequence-to-sequence architecture with an `edit` classifier and two dictionaries to produce robust lemmas from word forms. For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf. """ import loggi...
en
null
3,489
0042080.py
# Copyright 2013-2022 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) import os from spack import * class Netgauge(AutotoolsPackage): """Netgauge is a high-precision network parameter m...
# Copyright 2013-2022 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) import os from spack import * class Netgauge(AutotoolsPackage): """Netgauge is a high-precision network parameter m...
en
null
347
0013754.py
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725 import unittest from ansiblelint.rules import RulesCollection from ansiblelint.rules.ShellWithoutPipefail import ShellWithoutPipefail from ansiblelint.testing import RunFromText FAIL_TASKS = ''' --- - hosts: localhost become: no tasks: ...
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725 import unittest from ansiblelint.rules import RulesCollection from ansiblelint.rules.ShellWithoutPipefail import ShellWithoutPipefail from ansiblelint.testing import RunFromText FAIL_TASKS = ''' --- - hosts: localhost become: no tasks: ...
en
null
613
0016339.py
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT from unittest.mock import patch, Mock import unittest import pytest from cla.models.dynamo_models import User, Project, Company, CCLAWhitelistRequest from cla.models.event_types import EventType from cla.controll...
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT from unittest.mock import patch, Mock import unittest import pytest from cla.models.dynamo_models import User, Project, Company, CCLAWhitelistRequest from cla.models.event_types import EventType from cla.controll...
en
null
2,020
0031262.py
# This file is part of the Python aiocoap library project. # # Copyright (c) 2012-2014 Maciej Wasilak <http://sixpinetrees.blogspot.com/>, # 2013-2014 Christian Amsüss <c.amsuess@energyharvesting.at> # # aiocoap is free software, this file is published under the MIT license as # described in the accompany...
# This file is part of the Python aiocoap library project. # # Copyright (c) 2012-2014 Maciej Wasilak <http://sixpinetrees.blogspot.com/>, # 2013-2014 Christian Amsüss <c.amsuess@energyharvesting.at> # # aiocoap is free software, this file is published under the MIT license as # described in the accompany...
en
null
1,679
0005917.py
from rply import ParserGenerator from poketype.ast import Number, Boolean, NegNumber class DataTypes(): def __init__(self, pg: ParserGenerator) -> None: @pg.production('expression : NUMBER') def expression_number(p): return Number(int(p[0].getstr())) @pg.production('expression : BOOLEAN') def expressio...
from rply import ParserGenerator from poketype.ast import Number, Boolean, NegNumber class DataTypes(): def __init__(self, pg: ParserGenerator) -> None: @pg.production('expression : NUMBER') def expression_number(p): return Number(int(p[0].getstr())) @pg.production('expression : BOOLEAN') def expressio...
en
null
213
0029886.py
""" Low-dependency indexing utilities. """ import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries # ----------------------------------------------------------- # Indexer Identification def is_list_like_indexer(key) -> bool: """ C...
""" Low-dependency indexing utilities. """ import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries # ----------------------------------------------------------- # Indexer Identification def is_list_like_indexer(key) -> bool: """ C...
en
null
1,780
0011226.py
from threading import Lock class FooBar: def __init__(self, n): self.n = n self.lock1 = Lock() self.lock2 = Lock() self.lock2.acquire() def foo(self, printFoo: "Callable[[], None]") -> None: for _ in range(self.n): self.lock1.acquire() printFoo(...
from threading import Lock class FooBar: def __init__(self, n): self.n = n self.lock1 = Lock() self.lock2 = Lock() self.lock2.acquire() def foo(self, printFoo: "Callable[[], None]") -> None: for _ in range(self.n): self.lock1.acquire() printFoo(...
en
null
170
0034082.py
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mempool persistence. By default, b3ccd will dump mempool on shutdown and then reload it on startu...
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mempool persistence. By default, b3ccd will dump mempool on shutdown and then reload it on startu...
en
null
1,770
0047034.py
""" 方法1: hash表+排序+贪心 时间复杂度:O(wlogw+blob) 空间复杂度:O(b) 方法2: 排序+贪心 时间复杂度:O(w+blogb) 空间复杂度:O(1) case1: 4 3 4 1 5 3 3 4 1 r: 3 case2: 1 2 2 3 4 3 4 1 2 r: 3 case3: 1 2 3 1 2 3 4 r: 1 case4: 4 5 6 3 3 3 3 3 r: 0 case4: 4 4 1 1 5 4 3 3 1 r: 4 1.当有双指针时,其中一个指针必须遍历完所有元素,则可将while替换为for循环 2.这个跟分发饼干有些类似,关键在于将高低不同的warehouse转...
""" 方法1: hash表+排序+贪心 时间复杂度:O(wlogw+blob) 空间复杂度:O(b) 方法2: 排序+贪心 时间复杂度:O(w+blogb) 空间复杂度:O(1) case1: 4 3 4 1 5 3 3 4 1 r: 3 case2: 1 2 2 3 4 3 4 1 2 r: 3 case3: 1 2 3 1 2 3 4 r: 1 case4: 4 5 6 3 3 3 3 3 r: 0 case4: 4 4 1 1 5 4 3 3 1 r: 4 1.当有双指针时,其中一个指针必须遍历完所有元素,则可将while替换为for循环 2.这个跟分发饼干有些类似,关键在于将高低不同的warehouse转...
en
null
1,129
0006588.py
import unittest from MusicTheory.pitch.Accidental import Accidental import Framework.ConstMeta """ Degreeのテスト。 """ class TestAccidental(unittest.TestCase): def test_Accidentals(self): self.assertEqual(Accidental.Accidentals, {'♯': 1, '#': 1, '+': 1, '♭': -1, 'b': -1, '-': -1}) def test_Accidentals_NotSe...
import unittest from MusicTheory.pitch.Accidental import Accidental import Framework.ConstMeta """ Degreeのテスト。 """ class TestAccidental(unittest.TestCase): def test_Accidentals(self): self.assertEqual(Accidental.Accidentals, {'♯': 1, '#': 1, '+': 1, '♭': -1, 'b': -1, '-': -1}) def test_Accidentals_NotSe...
en
null
608
0015428.py
from kazoo.client import KazooClient from kazoo.exceptions import NoNodeError from kazoo.exceptions import NodeExistsError _callback = None _zk = None def init_kazoo(hosts, data_path, callback, children=True): global _zk global _callback _zk = KazooClient(hosts=hosts) _zk.start() _callback = ca...
from kazoo.client import KazooClient from kazoo.exceptions import NoNodeError from kazoo.exceptions import NodeExistsError _callback = None _zk = None def init_kazoo(hosts, data_path, callback, children=True): global _zk global _callback _zk = KazooClient(hosts=hosts) _zk.start() _callback = ca...
en
null
211
0018958.py
from numpy import pi from numpy import array from numpy import linspace from numpy import arange from numpy import zeros from numpy import column_stack from numpy import array from time import time from math import radians import cairocffi as cairo from sand import Sand from ..lib.sand_spline import SandSpline from .....
from numpy import pi from numpy import array from numpy import linspace from numpy import arange from numpy import zeros from numpy import column_stack from numpy import array from time import time from math import radians import cairocffi as cairo from sand import Sand from ..lib.sand_spline import SandSpline from .....
en
null
1,137
0044175.py
from flask import Flask,render_template, url_for, flash, redirect from forms import RegistrationForm, LoginForm from app import app app = Flask(__name__) app.config['SECRET_KEY'] = '4da30bd01c4cd12344b9a7d1b4fb7784' reviews = [ { 'author': 'John james', 'title': 'Blog Review ', 'content': ...
from flask import Flask,render_template, url_for, flash, redirect from forms import RegistrationForm, LoginForm from app import app app = Flask(__name__) app.config['SECRET_KEY'] = '4da30bd01c4cd12344b9a7d1b4fb7784' reviews = [ { 'author': 'John james', 'title': 'Blog Review ', 'content': ...
en
null
501
0023917.py
#!/usr/bin/env python """ _JobStatusMonitoring_ MySQL implementation for loading a job by scheduler status """ from WMCore.Database.DBFormatter import DBFormatter class JobStatusForMonitoring(DBFormatter): """ _LoadForMonitoring_ Load all jobs with a certain scheduler status including all the joine...
#!/usr/bin/env python """ _JobStatusMonitoring_ MySQL implementation for loading a job by scheduler status """ from WMCore.Database.DBFormatter import DBFormatter class JobStatusForMonitoring(DBFormatter): """ _LoadForMonitoring_ Load all jobs with a certain scheduler status including all the joine...
en
null
779
0001243.py
#!/usr/bin/env python """ Copyright 2017 ARM Limited 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...
#!/usr/bin/env python """ Copyright 2017 ARM Limited 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...
en
null
324
0030308.py
"""Class for RESQML Horizon Interpretation organizational objects.""" from ._utils import (equivalent_extra_metadata, alias_for_attribute, extract_has_occurred_during, equivalent_chrono_pairs, create_xml_has_occurred_during) import resqpy.olio.uuid as bu import resqpy.olio.xml_et as rqet from res...
"""Class for RESQML Horizon Interpretation organizational objects.""" from ._utils import (equivalent_extra_metadata, alias_for_attribute, extract_has_occurred_during, equivalent_chrono_pairs, create_xml_has_occurred_during) import resqpy.olio.uuid as bu import resqpy.olio.xml_et as rqet from res...
en
null
2,143
0049552.py
import curses from castero import helpers from castero.config import Config from castero.menu import Menu from castero.menus.chronomenu import ChronoMenu from castero.perspective import Perspective from castero.player import Player class ChronoPerspective(Perspective): """The chronological perspective. This...
import curses from castero import helpers from castero.config import Config from castero.menu import Menu from castero.menus.chronomenu import ChronoMenu from castero.perspective import Perspective from castero.player import Player class ChronoPerspective(Perspective): """The chronological perspective. This...
en
null
2,163
0012908.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
en
null
3,414
0015508.py
from django.core.management.base import BaseCommand from dimagi.utils.couch.database import iter_docs from corehq.apps.domain.models import Domain class Command(BaseCommand): def _get_domains_without_last_modified_date(self): docs = iter_docs(Domain.get_db(), [ domain['id'] for ...
from django.core.management.base import BaseCommand from dimagi.utils.couch.database import iter_docs from corehq.apps.domain.models import Domain class Command(BaseCommand): def _get_domains_without_last_modified_date(self): docs = iter_docs(Domain.get_db(), [ domain['id'] for ...
en
null
219
0045194.py
"""Helpers for script and condition tracing.""" from __future__ import annotations from collections import deque from collections.abc import Callable, Generator from contextlib import contextmanager from contextvars import ContextVar from functools import wraps from typing import Any, cast from homeassistant.helpers....
"""Helpers for script and condition tracing.""" from __future__ import annotations from collections import deque from collections.abc import Callable, Generator from contextlib import contextmanager from contextvars import ContextVar from functools import wraps from typing import Any, cast from homeassistant.helpers....
en
null
2,344
0026932.py
from __future__ import print_function from collections import Counter import string import re import argparse import json import sys import os '''KorQuAD v1.0에 대한 공식 평가 스크립트 ''' '''본 스크립트는 SQuAD v1.1 평가 스크립트 https://rajpurkar.github.io/SQuAD-explorer/ 를 바탕으로 작성됨.''' def normalize_answer(s): def remove_(text): ...
from __future__ import print_function from collections import Counter import string import re import argparse import json import sys import os '''KorQuAD v1.0에 대한 공식 평가 스크립트 ''' '''본 스크립트는 SQuAD v1.1 평가 스크립트 https://rajpurkar.github.io/SQuAD-explorer/ 를 바탕으로 작성됨.''' def normalize_answer(s): def remove_(text): ...
en
null
1,493
0012152.py
""" What do you want from this file? 1. I need to look up when to raise what. Then read on the docstrings. 2. I have to add a new exception. Make sure you catch it somewhere. Sometimes you'll realize you cannot catch it. Especially, if your new exception indicates bug in the Raiden codebase, you are no...
""" What do you want from this file? 1. I need to look up when to raise what. Then read on the docstrings. 2. I have to add a new exception. Make sure you catch it somewhere. Sometimes you'll realize you cannot catch it. Especially, if your new exception indicates bug in the Raiden codebase, you are no...
en
null
3,266
0022330.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
en
null
7,249
0025895.py
import json import logging import os from datetime import datetime from pathlib import Path from telegram import ParseMode from telegram.ext import Updater, MessageHandler, Filters from uploader import Uploader logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) log...
import json import logging import os from datetime import datetime from pathlib import Path from telegram import ParseMode from telegram.ext import Updater, MessageHandler, Filters from uploader import Uploader logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) log...
en
null
1,688
0013410.py
import json import os import discord import asyncio import datetime from discord.ext import commands, tasks with open('config.json') as e: infos = json.load(e) token = infos['token'] prefix = infos['prefix'] lara = commands.Bot(command_prefix=prefix, case_insensitive=True, intents=discord.Intents.all()) ...
import json import os import discord import asyncio import datetime from discord.ext import commands, tasks with open('config.json') as e: infos = json.load(e) token = infos['token'] prefix = infos['prefix'] lara = commands.Bot(command_prefix=prefix, case_insensitive=True, intents=discord.Intents.all()) ...
en
null
604
0020047.py
#!/usr/bin/env python3 from .general_common import States from Control.control_common import ButtonIndex def getState(state, my_joystick): # ============================================================== if state == States.IDLE: if my_joystick.get_button_val(ButtonIndex.SIDE_BUTTON) == 1: r...
#!/usr/bin/env python3 from .general_common import States from Control.control_common import ButtonIndex def getState(state, my_joystick): # ============================================================== if state == States.IDLE: if my_joystick.get_button_val(ButtonIndex.SIDE_BUTTON) == 1: r...
en
null
526
0029486.py
from unittest import TestCase import simplejson as json class TestBigintAsString(TestCase): values = [(200, 200), ((2 ** 53) - 1, 9007199254740991), ((2 ** 53), '9007199254740992'), ((2 ** 53) + 1, '9007199254740993'), (-100, -100), ((-2 ** 53)...
from unittest import TestCase import simplejson as json class TestBigintAsString(TestCase): values = [(200, 200), ((2 ** 53) - 1, 9007199254740991), ((2 ** 53), '9007199254740992'), ((2 ** 53) + 1, '9007199254740993'), (-100, -100), ((-2 ** 53)...
en
null
600
0024565.py
#!/usr/bin/env python # Copyright 2014 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. """Code generator DeviceCapabilities literal.""" import argparse import ctypes import glob import evdev import os import sys TEST_DA...
#!/usr/bin/env python # Copyright 2014 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. """Code generator DeviceCapabilities literal.""" import argparse import ctypes import glob import evdev import os import sys TEST_DA...
en
null
1,655
0049008.py
"""Fixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('c...
"""Fixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('c...
en
null
2,382
0006503.py
# Copyright 2013-2022 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 Dftfe(CMakePackage): """Real-space DFT calculations using Finite Elements""" homepage ...
# Copyright 2013-2022 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 Dftfe(CMakePackage): """Real-space DFT calculations using Finite Elements""" homepage ...
en
null
1,046
0027199.py
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum import collections if parse_version(kaitaistruct.__version__) < parse_versi...
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum import collections if parse_version(kaitaistruct.__version__) < parse_versi...
en
null
7,617
0029281.py
#!/usr/bin/python3 from __future__ import annotations from json import loads from os.path import abspath, dirname, join class Language: ''' This class will hold information about a certain langauge ''' _countrySpecific = '' def __init__(self, iso3, iso, name): self.iso3 = iso3 ...
#!/usr/bin/python3 from __future__ import annotations from json import loads from os.path import abspath, dirname, join class Language: ''' This class will hold information about a certain langauge ''' _countrySpecific = '' def __init__(self, iso3, iso, name): self.iso3 = iso3 ...
en
null
915
0002131.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 7 09:36:45 2019 @author: MyPC """ import pandas as pd import matplotlib.pyplot as plt import matplotlib import math import pymssql import numpy as np import copy import re from sklearn import preprocessing from sklearn.linear_model import LinearRegression...
# -*- coding: utf-8 -*- """ Created on Wed Aug 7 09:36:45 2019 @author: MyPC """ import pandas as pd import matplotlib.pyplot as plt import matplotlib import math import pymssql import numpy as np import copy import re from sklearn import preprocessing from sklearn.linear_model import LinearRegression...
en
null
1,683
0015121.py
from __future__ import print_function import os import subprocess import sys import six from kecpkg.files.rendering import render_to_file from kecpkg.utils import (ensure_dir_exists, get_proper_python, NEED_SUBPROCESS_SHELL, venv, echo_success, echo_failure, echo_info) def create_package(...
from __future__ import print_function import os import subprocess import sys import six from kecpkg.files.rendering import render_to_file from kecpkg.utils import (ensure_dir_exists, get_proper_python, NEED_SUBPROCESS_SHELL, venv, echo_success, echo_failure, echo_info) def create_package(...
en
null
1,413
0044369.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
en
null
1,896
0020230.py
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
en
null
3,961
0043271.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: José Sánchez-Gallego (gallegoj@uw.edu) # @Date: 2020-01-10 # @Filename: exposure.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) from __future__ import annotations import asyncio import functools import os import pathlib import r...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: José Sánchez-Gallego (gallegoj@uw.edu) # @Date: 2020-01-10 # @Filename: exposure.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) from __future__ import annotations import asyncio import functools import os import pathlib import r...
en
null
3,264
0041902.py
import re import time import random import logging import requests from base import BaseBot logger = logging.getLogger(__name__) MEME_URL = 'http://www.memes.com' MEME_REGEX = re.compile(r'^!meme') SCRAPE_REGEX = re.compile(r'<img id="image_\d+" src="([^"]+)"') def random_meme(): try: html = requests.ge...
import re import time import random import logging import requests from base import BaseBot logger = logging.getLogger(__name__) MEME_URL = 'http://www.memes.com' MEME_REGEX = re.compile(r'^!meme') SCRAPE_REGEX = re.compile(r'<img id="image_\d+" src="([^"]+)"') def random_meme(): try: html = requests.ge...
en
null
570
0034604.py
import imp import ssl import sys from amqpstorm import AMQPConnectionError from amqpstorm import UriConnection from amqpstorm import compatibility from amqpstorm.tests.utility import TestFramework from amqpstorm.tests.utility import unittest class UriConnectionExceptionTests(TestFramework): @unittest.skipIf(sys....
import imp import ssl import sys from amqpstorm import AMQPConnectionError from amqpstorm import UriConnection from amqpstorm import compatibility from amqpstorm.tests.utility import TestFramework from amqpstorm.tests.utility import unittest class UriConnectionExceptionTests(TestFramework): @unittest.skipIf(sys....
en
null
830
0049150.py
from test.integration.base import DBTIntegrationTest, use_profile import os from dbt.logger import log_manager from test.integration.base import normalize import json class TestStrictUndefined(DBTIntegrationTest): @property def schema(self): return 'dbt_ls_047' @staticmethod def dir(value):...
from test.integration.base import DBTIntegrationTest, use_profile import os from dbt.logger import log_manager from test.integration.base import normalize import json class TestStrictUndefined(DBTIntegrationTest): @property def schema(self): return 'dbt_ls_047' @staticmethod def dir(value):...
en
null
5,367
0029665.py
import asyncio from mitmproxy.test.taddons import RecordingMaster async def err(): raise RuntimeError async def test_exception_handler(): m = RecordingMaster(None) running = asyncio.create_task(m.run()) asyncio.create_task(err()) await m.await_log("Traceback", level="error") m.shutdown() ...
import asyncio from mitmproxy.test.taddons import RecordingMaster async def err(): raise RuntimeError async def test_exception_handler(): m = RecordingMaster(None) running = asyncio.create_task(m.run()) asyncio.create_task(err()) await m.await_log("Traceback", level="error") m.shutdown() ...
en
null
105
0028355.py
# Copyright 2012-2015 The Meson development team # 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 agree...
# Copyright 2012-2015 The Meson development team # 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 agree...
en
null
8,895
0032045.py
from sympy import Abs, exp, Expr, I, pi, Q, Rational, refine, S, sqrt from sympy.abc import x, y, z def test_Abs(): assert refine(Abs(x), Q.positive(x)) == x assert refine(1 + Abs(x), Q.positive(x)) == 1 + x assert refine(Abs(x), Q.negative(x)) == -x assert refine(1 + Abs(x), Q.negative(x)) == 1 - x ...
from sympy import Abs, exp, Expr, I, pi, Q, Rational, refine, S, sqrt from sympy.abc import x, y, z def test_Abs(): assert refine(Abs(x), Q.positive(x)) == x assert refine(1 + Abs(x), Q.positive(x)) == 1 + x assert refine(Abs(x), Q.negative(x)) == -x assert refine(1 + Abs(x), Q.negative(x)) == 1 - x ...
en
null
828
0031499.py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities __a...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities __a...
en
null
4,775
0005237.py
import json import os from base64 import b64decode from datetime import timedelta from threading import Semaphore import github from dotmap import DotMap from github import GithubException from conan_inquiry.transformers.base import BaseGithubTransformer from conan_inquiry.util.general import render_readme from conan...
import json import os from base64 import b64decode from datetime import timedelta from threading import Semaphore import github from dotmap import DotMap from github import GithubException from conan_inquiry.transformers.base import BaseGithubTransformer from conan_inquiry.util.general import render_readme from conan...
en
null
2,286
0024100.py
from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework.test import APIClient from rest_framework import status CREATE_USER_URL = reverse('user:create') # TOKEN_URL = reverse('user:token') ME_URL = reverse('user:me') def create_user(**param...
from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework.test import APIClient from rest_framework import status CREATE_USER_URL = reverse('user:create') # TOKEN_URL = reverse('user:token') ME_URL = reverse('user:me') def create_user(**param...
en
null
1,138
0034540.py
import torch import torch.nn as nn import torch.nn.functional as F from networks.network_utils import hidden_init class MADDPGCriticVersion1(nn.Module): def __init__(self, num_agents, state_size, action_size, fcs1_units, fc2_units, seed=0): """Initialize parameters and build model. Params ...
import torch import torch.nn as nn import torch.nn.functional as F from networks.network_utils import hidden_init class MADDPGCriticVersion1(nn.Module): def __init__(self, num_agents, state_size, action_size, fcs1_units, fc2_units, seed=0): """Initialize parameters and build model. Params ...
en
null
540
0003186.py
import boto3 import botocore class S3: def __init__(self, key, secret, bucket): self.Key = key self.Secret = secret self.Bucket = bucket return def upload_file(self, local_file, remote_file): s3 = boto3.resource( 's3', aws_access_key_id=self.Ke...
import boto3 import botocore class S3: def __init__(self, key, secret, bucket): self.Key = key self.Secret = secret self.Bucket = bucket return def upload_file(self, local_file, remote_file): s3 = boto3.resource( 's3', aws_access_key_id=self.Ke...
en
null
299