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
wemanuel/smry
smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/sql/tools/instances/set_root_password.py
Python
apache-2.0
4,026
0.002981
# Copyright 2013 Google Inc. All Rights Reserved. """Sets the password of the MySQL root user.""" from googlecloudsdk.calliope import base from googlecloudsdk.core import log from googlecloudsdk.core import remote_completion from googlecloudsdk.sql import util @base.ReleaseTracks(base.ReleaseTrack.GA) class SetRoot...
.readline() else: password = args.password result = sql_client.instances.SetRootPassword( sql_messages.SqlInstancesSetRootPasswordRequest( project=instance_ref.project, instance=instance_ref.instance, instanceSetRootPasswordRequest=( sql_message...
password=password)))))) operation_ref = resources.Create( 'sql.operations', operation=result.operation, project=instance_ref.project, instance=instance_ref.instance, ) if args.async: return sql_client.operations.Get(operation_ref.Request()) util.WaitFo...
googleapis/python-aiplatform
google/cloud/aiplatform/datasets/column_names_dataset.py
Python
apache-2.0
8,935
0.001231
# -*- coding: utf-8 -*- # Copyright 2021 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
ed. Project to initiate the BigQuery client with. bq_table_uri (str)
: Required. A URI to a BigQuery table. Can include "bq://" prefix but not required. credentials (auth_credentials.Credentials): Credentials to use with BQ Client. Returns: Set[str] A set of column names in the BigQuery tabl...
antoinecarme/sklearn2sql_heroku
tests/classification/iris/ws_iris_AdaBoostClassifier_mysql_code_gen.py
Python
bsd-3-clause
137
0.014599
from sklearn2sql_hero
ku.tests.classification import generic as class_gen class_gen.test_model("AdaBoostClassifier" , "iris" , "mysql"
)
aapris/IoT-Web-Experiments
iotendpoints/endpoints/migrations/0003_datalogger.py
Python
mit
1,762
0.003973
# Generated by Django 2.0.5 on 2018-05-07 09:24 from django.conf import settings import django.contrib.gis.db.models.fields from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import endpoints.models
class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(se
ttings.AUTH_USER_MODEL), ('endpoints', '0002_request_user'), ] operations = [ migrations.CreateModel( name='Datalogger', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uid', mo...
tomduck/pandoc-xnos
pandocxnos/__init__.py
Python
gpl-3.0
121
0
"""
Package initialization.""" from .core import * from .main import main from .pandocattributes import PandocAt
tributes
dstufft/sessions
sessions/__init__.py
Python
apache-2.0
913
0.001095
# Copyright 2014 Donald Stufft # # 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 writing, software # distributed under the License is distributed on an "...
ress or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from sessions.__about__ import ( __author__, __copyright__, __email__, __license__, __summary__, __title__, __uri__, __version...
nkmk/python-snippets
notebook/numpy_floor_trunc_ceil.py
Python
mit
681
0
import numpy as np print(np.__version__) # 1.19.4 a = np.array([[10.0, 10.1, 10.9], [-10.0, -10.1, -10.9]]) print(a) # [[ 10. 10.1 10.9] # [-10. -10.1 -10.9]]
print(np.floor(a)) # [[ 10. 10. 10.] # [-10. -11. -11.]] print(np.floor(a).dtype) # float64 print(np.floor(a).astyp
e(int)) # [[ 10 10 10] # [-10 -11 -11]] print(np.floor(10.1)) # 10.0 print(np.trunc(a)) # [[ 10. 10. 10.] # [-10. -10. -10.]] print(np.fix(a)) # [[ 10. 10. 10.] # [-10. -10. -10.]] print(a.astype(int)) # [[ 10 10 10] # [-10 -10 -10]] print(np.ceil(a)) # [[ 10. 11. 11.] # [-10. -10. -10.]] print(np....
OpenMined/PySyft
packages/syft/src/syft/core/node/common/node_table/dataset.py
Python
apache-2.0
435
0
# third party from sqlalchemy import Column from sqlalchemy import JSON from sqlalchemy import String # relative from . import Base class Dataset(Base): __tablename__ = "dataset" id = Column(String(256), pr
imary_key=True) name = Column(String(256)) manifest = Column(String(2048)) description = Column(String(2048)) tags = Column(JSON()) str_metadata = Column(JSON())
blob_metadata = Column(JSON())
airbnb/airflow
dev/send_email.py
Python
apache-2.0
10,284
0.001654
#!/usr/bin/python3 # # 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 # "Lic...
ue, help="Your LDAP Apache username", required=True, ) @click.password_option( # type: ignore "-p", "--apache_password", prompt="Apache Password", envvar="APACHE_PASSWORD", show_envvar=True, help="Your LDAP Apache password",
required=True, ) @click.option( "-v", "--version", prompt="Version", envvar="AIRFLOW_VERSION", show_envvar=True, help="Release Version", required=True, ) @click.option( "-rc", "--version_rc", prompt="Version (with RC)", envvar="AIRFLOW_VERSION_RC", show_envvar=True, h...
Cynary/distro6.01
arch/6.01Soft/lib601-F13-4/soar/worlds/bigFrustrationWorld.py
Python
mit
133
0.120301
dimensions(8,8) wall((2,0),(2,4)) wal
l((2,4),(4,4)) wall((2,6),(6,6)) wall((6,6),(6,0)) wall((6,2),(4,2)) initi
alRobotLoc(1.0, 1.0)
AnanseGroup/map-of-innovation
mapofinnovation/tests/functional/test_adminfunc.py
Python
mit
215
0.004651
from mapofinnovation.tests import * class TestAdminfuncC
ontroller(TestController): def test_index(self): response = self.app.get(url(controller='adminfunc', action='i
ndex')) # Test response...
FrozenPigs/Taigabot
plugins/amazon.py
Python
gpl-3.0
2,394
0.000835
# amazon plugin by ine (2020) from util import hook from utilities import request from bs4 import BeautifulSoup import re def parse(html): soup = BeautifulSoup(html, 'lxml') container = soup.find(attrs={'data-component-type': 's-search-results'}) if container is None: return [] results = cont...
type': 's-search-result'}) if len(results) == 0: return [] links = [] for result in results: ti
tle = result.find('h2') price = result.find('span', attrs={'class': 'a-offscreen'}) if title is None or price is None: continue id = result['data-asin'] title = title.text.strip() price = price.text.strip() url = 'https://www.amazon.com/dp/' + id + '/' ...
MjAbuz/watchdog
vendor/rdflib-2.4.0/test/rdfdiff.py
Python
agpl-3.0
2,002
0.025475
#!/usr/bin/env python """ RDF Graph Isomorphism Tester Author: Sean B. Palmer, inamidst.com Uses the pyrple algorithm Requirements: Python2.4+ http://inamidst.com/proj/rdf/ntriples.py Usage: ./rdfdiff.py <ntriplesP> <ntriplesQ> """ import sys, re, urllib import ntriples from ntriples import bNode ntriples.r_uri...
def triple(sink, s, p, o): self.triples.add((s, p, o)) p = ntriples.NTriplesParser(sink=Sink()) u = urllib.urlopen(uri) p.parse(u) u.close() def parse_string(self, content): class Sink(object): def triple(sink, s, p, o): self.triples.add((s, p, o)) ...
nk()) p.parsestring(content) def __hash__(self): return hash(tuple(sorted(self.hashtriples()))) def hashtriples(self): for triple in self.triples: g = ((isinstance(t, bNode) and self.vhash(t)) or t for t in triple) yield hash(tuple(g)) def vhash(self, term, done=False): ...
Zimmi48/coq
doc/tools/coqrst/notations/TacticNotationsLexer.py
Python
lgpl-2.1
3,961
0.004292
# Generated from TacticNotations.g by ANTLR 4.7.2 from antlr4 import * from io import StringIO from typing.io import TextIO import sys def serializedATN(): with StringIO() as buf: buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\f") buf.write("f\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4...
\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r") buf.write("\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3") buf.write("\2\2\2\3\27\3\2\2\2\5 \3\2\2\2\7\"\3\2\2\2\t$\3\2\2\2") buf.write("\13E\3\2\2\2\rG\3\2\2\2\17O\3\2\2\2\21Q\3\2\2\2\23Z\3") buf.write("\2\2\2\25b\3\2\2\2\27\30\7}\2...
2\2\35!\7,\2\2\36") buf.write("\37\7}\2\2\37!\7A\2\2 \32\3\2\2\2 \34\3\2\2\2 \36\3\2") buf.write("\2\2!\6\3\2\2\2\"#\7}\2\2#\b\3\2\2\2$%\7\177\2\2%\n\3") buf.write("\2\2\2&\'\7\'\2\2\'F\7}\2\2()\7\'\2\2)F\7\177\2\2*+\7") buf.write("\'\2\2+F\7~\2\2,-\7b\2\2-.\7\'\2\2.F\7}\2\2/\60\7B\2\2")...
igraph/xdata-igraph
interfaces/python/igraph/datatypes.py
Python
gpl-2.0
28,500
0.001334
# vim:ts=4:sw=4:sts=4:et # -*- coding: utf-8 -*- """Additional auxiliary data types""" from itertools import islice __license__ = """\ Copyright (C) 2006-2012 Tamás Nepusz <ntamas@gmail.com> Pázmány Péter sétány 1/a, 1117 Budapest, Hungary This program is free software; you can redistribute it and/or modify it unde...
ix shapes do not match") return self.__class__([ [a+b for a, b in izip(row_a, row_b)] for row_a, row_b in izip(self, other) ]) else: return self.__class__([ [item+other for item in row] for row in self]) def __eq__(self, ot...
x is equal to another one""" return isinstance(other, Matrix) and \ self._nrow == other._nrow and \ self._ncol == other._ncol and \ self._data == other._data def __getitem__(self, i): """Returns a single item, a row or a column of the matrix ...
BlogomaticProject/Blogomatic
opt/blog-o-matic/usr/lib/python/Bio/PopGen/GenePop/EasyController.py
Python
gpl-2.0
6,648
0.007822
# Copyright 2009 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """ This module allows to control GenePop through an easier interface. ...
"""Returns the alleles for a certain population and locus. """ geno_freqs = self._controller.calc_allele_genotype_freqs(self._fname) pop_iter, loc_iter = geno_freqs for locus_info in loc_iter: if locus_info[0] == locus_name: return locus_info[1] def ge...
locus_info in loc_iter: if locus_info[0] == locus_name: alleles = locus_info[1] pop_name, freqs, total = locus_info[2][pop_pos] allele_freq = {} for i in range(len(alleles)): allele_freq[alleles[i]] = freqs[i] ...
duyuan11/ford
setup.py
Python
gpl-3.0
2,137
0.015442
from setuptools import setup, find_packages from codecs import open # To use a consistent encoding from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup(...
# Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Langu...
Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ], install_requires = ['markdown','markdown-include >= 0.5.1','toposort', ...
fireeye/flare-wmi
python-cim/tests/test_mapping.py
Python
apache-2.0
7,662
0.001044
from fixtures import * import cim def test_mapping_type_guess_xp(): ''' test automatic detection of winxp repositories. ''' repodir = os.path.join(os.path.dirname(__file__), 'repos') xpdir = os.path.join(repodir, 'xp') repopath = os.path.join(xpdir, 'mapping-only') assert cim.CIM.guess_c...
325, 330, 331, 334, 341, 347, 349, 352, 354, 355, 357, 358, 365, 366, 367, 372, 373, 375, 379, 380, 381, 383, 384, 386, 387, 388, 39
0, 391, 392, 393, 394, 395, 396, 398, 401, 403, 404, 406, 407, 408, 409, 410, 414, 415, 417, 419, 420, 422, 424, 425, 426, 430, 432, 433, 434, 435, 436, 437, 438, 439, 440, 442, 443, 447, 448, 449, 45...
GhostshipSoftware/avaloria
src/tests/test_server_amp.py
Python
bsd-3-clause
5,448
0.008443
import unittest class TestGetRestartMode(unittest.TestCase): def test_get_restart_mode(self): # self.assertEqual(expected, get_restart_mode(restart_file)) assert True # TODO: implement your test here class TestAmpServerFactory(unittest.TestCase): def test___init__(self): # amp_server_f...
# a_mp_protocol = AMPProtocol() # self.assertEqual(expected, a_mp_protocol.amp_function_call(module, function, args, **kwargs)) assert True # TODO: implement your test here def test_amp_msg_portal2server(self): # a_mp_protocol = AMPProtocol() # self.assertEqual(
expected, a_mp_protocol.amp_msg_portal2server(sessid, ipart, nparts, msg, data)) assert True # TODO: implement your test here def test_amp_msg_server2portal(self): # a_mp_protocol = AMPProtocol() # self.assertEqual(expected, a_mp_protocol.amp_msg_server2portal(sessid, ipart, nparts, msg, da...
leighpauls/k2cro4
third_party/mozc/chrome/chromeos/renderer/litify_proto_file.py
Python
bsd-3-clause
2,506
0.005188
# -*- coding: utf-8 -*- # Copyright 2010-2011, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this...
TE_R
UNTIME;' def ParseOption(): parser = optparse.OptionParser() parser.add_option('--in_file_path', dest='in_file_path', help='Specify the input protocol buffer definition file.') parser.add_option('--out_file_path', dest='out_file_path', help='Specify the result file name.'...
tranpthuan/blabla
Cybercore/task1_cybercore.py
Python
gpl-3.0
1,320
0.018939
import numpy as np import matplotlib.pyplot as plt import csv read1 = [] read2 = [] with open('train.csv',"rb") as csvfile: read = csv.reader(csvfile) read.next() for row in read : if len(row) <= 1 : #data preprocessing c continue read1.append(row[0]) read2.append(...
Xbar.T,Y) w = np.dot(np.linalg.pinv(A),b) w0 = w[0][0] w1 = w[1][0] print(w0) print(w1) x0 = np.linspace(0, 110, 2) y0 = w0 + w1*x0 plt.plot(X, Y, 'm.') # data plt.plot(x0, y0, 'c') # the fitting line plt.axis([0, 110, 0, 110]) plt.xlabel('X') plt.ylabel(''
) plt.show() temp = [] data = [] with open('test.csv',"rb") as csvtest : test = csv.reader(csvtest) test.next() for i in test: if(len(i) < 1) : continue temp.append(i[0]); data = np.array(temp, dtype = float) with open('predict.csv',"wb") as output : writer = csv.writer(o...
lovelysystems/pyjamas
pyjs/src/pyjs/lib/gdk.py
Python
apache-2.0
248
0
class Rectangle: def __init__(self, x=0, y=0, width=0, height=0): self.x = x self.y = y self.width = width
self.height = height def in
tersect(self, src): pass def union(self, src): pass
ucsd-progsys/ml2
paper/oopsla17-cameraready/plots.py
Python
bsd-3-clause
4,957
0.009482
import csv import matplotlib import matplotlib.pyplot as plt import numpy as np UCSD = 'UCSD' BUCKETS = [0.1, 0.2, 1.0, 10.0, 60.0 ] # range(500, 3001, 500) #COLORS=['#90B0D4', '#90D492', '#D4B490', '#D490D2'] COLORS=['#8dd3c7','#bebada','#ffffb3','#fb8072','#80b1d3','#fdb462'] COLORS_E=['#8dd3c7','#bebada','#80b1d3'...
b, padzero_a, mulbydigit_b]) p_n = plt.bar(ind + width, [100*np.average(sepconcat_b), 100*np.average(padzero_a), 100*np.average(mulbydigit_b)], width, color=COLORS[1], yerr=map(err, [sepconcat_b, padzero_a, mulbydigit_b]), err...
fontsize=30) # plt.xlabel('Problem', fontsize=20) plt.ylabel('% Correct', fontsize=24) plt.xticks(ind + width, ['sepConcat\n(p = 0.48)', 'padZero\n(p = 0.097)', 'mulByDigit\n(p = 0.083)'], fontsize=20) plt.legend(('SHErrLoc', 'Nate'), loc='lower right', fontsize=20) # autolabel(plt, p_o) # autol...
bboalimoe/ndn-cache-policy
docs/sphinx-contrib/actdiag/setup.py
Python
gpl-3.0
1,692
0
# -*- coding: utf-8 -*- from setuptools import setup, find_packages long_desc = ''' This package contains the actdiag Sphinx extension. .. _Sphinx: http://sphinx.pocoo
.org/ .. _actdiag: http://blockdiag.com/en/actdiag/ This extension enable you to insert activity diagrams in your Sphinx document. Following code is sample:: .. actdiag::
diagram { A -> B -> C -> D; lane { A; B; } lane { C; D; } } This module needs actdiag_. ''' requires = ['actdiag>=0.5.3', 'Sphinx>=0.6', 'setuptools'] setup( name='sphinxcontrib-actdiag', version='0.7.2', url='http://bitbucket.org/birk...
kobotoolbox/kobocat
onadata/celery.py
Python
bsd-2-clause
1,357
0
# coding: utf-8 import os import celery import logging from django.apps import apps from django.conf import settings # http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html # Attempt to determine the project name from the directory containing this file PROJECT_NAME = os.path.basename(os.path.di...
includes a "dotted path to the appropriate # AppConfig subclass" as recommended
by # https://docs.djangoproject.com/en/1.8/ref/applications/#configuring-applications. # Ask Solem recommends the following workaround; see # https://github.com/celery/celery/issues/2248#issuecomment-97404667 app.autodiscover_tasks(lambda: [n.name for n in apps.get_app_configs()]) @app.task(bind=True) def debug_task(...
WarrenWeckesser/scipy
scipy/linalg/tests/test_basic.py
Python
bsd-3-clause
62,678
0.000032
import itertools import warnings import numpy as np from numpy import (arange, array, dot, zeros, identity, conjugate, transpose, float32) import numpy.linalg as linalg from numpy.random import random from numpy.testing import (assert_equal, assert_almost_equal, assert_, ...
, 0], [2j, 1, 20, 2j],
[0, -1, 7, 14]]) ab = array([[0.0, 20, 6, 2j], [1, 4, 20, 14], [-30, 1, 7, 0], [2j, -1, 0, 0]]) l, u = 2, 1 b4 = array([10.0, 0.0, 2.0, 14.0j]) b4by1 = b4.reshape(-1, 1) b4by2 = array([[2, 1], ...
maninmotion/LittleSportsBiscuit
config/settings/common.py
Python
bsd-3-clause
9,768
0.001126
# -*- coding: utf-8 -*- """ Django settings for LittleSportsBiscuit project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ from __future__ import absolute_import,...
ON # ------------------------------------------------------------------------------ # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be se...
See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id SITE_ID = 1 # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n USE_I18N = True # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n USE_L10N = True # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz USE_T...
dokipen/trac
trac/upgrades/db10.py
Python
bsd-3-clause
697
0.010043
sql = [ #-- Make the node_change table contain more information, and force a resync
"""DROP TABLE revision;""", """DROP TABLE node_change;""", """CREATE TABLE revision ( rev text PRIMARY KEY, time integer, author text, message text );""", """CREATE TABLE node_change ( rev text, path text, kind char(1)...
text, UNIQUE(rev, path, change) );""" ] def do_upgrade(env, ver, cursor): for s in sql: cursor.execute(s) print 'Please perform a "resync" after this upgrade.'
flypy/flypy
flypy/cppgen/tests/test_cppgen.py
Python
bsd-2-clause
907
0.005513
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import os import unittest import tempfile from flypy import jit from flypy.cppgen import cppgen @jit('C[x, y]') class C(object): layout = [('a', 'x'), ('b', 'y')] @jit('C[x, y] -> x') def first(self): return...
--------------------------------------------=== # Tests #===------------------------------------------------------------------=== class TestCPPGen(unittest.TestCase): def test_cppgen(self): with tempfile.NamedTemporaryFile(suffix=".cpp") as f: # TODO: Remove compiled code # TODO: P...
e(C, f.write) os.system("g++ -g -Wall -c %s" % (f.name,)) if __name__ == '__main__': unittest.main()
PeachstoneIO/peachbox
tutorials/tutorial_movie_reviews/model/master.py
Python
apache-2.0
3,918
0.015314
# Copyright 2015 Philipp Pahl, Sven Schubert, Daniel Britzger # # 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 appl...
of_seconds' partition_granularity = 60*60*24*360 time_fill_method = fill_name('time') model = [{'field':'review_id', 'type':'StringType', 'fill_method': fill_review_id}, {'field':'helpful', 'type':'IntegerType', 'fill_method': helpful}, {'field':'nothelpful', 'type':'IntegerType',...
{'field':'text', 'type':'StringType'}] source_fields = [{'field:review_id','type:StringType','validation:notempty'}, {'field':'text','validation:notempty'}] def __init__(self): self.build_model() def helpful(self, row, field=''): lambda row: int(row['helpfulness'...
plotly/python-api
packages/python/plotly/plotly/validators/isosurface/slices/z/_locations.py
Python
mit
476
0.002101
import _plotly_utils.basevalidators c
lass LocationsValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__( self, plotly_name="locations", parent_name="isosurface.slices.z", **kwargs ): super(LocationsValidat
or, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "calc"), role=kwargs.pop("role", "data"), **kwargs )
France-ioi/taskgrader
cache_reset.py
Python
mit
680
0.001471
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- # Copyright (c) 2016 France-IOI, MIT license # # http://opensource.org/licenses/MIT # This little script resets the build folder and the cache database import os, shuti
l # Local imports import schema_db from config_default import CFG_BUILDSDIR, CFG_CACHEDIR from config import CFG_BUILDSDIR, CFG_CACHEDIR if __name__ == '__main__': # Delete the builds and the cache folder shutil.rmtree(CFG_BUILDSDIR, ignore_errors=True) shutil.rmtree(CFG_CACHEDIR, ignore_errors=True) ...
ase schema_db.schemaDb()
vesellov/bitdust.devel
manage.py
Python
agpl-3.0
1,152
0
#!/usr/bin/env python # manage.py # # Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io # # This file (manage.py) is part of BitDust Software. # # BitDust 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 Fou...
f not, see <http://www.gnu.org/licenses/>. # # Please contact us if you have any questions at bitdust.i
o@gmail.com from __future__ import absolute_import import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web.asite.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
sauloal/pycluster
pypy-1.9_64/lib_pypy/_md5.py
Python
mit
12,905
0.01511
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- # Note that PyPy contains also a built-in module 'md5' which will hide # this one if compiled in. """A sample implementation of MD5 in pure Python. This is an implementation o
f the MD5 hash function, as specified by RFC 1321, in pure Python. It was implemented using Bruce Schneier's excellent book "Applied Cryptography", 2nd ed., 1996. Surely this is not meant to compete with the existing implementation of
the Python standard library (written in C). Rather, it should be seen as a Python complement that is more readable than C and can be used more conveniently for learning and experimenting purposes in the field of cryptography. This module tries very hard to follow the API of the existing Python standard library's "md5...
jcmgray/autoray
autoray/_version.py
Python
apache-2.0
18,445
0
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
# sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startsw
ith(tag_prefix): r = ref[len(tag_prefix):] if verbose: print("picking %s" % r) return {"version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None, "date": date} # no suitable...
Voldemort93/python
detect_remotes.py
Python
gpl-2.0
13,069
0.004438
# coding=utf-8 import base64 import zlib import json from sqlalchemy import Column, ForeignKey, Integer, String import sqlalchemy from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker Base = declarat...
Tolerance is None and \ self.repeatCount is None: result = cmp((self.frame, self.frequency), (other.frame, o
ther.frequency)) elif self.period is None and self.frequency is None and self.periodTolerance is not None and \ self.repeatCount is None: result = cmp((self.frame, self.periodTolerance), (other.frame, other.periodTolera...
ademariag/kapitan
kapitan/version.py
Python
apache-2.0
504
0.003968
#!/usr/bin/env python3 # Copyright 2019 The Kapitan Authors # SPDX-FileCopyrightText: 2020 The Kapitan Authors <kapitan
-admins@googlegroups.com> # # SPDX-License-Identifier: Apache-2.0 "Project description variables" PROJECT_NAME = "kapitan" VERSION = '0
.29.4' DESCRIPTION = "Generic templated configuration management for Kubernetes, " "Terraform and other things" AUTHOR = "Ricardo Amaro" AUTHOR_EMAIL = "ramaro@google.com" LICENCE = "Apache License 2.0" URL = "https://github.com/kapicorp/kapitan"
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/aio/operations/_virtual_routers_operations.py
Python
mit
24,260
0.005029
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
his operation to not poll, or pass in your own initialized polling obje
ct for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or ...
SteveWooding/fullstack-nanodegee-conference
Lesson_3/00_Conference_Central/conference.py
Python
gpl-3.0
4,120
0.004126
#!/usr/bin/env python """ conference.py -- Udacity conference server-side Python App Engine API; uses Google Cloud Endpoints $Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $ created by wesc on 2014 apr 21 """ __author__ = 'wesc+api@google.com (Wesley Chun)' from datetime import datetime import ...
_SCOPE API_EXPLORER_CLIENT_ID = endpoints.API_EXPLORER_CLIENT_ID # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @endpoints.api( name='conference', version='v1', allowed_client_ids=[WEB_CLIENT_ID, API_EXPLORER_CLIENT_ID], scopes=[EMAIL_SCOPE]) class Confe...
ofileToForm(self, prof): """Copy relevant fields from Profile to ProfileForm.""" # copy relevant fields from Profile to ProfileForm pf = ProfileForm() for field in pf.all_fields(): if hasattr(prof, field.name): # convert t-shirt string to Enum; just copy other...
feifangit/dj-api-auth
djapiauth/models.py
Python
gpl-2.0
4,372
0.003202
import uuid import re import cPickle import pprint from django.db import models from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.db.models.signals import m2m_changed, pre_delete from django.dispatch import receiver class APITree(object): def __init__(self): ...
e = cPickle.dumps(tree) apikey.save(
update_fields=["apitree"])
JoyTeam/metagam
mg/test/testorm-2.py
Python
gpl-3.0
1,140
0.004386
#!/usr/bin/python2.6 # -*- coding: utf-8 -*
- #
This file is a part of Metagam project. # # Metagam 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 # any later version. # # Metagam is distributed in the hope that it wil...
martinrotter/rssguard
resources/scripts/scrapers/search-xml-feeds.py
Python
gpl-3.0
979
0.017365
# Produces the list of links to XML feeds as extracted from input list of generic URLs. # This script expects to have the file path passed as the
only input parameter import re import sys import urllib.request from urllib.parse import urljoin urls_file = sys.argv[1] with open(urls_file) as f: urls_lines = [line.rstrip() for line in f] regexp_link = re.compile
("<link[^>]+type=\"application\/(?:atom\+xml|rss\+xml|feed\+json|json)\"[^>]*>") regexp_href = re.compile("href=\"([^\"]+)\"") for url in urls_lines: # Download HTML data. try: url_response = urllib.request.urlopen(url) html = url_response.read().decode("utf-8") except: continue # Sear...
lombritz/odoo
addons/pos_delivery_restaurant/wizard/__init__.py
Python
agpl-3.0
1,334
0.001499
# -*- encoding: utf-8 -*- ############################################################################### # Module Writen to OpenERP, Open Source Management Solution # Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). # All Rights Reserved ############# Credits ########################################...
######################################################### # This program is free software: y
ou 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 option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT AN...
QuantumQuadrate/CsPyController
python/Counter.py
Python
lgpl-3.0
19,978
0.005056
"""Counter.py Part of the AQuA Cesium Controller software package author=Martin Lichtman created=2013-10-19 modified>=2015-05-11 This file holds everything to model a National Instruments DAQmx counter. It communicated to LabView via the higher up LabView(Instrument) class. Saving of returned data is handled...
f.bins)) array = array.swapaxes(0, 1) # swap rois and measurement axes array = array.swapaxes(1,
2) # swap rois and shots axes return array def analyzeMeasurement(self, measurementResults, iterationResults, experimentResults): if self.enable: '''# number of shots is hard coded right now bins_per_shot = self.drops + self.bins num_shots = int(len(se...
s0lst1c3/eaphammer
local/hostapd-eaphammer/tests/hwsim/test_module_tests.py
Python
gpl-3.0
889
0.00225
# Module tests # Copyright (c) 2014, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import os import time import hostapd def test_module_wpa_supplicant(dev, apdev, params): """wpa_supplicant module
tests""" if "OK" not in dev[0].global_request("MODULE_TESTS"): raise Exception("Module tests failed") # allow eloop test to complete time.sleep(0.75) dev[0].relog() with open(os.path.join(params['logdir'], 'log0'), 'r') as f: res = f.read() if "FAIL - should not have called ...
"""hostapd module tests""" hapd_global = hostapd.HostapdGlobal() if "OK" not in hapd_global.ctrl.request("MODULE_TESTS"): raise Exception("Module tests failed")
MorseDecoder/Morse-Code-Project
Input/User Input.py
Python
gpl-3.0
1,443
0.11088
import winsound #Import winsound library for winsound.Beep() function import time #Import time library for time.sleep() function morse_code = { #Dictionary containing each letter and their respective morse code "a" : [0,1], "b" : [1,0,0,0], "c" : [1,0,1,0], "d" : [1,0,0], "e" : [0], "f" : [0,0,1,0], "g" : [1,1,0...
nt][innercount] ==
0: winsound.Beep(1000, 500) #Plays a dot time.sleep(0.2) elif morse_buffer[count][innercount] == 1: winsound.Beep(1000, 980) #Plays a dash time.sleep(0.1) elif morse_buffer[count][innercount] == 2: time.sleep(2.1) #Space innercount += 1 innercount = 0 count += 1 time.sleep(1)
billiob/papyon
papyon/media/conference.py
Python
gpl-2.0
12,851
0.003735
# -*- coding: utf-8 -*- # # papyon - a python client library for Msn # # Copyright (C) 2009 Collabora Ltd. # # 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 2 of the License, or #...
= conference.new_session(media_type) self.fssession.set_codec_preferences(build_codecs(self._stream.name)) self.fsstream = self.fssession.new_stream(participant, self._stream.direction, "nice", params) self.fsstream.connect("src-pad-added", self.on_src_pad_added, pipeline) ...
lf._stream.name) pipeline.add(source) source.get_pad("src").link(self.fssession.get_property("sink-pad")) pipeline.set_state(gst.STATE_PLAYING) def on_stream_closed(self): del self.fsstream def on_remote_candidates_received(self, candidates): candidates = filter(lambda ...
agustinhenze/logbook.debian
logbook/__init__.py
Python
bsd-3-clause
1,683
0.000594
# -*- coding: utf-8 -*- """ logbook ~~~~~~~ Simple logging library that aims to support desktop, command line and web applications alike. :copyright: (c) 2010 by Armin Ronacher, Georg Brandl. :license: BSD, see LICENSE for more details. """ import os from logbook.base import LogRecord, Logger...
DEBUG, NOTSET, \ set_datetime_format from logbook.handlers import Handler, StreamHandler, FileHandler, \ MonitoringFileHandler, StderrHandler, RotatingFileHandler, \ TimedRotatingFileHandler, TestHandler, MailHandler, GMailHandler, SyslogHandler, \ NullHandler, NTEventLogHandler, create_syshandler,...
, \ LimitingHandlerMixin, WrapperHandler, FingersCrossedHandler, \ GroupHandler __version__ = '0.10.0' # create an anonymous default logger and provide all important # methods of that logger as global functions _default_logger = Logger('Generic') _default_logger.suppress_dispatcher = True debug = _default_l...
Sergiopopoulos/IV-perezmolinasergio
iaas/fabfile.py
Python
gpl-3.0
330
0.027273
#
coding: utf-8 from fabric.api import * def instalacion(): run('sudo git clone https://github.com/Sergiopopoulos/IV-perezmolinasergio') run('cd IV-perezmolinasergio && sudo pip install -r requirements.txt') def ejecucion(): run('cd IV-perezmolinasergio && nohup sudo -E gunicorn app.wsgi -b 0.0.0.0:80 &', pty=Fal...
vedujoshi/tempest
tempest/tests/lib/services/identity/v3/test_endpoint_groups_client.py
Python
apache-2.0
5,681
0
# Copyright 2017 AT&T Corporation. # 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 require...
eate_endpoint_group, 'tempest.lib.common.rest
_client.RestClient.post', self.FAKE_CREATE_ENDPOINT_GROUP, bytes_body, status=201, name="FAKE_ENDPOINT_GROUP", filters={'service_id': "1"}) def _test_show_endpoint_group(self, bytes_body=False): self.check_service_client_function( self...
cigroup-ol/metaopt
docs/_extensions/numpy_ext/docscrape_sphinx.py
Python
bsd-3-clause
7,924
0.001641
import re, inspect, textwrap, pydoc import sphinx from docscrape import NumpyDocString, FunctionDoc, ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots = config.get('use_plots', False) NumpyDoc...
self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Returns', 'Raises'): out += self._str_param_list(param_list) out += self._str_warnings() out += self._str_see_also(func_role) out += self._str_section('Notes') out += sel...
self._str_examples() for param_list in ('Attributes', 'Methods'): out += self._str_member_list(param_list) out = self._str_indent(out,indent) return '\n'.join(out) class SphinxFunctionDoc(SphinxDocString, FunctionDoc): def __init__(self, obj, doc=None, config={}): self.u...
eliadl/talks
20170613-mock/code/ggee/tests/test_i18n.py
Python
gpl-3.0
2,534
0.002815
# -*- coding: utf-8 -*- try: from unittest import mock except ImportError: import mock from guessing import i18n @mock.patch.dict('guessing.i18n.environ', LC_MESSAGES='he_IL') def test_lang_lc_message_he(): assert i18n.lang() == 'he' def test_lang_default(): with mock.patch.dict('guessing.i18n.envi...
test_is_lang_en(): with mock.patch.dict('guessing.i18n.environ', dict(LC_ALL='en_US',
LC_MESSAGES='en_US', LANG='en_US')): assert i18n.lang() == 'en' @mock.patch('guessing.i18n.lang') def test_T_default(mock_lang): mock_lang.return_value = 'C' assert i18n.T('hello') == 'hello' @mock.patch('guessing.i18n.CLIENT') #, spec=mock.create_autospec...
odoo-arg/odoo_l10n_ar
l10n_ar_account_payment/tests/test_account_payment.py
Python
agpl-3.0
15,283
0.003075
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms o
f 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. # # This
program 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. # # You should have received a copy of the GNU General Public License # ...
SylvainCecchetto/plugin.video.catchuptvandmore
plugin.video.catchuptvandmore/resources/lib/skeletons/cn_replay.py
Python
gpl-2.0
1,406
0.000711
# -*- coding: utf-8 -*- """ Catch-up TV & More Copyright (C) 2016 SylvainCecchetto
This file is part of C
atch-up TV & More. Catch-up TV & More 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 the License, or (at your option) any later version. Catch-up TV & More is distributed...
ShanghaitechGeekPie/LBlogger
LBlogger/LBlogger/part_upload.py
Python
gpl-2.0
809
0.069221
#coding=utf-8 import string, random, time from django.http import Http404 from django.shortcuts import render_to_response from django.template import RequestContext from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User import os def upload(request): file_path='%s_' %(st...
ES['upload_file'].name,'wb+') for chunk in r
equest.FILES['upload_file'].chunks(): destination.write(chunk) destination.close() return '/download/'+file_path+request.FILES['upload_file'].name except: return 'error'
TheDSCPL/SSRE_2017-2018_group8
Projeto/Python/cryptopy/crypto/keyedHash/hmacHash.py
Python
mit
3,613
0.014669
# -*- coding: utf-8 -*- """ hmacHash.py Implemention of Request for Comments: 2104 HMAC: Keyed-Hashing for Message Authentication HMAC is a mechanism for message authentication using cryptographic hash functions. HMAC can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, i...
== None : raise 'no key defined' return self.H_outer(self.k_xor_opad+self.H.digest()) from crypto.hash.sha1Hash import SHA1 class HMAC_SHA1(HMAC): """ Predefined HMAC built on SHA1 """ def __init__(self, key = None): """ optionally initialize with key """ HMAC.__init__(self,...
key) from crypto.hash.md5Hash import MD5 class HMAC_MD5(HMAC): """ Predefined HMAC built on SHA1 """ def __init__(self, key = None): """ optionally initialize with key """ HMAC.__init__(self,MD5,key)
chrys87/fenrir
src/fenrirscreenreader/commands/commands/quit_fenrir.py
Python
lgpl-3.0
552
0.016304
#!/bin/python # -*- coding: utf-8 -*- # Fenrir TTY
screen reader # By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug class command(): def __init__(self): pass def initialize(self, environment): self.env = environment def shutdown(self): pass def getDescription(self): retur...
.stopMainEventLoop() def setCallback(self, callback): pass
makcedward/nlpaug
nlpaug/augmenter/spectrogram/loudness.py
Python
mit
1,919
0.00938
import numpy as np from nlpaug.augmenter.spectrogram import SpectrogramAugmenter from nlpaug.util import Action import nlpa
ug.model.spectrogram as nms class LoudnessAug(SpectrogramAugmenter): """ Augmenter that change loudness on mel spectrogram by random values. :param tuple zone: Default value is (0.2, 0.8). Assign a zone for augmentation. By default, no any augmentation will be applied in first 20% and last 20% o...
:param float coverage: Default value is 1 and value should be between 0 and 1. Portion of augmentation. If `1` is assigned, augment operation will be applied to target audio segment. For example, the audio duration is 60 seconds while zone and coverage are (0.2, 0.8) and 0.7 respectively. 42 ...
esthermm/odoomrp-wip
mrp_repair_full_editable/models/mrp_repair.py
Python
agpl-3.0
755
0
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, s
ee __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api class MrpRepair(models.Model): _inherit = 'mrp.repair' fees_lines = fields.One2many(readonly=False) operations = fields.O
ne2many(readonly=False) @api.multi @api.onchange('product_id') def onchange_product_id(self, product_id=None): res = super(MrpRepair, self).onchange_product_id(product_id) if not self.partner_id: res['value']['pricelist_id'] = self.env.ref('product.list0') return res
tdyas/pants
src/python/pants/backend/codegen/thrift/java/register.py
Python
apache-2.0
874
0.002288
# Copyri
ght 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). """Generate Java targets from Thrift. See https://thrift.apache.org. """ from pants.backend.codegen.thrift.ja
va.apache_thrift_java_gen import ApacheThriftJavaGen from pants.backend.codegen.thrift.java.java_thrift_library import ( JavaThriftLibrary as JavaThriftLibraryV1, ) from pants.backend.codegen.thrift.java.target_types import JavaThriftLibrary from pants.build_graph.build_file_aliases import BuildFileAliases from pan...
anconaesselmann/ClassesAndTests
classes_and_testsTest/DocumentationFromUnitTestsTestData/DataSet4_py_ClassFileTest.py
Python
mit
1,206
0.008292
class DataClassFileTests(): def test_functionName1_test_case_4(self): # Given: First test function line one obj = new aClass() expected = "Some result" parameter1 = False # When: First test function line two result = obj.functionName1(parameter1) ...
st_function(self): # Given: Second test function Given: line obj = new aClass() expected = "Some result" parameter1 = False # When: Second test function When: line result = obj.functionName1(parameter1) # Then: Second test function Then:
line this->assertEquals(expected, result) def test_functionName1_third_test_function(self): # Given: Last test function third from last line obj = new aClass() expected = "Some result" parameter1 = False # When: Last test function second from last line r...
C4ptainCrunch/info-f-309
webview/documents/migrations/0003_auto_20160417_0946.py
Python
agpl-3.0
541
0.001848
# -*- co
ding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-17 09:46 from __future__ import unicode_literals from django.db import migrations, models import documents.models class Migration(migrations.Migration): dependencies = [ ('documents', '0002_auto_20160417_0749'), ] operations = [ mig...
d( model_name='document', name='zipFile', field=models.FileField(upload_to='uploads/', validators=[documents.models.validate_file_extension]), ), ]
mzdaniel/oh-mainline
vendor/packages/Django/tests/modeltests/properties/models.py
Python
agpl-3.0
567
0.001764
""" 22. Using properties on models Use properties on models just like on any other Python object. """ from django.d
b import models class Person(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) def _get_full_name(self): return "%s %s" % (self.first_name, self.la
st_name) def _set_full_name(self, combined_name): self.first_name, self.last_name = combined_name.split(' ', 1) full_name = property(_get_full_name) full_name_2 = property(_get_full_name, _set_full_name)
ediston/energi
qa/pull-tester/rpc-tests.py
Python
mit
8,724
0.003324
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Run Regression Test Suite This module calls down into individual test cases via subprocess. It will ...
LE_UTILS=0 if 'ENABLE_ZMQ' not in vars(): ENABLE_ZMQ=0 ENABLE_COVERAGE=0 #Create a set to store arguments and create the passOn string opts = set() passOn = "" p = re.compile("^--") bold = ("","") if (os.name == 'posix'): bold = ('\033[0m', '\033[1m') for arg in sys.argv[1:]: if arg == '--coverage': ...
os.environ: os.environ["DASHD"] = buildDir + '/src/dashd' + EXEEXT if "DASHCLI" not in os.environ: os.environ["DASHCLI"] = buildDir + '/src/dash-cli' + EXEEXT if EXEEXT == ".exe" and "-win" not in opts: # https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 # https://githu...
thamada/tool-private
commi.py
Python
mit
5,969
0.005726
#!/usr/bin/env python2.7 # -*- coding:utf-8 -*- # # Copyright (c) 2017 by Tsuyoshi Hamada. All rights reserved. # import os import logging as LG import random import commands import shelve import pickle import sys import hashlib import re as REGEXP # -- set encode for your terminal -- config_term_encode = 'euc-jp' # ...
pend(u"そして") result.append(u"かくされた悪を注意深くこばむこと") # -- result.append(u"生きているということ") result.append(u"いま生きているということ") result.append(u"泣けるということ") result.append(u"笑えるということ") result.append(u"怒れるということ") result.append(u"自由ということ") # -- result.append(u"生きているということ") result.append(u"いま生きてい...
まぶらんこがゆれているということ") result.append(u"いまいまがすぎてゆくこと") # -- result.append(u"生きているということ") result.append(u"いま生きてるということ") result.append(u"鳥ははばたくということ") result.append(u"海はとどろくということ") result.append(u"かたつむりははうということ") result.append(u"人は愛するということ") result.append(u"あなたの手のぬくみ") result.append(u"い...
Xunius/evernote2zim
lib/markdown2zim.py
Python
gpl-3.0
43,705
0.004896
#!/usr/bin/python2 # -*- coding: utf-8 -*- """Convert markdown to zim wiki syntax. Stripped and modified from markdown2.py Syntax converted: type Markdown -> Zim ---------------------------------------------------- Heading1 # heading ===== heading ===== Head...
return text _detab_re = re.compile(r'(.*?)\t', re.M) def _detab_sub(self, match): g1 = match.group(1) return g1 + (' ' * (self.tab_width - len(g1) % self.tab_width)) def _detab(self, text): r"""Remove (leading?) tabs from a file. >>> m = Markdown() ...
' foo' >>> m._detab(" foo") ' foo' >>> m._detab(" foo\n\tbar\tblam") ' foo\n bar blam' """ if '\t' not in text: return text return self._detab_re.subn(self._detab_sub, text)[0] def _strip_link_definitions(self, text)...
cortext/crawtextV2
~/venvs/crawler/lib/python2.7/site-packages/setuptools/command/easy_install.py
Python
mit
74,243
0.002667
#!/usr/bin/env python """ Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://pythonhosted.org/setuptools/easy_install.html """ impo...
tive_opt = {'always-unzip': 'zip-ok'} create_index = PackageIndex def initialize_options(self): if site.ENABLE_USER_SITE: whereami = os.path.abspath(__file__) self.user = whereami.sta
rtswith(site.USER_SITE) else: self.user = 0 self.zip_ok = self.local_snapshots_ok = None self.install_dir = self.script_dir = self.exclude_scripts = None self.index_url = None self.find_links = None self.build_directory = None self.args = None ...
mvaled/sentry
src/sentry/grouping/strategies/security.py
Python
bsd-3-clause
1,936
0.002583
from __future__ import absolute_import from sentry.grouping.component import GroupingComponent from sentry.grouping.strategies.base import strategy def _security_v1(reported_id, obj): return GroupingComponent( id=reported_id, values=[ GroupingComponent(id="salt", values=[reported_id])...
re=1002) def hpkp_v1(hpkp_interface, **meta): return _security_v1("hpkp", hpkp_interface) @strategy(id="csp:v1", interfaces=["csp"], variants=["default"], score=1003) def csp_v1(csp_interface, **meta): violation_component = GroupingComponent(id="violation")
uri_component = GroupingComponent(id="uri") if csp_interface.local_script_violation_type: violation_component.update(values=["'%s'" % csp_interface.local_script_violation_type]) uri_component.update( contributes=False, hint="violation takes precedence", values...
akash1808/oslo.log
oslo_log/fixture/__init__.py
Python
apache-2.0
665
0
# 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 in writing, softw...
se for the specific language governing permissions and limitations # under the License. from .logging_error import get_logging_handle_error_fixture from .setlevel import SetLog
Level
kate-harrison/west
documentation/conf.py
Python
gpl-2.0
9,688
0.008567
# -*- coding: utf-8 -*- # # Whitespace Evaluation SofTware documentation build configuration file, created by # sphinx-quickstart on Wed Jul 9 13:12:12 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
onal_pa
ges = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink =...
ayemos/osho
akagi/utils.py
Python
mit
414
0
imp
ort re import six from six import BytesIO import gzip def gzip_decompress(data): if six.PY2: in_io = BytesIO() in_io.write(data.read()) in_io.seek(0) return BytesIO(gzip.GzipFile(fileobj=in_io, mode='rb').read()) else: return BytesIO(gzip.decompress(data.read())) def...
path))
bladekp/DroniadaDjangoDronekitAPP
app/maps/urls.py
Python
mit
339
0.00295
from django.conf.urls
import url from . import views urlpatterns = [ url(r'^$', views.render_map, name='render_map'), url(r'^get
Data/$', views.get_data, name='get_data'), url(r'^saveDroneData/$', views.save_drone_data, name='save_drone_data'), url(r'^saveBeaconData/$', views.save_beacon_data, name='save_beacon_data'), ]
jaidevd/scikit-learn
sklearn/svm/tests/test_svm.py
Python
bsd-3-clause
35,876
0.000167
""" Testing for Support Vector Machine module (sklearn.svm) TODO: remove hard coded numerical results when possible """ import numpy as np import itertools from numpy.testing import assert_array_equal, assert_array_almost_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_allclose fro...
seeded (by calling `srand`), hence # we should get deterministic results (assuming that there is no other # thread calling this wrapper calling `srand` concurrently). pred2 = svm.libsvm.cross_validation(iris.data, iris.target.astype(np.float64), 5, ...
h a precomputed kernel. # We test it with a toy dataset and with iris. clf = svm.SVC(kernel='precomputed') # Gram matrix for train data (square matrix) # (we use just a linear kernel) K = np.dot(X, np.array(X).T) clf.fit(K, Y) # Gram matrix for test data (rectangular matrix) KT = np.dot(...
alangwansui/mtl_ordercenter
openerp/addons/001_qingjia/qingjia_calendar.py
Python
agpl-3.0
2,648
0.047205
#!usr/bin/python # -*- coding:utf-8 -*- from osv import osv,fields import time from datetime import datetime from dateutil import rrule class qingjia_calendar(osv.osv): _name='qingjia.calendar' _columns={ 'start_date':fields.datetime('start_date'), 'end_date':fields.datetime('end...
self.write(cr,uid,ids,{'calendar_line_ids':datas}) return True qingjia_calendar() class qingjia_calendar_line(osv.osv): _name='qingjia.calendar.line' _columns={ 'qingjia_calendar_id':fields.many2one('qingjia.calendar','qingjia_calendar_id'),
'name':fields.char('type',size=64), 'date':fields.datetime('date'), 'type':fields.selection([('work','Work'),('holiday','Holiday')],'type',), 'state':fields.selection([('arrange','arrange'),('not arrange','not arrange')],'state'), 'is_holiday':fields.boolean('is_holida...
yhat/ggplot
ggplot/themes/theme_xkcd.py
Python
bsd-2-clause
1,582
0.001264
from __future__ import (absolute_import, division, print_function, unicode_literals) import matplotlib as mpl import matplotlib.pyplot as plt from .theme import theme_base class theme_xkcd(theme_base): """ xkcd theme The theme internaly uses the settings from pyplot.xkcd(). ""...
# deepcopy rais
es an error for objects that are drived from or # composed of matplotlib.transform.TransformNode. # Not desirable, but probably requires upstream fix. # In particular, XKCD uses matplotlib.patheffects.withStrok # -gdowding result.__dict__["...
massimo-nocentini/master-thesis
sympy/riordan_avoiding_patterns.py
Python
mit
2,308
0.009532
from sage.misc.functional import symbolic_sum from sage.calculus import var def from_pattern_family_10j_1(j, variable=var('t')): """ This function allow to build a pair of functions (d, h) to build a Riordan array for the pattern family (10)**j1, for a given j. """ def make_sum(from_index): ...
from_index, to) i = var('i') d = make_sum(from_index=0)/sqrt( 1-2*make_sum(from_index=1)-3*make_sum(from_index=1)**2) h = (make_sum(from_index=0) - sqrt( 1-2*make_sum(from_index=1)-3*make_sum(from_index=1)**2))/(2*make_sum( from_index=0, to=j-1)) return d,h def from_pa...
')): """ This function allow to build a pair of functions (d, h) to build a Riordan array for the pattern family (10)**j1, for a given j. """ d = 1/sqrt(1-4*variable + 2*variable**j + variable**(2*j)) h = (1 + variable**j - sqrt(1-4*variable + 2*variable**j + variable**(2*j)))/2 retu...
ervinyang/tutorial_zookeeper
zookeeper-trunk/src/contrib/zkpython/src/test/get_set_test.py
Python
mit
8,748
0.00583
#!/usr/bin/python # # 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 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 writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and...
wronk/mne-python
mne/viz/raw.py
Python
bsd-3-clause
33,845
0
"""Functions to plot raw M/EEG data """ from __future__ import print_function # Authors: Eric Larson <larson.eric.d@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.fi> # # License: Simplified BSD import copy from functools import partial import numpy as np from ..externals.six import string_types fro...
background. color : dict | color object | None
Color for the data traces. If None, defaults to:: dict(mag='darkblue', grad='b', eeg='k', eog='k', ecg='m', emg='k', ref_meg='steelblue', misc='k', stim='k', resp='k', chpi='k') bad_color : color object Color to make bad channels. event_color : color o...
n0tr00t/Sreg
sreg.py
Python
mit
6,889
0.002177
#!/usr/bin/env python # encoding: utf-8 # author: www.n0tr00t.com import sys import glob import json import chardet import requests import urlparse import argparse import multiprocessing from common.color import * from common.output import * from collections import OrderedDict def check(plugin, passport, passport_t...
!".format(plugin['request']['name']) def main(): parser = argparse.ArgumentParser(description="Check how many Platforms the User registered.") parser.add_argument("-u", action="store", dest="user") parser.add_argument("-e", action="store", dest="email") parser.add_argument("-c", action="store", dest="...
"Y88b.888P" d8P Y8bd88P"88b "888888 88888888888 888 Y88b d88P888 Y8b. Y88b 888 "Y8888P" 888 "Y8888 "Y88888 888 Y8b d88P "Y88P" ''' all_argument = [parser_argument.cellphone, pa...
derblub/pixelpi
menu.py
Python
mit
6,460
0.002632
import time import thread import pygame import input from menu.menuitems import create_menu_items from screenfactory import create_screen from server import interface from helpers import * os.chdir(os.path.dirname(os.path.realpath(__file__))) S = Settings() S.load() class Menu(object): def __init__(self, scree...
[(start + x - int(size * self.offset) + 16) % 16][15] = Color(int(80 * self.brightness), int(80 * self.brightness), int(80 * self.brightne...
offset * 12), 8, self.zoom, self.items[self.index].get_preview()) if self.dir != 0: self.draw_on_screen(8 + int(self.offset * 12) - self.dir * 12, 8, self.zoom, self.items[(self.index - self.dir + len(self.items)) % len(self.items)].get_preview()) self.scree...
antoinecarme/pyaf
tests/artificial/transf_Anscombe/trend_MovingMedian/cycle_12/ar_/test_artificial_32_Anscombe_MovingMedian_12__20.py
Python
bsd-3-clause
266
0.086466
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process
_artificial_dataset as art art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "Anscombe", sigma = 0.0, exog
_count = 20, ar_order = 0);
ContinuumIO/ashiba
enaml/enaml/qt/qt_color_dialog.py
Python
bsd-3-clause
5,551
0.001441
#------------------------------------------------------------------------------ # Copyright (c) 2013, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------------------------------------------------...
buttons option on the underlying widget. """ widget = self.widget
opt = widget.options() if show: opt &= ~QColorDialog.NoButtons else: opt |= QColorDialog.NoButtons widget.setOptions(opt)
xiilei/pytools
mitm-savecookies.py
Python
apache-2.0
702
0.011396
#!/usr/bin/env python3 #
-*- coding: utf-8 -*- # sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 # sudo sysctl -w net.ipv4.ip_forward=1 from libmproxy.protocol.http import decoded def response(context, flow): with decoded(flow.response): # automatically decode gzipped responses. headers =...
eturn True with open('savecookies','a') as f: f.write(','.join(host)) f.write("\n") f.write(';'.join(cookies)) f.write("\n\n")
NicolasLM/sauna
sauna/__init__.py
Python
bsd-2-clause
15,099
0
from collections import namedtuple import threading import queue from logging import getLogger import time import socket import os import textwrap import signal import importlib import pkgutil import re import sys import glob import functools from concurrent.futures import ThreadPoolExecutor from sauna import plugins,...
file_p
ath = os.path.join(path, 'sauna-sample.yml') with open(file_path, 'w') as f: f.write(sample) return file_path @property @functools.lru_cache() def hostname(self): # socket.getfqdn can be a very long call # make sure to only call it when absolutely necessary ...
quaddra/engage
python_pkg/engage/engine/create_distribution.py
Python
apache-2.0
4,538
0.003967
import sys import tarfile import os import os.path from optparse import OptionParser import fixup_python_path from engage.engine.engage_file_layout import get_engine_layout_mgr from engage.engine.cmdline_script_utils import add_standard_cmdline_options, process_standard_options from engage.utils.log_setup import se...
path of generated archive file (defaults to <deployment_home>/engage/engage-dist.tar.gz)") parser.add_option("--include_test-data", dest="include_test_data", default=False, help="Include the engage/test_data
directory, if present") add_standard_cmdline_options(parser, uses_pw_file=False, running_deployment=False) (options, args) = parser.parse_args(args=argv) (file_layout, dh) = process_standard_options(options, parser, allow_over...
pythononwheels/pow_clean
start/stuff/comment.py
Python
mit
1,289
0.013964
# # Model Comment # from sqlalchemy import Column, Integer, String, Boolean, Sequence from sqlalchemy import BigInteger, Date, DateTime, Float, Numeric from pow_comments.powlib import relation from pow_comments.sqldblib import Base #@relation.has_many("<plural_other_models>") @relation.is_tree() @relation.setup_schem...
put your column definition here: # # # sqlalchemy classic style # which offer you all sqlalchemy options # #title = Column
(String(50)) #text = Column(String) # # or the new (cerberus) schema style # which offer you immediate validation # schema = { # string sqltypes can be TEXT or UNICODE or nothing 'author': { 'type': 'string', 'maxlength' : 35, # the sql "sub"key let...
harnasproject/harnas
harnas/userprofile/forms.py
Python
agpl-3.0
409
0
from django im
port forms from django.contrib.auth.models import User from harnas.userprofile.models import UserProfile class UserProfileEditForm(forms.ModelForm): class Meta: model = UserProfile fields = ('organization', 'personal_page', 'show_email', 'show_age') class UserFieldsForm(forms.ModelForm): cla...
ame')
tiborsimko/analysis-preservation.cern.ch
cap/modules/deposit/api.py
Python
gpl-2.0
22,465
0
# -*- coding: utf-8 -*- # # This file is part of CERN Analysis Preservation Framework. # Copyright (C) 2016 CERN. # # CERN Analysis Preservation Framework 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...
port (get_existing_or_register_role, get_existing_or_register_user) from .errors import (DepositValidationError, FileUploadError, UpdateDepositPermissionsError) from .fetchers import cap_deposit_fetcher from .minters import cap_deposit_minter from .permissions i...
dateDepositPermission) _datastore = LocalProxy(lambda: current_app.extensions['security'].datastore) current_jsonschemas = LocalProxy( lambda: current_app.extensions['invenio-jsonschemas'] ) PRESERVE_FIELDS = ( '_deposit', '_buckets', '_files', '_experiment', '_access', 'general_title', ...
Azure/azure-sdk-for-python
sdk/applicationinsights/azure-applicationinsights/azure/applicationinsights/models/events_application_info_py3.py
Python
mit
917
0.002181
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
o(Model): """Application info for an event result. :param version: Version of the application :type version: str """ _attribute_map = { 'version': {'key': 'version', 'type': 'str'}, } def __init__(self, *, version: str=None, **kwargs) -> None: super(EventsApplicationInfo, ...
self.version = version
mattmcd/PyAnalysis
scripts/dsfs_chapter01.py
Python
apache-2.0
3,086
0.021063
# 'Data Science from Scratch' Chapter 1 exampl # Create list of users userNames = ["Hero", "Dunn", "Sue", "Chi", "Thor", "Clive", "Hicks", "Devin", "Kate", "Klein"] users = [] for ind, name in enumerate( userNames ): users.append( {"id": ind, "name": name}) # Helper function to get id get_id = lambda userlist...
"Storm", "Cassandra"], 1: ["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres", "Python", "scikit-learn", "scipy"], 2: ["numpy", "statsmodels", "pandas"], 3: ["R", "Python", "statistics", "regression", "probability"], 4: ["machine learning", "regression", "decision trees", "libsvm"], 5: ["Python", "R", "Ja...
"Mahout", "neural networks"], 8: ["neural networks", "deep learning", "Big Data", "artificical intelligence"], 9: ["Hadoop", "java", "MapReduce", "Big Data"]} # Invert to look up from interest to list of user ids from collections import defaultdict users_dict = defaultdict(list) for k in interests_dict.keys()...
draekko-rand/nik_on_gimp
plug-ins/NIK-HDREfexPro2.py
Python
apache-2.0
4,466
0.016346
#!/usr/bin/env python ''' NIK-HDREfexPro2.py Mod of ShellOut.py focused on getting Google NIK to work. ShellOut call an external program passing the active layer as a temp file. Tested only in Ubuntu 16.04 with Gimp 2.9.5 (git) with Nik Collection 1.2.11 Author: Erico Porto on top of the work of Rob Antonishen Benoi...
_main(image, drawable, visible): pdb.gimp_image_undo_group_start(image) # Copy so the save operations doesn't affect the original if visible == 0: # Save in temporary. Note: empty user entered file name temp = pdb.gimp_image_get_active_drawable(image) else:
# Get the current visible temp = pdb.gimp_layer_new_from_visible(image, image, "HDR Efex") image.add_layer(temp, 0) buffer = pdb.gimp_edit_named_copy(temp, "ShellOutTemp") #save selection if one exists hassel = pdb.gimp_selection_is_empty(image) == 0 if hassel: savedsel = pdb.gimp_selection_save(...
cg31/tensorflow
tensorflow/contrib/distributions/python/kernel_tests/operator_pd_full_test.py
Python
apache-2.0
2,294
0.008718
# Copyright 2016 The TensorFlow Authors. 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 applica...
== from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.contrib.distributions.python.ops import operator_pd_full class OperatorPDFullTest(tf.test.TestCase): # The only method needing checked (becaus...
self._rng = np.random.RandomState(42) def _random_positive_def_array(self, *shape): matrix = self._rng.rand(*shape) return tf.batch_matmul(matrix, matrix, adj_y=True).eval() def testPositiveDefiniteMatrixDoesntRaise(self): with self.test_session(): matrix = self._random_positive_def_array(2, 3,...
dbrattli/RxPY
tests/test_observable/test_windowwithcount.py
Python
apache-2.0
3,069
0.002607
import unittest from rx.observable import Observable from rx.testing import TestScheduler, ReactiveTest from rx.disposables import Disposable, SerialDisposable on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe subscribed = React...
0, 5), on_next(350, 6), on_next(380, 7), on_next(420, 8), on_next(470, 9), on_error(600, ex)) def create(): def selector(w, i): def mapping(x): return "%s %s" % (i, x) return w.map(mapping)
return xs.window_with_count(3, 2).map(selector).merge_observable() results = scheduler.start(create) results.messages.assert_equal(on_next(210, "0 2"), on_next(240, "0 3"), on_next(280, "0 4"), on_next(280, "1 4"), on_next(320, "1 5"), on_next(350, "1 6"), on_next(350, "2 6"), on_next(380, "2 7"), ...
christianurich/VIBe2UrbanSim
3rdparty/opus/src/opus_core/hierarchical_choice_model.py
Python
gpl-2.0
12,765
0.010576
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from numpy import zeros, concatenate, array, where, ndarray, sort, ones, all from opus_core.misc import unique from opus_core.choice_model import ChoiceModel from opus_core.samplers.constants import NO...
def create_nested_and_tree_structure(self, nested_structure=None, stratum=None, **kwargs): strat = stratum if isinstance(strat, str): strat = self.choice_set.compute_variables(strat, dataset_pool=self.dataset_pool) elif strat is not None: strat = array(strat) ...
rger than 0 if nested_structure is None: if strat is None: raise StandardError, "Either 'nested_structure' or 'stratum' must be given." sampler_size = None if self.sampler_class is not None: sampler_size = self.sampler_size self.nes...
ryanss/holidays.py
holidays/countries/mozambique.py
Python
mit
2,356
0
# -*- coding: utf-8 -*- # python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio....
ival = carnival - rd(days=1) self[carnival] = "Carnaval" self[date(year, FEB, 3)] = "Dia dos Heróis Moçambicanos" self[date(year, APR, 7)] = "Dia da Mulher Moçambicana" self[date(year, MAY, 1)] = "Dia Mundial do Trabalho" self[date(year, JUN, 25)] = "Dia da I...
4)] = "Dia da Paz e Reconciliação" self[date(year, DEC, 25)] = "Dia de Natal e da Família" # whenever a public holiday falls on a Sunday, # it rolls over to the following Monday for k, v in list(self.items()): if self.observed and year > 1974: ...
w4/belle
dave/modules/pollen.py
Python
gpl-3.0
1,618
0.003708
# -*- coding: utf-8 -*- """Get the pollen count for a UK postcode.""" import dave.module from bs4 import BeautifulSoup from requests import get from twisted.words.protocols.irc import assembleFormattedText, attributes as A import dave.config @dave.module.help("Syntax: pollen [first part of postcode]. Get the forecast...
r UK postcodes.")
@dave.module.command(["pollen"], "(([gG][iI][rR] {0,}0[aA]{2})|((([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y]?[0-9][0-9]?)|(([a-pr-uwyzA-PR-UWYZ][0-9][a-hjkstuwA-HJKSTUW])|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][abehmnprv-yABEHMNPRV-Y])))))$") @dave.module.priority(dave.module.Priority.HIGHEST) @dave.module.ratelimit(1, 1) de...
google-business-communications/bm-snippets-python
send-message-suggested-action-dial.py
Python
apache-2.0
3,227
0.007127
## Copyright 2022 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 agreed to in ...
ssmessages.businessmessages_v1_messages import BusinessMessagesSuggestedAction from businessmessages.businessmessages_v1_messages import BusinessMessagesSuggestion from oauth2client.service_account import ServiceAccountCredentials # Edit the values below: pa
th_to_service_account_key = './service_account_key.json' conversation_id = 'EDIT_HERE' credentials = ServiceAccountCredentials.from_json_keyfile_name( path_to_service_account_key, scopes=['https://www.googleapis.com/auth/businessmessages']) client = bm_client.BusinessmessagesV1(credentials=credentials) repre...
mdworks2016/work_development
Python/05_FirstPython/Chapter9_WebApp/fppython_develop/lib/python3.7/site-packages/zope/interface/tests/test_registry.py
Python
apache-2.0
109,233
0.00162
############################################################################## # # Copyright (c) 2001, 2002, 2009 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution...
eError, comp.registerUtility, component=_to
_reg, factory=_factory) def test_registerUtility_w_component(self): from zope.interface.declarations import InterfaceClass from zope.interface.interfaces import Registered from zope.interface.registry import UtilityRegistration class IFoo(InterfaceClass): pass i...
axinging/chromium-crosswalk
third_party/WebKit/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
Python
bsd-3-clause
3,090
0.000647
# Copyright (c) 2011 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
ockUser() self.platform = MockPlatformInfo() if os_name:
self.platform.os_name = os_name if os_version: self.platform.os_version = os_version # FIXME: Should this take pointers to the filesystem and the executive? self.workspace = MockWorkspace() self.stdin = StringIO() self.stdout = StringIO() self.stderr = S...
matpow2/gamedev-old
chowdren/project.py
Python
bsd-2-clause
2,297
0.002177
# Copyright (c) Mathias Kaerlev # See LICENSE for details. import os from chowdren.image import Image from chowdren.common import IDPool from chowdren.object import get_objects from chowdren.data import CodeData class ProjectManager(object): base_dir = None def __init__(self, directory = None): self....
'wb') as fp: self.data.save(fp) def set_directory(self, directory): self.base_dir = directory def get_image_file(self, ref): return os.path.join(self.base_dir, '%s.png' % ref) def get_image(self, ref): if ref in self.images: return self.images[ref] ...
self.image_ids.pop(ref) image.id = ref self.images[ref] = image return image def save_image(self, image): if image.id is None: image.id = self.image_ids.pop() self.images[image.id] = image image.save(self.get_image_file(image.id)) return ...