function string | repo_name string | features list |
|---|---|---|
def aidCommon(self, card):
if not card.routingAttr:
return False
return set(sim_card.FILES_AID).issubset(set(card.routingAttr.filesCommon)) | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getFileHandler(self, file):
#by default execute apdu in card 0
cards = [self.cardsDict[0][MAIN_INTERFACE]]
for cardDict in self.cardsDict:
if cardDict == self.cardsDict[0]:
#cardDict already in cards
continue
card = cardDict[MAIN_INTER... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def addLeftHandlers(self, cards):
for cardDict in self.cardsDict:
card = cardDict[MAIN_INTERFACE]
if card in cards:
continue
cards.append(card)
return cards | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def handleApdu(self, cardData, apdu):
card = cardData[0]
sendData = cardData[1]
if card == None:
raise Exception("card not initialized")
ins = types.insName(apdu)
if card != self.getMainCard(0):
origApdu = apdu
if ( self.aidCommon(card) and
... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def tick(self):
with self.lock:
inject = INJECT_READY
evt, apdu = self.receiveCommandApdu()
if evt == EVT_RESET:
self.resetCards()
return
if not apdu:
if (not self.inject or
self.rapduInject):... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getNbrOfCards(self):
return len(self.cardsDict) | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getCardDictFromId(self, simId):
if simId >= self.getNbrOfCards() or simId < 0:
raise Exception("simId: " + str(simId) + " not found")
return self.cardsDict[simId] | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getMainCard(self, simId):
cardDict = self.getCardDictFromId(simId)
return cardDict[MAIN_INTERFACE] | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getRelatedMainCard(self, cardCtrl):
for cardDict in self.cardsDict:
if cardDict[CTRL_INTERFACE] == cardCtrl:
return cardDict[MAIN_INTERFACE]
return None | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def swapCards(self, simId1, simId2):
cardDict1 = self.getCardDictFromId(simId1)
cardDict2 = self.getCardDictFromId(simId2)
#with self.lock:
self.cardsDict[simId1] = cardDict2
self.cardsDict[simId2] = cardDict1 | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def getATR(self):
if self.atr is not None:
return self.atr
else:
return self.getMainCard(0).getATR() | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def waitRapduInject(self, timeout=30):
startTime = time.time()
while True:
with self.lock:
rapduInject = self.rapduInject
if rapduInject:
self.rapduInject = None
self.inject = INJECT_READY
return rapd... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def setPowerSkip(self, skip):
self.command(CMD_SET_SKIP, hextools.u32(skip)) | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def run(self, mode=ROUTER_MODE_INTERACTIVE):
if self.loop and self.routerMode == ROUTER_MODE_DISABLED:
self.shell.updateInteractive(self.getInteractiveFromMode(mode))
self.startPlacServer(mode)
return
self.routerMode = mode
time.sleep(0.1) # Truncated logs
... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def startPlacServer(self, mode):
if mode == ROUTER_MODE_DISABLED:
return
self.interpreter = plac.Interpreter(self.shell)
if mode == ROUTER_MODE_TELNET:
self.interpreter.start_server() # Loop
elif mode == ROUTER_MODE_DBUS:
from util import dbus_ctrl
... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def setupLogger(self):
logger = logging.getLogger("router")
#dont't propagate to root logger
logger.propagate=False
logger.handlers = []
consoleHandler = logging.StreamHandler()
consoleHandler.setLevel(logging.DEBUG)
# create file handler which logs even debug m... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def pretty_apdu(self, apdu):
str = types.insName(apdu)
if str == 'SELECT_FILE':
str += " " + self.fileName(apdu)
self.loggingApdu.info(str) | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def setLoggerExtHandler(handler):
global extHandler
extHandler = handler | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def __init__(self, simRouter):
threading.Thread.__init__(self)
self.simRouter = simRouter
threading.Thread.setName(self, 'MainLoopThread')
self.__lock = threading.Lock() | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def stop(self):
self.join() | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def __init__(self, simRouter):
threading.Thread.__init__(self)
self.simRouter = simRouter
threading.Thread.setName(self, 'ResetThread')
self.__lock = threading.Lock() | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def softReset(self):
self.simRouter.logging.info("\n")
self.simRouter.logging.info("<- Soft reset")
for cardDict in self.simRouter.cardsDict:
if (not cardDict[MAIN_INTERFACE].routingAttr or
#skip SIM with no common instruction
cardDict[MAIN_INT... | kamwar/simLAB | [
74,
31,
74,
4,
1461177205
] |
def testGladman_dev_vec(self):
""" All 25 combinations of block and key size.
These test vectors were generated by Dr Brian Gladman
using the program aes_vec.cpp <brg@gladman.uk.net> 24th May 2001.
vectors in file: dev_vec.txt
http://fp.gladman.plus.com/cryptogra... | repotvsupertuga/tvsupertuga.repository | [
1,
8,
1,
4,
1493763534
] |
def execute(self):
# Option sanity check
self.forbidden(self.options.fsnames, "-f, see -m")
self.forbidden(self.options.labels, "-l")
self.forbidden(self.options.indexes, "-i")
self.forbidden(self.options.failover, "-F")
rc = RC_OK
if not self.options.model:
... | cea-hpc/shine | [
20,
5,
20,
38,
1427733899
] |
def __init__(self,screen):
ConverterBase.__init__(self,screen)
ui=self.ui
ys=self.makeTab(10,94,'CFG settings')
ui.add(sockgui.Label(ui,[20,ys+10],'Expansion name:'))
ui.add(sockgui.Label(ui,[20,ys+26],'Author name:'))
ui.add(sockgui.Label(ui,[20,ys+42],'Orig. Author name:'))
ui.add(sockgui.Label(ui,[20... | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def refreshList(self,junk):
self.files.setItems(self.getOBJList()) | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def statusCallback(self,text):
self.errortext.setText(text)
self.ui.draw() | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def copyAuthorToOrigAuthor(self,junk):
self.origauthorbox.setText(self.authorbox.getText()) | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def getEnhanceColor(self):
try:
val=self.config.get('obj2vxp','enhance')
return sockgui.BoolConv(val)
except:
return False | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def getOBJList(self):
out=[]
for file in os.listdir('.'):
flower=file.lower()
if flower.endswith('.obj'):
out.append(file)
return out | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def RunConverter(title):
pygame.display.set_caption(title+'obj2vxpGUI '+obj2vxp.version)
screen=pygame.display.set_mode((375,397))
gui=obj2vxpGUI(screen)
return gui.run() | foone/7gen | [
5,
1,
5,
2,
1422166989
] |
def re_glob(s):
""" Tests if a string is a shell wildcard. """
global _re_compiled_glob_match
if _re_compiled_glob_match is None:
_re_compiled_glob_match = re.compile(r'[*?]|\[.+\]').search
return _re_compiled_glob_match(s) | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def re_full_search_needed(s):
""" Tests if a string needs a full nevra match, instead of just name. """
global _re_compiled_full_match
if _re_compiled_full_match is None:
# A glob, or a "." or "-" separator, followed by something (the ".")
one = re.compile(r'.*([-.*?]|\[.+\]).').match
... | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def __init__(self, iter=None):
self.__iter = iter | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def __getitem__(self, item):
if hasattr(self, item):
return getattr(self, item)
else:
raise KeyError(item) | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def merge_lists(self, other):
""" Concatenate the list attributes from 'other' to ours. """
for (key, val) in other.all_lists().items():
vars(self).setdefault(key, []).extend(val)
return self | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def keyInstalled(ts, keyid, timestamp):
'''
Return if the GPG key described by the given keyid and timestamp are
installed in the rpmdb.
The keyid and timestamp should both be passed as integers.
The ts is an rpm transaction set object
Return values:
- -1 key is not installed
... | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def getCacheDir():
"""return a path to a valid and safe cachedir - only used when not running
as root or when --tempcache is set"""
uid = os.geteuid()
try:
usertup = pwd.getpwuid(uid)
username = dnf.i18n.ucd(usertup[0])
prefix = '%s-%s-' % (dnf.const.PREFIX, username)
exc... | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def unlink_f(filename):
""" Call os.unlink, but don't die if the file isn't there. This is the main
difference between "rm -f" and plain "rm". """
try:
os.unlink(filename)
except OSError as e:
if e.errno != errno.ENOENT:
raise | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def _getloginuid():
""" Get the audit-uid/login-uid, if available. os.getuid() is returned
instead if there was a problem. Note that no caching is done here. """
# We might normally call audit.audit_getloginuid(), except that requires
# importing all of the audit module. And it doesn't work anyway:... | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def getloginuid():
""" Get the audit-uid/login-uid, if available. os.getuid() is returned
instead if there was a problem. The value is cached, so you don't
have to save it. """
global _cached_getloginuid
if _cached_getloginuid is None:
_cached_getloginuid = _getloginuid()
return ... | rpm-software-management/dnf | [
1066,
367,
1066,
40,
1331307069
] |
def __init__(self, username, password,\
server='imap.gmail.com', port=993):
"""
It returns -1 if there is no connection otherwise it returns
the number of unread mails.
""" | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def __connect(self):
self.M=imaplib.IMAP4_SSL(self.server , self.port)
#First field is imap login (gmail uses login with
#domain and '@' character), second - password
self.M.login(self.username, self.password) | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def __call__(self):
"""
It returns -1 if it's not available the information otherwise
returns the number of unread mail.
"""
try:
if not self.M:
self.__connect() | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def __init__(self, username, password):
"""
It returns -1 if there is no connection otherwise it returns
the number of unread news.
""" | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def __connect(self):
st, out = subprocess.getstatusoutput('curl -fs '+\
'"https://www.google.com/accounts/ClientLogin?'+\
'service=reader&Email='+self.username+\
'&Passwd='+self... | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def __call__(self): | fsquillace/pycious | [
5,
2,
5,
3,
1322312279
] |
def get_migrated_vm_obj(src_vm_obj, target_provider):
"""Returns migrated_vm obj from target_provider"""
collection = target_provider.appliance.provider_based_collection(target_provider)
migrated_vm = collection.instantiate(src_vm_obj.name, target_provider)
return migrated_vm | RedHatQE/cfme_tests | [
69,
165,
69,
133,
1360187957
] |
def ansible_repository(appliance):
"""Fixture to add ansible repository"""
appliance.wait_for_embedded_ansible()
repositories = appliance.collections.ansible_repositories
try:
repository = repositories.create(
name=fauxfactory.gen_alpha(),
url=cfme_data.ansible_links.play... | RedHatQE/cfme_tests | [
69,
165,
69,
133,
1360187957
] |
def _cleanup():
if cat_item.exists:
cat_item.delete() | RedHatQE/cfme_tests | [
69,
165,
69,
133,
1360187957
] |
def __init__(self, id, params):
super(Speaker, self).__init__(id, params)
try:
self.path_to_audio = params["path_to_audio"]
self.repetitions = int(params["repetitions"])
except ValueError as ve: # if repetitions can't be parsed as int
logging.error("Speaker: Wasn't able to initialize the device, please c... | SecPi/SecPi | [
245,
40,
245,
32,
1431606302
] |
def execute(self):
if not self.corrupted:
self.play_audio()
else:
logging.error("Speaker: Wasn't able to play sound because of an initialization error") | SecPi/SecPi | [
245,
40,
245,
32,
1431606302
] |
def test_imslp_xml_to_marc():
example = """<?xml version="1.0"?>
<document docID="imslpvalsskramstadhans">
<localClass localClassName="col">imslp</localClass>
<localClass localClassName="vifa">vifamusik</localClass>
<identifier identifierEncodingSchema="originalID">valsskramstadhans</identifie... | miku/siskin | [
21,
4,
21,
1,
1403546397
] |
def find_comment_by_id(id):
return Comment.get_by_id(id) | kianby/stacosys | [
17,
1,
17,
2,
1430325952
] |
def publish_comment(comment: Comment):
comment.published = datetime.now().strftime(TIME_FORMAT)
comment.save() | kianby/stacosys | [
17,
1,
17,
2,
1430325952
] |
def find_not_notified_comments():
return Comment.select().where(Comment.notified.is_null()) | kianby/stacosys | [
17,
1,
17,
2,
1430325952
] |
def find_published_comments_by_url(url):
return Comment.select(Comment).where((Comment.url == url) & (Comment.published.is_null(False))).order_by(
+Comment.published) | kianby/stacosys | [
17,
1,
17,
2,
1430325952
] |
def load_person_by_id(person_id: int, season_id: Optional[int] = None) -> Person:
return load_person(f'p.id = {person_id}', season_id=season_id) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_person_by_discord_id(discord_id: int, season_id: Optional[int] = None) -> Person:
return load_person(f'p.discord_id = {discord_id}', season_id=season_id) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_person_by_discord_id_or_username(person: str, season_id: int = 0) -> Person:
# It would probably be better if this method did not exist but for now it's required by the API.
# The problem is that Magic Online usernames can be integers so we cannot be completely unambiguous here.
# We can make a rea... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def maybe_load_person_by_discord_id(discord_id: Optional[int]) -> Optional[Person]:
if discord_id is None:
return None
return guarantee.at_most_one(load_people(f'p.discord_id = {discord_id}')) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def maybe_load_person_by_tappedout_name(username: str) -> Optional[Person]:
return guarantee.at_most_one(load_people('p.tappedout_username = {username}'.format(username=sqlescape(username)))) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def maybe_load_person_by_mtggoldfish_name(username: str) -> Optional[Person]:
return guarantee.at_most_one(load_people('p.mtggoldfish_username = {username}'.format(username=sqlescape(username)))) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_person_statless(where: str = 'TRUE', season_id: Optional[int] = None) -> Person:
person_query = query.person_query()
sql = f"""
SELECT
p.id,
{person_query} AS name,
p.mtgo_username,
p.tappedout_username,
p.mtggoldfish_username,
... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_people(where: str = 'TRUE',
order_by: str = 'num_decks DESC, p.name',
limit: str = '',
season_id: Optional[Union[str, int]] = None) -> Sequence[Person]:
person_query = query.person_query()
season_join = query.season_join() if season_id else ''
season_... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def preaggregate() -> None:
achievements.preaggregate_achievements()
preaggregate_head_to_head() | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def set_achievements(people: List[Person], season_id: int = None) -> None:
people_by_id = {person.id: person for person in people}
sql = achievements.load_query(people_by_id, season_id)
results = [Container(r) for r in db().select(sql)]
for result in results:
people_by_id[result['id']].num_achie... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_head_to_head_count(person_id: int, where: str = 'TRUE', season_id: Optional[int] = None) -> int:
season_query = query.season_query(season_id)
sql = f'SELECT COUNT(*) FROM _head_to_head_stats AS hths INNER JOIN person AS opp ON hths.opponent_id = opp.id WHERE ({where}) AND (hths.person_id = {person_id})... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_head_to_head(person_id: int, where: str = 'TRUE', order_by: str = 'num_matches DESC, record DESC, win_percent DESC, wins DESC, opp_mtgo_username', limit: str = '', season_id: int = None) -> Sequence[Container]:
season_query = query.season_query(season_id)
sql = f"""
SELECT
hths.pers... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def is_allowed_to_retire(deck_id: Optional[int], discord_id: Optional[int]) -> bool:
if not deck_id:
return False
if not discord_id:
return True
person = maybe_load_person_by_discord_id(discord_id)
if person is None:
return True
return any(int(deck_id) == deck.id for deck in ... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_aliases() -> List[Container]:
sql = """
SELECT
pa.person_id,
pa.alias,
p.mtgo_username
FROM
person_alias AS pa
INNER JOIN
person AS p ON p.id = pa.person_id
"""
return [Container(r) for r in db().select(sql)] | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def load_notes(person_id: int = None) -> List[Container]:
where = f'subject_id = {person_id}' if person_id else 'TRUE'
sql = """
SELECT
pn.created_date,
pn.creator_id,
{creator_query} AS creator,
pn.subject_id,
{subject_query} AS subject,
... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def link_discord(mtgo_username: str, discord_id: int) -> Person:
person_id = deck.get_or_insert_person_id(mtgo_username, None, None)
p = load_person_by_id(person_id)
if p.discord_id is not None:
raise AlreadyExistsException('Player with mtgo username {mtgo_username} already has discord id {old_disco... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def remove_discord_link(discord_id: int) -> int:
sql = 'UPDATE person SET discord_id = NULL WHERE discord_id = %s'
return db().execute(sql, [discord_id]) | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def squash(p1id: int, p2id: int, col1: str, col2: str) -> None:
logger.warning('Squashing {p1id} and {p2id} on {col1} and {col2}'.format(p1id=p1id, p2id=p2id, col1=col1, col2=col2))
db().begin('squash')
new_value = db().value('SELECT {col2} FROM person WHERE id = %s'.format(col2=col2), [p2id])
db().exec... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def __init__(self, word2vec_model):
super().__init__(word2vec_model) | apmoore1/semeval | [
17,
8,
17,
4,
1487765768
] |
def __init__(self, layer_name):
self.gs_catalog_obj = Layer.objects.gs_catalog
self.layer_name = layer_name
self.err_found = False
self.err_msgs = []
self.layer_metadata = None # LayerMetadata object | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def create_layer_metadata(self, layer_name):
if layer_name is None:
self.layer_metadata = None
return
#self.layer_metadata = LayerMetadata(**dict(geonode_layer_name=layer_name))
self.layer_metadata = LayerMetadata.create_metadata_using_layer_name(layer_name) | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def add_sld_to_layer(self, formatted_sld_object):
# update layer via 2 PUT calls to the geoserver
return self.add_sld_xml_to_layer_via_puts(formatted_sld_object,\
self.layer_name)
# use direct python, but doesn't properly clear tile cache
#return self.add_sld_xml_to_lay... | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def get_set_default_style_url(self, layer_name):
"""
Given a layer name, return the REST url to set a default style
"""
if not layer_name:
return None
url_fragment = 'rest/layers/%s:%s' % (settings.DEFAULT_WORKSPACE, layer_name)
full_url = urljoin(settings.GE... | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def add_sld_xml_to_layer(self, formatted_sld_object):
"""
NOT USING, tiles were not getting refreshed properly
Keeping code around in case needed in the future
"""
if not formatted_sld_object:
return False
print 'type(formatted_sld_object)', type(formatted_sl... | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def get_style_from_name(self, style_name):
"""
Get the style object from the style name
:returns: Style object or None
"""
if not style_name:
return None
return self.gs_catalog_obj.get_style(style_name) | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def clear_alternate_style_list(self, layer_obj):
"""
Clear existing alternate styles from layer
(ask Matt how to delete a style)
"""
if not layer_obj.__class__.__name__ == 'Layer':
return False
# clear style list
layer_obj._set_alternate_styles([])
... | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def show_layer_style_list(self, layer_obj):
print('Show layer styles')
if not layer_obj.__class__.__name__ == 'Layer':
print ('not a layer', type(layer_obj))
return
sl = [layer_obj.default_style.name]
for s in layer_obj._get_alternate_styles():
sl.appe... | cga-harvard/cga-worldmap | [
96,
31,
96,
30,
1288628631
] |
def init_client(self, client, headers={}):
ssl_context = ssl.create_default_context(cafile=certifi.where())
conn = aiohttp.TCPConnector(ssl=ssl_context)
if client:
self.client_owned, self.client = False, client
else:
self.client_owned, self.client = True, aiohttp.... | syncrypt/client | [
11,
1,
11,
3,
1464178408
] |
def __init__(self, url, client=None):
super(URLReader, self).__init__()
self.url = url
self.response = None
self.init_client(client) | syncrypt/client | [
11,
1,
11,
3,
1464178408
] |
def __init__(self, url, size=None, client=None):
super(URLWriter, self).__init__()
self.url = url
self._done = False
self.response = None
self.bytes_written = 0
self.size = size
self.etag = None
self.init_client(client) | syncrypt/client | [
11,
1,
11,
3,
1464178408
] |
def __init__(self, urls, chunksize, total_size=None, client=None):
super(ChunkedURLWriter, self).__init__()
self._urls = urls
self._chunksize = chunksize
self._url_idx = 0
self.init_client(client)
self.bytes_written = 0
self.total_size = total_size
self.et... | syncrypt/client | [
11,
1,
11,
3,
1464178408
] |
def __init__(self, db_connection):
self.adba_connection = None
self.db_connection = db_connection | MediaKraken/MediaKraken_Deployment | [
10,
4,
10,
10,
1470774651
] |
def parse_geste(infile_name):
"""
Parses a GESTE file and retuns an OrderedDict with:
{"Population_name":[Freq_ref_allele_on SNP_1,Freq_ref_allele_on SNP_2,...]}
"""
infile = open(infile_name, "r")
pop_freqs = OrderedDict()
pop_starter = "[pop]="
popname = ""
for line in infile:
... | StuntsPT/pyRona | [
9,
2,
9,
2,
1478901588
] |
def colorize(cls, field, color):
"""
Color background of the field with specified color.
:param field: Field handler.
:param color: Desired color.
:return:
"""
color_name = color.name()
class_name = field.__class__.__name__
field.setStyleSheet('%s ... | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def colorize_frame(cls, field, color):
"""
Color border of the field with specified color.
:param field: Field handler.
:param color: Desired color.
:return:
"""
color_name = color.name()
class_name = field.__class__.__name__
field.setStyleSheet('%... | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def colorize_default(cls, field):
"""
Convenience method for white coloring.
:param field: Field handler.
:return:
"""
if isinstance( field, QtWidgets.QLineEdit):
cls.colorize(field, ValidationColors.white.value)
if isinstance( field, QtWidgets.QComboB... | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def colorize_red(cls, field):
"""
Convenience method for red coloring.
:param field: Field handler.
:return:
"""
if isinstance( field, QtWidgets.QLineEdit):
cls.colorize(field, ValidationColors.red.value)
if isinstance( field, QtWidgets.QComboBox):
... | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def __init__(self):
self.controls={}
"""dictionary of validated controls""" | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def add(self, key, control):
"""add control for validation"""
self.controls[key] = control | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def colorize(self, errors):
"""Colorized associated control and return if any control was colorized"""
valid = True
for key, control in self.controls.items():
if key in errors:
control.setToolTip(errors[key])
ValidationColorizer.coloriz... | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def reset_colorize(self):
"""Colorized associated control to white"""
for key, control in self.controls.items():
ValidationColorizer.colorize_default(control)
control.setToolTip("") | GeoMop/GeoMop | [
3,
1,
3,
76,
1420793228
] |
def run(self):
from Cython.Build import cythonize
if USE_ASAN:
from Cython.Compiler import Options
# make asan/valgrind's memory leak results better
Options.generate_cleanup_code = True
compiler_directives = {'language_level': 3, 'embedsignature': True}
... | piqueserver/piqueserver | [
165,
59,
165,
87,
1482889715
] |
def utcoffset(self, dt):
return ZERO | sprinkler/rainmachine-developer-resources | [
26,
38,
26,
4,
1436776616
] |