prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
pool.wait() sys.exit(0)
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
logger.debug("Running with multiprocessing on {} cores..." .format(threads)) pool = multiprocessing.Pool(threads)
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
logger.debug("Running serial...") pool = SerialPool()
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
raise ValueError("Invalid shape: {}".format(y.shape))
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
for parent in cls.__bases__: try: parfunc = getattr(parent, name) except AttributeError: # parent doesn't have function break if parfunc and getattr(parfunc, '__doc__', None): func.__doc__ = parfunc._...
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
func.__doc__ = parfunc.__doc__ break
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
self._hash = hash(frozenset(self._dict.items()))
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
close
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
map
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
get_pool
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
gram_schmidt
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__init__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__enter__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__exit__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
inherit_docs
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__init__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__getitem__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__len__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__iter__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__hash__
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__...
__eq__
<|file_name|>profile_core.py<|end_file_name|><|fim▁begin|>import cProfile from pathlib import Path def main(args, results_dir: Path, scenario_dir: Path): try: scenario_dir.mkdir(parents=True) except FileExistsError: pass<|fim▁hole|> cProfile.runctx( 'from dmprsim.scenarios.python_pr...
<|file_name|>profile_core.py<|end_file_name|><|fim▁begin|>import cProfile from pathlib import Path def main(args, results_dir: Path, scenario_dir: Path): <|fim_middle|> <|fim▁end|>
try: scenario_dir.mkdir(parents=True) except FileExistsError: pass cProfile.runctx( 'from dmprsim.scenarios.python_profile import main;' 'main(args, results_dir, scenario_dir)', globals=globals(), locals=locals(), filename=str(results_dir / 'profile.ps...
<|file_name|>profile_core.py<|end_file_name|><|fim▁begin|>import cProfile from pathlib import Path def <|fim_middle|>(args, results_dir: Path, scenario_dir: Path): try: scenario_dir.mkdir(parents=True) except FileExistsError: pass cProfile.runctx( 'from dmprsim.scenarios.python_pro...
main
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException <|fim▁hole|> def setUp(self): super(CharityRepositoryTest, self).setUp() self.all_charities = [test_data.c1...
from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils.TestCase):
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
def setUp(self): super(CharityRepositoryTest, self).setUp() self.all_charities = [test_data.c1, test_data.c2, test_data.c3, test_data.c4] for charity in self.all_charities: self.charity_repo.add_or_update_charity(charity) def test_lists_charities(self): self.assertSe...
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
super(CharityRepositoryTest, self).setUp() self.all_charities = [test_data.c1, test_data.c2, test_data.c3, test_data.c4] for charity in self.all_charities: self.charity_repo.add_or_update_charity(charity)
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
self.assertSequenceEqual(self.charity_repo.list_charities(), self.all_charities)
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
self.assertEqual(self.charity_repo.get_charity('Shelter'), test_data.c1) self.assertEqual(self.charity_repo.get_charity('Oxfam'), test_data.c2) with self.assertRaises(MissingValueException): self.charity_repo.get_charity('Does not exist') try: self.charity_repo.ge...
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
self.assertEquals(self.charity_repo.get_charity(id=test_data.c1.key().id()), test_data.c1)
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
missing_id = 0 while missing_id in map(lambda charity: charity.key().id(), self.all_charities): missing_id += 1 with self.assertRaises(MissingValueException): self.charity_repo.get_charity(id=missing_id)
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
setUp
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
test_lists_charities
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
test_gets_single_charity
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
test_gets_charity_by_id
<|file_name|>charity_repository_test.py<|end_file_name|><|fim▁begin|>from givabit.backend.charity import Charity from givabit.backend.errors import MissingValueException, MultipleValueException from givabit.test_common import test_data from givabit.test_common import test_utils class CharityRepositoryTest(test_utils....
test_getting_missing_charity_by_id_throws
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
self.fetched = self.fetch() def define_fetch_method(self): u"""継承側クラスで実装すること"""
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
u"""Pagenate されているリストを全体を回せるようにする""" def __init__(self, client, limit=10): self.master_account = client['Account'] self.offset = 0 self.limit = limit self.define_fetch_method() self.fetched = self.fetch() def define_fetch_method(self): u"""継承側クラス...
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
self.offset = 0 self.limit = limit self.define_fetch_method() self.fetched = self.fetch() def define_fetch_method(se
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
h_method に適切な pagenate メソッドを設定 raise NotImpementedError("Not implemented yet.") def fetch(self): items = self.fetch_method(limit=self.limit, o
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
elf.limit return items def __iter__(self): return self def __next__(self): i
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
aise StopIt
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
p() if len(self.fetched) < 1: # prefetch for next self.fetched = self.fetch() return item class Users(IterableItems): u"""List of SoftLayer_User_Customer""" def define_
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
etch_method = self.master_account.getUsers class VirtualGuests(IterableItems): u"""List of SoftLayer_Virtual_Guest""" def
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
u"""List of SoftLayer_Virtual_Guest""" def
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
etch_method = self.master_account.getVirtualGuests # -------------------------------------------------------------- try: master_acco
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
---------------------------------- try: master_acco
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
# prefetch for nex
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
t of SoftLayer_User_Custome
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
self.m
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
承側クラスで実装すること"""
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
ched) <
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
item =
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
ss VirtualGuests(It
<|file_name|>sl-ls.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # sl-ls.py: get information utility # Created by NAKAJIMA Takaaki # Last modified: Apr 16, 2014. # # Require: Python v3 # # See also https://softlayer-api-python-client.readthe...
sts # ------------
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&")<|fim▁hole|>class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat import...
return s
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): <|fim_middle|> class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat import S_ISDIR data = (escape(open(path).read()) if not S_ISDIR(os.stat(path).st_mode) ...
s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: <|fim_middle|> class FsApp(FilesystemMixin): def ...
def h_fs_get(_,path,eltName=''): from stat import S_ISDIR data = (escape(open(path).read()) if not S_ISDIR(os.stat(path).st_mode) else [(p,S_ISDIR(os.stat(path+'/'+p).st_mode)) for p in os.listdir(path)]) _.ws.send(json.dumps({"method":...
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): <|fim_middle|...
from stat import S_ISDIR data = (escape(open(path).read()) if not S_ISDIR(os.stat(path).st_mode) else [(p,S_ISDIR(os.stat(path+'/'+p).st_mode)) for p in os.listdir(path)]) _.ws.send(json.dumps({"method":"fs_get","result":[path,data,eltName]...
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
f=open(path,'w') for x in data: f.write(unescape(x)) f.close() pass
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
import subprocess as sp import shlex data=sp.Popen(shlex.split(path),cwd=cwd,stdout=sp.PIPE, stderr=sp.PIPE).communicate() _.ws.send(json.dumps({"method":"fs_system","result":[path,data,eltName]})); pass
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
os.mkdir(path)
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
os.rmdir(path)
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
open(path,'w').close()
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
os.unlink(path)
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
def __init__(_,ws):_.ws=ws
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
_.ws=ws
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def <|fim_middle|>(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from st...
unescape
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def <|fim_middle|>(_,path,eltName=''): from st...
h_fs_get
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_put
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_system
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_mkdir
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_rmdir
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_touch
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
h_fs_unlink
<|file_name|>fs.py<|end_file_name|><|fim▁begin|>import os,json from cgi import escape def unescape(s): s = s.replace("&lt;", "<") s = s.replace("&gt;", ">") # this has to be last: s = s.replace("&amp;", "&") return s class FilesystemMixin: def h_fs_get(_,path,eltName=''): from stat imp...
__init__
<|file_name|>connect.py<|end_file_name|><|fim▁begin|>import pymongo def connect (): ''' Create the connection to the MongoDB and create 3 collections needed ''' try: # Create the connection to the local host <|fim▁hole|> return False # This is the name of the database -'GtownT...
conn = pymongo.MongoClient() print 'MongoDB Connection Successful' except pymongo.errors.ConnectionFailure, err: print 'MongoDB Connection Unsuccessful'
<|file_name|>connect.py<|end_file_name|><|fim▁begin|>import pymongo def connect (): <|fim_middle|> <|fim▁end|>
''' Create the connection to the MongoDB and create 3 collections needed ''' try: # Create the connection to the local host conn = pymongo.MongoClient() print 'MongoDB Connection Successful' except pymongo.errors.ConnectionFailure, err: print 'MongoDB Connection Unsu...
<|file_name|>connect.py<|end_file_name|><|fim▁begin|>import pymongo def <|fim_middle|> (): ''' Create the connection to the MongoDB and create 3 collections needed ''' try: # Create the connection to the local host conn = pymongo.MongoClient() print 'MongoDB Connection Success...
connect
<|file_name|>subscribe.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Simple script to test sending UTF8 text with the GrowlNotifier class import logging logging.basicConfig(level=logging.DEBUG)<|fim▁hole|>import platform growl = GrowlNotifier(notifications=['Testing'],password='password',hostname='ayu') gr...
from gntp.notifier import GrowlNotifier
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
multi_path = os.path.join(self.output_path, name_multi) if os.path.isfile(multi_path): content_multi = load(multi_path)
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
template = """<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" > </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup /> <ItemDefinitionGroup /> <ItemGroup /> </Pr...
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
pass
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
configuration = str(self.conanfile.settings.build_type) platform = {'x86': 'Win32', 'x86_64': 'x64'}.get(str(self.conanfile.settings.arch)) vsversion = str(self.settings.compiler.version) # there is also ClCompile.RuntimeLibrary, but it's handling is a bit complicated, so skipping for n...
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
content_multi = load(multi_path)
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
content_multi = self.template
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
break
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
import_group.appendChild(import_node)
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
filename
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generat...
content
<|file_name|>test_passthrough.py<|end_file_name|><|fim▁begin|># #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this softw...
def test_https_passthrough(): url = 'https://raw.githubusercontent.com/gabrielfalcao/HTTPretty/master/COPYING'
<|file_name|>test_passthrough.py<|end_file_name|><|fim▁begin|># #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this softw...
rl = 'http://httpbin.org/status/200' response1 = requests.get(url) response1 = requests.get(url, stream=True) HTTPretty.enable() HTTPretty.register_uri(HTTPretty.GET, 'http://google.com/', body="Not Google") response2 = requests.get('http://google.com/') expect(response2.content).to.equal...
<|file_name|>test_passthrough.py<|end_file_name|><|fim▁begin|># #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this softw...
rl = 'https://raw.githubusercontent.com/gabrielfalcao/HTTPretty/master/COPYING' response1 = requests.get(url, stream=True) HTTPretty.enable() HTTPretty.register_uri(HTTPretty.GET, 'https://google.com/', body="Not Google") response2 = requests.get('https://google.com/') expect(response2.conten...
<|file_name|>test_passthrough.py<|end_file_name|><|fim▁begin|># #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this softw...
est_http_passthrough(
<|file_name|>test_passthrough.py<|end_file_name|><|fim▁begin|># #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this softw...
est_https_passthrough(
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models from constituencies.models import Constituency from uk_political_parties.models import Party from elections.models import Election class Person(models.Model): name = models.CharField(blank=False, max_length=255) remote_id = mod...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models from constituencies.models import Constituency from uk_political_parties.models import Party from elections.models import Election class Person(models.Model): <|fim_middle|> class PartyMemberships(models.Model): person = mod...
name = models.CharField(blank=False, max_length=255) remote_id = models.CharField(blank=True, max_length=255, null=True) source_url = models.URLField(blank=True, null=True) source_name = models.CharField(blank=True, max_length=100) image_url = models.URLField(blank=True, null=True) elections = m...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models from constituencies.models import Constituency from uk_political_parties.models import Party from elections.models import Election class Person(models.Model): name = models.CharField(blank=False, max_length=255) remote_id = mod...
parties = self.partymemberships_set.filter(membership_end=None) if parties: return parties[0]
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models from constituencies.models import Constituency from uk_political_parties.models import Party from elections.models import Election class Person(models.Model): name = models.CharField(blank=False, max_length=255) remote_id = mod...
return self.elections.filter(active=True)[0]