commit
stringlengths 40
40
| subject
stringlengths 4
1.73k
| repos
stringlengths 5
127k
| old_file
stringlengths 2
751
| new_file
stringlengths 2
751
| new_contents
stringlengths 1
8.98k
| old_contents
stringlengths 0
6.59k
| license
stringclasses 13
values | lang
stringclasses 23
values |
---|---|---|---|---|---|---|---|---|
c5a2d916fa907aa15a425dedc405ecc0ae2ba668 | Add script to compare taxa from before and after filter step | ODoSE/odose.nl | compare_taxa.py | compare_taxa.py | #!/usr/bin/env python
"""Module to compare filtered and unfiltered taxa deduced from their respective trees to assert that they match."""
from divergence import parse_options
import logging as log
import sys
def fail(unfiltered_a, unfiltered_b, filtered_a, filtered_b):
"""Report error back to the user and exit with error code 1."""
def _log_error_and_print_stderr(msg, dictionary = None):
"""Both log an error and print it to sys.stderr"""
log.error(msg)
print >> sys.stderr, msg
if dictionary:
for key, value in dictionary.iteritems():
log.error('{0}\t{1}'.format(key, value))
print >> sys.stderr, '{0}\t{1}'.format(key, value)
_log_error_and_print_stderr('Unfiltered & filtered tree clusterings do not match!')
_log_error_and_print_stderr('Unfiltered taxon A:', unfiltered_a)
_log_error_and_print_stderr('Unfiltered taxon B:', unfiltered_b)
_log_error_and_print_stderr('Filtered taxon A:', filtered_a)
_log_error_and_print_stderr('Filtered taxon B:', filtered_b)
sys.exit(1)
def main(args):
"""Main function called when run from command line or as part of pipeline."""
usage = """
Usage: compare_taxa.py
--unfiltered-taxon-a=FILE genome IDs for taxon A as deduced from phylogenetic tree of unfiltered concatemers
--unfiltered-taxon-b=FILE genome IDs for taxon B as deduced from phylogenetic tree of unfiltered concatemers
--filtered-taxon-a=FILE genome IDs for taxon A as deduced from phylogenetic tree of filtered concatemers
--filtered-taxon-b=FILE genome IDs for taxon B as deduced from phylogenetic tree of filtered concatemers
"""
options = ['unfiltered-taxon-a', 'unfiltered-taxon-b', 'filtered-taxon-a', 'filtered-taxon-b']
unfiltered_a_file, unfiltered_b_file, filtered_a_file, filtered_b_file = parse_options(usage, options, args)
#Parse file containing RefSeq project IDs to extract RefSeq project IDs
with open(unfiltered_a_file) as read_handle:
unfiltered_a = dict((line.split('\t')[0], line.strip().split('\t')[1]) for line in read_handle)
with open(unfiltered_b_file) as read_handle:
unfiltered_b = dict((line.split('\t')[0], line.strip().split('\t')[1]) for line in read_handle)
with open(filtered_a_file) as read_handle:
filtered_a = dict((line.split('\t')[0], line.strip().split('\t')[1]) for line in read_handle)
with open(filtered_b_file) as read_handle:
filtered_b = dict((line.split('\t')[0], line.strip().split('\t')[1]) for line in read_handle)
#Otherwise fail after
if unfiltered_a.keys()[0] in filtered_a:
if not (set(unfiltered_a.keys()) == set(filtered_a.keys())
and set(unfiltered_b.keys()) == set(filtered_b.keys())):
fail(unfiltered_a, unfiltered_b, filtered_a, filtered_b)
else:
if not (set(unfiltered_a.keys()) == set(filtered_b.keys())
and set(unfiltered_b.keys()) == set(filtered_a.keys())):
fail(unfiltered_a, unfiltered_b, filtered_b, filtered_a)
if __name__ == '__main__':
main(sys.argv[1:])
| mit | Python |
|
0b8d5794d2c5a1ae46659e02b65d1c21ffe8881d | Implement tests for temperature endpoint | BabyOnBoard/BabyOnBoard-API,BabyOnBoard/BabyOnBoard-API | babyonboard/api/tests/test_views.py | babyonboard/api/tests/test_views.py | import json
from rest_framework import status
from django.test import TestCase, Client
from django.urls import reverse
from ..models import Temperature
from ..serializers import TemperatureSerializer
client = Client()
class GetCurrentTemperatureTest(TestCase):
""" Test class for GET current temperature from API """
def setUp(self):
Temperature.objects.create(temperature=35)
def test_get_current_temperature(self):
response = client.get(reverse('temperature'))
temperature = Temperature.objects.order_by('date', 'time').last()
serializer = TemperatureSerializer(temperature)
self.assertEqual(response.data, serializer.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
class CreateNewTemperatureTest(TestCase):
""" Test class for saving a new temperature registry """
def setUp(self):
self.valid_payload = {
'temperature': 27.2
}
self.invalid_payload = {
'temperature': ''
}
def test_creat_valid_temperature(self):
response = client.post(
reverse('temperature'),
data=json.dumps(self.valid_payload),
content_type='application/json'
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_create_invalid_temperature(self):
response = client.post(
reverse('temperature'),
data=json.dumps(self.invalid_payload),
content_type='application/json'
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
| mit | Python |
|
fa1057d8b9a44bdf2ee0f667184ff5854fd0e8e1 | add rds backup | ministryofjustice/opg-docker,ministryofjustice/opg-docker | base/docker/scripts/rds-snapshot.py | base/docker/scripts/rds-snapshot.py | #!/usr/bin/env python
"""
Backup Amazon RDS DBs.
Script is expected to be run on EC2 VM within the same Amazon account as RDS.
Script reads tags of EC2 and then searches for all matching RDSes.
Where matching RDS is the one that shares the same "Stack" tag value.
"""
import sys
import time
import argparse
import boto
import boto.utils
import boto.ec2
import boto.rds2
def main():
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--stack-tag', help="name of tag shared by EC2 and RDS", default="Stack")
parser.add_argument('--dry-run', help="skip backup", action='store_true')
args = parser.parse_args()
region = boto.utils.get_instance_metadata()['placement']['availability-zone'][:-1]
print "region: {}".format(region)
instance_id = boto.utils.get_instance_metadata()['instance-id']
print "instance_id: {}".format(instance_id)
account_id = boto.utils.get_instance_metadata()['iam']['info']['InstanceProfileArn'].split(':')[4]
print "account_id: {}".format(account_id)
conn_ec2 = boto.ec2.connect_to_region(region)
conn_rds = boto.rds2.connect_to_region(region)
my_instance = conn_ec2.get_all_instances(instance_ids=[instance_id])[0].instances[0]
if args.stack_tag not in my_instance.tags:
print "Missing tag '{}' on this EC2".format(args.stack_tag)
return 1
my_stack = my_instance.tags[args.stack_tag]
print "Tag {}:{}".format(args.stack_tag, my_stack)
print
db_descriptions = conn_rds.describe_db_instances()[u'DescribeDBInstancesResponse'][u'DescribeDBInstancesResult'][u'DBInstances']
ts_formatted = "-".join(str(time.time()).split('.'))
error_count = 0
for db_desc in db_descriptions:
rds_id = db_desc['DBInstanceIdentifier']
# For now AWS API does not support filtering filters={'tag:{}'.format(STACK_TAG):my_stack,}
# see: http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html
# so we have to go through list_tags_for_resource(arn)
rds_arn = 'arn:aws:rds:{region}:{account_id}:db:{rds_id}'.format(
region=region,
account_id=account_id,
rds_id=rds_id
)
tag_list = conn_rds.list_tags_for_resource(rds_arn)['ListTagsForResourceResponse']['ListTagsForResourceResult']['TagList']
tag_dict = dict(map(lambda x: (x['Key'], x['Value']), tag_list))
if args.stack_tag not in tag_dict:
print "Skipping {} as missing tag '{}'".format(rds_id, args.stack_tag)
elif tag_dict[args.stack_tag] != my_stack:
print "Skipping {} as tag '{}'!='{}'".format(rds_id, tag_dict[args.stack_tag], my_stack)
else:
snapshot_id = '{}-{}'.format(rds_id, ts_formatted)
if args.dry_run:
print "Backing up {} as {} - dry run".format(rds_id, snapshot_id)
else:
print "Backing up {} as {} - requested".format(rds_id, snapshot_id)
try:
conn_rds.create_db_snapshot(snapshot_id, rds_id)
except boto.rds2.exceptions.InvalidDBInstanceState as e:
error_count += 1
print "Failed - API response: {}".format(e.body)
return error_count
if __name__ == "__main__":
error_count = main()
sys.exit(error_count)
| mit | Python |
|
a9d458c0995db80f164f6099b5264f23c1ceffbb | Create 02.py | ezralalonde/cloaked-octo-sansa | 02/qu/02.py | 02/qu/02.py | # Define a procedure, sum3, that takes three
# inputs, and returns the sum of the three
# input numbers.
def sum3(aa, bb, cc):
return aa + bb + cc
#print sum3(1,2,3)
#>>> 6
#print sum3(93,53,70)
#>>> 216
| bsd-2-clause | Python |
|
9a705f58acbcfb2cc7292cb396544f1f8c9b89a1 | Add basic web test | laurentb/assnet,laurentb/assnet | tests/baseweb_test.py | tests/baseweb_test.py | from __future__ import with_statement
from ass2m.ass2m import Ass2m
from ass2m.server import Server
from unittest import TestCase
from webtest import TestApp
from tempfile import mkdtemp
import os.path
import shutil
class BaseWebTest(TestCase):
def setUp(self):
self.root = mkdtemp(prefix='ass2m_test_root')
ass2m = Ass2m(self.root)
ass2m.create(self.root)
server = Server(self.root)
self.app = TestApp(server.process)
def tearDown(self):
if self.root:
shutil.rmtree(self.root)
def test_listAndDownload(self):
res = self.app.get("/")
assert "<h1>Index of /</h1>" in res.body
with file(os.path.join(self.root, "penguins_are_cute"), 'a') as f:
f.write("HELLO")
res = self.app.get("/")
assert "penguins_are_cute" in res.body
res = self.app.get("/penguins_are_cute")
assert "HELLO" == res.body
| agpl-3.0 | Python |
|
56eba00d00e450b5dc8fae7ea8475d418b00e2db | Add problem69.py | mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler | euler_python/problem69.py | euler_python/problem69.py | """
problem69.py
Euler's Totient function, φ(n) [sometimes called the phi function], is used to
determine the number of numbers less than n which are relatively prime to n. For
example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to
nine, φ(9)=6.
It can be seen that n=6 produces a maximum n/φ(n) for n ≤ 10. Find the value of
n ≤ 1,000,000 for which n/φ(n) is a maximum.
"""
from itertools import takewhile
from toolset import get_primes
# def phi(n):
# ps = list(unique(prime_factors(n)))
# return n * reduce(operator.mul, (1 - Fraction(1, p) for p in ps))
# return max((n for n in range(2, 1000000+1)), key=lambda n: n/phi(n))
#
# The commented-out solution above is correct and true to the problem
# description, but slightly slower than 1 minute.
#
# So, note that the phi function multiplies n by (1 - (1/p)) for every p in
# its unique prime factors. Therefore, phi(n) will diminish as n has a
# greater number of small unique prime factors. Since we are seeking the
# largest value for n/phi(n), we want to minimize phi(n). We are therefore
# looking for the largest number < 1e6 which is the product of the smallest
# unique prime factors, i.e successive prime numbers starting from 2.
def candidates():
primes = get_primes()
x = next(primes)
while True:
yield x
x *= next(primes)
def problem69():
return max(takewhile(lambda x: x < 1e6, candidates()))
| mit | Python |
|
e082435619399051321e7c9ae02540f54e436e5b | Create acr_routerauthenticator.py | madumlao/oxAuth,GluuFederation/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth | Server/integrations/acr_router/acr_routerauthenticator.py | Server/integrations/acr_router/acr_routerauthenticator.py | from org.xdi.model.custom.script.type.auth import PersonAuthenticationType
from org.jboss.seam.contexts import Context, Contexts
from org.jboss.seam.security import Identity
from org.xdi.oxauth.service import UserService, AuthenticationService, SessionStateService, VeriCloudCompromise
from org.xdi.util import StringHelper
from org.xdi.util import ArrayHelper
from org.xdi.oxauth.client.fido.u2f import FidoU2fClientFactory
from org.xdi.oxauth.service.fido.u2f import DeviceRegistrationService
from org.xdi.oxauth.util import ServerUtil
from org.xdi.oxauth.model.config import Constants
from org.jboss.resteasy.client import ClientResponseFailure
from org.jboss.resteasy.client.exception import ResteasyClientException
from javax.ws.rs.core import Response
from java.util import Arrays
import sys
import java
class PersonAuthentication(PersonAuthenticationType):
def __init__(self, currentTimeMillis):
self.currentTimeMillis = currentTimeMillis
def init(self, configurationAttributes):
print "acr_router Initialization"
return True
def destroy(self, configurationAttributes):
print "acr_router Destroy"
print "acr_router Destroyed successfully"
return True
def getApiVersion(self):
return 1
def isValidAuthenticationMethod(self, usageType, configurationAttributes):
return True
def getAlternativeAuthenticationMethod(self, usageType, configurationAttributes):
return None
def authenticate(self, configurationAttributes, requestParameters, step):
credentials = Identity.instance().getCredentials()
user_name = credentials.getUsername()
user_password = credentials.getPassword()
context = Contexts.getEventContext()
session_attributes = context.get("sessionAttributes")
remote_ip = session_attributes.get("remote_ip")
client_id = self.getClientID(session_attributes)
sessionStateService = SessionStateService.instance()
sessionState = sessionStateService.getSessionState()
print "SessionState id: %s" % sessionState.getId()
acr = sessionStateService.getAcr(sessionState)
print "Current ACR_VALUE: " + acr
if (step == 1):
print "acr_router Authenticate for step 1"
logged_in = False
if (StringHelper.isNotEmptyString(user_name) and StringHelper.isNotEmptyString(user_password)):
userService = UserService.instance()
veriCloudCompromise= VeriCloudCompromise.instance()
find_user_by_uid = userService.getUser(user_name)
status_attribute_value = userService.getCustomAttribute(find_user_by_uid, "mail")
if status_attribute_value != None:
user_mail = status_attribute_value.getValue()
#isCompromise = veriCloudCompromise.is_compromised("testuser123@gmail.com", "123456")
isCompromise = False
if(isCompromise ):
sessionAttributes = sessionState.getSessionAttributes()
sessionAttributes.put("acr_values", "otp")
sessionAttributes.put("acr", "otp")
sessionState.setSessionAttributes(sessionAttributes)
sessionStateService.reinitLogin(sessionState,True)
else:
logged_in = userService.authenticate(user_name, user_password)
if (not logged_in):
return False
return True
elif (step == 2):
print "acr_router Authenticate for step 2"
authenticationService = AuthenticationService.instance()
user = authenticationService.getAuthenticatedUser()
if (user == None):
print "acr_router Prepare for step 2. Failed to determine user name"
return False
if (auth_method == 'authenticate'):
print "Code here to check APIs"
return True
else:
print "acr_router. Prepare for step 2. Authenticatiod method is invalid"
return False
return False
else:
return False
def prepareForStep(self, configurationAttributes, requestParameters, step):
if (step == 1):
return True
elif (step == 2):
print "acr_router Prepare for step 2"
return True
else:
return False
def getExtraParametersForStep(self, configurationAttributes, step):
return None
def getCountAuthenticationSteps(self, configurationAttributes):
return 1
def getPageForStep(self, configurationAttributes, step):
return True
def logout(self, configurationAttributes, requestParameters):
return True
def getClientID(self, session_attributes):
if not session_attributes.containsKey("client_id"):
return None
return session_attributes.get("client_id")
| mit | Python |
|
47bdc98a7fb8c030f5beb09ec9bb1b83c100dc9a | Add missing migration | uranusjr/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/users/migrations/0008_auto_20160222_0553.py | src/users/migrations/0008_auto_20160222_0553.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-22 05:53
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20160122_1333'),
]
operations = [
migrations.AlterField(
model_name='user',
name='github_id',
field=models.CharField(blank=True, help_text='Your GitHub account, without the "@" sign. This will be shown when we display your public information.', max_length=100, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_-]*$', 'Not a valid GitHub account')], verbose_name='GitHub'),
),
migrations.AlterField(
model_name='user',
name='twitter_id',
field=models.CharField(blank=True, help_text='Your Twitter handle, without the "@" sign. This will be shown when we display your public information.', max_length=100, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_]*$', 'Not a valid Twitter handle')], verbose_name='Twitter'),
),
]
| mit | Python |
|
f0cd785688ed04821f0338021e2360b98bd9dd58 | add very simple perf test | coopernurse/barrister,coopernurse/barrister | conform/perf.py | conform/perf.py | #!/usr/bin/env python
import sys
import barrister
trans = barrister.HttpTransport("http://localhost:9233/")
client = barrister.Client(trans, validate_request=False)
num = int(sys.argv[1])
s = "safasdfasdlfasjdflkasjdflaskjdflaskdjflasdjflaskdfjalsdkfjasldkfjasldkasdlkasjfasld"
for i in range(num):
client.B.echo(s)
| mit | Python |
|
e88a6a634f600a5ef3ae269fc0d49bcd1e1d58e8 | Revert "More accurate info in examples." | harshaneelhg/scikit-learn,glouppe/scikit-learn,henridwyer/scikit-learn,huzq/scikit-learn,OshynSong/scikit-learn,icdishb/scikit-learn,Sentient07/scikit-learn,yunfeilu/scikit-learn,walterreade/scikit-learn,glennq/scikit-learn,jakobworldpeace/scikit-learn,Fireblend/scikit-learn,huzq/scikit-learn,iismd17/scikit-learn,poryfly/scikit-learn,Adai0808/scikit-learn,pv/scikit-learn,DonBeo/scikit-learn,Sentient07/scikit-learn,Fireblend/scikit-learn,bthirion/scikit-learn,mjgrav2001/scikit-learn,alexsavio/scikit-learn,mrshu/scikit-learn,lucidfrontier45/scikit-learn,Clyde-fare/scikit-learn,eg-zhang/scikit-learn,JeanKossaifi/scikit-learn,zuku1985/scikit-learn,hrjn/scikit-learn,mhdella/scikit-learn,NelisVerhoef/scikit-learn,nrhine1/scikit-learn,equialgo/scikit-learn,dingocuster/scikit-learn,jzt5132/scikit-learn,cainiaocome/scikit-learn,fabioticconi/scikit-learn,0x0all/scikit-learn,xavierwu/scikit-learn,samzhang111/scikit-learn,MohammedWasim/scikit-learn,mhdella/scikit-learn,aminert/scikit-learn,beepee14/scikit-learn,billy-inn/scikit-learn,joshloyal/scikit-learn,shyamalschandra/scikit-learn,mugizico/scikit-learn,trungnt13/scikit-learn,RomainBrault/scikit-learn,zhenv5/scikit-learn,shenzebang/scikit-learn,kylerbrown/scikit-learn,yanlend/scikit-learn,3manuek/scikit-learn,hlin117/scikit-learn,evgchz/scikit-learn,olologin/scikit-learn,florian-f/sklearn,idlead/scikit-learn,olologin/scikit-learn,anurag313/scikit-learn,trankmichael/scikit-learn,JeanKossaifi/scikit-learn,jblackburne/scikit-learn,hitszxp/scikit-learn,ishanic/scikit-learn,ivannz/scikit-learn,gclenaghan/scikit-learn,hainm/scikit-learn,IshankGulati/scikit-learn,hrjn/scikit-learn,Srisai85/scikit-learn,ilo10/scikit-learn,andaag/scikit-learn,arjoly/scikit-learn,larsmans/scikit-learn,marcocaccin/scikit-learn,fbagirov/scikit-learn,h2educ/scikit-learn,B3AU/waveTree,davidgbe/scikit-learn,henrykironde/scikit-learn,yunfeilu/scikit-learn,kylerbrown/scikit-learn,0x0all/scikit-learn,macks22/scikit-learn,kagayakidan/scikit-learn,costypetrisor/scikit-learn,mhue/scikit-learn,fbagirov/scikit-learn,OshynSong/scikit-learn,evgchz/scikit-learn,wlamond/scikit-learn,vibhorag/scikit-learn,jereze/scikit-learn,ephes/scikit-learn,bnaul/scikit-learn,xuewei4d/scikit-learn,vermouthmjl/scikit-learn,hsuantien/scikit-learn,saiwing-yeung/scikit-learn,0asa/scikit-learn,sgenoud/scikit-learn,moutai/scikit-learn,aetilley/scikit-learn,B3AU/waveTree,andrewnc/scikit-learn,nesterione/scikit-learn,victorbergelin/scikit-learn,giorgiop/scikit-learn,altairpearl/scikit-learn,glemaitre/scikit-learn,jpautom/scikit-learn,massmutual/scikit-learn,mblondel/scikit-learn,clemkoa/scikit-learn,kashif/scikit-learn,lenovor/scikit-learn,arjoly/scikit-learn,hdmetor/scikit-learn,gotomypc/scikit-learn,akionakamura/scikit-learn,Windy-Ground/scikit-learn,3manuek/scikit-learn,nhejazi/scikit-learn,rahul-c1/scikit-learn,Achuth17/scikit-learn,CVML/scikit-learn,anirudhjayaraman/scikit-learn,sergeyf/scikit-learn,jmschrei/scikit-learn,LohithBlaze/scikit-learn,BiaDarkia/scikit-learn,vinayak-mehta/scikit-learn,NunoEdgarGub1/scikit-learn,vortex-ape/scikit-learn,icdishb/scikit-learn,sarahgrogan/scikit-learn,justincassidy/scikit-learn,AIML/scikit-learn,eickenberg/scikit-learn,lucidfrontier45/scikit-learn,Clyde-fare/scikit-learn,luo66/scikit-learn,cwu2011/scikit-learn,tosolveit/scikit-learn,phdowling/scikit-learn,bnaul/scikit-learn,jakobworldpeace/scikit-learn,PrashntS/scikit-learn,bnaul/scikit-learn,hsuantien/scikit-learn,rsivapr/scikit-learn,nelson-liu/scikit-learn,jm-begon/scikit-learn,pratapvardhan/scikit-learn,hitszxp/scikit-learn,IssamLaradji/scikit-learn,thientu/scikit-learn,aetilley/scikit-learn,qifeigit/scikit-learn,fabianp/scikit-learn,glouppe/scikit-learn,samzhang111/scikit-learn,JPFrancoia/scikit-learn,samuel1208/scikit-learn,jlegendary/scikit-learn,466152112/scikit-learn,quheng/scikit-learn,clemkoa/scikit-learn,glemaitre/scikit-learn,kashif/scikit-learn,kagayakidan/scikit-learn,alexeyum/scikit-learn,arabenjamin/scikit-learn,michigraber/scikit-learn,chrisburr/scikit-learn,mrshu/scikit-learn,yask123/scikit-learn,sanketloke/scikit-learn,khkaminska/scikit-learn,eickenberg/scikit-learn,IndraVikas/scikit-learn,yyjiang/scikit-learn,MartinSavc/scikit-learn,imaculate/scikit-learn,shenzebang/scikit-learn,schets/scikit-learn,466152112/scikit-learn,jblackburne/scikit-learn,fzalkow/scikit-learn,nvoron23/scikit-learn,trungnt13/scikit-learn,UNR-AERIAL/scikit-learn,f3r/scikit-learn,spallavolu/scikit-learn,IndraVikas/scikit-learn,aflaxman/scikit-learn,ivannz/scikit-learn,cainiaocome/scikit-learn,BiaDarkia/scikit-learn,DSLituiev/scikit-learn,jzt5132/scikit-learn,altairpearl/scikit-learn,hainm/scikit-learn,potash/scikit-learn,ltiao/scikit-learn,kjung/scikit-learn,meduz/scikit-learn,mjudsp/Tsallis,nrhine1/scikit-learn,jakirkham/scikit-learn,DSLituiev/scikit-learn,jjx02230808/project0223,AlexandreAbraham/scikit-learn,fyffyt/scikit-learn,manashmndl/scikit-learn,alexeyum/scikit-learn,kjung/scikit-learn,xwolf12/scikit-learn,vinayak-mehta/scikit-learn,djgagne/scikit-learn,tdhopper/scikit-learn,mikebenfield/scikit-learn,ilo10/scikit-learn,krez13/scikit-learn,amueller/scikit-learn,UNR-AERIAL/scikit-learn,Sentient07/scikit-learn,hugobowne/scikit-learn,vshtanko/scikit-learn,vermouthmjl/scikit-learn,xubenben/scikit-learn,roxyboy/scikit-learn,macks22/scikit-learn,henrykironde/scikit-learn,bnaul/scikit-learn,HolgerPeters/scikit-learn,mrshu/scikit-learn,kaichogami/scikit-learn,466152112/scikit-learn,zuku1985/scikit-learn,sergeyf/scikit-learn,bhargav/scikit-learn,krez13/scikit-learn,murali-munna/scikit-learn,cauchycui/scikit-learn,depet/scikit-learn,nvoron23/scikit-learn,dhruv13J/scikit-learn,mfjb/scikit-learn,wlamond/scikit-learn,kmike/scikit-learn,xyguo/scikit-learn,DSLituiev/scikit-learn,meduz/scikit-learn,Achuth17/scikit-learn,jm-begon/scikit-learn,arabenjamin/scikit-learn,jorik041/scikit-learn,CVML/scikit-learn,jzt5132/scikit-learn,LohithBlaze/scikit-learn,rishikksh20/scikit-learn,xiaoxiamii/scikit-learn,jjx02230808/project0223,PrashntS/scikit-learn,hdmetor/scikit-learn,ChanChiChoi/scikit-learn,CforED/Machine-Learning,liyu1990/sklearn,MohammedWasim/scikit-learn,giorgiop/scikit-learn,dhruv13J/scikit-learn,shusenl/scikit-learn,samzhang111/scikit-learn,shusenl/scikit-learn,betatim/scikit-learn,wanggang3333/scikit-learn,tawsifkhan/scikit-learn,pianomania/scikit-learn,heli522/scikit-learn,JsNoNo/scikit-learn,rsivapr/scikit-learn,arjoly/scikit-learn,lbishal/scikit-learn,Windy-Ground/scikit-learn,madjelan/scikit-learn,nikitasingh981/scikit-learn,MechCoder/scikit-learn,sinhrks/scikit-learn,ChanChiChoi/scikit-learn,gotomypc/scikit-learn,quheng/scikit-learn,espg/scikit-learn,HolgerPeters/scikit-learn,ky822/scikit-learn,sumspr/scikit-learn,frank-tancf/scikit-learn,tomlof/scikit-learn,siutanwong/scikit-learn,plissonf/scikit-learn,betatim/scikit-learn,etkirsch/scikit-learn,liberatorqjw/scikit-learn,kmike/scikit-learn,bhargav/scikit-learn,vortex-ape/scikit-learn,sarahgrogan/scikit-learn,ZenDevelopmentSystems/scikit-learn,jakirkham/scikit-learn,heli522/scikit-learn,spallavolu/scikit-learn,YinongLong/scikit-learn,nelson-liu/scikit-learn,fyffyt/scikit-learn,rajat1994/scikit-learn,lbishal/scikit-learn,tosolveit/scikit-learn,cwu2011/scikit-learn,glennq/scikit-learn,amueller/scikit-learn,gclenaghan/scikit-learn,ashhher3/scikit-learn,joshloyal/scikit-learn,abhishekgahlot/scikit-learn,kashif/scikit-learn,mwv/scikit-learn,abhishekgahlot/scikit-learn,voxlol/scikit-learn,shyamalschandra/scikit-learn,fredhusser/scikit-learn,YinongLong/scikit-learn,lenovor/scikit-learn,JosmanPS/scikit-learn,arabenjamin/scikit-learn,carrillo/scikit-learn,mattgiguere/scikit-learn,manashmndl/scikit-learn,h2educ/scikit-learn,pompiduskus/scikit-learn,ldirer/scikit-learn,arabenjamin/scikit-learn,jjx02230808/project0223,JosmanPS/scikit-learn,vortex-ape/scikit-learn,jorik041/scikit-learn,alvarofierroclavero/scikit-learn,tawsifkhan/scikit-learn,CVML/scikit-learn,Djabbz/scikit-learn,kmike/scikit-learn,rvraghav93/scikit-learn,mattilyra/scikit-learn,thientu/scikit-learn,kjung/scikit-learn,samuel1208/scikit-learn,TomDLT/scikit-learn,Lawrence-Liu/scikit-learn,glemaitre/scikit-learn,jorge2703/scikit-learn,Nyker510/scikit-learn,victorbergelin/scikit-learn,manashmndl/scikit-learn,phdowling/scikit-learn,maheshakya/scikit-learn,marcocaccin/scikit-learn,elkingtonmcb/scikit-learn,pypot/scikit-learn,poryfly/scikit-learn,chrisburr/scikit-learn,cl4rke/scikit-learn,lin-credible/scikit-learn,joernhees/scikit-learn,btabibian/scikit-learn,ahoyosid/scikit-learn,florian-f/sklearn,mattilyra/scikit-learn,herilalaina/scikit-learn,zhenv5/scikit-learn,zihua/scikit-learn,luo66/scikit-learn,aminert/scikit-learn,dsullivan7/scikit-learn,pv/scikit-learn,aflaxman/scikit-learn,rishikksh20/scikit-learn,stylianos-kampakis/scikit-learn,russel1237/scikit-learn,rrohan/scikit-learn,ZENGXH/scikit-learn,robin-lai/scikit-learn,Jimmy-Morzaria/scikit-learn,fzalkow/scikit-learn,RomainBrault/scikit-learn,wanggang3333/scikit-learn,jakobworldpeace/scikit-learn,jseabold/scikit-learn,sumspr/scikit-learn,carrillo/scikit-learn,aflaxman/scikit-learn,treycausey/scikit-learn,466152112/scikit-learn,sumspr/scikit-learn,robin-lai/scikit-learn,ky822/scikit-learn,wazeerzulfikar/scikit-learn,frank-tancf/scikit-learn,MechCoder/scikit-learn,schets/scikit-learn,glennq/scikit-learn,bikong2/scikit-learn,ltiao/scikit-learn,mojoboss/scikit-learn,HolgerPeters/scikit-learn,Srisai85/scikit-learn,Garrett-R/scikit-learn,adamgreenhall/scikit-learn,terkkila/scikit-learn,ogrisel/scikit-learn,kevin-intel/scikit-learn,jmschrei/scikit-learn,fredhusser/scikit-learn,tmhm/scikit-learn,lucidfrontier45/scikit-learn,IssamLaradji/scikit-learn,yunfeilu/scikit-learn,carrillo/scikit-learn,mblondel/scikit-learn,olologin/scikit-learn,jjx02230808/project0223,anntzer/scikit-learn,cauchycui/scikit-learn,r-mart/scikit-learn,jmetzen/scikit-learn,quheng/scikit-learn,jseabold/scikit-learn,loli/semisupervisedforests,zihua/scikit-learn,toastedcornflakes/scikit-learn,scikit-learn/scikit-learn,xiaoxiamii/scikit-learn,yanlend/scikit-learn,fzalkow/scikit-learn,dsquareindia/scikit-learn,ZENGXH/scikit-learn,trungnt13/scikit-learn,vshtanko/scikit-learn,rohanp/scikit-learn,bthirion/scikit-learn,stylianos-kampakis/scikit-learn,jereze/scikit-learn,kaichogami/scikit-learn,justincassidy/scikit-learn,florian-f/sklearn,pnedunuri/scikit-learn,scikit-learn/scikit-learn,toastedcornflakes/scikit-learn,rohanp/scikit-learn,jaidevd/scikit-learn,victorbergelin/scikit-learn,siutanwong/scikit-learn,waterponey/scikit-learn,CforED/Machine-Learning,rsivapr/scikit-learn,madjelan/scikit-learn,siutanwong/scikit-learn,Obus/scikit-learn,AlexandreAbraham/scikit-learn,Vimos/scikit-learn,AlexanderFabisch/scikit-learn,ltiao/scikit-learn,depet/scikit-learn,mayblue9/scikit-learn,pkruskal/scikit-learn,ChanChiChoi/scikit-learn,mxjl620/scikit-learn,rohanp/scikit-learn,rahul-c1/scikit-learn,mugizico/scikit-learn,cl4rke/scikit-learn,MohammedWasim/scikit-learn,IndraVikas/scikit-learn,yask123/scikit-learn,krez13/scikit-learn,Jimmy-Morzaria/scikit-learn,elkingtonmcb/scikit-learn,B3AU/waveTree,depet/scikit-learn,anntzer/scikit-learn,costypetrisor/scikit-learn,florian-f/sklearn,mattgiguere/scikit-learn,mayblue9/scikit-learn,joernhees/scikit-learn,maheshakya/scikit-learn,mjudsp/Tsallis,akionakamura/scikit-learn,jayflo/scikit-learn,yonglehou/scikit-learn,liangz0707/scikit-learn,ssaeger/scikit-learn,zihua/scikit-learn,vigilv/scikit-learn,vortex-ape/scikit-learn,siutanwong/scikit-learn,ElDeveloper/scikit-learn,cybernet14/scikit-learn,mugizico/scikit-learn,theoryno3/scikit-learn,tomlof/scikit-learn,Titan-C/scikit-learn,khkaminska/scikit-learn,Vimos/scikit-learn,andrewnc/scikit-learn,nikitasingh981/scikit-learn,zaxtax/scikit-learn,meduz/scikit-learn,rohanp/scikit-learn,ankurankan/scikit-learn,vybstat/scikit-learn,CforED/Machine-Learning,alvarofierroclavero/scikit-learn,eickenberg/scikit-learn,mehdidc/scikit-learn,Myasuka/scikit-learn,mxjl620/scikit-learn,jlegendary/scikit-learn,betatim/scikit-learn,ngoix/OCRF,imaculate/scikit-learn,jorik041/scikit-learn,q1ang/scikit-learn,manhhomienbienthuy/scikit-learn,glouppe/scikit-learn,walterreade/scikit-learn,HolgerPeters/scikit-learn,xyguo/scikit-learn,ashhher3/scikit-learn,TomDLT/scikit-learn,LiaoPan/scikit-learn,zuku1985/scikit-learn,bigdataelephants/scikit-learn,alexeyum/scikit-learn,chrisburr/scikit-learn,petosegan/scikit-learn,roxyboy/scikit-learn,jereze/scikit-learn,petosegan/scikit-learn,ZenDevelopmentSystems/scikit-learn,ningchi/scikit-learn,eickenberg/scikit-learn,elkingtonmcb/scikit-learn,hainm/scikit-learn,r-mart/scikit-learn,billy-inn/scikit-learn,0x0all/scikit-learn,liyu1990/sklearn,cwu2011/scikit-learn,hlin117/scikit-learn,h2educ/scikit-learn,evgchz/scikit-learn,larsmans/scikit-learn,russel1237/scikit-learn,rajat1994/scikit-learn,nrhine1/scikit-learn,NelisVerhoef/scikit-learn,qifeigit/scikit-learn,fabioticconi/scikit-learn,fzalkow/scikit-learn,ilyes14/scikit-learn,sumspr/scikit-learn,pompiduskus/scikit-learn,alexsavio/scikit-learn,yonglehou/scikit-learn,yanlend/scikit-learn,Adai0808/scikit-learn,ky822/scikit-learn,rsivapr/scikit-learn,wzbozon/scikit-learn,MartinDelzant/scikit-learn,theoryno3/scikit-learn,ilyes14/scikit-learn,JsNoNo/scikit-learn,yanlend/scikit-learn,xavierwu/scikit-learn,kylerbrown/scikit-learn,eg-zhang/scikit-learn,ivannz/scikit-learn,amueller/scikit-learn,ogrisel/scikit-learn,rahul-c1/scikit-learn,thilbern/scikit-learn,ndingwall/scikit-learn,hainm/scikit-learn,petosegan/scikit-learn,ankurankan/scikit-learn,henridwyer/scikit-learn,mikebenfield/scikit-learn,YinongLong/scikit-learn,tawsifkhan/scikit-learn,PatrickOReilly/scikit-learn,kevin-intel/scikit-learn,fengzhyuan/scikit-learn,nmayorov/scikit-learn,jaidevd/scikit-learn,ClimbsRocks/scikit-learn,etkirsch/scikit-learn,amueller/scikit-learn,aetilley/scikit-learn,RachitKansal/scikit-learn,btabibian/scikit-learn,loli/sklearn-ensembletrees,ycaihua/scikit-learn,xubenben/scikit-learn,kevin-intel/scikit-learn,f3r/scikit-learn,plissonf/scikit-learn,roxyboy/scikit-learn,lesteve/scikit-learn,xyguo/scikit-learn,liangz0707/scikit-learn,marcocaccin/scikit-learn,nomadcube/scikit-learn,belltailjp/scikit-learn,ldirer/scikit-learn,plissonf/scikit-learn,zuku1985/scikit-learn,MatthieuBizien/scikit-learn,dhruv13J/scikit-learn,ElDeveloper/scikit-learn,ankurankan/scikit-learn,YinongLong/scikit-learn,aminert/scikit-learn,yonglehou/scikit-learn,rishikksh20/scikit-learn,themrmax/scikit-learn,JPFrancoia/scikit-learn,zorojean/scikit-learn,heli522/scikit-learn,ilo10/scikit-learn,roxyboy/scikit-learn,stylianos-kampakis/scikit-learn,mhue/scikit-learn,Vimos/scikit-learn,xuewei4d/scikit-learn,RachitKansal/scikit-learn,lin-credible/scikit-learn,shyamalschandra/scikit-learn,ephes/scikit-learn,florian-f/sklearn,pnedunuri/scikit-learn,sonnyhu/scikit-learn,alvarofierroclavero/scikit-learn,DSLituiev/scikit-learn,imaculate/scikit-learn,joernhees/scikit-learn,loli/sklearn-ensembletrees,ClimbsRocks/scikit-learn,henridwyer/scikit-learn,jlegendary/scikit-learn,Djabbz/scikit-learn,tdhopper/scikit-learn,OshynSong/scikit-learn,cwu2011/scikit-learn,sarahgrogan/scikit-learn,Clyde-fare/scikit-learn,michigraber/scikit-learn,murali-munna/scikit-learn,ChanderG/scikit-learn,carrillo/scikit-learn,fredhusser/scikit-learn,LohithBlaze/scikit-learn,ZenDevelopmentSystems/scikit-learn,xzh86/scikit-learn,ankurankan/scikit-learn,rahuldhote/scikit-learn,potash/scikit-learn,liberatorqjw/scikit-learn,rahuldhote/scikit-learn,treycausey/scikit-learn,davidgbe/scikit-learn,glennq/scikit-learn,Adai0808/scikit-learn,ilyes14/scikit-learn,rexshihaoren/scikit-learn,zorroblue/scikit-learn,ZenDevelopmentSystems/scikit-learn,beepee14/scikit-learn,saiwing-yeung/scikit-learn,equialgo/scikit-learn,xwolf12/scikit-learn,xuewei4d/scikit-learn,Fireblend/scikit-learn,LohithBlaze/scikit-learn,depet/scikit-learn,hrjn/scikit-learn,bigdataelephants/scikit-learn,Aasmi/scikit-learn,h2educ/scikit-learn,JPFrancoia/scikit-learn,RomainBrault/scikit-learn,smartscheduling/scikit-learn-categorical-tree,shenzebang/scikit-learn,AlexRobson/scikit-learn,abhishekkrthakur/scikit-learn,spallavolu/scikit-learn,dsquareindia/scikit-learn,justincassidy/scikit-learn,equialgo/scikit-learn,pkruskal/scikit-learn,Achuth17/scikit-learn,mayblue9/scikit-learn,zorojean/scikit-learn,pythonvietnam/scikit-learn,khkaminska/scikit-learn,iismd17/scikit-learn,adamgreenhall/scikit-learn,kaichogami/scikit-learn,Obus/scikit-learn,gclenaghan/scikit-learn,jereze/scikit-learn,tomlof/scikit-learn,scikit-learn/scikit-learn,voxlol/scikit-learn,belltailjp/scikit-learn,aewhatley/scikit-learn,jakirkham/scikit-learn,vivekmishra1991/scikit-learn,chrsrds/scikit-learn,raghavrv/scikit-learn,jseabold/scikit-learn,cybernet14/scikit-learn,icdishb/scikit-learn,andrewnc/scikit-learn,ominux/scikit-learn,pypot/scikit-learn,bikong2/scikit-learn,poryfly/scikit-learn,sinhrks/scikit-learn,belltailjp/scikit-learn,kagayakidan/scikit-learn,michigraber/scikit-learn,xavierwu/scikit-learn,pythonvietnam/scikit-learn,jkarnows/scikit-learn,Titan-C/scikit-learn,ningchi/scikit-learn,chrsrds/scikit-learn,vshtanko/scikit-learn,phdowling/scikit-learn,cl4rke/scikit-learn,frank-tancf/scikit-learn,shikhardb/scikit-learn,sgenoud/scikit-learn,jblackburne/scikit-learn,zorroblue/scikit-learn,gclenaghan/scikit-learn,Myasuka/scikit-learn,hugobowne/scikit-learn,ChanChiChoi/scikit-learn,cainiaocome/scikit-learn,deepesch/scikit-learn,nmayorov/scikit-learn,lbishal/scikit-learn,ephes/scikit-learn,mattilyra/scikit-learn,jmetzen/scikit-learn,CVML/scikit-learn,ZENGXH/scikit-learn,devanshdalal/scikit-learn,IssamLaradji/scikit-learn,arahuja/scikit-learn,MechCoder/scikit-learn,mlyundin/scikit-learn,mhue/scikit-learn,0asa/scikit-learn,MatthieuBizien/scikit-learn,davidgbe/scikit-learn,shahankhatch/scikit-learn,davidgbe/scikit-learn,bikong2/scikit-learn,adamgreenhall/scikit-learn,nesterione/scikit-learn,espg/scikit-learn,pianomania/scikit-learn,NunoEdgarGub1/scikit-learn,ilyes14/scikit-learn,mfjb/scikit-learn,treycausey/scikit-learn,appapantula/scikit-learn,PatrickChrist/scikit-learn,iismd17/scikit-learn,Obus/scikit-learn,arahuja/scikit-learn,khkaminska/scikit-learn,pianomania/scikit-learn,mrshu/scikit-learn,sanketloke/scikit-learn,ssaeger/scikit-learn,massmutual/scikit-learn,dsullivan7/scikit-learn,arahuja/scikit-learn,manashmndl/scikit-learn,shangwuhencc/scikit-learn,dsullivan7/scikit-learn,walterreade/scikit-learn,cainiaocome/scikit-learn,DonBeo/scikit-learn,simon-pepin/scikit-learn,MartinDelzant/scikit-learn,hlin117/scikit-learn,PatrickChrist/scikit-learn,pratapvardhan/scikit-learn,cybernet14/scikit-learn,loli/sklearn-ensembletrees,fabianp/scikit-learn,nikitasingh981/scikit-learn,lenovor/scikit-learn,ndingwall/scikit-learn,glouppe/scikit-learn,DonBeo/scikit-learn,dsquareindia/scikit-learn,bhargav/scikit-learn,Windy-Ground/scikit-learn,smartscheduling/scikit-learn-categorical-tree,procoder317/scikit-learn,raghavrv/scikit-learn,billy-inn/scikit-learn,ElDeveloper/scikit-learn,Clyde-fare/scikit-learn,bthirion/scikit-learn,rexshihaoren/scikit-learn,ashhher3/scikit-learn,maheshakya/scikit-learn,idlead/scikit-learn,mwv/scikit-learn,ZENGXH/scikit-learn,lucidfrontier45/scikit-learn,jkarnows/scikit-learn,akionakamura/scikit-learn,fbagirov/scikit-learn,sonnyhu/scikit-learn,treycausey/scikit-learn,beepee14/scikit-learn,xzh86/scikit-learn,loli/semisupervisedforests,shahankhatch/scikit-learn,PatrickOReilly/scikit-learn,lbishal/scikit-learn,fabianp/scikit-learn,robbymeals/scikit-learn,shangwuhencc/scikit-learn,huzq/scikit-learn,Barmaley-exe/scikit-learn,yyjiang/scikit-learn,ephes/scikit-learn,mojoboss/scikit-learn,jm-begon/scikit-learn,jakobworldpeace/scikit-learn,thientu/scikit-learn,djgagne/scikit-learn,beepee14/scikit-learn,AIML/scikit-learn,Garrett-R/scikit-learn,murali-munna/scikit-learn,tdhopper/scikit-learn,shusenl/scikit-learn,vermouthmjl/scikit-learn,LiaoPan/scikit-learn,dingocuster/scikit-learn,LiaoPan/scikit-learn,zaxtax/scikit-learn,hsiaoyi0504/scikit-learn,ycaihua/scikit-learn,djgagne/scikit-learn,jorge2703/scikit-learn,bigdataelephants/scikit-learn,walterreade/scikit-learn,mlyundin/scikit-learn,AIML/scikit-learn,wazeerzulfikar/scikit-learn,etkirsch/scikit-learn,simon-pepin/scikit-learn,pratapvardhan/scikit-learn,mojoboss/scikit-learn,anirudhjayaraman/scikit-learn,manhhomienbienthuy/scikit-learn,PrashntS/scikit-learn,hrjn/scikit-learn,mfjb/scikit-learn,ldirer/scikit-learn,Achuth17/scikit-learn,bikong2/scikit-learn,huobaowangxi/scikit-learn,deepesch/scikit-learn,nelson-liu/scikit-learn,0x0all/scikit-learn,hsiaoyi0504/scikit-learn,Myasuka/scikit-learn,jmetzen/scikit-learn,IshankGulati/scikit-learn,cdegroc/scikit-learn,zorroblue/scikit-learn,theoryno3/scikit-learn,ningchi/scikit-learn,andrewnc/scikit-learn,xubenben/scikit-learn,TomDLT/scikit-learn,r-mart/scikit-learn,fengzhyuan/scikit-learn,xyguo/scikit-learn,liangz0707/scikit-learn,hlin117/scikit-learn,fengzhyuan/scikit-learn,schets/scikit-learn,Djabbz/scikit-learn,rrohan/scikit-learn,abhishekgahlot/scikit-learn,ClimbsRocks/scikit-learn,Garrett-R/scikit-learn,Srisai85/scikit-learn,xiaoxiamii/scikit-learn,TomDLT/scikit-learn,fbagirov/scikit-learn,michigraber/scikit-learn,yyjiang/scikit-learn,B3AU/waveTree,smartscheduling/scikit-learn-categorical-tree,RachitKansal/scikit-learn,hdmetor/scikit-learn,f3r/scikit-learn,ChanderG/scikit-learn,abhishekgahlot/scikit-learn,ycaihua/scikit-learn,MohammedWasim/scikit-learn,liangz0707/scikit-learn,betatim/scikit-learn,untom/scikit-learn,qifeigit/scikit-learn,ningchi/scikit-learn,ndingwall/scikit-learn,jorik041/scikit-learn,kashif/scikit-learn,frank-tancf/scikit-learn,nomadcube/scikit-learn,espg/scikit-learn,RachitKansal/scikit-learn,3manuek/scikit-learn,vivekmishra1991/scikit-learn,appapantula/scikit-learn,anirudhjayaraman/scikit-learn,ElDeveloper/scikit-learn,chrsrds/scikit-learn,NelisVerhoef/scikit-learn,tawsifkhan/scikit-learn,joshloyal/scikit-learn,vivekmishra1991/scikit-learn,shangwuhencc/scikit-learn,robin-lai/scikit-learn,lazywei/scikit-learn,JeanKossaifi/scikit-learn,ominux/scikit-learn,meduz/scikit-learn,Titan-C/scikit-learn,chrisburr/scikit-learn,xubenben/scikit-learn,sgenoud/scikit-learn,rvraghav93/scikit-learn,mhdella/scikit-learn,moutai/scikit-learn,hitszxp/scikit-learn,liberatorqjw/scikit-learn,plissonf/scikit-learn,loli/semisupervisedforests,mwv/scikit-learn,zorojean/scikit-learn,wazeerzulfikar/scikit-learn,RayMick/scikit-learn,wazeerzulfikar/scikit-learn,Akshay0724/scikit-learn,procoder317/scikit-learn,depet/scikit-learn,aewhatley/scikit-learn,ngoix/OCRF,jayflo/scikit-learn,cdegroc/scikit-learn,mayblue9/scikit-learn,AlexRobson/scikit-learn,joshloyal/scikit-learn,mjudsp/Tsallis,alexeyum/scikit-learn,nomadcube/scikit-learn,fengzhyuan/scikit-learn,AlexandreAbraham/scikit-learn,krez13/scikit-learn,Akshay0724/scikit-learn,ChanderG/scikit-learn,fyffyt/scikit-learn,nmayorov/scikit-learn,maheshakya/scikit-learn,aewhatley/scikit-learn,dingocuster/scikit-learn,PatrickOReilly/scikit-learn,jorge2703/scikit-learn,dsquareindia/scikit-learn,3manuek/scikit-learn,mfjb/scikit-learn,vigilv/scikit-learn,henridwyer/scikit-learn,devanshdalal/scikit-learn,ishanic/scikit-learn,theoryno3/scikit-learn,ndingwall/scikit-learn,nhejazi/scikit-learn,JeanKossaifi/scikit-learn,hugobowne/scikit-learn,rajat1994/scikit-learn,imaculate/scikit-learn,clemkoa/scikit-learn,jseabold/scikit-learn,liberatorqjw/scikit-learn,Jimmy-Morzaria/scikit-learn,kmike/scikit-learn,giorgiop/scikit-learn,pkruskal/scikit-learn,aabadie/scikit-learn,vivekmishra1991/scikit-learn,dsullivan7/scikit-learn,xzh86/scikit-learn,victorbergelin/scikit-learn,0asa/scikit-learn,shusenl/scikit-learn,fabioticconi/scikit-learn,Djabbz/scikit-learn,andaag/scikit-learn,nvoron23/scikit-learn,kaichogami/scikit-learn,madjelan/scikit-learn,vibhorag/scikit-learn,lin-credible/scikit-learn,yonglehou/scikit-learn,Lawrence-Liu/scikit-learn,icdishb/scikit-learn,pompiduskus/scikit-learn,jaidevd/scikit-learn,jmschrei/scikit-learn,lesteve/scikit-learn,xzh86/scikit-learn,pompiduskus/scikit-learn,f3r/scikit-learn,djgagne/scikit-learn,alexsavio/scikit-learn,r-mart/scikit-learn,appapantula/scikit-learn,waterponey/scikit-learn,abimannans/scikit-learn,mrshu/scikit-learn,q1ang/scikit-learn,AlexanderFabisch/scikit-learn,costypetrisor/scikit-learn,rrohan/scikit-learn,Titan-C/scikit-learn,anntzer/scikit-learn,hsiaoyi0504/scikit-learn,ssaeger/scikit-learn,lucidfrontier45/scikit-learn,rahuldhote/scikit-learn,thilbern/scikit-learn,NelisVerhoef/scikit-learn,jpautom/scikit-learn,ky822/scikit-learn,nomadcube/scikit-learn,macks22/scikit-learn,AnasGhrab/scikit-learn,NunoEdgarGub1/scikit-learn,ChanderG/scikit-learn,mjgrav2001/scikit-learn,abhishekkrthakur/scikit-learn,AlexRobson/scikit-learn,evgchz/scikit-learn,larsmans/scikit-learn,ycaihua/scikit-learn,Jimmy-Morzaria/scikit-learn,robbymeals/scikit-learn,sanketloke/scikit-learn,idlead/scikit-learn,costypetrisor/scikit-learn,Aasmi/scikit-learn,lazywei/scikit-learn,mxjl620/scikit-learn,tmhm/scikit-learn,trungnt13/scikit-learn,JosmanPS/scikit-learn,bigdataelephants/scikit-learn,stylianos-kampakis/scikit-learn,cdegroc/scikit-learn,zhenv5/scikit-learn,qifeigit/scikit-learn,OshynSong/scikit-learn,luo66/scikit-learn,jkarnows/scikit-learn,terkkila/scikit-learn,mattilyra/scikit-learn,macks22/scikit-learn,kagayakidan/scikit-learn,lesteve/scikit-learn,samzhang111/scikit-learn,jkarnows/scikit-learn,cdegroc/scikit-learn,larsmans/scikit-learn,MartinDelzant/scikit-learn,moutai/scikit-learn,mehdidc/scikit-learn,ycaihua/scikit-learn,wanggang3333/scikit-learn,robin-lai/scikit-learn,ssaeger/scikit-learn,herilalaina/scikit-learn,xwolf12/scikit-learn,rajat1994/scikit-learn,AnasGhrab/scikit-learn,vybstat/scikit-learn,vermouthmjl/scikit-learn,arjoly/scikit-learn,aewhatley/scikit-learn,toastedcornflakes/scikit-learn,Windy-Ground/scikit-learn,ahoyosid/scikit-learn,heli522/scikit-learn,olologin/scikit-learn,ogrisel/scikit-learn,fabianp/scikit-learn,pythonvietnam/scikit-learn,0x0all/scikit-learn,clemkoa/scikit-learn,jlegendary/scikit-learn,yyjiang/scikit-learn,mhdella/scikit-learn,idlead/scikit-learn,lazywei/scikit-learn,treycausey/scikit-learn,MechCoder/scikit-learn,Nyker510/scikit-learn,alexsavio/scikit-learn,sonnyhu/scikit-learn,herilalaina/scikit-learn,harshaneelhg/scikit-learn,raghavrv/scikit-learn,sanketloke/scikit-learn,luo66/scikit-learn,Akshay0724/scikit-learn,JPFrancoia/scikit-learn,aetilley/scikit-learn,massmutual/scikit-learn,AIML/scikit-learn,RayMick/scikit-learn,RayMick/scikit-learn,dhruv13J/scikit-learn,rsivapr/scikit-learn,zihua/scikit-learn,RPGOne/scikit-learn,yunfeilu/scikit-learn,adamgreenhall/scikit-learn,mwv/scikit-learn,fyffyt/scikit-learn,anurag313/scikit-learn,pv/scikit-learn,iismd17/scikit-learn,zorroblue/scikit-learn,rexshihaoren/scikit-learn,abhishekkrthakur/scikit-learn,lesteve/scikit-learn,jayflo/scikit-learn,pypot/scikit-learn,larsmans/scikit-learn,Aasmi/scikit-learn,Sentient07/scikit-learn,B3AU/waveTree,hsiaoyi0504/scikit-learn,procoder317/scikit-learn,nesterione/scikit-learn,jzt5132/scikit-learn,madjelan/scikit-learn,simon-pepin/scikit-learn,etkirsch/scikit-learn,raghavrv/scikit-learn,nikitasingh981/scikit-learn,herilalaina/scikit-learn,liyu1990/sklearn,lenovor/scikit-learn,ClimbsRocks/scikit-learn,yask123/scikit-learn,mjudsp/Tsallis,pnedunuri/scikit-learn,sergeyf/scikit-learn,JsNoNo/scikit-learn,ogrisel/scikit-learn,q1ang/scikit-learn,anntzer/scikit-learn,wzbozon/scikit-learn,themrmax/scikit-learn,0asa/scikit-learn,vigilv/scikit-learn,andaag/scikit-learn,PatrickOReilly/scikit-learn,tomlof/scikit-learn,mlyundin/scikit-learn,anirudhjayaraman/scikit-learn,huobaowangxi/scikit-learn,pv/scikit-learn,aflaxman/scikit-learn,aabadie/scikit-learn,vinayak-mehta/scikit-learn,ivannz/scikit-learn,AlexanderFabisch/scikit-learn,hugobowne/scikit-learn,MartinDelzant/scikit-learn,scikit-learn/scikit-learn,procoder317/scikit-learn,wzbozon/scikit-learn,shikhardb/scikit-learn,phdowling/scikit-learn,nrhine1/scikit-learn,vshtanko/scikit-learn,henrykironde/scikit-learn,thientu/scikit-learn,tosolveit/scikit-learn,DonBeo/scikit-learn,NunoEdgarGub1/scikit-learn,untom/scikit-learn,hdmetor/scikit-learn,huobaowangxi/scikit-learn,AlexRobson/scikit-learn,vigilv/scikit-learn,jmetzen/scikit-learn,xavierwu/scikit-learn,nhejazi/scikit-learn,themrmax/scikit-learn,Lawrence-Liu/scikit-learn,deepesch/scikit-learn,wzbozon/scikit-learn,UNR-AERIAL/scikit-learn,IssamLaradji/scikit-learn,mjgrav2001/scikit-learn,elkingtonmcb/scikit-learn,appapantula/scikit-learn,anurag313/scikit-learn,manhhomienbienthuy/scikit-learn,tdhopper/scikit-learn,UNR-AERIAL/scikit-learn,Garrett-R/scikit-learn,huzq/scikit-learn,shikhardb/scikit-learn,anurag313/scikit-learn,sinhrks/scikit-learn,hsuantien/scikit-learn,ahoyosid/scikit-learn,dingocuster/scikit-learn,schets/scikit-learn,nhejazi/scikit-learn,Barmaley-exe/scikit-learn,mikebenfield/scikit-learn,abhishekkrthakur/scikit-learn,LiaoPan/scikit-learn,mattgiguere/scikit-learn,eickenberg/scikit-learn,IndraVikas/scikit-learn,aminert/scikit-learn,loli/semisupervisedforests,russel1237/scikit-learn,harshaneelhg/scikit-learn,ngoix/OCRF,hitszxp/scikit-learn,terkkila/scikit-learn,maheshakya/scikit-learn,xuewei4d/scikit-learn,mehdidc/scikit-learn,aabadie/scikit-learn,fabioticconi/scikit-learn,manhhomienbienthuy/scikit-learn,shangwuhencc/scikit-learn,joernhees/scikit-learn,cl4rke/scikit-learn,BiaDarkia/scikit-learn,untom/scikit-learn,robbymeals/scikit-learn,harshaneelhg/scikit-learn,potash/scikit-learn,wlamond/scikit-learn,waterponey/scikit-learn,chrsrds/scikit-learn,Nyker510/scikit-learn,ishanic/scikit-learn,samuel1208/scikit-learn,Barmaley-exe/scikit-learn,ldirer/scikit-learn,JosmanPS/scikit-learn,Akshay0724/scikit-learn,mxjl620/scikit-learn,espg/scikit-learn,giorgiop/scikit-learn,rahuldhote/scikit-learn,mattilyra/scikit-learn,petosegan/scikit-learn,lin-credible/scikit-learn,abhishekgahlot/scikit-learn,IshankGulati/scikit-learn,vibhorag/scikit-learn,trankmichael/scikit-learn,mojoboss/scikit-learn,zaxtax/scikit-learn,vibhorag/scikit-learn,simon-pepin/scikit-learn,voxlol/scikit-learn,IshankGulati/scikit-learn,BiaDarkia/scikit-learn,mlyundin/scikit-learn,nvoron23/scikit-learn,ahoyosid/scikit-learn,tosolveit/scikit-learn,zorojean/scikit-learn,altairpearl/scikit-learn,ngoix/OCRF,MatthieuBizien/scikit-learn,cauchycui/scikit-learn,zhenv5/scikit-learn,voxlol/scikit-learn,AlexanderFabisch/scikit-learn,zaxtax/scikit-learn,justincassidy/scikit-learn,pythonvietnam/scikit-learn,devanshdalal/scikit-learn,kylerbrown/scikit-learn,q1ang/scikit-learn,shahankhatch/scikit-learn,hsuantien/scikit-learn,pypot/scikit-learn,sergeyf/scikit-learn,spallavolu/scikit-learn,cybernet14/scikit-learn,samuel1208/scikit-learn,themrmax/scikit-learn,billy-inn/scikit-learn,shahankhatch/scikit-learn,vybstat/scikit-learn,tmhm/scikit-learn,ominux/scikit-learn,liyu1990/sklearn,Barmaley-exe/scikit-learn,fredhusser/scikit-learn,wanggang3333/scikit-learn,quheng/scikit-learn,Obus/scikit-learn,pkruskal/scikit-learn,saiwing-yeung/scikit-learn,jpautom/scikit-learn,toastedcornflakes/scikit-learn,andaag/scikit-learn,alvarofierroclavero/scikit-learn,RayMick/scikit-learn,mattgiguere/scikit-learn,Fireblend/scikit-learn,Aasmi/scikit-learn,PrashntS/scikit-learn,jaidevd/scikit-learn,bhargav/scikit-learn,mjgrav2001/scikit-learn,cauchycui/scikit-learn,eg-zhang/scikit-learn,MartinSavc/scikit-learn,jm-begon/scikit-learn,huobaowangxi/scikit-learn,JsNoNo/scikit-learn,0asa/scikit-learn,vybstat/scikit-learn,shyamalschandra/scikit-learn,AlexandreAbraham/scikit-learn,trankmichael/scikit-learn,Nyker510/scikit-learn,rahul-c1/scikit-learn,kmike/scikit-learn,robbymeals/scikit-learn,abimannans/scikit-learn,trankmichael/scikit-learn,ngoix/OCRF,aabadie/scikit-learn,btabibian/scikit-learn,btabibian/scikit-learn,thilbern/scikit-learn,xwolf12/scikit-learn,rrohan/scikit-learn,belltailjp/scikit-learn,jorge2703/scikit-learn,ltiao/scikit-learn,ngoix/OCRF,sgenoud/scikit-learn,gotomypc/scikit-learn,evgchz/scikit-learn,hitszxp/scikit-learn,MartinSavc/scikit-learn,loli/sklearn-ensembletrees,Garrett-R/scikit-learn,henrykironde/scikit-learn,AnasGhrab/scikit-learn,mjudsp/Tsallis,nesterione/scikit-learn,altairpearl/scikit-learn,potash/scikit-learn,mhue/scikit-learn,jblackburne/scikit-learn,ishanic/scikit-learn,PatrickChrist/scikit-learn,jayflo/scikit-learn,tmhm/scikit-learn,jmschrei/scikit-learn,massmutual/scikit-learn,RPGOne/scikit-learn,shikhardb/scikit-learn,rvraghav93/scikit-learn,glemaitre/scikit-learn,vinayak-mehta/scikit-learn,arahuja/scikit-learn,ashhher3/scikit-learn,loli/sklearn-ensembletrees,abimannans/scikit-learn,moutai/scikit-learn,gotomypc/scikit-learn,Adai0808/scikit-learn,CforED/Machine-Learning,bthirion/scikit-learn,poryfly/scikit-learn,pratapvardhan/scikit-learn,sinhrks/scikit-learn,kjung/scikit-learn,RomainBrault/scikit-learn,jpautom/scikit-learn,nelson-liu/scikit-learn,Lawrence-Liu/scikit-learn,ankurankan/scikit-learn,eg-zhang/scikit-learn,nmayorov/scikit-learn,marcocaccin/scikit-learn,waterponey/scikit-learn,PatrickChrist/scikit-learn,rvraghav93/scikit-learn,xiaoxiamii/scikit-learn,deepesch/scikit-learn,smartscheduling/scikit-learn-categorical-tree,sgenoud/scikit-learn,untom/scikit-learn,akionakamura/scikit-learn,yask123/scikit-learn,mblondel/scikit-learn,rexshihaoren/scikit-learn,abimannans/scikit-learn,equialgo/scikit-learn,devanshdalal/scikit-learn,MartinSavc/scikit-learn,RPGOne/scikit-learn,ominux/scikit-learn,mugizico/scikit-learn,mehdidc/scikit-learn,Myasuka/scikit-learn,AnasGhrab/scikit-learn,murali-munna/scikit-learn,pianomania/scikit-learn,mblondel/scikit-learn,RPGOne/scikit-learn,jakirkham/scikit-learn,Srisai85/scikit-learn,sonnyhu/scikit-learn,russel1237/scikit-learn,thilbern/scikit-learn,mikebenfield/scikit-learn,rishikksh20/scikit-learn,Vimos/scikit-learn,shenzebang/scikit-learn,lazywei/scikit-learn,pnedunuri/scikit-learn,MatthieuBizien/scikit-learn,ilo10/scikit-learn,kevin-intel/scikit-learn,sarahgrogan/scikit-learn,wlamond/scikit-learn,terkkila/scikit-learn,saiwing-yeung/scikit-learn | examples/svm/plot_iris.py | examples/svm/plot_iris.py | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface and the support vectors.
"""
import numpy as np
import pylab as pl
from scikits.learn import svm, datasets
# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the first two features. We could
# avoid this ugly slicing by using a two-dim dataset
Y = iris.target
h=.02 # step size in the mesh
# we create an instance of SVM and fit out data. We do not scale our
# data since we want to plot the support vectors
svc = svm.SVC(kernel='linear').fit(X, Y)
rbf_svc = svm.SVC(kernel='poly').fit(X, Y)
nu_svc = svm.NuSVC(kernel='linear').fit(X,Y)
lin_svc = svm.LinearSVC().fit(X, Y)
# create a mesh to plot in
x_min, x_max = X[:,0].min()-1, X[:,0].max()+1
y_min, y_max = X[:,1].min()-1, X[:,1].max()+1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
np.arange(y_min, y_max, h))
# title for the plots
titles = ['SVC with linear kernel',
'SVC with polynomial (degree 3) kernel',
'NuSVC with linear kernel',
'LinearSVC (linear kernel)']
pl.set_cmap(pl.cm.Paired)
for i, clf in enumerate((svc, rbf_svc, nu_svc, lin_svc)):
# Plot the decision boundary. For that, we will asign a color to each
# point in the mesh [x_min, m_max]x[y_min, y_max].
pl.subplot(2, 2, i+1)
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
# Put the result into a color plot
Z = Z.reshape(xx.shape)
pl.set_cmap(pl.cm.Paired)
pl.contourf(xx, yy, Z)
pl.axis('tight')
# Plot also the training points
pl.scatter(X[:,0], X[:,1], c=Y)
pl.title(titles[i])
pl.axis('tight')
pl.show()
| """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface for four different SVM classifiers.
"""
import numpy as np
import pylab as pl
from scikits.learn import svm, datasets
# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the first two features. We could
# avoid this ugly slicing by using a two-dim dataset
Y = iris.target
h=.02 # step size in the mesh
# we create an instance of SVM and fit out data. We do not scale our
# data since we want to plot the support vectors
svc = svm.SVC(kernel='linear').fit(X, Y)
rbf_svc = svm.SVC(kernel='poly').fit(X, Y)
nu_svc = svm.NuSVC(kernel='linear').fit(X,Y)
lin_svc = svm.LinearSVC().fit(X, Y)
# create a mesh to plot in
x_min, x_max = X[:,0].min()-1, X[:,0].max()+1
y_min, y_max = X[:,1].min()-1, X[:,1].max()+1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
np.arange(y_min, y_max, h))
# title for the plots
titles = ['SVC with linear kernel',
'SVC with polynomial (degree 3) kernel',
'NuSVC with linear kernel',
'LinearSVC (linear kernel)']
pl.set_cmap(pl.cm.Paired)
for i, clf in enumerate((svc, rbf_svc, nu_svc, lin_svc)):
# Plot the decision boundary. For that, we will asign a color to each
# point in the mesh [x_min, m_max]x[y_min, y_max].
pl.subplot(2, 2, i+1)
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
# Put the result into a color plot
Z = Z.reshape(xx.shape)
pl.set_cmap(pl.cm.Paired)
pl.contourf(xx, yy, Z)
pl.axis('tight')
# Plot also the training points
pl.scatter(X[:,0], X[:,1], c=Y)
pl.title(titles[i])
pl.axis('tight')
pl.show()
| bsd-3-clause | Python |
9ba3c840514e765acac2542ee3faf47671824918 | add missing source file | chfw/moban,chfw/moban | moban/buffered_writer.py | moban/buffered_writer.py | from moban import utils, file_system
import fs
import fs.path
class BufferedWriter(object):
def __init__(self):
self.fs_list = {}
def write_file_out(self, filename, content):
if "zip://" in filename:
self.write_file_out_to_zip(filename, content)
else:
utils.write_file_out(filename, content)
def write_file_out_to_zip(self, filename, content):
zip_file, file_name = filename.split(".zip/")
zip_file = zip_file + ".zip"
if zip_file not in self.fs_list:
self.fs_list[zip_file] = fs.open_fs(
file_system.to_unicode(zip_file), create=True
)
base_dirs = fs.path.dirname(file_name)
if not self.fs_list[zip_file].exists(base_dirs):
self.fs_list[zip_file].makedirs(base_dirs)
self.fs_list[zip_file].writebytes(
file_system.to_unicode(file_name), content
)
def close(self):
for fsx in self.fs_list.values():
fsx.close()
| mit | Python |
|
b573daf86d2bcb5d8dc71e45a65b5f2ffc0866b1 | Correct module help | iglocska/PyMISP,pombredanne/PyMISP | examples/create_events.py | examples/create_events.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create an event on MISP.')
parser.add_argument("-d", "--distrib", type=int, help="The distribution setting used for the attributes and for the newly created event, if relevant. [0-3].")
parser.add_argument("-i", "--info", help="Used to populate the event info field if no event ID supplied.")
parser.add_argument("-a", "--analysis", type=int, help="The analysis level of the newly created event, if applicatble. [0-2]")
parser.add_argument("-t", "--threat", type=int, help="The threat level ID of the newly created event, if applicatble. [1-4]")
args = parser.parse_args()
misp = init(misp_url, misp_key)
event = misp.new_event(args.distrib, args.threat, args.analysis, args.info)
print event
response = misp.add_mutex(event, 'booh')
print response
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create an event on MISP.')
parser.add_argument("-d", "--distrib", type=int, help="The distribution setting used for the attributes and for the newly created event, if relevant. [0-3].")
parser.add_argument("-i", "--info", help="Used to populate the event info field if no event ID supplied.")
parser.add_argument("-a", "--analysis", type=int, help="The analysis level of the newly created event, if applicatble. [0-2]")
parser.add_argument("-t", "--threat", type=int, help="The threat level ID of the newly created event, if applicatble. [0-3]")
args = parser.parse_args()
misp = init(misp_url, misp_key)
event = misp.new_event(args.distrib, args.threat, args.analysis, args.info)
print event
response = misp.add_mutex(event, 'booh')
print response
| bsd-2-clause | Python |
291d882a29981ea6c82c40c8e9a001aa3305e0ae | Create 8kyu_do_I_get_a_bonus.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | def bonus_time(salary, bonus):
return '${}'.format(salary*([1,10][bonus]))
| mit | Python |
|
7c16172f9ebe65d6928a72001a086637bf4bd725 | Fix buggy annotations for stdout/stderr. | peguin40/zulip,TigorC/zulip,showell/zulip,rishig/zulip,grave-w-grave/zulip,Galexrt/zulip,kou/zulip,Jianchun1/zulip,sup95/zulip,jrowan/zulip,cosmicAsymmetry/zulip,jainayush975/zulip,kou/zulip,hackerkid/zulip,j831/zulip,brockwhittaker/zulip,Juanvulcano/zulip,paxapy/zulip,reyha/zulip,jphilipsen05/zulip,j831/zulip,tommyip/zulip,mahim97/zulip,amanharitsh123/zulip,jackrzhang/zulip,dhcrzf/zulip,jainayush975/zulip,zulip/zulip,kou/zulip,dawran6/zulip,susansls/zulip,tommyip/zulip,timabbott/zulip,synicalsyntax/zulip,synicalsyntax/zulip,dhcrzf/zulip,sup95/zulip,samatdav/zulip,joyhchen/zulip,aakash-cr7/zulip,reyha/zulip,niftynei/zulip,jrowan/zulip,arpith/zulip,vikas-parashar/zulip,mohsenSy/zulip,jrowan/zulip,hackerkid/zulip,Diptanshu8/zulip,dattatreya303/zulip,SmartPeople/zulip,andersk/zulip,jackrzhang/zulip,mohsenSy/zulip,eeshangarg/zulip,jackrzhang/zulip,timabbott/zulip,dawran6/zulip,kou/zulip,sharmaeklavya2/zulip,TigorC/zulip,AZtheAsian/zulip,vaidap/zulip,sonali0901/zulip,TigorC/zulip,rishig/zulip,JPJPJPOPOP/zulip,reyha/zulip,souravbadami/zulip,jrowan/zulip,PhilSk/zulip,jackrzhang/zulip,isht3/zulip,eeshangarg/zulip,JPJPJPOPOP/zulip,zacps/zulip,ryanbackman/zulip,KingxBanana/zulip,joyhchen/zulip,blaze225/zulip,niftynei/zulip,dawran6/zulip,j831/zulip,tommyip/zulip,sharmaeklavya2/zulip,mohsenSy/zulip,paxapy/zulip,sonali0901/zulip,grave-w-grave/zulip,timabbott/zulip,brainwane/zulip,calvinleenyc/zulip,TigorC/zulip,verma-varsha/zulip,paxapy/zulip,Galexrt/zulip,hackerkid/zulip,jainayush975/zulip,christi3k/zulip,synicalsyntax/zulip,zulip/zulip,synicalsyntax/zulip,brockwhittaker/zulip,tommyip/zulip,Jianchun1/zulip,ryanbackman/zulip,christi3k/zulip,amyliu345/zulip,synicalsyntax/zulip,joyhchen/zulip,souravbadami/zulip,dawran6/zulip,verma-varsha/zulip,zacps/zulip,SmartPeople/zulip,showell/zulip,reyha/zulip,brockwhittaker/zulip,dhcrzf/zulip,JPJPJPOPOP/zulip,christi3k/zulip,susansls/zulip,brainwane/zulip,Diptanshu8/zulip,reyha/zulip,dattatreya303/zulip,Juanvulcano/zulip,zacps/zulip,synicalsyntax/zulip,Jianchun1/zulip,punchagan/zulip,vabs22/zulip,eeshangarg/zulip,arpith/zulip,JPJPJPOPOP/zulip,dattatreya303/zulip,eeshangarg/zulip,vabs22/zulip,jphilipsen05/zulip,mahim97/zulip,sonali0901/zulip,niftynei/zulip,showell/zulip,brockwhittaker/zulip,zulip/zulip,rht/zulip,timabbott/zulip,shubhamdhama/zulip,dattatreya303/zulip,arpith/zulip,sharmaeklavya2/zulip,zulip/zulip,sharmaeklavya2/zulip,shubhamdhama/zulip,niftynei/zulip,andersk/zulip,dattatreya303/zulip,vaidap/zulip,susansls/zulip,j831/zulip,susansls/zulip,niftynei/zulip,vabs22/zulip,Diptanshu8/zulip,samatdav/zulip,hackerkid/zulip,calvinleenyc/zulip,peguin40/zulip,j831/zulip,PhilSk/zulip,KingxBanana/zulip,aakash-cr7/zulip,timabbott/zulip,arpith/zulip,ryanbackman/zulip,paxapy/zulip,Galexrt/zulip,KingxBanana/zulip,SmartPeople/zulip,timabbott/zulip,susansls/zulip,vabs22/zulip,sup95/zulip,jrowan/zulip,mohsenSy/zulip,samatdav/zulip,amyliu345/zulip,vikas-parashar/zulip,punchagan/zulip,showell/zulip,Jianchun1/zulip,Juanvulcano/zulip,AZtheAsian/zulip,sonali0901/zulip,verma-varsha/zulip,AZtheAsian/zulip,ryanbackman/zulip,mohsenSy/zulip,calvinleenyc/zulip,jackrzhang/zulip,dhcrzf/zulip,isht3/zulip,zacps/zulip,Galexrt/zulip,sharmaeklavya2/zulip,aakash-cr7/zulip,dhcrzf/zulip,brainwane/zulip,brainwane/zulip,brockwhittaker/zulip,mahim97/zulip,Galexrt/zulip,calvinleenyc/zulip,punchagan/zulip,Diptanshu8/zulip,jphilipsen05/zulip,Juanvulcano/zulip,jackrzhang/zulip,jainayush975/zulip,amanharitsh123/zulip,cosmicAsymmetry/zulip,hackerkid/zulip,cosmicAsymmetry/zulip,tommyip/zulip,vikas-parashar/zulip,TigorC/zulip,mahim97/zulip,calvinleenyc/zulip,Galexrt/zulip,j831/zulip,shubhamdhama/zulip,vikas-parashar/zulip,showell/zulip,kou/zulip,amyliu345/zulip,shubhamdhama/zulip,kou/zulip,souravbadami/zulip,jainayush975/zulip,shubhamdhama/zulip,vaidap/zulip,cosmicAsymmetry/zulip,dhcrzf/zulip,shubhamdhama/zulip,grave-w-grave/zulip,rishig/zulip,vabs22/zulip,christi3k/zulip,Diptanshu8/zulip,andersk/zulip,jphilipsen05/zulip,blaze225/zulip,eeshangarg/zulip,brainwane/zulip,Jianchun1/zulip,joyhchen/zulip,amanharitsh123/zulip,andersk/zulip,zacps/zulip,rht/zulip,peguin40/zulip,ryanbackman/zulip,andersk/zulip,AZtheAsian/zulip,peguin40/zulip,punchagan/zulip,samatdav/zulip,brainwane/zulip,cosmicAsymmetry/zulip,punchagan/zulip,andersk/zulip,jphilipsen05/zulip,susansls/zulip,amyliu345/zulip,vabs22/zulip,brainwane/zulip,dattatreya303/zulip,PhilSk/zulip,SmartPeople/zulip,andersk/zulip,cosmicAsymmetry/zulip,timabbott/zulip,zacps/zulip,kou/zulip,souravbadami/zulip,KingxBanana/zulip,AZtheAsian/zulip,sup95/zulip,grave-w-grave/zulip,souravbadami/zulip,souravbadami/zulip,vaidap/zulip,paxapy/zulip,mohsenSy/zulip,rishig/zulip,tommyip/zulip,blaze225/zulip,rht/zulip,AZtheAsian/zulip,tommyip/zulip,eeshangarg/zulip,vikas-parashar/zulip,Jianchun1/zulip,rishig/zulip,jrowan/zulip,sup95/zulip,Diptanshu8/zulip,isht3/zulip,KingxBanana/zulip,mahim97/zulip,sonali0901/zulip,rht/zulip,dhcrzf/zulip,vaidap/zulip,rht/zulip,samatdav/zulip,JPJPJPOPOP/zulip,punchagan/zulip,verma-varsha/zulip,blaze225/zulip,showell/zulip,eeshangarg/zulip,calvinleenyc/zulip,jainayush975/zulip,aakash-cr7/zulip,zulip/zulip,SmartPeople/zulip,aakash-cr7/zulip,amanharitsh123/zulip,TigorC/zulip,amyliu345/zulip,vaidap/zulip,Juanvulcano/zulip,sharmaeklavya2/zulip,arpith/zulip,hackerkid/zulip,showell/zulip,paxapy/zulip,blaze225/zulip,blaze225/zulip,isht3/zulip,peguin40/zulip,reyha/zulip,joyhchen/zulip,PhilSk/zulip,jackrzhang/zulip,synicalsyntax/zulip,christi3k/zulip,PhilSk/zulip,isht3/zulip,aakash-cr7/zulip,rishig/zulip,rht/zulip,rishig/zulip,grave-w-grave/zulip,peguin40/zulip,christi3k/zulip,samatdav/zulip,dawran6/zulip,mahim97/zulip,amanharitsh123/zulip,JPJPJPOPOP/zulip,KingxBanana/zulip,vikas-parashar/zulip,sonali0901/zulip,shubhamdhama/zulip,dawran6/zulip,niftynei/zulip,zulip/zulip,verma-varsha/zulip,jphilipsen05/zulip,arpith/zulip,zulip/zulip,Juanvulcano/zulip,Galexrt/zulip,SmartPeople/zulip,verma-varsha/zulip,grave-w-grave/zulip,ryanbackman/zulip,rht/zulip,joyhchen/zulip,amyliu345/zulip,amanharitsh123/zulip,sup95/zulip,PhilSk/zulip,isht3/zulip,hackerkid/zulip,punchagan/zulip,brockwhittaker/zulip | scripts/lib/node_cache.py | scripts/lib/node_cache.py | from __future__ import print_function
import os
import hashlib
from os.path import dirname, abspath
if False:
from typing import Optional, List, IO, Tuple
from scripts.lib.zulip_tools import subprocess_text_output, run
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
NPM_CACHE_PATH = "/srv/zulip-npm-cache"
if 'TRAVIS' in os.environ:
# In Travis CI, we don't have root access
NPM_CACHE_PATH = "/home/travis/zulip-npm-cache"
def setup_node_modules(npm_args=None, stdout=None, stderr=None, copy_modules=False):
# type: (Optional[List[str]], Optional[IO], Optional[IO], Optional[bool]) -> None
sha1sum = hashlib.sha1()
sha1sum.update(subprocess_text_output(['cat', 'package.json']).encode('utf8'))
sha1sum.update(subprocess_text_output(['npm', '--version']).encode('utf8'))
sha1sum.update(subprocess_text_output(['node', '--version']).encode('utf8'))
if npm_args is not None:
sha1sum.update(''.join(sorted(npm_args)).encode('utf8'))
npm_cache = os.path.join(NPM_CACHE_PATH, sha1sum.hexdigest())
cached_node_modules = os.path.join(npm_cache, 'node_modules')
success_stamp = os.path.join(cached_node_modules, '.success-stamp')
# Check if a cached version already exists
if not os.path.exists(success_stamp):
do_npm_install(npm_cache, npm_args or [], stdout, stderr, copy_modules)
print("Using cached node modules from %s" % (cached_node_modules,))
cmds = [
['rm', '-rf', 'node_modules'],
["ln", "-nsf", cached_node_modules, 'node_modules'],
['touch', success_stamp],
]
for cmd in cmds:
run(cmd, stdout=stdout, stderr=stderr)
def do_npm_install(target_path, npm_args, stdout=None, stderr=None, copy_modules=False):
# type: (str, List[str], Optional[IO], Optional[IO], Optional[bool]) -> None
cmds = [
["sudo", "rm", "-rf", target_path],
['sudo', 'mkdir', '-p', target_path],
["sudo", "chown", "{}:{}".format(os.getuid(), os.getgid()), target_path],
['cp', 'package.json', target_path],
]
if copy_modules:
print("Cached version not found! Copying node modules.")
cmds.append(["mv", "node_modules", target_path])
else:
print("Cached version not found! Installing node modules.")
cmds.append(['npm', 'install'] + npm_args + ['--prefix', target_path])
for cmd in cmds:
run(cmd, stdout=stdout, stderr=stderr)
| from __future__ import print_function
import os
import hashlib
from os.path import dirname, abspath
if False:
from typing import Optional, List, Tuple
from scripts.lib.zulip_tools import subprocess_text_output, run
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
NPM_CACHE_PATH = "/srv/zulip-npm-cache"
if 'TRAVIS' in os.environ:
# In Travis CI, we don't have root access
NPM_CACHE_PATH = "/home/travis/zulip-npm-cache"
def setup_node_modules(npm_args=None, stdout=None, stderr=None, copy_modules=False):
# type: (Optional[List[str]], Optional[str], Optional[str], Optional[bool]) -> None
sha1sum = hashlib.sha1()
sha1sum.update(subprocess_text_output(['cat', 'package.json']).encode('utf8'))
sha1sum.update(subprocess_text_output(['npm', '--version']).encode('utf8'))
sha1sum.update(subprocess_text_output(['node', '--version']).encode('utf8'))
if npm_args is not None:
sha1sum.update(''.join(sorted(npm_args)).encode('utf8'))
npm_cache = os.path.join(NPM_CACHE_PATH, sha1sum.hexdigest())
cached_node_modules = os.path.join(npm_cache, 'node_modules')
success_stamp = os.path.join(cached_node_modules, '.success-stamp')
# Check if a cached version already exists
if not os.path.exists(success_stamp):
do_npm_install(npm_cache, npm_args or [], stdout, stderr, copy_modules)
print("Using cached node modules from %s" % (cached_node_modules,))
cmds = [
['rm', '-rf', 'node_modules'],
["ln", "-nsf", cached_node_modules, 'node_modules'],
['touch', success_stamp],
]
for cmd in cmds:
run(cmd, stdout=stdout, stderr=stderr)
def do_npm_install(target_path, npm_args, stdout=None, stderr=None, copy_modules=False):
# type: (str, List[str], Optional[str], Optional[str], Optional[bool]) -> None
cmds = [
["sudo", "rm", "-rf", target_path],
['sudo', 'mkdir', '-p', target_path],
["sudo", "chown", "{}:{}".format(os.getuid(), os.getgid()), target_path],
['cp', 'package.json', target_path],
]
if copy_modules:
print("Cached version not found! Copying node modules.")
cmds.append(["mv", "node_modules", target_path])
else:
print("Cached version not found! Installing node modules.")
cmds.append(['npm', 'install'] + npm_args + ['--prefix', target_path])
for cmd in cmds:
run(cmd, stdout=stdout, stderr=stderr)
| apache-2.0 | Python |
d10ec57d6f58a4f96a2f648cac1bc94dc78efc32 | Implement identifying to accounts | Heufneutje/txircd | txircd/modules/extra/services/account_identify.py | txircd/modules/extra/services/account_identify.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERROR>
class AccountIdentify(ModuleData):
implements(IPlugin, IModuleData)
name = "AccountIdentify"
def userCommands(self):
return [ ("IDENTIFY", 1, IdentifyCommand(self)),
("ID", 1, IdCommand(self)) ]
def parseParams(self, command, user, params, prefix, tags):
if not params:
user.sendSingleError("IdentifyParams", irc.ERR_NEEDMOREPARAMS, command, "Not enough parameters")
return None
if len(params) == 1:
return {
"password": params[0]
}
return {
"accountname": params[0],
"password": params[1]
}
def execute(self, user, data):
resultValue = self.ircd.runActionUntilValue("accountauthenticate", user, data["accountname"] if "accountname" in data else user.nick, data["password"])
if not resultValue:
user.sendMessage(irc.ERR_SERVICES, "ACCOUNT", "IDENTIFY", "This server doesn't have accounts set up.")
user.sendMessage("NOTICE", "This server doesn't have accounts set up.")
return True
if resultValue[0]:
return True
user.sendMessage(irc.ERR_SERVICES, "ACCOUNT", "IDENTIFY", resultValue[1])
user.sendMessage("NOTICE", resultValue[1])
return True
class IdentifyCommand(Command):
implements(ICommand)
def __init__(self, module):
self.module = module
def parseParams(self, user, params, prefix, tags):
return self.module.parseParams("IDENTIFY", user, params, prefix, tags)
def execute(self, user, data):
return self.module.execute(user, data)
class IdCommand(Command):
implements(ICommand)
def __init__(self, module):
self.module = module
def parseParams(self, user, params, prefix, tags):
return self.module.parseParams("ID", user, params, prefix, tags)
def execute(self, user, data):
self.module.execute(user, data)
identifyCommand = AccountIdentify() | bsd-3-clause | Python |
|
166854466771850bda3384b75d0f8d0656c259f6 | add predict | Superjom/sematic,Superjom/sematic | gen_predict_res_format.py | gen_predict_res_format.py | # -*- coding: utf-8 -*-
'''
Created on Jul 9, 2013
@author: Chunwei Yan @ pkusz
@mail: yanchunwei@outlook.com
'''
import sys
from utils import get_num_lines, args_check
class Gen(object):
formats = {
'1':1,
'-1':0,
}
def __init__(self, fph, test_ph, tph):
self.fph, self.test_ph, self.tph = \
fph, test_ph, tph
def __call__(self):
self.trans()
self.tofile()
def trans(self):
num_lines = get_num_lines(self.test_ph)
self.lines = []
with open(self.fph) as resf:
with open(self.test_ph) as testf:
for i in range(num_lines):
res = resf.readline()
tes = testf.readline()
label = self.formats.get(res.strip())
line = "%d\t%s" % (label, tes.strip())
self.lines.append(line)
def tofile(self):
with open(self.tph, 'w') as f:
f.write('\n'.join(self.lines))
if __name__ == "__main__":
fph, test_ph, tph = args_check(3, "")
g = Gen(fph, test_ph, tph)
g()
| mit | Python |
|
aa6837e14e520f5917cf1c452bd0c9a8ce2a27dd | Add new module for plugin loading | minoue/miExecutor | module/others/plugins.py | module/others/plugins.py | from maya import cmds
class Commands(object):
""" class name must be 'Commands' """
commandDict = {}
def _loadObjPlugin(self):
if not cmds.pluginInfo("objExport", q=True, loaded=True):
cmds.loadPlugin("objExport")
commandDict['sampleCommand'] = "sphere.png"
# ^ Don't forget to add the command to the dictionary.
| mit | Python |
|
67350e9ac3f2dc0fceb1899c8692adcd9cdd4213 | Add a test case to validate `get_unseen_notes` | yashodhank/frappe,StrellaGroup/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,yashodhank/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,StrellaGroup/frappe | frappe/tests/test_boot.py | frappe/tests/test_boot.py | import unittest
import frappe
from frappe.boot import get_unseen_notes
from frappe.desk.doctype.note.note import mark_as_seen
class TestBootData(unittest.TestCase):
def test_get_unseen_notes(self):
frappe.db.delete("Note")
frappe.db.delete("Note Seen By")
note = frappe.get_doc(
{
"doctype": "Note",
"title": "Test Note",
"notify_on_login": 1,
"content": "Test Note 1",
"public": 1,
}
)
note.insert()
frappe.set_user("test@example.com")
unseen_notes = [d.title for d in get_unseen_notes()]
self.assertListEqual(unseen_notes, ["Test Note"])
mark_as_seen(note.name)
unseen_notes = [d.title for d in get_unseen_notes()]
self.assertListEqual(unseen_notes, [])
| mit | Python |
|
15fd5f6ddd3aa79a26b28d5ef4b93eeb12e28956 | add an update_users management command | edx/edx-ora,edx/edx-ora,edx/edx-ora,edx/edx-ora | controller/management/commands/update_users.py | controller/management/commands/update_users.py | """
Ensure that the right users exist:
- read USERS dictionary from auth.json
- if they don't exist, create them.
- if they do, update the passwords to match
"""
import json
import logging
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import User
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Create users that are specified in auth.json"
def handle(self, *args, **options):
log.info("root is : " + settings.ENV_ROOT)
auth_path = settings.ENV_ROOT / "auth.json"
log.info(' [*] reading {0}'.format(auth_path))
with open(auth_path) as auth_file:
AUTH_TOKENS = json.load(auth_file)
users = AUTH_TOKENS.get('USERS', {})
for username, pwd in users.items():
log.info(' [*] Creating/updating user {0}'.format(username))
try:
user = User.objects.get(username=username)
user.set_password(pwd)
user.save()
except User.DoesNotExist:
log.info(' ... {0} does not exist. Creating'.format(username))
user = User.objects.create(username=username,
email=username + '@dummy.edx.org',
is_active=True)
user.set_password(pwd)
user.save()
log.info(' [*] All done!')
| agpl-3.0 | Python |
|
3d0f6085bceffc5941e55678da20d8db4a7d5ce2 | Create question4.py | pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion | huangguolong/question4.py | huangguolong/question4.py |
def fib(nums):
'''
:param nums: 一个整数,相当于数列的下标
:return: 返回该下标的值
'''
if nums == 0 or nums == 1:
return nums
else:
return fib(nums-2) + fib(nums-1)
def createFib(n):
'''
:param n: 需要展示前面n个数
:return: 返回一个列表,费波那契数列
'''
list1 = []
for i in range(n):
list1.append(fib(i))
print(list1)
#调用生成费波那契数列函数,指定展示的前面n个数
createFib(20)
| mit | Python |
|
448ca2cfb8f7e167b1395e84a4f2b4b4cea57905 | add file | PegasusWang/articles,PegasusWang/articles,PegasusWang/articles | crawler/jb51.py | crawler/jb51.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from async_spider import AsySpider
class Jb51Spider(AsySpider):
def handle_html(self, url, html):
print(url)
'''
filename = url.rsplit('/', 1)[1]
with open(filename, 'w+') as f:
f.write(html)
'''
if __name__ == '__main__':
urls = []
for page in range(1, 73000):
urls.append('http://www.jb51.net/article/%s.htm' % page)
s = Jb51Spider(urls)
s.run()
| mit | Python |
|
55b3269f9c2cd22ef75a2632f04e37a9f723e961 | add data migration | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0033_migrate_gender_data.py | accelerator/migrations/0033_migrate_gender_data.py | # Generated by Django 2.2.10 on 2021-01-22 12:13
import sys
from django.contrib.auth import get_user_model
from django.db import migrations
# gender identity
GENDER_MALE = "Male"
GENDER_FEMALE = "Female"
GENDER_PREFER_TO_SELF_DESCRIBE = "I Prefer To Self-describe"
GENDER_PREFER_NOT_TO_SAY = "I Prefer Not To Say"
# gender
MALE_CHOICE = 'm'
FEMALE_CHOICE = 'f'
OTHER_CHOICE = 'o'
PREFER_NOT_TO_STATE_CHOICE = 'p'
gender_map = {
MALE_CHOICE: GENDER_MALE,
FEMALE_CHOICE: GENDER_FEMALE,
OTHER_CHOICE: GENDER_PREFER_TO_SELF_DESCRIBE,
PREFER_NOT_TO_STATE_CHOICE: GENDER_PREFER_NOT_TO_SAY,
}
def get_gender_choice_obj_dict(apps):
GenderChoices = apps.get_model('accelerator', 'GenderChoices')
return {
gender_choice.name: gender_choice
for gender_choice in GenderChoices.objects.all()
}
def add_gender_identity(profile, gender_choice):
if not profile.gender_identity.filter(pk=gender_choice.pk).exists():
profile.gender_identity.add(gender_choice.pk)
def migrate_gender_data_to_gender_identity(apps, schema_editor):
users = get_user_model().objects.all()
gender_choices = get_gender_choice_obj_dict(apps)
for user in users:
profile = user.get_profile()
gender = profile.gender
if gender:
try:
gender_choice = gender_choices[gender_map[gender.lower()]]
add_gender_identity(profile, gender_choice)
except KeyError:
print(f"Exception: {type(profile)} ID:{profile.id}"
f" has unexpected gender value '{gender}'")
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0032_add_ethno_racial_identity_data'),
]
operations = [
migrations.RunPython(
migrate_gender_data_to_gender_identity,
migrations.RunPython.noop,
)
]
| mit | Python |
|
3344bb0a967c4217f6fa1d701b2c4dfb89d578aa | add new package : alluxio (#14143) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/alluxio/package.py | var/spack/repos/builtin/packages/alluxio/package.py | # Copyright 2013-2019 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 Alluxio(Package):
"""
Alluxio (formerly known as Tachyon) is a virtual distributed storage
system. It bridges the gap between computation frameworks and storage
systems, enabling computation applications to connect to numerous
storage systems through a common interface.
"""
homepage = "https://github.com/Alluxio/alluxio"
url = "https://github.com/Alluxio/alluxio/archive/v2.1.0.tar.gz"
version('2.1.0', sha256='c8b5b7848488e0ac10b093eea02ef05fa822250669d184291cc51b2f8aac253e')
def install(self, spec, prefix):
install_tree('.', prefix)
| lgpl-2.1 | Python |
|
6dc035051d666707fdc09e63f510dbc4edf1724d | Migrate lab_members | mfcovington/django-lab-members,mfcovington/django-lab-members,mfcovington/django-lab-members | lab_members/migrations/0001_initial.py | lab_members/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Position',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=64, unique=True, help_text='Please enter a title for this position', default='', verbose_name='title')),
],
options={
'verbose_name': 'Position',
'verbose_name_plural': 'Positions',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Scientist',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')),
('full_name', models.CharField(max_length=64, unique=True, help_text='Please enter a full name for this scientist', default='', verbose_name='full name')),
('slug', models.SlugField(max_length=64, help_text='Please enter a unique slug for this scientist', default='', verbose_name='slug')),
('title', models.ForeignKey(blank=True, help_text='Please specify a title for this scientist', default=None, to='lab_members.Position', null=True)),
],
options={
'verbose_name': 'Scientist',
'verbose_name_plural': 'Scientists',
},
bases=(models.Model,),
),
]
| bsd-3-clause | Python |
|
f7f25876d3398cacc822faf2b16cc156e88c7fd3 | Use this enough, might as well add it. | ehenneken/loris,medusa-project/loris,rlskoeser/loris,medusa-project/loris,rlskoeser/loris,ehenneken/loris | misc/jp2_kakadu_pillow.py | misc/jp2_kakadu_pillow.py | # This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow
# Useful for debugging the scenario independent of the server.
from PIL import Image
from PIL.ImageFile import Parser
from os import makedirs, path, unlink
import subprocess
import sys
KDU_EXPAND='/usr/local/bin/kdu_expand'
LIB_KDU='/usr/local/lib/libkdu_v72R.so'
TMP='/tmp'
INPUT_JP2='/home/jstroop/Desktop/nanteuil.jp2'
OUT_JPG='/tmp/test.jpg'
REDUCE=0
### cmds, etc.
pipe_fp = '%s/mypipe.bmp' % (TMP,)
kdu_cmd = '%s -i %s -o %s -num_threads 4 -reduce %d' % (KDU_EXPAND, INPUT_JP2, pipe_fp, REDUCE)
mkfifo_cmd = '/usr/bin/mkfifo %s' % (pipe_fp,)
rmfifo_cmd = '/bin/rm %s' % (pipe_fp,)
# make a named pipe
mkfifo_resp = subprocess.check_call(mkfifo_cmd, shell=True)
if mkfifo_resp == 0:
print 'mkfifo OK'
# write kdu_expand's output to the named pipe
kdu_expand_proc = subprocess.Popen(kdu_cmd, shell=True,
bufsize=-1, stderr=subprocess.PIPE, stdout=subprocess.PIPE,
env={ 'LD_LIBRARY_PATH' : KDU_EXPAND })
# open the named pipe and parse the stream
with open(pipe_fp, 'rb') as f:
p = Parser()
while True:
s = f.read(1024)
if not s:
break
p.feed(s)
im = p.close()
# finish kdu
kdu_exit = kdu_expand_proc.wait()
if kdu_exit != 0:
map(sys.stderr.write, kdu_expand_proc.stderr)
else:
# if kdu was successful, save to a jpg
map(sys.stdout.write, kdu_expand_proc.stdout)
im = im.resize((719,900), resample=Image.ANTIALIAS)
im.save(OUT_JPG, quality=95)
# remove the named pipe
rmfifo_resp = subprocess.check_call(rmfifo_cmd, shell=True)
if rmfifo_resp == 0:
print 'rm fifo OK'
| bsd-2-clause | Python |
|
2f9324f4d073082f47ecd8279d4bd85eaa1cf258 | add splits-io api wrapper | BatedUrGonnaDie/salty_bot | modules/apis/splits_io.py | modules/apis/splits_io.py | #! /usr/bin/env python2.7
import modules.apis.api_base as api
class SplitsIOAPI(api.API):
def __init__(self, session = None):
super(SplitsIOAPI, self).__init__("https://splits.io/api/v3", session)
def get_user_splits(self, user, **kwargs):
endpoint = "/users/{0}/pbs".format(user)
success, response = self.get(endpoint, **kwargs)
return success, response
| mit | Python |
|
d5e67563f23acb11fe0e4641d48b67fe3509822f | Add test migration removing ref to old company image | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | apps/companyprofile/migrations/0002_auto_20151014_2132.py | apps/companyprofile/migrations/0002_auto_20151014_2132.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('companyprofile', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='company',
old_name='image',
new_name='old_image',
),
]
| mit | Python |
|
a1e2e51c2777107bbc8a20429078638917149b6a | Remove unused import | compas-dev/compas | src/compas/rpc/services/default.py | src/compas/rpc/services/default.py | import os
import inspect
import json
import socket
import compas
from compas.rpc import Server
from compas.rpc import Service
class DefaultService(Service):
pass
if __name__ == '__main__':
import sys
try:
port = int(sys.argv[1])
except:
port = 1753
print('Starting default RPC service on port {0}...'.format(port))
server = Server(("localhost", port))
server.register_function(server.ping)
server.register_function(server.remote_shutdown)
server.register_instance(DefaultService())
print('Listening, press CTRL+C to abort...')
server.serve_forever()
| import os
import inspect
import json
import socket
import compas
from compas.rpc import Server
from compas.rpc import Service
class DefaultService(Service):
pass
if __name__ == '__main__':
import sys
import threading
try:
port = int(sys.argv[1])
except:
port = 1753
print('Starting default RPC service on port {0}...'.format(port))
server = Server(("localhost", port))
server.register_function(server.ping)
server.register_function(server.remote_shutdown)
server.register_instance(DefaultService())
print('Listening, press CTRL+C to abort...')
server.serve_forever()
| mit | Python |
f20f286a3c5c6e2b9adf7220ac4426ce783d96b5 | Create regressors.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | trendpy/regressors.py | trendpy/regressors.py | # regressors.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# 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, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
class Lasso(Strategy):
pass
| mit | Python |
|
ad777af05d2995ee43b3d64ce435cc96379fa9a2 | add iostat template | dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer | graph_templates/iostat.py | graph_templates/iostat.py | from . import GraphTemplate
class IostatTemplate(GraphTemplate):
'''
corresponds to diamond diskusage plugin
'''
target_types = {
'gauge': {
'match': '^servers\.(?P<server>[^\.]+)\.iostat\.(?P<device>[^\.]+)\.(?P<type>.*)$',
'default_group_by': 'server',
'default_graph_options': {'state': 'stacked'}
},
'rate': {
'match': '^servers\.(?P<server>[^\.]+)\.iostat\.(?P<device>[^\.]+)\.(?P<type>.*)_per_second$',
'default_group_by': 'server',
'default_graph_options': {'state': 'stacked', 'vtitle': 'events/s'}
}
}
# vim: ts=4 et sw=4:
| apache-2.0 | Python |
|
1637b53727f81c9528c47effab172f86a58e8b9a | Add script register_ph_migrate.py to mass register and migrate placeholders remotely | eReuse/DeviceHub,eReuse/DeviceHub | ereuse_devicehub/scripts/register_ph_migrate.py | ereuse_devicehub/scripts/register_ph_migrate.py | import argparse
import requests
from ereuse_devicehub.security.request_auth import Auth
def create_placeholders_and_migrate(base_url, email, password, n_placeholders, origin_db, dest_db, label=None,
comment=None):
"""
Remotely connects to a devicehub, creates n_placeholders placeholders and then migrates them to a dest_db
in the same devicehub.
"""
try:
auth = Auth(base_url, email, password)
snapshot = {
"@type": "devices:Register",
"device": {
"@type": "Device",
"placeholder": True
}
}
devices_id = []
for _ in range(0, n_placeholders):
r = requests.post('{}/{}/events/devices/register'.format(base_url, origin_db), json=snapshot, auth=auth)
r.raise_for_status()
result = r.json()
devices_id.append(result['device'])
migrate = {
"@type": "devices:Migrate",
"label": label,
"to": {
"baseUrl": "https://devicehub.ereuse.org/",
"database": dest_db
},
'devices': devices_id,
"comment": comment
}
r = requests.post('{}/{}/events/devices/migrate'.format(base_url, origin_db), json=migrate, auth=auth)
r.raise_for_status()
except Exception as e:
raise e
if __name__ == '__main__':
desc = 'Creates a number of placeholders and then migrates them to another database. ' \
'This method executes remotely to any DeviceHub on the web.'
epilog = 'Example: python register_ph_migrate.py http://api.foo.bar a@a.a pass 25 db1 db2' \
' -l "Migrate to DB2" -c "This migrate represents..."'
parser = argparse.ArgumentParser(description=desc, epilog=epilog)
parser.add_argument('base_url', help='Ex: https://api.devicetag.io')
parser.add_argument('email')
parser.add_argument('password')
parser.add_argument('n_placeholders', help='Number of placeholders to create and migrate', type=int)
parser.add_argument('origin_db', help='Name of the database where placeholders are Registered and them moved from')
parser.add_argument('dest_db', help='Destination db')
parser.add_argument('-l', '--label')
parser.add_argument('-c', '--comment')
args = vars(parser.parse_args()) # If --help or -h or wrong value this will print message to user and abort
create_placeholders_and_migrate(**args)
| agpl-3.0 | Python |
|
417e8d1b63b4b343de3a81366d2d2ce433f089dd | Add paf (#294) | tanghaibao/jcvi | jcvi/formats/paf.py | jcvi/formats/paf.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# paf.py
# formats
#
# Created by Haibao Tang on 09/03/20
# Copyright © 2020 Haibao Tang. All rights reserved.
#
import sys
import logging
from jcvi.formats.base import must_open
from jcvi.apps.base import OptionParser, ActionDispatcher
class PAFLine:
"""
PAF specification
https://github.com/lh3/miniasm/blob/master/PAF.md
"""
__slots__ = (
"query",
"qsize",
"qstart",
"qstop",
"orientation",
"subject",
"ssize",
"sstart",
"sstop",
"nmatch",
"hitlen",
"mapq",
)
def __init__(self, row):
args = row.split()
self.query = args[0]
self.qsize = int(args[1])
self.qstart = int(args[2]) + 1
self.qstop = int(args[3])
self.orientation = args[4]
self.subject = args[5]
self.ssize = int(args[6])
self.sstart = int(args[7]) + 1
self.sstop = int(args[8])
self.nmatch = int(args[9])
self.hitlen = int(args[10])
self.mapq = int(args[11])
@property
def sbedline(self):
return "\t".join(
str(x)
for x in (
self.subject,
self.sstart - 1,
self.sstop,
self.query,
self.hitlen,
self.orientation,
)
)
@property
def qbedline(self):
return "\t".join(
str(x)
for x in (
self.query,
self.qstart - 1,
self.qstop,
self.subject,
self.hitlen,
self.orientation,
)
)
def bed(args):
"""
%prog bed paffile
Print out BED file based on coordinates in BLAST PAF results. By default,
write out subject positions. Use --swap to write query positions.
"""
from jcvi.formats.bed import sort as sort_bed
p = OptionParser(bed.__doc__)
p.add_option(
"--swap", default=False, action="store_true", help="Write query positions"
)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
(paffile,) = args
write_qbed = opts.swap
bedfile = "{}.{}.bed".format(
paffile.rsplit(".", 1)[0], "query" if write_qbed else "subject"
)
with must_open(paffile) as fp, open(bedfile, "w") as fw:
for row in fp:
b = PAFLine(row)
if write_qbed:
print(b.qbedline, file=fw)
else:
print(b.sbedline, file=fw)
logging.debug("File written to `{}`".format(bedfile))
sort_bed([bedfile, "-i"])
return bedfile
def main():
actions = (("bed", "get BED file from PAF"),)
p = ActionDispatcher(actions)
p.dispatch(globals())
if __name__ == "__main__":
main()
| bsd-2-clause | Python |
|
54641126cd8d662c6443aff1e6fe238c4bb09932 | Add PowerAnalysers Voltech PMn000 | DavidLutton/EngineeringProject | engineering_project/Instrument/PowerAnalyser.py | engineering_project/Instrument/PowerAnalyser.py | # import time
# import logging
# from scipy.interpolate import UnivariateSpline
# import numpy as np
try:
from Instrument.GenericInstrument import GenericInstrument
from Instrument.IEEE488 import IEEE488
from Instrument.SCPI import SCPI
except ImportError:
from GenericInstrument import GenericInstrument
from IEEE488 import IEEE488
from SCPI import SCPI
class PowerAnalyser(GenericInstrument):
"""Parent class for PowerAnalysers."""
def __init__(self, instrument):
"""."""
super().__init__(instrument)
def __repr__(self):
"""."""
return"{}, {}".format(__class__, self.instrument)
class VoltechPM3000A(PowerAnalyser, IEEE488):
"""Voltech PM3000A.
.. figure:: images/PowerAnalyser/VoltechPM3000A.jpg
"""
class VoltechPM1000P(PowerAnalyser, IEEE488):
"""Voltech PM1000+.
.. figure:: images/PowerAnalyser/VoltechPM1000P.jpg
"""
# REGISTER = {}
| mit | Python |
|
d4a5e1bf3e44a8cfe4bd3a9d1900803613e6da67 | Add C_O_L_R_test.py to check basic compile/decompile of otTables.COLR | googlefonts/fonttools,fonttools/fonttools | Tests/ttLib/tables/C_O_L_R_test.py | Tests/ttLib/tables/C_O_L_R_test.py | from fontTools import ttLib
from fontTools.misc.testTools import getXML, parseXML
from fontTools.ttLib.tables import otTables as ot
from fontTools.ttLib.tables.otBase import OTTableReader, OTTableWriter
import pytest
COLR_DATA = (
b"\x00\x00" # Version
b"\x00\x01" # BaseGlyphRecordCount
b"\x00\x00\x00\x0e" # Offset to BaseGlyphRecordArray
b"\x00\x00\x00\x14" # Offset to LayerRecordArray
b"\x00\x03" # LayerRecordCount
b"\x00\x06" # BaseGlyphRecord[0].BaseGlyph
b"\x00\x00" # BaseGlyphRecord[0].FirstLayerIndex
b"\x00\x03" # BaseGlyphRecord[0].NumLayers
b"\x00\x07" # LayerRecord[0].LayerGlyph
b"\x00\x00" # LayerRecord[0].PaletteIndex
b"\x00\x08" # LayerRecord[1].LayerGlyph
b"\x00\x01" # LayerRecord[1].PaletteIndex
b"\x00\t" # LayerRecord[2].LayerGlyph
b"\x00\x02" # LayerRecord[3].PaletteIndex
)
COLR_XML = [
"<COLR>",
' <Version value="0"/>',
" <!-- BaseGlyphRecordCount=1 -->",
" <BaseGlyphRecordArray>",
' <BaseGlyphRecord index="0">',
' <BaseGlyph value="glyph00006"/>',
' <FirstLayerIndex value="0"/>',
' <NumLayers value="3"/>',
" </BaseGlyphRecord>",
" </BaseGlyphRecordArray>",
" <LayerRecordArray>",
' <LayerRecord index="0">',
' <LayerGlyph value="glyph00007"/>',
' <PaletteIndex value="0"/>',
" </LayerRecord>",
' <LayerRecord index="1">',
' <LayerGlyph value="glyph00008"/>',
' <PaletteIndex value="1"/>',
" </LayerRecord>",
' <LayerRecord index="2">',
' <LayerGlyph value="glyph00009"/>',
' <PaletteIndex value="2"/>',
" </LayerRecord>",
" </LayerRecordArray>",
" <!-- LayerRecordCount=3 -->",
"</COLR>",
]
def dump(table, ttFont=None):
print("\n".join(getXML(table.toXML, ttFont)))
@pytest.fixture
def font():
font = ttLib.TTFont()
font.setGlyphOrder(["glyph%05d" % i for i in range(10)])
return font
def test_decompile_and_compile(font):
colr = ot.COLR()
reader = OTTableReader(COLR_DATA)
colr.decompile(reader, font)
writer = OTTableWriter()
colr.compile(writer, font)
data = writer.getAllData()
assert data == COLR_DATA
def test_decompile_and_dump_xml(font):
colr = ot.COLR()
reader = OTTableReader(COLR_DATA)
colr.decompile(reader, font)
dump(colr, font)
assert getXML(colr.toXML, font) == COLR_XML
| mit | Python |
|
884861de58ddfb12f2f5d15ce35349c74eab0c4e | Create 5009-set_bio_gripper.py | xArm-Developer/xArm-Python-SDK | example/wrapper/common/5009-set_bio_gripper.py | example/wrapper/common/5009-set_bio_gripper.py | #!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2020, UFACTORY, Inc.
# All rights reserved.
#
# Author: Hutton <geweipan@ufactory.cc>
"""
Example: Bio Gripper Control
Please make sure that the gripper is attached to the end.
"""
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from xarm.wrapper import XArmAPI
from configparser import ConfigParser
parser = ConfigParser()
parser.read('../robot.conf')
try:
ip = parser.get('xArm', 'ip')
except:
ip = input('Please input the xArm ip address[192.168.1.194]:')
if not ip:
ip = '192.168.1.194'
arm = XArmAPI(ip)
time.sleep(0.5)
if arm.warn_code != 0:
arm.clean_warn()
if arm.error_code != 0:
arm.clean_error()
arm.motion_enable(enable=True) #gripper enable
time.sleep(2) #Initialize the wait time
arm.set_gripper_position(-10,wait=False,auto_enable=True,speed=900,timeout=10) #gripper open
time.sleep(1)
arm.set_gripper_position(10,wait=False,auto_enable=True,speed=900,timeout=10) #gripper close
| bsd-3-clause | Python |
|
3ebe9ccebede38cc0638ef4adefe54fca306f2e6 | fix path | aeroevan/pykafka,jofusa/pykafka,sontek/pykafka,wikimedia/operations-debs-python-pykafka,yungchin/pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,sontek/pykafka,fortime/pykafka,aeroevan/pykafka,benauthor/pykafka,yungchin/pykafka,jofusa/pykafka,thedrow/samsa,appsoma/pykafka,fortime/pykafka,appsoma/pykafka,thedrow/samsa,sammerry/pykafka,benauthor/pykafka,thedrow/samsa,sammerry/pykafka,tempbottle/pykafka,wikimedia/operations-debs-python-pykafka,vortec/pykafka,tempbottle/pykafka,vortec/pykafka | doc/conf.py | doc/conf.py | __license__ = """
Copyright 2012 DISQUS
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 "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
# -*- coding: utf-8 -*-
import os
import sys
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from version import version
project = u'pykafka'
copyright = u'2015, Parse.ly'
version = release = version
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
exclude_patterns = ['_build']
html_static_path = ['_static']
source_suffix = '.rst'
master_doc = 'index'
html_theme = 'nature'
pygments_style = 'sphinx'
htmlhelp_basename = 'pykafkadoc'
autodoc_default_flags = ['special-members', 'undoc-members', 'private-members',
'show-inheritance']
| __license__ = """
Copyright 2012 DISQUS
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 "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
# -*- coding: utf-8 -*-
import os
import sys
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from version import version
project = u'pykafka'
copyright = u'2015, Parse.ly'
version = release = version
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
exclude_patterns = ['_build']
html_static_path = ['_static']
source_suffix = '.rst'
master_doc = 'index'
html_theme = 'nature'
pygments_style = 'sphinx'
htmlhelp_basename = 'pykafkadoc'
autodoc_default_flags = ['special-members', 'show-inheritance']
| apache-2.0 | Python |
965cd743ab1310455fe1ee24c5fa0ae0ae97bd7a | Create MyTestProgram.py | johnscuteri/OpenSourcedButtonBoardTest | MyTestProgram.py | MyTestProgram.py | #!/usr/bin/python
import RPIO, time
# John Scuteri's Button Board tester program
# This program is for John Jay's Button board
# This program was inspired by programs from the following website
# http://www.savagehomeautomation.com/projects/raspberry-pi-john-jays-8-led-button-breakout-board.html
# This program uses Python to make use of the Raspberry Pi's GPIO
# GPIO.RPI is replaced in this program with RPIO which need to be downloaded
# RPIO adds the resistor value modification
# As I am new at Python the following needs to be noted
# This program does not make use of arrays
# Future versions of this program will attempt to make use of arrays
# Setting resistor values for the switches
RPIO.setup(15, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(17, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(18, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(21, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(22, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(23, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(24, RPIO.IN, pull_up_down=RPIO.PUD_UP)
RPIO.setup(25, RPIO.IN, pull_up_down=RPIO.PUD_UP)
# Starting the LEDs
# LED 1
RPIO.setup(0, RPIO.OUT)
RPIO.output(0, RPIO.HIGH)
# LED 2
RPIO.setup(1, RPIO.OUT)
RPIO.output(1, RPIO.HIGH)
# LED 3
RPIO.setup(4, RPIO.OUT)
RPIO.output(4, RPIO.HIGH)
# LED 4
RPIO.setup(7, RPIO.OUT)
RPIO.output(7, RPIO.HIGH)
# LED 5
RPIO.setup(8, RPIO.OUT)
RPIO.output(8, RPIO.HIGH)
# LED 6
RPIO.setup(9, RPIO.OUT)
RPIO.output(9, RPIO.HIGH)
# LED 7
RPIO.setup(10, RPIO.OUT)
RPIO.output(10, RPIO.HIGH)
# LED 8
RPIO.setup(11, RPIO.OUT)
RPIO.output(11, RPIO.HIGH)
# Seed values
inputValue1 = True
inputValue2 = True
inputValue3 = True
inputValue4 = True
inputValue5 = True
inputValue6 = True
inputValue7 = True
inputValue8 = True
while True:
# Memories of past values
# these will be used for making sure the button push
# only registers once per press
hold1 = inputValue1
hold2 = inputValue2
hold3 = inputValue3
hold4 = inputValue4
hold5 = inputValue5
hold6 = inputValue6
hold7 = inputValue7
hold8 = inputValue8
inputValue1 = RPIO.input(15)
# ^ Gets the input value from Pin 15
if (inputValue1 == False):
if (hold1 == True):
# ^ Tests for previous value to make sure it registers once
print("Button 1 pressed ")
RPIO.output(0, RPIO.LOW)
# ^ Turns the LED off
else:
RPIO.output(0, RPIO.HIGH)
# ^ Turns the LED back on
time.sleep(.3)
# ^ Prevents the Led from blinking really fast
# but creates the problem of the LED not turning
# back on if the button is pressed too fast
inputValue2 = RPIO.input(17)
if (inputValue2 == False):
if (hold2 == True):
print("Button 2 pressed ")
RPIO.output(1, RPIO.LOW)
else:
RPIO.output(1, RPIO.HIGH)
time.sleep(.3)
inputValue3 = RPIO.input(18)
if (inputValue3 == False):
if (hold3 == True):
print("Button 3 pressed ")
RPIO.output(4, RPIO.LOW)
else:
RPIO.output(4, RPIO.HIGH)
time.sleep(.3)
inputValue4 = RPIO.input(21)
if (inputValue4 == False):
if (hold4 == True):
print("Button 4 pressed ")
RPIO.output(7, RPIO.LOW)
else:
RPIO.output(7, RPIO.HIGH)
time.sleep(.3)
inputValue5 = RPIO.input(22)
if (inputValue5 == False):
if (hold5 == True):
print("Button 5 pressed ")
RPIO.output(8, RPIO.LOW)
else:
RPIO.output(8, RPIO.HIGH)
time.sleep(.3)
inputValue6 = RPIO.input(23)
if (inputValue6 == False):
if (hold6 == True):
print("Button 6 pressed ")
RPIO.output(9, RPIO.LOW)
else:
RPIO.output(9, RPIO.HIGH)
time.sleep(.3)
inputValue7 = RPIO.input(24)
if (inputValue7 == False):
if (hold7 == True):
print("Button 7 pressed ")
RPIO.output(10, RPIO.LOW)
else:
RPIO.output(10, RPIO.HIGH)
time.sleep(.3)
inputValue8 = RPIO.input(25)
if (inputValue8 == False):
if (hold8 == True):
print("Button 8 pressed ")
RPIO.output(11, RPIO.LOW)
else:
RPIO.output(11, RPIO.HIGH)
time.sleep(.3)
time.sleep(.01)
| mit | Python |
|
3cfd37f81708e1f3a1b69d6c310c7f93d32eb8ed | add script to generate artificial data | djangothon/django-db-meter,djangothon/django-db-meter,djangothon/django-db-meter | django_db_meter/generate_data.py | django_db_meter/generate_data.py | import random
import threading
from django.contrib.auth.models import User
from models import TestModel
def generate_queries():
u1 = User.objects.filter()
new_name = str(random.randint(0, 2000000))
if u1:
u1.update(first_name=new_name)
else:
u1 = User(username=new_name)
u1.save()
u1 = User.objects.filter(username=new_name)
if u1:
u1.first_name = new_name + 'hello'
u1.save()
users = [User(username=get_random_text()) for i in xrange(100)]
for user in users:
user.save()
t = TestModel.objects.filter(user=u1)
t = list(t)
for i in xrange(100):
t = TestModel.objects.filter()
t = list(t)
for i in xrange(len(users)):
random_user = random.choice(users)
t = TestModel(user=random_user)
t.save()
for i in xrange(100):
k = TestModel.objects.select_related('user')
k = list(k)
def get_random_text():
new_name = str(random.randint(0, 2000000))
return new_name
def main(concurrency=2):
ths = [threading.Thread(target=generate_queries) for i in
xrange(concurrency)]
for th in ths:
th.start()
for th in ths:
th.join()
| apache-2.0 | Python |
|
af88a37ed87b18941232a98f52fec001bd63b453 | Fix bug in CookieJar where QSettings expected str, but got QByteArray instead (#10) | houzhenggang/phantomjs,JamesMGreene/phantomjs,bkrukowski/phantomjs,shinate/phantomjs,hexid/phantomjs,jefleponot/phantomjs,peakji/phantomjs,JingZhou0404/phantomjs,Lochlan/phantomjs,chylli/phantomjs,skyeckstrom/phantomjs,Lochlan/phantomjs,nicksay/phantomjs,AladdinSonni/phantomjs,etiennekruger/phantomjs-qt5,r3b/phantomjs,viewdy/phantomjs2,VinceZK/phantomjs,jdar/phantomjs-modified,pigshell/nhnick,nin042/phantomjs,wuxianghou/phantomjs,PeterWangPo/phantomjs,rishilification/phantomjs,webmull/phantomjs,ye11ow/phantomjs,matepeter90/phantomjs,Deepakpatle/phantomjs,jkenn99/phantomjs,farhi-naz/phantomjs,ChrisAntaki/phantomjs,angelman/phantomjs,linjeffrey/phantomjs,dhendo/phantomjs,iver333/phantomjs,cesarmarinhorj/phantomjs,mapbased/phantomjs,PeterWangPo/phantomjs,petermat/phantomjs,neraliu/tpjs,r3b/phantomjs,webmull/phantomjs,MaDKaTZe/phantomjs,MeteorAdminz/phantomjs,VinceZK/phantomjs,asrie/phantomjs,Medium/phantomjs-1,dongritengfei/phantomjs,saisai/phantomjs,apanda/phantomjs-intercept,pbrazdil/phantomjs,paulfitz/phantomjs,bjko/phantomjs,jdar/phantomjs-modified,zhulin2609/phantomjs,Medium/phantomjs-1,astefanutti/phantomjs,bkrukowski/phantomjs,grevutiu-gabriel/phantomjs,kyroskoh/phantomjs,Deepakpatle/phantomjs,bukalov/phantomjs,ezoic/phantomjs,vegetableman/phantomjs,sxhao/phantomjs,Deepakpatle/phantomjs,liorvh/phantomjs,vegetableman/phantomjs,iradul/phantomjs,djmaze/phantomjs,avinashkunuje/phantomjs,forzi/phantomjs_stradivari_fork,iver333/phantomjs,christoph-buente/phantomjs,tmuelle2/phantomjs,paulfitz/phantomjs,iradul/phantomjs,kinwahlai/phantomjs-ghostdriver,neraliu/tpjs,yoki/phantomjs,you21979/phantomjs,liorvh/phantomjs,joomel1/phantomjs,farhi-naz/phantomjs,pigshell/nhnick,joomel1/phantomjs,jillesme/phantomjs,astefanutti/phantomjs,jdar/phantomjs-modified,eugene1g/phantomjs,PeterWangPo/phantomjs,djmaze/phantomjs,iradul/phantomjs-clone,pataquets/phantomjs,jkenn99/phantomjs,woodpecker1/phantomjs,likaiwalkman/phantomjs,tinfoil/phantomjs,nin042/phantomjs,mark-ignacio/phantomjs,peakji/phantomjs,attilahorvath/phantomjs,jdar/phantomjs-modified,PeterWangPo/phantomjs,OCForks/phantomjs,dongritengfei/phantomjs,Vitallium/phantomjs,PeterWangPo/phantomjs,avinashkunuje/phantomjs,zhulin2609/phantomjs,klickagent/phantomjs,Medium/phantomjs-1,RobertoMalatesta/phantomjs,Klaudit/phantomjs,StevenBlack/phantomjs,linjeffrey/phantomjs,revolutionaryG/phantomjs,tianzhihen/phantomjs,jorik041/phantomjs,yoki/phantomjs,MaDKaTZe/phantomjs,saisai/phantomjs,tmuelle2/phantomjs,saisai/phantomjs,JamesMGreene/phantomjs,Klaudit/phantomjs,shinate/phantomjs,pcarrier-packaging/deb-phantomjs,likaiwalkman/phantomjs,cesarmarinhorj/phantomjs,NickelMedia/phantomjs,yoki/phantomjs,brandingbrand/phantomjs,ChrisAntaki/phantomjs,thomasrogers03/phantomjs,jjyycchh/phantomjs,gskachkov/phantomjs,mapbased/phantomjs,StevenBlack/phantomjs,Lochlan/phantomjs,chauhanmohit/phantomjs,mattvick/phantomjs,cirrusone/phantom2,linjeffrey/phantomjs,forzi/phantomjs_stradivari_fork,unb-libraries/phantomjs,zhulin2609/phantomjs,VinceZK/phantomjs,kyroskoh/phantomjs,hexid/phantomjs,Deepakpatle/phantomjs,etiennekruger/phantomjs-qt5,pbrazdil/phantomjs,VinceZK/phantomjs,mapbased/phantomjs,danigonza/phantomjs,djmaze/phantomjs,RobertoMalatesta/phantomjs,jjyycchh/phantomjs,Deepakpatle/phantomjs,Dinamize/phantomjs,RobertoMalatesta/phantomjs,MaDKaTZe/phantomjs,danigonza/phantomjs,jillesme/phantomjs,kinwahlai/phantomjs-ghostdriver,gitromand/phantomjs,delighted/phantomjs,wxkdesky/phantomjs,iver333/phantomjs,iver333/phantomjs,wxkdesky/phantomjs,liorvh/phantomjs,farhi-naz/phantomjs,iradul/phantomjs-clone,delighted/phantomjs,NickelMedia/phantomjs,ramanajee/phantomjs,chauhanmohit/phantomjs,cesarmarinhorj/phantomjs,attilahorvath/phantomjs,Deepakpatle/phantomjs,r3b/phantomjs,jorik041/phantomjs,neraliu/tainted-phantomjs,tianzhihen/phantomjs,pigshell/nhnick,matepeter90/phantomjs,jdar/phantomjs-modified,liorvh/phantomjs,StevenBlack/phantomjs,Klaudit/phantomjs,gitromand/phantomjs,iver333/phantomjs,djmaze/phantomjs,jkburges/phantomjs,ChrisAntaki/phantomjs,JamesMGreene/phantomjs,unb-libraries/phantomjs,sxhao/phantomjs,brandingbrand/phantomjs,ezoic/phantomjs,sporttech/phantomjs,bprodoehl/phantomjs,ezoic/phantomjs,AladdinSonni/phantomjs,r3b/phantomjs,Observer-Wu/phantomjs,r3b/phantomjs,thomasrogers03/phantomjs,AladdinSonni/phantomjs,ye11ow/phantomjs,bkrukowski/phantomjs,danigonza/phantomjs,ezoic/phantomjs,you21979/phantomjs,vietch2612/phantomjs,pbrazdil/phantomjs,grevutiu-gabriel/phantomjs,webmull/phantomjs,ariya/phantomjs,nicksay/phantomjs,bettiolo/phantomjs,iradul/phantomjs-clone,zackw/phantomjs,pigshell/nhnick,eugene1g/phantomjs,admetricks/phantomjs,woodpecker1/phantomjs,chylli/phantomjs,linjeffrey/phantomjs,raff/phantomjs,bprodoehl/phantomjs,bjko/phantomjs,AladdinSonni/phantomjs,xsyntrex/phantomjs,linjeffrey/phantomjs,pigshell/nhnick,chauhanmohit/phantomjs,OCForks/phantomjs,OCForks/phantomjs,jkburges/phantomjs,bmotlaghFLT/FLT_PhantomJS,ezoic/phantomjs,VinceZK/phantomjs,jkenn99/phantomjs,PeterWangPo/phantomjs,pbrazdil/phantomjs,lseyesl/phantomjs,sxhao/phantomjs,PeterWangPo/phantomjs,ariya/phantomjs,jillesme/phantomjs,eceglov/phantomjs,danigonza/phantomjs,jjyycchh/phantomjs,markhu/phantomjs,petermat/phantomjs,bmotlaghFLT/FLT_PhantomJS,joomel1/phantomjs,klickagent/phantomjs,likaiwalkman/phantomjs,sporttech/phantomjs,gitromand/phantomjs,OCForks/phantomjs,hexid/phantomjs,pigshell/nhnick,tianzhihen/phantomjs,Andrey-Pavlov/phantomjs,r3b/phantomjs,bmotlaghFLT/FLT_PhantomJS,kinwahlai/phantomjs-ghostdriver,shinate/phantomjs,webmull/phantomjs,ramanajee/phantomjs,attilahorvath/phantomjs,neraliu/tainted-phantomjs,wxkdesky/phantomjs,delighted/phantomjs,Klaudit/phantomjs,tinfoil/phantomjs,thomasrogers03/phantomjs,bjko/phantomjs,cloudflare/phantomjs,delighted/phantomjs,Lkhagvadelger/phantomjs,admetricks/phantomjs,VinceZK/phantomjs,forzi/phantomjs_stradivari_fork,jorik041/phantomjs,christoph-buente/phantomjs,pbrazdil/phantomjs,jorik041/phantomjs,pbrazdil/phantomjs,mark-ignacio/phantomjs,markhu/phantomjs,angelman/phantomjs,admetricks/phantomjs,bprodoehl/phantomjs,r3b/phantomjs,rishilification/phantomjs,petermat/phantomjs,bukalov/phantomjs,petermat/phantomjs,eceglov/phantomjs,petermat/phantomjs,Observer-Wu/phantomjs,MeteorAdminz/phantomjs,Dinamize/phantomjs,cesarmarinhorj/phantomjs,asrie/phantomjs,houzhenggang/phantomjs,forzi/phantomjs_stradivari_fork,lseyesl/phantomjs,kyroskoh/phantomjs,paulfitz/phantomjs,linjeffrey/phantomjs,markhu/phantomjs,raff/phantomjs,tianzhihen/phantomjs,fentas/phantomjs,Klaudit/phantomjs,dhendo/phantomjs,you21979/phantomjs,skyeckstrom/phantomjs,Lochlan/phantomjs,StevenBlack/phantomjs,apanda/phantomjs-intercept,JingZhou0404/phantomjs,petermat/phantomjs,MaDKaTZe/phantomjs,paulfitz/phantomjs,lattwood/phantomjs,farhi-naz/phantomjs,tinfoil/phantomjs,revolutionaryG/phantomjs,danigonza/phantomjs,fentas/phantomjs,fxtentacle/phantomjs,martonw/phantomjs,r3b/phantomjs,Medium/phantomjs-1,unb-libraries/phantomjs,chauhanmohit/phantomjs,Medium/phantomjs-1,revolutionaryG/phantomjs,lseyesl/phantomjs,chauhanmohit/phantomjs,delighted/phantomjs,houzhenggang/phantomjs,klickagent/phantomjs,linjeffrey/phantomjs,jefleponot/phantomjs,jkenn99/phantomjs,farhi-naz/phantomjs,revolutionaryG/phantomjs,AladdinSonni/phantomjs,skyeckstrom/phantomjs,eugene1g/phantomjs,dhendo/phantomjs,JingZhou0404/phantomjs,Dinamize/phantomjs,asrie/phantomjs,nicksay/phantomjs,cesarmarinhorj/phantomjs,iradul/phantomjs,AladdinSonni/phantomjs,JingZhou0404/phantomjs,smasala/phantomjs,woodpecker1/phantomjs,ariya/phantomjs,smasala/phantomjs,MeteorAdminz/phantomjs,jjyycchh/phantomjs,lseyesl/phantomjs,NickelMedia/phantomjs,houzhenggang/phantomjs,revolutionaryG/phantomjs,saisai/phantomjs,raff/phantomjs,bkrukowski/phantomjs,cesarmarinhorj/phantomjs,you21979/phantomjs,saisai/phantomjs,peakji/phantomjs,zhulin2609/phantomjs,christoph-buente/phantomjs,petermat/phantomjs,matepeter90/phantomjs,brandingbrand/phantomjs,raff/phantomjs,aljscott/phantomjs,mapbased/phantomjs,xsyntrex/phantomjs,NickelMedia/phantomjs,dongritengfei/phantomjs,zhulin2609/phantomjs,christoph-buente/phantomjs,ye11ow/phantomjs,jefleponot/phantomjs,iradul/phantomjs-clone,etiennekruger/phantomjs-qt5,woodpecker1/phantomjs,bjko/phantomjs,iradul/phantomjs-clone,fentas/phantomjs,sharma1nitish/phantomjs,fentas/phantomjs,tmuelle2/phantomjs,youprofit/phantomjs,MeteorAdminz/phantomjs,S11001001/phantomjs,ixiom/phantomjs,mattvick/phantomjs,klim-iv/phantomjs-qt5,iradul/phantomjs,chylli/phantomjs,skyeckstrom/phantomjs,jkburges/phantomjs,mattvick/phantomjs,jdar/phantomjs-modified,AladdinSonni/phantomjs,Observer-Wu/phantomjs,jorik041/phantomjs,tinfoil/phantomjs,JingZhou0404/phantomjs,christoph-buente/phantomjs,bukalov/phantomjs,bmotlaghFLT/FLT_PhantomJS,wuxianghou/phantomjs,djmaze/phantomjs,shinate/phantomjs,dparshin/phantomjs,martonw/phantomjs,likaiwalkman/phantomjs,nin042/phantomjs,eceglov/phantomjs,jillesme/phantomjs,zhulin2609/phantomjs,ezoic/phantomjs,klim-iv/phantomjs-qt5,sharma1nitish/phantomjs,iver333/phantomjs,viewdy/phantomjs2,zhengyongbo/phantomjs,nin042/phantomjs,vietch2612/phantomjs,nin042/phantomjs,tinfoil/phantomjs,RobertoMalatesta/phantomjs,neraliu/tpjs,vegetableman/phantomjs,pigshell/nhnick,forzi/phantomjs_stradivari_fork,apanda/phantomjs-intercept,chylli/phantomjs,chauhanmohit/phantomjs,admetricks/phantomjs,Tomtomgo/phantomjs,farhi-naz/phantomjs,NickelMedia/phantomjs,brandingbrand/phantomjs,Observer-Wu/phantomjs,fxtentacle/phantomjs,martonw/phantomjs,RobertoMalatesta/phantomjs,NickelMedia/phantomjs,cloudflare/phantomjs,astefanutti/phantomjs,Klaudit/phantomjs,zhulin2609/phantomjs,chirilo/phantomjs,pbrazdil/phantomjs,tmuelle2/phantomjs,StevenBlack/phantomjs,jefleponot/phantomjs,Tomtomgo/phantomjs,aljscott/phantomjs,thomasrogers03/phantomjs,DocuSignDev/phantomjs,fxtentacle/phantomjs,iradul/phantomjs-clone,djmaze/phantomjs,grevutiu-gabriel/phantomjs,vegetableman/phantomjs,viewdy/phantomjs2,Vitallium/phantomjs,S11001001/phantomjs,zhengyongbo/phantomjs,ezoic/phantomjs,nin042/phantomjs,toanalien/phantomjs,webmull/phantomjs,sxhao/phantomjs,dparshin/phantomjs,RobertoMalatesta/phantomjs,martonw/phantomjs,shinate/phantomjs,bukalov/phantomjs,DocuSignDev/phantomjs,VinceZK/phantomjs,toanalien/phantomjs,jjyycchh/phantomjs,peakji/phantomjs,cloudflare/phantomjs,mark-ignacio/phantomjs,bprodoehl/phantomjs,woodpecker1/phantomjs,toanalien/phantomjs,StevenBlack/phantomjs,Observer-Wu/phantomjs,thomasrogers03/phantomjs,NickelMedia/phantomjs,AladdinSonni/phantomjs,delighted/phantomjs,eceglov/phantomjs,lattwood/phantomjs,zhengyongbo/phantomjs,saisai/phantomjs,jorik041/phantomjs,admetricks/phantomjs,Lochlan/phantomjs,smasala/phantomjs,tmuelle2/phantomjs,petermat/phantomjs,MaDKaTZe/phantomjs,you21979/phantomjs,you21979/phantomjs,dparshin/phantomjs,JingZhou0404/phantomjs,rishilification/phantomjs,you21979/phantomjs,shinate/phantomjs,apanda/phantomjs-intercept,bprodoehl/phantomjs,apanda/phantomjs-intercept,sharma1nitish/phantomjs,aljscott/phantomjs,cesarmarinhorj/phantomjs,martonw/phantomjs,bukalov/phantomjs,Dinamize/phantomjs,fentas/phantomjs,cesarmarinhorj/phantomjs,markhu/phantomjs,asrie/phantomjs,eceglov/phantomjs,petermat/phantomjs,jjyycchh/phantomjs,neraliu/tpjs,VinceZK/phantomjs,dhendo/phantomjs,ixiom/phantomjs,bettiolo/phantomjs,linjeffrey/phantomjs,markhu/phantomjs,bukalov/phantomjs,viewdy/phantomjs2,pataquets/phantomjs,neraliu/tpjs,vietch2612/phantomjs,dongritengfei/phantomjs,cirrusone/phantom2,lattwood/phantomjs,ixiom/phantomjs,cesarmarinhorj/phantomjs,bmotlaghFLT/FLT_PhantomJS,wuxianghou/phantomjs,toanalien/phantomjs,yoki/phantomjs,attilahorvath/phantomjs,bprodoehl/phantomjs,sharma1nitish/phantomjs,jguyomard/phantomjs,matepeter90/phantomjs,asrie/phantomjs,viewdy/phantomjs2,Lkhagvadelger/phantomjs,peakji/phantomjs,chylli/phantomjs,neraliu/tpjs,iradul/phantomjs,jguyomard/phantomjs,sharma1nitish/phantomjs,farhi-naz/phantomjs,neraliu/tainted-phantomjs,matepeter90/phantomjs,avinashkunuje/phantomjs,dparshin/phantomjs,lseyesl/phantomjs,cloudflare/phantomjs,chylli/phantomjs,jkburges/phantomjs,mark-ignacio/phantomjs,MeteorAdminz/phantomjs,lseyesl/phantomjs,bmotlaghFLT/FLT_PhantomJS,raff/phantomjs,gskachkov/phantomjs,viewdy/phantomjs2,avinashkunuje/phantomjs,Tomtomgo/phantomjs,Dinamize/phantomjs,sharma1nitish/phantomjs,hexid/phantomjs,zhulin2609/phantomjs,NickelMedia/phantomjs,Dinamize/phantomjs,yoki/phantomjs,RobertoMalatesta/phantomjs,liorvh/phantomjs,bkrukowski/phantomjs,saisai/phantomjs,mark-ignacio/phantomjs,OCForks/phantomjs,OCForks/phantomjs,Lochlan/phantomjs,matepeter90/phantomjs,jefleponot/phantomjs,bukalov/phantomjs,liorvh/phantomjs,mattvick/phantomjs,shinate/phantomjs,S11001001/phantomjs,pataquets/phantomjs,unb-libraries/phantomjs,mattvick/phantomjs,OCForks/phantomjs,chirilo/phantomjs,mark-ignacio/phantomjs,StevenBlack/phantomjs,fxtentacle/phantomjs,PeterWangPo/phantomjs,tianzhihen/phantomjs,Andrey-Pavlov/phantomjs,fxtentacle/phantomjs,jkburges/phantomjs,ChrisAntaki/phantomjs,zackw/phantomjs,christoph-buente/phantomjs,neraliu/tpjs,chylli/phantomjs,bkrukowski/phantomjs,zhengyongbo/phantomjs,bukalov/phantomjs,zackw/phantomjs,angelman/phantomjs,smasala/phantomjs,iradul/phantomjs-clone,aljscott/phantomjs,webmull/phantomjs,astefanutti/phantomjs,wuxianghou/phantomjs,JamesMGreene/phantomjs,Deepakpatle/phantomjs,sharma1nitish/phantomjs,likaiwalkman/phantomjs,avinashkunuje/phantomjs,grevutiu-gabriel/phantomjs,avinashkunuje/phantomjs,MeteorAdminz/phantomjs,bkrukowski/phantomjs,bukalov/phantomjs,mapbased/phantomjs,cirrusone/phantom2,eugene1g/phantomjs,woodpecker1/phantomjs,brandingbrand/phantomjs,viewdy/phantomjs2,sporttech/phantomjs,woodpecker1/phantomjs,DocuSignDev/phantomjs,chauhanmohit/phantomjs,JamesMGreene/phantomjs,sxhao/phantomjs,kyroskoh/phantomjs,pataquets/phantomjs,pcarrier-packaging/deb-phantomjs,mattvick/phantomjs,shinate/phantomjs,jkburges/phantomjs,avinashkunuje/phantomjs,zhengyongbo/phantomjs,jillesme/phantomjs,nicksay/phantomjs,martonw/phantomjs,Tomtomgo/phantomjs,unb-libraries/phantomjs,JamesMGreene/phantomjs,lseyesl/phantomjs,revolutionaryG/phantomjs,klickagent/phantomjs,etiennekruger/phantomjs-qt5,skyeckstrom/phantomjs,ChrisAntaki/phantomjs,bprodoehl/phantomjs,jdar/phantomjs-modified,toanalien/phantomjs,ixiom/phantomjs,houzhenggang/phantomjs,attilahorvath/phantomjs,mark-ignacio/phantomjs,Lochlan/phantomjs,MaDKaTZe/phantomjs,dparshin/phantomjs,DocuSignDev/phantomjs,wuxianghou/phantomjs,sporttech/phantomjs,cesarmarinhorj/phantomjs,eceglov/phantomjs,smasala/phantomjs,mattvick/phantomjs,asrie/phantomjs,jkburges/phantomjs,astefanutti/phantomjs,Lkhagvadelger/phantomjs,danigonza/phantomjs,avinashkunuje/phantomjs,JamesMGreene/phantomjs,pataquets/phantomjs,bjko/phantomjs,jillesme/phantomjs,mattvick/phantomjs,eugene1g/phantomjs,mapbased/phantomjs,bkrukowski/phantomjs,jorik041/phantomjs,jguyomard/phantomjs,chirilo/phantomjs,grevutiu-gabriel/phantomjs,zhengyongbo/phantomjs,gskachkov/phantomjs,webmull/phantomjs,ChrisAntaki/phantomjs,grevutiu-gabriel/phantomjs,martonw/phantomjs,klim-iv/phantomjs-qt5,iver333/phantomjs,djmaze/phantomjs,vietch2612/phantomjs,StevenBlack/phantomjs,ramanajee/phantomjs,rishilification/phantomjs,vegetableman/phantomjs,grevutiu-gabriel/phantomjs,thomasrogers03/phantomjs,youprofit/phantomjs,Lochlan/phantomjs,pcarrier-packaging/deb-phantomjs,ye11ow/phantomjs,dongritengfei/phantomjs,viewdy/phantomjs2,sporttech/phantomjs,Deepakpatle/phantomjs,avinashkunuje/phantomjs,markhu/phantomjs,tianzhihen/phantomjs,yoki/phantomjs,nin042/phantomjs,joomel1/phantomjs,martonw/phantomjs,zackw/phantomjs,gitromand/phantomjs,pbrazdil/phantomjs,cloudflare/phantomjs,xsyntrex/phantomjs,kyroskoh/phantomjs,klim-iv/phantomjs-qt5,smasala/phantomjs,markhu/phantomjs,lseyesl/phantomjs,JingZhou0404/phantomjs,cirrusone/phantom2,sharma1nitish/phantomjs,lattwood/phantomjs,eugene1g/phantomjs,yoki/phantomjs,houzhenggang/phantomjs,eceglov/phantomjs,raff/phantomjs,tmuelle2/phantomjs,hexid/phantomjs,Observer-Wu/phantomjs,admetricks/phantomjs,angelman/phantomjs,aljscott/phantomjs,joomel1/phantomjs,pataquets/phantomjs,Andrey-Pavlov/phantomjs,pigshell/nhnick,joomel1/phantomjs,eugene1g/phantomjs,neraliu/tainted-phantomjs,skyeckstrom/phantomjs,Lkhagvadelger/phantomjs,ChrisAntaki/phantomjs,revolutionaryG/phantomjs,ixiom/phantomjs,admetricks/phantomjs,skyeckstrom/phantomjs,ramanajee/phantomjs,rishilification/phantomjs,angelman/phantomjs,r3b/phantomjs,tmuelle2/phantomjs,smasala/phantomjs,eugene1g/phantomjs,OCForks/phantomjs,Deepakpatle/phantomjs,eceglov/phantomjs,Klaudit/phantomjs,rishilification/phantomjs,ChrisAntaki/phantomjs,pcarrier-packaging/deb-phantomjs,zhengyongbo/phantomjs,joomel1/phantomjs,chirilo/phantomjs,paulfitz/phantomjs,jillesme/phantomjs,MaDKaTZe/phantomjs,jguyomard/phantomjs,jkenn99/phantomjs,ramanajee/phantomjs,dparshin/phantomjs,chylli/phantomjs,ixiom/phantomjs,vietch2612/phantomjs,jorik041/phantomjs,gitromand/phantomjs,Vitallium/phantomjs,petermat/phantomjs,Observer-Wu/phantomjs,likaiwalkman/phantomjs,aljscott/phantomjs,xsyntrex/phantomjs,DocuSignDev/phantomjs,forzi/phantomjs_stradivari_fork,delighted/phantomjs,shinate/phantomjs,klim-iv/phantomjs-qt5,Observer-Wu/phantomjs,dhendo/phantomjs,pbrazdil/phantomjs,jefleponot/phantomjs,fentas/phantomjs,chauhanmohit/phantomjs,Tomtomgo/phantomjs,youprofit/phantomjs,astefanutti/phantomjs,bukalov/phantomjs,bprodoehl/phantomjs,neraliu/tainted-phantomjs,apanda/phantomjs-intercept,attilahorvath/phantomjs,sxhao/phantomjs,dongritengfei/phantomjs,likaiwalkman/phantomjs,chylli/phantomjs,fxtentacle/phantomjs,kinwahlai/phantomjs-ghostdriver,lattwood/phantomjs,DocuSignDev/phantomjs,Lkhagvadelger/phantomjs,angelman/phantomjs,RobertoMalatesta/phantomjs,klickagent/phantomjs,unb-libraries/phantomjs,brandingbrand/phantomjs,Tomtomgo/phantomjs,jkenn99/phantomjs,ye11ow/phantomjs,martonw/phantomjs,tianzhihen/phantomjs,apanda/phantomjs-intercept,mattvick/phantomjs,Tomtomgo/phantomjs,woodpecker1/phantomjs,linjeffrey/phantomjs,jjyycchh/phantomjs,Deepakpatle/phantomjs,gitromand/phantomjs,Vitallium/phantomjs,ramanajee/phantomjs,christoph-buente/phantomjs,bmotlaghFLT/FLT_PhantomJS,wuxianghou/phantomjs,tinfoil/phantomjs,farhi-naz/phantomjs,unb-libraries/phantomjs,mapbased/phantomjs,cirrusone/phantom2,sporttech/phantomjs,dongritengfei/phantomjs,rishilification/phantomjs,vegetableman/phantomjs,zackw/phantomjs,pataquets/phantomjs,joomel1/phantomjs,mark-ignacio/phantomjs,youprofit/phantomjs,attilahorvath/phantomjs,JamesMGreene/phantomjs,neraliu/tpjs,matepeter90/phantomjs,chirilo/phantomjs,wxkdesky/phantomjs,mattvick/phantomjs,MeteorAdminz/phantomjs,dparshin/phantomjs,jkenn99/phantomjs,matepeter90/phantomjs,gskachkov/phantomjs,mattvick/phantomjs,Lkhagvadelger/phantomjs,Vitallium/phantomjs,OCForks/phantomjs,vegetableman/phantomjs,nicksay/phantomjs,AladdinSonni/phantomjs,iver333/phantomjs,joomel1/phantomjs,neraliu/tpjs,christoph-buente/phantomjs,wxkdesky/phantomjs,shinate/phantomjs,rishilification/phantomjs,toanalien/phantomjs,toanalien/phantomjs,dongritengfei/phantomjs,youprofit/phantomjs,paulfitz/phantomjs,ChrisAntaki/phantomjs,lattwood/phantomjs,gskachkov/phantomjs,fxtentacle/phantomjs,cirrusone/phantom2,klim-iv/phantomjs-qt5,tmuelle2/phantomjs,dparshin/phantomjs,hexid/phantomjs,JamesMGreene/phantomjs,fxtentacle/phantomjs,sharma1nitish/phantomjs,webmull/phantomjs,chylli/phantomjs,nicksay/phantomjs,houzhenggang/phantomjs,pcarrier-packaging/deb-phantomjs,dhendo/phantomjs,djmaze/phantomjs,Andrey-Pavlov/phantomjs,vietch2612/phantomjs,woodpecker1/phantomjs,gskachkov/phantomjs,angelman/phantomjs,grevutiu-gabriel/phantomjs,Andrey-Pavlov/phantomjs,bprodoehl/phantomjs,nin042/phantomjs,jjyycchh/phantomjs,klickagent/phantomjs,woodpecker1/phantomjs,aljscott/phantomjs,jdar/phantomjs-modified,bprodoehl/phantomjs,jjyycchh/phantomjs,yoki/phantomjs,vietch2612/phantomjs,admetricks/phantomjs,you21979/phantomjs,revolutionaryG/phantomjs,etiennekruger/phantomjs-qt5,ezoic/phantomjs,bjko/phantomjs,jdar/phantomjs-modified,Vitallium/phantomjs,MeteorAdminz/phantomjs,jguyomard/phantomjs,Lkhagvadelger/phantomjs,PeterWangPo/phantomjs,bettiolo/phantomjs,nin042/phantomjs,markhu/phantomjs,eceglov/phantomjs,asrie/phantomjs,S11001001/phantomjs,bettiolo/phantomjs,NickelMedia/phantomjs,thomasrogers03/phantomjs,kyroskoh/phantomjs,fentas/phantomjs,dongritengfei/phantomjs,linjeffrey/phantomjs,klim-iv/phantomjs-qt5,jjyycchh/phantomjs,joomel1/phantomjs,wxkdesky/phantomjs,ramanajee/phantomjs,vegetableman/phantomjs,zhulin2609/phantomjs,OCForks/phantomjs,pataquets/phantomjs,cirrusone/phantom2,attilahorvath/phantomjs,fxtentacle/phantomjs,bjko/phantomjs,sxhao/phantomjs,sxhao/phantomjs,paulfitz/phantomjs,lattwood/phantomjs,mark-ignacio/phantomjs,kinwahlai/phantomjs-ghostdriver,MaDKaTZe/phantomjs,tinfoil/phantomjs,neraliu/tpjs,matepeter90/phantomjs,yoki/phantomjs,mapbased/phantomjs,paulfitz/phantomjs,Lkhagvadelger/phantomjs,christoph-buente/phantomjs,iver333/phantomjs,aljscott/phantomjs,dongritengfei/phantomjs,jkburges/phantomjs,viewdy/phantomjs2,Tomtomgo/phantomjs,Tomtomgo/phantomjs,zackw/phantomjs,viewdy/phantomjs2,jillesme/phantomjs,gitromand/phantomjs,jguyomard/phantomjs,raff/phantomjs,wuxianghou/phantomjs,Lkhagvadelger/phantomjs,wuxianghou/phantomjs,martonw/phantomjs,NickelMedia/phantomjs,zackw/phantomjs,klickagent/phantomjs,PeterWangPo/phantomjs,jkenn99/phantomjs,AladdinSonni/phantomjs,smasala/phantomjs,chirilo/phantomjs,jillesme/phantomjs,ramanajee/phantomjs,angelman/phantomjs,jdar/phantomjs-modified,MaDKaTZe/phantomjs,jkenn99/phantomjs,bmotlaghFLT/FLT_PhantomJS,sporttech/phantomjs,kinwahlai/phantomjs-ghostdriver,StevenBlack/phantomjs,mark-ignacio/phantomjs,ramanajee/phantomjs,zhengyongbo/phantomjs,webmull/phantomjs,Dinamize/phantomjs,iradul/phantomjs,toanalien/phantomjs,chauhanmohit/phantomjs,zackw/phantomjs,raff/phantomjs,danigonza/phantomjs,S11001001/phantomjs,wxkdesky/phantomjs,martonw/phantomjs,chauhanmohit/phantomjs,zhulin2609/phantomjs,youprofit/phantomjs,cesarmarinhorj/phantomjs,webmull/phantomjs,pbrazdil/phantomjs,xsyntrex/phantomjs,thomasrogers03/phantomjs,DocuSignDev/phantomjs,djmaze/phantomjs,likaiwalkman/phantomjs,yoki/phantomjs,youprofit/phantomjs,attilahorvath/phantomjs,aljscott/phantomjs,toanalien/phantomjs,sxhao/phantomjs,neraliu/tainted-phantomjs,Tomtomgo/phantomjs,dongritengfei/phantomjs,eugene1g/phantomjs,grevutiu-gabriel/phantomjs,jkenn99/phantomjs,jkburges/phantomjs,asrie/phantomjs,delighted/phantomjs,Medium/phantomjs-1,skyeckstrom/phantomjs,mapbased/phantomjs,ariya/phantomjs,nin042/phantomjs,bmotlaghFLT/FLT_PhantomJS,asrie/phantomjs,joomel1/phantomjs,kinwahlai/phantomjs-ghostdriver,sxhao/phantomjs,jillesme/phantomjs,farhi-naz/phantomjs,houzhenggang/phantomjs,gitromand/phantomjs,RobertoMalatesta/phantomjs,iradul/phantomjs-clone,wxkdesky/phantomjs,ariya/phantomjs,jorik041/phantomjs,saisai/phantomjs,Observer-Wu/phantomjs,admetricks/phantomjs,wxkdesky/phantomjs,pataquets/phantomjs,chirilo/phantomjs,dparshin/phantomjs,Andrey-Pavlov/phantomjs,Medium/phantomjs-1,ixiom/phantomjs,sharma1nitish/phantomjs,NickelMedia/phantomjs,neraliu/tainted-phantomjs,xsyntrex/phantomjs,vietch2612/phantomjs,tianzhihen/phantomjs,JingZhou0404/phantomjs,astefanutti/phantomjs,Vitallium/phantomjs,angelman/phantomjs,pigshell/nhnick,saisai/phantomjs,bettiolo/phantomjs,youprofit/phantomjs,thomasrogers03/phantomjs,iver333/phantomjs,ramanajee/phantomjs,yoki/phantomjs,nicksay/phantomjs,webmull/phantomjs,jdar/phantomjs-modified,neraliu/tainted-phantomjs,Lochlan/phantomjs,ramanajee/phantomjs,xsyntrex/phantomjs,PeterWangPo/phantomjs,ChrisAntaki/phantomjs,bmotlaghFLT/FLT_PhantomJS,RobertoMalatesta/phantomjs,delighted/phantomjs,pataquets/phantomjs,admetricks/phantomjs,dparshin/phantomjs,eugene1g/phantomjs,ezoic/phantomjs,tmuelle2/phantomjs,Vitallium/phantomjs,brandingbrand/phantomjs,youprofit/phantomjs,apanda/phantomjs-intercept,hexid/phantomjs,bettiolo/phantomjs,cirrusone/phantom2,kyroskoh/phantomjs,iver333/phantomjs,gitromand/phantomjs,ixiom/phantomjs,ariya/phantomjs,aljscott/phantomjs,attilahorvath/phantomjs,pbrazdil/phantomjs,rishilification/phantomjs,JamesMGreene/phantomjs,Klaudit/phantomjs,xsyntrex/phantomjs,lattwood/phantomjs,pcarrier-packaging/deb-phantomjs,Lkhagvadelger/phantomjs,gskachkov/phantomjs,woodpecker1/phantomjs,fentas/phantomjs,bjko/phantomjs,klim-iv/phantomjs-qt5,ixiom/phantomjs,JingZhou0404/phantomjs,chylli/phantomjs,fentas/phantomjs,zhengyongbo/phantomjs,viewdy/phantomjs2,kyroskoh/phantomjs,youprofit/phantomjs,JingZhou0404/phantomjs,angelman/phantomjs,iradul/phantomjs,chirilo/phantomjs,liorvh/phantomjs,linjeffrey/phantomjs,Observer-Wu/phantomjs,grevutiu-gabriel/phantomjs,chauhanmohit/phantomjs,gskachkov/phantomjs,avinashkunuje/phantomjs,iradul/phantomjs-clone,lseyesl/phantomjs,dhendo/phantomjs,lseyesl/phantomjs,liorvh/phantomjs,astefanutti/phantomjs,Dinamize/phantomjs,you21979/phantomjs,lattwood/phantomjs,ye11ow/phantomjs,Lkhagvadelger/phantomjs,thomasrogers03/phantomjs,jillesme/phantomjs,unb-libraries/phantomjs,skyeckstrom/phantomjs,likaiwalkman/phantomjs,RobertoMalatesta/phantomjs,saisai/phantomjs,bettiolo/phantomjs,bukalov/phantomjs,gitromand/phantomjs,paulfitz/phantomjs,liorvh/phantomjs,Tomtomgo/phantomjs,sxhao/phantomjs,ye11ow/phantomjs,djmaze/phantomjs,jkenn99/phantomjs,asrie/phantomjs,saisai/phantomjs,unb-libraries/phantomjs,tinfoil/phantomjs,toanalien/phantomjs,wuxianghou/phantomjs,zackw/phantomjs,christoph-buente/phantomjs,klickagent/phantomjs,kyroskoh/phantomjs,forzi/phantomjs_stradivari_fork,pcarrier-packaging/deb-phantomjs,JamesMGreene/phantomjs,asrie/phantomjs,klickagent/phantomjs,angelman/phantomjs,S11001001/phantomjs,rishilification/phantomjs,fentas/phantomjs,brandingbrand/phantomjs,apanda/phantomjs-intercept,astefanutti/phantomjs,Klaudit/phantomjs,etiennekruger/phantomjs-qt5,OCForks/phantomjs,neraliu/tainted-phantomjs,jorik041/phantomjs,houzhenggang/phantomjs,mapbased/phantomjs,klim-iv/phantomjs-qt5,aljscott/phantomjs,revolutionaryG/phantomjs,nicksay/phantomjs,Andrey-Pavlov/phantomjs,djmaze/phantomjs,ixiom/phantomjs,zhengyongbo/phantomjs,Observer-Wu/phantomjs,ChrisAntaki/phantomjs,cloudflare/phantomjs,revolutionaryG/phantomjs,mark-ignacio/phantomjs,ye11ow/phantomjs,jefleponot/phantomjs,apanda/phantomjs-intercept,farhi-naz/phantomjs,bettiolo/phantomjs,eceglov/phantomjs,Lochlan/phantomjs,attilahorvath/phantomjs,Andrey-Pavlov/phantomjs,bkrukowski/phantomjs,smasala/phantomjs,kyroskoh/phantomjs,pcarrier-packaging/deb-phantomjs,thomasrogers03/phantomjs,iradul/phantomjs,S11001001/phantomjs,fentas/phantomjs,wxkdesky/phantomjs,StevenBlack/phantomjs,zhulin2609/phantomjs,iradul/phantomjs-clone,apanda/phantomjs-intercept,S11001001/phantomjs,wuxianghou/phantomjs,neraliu/tainted-phantomjs,cloudflare/phantomjs,vegetableman/phantomjs,jguyomard/phantomjs,lseyesl/phantomjs,ixiom/phantomjs,chirilo/phantomjs,Andrey-Pavlov/phantomjs,xsyntrex/phantomjs,etiennekruger/phantomjs-qt5,paulfitz/phantomjs,vietch2612/phantomjs,markhu/phantomjs,Medium/phantomjs-1,MeteorAdminz/phantomjs,peakji/phantomjs,bjko/phantomjs,delighted/phantomjs,cirrusone/phantom2,bkrukowski/phantomjs,AladdinSonni/phantomjs,tmuelle2/phantomjs,Dinamize/phantomjs,gskachkov/phantomjs,sporttech/phantomjs,StevenBlack/phantomjs,fxtentacle/phantomjs,bettiolo/phantomjs,Medium/phantomjs-1,tinfoil/phantomjs,bettiolo/phantomjs,MaDKaTZe/phantomjs,VinceZK/phantomjs,peakji/phantomjs,nin042/phantomjs,pigshell/nhnick,bjko/phantomjs,Klaudit/phantomjs,lattwood/phantomjs,tmuelle2/phantomjs,klickagent/phantomjs,mapbased/phantomjs,petermat/phantomjs,wxkdesky/phantomjs,dparshin/phantomjs,brandingbrand/phantomjs,avinashkunuje/phantomjs,youprofit/phantomjs,smasala/phantomjs,Vitallium/phantomjs,Lochlan/phantomjs,VinceZK/phantomjs,JingZhou0404/phantomjs,toanalien/phantomjs,fxtentacle/phantomjs,jkburges/phantomjs,grevutiu-gabriel/phantomjs,pataquets/phantomjs,bettiolo/phantomjs,pigshell/nhnick,likaiwalkman/phantomjs,bkrukowski/phantomjs,shinate/phantomjs,likaiwalkman/phantomjs,farhi-naz/phantomjs,bmotlaghFLT/FLT_PhantomJS,nicksay/phantomjs,Andrey-Pavlov/phantomjs,you21979/phantomjs,jefleponot/phantomjs,DocuSignDev/phantomjs,chirilo/phantomjs,liorvh/phantomjs,VinceZK/phantomjs,jjyycchh/phantomjs,Deepakpatle/phantomjs,Andrey-Pavlov/phantomjs,DocuSignDev/phantomjs,tianzhihen/phantomjs,dhendo/phantomjs,revolutionaryG/phantomjs,vietch2612/phantomjs,jkburges/phantomjs,tianzhihen/phantomjs,bjko/phantomjs,jorik041/phantomjs,cloudflare/phantomjs,MaDKaTZe/phantomjs,bprodoehl/phantomjs,wuxianghou/phantomjs,jefleponot/phantomjs,chirilo/phantomjs,klickagent/phantomjs,zhengyongbo/phantomjs,Klaudit/phantomjs,kyroskoh/phantomjs,delighted/phantomjs,paulfitz/phantomjs,vietch2612/phantomjs,liorvh/phantomjs,tinfoil/phantomjs,hexid/phantomjs,smasala/phantomjs,tinfoil/phantomjs,peakji/phantomjs,sharma1nitish/phantomjs,danigonza/phantomjs,dhendo/phantomjs,lattwood/phantomjs,gitromand/phantomjs,rishilification/phantomjs,you21979/phantomjs,christoph-buente/phantomjs,jguyomard/phantomjs,eceglov/phantomjs,admetricks/phantomjs,iradul/phantomjs-clone,raff/phantomjs,jguyomard/phantomjs,iradul/phantomjs,forzi/phantomjs_stradivari_fork,peakji/phantomjs | python/pyphantomjs/cookiejar.py | python/pyphantomjs/cookiejar.py | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.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 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
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
from PyQt4.QtCore import QSettings
from PyQt4.QtNetwork import QNetworkCookie, QNetworkCookieJar
class CookieJar(QNetworkCookieJar):
def __init__(self, parent, cookiesFile):
super(CookieJar, self).__init__(parent)
self.m_cookiesFile = cookiesFile
def setCookiesFromUrl(self, cookieList, url):
settings = QSettings(self.m_cookiesFile, QSettings.IniFormat)
settings.beginGroup(url.host())
for cookie in cookieList:
settings.setValue(str(cookie.name()), str(cookie.value()))
settings.sync()
return True
def cookiesForUrl(self, url):
settings = QSettings(self.m_cookiesFile, QSettings.IniFormat)
cookieList = []
settings.beginGroup(url.host())
for cname in settings.childKeys():
cookieList.append(QNetworkCookie(cname, settings.value(cname)))
return cookieList
| '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.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 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
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
from PyQt4.QtCore import QSettings
from PyQt4.QtNetwork import QNetworkCookie, QNetworkCookieJar
class CookieJar(QNetworkCookieJar):
def __init__(self, parent, cookiesFile):
super(CookieJar, self).__init__(parent)
self.m_cookiesFile = cookiesFile
def setCookiesFromUrl(self, cookieList, url):
settings = QSettings(self.m_cookiesFile, QSettings.IniFormat)
settings.beginGroup(url.host())
for cookie in cookieList:
settings.setValue(cookie.name(), cookie.value())
settings.sync()
return True
def cookiesForUrl(self, url):
settings = QSettings(self.m_cookiesFile, QSettings.IniFormat)
cookieList = []
settings.beginGroup(url.host())
for cname in settings.childKeys():
cookieList.append(QNetworkCookie(cname, settings.value(cname)))
return cookieList
| bsd-3-clause | Python |
eb34dd310cac0106070554c440b134d0baad6c8e | add a way to sequence animations into a new animation | shimpe/pyvectortween,shimpe/pyvectortween | vectortween/SequentialAnimation.py | vectortween/SequentialAnimation.py | from vectortween.Animation import Animation
from vectortween.Tween import Tween
from vectortween.Mapping import Mapping
from copy import deepcopy
from itertools import tee
import numpy as np
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return zip(a, b)
def normalize(x):
return x / sum(x)
class SequentialAnimation(Animation):
def __init__(self, ListOfAnimations=[], timeweight=[], tween=['linear']):
super().__init__(None, None)
self.ListOfAnimations = []
self.ListOfAnimationTimeWeight = np.array([])
self.CumulativeNormalizedTimeWeights = np.array([])
self.T = Tween(*tween)
if ListOfAnimations:
if not timeweight:
for a in ListOfAnimations:
self.add(a, 1)
else:
for a,t in zip(ListOfAnimations,timeweight):
self.add(a, t)
def add(self, Anim, timeweight=1):
self.ListOfAnimations.append(deepcopy(Anim))
self.ListOfAnimationTimeWeight = np.append(self.ListOfAnimationTimeWeight, [timeweight])
self.CumulativeNormalizedTimeWeights = np.cumsum(normalize(self.ListOfAnimationTimeWeight))
def make_frame(self, frame, birthframe, startframe, stopframe, deathframe):
if birthframe is None:
birthframe = startframe
if deathframe is None:
deathframe = stopframe
if frame < birthframe:
return None
if frame > deathframe:
return None
if frame < startframe:
return self.ListOfAnimations[0].make_frame(frame, birthframe, startframe, stopframe, deathframe)
if frame > stopframe:
return self.ListOfAnimations[-1].make_frame(frame, birthframe, startframe, stopframe, deathframe)
t = self.T.tween2(frame, startframe, stopframe)
for i, w in enumerate(self.CumulativeNormalizedTimeWeights):
if t <= w:
if i == 0: # reached the end of the cumulative weights
relativestartframe = 0
else:
relativestartframe = self.CumulativeNormalizedTimeWeights[i-1]
relativestopframe = self.CumulativeNormalizedTimeWeights[i]
absstartframe = Mapping.linlin(relativestartframe, 0, 1, startframe, stopframe)
absstopframe = Mapping.linlin(relativestopframe, 0, 1, startframe, stopframe)
return self.ListOfAnimations[i].make_frame(frame, birthframe, absstartframe, absstopframe, deathframe)
| mit | Python |
|
d5b622e9fb855753630cd3a6fae1a315b4be1a08 | Add example using new pytorch backend | nkoep/pymanopt,nkoep/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,pymanopt/pymanopt | examples/dominant_eigenvector_pytorch.py | examples/dominant_eigenvector_pytorch.py | import numpy as np
import numpy.random as rnd
import numpy.linalg as la
import torch
from pymanopt import Problem
from pymanopt.tools import decorators
from pymanopt.manifolds import Sphere
from pymanopt.solvers import TrustRegions
def dominant_eigenvector(A):
"""
Returns the dominant eigenvector of the symmetric matrix A.
Note: For the same A, this should yield the same as the dominant invariant
subspace example with p = 1.
"""
m, n = A.shape
assert m == n, "matrix must be square"
assert np.allclose(np.sum(A - A.T), 0), "matrix must be symmetric"
manifold = Sphere(n)
solver = TrustRegions()
A_ = torch.from_numpy(A)
@decorators.pytorch
def cost(x):
return -x.matmul(A_.matmul(x))
problem = Problem(manifold=manifold, cost=cost)
xopt = solver.solve(problem)
return xopt.squeeze()
if __name__ == "__main__":
# Generate random problem data.
n = 128
A = rnd.randn(n, n)
A = 0.5 * (A + A.T)
# Calculate the actual solution by a conventional eigenvalue decomposition.
w, v = la.eig(A)
x = v[:, np.argmax(w)]
# Solve the problem with pymanopt.
xopt = dominant_eigenvector(A)
# Make sure both vectors have the same direction. Both are valid
# eigenvectors, of course, but for comparison we need to get rid of the
# ambiguity.
if np.sign(x[0]) != np.sign(xopt[0]):
xopt = -xopt
# Print information about the solution.
print('')
print("l2-norm of x: %f" % la.norm(x))
print("l2-norm of xopt: %f" % la.norm(xopt))
print("solution found: %s" % np.allclose(x, xopt, rtol=1e-3))
print("l2-error: %f" % la.norm(x - xopt))
| bsd-3-clause | Python |
|
7a9cb703e776d91d4fc3c632b190bd7d318a12a6 | Create primary directions module | flatangle/flatlib | flatlib/predictives/primarydirections.py | flatlib/predictives/primarydirections.py | """
This file is part of flatlib - (C) FlatAngle
Author: João Ventura (flatangleweb@gmail.com)
This module implements the Primary Directions
method.
"""
from flatlib import angle
from flatlib import utils
# === Base functions === #
def arc(pRA, pDecl, sRA, sDecl, mcRA, lat):
""" Returns the arc of direction between a Promissor
and Significator. It uses the generic proportional
semi-arc method.
"""
pDArc, pNArc = utils.dnarcs(pDecl, lat)
sDArc, sNArc = utils.dnarcs(sDecl, lat)
# Select meridian and arcs to be used
# Default is MC and Diurnal arcs
mdRA = mcRA
sArc = sDArc
pArc = pDArc
if not utils.isAboveHorizon(sRA, sDecl, mcRA, lat):
# Use IC and Nocturnal arcs
mdRA = angle.norm(mcRA + 180)
sArc = sNArc
pArc = pNArc
# Promissor and Significator distance to meridian
pDist = angle.closestdistance(mdRA, pRA)
sDist = angle.closestdistance(mdRA, sRA)
# Promissor should be after significator (in degrees)
if pDist < sDist:
pDist += 360
# Meridian distances proportional to respective semi-arcs
sPropDist = sDist / (sArc / 2.0)
pPropDist = pDist / (pArc / 2.0)
# The arc is how much of the promissor's semi-arc is
# needed to reach the significator
return (pPropDist - sPropDist) * (pArc / 2.0)
def getArc(prom, sig, mc, pos, zerolat):
""" Returns the arc of direction between a promissor
and a significator. Arguments are also the MC, the
geoposition and zerolat to assume zero ecliptical
latitudes.
ZeroLat true => inZodiaco, false => inMundo
"""
pRA, pDecl = prom.eqCoords(zerolat)
sRa, sDecl = sig.eqCoords(zerolat)
mcRa, mcDecl = mc.eqCoords()
return arc(pRA, pDecl, sRa, sDecl, mcRa, pos.lat) | mit | Python |
|
9fbde5b8dd4d2555e03bc0b7915fc4e55f8333d9 | Add test to help module | numba/numba,stonebig/numba,numba/numba,stonebig/numba,seibert/numba,stuartarchibald/numba,cpcloud/numba,sklam/numba,gmarkall/numba,stuartarchibald/numba,IntelLabs/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,gmarkall/numba,gmarkall/numba,seibert/numba,numba/numba,cpcloud/numba,gmarkall/numba,stuartarchibald/numba,stonebig/numba,sklam/numba,stonebig/numba,seibert/numba,stuartarchibald/numba,gmarkall/numba,IntelLabs/numba,cpcloud/numba,sklam/numba,numba/numba,seibert/numba,IntelLabs/numba,sklam/numba,stuartarchibald/numba,stonebig/numba,sklam/numba,cpcloud/numba,cpcloud/numba,numba/numba | numba/tests/test_help.py | numba/tests/test_help.py | from __future__ import print_function
import builtins
import types as pytypes
import numpy as np
from numba import types
from .support import TestCase
from numba.help.inspector import inspect_function, inspect_module
class TestInspector(TestCase):
def check_function_descriptor(self, info, must_be_defined=False):
self.assertIsInstance(info, dict)
self.assertIn('numba_type', info)
numba_type = info['numba_type']
if numba_type is None:
self.assertFalse(must_be_defined)
else:
self.assertIsInstance(numba_type, types.Type)
self.assertIn('explained', info)
self.assertIsInstance(info['explained'], str)
self.assertIn('source_infos', info)
self.assertIsInstance(info['source_infos'], dict)
def test_inspect_function_on_range(self):
info = inspect_function(range)
self.check_function_descriptor(info, must_be_defined=True)
def test_inspect_function_on_np_all(self):
info = inspect_function(np.all)
self.check_function_descriptor(info, must_be_defined=True)
source_infos = info['source_infos']
self.assertGreater(len(source_infos), 0)
c = 0
for srcinfo in source_infos.values():
self.assertIsInstance(srcinfo['kind'], str)
self.assertIsInstance(srcinfo['name'], str)
self.assertIsInstance(srcinfo['sig'], str)
self.assertIsInstance(srcinfo['filename'], str)
self.assertIsInstance(srcinfo['lines'], tuple)
self.assertIn('docstring', srcinfo)
c += 1
self.assertEqual(c, len(source_infos))
def test_inspect_module(self):
c = 0
for it in inspect_module(builtins):
self.assertIsInstance(it['module'], pytypes.ModuleType)
self.assertIsInstance(it['name'], str)
self.assertTrue(callable(it['obj']))
self.check_function_descriptor(it)
c += 1
self.assertGreater(c, 0)
| bsd-2-clause | Python |
|
e8607fce01bfe17c08de0702c4041d98504bc159 | Add migration for changing CONTACTED_CHOICES | reunition/reunition,reunition/reunition,reunition/reunition | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('alumni', '0005_note'),
]
operations = [
migrations.AlterField(
model_name='note',
name='contacted',
field=models.CharField(blank=True, max_length=10, null=True, choices=[(b'', b'No contact made'), (b'', b'---'), (b'email', b'Sent email'), (b'fb', b'Sent Facebook message'), (b'phone', b'Made phone call'), (b'text', b'Sent text message'), (b'other', b'Made other contact'), (b'', b'---'), (b'email-in', b'Received email'), (b'fb-in', b'Received Facebook message'), (b'phone-in', b'Received phone call'), (b'text-in', b'Received text message'), (b'other', b'Received other contact')]),
),
]
| mit | Python |
|
5db1a4c8c721a0acffa6e903c5eef9b84ebfd0d3 | rename example to avoid namespace problem | ContinuumIO/chaco,ContinuumIO/chaco,burnpanck/chaco,ContinuumIO/chaco,ContinuumIO/chaco,tommy-u/chaco,burnpanck/chaco,tommy-u/chaco,burnpanck/chaco,tommy-u/chaco | examples/tutorials/scipy2008/traits_example.py | examples/tutorials/scipy2008/traits_example.py |
from numpy import linspace, sin
from enable.api import ColorTrait
from chaco.api import ArrayPlotData, Plot, marker_trait
from enable.component_editor import ComponentEditor
from traits.api import HasTraits, Instance, Int
from traitsui.api import Group, Item, View
class ScatterPlotTraits(HasTraits):
plot = Instance(Plot)
color = ColorTrait("blue")
marker = marker_trait
marker_size = Int(4)
traits_view = View(
Group(Item('color', label="Color", style="custom"),
Item('marker', label="Marker"),
Item('marker_size', label="Size"),
Item('plot', editor=ComponentEditor(), show_label=False),
orientation = "vertical"),
width=800, height=600, resizable=True,
title="Chaco Plot"
)
def __init__(self):
# Create the data and the PlotData object
x = linspace(-14, 14, 100)
y = sin(x) * x**3
plotdata = ArrayPlotData(x = x, y = y)
# Create a Plot and associate it with the PlotData
plot = Plot(plotdata)
# Create a line plot in the Plot
self.renderer = plot.plot(("x", "y"), type="scatter", color="blue")[0]
self.plot = plot
def _color_changed(self):
self.renderer.color = self.color
def _marker_changed(self):
self.renderer.marker = self.marker
def _marker_size_changed(self):
self.renderer.marker_size = self.marker_size
#===============================================================================
# demo object that is used by the demo.py application.
#===============================================================================
demo = ScatterPlotTraits()
if __name__ == "__main__":
demo.configure_traits()
| bsd-3-clause | Python |
|
212d19c29a42bd6966965b166cdbb4dd642e5eb4 | Add test-cases for `get_user_membership` | pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2 | wqflask/tests/unit/wqflask/test_resource_manager.py | wqflask/tests/unit/wqflask/test_resource_manager.py | """Test cases for wqflask/resource_manager.py"""
import unittest
from unittest import mock
from wqflask.resource_manager import get_user_membership
class TestGetUserMembership(unittest.TestCase):
"""Test cases for `get_user_membership`"""
def setUp(self):
conn = mock.MagicMock()
conn.hgetall.return_value = {
'7fa95d07-0e2d-4bc5-b47c-448fdc1260b2': (
'{"name": "editors", '
'"admins": ["8ad942fe-490d-453e-bd37-56f252e41604", "rand"], '
'"members": ["8ad942fe-490d-453e-bd37-56f252e41603", '
'"rand"], '
'"changed_timestamp": "Oct 06 2021 06:39PM", '
'"created_timestamp": "Oct 06 2021 06:39PM"}')}
self.conn = conn
def test_user_is_group_member_only(self):
"""Test that a user is only a group member"""
self.assertEqual(
get_user_membership(
conn=self.conn,
user_id="8ad942fe-490d-453e-bd37-56f252e41603",
group_id="7fa95d07-0e2d-4bc5-b47c-448fdc1260b2"),
{"member": True,
"admin": False})
def test_user_is_group_admin_only(self):
"""Test that a user is a group admin only"""
self.assertEqual(
get_user_membership(
conn=self.conn,
user_id="8ad942fe-490d-453e-bd37-56f252e41604",
group_id="7fa95d07-0e2d-4bc5-b47c-448fdc1260b2"),
{"member": False,
"admin": True})
def test_user_is_both_group_member_and_admin(self):
"""Test that a user is both an admin and member of a group"""
self.assertEqual(
get_user_membership(
conn=self.conn,
user_id="rand",
group_id="7fa95d07-0e2d-4bc5-b47c-448fdc1260b2"),
{"member": True,
"admin": True})
| agpl-3.0 | Python |
|
b2febfd4b52c1e50be4d8ba614adcbe4d59251d8 | Add blank init file | moonrisewarrior/line-memebot | SDK/__init__.py | SDK/__init__.py | apache-2.0 | Python |
||
fc58a85131675672ccef2302038cc55c9e4b0460 | Migrate products | c2corg/v6_api,c2corg/v6_api,c2corg/v6_api | c2corg_api/scripts/migration/documents/products.py | c2corg_api/scripts/migration/documents/products.py | from c2corg_api.models.document import DocumentGeometry, \
ArchiveDocumentGeometry
from c2corg_api.models.waypoint import Waypoint, ArchiveWaypoint, \
WaypointLocale, ArchiveWaypointLocale
from c2corg_api.scripts.migration.documents.document import MigrateDocuments
class MigrateProducts(MigrateDocuments):
def get_name(self):
return 'products'
def get_model_document(self, locales):
return WaypointLocale if locales else Waypoint
def get_model_archive_document(self, locales):
return ArchiveWaypointLocale if locales else ArchiveWaypoint
def get_model_geometry(self):
return DocumentGeometry
def get_model_archive_geometry(self):
return ArchiveDocumentGeometry
def get_count_query(self):
return (
'select count(*) from app_products_archives;'
)
def get_query(self):
return (
'select '
' id, document_archive_id, is_latest_version, elevation, '
' is_protected, redirects_to, '
' ST_Force2D(ST_SetSRID(geom, 3857)) geom, '
' product_type, url '
'from app_products_archives '
'order by id, document_archive_id;'
)
def get_count_query_locales(self):
return (
'select count(*) from app_products_i18n_archives;'
)
def get_query_locales(self):
return (
'select '
' id, document_i18n_archive_id, is_latest_version, culture, '
' name, description, hours, access '
'from app_products_i18n_archives '
'order by id, document_i18n_archive_id;'
)
def get_document(self, document_in, version):
return dict(
document_id=document_in.id,
version=version,
waypoint_type='local_product',
elevation=document_in.elevation,
product_types=self.convert_types(
document_in.product_type,
MigrateProducts.product_types, [0]),
url=document_in.url
)
def get_document_archive(self, document_in, version):
doc = self.get_document(document_in, version)
doc['id'] = document_in.document_archive_id
return doc
def get_document_geometry(self, document_in, version):
return dict(
document_id=document_in.id,
id=document_in.id,
version=version,
geom=document_in.geom
)
def get_document_geometry_archive(self, document_in, version):
doc = self.get_document_geometry(document_in, version)
doc['id'] = document_in.document_archive_id
return doc
def get_document_locale(self, document_in, version):
# TODO extract summary
return dict(
document_id=document_in.id,
id=document_in.document_i18n_archive_id,
version=version,
culture=document_in.culture,
title=document_in.name,
description=document_in.description,
access=document_in.access,
access_period=document_in.hours
)
def get_document_locale_archive(self, document_in, version):
return self.get_document_locale(document_in, version)
product_types = {
'1': 'farm_sale',
'2': 'restaurant',
'3': 'grocery',
'4': 'bar',
'5': 'sport_shop'
}
| agpl-3.0 | Python |
|
9719189501f8b0fcff186b1bc2130fcef8d21e8d | add movie scraper | yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations,yujinjcho/movie_recommendations | scrape_rotten/scrape_rotten/spiders/movie_spider.py | scrape_rotten/scrape_rotten/spiders/movie_spider.py | import scrapy
def get_urls():
# load from file
with open('movie_urls.json') as f:
return [line.rstrip() for line in f]
class MovieSpider(scrapy.Spider):
name = 'movies'
start_urls = get_urls()
def meta_property(self, response, prop):
return response.xpath("//meta[@property='{}']/@content".format(prop)).extract()
def parse(self, response):
data = {'url': response.url}
movie_url_handle = response.url.split('/')
poster_url = response.css('img.posterImage::attr(src)').extract()
movie_title = self.meta_property(response, 'og:title')
description = self.meta_property(response, 'og:description')
rotten_id = self.meta_property(response, 'movieID')
year = response.css("h1#movie-title").xpath('span/text()').extract()
if movie_url_handle:
data['movie_url_handle'] = movie_url_handle[-1]
if poster_url:
data['poster_url'] = poster_url[0]
if movie_title:
data['movie_title'] = movie_title[0]
if description:
data['description'] = description[0]
if rotten_id:
data['rt_id'] = rotten_id[0]
if year:
data['year'] = year[0].replace('(', '').replace(')', '').strip()
yield data
| mit | Python |
|
052832a766e296a3444cb7afd5b5a930013d18d6 | Create z04-convolutional-neural-network.py | hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow,hpssjellis/forth-tensorflow | skflow-examples/z04-convolutional-neural-network.py | skflow-examples/z04-convolutional-neural-network.py | # http://terrytangyuan.github.io/2016/03/14/scikit-flow-intro/
# Loading MNIST data
mnist = input_data.read_data_sets('MNIST_data')
def max_pool_2x2(tensor_in):
return tf.nn.max_pool(tensor_in, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1],
padding='SAME')
def conv_model(X, y):
# reshape X to 4d tensor with 2nd and 3rd dimensions being image width and height
# final dimension being the number of color channels
X = tf.reshape(X, [-1, 28, 28, 1])
# first conv layer will compute 32 features for each 5x5 patch
with tf.variable_scope('conv_layer1'):
h_conv1 = skflow.ops.conv2d(X, n_filters=32, filter_shape=[5, 5],
bias=True, activation=tf.nn.relu)
h_pool1 = max_pool_2x2(h_conv1)
# second conv layer will compute 64 features for each 5x5 patch
with tf.variable_scope('conv_layer2'):
h_conv2 = skflow.ops.conv2d(h_pool1, n_filters=64, filter_shape=[5, 5],
bias=True, activation=tf.nn.relu)
h_pool2 = max_pool_2x2(h_conv2)
# reshape tensor into a batch of vectors
h_pool2_flat = tf.reshape(h_pool2, [-1, 7 * 7 * 64])
# densely connected layer with 1024 neurons
h_fc1 = skflow.ops.dnn(h_pool2_flat, [1024], activation=tf.nn.relu, keep_prob=0.5)
return skflow.models.logistic_regression(h_fc1, y)
# Training and predicting
classifier = skflow.TensorFlowEstimator(
model_fn=conv_model, n_classes=10, batch_size=100, steps=20000,
learning_rate=0.001)
| mit | Python |
|
b9ff8fc06f9bd55721332831d4ce23589d93fafb | Create 3Sum.py | chengjinlee/leetcode,chengjinlee/leetcode-solution-python | leetcode/15.-3Sum/3Sum.py | leetcode/15.-3Sum/3Sum.py | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
res = []
sortnum = sorted(nums)
length = len(sortnum)
# make sure a < b < c
for i in xrange(length-2):
a = sortnum[i]
# remove duplicate a
if i >= 1 and a == sortnum[i-1]:
continue
j = i + 1
k = length - 1
while j < k:
b = sortnum[j]
c = sortnum[k]
if b + c == -a:
res.append([a,b,c])
# remove duplicate b,c
while j < k:
j += 1
k -= 1
if sortnum[j] != b or sortnum[k] != c:
break
elif b + c > -a:
# remove duplicate c
while j < k:
k -= 1
if sortnum[k] != c:
break
else:
# remove duplicate b
while j < k:
j += 1
if sortnum[j] != b:
break
return res
| mit | Python |
|
80bf107b29f51456f778da718ef438fd62545b1b | Add server test file | the-raspberry-pi-guy/lidar | pi_approach/UI/server.py | pi_approach/UI/server.py | import socket
HOST = socket.gethostname() + '.local' # Server IP or Hostname
PORT = 12345 # Pick an open Port (1000+ recommended), must match the client sport
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
#managing error exception
try:
s.bind((HOST, PORT))
print "Opened"
except socket.error:
print 'Bind failed '
s.listen(5)
print 'Socket awaiting messages'
(conn, addr) = s.accept()
print 'Connected'
# awaiting for message
while True:
data = conn.recv(1024)
print 'I sent a message back in response to: ' + data
reply = ''
# process your message
if data == 'Hello':
reply = 'Hi, back!'
elif data == 'This is important':
reply = 'OK, I have done the important thing you have asked me!'
#and so on and on until...
elif data == 'quit':
conn.send('Terminating')
break
else:
reply = 'Unknown command'
# Sending reply
conn.send(reply)
conn.close() # Close connections
| mit | Python |
|
64577b7eb445a62f4e8348d687fa6ed7ed5401ed | Add migrations to user_profile app. | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | localtv/user_profile/migrations/0001_initial.py | localtv/user_profile/migrations/0001_initial.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('localtv', '0008_add_profile'),
)
def forwards(self, orm):
pass # this is handled by 0008_add_profile
def backwards(self, orm):
pass # this is handled by 0008_add_profile
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'user_profile.profile': {
'Meta': {'object_name': 'Profile', 'db_table': "'localtv_profile'"},
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'location': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'})
}
}
complete_apps = ['user_profile']
| agpl-3.0 | Python |
|
691b27a4d97d5c2966f1627ed6cc5870024537c0 | add bouncy example | jeisenma/ProgrammingConcepts | 06-animation/bouncy.py | 06-animation/bouncy.py | def setup():
size(300,300)
# ball properties
global rad, d, pos, vel, grav
rad = 25 # radius of the ball
pos = PVector( 150, 50 ) # initial position of the ball
vel = PVector( random(-3,3), random(-3,3) ) # velocity of the balll
grav = PVector( 0, 0.9 ) # force on the ball (gravity)
d = 0.97 # how much bounce?
def draw():
""" update the ball's state and draw it every frame """
global rad, d, pos, vel, grav
# update the velocity with the force
vel.add(grav)
# update the position with the velocity
pos.add(vel)
# deal with wall collisions
if(pos.y > height-rad): # floor collision
pos.y = height-rad
vel.y = -vel.y
vel.mult(d)
if(pos.x < rad): # left wall collision
pos.x = rad
vel.x = -vel.x
vel.mult(d)
if(pos.x > width-rad): # right wall collision
pos.x = width-rad
vel.x = -vel.x
vel.mult(d)
# draw the scene
background(150) # refresh the background
strokeWeight(2)
fill(20,160,240)
ellipse( pos.x, pos.y, rad*2, rad*2) # draw the ball
def mousePressed():
""" If the ball is clicked, add a random velocity. """
global rad, pos
if( dist(mouseX,mouseY,pos.x,pos.y) < rad ):
vel.add( PVector(random(-3,3), random(10,20)) )
| bsd-3-clause | Python |
|
1f6e225a1b01e8eb4cd9f1d5da05455d85326064 | Validate ck_user_has_mobile_or_other_auth constraint | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0357_validate_constraint.py | migrations/versions/0357_validate_constraint.py | """
Revision ID: 0357_validate_constraint
Revises: 0356_add_webautn_auth_type
Create Date: 2021-05-13 14:15:25.259991
"""
from alembic import op
revision = '0357_validate_constraint'
down_revision = '0356_add_webautn_auth_type'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute('ALTER TABLE users VALIDATE CONSTRAINT "ck_user_has_mobile_or_other_auth"')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
| mit | Python |
|
8387b0289e84ededdd9ba3db5ba47f149b918530 | clean up batch submit script | ENCODE-DCC/dna-me-pipeline,ENCODE-DCC/dna-me-pipeline,ENCODE-DCC/dna-me-pipeline | dnanexus/dx_batch.py | dnanexus/dx_batch.py | #!/usr/bin/env python
import argparse
import os
import sys
import subprocess
import dxpy
import requests
from dxencode import dxencode as dxencode
SERVER = 'https://www.encodeproject.org'
ASSAY_TYPE = 'whole genome bisulfite sequencing'
ASSAY_TERM_ID = 'OBI:0001863'
HEADERS = {'content-type': 'application/json'}
def get_args():
'''Parse the input arguments.'''
ap = argparse.ArgumentParser(description='Set up DNA Methylation runs on DNA Nexus')
ap.add_argument('-t', '--test',
help='Use test input folder',
action='store_true',
required=False)
ap.add_argument('-n', '--numberjobs',
help='Maximum Number of jobs to run',
type=int,
required=False)
return ap.parse_args()
def main():
cmnd = get_args()
## resolve projects
(AUTHID, AUTHPW, SERVER) = dxencode.processkey('www')
query = '/search/?type=experiment&assay_term_id=%s&award.rfa=ENCODE3&limit=all&files.file_format=fastq&frame=embedded&replicates.library.biosample.donor.organism.name=mouse' % ASSAY_TERM_ID
res = requests.get(SERVER+query, headers=HEADERS, auth=(AUTHID, AUTHPW),allow_redirects=True, stream=True)
exps = res.json()['@graph']
n=0
for exp in exps:
acc = exp['accession']
if n >= cmnd.numberjobs:
print "Stopping at %s replicates" % n
break
for rep in exp.get('replicates', []):
try:
runcmd = "./launchDnaMe.py --gzip -e %s --br %s --tr %s > runs/launch%s-%s-%s.out" % (acc, rep['biological_replicate_number'], rep['technical_replicate_number'],acc, rep['biological_replicate_number'], rep['technical_replicate_number'])
print runcmd
if not cmnd.test:
os.system(runcmd)
n+=1
except KeyError, e:
print "%s failed: %s" % (acc, e)
if __name__ == '__main__':
main()
| mit | Python |
|
9e217f0641328e1dfce91cdffdb8b5d77e4fe8fa | Add segcnn | Cysu/dlearn,Cysu/dlearn,Cysu/dlearn | examples/human_sar/segcnn.py | examples/human_sar/segcnn.py | import os
import sys
import cPickle
import theano.tensor as T
homepath = os.path.join('..', '..')
if not homepath in sys.path:
sys.path.insert(0, homepath)
from dlearn.models.layer import FullConnLayer, ConvPoolLayer
from dlearn.models.nnet import NeuralNet
from dlearn.utils import actfuncs, costfuncs
from dlearn.optimization import sgd
def load_data():
with open('data.pkl', 'rb') as f:
dataset = cPickle.load(f)
return dataset
def load_attr_model():
with open('scpool.pkl', 'rb') as f:
attr_model = cPickle.load(f)
return attr_model
def train_model(dataset, attr_model):
X = T.tensor4()
A = T.matrix()
S = T.tensor3()
layers = []
layers.append(ConvPoolLayer(
input=X * S.dimshuffle(0, 'x', 1, 2),
input_shape=(3, 160, 80),
filter_shape=(32, 3, 5, 5),
pool_shape=(2, 2),
active_func=actfuncs.tanh,
flatten=False,
W=attr_model.blocks[0]._W,
b=attr_model.blocks[0]._b
))
layers.append(ConvPoolLayer(
input=layers[-1].output,
input_shape=layers[-1].output_shape,
filter_shape=(64, 32, 5, 5),
pool_shape=(2, 2),
active_func=actfuncs.tanh,
flatten=True,
W=attr_model.blocks[0]._W,
b=attr_model.blocks[0]._b
))
layers.append(FullConnLayer(
input=layers[-1].output,
input_shape=layers[-1].output_shape,
output_shape=128,
dropout_ratio=0.1,
active_func=actfuncs.tanh
))
layers.append(FullConnLayer(
input=layers[-1].output,
input_shape=layers[-1].output_shape,
output_shape=37 * 17,
dropout_input=layers[-1].dropout_output,
active_func=actfuncs.sigmoid
))
model = NeuralNet(layers, [X, A], layers[-1].output)
model.target = S
model.cost = costfuncs.binxent(layers[-1].dropout_output, S.flatten(2)) + \
1e-3 * model.get_norm(2)
model.error = costfuncs.binerr(layers[-1].output, S.flatten(2))
model.consts = layers.blocks[0].parameters + layers.blocks[1].parameters
sgd.train(model, dataset, lr=1e-2, momentum=0.9,
batch_size=100, n_epochs=300,
epoch_waiting=10)
return model
def save_model(model):
with open('model_segcnn.pkl', 'wb') as f:
cPickle.dump(model, f, cPickle.HIGHEST_PROTOCOL)
if __name__ == '__main__':
dataset = load_data()
attr_model = load_attr_model()
model = train_model(dataset)
save_model(model)
| mit | Python |
|
218df31e0f808aae75310b98dfe2c5cb7d87e7ed | introduce image slicer | abertschi/postcards,abertschi/postcards,abertschi/postcards | postcards/slice_image.py | postcards/slice_image.py | from PIL import Image
import os
from time import gmtime, strftime
import math
import sys
import logging
"""slice_image.py: Slice images into tiles."""
__author__ = "Andrin Bertschi. www.abertschi.ch"
LOGGER_NAME = 'slice_image'
logger = logging.getLogger(LOGGER_NAME)
def make_tiles(image, tile_width, tile_height):
"""
slice PIL image to tiles
:param image: PIL image
:param tile_width: target tile width
:param tile_height: target tile height
:return: 2d array of PIL images
"""
width_segments = math.floor(image.width / tile_width)
height_segments = math.floor(image.height / tile_height)
matrix = [[0 for i in range(width_segments)] for i in range(height_segments)]
for h in range(height_segments):
y_from = h * tile_height
y_to = y_from + tile_height
for w in range(width_segments):
x_from = w * tile_width
x_to = x_from + tile_width
frame = image.crop((x_from, y_from, x_to, y_to))
matrix[h][w] = frame
return matrix
def store_tiles(tiles, directory, basename=None):
"""
Store generated tiles to disk
:param tiles: a 2d array of PIL images, as created by #make_tiles function
:param directory: directory to store images
:param basename: basename of image, if none is set, default name is chosen
:return: nothing
"""
if not basename:
basename = strftime("cropped_%Y-%m-%d_%H-%M-%S", gmtime())
if not os.path.exists(directory):
os.makedirs(directory)
logger.debug('creating {}'.format(directory))
height = len(tiles)
width = len(tiles[0])
for h in range(height):
for w in range(width):
frame = tiles[h][w]
filename = basename + '_{}-{}.jpg'.format(h, w)
filepath = os.path.join(directory, filename)
logger.debug('storing {}'.format(filepath))
frame.save(filepath)
def _make_absolute_path(path):
if os.path.isabs(path):
return path
else:
return str(os.path.join(os.getcwd(), path))
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO,
format='%(name)s (%(levelname)s): %(message)s')
logging.getLogger(LOGGER_NAME).setLevel(logging.DEBUG)
if len(sys.argv) < 4:
logger.error('wrong usage. call script python {} <image_path> <tile_width> <tile_height>'.format(sys.argv[0]))
exit(1)
image_path = _make_absolute_path(sys.argv[1])
tile_height = int(sys.argv[3])
tile_width = int(sys.argv[2])
if not os.path.isfile(image_path):
logger.error('file {} does not exist'.format(image_path))
exit(1)
file = open(image_path, 'rb')
with Image.open(file) as image:
cwd = os.getcwd()
basename = strftime("cropped_%Y-%m-%d_%H-%M-%S", gmtime())
directory = os.path.join(cwd, basename)
tiles = make_tiles(image, tile_width=tile_width, tile_height=tile_height)
store_tiles(tiles, directory)
| mit | Python |
|
ef627493f87d60e404008b26fe13e816d492a333 | add a bluetooth test component that simply displays when a device move on the network | librallu/cohorte-herald,librallu/cohorte-herald,librallu/cohorte-herald | python/test_bluetooth.py | python/test_bluetooth.py | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Test bluetooth module that displays informations from
bluetooth and print a message when a bluetooth device
appears or disappears.
:author: Luc Libralesso
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
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 "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
# Module version
__version_info__ = (0, 0, 3)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
__docformat__ = "restructuredtext en"
# ------------------------------------------------------------------------------
from pelix.ipopo.decorators import ComponentFactory, Instantiate, Requires, Validate
import logging
import herald.utils
# ------------------------------------------------------------------------------
_logger = logging.getLogger(__name__)
# ------------------------------------------------------------------------------
@ComponentFactory("herald-bluetooth-test-factory")
@Requires('_discovery', herald.transports.bluetooth.BLUETOOTH_DISCOVERY_SERVICE)
@Instantiate('herald-bluetooth-test-test')
class BluetoothTest:
""" A simple Test bluetooth module that displays information from
bluetooth and print a message when a bluetooth device
appears or disappears.
"""
def __init__(self):
self._discovery = None
@Validate
def validate(self, _):
# ask to be notified when there is a new device in the bluetooth network
self._discovery.listen_new(lambda x: print(x+" appears"))
self._discovery.listen_del(lambda x: print(x+" disappears"))
print('LISTENING TO THE BLUETOOTH NETWORK !')
| apache-2.0 | Python |
|
a1e3e275a81ff073fed226619bde23361230cfce | Add tests for packaging.tests.support (#12659). | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/packaging/tests/test_support.py | Lib/packaging/tests/test_support.py | import os
import tempfile
from packaging.dist import Distribution
from packaging.tests import support, unittest
class TestingSupportTestCase(unittest.TestCase):
def test_fake_dec(self):
@support.fake_dec(1, 2, k=3)
def func(arg0, *args, **kargs):
return arg0, args, kargs
self.assertEqual(func(-1, -2, k=-3), (-1, (-2,), {'k': -3}))
def test_TempdirManager(self):
files = {}
class Tester(support.TempdirManager, unittest.TestCase):
def test_mktempfile(self2):
tmpfile = self2.mktempfile()
files['test_mktempfile'] = tmpfile.name
self.assertTrue(os.path.isfile(tmpfile.name))
def test_mkdtemp(self2):
tmpdir = self2.mkdtemp()
files['test_mkdtemp'] = tmpdir
self.assertTrue(os.path.isdir(tmpdir))
def test_write_file(self2):
tmpdir = self2.mkdtemp()
files['test_write_file'] = tmpdir
self2.write_file((tmpdir, 'file1'), 'me file 1')
file1 = os.path.join(tmpdir, 'file1')
self.assertTrue(os.path.isfile(file1))
text = ''
with open(file1, 'r') as f:
text = f.read()
self.assertEqual(text, 'me file 1')
def test_create_dist(self2):
project_dir, dist = self2.create_dist()
files['test_create_dist'] = project_dir
self.assertTrue(os.path.isdir(project_dir))
self.assertIsInstance(dist, Distribution)
def test_assertIsFile(self2):
fd, fn = tempfile.mkstemp()
os.close(fd)
self.addCleanup(support.unlink, fn)
self2.assertIsFile(fn)
self.assertRaises(AssertionError, self2.assertIsFile, 'foO')
def test_assertIsNotFile(self2):
tmpdir = self2.mkdtemp()
self2.assertIsNotFile(tmpdir)
tester = Tester()
for name in ('test_mktempfile', 'test_mkdtemp', 'test_write_file',
'test_create_dist', 'test_assertIsFile',
'test_assertIsNotFile'):
tester.setUp()
try:
getattr(tester, name)()
finally:
tester.tearDown()
# check clean-up
if name in files:
self.assertFalse(os.path.exists(files[name]))
def test_suite():
return unittest.makeSuite(TestingSupportTestCase)
if __name__ == "__main__":
unittest.main(defaultTest="test_suite")
| mit | Python |
|
5a59b5b96e223da782cf683aabbf4e8371c883e1 | Add DHKE protocol | divkakwani/cryptos | cryptos/dhke.py | cryptos/dhke.py | """
Implementation of the Diffie-Hellman Key Exchange Protocol
Usage:
# Setup
invoker = DHKEInvoker()
other = DHKEParty(invoker.get_param())
# Key exchange phase
other.receive_partial_key(invoker.get_partial_key())
invoker.receive_partial_key(other.get_partial_key())
# Check consistency
assert(invoker.get_key() == other.get_key)
"""
from .numt import randprime, modulo_exp
from random import randint
__author__ = 'Divyanshu Kakwani'
__license__ = 'MIT'
def DHKEparam_gen(primelen=10):
"""
Generates parameters for the DHKE Protocol
"""
prime = randprime(10**(primelen-1), 10**primelen)
alpha = randint(2, prime-2)
return (prime, alpha)
class DHKEParty:
"""
Represents a party involved in DHKE Protocol
"""
def __init__(self, param):
self.prime = param[0]
self.alpha = param[1]
self.secret = randint(2, self.prime-2)
self.Ka = modulo_exp(self.alpha, self.secret, self.prime)
self.Kb = None
def get_param(self):
return (self.prime, self.alpha)
def get_partial_key(self):
return self.Ka
def receive_partial_key(self, Kb):
self.Kb = Kb
self.final_key = modulo_exp(Kb, self.secret, self.prime)
def get_key(self):
if not self.Kb:
raise Exception('Partial key not received')
return self.final_key
class DHKEInvoker(DHKEParty):
"""
The party which invokes the DHKE Protocol. A DHKEInvoker
differs from a DHKEParty in that it has to generate the
DHKE parameters at the outset.
"""
def __init__(self):
param = DHKEparam_gen()
DHKEParty.__init__(self, param)
| mit | Python |
|
088cd2ddb79bdd2a8dd68e2d7169484eea90fd1a | Add problem79.py | mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler | euler_python/problem79.py | euler_python/problem79.py | """
problem79.py
A common security method used for online banking is to ask the user for three
random characters from a passcode. For example, if the passcode was 531278, they
may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
The text file, keylog.txt, contains fifty successful login attempts.
Given that the three characters are always asked for in order, analyse the file
so as to determine the shortest possible secret passcode of unknown length.
"""
from collections import defaultdict, deque
from itertools import dropwhile
def to_digits(num):
return map(int, str(num))
def to_num(digits):
return int(''.join(map(str, digits)))
# Use 'breadth-first tree search', inspired by Peter Norvig's version in AIMA.
def solve(codes):
# Store all relations specified in the codes in a dict. Each digit
# is mapped to those digits appearing after it.
after = defaultdict(set)
for code in codes:
a, b, c = to_digits(code)
after[a].add(b)
after[a].add(c)
after[b].add(c)
# We will use lists to represent nodes in the tree, each of which is
# a candidate solution. So, initialise the frontier to the possible
# starting values.
frontier = deque([x] for x in after)
while frontier:
node = frontier.popleft()
if goal_state(node, after):
return node
# Use the 'after' dict to find the values, x, reachable from the end of
# the current node. Child nodes are then node + [x].
frontier.extend(node + [x] for x in after[node[-1]])
def goal_state(node, after):
"""Check whether, for all the relations specified in the 'after' dict,
the node satisfies them."""
# For each key, x, in the 'after' dict, the values, y, in after[x] must
# exist after the first occurrence of x in the node.
return all(y in dropwhile(lambda dgt: dgt != x, node)
for x in after
for y in after[x])
def problem79():
with open("data/keylog.txt", "r") as f:
codes = [int(x) for x in f.readlines()]
solution = solve(codes)
return to_num(solution)
| mit | Python |
|
a0e9ac222091619f41a4eed0cfb25c1653b8034d | add simple update script | merraksh/cvxpy,merraksh/cvxpy,merraksh/cvxpy,merraksh/cvxpy | cvxpy/utilities/cvxpy_upgrade.py | cvxpy/utilities/cvxpy_upgrade.py | import argparse
import re
# Captures row and column parameters; note the captured object should
# not be a keyword argument other than "cols" (hence the requirement that
# the captured group is followed by a comma, whitespace, or parentheses)
P_ROW_COL = r"(?:rows=)?(\w+),\s*(?:cols=)?(\w+)[\s,)]"
# A list of substitutions to make, with the first entry in each tuple the
# pattern and the second entry the substitution.
SUBST = [
# The shape is a single argument in CVXPY 1.0 (either a tuple or an int)
(r"Variable\(" + P_ROW_COL, r"Variable(shape=(\1, \2)"),
(r"Bool\(" + P_ROW_COL, r"Variable(shape=(\1, \2), boolean=True"),
(r"Int\(" + P_ROW_COL, r"Variable(shape=(\1, \2), integer=True"),
(r"Parameter\(" + P_ROW_COL, r"Parameter(shape=(\1, \2)"),
# Interpret 1D variables as 2D; code may depend upon 2D structure
(r"Variable\(([^,)]+)\)", r"Variable(shape=(\1,1))"),
(r"Bool\(([^,)]+)\)", r"Variable(shape=(\1,1), boolean=True)"),
(r"Int\(([^,)]+)\)", r"Variable(shape=(\1,1), integer=True)"),
(r"Parameter\(([^,)]+)\)", r"Parameter(shape=(\1,1))"),
# Update atom names
(r"sum_entries", "sum"),
(r"max_entries", "cummax"),
(r"max_elemwise", "max")
]
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="""Upgrade cvxpy code to version 1.0
Usage:
python cvxpy_upgrade.py --infile foo.py --outfile bar.py
""")
parser.add_argument("--infile", dest="input_file",
help="The name of the file to upgrade.",
required=True)
parser.add_argument("--outfile", dest="output_file",
help="The output filename.",
required=True)
args = parser.parse_args()
with open(args.input_file, 'rU') as f:
code = f.read()
for pattern, subst in SUBST:
code = re.sub(pattern, subst, code)
with open(args.output_file, 'w') as f:
f.write(code)
| apache-2.0 | Python |
|
5a99f676a5b0b55d0490c955cb9af42d9121192d | Initialize database transactions | andela-akiura/bucketlist | app/database.py | app/database.py | """This module initialises ."""
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.config import Config
engine = create_engine(Config.DATABASE_URI, convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()
def init_db():
"""."""
import app.models
Base.metadata.drop_all(bind=engine)
Base.metadata.create_all(bind=engine)
| mit | Python |
|
0ee023d29f613f718f5b88c158b120adb8b2fe2e | add new package (#16289) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-murmurhash/package.py | var/spack/repos/builtin/packages/py-murmurhash/package.py | # 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)
class PyMurmurhash(PythonPackage):
"""Cython bindings for MurmurHash."""
homepage = "https://github.com/explosion/murmurhash"
url = "https://pypi.io/packages/source/m/murmurhash/murmurhash-1.0.2.tar.gz"
version('1.0.2', sha256='c7a646f6b07b033642b4f52ae2e45efd8b80780b3b90e8092a0cec935fbf81e2')
depends_on('py-setuptools', type='build')
depends_on('py-wheel@0.32.0:0.32.999', type='build')
| lgpl-2.1 | Python |
|
e4bc3edf4180ac1385e125a11d01f222747b13f7 | send File Over FTP using ftplib | frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying | python/sendFileOverFTP.py | python/sendFileOverFTP.py | #---License---
#This is free and unencumbered software released into the public domain.
#Anyone is free to copy, modify, publish, use, compile, sell, or
#distribute this software, either in source code form or as a compiled
#binary, for any purpose, commercial or non-commercial, and by any
#means.
#by frainfreeze
#---Description---
#sends file over FTP using ftplib
#---code---
import ftplib
session = ftplib.FTP('myserver.com','login','passord')
myfile = open('theFile.txt','rb')
session.storbinary('STOR theFile.txt', myfile)
myfile.close()
session.quit()
| mit | Python |
|
b33725e2a3153b27312e820797bbc8375dbe8970 | Create beta_interweaving_strings_and_removing_digits.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta_interweaving_strings_and_removing_digits.py | Solutions/beta_interweaving_strings_and_removing_digits.py | from itertools import zip_longest as zlo
from string import digits
interweave = lambda a,b: ''.join((i if i not in digits else '')+(j if j not in digits else '') for i,j in zlo(a, b, fillvalue = ''))
| mit | Python |
|
6b53e890958251bd34c29b09f597c8221f4bc98b | Add sublime text utils module | Zeeker/sublime-SessionManager | modules/st_utils.py | modules/st_utils.py | import sublime
def open_window():
sublime.run_command("new_window")
return sublime.active_window()
| mit | Python |
|
ff2fba1c09cff57c9fb01ff3c12f076aff23d56a | Create __init__.py | rolc/python-package | __init__.py | __init__.py | #!/usr/bin/python
#-------------------------------IMPORT--------------------------------#
from lib import *
#-------------------------------EXPORT--------------------------------#
__all__ = ['<#PREFIX#>_app','<#PREFIX#>_index']
| mit | Python |
|
1641de48deab3e6cc18de7eb40e1d02ab28dd88c | Create StarTrek.py | WRWhite/StarTrek | StarTrek.py | StarTrek.py | # Star Treck
| mit | Python |
|
ae93eaf84487339c5fba696c7900485f2918546e | Add __init__.py | mrozekma/pytypecheck | __init__.py | __init__.py | from .pytypecheck import tc, tc_opts
from . import predicates
| mit | Python |
|
59e9281d94acf529113697057d80bb6a1eac6191 | Add global init file | walkerke/marble,scities/marble | __init__.py | __init__.py | # -*- coding: utf-8 -*-
"""Marble: analyse social stratification in cities"""
__author__ = "Rémi Louf"
__email__ = "remilouf@sciti.es"
__website__ = "www.sciti.es"
__copyright__ = "2015, Rémi Louf"
| bsd-3-clause | Python |
|
f06ebc1da601de961311c4b753e966227eadb911 | Create __init__.py | Hojalab/sarafu,Hojalab/sarafu,pesaply/sarafu,pesaply/sarafu | __init__.py | __init__.py | ""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = len(package)
for x in xrange(level, 1, -1):
try:
dot = package.rindex('.', 0, dot)
except ValueError:
raise ValueError("attempted relative import beyond top-level "
"package")
return "%s.%s" % (package[:dot], name)
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
if name.startswith('.'):
if not package:
raise TypeError("relative imports require the 'package' argument")
level = 0
for character in name:
if character != '.':
break
level += 1
name = _resolve_name(name[level:], package, level)
__import__(name)
return sys.modules[name]
| mit | Python |
|
a09fa218a918fbde70ea99a67fa1d964b17c5e2c | add init | thiippal/tankbuster | __init__.py | __init__.py | __all__ = ['bust']
from .detector import bust
| mit | Python |
|
7b8136d77f2968ac02d17991eca30862bdf9e104 | add __init__ file | LemonAniLabs/tensorflow-resnet,ry/tensorflow-resnet,sigmunjr/VirtualPetFence | __init__.py | __init__.py | from resnet import *
| mit | Python |
|
da874ace234dbac4f0fc8f428cf43d3f415cc596 | Create __init__.py | dabraude/PYSpeechLib | __init__.py | __init__.py | # __init__.py
| apache-2.0 | Python |
|
1e716efd7e275068a18d309f42ec8e955309b4b7 | Create __init__.py | eugena/django-stripwhitespace-middleware | __init__.py | __init__.py | mit | Python |
||
0a5710cae8597faf111486600fd90278bfc000f9 | reset head due to large file issue | dkoslicki/CMash,dkoslicki/CMash | dataForShaopeng/generate_data.py | dataForShaopeng/generate_data.py | import numpy as np
from CMash import MinHash as MH
import seaborn
import matplotlib.pyplot as plt
# Data prep
# In bash:
#mkdir dataForShaopeng
#cd dataForShaopeng/
#mkdir data
#cd data
#wget https://ucla.box.com/shared/static/c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && tar -zxvf c1g8xjc9glh68oje9e549fjqj0y8nc17.gz && rm c1g8xjc9glh68oje9e549fjqj0y8nc17.gz # grabbed this from the Metalign setup_data.sh
#ls | xargs -I{} sh -c 'readlink -f {} >> ../file_names.txt'
#cd ..
#head -n 10 file_names.txt > file_names_10.txt
#head -n 100 file_names.txt > file_names_100.txt
#head -n 1000 file_names.txt > file_names_1000.txt
#cd ../scripts/
#python MakeStreamingDNADatabase.py ../dataForShaopeng/file_names_10.txt ../dataForShaopeng/TrainingDatabase_10_k_60.h5 -n 1000 -k 60 -v
#python MakeStreamingDNADatabase.py ../dataForShaopeng/file_names_100.txt ../dataForShaopeng/TrainingDatabase_100_k_60.h5 -n 1000 -k 60 -v
#python MakeStreamingDNADatabase.py ../dataForShaopeng/file_names_1000.txt ../dataForShaopeng/TrainingDatabase_1000_k_60.h5 -n 1000 -k 60 -v
def cluster_matrix(A_eps, A_indicies, cluster_eps=.01):
"""
This function clusters the indicies of A_eps such that for a given cluster, there is another element in that cluster
with similarity (based on A_eps) >= cluster_eps for another element in that same cluster. For two elements of
distinct clusters, their similarity (based on A_eps) < cluster_eps.
:param A_eps: The jaccard or jaccard_count matrix containing the similarities
:param A_indicies: The basis of the matrix A_eps (in terms of all the CEs)
:param cluster_eps: The similarity threshold to cluster on
:return: (a list of sets of indicies defining the clusters, LCAs of the clusters)
"""
#A_indicies_numerical = np.where(A_indicies == True)[0]
A_indicies_numerical = A_indicies
# initialize the clusters
clusters = []
for A_index in range(len(A_indicies_numerical)):
# Find nearby elements
nearby = set(np.where(A_eps[A_index, :] >= cluster_eps)[0]) | set(np.where(A_eps[:, A_index] >= cluster_eps)[0])
in_flag = False
in_counter = 0
in_indicies = []
for i in range(len(clusters)):
if nearby & clusters[i]:
clusters[i].update(nearby) # add the nearby indicies to the cluster
in_counter += 1 # keep track if the nearby elements belong to more than one of the previously formed clusters
in_indicies.append(i) # which clusters nearby shares elements with
in_flag = True # tells if it forms a new cluster
if not in_flag: # if new cluster, then append to clusters
clusters.append(set(nearby))
if in_counter > 1: # If it belongs to more than one cluster, merge them together
merged_cluster = set()
for in_index in in_indicies[::-1]:
merged_cluster.update(clusters[in_index])
del clusters[in_index] # delete the old clusters (now merged)
clusters.append(merged_cluster) # append the newly merged clusters
clusters_full_indicies = []
for cluster in clusters:
cluster_full_indicies = set()
for item in cluster:
cluster_full_indicies.add(A_indicies_numerical[item])
clusters_full_indicies.append(cluster_full_indicies)
# Check to make sure the clustering didn't go wrong
if sum([len(item) for item in clusters_full_indicies]) != len(A_indicies_numerical): # Check the correct number of indicies
raise Exception("For some reason, the total number of indicies in the clusters doesn't equal the number of indicies you started with")
if set([item for subset in clusters_full_indicies for item in subset]) != set(A_indicies_numerical): # Make sure no indicies were missed or added
raise Exception("For some reason, the indicies in all the clusters doesn't match the indicies you started with")
return clusters_full_indicies#, cluster_LCAs(clusters_full_indicies, taxonomy)
n = 1000
cluster_eps = .01
CEs = MH.import_multiple_from_single_hdf5(f"/home/dkoslicki/Desktop/CMash/dataForShaopeng/TrainingDatabase_{n}_k_60.h5")
mat = MH.form_jaccard_matrix(CEs)
clusters_full_indicies = cluster_matrix(mat, range(n), cluster_eps=cluster_eps)
cluster_sizes = [len(x) for x in clusters_full_indicies]
max_cluster_loc = np.argmax(cluster_sizes)
max_cluster_indicies = list(clusters_full_indicies[max_cluster_loc])
print(len(max_cluster_indicies))
sub_mat = mat[max_cluster_indicies,:][:,max_cluster_indicies]
sub_CEs = [CEs[x] for x in max_cluster_indicies]
out_file_names = [x.input_file_name.decode('utf-8') for x in sub_CEs]
fid = open('/home/dkoslicki/Desktop/CMash/dataForShaopeng/to_select.txt', 'w')
for name in out_file_names:
fid.write(f"{name}\n")
fid.close()
seaborn.heatmap(sub_mat)
plt.show()
seaborn.clustermap(sub_mat)
plt.show()
# to check the kinds of organisms
#cat to_select.txt | xargs -I{} sh -c 'zcat {} | head -n 1'
| bsd-3-clause | Python |
|
d72f11fbfc23de44af8a2600a7310adafe3e2ffe | Create a.py | y-sira/atcoder,y-sira/atcoder | agc015/a.py | agc015/a.py | def main():
n, a, b = map(int, input().split())
if a > b or (n == 1 and a != b):
print(0)
else:
print((n - 1) * (b - a) - (b - a - 1))
if __name__ == '__main__':
main()
| mit | Python |
|
47ba8815c7a0de0191fb363c22c42732781a8e38 | Fix blank index_for | aipescience/django-daiquiri,aipescience/django-daiquiri,aipescience/django-daiquiri | daiquiri/metadata/migrations/0020_blank_index_for.py | daiquiri/metadata/migrations/0020_blank_index_for.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-04-05 15:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('daiquiri_metadata', '0019_column_index_for'),
]
operations = [
migrations.AlterField(
model_name='column',
name='index_for',
field=models.CharField(blank=True, default=b'', help_text='The columns which this column is an index for (e.g. for pgSphere).', max_length=256, verbose_name='Index for'),
),
]
| apache-2.0 | Python |
|
a9d5c1dcb059f02f6c3ec5dbff6b07f54c20194d | Add an example directory | phalt/beckett | example/main.py | example/main.py | from beckett import clients, resources
class PersonResource(resources.BaseResource):
class Meta:
name = 'Person'
resource_name = 'people'
identifier = 'url'
attributes = (
'name',
'birth_year',
'eye_color',
'gender',
'height',
'mass',
'url',
)
valid_status_codes = (
200,
)
methods = (
'get',
)
pagination_key = None
class StarWarsClient(clients.BaseClient):
class Meta:
name = 'Star Wars API Client'
base_url = 'http://swapi.co/api'
resources = (
PersonResource,
)
swapi = StarWarsClient()
results_list = swapi.get_person(uid=1)
person = results_list[0]
print(person.name)
| isc | Python |
|
3367f9d1e394bf686bc6bbd6316265c9feef4f03 | Add basic tests for config usb | Yubico/yubikey-manager,Yubico/yubikey-manager | test/on_yubikey/test_cli_config.py | test/on_yubikey/test_cli_config.py | from .util import (DestructiveYubikeyTestCase, ykman_cli)
class TestConfigUSB(DestructiveYubikeyTestCase):
def setUp(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def tearDown(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def test_disable_otp(self):
ykman_cli('config', 'usb', '--disable', 'OTP', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('OTP', output)
def test_disable_u2f(self):
ykman_cli('config', 'usb', '--disable', 'U2F', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('FIDO U2F', output)
def test_disable_openpgp(self):
ykman_cli('config', 'usb', '--disable', 'OPGP', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('OpenPGP', output)
def test_disable_piv(self):
ykman_cli('config', 'usb', '--disable', 'PIV', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('PIV', output)
def test_disable_oath(self):
ykman_cli('config', 'usb', '--disable', 'OATH', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('OATH', output)
def test_disable_fido2(self):
ykman_cli('config', 'usb', '--disable', 'FIDO2', '-f')
output = ykman_cli('config', 'usb', '--list')
self.assertNotIn('FIDO2', output)
| bsd-2-clause | Python |
|
b8e466a8671be716397d136e16814790b7ed594a | Create Scaffold | au-re/steiner-tree | SteinerTree.py | SteinerTree.py | import random
import numpy
import matplotlib.pyplot as plt
from deap import base, creator, tools, algorithms
'''
SteinerTree
Code scaffold for solving the SteinerTree problem using the
DEAP framework https://github.com/deap/deap
(currently OneMax problem)
you can find more information about DEAP in the notebooks at:
https://github.com/DEAP/notebooks
version: 0.1
authors: Xiaoqian Xiong, Raoul Nicolodi, Martin Kaufleitner, Aurelien Hontabat
license: MIT
'''
# Type Creation
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
# Individual and Population
toolbox = base.Toolbox()
toolbox.register("attr_bool", random.randint, 0, 1)
toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, n=10)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
# Evaluation Function
def evalOneMax(individual):
return sum(individual), # don't forget the comma (returns tupple)
# Genetic Operators
toolbox.register("evaluate", evalOneMax)
toolbox.register("mate", tools.cxTwoPoint)
toolbox.register("mutate", tools.mutFlipBit, indpb=0.05)
toolbox.register("select", tools.selTournament, tournsize=3)
# Evolving the Population
def main():
pop = toolbox.population(n=50)
hof = tools.HallOfFame(1)
stats = tools.Statistics(lambda ind: ind.fitness.values)
stats.register("avg", numpy.mean)
stats.register("min", numpy.min)
stats.register("max", numpy.max)
pop, logbook = algorithms.eaSimple(pop, toolbox, cxpb=0.5, mutpb=0.2, ngen=10, stats=stats, halloffame=hof, verbose=True)
return pop, logbook, hof
# Visualize Results
pop, log, hof = main()
print("Best individual is: %s\nwith fitness: %s" % (hof[0], hof[0].fitness))
gen, avg, min_, max_ = log.select("gen", "avg", "min", "max")
plt.plot(gen, avg, label="average")
plt.plot(gen, min_, label="minimum")
plt.plot(gen, max_, label="maximum")
plt.xlabel("Generation")
plt.ylabel("Fitness")
plt.legend(loc="lower right")
# Alternative: defining the generation step process
# population = toolbox.population(n=300)
# NGEN=40
#
# for gen in range(NGEN):
#
# offspring = algorithms.varAnd(population, toolbox, cxpb=0.5, mutpb=0.1)
# fits = toolbox.map(toolbox.evaluate, offspring)
#
# for fit, ind in zip(fits,offspring):
# ind.fitness.values = fit
#
# population = toolbox.select(offspring, k=len(population))
#
# top10 = tools.selBest(population, k=10)
#
# print(top10)
| mit | Python |
|
4dbe1b21ab0f82eeba82be7db2e141260942b998 | add num_states to mixture convenience wrapper | theDataGeek/pyhsmm,theDataGeek/pyhsmm,mattjj/pyhsmm,theDataGeek/pyhsmm,wgmueller1/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,wgmueller1/pyhsmm,mattjj/pyhsmm,fivejjs/pyhsmm,fivejjs/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm | basic/models.py | basic/models.py | # These classes make aliases of class members and properties so as to make
# pybasicbayes mixture models look more like pyhsmm models. When comparing
# H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one
# code path by using these models.
import pybasicbayes
from ..util.general import rle
class _Labels(pybasicbayes.internals.labels.Labels):
@property
def T(self):
return self.N
@property
def stateseq(self):
return self.z
@stateseq.setter
def stateseq(self,stateseq):
self.z = stateseq
@property
def stateseqs_norep(self):
return rle(self.z)[0]
@property
def durations(self):
return rle(self.z)[1]
class _MixturePropertiesMixin(object):
_labels_class = _Labels
@property
def num_states(self):
return len(self.obs_distns)
@property
def states_list(self):
return self.labels_list
@property
def stateseqs(self):
return [s.stateseq for s in self.states_list]
@property
def stateseqs_norep(self):
return [s.stateseq_norep for s in self.states_list]
@property
def durations(self):
return [s.durations for s in self.states_list]
@property
def obs_distns(self):
return self.components
@obs_distns.setter
def obs_distns(self,distns):
self.components = distns
class Mixture(_MixturePropertiesMixin,pybasicbayes.models.Mixture):
pass
class MixtureDistribution(_MixturePropertiesMixin,pybasicbayes.models.MixtureDistribution):
pass
| # These classes make aliases of class members and properties so as to make
# pybasicbayes mixture models look more like pyhsmm models. When comparing
# H(S)MM model fits to pybasicbayes mixture model fits, it's easier to write one
# code path by using these models.
import pybasicbayes
from ..util.general import rle
class _Labels(pybasicbayes.internals.labels.Labels):
@property
def T(self):
return self.N
@property
def stateseq(self):
return self.z
@stateseq.setter
def stateseq(self,stateseq):
self.z = stateseq
@property
def stateseqs_norep(self):
return rle(self.z)[0]
@property
def durations(self):
return rle(self.z)[1]
class _MixturePropertiesMixin(object):
_labels_class = _Labels
@property
def states_list(self):
return self.labels_list
@property
def stateseqs(self):
return [s.stateseq for s in self.states_list]
@property
def stateseqs_norep(self):
return [s.stateseq_norep for s in self.states_list]
@property
def durations(self):
return [s.durations for s in self.states_list]
@property
def obs_distns(self):
return self.components
@obs_distns.setter
def obs_distns(self,distns):
self.components = distns
class Mixture(_MixturePropertiesMixin,pybasicbayes.models.Mixture):
pass
class MixtureDistribution(_MixturePropertiesMixin,pybasicbayes.models.MixtureDistribution):
pass
| mit | Python |
fb7a5b279da36b9dbd6338867168a79011edd0d6 | Create new package (#7208) | EmreAtes/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,LLNL/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,tmerrick1/spack,EmreAtes/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,mfherbst/spack,krafczyk/spack,krafczyk/spack,iulian787/spack,iulian787/spack,LLNL/spack,tmerrick1/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,matthiasdiener/spack | var/spack/repos/builtin/packages/glimmer/package.py | var/spack/repos/builtin/packages/glimmer/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program 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) version 2.1, February 1999.
#
# 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 terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Glimmer(MakefilePackage):
"""Glimmer is a system for finding genes in microbial DNA, especially the
genomes of bacteria, archaea, and viruses."""
homepage = "https://ccb.jhu.edu/software/glimmer"
version('3.02b', '344d012ae12596de905866fe9eb7f16c')
build_directory = 'src'
def url_for_version(self, version):
url = "https://ccb.jhu.edu/software/glimmer/glimmer{0}.tar.gz"
return url.format(version.joined)
def install(self, spec, prefix):
install_tree('bin', prefix.bin)
| lgpl-2.1 | Python |
|
fe1af6449ec4feeaf75a248422e806ad9c818749 | remove doc | dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild | python/qidoc/__init__.py | python/qidoc/__init__.py | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" qidoc : handle generating sphinx and doxygen documentation of qibuild
projects
"""
| ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" qidoc : handle generating sphinx and doxygen documentation of qibuild
projects
qiDoc: documentation generator
==============================
qiDoc helps you easily write and merge several
documentation formats, doxygen and sphinx for the moment.
Usage:
-----
qidoc is controlled by a simple config file, looking like
.. code-block:: xml
<qidoc>
<repo name="qibuild">
<sphinxdoc name="qibuild" src="doc" />
</repo>
<repo name="libnaoqi" >
<doxydoc name="libalcommon" src="libalcommon/doc" />
<doxydoc name="libalvision" src="libalvisio/doc" />
</repo>
<repo name="doc">
<sphinxdoc name="doc" src="source" dest="." />
</repo>
<defaults>
<root_project name="doc" />
</defaults>
<templates>
<doxygen
doxyfile="soure/tools/Doxyfile.template"
css="soure/tools/doxygen.template.css"
header="soure/tools/header.template.html"
footer="soure/tools/footer.template.html"
/>
<sphinx
config="source/conf.py"
/>
</templates>
</qidoc>
Such a file will produce a documentation looking like
::
doc/ index.html (doc)
/ libalmotion/index (doxy libnaoqi/almotion)
/ libalvision/index (doxy libnaoqi/avisiion)
/ qibuild/index (sphinx qibuild)
"""
| bsd-3-clause | Python |
ceb8ec420e5e894644aecce8b96463cc3769ce1d | Add process_alerts management command | NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor,NUKnightLab/cityhallmonitor | cityhallmonitor/management/commands/process_alerts.py | cityhallmonitor/management/commands/process_alerts.py | from django.conf import settings
from django.core.mail import send_mail
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from cityhallmonitor.models import Subscription
from documentcloud import DocumentCloud
DEFAULT_PROJECT = 'Chicago City Hall Monitor'
EMAIL_SUBJECT = 'City Hall Monitor Search Alert'
EMAIL_FROM = 'KnightLab@northwestern.edu'
EMAIL_TEMPLATE = """
<p>You alert subscription on City Hall Monitor:
</p>
<p>%(query)s
</p>
<p>Matched %(n)d new documents:</p>
"""
EMAIL_DOC_TEMPLATE = """
<p>%(matter)s<br>
<a href="%(link_url)s">%(link_text)s</a>
</p>
"""
class Command(BaseCommand):
help = 'Process user alert subscriptions.'
_client = None
def client(self):
"""Using un-authenticated client..."""
if self._client is None:
self._client = DocumentCloud()
return self._client
def add_arguments(self, parser):
pass # noop
def search(self, query):
return self.client().documents.search(query)
def send_subscription_alert(self, subscription, document_list):
"""Send user subscription alert"""
n_documents = len(document_list)
html_message = EMAIL_TEMPLATE % ({
'query': subscription.query,
'n': n_documents
})
for doc in document_list:
html_message += EMAIL_DOC_TEMPLATE % {
'matter': doc.data['MatterTitle'],
'link_url': doc.published_url,
'link_text': doc.title
}
print('Sending alert for %d documents [%s]' % (
n_documents, subscription))
send_mail(
EMAIL_SUBJECT,
'',
EMAIL_FROM,
[subscription.email],
fail_silently=False,
html_message=html_message)
def process_subscription(self, subscription):
"""Process subscription"""
query = 'account:%s project:"%s" %s' % (
settings.DOCUMENT_CLOUD_ACCOUNT,
DEFAULT_PROJECT,
subscription.query)
print(query)
r = self.search(query)
if subscription.last_check:
r = [d for d in r if d.updated_at > subscription.last_check]
try:
if len(r):
self.send_subscription_alert(subscription, r)
subscription.last_check = timezone.now()
subscription.save()
except SMTPException as se:
self.stdout.write(
'ERROR sending email for subscription %d: %s' % \
(subscription.id, str(se)))
def handle(self, *args, **options):
"""Process subscriptions"""
subscription_list = Subscription.objects.all()
print('Processing %d subscriptions' % len(subscription_list))
for subscription in subscription_list:
self.process_subscription(subscription)
self.stdout.write('Done')
| mit | Python |
|
59a0996644115bef57de6e15dc572a6227e45b3a | Add script for downloading weekly price data from India | FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas | data_crunching/download_india_prices.py | data_crunching/download_india_prices.py | #!/usr/bin/env python2
import urllib
import urllib2
import shutil
import re
import sys
import datetime
usage_str = '''
This scripts downloads weekly food prices from http://rpms.dacnet.nic.in/Bulletin.aspx in XLS format.
'''
def download_spreadsheet(date_string):
main_url = 'http://rpms.dacnet.nic.in/Bulletin.aspx'
params = '__VIEWSTATE=%2FwEPDwUKLTMyOTA3MjI1Ng9kFgICAQ9kFgQCDQ8QZGQWAWZkAhgPFCsABWQoKVhTeXN0ZW0uR3VpZCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5JDc5NWYyNmMxLTc5OTYtNDljNy04ZmNiLTEwMWYyZTVjMDljYQIBFCsAATwrAAQBAGZkFgICAQ9kFgJmD2QWAmYPZBYMAgEPDxYCHgdWaXNpYmxlaGRkAgIPZBYCAgIPFgIeBVZhbHVlBQVmYWxzZWQCAw9kFgJmD2QWAmYPDxYCHwBoZGQCBQ9kFgICAg8WAh8BBQVmYWxzZWQCBg9kFgJmD2QWAmYPZBYEZg8PZBYCHgVzdHlsZQUQdmlzaWJpbGl0eTpub25lO2QCAw9kFgQCAQ8WAh4HRW5hYmxlZGhkAgQPFgIfAQUDMTAwZAIKD2QWAgIBDxYCHwEFBUZhbHNlZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgUdUmVwb3J0Vmlld2VyMTpUb2dnbGVQYXJhbTppbWcFF1JlcG9ydFZpZXdlcjE6X2N0bDg6aW1ngH4V0uEh9SSOm1xq3bgJgGyDNgIP96LELxzNCJ%2FutD8%3D&__EVENTVALIDATION=%2FwEWHgLr9e3WDgKkjKiDDgKgwpPxDQKsrPr5DAK896w2Ap6Ss%2BMJAvHkkI8EAveMotMNAu7cnNENAqLH6hoC0veCxAoCjOeKxgYC3YHBwAQCyYC91AwCyIC91AwCp5zChwMCp5z%2BmA0CyI%2B56wYCxNb9oA8CzO7%2BnQkC6MPz%2FQkCvKm9vQwC0vCh0QoC4qOPjw8C9%2FmBmAICstrw7ggC%2Fa2qigkCgoOCmg8CgoOW9QcCgoPa4w062z2PEYfDeoZgfbqdsNPMXUtlCnyUt5wzsv6RVn9PnA%3D%3D&TxtDate=#{TXTDATE}&RadioButtonList1=Food+Items&DDLReportFormat=MS+Excel&Button1=Generate+Report&TxtVolume=XXXX+NO+03&ReportViewer1%3A_ctl3%3A_ctl0=&ReportViewer1%3A_ctl3%3A_ctl1=&ReportViewer1%3A_ctl11=&ReportViewer1%3A_ctl12=quirks&ReportViewer1%3AAsyncWait%3AHiddenCancelField=False&ReportViewer1%3AToggleParam%3Astore=&ReportViewer1%3AToggleParam%3Acollapse=false&ReportViewer1%3A_ctl9%3AClientClickedId=&ReportViewer1%3A_ctl8%3Astore=&ReportViewer1%3A_ctl8%3Acollapse=false&ReportViewer1%3A_ctl10%3AVisibilityState%3A_ctl0=None&ReportViewer1%3A_ctl10%3AScrollPosition=&ReportViewer1%3A_ctl10%3AReportControl%3A_ctl2=&ReportViewer1%3A_ctl10%3AReportControl%3A_ctl3=&ReportViewer1%3A_ctl10%3AReportControl%3A_ctl4=100'
params = params.replace('#{TXTDATE}', date_string)
req = urllib2.Request(main_url, params)
response = urllib2.urlopen(req)
out_file_name = re.sub('/', '_', date) + '.xls'
print "### Output file:", out_file_name
myfile = open(out_file_name, 'wb')
shutil.copyfileobj(response.fp, myfile)
myfile.close()
print "### Finished."
def validate_date(date_string):
match = re.match(r'(\d{2})/(\d{2})/(\d{4})', date_string)
if not match:
sys.exit("ERROR: invalid date")
day, month, year = int(match.group(1)), int(match.group(2)), int(match.group(3))
date = datetime.date(year, month, day)
if date.weekday() != 4:
sys.exit("ERROR: the date entered is not Friday, too bad")
def usage():
print usage_str
if __name__ == "__main__":
if len(sys.argv) == 1 or sys.argv[1] in ['-h', '--help']:
usage()
sys.exit(0)
date = sys.argv[1]
validate_date(date)
download_spreadsheet(date)
| bsd-3-clause | Python |
|
44597a9b9f5e2ef2eb391b096d3240b81960ce68 | fix doc generation on plot_lasso_coordinate_descent_path.py example (pb on my box) | ZENGXH/scikit-learn,harshaneelhg/scikit-learn,Obus/scikit-learn,belltailjp/scikit-learn,xzh86/scikit-learn,luo66/scikit-learn,mjudsp/Tsallis,3manuek/scikit-learn,fyffyt/scikit-learn,liangz0707/scikit-learn,aewhatley/scikit-learn,henridwyer/scikit-learn,vibhorag/scikit-learn,ChanChiChoi/scikit-learn,ilo10/scikit-learn,icdishb/scikit-learn,lazywei/scikit-learn,ankurankan/scikit-learn,procoder317/scikit-learn,billy-inn/scikit-learn,sgenoud/scikit-learn,henridwyer/scikit-learn,DonBeo/scikit-learn,rexshihaoren/scikit-learn,zhenv5/scikit-learn,huzq/scikit-learn,ilo10/scikit-learn,sgenoud/scikit-learn,zaxtax/scikit-learn,ElDeveloper/scikit-learn,mblondel/scikit-learn,mhdella/scikit-learn,lesteve/scikit-learn,IssamLaradji/scikit-learn,liyu1990/sklearn,jseabold/scikit-learn,adamgreenhall/scikit-learn,mblondel/scikit-learn,jakirkham/scikit-learn,sgenoud/scikit-learn,ChanderG/scikit-learn,schets/scikit-learn,ycaihua/scikit-learn,equialgo/scikit-learn,imaculate/scikit-learn,procoder317/scikit-learn,spallavolu/scikit-learn,joshloyal/scikit-learn,mjgrav2001/scikit-learn,maheshakya/scikit-learn,nmayorov/scikit-learn,ngoix/OCRF,fabianp/scikit-learn,arabenjamin/scikit-learn,lbishal/scikit-learn,ashhher3/scikit-learn,jmschrei/scikit-learn,khkaminska/scikit-learn,Windy-Ground/scikit-learn,rajat1994/scikit-learn,shusenl/scikit-learn,JosmanPS/scikit-learn,betatim/scikit-learn,alexeyum/scikit-learn,liyu1990/sklearn,zaxtax/scikit-learn,btabibian/scikit-learn,hugobowne/scikit-learn,MechCoder/scikit-learn,RPGOne/scikit-learn,larsmans/scikit-learn,procoder317/scikit-learn,rahuldhote/scikit-learn,rohanp/scikit-learn,tawsifkhan/scikit-learn,hsiaoyi0504/scikit-learn,victorbergelin/scikit-learn,vivekmishra1991/scikit-learn,dsullivan7/scikit-learn,rexshihaoren/scikit-learn,UNR-AERIAL/scikit-learn,eg-zhang/scikit-learn,fabianp/scikit-learn,0asa/scikit-learn,lin-credible/scikit-learn,ChanderG/scikit-learn,Garrett-R/scikit-learn,moutai/scikit-learn,jayflo/scikit-learn,smartscheduling/scikit-learn-categorical-tree,nomadcube/scikit-learn,DonBeo/scikit-learn,JeanKossaifi/scikit-learn,nelson-liu/scikit-learn,OshynSong/scikit-learn,Fireblend/scikit-learn,Akshay0724/scikit-learn,Clyde-fare/scikit-learn,jkarnows/scikit-learn,shusenl/scikit-learn,meduz/scikit-learn,MartinDelzant/scikit-learn,harshaneelhg/scikit-learn,qifeigit/scikit-learn,moutai/scikit-learn,hdmetor/scikit-learn,DSLituiev/scikit-learn,fabioticconi/scikit-learn,jjx02230808/project0223,mxjl620/scikit-learn,Lawrence-Liu/scikit-learn,r-mart/scikit-learn,altairpearl/scikit-learn,sanketloke/scikit-learn,beepee14/scikit-learn,scikit-learn/scikit-learn,Vimos/scikit-learn,wanggang3333/scikit-learn,ldirer/scikit-learn,lucidfrontier45/scikit-learn,rsivapr/scikit-learn,RomainBrault/scikit-learn,abhishekgahlot/scikit-learn,walterreade/scikit-learn,depet/scikit-learn,jblackburne/scikit-learn,deepesch/scikit-learn,sinhrks/scikit-learn,aminert/scikit-learn,rishikksh20/scikit-learn,yask123/scikit-learn,ky822/scikit-learn,jzt5132/scikit-learn,thientu/scikit-learn,clemkoa/scikit-learn,nomadcube/scikit-learn,RomainBrault/scikit-learn,btabibian/scikit-learn,cdegroc/scikit-learn,IndraVikas/scikit-learn,arahuja/scikit-learn,siutanwong/scikit-learn,huobaowangxi/scikit-learn,icdishb/scikit-learn,victorbergelin/scikit-learn,waterponey/scikit-learn,Achuth17/scikit-learn,idlead/scikit-learn,bthirion/scikit-learn,stylianos-kampakis/scikit-learn,AIML/scikit-learn,larsmans/scikit-learn,abimannans/scikit-learn,djgagne/scikit-learn,altairpearl/scikit-learn,ssaeger/scikit-learn,RachitKansal/scikit-learn,samuel1208/scikit-learn,kashif/scikit-learn,mikebenfield/scikit-learn,evgchz/scikit-learn,Djabbz/scikit-learn,tosolveit/scikit-learn,fredhusser/scikit-learn,AlexanderFabisch/scikit-learn,hugobowne/scikit-learn,ClimbsRocks/scikit-learn,liangz0707/scikit-learn,wazeerzulfikar/scikit-learn,untom/scikit-learn,0x0all/scikit-learn,vybstat/scikit-learn,lesteve/scikit-learn,michigraber/scikit-learn,rvraghav93/scikit-learn,huobaowangxi/scikit-learn,ZENGXH/scikit-learn,krez13/scikit-learn,sergeyf/scikit-learn,yunfeilu/scikit-learn,rahul-c1/scikit-learn,beepee14/scikit-learn,tdhopper/scikit-learn,jakirkham/scikit-learn,larsmans/scikit-learn,Barmaley-exe/scikit-learn,joernhees/scikit-learn,MartinSavc/scikit-learn,ndingwall/scikit-learn,Djabbz/scikit-learn,pkruskal/scikit-learn,xiaoxiamii/scikit-learn,PatrickOReilly/scikit-learn,thilbern/scikit-learn,kylerbrown/scikit-learn,shenzebang/scikit-learn,petosegan/scikit-learn,MartinSavc/scikit-learn,IshankGulati/scikit-learn,xyguo/scikit-learn,iismd17/scikit-learn,bthirion/scikit-learn,andaag/scikit-learn,pratapvardhan/scikit-learn,hitszxp/scikit-learn,AlexandreAbraham/scikit-learn,pkruskal/scikit-learn,mattilyra/scikit-learn,etkirsch/scikit-learn,equialgo/scikit-learn,tawsifkhan/scikit-learn,bigdataelephants/scikit-learn,Jimmy-Morzaria/scikit-learn,lazywei/scikit-learn,AnasGhrab/scikit-learn,ssaeger/scikit-learn,djgagne/scikit-learn,sarahgrogan/scikit-learn,maheshakya/scikit-learn,kmike/scikit-learn,3manuek/scikit-learn,hsuantien/scikit-learn,carrillo/scikit-learn,jakirkham/scikit-learn,AIML/scikit-learn,luo66/scikit-learn,shahankhatch/scikit-learn,nomadcube/scikit-learn,JeanKossaifi/scikit-learn,betatim/scikit-learn,ChanChiChoi/scikit-learn,spallavolu/scikit-learn,tmhm/scikit-learn,huzq/scikit-learn,zihua/scikit-learn,466152112/scikit-learn,bnaul/scikit-learn,kjung/scikit-learn,MohammedWasim/scikit-learn,NelisVerhoef/scikit-learn,Srisai85/scikit-learn,jmschrei/scikit-learn,alexsavio/scikit-learn,nikitasingh981/scikit-learn,PatrickChrist/scikit-learn,Sentient07/scikit-learn,samuel1208/scikit-learn,0asa/scikit-learn,IndraVikas/scikit-learn,jakobworldpeace/scikit-learn,trankmichael/scikit-learn,kmike/scikit-learn,rohanp/scikit-learn,mblondel/scikit-learn,samzhang111/scikit-learn,florian-f/sklearn,ishanic/scikit-learn,IndraVikas/scikit-learn,LohithBlaze/scikit-learn,JPFrancoia/scikit-learn,Myasuka/scikit-learn,pratapvardhan/scikit-learn,ilo10/scikit-learn,ZENGXH/scikit-learn,ltiao/scikit-learn,scikit-learn/scikit-learn,CforED/Machine-Learning,cauchycui/scikit-learn,jlegendary/scikit-learn,arahuja/scikit-learn,lin-credible/scikit-learn,r-mart/scikit-learn,anurag313/scikit-learn,altairpearl/scikit-learn,massmutual/scikit-learn,hitszxp/scikit-learn,lesteve/scikit-learn,cainiaocome/scikit-learn,voxlol/scikit-learn,Myasuka/scikit-learn,adamgreenhall/scikit-learn,kaichogami/scikit-learn,trungnt13/scikit-learn,shenzebang/scikit-learn,liyu1990/sklearn,Garrett-R/scikit-learn,hlin117/scikit-learn,UNR-AERIAL/scikit-learn,mikebenfield/scikit-learn,dsullivan7/scikit-learn,fbagirov/scikit-learn,aflaxman/scikit-learn,yunfeilu/scikit-learn,YinongLong/scikit-learn,ZenDevelopmentSystems/scikit-learn,meduz/scikit-learn,ilyes14/scikit-learn,rsivapr/scikit-learn,eickenberg/scikit-learn,schets/scikit-learn,dsullivan7/scikit-learn,joshloyal/scikit-learn,sgenoud/scikit-learn,mojoboss/scikit-learn,MatthieuBizien/scikit-learn,cwu2011/scikit-learn,madjelan/scikit-learn,espg/scikit-learn,rishikksh20/scikit-learn,pnedunuri/scikit-learn,imaculate/scikit-learn,Aasmi/scikit-learn,loli/sklearn-ensembletrees,shyamalschandra/scikit-learn,gotomypc/scikit-learn,espg/scikit-learn,aetilley/scikit-learn,victorbergelin/scikit-learn,mehdidc/scikit-learn,kevin-intel/scikit-learn,tdhopper/scikit-learn,kmike/scikit-learn,jjx02230808/project0223,pypot/scikit-learn,AnasGhrab/scikit-learn,abhishekkrthakur/scikit-learn,mrshu/scikit-learn,mwv/scikit-learn,huzq/scikit-learn,costypetrisor/scikit-learn,icdishb/scikit-learn,JPFrancoia/scikit-learn,Aasmi/scikit-learn,lesteve/scikit-learn,jm-begon/scikit-learn,russel1237/scikit-learn,rajat1994/scikit-learn,andrewnc/scikit-learn,Lawrence-Liu/scikit-learn,vermouthmjl/scikit-learn,glouppe/scikit-learn,jorik041/scikit-learn,zuku1985/scikit-learn,mlyundin/scikit-learn,mattilyra/scikit-learn,treycausey/scikit-learn,justincassidy/scikit-learn,henrykironde/scikit-learn,mhue/scikit-learn,tawsifkhan/scikit-learn,Titan-C/scikit-learn,alvarofierroclavero/scikit-learn,jmetzen/scikit-learn,glouppe/scikit-learn,rsivapr/scikit-learn,roxyboy/scikit-learn,robbymeals/scikit-learn,larsmans/scikit-learn,HolgerPeters/scikit-learn,nvoron23/scikit-learn,yonglehou/scikit-learn,potash/scikit-learn,frank-tancf/scikit-learn,potash/scikit-learn,hugobowne/scikit-learn,jorge2703/scikit-learn,costypetrisor/scikit-learn,Fireblend/scikit-learn,krez13/scikit-learn,pompiduskus/scikit-learn,RPGOne/scikit-learn,rrohan/scikit-learn,devanshdalal/scikit-learn,smartscheduling/scikit-learn-categorical-tree,MechCoder/scikit-learn,jpautom/scikit-learn,h2educ/scikit-learn,aabadie/scikit-learn,AlexandreAbraham/scikit-learn,zorojean/scikit-learn,poryfly/scikit-learn,Fireblend/scikit-learn,ZENGXH/scikit-learn,Adai0808/scikit-learn,Akshay0724/scikit-learn,samzhang111/scikit-learn,rsivapr/scikit-learn,marcocaccin/scikit-learn,xavierwu/scikit-learn,adamgreenhall/scikit-learn,3manuek/scikit-learn,stylianos-kampakis/scikit-learn,ZenDevelopmentSystems/scikit-learn,ominux/scikit-learn,ivannz/scikit-learn,CforED/Machine-Learning,Obus/scikit-learn,tdhopper/scikit-learn,theoryno3/scikit-learn,petosegan/scikit-learn,walterreade/scikit-learn,jblackburne/scikit-learn,petosegan/scikit-learn,khkaminska/scikit-learn,simon-pepin/scikit-learn,siutanwong/scikit-learn,anirudhjayaraman/scikit-learn,appapantula/scikit-learn,sonnyhu/scikit-learn,shahankhatch/scikit-learn,RachitKansal/scikit-learn,kashif/scikit-learn,Srisai85/scikit-learn,murali-munna/scikit-learn,nelson-liu/scikit-learn,akionakamura/scikit-learn,jlegendary/scikit-learn,MartinDelzant/scikit-learn,kmike/scikit-learn,thientu/scikit-learn,ClimbsRocks/scikit-learn,stylianos-kampakis/scikit-learn,heli522/scikit-learn,siutanwong/scikit-learn,cdegroc/scikit-learn,justincassidy/scikit-learn,Sentient07/scikit-learn,dingocuster/scikit-learn,vortex-ape/scikit-learn,cdegroc/scikit-learn,vigilv/scikit-learn,huobaowangxi/scikit-learn,qifeigit/scikit-learn,untom/scikit-learn,anntzer/scikit-learn,quheng/scikit-learn,tosolveit/scikit-learn,0x0all/scikit-learn,yask123/scikit-learn,aflaxman/scikit-learn,YinongLong/scikit-learn,tmhm/scikit-learn,abhishekgahlot/scikit-learn,jjx02230808/project0223,untom/scikit-learn,ephes/scikit-learn,spallavolu/scikit-learn,glennq/scikit-learn,arahuja/scikit-learn,nhejazi/scikit-learn,yyjiang/scikit-learn,jmetzen/scikit-learn,f3r/scikit-learn,loli/sklearn-ensembletrees,MatthieuBizien/scikit-learn,0x0all/scikit-learn,PrashntS/scikit-learn,jorik041/scikit-learn,krez13/scikit-learn,Lawrence-Liu/scikit-learn,henrykironde/scikit-learn,lenovor/scikit-learn,tosolveit/scikit-learn,Obus/scikit-learn,yyjiang/scikit-learn,ldirer/scikit-learn,hlin117/scikit-learn,BiaDarkia/scikit-learn,schets/scikit-learn,btabibian/scikit-learn,loli/sklearn-ensembletrees,fabioticconi/scikit-learn,Adai0808/scikit-learn,Titan-C/scikit-learn,tmhm/scikit-learn,pypot/scikit-learn,IshankGulati/scikit-learn,Jimmy-Morzaria/scikit-learn,vshtanko/scikit-learn,RachitKansal/scikit-learn,hrjn/scikit-learn,lucidfrontier45/scikit-learn,OshynSong/scikit-learn,mattgiguere/scikit-learn,rahuldhote/scikit-learn,pythonvietnam/scikit-learn,ishanic/scikit-learn,zorroblue/scikit-learn,eg-zhang/scikit-learn,xuewei4d/scikit-learn,giorgiop/scikit-learn,mjgrav2001/scikit-learn,sonnyhu/scikit-learn,mjgrav2001/scikit-learn,hsuantien/scikit-learn,cwu2011/scikit-learn,chrsrds/scikit-learn,harshaneelhg/scikit-learn,tosolveit/scikit-learn,ahoyosid/scikit-learn,devanshdalal/scikit-learn,dsquareindia/scikit-learn,xubenben/scikit-learn,ogrisel/scikit-learn,deepesch/scikit-learn,abimannans/scikit-learn,jblackburne/scikit-learn,equialgo/scikit-learn,zhenv5/scikit-learn,waterponey/scikit-learn,ankurankan/scikit-learn,shangwuhencc/scikit-learn,kaichogami/scikit-learn,billy-inn/scikit-learn,vinayak-mehta/scikit-learn,untom/scikit-learn,Achuth17/scikit-learn,rajat1994/scikit-learn,pnedunuri/scikit-learn,dsullivan7/scikit-learn,yunfeilu/scikit-learn,bnaul/scikit-learn,mugizico/scikit-learn,xzh86/scikit-learn,robbymeals/scikit-learn,depet/scikit-learn,mfjb/scikit-learn,Garrett-R/scikit-learn,eickenberg/scikit-learn,samuel1208/scikit-learn,rahul-c1/scikit-learn,JosmanPS/scikit-learn,q1ang/scikit-learn,BiaDarkia/scikit-learn,TomDLT/scikit-learn,iismd17/scikit-learn,ngoix/OCRF,mfjb/scikit-learn,sumspr/scikit-learn,sarahgrogan/scikit-learn,saiwing-yeung/scikit-learn,MohammedWasim/scikit-learn,treycausey/scikit-learn,treycausey/scikit-learn,jorge2703/scikit-learn,ngoix/OCRF,ycaihua/scikit-learn,djgagne/scikit-learn,clemkoa/scikit-learn,zhenv5/scikit-learn,xavierwu/scikit-learn,rohanp/scikit-learn,hsuantien/scikit-learn,pv/scikit-learn,yanlend/scikit-learn,bhargav/scikit-learn,nrhine1/scikit-learn,beepee14/scikit-learn,dhruv13J/scikit-learn,adamgreenhall/scikit-learn,bikong2/scikit-learn,MohammedWasim/scikit-learn,wanggang3333/scikit-learn,maheshakya/scikit-learn,anurag313/scikit-learn,theoryno3/scikit-learn,mhue/scikit-learn,AlexRobson/scikit-learn,treycausey/scikit-learn,davidgbe/scikit-learn,manhhomienbienthuy/scikit-learn,terkkila/scikit-learn,kevin-intel/scikit-learn,IshankGulati/scikit-learn,gclenaghan/scikit-learn,hrjn/scikit-learn,kagayakidan/scikit-learn,jaidevd/scikit-learn,q1ang/scikit-learn,LiaoPan/scikit-learn,shusenl/scikit-learn,AlexanderFabisch/scikit-learn,rishikksh20/scikit-learn,etkirsch/scikit-learn,murali-munna/scikit-learn,PatrickOReilly/scikit-learn,OshynSong/scikit-learn,liberatorqjw/scikit-learn,xwolf12/scikit-learn,TomDLT/scikit-learn,bhargav/scikit-learn,yyjiang/scikit-learn,jayflo/scikit-learn,liberatorqjw/scikit-learn,nesterione/scikit-learn,jseabold/scikit-learn,Srisai85/scikit-learn,mojoboss/scikit-learn,ngoix/OCRF,sinhrks/scikit-learn,Djabbz/scikit-learn,zihua/scikit-learn,bthirion/scikit-learn,billy-inn/scikit-learn,aabadie/scikit-learn,shenzebang/scikit-learn,ashhher3/scikit-learn,LiaoPan/scikit-learn,PatrickChrist/scikit-learn,RayMick/scikit-learn,massmutual/scikit-learn,vibhorag/scikit-learn,ilyes14/scikit-learn,wzbozon/scikit-learn,aabadie/scikit-learn,bikong2/scikit-learn,hugobowne/scikit-learn,mfjb/scikit-learn,fredhusser/scikit-learn,andaag/scikit-learn,AnasGhrab/scikit-learn,trungnt13/scikit-learn,YinongLong/scikit-learn,belltailjp/scikit-learn,glennq/scikit-learn,samuel1208/scikit-learn,vybstat/scikit-learn,pianomania/scikit-learn,roxyboy/scikit-learn,ankurankan/scikit-learn,r-mart/scikit-learn,larsmans/scikit-learn,AlexRobson/scikit-learn,JsNoNo/scikit-learn,ningchi/scikit-learn,hsiaoyi0504/scikit-learn,hsuantien/scikit-learn,betatim/scikit-learn,zuku1985/scikit-learn,roxyboy/scikit-learn,eickenberg/scikit-learn,ogrisel/scikit-learn,elkingtonmcb/scikit-learn,themrmax/scikit-learn,ycaihua/scikit-learn,ominux/scikit-learn,alexsavio/scikit-learn,abhishekkrthakur/scikit-learn,marcocaccin/scikit-learn,abhishekkrthakur/scikit-learn,hitszxp/scikit-learn,ky822/scikit-learn,anntzer/scikit-learn,equialgo/scikit-learn,ogrisel/scikit-learn,Srisai85/scikit-learn,arjoly/scikit-learn,jm-begon/scikit-learn,loli/semisupervisedforests,f3r/scikit-learn,liberatorqjw/scikit-learn,spallavolu/scikit-learn,fabianp/scikit-learn,f3r/scikit-learn,abimannans/scikit-learn,saiwing-yeung/scikit-learn,vermouthmjl/scikit-learn,chrsrds/scikit-learn,shikhardb/scikit-learn,MartinDelzant/scikit-learn,tomlof/scikit-learn,vermouthmjl/scikit-learn,scikit-learn/scikit-learn,depet/scikit-learn,Vimos/scikit-learn,ivannz/scikit-learn,maheshakya/scikit-learn,ephes/scikit-learn,kagayakidan/scikit-learn,smartscheduling/scikit-learn-categorical-tree,xubenben/scikit-learn,ivannz/scikit-learn,mayblue9/scikit-learn,pompiduskus/scikit-learn,fzalkow/scikit-learn,cwu2011/scikit-learn,CVML/scikit-learn,plissonf/scikit-learn,eickenberg/scikit-learn,arabenjamin/scikit-learn,procoder317/scikit-learn,jm-begon/scikit-learn,pv/scikit-learn,andaag/scikit-learn,appapantula/scikit-learn,mjudsp/Tsallis,mehdidc/scikit-learn,macks22/scikit-learn,yanlend/scikit-learn,michigraber/scikit-learn,potash/scikit-learn,robbymeals/scikit-learn,AlexandreAbraham/scikit-learn,fbagirov/scikit-learn,pv/scikit-learn,RomainBrault/scikit-learn,zorroblue/scikit-learn,beepee14/scikit-learn,frank-tancf/scikit-learn,anirudhjayaraman/scikit-learn,CVML/scikit-learn,ivannz/scikit-learn,kylerbrown/scikit-learn,wazeerzulfikar/scikit-learn,DSLituiev/scikit-learn,deepesch/scikit-learn,elkingtonmcb/scikit-learn,Titan-C/scikit-learn,ephes/scikit-learn,Garrett-R/scikit-learn,nhejazi/scikit-learn,jlegendary/scikit-learn,belltailjp/scikit-learn,yunfeilu/scikit-learn,aflaxman/scikit-learn,themrmax/scikit-learn,carrillo/scikit-learn,vibhorag/scikit-learn,fabianp/scikit-learn,maheshakya/scikit-learn,ClimbsRocks/scikit-learn,ashhher3/scikit-learn,evgchz/scikit-learn,kagayakidan/scikit-learn,glennq/scikit-learn,ChanderG/scikit-learn,simon-pepin/scikit-learn,Vimos/scikit-learn,ndingwall/scikit-learn,manashmndl/scikit-learn,raghavrv/scikit-learn,ngoix/OCRF,fbagirov/scikit-learn,IssamLaradji/scikit-learn,florian-f/sklearn,BiaDarkia/scikit-learn,Myasuka/scikit-learn,vybstat/scikit-learn,sonnyhu/scikit-learn,betatim/scikit-learn,yonglehou/scikit-learn,ilyes14/scikit-learn,manashmndl/scikit-learn,evgchz/scikit-learn,zaxtax/scikit-learn,gotomypc/scikit-learn,mhue/scikit-learn,xuewei4d/scikit-learn,thientu/scikit-learn,Akshay0724/scikit-learn,imaculate/scikit-learn,ZenDevelopmentSystems/scikit-learn,madjelan/scikit-learn,ycaihua/scikit-learn,tomlof/scikit-learn,abhishekgahlot/scikit-learn,tomlof/scikit-learn,pkruskal/scikit-learn,trankmichael/scikit-learn,quheng/scikit-learn,fabioticconi/scikit-learn,sumspr/scikit-learn,evgchz/scikit-learn,pianomania/scikit-learn,Sentient07/scikit-learn,OshynSong/scikit-learn,espg/scikit-learn,bhargav/scikit-learn,kashif/scikit-learn,ndingwall/scikit-learn,florian-f/sklearn,alexeyum/scikit-learn,jakobworldpeace/scikit-learn,davidgbe/scikit-learn,abhishekkrthakur/scikit-learn,akionakamura/scikit-learn,MechCoder/scikit-learn,voxlol/scikit-learn,JeanKossaifi/scikit-learn,jereze/scikit-learn,davidgbe/scikit-learn,shangwuhencc/scikit-learn,schets/scikit-learn,xavierwu/scikit-learn,hdmetor/scikit-learn,kjung/scikit-learn,jaidevd/scikit-learn,carrillo/scikit-learn,elkingtonmcb/scikit-learn,hdmetor/scikit-learn,dsquareindia/scikit-learn,CforED/Machine-Learning,fabioticconi/scikit-learn,zorojean/scikit-learn,idlead/scikit-learn,siutanwong/scikit-learn,murali-munna/scikit-learn,chrisburr/scikit-learn,manhhomienbienthuy/scikit-learn,AlexRobson/scikit-learn,JPFrancoia/scikit-learn,loli/sklearn-ensembletrees,anurag313/scikit-learn,alexsavio/scikit-learn,mattilyra/scikit-learn,chrsrds/scikit-learn,MatthieuBizien/scikit-learn,henrykironde/scikit-learn,glemaitre/scikit-learn,Windy-Ground/scikit-learn,rexshihaoren/scikit-learn,liangz0707/scikit-learn,wanggang3333/scikit-learn,herilalaina/scikit-learn,B3AU/waveTree,pypot/scikit-learn,Akshay0724/scikit-learn,mwv/scikit-learn,ahoyosid/scikit-learn,xiaoxiamii/scikit-learn,wzbozon/scikit-learn,tmhm/scikit-learn,espg/scikit-learn,aewhatley/scikit-learn,russel1237/scikit-learn,dhruv13J/scikit-learn,mojoboss/scikit-learn,jmetzen/scikit-learn,mwv/scikit-learn,pompiduskus/scikit-learn,saiwing-yeung/scikit-learn,mjudsp/Tsallis,cwu2011/scikit-learn,IndraVikas/scikit-learn,kevin-intel/scikit-learn,RomainBrault/scikit-learn,mhdella/scikit-learn,jzt5132/scikit-learn,nmayorov/scikit-learn,jseabold/scikit-learn,mehdidc/scikit-learn,jmschrei/scikit-learn,Clyde-fare/scikit-learn,nikitasingh981/scikit-learn,DSLituiev/scikit-learn,Aasmi/scikit-learn,depet/scikit-learn,zihua/scikit-learn,aetilley/scikit-learn,nmayorov/scikit-learn,IshankGulati/scikit-learn,liyu1990/sklearn,JeanKossaifi/scikit-learn,ElDeveloper/scikit-learn,mehdidc/scikit-learn,sanketloke/scikit-learn,fzalkow/scikit-learn,thilbern/scikit-learn,nesterione/scikit-learn,kagayakidan/scikit-learn,zaxtax/scikit-learn,ahoyosid/scikit-learn,jereze/scikit-learn,rahul-c1/scikit-learn,pythonvietnam/scikit-learn,mhdella/scikit-learn,dsquareindia/scikit-learn,thilbern/scikit-learn,potash/scikit-learn,aminert/scikit-learn,aflaxman/scikit-learn,Myasuka/scikit-learn,ningchi/scikit-learn,kevin-intel/scikit-learn,IssamLaradji/scikit-learn,r-mart/scikit-learn,scikit-learn/scikit-learn,anntzer/scikit-learn,mattgiguere/scikit-learn,mlyundin/scikit-learn,Clyde-fare/scikit-learn,hsiaoyi0504/scikit-learn,walterreade/scikit-learn,manashmndl/scikit-learn,jkarnows/scikit-learn,AlexanderFabisch/scikit-learn,PatrickOReilly/scikit-learn,nikitasingh981/scikit-learn,Windy-Ground/scikit-learn,nrhine1/scikit-learn,arabenjamin/scikit-learn,RPGOne/scikit-learn,dsquareindia/scikit-learn,arjoly/scikit-learn,sergeyf/scikit-learn,zuku1985/scikit-learn,mugizico/scikit-learn,RayMick/scikit-learn,nelson-liu/scikit-learn,michigraber/scikit-learn,mayblue9/scikit-learn,khkaminska/scikit-learn,cl4rke/scikit-learn,clemkoa/scikit-learn,LohithBlaze/scikit-learn,hlin117/scikit-learn,yanlend/scikit-learn,alexeyum/scikit-learn,loli/sklearn-ensembletrees,loli/semisupervisedforests,akionakamura/scikit-learn,madjelan/scikit-learn,djgagne/scikit-learn,jorik041/scikit-learn,imaculate/scikit-learn,PatrickChrist/scikit-learn,AIML/scikit-learn,bnaul/scikit-learn,hitszxp/scikit-learn,theoryno3/scikit-learn,ishanic/scikit-learn,CforED/Machine-Learning,terkkila/scikit-learn,gclenaghan/scikit-learn,HolgerPeters/scikit-learn,billy-inn/scikit-learn,JosmanPS/scikit-learn,jakobworldpeace/scikit-learn,toastedcornflakes/scikit-learn,MohammedWasim/scikit-learn,nesterione/scikit-learn,nrhine1/scikit-learn,ankurankan/scikit-learn,plissonf/scikit-learn,pkruskal/scikit-learn,NunoEdgarGub1/scikit-learn,466152112/scikit-learn,andrewnc/scikit-learn,NelisVerhoef/scikit-learn,xyguo/scikit-learn,ashhher3/scikit-learn,stylianos-kampakis/scikit-learn,0asa/scikit-learn,chrsrds/scikit-learn,tomlof/scikit-learn,xubenben/scikit-learn,nhejazi/scikit-learn,MartinSavc/scikit-learn,ankurankan/scikit-learn,idlead/scikit-learn,vigilv/scikit-learn,mblondel/scikit-learn,walterreade/scikit-learn,rvraghav93/scikit-learn,cybernet14/scikit-learn,loli/semisupervisedforests,Lawrence-Liu/scikit-learn,ilo10/scikit-learn,jblackburne/scikit-learn,JsNoNo/scikit-learn,Vimos/scikit-learn,jmschrei/scikit-learn,LiaoPan/scikit-learn,poryfly/scikit-learn,olologin/scikit-learn,amueller/scikit-learn,shikhardb/scikit-learn,xavierwu/scikit-learn,trungnt13/scikit-learn,fredhusser/scikit-learn,mxjl620/scikit-learn,hainm/scikit-learn,q1ang/scikit-learn,Titan-C/scikit-learn,vinayak-mehta/scikit-learn,pratapvardhan/scikit-learn,florian-f/sklearn,mattgiguere/scikit-learn,shangwuhencc/scikit-learn,phdowling/scikit-learn,manashmndl/scikit-learn,costypetrisor/scikit-learn,mjudsp/Tsallis,joernhees/scikit-learn,alexeyum/scikit-learn,hainm/scikit-learn,dingocuster/scikit-learn,phdowling/scikit-learn,raghavrv/scikit-learn,waterponey/scikit-learn,vigilv/scikit-learn,lin-credible/scikit-learn,xyguo/scikit-learn,dingocuster/scikit-learn,xyguo/scikit-learn,mlyundin/scikit-learn,BiaDarkia/scikit-learn,hitszxp/scikit-learn,YinongLong/scikit-learn,aminert/scikit-learn,pythonvietnam/scikit-learn,trankmichael/scikit-learn,anirudhjayaraman/scikit-learn,RPGOne/scikit-learn,JsNoNo/scikit-learn,vivekmishra1991/scikit-learn,madjelan/scikit-learn,wlamond/scikit-learn,MechCoder/scikit-learn,iismd17/scikit-learn,sgenoud/scikit-learn,akionakamura/scikit-learn,Jimmy-Morzaria/scikit-learn,thilbern/scikit-learn,jereze/scikit-learn,mattilyra/scikit-learn,Obus/scikit-learn,sinhrks/scikit-learn,CVML/scikit-learn,samzhang111/scikit-learn,shenzebang/scikit-learn,zihua/scikit-learn,vivekmishra1991/scikit-learn,mikebenfield/scikit-learn,RayMick/scikit-learn,depet/scikit-learn,evgchz/scikit-learn,kylerbrown/scikit-learn,sanketloke/scikit-learn,andrewnc/scikit-learn,xuewei4d/scikit-learn,trungnt13/scikit-learn,ominux/scikit-learn,rishikksh20/scikit-learn,terkkila/scikit-learn,marcocaccin/scikit-learn,aewhatley/scikit-learn,sinhrks/scikit-learn,Nyker510/scikit-learn,lbishal/scikit-learn,AlexanderFabisch/scikit-learn,cauchycui/scikit-learn,belltailjp/scikit-learn,lbishal/scikit-learn,NelisVerhoef/scikit-learn,h2educ/scikit-learn,terkkila/scikit-learn,pnedunuri/scikit-learn,florian-f/sklearn,PatrickChrist/scikit-learn,gclenaghan/scikit-learn,PrashntS/scikit-learn,mattilyra/scikit-learn,devanshdalal/scikit-learn,Nyker510/scikit-learn,anirudhjayaraman/scikit-learn,kjung/scikit-learn,HolgerPeters/scikit-learn,meduz/scikit-learn,costypetrisor/scikit-learn,pompiduskus/scikit-learn,ssaeger/scikit-learn,Garrett-R/scikit-learn,rexshihaoren/scikit-learn,chrisburr/scikit-learn,f3r/scikit-learn,raghavrv/scikit-learn,xwolf12/scikit-learn,Achuth17/scikit-learn,toastedcornflakes/scikit-learn,ClimbsRocks/scikit-learn,themrmax/scikit-learn,jmetzen/scikit-learn,anntzer/scikit-learn,nvoron23/scikit-learn,0asa/scikit-learn,MatthieuBizien/scikit-learn,carrillo/scikit-learn,marcocaccin/scikit-learn,mrshu/scikit-learn,jseabold/scikit-learn,joshloyal/scikit-learn,Achuth17/scikit-learn,macks22/scikit-learn,ishanic/scikit-learn,rahuldhote/scikit-learn,AlexRobson/scikit-learn,moutai/scikit-learn,arahuja/scikit-learn,vortex-ape/scikit-learn,andrewnc/scikit-learn,robbymeals/scikit-learn,mjudsp/Tsallis,q1ang/scikit-learn,0x0all/scikit-learn,mayblue9/scikit-learn,macks22/scikit-learn,shahankhatch/scikit-learn,dhruv13J/scikit-learn,khkaminska/scikit-learn,idlead/scikit-learn,mhue/scikit-learn,toastedcornflakes/scikit-learn,appapantula/scikit-learn,nelson-liu/scikit-learn,cybernet14/scikit-learn,xiaoxiamii/scikit-learn,giorgiop/scikit-learn,victorbergelin/scikit-learn,B3AU/waveTree,heli522/scikit-learn,mattgiguere/scikit-learn,jorge2703/scikit-learn,cl4rke/scikit-learn,mayblue9/scikit-learn,cl4rke/scikit-learn,petosegan/scikit-learn,rvraghav93/scikit-learn,vshtanko/scikit-learn,Fireblend/scikit-learn,NunoEdgarGub1/scikit-learn,Adai0808/scikit-learn,abhishekgahlot/scikit-learn,aetilley/scikit-learn,ZenDevelopmentSystems/scikit-learn,rrohan/scikit-learn,shahankhatch/scikit-learn,mugizico/scikit-learn,jzt5132/scikit-learn,cainiaocome/scikit-learn,sanketloke/scikit-learn,JosmanPS/scikit-learn,ahoyosid/scikit-learn,nomadcube/scikit-learn,TomDLT/scikit-learn,sergeyf/scikit-learn,frank-tancf/scikit-learn,RachitKansal/scikit-learn,ldirer/scikit-learn,jjx02230808/project0223,Barmaley-exe/scikit-learn,joernhees/scikit-learn,thientu/scikit-learn,cainiaocome/scikit-learn,wanggang3333/scikit-learn,ssaeger/scikit-learn,quheng/scikit-learn,466152112/scikit-learn,rsivapr/scikit-learn,quheng/scikit-learn,tawsifkhan/scikit-learn,aabadie/scikit-learn,jakirkham/scikit-learn,xubenben/scikit-learn,jm-begon/scikit-learn,jaidevd/scikit-learn,iismd17/scikit-learn,sarahgrogan/scikit-learn,Barmaley-exe/scikit-learn,lbishal/scikit-learn,466152112/scikit-learn,chrisburr/scikit-learn,fengzhyuan/scikit-learn,moutai/scikit-learn,alvarofierroclavero/scikit-learn,raghavrv/scikit-learn,shangwuhencc/scikit-learn,ilyes14/scikit-learn,0asa/scikit-learn,hlin117/scikit-learn,Jimmy-Morzaria/scikit-learn,qifeigit/scikit-learn,altairpearl/scikit-learn,heli522/scikit-learn,olologin/scikit-learn,mikebenfield/scikit-learn,yask123/scikit-learn,cainiaocome/scikit-learn,zorroblue/scikit-learn,luo66/scikit-learn,mrshu/scikit-learn,B3AU/waveTree,bnaul/scikit-learn,vshtanko/scikit-learn,andaag/scikit-learn,olologin/scikit-learn,Nyker510/scikit-learn,abimannans/scikit-learn,zuku1985/scikit-learn,macks22/scikit-learn,UNR-AERIAL/scikit-learn,robin-lai/scikit-learn,bigdataelephants/scikit-learn,phdowling/scikit-learn,jorik041/scikit-learn,plissonf/scikit-learn,qifeigit/scikit-learn,giorgiop/scikit-learn,lenovor/scikit-learn,jaidevd/scikit-learn,vybstat/scikit-learn,JPFrancoia/scikit-learn,AnasGhrab/scikit-learn,kmike/scikit-learn,gotomypc/scikit-learn,luo66/scikit-learn,yanlend/scikit-learn,Aasmi/scikit-learn,vibhorag/scikit-learn,yonglehou/scikit-learn,zhenv5/scikit-learn,clemkoa/scikit-learn,hrjn/scikit-learn,jlegendary/scikit-learn,fyffyt/scikit-learn,appapantula/scikit-learn,devanshdalal/scikit-learn,LohithBlaze/scikit-learn,sarahgrogan/scikit-learn,bigdataelephants/scikit-learn,henridwyer/scikit-learn,lenovor/scikit-learn,pianomania/scikit-learn,ky822/scikit-learn,shyamalschandra/scikit-learn,mwv/scikit-learn,henridwyer/scikit-learn,fbagirov/scikit-learn,loli/semisupervisedforests,cl4rke/scikit-learn,pv/scikit-learn,wazeerzulfikar/scikit-learn,lucidfrontier45/scikit-learn,fengzhyuan/scikit-learn,mfjb/scikit-learn,Sentient07/scikit-learn,jpautom/scikit-learn,shusenl/scikit-learn,gclenaghan/scikit-learn,ycaihua/scikit-learn,jkarnows/scikit-learn,tdhopper/scikit-learn,hrjn/scikit-learn,joernhees/scikit-learn,huobaowangxi/scikit-learn,MartinSavc/scikit-learn,shikhardb/scikit-learn,shyamalschandra/scikit-learn,frank-tancf/scikit-learn,vigilv/scikit-learn,sumspr/scikit-learn,B3AU/waveTree,robin-lai/scikit-learn,glouppe/scikit-learn,ningchi/scikit-learn,cauchycui/scikit-learn,wazeerzulfikar/scikit-learn,Windy-Ground/scikit-learn,nesterione/scikit-learn,zorroblue/scikit-learn,vshtanko/scikit-learn,massmutual/scikit-learn,herilalaina/scikit-learn,kylerbrown/scikit-learn,saiwing-yeung/scikit-learn,fyffyt/scikit-learn,alvarofierroclavero/scikit-learn,vinayak-mehta/scikit-learn,hsiaoyi0504/scikit-learn,shikhardb/scikit-learn,jpautom/scikit-learn,olologin/scikit-learn,kaichogami/scikit-learn,LiaoPan/scikit-learn,lucidfrontier45/scikit-learn,lazywei/scikit-learn,kjung/scikit-learn,nvoron23/scikit-learn,mxjl620/scikit-learn,pythonvietnam/scikit-learn,nrhine1/scikit-learn,arabenjamin/scikit-learn,toastedcornflakes/scikit-learn,rohanp/scikit-learn,ominux/scikit-learn,murali-munna/scikit-learn,wlamond/scikit-learn,xuewei4d/scikit-learn,MartinDelzant/scikit-learn,lenovor/scikit-learn,poryfly/scikit-learn,lucidfrontier45/scikit-learn,aetilley/scikit-learn,jpautom/scikit-learn,amueller/scikit-learn,NunoEdgarGub1/scikit-learn,arjoly/scikit-learn,kaichogami/scikit-learn,HolgerPeters/scikit-learn,ldirer/scikit-learn,DSLituiev/scikit-learn,glemaitre/scikit-learn,nmayorov/scikit-learn,AlexandreAbraham/scikit-learn,cauchycui/scikit-learn,wlamond/scikit-learn,alvarofierroclavero/scikit-learn,dhruv13J/scikit-learn,mrshu/scikit-learn,Nyker510/scikit-learn,hainm/scikit-learn,fyffyt/scikit-learn,ltiao/scikit-learn,ElDeveloper/scikit-learn,nikitasingh981/scikit-learn,vortex-ape/scikit-learn,russel1237/scikit-learn,fengzhyuan/scikit-learn,mhdella/scikit-learn,vinayak-mehta/scikit-learn,ngoix/OCRF,ChanderG/scikit-learn,anurag313/scikit-learn,xzh86/scikit-learn,mugizico/scikit-learn,waterponey/scikit-learn,giorgiop/scikit-learn,xzh86/scikit-learn,ephes/scikit-learn,Clyde-fare/scikit-learn,UNR-AERIAL/scikit-learn,mjgrav2001/scikit-learn,jereze/scikit-learn,vortex-ape/scikit-learn,Djabbz/scikit-learn,jkarnows/scikit-learn,robin-lai/scikit-learn,manhhomienbienthuy/scikit-learn,glennq/scikit-learn,vivekmishra1991/scikit-learn,yask123/scikit-learn,TomDLT/scikit-learn,CVML/scikit-learn,lazywei/scikit-learn,shyamalschandra/scikit-learn,Barmaley-exe/scikit-learn,lin-credible/scikit-learn,jorge2703/scikit-learn,robin-lai/scikit-learn,xiaoxiamii/scikit-learn,eg-zhang/scikit-learn,bthirion/scikit-learn,DonBeo/scikit-learn,meduz/scikit-learn,bhargav/scikit-learn,treycausey/scikit-learn,plissonf/scikit-learn,theoryno3/scikit-learn,herilalaina/scikit-learn,wzbozon/scikit-learn,AIML/scikit-learn,mrshu/scikit-learn,massmutual/scikit-learn,elkingtonmcb/scikit-learn,hainm/scikit-learn,eickenberg/scikit-learn,hdmetor/scikit-learn,samzhang111/scikit-learn,mxjl620/scikit-learn,roxyboy/scikit-learn,IssamLaradji/scikit-learn,nhejazi/scikit-learn,eg-zhang/scikit-learn,jayflo/scikit-learn,bigdataelephants/scikit-learn,poryfly/scikit-learn,LohithBlaze/scikit-learn,ltiao/scikit-learn,fengzhyuan/scikit-learn,ElDeveloper/scikit-learn,mlyundin/scikit-learn,JsNoNo/scikit-learn,trankmichael/scikit-learn,aminert/scikit-learn,themrmax/scikit-learn,B3AU/waveTree,DonBeo/scikit-learn,deepesch/scikit-learn,justincassidy/scikit-learn,0x0all/scikit-learn,sumspr/scikit-learn,ogrisel/scikit-learn,liangz0707/scikit-learn,sergeyf/scikit-learn,voxlol/scikit-learn,glemaitre/scikit-learn,yyjiang/scikit-learn,h2educ/scikit-learn,simon-pepin/scikit-learn,ningchi/scikit-learn,amueller/scikit-learn,krez13/scikit-learn,dingocuster/scikit-learn,vermouthmjl/scikit-learn,Adai0808/scikit-learn,nvoron23/scikit-learn,aewhatley/scikit-learn,rrohan/scikit-learn,glemaitre/scikit-learn,pratapvardhan/scikit-learn,rahul-c1/scikit-learn,wzbozon/scikit-learn,cybernet14/scikit-learn,fredhusser/scikit-learn,ltiao/scikit-learn,glouppe/scikit-learn,jayflo/scikit-learn,PatrickOReilly/scikit-learn,rvraghav93/scikit-learn,NunoEdgarGub1/scikit-learn,jzt5132/scikit-learn,pnedunuri/scikit-learn,chrisburr/scikit-learn,ChanChiChoi/scikit-learn,wlamond/scikit-learn,icdishb/scikit-learn,davidgbe/scikit-learn,jakobworldpeace/scikit-learn,cybernet14/scikit-learn,cdegroc/scikit-learn,gotomypc/scikit-learn,NelisVerhoef/scikit-learn,liberatorqjw/scikit-learn,xwolf12/scikit-learn,henrykironde/scikit-learn,arjoly/scikit-learn,rahuldhote/scikit-learn,ChanChiChoi/scikit-learn,h2educ/scikit-learn,btabibian/scikit-learn,etkirsch/scikit-learn,pianomania/scikit-learn,fzalkow/scikit-learn,phdowling/scikit-learn,alexsavio/scikit-learn,harshaneelhg/scikit-learn,kashif/scikit-learn,voxlol/scikit-learn,huzq/scikit-learn,zorojean/scikit-learn,PrashntS/scikit-learn,smartscheduling/scikit-learn-categorical-tree,pypot/scikit-learn,abhishekgahlot/scikit-learn,joshloyal/scikit-learn,sonnyhu/scikit-learn,ky822/scikit-learn,rrohan/scikit-learn,justincassidy/scikit-learn,PrashntS/scikit-learn,amueller/scikit-learn,bikong2/scikit-learn,3manuek/scikit-learn,ndingwall/scikit-learn,xwolf12/scikit-learn,zorojean/scikit-learn,rajat1994/scikit-learn,michigraber/scikit-learn,manhhomienbienthuy/scikit-learn,simon-pepin/scikit-learn,RayMick/scikit-learn,bikong2/scikit-learn,yonglehou/scikit-learn,mojoboss/scikit-learn,fzalkow/scikit-learn,russel1237/scikit-learn,heli522/scikit-learn,etkirsch/scikit-learn,herilalaina/scikit-learn | examples/glm/plot_lasso_coordinate_descent_path.py | examples/glm/plot_lasso_coordinate_descent_path.py | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
"""
print __doc__
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
from itertools import cycle
import numpy as np
import pylab as pl
from scikits.learn.glm import lasso_path, enet_path
from scikits.learn import datasets
diabetes = datasets.load_diabetes()
X = diabetes.data
y = diabetes.target
X /= X.std(0) # Standardize data (easier to set the rho parameter)
################################################################################
# Compute paths
eps = 5e-3 # the smaller it is the longer is the path
print "Computing regularization path using the lasso..."
models = lasso_path(X, y, eps=eps)
alphas_lasso = np.array([model.alpha for model in models])
coefs_lasso = np.array([model.coef_ for model in models])
print "Computing regularization path using the elastic net..."
models = enet_path(X, y, eps=eps, rho=0.8)
alphas_enet = np.array([model.alpha for model in models])
coefs_enet = np.array([model.coef_ for model in models])
################################################################################
# Display results
ax = pl.gca()
ax.set_color_cycle(2 * ['b', 'r', 'g', 'c', 'k'])
l1 = pl.plot(coefs_lasso)
l2 = pl.plot(coefs_enet, linestyle='--')
pl.xlabel('-Log(lambda)')
pl.ylabel('weights')
pl.title('Lasso and Elastic-Net Paths')
pl.legend((l1[-1], l2[-1]), ('Lasso', 'Elastic-Net'), loc='lower left')
pl.axis('tight')
pl.show()
| """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
"""
print __doc__
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
from itertools import cycle
import numpy as np
import pylab as pl
from scikits.learn.glm import lasso_path, enet_path
from scikits.learn import datasets
diabetes = datasets.load_diabetes()
X = diabetes.data
y = diabetes.target
X /= X.std(0) # Standardize data (easier to set the rho parameter)
################################################################################
# Compute paths
eps = 5e-3 # the smaller it is the longer is the path
print "Computing regularization path using the lasso..."
models = lasso_path(X, y, eps=eps)
alphas_lasso = np.array([model.alpha for model in models])
coefs_lasso = np.array([model.coef_ for model in models])
print "Computing regularization path using the elastic net..."
models = enet_path(X, y, eps=eps, rho=0.8)
alphas_enet = np.array([model.alpha for model in models])
coefs_enet = np.array([model.coef_ for model in models])
################################################################################
# Display results
color_iter = cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k'])
for color, coef_lasso, coef_enet in zip(color_iter,
coefs_lasso.T, coefs_enet.T):
pl.plot(-np.log10(alphas_lasso), coef_lasso, color)
pl.plot(-np.log10(alphas_enet), coef_enet, color + '--')
pl.xlabel('-Log(lambda)')
pl.ylabel('weights')
pl.title('Lasso and Elastic-Net Paths')
pl.legend(['Lasso','Elastic-Net'])
pl.axis('tight')
pl.show()
| bsd-3-clause | Python |
c12305c59f9c95149e95094179768ac627d7faf9 | Add test file for upload client class | yunify/qingstor-sdk-python | tests/client/test_upload_client.py | tests/client/test_upload_client.py | import os
import mock
import unittest
from qingstor.sdk.config import Config
from qingstor.sdk.service.qingstor import Bucket
from qingstor.sdk.service.qingstor import QingStor
from qingstor.sdk.client.upload_client import UploadClient
from qingstor.sdk.error import (
BadRequestError,
InvalidObjectNameError
)
TEST_PART_SIZE=5242880
TEST_FILE_PATH='test_file_100M'
TEST_OBJECT_KEY='test_upload_20170804'
TEST_ACCESS_KEY='This_is_mock_access_key'
TEST_SECRET_ACCESS_KEY='This_is_mock_secret_access_key'
class MockBucket:
def __init__(self,status_code):
self.status_code = status_code
# Mock the upload_id
def __getitem__(self, key):
return 000000000000
class CallbackFunc:
def __init__(self):
pass
def callback_func(self):
pass
class TestUploadClient(unittest.TestCase):
@classmethod
def setUpClass(cls):
output200=MockBucket(200)
cls.mock_http200=mock.Mock(return_value=output200)
output201=MockBucket(201)
cls.mock_http201=mock.Mock(return_value=output201)
output400=MockBucket(400)
cls.mock_http400=mock.Mock(return_value=output400)
config=Config(TEST_ACCESS_KEY,TEST_SECRET_ACCESS_KEY)
# QingStor.Bucket=mock_qingstor
qingstor=QingStor(config)
# Create bucket instance
callback_func=CallbackFunc()
bucket=qingstor.Bucket('test_upload_bucket','pek3a')
cls.upload_obj = UploadClient(bucket, callback_func.callback_func, TEST_PART_SIZE)
def setUp(self):
os.system("dd if=/dev/zero of=test_file_100M bs=1024 count=102400")
def tearDown(self):
os.system("rm -f test_file_100M")
def test_right_response(self):
# Mock the output of initiate_multipart_upload
Bucket.initiate_multipart_upload=self.mock_http200
# Mock the output of upload_multipart
Bucket.upload_multipart=self.mock_http201
Bucket.complete_multipart_upload=self.mock_http201
with open(TEST_FILE_PATH, 'rb') as f:
self.upload_obj.upload('upload_20180803.mp4', f)
def test_initialize_bad_response(self):
# Mock the output of initiate_multipart_upload
Bucket.initiate_multipart_upload=self.mock_http400
with open(TEST_FILE_PATH, 'rb') as f:
self.assertRaises(InvalidObjectNameError,self.upload_obj.upload,TEST_OBJECT_KEY,f)
def test_upload_bad_response(self):
# Mock the output of initiate_multipart_upload
Bucket.initiate_multipart_upload=self.mock_http200
# Mock the output of upload_multipart
Bucket.upload_multipart=self.mock_http400
with open(TEST_FILE_PATH, 'rb') as f:
self.assertRaises(BadRequestError,self.upload_obj.upload,TEST_OBJECT_KEY,f)
if __name__=="__main__":
unittest.main()
| apache-2.0 | Python |
|
305ab2ede27fde9097c7a69804189a529c868140 | add missing filter plugins | nicolai86/ansible-phantomjs | filter_plugins/customs.py | filter_plugins/customs.py | class FilterModule(object):
def filters(self):
return {
'filename_without_extension': self.filename_without_extension
}
def filename_without_extension(self, path, extension):
return path[:-len(extension)] | mit | Python |
|
9296c11a013fc03c7f299707a12b74a4ef85abf7 | update cStringIO counter | maliubiao/python_gdb_scripts,maliubiao/python_gdb_scripts | gdb_StringIO.py | gdb_StringIO.py | import gdb
"""
SPECS
/* Entries related to the type of user set breakpoints. */
static struct pybp_code pybp_codes[] =
{
{ "BP_NONE", bp_none},
{ "BP_BREAKPOINT", bp_breakpoint},
{ "BP_WATCHPOINT", bp_watchpoint},
{ "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint},
{ "BP_READ_WATCHPOINT", bp_read_watchpoint},
{ "BP_ACCESS_WATCHPOINT", bp_access_watchpoint},
{NULL} /* Sentinel. */
};
gdb.BreakPoint.__init__
static char *keywords[] = { "spec", "type", "wp_class", "internal", NULL };
if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiO", keywords,
&spec, &type, &access_type, &internal))
"""
O_s = {}
gdb_eval = gdb.parse_and_eval
gdb_O_object_type = gdb.lookup_type("Oobject")
def StringO_New_BP(gdb.BreakPoint):
def __init__(self):
super(gdb.BreakPoint, self).__init__(
spec = "cStringIO.c:566",
type = gdb.BPWATCHPOINT,
wp_class = gdb.WP_READ
)
def stop(self):
O_self = gdb_eval("self")
address = str(O_self.address)
O_object = O_self.cast(gdb_O_object_type)
infos = {
"pos": str(O_object["pos"]),
"string_size": str(O_object["string_size"]),
"buf_size": str(O_object["buf_size"]),
"softspace": str(O_object["softspace"])
}
if address in O_s:
if O_s[address]:
O_s[address]["new"] = infos
else:
O_s[address] = {"new": infos}
else:
O_s[address] = {"new": infos}
def StringO_Dealloc_BP(gdb.BreakPoint):
def __init__(self):
super(gdb.BreakPoint, self).__init__(
spec = "cStringIO.c:518",
type = gdb.BPWATCHPOINT,
wp_class = gdb.WP_READ
)
def stop(self):
O_self = gdb_eval("self")
address = str(O_self.address)
O_object = O_self.cast(gdb_O_object_type)
infos = {
"pos": str(O_object["pos"]),
"string_size": str(O_object["string_size"]),
"buf_size": str(O_object["buf_size"]),
"softspace": str(O_object["softspace"])
}
if address in O_s:
if O_s[address]:
O_s[address]["dealloc"] = infos
else:
O_s[address] = {"dealloc": infos}
else:
O_s[address] = {"dealloc": infos}
| mit | Python |
|
96a94b6901ebca0930a2509ccadfd603f8558b8d | Add test case for event items | leaffan/pynhldb | tests/test_event.py | tests/test_event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
from lxml import html
from utils.summary_downloader import SummaryDownloader
from utils.data_handler import DataHandler
from parsers.team_parser import TeamParser
from parsers.game_parser import GameParser
from parsers.roster_parser import RosterParser
from parsers.event_parser import EventParser
def test_event(tmpdir):
date = "Oct 12, 2016"
game_id = "020001"
sdl = SummaryDownloader(
tmpdir.mkdir('shot').strpath, date, zip_summaries=False)
sdl.run()
dld_dir = sdl.get_tgt_dir()
ep = get_event_parser(dld_dir, game_id)
event = ep.get_event(ep.event_data[1])
assert event.event_id == 20160200010002
assert event.game_id == 2016020001
assert event.in_game_event_cnt == 2
assert event.type == 'FAC'
assert event.period == 1
assert event.time == datetime.timedelta(0)
assert event.road_on_ice == [
8475172, 8473463, 8470599, 8476853, 8475716, 8475883]
assert event.home_on_ice == [
8474250, 8473544, 8471676, 8470602, 8476879, 8467950]
assert event.road_score == 0
assert event.home_score == 0
assert event.x == 0
assert event.y == 0
assert event.road_goalie == 8475883
assert event.home_goalie == 8467950
assert event.raw_data == (
"TOR won Neu. Zone - TOR #43 KADRI vs OTT #19 BRASSARD")
def get_document(dir, game_id, prefix):
dh = DataHandler(dir)
return open(dh.get_game_data(game_id, prefix)[prefix]).read()
def get_json_document(dir, game_id):
dh = DataHandler(dir)
return json.loads(open(dh.get_game_json_data(game_id)).read())
def get_event_parser(dir, game_id):
"""
Retrieves event parser for game with specified id from
data downloaded to directory also given.
"""
# retrieving raw data
game_report_doc = html.fromstring(get_document(dir, game_id, 'GS'))
roster_report_doc = html.fromstring(get_document(dir, game_id, 'ES'))
play_by_play_report_doc = html.fromstring(
get_document(dir, game_id, 'PL'))
game_feed_json_doc = get_json_document(dir, game_id)
# using team parser to retrieve teams
tp = TeamParser(game_report_doc)
teams = tp.create_teams()
# using game parser to retrieve basic game information
gp = GameParser(game_id, game_report_doc)
game = gp.create_game(teams)
# using roster parser to retrieve team rosters
rp = RosterParser(roster_report_doc)
rosters = rp.create_roster(game, teams)
# using event parser to retrieve all raw events
ep = EventParser(play_by_play_report_doc, game_feed_json_doc)
ep.load_data()
(ep.game, ep.rosters) = (game, rosters)
ep.cache_plays_with_coordinates()
return ep
| mit | Python |
|
bc581b1ac7a12fd3026667663a4812fe0bd3869b | add dict.py | pidofme/T4LE | dict.py | dict.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import json
import urllib
import subprocess
def main():
word = subprocess.check_output('xsel')
params = urllib.urlencode({'from': 'auto', 'to': 'auto', 'client_id':'WGCxN9fzvCxPo0nqlzGLCPUc', 'q': word})
f = urllib.urlopen("http://openapi.baidu.com/public/2.0/bmt/translate?%s", params)
j = json.loads(f.read())
d = dict(j['trans_result'][0])
subprocess.call(['notify-send', word, d['dst']])
if __name__ == '__main__':
main()
| mit | Python |
|
28b5fef57580640cd78775d6c0544bc633e5958a | Add helper script to generate API keys. | ZeitOnline/content-api,ZeitOnline/content-api | generate-key.py | generate-key.py | #!/usr/bin/python
import os
import sqlite3
import sys
import time
if len(sys.argv) < 3:
raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0])
db = sqlite3.connect('/var/lib/zon-api/data.db')
api_key = str(os.urandom(26).encode('hex'))
tier = 'free'
name = sys.argv[1]
email = sys.argv[2]
requests = 0
reset = int(time.time())
query = 'INSERT INTO client VALUES (?, ?, ?, ?, ?, ?)'
db.execute(query, (api_key, tier, name, email, requests, reset))
db.commit()
db.close()
print api_key
| bsd-3-clause | Python |
|
a314da2415e661ed6cbc9929095a0f34610d9c21 | FIX _get_search_domain in partner | adhoc-dev/odoo-personalizations,ingadhoc/odoo-personalizations | transindar_personalization/res_partner.py | transindar_personalization/res_partner.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class res_partner(models.Model):
_inherit = 'res.partner'
@api.model
def name_search(
self, name, args=None, operator='ilike', limit=100):
recs = self.search(self._get_search_domain(
name, args=args, operator=operator, limit=limit), limit=limit)
if not recs:
return super(res_partner, self).name_search(
name=name, args=args, operator=operator, limit=limit)
return recs.name_get()
@api.model
def _get_search_domain(self, name, args=None, operator='ilike', limit=100):
if not args:
args = []
if name:
if self.search(
[('internal_code', '=ilike', name)] + args,
limit=limit):
return [('internal_code', '=ilike', name)] + args
else:
return ['|', ('display_name', 'ilike', name),
('ref', 'ilike', name)] + args
return args
def _search_custom_search(self, operator, value):
res = self._get_search_domain(value, operator=operator)
return res
@api.multi
def _get_custom_search(self):
return False
custom_search = fields.Char(
compute='_get_custom_search',
string='Busqueda Inteligente',
search='_search_custom_search'
)
| # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
class res_partner(models.Model):
_inherit = 'res.partner'
@api.model
def name_search(
self, name, args=None, operator='ilike', limit=100):
recs = self.search(self._get_search_domain(
name, args=args, operator=operator, limit=limit), limit=limit)
if not recs:
return super(res_partner, self).name_search(
name=name, args=args, operator=operator, limit=limit)
return recs.name_get()
@api.model
def _get_search_domain(self, name, args=None, operator='ilike', limit=100):
if not args:
args = []
if name:
if self.search(
[('internal_code', '=ilike', name)],
limit=limit):
return [('internal_code', '=ilike', name)]
else:
return ['|', ('display_name', 'ilike', name),
('ref', 'ilike', name)]
return args
def _search_custom_search(self, operator, value):
res = self._get_search_domain(value, operator=operator)
return res
@api.multi
def _get_custom_search(self):
return False
custom_search = fields.Char(
compute='_get_custom_search',
string='Busqueda Inteligente',
search='_search_custom_search'
)
| agpl-3.0 | Python |
6807ce92c5d0a26a43db8cb25ef5ffd8b8ff6277 | Add skeleton cryptdev module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/cryptdev.py | salt/modules/cryptdev.py | # -*- coding: utf-8 -*-
'''
Salt module to manage Unix cryptsetup jobs and the crypttab file
'''
# Import python libraries
from __future__ import absolute_import
import logging
# Import salt libraries
import salt
# Set up logger
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = 'cryptdev'
def __virtual__():
'''
Only load on POSIX-like systems
'''
if salt.utils.is_windows():
return (False, 'The cryptdev module cannot be loaded: not a POSIX-like system')
else:
return True
| apache-2.0 | Python |
|
9b457a08ce433b574f186bb1b32da666edee485a | Complete sol by recursion | bowen0701/algorithms_data_structures | lc0108_convert_sorted_array_to_binary_search_tree.py | lc0108_convert_sorted_array_to_binary_search_tree.py | """Leetcode 108. Convert Sorted Array to Binary Search Tree
Easy
URL: https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
Given an array where elements are sorted in ascending order,
convert it to a height balanced BST.
For this problem, a height-balanced binary tree is defined as a binary tree
in which the depth of the two subtrees of every node never differ by more than 1.
Example:
Given the sorted array: [-10,-3,0,5,9],
One possible answer is: [0,-3,9,-10,null,5], which represents the following
height balanced BST:
0
/ \
-3 9
/ /
-10 5
"""
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class SolutionRecur(object):
def sortedArrayToBST(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
if not nums:
return None
left, right = 0, len(nums) - 1
mid = left + (right - left) // 2
root = TreeNode(nums[mid])
root.left = self.sortedArrayToBST(nums[:mid])
root.right = self.sortedArrayToBST(nums[mid+1:])
return root
def main():
nums = [-10, -3, 0, 5, 9]
root = SolutionRecur().sortedArrayToBST(nums)
if __name__ == '__main__':
main()
| bsd-2-clause | Python |
|
e36df0c827de666fa00d9b806759cde0f0cb1697 | Test code | henrik645/txt-rpg | game.py | game.py | class Room:
def __init__(self, configuration={}):
self.doors = configuration
class Merchant:
def __init__(self, markup=1.2, markdown=0.8):
self.inventory = []
self.markup = markup
self.markdown = markdown
def add_item(self, item):
# Adds an item to the merchant's inventory
if (not isinstance(item, Item)):
raise TypeError("Unexpected " + type(item))
self.inventory.append(item)
def get_selling_offers(self):
# Lists all items in the merchant's inventory
# and adds the markup fee
offers = []
for item in self.inventory:
offer = (item, item.value*self.markup)
offers.append(offer)
return offers
def get_buying_offers(self, items):
# Generates buying offers on the items in 'items'
offers = []
for item in items:
offer = (item, item.value*self.markdown)
offers.append(offer)
return offers
class Town(Room):
def __init__(self, name, room_configuration={}):
super().__init__(room_configuration)
self.name = name
class Item:
def __init__(self, name, description, value):
self.name = name
self.description = description
self.value = value # The item's monetary value
@property
def value(self):
return self.value
@value.setter
def x(self, value):
if value < 0:
raise ValueError("Item value cannot be less than 0")
else:
self.value = value
class Weapon(Item):
def __init__(self, name, description, damage=0, value=0):
self.damage = damage
super().__init__(name, description, value)
# Create new place with the name "My Place"
my_place = Town("My Place")
# Create new merchant with markup=1.2 and markdown=0.8
my_merchant = Merchant(1.2, 0.8)
# Attach the merchant to the place
my_place.merchant = my_merchant
# Create new weapon with the name "Sword", the description "A plain sword."
# a damage value of 20, and a monetary value of 10
sword = Weapon("Sword", "A plain sword.", 20, 10)
# Ditto
axe = Weapon("Axe", "A plain axe.", 30, 20)
# Ditto
pickaxe = Weapon("Pickaxe", "A plain pickaxe.", 10, 10)
# Add our weapons to the merchant we attached to our place
my_place.merchant.add_item(sword)
my_place.merchant.add_item(axe)
my_place.merchant.add_item(pickaxe)
# Create a new room
# Pass the configuration dict, which says that the east door should lead to my_place
starting_room = Room({'east': my_place})
# Get selling offers from the merchant in the place that is behind the east door of our room
selling_offers = starting_room.doors['east'].merchant.get_selling_offers()
selling_offers_formatted = []
for offer in selling_offers:
selling_offers_formatted.append((offer[0], offer[1]))
print(selling_offers_formatted) | mit | Python |
|
e9eed6b6e99e948ed2863fcc45a037b0e2b1e80f | fix import in tornado worker | zhoucen/gunicorn,alex/gunicorn,prezi/gunicorn,jamesblunt/gunicorn,pschanely/gunicorn,z-fork/gunicorn,harrisonfeng/gunicorn,ccl0326/gunicorn,WSDC-NITWarangal/gunicorn,beni55/gunicorn,tejasmanohar/gunicorn,ccl0326/gunicorn,alex/gunicorn,mvaled/gunicorn,jamesblunt/gunicorn,mvaled/gunicorn,mvaled/gunicorn,malept/gunicorn,1stvamp/gunicorn,pschanely/gunicorn,1stvamp/gunicorn,GitHublong/gunicorn,pschanely/gunicorn,prezi/gunicorn,wong2/gunicorn,malept/gunicorn,wong2/gunicorn,zhoucen/gunicorn,tempbottle/gunicorn,ccl0326/gunicorn,malept/gunicorn,urbaniak/gunicorn,1stvamp/gunicorn,urbaniak/gunicorn,ammaraskar/gunicorn,urbaniak/gunicorn,elelianghh/gunicorn,MrKiven/gunicorn,alex/gunicorn,wong2/gunicorn,gtrdotmcs/gunicorn,keakon/gunicorn,gtrdotmcs/gunicorn,ephes/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,zhoucen/gunicorn,prezi/gunicorn | gunicorn/workers/gtornado.py | gunicorn/workers/gtornado.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
class TornadoWorker(Worker):
def watchdog(self):
self.notify()
if self.ppid != os.getppid():
self.log.info("Parent changed, shutting down: %s" % self)
self.ioloop.stop()
def run(self):
self.socket.setblocking(0)
self.ioloop = IOLoop.instance()
PeriodicCallback(self.watchdog, 1000, io_loop=self.ioloop).start()
server = HTTPServer(self.app, io_loop=self.ioloop)
server._socket = self.socket
server.start(num_processes=1)
self.ioloop.start()
| # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
class TornadoWorker(Worker):
def watchdog(self):
self.notify()
if self.ppid != os.getppid():
self.log.info("Parent changed, shutting down: %s" % self)
self.ioloop.stop()
def run(self):
self.socket.setblocking(0)
self.ioloop = IOLoop.instance()
PeriodicCallback(self.watchdog, 1000, io_loop=self.ioloop).start()
server = HTTPServer(self.app, io_loop=self.ioloop)
server._socket = self.socket
server.start(num_processes=1)
self.ioloop.start()
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.