prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Fire the off action.""" await self._off_script.async_run(context=self._context) if self._template is None: self._state = False self.async_write_ha_state()
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""State is assumed, if no template given.""" return self._template is None
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self._state = None return
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
await super().async_added_to_hass() state = await self.async_get_last_state() if state: self._state = state.state == STATE_ON # no need to listen for events
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self._state = state.state == STATE_ON
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self.add_template_attribute( "_state", self._template, None, self._update_state )
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self._state = True self.async_write_ha_state()
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self._state = False self.async_write_ha_state()
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
_async_create_entities
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
async_setup_platform
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
__init__
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
_update_state
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
async_added_to_hass
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
name
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
unique_id
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
is_on
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
should_poll
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
async_turn_on
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
async_turn_off
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
assumed_state
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
cursor = self.conn.get_cursor(""" select runcatid, wm_ra, wm_ra_err, wm_decl, wm_decl_err, wm_f_int, wm_f_int_err from runningcatalog r, runningcatalog_fluxes f,
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): <|fim_middle|> <|fim▁end|>
"""General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve function. Returns resolution status and an array of xtrsrcid-runcatid of resolved pairs (if possible).""" return ...
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): <|fim_middle|> def resolve(self, detections, sources): """Template resolve function. ...
self.conn = conn pass
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): <|fim_middle|> ...
"""Template resolve function. Returns resolution status and an array of xtrsrcid-runcatid of resolved pairs (if possible).""" return False, []
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
cursor = self.conn.get_cursor(""" select xtrsrcid, ra, ra_err, decl, decl_err, f_int, f_int_err from extractedsources e where e.image_id = %s and exists (select 1 from temp_associations ta where ta.xtrsrc_id2 = e.xtrsrcid and ta.image_id = e.image_id and...
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
cursor = self.conn.get_cursor(""" select runcatid, wm_ra, wm_ra_err, wm_decl, wm_decl_err, wm_f_int, wm_f_int_err from runningcatalog r, runningcatalog_fluxes f, images i where i.imageid = %s and f.band = i.band and f.stokes = i.stokes and r.runcatid = f.runcat_id and exists (select...
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
"""Get data from Database, run resolver, saev results to temp_associations""" #--Run resolver-- is_ok, solutions = self.resolve(self.load_detections(group_id), self.load_sources(group_id)) if is_ok: #"delete" all associa...
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
self.conn.execute(""" update temp_associations set kind = -1 where image_id = %s and group_head_id = %s;""" % (GLOBALS['i'], group_id)) #"restore" associations that are "ok" for solution in solutions: self.conn.execute("""update temp_associations set kind = ...
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def <|fim_middle|>(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resol...
__init__
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def <|fim_middle|>(self, detections, sources): """Template reso...
resolve
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
load_detections
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
load_sources
<|file_name|>resolve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python from src.sqllist import GLOBALS class BasicResolver(object): """General resolver class""" def __init__(self, conn=None): self.conn = conn pass def resolve(self, detections, sources): """Template resolve fun...
run_resolve
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
actual_params = {} default_keys = DEFAULT_PARAMS.keys() for key, value in params.items():
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
"""Generate a Gravatar URL. """ # step 1: get a hex hash of the email address email = email.strip().lower().encode('utf-8') if not EMAIL_RE.match(email): return '' email_hash = hashlib.md5(email).hexdigest() # step 2a: build a canonized parameters dictionary if not type(pa...
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
def __init__(self, email, params): self.email = email self.params = params def render(self, context): try: if self.params: params = template.Variable(self.params).resolve(context) else: params = {} # try matching an ad...
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
self.email = email self.params = params
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
try: if self.params: params = template.Variable(self.params).resolve(context) else: params = {} # try matching an address string literal email_literal = self.email.strip().lower() if EMAIL_RE.match(email_literal): ...
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
"""For template tag: {% gravatar_url <email> <params> %} Where <params> is an object or a dictionary (variable), and <email> is a string object (variable) or a string (literal). """ try: tag_name, email, params = token.split_contents() except ValueError: try: tag_na...
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
return ''
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
params = params.__dict__
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
k, default_value = DEFAULT_PARAMS[key] # skip parameters whose values are defaults, # assume these values are mirroring Gravatar's defaults if value != default_value: actual_params[k] = value
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
actual_params[k] = value
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
if value < 1 or value > 512: del actual_params[key]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
del actual_params[key]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
if value.lower() not in ('g', 'pg', 'r', 'x'): del actual_params[key]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
del actual_params[key]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
if value.lower() not in ('identicon', 'monsterid', 'wavatar', '404'): if not URL_RE.match(value): # if not a valid URI del actual_params[key] else: # valid URI, encode it actual_params[key] = value # urlencode wil...
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
if not URL_RE.match(value): # if not a valid URI del actual_params[key] else: # valid URI, encode it actual_params[key] = value # urlencode will encode it later
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
del actual_params[key]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
actual_params[key] = value # urlencode will encode it later
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
gravatar_url += '?' + params_encode
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
params = template.Variable(self.params).resolve(context)
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
params = {}
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
email = email_literal
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
email = template.Variable(self.email).resolve(context)
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
if email[0] == email[-1]: email = email[1:-1] else: raise template.TemplateSyntaxError( "%r tag's first argument is in unbalanced quotes." % tag_name)
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
email = email[1:-1]
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
raise template.TemplateSyntaxError( "%r tag's first argument is in unbalanced quotes." % tag_name)
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
_build_gravatar_url
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
__init__
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
render
<|file_name|>gravatar_tags.py<|end_file_name|><|fim▁begin|>import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]...
get_gravatar_url
<|file_name|>tpl-py-0001.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python #################################### # # --- TEXTPATGEN TEMPLATE --- #<|fim▁hole|> import sys sys.stdout.write('####################################\n') sys.stdout.write('#\n') sys.stdout.write('# -- TEXTPATGEN GENERATED FILE --\n') sys.st...
# Users can change the output by editing # this file directly. # ####################################
<|file_name|>script.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
../../../../../../../share/pyshared/orca/scripts/apps/nautilus/script.py
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
anns = self.gateway.getQueryService().findAllByQuery('from CommentAnnotation as a where a.ns=:ns', param) self.assertEqual(len(anns), 1) self.assertEqual(omero.gateway.CommentAnnotationWrapper(self.gateway, anns[0]).getOwnerOmeName(), self.AUTHOR.name)
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
def testUsers (self): self.loginAsUser() # Try reconnecting without disconnect self._has_connected = False self.doConnect() self.loginAsAuthor() self.loginAsAdmin() def testSaveAs (self): for u in (self.AUTHOR, self.ADMIN): # Test image should...
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
self.loginAsUser() # Try reconnecting without disconnect self._has_connected = False self.doConnect() self.loginAsAuthor() self.loginAsAdmin()
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
for u in (self.AUTHOR, self.ADMIN): # Test image should be owned by author self.loginAsAuthor() image = self.getTestImage() ownername = image.getOwnerOmeName() # Now login as author or admin self.doLogin(u) self.gateway.SERVICE_...
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
self.loginAsUser() uid = self.gateway.getUserId() self.loginAsAdmin() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') d = self.getTestDataset() did = d.getId() g = d.getDetails().getGroup() admin = self.gateway.getAdminService() admin.addGroups(omero...
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
self.loginAsAuthor() u = self.gateway.getUpdateService() p = self.getTestProject() self.assertEqual(str(p.getDetails().permissions)[4], '-') d = p.getDetails() g = d.getGroup() self.loginAsUser() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') self.a...
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
""" Object accesss must be dependent only of group permissions """ ns = 'omero.test.ns' # Author self.loginAsAuthor() # create group with rw---- # create project and annotation in that group p = dbhelpers.ProjectEntry('testAnnotationPermissions', None, create_grou...
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
unittest.main()
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
testUsers
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
testSaveAs
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
testCrossGroupSave
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
testCrossGroupRead
<|file_name|>user.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts...
testGroupOverObjPermissions
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
query_params.update(parse_qsl(url.query, True)) if additional_params is not None: query_params.update(additional_params) for k, v in additional_params.items():
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
random = SystemRandom() return ''.join([random.choice(UNICODE_ASCII_CHARACTERS) for x in range(length)])
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
"""Return query parameters as a dict from the specified URL. :param url: URL. :type url: str :rtype: dict """ return dict(parse_qsl(urlparse(url).query, True))
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
"""Return a URL with the query component removed. :param url: URL to dequery. :type url: str :rtype: str """ url = urlparse(url) return urlunparse((url.scheme, url.netloc, url.path, url.params, ...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
"""Construct a URL based off of base containing all parameters in the query portion of base plus any additional parameters. :param base: Base URL :type base: str ::param additional_params: Additional query parameters to include. :type additional_params: dict :rtype: str """ url = ur...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
query_params.update(additional_params) for k, v in additional_params.items(): if v is None: query_params.pop(k)
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
query_params.pop(k)
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
random_ascii_string
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
url_query_params
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
url_dequery
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, division, print_function, unicode_literals import string import urllib try: from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse from urllib.request import urlopen, Request from urllib.error im...
build_url
<|file_name|>g3c.py<|end_file_name|><|fim▁begin|>from . import Cl, conformalize<|fim▁hole|>layout, blades, stuff = conformalize(layout_orig) locals().update(blades) locals().update(stuff) # for shorter reprs layout.__name__ = 'layout' layout.__module__ = __name__<|fim▁end|>
layout_orig, blades_orig = Cl(3)
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
def delete(self, id_or_filename): """ Deletes the file referenced by name or unique id. If deletion is not supported on the target storage system this will raise NotImplementedError instead
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): <|fim_middle|> <|fim▁end|>
""" The MediaStorage class provides a standardized API for storing files, along with a set of default behaviors that all other storage systems can inherit or override as necessary. ..versioneadded:: 0.3 """ def __init__(self, app=None): """ :param app: the flask application (ev...
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
""" :param app: the flask application (eve itself). This can be used by the class to access, amongst other things, the app.config object to retrieve class-specific settings. """ self.app = app
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
""" Opens the file given by name or unique id. Note that although the returned file is guaranteed to be a File object, it might actually be some subclass. Returns None if no file was found. """ raise NotImplementedError
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
""" Saves a new file using the storage system, preferably with the name specified. If there already exists a file with this name name, the storage system may modify the filename as necessary to get a unique name. Depending on the storage system, a unique id or the actual name of ...
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
""" Deletes the file referenced by name or unique id. If deletion is not supported on the target storage system this will raise NotImplementedError instead """ raise NotImplementedError
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
""" Returns True if a file referenced by the given name or unique id already exists in the storage system, or False if the name is available for a new file. """ raise NotImplementedError
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
__init__
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
get
<|file_name|>media.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ eve.io.media ~~~~~~~~~~~~ Media storage for Eve-powered APIs. :copyright: (c) 2014 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class MediaStorage(object): """ The MediaStorage class provid...
put