function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def hello_app(environ, start_response):
headers = [('Content-Type', 'text/plain')]
start_response('200 OK', headers)
return [b'Hello!'] | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def perf_parsing_speed(self):
transport = MockTransport()
protocol = HttpProtocol()
transport.start(protocol)
r = b'HTTP/1.1 200 OK\r\nContent-Length: 10000\r\n\r\n'
r += b'x' * 10000
reqs = 4 * r
nbytes = 0
t0 = t1 = time.time()
while t1 - t0 < 1.... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def __init__(
self, plotly_name="symmetric", parent_name="scatter3d.error_y", **kwargs | plotly/python-api | [
13052,
2308,
13052,
1319,
1385013188
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
resource_group_name: str,
resource_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
if not next_link: | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
deserialized = self._deserialize('AgentPool', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build(self, input_shape):
"""See tfkl.Layer.build."""
assert self._event_shape is not None, \
'Unlike MADE, MAN require specified event_shape at __init__'
# `event_shape` wasn't specied at __init__, so infer from `input_shape`.
self._input_size = input_shape[-1]
# Construct the masks.
... | imito/odin | [
20,
10,
20,
4,
1466893531
] |
def sample_get_operations():
# [START list_operations]
from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import DocumentModelAdministrationClient
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
document_mode... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self):
self.screen = curses.initscr()
self.screen.clear() | manly-man/moodle-destroyer-tools | [
7,
2,
7,
3,
1422642405
] |
def __exit__(self, exc_type, exc_val, exc_tb):
print('__exit__')
curses.nocbreak()
self.screen.keypad(False)
curses.echo()
curses.endwin() | manly-man/moodle-destroyer-tools | [
7,
2,
7,
3,
1422642405
] |
def __init__(
self,
plotly_name="minexponent",
parent_name="histogram.marker.colorbar",
**kwargs | plotly/plotly.py | [
13052,
2308,
13052,
1319,
1385013188
] |
def test_watch_bad_argument(self):
"""Should not reload a module"""
self.assertFalse(
reloading.refresh(datetime, force=True),
Message('Should not reload not a module')
) | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_watch_not_needed(self):
"""Don't reload modules that haven't changed."""
support.create_project(self, 'betty')
project = cd.project.get_internal_project()
project.current_step = project.steps[0]
self.assertFalse(
reloading.refresh(mime_text),
Mes... | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_get_module_name(self):
"""Should get the module name from the name of its spec."""
target = MagicMock()
target.__spec__ = MagicMock()
target.__spec__.name = 'hello'
self.assertEqual('hello', reloading.get_module_name(target)) | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_do_reload_error(self, reload: MagicMock, os_path: MagicMock):
"""Should fail to import the specified module and so return False."""
target = MagicMock()
target.__file__ = None
target.__path__ = ['fake']
os_path.getmtime.return_value = 10
reload.side_effect = Impo... | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_do_reload(self, reload: MagicMock, os_path: MagicMock):
"""Should import the specified module and return True."""
target = MagicMock()
target.__file__ = 'fake'
os_path.getmtime.return_value = 10
self.assertTrue(reloading.do_reload(target, 0))
self.assertEqual(1, ... | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def test_do_reload_skip(self, reload: MagicMock, os_path: MagicMock):
"""
Should skip reloading the specified module because it hasn't been
modified and return False.
"""
target = MagicMock()
target.__file__ = 'fake'
os_path.getmtime.return_value = 0
self.... | sernst/cauldron | [
78,
127,
78,
24,
1461686724
] |
def cfg():
name = 'kyle' | zzsza/TIL | [
22,
8,
22,
1,
1486867877
] |
def greet(name):
print('Hello {}! Nice to greet you!'.format(name)) | zzsza/TIL | [
22,
8,
22,
1,
1486867877
] |
def shout():
print('WHAZZZUUUUUUUUUUP!!!????') | zzsza/TIL | [
22,
8,
22,
1,
1486867877
] |
def test_suggestion_url(self):
client = self.client
# self.assertEqual(client.suggestions.address.url, "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address")
self.assertEqual(client.suggestions.address.url, "https://dadata.ru/api/v2/suggest/address") | tigrus/dadata-python | [
11,
7,
11,
1,
1485256853
] |
def __init__(self, *a, **kw):
test_web.DummyRequest.__init__(self, *a, **kw)
self.requestHeaders = http_headers.Headers()
self.content = StringIO() | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def setHeader(self, name, value):
return server.Request.setHeader(self, name, value) | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def setResponseCode(self, code, message=None):
server.Request.setResponseCode(self, code, message) | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def written_as_string(self):
return ''.join(self.written) | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def setUp(self):
self.runtime_environment = processing.RuntimeEnvironment()
self.service = service.IService(self.runtime_environment.application)
self.dependency_manager = self.runtime_environment.dependency_manager
self.configuration_manager = self.runtime_environment.configuration_mana... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def _create_configured_web_resource(self, routing, site_configuration=None):
site_configuration = site_configuration or dict()
web_site = web_provider.WebSite('site_name', site_configuration)
web_resource = web_provider.WebResource(web_site, routing)
web_resource.configure(self.runtime_e... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def getResourceForFakeRequest(self, site, post_path=None, request=None):
if not request:
request = DummyRequest(post_path)
return site.factory.getResourceFor(request) | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_enabled_web_sites_provided(self):
provider = web_provider.WebResourceProvider()
self.configuration_manager.set('web.my_site.routing',
dict(__config__=dict(processor='a_processor'))
)
self.configuration_manager.set('web.another_site.enabled', False)
self.config... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_no_resource_processor_routing(self):
config = dict(
routing = dict(
__config__ = dict(processor='pipeline.root_pipeline', no_resource_processor='pipeline.root_no_resource_pipeline'),
foo = dict(
__config__ = dict(processor = 'pipeline.foo_... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def assertRequestRenderedWithPostPath(web_site, batons, request, post_path):
self.getResourceForFakeRequest(web_site, request=request).render(request)
self.assertEquals(batons, [dict(request=request)])
request = batons.pop()['request']
self.assertEquals(request.postpath, ... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_static_preprocessors(self):
current_file = filepath.FilePath(__file__)
config = dict(
routing = dict(
__config__ = dict(
static = dict(
path = current_file.dirname(),
preprocessors = dict(
... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_web_resource_simple_request_processing(self):
web_resource = self._create_configured_web_resource(dict(__config__=dict(processor='pipeline.a_pipeline')))
request = DummyRequest([''])
batons = list()
web_resource.processor_dependency.on_resource_ready(batons.append)
# ... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def raiser(baton):
raise Exception() | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_web_resource_processing_raises_with_debugging(self):
routing = dict(__config__=dict(processor='pipeline.a_pipeline'))
site_config = dict(debug=dict(allow=['localhost']))
web_resource = self._create_configured_web_resource(routing, site_config)
request = DummyRequest([''])
... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_debug_handler_reaping(self):
# reap all debuggers every reactor iteration:
site_config = dict(routing=dict())
web_site = web_provider.WebSite('site_name', site_config)
debug_handler = web_provider.WebDebugHandler(web_site, reap_interval=0, max_inactive_time=0)
debug_han... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_web_debugger(self):
# create a failure instance with an actual traceback:
foo = 42 # this will become part of the debuggers namespace
try:
raise Exception()
except Exception as e:
f = util.NonCleaningFailure()
web_debugger = web_provider.WebDebug... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_request_finished_when_garbage_collected(self):
web_site = web_provider.WebSite('site_name', dict(routing=dict(__config__=dict(processor='pipeline.test_pipeline'))))
web_site.configure(self.runtime_environment)
batons = list()
web_resource = self.getResourceForFakeRequest(web_s... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_concatenating_files(self):
test_data_path = filepath.FilePath(__file__).sibling('data')
file_paths = [test_data_path.child('foo'), test_data_path.child('bar')]
cf = web_provider.ConcatenatedFile('text/plain', file_paths)
request = DummyRequest([''])
text = cf.render_GET... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def test_just_a_single_file(self):
test_data_path = filepath.FilePath(__file__).sibling('data')
file_paths = [test_data_path.child('foo')]
cf = web_provider.ConcatenatedFile('text/plain', file_paths)
request = DummyRequest([''])
text = cf.render_GET(request)
self.assert... | foundit/Piped | [
21,
4,
21,
5,
1308050379
] |
def __init__(self, *args, **kwargs): #method, initialisng
tk.Tk.__init__(self, *args, **kwargs)
tk.Tk.wm_iconbitmap(self, default="favicon.ico")
container = tk.Frame(self) #container for holding everything
container.pack(side = "top", fill = None, expand = False)
container.pack_pr... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def music(self, uri):
spotify = spotipy.Spotify()
results = spotify.artist_top_tracks(uri)
#getting the track and audio link to top song
for track in results['tracks'][:1]:
text2 = track['preview_url']
return text2 | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def getTweets(self):
x = t.statuses.home_timeline(screen_name="AndrewKLeech")
return x | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def get_map(self,lat,lng):
latString = str(lat)
lngString = str(lng)
#Map url from google maps, has marker and colors included
url = ("https://maps.googleapis.com/maps/api/staticmap?center="+latString+","+lngString+"&size=450x250&zoom=16&style=feature:road.local%7Celement:geometry%7Ccolor:0x... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def game(self):
w, h = 500, 500
# Pack pygame in `embed`.
root = tk.Tk()
embed = tk.Frame(root, width=w, height=h)
embed.pack()
# Tell pygame's SDL window which window ID to use
os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
# Show the window so it's assign... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Frame.configure(self, bg = "black")
radio = tk.Button(self, text ="RADIO", bg="black", fg="green", width = 10,
command = lambda: controller.show_frame(RadioPage))
radio.place(x = 15, y = 0)
... | AndrewKLeech/Pip-Boy | [
12,
2,
12,
1,
1455726425
] |
def __init__(self, xChart, chart):
super(_BasePlot, self).__init__()
self._element = xChart
self._chart = chart | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def categories(self):
"""
Returns a |category.Categories| sequence object containing
a |category.Category| object for each of the category labels
associated with this plot. The |category.Category| class derives from
``str``, so the returned value can be treated as a simple sequen... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def chart(self):
"""
The |Chart| object containing this plot.
"""
return self._chart | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def data_labels(self):
"""
|DataLabels| instance providing properties and methods on the
collection of data labels associated with this plot.
"""
dLbls = self._element.dLbls
if dLbls is None:
raise ValueError(
"plot has no data labels, set has_... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def has_data_labels(self):
"""
Read/write boolean, |True| if the series has data labels. Assigning
|True| causes data labels to be added to the plot. Assigning False
removes any existing data labels.
"""
return self._element.dLbls is not None | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def has_data_labels(self, value):
"""
Add, remove, or leave alone the ``<c:dLbls>`` child element depending
on current state and assigned *value*. If *value* is |True| and no
``<c:dLbls>`` element is present, a new default element is added with
default child elements and settings... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def series(self):
"""
A sequence of |Series| objects representing the series in this plot,
in the order they appear in the plot.
"""
return SeriesCollection(self._element) | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def vary_by_categories(self):
"""
Read/write boolean value specifying whether to use a different color
for each of the points in this plot. Only effective when there is
a single series; PowerPoint automatically varies color by series when
more than one series is present.
... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def vary_by_categories(self, value):
self._element.get_or_add_varyColors().val = bool(value) | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def gap_width(self):
"""
Width of gap between bar(s) of each category, as an integer
percentage of the bar width. The default value for a new bar chart is
150, representing 150% or 1.5 times the width of a single bar.
"""
gapWidth = self._element.gapWidth
if gapWi... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def gap_width(self, value):
gapWidth = self._element.get_or_add_gapWidth()
gapWidth.val = value | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def overlap(self):
"""
Read/write int value in range -100..100 specifying a percentage of
the bar width by which to overlap adjacent bars in a multi-series bar
chart. Default is 0. A setting of -100 creates a gap of a full bar
width and a setting of 100 causes all the bars in a c... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def overlap(self, value):
"""
Set the value of the ``<c:overlap>`` child element to *int_value*,
or remove the overlap element if *int_value* is 0.
"""
if value == 0:
self._element._remove_overlap()
return
self._element.get_or_add_overlap().val = v... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def bubble_scale(self):
"""
An integer between 0 and 300 inclusive indicating the percentage of
the default size at which bubbles should be displayed. Assigning
|None| produces the same behavior as assigning `100`.
"""
bubbleScale = self._element.bubbleScale
if bu... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def bubble_scale(self, value):
bubbleChart = self._element
bubbleChart._remove_bubbleScale()
if value is None:
return
bubbleScale = bubbleChart._add_bubbleScale()
bubbleScale.val = value | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def PlotFactory(xChart, chart):
"""
Return an instance of the appropriate subclass of _BasePlot based on the
tagname of *xChart*.
"""
try:
PlotCls = {
qn("c:areaChart"): AreaPlot,
qn("c:area3DChart"): Area3DPlot,
qn("c:barChart"): BarPlot,
qn("... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def chart_type(cls, plot):
"""
Return the member of :ref:`XlChartType` that corresponds to the chart
type of *plot*.
"""
try:
chart_type_method = {
"AreaPlot": cls._differentiate_area_chart_type,
"Area3DPlot": cls._differentiate_area_3d... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_area_3d_chart_type(cls, plot):
return {
ST_Grouping.STANDARD: XL.THREE_D_AREA,
ST_Grouping.STACKED: XL.THREE_D_AREA_STACKED,
ST_Grouping.PERCENT_STACKED: XL.THREE_D_AREA_STACKED_100,
}[plot._element.grouping_val] | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_area_chart_type(cls, plot):
return {
ST_Grouping.STANDARD: XL.AREA,
ST_Grouping.STACKED: XL.AREA_STACKED,
ST_Grouping.PERCENT_STACKED: XL.AREA_STACKED_100,
}[plot._element.grouping_val] | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_bar_chart_type(cls, plot):
barChart = plot._element
if barChart.barDir.val == ST_BarDir.BAR:
return {
ST_Grouping.CLUSTERED: XL.BAR_CLUSTERED,
ST_Grouping.STACKED: XL.BAR_STACKED,
ST_Grouping.PERCENT_STACKED: XL.BAR_STACKED_1... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_bubble_chart_type(cls, plot):
def first_bubble3D(bubbleChart):
results = bubbleChart.xpath("c:ser/c:bubble3D")
return results[0] if results else None
bubbleChart = plot._element
bubble3D = first_bubble3D(bubbleChart)
if bubble3D is None:
... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_doughnut_chart_type(cls, plot):
doughnutChart = plot._element
explosion = doughnutChart.xpath("./c:ser/c:explosion")
return XL.DOUGHNUT_EXPLODED if explosion else XL.DOUGHNUT | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_line_chart_type(cls, plot):
lineChart = plot._element
def has_line_markers():
matches = lineChart.xpath('c:ser/c:marker/c:symbol[@val="none"]')
if matches:
return False
return True
if has_line_markers():
return ... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_pie_chart_type(cls, plot):
pieChart = plot._element
explosion = pieChart.xpath("./c:ser/c:explosion")
return XL.PIE_EXPLODED if explosion else XL.PIE | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def _differentiate_radar_chart_type(cls, plot):
radarChart = plot._element
radar_style = radarChart.xpath("c:radarStyle")[0].get("val")
def noMarkers():
matches = radarChart.xpath("c:ser/c:marker/c:symbol")
if matches and matches[0].get("val") == "none":
... | scanny/python-pptx | [
1718,
400,
1718,
404,
1353495811
] |
def __init__(
self,
url, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _send_request(
self,
request, # type: HttpRequest
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def close(self):
# type: () -> None
self._client.close() | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
resource_group_name, # type: str
circuit_name, # type: str
peering_name, # type: str
**kwargs # type: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=resp... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _any_conditions(modified_access_conditions=None, **kwargs): # pylint: disable=unused-argument
return any([
modified_access_conditions.if_modified_since,
modified_access_conditions.if_unmodified_since,
modified_access_conditions.if_none_match,
modified_access_conditions.if_match
... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
resource_group_name: str,
account_name: str,
maxpagesize: Optional[str] = None,
filter: Optional[str] = None,
include: Optional[Union[str, "_models.ListContainersInclude"]] = None,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
if not next_link: | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, configurations):
self.jobs = []
for config in configurations:
print("CONFIG:", config)
self.jobs.append(AsyncTask(TotalScatteringReduction, args=(config,),
success_cb=self.on_success, error_cb=self.on_error,
... | neutrons/FastGR | [
5,
5,
5,
38,
1460053228
] |
def start(self):
if not self.jobs:
raise RuntimeError('Cannot start empty job list')
self._start_next() | neutrons/FastGR | [
5,
5,
5,
38,
1460053228
] |
def on_error(self, task_result):
# TODO should emit a signal
print('ERROR!!!')
self.task_exc_type = task_result.exc_type
self.task_exc = task_result.exc_value
self.task_exc_stack = traceback.extract_tb(task_result.stack)
traceback.print_tb(task_result.stack)
print... | neutrons/FastGR | [
5,
5,
5,
38,
1460053228
] |
def test_api_basic_publish(self):
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
api.queue.declare(self.queue_name)
try:
self.assertEqual(api.basic.publish(self.message, self.queue_name),
{'routed': True})
finally:
api.queue.delete... | eandersson/amqpstorm | [
173,
37,
173,
9,
1408606339
] |
def test_api_basic_get_message(self):
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
api.queue.declare(self.queue_name)
self.assertEqual(api.basic.publish(self.message, self.queue_name),
{'routed': True})
result = api.basic.get(self.queue_name, requeue=False... | eandersson/amqpstorm | [
173,
37,
173,
9,
1408606339
] |
def test_api_basic_get_message_requeue(self):
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
api.queue.declare(self.queue_name)
self.assertEqual(api.basic.publish(self.message, self.queue_name),
{'routed': True})
result = api.basic.get(self.queue_name, reque... | eandersson/amqpstorm | [
173,
37,
173,
9,
1408606339
] |
def E_field_from_SheetCurruent(XYZ, srcLoc, sig, t, E0=1., orientation='X', kappa=0., epsr=1.):
"""
Computing Analytic Electric fields from Plane wave in a Wholespace
TODO:
Add description of parameters
"""
XYZ = Utils.asArray_N_x_Dim(XYZ, 3)
# Check
if XYZ.shape[0] > 1 ... | geoscixyz/em_examples | [
8,
7,
8,
9,
1453777337
] |
def __init__(self,parent):
self.parent = parent | iitis/PyLTEs | [
17,
24,
17,
5,
1427202276
] |
def findPowersRR(self, objectiveFunction="averageThr", sgaGenerations = 100, numberOfThreads = 11, numOfIndividuals = 10, evolveTimes = 10, method="global", x_arg=None, y_arg=None, expectedSignalLoss_arg=None):
if method == "local":
if x_arg == None:
x = self.parent.constraintArea... | iitis/PyLTEs | [
17,
24,
17,
5,
1427202276
] |
def returnDistanceFromSNR(expectedSignalLoss):
lambda_val = 0.142758313333
a = 4.0
b = 0.0065
c = 17.1
d = 10.8
s = 15.8 | iitis/PyLTEs | [
17,
24,
17,
5,
1427202276
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.