repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
prefix
stringlengths
0
8.16k
middle
stringlengths
3
512
suffix
stringlengths
0
8.17k
i32argaj/practicas-is
ligaFutbol/liga/admin.py
Python
gpl-3.0
159
0
from django.contrib
import admin from .models import Equipo, Jugadore # Register your
models here. admin.site.register(Equipo) admin.site.register(Jugadore)
albertz/music-player
mac/pyobjc-framework-Quartz/PyObjCTest/test_cgpdfdictionary.py
Python
bsd-2-clause
277
0.00722
from PyObjCTools.TestSupport import * from Quartz.CoreGraphics import * class TestCGPDFDictionary (TestCase): @expectedFailure def testIncomplete(self): self.fail("Add header tests for <CoreGraphics/CGPDFDictionary.h>") if __name__ == "
__main__": main()
sachinpro/sachinpro.github.io
tensorflow/python/ops/math_ops.py
Python
apache-2.0
58,305
0.005608
# Copyright 2015 Google Inc. All Rights Reserved. # # 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/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
inimum @@cos @@sin @@lbeta @@lgamma @@digamma @@erf @@erfc @@squared_difference @@igamma @@igammac @@zeta @@polygamma ## Matrix Math Functions TensorFlow provides several operations that you can use to add linear algebra functions on matrices to your graph. @@batch_matrix_diag @@batc
h_matrix_diag_part @@batch_matrix_band_part @@diag @@diag_part @@trace @@transpose @@matmul @@batch_matmul @@matrix_determinant @@batch_matrix_determinant @@matrix_inverse @@batch_matrix_inverse @@cholesky @@batch_cholesky @@cholesky_solve @@batch_cholesky_solve @@self_adjoint_eig @@batch_self_adjoint_eig @@matr...
JHUISI/charm
charm/schemes/pksig/pksig_ps03.py
Python
lgpl-3.0
2,946
0.001358
""" Identity Based Signature | From: "David Pointcheval and Olivier Sanders. Short Randomizable Signatures" | Published in: 2015 | Available from: https://eprint.iacr.org/2015/525.pdf * type: signature (identity-based) * setting: bilinear groups (asymmetric) :Authors: Lovesh Harchandani :Date: ...
) return pair(s1, l2) == pair(pk['g2'], s2) def randomize_sig(self, sig): s1, s2 = sig t = group.random(ZR) return s1 ** t, s2 ** t @staticmethod def product(seq):
return reduce(lambda x, y: x * y, seq) def main(): grp = PairingGroup('MNT224') ps = PS01(grp) messages = ['Hi there', 'Not there', 'Some message ................', 'Dont know .............'] (pk, sk) = ps.keygen(len(messages)) if debug: print("Keygen...") print("pk :=", ...
stannynuytkens/youtube-dl
youtube_dl/extractor/gdcvault.py
Python
unlicense
6,690
0.002392
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( HEADRequest, sanitized_Request, urlencode_postdata, ) class GDCVaultIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)?' _NETRC_MACHINE = '...
'ext': 'flv', 'title': 'An American Engine in Tokyo:/nThe collaboration of Epic Games and Sq
uare Enix/nFor THE LAST REMINANT', }, 'params': { 'skip_download': True, # Requires rtmpdump }, }, ] def _login(self, webpage_url, display_id): username, password = self._get_login_info() if username is None or password is None: ...
franksh/scheduled-speedtest
config.py
Python
mit
212
0
config = { # Interval between speedtests 'INTERVAL': 5, # Interval Unit
s can be: seconds, minutes, hours, days, ... 'INTERVAL_UNI
T': 'minutes', # Output file 'SAVE_FILE': 'results.csv', }
ConstellationApps/Forms
constellation_forms/forms.py
Python
isc
190
0
from django import for
ms from .models import Log class LogForm(forms.ModelForm): class Meta: model = Log fields = ('owner', 'submission', 'private', 'message', 'file
')
codingforentrepreneurs/ecommerce-2
src/newsletter/forms.py
Python
mit
812
0.03202
from django import forms from .models import SignUp class ContactForm(forms.Form): full_name = forms.CharField(required=False) email = forms.E
mailField() message = forms.CharField() class SignUpForm(forms.ModelForm): class Meta: model = SignUp fields = ['full_name', 'email'] ### exclude = ['full_name'] def clean_email(self): email = self.cleaned_data.get('email') email_base, provider = email.split("@") domain, extension = provider.split('....
a valid .EDU email address") return email def clean_full_name(self): full_name = self.cleaned_data.get('full_name') #write validation code. return full_name
havard024/prego
sales/models.py
Python
mit
17,973
0.000723
# encoding: utf-8 # Copyright 2011 Tree.io Limited # This file is part of Treeio. # License www.tree.io/license """ Sales module objects. """ from django.core.urlresolvers import reverse from django.db import models from treeio.core.models import Object, User, ModuleSetting from treeio.identities.models import Conta...
ule', '*user') def __unicode__(self): return unicode(self.name) def get_absolute_url(self): "Returns absolute URL" try: return reverse('sales_product_view', args=[self.id]) except: return "" class Meta: "Product" ordering = ['co
de'] class SaleSource(Object): "Source of Sale e.g. Search Engine" name = models.CharField(max_length=512) active = models.BooleanField(default=False) details = models.TextField(blank=True, null=True) searchable = False def __unicode__(self): return unicode(self.name) def get_ab...
ttreeagency/PootleTypo3Org
pootle/apps/pootle_app/models/__init__.py
Python
gpl-2.0
1,034
0
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008 Zuza Software Foundation # # This file is part of translate. # # translate is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of t...
t will be useful, # bu
t WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with translate; if not, write to the Free Software # Foundation, Inc.,...
feilchenfeldt/enrichme
pandas_util.py
Python
mit
15,740
0.009593
import numpy as np import pandas as pd """ Specifications (So far, only implemented for the single index part below): feature_df ... Data Frame of intervals along the genome, equivalent of a bed file, but 1-indexed index: (chrom, start) columns required: end optional: na...
ata series and gets a similar series with one entry per pair data-point gene (i.e., there can be 0,1 or more entries per data point) """ all_features = [] if not feature_df.index.is_monotonic: feature_df = feature_df.sort_index()
tot_hit_df = pd.DataFrame() for chrom in peak_s.index.droplevel(1).unique(): loc_feature_df = feature_df.ix[chrom] #loc_feature_df = loc_feature_df.append(pd.DataFrame(np.nan,index=[np.inf],columns=loc_feature_df.columns)) #print loc_feature_df.index-max_dist, peak_s.ix[chrom].index.valu...
Pradeek/django-snoopy
snoopy/__init__.py
Python
mit
48
0
default_app_config = 's
noopy.ap
ps.SnoopyConfig'
morganzhh/sysrepo
swig/python3/tests/SchemasManagementTest.py
Python
apache-2.0
7,156
0.005729
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>" __copyright__ = "Copyright 2016, Cisco Systems, Inc." __license__ = "Apache 2.0" # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compl...
.process.wait() self.tc.assertEqual(rc, 0) def uninsta
llModuleFailStep(self, module_name, log_level = sr.SR_LL_INF): self.process = subprocess.Popen([self.sysrepoctl, "--uninstall", "--module={0}".format(module_name), "-L {0}".format(log_level)]) rc = self.process.wait() self.tc.assertNotEquals(rc, 0) def uninstallModuleStep(self, module_name,...
EuroPython/epcon
conference/migrations/0028_changes_to_conferencetag_and_conferencetaggeditem.py
Python
bsd-2-clause
1,180
0.002542
# Generated by Django 2.2.19 on 2021-04-15 10:46 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('conference', '0027_auto_20201204_1539'), ] operations = [ migrations.AlterField( model_name='c...
=100, unique=True, verbose_name='name'), ), migrations.AlterField( model_name='conferencetag', name='slug', field=models.SlugField(max_length=100, unique=True, verbose_name='slug'), ), migrations.AlterField( model_name='conferencetaggeditem...
name='content_type', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='conference_conferencetaggeditem_tagged_items', to='contenttypes.ContentType', verbose_name='content type'), ), migrations.AlterField( model_name='conferencetaggeditem', ...
jimgoo/zipline-fork
zipline/errors.py
Python
apache-2.0
12,167
0
# # Copyright 2013 Quantopian, 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
""" Raised when AssetMetaData.map_identifier_index_to_sids() is calle
d on an index of invalid objects. """ msg = """ AssetFinder can not map an index with values of type {obj}. Asset indices of DataFrames or Panels must be integer sids, string symbols, or Asset objects. """.strip() class SidAssignmentError(ZiplineError): """ Raised when an AssetFinder tries to buil...
wavenator/tasker
tasker/executor/serial.py
Python
apache-2.0
2,868
0.000349
import traceback import os import signal from .import _executor from .. import devices from .. import worker class SerialExecutor( _executor.Executor, ): def sigabrt_handler( self, signal_num, frame, ): try: self.tasks_to_finish.remove(self.current_task) ...
kwargs=self.current_task['kwargs'], exception=exception, exception_traceback=exception_traceback, ) finally: self.end_working() os.kill(os.getpid(), signal.SIGTERM)
def sigint_handler( self, signal_num, frame, ): raise worker.WorkerSoftTimedout() def begin_working( self, ): self.killer = devices.killer.KillerClient.create_a_killer( pid_to_kill=os.getpid(), sleep_interval=0.1, soft_time...
ymktw/SDNProbe
pymodule/rule.py
Python
apache-2.0
3,687
0.005424
import cPickle def dump_rules(filename, rules): with open(filename, 'w') as f: cPickle.dump(rules, f, cPickle.HIGHEST_PROTOCOL) def load_rules(filename): with open(filename, 'r') as f: rules = cPickle.load(f) return rules class Rule(): APPLY_ACTION = 0 CLEAR_ACTION = 1 WRITE_A...
h_index = None self.is_incremental = False
self.is_sendback = False self.is_deleted = False self.is_modified_input = False self.is_modified_output = False def to_header_space(self, prefix): ip = prefix.split('/')[0] match_length = 32 if len(prefix.split('/')) < 2 else int(prefix.split('/')[1] ) hs = ''.join([...
wtrevino/django-listings
listings/syndication/migrations/0007_auto__del_field_feed_feed_type.py
Python
mit
1,955
0.007673
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Feed.feed_type' db.delete_column('syndication_feed', 'feed_type_id') def backwards(s...
object_name': 'Feed'}, 'content_type': ('django.db.models.fields.CharField', [], {'default': "'application/xml'", 'max_length': '100'}), 'feed_url': ('django.db.models.fiel
ds.CharField', [], {'unique': 'True', 'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), 'site': ('django.db.models.fields.related.ManyToManyField...
antoinecarme/pyaf
tests/artificial/transf_Anscombe/trend_LinearTrend/cycle_0/ar_12/test_artificial_128_Anscombe_LinearTrend_0_12_20.py
Python
bsd-3-clause
266
0.086466
import pyaf.Bench.TS_dat
asets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 128 ,
FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12);
sonata-nfv/son-qual
qual-stress-mano-framework/son-mano-base/test/test_messaging.py
Python
apache-2.0
10,419
0.003455
""" Copyright (c) 2015 SONATA-NFV ALL RIGHTS RESERVED. 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/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
with async messaging system. Waits until a the specified message can be found in the buffer. :
param timeout: seconds to wait :return: """ self.waiting = 0 while message not in self._message_buffer[buffer] and self.waiting < timeout: time.sleep(0.01) self.waiting += 0.01 if not self.waiting < timeout: raise Exception( "Me...
anhstudios/swganh
data/scripts/templates/object/tangible/furniture/decorative/shared_radio.py
Python
mit
440
0.047727
#
### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/furniture/decorative/shared_radio.iff" result.attribute_template_id ...
lt
zentropi/python-uzentropi
examples/01-blink-led/blink_led.py
Python
apache-2.0
287
0
# coding=ut
f-8 from uzentropi import Agent, on_timer, asyncio from machine import Pin led = Pin(13, Pin.OUT) class BlinkAgent(Agent): @on_timer(3) async def blink_led(self): led.on() await asyncio.sleep(1) led.off() agent = BlinkAgent() agent.r
un()
sergiopasra/megaradrp
megaradrp/recipes/calibration/bias.py
Python
gpl-3.0
2,560
0.000781
# # Copyright 2014-2019 Universidad Complutense de Madrid # # This file is part of Megara DRP # # SPDX-License-Identifier: GPL-3.0+ # License-Filename: LICENSE.txt # from numina.core import Result, Parameter from numina.array import combine from megaradrp.processing.combine import basic_processing_with_combination fr...
quirement class BiasRecipe(MegaraBaseRecipe): """Process BIAS images and cre
ate a MASTER_BIAS product. This recipe process a set of bias images obtained in **Bias Image** mode and returns a combined product image, trimmed to the physical size of the detector. Notes ----- Images are corrected from overscan and trimmed to the physical size of the detector. Then, the...
spookylukey/banter
setup.py
Python
mit
1,171
0
from setuptools import setup setup( name='banter', v
ersion='0.2.0', author='Mark Drago', author_email='markdrago@gmail.com', url='http://github.com/markdrago/banter', download_url='http://pypi.python.org/pypi/banter', description='Create crucible code reviews from the command line', license='MIT', packages=['banter'], entry_points={ ...
n' ] }, install_requires=['requests>=1.0'], tests_require=['mock'], test_suite='test', classifiers=[ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'D...
bsipocz/glue
glue/core/parse.py
Python
bsd-3-clause
6,344
0.001103
import re from .data import ComponentID from .subset import Subset, SubsetState from .component_link import ComponentLink TAG_RE = re.compile('\{\s*(?P<tag>\S+)\s*\}') __all__ = ['ParsedCommand', 'ParsedSubsetState'] def _ensure_only_component_references(cmd, references): """ Search through tag references in a...
------ >>> cmd = '{g} - {r} + {g}' >>> references = {'g' : g_object, 'r' : r_object, 'i' : i_object} >>> _reference_list(cmd, references) [g_object, r_object] Raises ------ KeyError: if tags in the command aren't in the reference mapping """ try: return list(set(references[m...
se KeyError("Tags from command not in reference mapping") def _dereference(cmd, references): """ Dereference references in the template command, to refer to objects in the reference mapping Parameters ---------- cmd : Command string references : mapping from template tags to objects Retu...
TomBaxter/osf.io
osf/models/nodelog.py
Python
apache-2.0
7,049
0.002695
from include import IncludeManager from django.apps import apps from django.db import models from django.utils import timezone from osf.models.base import BaseModel, ObjectIDMixin from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField from osf.utils.fields import NonNaiveDateTimeField from website.util ...
NODE_LINK_REMOVED, WIKI_UPDATED, WIKI_DELETED, WIKI_RENAMED, MADE_WIKI_PUBLIC, MADE_WIKI_PRIVATE, CONTRIB_ADDED, CONTRIB_REMOVED, CONTRIB_REORDERED, PERMISSIONS_UPDATED, MADE_PRIVATE, MADE_PUBLIC, TAG_ADDED, TAG_R
EMOVED, EDITED_TITLE, EDITED_DESCRIPTION, UPDATED_FIELDS, FILE_MOVED, FILE_COPIED, FOLDER_CREATED, FILE_ADDED, FILE_UPDATED, FILE_REMOVED, FILE_RESTORED, ADDON_ADDED, ADDON_REMOVED, COMMENT_ADDED, COMMENT_REMOVED, COMMENT_UPDATED, COMMENT_RESTORED, MADE_CO...
sixuanwang/SAMSaaS
wirecloud-develop/src/wirecloud/oauth2provider/models.py
Python
gpl-2.0
2,919
0.002399
# -*- coding: utf-8 -*- # Copyright (c) 2013-2014 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either v...
eld(_('Creation timestamp'), max_length=40, blank=False) expires_in = models.CharField(_('Expires in'), max_length=40, blan
k=True) def __unicode__(self): return unicode(self.token) @receiver(post_save, sender=Application) def invalidate_tokens_on_change(sender, instance, created, raw, **kwargs): if created is False: instance.token_set.all().update(creation_timestamp='0')
cvandeplas/plaso
plaso/parsers/winreg_plugins/userassist_test.py
Python
apache-2.0
3,967
0.00126
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2012 The Plaso Project Authors. # Please see the AUTHORS file for details on individual authors. # # 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 L...
ct, regvalue_identifier, expected_value) expected_msg = u'[{0:s}\\Count] {1:s}: {2:s}'.format( key_path, regvalue_identifier, expected_value) # The short message contains the first 76 characters of the key path. expected_msg_short = u'[{0:s}...'.format(key_path[:76]) self._TestGetMessageSt...
s 7 Registry file.""" test_file = self._GetTestFilePath(['NTUSER-WIN7.DAT']) key_path = ( u'\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist' u'\\{CEBFF5CD-ACE2-4F4F-9178-9926F41749EA}') winreg_key = self._GetKeyFromFile(test_file, key_path) event_queue_consumer = sel...
Buchhold/QLever
misc/compare_shuffled.py
Python
apache-2.0
1,155
0.006926
import sys q_to_time = {} i = 0 for line in open(sys.argv[1]): try: line = line.strip() cols = line.split('\t') q_to_time[cols[0]] = [(int(cols[2].split(' ')[0]), i)] i += 1 except ValueError: continue i = 0 for line in open(sys.argv[2]): try: line = line.s...
ime[cols[0]].append((int(cols[2].split(' ')[0]), i)) i += 1 except KeyError: continue except ValueError: continue for k,v in q_to_time.items(): if v[0][0] < v[1][0]: smaller = float(v[0][0]) larger = float(v[1][0])
else: smaller = float(v[1][0]) larger = float(v[0][0]) try: if (larger / smaller > 2): print('SIGNIFICANT DIFFERENCE: ' + k + ': (' + str(v[0][0]) + ', ' + str(v[0][1]) + ') vs (' + str(v[1][0]) + ', ' + str(v[1][1]) ...
drxos/kuiqblog
config/settings/local.py
Python
bsd-3-clause
2,106
0.001899
# -*- coding: utf-8 -*- ''' Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default...
--- # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # Note: This key only used for development and testing. SECRET_KEY = env("DJANGO_SECRET_KEY", default='6eucn@^czyx0
n0d15*9-f3_o%d4ba4w2_i1udeaywj)t7cb6fv') # Mail settings # ------------------------------------------------------------------------------ EMAIL_HOST = 'localhost' EMAIL_PORT = 1025 EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend') # CACHING # ---...
hardworkingcoder/dw_experiments
models.py
Python
mit
1,081
0.00555
from app import db import datetime from geoalchemy2 import Geometry from sqlalchemy.dialects import postgresq
l from sqlalchemy.dialects.postgresql import UUID from sqlalchemy import Column import sqlalchemy from slugify import slugify from flask.ext.
login import UserMixin class User(UserMixin, db.Model): __tablename__ = "users" id = Column(UUID(as_uuid=True), server_default=sqlalchemy.text("uuid_generate_v4()"), primary_key=True) session_token = Column(UUID(as_uuid=True), server_default=sqlalchemy.text("uuid_generate_v4()"), unique=T...
OaklandPeters/optional
optional/test_optional.py
Python
mit
3,279
0.009759
from __future__ import absolute_import import unittest import types if __name__ == "__main__": from optional import * #imports from package, not sub-module else: from .optional import * from .nulltype import * class TestNullType(unittest.TestCase): def test_supertype(self): self.assert_(isinst...
self.assert_(isinstance(NotPassed, NotPassedType)) self.assert_(isinstance(NotPassed, NullType)) self.assert_(issubclass(type(None), NullType)) self.assert_(issubclass(types
.NoneType, NullType)) self.assert_(issubclass(Optional, NullType)) self.assert_(issubclass(NotPassedType, NullType)) class TestOptional(unittest.TestCase): def setUp(self): def myfunc(first, second=None, third=Optional(5), fourth=Optional(execute=list)): #Equivalent: second = ...
GovReady/govready-q
controls/migrations/0046_element_tags.py
Python
gpl-3.0
459
0.002179
# Generated by Django 3.1.7 on 2021-02-28 19:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('siteapp', '0041_project
_tags'), ('controls', '0045_auto_20210228_1431'), ]
operations = [ migrations.AddField( model_name='element', name='tags', field=models.ManyToManyField(related_name='element', to='siteapp.Tag'), ), ]
msunardi/PTVS
Python/Tests/TestData/Grammar/Ellipsis.py
Python
apache-2.0
22
0
fob(...)
1 + ...
pirate/bitcoin-trader
secrets_default.py
Python
mit
252
0
# 1. Create a new API
key: https://exchange.gemini.com/settings/api # 2. Enter API key & secret below # 3. Optionally add any settings here that you want to override in settings.py API_KEY = 'gemini_API_KEY_here' API_SECRET = 'gemini_API_SECRET_h
ere'
RulersOfAsgard/ALAMO-worker
alamo_worker/alerter/tests/test_cassandra_backend.py
Python
apache-2.0
4,182
0
# -*- coding: utf-8 -*- import unittest from datetime import datetime from unittest.mock import call from uuid import uuid4, UUID from mock import patch, MagicMock from alamo_worker.alerter.backend.cassandra import ( CassandraDriver, SELECT_QUERY, INSERT_QUERY, INSERT_SERVICE_QUERY, AsyncCassandraDriver ) fro...
er._connect() self.driver._session.prepare.assert_has_calls( expected_calls, any_order=True ) def test_get_result_method(self): self.driver.get_result(self.check_uuid, self.trigger_uuid, 10) self.driver._connect() self.driver._session.execute.assert_called_once_w...
f.driver._save_query_stmt, (UUID(self.check_uuid), UUID(self.trigger_uuid), 10), execution_profile='normal' ) def test_save_result_method(self): _now = datetime.now() self.driver._connect() self.driver.save_result( self.check_uuid, self.trigger, _...
andyzsf/django
django/dispatch/dispatcher.py
Python
bsd-3-clause
11,964
0.00117
import sys import threading import weakref from django.utils.six.moves import xrange if sys.version_info < (3, 4): from .weakref_backports import WeakMethod else: from weakref import WeakMethod def _make_id(target): if hasattr(target, '__func__'): return (id(target.__self__), id(target.__func__)...
response), ... ]. """ responses = [] if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS: return responses for receiver in self._live_receivers(sender): response = receiver(signal=self, sender=sender, **named) responses.a...
n responses def send_robust(self, sender, **named): """ Send signal from sender to all connected receivers catching errors. Arguments: sender The sender of the signal. Can be any python object (normally one registered with a connect if you actua...
labcodes/django
tests/generic_views/test_dates.py
Python
bsd-3-clause
34,915
0.003179
import datetime from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, override_settings, skipUnlessDBFeature from django.test.utils import requires_tz_support from django.utils import timezone from .models import Artist, Author, Book, BookSigning, Page def _make_books(n, base_dat...
ed descending in index""" _make_books(5, base_date=datetime.date(2011, 12, 25)) res = self.client.get('/dates/books/') self.assertEqual(res.status_code, 200) self.assertEqual(list(res.context['date_list']), list(reversed(sorted(res.context['date_list'])))) def test_archive_view_cust...
te=datetime.date(2007, 5, 1)) res = self.client.get('/dates/books/sortedbyname/') self.assertEqual(res.status_code, 200) self.assertEqual(list(res.context['date_list']), list(Book.objects.dates('pubdate', 'year', 'DESC'))) self.assertEqual(list(res.context['latest']), list(Book.objects.o...
tuxfux-hlp-notes/python-batches
archieves/batch-66/05.2-market.py
Python
gpl-3.0
1,081
0.004625
#!/usr/bin/python # pass: block filler - it does nothing. # logical operators - and/or print "welcome to the market" food_type = raw_input("please enter the item- meat/fish/chicken/
veg: ") if food_type == 'meat': pass elif food_type == 'fish': print "welcome to the fish market." fish_type = raw_input("please enter your fish type - solomon/rohu/tofu/fillets:") if fish_type == 'solomon': print "we have your fish {}".f
ormat(fish_type) print "how much quantity of fish {} you need".format(fish_type) elif fish_type == 'tofu' or fish_type == 'TOFU': print "we have your fish {}".format(fish_type) print "how much quantity of fish {} you need".format(fish_type) elif fish_type == 'rohu': print "we h...
ThiagoGarciaAlves/intellij-community
python/testData/inspections/PyUnreachableCodeInspection/Unreachable.py
Python
apache-2.0
2,105
0.025178
def f(): return <warning descr="This code is unreachable">a = 1</warning> def f(): if 0: return a = 1 # pass def f(): raise Exception() <warning descr="This code is unreachable">a = 1</warning> def f(): for x in []: break <warning descr="This code is unreachable...
e): def test_something(self): with self.assertRaises(): raise Foo foo() # pass # PY-3532 def f(): import sys f = lambda: sys.exit() #pass foo = 3 return f, foo # PY-3886 def f(): from unittest import TestCase class C(TestCase): def test_1(self): ...
-4149 def f(): try: pass finally: #pass pass # PY-4208 def f(g): try: raise ValueError finally: g() <warning descr="This code is unreachable">g()</warning> # PY-5266 def f(g): x = 0 try: x = g() except Exception: try: x = 2 ...
Nixonite/Chess-RPG
main.py
Python
gpl-2.0
513
0.005848
from controller import Con
troller import time import json from unichess import UniChess from unicode import * import locale from color import color locale.setlocale(locale.LC_ALL,"") with open("story.json") as story_file: story = json.load(story_file) glb = Controller() Board = UniChess() Board.setup_board() for line
in story['Introduction']: glb.printc(uni_chess_pieces['wN']+' '+line) glb.print_str(3, 1, uni_chess_pieces['wN']+" This is a fucking chess board") glb.print_rows(Board.board) glb.quit()
versae/qbe
setup.py
Python
mit
1,374
0.000728
import codecs import re from os import path from setuptools import setup, find_packages def read(*parts): file_path = path.join(path.dirname(__file__), *parts) return codecs.open(file_path).
read() def find_version(*parts): version_file = read(*parts) version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return version_match.group(1) raise RuntimeError("Unable to find version string.") setup( name=...
'__init__.py'), author='Javier de la Rosa', author_email='versae@gmail.com', url='http://versae.github.com/qbe/', description='Django admin tool for custom reports', long_description=read('README.rst'), license='MIT', keywords='qbe django admin reports query sql', classifiers=[ '...
rtfd/readthedocs.org
readthedocs/redirects/migrations/0002_add_missing_model_change_migrations.py
Python
mit
963
0.002077
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-31 11:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('redirects', '0001_initial'), ] operations = [ migrations.AlterField( model_name='redirect', ...
),
migrations.AlterField( model_name='redirect', name='to_url', field=models.CharField(blank=True, db_index=True, help_text='Absolute or relative URL. Example: <b>/tutorial/install.html</b>', max_length=255, verbose_name='To URL'), ), ]
yangtsecxf/a-fund
process/process_csv.py
Python
gpl-2.0
5,973
0.027115
#coding=utf-8 #!/usr/bin/env python # A small script to analyze all the funds data # Author :xin xin from "微信公众号:菜鸟学python" import pandas as pd import numpy as np file='fund3.1.csv' df=pd.read_csv(file) print("head-------------------------------------------------------------------------") print(len(df)) print(df.hea...
].sum(axis=1).values[0] print(fund_id,fund_total_rate) # 5 c with fund_name #df_no_NA = df_no_NA.sort_values(by=['fund_id'], ascending=True).head() #a = pd.DataFrame(df_no_NA, index=mix_5c) #print(a) #print(Index) #a = df_no_NA[(df_no_NA.BoolCol==3)
&(df_no_NA.attr==22)].mix_5c.tolist() #print(a) #print(df_no_NA.head()) #print() #print(df_no_NA.head(['fund_id'], mix_5c)) #for x in mix_5c: # print(x) # print(df_no_NA.at[x, "fund_id"]) print("output the complete info of mix_5c------------------------------------------") #print(list(mix_5c)) #print(df_no_NA[...
rem2016/whoTouchMyWiFi
analysis/mac_producer.py
Python
mit
3,200
0.000938
import os import json import time import threading import requests class MAC_Map: def __init__(self): self.lock = threading.Lock() self.mac_producer = {} self._read_mac_producer_table() @staticmethod def _load_broken_json(self, text): if text[0] != '{': raise Va...
) except requests.ConnectionError as e: print(e) except requests.ConnectTimeout as e: print(e) print("Please Check the network condition") try:
response = json.loads(r.text) break except json.JSONDecodeError as e: try: response = self._load_broken_json(r.text) break except ValueError: return 'Null' if response['success...
google/tf-quant-finance
tf_quant_finance/datetime/holiday_calendar_test.py
Python
apache-2.0
11,852
0.004809
# Lint as: python3 # Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
tes.BusinessDayConvention.PRECEDING, "data_key": "preceding" }, { "testcase_name": "modified_preceding", "rolling_enum_value": dates.BusinessDayConvention.MODIFIED_PRECEDING, "data_key": "modified_preceding" } @para
meterized.named_parameters({ "testcase_name": "as_tuples", "holidays": [(2020, 1, 1), (2020, 12, 25), (2021, 1, 1)], }, { "testcase_name": "as_datetimes", "holidays": [datetime.date(2020, 1, 1), datetime.date(2020, 12, 25), datetime.date(2021, 1, 1)], },...
vladan-m/ggrc-core
src/ggrc_workflows/models/cycle_task_group_object.py
Python
apache-2.0
2,917
0.009599
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com from ggrc import db from ggrc.models.mixins import ( Base, Titled, Described,...
def object(self,
value): self.object_id = value.id if value is not None else None self.object_type = value.__class__.__name__ if value is not None \ else None return setattr(self, self.object_attr, value) def _display_name(self): return \ self.object.display_name + '<->' + self.cycle_task_group.displa...
pvreman/cobbler
cobbler/modules/manage_import_vmware.py
Python
gpl-2.0
36,318
0.009307
""" This is some of the code behind 'cobbler sync'. Copyright 2006-2009, Red Hat, Inc Michael DeHaan <mdehaan@redhat.com> John Eckersberg <jeckersb@redhat.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Fo...
files = config.profiles() self.systems
= config.systems() self.settings = config.settings() self.repos = config.repos() self.templar = templar.Templar(config) # required function for import modules def what(self): return "import/vmware" # required function for import modules def chec...
iulian787/spack
var/spack/repos/builtin/packages/hashcat/package.py
Python
lgpl-2.1
1,313
0.00457
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Hashcat(MakefilePackage): """hashcat is the world's fastest and most advanced password rec...
= "https://github.com/hashcat/ha
shcat/archive/v6.1.1.tar.gz" version('6.1.1', sha256='39c140bbb3c0bdb1564bfa9b9a1cff49115a42f4c9c19e9b066b617aea309f80') version('6.1.0', sha256='916f92434e3b36a126be1d1247a95cd3b32b4d814604960a2ca325d4cc0542d1') version('6.0.0', sha256='e8e70f2a5a608a4e224ccf847ad2b8e4d68286900296afe00eb514d8c9ec1285') ...
SoftlySplinter/sem6120-assign2
tsp/ga/selection/tournament.py
Python
unlicense
609
0.009852
import random from tsp.ga.selection import Selection
Scheme class TournamentSelection(SelectionScheme): """ Runs tournaments between indivduals until a sufficient number are obtained. """ de
f __init__(self): self.tournament_size = 5 def select(self, population): selected = [] while len(selected) < len(population): selected.append(self.run_tournament(random.sample(population, self.tournament_size))) return selected def run...
Aendra/django_vgv
management/commands/subcommands/base.py
Python
bsd-3-clause
3,253
0.003381
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import os from collections import OrderedDict from django.core.management.base import BaseCommand, CommandParser from django.core.management.color import no_style def add_builtin_arguments(parser): parser.add_argume...
if options.get('stdout'): command.stdout._o
ut = options.get('stdout') if options.get('stderr'): command.stderr._out = options.get('stderr') command.handle(*args, **options) else: self.print_help('manage.py', 'cms')
NewGlobalStrategy/NetDecisionMaking
fts/test_addaction.py
Python
mit
2,203
0.01498
# These tests are all based on the tutorial at http://killer-web-development.com/ # if registration is successful this may work but lets # try and get user logged in first from functional_tests import FunctionalTest, ROOT, USERS import time from selenium.webdriver.support.ui import WebDriverWait class AddBasicAction...
end_keys(USERS['USER2']) password = self.browser.find_element_by_name("password") password.send_keys(USERS['PASSWORD2']) submit_button = self.browser.find_element_by_css_selector("#submit_record__row input") submit_button.click() time.sleep(1) se...
tion' get_browser=self.browser.get(self.url) time.sleep(2) def test_can_view_submit_page(self): response_code = self.get_response_code(self.url) self.assertEqual(response_code, 200) def test_has_right_title(self): title = self.browser.title ...
petermalcolm/osf.io
website/app.py
Python
apache-2.0
5,502
0.001272
# -*- coding: utf-8 -*- import os import importlib from collections import OrderedDict import json from modularodm import storage from werkzeug.contrib.fixers import ProxyFix import framework from framework.flask import app, add_handlers from framework.logging import logger from framework.mongo import set_up_storage ...
handlers) add_handlers(app, transaction_handlers.handlers) # Attach handler for checking view-only link keys. # NOTE: This must be attached AFTER the TokuMX to avoid calling # a commitTransaction (in toku's after_request handler) when no transaction # has been
created add_handlers(app, {'before_request': framework.sessions.prepare_private_key}) # framework.session's before_request handler must go after # prepare_private_key, else view-only links won't work add_handlers(app, {'before_request': framework.sessions.before_request, 'after_r...
daimon99/santicms
src/manage.py
Python
mit
251
0
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "santicms.settings")
from django.core.management import execute_fro
m_command_line execute_from_command_line(sys.argv)
sqlalchemy/sqlalchemy
test/ext/mypy/plugin_files/composite_props.py
Python
mit
1,391
0
from typing import Any from typing import Tuple from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import composite Base = declarative_base() class Point: def __init__(self, x: int, y: int): ...
> Tuple[int, int]: return self.x, self.y def __repr__(self) -> str: return "Point(x=%r, y
=%r)" % (self.x, self.y) def __eq__(self, other: Any) -> bool: return ( isinstance(other, Point) and other.x == self.x and other.y == self.y ) def __ne__(self, other: Any) -> bool: return not self.__eq__(other) class Vertex(Base): __tablename__...
tdyas/pants
tests/python/pants_test/backend/native/tasks/test_link_shared_libraries.py
Python
apache-2.0
1,358
0.002209
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from pants.backend.native.targets.native_artifact import NativeArtifact from pants.backend.native.tasks.cpp_compile import CppCompile from pants.backend.native.tasks.link_shared...
Mixin): @classmethod def task_type(cls): return LinkSharedLibraries def test_caching(sel
f): cpp = self.create_simple_cpp_library(ctypes_native_library=NativeArtifact(lib_name="test")) cpp_compile_task_type = self.synthesize_task_subtype(CppCompile, "cpp_compile_scope") context = self.prepare_context_for_compile( target_roots=[cpp], for_task_types=[cpp_compi...
helloTC/LearnPython
framework_attempt/MRFreeframe.py
Python
mit
4,576
0.007867
import nibabel as nib from nibabel import freesurfer import numpy as np class Region(object): _defaults = ['data', '_name', '_layer', 'hemi', 'header', 'space', 'shape', 'img'] def __init__(self, source): self._source = source for key in self._defaults: if key not in self.__di...
': self.shape = (163842,1) elif space_name == 'fsaverage5': self.shape = (10242,1) else: self.shape = None if 'data' in self.__dict__: self.shape = self.data.shape
self.space = None def get_data(self): self.img = nib.load(self._source) self.data = self.img.get_data() self.set_hemi() self.header = self.img.get_header() def get_shape(self): if self.data is not None: self.shape = self.data.shape def set_hemi(self, he...
danking/hail
hail/python/hailtop/auth/auth.py
Python
mit
3,187
0.002824
import os import aiohttp from hailtop.config import get_deploy_config from hailtop.utils import async_to_blocking, request_retry_transient_errors from hailtop.tls import get_context_specific_ssl_client_session from .tokens import get_tokens async def async_get_userinfo(*, deploy_config=None, session_id=None, client_...
nfig=deploy_config)) def namespace_auth_headers(deploy_config, ns, authorize_target=True, *, token_file=None): tokens = get_tokens(token_file) headers = {} if authorize_target: headers['Authorization'] = f'Be
arer {tokens.namespace_token_or_error(ns)}' if deploy_config.location() == 'external' and ns != 'default': headers['X-Hail-Internal-Authorization'] = f'Bearer {tokens.namespace_token_or_error("default")}' return headers def service_auth_headers(deploy_config, service, authorize_target=True, *, token_f...
rcosnita/fantastico
fantastico/contrib/oauth2_idp/models/validators/user_validator.py
Python
mit
4,914
0.005088
''' Copyright 2013 Cosnita Radu Viorel 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 limitation the rights to use, copy, modify, merge, publish, distribute...
e(self, res
ource, request): '''This method suppress user password from being sent to GET calls.''' resource.password = None def _validate_username(self, resource): '''This method validates the username from submitted resource.''' if not resource.username or len(resource.username.strip()) == ...
janusnic/youtube-dl-GUI
youtube_dl/postprocessor/__init__.py
Python
mit
760
0
from __future__ import unicode_literals from .atomicparsley import AtomicParsleyPP from .ffmpeg import ( FFmpegPostProcessor, FFmpegAudioFixPP, FFmpegEmbedSubtitlePP, FFmpegExtractAudioPP, FFmpegFixupStretchedPP, FFmpegMergerPP, FFmpegMetadataPP, FFmpegVideoConvertorPP
, ) from .xattrpp import XAttrMetadataPP from .execafterdownload import ExecAfterDownloadPP def get_postprocessor(key): return globals()[key +
'PP'] __all__ = [ 'AtomicParsleyPP', 'ExecAfterDownloadPP', 'FFmpegAudioFixPP', 'FFmpegEmbedSubtitlePP', 'FFmpegExtractAudioPP', 'FFmpegFixupStretchedPP', 'FFmpegMergerPP', 'FFmpegMetadataPP', 'FFmpegPostProcessor', 'FFmpegVideoConvertorPP', 'XAttrMetadataPP', ]
JamesLinEngineer/RKMC
addons/plugin.video.salts/scrapers/snagfilms_scraper.py
Python
gpl-2.0
6,712
0.006257
""" SALTS XBMC Addon Copyright (C) 2014 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. T...
erm': title, 'type': SEARCH_TYPES[v
ideo_type], 'limit': 500} html = self._http_get(search_url, params=params, headers=headers, auth=False, cache_limit=2) js_data = scraper_utils.parse_json(html, search_url) if 'results' in js_data: for result in js_data['results']: match_year = str(result.get('year', '...
Aloomaio/googleads-python-lib
examples/ad_manager/v201808/creative_service/create_creatives.py
Python
apache-2.0
2,868
0.00523
#!/usr/bin/env python # # Copyright 2015 Google Inc. All Rights Reserved. # # 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/licenses/LICENSE-2.0 # # Unless requir...
50' } # Create image asset. creative_asset = { 'xsi_type': 'CreativeAsset', 'fileName': 'image.jpg', 'assetByteArray': image_data, 'size': size } # Create an image creative. c
reative = { 'xsi_type': 'ImageCreative', 'name': 'Image Creative #%s' % uuid.uuid4(), 'advertiserId': advertiser_id, 'destinationUrl': 'http://google.com', 'size': size, 'primaryImageAsset': creative_asset } creatives.append(creative) # Add creatives. creati...
reality3d/molefusion
modules/ExitMenu.py
Python
mit
1,885
0.058355
import pygame from pygame.locals import * from Constants import Constants from FadeTransition import FadeTransition from Menu import Menu from GW_Label import GW_Label from GuiWidgetManager import GuiWidgetManager from xml.sax import make_parser from Localization import Localization import os class ExitMenu(Menu...
f.parser.parse(open("languages/ExitMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24)) self.game_by = GW_Label(self.curHandler.getText("game"),(0.5,0.3),(240,255,220)) self.music_by = GW_Label(self.curHandler.getText("music"),(0.5,0.5),(240,255,...
et_man = GuiWidgetManager([self.title,self.game_by,self.music_by,self.web]) self.time_speed=pygame.time.Clock() self.exit=False self.on_enter() def on_enter(self): pygame.event.clear() self.screen.blit(self.background, (0, 0)) pygame.display.flip() self.exit=False self.widget_man.set_draw(True) ...
gnumdk/lollypop
lollypop/touch_helper.py
Python
gpl-3.0
3,548
0
# Copyright (c) 2014-2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later vers...
Lp().add_action(new_
action) Lp().set_accels_for_action("app.%s" % action, [shortcut]) def set_short_func(self, short_func, *args): """ @param short func as function @param short args """ self.__short_func = short_func self.__short_args = args def set_long_func(s...
danmt/NEO
Codigo_Fuente/etapa3/entrega/Instrucciones/Condicional.py
Python
gpl-3.0
910
0.026374
from Estructura import espaceado from Instrucciones.Arbol_Sintactico_Abstracto import Arbol_Sintactico_Abstracto class Condicional: def __init__(self,expresion,if_lista_controladores,else_lista_controladores=None): self.expresion = expresion self.if_lista_controladores = if_lista_controladores self.else_lista_c...
acion)) print tabulacion + " - Exito: " instr_list_izq = Arbol_Sintactico_Abstracto(self.if_lista_controladores) instr_list_izq.imprimir(" " + e
spaceado(tabulacion)) if (self.else_lista_controladores): print " - Fracaso: " instr_list_der = Arbol_Sintactico_Abstracto(self.else_lista_controladores) instr_list_der.imprimir(" " + espaceado(tabulacion))
jdsika/TUM_HOly
openrave/docs/source/tutorials/openravepy_examples/returning_trajectory.py
Python
mit
847
0.011806
"""Get a trajectory to a grasp before executing it. """ from openravepy import * import numpy, time env=Environment() env.Load('data/lab1.env.xml') env.SetViewer('qtcoin') robot = env.GetRobots()[0] target = env.GetKinBody('mug1') gmodel = databases.grasping.GraspingModel(robot,target) if not gmodel.load(): gmodel....
s(returnnum=1) basemanip = interfaces.BaseManipulation(robot) with robot: grasp = validgrasps[0] gmodel.setPreshape(grasp) T = gmodel.getGlobalGraspTransform(grasp,collision
free=True) traj = basemanip.MoveToHandPosition(matrices=[T],execute=False,outputtrajobj=True) raveLogInfo('traj has %d waypoints, last waypoint is: %s'%(traj.GetNumWaypoints(),repr(traj.GetWaypoint(-1)))) robot.GetController().SetPath(traj) robot.WaitForController(0)
lmoran/SDMXPlugin
resources.py
Python
apache-2.0
5,341
0.000936
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt4 (Qt v4.8.7) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = "\ \x00\x00\x04\x0a\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x17\x00...
3\xd8\xb5\xb6\xce\ \xfc\xfa\xfd\x00\xfb\x3e\xf4\xc8\x05\x35\xba\x5e\xeb\x46\x21\xf9\ \xcf\x0a\xa9\x8c\x87\xe3\x48\xdc\x90\xb5\x6e\x98\x6a\xaa\x65\xf2\ \x52\x92\x43\x2f\x5e\xc2\x8c\x02\x1a\x10\xf5\x07\xac\xc3\x75\x70\ \x83\x92\x80\xb3\xf9\xd0\x26\xf8\x8f\xb3\x29\xc6\x3e\xb8\x8c\x19\ \x35\x75\x6b\x7b\x7e\x3c\xca\x45\x0c\...
3c\x5f\x9d\x4b\ \x32\xfd\x44\xb2\xba\xd7\xfa\xb6\x60\xcf\xde\x16\xdc\x90\x45\x4c\ \x4a\x2a\x9e\x62\xfe\x4e\xc5\xc8\xc1\x4e\xda\x76\x86\xe8\xe9\x0a\ \xe3\xd8\x92\x58\xd4\xc6\xb2\x44\x6d\x78\x2a\x53\xe1\xca\x7c\x99\ \x63\x5d\xbf\x56\x9d\xbd\x9f\x44\x18\x7a\xba\x95\x27\x0f\xb4\xd3\ \xdc\x18\xc0\xf3\x0d\x52\x40\xd8\xb5\xb0...
examachine/pisi
pisi/exml/autoxml.py
Python
gpl-3.0
31,161
0.007702
# -*- coding: utf-8 -*- # # Copyright (C) 2005, TUBITAK/UEKAE # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) # any later version. # # Plea...
Stri
ngIO import gettext __trans = gettext.translation('pisi', fallback=True) _ = __trans.ugettext # PiSi import pisi from pisi.exml.xmlext import * from pisi.exml.xmlfile import XmlFile import pisi.context as ctx import pisi.util as util import pisi.oo as oo class Error(pisi.Error): pass # requirement specs mandat...
jerryasher/hackerrank30
11/hourglass.py
Python
unlicense
550
0.001818
#!/bin/python3 a = [] for i in range(6): line
= input() a.append([int(x) for x in line.split()]) def hourglass_sum(a, i, j):
sum = a[i][j] + a[i][j + 1] + a[i][j + 2] i += 1 sum += a[i][j + 1] i += 1 sum += a[i][j] + a[i][j + 1] + a[i][j + 2] return sum def max_hourglasses(a): max = -9 * 36 for i in range(0, 4): for j in range(0, 4): sum = hourglass_sum(a, i, j) # print(sum) ...
michaelBenin/django-jenkins
tests/test_app/urls.py
Python
lgpl-3.0
247
0.004049
# -*- c
oding: utf-8 -*- from django.conf.urls.defaults import * urlpatterns = patterns('', url(r'^test_click/$', 'django.views.generic.simple.direct_to_template', {'template': 'test_app/wm_test_click.html'}, name='wm_test_click
') )
federicoviola/alpha
wsgi/app/auth/__init__.py
Python
mit
84
0.02381
from flask
import Blueprint auth = Blueprint('auth'
, __name__) from . import views
IBT-FMI/SAMRI
samri/plotting/blender_visualization.py
Python
gpl-3.0
11,136
0.018858
import bpy from bpy import context import os import sys import argparse ## Example call from commandline: blender -b -P decimate_mesh_blender.py -- -f mesh.obj -o mesh_dec.obj -r 0.5 -i 2 -n 4 -l 0.5 ## Blender will ignore all options after -- so parameters can be passed to python script. # get the args passed to ble...
NGLE' bpy.context.object.rotation_axis_angle[0] = 3.02814 bpy.context.object.rotation_axis_angle[1] = 0.0004 bpy.context.object.rotation_a
xis_angle[2] = 0.387187 bpy.context.object.rotation_axis_angle[3] = -0.916546 #Try with a hemi lamp #HEMI does not exist in 2.8+ deselect() bpy.context.object.rotation_axis_angle[2] = 0.387187 bpy.ops.object.light_add(type='SUN', radius=1, location=(-0.00643184, -10.4931, 10.284)) Hemi = bpy.context.selected_objects[...
XiaoLiuAI/RUPEE
src/python/main.py
Python
gpl-2.0
1,335
0.004494
#!python2.7 ''' Created on Jul 13, 2014 @author: cilia ''' import os.path import os import time import sys import tempfile from utils.path import loadModule import utils conf = utils.get_conf() def run_task(task_conf): #
import pdb; pdb.set_trace() print 'run task:', task_conf['task name'] task_func = loadModule(task_conf['task method']) task_param = eval(task_conf['task parameters']) task_func(**task_param) def main(argv): task_conf_name = argv[0] if os.path.exists(task
_conf_name): task_confs = eval(open(task_conf_name).read()) else: task_conf_name += '%s%s%s' % (os.path.dirname(__file__), '../conf/', task_conf_name) if os.path.exists(task_conf_name): task_confs = eval(open(task_conf_name)) else: print 'task configuration fi...
nturaga/tools-iuc
tools/kraken_taxonomy_report/kraken_taxonomy_report.py
Python
mit
11,752
0.02272
#!/usr/bin/env python # Reports a summary of Kraken's results # and optionally creates a newick Tree # Copyright (c) 2016 Daniel Blankenberg # Licensed under the Academic Free License version 3.0 # https://github.com/blankenberg/Kraken-Taxonomy-Report import sys import os import optparse import re __VERSION__ = '0.0...
ild_lists[ parent_id ] = [] child_lists[ parent_id ].append( node_id ) rank_map[node_id] = rank return ( child_lists, name_map, rank_map ) def dfs_summation( node, counts, child_lists ): children = child_lists.get( node, None ) if children: for child in children: ...
k_map, name_map, child_lists, output_lines, options, name=None, tax=None ): if not options.summation and ( not options.show_zeros and node not in hit_taxa ): return rank_int = rank_map[node] code = RANK_INT_TO_CODE.get( rank_int, NO_RANK_CODE ) if ( code != NO_RANK_CODE or options.intermediate )...
hickerson/bbn
fable/fable_sources/fable/test/sf_times.py
Python
mit
13,934
0.011626
from __future__ import division from libtbx.test_utils import approx_equal from libtbx.utils import Usage from libtbx import easy_run import libtbx.load_env import platform import time import sys, os op = os.path __this_script__ = "cctbx_project/fable/test/sf_times.py" # based on cctbx_project/compcomm/newslet...
, "max(0.0, 1.0 - arg*arg)") for_txt = for_txt.replace("REAL", real) open("tmp.f", "w").write(for_txt) from fable import cout cpp_txt = cout.process( file_names=["tmp.f"], namespace="sf_test",
fem_do_safe=False, inline_all=True) open("tmp.cpp", "w").write("\n".join(cpp_txt)+"\n") if (lang.lower() == "f"): build_cmd += " tmp.f" elif (lang.lower() == "c"): build_cmd += finalize_cpp_build_cmd("tmp.cpp") else: raise RuntimeError('Unknown lang: "%s"' % lang) return build_run( setup_c...
vFense/vFenseAgent-nix
agent/agent.py
Python
lgpl-3.0
182
0.005495
import sys import os
sys.path.append(os.path.join(os.getcwd(), "src")) from core import MainCore if __name__ == "__main__": main
_core = MainCore("agent") main_core.run()
drtuxwang/system-config
bin/dockerreg.py
Python
gpl-2.0
13,196
0
#!/usr/bin/env python3 """ List images in Docker registry curl http://localhost:5000/v1/_ping curl http://localhost:5000/v1/search curl http://localhost:5000/v1/repositories/<repository>/tags curl -X DELETE http://localhost:5000/v1/repositories/<repository>/tags/<tag> curl http://localhost:5000/v2/ curl http://localh...
ge number can crash Registry MAXREPO = "9999" requests.packages.urllib3.disable_warnings() # pylint: disable = no-member SSL_V
ERIFY = False class Options: """ Options class """ def __init__(self) -> None: self._args: argparse.Namespace = None self._config() self.parse(sys.argv) def get_remove_flag(self) -> bool: """ Return remove flag. """ return self._args.remove...
deepchem/deepchem
deepchem/feat/complex_featurizers/splif_fingerprints.py
Python
mit
10,535
0.004273
""" SPLIF Fingerprints for molecular complexes. """ import logging import itertools import numpy as np from deepchem.utils.hash_utils import hash_ecfp_pair from deepchem.utils.rdkit_utils import load_complex from deepchem.utils.rdkit_utils import compute_all_ecfp from deepchem.utils.rdkit_utils import MoleculeLoadExcep...
ls.rdkit_utils import compute_contact_centroid from deepchem.feat import ComplexFeaturizer from deepchem.utils.hash_utils import vectorize from deepchem.utils.voxel_utils import voxelize from deepchem.utils.voxel_utils import convert_atom_pair_to_voxel from deepchem.utils.geometry_utils import compute_pairwise_distance...
g.getLogger(__name__) SPLIF_CONTACT_BINS = [(0, 2.0), (2.0, 3.0), (3.0, 4.5)] def compute_splif_features_in_range(frag1: Tuple, frag2: Tuple, pairwise_distances: np.ndarray, contact_bin: List, ...
triple-threat/django-dash
apps/emailer/engines.py
Python
agpl-3.0
2,728
0.000367
# Promise.ly -- social commitment platform # # Copyright (C) 2012 Promise.ly authors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your opti...
FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org
/licenses/>. from django.core.mail import EmailMessage from django.template.loader import render_to_string from promise.models import Profile, Promise class EmailEngine(object): """ Base email engine for rendering a template and sending it. """ from_address = "Promise.ly <notifications@promise.ly>"...
spulec/moto
moto/elasticbeanstalk/utils.py
Python
apache-2.0
360
0.002778
def make_arn(region, account_id, resource_type, resource_path): arn_template = ( "arn:aws:elasticbeanstalk:{region}:{account_id}:{resource_type}/{resource_path}" ) arn = arn_template.format( region=region, account_id=account_id,
resource_type=resource_type,
resource_path=resource_path, ) return arn
lcostantino/healing-os
healing/db/sqlalchemy/models.py
Python
apache-2.0
3,311
0.00151
# -*- coding: utf-8 -*- # # Copyright 2014 - Intel. # # 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/licenses/LICENSE-2.0 # # Unless required by ap...
ue) name = sa.Column(sa.String(255), nullable=True) action = sa.Column(sa.String(255), nullable=True) resource_id = sa.Column(sa.String(255), nullable=True) action_options = sa.Column(sa.String(255), nullable=True) class AlarmTrack(mb.HealingBase): """Contains info about the ALARMs.""" ...
sa.Column(sa.String(80)) contract_id = sa.Column(sa.String(80)) type = sa.Column(sa.String(100)) meter = sa.Column(sa.String(100)) threshold = sa.Column(sa.String(20)) operator = sa.Column(sa.String(5)) period = sa.Column(sa.Integer(), default=10) evaluation_period = sa.Column(sa.Integer(), ...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/action/netconf_config.py
Python
bsd-3-clause
987
0
# # Copyright 2016 Peter Sprygada <psprygada@ansible.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU
General Public License as published by # the Free Software Founda
tion, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #...
onespacemedia/cms-faqs
apps/faqs/models.py
Python
mit
1,520
0.000658
from cms import sitemaps from cms.apps.pages.models import ContentBase from cms.models import HtmlField, PageBase from django.db import models from historylinks import shortcuts as historylinks class Faqs(ContentBase): classifier = 'apps' urlconf = '{{ project_name }}.apps.faqs.urls' per_page = models.P...
) answer = HtmlField() order = models.PositiveIntegerField( default=0 ) def __str__(self): return self.question class Meta: verbose_name = 'FAQ' verbose_name_plural = 'FAQs' ordering = ['order', 'question'] def get_absolute_url(self): return ...
lug': self.slug, }) historylinks.register(Faq) sitemaps.register(Faq)
Keeper-Security/Commander
keepercommander/importer/lastpass/shared_folder.py
Python
mit
192
0
class LastpassSharedFolder: def __init__(self, id, name, members=None, teams=None): self.id =
id self.
name = name self.members = members self.teams = teams
aguinane/energyusage
energy/models.py
Python
agpl-3.0
3,513
0.001139
import datetime import os from sqlalchemy import create_engine from sqlalchemy import MetaData, Table, Column, DateTime, Float, Integer, ForeignKey from sqlalchemy import between, func from sqlalchemy.sql import select from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy import Column, String, DateTime, Fl...
def get_id(self): """Return the email address to satisfy Flask-Login's requirements.""" return self.user_id def is_authenticated(self): """Return True if the user is authenticated.""" return True def is_anonymous(self): """False, as anonymous users aren't supported
.""" return False
hsnr-gamera/gamera
gamera/gui/toolbar.py
Python
gpl-2.0
4,334
0.017074
# -*- mode: python; indent-tabs-mode: nil; tab-width: 3 -*- # vim: set tabstop=3 shiftwidth=3 expandtab: # # Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom, # and Karl MacMillan # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU ...
ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for
more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # import wx from wx.lib import buttons from gamera.gui import gamera_icons, compat_wx # Thi...
DailyActie/Surrogate-Model
01-codes/numpy-master/numpy/f2py/__main__.py
Python
mit
740
0
# See http://cens.ioc.ee/proje
cts/f2py2e/ from __future__ import division, print_function import os import sys for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: try: i = sys.argv.index("--" + mode) del sys.argv[i] break except ValueError: pass os.environ["NO_S
CIPY_IMPORT"] = "f2py" if mode == "g3-numpy": sys.stderr.write("G3 f2py support is not implemented, yet.\\n") sys.exit(1) elif mode == "2e-numeric": from f2py2e import main elif mode == "2e-numarray": sys.argv.append("-DNUMARRAY") from f2py2e import main elif mode == "2e-numpy": from numpy.f2py ...
Shigbeard/shigbeard-cogs
gsinfo/gsinfo.py
Python
gpl-3.0
11,433
0.008134
import discord from discord.ext import commands from .utils import checks from __main__ import send_cmd_help try: import valve.source.a2s import valve.source.messages sourcequery_isinstalled = True except: sourcequery_isinstalled = False import socket import json try: from bs4 import BeautifulSoup ...
ier([ip,port]) info = server.info() do_players = True try: players = server.players() except valve.source.messages.BrokenMessageError: do_players = False vac_enabled = "No" if info["vac_enabled"] == 1: ...
* {}\n:robot: **Bot Count:** {}\n:basketball_player: **Player Count:** {}/{}".format(info["game"],info["map"],vac_enabled,info["bot_count"],info["player_count"],info["max_players"]) someurl = "http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=079D7A41C1ECEF33960716B75A7B39D4&...
imatge-upc/trecvid-2015
scripts/python/select_samples.py
Python
mit
8,229
0.015433
import os import numpy as np import Image import cv2 import matplotlib.pyplot as plt import csv import sys import pickle import scipy.io as sio from get_params import get_params import fast_rcnn_comp as fast_rcnn_comp import random params = get_params() sys.path.insert(0, os.path.join(params['fast_rcnn...
len(negatives)) positives = random.sample(positives, len(positives)) ''' positives_train = positives[0:int(params['split_percentage']*len(positives))] positives_test = positives[int(params['split_percentage']*len(positives)):len(positives)] ...
negatives_test = negatives[int(params['split_percentage']*len(negatives)):len(negatives)] print "Number of positives: ", len(positives), len(positives_train), len(positives_test) print "Number of negatives: ", len(negatives), len(negatives_train), len(negatives_test) ...
rbprogrammer/advanced_python_topics
course-material/py2/solutions/13 File system control/fuser_t.py
Python
apache-2.0
256
0.011719
#!/usr/local/bin/python2 import os print "PID:",str(os.getpid()) while True: raw_input("press
<RETURN> to open file") fh = open("/tmp/test.txt",'w') print "Opened /tmp/test.txt..."
raw_input("press <RETURN> to close") fh.close()
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/organizations/migrations/0001_initial.py
Python
agpl-3.0
2,363
0.004232
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import model_utils.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Organization', ...
fault=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('name', models.CharField(max_length=255, verbose_name=b'Long name', db_index=Tru...
('logo', models.ImageField(help_text='Please add only .PNG files for logo images.', max_length=255, null=True, upload_to=b'organization_logos', blank=True)), ('active', models.BooleanField(default=True)), ], options={ 'abstract': False, }, ...
Open-Transport/synthese
legacy/projects/template/manager/imports_config.py
Python
gpl-2.0
784
0
# Example import configuration. import_templates = [{ 'id': 'my_import', 'label': 'My Import (Trident)', 'defaults': [ ('ds', '16607027920896001'),
('itt', '1'), ('mr', '1'), ('impstp', '1'), ('asa', '1'), ('impjun', '0'), ('dtd', '5'), { 'id': 'dr', 'label': 'Directory containing files to import', 'type': 'directory', 'defaul
t': 'files', }, ('clean_old_data', '1'), ('from_today', '1'), ], 'admins': [('root', 'admin@example.com')], 'uploaders': [('uploader', ['uploader@rcsmobility.com'])], 'run_results_notifications': { 'load': ('alice@example.com',), 'warn': ('bob@example.com',), ...
xiaokangwang/KKWebVideoDL-X
youtube_dl/extractor/ted.py
Python
gpl-3.0
4,024
0.010934
import json import re from .common import InfoExtractor class TEDIE(InfoExtractor): _VALID_URL=r'''http://www\.ted\.com/ ( ((?P<type_playlist>playlists)/(?P<playlist_id>\d+)) # We have a playlist | ((?P<type_talk>talks)) #...
{.*?})</script>', webpage, 'json data') info = json.loads(json_data) desc = self._html_search_regex(r'<div class="talk-intro">.*?<p.*?>(.*?)</p>', webpage, 'description', flags = re.DOTALL) thumbnail = self._sear...
webpage, 'thumbnail') info = { 'id': info['id'], 'url': info['htmlStreams'][-1]['file'], 'ext': 'mp4', 'title': title, 'thumbnail': thumbnail, 'description': desc, } ...
Lorquas/subscription-manager
src/subscription_manager/injection.py
Python
gpl-2.0
4,210
0
from __future__ import print_function, division, absolute_import # Copyright (c) 2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNES...
ACHE = "CURRENT_OWNER_CACHE" SYSPURPOSE_VALID_FIELDS_CACHE = "SYSPURPOSE_VALID_FIELDS_CACHE" SUPPORTED_RESOURCES_CACHE = "SUPPORTED_RESOURCES_CACHE" AVAILABLE_ENTITLEMENT_CACHE = "AVAILABLE_ENTITLEMENT_CACHE" ENTITLEMENT_STATUS_CACHE = "ENTITLEMENT_STATUS_CACHE" POOL_STATUS_CACHE = "POOL_STATUS_CACHE" PROD_STATUS_CACHE...
"PROD_STATUS_CACHE" OVERRIDE_STATUS_CACHE = "OVERRIDE_STATUS_CACHE" CP_PROVIDER = "CP_PROVIDER" PLUGIN_MANAGER = "PLUGIN_MANAGER" DBUS_IFACE = "DBUS_IFACE" POOLTYPE_CACHE = "POOLTYPE_CACHE" ACTION_LOCK = "ACTION_LOCK" FACTS = "FACTS" PROFILE_MANAGER = "PROFILE_MANAGER" INSTALLED_PRODUCTS_MANAGER = "INSTALLED_PRODUCTS_...
qedsoftware/commcare-hq
corehq/form_processor/tests/test_adjust_datetimes.py
Python
bsd-3-clause
1,377
0
from django.test import SimpleTestCase from corehq.apps.tzmigration.api import phone_timezones_should_be_processed from corehq.apps.tzmigration.test_utils import \ run_pre_and_post_timezone_migration from corehq.form_processor.utils import adjust_datetimes class AdjustDatetimesTest(SimpleTestCase): def test_...
): self.assertEqual( adjust_datetimes({'datetime': '2013-03-09T06:30:09.007+03'}),
{'datetime': '2013-03-09T03:30:09.007000Z'} ) else: self.assertEqual( adjust_datetimes({'datetime': '2013-03-09T06:30:09.007+03'}), {'datetime': '2013-03-09T06:30:09.007000Z'} ) def test_match_no_parse(self): fake_datet...
zhengjue/mytornado
study/3/XLsxWriter/demo1.py
Python
gpl-3.0
3,331
0.025301
# !/bin/env python # _*_ coding: utf-8 _*_ import xlsxwriter workbook = xlsxwriter.Workbook('chart.xlsx') # 创建一个Excel文件 worksheet = workbook.add_worksheet() # 创建一个工作表对象 chart = workbook.add_chart({'type': 'column'}) # 创建一个图表对象 # 定义数据表头列表 title = [u'业务名称',u'星期一',u'星期二',u'星期三',u'星期四',u'星期五',u'星期六',u'星期日',u'平均...
148], [89,88,95,93,98,100,99], [201,200,198,175,170,198,195], [75,77,78,78,74,70,79], [88,85,87,90,93,88,84], ] format=workbook.add_format() # 定义format格式对象 format.set_border(1) # 定义format对象单元格边框加粗(1像素)的格式 format_title=workbook.add_format() # 定义forma
t_title格式对象 format_title.set_border(1) # 定义format_title对象单元格边框加粗(1像素)的格式 format_title.set_bg_color('# cccccc') # 定义format_title对象单元格背景颜色为# '# cccccc'的格式 format_title.set_align('center') # 定义format_title对象单元格居中对齐的格式 format_title.set_bold() # 定义format_title对象单元格内容加粗的格式 format_ave=workbook.add_format() # 定义format_...
hydroffice/hyo_ssp
hydroffice/ssp/helper.py
Python
lgpl-3.0
1,806
0.003322
from __future__ import absolute_import, division, print_function, unicode_literals import os import logging log = logging.getLogger(__name__) from hydroffice.base import helper def hyo_ssp_installation_folder(): """ Return the HydrOffice SSP folder """ return os.path.dirname(os.path.realpath(__...
ory """ from . import __doc__
from . import __version__ hyo_folder = helper.Helper.default_projects_folder() projects_folder = os.path.join(hyo_folder, "%s %s" % (__doc__, __version__)) if not os.path.exists(projects_folder): try: os.mkdir(projects_folder) except OSEr...
stephrdev/brigitte
brigitte/gitserver/management/commands/run_gitserver.py
Python
bsd-3-clause
627
0.001595
# -*- coding: utf-8 -*- from django.conf import settings from django.core.management.base import BaseCommand from twisted.conch.interfaces import ISession from twisted.internet import reactor from twisted.python import components from brigitte.gitserver.server import GitSession, GitConchUser, GitServer class Comman...
T, GitServer(settings.BRIGIT
TE_SSH_KEY_PATH)) reactor.run()
trendelkampschroer/msmtools
msmtools/analysis/sparse/stationary_vector.py
Python
lgpl-3.0
4,394
0.001593
# This file is part of MSMTools. # # Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER) # # MSMTools is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either ...
tionary vector usin
g backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue. Returns ------- pi : (M,) ndarray Stationary vector """ A = P.transpose() mu = 1.0 - ...
Acehaidrey/incubator-airflow
airflow/task/task_runner/cgroup_task_runner.py
Python
apache-2.0
10,133
0.001776
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
e) self._created_cpu_cgroup = True if self._cpu_shares > 0: self.log.debug("Setting %s with %s CPU shares", self.cpu_cgroup_name, self._cpu_shares) cpu_cgroup_node.controller.shares = self._cpu_shares # Start the process w/ cgroups self.log.debug("Starting task p...
s = self.run_command(['cgexec', '-g', f'cpu,memory:{cgroup_name}']) def return_code(self): return_code = self.process.poll() # TODO(plypaul) Monitoring the control file in the cgroup fs is better than # checking the return code here. The PR to use this is here: # https://github.com/...