prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | self.test_read()
self.failUnlessRaises(StopIteration, self.obj.read)
self.obj.seek(0)
self.test_read() |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | w = self.obj.read()
f = tempfile.NamedTemporaryFile(
suffix='.swm', dir=pysal.examples.get_path(''))
fname = f.name
f.close()
o = pysal.open(fname, 'w')
o.write(w)
o.close()
wnew = pysal.open(fname, 'r').read()
self.assertEqual(wnew.pct... |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | unittest.main() |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def <|fim_middle|>(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')... | setUp |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | test_close |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | test_read |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | test_seek |
<|file_name|>test_arcgis_swm.py<|end_file_name|><|fim▁begin|>import unittest
import pysal
from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO
import tempfile
import os
class test_ArcGISSwmIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal.examples.get_path('ohio.swm')
... | test_write |
<|file_name|>signals.py<|end_file_name|><|fim▁begin|>from django.dispatch import Signal
<|fim▁hole|>pre_delete = Signal(providing_args=['instance', 'action', ])
post_delete = Signal(providing_args=['instance', 'action', ])<|fim▁end|> | pre_save = Signal(providing_args=['instance', 'action', ])
post_save = Signal(providing_args=['instance', 'action', ])
|
<|file_name|>P4COMSTR.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limita... | test.write('bbb.in', "checked-out bbb.in\n")
test.write(['Perforce', 'ccc.in'], "Perforce/ccc.in\n")
|
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | s = getattr(self.style, action.upper())
action = s(action)
|
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
<|fim_middle|>
<|fim▁end|> | def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry_run = False
if supports_color():
opts = ('bold',)
self.style.EXISTS = \
termcolors.make_style(fg='blue', opts=opts)
self.style.APPEND =... |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
<|fim_middle|>
def msg(self, action, path):
is_withholding_ac... | super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry_run = False
if supports_color():
opts = ('bold',)
self.style.EXISTS = \
termcolors.make_style(fg='blue', opts=opts)
self.style.APPEND = \
termcolors.make_style(... |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | is_withholding_action = False
non_actions = set(['create', 'append', 'revert'])
if self.dry_run and action in non_actions:
is_withholding_action = True
if hasattr(self.style, action.upper()):
s = getattr(self.style, action.upper())
action = s(action)
... |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | if self.verbose:
self.stdout.write(output) |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | opts = ('bold',)
self.style.EXISTS = \
termcolors.make_style(fg='blue', opts=opts)
self.style.APPEND = \
termcolors.make_style(fg='yellow', opts=opts)
self.style.CREATE = \
termcolors.make_style(fg='green', opts=opts)
... |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | is_withholding_action = True |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | s = getattr(self.style, action.upper())
action = s(action) |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | action = self.style.NOTICE('did not ') + action |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | self.stdout.write(output) |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def <|fim_middle|>(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
se... | __init__ |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | msg |
<|file_name|>verbosity.py<|end_file_name|><|fim▁begin|>import os
from django.core.management.color import supports_color
from django.utils import termcolors
class VerboseCommandMixin(object):
def __init__(self, *args, **kwargs):
super(VerboseCommandMixin, self).__init__(*args, **kwargs)
self.dry... | log |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | assert not question.their_answer_matches |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | age = 22
search_fetchable = SearchFetchable(gentation='everybody',
minimum_age=age, maximum_age=age)
for profile in search_fetchable[:5]:
assert profile.age == age |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | profiles = search(gentation='everybody', count=14)
assert len(profiles) == 14
for profile in profiles:
profile.username
profile.age
profile.location
profile.match_percentage
profile.enemy_percentage
profile.id
profile.rating
profile.contacted |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
location_cache = LocationQueryCache(session)
location = 'Portland, OR'
search_fetchable = SearchFetchable(location=location, location_cache=location_cache, radius=1)
for profile in search_fetchable[:5]:
assert profile.location == 'Portland, OR' |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | profile, = search(count=1)
assert isinstance(profile, Profile)
profile.username
profile.age
profile.location
profile.match_percentage
profile.enemy_percentage
profile.id
profile.rating
profile.contacted |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | search_fetchable = SearchFetchable(gentation='everybody',
religion='buddhist', age_min=25, age_max=25,
location='new york, ny', keywords='bicycle')
for count, profile in enumerate(search_fetchable):
assert isinstance(profile, ... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
query_test_pairs = [# ('bodytype', maps.bodytype),
# TODO(@IvanMalison) this is an alist feature,
# so it can't be tested for now.
('drugs', maps.drugs), ('smokes', maps.smokes),
('diet', ma... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
profile = SearchFetchable(session, wants_kids="wants kids", count=1)[0]
assert "wants" in profile.details.children.lower()
profile = SearchFetchable(session, has_kids=["has kids"],
wants_kids="doesn't want kids",
coun... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
profile = SearchFetchable(session, cats=['dislikes cats', 'likes cats'],
count=1)[0]
assert 'likes cats' in profile.details.pets.lower()
profile = SearchFetchable(session, dogs='likes dogs', cats='has cats', count=1)[0]
assert 'likes dogs' in... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
profile = SearchFetchable(session, height_min='5\'6"', height_max='5\'6"',
gentation='girls who like guys', radius=25, count=1)[0]
match = magicnumbers.imperial_re.search(profile.details.height)
assert int(match.group(1)) == 5
assert int(match.... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
profile = SearchFetchable(session, language='french', count=1)[0]
assert 'french' in [language_info[0].lower()
for language_info in profile.details.languages]
profile = SearchFetchable(session, language='Afrikaans', count=1)[0]
assert 'afrikaans' in... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | session = Session.login()
profile = SearchFetchable(session, attractiveness_min=4000,
attractiveness_max=6000, count=1)[0]
assert profile.attractiveness > 4000
assert profile.attractiveness < 6000 |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | user = User()
user_question = user.questions.somewhat_important[0]
for profile in user.search(question=user_question)[:5]:
question = profile.find_question(user_question.id)
assert question.their_answer_matches |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | user = User()
user_question = user.questions.somewhat_important[1]
unacceptable_answers = [answer_option.id
for answer_option in user_question.answer_options
if not answer_option.is_match]
for profile in user.search(question=user_question.id,
... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | user = User()
for profile in user.search(question_count_min=250)[:5]:
assert profile.questions[249] |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | user = User()
search_fetchable = user.search()
for profile in search_fetchable[:4]:
profile_session = profile._session
with mock.patch.object(profile, '_session') as mock_session:
mock_session.okc_get.side_effect = profile_session.okc_get
assert profile.id > 0
... |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | break |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_age_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_count_variable |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_location_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_search_function |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_search_fetchable_iter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_easy_search_filters |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_children_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_pets_queries |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_height_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_language_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_attractiveness_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_question_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_question_filter_with_custom_answers |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_question_count_filter |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | test_search_populates_upfront |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.spli... | pass
# print unique_values[i] |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
<|fim_middle|>
###
csv.field_size_limit( 1000000 )
input_file = sys.argv[1]
target_col = 'SalaryNormal... | text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.split()
words = []
for w in text:
if w in words:
continue
words.append( w )
return words |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.spli... | continue |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.spli... | print n |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.spli... | pass
# print unique_values[i] |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def <|fim_middle|>( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text... | get_words |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.<|fim▁hole|... | """
g.setColor('#ff0000') |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
<|fim_middle|>
def all_blue():
"""
C... | """
Create an all-red frame.
"""
g.setColor('#ff0000')
g.setIntensity(255)
return g.getFrame() |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.se... | """
Create an all-blue frame.
"""
g.setColor('#0000ff')
g.setIntensity(255)
return g.getFrame() |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.se... | log.info("Running script %s" % __name__)
# global g
# g = get_default_fixture_group(config)
q = controller or dmx.Controller(config.get('base', 'address'), bpm=60, nodaemon=True, runout=True)
q.add(fades.create_multifade([
all_red(),
all_blue(),
] * 3, secs=5.0))
if not controller:
q.start() |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.se... | q.start() |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def <|fim_middle|>():
"""
Create an all-red frame.
""... | all_red |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.se... | all_blue |
<|file_name|>alternating_color_fades.py<|end_file_name|><|fim▁begin|>import time, logging
from artnet import dmx, fixtures, rig
from artnet.dmx import fades
log = logging.getLogger(__name__)
# set up test fixtures
r = rig.get_default_rig()
g = r.groups['all']
def all_red():
"""
Create an all-red frame.
"""
g.se... | main |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror<|fim▁hole|>-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Picture... | |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | plot1 = xrtp.XYCPlot('star.03')
plot1.caxis.offset = 6000
plot2 = xrtp.XYCPlot('star.04')
plot2.caxis.offset = 6000
plot1.xaxis.limits = [-15, 15]
plot1.yaxis.limits = [-15, 15]
plot1.yaxis.factor *= -1
plot2.xaxis.limits = [-1, 1]
plot2.yaxis.limits = [-1, 1]
plot2.yaxis.factor ... |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | for rmirr in np.logspace(-1., 1., 7, base=1.5) * rmirr0:
shadow.modify_input(start01, ('RMIRR', str(rmirr)))
filename = 'VCM_R%07i' % rmirr
filename03 = '03' + filename
filename04 = '04' + filename
plot1.title = filename03
plot2.title = fil... |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | pass |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | main() |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | main |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | plot_generator |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | after |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | @mock.patch.object(
requests, 'request',
mock.MagicMock(return_value=test_base.FakeHTTPResponse('', 200, 'OK')))
@mock.patch.object(
std_actions.HTTPAction, 'is_sync',
mock.MagicMock(return_value=True))
def test_action_defaults_from_env(self):
wf_service.create_workfl... |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | wf_service.create_workflows(WORKFLOW1)
wf_ex = self.engine.start_workflow('wf1', env=ENV)
self.await_workflow_success(wf_ex.id)
with db_api.transaction():
wf_ex = db_api.get_workflow_execution(wf_ex.id)
self.assertEqual(states.SUCCESS, wf_ex.state)
... |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | wf_service.create_workflows(WORKFLOW2)
wf_ex = self.engine.start_workflow('wf2', env=ENV)
self.await_workflow_success(wf_ex.id)
with db_api.transaction():
wf_ex = db_api.get_workflow_execution(wf_ex.id)
self.assertEqual(states.SUCCESS, wf_ex.state)
... |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | wf_service.create_workflows(WORKFLOW1_WITH_ITEMS)
wf_input = {
'links': [
'https://api.library.org/books',
'https://api.library.org/authors'
]
}
wf_ex = self.engine.start_workflow(
'wf1_with_items',
wf_inpu... |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | wf_service.create_workflows(WORKFLOW2_WITH_ITEMS)
wf_input = {
'links': [
'https://api.library.org/books',
'https://api.library.org/authors'
]
}
wf_ex = self.engine.start_workflow(
'wf2_with_items',
wf_inpu... |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | test_action_defaults_from_env |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | test_action_defaults_from_env_not_applied |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | test_with_items_action_defaults_from_env |
<|file_name|>test_action_defaults.py<|end_file_name|><|fim▁begin|># Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | test_with_items_action_defaults_from_env_not_applied |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | from osweb.projects.ManageProject import ManageProject
from osweb.projects.projects_data import ProjectsData |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]<|fim▁hole|> :rtype: bool
"""
if k < 1 or t < 0:
return False
dic = {}
t +=... | :type k: int
:type t: int |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
<|fim_middle|>
test = Solution()
print(test.containsNearbyAlmostDuplicate([1, 3, 1], 1, 1))
<|fim▁end|> | def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return False
dic = {}
t += 1
for i in range(len(nums)):
if i > k:
... |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
<|fim_middle|>
test = Solution()
print(test.containsNearbyAlmostDuplicate([1, 3, 1], 1, 1))
<|fim▁end|> | """
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return False
dic = {}
t += 1
for i in range(len(nums)):
if i > k:
del dic[nums[i - k - 1] // t]
m = ... |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
... | return False |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return Fals... | del dic[nums[i - k - 1] // t] |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return Fals... | return True |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return Fals... | return True |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return Fals... | return True |
<|file_name|>220 Contains Duplicate III.py<|end_file_name|><|fim▁begin|>class Solution(object):
def <|fim_middle|>(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return False
dic =... | containsNearbyAlmostDuplicate |
<|file_name|>uicommon.py<|end_file_name|><|fim▁begin|>def emptyLayout(layout):
for i in reversed(range(layout.count())):<|fim▁hole|><|fim▁end|> | layout.itemAt(i).widget().setParent(None) |
<|file_name|>uicommon.py<|end_file_name|><|fim▁begin|>def emptyLayout(layout):
<|fim_middle|>
<|fim▁end|> | for i in reversed(range(layout.count())):
layout.itemAt(i).widget().setParent(None) |
<|file_name|>uicommon.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>(layout):
for i in reversed(range(layout.count())):
layout.itemAt(i).widget().setParent(None)
<|fim▁end|> | emptyLayout |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.