prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>day.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Forms for day forms
"""
from django.conf import settings
from django import forms
from django.utils.translation import ugettext as _
from arrow import Arrow
from datebook.models import DayEntry
from datebook.forms import CrispyFormMixin
from... | clean |
<|file_name|>0002_auto_20190430_1520.py<|end_file_name|><|fim▁begin|># Generated by Django 2.1.7 on 2019-04-30 13:20
from django.db import migrations, models<|fim▁hole|>
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='publishablemo... | import uuid
class Migration(migrations.Migration): |
<|file_name|>0002_auto_20190430_1520.py<|end_file_name|><|fim▁begin|># Generated by Django 2.1.7 on 2019-04-30 13:20
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|> | dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='publishablemodel',
name='id',
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False),
),
] |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# RedPipe documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 19 13:22:45 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration valu... | extensions = [ |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()<|fim▁hole|> u = openmc.Universe(name='c... | |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
<|fim_middle|>
def test_bounding_box():
cyl1 = openmc.ZCylinder(r=1.0)
cyl2 = openmc.ZCylinder(r... | c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells=(c1, c2, c3))
assert u.name == 'cool'
cells = set(u.cells.values())
assert not (cells ^ {c1, c2, c3})
# Test __repr__
repr(u)
with pytest.raises(TypeError):
u.add_cell(openm... |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | cyl1 = openmc.ZCylinder(r=1.0)
cyl2 = openmc.ZCylinder(r=2.0)
c1 = openmc.Cell(region=-cyl1)
c2 = openmc.Cell(region=+cyl1 & -cyl2)
u = openmc.Universe(cells=[c1, c2])
ll, ur = u.bounding_box
assert ll == pytest.approx((-2., -2., -np.inf))
assert ur == pytest.approx((2., 2., np.inf))
... |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | m = sphere_model.materials[0]
univ = sphere_model.geometry.root_universe
colors = {m: 'limegreen'}
for basis in ('xy', 'yz', 'xz'):
univ.plot(
basis=basis,
pixels=(10, 10),
color_by='material',
colors=colors,
) |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | c = openmc.Cell(fill=uo2)
univ = openmc.Universe(cells=[c])
nucs = univ.get_nuclides()
assert nucs == ['U235', 'O16'] |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | cells = [openmc.Cell() for i in range(5)]
cells2 = [openmc.Cell() for i in range(3)]
cells[0].fill = openmc.Universe(cells=cells2)
u = openmc.Universe(cells=cells)
assert not (set(u.cells.values()) ^ set(cells))
all_cells = set(u.get_all_cells().values())
assert not (all_cells ^ set(cells +... |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | cells, mats, univ, lattice = cell_with_lattice
test_mats = set(univ.get_all_materials().values())
assert not (test_mats ^ set(mats)) |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | c1 = openmc.Cell()
u1 = openmc.Universe(cells=[c1])
c2 = openmc.Cell()
u2 = openmc.Universe(cells=[c2])
c3 = openmc.Cell(fill=u1)
c4 = openmc.Cell(fill=u2)
u3 = openmc.Universe(cells=[c3, c4])
univs = set(u3.get_all_universes().values())
assert not (univs ^ {u1, u2}) |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | cells = [openmc.Cell() for i in range(5)]
u = openmc.Universe(cells=cells)
geom = ET.Element('geom')
u.create_xml_subelement(geom)
cell_elems = geom.findall('cell')
assert len(cell_elems) == len(cells)
assert all(c.get('universe') == str(u.id) for c in cell_elems)
assert not (set(c.get(... |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def <|fim_middle|>():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', c... | test_basic |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_bounding_box |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_plot |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_get_nuclides |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_cells |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_get_all_materials |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_get_all_universes |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | test_create_xml |
<|file_name|>read_project_steps.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML<|fim▁hole|>#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on a... | #
# 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 |
<|file_name|>read_project_steps.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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
#
# ... | resource = world.api.get_project(resource)
world.status = resource['code']
assert world.status == HTTP_OK
world.project = resource['object'] |
<|file_name|>read_project_steps.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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
#
# ... | i_get_the_project |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|># Scrapy settings for helloscrapy project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'helloscrapy'
SPID... |
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'helloscrapy (+http://www.yourdomain.com)'
|
<|file_name|>FindNextHigherNumberWithSameDigits.py<|end_file_name|><|fim▁begin|>'''
Given a number, find the next higher number using only the digits in the given number.
For example if the given number is 1234, next higher number with same digits is 1243
'''<|fim▁hole|> number = str(num)
length = len(number)
... |
def FindNext(num): |
<|file_name|>FindNextHigherNumberWithSameDigits.py<|end_file_name|><|fim▁begin|>'''
Given a number, find the next higher number using only the digits in the given number.
For example if the given number is 1234, next higher number with same digits is 1243
'''
def FindNext(num):
<|fim_middle|>
<|fim▁end|> | number = str(num)
length = len(number)
for i in range(length-2,-1,-1):
current = number[i]
right = number[i+1]
if current < right:
temp = sorted(number[i:])
Next = temp[temp.index(current)+1]
temp.remove(Next)
temp = ''.join(temp)
... |
<|file_name|>FindNextHigherNumberWithSameDigits.py<|end_file_name|><|fim▁begin|>'''
Given a number, find the next higher number using only the digits in the given number.
For example if the given number is 1234, next higher number with same digits is 1243
'''
def FindNext(num):
number = str(num)
length = len(... | temp = sorted(number[i:])
Next = temp[temp.index(current)+1]
temp.remove(Next)
temp = ''.join(temp)
return int(number[:i]+Next+temp) |
<|file_name|>FindNextHigherNumberWithSameDigits.py<|end_file_name|><|fim▁begin|>'''
Given a number, find the next higher number using only the digits in the given number.
For example if the given number is 1234, next higher number with same digits is 1243
'''
def <|fim_middle|>(num):
number = str(num)
length ... | FindNext |
<|file_name|>testes_notificacao.py<|end_file_name|><|fim▁begin|># coding=utf-8
# ---------------------------------------------------------------
# Desenvolvedor: Arannã Sousa Santos
# Mês: 12
# Ano: 2015
# Projeto: pagseguro_xml
# e-mail: asousas@live.com
# --------------... | |
<|file_name|>testes_notificacao.py<|end_file_name|><|fim▁begin|># coding=utf-8
# ---------------------------------------------------------------
# Desenvolvedor: Arannã Sousa Santos
# Mês: 12
# Ano: 2015
# Projeto: pagseguro_xml
# e-mail: asousas@live.com
# --------------... | nt u'-' * 50
print retorno.xml
print u'-' * 50
for a in retorno.alertas:
print a
e |
<|file_name|>testes_notificacao.py<|end_file_name|><|fim▁begin|># coding=utf-8
# ---------------------------------------------------------------
# Desenvolvedor: Arannã Sousa Santos
# Mês: 12
# Ano: 2015
# Projeto: pagseguro_xml
# e-mail: asousas@live.com
# --------------... | nt u'Motivo do erro:', retorno
|
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | """A config parser that sucks less than those in module `ConfigParser`."""
def __init__(self, filenames_to_try=[]):
# FUN FACT: In Python 3.2, they spontaneously changed the behaviour of
# RawConfigParser so that it no longer considers ';' a comment delimiter
# for inline comments.
... |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | if sys.version_info.major >= 3:
self._cp = RawConfigParser(dict_type=OrderedMultiDict, inline_comment_prefixes=(';',))
else:
self._cp = RawConfigParser(dict_type=OrderedMultiDict)
if isinstance(filenames_to_try, str):
filenames_to_try = [filenames_to_try]
... |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | if isinstance(filenames_to_try, str):
filenames_to_try = [filenames_to_try]
self._filenames_to_try.extend(filenames_to_try)
return self._cp.read(self._filenames_to_try) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return self._cp.sections() |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | if not self._cp.has_section(section_name):
return []
return self._cp.options(section_name) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | if do_optionxform:
# https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.optionxform
option_name = self._cp.optionxform(option_name)
if section_name is None:
return self._get_optval_in_sections(self.sections(), option_name)
elif i... |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | optvals = []
for section_name in section_names:
## Check that `section_name` is present in the config.
## Otherwise, RawConfigParser will raise ConfigParser.NoSectionError.
if not self._cp.has_section(section_name):
continue
optvals.extend... |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return [self._coerce_to_boolean(optval)
for optval in self.get(section_name, option_name, do_optionxform)] |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | ovs_lower = optval_str.lower()
if ovs_lower not in self._boolean_states:
raise ValueError("Not a boolean: %s" % optval_str)
return self._boolean_states[ovs_lower] |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | from configparser import RawConfigParser |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | from ConfigParser import RawConfigParser |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | self._cp = RawConfigParser(dict_type=OrderedMultiDict, inline_comment_prefixes=(';',)) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | self._cp = RawConfigParser(dict_type=OrderedMultiDict) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | filenames_to_try = [filenames_to_try] |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | filenames_to_try = [filenames_to_try] |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return [] |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | option_name = self._cp.optionxform(option_name) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return self._get_optval_in_sections(self.sections(), option_name) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return self._get_optval_in_sections([section_name], option_name) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | return self._get_optval_in_sections(section_name, option_name) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | continue |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | raise ValueError("Not a boolean: %s" % optval_str) |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | __init__ |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | read |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | sections |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | options |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | get |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | _get_optval_in_sections |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | getboolean |
<|file_name|>UsefulConfigParser.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >=... | _coerce_to_boolean |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | RunningJobsProcess().run(filter_to_project=project,
filter_to_revision=push_sha,
filter_to_job_group=options['filter_job_group'])
|
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | """Management command to ingest data from a single push."""
help = "Ingests a single push into treeherder"
args = '<project> <changeset>'
option_list = BaseCommand.option_list + (
make_option('--profile-file',
action='store',
dest='profile_file',
... |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | if len(args) != 2:
raise CommandError("Need to specify (only) branch and changeset")
(project, changeset) = args
# get reference to repo
rdm = RefDataManager()
repos = filter(lambda x: x['name'] == project,
rdm.get_all_repository_info())
... |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | if options['profile_file']:
profiler = Profile()
profiler.runcall(self._handle, *args, **options)
profiler.dump_stats(options['profile_file'])
else:
self._handle(*args, **options) |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | raise CommandError("Need to specify (only) branch and changeset") |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | raise CommandError("No project found named '%s'" % project) |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | profiler = Profile()
profiler.runcall(self._handle, *args, **options)
profiler.dump_stats(options['profile_file']) |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | self._handle(*args, **options) |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | _handle |
<|file_name|>ingest_push.py<|end_file_name|><|fim▁begin|>from cProfile import Profile
from optparse import make_option
from django.conf import settings
from django.core.management.base import (BaseCommand,
CommandError)
from treeherder.etl.buildapi import (Builds4hJobsProcess,... | handle |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|># coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_hei... | subplot_kw=dict(projection=ccrs.PlateCarree()))
ax.set_extent([lon.min(), lon.max(), lat.min(), lat.max()])
ax.coastlines() |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | return (cube.standard_name in name_list) and (not any(m.method == 'maximum' for m in cube.cell_methods)) |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | ug = pyugrid.UGrid.from_ncfile(url)
cube.mesh = ug
cube.mesh_dimension = 1
return cube |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
nv = cube.mesh.faces
return tri.Triangulation(lon, lat, triangles=nv) |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | cube = cubes[model]
lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
ind = -1 # just take the last time index for now
zcube = cube[ind]
triang = tris[model]
fig, ax = plt.subplots(figsize=(7, 7),
subplot_kw=dict(projection=ccrs.PlateCarree()))
ax.set_ex... |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | cube_func |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | get_mesh |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | get_triang |
<|file_name|>pyugrid_test.py<|end_file_name|><|fim▁begin|>
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['sea_surface_elevation',
'sea_surface_height_above_geoid',
'sea_surface_height','water level',
'sea_surface_he... | plot_model |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | async def async_setup_entry( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Set up the electricity price sensor from config_entry."""
name = config_entry.data[CONF_NAME]
pvpc_data_handler = PVPCData(
tariff=config_entry.data[ATTR_TARIFF],
local_timezone=hass.config.time_zone,
websession=async_get_clientsession(hass),
logger=_LOGGER,
timeout=... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Class to hold the prices of electricity as a sensor."""
unit_of_measurement = UNIT
icon = ICON
should_poll = False
def __init__(self, name, unique_id, pvpc_data_handler):
"""Initialize the sensor object."""
self._name = name
self._unique_id = unique_id
self._pvpc_d... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Initialize the sensor object."""
self._name = name
self._unique_id = unique_id
self._pvpc_data = pvpc_data_handler
self._num_retries = 0
self._hourly_tracker = None
self._price_tracker = None
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Cancel listeners for sensor updates."""
self._hourly_tracker()
self._price_tracker()
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Handle entity which will be added."""
await super().async_added_to_hass()
state = await self.async_get_last_state()
if state:
self._pvpc_data.state = state.state
# Update 'state' value in hour changes
self._hourly_tracker = async_track_time_change(
... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Return a unique ID."""
return self._unique_id
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Return the name of the sensor."""
return self._name
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Return the state of the sensor."""
return self._pvpc_data.state
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Return True if entity is available."""
return self._pvpc_data.state_available
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Return the state attributes."""
return self._pvpc_data.attributes
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Update the sensor state, by selecting the current price for this hour."""
self._pvpc_data.process_state_and_attributes(now)
self.async_write_ha_state()
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | "Update electricity prices from the ESIOS API."""
prices = await self._pvpc_data.async_update_prices(now)
if not prices and self._pvpc_data.source_available:
self._num_retries += 1
if self._num_retries > 2:
_LOGGER.warning(
"%s: repeate... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | lf._pvpc_data.state = state.state
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | lf._num_retries += 1
if self._num_retries > 2:
_LOGGER.warning(
"%s: repeated bad data update, mark component as unavailable source",
self.entity_id,
)
self._pvpc_data.source_available = False
... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | OGGER.warning(
"%s: repeated bad data update, mark component as unavailable source",
self.entity_id,
)
self._pvpc_data.source_available = False
return
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | OGGER.debug("%s: data source is not yet available", self.entity_id)
return
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Sensor to collect the reference daily prices of electricity ('PVPC') in Spain."""
import logging
from random import randint
from typing import Optional
from aiopvpc import PVPCData
from homeassistant import config_entries
from homeassistant.const import CONF_NAME... | lf._pvpc_data.source_available = True
_LOGGER.warning("%s: component has recovered data access", self.entity_id)
self.update_current_price(now)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.