prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def <|fim_middle|>(self, head): ...
__init__
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
_getN
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
getRandom
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
_get
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest<|fim▁hole|> class TestAssemblyReader(unittest.TestCase): def test_version_reader(self): assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') s...
import play_file
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest import play_file class TestAssemblyReader(unittest.TestCase): <|fim_middle|> <|fim▁end|>
def test_version_reader(self): assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') self.assertEqual(version, '7.3.1.0210') def test_version_writer(self): new_version = '7.3.1.0228' assembly_writer = play_file.Ass...
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest import play_file class TestAssemblyReader(unittest.TestCase): def test_version_reader(self): <|fim_middle|> def test_version_writer(self): new_version = '7.3.1.0228' assembly_writer = play_fil...
assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') self.assertEqual(version, '7.3.1.0210')
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest import play_file class TestAssemblyReader(unittest.TestCase): def test_version_reader(self): assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') ...
new_version = '7.3.1.0228' assembly_writer = play_file.AssemblyWriter() version = assembly_writer.update_assembly_version('AssemblyInfo.cs', new_version) self.assertEqual(version, new_version)
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest import play_file class TestAssemblyReader(unittest.TestCase): def <|fim_middle|>(self): assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') ...
test_version_reader
<|file_name|>test_play_file.py<|end_file_name|><|fim▁begin|># coding: UTF-8 import unittest import play_file class TestAssemblyReader(unittest.TestCase): def test_version_reader(self): assembly_reader = play_file.AssemblyReader() version = assembly_reader.get_assembly_version('AssemblyInfo.cs') ...
test_version_writer
<|file_name|>005_cleaner.py<|end_file_name|><|fim▁begin|># 005_cleaner.py ##################################################################### ################################## # Import des modules et ajout du path de travail pour import relatif import sys sys.path.insert(0 , 'C:/Users/WILLROS/Perso/Shade/scri...
missionName = '005' AddLog('title' , '{} : Début du nettoyage du fichier'.format(missionName)) work_dir = 'C:/Users/WILLROS/Perso/Shade/scripts/LocalWC-Shade-App/apis/raw/{}_raw/'.format(missionName)
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pigame.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above impo...
# exceptions on Python 2. try: import django except ImportError:
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os import sys if __name__ == "__main__": <|fim_middle|> <|fim▁end|>
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pigame.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that the # issue is really that Django is missing to avoid masking other ...
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
@staticmethod def add_content(contents, path): if isPython3:
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: <|fim_middle|> <|fim▁end|>
@staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) return s @staticmethod def read_beginning(path, lines): with io.open(path, mode="rt", encoding="utf-...
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): <|fim_middle|> @staticmethod def read_beginning(path, lines): with io.open(path, mode="rt", encoding="utf-...
with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) return s
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read(lines) # go to beginning f.seek(0) return s
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with io.open(path, mode="rt", encoding="utf-8") as f: content = f.readlines() return content
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
if isPython3: with open(path, mode="wt", encoding="utf-8") as f: # truncate previous contents f.truncate() f.write(contents) else: with io.open(path, mode="wt", encoding="utf-8") as f: # truncate previous cont...
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
if isPython3: with open(path, mode="wt", encoding="utf-8") as f: f.writelines([l + "\n" for l in lines]) else: with io.open(path, mode="wt") as f: for line in lines: f.writelines(line.decode("utf8") + "\n")
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
if isPython3: with open(path, mode="a", encoding="utf-8") as f: f.writelines(contents) else: with io.open(path, mode="a") as f: f.writelines(contents.decode("utf8"))
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with open(path, mode="wt", encoding="utf-8") as f: # truncate previous contents f.truncate() f.write(contents)
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with io.open(path, mode="wt", encoding="utf-8") as f: # truncate previous contents f.truncate() f.write(contents.decode("utf8"))
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with open(path, mode="wt", encoding="utf-8") as f: f.writelines([l + "\n" for l in lines])
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with io.open(path, mode="wt") as f: for line in lines: f.writelines(line.decode("utf8") + "\n")
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with open(path, mode="a", encoding="utf-8") as f: f.writelines(contents)
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
with io.open(path, mode="a") as f: f.writelines(contents.decode("utf8"))
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def <|fim_middle|>(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f....
read
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
read_beginning
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
read_lines
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
write
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
write_lines
<|file_name|>scribe.py<|end_file_name|><|fim▁begin|>import io import sys isPython3 = sys.version_info >= (3, 0) class Scribe: @staticmethod def read(path): with io.open(path, mode="rt", encoding="utf-8") as f: s = f.read() # go to beginning f.seek(0) ...
add_content
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
class ListProperty(BaseProperty): """A property that accepts list input."""
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
"""A property that accepts list input.""" # if you edit this you need to adapt accordingly xml_value and is_valid _allowed_python_types = [list, NoneType] def __init__(self, name, value, xml_path): super(ListProperty, self).__init__( name, value, xml_path, self._allowed_python_type...
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
super(ListProperty, self).__init__( name, value, xml_path, self._allowed_python_types)
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
return True
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
try: return json.loads(value) except ValueError as e: raise MetadataCastError(e)
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
if self.python_type is list: return json.dumps(self.value) elif self.python_type is NoneType: return '' else: raise RuntimeError('self._allowed_python_types and self.xml_value' 'are out of sync. This should never happen')
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
return json.dumps(self.value)
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
return ''
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
raise RuntimeError('self._allowed_python_types and self.xml_value' 'are out of sync. This should never happen')
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
__init__
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
is_valid
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
cast_from_str
<|file_name|>list_property.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ InaSAFE Disaster risk assessment tool developed by AusAid - **metadata module.** Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the G...
xml_value
<|file_name|>AvailabilityNodes.py<|end_file_name|><|fim▁begin|>from Child import Child from Node import Node # noqa: I201 AVAILABILITY_NODES = [ # availability-spec-list -> availability-entry availability-spec-list? Node('AvailabilitySpecList', kind='SyntaxCollection', element='AvailabilityArgument')...
children=[ Child('Entry', kind='Syntax', description='The actual argument', node_choices=[
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() <|fim▁hole|> return type(value) @register.filter def is_model(value): return isinstance(value, Model) @register.filter d...
@register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 <|fim_middle|> @register.fil...
return type(value)
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
return isinstance(value, Model)
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
return isinstance(value, Iterable)
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
return isinstance(value, str)
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
return isinstance(value, bool)
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def <|fim_middle|>(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @reg...
get_type
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
is_model
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
is_iterable
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
is_str
<|file_name|>type_extras.py<|end_file_name|><|fim▁begin|>from collections.abc import Iterable from django import template from django.db.models import Model register = template.Library() @register.filter def get_type(value): # inspired by: https://stackoverflow.com/a/12028864 return type(value) @register....
is_bool
<|file_name|>data_import.py<|end_file_name|><|fim▁begin|># ~*~ encoding: utf-8 ~*~ from pymongo import MongoClient from pandas import read_csv from datetime import date mongodb = MongoClient('192.168.178.82', 9999)<|fim▁hole|>db = mongodb['dev'] drug_collection = db['drug'] drugs = read_csv('~/Dokumente/bfarm_liefer...
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
fpath = f'{settings.QUERY_DIR}/{qid}/{fname}' with open(fpath, 'r') as f: c = f.read().count(p)
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): <|fim_middle|> <|fim▁end|>
help = 'check a query file - how many records' def add_arguments(self, parser): parser.add_argument('qid',type=int) def handle(self, *args, **options): qid = options['qid'] q = Query.objects.get(pk=qid) p = 'TY - ' if q.query_file.name is not '': fpath ...
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
parser.add_argument('qid',type=int)
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
qid = options['qid'] q = Query.objects.get(pk=qid) p = 'TY - ' if q.query_file.name is not '': fpath = q.query_file.path else: if q.database=="scopus": fname = 's_results.txt' else: fname = 'results.txt' ...
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
fpath = q.query_file.path
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
if q.database=="scopus": fname = 's_results.txt' else: fname = 'results.txt' fpath = f'{settings.QUERY_DIR}/{qid}/{fname}' with open(fpath, 'r') as f: c = f.read().count(p)
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
fname = 's_results.txt'
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
fname = 'results.txt'
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
yts = q.doc_set.values('PY').annotate( n = Count('pk') ) for y in yts: print('{} documents in {}'.format(y['n'],y['PY']))
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def <|f...
add_arguments
<|file_name|>check_query_file.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError from django.core import management from django.db.models import Count from scoping.models import * class Command(BaseCommand): help = 'check a query file - how many records' def add...
handle
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
def setUp(self): configuration.load_test_config() db.merge_conn( models.Connection( conn_id='jira_default', conn_type='jira', host='https://localhost/jira/', port=443, extra='{"verify": "False", "project": "AIRFL...
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
configuration.load_test_config() db.merge_conn( models.Connection( conn_id='jira_default', conn_type='jira', host='https://localhost/jira/', port=443, extra='{"verify": "False", "project": "AIRFLOW"}'))
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
jira_hook = JiraHook() self.assertTrue(jira_mock.called) self.assertIsInstance(jira_hook.client, Mock) self.assertEqual(jira_hook.client.name, jira_mock.return_value.name)
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
unittest.main()
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
setUp
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # 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 thi...
test_jira_client_connection
<|file_name|>Roche.py<|end_file_name|><|fim▁begin|># We calculate the flatness with the Roche model # calculate omk knowing omc and vice-versa from numpy import * from scipy.optimize import root # we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2 def eps(omk): return omk**2/(2+omk**2) def om_k(omc):<|fi...
khi=arcsin(omc) return sqrt(6*sin(khi/3)/omc-2)
<|file_name|>Roche.py<|end_file_name|><|fim▁begin|># We calculate the flatness with the Roche model # calculate omk knowing omc and vice-versa from numpy import * from scipy.optimize import root # we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2 def eps(omk): <|fim_middle|> def om_k(omc): khi=arcsin(...
return omk**2/(2+omk**2)
<|file_name|>Roche.py<|end_file_name|><|fim▁begin|># We calculate the flatness with the Roche model # calculate omk knowing omc and vice-versa from numpy import * from scipy.optimize import root # we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2 def eps(omk): return omk**2/(2+omk**2) def om_k(omc): <|...
khi=arcsin(omc) return sqrt(6*sin(khi/3)/omc-2)
<|file_name|>Roche.py<|end_file_name|><|fim▁begin|># We calculate the flatness with the Roche model # calculate omk knowing omc and vice-versa from numpy import * from scipy.optimize import root # we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2 def <|fim_middle|>(omk): return omk**2/(2+omk**2) def om_...
eps
<|file_name|>Roche.py<|end_file_name|><|fim▁begin|># We calculate the flatness with the Roche model # calculate omk knowing omc and vice-versa from numpy import * from scipy.optimize import root # we have to solve a cubic equation a-J2*a**3=1+J2+0.5*omk**2 def eps(omk): return omk**2/(2+omk**2) def <|fim_middle|>...
om_k
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
# test for len(financial.move) == 1 financial_move_id = self.financial_model.search([], limit=1) action = financial_move_id.action_view_financial('2receive')
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
def setUp(self): self.financial_model = self.env['financial.move'] super(ManualFinancialProcess, self).setUp() def test_01_check_return_views(self): """Check if view is correctly called for python code""" # test for len(financial.move) == 1 financial_move_id = self.fin...
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
self.financial_model = self.env['financial.move'] super(ManualFinancialProcess, self).setUp()
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
"""Check if view is correctly called for python code""" # test for len(financial.move) == 1 financial_move_id = self.financial_model.search([], limit=1) action = financial_move_id.action_view_financial('2receive') self.assertEqual( action.get('display_name'), ...
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
setUp
<|file_name|>test_financial_move.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2017 KMEE # Hendrix Costa <hendrix.costa@kmee.com.br> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.addons.financial.tests.financial_test_classes import \ FinancialTestCase class ...
test_01_check_return_views
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
email = Column("email", String(150), nullable=False) created = Column("created", DateTime, nullable=False,
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
__tablename__ = "test" id = Column("id", Integer, primary_key=True) username = Column("username", String(150), nullable=False) first_name = Column("first_name", String(150), nullable=False) last_name = Column("last_name", String(150), nullable=False) password = Column("password", String(150), n...
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
def setUp(self): self.test_object = TestBase() self.test_object.id = 1 self.test_object.username = "anusername" self.test_object.password = "apassword" self.test_object.first_name = "Test" self.test_object.last_name = "Object" self.test_object.email = "test@ex...
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
self.test_object = TestBase() self.test_object.id = 1 self.test_object.username = "anusername" self.test_object.password = "apassword" self.test_object.first_name = "Test" self.test_object.last_name = "Object" self.test_object.email = "test@example.com"
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
dict_from_base = base_to_dict(self.test_object) self.assertEqual(dict_from_base['id'], self.test_object.id) self.assertEqual(dict_from_base['username'], self.test_object.username) self.assertEqual(dict_from_base['password'], self.test_object.password) self.assertEqual(dict_from_b...
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
dict_from_base = base_to_dict(self.test_object, ["id", "username", "first_name"]) self.assertEqual(dict_from_base['id'], self.test_object.id) self.assertEqual(dict_from_base['username'], self.test_object.username) self.assertEqual(dict_from_base['fir...
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
setUp
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
test_base_to_dict
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # Copyright 2015-2021 Flavio Garcia # # 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...
test_base_to_dict
<|file_name|>regular_expression_matching.py<|end_file_name|><|fim▁begin|>class R: def __init__(self, c): self.c = c self.is_star = False def match(self, c): return self.c == '.' or self.c == c class Solution(object): def isMatch(self, s, p): """ :type s: str ...
else:
<|file_name|>regular_expression_matching.py<|end_file_name|><|fim▁begin|>class R: <|fim_middle|> class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ rs = [] """:type: list[R]""" for c in p: ...
def __init__(self, c): self.c = c self.is_star = False def match(self, c): return self.c == '.' or self.c == c
<|file_name|>regular_expression_matching.py<|end_file_name|><|fim▁begin|>class R: def __init__(self, c): <|fim_middle|> def match(self, c): return self.c == '.' or self.c == c class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :...
self.c = c self.is_star = False