prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>download_entered_data_test.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, r... | is_alert_present |
<|file_name|>download_entered_data_test.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, r... | close_alert_and_get_its_text |
<|file_name|>download_entered_data_test.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, r... | tearDown |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Set up the Verisure switch platform."""
if not int(hub.config.get(CONF_SMARTPLUGS, 1)):
return False
hub.update_overview()
switches = []
switches.extend(
[
VerisureSmartplug(device_label)
for device_label in hub.get("$.smartPlugs[*].deviceLabel")
]... |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Representation of a Verisure smartplug."""
def __init__(self, device_id):
"""Initialize the Verisure device."""
self._device_label = device_id
self._change_timestamp = 0
self._state = False
@property
def name(self):
"""Return the name or location of the smart... |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Initialize the Verisure device."""
self._device_label = device_id
self._change_timestamp = 0
self._state = False |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Return the name or location of the smartplug."""
return hub.get_first(
"$.smartPlugs[?(@.deviceLabel == '%s')].area", self._device_label
) |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Return true if on."""
if monotonic() - self._change_timestamp < 10:
return self._state
self._state = (
hub.get_first(
"$.smartPlugs[?(@.deviceLabel == '%s')].currentState",
self._device_label,
)
== "ON"
)
... |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Return True if entity is available."""
return (
hub.get_first("$.smartPlugs[?(@.deviceLabel == '%s')]", self._device_label)
is not None
) |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Set smartplug status on."""
hub.session.set_smartplug_state(self._device_label, True)
self._state = True
self._change_timestamp = monotonic() |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Set smartplug status off."""
hub.session.set_smartplug_state(self._device_label, False)
self._state = False
self._change_timestamp = monotonic() |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | """Get the latest date of the smartplug."""
hub.update_overview() |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | return False |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | return self._state |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def <|fim_middle|>(hass, config, add_entities... | setup_platform |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | __init__ |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | name |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | is_on |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | available |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | turn_on |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | turn_off |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | update |
<|file_name|>0f3a25.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | |
<|file_name|>0f3a25.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | def test(self):
# EVEX.256.66.0F3A.W0 25 /r ib
# vpternlogd ymm1{k1}{z}, ymm2, ymm3/m256/m32bcst, imm8
myEVEX = EVEX('EVEX.256.66.0F3A.W0')
Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDi... |
<|file_name|>0f3a25.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | myEVEX = EVEX('EVEX.256.66.0F3A.W0')
Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(myDisasm.infos.Instruction.Opcode, 0x25)
assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vpternlogd')
assert_... |
<|file_name|>0f3a25.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | test |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | "{}/*{}*{}*/peak/macs2/rep{}/*narrowPeak.gz".format( |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
<|fim_middle|>
def main():
"""get stats from PAS-seq
- num reads pe... | num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
num_lines += 1
return num_lines |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | """get stats from PAS-seq
- num reads per file
- gene quant level spearman correlations
"""
# files
DATA_DIR = "/mnt/lab_data/kundaje/projects/skin/data/bds/processed.chipseq.2017-01-23.histones"
# params
marks = ["H3K27ac", "H3K4me1", "H3K27me3", "CTCF"]
days = np.ar... |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | num_nodup_reads = line.split("+")[0].strip()
results["num_nodup_reads"].append(num_nodup_reads) |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | idr_peaks = glob.glob(
"{}/*{}*{}*/peak/idr/true_reps/rep1-rep2/*filt.narrowPeak.gz".format(
DATA_DIR, day, mark))[0]
num_idr = get_num_lines_gz(idr_peaks)
results["num_idr_peaks"].append(num_idr)
... |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | results["num_idr_peaks"].append("NA")
overlap_peaks = glob.glob(
"{}/*{}*{}*/peak/macs2/overlap/*filt.narrowPeak.gz".format(
DATA_DIR, day, mark, rep))[0]
num_overlap = get_num_lines_gz(overlap_peaks)
... |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def <|fim_middle|>(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | get_num_lines_gz |
<|file_name|>summarize_chipseq_qc.py<|end_file_name|><|fim▁begin|>
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
... | main |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | import sys
def main(): |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | config = configparser.ConfigParser()
config.optionxform = str
config.read_file(open(os.path.join(os.path.dirname(__file__), "../config.ini"), encoding="utf8"))
env_conf = dict(config.items('environment'))
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-v', '--verbose... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | """ Loads and parses the input file, runs all tests and reports results"""
input_filename = os.path.join(testDir, input_basename)
raw_data = open(input_filename, encoding="utf8").read()
input_data = json.loads(raw_data)
failed_testcases = []
for testObj in input_data:
try:
... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | """Runs a single test, comparing output and RC to expected output and RC.
Raises an error if input can't be read, executable fails, or output/RC
are not as expected. Error is caught by bctester() and reported.
"""
# Get the exec names and arguments
execprog = os.path.join(buildenv["BUILDDIR"], ... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | """Parse the output according to specified format.
Raise an error if the output can't be parsed."""
if fmt == 'json': # json: compare parsed data
return json.loads(a)
elif fmt == 'hex': # hex: parse and compare binary data
return binascii.a2b_hex(a.strip())
else:
raise Not... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | level = logging.DEBUG |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | level = logging.ERROR |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | error_message = "FAILED_TESTCASES:\n"
error_message += pprint.pformat(failed_testcases, width=400)
logging.error(error_message)
sys.exit(1) |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | sys.exit(0) |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | filename = os.path.join(testDir, testObj["input"])
inputData = open(filename, encoding="utf8").read()
stdinCfg = subprocess.PIPE |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | outputFn = testObj['output_cmp']
outputType = os.path.splitext(outputFn)[1][1:] # output type from file extension (determines how to compare)
try:
outputData = open(os.path.join(testDir, outputFn), encoding="utf8").read()
except:
logging.error("Output file " + ou... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | logging.error("Output data missing for " + outputFn)
raise Exception |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | logging.error("Output file %s does not have a file extension" % outputFn)
raise Exception |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | data_mismatch, formatting_mismatch = False, False
# Parse command output and expected output
try:
a_parsed = parse_output(outs[0], outputType)
except Exception as e:
logging.error('Error parsing command output as %s: %s' % (outputType, e))
raise
... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | logging.error("Output data mismatch for " + outputFn + " (format " + outputType + ")")
data_mismatch = True |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | error_message = "Output formatting mismatch for " + outputFn + ":\n"
error_message += "".join(difflib.context_diff(outputData.splitlines(True),
outs[0].splitlines(True),
fromfile=o... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | wantRC = testObj['return_code'] |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | logging.error("Return code mismatch for " + outputFn)
raise Exception |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | want_error = testObj["error_txt"]
# Compare error text
# TODO: ideally, we'd compare the strings exactly and also assert
# That stderr is empty if no errors are expected. However, syscoin-tx
# emits DISPLAY errors when running as a windows application on
# linux through w... |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | logging.error("Error mismatch:\n" + "Expected: " + want_error + "\nReceived: " + outs[1].rstrip())
raise Exception |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | return json.loads(a) |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | return binascii.a2b_hex(a.strip()) |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | raise NotImplementedError("Don't know how to compare %s" % fmt) |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | main() |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | main |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | bctester |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | bctest |
<|file_name|>syscoin-util-test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework ... | parse_output |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | return UNITIES.get(unity, UNITIES["NONE"]) |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | for key, value in UNITIES.items():
if unity == value:
return key
else:
return u"NONE" |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | from autonomie.models.task import WorkUnit
from autonomie.models.task.estimation import EstimationLine
from autonomie.models.task.invoice import InvoiceLine
from autonomie.models.task.invoice import CancelInvoiceLine
from autonomie_base.models.base import DBSESSION
# Adding some characters to th... |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | from autonomie.models.task import WorkUnit
from autonomie.models.task.estimation import EstimationLine
from autonomie.models.task.invoice import InvoiceLine
from autonomie.models.task.invoice import CancelInvoiceLine
from autonomie_base.models.base import DBSESSION
for factory in (EstimationLine... |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | return key |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | return u"NONE" |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | translate_unity |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | translate_inverse |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | upgrade |
<|file_name|>1_5_migrating_work_u_1212f113f03b.py<|end_file_name|><|fim▁begin|>"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic impo... | downgrade |
<|file_name|>dicco_numbers.py<|end_file_name|><|fim▁begin|>def freq_month(obj):
if obj is None or obj == []:
return
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',<|fim▁hole|> 7: 'jul',
... | |
<|file_name|>dicco_numbers.py<|end_file_name|><|fim▁begin|>def freq_month(obj):
<|fim_middle|>
in_array = [3,6,2,7,7,7,]
print freq_month(in_array)
print freq_month([])
<|fim▁end|> | if obj is None or obj == []:
return
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',
7: 'jul',
8: 'aug',
9: 'sep',
10: 'oct',
11: 'nov',
... |
<|file_name|>dicco_numbers.py<|end_file_name|><|fim▁begin|>def freq_month(obj):
if obj is None or obj == []:
<|fim_middle|>
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',
7: 'jul',
... | return |
<|file_name|>dicco_numbers.py<|end_file_name|><|fim▁begin|>def freq_month(obj):
if obj is None or obj == []:
return
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',
7: 'jul',
8: 'aug',
... | print str(months[i+1]) + " has " + str(frequencies[i]) |
<|file_name|>dicco_numbers.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>(obj):
if obj is None or obj == []:
return
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',
7: 'jul',
8: 'au... | freq_month |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_M... | |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|> | dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('trans', '0045_auto_20150916_1007'),
]
operations = [
migrations.CreateModel(
name='Billing',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, aut... |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>#!python
# log/urls.py
from django.conf.urls import url
from . import views
# We are adding a URL called /home
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^clients/$', views.clients, name='clients'),
url(r'^clients/(?P<id>\d+)/$', views.cli... | url(r'^bills/(?P<id>\d+)/edit/$', views.bills_edit, name='bills_edit'), |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | # reload_old(ng) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | '''
Check if node or node.bl_idname is among
the old nodes
'''
if isinstance(node_info, str):
# assumes bl_idname
return node_info in old_bl_idnames
elif isinstance(node_info, bpy.types.Node):
return node_info.bl_idname in old_bl_idnames
else:
return False |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | nodes = [n for n in ng.nodes if n.bl_idname in old_bl_idnames]
for node in nodes:
mark_old(node) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | if node.parent and node.parent.label == "Deprecated node!":
return
ng = node.id_data
frame = ng.nodes.new("NodeFrame")
if node.parent:
frame.parent = node.parent
node.parent = frame
frame.label = "Deprecated node!"
frame.use_custom_color = True
frame.color = (.8, 0, 0)
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | if ng:
bl_idnames = {n.bl_idname for n in ng.nodes if n.bl_idname in old_bl_idnames}
for bl_id in bl_idnames:
mod = register_old(bl_id)
if mod:
importlib.reload(mod)
else:
print("Couldn't reload {}".format(bl_id))
else:
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | """
This approach didn't work, bl_idname of undefined node isn't as I expected
bl_idnames = {n.bl_idname for n in ng.nodes}
old_bl_ids = bl_idnames.intersection(old_bl_idnames)
if old_bl_ids:
"""
not_reged_nodes = list(n for n in ng.nodes if not n.is_registered_node_type())
if not_... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | if bl_id in old_bl_idnames:
mod = importlib.import_module(".{}".format(old_bl_idnames[bl_id]), __name__)
res = inspect.getmembers(mod)
for name, cls in res:
if inspect.isclass(cls):
if issubclass(cls, bpy.types.Node) and cls.bl_idname == bl_id:
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | global imported_mods
mod = imported_mods.get(bl_id)
if mod:
#print("Unloaded old node type {}".format(bl_id))
mod.unregister()
del imported_mods[bl_id] |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | global imported_mods
print(imported_mods)
for mod in imported_mods.values():
mod.unregister()
imported_mods = {} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | return node_info in old_bl_idnames |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | return node_info.bl_idname in old_bl_idnames |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | return False |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | return |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | frame.parent = node.parent |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | bl_idnames = {n.bl_idname for n in ng.nodes if n.bl_idname in old_bl_idnames}
for bl_id in bl_idnames:
mod = register_old(bl_id)
if mod:
importlib.reload(mod)
else:
print("Couldn't reload {}".format(bl_id)) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | importlib.reload(mod) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | print("Couldn't reload {}".format(bl_id)) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your o... | for ng in bpy.data.node_groups:
reload_old(ng)
#if ng.bl_idname in { 'SverchCustomTreeType', 'SverchGroupTreeType'}:
# reload_old(ng) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.