blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
dd4bd950a39ea20b33814bbe7e882ba1ea2b1bc3
f4e8c8294b23fe070a763b527bc2f75ccdebaab1
/leetCodePython/83.remove-duplicates-from-sorted-list.py
f829f2439febd64241b2d38c02332bae0a292c3b
[]
no_license
HOZH/leetCode
aff083b33e9b908490e7e992a0ad192ee31cc2e5
a0ab59ba0a1a11a06b7086aa8f791293ec9c7139
refs/heads/master
2023-08-17T08:44:07.884861
2023-08-08T19:47:42
2023-08-08T19:47:42
136,558,812
2
0
null
null
null
null
UTF-8
Python
false
false
733
py
# # @lc app=leetcode id=83 lang=python3 # # [83] Remove Duplicates from Sorted List # # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def deleteDuplicates(self, head): current = head if current: prev = current while current: while current.next: if current.next.val == current.val: current = current.next else: break temp = current.next prev.next = temp prev = current = temp current = prev return head
[ "hong.zheng@stonybrook.edu" ]
hong.zheng@stonybrook.edu
7453eac3ad4a2c9b553a59c2694a0a7c020a5d8a
0343de40021f8dd72fb9a6cb31b5d2f24ccd7971
/utilities/wake_models_mean/util.py
17331324b776f80e56a804d954b718b2ef2a65bd
[]
no_license
sebasanper/WINDOW_dev
47ae9252e6fadb2a3b1a0aae3383681a7955f4ea
3c6437a777f2fc3be1dfd3d53b5d2ed25281c55c
refs/heads/master
2021-01-01T19:45:02.555727
2018-05-21T20:27:56
2018-05-21T20:27:56
98,670,270
0
0
null
null
null
null
UTF-8
Python
false
false
136
py
def interpolate(minx, miny, maxx, maxy, valx): # print maxx, minx return miny + (maxy - miny) * ((valx - minx) / (maxx - minx))
[ "s.sanchezperezmoreno@tudelft.nl" ]
s.sanchezperezmoreno@tudelft.nl
f98901e3b2917cb13dcbd40a6f3479c0b87c6840
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03131/s120646921.py
522b4214f36258ffb62506f2aa2bb22339794d1f
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
260
py
K,A,B= map(int,input().split()) ans = 1 if (B-A) <= 2: ans += K else: if B - A <=2: ans += K else: ans += A - 1 if (K-(A-1)) % 2 == 0: ans += (((K-(A-1))//2)) * (B - A) else: ans += (((K-(A-1))//2)) * (B - A) + 1 print(ans)
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
ce5e7eeed67ed5e94efb5bf6fec120007d0c6a1f
b35f86d9746f782dca05765a3c2d31e1e7a511b8
/src/tubesite/models.py
df26a20d6bdd7017711e39e94258e224d255cf08
[]
no_license
jccode/cutetube
5f28f5c242c5213c91590ef82f97934257cb2b42
0a91745ca9adccab68ffb3d742d8fcc5c4b52f2b
refs/heads/master
2020-12-13T21:47:30.129097
2017-07-31T01:36:53
2017-07-31T01:36:53
95,474,863
0
0
null
null
null
null
UTF-8
Python
false
false
2,044
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.safestring import mark_safe # from django.contrib.postgres.fields import JSONField # from jsonfield import JSONField from .utils import JSONField from filer.fields.image import FilerImageField # Create your models here. class Category(models.Model): name = models.CharField(max_length=50) #image = models.ImageField(upload_to="category") image = FilerImageField() def image_thumbnail(self): if self.image: s = '<img src="{src}" alt="{name}"/>'.format(src=self.image.thumbnails['admin_tiny_icon'], name=self.image.label) return mark_safe(s) else: return '(No image)' image_thumbnail.short_description = 'Thumb' def __unicode__(self): return self.name class Video(models.Model): QUALITY_CHOICES = ( (0, 'Normal'), (1, 'HD'), ) category = models.ForeignKey('Category', blank=True, null=True) name = models.CharField(max_length=100, blank=True) desc = models.TextField(max_length=200, blank=True) poster = models.URLField() src = models.URLField() duration = models.IntegerField() quality = models.IntegerField(choices=QUALITY_CHOICES, default=0) multiple = models.BooleanField(default=False) extra = JSONField(blank=True, null=True) """ extra json format: { videos: [{src:"", poster:"", duration:"" }, ], } """ def poster_thumbnail(self): if self.poster: poster_src = self.poster s = '<img src="{src}" alt="{name}" width="32" height="32"/>'.format(src=poster_src, name=self.name) return mark_safe(s) else: return '(No poster)' poster_thumbnail.short_description = 'Thumb' def quality_str(self): choices = {c[0]: c[1] for c in self.QUALITY_CHOICES} return choices[self.quality] def __unicode__(self): return self.name if self.name is not None else self.poster
[ "junchangchen@gmail.com" ]
junchangchen@gmail.com
6f96e83991bae143e3344852c09a992a151e54a7
fe3759747f709a41e5ff3acf78872dd6b74f772a
/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog_all_of.py
82cee4c2f86b5e935a3f34a13f73fa89ec48000a
[ "Apache-2.0" ]
permissive
Januson/openapi-generator
c50e3b52765e41adba9712d745918cea39dfa490
5b6b4c9d4829b57716741dc35b3f1033e5483784
refs/heads/master
2022-10-19T04:16:38.042495
2022-04-23T08:42:21
2022-04-23T08:42:21
238,659,737
0
0
Apache-2.0
2023-09-05T01:01:23
2020-02-06T10:12:38
Java
UTF-8
Python
false
false
1,945
py
# coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 import typing # noqa: F401 from frozendict import frozendict # noqa: F401 import decimal # noqa: F401 from datetime import date, datetime # noqa: F401 from frozendict import frozendict # noqa: F401 from petstore_api.schemas import ( # noqa: F401 AnyTypeSchema, ComposedSchema, DictSchema, ListSchema, StrSchema, IntSchema, Int32Schema, Int64Schema, Float32Schema, Float64Schema, NumberSchema, UUIDSchema, DateSchema, DateTimeSchema, DecimalSchema, BoolSchema, BinarySchema, NoneSchema, none_type, Configuration, Unset, unset, ComposedBase, ListBase, DictBase, NoneBase, StrBase, IntBase, Int32Base, Int64Base, Float32Base, Float64Base, NumberBase, UUIDBase, DateBase, DateTimeBase, BoolBase, BinaryBase, Schema, _SchemaValidator, _SchemaTypeChecker, _SchemaEnumMaker ) class DogAllOf( DictSchema ): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ breed = StrSchema def __new__( cls, *args: typing.Union[dict, frozendict, ], breed: typing.Union[breed, Unset] = unset, _configuration: typing.Optional[Configuration] = None, **kwargs: typing.Type[Schema], ) -> 'DogAllOf': return super().__new__( cls, *args, breed=breed, _configuration=_configuration, **kwargs, )
[ "noreply@github.com" ]
Januson.noreply@github.com
0a4ff76290de76fbad0a9754c6e94dc235163730
85a9ffeccb64f6159adbd164ff98edf4ac315e33
/pysnmp/ZYXEL-DHCP-SNOOPING-MIB.py
cc4b139772e44793ddbbd362a97dd1e097633f21
[ "Apache-2.0" ]
permissive
agustinhenze/mibs.snmplabs.com
5d7d5d4da84424c5f5a1ed2752f5043ae00019fb
1fc5c07860542b89212f4c8ab807057d9a9206c7
refs/heads/master
2020-12-26T12:41:41.132395
2019-08-16T15:51:41
2019-08-16T15:53:57
237,512,469
0
0
Apache-2.0
2020-01-31T20:41:36
2020-01-31T20:41:35
null
UTF-8
Python
false
false
16,635
py
# # PySNMP MIB module ZYXEL-DHCP-SNOOPING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-DHCP-SNOOPING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:43:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint") dot1dBasePort, = mibBuilder.importSymbols("BRIDGE-MIB", "dot1dBasePort") EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, iso, Gauge32, Counter32, IpAddress, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Counter64, ObjectIdentity, Unsigned32, ModuleIdentity, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "iso", "Gauge32", "Counter32", "IpAddress", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Counter64", "ObjectIdentity", "Unsigned32", "ModuleIdentity", "Bits", "NotificationType") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") esMgmt, = mibBuilder.importSymbols("ZYXEL-ES-SMI", "esMgmt") zyxelDhcpSnooping = ModuleIdentity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20)) if mibBuilder.loadTexts: zyxelDhcpSnooping.setLastUpdated('201207010000Z') if mibBuilder.loadTexts: zyxelDhcpSnooping.setOrganization('Enterprise Solution ZyXEL') zyxelDhcpSnoopingSetup = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1)) zyxelDhcpSnoopingStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2)) zyDhcpSnoopingState = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 1), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingState.setStatus('current') zyxelDhcpSnoopingVlanTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 2), ) if mibBuilder.loadTexts: zyxelDhcpSnoopingVlanTable.setStatus('current') zyxelDhcpSnoopingVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 2, 1), ).setIndexNames((0, "ZYXEL-DHCP-SNOOPING-MIB", "zyDhcpSnoopingVlanVid")) if mibBuilder.loadTexts: zyxelDhcpSnoopingVlanEntry.setStatus('current') zyDhcpSnoopingVlanVid = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))) if mibBuilder.loadTexts: zyDhcpSnoopingVlanVid.setStatus('current') zyDhcpSnoopingVlanState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 2, 1, 2), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingVlanState.setStatus('current') zyDhcpSnoopingVlanOption82Profile = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 2, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingVlanOption82Profile.setStatus('current') zyxelDhcpSnoopingPortTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 3), ) if mibBuilder.loadTexts: zyxelDhcpSnoopingPortTable.setStatus('current') zyxelDhcpSnoopingPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 3, 1), ).setIndexNames((0, "BRIDGE-MIB", "dot1dBasePort")) if mibBuilder.loadTexts: zyxelDhcpSnoopingPortEntry.setStatus('current') zyDhcpSnoopingPortTrustState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 3, 1, 1), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingPortTrustState.setStatus('current') zyDhcpSnoopingPortRate = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2048))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingPortRate.setStatus('current') zyxelDhcpSnoopingDb = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 4)) zyDhcpSnoopingDbAbort = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 4, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDbAbort.setStatus('current') zyDhcpSnoopingDbWriteDelay = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 4, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDbWriteDelay.setStatus('current') zyDhcpSnoopingDbUrl = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 4, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDbUrl.setStatus('current') zyDhcpSnoopingDbUrlRenew = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 4, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDbUrlRenew.setStatus('current') zyxelDhcpSnoopingDhcpVlan = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 5)) zyDhcpSnoopingDhcpVlanVid = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 5, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDhcpVlanVid.setStatus('current') zyDhcpSnoopingMaxNumberOfOption82VlanPort = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingMaxNumberOfOption82VlanPort.setStatus('current') zyxelDhcpSnoopingOption82VlanPortTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 7), ) if mibBuilder.loadTexts: zyxelDhcpSnoopingOption82VlanPortTable.setStatus('current') zyxelDhcpSnoopingOption82VlanPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 7, 1), ).setIndexNames((0, "ZYXEL-DHCP-SNOOPING-MIB", "zyDhcpSnoopingVlanVid"), (0, "BRIDGE-MIB", "dot1dBasePort")) if mibBuilder.loadTexts: zyxelDhcpSnoopingOption82VlanPortEntry.setStatus('current') zyDhcpSnoopingOption82VlanPortProfile = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 1, 7, 1, 1), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: zyDhcpSnoopingOption82VlanPortProfile.setStatus('current') zyDhcpSnoopingDbStatisticsClear = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 1), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsClear.setStatus('current') zyxelDhcpSnoopingDbStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2)) zyDhcpSnoopingDbStatisticsAgentRunning = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("read", 1), ("write", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsAgentRunning.setStatus('current') zyDhcpSnoopingDbStatisticsDelayExpiry = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsDelayExpiry.setStatus('current') zyDhcpSnoopingDbStatisticsAbortExpiry = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsAbortExpiry.setStatus('current') zyDhcpSnoopingDbStatisticsLastSuccessTime = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastSuccessTime.setStatus('current') zyDhcpSnoopingDbStatisticsLastFailTime = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastFailTime.setStatus('current') zyDhcpSnoopingDbStatisticsLastFailReasonType = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastFailReasonType.setStatus('current') zyDhcpSnoopingDbStatisticsTotalAttempt = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalAttempt.setStatus('current') zyDhcpSnoopingDbStatisticsStartupFail = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsStartupFail.setStatus('current') zyDhcpSnoopingDbStatisticsSuccessTrans = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsSuccessTrans.setStatus('current') zyDhcpSnoopingDbStatisticsFailTrans = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsFailTrans.setStatus('current') zyDhcpSnoopingDbStatisticsSuccessRead = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsSuccessRead.setStatus('current') zyDhcpSnoopingDbStatisticsFailRead = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsFailRead.setStatus('current') zyDhcpSnoopingDbStatisticsSuccessWrite = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsSuccessWrite.setStatus('current') zyDhcpSnoopingDbStatisticsFailWrite = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsFailWrite.setStatus('current') zyDhcpSnoopingDbStatisticsFirstSuccessAccess = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("read", 1), ("write", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsFirstSuccessAccess.setStatus('current') zyDhcpSnoopingDbStatisticsLastIgnoreBindCollision = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastIgnoreBindCollision.setStatus('current') zyDhcpSnoopingDbStatisticsLastIgnoreExpireLease = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastIgnoreExpireLease.setStatus('current') zyDhcpSnoopingDbStatisticsLastIgnoreInvalidInterface = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 18), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastIgnoreInvalidInterface.setStatus('current') zyDhcpSnoopingDbStatisticsLastIgnoreUnsupportedVlan = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 19), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastIgnoreUnsupportedVlan.setStatus('current') zyDhcpSnoopingDbStatisticsLastIgnoreParse = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsLastIgnoreParse.setStatus('current') zyDhcpSnoopingDbStatisticsTotalIgnoreBindCollision = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 21), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalIgnoreBindCollision.setStatus('current') zyDhcpSnoopingDbStatisticsTotalIgnoreExpireLease = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 22), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalIgnoreExpireLease.setStatus('current') zyDhcpSnoopingDbStatisticsTotalIgnoreInvalidInterface = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalIgnoreInvalidInterface.setStatus('current') zyDhcpSnoopingDbStatisticsTotalIgnoreUnsupportedVlan = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 24), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalIgnoreUnsupportedVlan.setStatus('current') zyDhcpSnoopingDbStatisticsTotalIgnoreParse = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 20, 2, 2, 25), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyDhcpSnoopingDbStatisticsTotalIgnoreParse.setStatus('current') mibBuilder.exportSymbols("ZYXEL-DHCP-SNOOPING-MIB", zyxelDhcpSnoopingPortEntry=zyxelDhcpSnoopingPortEntry, zyxelDhcpSnoopingVlanTable=zyxelDhcpSnoopingVlanTable, zyDhcpSnoopingDbAbort=zyDhcpSnoopingDbAbort, zyDhcpSnoopingDbStatisticsAbortExpiry=zyDhcpSnoopingDbStatisticsAbortExpiry, zyDhcpSnoopingDbStatisticsLastIgnoreInvalidInterface=zyDhcpSnoopingDbStatisticsLastIgnoreInvalidInterface, zyxelDhcpSnoopingStatus=zyxelDhcpSnoopingStatus, zyDhcpSnoopingDbStatisticsSuccessTrans=zyDhcpSnoopingDbStatisticsSuccessTrans, zyxelDhcpSnoopingOption82VlanPortTable=zyxelDhcpSnoopingOption82VlanPortTable, zyDhcpSnoopingDbStatisticsFailWrite=zyDhcpSnoopingDbStatisticsFailWrite, zyxelDhcpSnoopingDb=zyxelDhcpSnoopingDb, zyxelDhcpSnoopingSetup=zyxelDhcpSnoopingSetup, zyDhcpSnoopingOption82VlanPortProfile=zyDhcpSnoopingOption82VlanPortProfile, zyDhcpSnoopingDbStatisticsLastIgnoreExpireLease=zyDhcpSnoopingDbStatisticsLastIgnoreExpireLease, zyDhcpSnoopingDbStatisticsFirstSuccessAccess=zyDhcpSnoopingDbStatisticsFirstSuccessAccess, zyDhcpSnoopingDbStatisticsFailRead=zyDhcpSnoopingDbStatisticsFailRead, zyxelDhcpSnoopingDhcpVlan=zyxelDhcpSnoopingDhcpVlan, zyDhcpSnoopingVlanVid=zyDhcpSnoopingVlanVid, zyDhcpSnoopingDbUrl=zyDhcpSnoopingDbUrl, PYSNMP_MODULE_ID=zyxelDhcpSnooping, zyDhcpSnoopingDbStatisticsTotalIgnoreBindCollision=zyDhcpSnoopingDbStatisticsTotalIgnoreBindCollision, zyDhcpSnoopingDbStatisticsLastFailTime=zyDhcpSnoopingDbStatisticsLastFailTime, zyxelDhcpSnoopingOption82VlanPortEntry=zyxelDhcpSnoopingOption82VlanPortEntry, zyDhcpSnoopingDbStatisticsTotalAttempt=zyDhcpSnoopingDbStatisticsTotalAttempt, zyDhcpSnoopingDbStatisticsTotalIgnoreUnsupportedVlan=zyDhcpSnoopingDbStatisticsTotalIgnoreUnsupportedVlan, zyDhcpSnoopingDbStatisticsAgentRunning=zyDhcpSnoopingDbStatisticsAgentRunning, zyDhcpSnoopingDbStatisticsSuccessRead=zyDhcpSnoopingDbStatisticsSuccessRead, zyDhcpSnoopingDbStatisticsLastIgnoreParse=zyDhcpSnoopingDbStatisticsLastIgnoreParse, zyDhcpSnoopingState=zyDhcpSnoopingState, zyxelDhcpSnoopingVlanEntry=zyxelDhcpSnoopingVlanEntry, zyDhcpSnoopingDbUrlRenew=zyDhcpSnoopingDbUrlRenew, zyDhcpSnoopingDbStatisticsTotalIgnoreExpireLease=zyDhcpSnoopingDbStatisticsTotalIgnoreExpireLease, zyDhcpSnoopingDbStatisticsLastFailReasonType=zyDhcpSnoopingDbStatisticsLastFailReasonType, zyDhcpSnoopingPortTrustState=zyDhcpSnoopingPortTrustState, zyDhcpSnoopingPortRate=zyDhcpSnoopingPortRate, zyDhcpSnoopingDbStatisticsLastSuccessTime=zyDhcpSnoopingDbStatisticsLastSuccessTime, zyDhcpSnoopingDbStatisticsStartupFail=zyDhcpSnoopingDbStatisticsStartupFail, zyDhcpSnoopingDbStatisticsTotalIgnoreInvalidInterface=zyDhcpSnoopingDbStatisticsTotalIgnoreInvalidInterface, zyxelDhcpSnoopingPortTable=zyxelDhcpSnoopingPortTable, zyDhcpSnoopingDbStatisticsFailTrans=zyDhcpSnoopingDbStatisticsFailTrans, zyxelDhcpSnoopingDbStatistics=zyxelDhcpSnoopingDbStatistics, zyDhcpSnoopingDbStatisticsTotalIgnoreParse=zyDhcpSnoopingDbStatisticsTotalIgnoreParse, zyxelDhcpSnooping=zyxelDhcpSnooping, zyDhcpSnoopingVlanState=zyDhcpSnoopingVlanState, zyDhcpSnoopingMaxNumberOfOption82VlanPort=zyDhcpSnoopingMaxNumberOfOption82VlanPort, zyDhcpSnoopingDbStatisticsClear=zyDhcpSnoopingDbStatisticsClear, zyDhcpSnoopingDbStatisticsDelayExpiry=zyDhcpSnoopingDbStatisticsDelayExpiry, zyDhcpSnoopingDhcpVlanVid=zyDhcpSnoopingDhcpVlanVid, zyDhcpSnoopingDbStatisticsSuccessWrite=zyDhcpSnoopingDbStatisticsSuccessWrite, zyDhcpSnoopingVlanOption82Profile=zyDhcpSnoopingVlanOption82Profile, zyDhcpSnoopingDbStatisticsLastIgnoreBindCollision=zyDhcpSnoopingDbStatisticsLastIgnoreBindCollision, zyDhcpSnoopingDbWriteDelay=zyDhcpSnoopingDbWriteDelay, zyDhcpSnoopingDbStatisticsLastIgnoreUnsupportedVlan=zyDhcpSnoopingDbStatisticsLastIgnoreUnsupportedVlan)
[ "dcwangmit01@gmail.com" ]
dcwangmit01@gmail.com
3492b0d6ce2c684a730e99b0b923f6eb900e6355
b30216e0e7d5181da3430087c1deb121f0c58dd5
/Accounts/migrations/0003_usernames_image.py
c4ccec940e692346590414372a99b33347dc62fd
[ "MIT" ]
permissive
kurianbenoy/ShareGoods
ac360f7523636f3d0f5c758aac19ccd7de6769d8
5231a0ec2ad3ef22fa5da1c2ab2ba5a654ba75e0
refs/heads/master
2020-03-24T12:08:16.263168
2018-08-10T17:48:24
2018-08-10T17:48:24
142,704,517
0
1
null
null
null
null
UTF-8
Python
false
false
483
py
# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2018-07-29 03:24 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Accounts', '0002_auto_20180729_0818'), ] operations = [ migrations.AddField( model_name='usernames', name='image', field=models.ImageField(blank=True, null=True, upload_to='uploads/'), ), ]
[ "kurian.pro@gmail.com" ]
kurian.pro@gmail.com
0ecfe9bc8614ef986ade28e1ce80d6929d627709
187ba0b860c1311e1e931825ad207b57d673d46d
/docs/conf.py
e64e7747d4c0c6f6ba851b43f3e40d6cbf5cbc0e
[ "MIT" ]
permissive
acgh213/jaraco.nxt
698a230f7fd80e046741300182f283065900a3cd
954f7dc95ac7c82e06b8d21a26b5d654ced31c9f
refs/heads/master
2021-05-30T02:10:10.287918
2015-11-30T01:14:47
2015-11-30T01:14:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
400
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import setuptools_scm extensions = [ 'sphinx.ext.autodoc', ] # General information about the project. project = 'jaraco.nxt' copyright = '2015 Jason R. Coombs' # The short X.Y version. version = setuptools_scm.get_version(root='..', relative_to=__file__) # The full version, including alpha/beta/rc tags. release = version master_doc = 'index'
[ "jaraco@jaraco.com" ]
jaraco@jaraco.com
407869ec28a72c22c3176031a91d984739fd1356
a0757f4148f4bcc0ae2a499267c884e2c04c389d
/posts/migrations/0001_initial.py
9da7662c853bb3787e6740e2f5c0c1441eb711f9
[]
no_license
hkailee/sequencinggo
7a1a11889e46b4b4aba0aeda6e50ff5d74c8f65b
e118f5815ac6ad41053a7edcaacb00f4a414f2a2
refs/heads/master
2021-01-21T03:21:46.672069
2016-12-03T05:58:33
2016-12-03T05:58:33
69,310,426
1
0
null
null
null
null
UTF-8
Python
false
false
2,570
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import taggit.managers import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('taggit', '0002_auto_20150616_2121'), ] operations = [ migrations.CreateModel( name='Comment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('body', models.TextField()), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('active', models.BooleanField(default=True)), ], options={ 'ordering': ('created',), }, ), migrations.CreateModel( name='Post', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('title', models.CharField(max_length=200)), ('slug', models.SlugField(max_length=200, unique_for_date='created')), ('image', models.ImageField(blank=True, null=True, upload_to='images/%Y/%m/%d')), ('description', models.TextField(blank=True)), ('created', models.DateTimeField(default=django.utils.timezone.now, db_index=True)), ('tags', taggit.managers.TaggableManager(verbose_name='Tags', to='taggit.Tag', through='taggit.TaggedItem', help_text='A comma-separated list of tags.')), ('user', models.ForeignKey(related_name='posts_created', to=settings.AUTH_USER_MODEL)), ('users_like', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, related_name='posts_liked')), ], ), migrations.AddField( model_name='comment', name='post', field=models.ForeignKey(related_name='comments', to='posts.Post'), ), migrations.AddField( model_name='comment', name='user', field=models.ForeignKey(related_name='comments_created', to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='comment', name='users_like', field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, related_name='comments_liked'), ), ]
[ "leehongkai@gmail.com" ]
leehongkai@gmail.com
b886898739062d97e735446d5063b42c56bd703c
b385f39c5b701fb6f22796ab951872257ae8398a
/exercicios-secao04/exercicio10.py
366c4faf0f212965a046781b9c4425271372735f
[ "MIT" ]
permissive
EhODavi/curso-python
5c97a6913bad198ae590519287ed441c95399d80
cf07e308be9d7516f2cfe7f21c539d214c836979
refs/heads/main
2023-08-07T13:44:46.608118
2021-06-14T21:40:50
2021-06-14T21:40:50
356,542,988
0
0
null
null
null
null
UTF-8
Python
false
false
175
py
velocidade_km_h = float(input('Informe a velocidade em km/h: ')) velocidade_m_s = velocidade_km_h / 3.6 print(f'{velocidade_km_h} km/h corresponde à {velocidade_m_s} m/s')
[ "davi.miau@gmail.com" ]
davi.miau@gmail.com
c8e3877940df449f6b89f121031545c98b5c2f26
4a36b5979b0753b32cff3956fd97fb8ed8b11e84
/0.22/_downloads/6448e1cdd25e7f92168993a74b81b311/plot_psf_ctf_vertices.py
26db8d8e8b32a53e728539452c6217f69cca5f9b
[]
permissive
mne-tools/mne-tools.github.io
8aac7ae10bf2faeeb875b9a351a5530dc0e53154
495e878adc1ef3374e3db88604504d7542b01194
refs/heads/main
2023-09-03T07:06:00.660557
2023-09-03T04:10:18
2023-09-03T04:10:18
35,639,371
12
16
BSD-3-Clause
2023-05-05T19:04:32
2015-05-14T22:04:23
HTML
UTF-8
Python
false
false
3,440
py
# -*- coding: utf-8 -*- """ Plot point-spread functions (PSFs) and cross-talk functions (CTFs) ================================================================== Visualise PSF and CTF at one vertex for sLORETA. """ # Authors: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample from mne.minimum_norm import (make_inverse_resolution_matrix, get_cross_talk, get_point_spread) print(__doc__) data_path = sample.data_path() subjects_dir = data_path + '/subjects/' fname_fwd = data_path + '/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif' fname_cov = data_path + '/MEG/sample/sample_audvis-cov.fif' fname_evo = data_path + '/MEG/sample/sample_audvis-ave.fif' # read forward solution forward = mne.read_forward_solution(fname_fwd) # forward operator with fixed source orientations mne.convert_forward_solution(forward, surf_ori=True, force_fixed=True, copy=False) # noise covariance matrix noise_cov = mne.read_cov(fname_cov) # evoked data for info evoked = mne.read_evokeds(fname_evo, 0) # make inverse operator from forward solution # free source orientation inverse_operator = mne.minimum_norm.make_inverse_operator( info=evoked.info, forward=forward, noise_cov=noise_cov, loose=0., depth=None) # regularisation parameter snr = 3.0 lambda2 = 1.0 / snr ** 2 method = 'MNE' # can be 'MNE' or 'sLORETA' # compute resolution matrix for sLORETA rm_lor = make_inverse_resolution_matrix(forward, inverse_operator, method='sLORETA', lambda2=lambda2) # get PSF and CTF for sLORETA at one vertex sources = [1000] stc_psf = get_point_spread(rm_lor, forward['src'], sources, norm=True) stc_ctf = get_cross_talk(rm_lor, forward['src'], sources, norm=True) ############################################################################## # Visualize # --------- # PSF: # Which vertex corresponds to selected source vertno_lh = forward['src'][0]['vertno'] verttrue = [vertno_lh[sources[0]]] # just one vertex # find vertices with maxima in PSF and CTF vert_max_psf = vertno_lh[stc_psf.data.argmax()] vert_max_ctf = vertno_lh[stc_ctf.data.argmax()] brain_psf = stc_psf.plot('sample', 'inflated', 'lh', subjects_dir=subjects_dir) brain_psf.show_view('ventral') brain_psf.add_text(0.1, 0.9, 'sLORETA PSF', 'title', font_size=16) # True source location for PSF brain_psf.add_foci(verttrue, coords_as_verts=True, scale_factor=1., hemi='lh', color='green') # Maximum of PSF brain_psf.add_foci(vert_max_psf, coords_as_verts=True, scale_factor=1., hemi='lh', color='black') ############################################################################### # CTF: brain_ctf = stc_ctf.plot('sample', 'inflated', 'lh', subjects_dir=subjects_dir) brain_ctf.add_text(0.1, 0.9, 'sLORETA CTF', 'title', font_size=16) brain_ctf.show_view('ventral') brain_ctf.add_foci(verttrue, coords_as_verts=True, scale_factor=1., hemi='lh', color='green') # Maximum of CTF brain_ctf.add_foci(vert_max_ctf, coords_as_verts=True, scale_factor=1., hemi='lh', color='black') ############################################################################### # The green spheres indicate the true source location, and the black # spheres the maximum of the distribution.
[ "larson.eric.d@gmail.com" ]
larson.eric.d@gmail.com
0ed63b19ed685dfb761fcbc978a8607fd3f3bd7f
4054fde482f06ba5566ff88ff7c65b7221f4fd91
/forml/io/dsl/_struct/frame.py
2709983fa18e1430abe162e403203b24d40133fd
[ "Apache-2.0" ]
permissive
formlio/forml
e54278c2cc76cdfaf9d4feb405bd1a98c6dcd3e6
373bf4329338a9056e43966b8cfa458529ed2817
refs/heads/main
2023-06-07T21:38:34.952453
2023-05-28T21:53:47
2023-05-28T21:53:47
310,066,051
108
15
Apache-2.0
2023-05-28T19:38:16
2020-11-04T17:04:13
Python
UTF-8
Python
false
false
31,539
py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. """ ETL schema types. """ import abc import collections import copyreg import enum import functools import inspect import logging import operator import random import string import typing from .. import _exception, _struct from . import series if typing.TYPE_CHECKING: from forml.io import dsl LOGGER = logging.getLogger(__name__) class Rows(typing.NamedTuple): """Row limit spec container. Attention: Instances are expected to be created internally via :meth:`dsl.Queryable.limit <forml.io.dsl.Queryable.limit>`. """ count: int """Number of rows to return.""" offset: int = 0 """Skip the given number of rows.""" def __repr__(self): return f'{self.offset}:{self.count}' class Source(tuple, metaclass=abc.ABCMeta): """Base class of the *tabular* data frame sources. A *Source* is anything that can be used to obtain tabular data *FROM*. It is a logical collection of :class:`dsl.Feature <forml.io.dsl.Feature>` instances represented by its :attr:`schema`. """ class Schema(type): """Meta-class for schema types construction. It guarantees consistent hashing and comparability for equality of the produced schema classes. Attention: This meta-class is used internally, for schema frontend API see the :class:`dsl.Schema <forml.io.dsl.Schema>`. """ def __new__(mcs, name: str, bases: tuple[type], namespace: dict[str, typing.Any]): seen = set() existing = collections.ChainMap( *( {f.name: k} for b in bases if isinstance(b, Source.Schema) for c in reversed(inspect.getmro(b)) for k, f in c.__dict__.items() if isinstance(f, _struct.Field) and k not in seen and not seen.add(k) ) ) if existing and len(existing.maps) > len(existing): raise _exception.GrammarError(f'Colliding base classes in schema {name}') for key, field in namespace.items(): if not isinstance(field, _struct.Field): continue if not field.name: namespace[key] = field = field.renamed(key) # to normalize so that hash/eq is consistent if field.name in existing and existing[field.name] != key: raise _exception.GrammarError(f'Colliding field name {field.name} in schema {name}') existing[field.name] = key cls = super().__new__(mcs, name, bases, namespace) cls.__qualname__ = f'{name}.schema' return cls def __hash__(cls): # pylint: disable=not-an-iterable return functools.reduce(operator.xor, (hash(f) for f in cls), 0) def __eq__(cls, other: 'dsl.Source.Schema'): return ( isinstance(other, cls.__class__) and len(cls) == len(other) and all(c == o for c, o in zip(cls, other)) ) def __len__(cls): return sum(1 for _ in cls) # pylint: disable=not-an-iterable def __repr__(cls): return f'{cls.__module__}:{cls.__qualname__}' @functools.lru_cache def __getitem__(cls, name: str) -> 'dsl.Field': try: item = getattr(cls, name) except AttributeError: for field in cls: # pylint: disable=not-an-iterable if name == field.name: return field else: if isinstance(item, _struct.Field): return item raise KeyError(f'Unknown field {name}') def __iter__(cls) -> typing.Iterator['dsl.Field']: return iter( { k: f for c in reversed(inspect.getmro(cls)) for k, f in c.__dict__.items() if isinstance(f, _struct.Field) }.values() ) copyreg.pickle( Schema, lambda s: ( Source.Schema, (s.__name__, s.__bases__, {k: f for k, f in s.__dict__.items() if isinstance(f, _struct.Field)}), ), ) class Visitor: """Source visitor.""" def visit_source(self, source: 'dsl.Source') -> None: # pylint: disable=unused-argument """Generic source hook. Args: source: Source instance to be visited. """ def visit_table(self, source: 'dsl.Table') -> None: """Table hook. Args: source: Source instance to be visited. """ self.visit_source(source) def visit_reference(self, source: 'dsl.Reference') -> None: """Reference hook. Args: source: Instance to be visited. """ source.instance.accept(self) self.visit_source(source) def visit_join(self, source: 'dsl.Join') -> None: """Join hook. Args: source: Instance to be visited. """ source.left.accept(self) source.right.accept(self) self.visit_source(source) def visit_set(self, source: 'dsl.Set') -> None: """Set hook. Args: source: Instance to be visited. """ source.left.accept(self) source.right.accept(self) self.visit_source(source) def visit_query(self, source: 'dsl.Query') -> None: """Query hook. Args: source: Instance to be visited. """ source.source.accept(self) self.visit_source(source) def __new__(cls, *args): return super().__new__(cls, args) def __getnewargs__(self): return tuple(self) def __hash__(self): return hash(self.__class__.__module__) ^ hash(self.__class__.__qualname__) ^ super().__hash__() def __repr__(self): return f'{self.__class__.__name__}({", ".join(repr(a) for a in self)})' def __getattr__(self, name: str) -> 'dsl.Feature': try: return self[name] except KeyError as err: raise AttributeError(f'Invalid feature {name}') from err @functools.lru_cache def __getitem__(self, name: typing.Union[int, str]) -> typing.Any: try: return super().__getitem__(name) except (TypeError, IndexError) as err: name = self.schema[name].name for field, feature in zip(self.schema, self.features): if name == field.name: return feature raise RuntimeError(f'Inconsistent {name} lookup vs schema iteration') from err @abc.abstractmethod def accept(self, visitor: 'dsl.Source.Visitor') -> None: """Visitor acceptor. Args: visitor: Visitor instance. """ @functools.cached_property def schema(self) -> 'dsl.Source.Schema': """Schema type representing this source. Returns: Schema type. """ return self.Schema( self.__class__.__name__, (_struct.Schema.schema,), {(c.name or f'_{i}'): _struct.Field(c.kind, c.name) for i, c in enumerate(self.features)}, ) @functools.cached_property @abc.abstractmethod def features(self) -> typing.Sequence['dsl.Feature']: """List of features logically contained in or potentially produced by this Source. Returns: Sequence of contained features. """ @property def query(self) -> 'dsl.Query': """Query equivalent of this Source. Returns: Query instance. """ return Query(self) @property def statement(self) -> 'dsl.Statement': """Statement equivalent of this Source. Returns: Statement instance. """ return self.query @property def instance(self) -> 'dsl.Source': """Return the source instance. Apart from the ``Reference`` type is the Source itself. Returns: Source instance. """ return self def reference(self, name: typing.Optional[str] = None) -> 'dsl.Reference': """Get an independent reference to this Source (e.g. for self-join conditions). Args: name: Optional alias to be used for this reference (random by default). Returns: New reference to this Source. Examples: >>> manager = staff.Employee.reference('manager') >>> subs = ( ... manager.join(staff.Employee, staff.Employee.manager == manager.id) ... .select(manager.name, function.Count(staff.Employee.id).alias('subs')) ... .groupby(manager.id) ... ) """ return Reference(self, name) def union(self, other: 'dsl.Source') -> 'dsl.Set': """Create a new Source as a set union of this and the other Source. Args: other: Source to union with. Returns: Set instance. Examples: >>> barbaz = ( ... foo.Bar.select(foo.Bar.X, foo.Bar.Y) ... .union(foo.Baz.select(foo.Baz.X, foo.Baz.Y)) ... ) """ return Set(self, other, Set.Kind.UNION) def intersection(self, other: 'dsl.Source') -> 'dsl.Set': """Create a new Source as a set intersection of this and the other Source. Args: other: Source to intersect with. Returns: Set instance. Examples: >>> barbaz = ( ... foo.Bar.select(foo.Bar.X, foo.Bar.Y) ... .intersection(foo.Baz.select(foo.Baz.X, foo.Baz.Y)) ... ) """ return Set(self, other, Set.Kind.INTERSECTION) def difference(self, other: 'dsl.Source') -> 'dsl.Set': """Create a new Source as a set difference of this and the other Source. Args: other: Source to difference with. Returns: Set instance. Examples: >>> barbaz = ( ... foo.Bar.select(foo.Bar.X, foo.Bar.Y) ... .difference(foo.Baz.select(foo.Baz.X, foo.Baz.Y)) ... ) """ return Set(self, other, Set.Kind.DIFFERENCE) class Statement(Source, metaclass=abc.ABCMeta): """Base class for complete statements. Complete statements are: * :class:`forml.io.dsl.Query` * :class:`forml.io.dsl.Set`. """ class Set(Statement): """Source made of two set-combined sub-statements with the same schema. Attention: Instances are expected to be created internally via: * :meth:`dsl.Source.union() <forml.io.dsl.Source.union>` * :meth:`dsl.Source.intersection() <forml.io.dsl.Source.intersection>` * :meth:`dsl.Source.difference() <forml.io.dsl.Source.difference>` """ @enum.unique class Kind(enum.Enum): """Set type enum.""" UNION = 'union' """Union set operation type.""" INTERSECTION = 'intersection' """Intersection set operation type.""" DIFFERENCE = 'difference' """Difference set operation type.""" left: 'dsl.Statement' = property(operator.itemgetter(0)) """Left side of the set operation.""" right: 'dsl.Statement' = property(operator.itemgetter(1)) """Right side of the set operation.""" kind: 'dsl.Set.Kind' = property(operator.itemgetter(2)) """Set operation enum type.""" def __new__(cls, left: 'dsl.Source', right: 'dsl.Source', kind: 'dsl.Set.Kind'): if left.schema != right.schema: raise _exception.GrammarError('Incompatible sources') return super().__new__(cls, left.statement, right.statement, kind) def __repr__(self): return f'{repr(self.left)} {self.kind.value} {repr(self.right)}' @property def statement(self) -> 'dsl.Statement': return self @functools.cached_property def features(self) -> typing.Sequence['dsl.Feature']: return self.left.features + self.right.features def accept(self, visitor: 'dsl.Source.Visitor') -> None: visitor.visit_set(self) class Queryable(Source, metaclass=abc.ABCMeta): """Base class for any *Source* that can be queried directly.""" def select(self, *features: 'dsl.Feature') -> 'dsl.Query': """Specify the output features to be provided (projection). Repeated calls to ``.select`` replace the earlier selection. Args: features: Sequence of features. Returns: Query instance. Examples: >>> barxy = foo.Bar.select(foo.Bar.X, foo.Bar.Y) """ return self.query.select(*features) def where(self, condition: 'dsl.Predicate') -> 'dsl.Query': """Add a row-filtering condition that's evaluated before any aggregations. Repeated calls to ``.where`` combine all the conditions (logical AND). Args: condition: Boolean feature expression. Returns: Query instance. Examples: >>> barx10 = foo.Bar.where(foo.Bar.X == 10) """ return self.query.where(condition) def having(self, condition: 'dsl.Predicate') -> 'dsl.Query': """Add a row-filtering condition that's applied to the evaluated aggregations. Repeated calls to ``.having`` combine all the conditions (logical AND). Args: condition: Boolean feature expression. Returns: Query instance. Examples: >>> bargy10 = foo.Bar.groupby(foo.Bar.X).having(function.Count(foo.Bar.Y) == 10) """ return self.query.having(condition) def groupby(self, *features: 'dsl.Operable') -> 'dsl.Query': """Aggregation grouping specifiers. Repeated calls to ``.groupby`` replace the earlier grouping. Args: features: Sequence of aggregation features. Returns: Query instance. Examples: >>> bargbx = foo.Bar.groupby(foo.Bar.X).select(foo.Bar.X, function.Count(foo.Bar.Y)) """ return self.query.groupby(*features) def orderby(self, *terms: 'dsl.Ordering.Term') -> 'dsl.Query': """Ordering specifiers. Default direction is *ascending*. Repeated calls to ``.orderby`` replace the earlier ordering. Args: terms: Sequence of feature and direction tuples. Returns: Query instance. Examples: >>> barbyx = foo.Bar.orderby(foo.Bar.X) >>> barbyxd = foo.Bar.orderby(foo.Bar.X, 'desc') >>> barbxy = foo.Bar.orderby(foo.Bar.X, foo.Bar.Y) >>> barbxdy = foo.Bar.orderby( ... foo.Bar.X, dsl.Ordering.Direction.DESCENDING, foo.Bar.Y, 'asc' ... ) >>> barbydxd = foo.Bar.orderby( ... (foo.Bar.X, 'desc'), ... (foo.Bar.Y, dsl.Ordering.Direction.DESCENDING), ... ) """ return self.query.orderby(*terms) def limit(self, count: int, offset: int = 0) -> 'dsl.Query': """Restrict the result rows by its max *count* with an optional *offset*. Repeated calls to ``.limit`` replace the earlier restriction. Args: count: Number of rows to return. offset: Skip the given number of rows. Returns: Query instance. Examples: >>> bar10 = foo.Bar.limit(10) """ return self.query.limit(count, offset) class Origin(Queryable, metaclass=abc.ABCMeta): """Origin is a queryable Source with some handle. Its features are represented using :class:`dsl.Element <forml.io.dsl.Element>`. """ @property @abc.abstractmethod def features(self) -> typing.Sequence['dsl.Element']: """Origin features are instances of ``dsl.Element``. Returns: Sequence of ``dsl.Element`` instances. """ def inner_join(self, other: 'dsl.Origin', condition: 'dsl.Predicate') -> 'dsl.Join': """Construct an *inner* join with the other *origin* using the provided *condition*. Args: other: Source to join with. condition: Feature expression as the join condition. Returns: Join instance. Examples: >>> barbaz = foo.Bar.inner_join(foo.Baz, foo.Bar.baz == foo.Baz.id) """ return Join(self, other, Join.Kind.INNER, condition) def left_join(self, other: 'dsl.Origin', condition: 'dsl.Predicate') -> 'dsl.Join': """Construct a *left* join with the other *origin* using the provided *condition*. Args: other: Source to join with. condition: Feature expression as the join condition. Returns: Join instance. Examples: >>> barbaz = foo.Bar.left_join(foo.Baz, foo.Bar.baz == foo.Baz.id) """ return Join(self, other, Join.Kind.LEFT, condition) def right_join(self, other: 'dsl.Origin', condition: 'dsl.Predicate') -> 'dsl.Join': """Construct a *right* join with the other *origin* using the provided *condition*. Args: other: Source to join with. condition: Feature expression as the join condition. Returns: Join instance. Examples: >>> barbaz = foo.Bar.right_join(foo.Baz, foo.Bar.baz == foo.Baz.id) """ return Join(self, other, Join.Kind.RIGHT, condition) def full_join(self, other: 'dsl.Origin', condition: 'dsl.Predicate') -> 'dsl.Join': """Construct a *full* join with the other *origin* using the provided *condition*. Args: other: Source to join with. condition: Feature expression as the join condition. Returns: Join instance. Examples: >>> barbaz = foo.Bar.full_join(foo.Baz, foo.Bar.baz == foo.Baz.id) """ return Join(self, other, Join.Kind.FULL, condition) def cross_join(self, other: 'dsl.Origin') -> 'dsl.Join': """Construct a *cross* join with the other *origin*. Args: other: Source to join with. Returns: Join instance. Examples: >>> barbaz = foo.Bar.cross_join(foo.Baz) """ return Join(self, other, kind=Join.Kind.CROSS) class Join(Origin): """Source made of two join-combined sub-sources. Attention: Instances are expected to be created internally via: * :meth:`dsl.Origin.inner_join() <forml.io.dsl.Origin.inner_join>` * :meth:`dsl.Origin.left_join() <forml.io.dsl.Origin.left_join>` * :meth:`dsl.Origin.right_join() <forml.io.dsl.Origin.right_join>` * :meth:`dsl.Origin.full_join() <forml.io.dsl.Origin.full_join>` * :meth:`dsl.Origin.cross_join() <forml.io.dsl.Origin.cross_join>` """ @enum.unique class Kind(enum.Enum): """Join type enum.""" INNER = 'inner' """Inner join type (default if *condition* is provided).""" LEFT = 'left' """Left outer join type.""" RIGHT = 'right' """Right outer join type.""" FULL = 'full' """Full join type.""" CROSS = 'cross' """Cross join type (default if *condition* is not provided).""" def __repr__(self): return f'<{self.value}-join>' left: 'dsl.Origin' = property(operator.itemgetter(0)) """Left side of the join operation.""" right: 'dsl.Origin' = property(operator.itemgetter(1)) """Right side of the join operation.""" kind: 'dsl.Join.Kind' = property(operator.itemgetter(2)) """Join type.""" condition: typing.Optional['dsl.Predicate'] = property(operator.itemgetter(3)) """Join condition (invalid for *CROSS*-join).""" def __new__( cls, left: 'dsl.Origin', right: 'dsl.Origin', kind: typing.Union['dsl.Join.Kind', str], condition: typing.Optional['dsl.Predicate'] = None, ): if (kind is cls.Kind.CROSS) ^ (condition is None): raise _exception.GrammarError('Illegal use of condition and join type') if condition is not None: condition = series.Cumulative.ensure_notin(series.Predicate.ensure_is(condition)) if not series.Element.dissect(condition).issubset(series.Element.dissect(*left.features, *right.features)): raise _exception.GrammarError( f'({condition}) not a subset of source features ({left.features}, {right.features})' ) return super().__new__(cls, left, right, kind, condition) def __repr__(self): return f'{repr(self.left)}{repr(self.kind)}{repr(self.right)}' @functools.cached_property def features(self) -> typing.Sequence['dsl.Element']: return self.left.features + self.right.features def accept(self, visitor: 'dsl.Source.Visitor') -> None: visitor.visit_join(self) class Reference(Origin): """Wrapper around any *Source* associating it with a (possibly random) name. Attention: Instances are expected to be created internally via :meth:`dsl.Source.reference <forml.io.dsl.Source.reference>`. """ _NAMELEN: int = 8 instance: 'dsl.Source' = property(operator.itemgetter(0)) """Wrapped *Source* instance.""" name: str = property(operator.itemgetter(1)) """Reference name.""" def __new__(cls, instance: 'dsl.Source', name: typing.Optional[str] = None): if not name: name = ''.join(random.choice(string.ascii_lowercase) for _ in range(cls._NAMELEN)) return super().__new__(cls, instance.instance, name) def __repr__(self): return f'{self.name}=[{repr(self.instance)}]' @functools.cached_property def features(self) -> typing.Sequence['dsl.Element']: return tuple(series.Element(self, c.name) for c in self.instance.features) @property def schema(self) -> 'dsl.Source.Schema': return self.instance.schema def accept(self, visitor: 'dsl.Source.Visitor') -> None: """Visitor acceptor. Args: visitor: Visitor instance. """ visitor.visit_reference(self) class Table(Origin): """Table based *Source* with an explicit *schema*. Attention: The primary way of creating ``Table`` instances is by inheriting the :class:`dsl.Schema <forml.io.dsl.Schema>` which is using this type as a meta-class. """ class Meta(abc.ABCMeta): """Metaclass for dynamic parent classes.""" copyreg.pickle( Meta, lambda c: ( Table.Meta, (c.__name__, c.__bases__, {}), ), ) @typing.overload def __new__( # pylint: disable=bad-classmethod-argument mcs, name: str, bases: tuple[type], namespace: dict[str, typing.Any], ): """Meta-class mode constructor. Args: name: Table class name. bases: Table base classes. namespace: Class namespace container. """ @typing.overload def __new__(cls, schema: 'dsl.Source.Schema'): """Standard class mode constructor. Args: schema: Table *schema* type. """ def __new__(mcs, schema, bases=None, namespace=None): # pylint: disable=bad-classmethod-argument if isinstance(schema, str): # used as metaclass if bases: bases = tuple(b.schema for b in bases if isinstance(b, Table)) # strip the parent base class and namespace mcs = mcs.Meta(schema, mcs.__bases__, {}) # pylint: disable=self-cls-assignment elif not any(isinstance(a, _struct.Field) for a in namespace.values()): # used as a base class definition - let's propagate the namespace mcs = mcs.Meta(schema, (mcs,), namespace) # pylint: disable=self-cls-assignment schema = mcs.Schema(schema, bases, namespace) elif bases or namespace: raise TypeError('Unexpected use of schema table') return super().__new__(mcs, schema) # used as constructor def __repr__(self): return self.schema.__name__ @property def schema(self) -> 'dsl.Source.Schema': return self[0] @functools.cached_property def features(self) -> typing.Sequence['dsl.Column']: return tuple(series.Column(self, f.name) for f in self.schema) def accept(self, visitor: 'dsl.Source.Visitor') -> None: visitor.visit_table(self) class Query(Queryable, Statement): """Query based *Source*. Container for holding all the parameters supplied via the :class:`dsl.Queryable <forml.io.dsl.Queryable>` interface. Attention: Instances are expected to be created internally via the ``dsl.Queryable`` interface methods. """ source: 'dsl.Source' = property(operator.itemgetter(0)) """Base *Source* to query *FROM*.""" selection: tuple['dsl.Feature'] = property(operator.itemgetter(1)) """Result projection features.""" prefilter: typing.Optional['dsl.Predicate'] = property(operator.itemgetter(2)) """Row-filtering condition to be applied before potential aggregations.""" grouping: tuple['dsl.Operable'] = property(operator.itemgetter(3)) """Aggregation grouping specifiers.""" postfilter: typing.Optional['dsl.Predicate'] = property(operator.itemgetter(4)) """Row-filtering condition to be applied after aggregations.""" ordering: tuple['dsl.Ordering'] = property(operator.itemgetter(5)) """Ordering specifiers.""" rows: typing.Optional['dsl.Rows'] = property(operator.itemgetter(6)) """Row restriction limit.""" def __new__( cls, source: 'dsl.Source', selection: typing.Optional[typing.Iterable['dsl.Feature']] = None, prefilter: typing.Optional['dsl.Predicate'] = None, grouping: typing.Optional[typing.Iterable['dsl.Operable']] = None, postfilter: typing.Optional['dsl.Predicate'] = None, ordering: typing.Optional[typing.Sequence['dsl.Ordering.Term']] = None, rows: typing.Optional['dsl.Rows'] = None, ): def ensure_subset(*features: 'dsl.Feature') -> typing.Sequence['dsl.Feature']: """Ensure the provided features is a valid subset of the available Source features. Args: *features: List of features to validate. Returns: Original list of features if all valid. """ if not series.Element.dissect(*features).issubset(superset): raise _exception.GrammarError(f'{features} not a subset of source features: {superset}') return features superset = series.Element.dissect(*source.features) selection = tuple(ensure_subset(*(series.Feature.ensure_is(c) for c in selection or []))) if prefilter is not None: prefilter = series.Cumulative.ensure_notin( series.Predicate.ensure_is(*ensure_subset(series.Operable.ensure_is(prefilter))) ) if grouping: grouping = ensure_subset(*(series.Cumulative.ensure_notin(series.Operable.ensure_is(g)) for g in grouping)) for aggregate in {c.operable for c in selection or source.features}.difference(grouping): series.Aggregate.ensure_in(aggregate) if postfilter is not None: postfilter = series.Window.ensure_notin( series.Predicate.ensure_is(*ensure_subset(series.Operable.ensure_is(postfilter))) ) ordering = tuple(series.Ordering.make(*(ordering or []))) ensure_subset(*(o.feature for o in ordering)) return super().__new__(cls, source, selection, prefilter, tuple(grouping or []), postfilter, ordering, rows) def __repr__(self): value = repr(self.source) if self.selection: value += f'[{", ".join(repr(c) for c in self.selection)}]' if self.prefilter: value += f'.where({repr(self.prefilter)})' if self.grouping: value += f'.groupby({", ".join(repr(c) for c in self.grouping)})' if self.postfilter: value += f'.having({repr(self.postfilter)})' if self.ordering: value += f'.orderby({", ".join(repr(c) for c in self.ordering)})' if self.rows: value += f'[{repr(self.rows)}]' return value @property def query(self) -> 'dsl.Query': return self @functools.cached_property def features(self) -> typing.Sequence['dsl.Feature']: """Get the list of features supplied by this query. Returns: A sequence of supplying features. """ return self.selection if self.selection else self.source.features def accept(self, visitor: 'dsl.Source.Visitor') -> None: visitor.visit_query(self) def select(self, *features: 'dsl.Feature') -> 'dsl.Query': return Query(self.source, features, self.prefilter, self.grouping, self.postfilter, self.ordering, self.rows) def where(self, condition: 'dsl.Predicate') -> 'dsl.Query': if self.prefilter is not None: condition &= self.prefilter return Query(self.source, self.selection, condition, self.grouping, self.postfilter, self.ordering, self.rows) def having(self, condition: 'dsl.Predicate') -> 'dsl.Query': if self.postfilter is not None: condition &= self.postfilter return Query(self.source, self.selection, self.prefilter, self.grouping, condition, self.ordering, self.rows) def groupby(self, *features: 'dsl.Operable') -> 'dsl.Query': return Query(self.source, self.selection, self.prefilter, features, self.postfilter, self.ordering, self.rows) def orderby(self, *terms: 'dsl.Ordering.Term') -> 'dsl.Query': return Query(self.source, self.selection, self.prefilter, self.grouping, self.postfilter, terms, self.rows) def limit(self, count: int, offset: int = 0) -> 'dsl.Query': return Query( self.source, self.selection, self.prefilter, self.grouping, self.postfilter, self.ordering, Rows(count, offset), )
[ "antonymayi@yahoo.com" ]
antonymayi@yahoo.com
a0be7c11d79e85d00ece19127980488c6049cee5
2933b8f123981f88e576e7ba5baa5143c3667019
/_testing/utils/subscription.py
cce06a6f7d97a2c2279aed54db1c9095aa986f69
[ "MIT" ]
permissive
MatthiasLienhard/pysmartnode
c6a9b4819cddcf1b928eecc385cef087a832e5cb
f853efb3378d881dd2e62eec2ca1621898953c19
refs/heads/master
2020-09-04T09:31:45.302398
2019-07-07T06:14:55
2019-07-07T06:14:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,829
py
''' Created on 18.02.2018 @author: Kevin K�ck ''' __version__ = "0.2" __updated__ = "2018-03-09" import gc from pysmartnode.utils.wrappers.timeit import timeit memory = gc.mem_free() gc.collect() def printMemory(info=""): global memory memory_new = gc.mem_free() print("[RAM] [{!s}] {!s}".format(info, memory_new - memory)) memory = memory_new def creating(): gc.collect() printMemory("Start") from pysmartnode.utils.subscriptionHandlers.subscription import SubscriptionHandler gc.collect() printMemory("After import") global handler handler = SubscriptionHandler() gc.collect() printMemory("After handler creation") @timeit def addObjects(): for j in range(0, 3): for i in range(0, 10): handler.addObject("home/235j094s4eg/device{!s}/htu{!s}".format(j, i), "func{!s}".format(i)) @timeit def getObject(): return handler.getFunctions("home/235j094s4eg/device2/htu9") @timeit def getObjectDirectly(): return handler.get("home/235j094s4eg/device2/htu9", 1) @timeit def addObjectsList(): for j in range(0, 3): for i in range(0, 10): a.append(("home/235j094s4eg/device{!s}/htu{!s}".format(j, i), "func{!s}".format(i))) @timeit def getObjectList(): for i in a: if i[0] == "home/235j094s4eg/device3/htu9": return i[1] def speedtest(): creating() gc.collect() printMemory("after creation with no Objects") addObjects() gc.collect() printMemory("30 Objects") print(getObject()) gc.collect() print(getObjectDirectly()) gc.collect() printMemory("Subscription test done") print("Comparison to list") global a a = [] gc.collect() printMemory("List created") addObjectsList() gc.collect() printMemory("Added 30 objects to list") print(getObjectList()) gc.collect() printMemory("List comparison done") speedtest() print("Functional test") def test(): from pysmartnode.utils.subscriptionHandlers.subscription import SubscriptionHandler handler = SubscriptionHandler() handler.addObject("home/test/htu", "func1") handler.addObject("home/test2/htu", "func2") handler.addObject("home/test3/htu2", "func3") print(handler.getFunctions("home/test/htu")) print(handler.getFunctions("home/test2/htu")) print(handler.getFunctions("home/test3/htu2")) handler.setFunctions("home/test3/htu2", "func_test") print(handler.getFunctions("home/test3/htu2")) try: print(handler.getFunctions("home/test5/htu2")) except Exception as e: print(e) handler.removeObject("home/test2/htu") try: print(handler.getFunctions("home/test2/htu")) except Exception as e: print(e) print(handler.getFunctions("home/test3/htu2")) handler.addObject("home/1325/ds18", "funcDS") print("Multiple subscriptions test") handler.addObject("home/1325/ds18", "funcDS2") print("ds18", handler.get("home/1325/ds18", 1)) return handler test() print("Test finished") """ >>> from _testing.utils import subscription [RAM] [Start] -336 [RAM] [After import] -992 [RAM] [After handler creation] -32 [RAM] [after creation with no Objects] 0 [Time] Function addObjects: 612.455ms [RAM] [30 Objects] -3552 [Time] Function getObject: 5.920ms func9 [Time] Function getObjectDirectly: 5.813ms func9 [RAM] [Subscription test done] 0 Comparison to list [RAM] [List created] -32 [Time] Function addObjectsList: 496.705ms [RAM] [Added 30 objects to list] -2704 [Time] Function getObjectList: 2.223ms None [RAM] [List comparison done] 0 Functional test func1 func2 func3 func_test Object home/test5/htu2 does not exist Object home/test2/htu does not exist func_test Multiple subscriptions test ds18 ['funcDS', 'funcDS2'] Test finished """
[ "kevinkk525@users.noreply.github.com" ]
kevinkk525@users.noreply.github.com
f72325a934916e12a434f42884e773a3cba383ff
18e10db2ac29420dadf40fc1185091a1e827d6b8
/tools/auto_freeze.py
7585016ac6fde70896d9e67ce36bcbfb70d0f881
[ "Apache-2.0" ]
permissive
liuxiaoliu321/faceboxes-tensorflow
a853fb86b8c1ee895028e4ce35f141f8f3ff158c
39d12704cf9c1da324bb439b6e8a72c8b4d01d34
refs/heads/master
2020-08-08T08:05:57.379527
2019-09-25T04:06:25
2019-09-25T04:06:25
null
0
0
null
null
null
null
UTF-8
Python
false
false
688
py
import os import tensorflow as tf os.environ["CUDA_VISIBLE_DEVICES"] = "-1" model_folder = './model' checkpoint = tf.train.get_checkpoint_state(model_folder) ##input_checkpoint input_checkpoint = checkpoint.model_checkpoint_path ##input_graph input_meta_graph = input_checkpoint + '.meta' ##output_node_names output_node_names='tower_0/images,tower_0/boxes,tower_0/scores,tower_0/num_detections,training_flag' #output_graph output_graph='./model/detector.pb' print('excuted') command="python tools/freeze.py --input_checkpoint %s --input_meta_graph %s --output_node_names %s --output_graph %s"\ %(input_checkpoint,input_meta_graph,output_node_names,output_graph) os.system(command)
[ "2120140200@mail.nankai.edu.cn" ]
2120140200@mail.nankai.edu.cn
6164a6e1eeaf57eb5e6c08c6f244aee8f956ada5
36943501114b8c6bfd59d248507140956a0d7c29
/PSCC20/diagram2.py
08914fee7ab952f524ee6b2c67f9f772837cc2c6
[]
no_license
Constancellc/Demand-Model
9c45ea1a9d9779c9da093f221a5851b168a45eac
e261371b7aa9aea113617a7cbe8176a5c5d9591c
refs/heads/master
2021-01-13T10:32:40.243847
2020-08-21T09:49:14
2020-08-21T09:49:14
76,476,909
0
0
null
null
null
null
UTF-8
Python
false
false
2,767
py
import matplotlib.pyplot as plt import numpy as np import random from scenarios import generate from cvxopt import matrix, spdiag, sparse, solvers, spmatrix scen = generate(5,10) def optimise(scen,en): Q = spdiag([1.0]*48) p = [0.0]*48 for i in range(len(scen)): for t in range(48): p[t] += scen[i][0]*scen[i][t+1] p = matrix(p) A = matrix(1.0/2,(1,48)) b = matrix([float(en)]) G = spdiag([-1.0]*48) h = matrix([0.0]*48) sol=solvers.qp(Q,p,G,h,A,b) x = sol['x'] return x def get_range(profiles,offset=0,new=[0]*48): _p1 = [] _p2 = [] _p3 = [] _p4 = [] _p5 = [] for t in range(48): y = [] for i in range(len(profiles)): y.append(profiles[i][t+offset]) y = sorted(y) _p1.append(y[int(len(y)*0.1)]+new[t]) _p2.append(y[int(len(y)*0.3)]+new[t]) _p3.append(y[int(len(y)*0.5)]+new[t]) _p4.append(y[int(len(y)*0.7)]+new[t]) _p5.append(y[int(len(y)*0.9)]+new[t]) return _p1,_p2,_p3,_p4,_p5 x = optimise(scen,100000) plt.figure() plt.figure(figsize=(6,3)) plt.rcParams["font.family"] = 'serif' plt.rcParams["font.size"] = '10' plt.subplot(1,2,1) _p1,_p2,_p3,_p4,_p5 = get_range(scen,offset=1) plt.fill_between(range(48),_p1,_p5,color='#bfddff') plt.fill_between(range(48),_p2,_p4,color='#80bbff') plt.yticks([10000,20000,30000,40000,50000],['10','20','30','40','50']) plt.xticks([7.5,23.5,39.5],['04:00','12:00','20:00']) plt.plot(_p3,c='#0077ff') plt.grid(ls=':') plt.ylabel('Power (GW)') plt.title('Before') plt.xlim(0,47) plt.ylim(20000,50000) plt.subplot(1,2,2) _p1,_p2,_p3,_p4,_p5 = get_range(scen,offset=1,new=x) plt.fill_between(range(48),_p1,_p5,color='#bfddff') plt.fill_between(range(48),_p2,_p4,color='#80bbff') plt.yticks([20000,30000,40000,50000],['20','30','40','50']) plt.xticks([7.5,23.5,39.5],['04:00','12:00','20:00']) plt.plot(_p3,c='#0077ff') plt.grid(ls=':') plt.title('After') plt.xlim(0,47) plt.ylim(20000,50000) plt.tight_layout() plt.savefig('../../Dropbox/papers/PSCC-20/img/optimise.eps', format='eps', dpi=300, bbox_inches='tight', pad_inches=0) plt.figure() plt.figure(figsize=(5,3)) plt.rcParams["font.family"] = 'serif' plt.rcParams["font.size"] = '10' plt.plot(scen[0][1:],c='k',ls=':',label='Existing Demand') x = optimise([[1.0]+scen[15][1:]],10000) p = [] for t in range(48): p.append(x[t]+scen[15][t+1]) plt.plot(p,c='b',label='With Smart Charging') plt.grid(ls=':') plt.legend() plt.xlim(0,47) plt.ylim(20000,50000) plt.yticks([20000,30000,40000,50000],['20','30','40','50']) plt.xticks([7.5,23.5,39.5],['04:00','12:00','20:00']) plt.ylabel('Power (GW)') plt.tight_layout() plt.show() #def optimise(scenarios,en):
[ "constancellc@gmail.com" ]
constancellc@gmail.com
96651c78fdaf73c97fb27cee2bf6e03ac6fc686e
4fc9c61450de38ce003e20e0452af3e636f28be3
/language_model/layer/dense.py
44fac721feea8ae136f6de4d920fb94e1aa7ae72
[ "Apache-2.0" ]
permissive
SunYanCN/language_model_tf
a6c453c3c3aa1b34ac240cff94674e9eaa679ec9
d39f335e5410d2bd7a23760dedbfcca36338d591
refs/heads/master
2020-05-02T03:58:59.634898
2019-05-24T20:31:52
2019-05-24T20:31:52
177,740,244
0
0
Apache-2.0
2019-12-30T06:17:43
2019-03-26T07:56:25
Python
UTF-8
Python
false
false
12,831
py
import numpy as np import tensorflow as tf from util.default_util import * from util.language_model_util import * from layer.basic import * __all__ = ["Dense", "DoubleDense", "StackedDense", "StackedDoubleDense"] class Dense(object): """dense layer""" def __init__(self, unit_dim, activation, dropout, layer_dropout=0.0, layer_norm=False, residual_connect=False, use_bias=False, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope="dense"): """initialize dense layer""" self.unit_dim = unit_dim self.activation = activation self.dropout = dropout self.layer_dropout = layer_dropout self.layer_norm = layer_norm self.residual_connect = residual_connect self.use_bias = use_bias self.regularizer = regularizer self.random_seed = random_seed self.trainable = trainable self.scope = scope self.device_spec = get_device_spec(default_gpu_id, num_gpus) with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): weight_initializer = create_variable_initializer("glorot_uniform", self.random_seed) bias_initializer = create_variable_initializer("zero") self.dense_layer = tf.layers.Dense(units=self.unit_dim, activation=None, use_bias=self.use_bias, kernel_initializer=weight_initializer, bias_initializer=bias_initializer, kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable) self.dense_activation = create_activation_function(self.activation) self.dropout_layer = Dropout(rate=self.dropout, num_gpus=num_gpus, default_gpu_id=default_gpu_id, random_seed=self.random_seed) if self.layer_norm == True: self.norm_layer = LayerNorm(layer_dim=self.unit_dim, num_gpus=num_gpus, default_gpu_id=default_gpu_id, trainable=self.trainable) def __call__(self, input_data, input_mask): """call dense layer""" with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): input_dense = input_data input_dense_mask = input_mask if self.layer_norm == True: input_dense, input_dense_mask = self.norm_layer(input_dense, input_dense_mask) input_dense = self.dense_layer(input_dense) if self.dense_activation != None: input_dense = self.dense_activation(input_dense) input_dense, input_dense_mask = self.dropout_layer(input_dense, input_dense_mask) if self.residual_connect == True: output_dense, output_mask = tf.cond(tf.random_uniform([]) < self.layer_dropout, lambda: (input_data, input_mask), lambda: (input_dense + input_data, input_mask)) else: output_dense = input_dense output_mask = input_mask return output_dense, output_mask class DoubleDense(object): """double-dense layer""" def __init__(self, unit_dim, inner_scale, activation, dropout, layer_dropout=0.0, layer_norm=False, residual_connect=False, use_bias=False, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope="double_dense"): """initialize double-dense layer""" self.unit_dim = unit_dim self.inner_scale = inner_scale self.activation = activation self.dropout = dropout self.layer_dropout = layer_dropout self.layer_norm = layer_norm self.residual_connect = residual_connect self.use_bias = use_bias self.regularizer = regularizer self.random_seed = random_seed self.trainable = trainable self.scope = scope self.device_spec = get_device_spec(default_gpu_id, num_gpus) with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): weight_initializer = create_variable_initializer("glorot_uniform", self.random_seed) bias_initializer = create_variable_initializer("zero") self.inner_dense_layer = tf.layers.Dense(units=self.unit_dim * self.inner_scale, activation=None, use_bias=self.use_bias, kernel_initializer=weight_initializer, bias_initializer=bias_initializer, kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable) self.outer_dense_layer = tf.layers.Dense(units=self.unit_dim, activation=None, use_bias=self.use_bias, kernel_initializer=weight_initializer, bias_initializer=bias_initializer, kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable) self.dense_activation = create_activation_function(self.activation) self.dropout_layer = Dropout(rate=self.dropout, num_gpus=num_gpus, default_gpu_id=default_gpu_id, random_seed=self.random_seed) if self.layer_norm == True: self.norm_layer = LayerNorm(layer_dim=self.unit_dim, num_gpus=num_gpus, default_gpu_id=default_gpu_id, trainable=self.trainable) def __call__(self, input_data, input_mask): """call double-dense layer""" with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): input_dense = input_data input_dense_mask = input_mask if self.layer_norm == True: input_dense, input_dense_mask = self.norm_layer(input_dense, input_dense_mask) input_dense = self.inner_dense_layer(input_dense) if self.dense_activation != None: input_dense = self.dense_activation(input_dense) input_dense = self.outer_dense_layer(input_dense) input_dense, input_dense_mask = self.dropout_layer(input_dense, input_dense_mask) if self.residual_connect == True: output_dense, output_mask = tf.cond(tf.random_uniform([]) < self.layer_dropout, lambda: (input_data, input_mask), lambda: (input_dense + input_data, input_mask)) else: output_dense = input_dense output_mask = input_mask return output_dense, output_mask class StackedDense(object): """stacked dense layer""" def __init__(self, num_layer, unit_dim, activation, dropout, layer_dropout=None, layer_norm=False, residual_connect=False, use_bias=False, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope="stacked_dense"): """initialize stacked dense layer""" self.num_layer = num_layer self.unit_dim = unit_dim self.activation = activation self.dropout = dropout self.layer_dropout = layer_dropout self.layer_norm = layer_norm self.residual_connect = residual_connect self.use_bias = use_bias self.num_gpus = num_gpus self.default_gpu_id = default_gpu_id self.regularizer = regularizer self.random_seed = random_seed self.trainable = trainable self.scope = scope self.device_spec = get_device_spec(default_gpu_id, num_gpus) with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): self.dense_layer_list = [] for i in range(self.num_layer): layer_scope = "layer_{0}".format(i) sublayer_dropout = self.dropout[i] if self.dropout != None else 0.0 sublayer_layer_dropout = self.layer_dropout[i] if self.layer_dropout != None else 0.0 dense_layer = Dense(unit_dim=self.unit_dim, activation=self.activation, dropout=sublayer_dropout, layer_dropout=sublayer_layer_dropout, layer_norm=self.layer_norm, residual_connect=self.residual_connect, use_bias=self.use_bias, num_gpus=self.num_gpus, default_gpu_id=self.default_gpu_id, regularizer=self.regularizer, random_seed=self.random_seed, trainable=self.trainable, scope=layer_scope) self.dense_layer_list.append(dense_layer) def __call__(self, input_data, input_mask): """call stacked dense layer""" with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): input_dense = input_data input_dense_mask = input_mask for dense_layer in self.dense_layer_list: input_dense, input_dense_mask = dense_layer(input_dense, input_dense_mask) output_dense = input_dense output_mask = input_dense_mask return output_dense, output_mask class StackedDoubleDense(object): """stacked double-dense layer""" def __init__(self, num_layer, unit_dim, inner_scale, activation, dropout, layer_dropout=None, layer_norm=False, residual_connect=False, use_bias=False, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope="stacked_double_dense"): """initialize stacked double-dense layer""" self.num_layer = num_layer self.unit_dim = unit_dim self.inner_scale = inner_scale self.activation = activation self.dropout = dropout self.layer_dropout = layer_dropout self.layer_norm = layer_norm self.residual_connect = residual_connect self.use_bias = use_bias self.num_gpus = num_gpus self.default_gpu_id = default_gpu_id self.regularizer = regularizer self.random_seed = random_seed self.trainable = trainable self.scope = scope self.device_spec = get_device_spec(default_gpu_id, num_gpus) with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): self.dense_layer_list = [] for i in range(self.num_layer): layer_scope = "layer_{0}".format(i) sublayer_dropout = self.dropout[i] if self.dropout != None else 0.0 sublayer_layer_dropout = self.layer_dropout[i] if self.layer_dropout != None else 0.0 dense_layer = DoubleDense(unit_dim=self.unit_dim, inner_scale=self.inner_scale, activation=self.activation, dropout=sublayer_dropout, layer_dropout=sublayer_layer_dropout, layer_norm=self.layer_norm, residual_connect=self.residual_connect, use_bias=self.use_bias, num_gpus=self.num_gpus, default_gpu_id=self.default_gpu_id, regularizer=self.regularizer, random_seed=self.random_seed, trainable=self.trainable, scope=layer_scope) self.dense_layer_list.append(dense_layer) def __call__(self, input_data, input_mask): """call stacked double-dense layer""" with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec): input_dense = input_data input_dense_mask = input_mask for dense_layer in self.dense_layer_list: input_dense, input_dense_mask = dense_layer(input_dense, input_dense_mask) output_dense = input_dense output_mask = input_dense_mask return output_dense, output_mask
[ "mizheng@microsoft.com" ]
mizheng@microsoft.com
4bb38afed0529d45e57f2e7e834157f55f5bfa9c
c660ae5554a682790061c4ed62a4bc19b4890250
/PruDigital/Django_project/Testform/student_formapp/views.py
580578a31939097c7bf71f85a499323d13acb9f1
[]
no_license
saurabhshukla01/Best-wsbsite
4a63d8e21307cf7f93e240e7ef871477a23cd912
04f5baba1807f71309bebfd2b6675ff408b7e25e
refs/heads/master
2022-05-30T03:32:03.609791
2020-04-21T09:06:23
2020-04-21T09:06:23
257,498,568
0
1
null
null
null
null
UTF-8
Python
false
false
804
py
from django.shortcuts import render from django.http import HttpResponse # Create your views here. ''' def register(request): return HttpResponse('index form') ''' def register_student(request): return render(request,'register_student.html') def show_student(request): stu_dict ={} stu_fname= request.POST.get('fname') stu_lname= request.POST.get('lname') stu_email= request.POST.get('email') stu_image= request.POST.get('file') stu_username= request.POST.get('username') password= request.POST.get('pwd') confirm_password= request.POST.get('cpwd') stu_dict = {'first_name' : stu_fname, 'last_name' :stu_lname , 'email' : stu_email , 'image_path' : stu_image , 'username' : stu_username } return render(request,'show_student.html',stu_dict)
[ "ss7838094755@gmail.com" ]
ss7838094755@gmail.com
f72a1cbc16ee408ae31c70d2d7b8fbbc2a467f92
d5125ccc1ef9915ffd72c575225a620aac5cb347
/TriAquae/TriAquae/sbin/tri_service.py
6a274b9873ac6a2e90ebaec04a55f064edb39479
[]
no_license
yurui829/stefanbo
2231074e0e4f04438aff647563299ad1947bd760
449f862c81a3b4ae3e079ecb4a15b3a5cbcca701
refs/heads/master
2021-01-24T23:42:52.064783
2014-07-02T03:05:04
2014-07-02T03:05:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,813
py
#!/usr/bin/env python import os,sys,time import logger,tri_config,tri_module import django triaquae_path = tri_config.Working_dir working_dir = logger.cur_dir status_check_script = 'host_status_check.py' snmp_monitor_script = 'multiprocessing_snmpMonitor.py' service_log = '%s/tri_service.log' % tri_config.Log_dir snmp_monitor_log = '%s/tri_snmp_service.log' % tri_config.Log_dir def status_monitor(interval): script = '%s/%s' %(working_dir,status_check_script) print "Checking service status....." if service_status(status_check_script) == 'Running': print "\033[33;1mHost Status Monitor service is already running!\033[0m" else: print "Starting HOST Status Monitor Service...." cmd = 'nohup python %s -s %s >> %s 2>&1 &' % (script,interval,service_log) result = os.system(cmd) if result == 0: print '\033[32;1mHost status monitor service started successfully!\n\033[0m' def snmp_monitor(): script = '%s/%s' %(working_dir,snmp_monitor_script) print "Checking snmp status....." if service_status(snmp_monitor_script) == 'Running': print "\033[33;1mTriAquae SNMP monitor service is already running!\033[0m\n" else: print "Starting TriAquae SNMP monitor service...." cmd = 'nohup python %s >> %s 2>&1 &' % (script, snmp_monitor_log) result = os.system(cmd) if result == 0: print '\033[32;1mTriAquae SNMP monitor service started successfully!\n\033[0m' def shellinabox(): if service_status('shellinaboxd') == 'Running': print "\033[33;1mshellinaboxd service is already running!\033[0m" else: cmd = '%s/shellinaboxd/bin/shellinaboxd -t -b' % triaquae_path if os.system(cmd) == 0: print '\033[32;1mshellinaboxd start success!\n\033[0m' else: print '\033[31;1mshellinaboxd start failed!\n\033[0m' def wsgiserver(): if service_status('runwsgiserver') == 'Running': print "\033[33;1mrunwsgiserver service is already running!\033[0m" else: cmd = 'nohup python %s/manage.py runwsgiserver host=0.0.0.0 port=7000 staticserve=collectstatic >>%s 2>&1 &' % (triaquae_path,service_log) if os.system(cmd) == 0: print '\033[32;1mwsgi server start success!\n\033[0m' else: print '\033[31;1mwsgi server start failed!\n\033[0m' def stop_service(service_name): cmd = "ps -ef| grep %s|grep -v grep |awk '{print $2}'|xargs kill -9" %(service_name) if service_status(service_name) == 'Running': cmd_result = os.system(cmd) if cmd_result == 0: print '..............\n' time.sleep(1) print '\033[31;1m%s stopped! \033[0m' % service_name else: print '\033[31;1mCannot stop %s service successfully,please manually kill the pid!\033[0m' % service_name else: print 'Service is not running...,nothing to kill! ' def service_status(service_name): cmd = "ps -ef |grep %s|grep -v grep |awk '{print $2}'" % service_name result = os.popen(cmd).read().strip() try: service_pid = result.split()[0] if service_pid: print "\033[32;1m%s monitor service is running...\033[0m" % service_name return "Running" except IndexError: print "\033[31;1m%s service is not running....\033[0m" % service_name return "Dead" try: if sys.argv[1] == 'start': status_monitor(30) snmp_monitor() shellinabox() wsgiserver() elif sys.argv[1] == 'stop': stop_service(snmp_monitor_script) stop_service(status_check_script) stop_service('shellinaboxd') stop_service('runwsgiserver') elif sys.argv[1] == 'status': service_status(snmp_monitor_script) service_status(status_check_script) service_status('shellinaboxd') service_status('runwsgiserver') except IndexError: print 'No argument detected!\nUse: stop|start|status'
[ "stefan_bo@163.com" ]
stefan_bo@163.com
3014be40eabec0a1d1eeadd68d766eda03badafa
6e42ce3512cefa970163bb105a736eba5c9bf902
/cw/cw_9/cw_9_1_1.py
fa811bd2a26807f7c1b7471c3b21ca19b929c6d0
[]
no_license
SKO7OPENDRA/gb-algorithm
32f483e095b57d8c71cd5de9fa9bd2c00f0b6bc1
366ae8e58beae267d84baf8a28e6d4055e3a5bdb
refs/heads/master
2020-12-26T22:40:34.640445
2020-02-27T16:16:44
2020-02-27T16:16:44
237,667,396
0
0
null
null
null
null
UTF-8
Python
false
false
658
py
# Что такое дерево # Классификация дерева # Создание деревьев в Python # Самый простой способ создать дерево - создать свой собственный класс from binarytree import tree, bst, Node, build class MyNode: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right a = tree(height=4, is_perfect=False) print(a) b = bst(height=4, is_perfect=True) print(b) c = Node(7) c.left = Node(3) c.right = Node (1) c.left = Node(5) c.right.left = Node(9) c.right.right = Node(13) print(c)
[ "58439768+SKO7OPENDRA@users.noreply.github.com" ]
58439768+SKO7OPENDRA@users.noreply.github.com
83715fa1d47f3fc83e0b62ba1acc085c58e59ecd
40c2bce56832d97797c115f60d1e0459fd4ebf93
/Eclipse_Project_2/Single_Ton_Pattern_Class/test_exampleOne.py
dc3a8820461af7567fb646cf3d32ba7fabdd7054
[]
no_license
amanoj319319319/Eclipse_Python_LastSeleniumTest
0be2e7f615160248f329b4df0e9d109612b29560
4d0978e4c2dfe9c3a9d4b429f7ff6340278c0252
refs/heads/master
2023-04-27T09:14:38.726807
2021-05-19T08:18:40
2021-05-19T08:18:40
267,038,244
0
0
null
2021-05-19T08:17:45
2020-05-26T12:35:36
Python
UTF-8
Python
false
false
2,889
py
#working very fine ''' import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time @pytest.mark.usefixtures("setup") class TestExampleOne: def test_title(self): ele=self.driver.find_element_by_id("name") ele.send_keys("Test Python") time.sleep(5) def test_hide(self): ele2=self.driver.find_element_by_id("displayed-text") ele2.send_keys("Hai Manoj") time.sleep(5) ''' #working very fine ''' import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time @pytest.mark.usefixtures("setup") class TestExampleOne: @pytest.mark.run(order=2) def test_title(self): ele=self.driver.find_element_by_id("name") ele.send_keys("Test Python") time.sleep(5) print("The title of the page is:-", self.driver.title) @pytest.mark.run(order=1) def test_hide(self): ele2=self.driver.find_element_by_id("displayed-text") ele2.send_keys("Hai Manoj") time.sleep(5) print ("The title of the page is:-",self.driver.title) ''' #How to run it on the console #pytest -v -s C:\Users\Manoj\PycharmProjects\LastSeleniumTest\Single_Ton_Pattern_Class\test_exampleOne.py #working very fine import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time import unittest @pytest.mark.usefixtures("setup") class TestExampleOne(unittest.TestCase): @pytest.mark.run(order=2) def test_title(self): ele=self.driver.find_element_by_id("name") ele.send_keys("Test Python") time.sleep(5) print("The title of the page is:-", self.driver.title) @pytest.mark.run(order=1) def test_hide(self): ele2=self.driver.find_element_by_id("displayed-text") ele2.send_keys("Hai Manoj") time.sleep(5) print ("The title of the page is:-",self.driver.title) hide_button=self.driver.find_element_by_id("hide-textbox") hide_button.click() text_box=self.driver.find_element_by_id("displayed-text") print ("is hide-button displayes:-",text_box.is_displayed()) self.driver.refresh() @pytest.mark.run(order=3) def test_another(self): self.driver.get("https://letskodeit.teachable.com/") login=self.driver.find_element_by_xpath("//*[@id='navbar']/div/div/div/ul/li[2]/a") login.click() time.sleep(6) print ("Title of the facebook page is:-",self.driver.title)
[ "a.manoj16@gmail.com" ]
a.manoj16@gmail.com
5f9b268af9cb8089a970308ee8aa501616c68bbc
6d80ce7a1f44ddf5741fd190ddfe0d9be8e5f162
/model/detection_model/PSENet/util/__init__.py
0851e4c84d2992a68efd02e1726176aecf9e3fbb
[ "MIT" ]
permissive
dun933/FudanOCR
dd8830ca4b8ebb08acd31326fcf5aa3c961886a0
fd79b679044ea23fd9eb30691453ed0805d2e98b
refs/heads/master
2021-04-03T19:50:47.646099
2020-03-16T08:43:59
2020-03-16T08:43:59
248,391,401
1
0
MIT
2020-03-19T02:23:11
2020-03-19T02:23:10
null
UTF-8
Python
false
false
1,335
py
import log import dtype # import plt import np import img _img = img import dec import rand import mod import proc # import test import neighbour as nb #import mask import str_ as str import io as sys_io import io_ as io import feature import thread_ as thread import caffe_ as caffe # import tf import cmd import ml import sys import url from .misc import * from .logger import * # log.init_logger('~/temp/log/log_' + get_date_str() + '.log') def exit(code = 0): sys.exit(0) is_main = mod.is_main init_logger = log.init_logger def sit(img, path = None, name = ""): if path is None: _count = get_count(); path = '~/temp/no-use/images/%s_%d_%s.jpg'%(log.get_date_str(), _count, name) if type(img) == list: plt.show_images(images = img, path = path, show = False, axis_off = True, save = True) else: plt.imwrite(path, img) return path _count = 0; def get_count(): global _count; _count += 1; return _count def cit(img, path = None, rgb = True, name = ""): _count = get_count(); if path is None: img = np.np.asarray(img, dtype = np.np.uint8) path = '~/temp/no-use/%s_%d_%s.jpg'%(log.get_date_str(), _count, name) _img.imwrite(path, img, rgb = rgb) return path def argv(index): return sys.argv[index]
[ "576194329@qq.com" ]
576194329@qq.com
1ccd46595657e4e3591261fd55aab390e27ec8a7
bc68b28995103a45c5050a418a009f5f0c075bdc
/Rosalind1/Prob26/deBruijn.py
201c46d46d9c2452c65c16307a2d005cd80b2a5e
[]
no_license
kedarpujara/BioinformaticsAlgorithms
71ca191c18ff8260d9edcd594c337b282b2a7188
4a8919d03af767704525e8a5610af5b811d5c873
refs/heads/master
2020-03-13T08:41:45.361941
2018-04-25T18:39:00
2018-04-25T18:39:00
131,048,693
0
0
null
null
null
null
UTF-8
Python
false
false
1,840
py
class Vertex: def __init__(self, n): self.name = n self.neighbors = list() def add_neighbor(self, v): if v not in self.neighbors: self.neighbors.append(v) self.neighbors.sort() class Graph: vertices = {} def add_vertex(self, vertex): if isinstance(vertex, Vertex) and vertex.name not in self.vertices: self.vertices[vertex.name] = vertex return True else: return False def add_edge(self, u, v): if u in self.vertices and v in self.vertices: self.vertices[u].add_neighbor(v) self.vertices[v].add_neighbor(u) return True else: return False def print_graph(self): for key in sorted(list(self.vertices.keys())): print(key + str(self.vertices[key].neighbors)) def suffixs(string): length = len(string) suffix = string[1:length] return suffix def prefixs(string): length = len(string) prefix = string[0:length-1] return prefix def deBruijnOld(patterns): leftList = [] rightList = [] for string1 in patterns: for string2 in patterns: if suffixs(string1) == prefixs(string2): leftList.append(string1) rightList.append(string2) break return leftList, rightList def deBruijn(inputString, k): leftList = [] rightList = [] multiList = [] for i in range(len(inputString)-k+1): string1 = inputString[i:i+k-1] string2 = inputString[i+1:i+k] if any(string1 in s for s in rightList): newString = inputString[i:i+k-1] + inputString[i+1:i+k] break leftList.append(string2) rightList.append(string1) return rightList, leftList def main(): inputFile = open("input.txt","r") k = int(inputFile.readline().strip()) inputString = inputFile.readline().strip() leftList, rightList = deBruijn(inputString, k) output = open("output.txt", 'w') for i in range(len(leftList)): output.write(leftList[i] + " -> " + rightList[i] + "\n") main()
[ "kedarpujara@gmail.com" ]
kedarpujara@gmail.com
620070250e2f6b411843401f50a7971be8f365d8
649bd422025e421d86025743eac324c9b882a2e8
/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp164_2500.py
576f14d7c5a41ab258af91170ba177c434a68fea
[]
no_license
scheuclu/atom_class
36ddee1f6a5995872e858add151c5942c109847c
0c9a8c63d9b38898c1869fe8983126cef17662cd
refs/heads/master
2021-01-21T10:52:28.448221
2017-03-07T23:04:41
2017-03-07T23:04:41
83,489,471
0
0
null
null
null
null
UTF-8
Python
false
false
68,793
py
ITEM: TIMESTEP 2500 ITEM: NUMBER OF ATOMS 2048 ITEM: BOX BOUNDS pp pp pp -3.3219773734549278e+00 5.0521977373447719e+01 -3.3219773734549278e+00 5.0521977373447719e+01 -3.3219773734549278e+00 5.0521977373447719e+01 ITEM: ATOMS id type xs ys zs 94 1 0.0295607 0.284641 0.112956 866 1 0.0661487 0.218979 0.102506 1641 1 0.0744139 0.0956117 0.142651 671 1 0.671874 0.445112 0.422496 943 1 0.0283588 0.152926 0.115034 265 1 0.0452492 0.164483 0.0392187 918 1 0.993706 0.0598728 0.138628 128 1 0.71782 0.477204 0.272921 239 1 0.0973559 0.159191 0.165028 1035 1 0.916661 0.144907 0.0523834 1178 1 0.16477 0.0269688 0.39176 461 1 0.161357 0.186653 0.0872751 267 1 0.214347 0.229933 0.130851 912 1 0.331954 0.384294 0.0196682 991 1 0.183806 0.108282 0.033384 996 1 0.187491 0.0564621 0.143426 645 1 0.778613 0.489764 0.151177 139 1 0.169933 0.182214 0.00923141 261 1 0.265635 0.0906969 0.00022716 1364 1 0.18922 0.0345761 0.0714741 1634 1 0.363048 0.0122868 0.0737585 824 1 0.347412 0.112636 0.0320395 238 1 0.407117 0.156463 0.124078 1933 1 0.983568 0.493267 0.0708426 1502 1 0.818202 0.359541 0.479016 1931 1 0.332049 0.0445061 0.139962 790 1 0.246847 0.101739 0.0948305 1482 1 0.308079 0.149967 0.0704693 822 1 0.660694 0.433787 0.240833 333 1 0.265369 0.0473746 0.0562768 278 1 0.954477 0.496584 0.394913 1003 1 0.387988 0.0842244 0.096703 861 1 0.509868 0.0439005 0.11925 1996 1 0.484377 0.125771 0.090647 1988 1 0.0354529 0.497201 0.355491 306 1 0.434923 0.0233874 0.0949901 618 1 0.452273 0.135558 0.00523608 1224 1 0.489866 0.0615361 0.05308 1125 1 0.76029 0.0258805 0.0835474 254 1 0.645984 0.0498802 0.0871568 1372 1 0.602369 0.0744986 0.136104 305 1 0.604661 0.146506 0.184004 1578 1 0.210077 0.242262 0.0320514 86 1 0.597551 0.11616 0.0491741 91 1 0.659741 0.128511 0.115631 1474 1 0.674393 0.0855004 0.176024 1113 1 0.321499 0.107438 0.472939 939 1 0.707909 0.0450017 0.0415633 1726 1 0.843773 0.136659 0.0653342 702 1 0.449529 0.0251639 0.341942 429 1 0.713353 0.100789 0.0939571 495 1 0.800773 0.0833504 0.0509822 611 1 0.901214 0.0564416 0.14636 2027 1 0.829108 0.121751 0.146858 3 1 0.908003 0.355691 0.458809 763 1 0.579899 0.0106422 0.120258 364 1 0.80234 0.487674 0.269951 525 1 0.89051 0.0556792 0.044752 332 1 0.524244 0.119839 0.0167175 271 1 0.951311 0.232168 0.100028 1523 1 0.88434 0.159874 0.123711 901 1 0.948946 0.132939 0.12938 25 1 0.893012 0.139863 0.192769 1976 1 0.654097 0.0798695 -0.00119738 201 1 0.937749 0.0224086 0.0856964 922 1 0.109108 0.277947 0.103969 860 1 0.988213 0.327943 0.0233913 1503 1 0.123862 0.324661 -0.00229758 398 1 0.158941 0.286474 0.155901 105 1 0.0381703 0.210129 0.167031 1161 1 0.942783 0.312804 0.124482 725 1 0.0860078 0.260579 0.166966 1534 1 0.932609 0.0822321 0.00667313 1287 1 0.153029 0.212028 0.176013 1375 1 0.232496 0.293622 0.11196 355 1 0.217881 0.364695 0.128021 1041 1 0.282345 0.357198 0.094686 782 1 0.172403 0.31856 0.0493966 116 1 0.705268 0.0343 0.284408 1526 1 0.254419 0.187435 0.160026 521 1 0.26815 0.268619 0.196275 1328 1 0.82329 0.0900573 0.461659 1910 1 0.215907 0.230577 0.205914 1668 1 0.348276 0.12576 0.15255 1519 1 0.279088 0.228826 0.0728689 1509 1 0.368034 0.245779 0.0221596 494 1 0.625375 0.185475 0.0306278 1149 1 0.319995 0.316926 0.147578 125 1 0.390606 0.3359 0.00820951 1415 1 0.352982 0.2037 0.104478 745 1 0.400382 0.253898 0.178359 558 1 0.465042 0.291079 0.126302 204 1 0.50702 0.281453 0.047129 1683 1 0.431514 0.255437 0.0333317 1646 1 0.411041 0.187214 0.049704 1772 1 0.451782 0.217757 0.108641 607 1 0.588814 0.274346 0.179714 377 1 0.504266 0.185902 0.148622 732 1 0.557364 0.264761 0.105197 517 1 0.549275 0.184976 0.0877474 1084 1 0.613956 0.256384 0.0431921 273 1 0.695054 0.278822 0.0569258 1822 1 0.705275 0.175179 0.0856932 1296 1 0.614939 0.191046 0.105339 986 1 0.669148 0.366043 0.114565 477 1 0.122096 0.063634 0.0330027 1724 1 0.834568 0.044179 0.120621 778 1 0.175201 0.129425 0.486777 1124 1 0.867871 0.479616 0.431951 1817 1 0.785193 0.311747 0.147535 1561 1 0.77837 0.147053 0.0794475 615 1 0.778945 0.225881 0.064506 1300 1 0.806845 0.233053 0.139504 682 1 0.615511 0.035493 0.187201 1446 1 0.049088 0.241841 0.029606 863 1 0.0338454 0.369995 0.101727 447 1 0.588878 0.0192828 0.375872 678 1 0.0329042 0.30942 0.179427 312 1 0.979987 0.265161 0.167408 954 1 0.875704 0.278585 0.104417 215 1 0.65777 0.394025 0.500686 686 1 0.107232 0.123863 0.0606967 1472 1 0.0593962 0.311134 0.0491956 101 1 0.145202 0.44753 0.173374 768 1 0.555592 0.31372 0.00456133 538 1 0.348127 0.180285 0.0104436 765 1 0.1113 0.413665 0.119395 1487 1 0.175573 0.398391 0.0852464 356 1 0.514362 0.451243 0.482701 827 1 0.030102 0.458413 0.0286416 849 1 0.141171 0.394541 -0.00166883 916 1 0.696398 0.164468 0.0139026 253 1 0.24275 0.408183 0.0320982 561 1 0.283252 0.373338 0.163405 1697 1 0.163393 0.380488 0.175113 1862 1 0.203559 0.458003 0.0815546 1050 1 0.973853 0.388402 0.501631 1119 1 0.974453 0.0154498 0.411956 1063 1 0.252351 0.42932 0.12208 1679 1 0.431403 0.0287961 0.498087 1306 1 0.33515 0.402436 0.120984 1198 1 0.363837 0.352437 0.0772396 1584 1 0.398115 0.268318 0.100546 609 1 0.296609 0.451458 0.0577299 336 1 0.392502 0.458565 0.107466 899 1 0.427268 0.407299 0.0581565 570 1 0.435751 0.332062 0.0639971 1740 1 0.558485 0.448655 0.0320021 526 1 0.487262 0.453473 0.0299696 1811 1 0.413321 0.478191 0.180099 1953 1 0.614252 0.397229 0.132371 1293 1 0.520817 0.356567 0.0476298 891 1 0.460495 0.460152 0.0979289 535 1 0.488234 0.375128 0.118003 1995 1 0.557398 0.414473 0.100876 43 1 0.61798 0.333715 0.0560432 1055 1 0.619106 0.482405 0.055684 362 1 0.625502 0.404485 0.0656038 828 1 0.775208 0.369413 0.0695241 1533 1 0.683744 0.427873 0.164163 1420 1 0.568604 0.344681 0.112917 1731 1 0.800021 0.409267 0.418837 1535 1 0.950398 0.405872 0.11648 1311 1 0.843852 0.455172 0.160072 1631 1 0.84844 0.355956 0.110019 59 1 0.957716 0.399245 0.412667 2044 1 0.77894 0.153117 0.0104476 73 1 0.0494922 0.441486 0.129581 1913 1 0.97265 0.340045 0.193742 539 1 0.486308 0.494366 0.342743 1019 1 0.983461 0.399914 0.0457403 141 1 0.992052 0.0515015 0.24147 1099 1 0.0505025 0.0580772 0.194432 1547 1 0.0798198 0.0584893 0.38258 1714 1 0.174543 0.0792692 0.273748 1179 1 0.111172 0.0304763 0.248354 286 1 0.10971 0.108486 0.245933 518 1 0.0425628 0.140893 0.324646 114 1 0.105515 0.0135428 0.173986 1664 1 0.254611 0.0305526 0.135412 1860 1 0.225453 0.0582493 0.203268 1431 1 0.277722 0.0996747 0.154746 496 1 0.195232 0.142243 0.167921 1770 1 0.229448 -0.00149776 0.254156 1261 1 0.142184 0.0881535 0.185538 241 1 0.231264 0.120051 0.241782 1073 1 0.294669 0.0547321 0.22014 387 1 0.335894 0.0600623 0.284429 579 1 0.396139 0.0339106 0.160991 192 1 0.426152 0.097869 0.157252 657 1 0.359119 0.459089 0.014496 335 1 0.201481 0.0525587 0.340196 1267 1 0.359588 0.160729 0.240669 701 1 0.14 0.243174 0.0312509 1209 1 0.362812 0.0848409 0.212434 1320 1 0.394417 0.108247 0.30272 1605 1 0.30731 0.210593 0.269483 907 1 0.416687 0.123478 0.22073 1892 1 0.344984 0.446388 0.444783 961 1 0.405648 0.0344776 0.278851 603 1 0.456402 0.198683 0.216524 1208 1 0.489758 0.108419 0.24073 1477 1 0.448539 0.0561027 0.227606 1989 1 0.457041 0.0811987 0.302284 1686 1 0.54667 0.0562354 0.201362 1001 1 0.568557 0.189117 0.326465 272 1 0.392888 0.104224 0.454844 1310 1 0.447342 0.157865 0.349882 30 1 0.894879 0.42607 0.375902 843 1 0.573153 0.16652 0.249956 752 1 0.700681 0.152124 0.289403 909 1 0.535314 0.110676 0.160298 677 1 0.692209 0.022906 0.210556 2042 1 0.670746 0.15407 0.225958 1695 1 0.831406 0.0539456 0.191896 597 1 0.7394 0.190264 0.217785 1182 1 0.730078 0.0514595 0.154987 514 1 0.806493 0.0861762 0.34052 687 1 0.789011 0.112558 0.213669 246 1 0.853717 0.0369628 0.298413 266 1 0.782589 0.0170093 0.306838 1563 1 0.789932 0.162161 0.273274 1249 1 0.883283 0.222305 0.194352 1598 1 0.758376 0.0917735 0.284378 724 1 0.721693 0.0985863 0.227257 1032 1 0.907384 0.0857884 0.275429 1369 1 0.843311 0.116892 0.249919 500 1 0.970059 0.111084 0.202947 935 1 0.0138988 0.0678533 0.338529 1220 1 0.897601 0.0460145 0.351541 499 1 0.0120226 0.164135 0.224009 430 1 0.987513 0.110862 0.286825 242 1 0.0903938 0.250661 0.24194 1381 1 0.0883854 0.179823 0.227036 4 1 0.0762277 0.341427 0.276076 1633 1 0.083504 0.263217 0.322968 771 1 0.161362 0.242545 0.263744 1167 1 0.0245676 0.238486 0.364377 1105 1 0.151654 0.174371 0.246542 2001 1 0.2339 0.326381 0.210173 965 1 0.26899 0.257463 0.31369 919 1 0.291272 0.320944 0.264376 1711 1 0.103578 0.18659 0.322053 1702 1 0.321188 0.218328 0.174681 674 1 0.354379 0.257171 0.233607 13 1 0.286433 0.165588 0.219502 1917 1 0.344581 0.278252 0.30679 1068 1 0.494242 0.357578 0.193751 1538 1 0.394477 0.334423 0.162217 168 1 0.326829 0.232536 0.355491 693 1 0.392004 0.189049 0.186764 636 1 0.363869 0.17138 0.333861 1660 1 0.562045 0.203737 0.171284 871 1 0.512294 0.194534 0.264648 984 1 0.548949 0.244522 0.241369 528 1 0.528197 0.0813624 0.296978 1721 1 0.570517 0.331586 0.241276 1038 1 0.42148 0.295978 0.241937 15 1 0.440236 0.19782 0.284418 707 1 0.497427 0.259357 0.190704 1737 1 0.511798 0.236595 0.420104 1550 1 0.643995 0.284263 0.121735 1285 1 0.705937 0.276115 0.148659 175 1 0.629228 0.213298 0.266017 1252 1 0.660228 0.323617 0.176447 424 1 0.636003 0.222272 0.186348 1348 1 0.760302 0.217376 0.375944 928 1 0.696137 0.264349 0.337394 296 1 0.580581 0.259213 0.302157 438 1 0.742981 0.18019 0.140891 2031 1 0.843114 0.325612 0.21358 5 1 0.889924 0.172054 0.271362 119 1 0.62172 0.287357 0.249431 933 1 0.690876 0.25789 0.231885 27 1 0.813219 0.257761 0.20722 1905 1 0.912444 0.308258 0.230332 665 1 0.766847 0.333526 0.319 414 1 0.0185913 0.27212 0.240767 1820 1 0.963937 0.242646 0.285705 1824 1 0.770975 0.328147 0.226246 2043 1 0.81773 0.182159 0.209471 1006 1 0.974831 0.191294 0.165803 1959 1 0.0176501 0.371475 0.244527 2040 1 0.846475 0.209242 0.0720943 395 1 0.972941 0.193811 0.348956 1239 1 0.0307381 0.209979 0.291289 840 1 0.939508 0.367101 0.265042 1346 1 0.919711 0.307722 0.317884 207 1 0.946458 0.237154 0.221833 287 1 0.122295 0.308576 0.211629 1028 1 0.0933754 0.405575 0.264042 181 1 0.138474 0.310692 0.303398 582 1 0.0916792 0.372736 0.192251 1607 1 0.0954615 0.338966 0.127217 1830 1 0.0544681 0.445499 0.206115 1877 1 0.309924 0.4442 0.253068 455 1 0.166814 0.364112 0.257095 1163 1 0.32564 0.475929 0.110364 1992 1 0.131302 0.47765 0.276637 1794 1 0.172262 0.430368 0.247453 454 1 0.230228 0.494041 0.257586 1118 1 0.37717 0.353962 0.363888 818 1 0.31708 0.368725 0.310751 714 1 0.3545 0.431565 0.181347 61 1 0.358279 0.342436 0.235091 536 1 0.500815 0.434888 0.168197 1872 1 0.00298034 0.072887 0.028584 833 1 0.409086 0.398297 0.148818 151 1 0.475321 0.346056 0.266319 1260 1 0.441626 0.414644 0.229068 1567 1 0.478204 0.0613974 0.449196 349 1 0.555734 0.404188 0.238509 634 1 0.489091 0.4962 0.271847 1458 1 0.564644 0.0257524 0.299526 402 1 0.758934 0.296482 0.385183 533 1 0.577664 0.467079 0.144842 351 1 0.582285 0.383041 0.31308 1713 1 0.6274 0.307365 0.328341 51 1 0.63214 0.36626 0.225567 1248 1 0.714059 0.386474 0.225389 673 1 0.719605 0.323622 0.276451 1216 1 0.666097 0.383156 0.293085 373 1 0.749151 0.423539 0.128552 1826 1 0.815386 0.356608 0.283375 1009 1 0.825163 0.461939 0.35619 890 1 0.79075 0.405287 0.239391 629 1 0.877994 0.401991 0.238169 1281 1 0.725747 0.358597 0.154804 896 1 0.01123 0.40172 0.175529 184 1 0.803166 0.384375 0.168178 1164 1 0.953217 0.36966 0.332319 879 1 0.88264 0.369113 0.318168 426 1 0.926096 0.444153 0.191484 855 1 0.942206 0.503901 0.22389 1490 1 0.138118 0.373001 0.464172 1855 1 0.970749 0.438536 0.280374 1906 1 0.0414178 0.396761 0.310164 1672 1 0.264231 0.242085 0.491111 441 1 0.0924817 0.029732 0.47321 221 1 0.196814 0.0512187 0.465038 893 1 0.00368271 0.144542 0.395006 268 1 0.0684727 0.124671 0.424235 588 1 0.983713 0.435786 0.350293 1574 1 0.0181347 0.0603807 0.44352 1444 1 0.175723 0.104406 0.409104 1337 1 0.114295 0.14374 0.376148 1065 1 0.101899 0.110231 0.491856 1768 1 0.271722 0.166651 0.468994 183 1 0.048912 0.00539948 0.273387 1774 1 0.929698 0.227856 0.0219552 353 1 0.199979 0.15111 0.358415 574 1 0.248198 0.323587 0.0373055 934 1 0.31998 0.0796285 0.351839 1488 1 0.603958 0.338132 0.471391 870 1 0.255169 0.103946 0.442285 1356 1 0.281062 0.154737 0.394176 994 1 0.447167 0.107951 0.409711 75 1 0.542808 0.0995809 0.414723 1237 1 0.5223 0.0162211 0.354768 280 1 0.503155 0.143518 0.468524 1685 1 0.450941 0.329662 0.487079 1430 1 0.496875 0.0850422 0.360642 503 1 0.580862 0.0861211 0.257516 464 1 0.580029 0.134373 0.486738 1344 1 0.649259 0.0584241 0.324534 1371 1 0.649809 0.0900879 0.258096 1865 1 0.575801 0.195578 0.394827 1060 1 0.583875 0.090847 0.34666 1993 1 0.599873 0.0813215 0.43846 133 1 0.618219 0.13269 0.302641 1112 1 0.746852 0.149189 0.436582 17 1 0.698707 0.20932 0.398351 474 1 0.762028 0.361485 -0.00228516 1629 1 0.725598 0.225531 0.286757 1284 1 0.843214 0.153667 0.493665 1165 1 0.755177 0.162054 0.331598 578 1 0.674824 0.11244 0.365151 967 1 0.122272 0.456686 0.0616313 1142 1 0.805378 0.137962 0.393036 1815 1 0.783722 0.0288087 0.385045 147 1 0.749066 0.0777088 0.436128 1418 1 0.878991 0.120448 0.425496 1188 1 0.842231 0.0691042 0.395785 728 1 0.0897666 0.03941 0.0952023 775 1 0.866163 0.450272 0.302603 323 1 0.955238 0.0622692 0.484288 225 1 0.903273 0.0482027 0.428501 740 1 0.948317 0.0949066 0.400867 1407 1 0.904719 0.128024 0.361456 1466 1 0.86567 0.194496 0.393127 549 1 0.924123 0.171796 0.43693 2013 1 0.110512 0.217555 0.500537 555 1 0.779897 0.488396 0.0288638 1909 1 0.972152 0.222049 0.413408 98 1 0.145855 0.247156 0.431958 836 1 0.0255585 0.349745 0.355694 1604 1 0.0832844 0.20855 0.424619 583 1 0.990039 0.302933 0.404627 1367 1 0.0495851 0.175134 0.478564 1440 1 0.0736905 0.305026 0.410234 630 1 0.0956106 0.350139 0.345734 668 1 0.167813 0.179464 0.430186 1447 1 0.189612 0.235701 0.481253 905 1 0.963236 0.0203949 0.304415 738 1 0.214883 0.305772 0.492172 1183 1 0.261259 0.24719 0.424302 156 1 0.303734 0.313751 0.471401 1095 1 0.122185 0.30472 0.472167 809 1 0.411386 0.32193 0.416374 1632 1 0.474313 0.226326 0.485466 1469 1 0.388891 0.274111 0.372676 134 1 0.732651 0.457389 0.203469 1918 1 0.341409 0.148546 0.420469 1100 1 0.378637 0.205864 0.402626 1738 1 0.380775 0.0191548 0.420218 1043 1 0.328049 0.247585 0.455397 691 1 0.445892 0.18399 0.424681 172 1 0.587983 0.267832 0.405144 385 1 0.505905 0.161207 0.387187 838 1 0.559768 0.216001 0.467351 149 1 0.508695 0.221671 0.341194 1382 1 0.505215 0.317791 0.410315 53 1 0.413806 0.394795 0.468298 1780 1 0.433867 0.471824 0.303348 1733 1 0.287779 0.263714 0.00577117 2014 1 0.633549 0.222351 0.436727 9 1 0.721668 0.265642 0.447896 1661 1 0.636905 0.207823 0.337728 1564 1 0.664949 0.279428 0.399283 202 1 0.524933 0.28583 0.353279 70 1 0.810745 0.273896 0.441151 1234 1 0.0812275 0.499825 0.14707 721 1 0.830091 0.186977 0.332182 252 1 0.866763 0.252768 0.347227 1181 1 0.804868 0.198687 0.434686 1788 1 0.796633 0.261245 0.318729 367 1 0.693167 0.21278 0.502211 633 1 0.861486 0.49264 0.0997796 1201 1 0.856081 0.299837 0.280103 1800 1 0.97355 0.497504 0.161721 710 1 0.974926 0.124946 0.453435 805 1 0.933899 0.256361 0.366472 1577 1 0.0132568 0.296792 0.309385 1441 1 0.0146831 0.260044 0.471381 1396 1 0.863734 0.317458 0.403035 569 1 0.146859 0.395109 0.394533 516 1 0.215398 0.413943 0.39017 1883 1 0.0278639 0.434076 0.487837 1174 1 0.0461001 0.418933 0.375589 1880 1 0.112993 0.444502 0.345491 1956 1 0.10134 0.45432 0.430674 47 1 0.521694 0.286961 0.489075 1274 1 0.300084 0.30361 0.389972 1835 1 0.239428 0.389187 0.326513 491 1 0.187006 0.316508 0.421574 1361 1 0.193693 0.438237 0.316663 1836 1 0.245194 0.35893 0.438744 817 1 0.0512093 0.475729 0.287276 343 1 0.280128 0.455228 0.413774 800 1 0.167465 0.46872 0.405481 1116 1 0.371672 0.435062 0.305902 1673 1 0.261294 0.448916 0.497734 1109 1 0.328981 0.433547 0.361024 498 1 0.252553 0.472046 0.330822 820 1 0.393781 0.430538 0.399065 622 1 0.333672 0.368244 0.427291 974 1 0.873272 0.396191 0.0423758 530 1 0.483746 0.410421 0.299319 1696 1 0.520003 0.373377 0.369452 469 1 0.45348 0.326153 0.336002 178 1 0.493635 0.456486 0.412145 74 1 0.43101 0.464807 0.472284 493 1 0.401325 0.369554 0.291803 700 1 0.447387 0.384945 0.383026 1748 1 0.484904 0.399058 0.451387 1804 1 0.565738 0.432699 0.359579 120 1 0.572068 0.50184 0.253143 829 1 0.565459 0.210094 0.00238308 1969 1 0.599128 0.40609 0.447747 1518 1 0.634605 0.403644 0.360966 1039 1 0.63708 0.47034 0.333003 389 1 0.53613 0.355078 0.473769 594 1 0.919348 0.468501 0.0933827 1833 1 0.617582 0.493054 0.414239 197 1 0.603988 0.330281 0.388474 914 1 0.708391 0.441533 0.348548 523 1 0.66593 0.340515 0.431003 72 1 0.804677 0.375063 0.356824 1077 1 0.721289 0.360853 0.367444 1853 1 0.757643 0.479096 0.410782 76 1 0.751847 0.354826 0.438933 981 1 0.431147 0.491961 0.040646 1859 1 0.64899 0.282648 0.474834 1639 1 0.871857 0.488164 0.22978 1014 1 -0.0039672 0.454704 0.426091 112 1 0.0178057 0.344635 0.457514 281 1 0.904417 0.263345 0.424044 884 1 0.914107 0.132638 0.494787 96 1 0.751501 0.424952 0.46481 1764 1 0.409092 0.0540347 0.0296017 365 1 0.495548 0.01096 0.17931 643 1 0.495222 0.208066 0.0470281 1247 1 0.682509 0.0617115 0.412379 1693 1 0.413903 0.167612 0.49338 847 1 0.571188 0.0429327 0.0511894 1251 1 0.170634 0.450634 0.473371 1340 1 0.335019 0.269238 0.0836279 1644 1 0.383985 0.476683 0.251856 1433 1 0.671578 0.445089 0.021506 1545 1 0.0620409 0.0312117 0.0260363 1709 1 0.628518 0.479386 0.487626 566 1 0.540934 0.0742945 0.487102 1546 1 0.194811 0.4472 0.00309241 90 1 0.331141 0.00678114 0.347883 275 1 0.645961 0.0804003 0.498929 1901 1 0.656894 0.294849 0.000234365 331 1 0.159883 0.00190297 0.506778 1590 1 0.00195567 0.106417 0.677526 1831 1 0.0910133 0.132073 0.685431 1459 1 0.0898037 0.0872967 0.570145 348 1 0.935144 0.469033 0.85954 1670 1 0.0252518 0.106477 0.514314 1645 1 0.170837 0.0692586 0.54197 307 1 0.2141 0.109456 0.585138 610 1 0.0495252 0.0460356 0.773764 826 1 0.280001 0.0823685 0.606564 1858 1 0.107074 0.0642474 0.641634 1944 1 0.845698 0.11191 0.989613 769 1 0.292014 0.18892 0.657999 1512 1 0.747053 0.45541 0.799186 1878 1 0.385225 0.202223 0.675602 1979 1 0.353284 0.0744786 0.54536 460 1 0.29361 0.0686773 0.699094 1622 1 0.332266 0.12082 0.65569 173 1 0.352724 0.180307 0.609348 1031 1 0.410362 0.137399 0.558103 921 1 0.414056 0.0458953 0.568616 274 1 0.877687 0.479811 0.67818 155 1 0.419989 0.123258 0.704791 709 1 0.0745221 0.366587 0.517722 279 1 0.0784571 0.183358 0.983333 971 1 0.537057 0.0484717 0.635056 1757 1 0.492979 0.0591336 0.581681 1292 1 0.434592 0.0928284 0.626288 661 1 0.883263 0.0215782 0.702647 1048 1 0.616801 0.0510572 0.627866 811 1 0.682741 0.0368676 0.585954 524 1 0.501848 0.138917 0.624136 1066 1 0.631311 0.144967 0.662922 235 1 0.678489 0.014618 0.681952 314 1 0.71965 0.142343 0.516165 1894 1 0.733682 0.0848257 0.574372 1761 1 0.783604 0.151301 0.555106 1295 1 0.948425 0.489977 0.990794 228 1 0.847413 0.0787561 0.650064 730 1 0.0409281 0.404075 0.912108 1981 1 0.237861 0.0990791 0.515349 371 1 0.134329 0.0562115 0.714588 1257 1 0.0489866 0.0239863 0.54078 1010 1 0.913022 0.138927 0.623934 1965 1 0.976399 0.0230063 0.670528 1769 1 0.223785 0.0104075 0.824775 1351 1 0.843922 0.147973 0.606773 1307 1 0.947688 0.114815 0.566405 1002 1 0.804805 0.0741012 0.576491 1276 1 0.942523 0.208921 0.663511 1410 1 0.984039 0.0522956 0.601847 407 1 0.86923 0.104227 0.536367 1706 1 0.917848 -0.00542531 0.62687 1147 1 0.344577 0.32446 0.519748 1166 1 0.140126 0.208635 0.562339 480 1 0.0911773 0.201525 0.616662 910 1 0.0525802 0.345906 0.61638 547 1 0.773759 0.482745 0.955643 388 1 0.274518 0.312192 0.623405 1938 1 0.223722 0.198863 0.536819 1379 1 0.151428 0.273233 0.606544 1416 1 0.26487 0.224078 0.595855 317 1 0.193685 0.266356 0.543835 1127 1 0.294929 0.19547 0.536178 1805 1 0.304834 0.125328 0.546534 357 1 0.264704 0.29434 0.537617 1271 1 0.397225 0.218082 0.554294 1656 1 0.383263 0.0401746 0.66623 186 1 0.412093 0.316312 0.631131 1339 1 0.351234 0.261779 0.625742 166 1 0.442662 0.167868 0.622968 1140 1 0.323202 0.258696 0.533946 457 1 0.401879 0.00141103 0.886273 551 1 0.447382 0.381539 0.591662 931 1 0.466833 0.186805 0.560353 1228 1 0.453739 0.272139 0.543122 163 1 0.520624 0.20243 0.601556 1144 1 0.532149 0.274995 0.591745 926 1 0.488296 0.319499 0.650668 33 1 0.572854 0.353435 0.532094 1497 1 0.436058 0.245731 0.619151 1667 1 0.52098 0.139755 0.549349 2036 1 0.488998 0.329746 0.566454 1925 1 0.612524 0.293619 0.554512 812 1 0.643123 0.182341 0.581325 1007 1 0.587628 0.237038 0.611752 1456 1 0.697223 0.272244 0.547994 50 1 0.575361 0.156372 0.617982 1885 1 0.662951 0.333333 0.529678 917 1 0.695418 0.259265 0.617949 97 1 0.0463836 0.046787 0.696731 1752 1 0.870162 0.254907 0.557715 839 1 0.735861 0.210271 0.561669 1710 1 0.770545 0.164277 0.663262 1370 1 0.707482 0.337959 0.584409 1626 1 0.839769 0.311469 0.623705 1715 1 0.820987 0.210969 0.576609 467 1 0.805008 0.279127 0.514678 1521 1 0.854677 0.333475 0.546354 715 1 0.247109 0.469901 0.784663 46 1 0.991624 0.167282 0.534264 170 1 0.881542 0.21261 0.636414 874 1 0.903431 0.287473 0.641156 1385 1 0.937989 0.293539 0.719653 160 1 0.00617879 0.231127 0.548296 1397 1 0.868697 0.00857149 0.791011 152 1 0.93331 0.281087 0.548403 2024 1 0.0754752 0.171837 0.552149 567 1 0.154645 0.34507 0.530622 680 1 0.151297 0.411776 0.570514 797 1 0.968417 0.458431 0.523704 1214 1 0.985396 0.300633 0.609525 758 1 0.927075 0.371565 0.999333 298 1 0.0798274 0.403889 0.598213 361 1 0.916229 0.340509 0.590762 162 1 0.506559 0.428766 0.687505 422 1 0.342043 0.33196 0.615215 983 1 0.17368 0.396504 0.635539 679 1 0.274597 0.373411 0.588452 1723 1 0.214939 0.333781 0.564787 1782 1 0.273065 0.366248 0.511108 626 1 0.211566 0.405921 0.531579 1402 1 0.220469 0.438768 0.590244 42 1 0.874291 0.183839 0.951118 795 1 0.413743 0.326332 0.549296 1439 1 0.378773 0.463744 0.5712 1760 1 0.385769 0.435994 0.735035 1597 1 0.402666 0.351587 0.697939 1437 1 0.329585 0.393587 0.550394 1480 1 0.29278 0.442961 0.587139 915 1 0.365111 0.491931 0.647827 1648 1 0.291579 0.471361 0.65831 1732 1 0.577139 0.186093 0.545153 869 1 0.397996 0.414854 0.626384 1092 1 0.268035 0.0166363 0.87587 617 1 0.559134 0.31482 0.644358 1132 1 0.485938 0.455455 0.560716 1206 1 0.54383 0.35989 0.59515 1899 1 0.601991 0.424202 0.532122 1483 1 0.548343 0.455393 0.594211 1854 1 0.474928 0.433068 0.626991 660 1 0.59558 0.00504801 0.787991 1650 1 0.0427892 0.471996 0.71404 1869 1 0.184345 0.0303436 0.761161 716 1 0.642283 0.366436 0.587258 832 1 0.612509 0.47795 0.602042 1324 1 0.694819 0.414783 0.570991 108 1 0.755793 0.391337 0.526173 1781 1 0.758428 0.458087 0.617192 55 1 0.738524 0.449358 0.897852 780 1 0.825372 0.438673 0.642977 1846 1 0.902147 0.382372 0.524803 381 1 0.725094 0.0457027 0.519899 1640 1 0.956754 0.150708 0.981825 1326 1 0.127893 0.00642292 0.579961 1698 1 0.81336 0.394957 0.570836 227 1 0.781561 0.436089 0.714673 470 1 0.821528 0.00396729 0.988148 1636 1 0.93747 0.185702 0.584666 2015 1 0.98725 0.355067 0.682412 293 1 0.792247 0.205399 0.513964 1052 1 0.88955 0.428983 0.570223 1258 1 0.00835938 0.385428 0.572081 1852 1 0.0441784 0.13454 0.779739 1362 1 0.0223064 0.187706 0.818239 1033 1 0.0319164 0.0758024 0.828555 103 1 0.979746 0.167519 0.713546 978 1 0.149194 0.18124 0.721043 747 1 0.974922 0.115483 0.839604 1244 1 0.975077 0.0819966 0.766225 1694 1 0.262576 0.0619157 0.765331 920 1 0.340451 0.0356058 0.613205 1162 1 0.108033 0.111109 0.757792 897 1 0.20269 0.106345 0.804616 1193 1 0.273835 0.117163 0.830721 1891 1 0.196759 0.101669 0.731355 483 1 0.168264 0.110014 0.63865 666 1 0.345907 0.11708 0.780273 1501 1 0.223912 0.0725407 0.656134 557 1 0.273327 0.195223 0.746371 1675 1 0.372143 0.0544807 0.737949 198 1 0.366189 0.182944 0.77172 1700 1 0.381075 0.0680104 0.850206 637 1 0.323698 0.096149 0.872491 675 1 0.309937 0.0531116 0.818343 22 1 0.468999 0.0369332 0.674482 1061 1 0.232084 0.0386536 0.559626 654 1 0.510305 0.105684 0.800188 1098 1 0.520953 0.0245862 0.753199 900 1 0.499119 0.0951598 0.699454 1067 1 0.339741 0.160538 0.71492 663 1 0.55696 0.0784064 0.846704 1207 1 0.444583 0.0518372 0.768462 308 1 0.56918 0.154066 0.798603 1069 1 0.696083 0.0198025 0.80456 1758 1 0.0401553 0.324727 0.950905 1146 1 0.566535 0.0893687 0.761281 554 1 0.663737 0.0952573 0.704868 1705 1 0.571261 0.109801 0.687584 1926 1 0.592647 0.0364343 0.714361 1018 1 0.786513 0.0841258 0.78051 1736 1 0.582691 0.175293 0.73104 712 1 0.641583 0.158127 0.784314 93 1 0.811525 0.198892 0.757409 1934 1 0.769796 0.0803978 0.648176 1129 1 0.917648 0.0876054 0.719326 1342 1 0.805561 0.0521312 0.713935 813 1 0.739494 0.0621508 0.87453 979 1 0.80811 0.118795 0.711304 1322 1 0.858076 0.0691112 0.75564 1514 1 0.737927 0.229369 0.844749 564 1 0.763403 0.0140519 0.800685 1507 1 0.893568 0.486577 0.498769 1719 1 0.469407 0.364967 0.988799 1893 1 0.908672 0.100026 0.796383 1037 1 0.810935 0.0592441 0.853341 951 1 0.878535 0.191101 0.8035 468 1 0.846214 0.136854 0.76911 1378 1 0.947985 0.0302875 0.818398 1935 1 0.0333053 0.294407 0.78387 1024 1 0.151501 0.207605 0.658597 383 1 0.0284409 0.284711 0.683038 1335 1 0.0741614 0.20547 0.697417 815 1 0.119715 0.185336 0.834213 502 1 0.969302 0.271292 0.81432 1242 1 0.0981618 0.390815 0.772788 1452 1 0.285883 0.29051 0.733268 1223 1 0.108865 0.248563 0.79538 115 1 0.182982 0.199124 0.80476 1135 1 0.245001 0.235999 0.801233 1494 1 0.246328 0.313527 0.821557 366 1 0.214129 0.184852 0.63363 976 1 0.206848 0.313646 0.690316 1051 1 0.324011 0.323511 0.830478 1980 1 0.199447 0.249238 0.859903 1708 1 0.289812 0.230389 0.860196 2039 1 0.167996 0.24276 0.751383 442 1 0.22007 0.364949 0.89363 757 1 0.330843 0.35479 0.717547 1619 1 0.345491 0.263312 0.782584 1199 1 0.430587 0.186787 0.836961 1553 1 0.331833 0.247095 0.70796 1211 1 0.277336 0.288926 0.89709 1916 1 0.623469 0.294392 0.634904 66 1 0.501121 0.188362 0.846129 410 1 0.610512 0.25248 0.692032 1544 1 0.458551 0.193424 0.69092 54 1 0.417412 0.119215 0.795615 1717 1 0.464896 0.17305 0.770677 1548 1 0.504068 0.246575 0.651264 1962 1 0.427835 0.339318 0.925457 631 1 0.558633 0.203192 0.671554 889 1 0.503896 0.336582 0.805418 180 1 0.692515 0.27204 0.753387 545 1 0.659115 0.216588 0.663407 473 1 0.617498 0.230416 0.761857 604 1 0.722977 0.309447 0.687549 1283 1 0.585855 0.214455 0.830168 1280 1 0.739372 0.232017 0.693805 1395 1 0.782117 0.262684 0.739632 1756 1 0.772665 0.243708 0.628479 443 1 0.873319 0.157218 0.683152 1275 1 0.622297 0.315065 0.760193 476 1 0.72199 0.325318 0.796998 816 1 0.83217 0.320133 0.803386 1581 1 0.840268 0.257415 0.871519 1057 1 0.0144122 0.317514 0.845796 210 1 0.0131195 0.234862 0.736889 706 1 0.833655 0.251872 0.797657 1994 1 0.871635 0.243336 0.715045 1866 1 0.0525473 0.350878 0.724965 1575 1 0.902352 0.263832 0.78415 628 1 0.931945 0.335379 0.79867 176 1 0.964605 0.360558 0.860273 248 1 0.0596284 0.468103 0.793209 1308 1 0.0405046 0.39938 0.669349 436 1 0.117803 0.355145 0.650255 1169 1 0.112853 0.472835 0.748761 1215 1 0.101025 0.291427 0.731003 1531 1 0.178156 0.304414 0.796807 548 1 0.0992469 0.41278 0.708662 1682 1 0.979921 0.483386 0.804112 540 1 0.0991159 0.473037 0.664111 481 1 0.177905 0.425949 0.757305 489 1 0.93594 0.428809 0.760074 2021 1 0.258496 0.378129 0.697499 78 1 0.165208 0.370547 0.709612 243 1 0.282081 0.355628 0.776396 1506 1 0.332959 0.416944 0.683031 1088 1 0.1627 0.450958 0.694655 1961 1 0.232485 0.44609 0.693817 142 1 0.276068 0.417468 0.823965 1952 1 0.736134 0.479266 0.527053 440 1 0.470427 0.34064 0.716839 1464 1 0.333296 0.49363 0.711858 1434 1 0.346612 0.395412 0.816319 605 1 0.385611 0.320279 0.798216 1115 1 0.301033 0.416808 0.74328 1863 1 0.449368 0.474125 0.681624 413 1 0.459541 0.26816 0.70935 770 1 0.429074 0.257309 0.784529 760 1 0.350603 0.493878 0.779306 397 1 0.404142 0.443112 0.806808 39 1 0.442211 0.404811 0.687576 1195 1 0.559124 0.301307 0.73466 1130 1 0.517462 0.460667 0.842648 1508 1 0.4912 0.441582 0.752575 606 1 0.529935 0.387826 0.773773 807 1 0.725849 0.0695721 0.747045 1486 1 0.593945 0.413569 0.639406 1473 1 0.572176 0.441805 0.713782 1637 1 0.547412 0.406571 0.911869 779 1 0.687442 0.449583 0.84998 211 1 0.699162 0.35961 0.726755 77 1 0.593556 0.369649 0.726382 741 1 0.841492 0.309228 0.730828 396 1 0.677975 0.441658 0.750962 1386 1 0.629957 0.404522 0.773819 601 1 0.794689 0.286648 0.673782 140 1 0.800358 0.38341 0.788862 513 1 0.780872 0.341223 0.730815 1417 1 0.721257 0.440959 0.680458 300 1 0.829383 0.472064 0.563278 804 1 0.982336 0.43378 0.696619 1148 1 0.889904 0.340847 0.690416 713 1 0.917967 0.416443 0.664969 1357 1 0.0145635 0.409937 0.762535 940 1 0.979891 0.345894 0.75465 1991 1 0.969986 0.494433 0.639189 488 1 0.891026 0.0121469 0.980966 1330 1 0.844564 0.343966 0.989562 867 1 0.351361 0.0074777 0.518818 14 1 0.0856277 0.000880193 0.965443 1945 1 0.102847 0.0480114 0.809554 58 1 0.0725096 0.0419975 0.901641 1442 1 0.13785 0.0399516 0.935505 161 1 0.0840496 0.0844522 0.980249 1045 1 0.0450971 0.134751 0.87016 1383 1 0.997234 0.313858 0.527268 1485 1 0.0701598 0.278234 0.50796 927 1 0.110724 0.1111 0.834932 1462 1 0.563762 0.0159567 0.526723 196 1 0.313185 0.180178 0.820797 1837 1 0.131183 0.142938 0.905052 1058 1 0.647393 0.0483173 0.756782 167 1 0.225937 0.0793875 0.868467 432 1 0.277833 0.0165535 0.962854 1246 1 0.297187 0.191549 0.952181 830 1 0.188376 0.103069 0.931432 195 1 0.976051 0.0208238 0.99346 799 1 0.369548 0.143712 0.845143 1354 1 0.3012 0.156254 0.890419 620 1 0.364167 0.157075 0.914298 1669 1 0.37458 0.0635239 0.919932 1763 1 0.458136 0.0251331 0.960042 676 1 0.381524 0.217091 0.874537 1026 1 0.319456 0.122494 0.96435 40 1 0.393076 0.104914 0.979638 1029 1 0.531616 0.0379097 0.992906 1942 1 0.428461 0.124313 0.918222 762 1 0.0426827 0.00703098 0.620626 1131 1 0.645843 0.11088 0.584941 1687 1 0.479356 0.0921184 0.958169 1864 1 0.129544 0.362044 0.927899 1842 1 0.489631 0.111784 0.875607 835 1 0.554417 0.0865608 0.577673 404 1 0.637933 0.0376757 0.909876 509 1 0.519637 0.0407226 0.904018 1848 1 0.698481 0.0511228 0.940582 49 1 0.614737 0.1107 0.868538 1449 1 0.822898 -0.00656094 0.667549 908 1 0.643159 0.202525 0.885076 1352 1 0.638668 0.0573468 0.834455 1478 1 0.823604 0.374448 0.879771 766 1 0.847528 0.105754 0.918726 329 1 0.26857 0.0195663 0.642984 260 1 0.256905 0.075344 0.931705 129 1 0.730881 -0.000281393 0.994487 858 1 0.837997 0.433308 0.916064 107 1 0.694144 0.142054 0.854648 962 1 0.644748 0.0036292 0.996938 23 1 0.473484 0.392608 0.527214 1777 1 0.740915 0.0825357 0.993042 1008 1 0.14673 0.466139 0.609366 487 1 0.30036 0.459984 0.979059 1924 1 0.00749882 0.0528697 0.902249 501 1 0.0154188 0.462541 0.957071 1783 1 0.912385 0.00374915 0.881802 1394 1 0.885573 0.06733 0.855215 2017 1 0.910624 0.0781954 0.941329 837 1 0.894064 0.398672 0.877663 1345 1 0.997949 0.102412 0.948239 736 1 0.982229 0.192078 0.884569 1390 1 0.86871 0.462461 0.744878 1334 1 0.0556992 0.250285 0.945988 798 1 0.0691084 0.1907 0.895372 1530 1 0.0450151 0.259057 0.861312 325 1 0.133993 0.229645 0.89544 89 1 0.187892 0.17038 0.87725 1879 1 0.109527 0.29555 0.925581 2047 1 0.237317 0.160272 0.925341 1900 1 0.170453 0.239355 0.964985 602 1 0.240018 0.241197 0.946715 731 1 0.262947 0.313722 0.956323 563 1 0.188141 0.308182 0.913194 1080 1 0.37744 0.296363 0.875017 881 1 0.338456 0.242394 0.945482 1304 1 0.449974 0.263341 0.891655 130 1 0.409323 0.171453 0.971325 255 1 0.278885 0.382964 0.96921 104 1 0.4016 0.270437 0.945795 138 1 0.446336 0.198927 0.910158 1042 1 0.325795 0.49453 0.529089 187 1 0.488544 0.27279 0.980251 1515 1 0.458198 0.089999 0.518626 1094 1 0.54043 0.139823 0.943104 84 1 0.492569 0.18421 0.975739 337 1 0.516343 0.27447 0.851418 696 1 0.901488 -0.00043712 0.514986 704 1 0.499537 0.30471 0.91936 1583 1 0.513205 0.234247 0.761874 393 1 0.663349 0.20494 0.967539 755 1 0.21453 0.498554 0.54825 445 1 0.233863 0.473992 0.947278 1136 1 0.594152 0.287271 0.812214 102 1 0.505839 0.228327 0.908234 2009 1 0.613756 0.163279 0.950112 7 1 0.703288 0.19735 0.763318 1448 1 0.56696 0.242363 0.932328 12 1 0.775591 0.313862 0.87417 1908 1 0.693228 0.244224 0.907357 1977 1 0.715411 0.173877 0.923293 270 1 0.793011 0.299399 0.942579 945 1 0.916313 0.319858 0.901928 1928 1 0.916672 0.255084 0.955103 1053 1 0.968868 0.400877 0.922066 1245 1 0.871602 0.330611 0.852782 190 1 0.399083 0.00617228 0.813595 345 1 0.0126694 0.174779 0.946147 1421 1 0.913726 0.149715 0.901038 80 1 0.793086 0.219101 0.941589 1476 1 0.969863 0.270158 0.896834 1958 1 0.836529 0.123734 0.851891 2007 1 0.169341 0.436181 0.929284 956 1 0.882703 0.178599 0.543117 1624 1 0.0956842 0.469055 0.942611 251 1 0.913237 0.455806 0.929146 623 1 0.105742 0.310238 0.826536 982 1 0.143251 0.132942 0.573843 546 1 0.0753543 0.344719 0.876264 1511 1 0.983153 0.419883 0.839425 1254 1 0.0935432 0.414156 0.870257 194 1 0.045341 0.381575 0.82077 1399 1 0.857599 0.0408494 0.551179 1405 1 0.644379 0.424808 0.687601 1809 1 0.380035 0.499412 0.95626 1845 1 0.185186 0.303297 0.982316 1914 1 0.146679 0.376869 0.839381 506 1 0.868465 0.400139 0.806853 1821 1 0.213377 0.362535 0.765957 44 1 0.0349038 0.470797 0.623778 774 1 0.763919 0.373643 0.928253 269 1 0.225811 0.442413 0.886611 717 1 0.156602 0.461381 0.862314 1510 1 0.201954 0.048032 0.985517 67 1 0.445747 0.485582 0.971236 1829 1 0.710365 0.350639 0.8803 223 1 0.300842 0.474434 0.909987 1 1 0.445606 0.325031 0.853105 1796 1 0.302009 0.368871 0.885616 1688 1 0.395425 0.383044 0.877149 1984 1 0.332804 0.315135 0.970577 1318 1 0.344251 0.413141 0.93014 1004 1 0.54296 0.448702 0.963877 199 1 0.600873 0.389246 0.999447 352 1 0.753652 0.239688 0.993059 1791 1 0.475598 0.42192 0.90637 421 1 0.643597 0.353723 0.832642 970 1 0.409027 0.413523 0.952624 977 1 0.674724 0.383985 0.961836 372 1 0.670901 0.466235 0.937706 638 1 0.604101 0.457674 0.908273 1316 1 0.717305 0.298297 0.946359 585 1 0.570231 0.442178 0.80444 318 1 0.071489 0.450077 0.548576 640 1 0.71663 0.39536 0.796237 1226 1 0.819967 0.459539 0.846054 1017 1 0.0755785 0.381566 0.992845 1720 1 0.765972 0.393374 0.852226 1612 1 0.134371 0.13413 0.978736 453 1 0.327007 0.0518612 0.99161 508 1 0.239152 0.00432921 0.711213 1946 1 0.387187 0.0135786 0.981172 35 1 0.591609 0.0852603 0.957366 2035 1 0.187487 0.495531 0.808114 154 1 0.615643 0.495906 0.723557 596 1 0.242914 0.164318 0.998353 1087 1 0.738636 0.31498 0.505595 136 1 0.925707 0.230158 0.506219 320 1 0.28586 0.03351 0.503173 1213 1 0.121495 0.657459 0.163245 382 1 0.48898 0.516714 0.491483 1789 1 0.0795874 0.703658 0.0341331 865 1 0.0678388 0.580405 0.0974663 1948 1 -0.00286485 0.602386 0.0813032 1091 1 0.0269924 0.539263 0.0241566 472 1 0.111713 0.505723 0.00822703 401 1 0.165732 0.63998 0.0771886 873 1 0.13927 0.556591 0.100561 1850 1 0.184843 0.623736 0.143567 1627 1 0.240321 0.664385 0.0571559 821 1 0.284387 0.587107 0.0416307 845 1 0.252636 0.61494 0.113711 106 1 0.199676 0.70776 0.116732 1539 1 0.209763 0.591755 0.0425482 529 1 0.223188 0.565159 0.165616 2028 1 0.3522 0.621604 0.119132 1253 1 0.357545 0.699378 0.125537 1771 1 0.357106 0.641169 0.212619 2020 1 0.0597891 0.862424 0.00481753 1227 1 0.411045 0.635664 0.0407579 1203 1 0.385317 0.550695 0.256036 537 1 0.366887 0.562759 0.0302845 36 1 0.206557 0.831876 0.0154135 1319 1 0.501057 0.579832 0.0999846 1652 1 0.538381 0.604661 0.0461666 1867 1 0.445659 0.557464 0.0614314 24 1 0.554708 0.698971 0.145747 1443 1 0.502602 0.678338 0.0576491 995 1 0.568752 0.537754 0.143896 81 1 0.904644 0.97249 0.29596 419 1 0.435893 0.62043 0.127106 1412 1 0.501692 0.587549 0.18732 1922 1 0.700363 0.584373 0.0975219 662 1 0.68966 0.496518 0.0704193 1999 1 0.62009 0.557344 0.0412385 85 1 0.546055 0.508996 0.408149 1325 1 0.659744 0.634742 0.0678671 209 1 0.655033 0.581351 0.158229 1425 1 0.582075 0.606932 0.114583 1499 1 0.635738 0.504221 0.122214 230 1 0.524658 0.520646 0.0480505 1616 1 0.388666 0.727094 0.486806 793 1 0.780657 0.628072 0.110493 1040 1 0.835628 0.543389 0.163112 1070 1 0.814803 0.543351 0.083359 1801 1 0.883496 0.564015 0.117275 403 1 0.807946 0.618997 0.0494984 131 1 0.883629 0.605388 0.0565204 864 1 0.471328 0.970763 0.276604 1741 1 0.0140106 0.603594 0.201635 846 1 0.7482 0.882684 0.0376039 1941 1 0.930035 0.545215 0.056194 1020 1 0.614753 0.969716 0.073087 1139 1 0.938407 0.633941 0.102459 1881 1 0.946508 0.572516 0.165892 295 1 0.949371 0.617818 0.0309851 1542 1 0.0479237 0.891977 0.385829 672 1 0.0765038 0.736655 0.218413 856 1 -0.000929914 0.702634 0.00594398 1259 1 0.159658 0.784412 0.00658878 213 1 0.0245811 0.741924 0.0697664 1059 1 0.0506187 0.651483 0.137135 486 1 0.0337072 0.805611 0.131096 358 1 0.0419547 0.874643 0.236072 299 1 0.0958565 0.786649 0.112316 1849 1 0.298425 0.791232 0.000889032 1806 1 0.0726889 0.722199 0.136476 1235 1 0.319347 0.728294 0.0439439 1380 1 0.186452 0.713452 0.0425161 1568 1 0.149816 0.774498 0.159824 303 1 0.189677 0.863348 0.129681 711 1 0.453029 0.986294 0.037764 1467 1 0.050861 0.511468 0.0801942 964 1 0.0894864 0.983124 0.328522 1170 1 0.192938 0.52133 0.0297873 1309 1 0.527398 0.781326 0.244377 2038 1 0.311978 0.747899 0.184431 412 1 0.376704 0.714406 0.240347 1074 1 0.384762 0.704853 0.0261738 1841 1 0.349636 0.879905 0.120816 1751 1 0.368233 0.77155 0.0772241 1160 1 0.433098 0.69663 0.07905 34 1 0.428889 0.9017 0.165988 616 1 0.570421 0.779388 0.149582 743 1 0.381759 0.80006 0.165495 390 1 0.519134 0.74202 0.0786825 1617 1 0.567104 0.730751 0.0179951 1743 1 0.575995 0.792032 0.0524311 1025 1 0.625889 0.647984 0.152892 100 1 0.215628 0.974159 0.191513 1571 1 0.651341 0.689941 0.0136606 2033 1 0.576792 0.666668 0.045327 1729 1 0.599925 0.738265 0.0933072 1559 1 0.721325 0.825543 0.0193237 1592 1 0.634754 0.82056 0.127489 1712 1 0.681903 0.753343 0.0674102 1778 1 0.70328 0.690237 0.103694 1691 1 0.668943 0.801201 0.192964 262 1 0.948562 0.513759 0.460885 642 1 0.816348 0.6873 0.140611 587 1 0.801811 0.696825 0.0587906 64 1 0.757922 0.816534 0.0744525 1089 1 0.757263 0.754536 0.0265588 321 1 0.839862 0.763523 0.0891784 2016 1 0.818612 0.82061 0.0270553 1517 1 0.344929 0.838975 0.0428067 434 1 0.971472 0.698106 0.107544 2048 1 0.858043 0.635089 0.142953 734 1 0.883821 0.690067 0.110639 1185 1 0.866572 0.738292 0.186641 1998 1 0.951441 0.784153 0.111591 553 1 0.856399 0.738214 0.0130915 205 1 0.957121 0.755502 0.0322764 1336 1 0.811338 0.836523 0.123904 1457 1 0.00761321 0.815284 0.0394676 1587 1 0.11817 0.940228 0.170912 1493 1 0.143488 0.911885 0.104365 459 1 0.092107 0.517487 0.472025 1808 1 0.166265 0.988115 0.130895 868 1 0.983186 0.990345 0.216727 834 1 0.073291 0.858144 0.102471 1034 1 0.129039 0.909523 0.0314532 1716 1 0.0546858 0.906249 0.151057 784 1 0.174258 0.96403 0.0602588 1810 1 0.205054 0.899825 0.0488496 844 1 0.37918 0.782885 0.00490685 113 1 0.205816 0.935239 0.131541 444 1 0.257402 0.840677 0.0630821 794 1 0.270821 0.902382 0.195294 448 1 0.281312 0.910603 0.0248514 992 1 0.0195164 0.501979 0.490049 406 1 0.336231 0.831797 0.20004 1792 1 0.281143 0.849559 0.144685 1314 1 0.302124 0.989708 0.0529721 1678 1 0.345753 0.932243 0.0532151 1435 1 0.279175 0.925618 0.10887 959 1 0.799942 0.592237 0.445672 544 1 0.391053 0.509939 0.433267 878 1 0.402077 0.953218 0.0993545 56 1 0.151089 0.845618 0.0612819 69 1 0.0798163 0.788261 0.0438011 1392 1 0.579799 0.875836 0.03548 1353 1 0.271393 0.555632 0.225721 1062 1 0.559453 0.941011 0.0976194 231 1 0.564639 0.873051 0.140729 150 1 0.494131 0.867311 0.026804 8 1 0.511708 0.810266 0.0764013 1498 1 0.412725 0.841452 0.0380095 1071 1 0.694358 0.864247 0.0848208 376 1 0.656782 0.877176 0.187125 1921 1 0.569034 0.94886 0.172141 1212 1 0.843008 0.968078 0.24936 284 1 0.627428 0.921015 0.140579 754 1 0.660521 0.910661 0.0484709 1196 1 0.0217118 0.914881 0.00151374 1186 1 0.700386 0.920913 0.125506 1086 1 0.808772 0.919628 0.194585 237 1 0.484724 0.797242 0.00551401 941 1 0.844606 0.902399 0.131941 360 1 0.731831 0.859621 0.141167 158 1 0.894294 0.898568 0.067225 28 1 0.788103 0.962548 0.10684 292 1 0.809286 0.888569 0.0679379 1154 1 0.802314 0.955092 0.033777 653 1 0.0254779 0.907501 0.0831345 350 1 0.963214 0.855413 0.0999977 1570 1 0.96354 0.936739 0.0529812 1966 1 0.922649 0.812852 0.0257461 1635 1 0.918653 0.94409 0.120583 52 1 0.880063 0.970281 0.0481155 1175 1 0.143953 0.661625 0.00653943 2032 1 0.0963878 0.587386 0.169503 1427 1 0.157918 0.626902 0.213721 316 1 0.08505 0.642647 0.238502 1187 1 0.361996 0.530055 0.123609 742 1 0.0374764 0.585343 0.264481 1384 1 0.104777 0.574186 0.241717 519 1 0.245999 0.736111 0.492734 1566 1 0.0244331 0.511485 0.229042 263 1 0.144418 0.514242 0.22108 575 1 0.121519 0.737999 0.0811821 1152 1 0.651298 0.817238 0.0101808 322 1 0.150735 0.560303 0.304097 1078 1 0.137127 0.625668 0.289771 423 1 0.262346 0.540866 0.311147 1896 1 0.202059 0.606028 0.348347 1593 1 0.296846 0.53845 0.149854 1753 1 0.441348 0.518813 0.233029 1868 1 0.481239 0.578184 0.255963 1582 1 0.26371 0.625966 0.183901 1391 1 0.229067 0.599315 0.276287 313 1 0.256145 0.584909 0.453937 1368 1 0.39789 0.559901 0.184451 1159 1 0.727421 0.537514 0.00914116 1657 1 0.68969 0.509205 0.360554 1022 1 0.534029 0.623123 0.269146 591 1 0.408807 0.590236 0.464348 577 1 0.532294 0.560913 0.299179 1513 1 0.423947 0.623555 0.21869 127 1 0.457019 0.996814 0.409441 930 1 0.683383 0.646319 0.207585 963 1 0.588745 0.661551 0.303071 803 1 0.504657 0.6372 0.134919 291 1 0.580463 0.559003 0.204247 1608 1 0.675222 0.591503 0.256653 684 1 0.759923 0.57196 0.14791 584 1 0.0266653 0.99462 0.14097 1902 1 0.801975 0.553241 0.253622 1798 1 0.899311 0.55303 0.27569 82 1 0.23284 0.538025 0.0845874 1054 1 0.506485 0.727389 0.489201 1263 1 0.80456 0.643445 0.288339 764 1 0.802957 0.616948 0.190415 1601 1 0.556169 0.502029 0.335068 1628 1 0.90962 0.695338 0.263111 2019 1 0.738873 0.540028 0.211452 1428 1 0.965293 0.580091 0.253593 374 1 0.978076 0.544815 0.314349 792 1 0.991399 0.675369 0.171856 1222 1 0.867721 0.600289 0.207672 1600 1 0.920836 0.625264 0.293257 212 1 0.102259 0.811863 0.213547 608 1 0.178108 0.709853 0.192207 783 1 0.0226533 0.790107 0.228372 541 1 0.0209746 0.745859 0.342177 1479 1 0.0155401 0.693381 0.235159 11 1 0.150249 0.773051 0.286485 1832 1 0.262854 0.820707 0.203823 880 1 0.251673 0.697349 0.172435 1787 1 0.122563 0.698603 0.260194 875 1 0.193648 0.77844 0.224785 1491 1 0.235077 0.762558 0.166856 411 1 0.0933604 0.746168 0.319562 946 1 0.14236 0.827244 0.322052 319 1 0.196506 0.671093 0.252964 2006 1 0.294064 0.602932 0.309785 164 1 0.259763 0.740262 0.233316 1887 1 0.296901 0.642932 0.251975 1576 1 0.344492 0.778664 0.253592 560 1 0.441649 0.625566 0.286348 1210 1 0.485285 0.657647 0.200602 1393 1 0.466988 0.786345 0.30041 1232 1 0.416158 0.658097 0.364158 363 1 0.287844 0.823241 0.280241 123 1 0.296932 0.711838 0.281206 925 1 0.233031 0.746346 0.290257 786 1 0.363184 0.641003 0.288549 556 1 0.526885 0.852108 0.298334 1153 1 0.570079 0.722231 0.28006 126 1 0.544821 0.678634 0.230185 650 1 0.441482 0.782475 0.227098 20 1 0.431509 0.843138 0.340676 2046 1 0.536269 0.922411 0.262611 1303 1 0.582926 0.740066 0.201777 1932 1 0.600065 0.803947 0.291759 1520 1 0.647442 0.726135 0.298551 1016 1 0.598319 0.82681 0.194422 258 1 0.652085 0.735799 0.153856 1790 1 0.662671 0.74905 0.23147 344 1 0.611451 0.687335 0.235012 2022 1 0.762169 0.743508 0.222386 310 1 0.703899 0.796137 0.119326 1814 1 0.750858 0.690107 0.269353 699 1 0.741037 0.613952 0.262128 282 1 0.741475 0.679394 0.170303 1818 1 0.831921 0.770453 0.279579 1939 1 0.898478 0.786267 0.231449 2002 1 0.848755 0.66774 0.216499 1463 1 0.775258 0.732537 0.332094 1233 1 0.673418 0.869601 0.353964 695 1 0.711151 0.787917 0.283503 1620 1 0.915642 0.650239 0.181633 664 1 0.975914 0.817706 0.186693 806 1 0.987969 0.921621 0.215205 1795 1 0.00393614 0.756222 0.173925 756 1 0.979281 0.811643 0.269877 165 1 0.895803 0.84981 0.313436 431 1 0.964605 0.743392 0.269195 1825 1 0.881277 0.736475 0.321758 99 1 0.922864 0.788865 0.346878 1884 1 0.876353 0.916313 0.464171 947 1 0.980504 0.924324 0.136771 1595 1 0.96653 0.839433 0.354901 1920 1 0.0825799 0.970601 0.0902488 1589 1 0.174686 0.950444 0.254493 1847 1 0.537645 0.979746 0.0452662 1373 1 0.0781596 0.810665 0.282771 359 1 1.00107 0.876462 0.294613 276 1 0.124793 0.87323 0.259761 92 1 0.070132 0.936807 0.272581 683 1 0.191277 0.910627 0.194517 1840 1 0.370229 0.939216 0.18013 635 1 0.161655 0.848521 0.202096 143 1 0.0305407 0.605334 0.0125535 600 1 0.204841 0.825163 0.272761 1419 1 0.182171 0.88847 0.300555 1064 1 0.170472 0.988644 0.32114 1355 1 0.412779 0.899867 0.258973 543 1 0.182886 0.890942 0.374148 1110 1 0.295178 0.873248 0.370922 244 1 0.277526 0.900343 0.280564 294 1 0.365465 0.83646 0.28386 1123 1 0.400411 0.73444 0.312869 1106 1 0.347053 0.922137 0.251789 903 1 0.921047 0.682076 0.0224702 1290 1 0.297328 0.967153 0.224245 1734 1 0.44194 0.979177 0.211737 2 1 0.437113 0.906917 0.0646931 449 1 0.523777 0.861874 0.222483 2026 1 0.512782 0.847845 0.364794 433 1 0.491816 0.92793 0.19688 1912 1 0.197096 0.799274 0.100285 1250 1 0.560923 0.989158 0.231212 1599 1 0.490158 0.975214 0.104549 842 1 0.393716 0.963276 0.309335 1138 1 0.623617 0.991617 0.270082 649 1 0.694837 0.506165 0.452757 1861 1 0.650256 0.837084 0.263168 302 1 0.60011 0.876931 0.313733 1739 1 0.741785 0.654946 0.0200438 1012 1 0.695494 0.946037 0.25515 456 1 0.599623 0.906722 0.238435 1219 1 0.738722 0.940438 0.1981 1671 1 0.643233 0.951086 0.20236 409 1 0.79395 0.846989 0.217574 1759 1 0.71625 0.855372 0.239646 759 1 0.759694 0.954166 0.273345 737 1 0.763206 0.832195 0.287399 1876 1 0.762084 0.791757 0.166543 1557 1 0.870944 0.849251 0.237484 767 1 0.72646 0.891033 0.30185 87 1 0.731554 0.967536 0.342279 1492 1 0.619518 0.501137 0.202855 379 1 0.820346 0.963692 0.47635 1374 1 0.832167 0.942834 0.318029 559 1 0.878983 0.834928 0.0922192 1422 1 0.852535 0.806513 0.168449 1011 1 0.856258 0.981973 0.138816 479 1 0.973628 0.917292 0.369362 1046 1 0.943854 0.866329 0.227456 368 1 0.886446 0.882796 0.381921 1409 1 0.901518 0.924407 0.230862 998 1 0.383799 0.889896 0.482301 1997 1 0.964773 0.939119 0.285617 1614 1 0.978177 0.571883 0.483202 1704 1 0.0644464 0.594122 0.332618 1569 1 0.0351576 0.531287 0.431959 31 1 0.694925 0.679484 0.47683 1454 1 0.0552435 0.585113 0.482577 1560 1 0.729292 0.946668 0.0567911 1653 1 0.115943 0.630399 0.448222 1904 1 0.160141 0.698232 0.325973 1882 1 0.994015 0.586142 0.412334 1236 1 0.0943294 0.524314 0.321434 384 1 0.053587 0.640916 0.396385 598 1 0.16936 0.530416 0.371046 1108 1 0.0654945 0.958869 0.209574 1684 1 0.211313 0.509817 0.461717 1468 1 0.173528 0.663079 0.382991 781 1 0.126329 0.607173 0.355592 1049 1 0.185032 0.573957 0.428416 1191 1 0.244248 0.539792 0.384095 1930 1 0.0882104 0.888374 0.493205 137 1 0.378139 0.682058 0.428486 122 1 0.393748 0.507505 0.349728 613 1 0.945423 0.830498 0.499078 375 1 0.376674 0.569969 0.323277 1638 1 0.3166 0.548081 0.36344 542 1 0.445759 0.545588 0.305477 1103 1 0.454441 0.52087 0.415515 1828 1 0.322441 0.610984 0.451195 1331 1 0.303952 0.536864 0.432167 746 1 0.763837 0.715609 0.484598 929 1 0.39484 0.569861 0.391725 854 1 0.4554 0.604549 0.388834 1189 1 0.525924 0.575873 0.449327 1591 1 0.506233 0.564706 0.365386 796 1 0.542766 0.635743 0.48881 1265 1 0.601028 0.772682 0.414167 571 1 0.556647 0.507854 0.477427 391 1 0.601474 0.716733 0.365278 330 1 0.604058 0.560444 0.377795 1985 1 0.661268 0.55155 0.414458 953 1 0.6374 0.529048 0.296033 552 1 0.648093 0.626849 0.442557 1277 1 0.743011 0.554205 0.495015 1184 1 0.583247 0.680449 0.429734 1655 1 0.620247 0.593708 0.318311 264 1 0.568224 0.625213 0.381857 1588 1 0.660494 0.655365 0.297984 772 1 0.715299 0.542298 0.300252 277 1 0.629218 0.645549 0.367799 1365 1 0.178965 0.862531 0.504205 1950 1 0.83694 0.656242 0.441897 1666 1 0.724231 0.630754 0.420251 1505 1 0.350018 0.557501 0.492565 1779 1 0.684716 0.604229 0.35067 987 1 0.731963 0.558582 0.397721 808 1 0.805077 0.625973 0.37621 21 1 0.747212 0.603975 0.32835 911 1 0.774213 0.536899 0.344638 1229 1 0.90344 0.548115 0.411421 1843 1 0.836039 0.557325 0.381797 1838 1 0.932455 0.605052 0.44555 18 1 0.897313 0.510788 0.3433 88 1 0.0122764 0.679943 0.304377 482 1 0.105528 0.614988 0.0471001 118 1 0.134449 0.690657 0.482535 776 1 0.0881869 0.678199 0.313598 1082 1 0.0693616 0.838415 0.424943 580 1 0.141785 0.7252 0.403524 1176 1 0.111751 0.791736 0.375991 111 1 0.0649293 0.751108 0.420712 408 1 0.0447154 0.831275 0.355615 723 1 0.000745658 0.686001 0.37965 177 1 0.191713 0.819497 0.411617 689 1 0.311325 0.784039 0.464816 937 1 0.17482 0.742461 0.462028 1114 1 0.231735 0.850112 0.331645 1895 1 0.257003 0.635107 0.396981 1727 1 0.239216 0.69553 0.348397 1044 1 0.248573 0.774761 0.426057 614 1 0.210954 0.758113 0.355975 1453 1 0.0987095 0.533946 0.39352 550 1 0.496601 0.716915 0.324516 1851 1 0.343446 0.785947 0.365981 1813 1 0.00978849 0.561187 0.139738 949 1 0.35114 0.626375 0.353187 174 1 0.296426 0.736197 0.390963 1551 1 0.349938 0.698557 0.363354 256 1 0.274894 0.804335 0.363827 1552 1 0.686293 0.993728 0.0993778 185 1 0.504608 0.783338 0.429948 1889 1 0.45515 0.741312 0.385433 48 1 0.519122 0.714535 0.396618 958 1 0.538044 0.783455 0.35306 787 1 0.459013 0.639539 0.454349 1298 1 0.509534 0.647051 0.330511 1943 1 0.659718 0.781675 0.347919 16 1 0.614505 0.834102 0.379572 1218 1 0.621086 0.901774 0.410579 1964 1 0.542188 0.862129 0.452108 1888 1 0.66952 0.69931 0.406814 6 1 0.655541 0.811774 0.447142 65 1 0.710925 0.722346 0.345216 462 1 0.233464 0.995482 0.0160292 214 1 0.823303 0.85826 0.350943 1730 1 0.714237 0.805019 0.390841 1527 1 0.87396 0.673318 0.356991 1083 1 0.75383 0.68988 0.396765 823 1 0.321587 0.93306 0.340384 895 1 0.713384 0.751594 0.435543 1359 1 0.841363 0.727904 0.40465 1755 1 0.822022 0.842845 0.43241 1767 1 0.891428 0.765549 0.454954 188 1 0.781535 0.778912 0.42373 1317 1 0.777083 0.808229 0.363375 2004 1 0.908695 0.68024 0.454328 222 1 -0.00185365 0.839764 0.434771 708 1 0.0306744 0.723255 0.478278 1689 1 0.872758 0.608154 0.401623 1376 1 0.860487 0.783747 0.373132 1173 1 0.917601 0.729109 0.383952 1349 1 0.938086 0.637967 0.386393 595 1 0.937985 0.690971 0.334484 1313 1 0.990472 0.769026 0.412778 1967 1 0.927846 0.811045 0.412687 1360 1 0.0149303 0.96807 0.338377 639 1 0.111322 0.973803 0.414998 1128 1 0.226559 0.694189 0.440132 1194 1 0.0810912 0.879049 0.306146 1579 1 0.131188 0.883336 0.42609 328 1 0.156343 0.928476 0.497584 1192 1 0.134396 0.811719 0.44816 1870 1 0.64453 0.734944 0.4682 1023 1 0.109152 0.921014 0.360369 1643 1 0.214809 0.88812 0.443922 892 1 0.20538 0.960043 0.392341 392 1 0.270563 0.919152 0.417668 1504 1 0.227198 0.819102 0.473725 589 1 0.294261 0.85032 0.440551 515 1 0.481774 0.509451 0.152164 1333 1 0.453545 0.696992 0.00909995 309 1 0.393414 0.962034 0.463733 1377 1 0.372152 0.881269 0.348007 655 1 0.448317 0.743385 0.456791 1076 1 0.421353 0.943027 0.370486 936 1 0.245288 0.92269 0.341797 1273 1 0.341769 0.896995 0.41441 1000 1 0.460491 0.891059 0.445361 688 1 0.453771 0.902282 0.319523 1785 1 0.537221 0.90458 0.389844 1625 1 0.561648 0.94861 0.331809 872 1 0.431 0.834982 0.414343 1121 1 0.483586 0.952229 0.356083 969 1 0.842942 0.991249 0.368245 993 1 0.690183 0.89777 0.47362 1231 1 0.608976 0.903734 0.492921 1225 1 0.659373 0.999803 0.362435 62 1 0.555658 0.959877 0.472421 497 1 0.766717 0.888037 0.449226 1799 1 0.698959 0.921458 0.398031 1797 1 0.0180832 0.997991 0.0666155 2010 1 0.311778 0.973642 0.143073 1573 1 0.684154 0.971618 0.470036 417 1 0.646082 0.939251 0.319006 1484 1 0.749135 0.97396 0.418493 121 1 0.920678 0.966444 0.418856 586 1 0.954884 0.896269 0.447606 1299 1 0.747139 0.875412 0.3712 1765 1 0.792608 0.930963 0.374824 751 1 0.986359 0.657192 0.462658 568 1 0.724284 0.829036 0.459432 1297 1 0.601614 0.57626 0.472779 471 1 0.0461828 0.953635 0.430394 973 1 0.902075 0.507032 0.158656 132 1 0.949188 0.733191 0.475618 1085 1 0.269381 0.642623 0.489456 1238 1 0.971794 0.872651 0.0219183 1157 1 0.374313 0.990783 0.227623 1554 1 0.258069 0.509314 0.0278657 744 1 0.330087 0.51878 0.229672 465 1 0.788054 0.986029 0.173091 859 1 0.196751 0.621133 0.47853 1230 1 0.131571 0.99054 0.0116072 1438 1 0.798563 0.77383 0.49588 83 1 -0.00189888 0.996872 0.491192 370 1 0.909476 0.991116 0.201943 1898 1 0.597672 0.826528 0.491717 1388 1 0.748394 0.626067 0.496812 315 1 0.581839 0.501446 -0.00290671 729 1 0.630362 0.663736 0.495681 1015 1 0.0362476 0.562859 0.630459 1489 1 0.993698 0.706715 0.539071 247 1 0.105285 0.530339 0.618161 801 1 0.0623965 0.649136 0.505807 532 1 0.308691 0.837448 0.537981 1749 1 0.0042244 0.631287 0.686111 906 1 0.138254 0.648839 0.545945 1968 1 0.185842 0.655506 0.658875 1338 1 -0.00254627 0.638077 0.532534 718 1 0.451242 0.519719 0.816984 876 1 0.746951 0.967895 0.511386 437 1 0.130743 0.601042 0.611753 1294 1 0.235099 0.521372 0.629434 2034 1 0.826325 0.639418 0.984111 145 1 0.782623 0.988155 0.928478 2012 1 0.193552 0.688534 0.588835 777 1 0.858363 0.541685 0.580449 703 1 0.0799364 0.541605 0.878737 1475 1 0.110231 0.581066 0.539969 259 1 0.341627 0.670692 0.618114 1936 1 0.313038 0.533609 0.602706 1496 1 0.341111 0.587067 0.557182 1585 1 0.427189 0.507003 0.620562 1403 1 0.431823 0.612138 0.618476 245 1 0.382313 0.570995 0.694419 171 1 0.355967 0.58831 0.626043 446 1 0.235354 0.603504 0.544085 1972 1 0.643955 0.606 0.985023 1200 1 0.365473 0.648268 0.539265 1875 1 0.411683 0.587014 0.530393 1886 1 0.432574 0.521591 0.548291 955 1 0.542918 0.580325 0.524132 748 1 0.531391 0.627463 0.620344 1613 1 0.552686 0.53635 0.586346 45 1 0.473081 0.632723 0.547484 624 1 0.812979 0.987334 0.847678 1609 1 0.63201 0.517668 0.834931 968 1 0.479436 0.567797 0.584532 1286 1 0.321499 0.602751 0.987958 1145 1 0.425579 0.51854 0.738283 894 1 0.682914 0.608667 0.513543 1278 1 0.745363 0.526399 0.7553 573 1 0.656963 0.61657 0.675396 1990 1 0.0168016 0.856535 0.516989 415 1 0.855786 0.943515 0.969553 157 1 0.635009 0.553424 0.566834 57 1 0.54231 0.573544 0.663203 95 1 0.499597 0.969139 0.9053 565 1 0.809059 0.874927 0.986776 249 1 0.260925 0.538456 0.913619 169 1 0.710677 0.560133 0.665208 810 1 0.819446 0.57875 0.634171 1754 1 0.945074 0.963277 0.927237 1137 1 0.931713 0.998215 0.750647 346 1 0.710689 0.503914 0.599486 1793 1 0.74395 0.638427 0.668154 144 1 0.901809 0.628122 0.526646 327 1 0.680571 0.608204 0.592003 1013 1 0.763355 0.605666 0.731566 250 1 0.909972 0.589046 0.590816 234 1 0.91013 0.55718 0.500687 60 1 0.825735 0.612159 0.554675 753 1 0.996995 0.507127 0.568741 1155 1 0.950153 0.521194 0.704615 159 1 0.810246 0.549959 0.701484 1525 1 0.786083 0.52382 0.624723 2000 1 0.102202 0.719888 0.547418 669 1 0.046266 0.650395 0.625701 1745 1 0.862062 0.509637 0.915905 420 1 0.115217 0.775478 0.499345 789 1 -0.00291073 0.774933 0.510463 641 1 0.054795 0.776996 0.581954 1722 1 0.984027 0.696838 0.660633 1288 1 0.0399504 0.788751 0.660895 1270 1 0.0685519 0.724434 0.627436 651 1 0.0871575 0.832105 0.553775 1937 1 0.265079 0.793998 0.648555 1954 1 0.289331 0.774286 0.556275 1630 1 0.196302 0.689623 0.520567 288 1 0.149576 0.880199 0.564714 490 1 0.133482 0.709924 0.636742 1097 1 0.126748 0.846441 0.633974 1663 1 0.200535 0.780721 0.542899 1202 1 0.291125 0.697954 0.526431 1703 1 0.176287 0.599078 0.975822 41 1 0.295232 0.699876 0.659535 1762 1 0.348668 0.726632 0.564393 1960 1 0.423189 0.695215 0.621679 667 1 0.424705 0.868202 0.59019 1951 1 0.544522 0.677252 0.548508 1107 1 0.762 0.569495 0.568602 1834 1 0.484849 0.700487 0.585264 1540 1 0.573217 0.657092 0.668544 1272 1 0.520317 0.52316 0.84087 848 1 0.453282 0.764839 0.638095 722 1 0.588348 0.498402 0.539824 1615 1 0.423089 0.694564 0.551614 1363 1 0.517423 0.710367 0.648297 1327 1 0.470862 0.627283 0.994091 1315 1 0.60336 0.610842 0.539035 1873 1 0.672925 0.669569 0.553049 1358 1 0.617167 0.734894 0.528954 233 1 0.62215 0.674248 0.606767 1321 1 0.628045 0.782743 0.604891 659 1 0.746854 0.687769 0.55895 1522 1 0.575598 0.726583 0.597512 304 1 0.691986 0.709114 0.635008 1718 1 0.26207 0.685587 0.989538 37 1 0.725949 0.775566 0.598625 220 1 0.234175 0.549476 0.835137 463 1 0.672434 0.830219 0.591383 2008 1 0.787097 0.704 0.681696 739 1 0.120376 0.51006 0.531616 226 1 0.725058 0.811447 0.535288 182 1 0.769337 0.635464 0.598297 2025 1 0.69749 0.78174 0.663415 394 1 0.82428 0.643828 0.675039 1642 1 0.870508 0.800307 0.576421 1606 1 0.965742 0.573085 0.554985 841 1 0.924086 0.701113 0.536222 1341 1 0.938576 0.76591 0.55903 492 1 0.905825 0.743431 0.617903 1426 1 0.864638 0.678938 0.577993 1699 1 0.00515671 0.730883 0.606297 1262 1 0.761839 0.929212 0.983172 750 1 0.451774 0.84392 0.503437 79 1 0.0439964 0.96542 0.880856 1350 1 0.981926 0.987357 0.860824 1516 1 0.963076 0.80526 0.631708 1343 1 0.941795 0.950522 0.556268 1823 1 0.105736 0.93129 0.578883 1725 1 0.331219 0.980454 0.927693 1465 1 0.825095 0.744085 0.578991 1302 1 0.0128947 0.951126 0.590528 1126 1 0.0221523 0.846535 0.585542 510 1 0.0273334 0.953173 0.660661 592 1 0.272335 0.884565 0.496599 179 1 0.733942 0.869607 0.961187 1543 1 0.219929 0.847882 0.574058 1282 1 0.3216 0.934053 0.532051 883 1 0.229554 0.928224 0.552062 1701 1 0.159701 0.926199 0.631103 694 1 0.267717 0.881253 0.619046 219 1 0.64746 0.849853 0.925732 1680 1 0.382938 0.819568 0.562038 531 1 0.534179 0.908131 0.942448 990 1 0.667736 0.974423 0.866341 1812 1 0.388331 0.935867 0.635666 1291 1 0.973574 0.553173 0.974835 369 1 0.560789 0.787875 0.544166 217 1 0.290539 0.989888 0.576258 26 1 0.400248 0.818718 0.643567 1143 1 0.713517 0.940732 0.918748 1072 1 0.561195 0.910649 0.646865 562 1 0.499008 0.831133 0.571786 1621 1 0.235772 0.752709 0.996149 720 1 0.463541 0.90534 0.978752 581 1 0.489641 0.907036 0.58747 862 1 0.566229 0.865344 0.578997 200 1 0.640577 0.937268 0.686963 1411 1 0.65552 0.951852 0.545845 627 1 0.640735 0.895762 0.583412 1955 1 0.57931 0.975968 0.687334 1204 1 0.671179 0.860252 0.672073 831 1 0.704838 0.89681 0.54882 938 1 0.653654 0.97452 0.610967 399 1 0.816767 0.851093 0.664142 1651 1 0.951279 0.902754 0.866467 1874 1 0.707435 0.907653 0.628349 1844 1 0.832943 0.95669 0.736214 2037 1 0.798749 0.811071 0.562274 135 1 0.765642 0.870407 0.600817 1776 1 0.732327 0.962126 0.591453 1565 1 0.778462 0.933721 0.660601 2011 1 0.438814 0.957744 0.9362 1190 1 0.502698 0.7943 0.50939 236 1 0.861464 0.962037 0.591488 1654 1 0.849071 0.87559 0.59661 1586 1 0.878535 0.914432 0.535022 932 1 0.863656 0.917339 0.65091 788 1 0.0488098 0.527699 0.948601 1413 1 0.953271 0.925975 0.640917 378 1 0.924162 0.878997 0.58713 297 1 0.403282 0.599941 0.955887 656 1 0.0361974 0.757281 0.99636 38 1 0.985193 0.58949 0.779506 505 1 0.0465181 0.614011 0.822718 1915 1 0.101059 0.756765 0.878764 621 1 0.0319425 0.683949 0.749264 2045 1 0.940201 0.579329 0.846315 146 1 0.0620474 0.531694 0.742881 1707 1 0.0444793 0.540136 0.814849 1923 1 0.170722 0.597887 0.745194 1690 1 0.220034 0.753865 0.771596 1056 1 0.248408 0.511065 0.697244 681 1 0.209501 0.58332 0.688694 1081 1 0.203727 0.586979 0.609784 1978 1 0.525521 0.910588 0.53007 1562 1 0.311586 0.551904 0.669869 647 1 0.333672 0.615323 0.728939 380 1 0.29814 0.539742 0.742681 1662 1 0.498331 0.978876 0.704075 1387 1 0.286605 0.646231 0.5739 1279 1 0.312406 0.672544 0.757268 980 1 0.384901 0.534056 0.822606 1117 1 0.283078 0.596207 0.882292 960 1 0.238709 0.688165 0.725777 1079 1 0.451999 0.699684 0.684411 1471 1 0.271899 0.623654 0.65722 1532 1 0.302148 0.589892 0.800274 1907 1 0.555662 0.590714 0.743073 1122 1 0.471706 0.546697 0.680176 632 1 0.48442 0.60899 0.703599 326 1 0.454506 0.66442 0.805861 1816 1 0.413541 0.651662 0.71369 1529 1 0.395428 0.684808 0.846811 110 1 0.563735 0.506336 0.787768 1269 1 0.407355 0.937237 0.999656 1773 1 0.519475 0.520318 0.729402 1839 1 0.63391 0.552902 0.771321 1618 1 0.595272 0.520267 0.654523 1406 1 0.685726 0.559126 0.727518 1090 1 0.504226 0.507789 0.628071 1692 1 0.714953 0.721644 0.700204 1021 1 0.687402 0.503832 0.77669 1495 1 0.697997 0.57591 0.797248 1674 1 0.744368 0.645246 0.813129 527 1 0.87623 0.53704 0.733825 451 1 0.833119 0.569654 0.794583 1982 1 0.860834 0.613015 0.722184 1243 1 0.866586 0.58887 0.876232 644 1 0.807464 0.735159 0.771195 1436 1 0.928584 0.546866 0.774041 1929 1 0.761644 0.567482 0.83682 658 1 0.212305 0.97956 0.930162 1255 1 0.922014 0.607702 0.684969 109 1 0.899708 0.615829 0.80204 1111 1 0.882436 0.719936 0.791552 324 1 0.868647 0.526901 0.844843 32 1 0.109453 0.656885 0.696708 857 1 0.973701 0.668742 0.803296 1240 1 0.0627015 0.786857 0.815826 354 1 0.0505822 0.693554 0.816355 206 1 0.0977493 0.679353 0.770095 189 1 0.13008 0.78502 0.825521 975 1 0.189774 0.818334 0.625413 1537 1 0.273022 0.752956 0.811902 1398 1 0.206987 0.754967 0.681885 1524 1 0.242818 0.690565 0.800129 1134 1 0.161304 0.800355 0.744262 1856 1 0.146399 0.727825 0.716655 191 1 0.257522 0.725007 0.597012 1744 1 0.213478 0.831056 0.699989 1323 1 0.0800369 0.746024 0.731076 612 1 0.166181 0.702993 0.784187 593 1 0.248288 0.824405 0.782482 1404 1 0.284003 0.745898 0.725667 1266 1 0.328102 0.762229 0.664558 1400 1 0.31996 0.851968 0.708234 1168 1 0.470005 0.794444 0.792939 1596 1 0.393441 0.844787 0.760908 726 1 0.316944 0.805555 0.791537 882 1 0.362365 0.706198 0.688704 966 1 0.577614 0.762414 0.664931 1120 1 0.520681 0.778805 0.613588 1414 1 0.512267 0.801211 0.679833 511 1 0.353877 0.756409 0.746856 1747 1 0.560929 0.687972 0.894215 1301 1 0.627566 0.642434 0.747005 698 1 0.403468 0.706433 0.759576 1197 1 0.501689 0.820955 0.848714 1150 1 0.661503 0.677501 0.693376 475 1 0.457433 0.758161 0.726948 1366 1 0.61041 0.794194 0.768037 311 1 0.544922 0.686607 0.732332 534 1 0.703092 0.637873 0.743127 652 1 0.67251 0.654472 0.809336 1217 1 0.637222 0.757928 0.700124 1347 1 0.605052 0.856826 0.635384 599 1 0.648812 0.72741 0.781797 1268 1 0.811689 0.646684 0.831564 944 1 0.864259 0.771081 0.672737 972 1 0.778 0.778091 0.674051 148 1 0.740045 0.841221 0.675083 1470 1 0.739673 0.838039 0.775498 886 1 0.96906 0.638325 0.604759 1500 1 0.948242 0.671868 0.726971 71 1 0.922512 0.669314 0.650522 997 1 0.851982 0.693094 0.722954 999 1 0.887884 0.821631 0.789042 1603 1 0.967686 0.739638 0.822163 1461 1 0.908208 0.778677 0.840572 1005 1 0.935968 0.664288 0.874115 1289 1 0.958877 0.756658 0.893004 733 1 0.957624 0.849279 0.761752 1481 1 0.0758247 0.902558 0.63579 1963 1 0.507886 0.968441 0.978591 791 1 0.104927 0.9661 0.673982 1957 1 0.108577 0.864296 0.7015 1171 1 -0.00160964 0.851922 0.670523 1802 1 0.0326024 0.820786 0.721746 2023 1 0.899842 0.537459 0.966335 1580 1 0.105833 0.846142 0.768631 1030 1 0.09309 0.930877 0.833386 1101 1 0.640376 0.934334 0.924736 924 1 0.216916 0.905063 0.671576 1177 1 0.290401 0.947568 0.668697 193 1 0.162047 0.932581 0.795992 435 1 0.28947 0.975094 0.810253 1658 1 0.154517 0.90792 0.707938 1681 1 0.22677 0.97254 0.767646 1803 1 0.284079 0.932417 0.748061 1093 1 0.158523 0.852271 0.818469 773 1 0.188145 0.866242 0.755074 485 1 0.739538 0.987324 0.656946 1450 1 0.083541 0.97736 0.740628 735 1 0.866771 0.812546 0.9785 1786 1 0.391303 0.90839 0.714749 988 1 0.339113 0.896279 0.767635 685 1 0.367546 0.86409 0.826921 1141 1 0.44275 0.920305 0.876343 825 1 0.808549 0.928626 0.546356 1871 1 0.436706 0.84036 0.837984 1451 1 0.331493 0.985033 0.750496 1974 1 0.43674 0.928204 0.513866 1819 1 0.926815 0.891693 0.954893 1075 1 0.485258 0.909388 0.691226 427 1 0.507458 0.98031 0.630047 1305 1 0.542365 0.878749 0.709011 1611 1 0.473326 0.851308 0.753358 705 1 0.466674 0.986042 0.843595 458 1 0.41767 0.932153 0.802326 898 1 0.507019 0.926578 0.770117 63 1 0.572746 0.985003 0.871634 814 1 0.55733 0.869865 0.805279 802 1 0.640941 0.892393 0.774443 416 1 0.74906 0.972763 0.856192 117 1 0.708714 0.909871 0.826085 1047 1 0.650755 0.954172 0.798785 1528 1 0.58701 0.939962 0.760863 347 1 0.706185 0.934231 0.724233 1973 1 0.578643 0.970152 0.985507 590 1 0.773193 0.898218 0.729133 1890 1 0.771256 0.932771 0.792462 1665 1 0.829711 0.85648 0.905879 341 1 0.849502 0.837723 0.509899 1445 1 0.809591 0.878874 0.798545 1766 1 0.870894 0.907672 0.771946 942 1 0.889134 0.843616 0.642068 1677 1 0.971402 0.965842 0.705281 1857 1 0.885226 0.870471 0.841376 338 1 0.984513 0.766246 0.712112 1728 1 0.858224 0.876219 0.714673 68 1 0.873203 0.948547 0.837342 1460 1 0.941241 0.941305 0.805686 1647 1 0.0381212 0.973003 0.800741 619 1 0.993338 0.9169 0.763095 522 1 0.0616389 0.633951 0.955649 1036 1 0.0114135 0.640073 0.892512 1784 1 0.525528 0.521033 0.962686 301 1 0.993264 0.632101 0.957539 1401 1 0.17799 0.55901 0.513665 405 1 0.102002 0.571825 0.980185 1536 1 0.0994918 0.656013 0.851206 887 1 0.156228 0.678887 0.88902 1151 1 0.202318 0.588889 0.900075 450 1 0.190495 0.621251 0.840147 1750 1 0.213049 0.64573 0.934158 877 1 0.113096 0.58922 0.830258 1558 1 0.113291 0.517538 0.799245 1572 1 0.127376 0.597891 0.896171 218 1 0.244541 0.558643 0.976886 29 1 0.111826 0.703589 0.943805 285 1 0.465408 0.560841 0.950166 1332 1 0.421306 0.599033 0.852228 400 1 0.348786 0.721696 0.963032 2041 1 0.358641 0.585918 0.901333 428 1 0.307648 0.652104 0.931713 785 1 0.252348 0.617235 0.74322 1424 1 0.436183 0.597465 0.764833 1594 1 0.483345 0.588963 0.872963 1156 1 0.485931 0.697897 0.870575 10 1 0.409834 0.515217 0.8854 484 1 0.558082 0.575475 0.811266 1602 1 0.816895 0.540932 0.521158 1987 1 0.373086 0.648035 0.785112 1649 1 0.516892 0.913576 0.861057 625 1 0.571543 0.572547 0.982127 957 1 0.101745 0.961293 0.517009 1429 1 0.558883 0.620324 0.915629 572 1 0.55887 0.548206 0.909699 203 1 0.529218 0.644356 0.815028 819 1 0.470435 0.852066 0.922575 1541 1 0.626699 0.589522 0.838965 1102 1 0.71993 0.524616 0.914236 1205 1 0.711026 0.593826 0.969755 851 1 0.796139 0.505201 0.793181 719 1 0.634669 0.54161 0.962836 1807 1 0.164209 0.513386 0.935945 1971 1 0.7601 0.602091 0.915287 1903 1 0.774775 0.594671 0.986978 512 1 0.800583 0.526432 0.880968 1659 1 0.760753 0.987183 0.727863 1312 1 0.317045 0.525587 0.979412 452 1 0.770872 0.86698 0.526686 340 1 0.913578 0.60672 0.974668 1104 1 0.840693 0.583311 0.945084 418 1 0.956901 0.583983 0.913344 520 1 0.986843 0.528849 0.874949 1986 1 0.684387 0.933571 0.987798 224 1 0.0126067 0.709661 0.867009 504 1 0.0782908 0.86204 0.842205 952 1 0.965145 0.722548 0.948991 1180 1 0.0901633 0.870222 0.926443 19 1 0.04862 0.739585 0.925887 904 1 0.156761 0.8376 0.892975 1158 1 0.203125 0.714086 0.942632 948 1 0.202179 0.720301 0.861698 339 1 0.203408 0.7865 0.829838 290 1 0.234153 0.549551 0.765925 985 1 0.158156 0.765314 0.918126 1256 1 0.340043 0.711687 0.802638 342 1 0.427214 0.797064 0.902777 1975 1 0.345604 0.626113 0.843666 1455 1 0.257091 0.680902 0.871897 648 1 0.28024 0.726605 0.923498 853 1 0.395617 0.784302 0.805624 1241 1 0.326065 0.734932 0.868158 334 1 0.426914 0.746206 0.9542 283 1 0.414747 0.85303 0.959942 1919 1 0.343666 0.784544 0.929033 1949 1 0.446142 0.758764 0.843604 466 1 0.532899 0.783159 0.750234 852 1 0.435352 0.671405 0.943896 690 1 0.609031 0.777927 0.972417 2005 1 0.489839 0.785364 0.927937 2030 1 0.394235 0.734448 0.893604 386 1 0.762502 0.856059 0.876899 692 1 0.650265 0.66078 0.879053 216 1 0.694048 0.745467 0.987888 1264 1 0.590725 0.697941 0.829188 1389 1 0.508143 0.714612 0.802544 1970 1 0.601831 0.667778 0.954798 439 1 0.651122 0.728916 0.893894 425 1 0.522666 0.698644 0.966783 727 1 0.708813 0.692539 0.860306 124 1 0.723885 0.732659 0.923672 888 1 0.546948 0.830829 0.967331 576 1 0.696743 0.600498 0.87262 1735 1 0.823958 0.808852 0.734023 1027 1 0.761297 0.677135 0.93365 1172 1 0.627773 0.596694 0.915053 1775 1 0.769662 0.806223 0.971474 1746 1 0.68333 0.667323 0.942876 1623 1 0.790281 0.737111 0.952224 240 1 0.893861 0.794365 0.910896 670 1 0.793855 0.704206 0.873055 232 1 0.702703 0.800621 0.937825 850 1 0.278137 0.535178 0.504592 1676 1 0.901116 0.681419 0.946636 289 1 0.353549 0.95007 0.853028 1827 1 0.967246 0.821152 0.895934 1549 1 0.00954997 0.847353 0.951196 1897 1 0.859723 0.727611 0.918434 923 1 0.829843 0.654024 0.913925 1927 1 0.86582 0.692582 0.854282 749 1 1.00111 0.822177 0.827188 2018 1 0.0501413 0.802908 0.884378 697 1 0.953357 0.793878 0.964763 950 1 0.848916 0.959999 0.903102 2029 1 0.789057 0.916818 0.894156 257 1 0.081055 0.932285 0.97391 761 1 0.254825 0.862004 0.976783 1911 1 0.0201919 0.912366 0.830611 1940 1 0.0260658 0.901402 0.896117 885 1 0.101228 0.797626 0.965115 1432 1 0.173923 0.982894 0.699706 153 1 0.157966 0.87682 0.978075 1096 1 0.148431 0.908708 0.8707 1947 1 0.0219481 0.976861 0.952498 478 1 0.272132 0.841171 0.908537 1133 1 0.922251 0.513784 0.577964 913 1 0.259882 0.93746 0.957154 1610 1 0.240407 0.778837 0.912752 1742 1 0.195666 0.81258 0.949946 646 1 0.209726 0.882594 0.91513 208 1 0.252026 0.898172 0.806765 1555 1 0.367351 0.844698 0.913557 1983 1 0.462768 0.997374 0.577912 1221 1 0.323828 0.845061 0.969564 507 1 0.37407 0.918408 0.914051 1423 1 0.266133 0.934952 0.890303 2003 1 0.323263 0.810397 0.865301 1329 1 0.329776 0.915083 0.97471 902 1 0.192731 0.947068 0.985932 989 1 0.799408 0.994887 0.555996 1408 1 0.201661 0.993789 0.6196 229 1 0.491739 0.987953 0.508474 1556 1 0.0127948 0.930688 0.50358
[ "scheuclu@gmail.com" ]
scheuclu@gmail.com
2cac0ac3790b90127a38572fbc918208c45b1259
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/buildtools/third_party/libc++abi/libc++abi.gyp
c3e6c07e1f9e77e7a1da0892ab9edadcfe7a0916
[ "NCSA", "MIT", "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
Python
false
false
1,576
gyp
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'libc++abi', 'type': 'static_library', 'toolsets': ['host', 'target'], 'dependencies=': [], 'sources': [ 'trunk/src/abort_message.cpp', 'trunk/src/cxa_aux_runtime.cpp', 'trunk/src/cxa_default_handlers.cpp', 'trunk/src/cxa_demangle.cpp', 'trunk/src/cxa_exception.cpp', 'trunk/src/cxa_exception_storage.cpp', 'trunk/src/cxa_guard.cpp', 'trunk/src/cxa_handlers.cpp', 'trunk/src/cxa_new_delete.cpp', 'trunk/src/cxa_personality.cpp', 'trunk/src/cxa_thread_atexit.cpp', 'trunk/src/cxa_unexpected.cpp', 'trunk/src/cxa_vector.cpp', 'trunk/src/cxa_virtual.cpp', 'trunk/src/exception.cpp', 'trunk/src/private_typeinfo.cpp', 'trunk/src/stdexcept.cpp', 'trunk/src/typeinfo.cpp', ], 'include_dirs': [ 'trunk/include', '../libc++/trunk/include' ], 'variables': { 'clang_warning_flags': [ # http://llvm.org/PR25978 '-Wno-unused-function', ], }, 'cflags': [ '-fPIC', '-fstrict-aliasing', '-nostdinc++', '-pthread', '-std=c++11', ], 'cflags_cc!': [ '-fno-exceptions', '-fno-rtti', ], 'cflags!': [ '-fvisibility=hidden', ], }, ] }
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
6e082aea8360e7905c61b42c01eb77a38ed8b56c
a6e4a6f0a73d24a6ba957277899adbd9b84bd594
/sdk/python/pulumi_azure_native/documentdb/v20191212/list_database_account_keys.py
f639451de463da06e7decaaaabefad7426574541
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
MisinformedDNA/pulumi-azure-native
9cbd75306e9c8f92abc25be3f73c113cb93865e9
de974fd984f7e98649951dbe80b4fc0603d03356
refs/heads/master
2023-03-24T22:02:03.842935
2021-03-08T21:16:19
2021-03-08T21:16:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,464
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables __all__ = [ 'ListDatabaseAccountKeysResult', 'AwaitableListDatabaseAccountKeysResult', 'list_database_account_keys', ] @pulumi.output_type class ListDatabaseAccountKeysResult: """ The access keys for the given database account. """ def __init__(__self__, primary_master_key=None, primary_readonly_master_key=None, secondary_master_key=None, secondary_readonly_master_key=None): if primary_master_key and not isinstance(primary_master_key, str): raise TypeError("Expected argument 'primary_master_key' to be a str") pulumi.set(__self__, "primary_master_key", primary_master_key) if primary_readonly_master_key and not isinstance(primary_readonly_master_key, str): raise TypeError("Expected argument 'primary_readonly_master_key' to be a str") pulumi.set(__self__, "primary_readonly_master_key", primary_readonly_master_key) if secondary_master_key and not isinstance(secondary_master_key, str): raise TypeError("Expected argument 'secondary_master_key' to be a str") pulumi.set(__self__, "secondary_master_key", secondary_master_key) if secondary_readonly_master_key and not isinstance(secondary_readonly_master_key, str): raise TypeError("Expected argument 'secondary_readonly_master_key' to be a str") pulumi.set(__self__, "secondary_readonly_master_key", secondary_readonly_master_key) @property @pulumi.getter(name="primaryMasterKey") def primary_master_key(self) -> str: """ Base 64 encoded value of the primary read-write key. """ return pulumi.get(self, "primary_master_key") @property @pulumi.getter(name="primaryReadonlyMasterKey") def primary_readonly_master_key(self) -> str: """ Base 64 encoded value of the primary read-only key. """ return pulumi.get(self, "primary_readonly_master_key") @property @pulumi.getter(name="secondaryMasterKey") def secondary_master_key(self) -> str: """ Base 64 encoded value of the secondary read-write key. """ return pulumi.get(self, "secondary_master_key") @property @pulumi.getter(name="secondaryReadonlyMasterKey") def secondary_readonly_master_key(self) -> str: """ Base 64 encoded value of the secondary read-only key. """ return pulumi.get(self, "secondary_readonly_master_key") class AwaitableListDatabaseAccountKeysResult(ListDatabaseAccountKeysResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return ListDatabaseAccountKeysResult( primary_master_key=self.primary_master_key, primary_readonly_master_key=self.primary_readonly_master_key, secondary_master_key=self.secondary_master_key, secondary_readonly_master_key=self.secondary_readonly_master_key) def list_database_account_keys(account_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableListDatabaseAccountKeysResult: """ The access keys for the given database account. :param str account_name: Cosmos DB database account name. :param str resource_group_name: Name of an Azure resource group. """ __args__ = dict() __args__['accountName'] = account_name __args__['resourceGroupName'] = resource_group_name if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-native:documentdb/v20191212:listDatabaseAccountKeys', __args__, opts=opts, typ=ListDatabaseAccountKeysResult).value return AwaitableListDatabaseAccountKeysResult( primary_master_key=__ret__.primary_master_key, primary_readonly_master_key=__ret__.primary_readonly_master_key, secondary_master_key=__ret__.secondary_master_key, secondary_readonly_master_key=__ret__.secondary_readonly_master_key)
[ "noreply@github.com" ]
MisinformedDNA.noreply@github.com
2337d1dc5879ef718152539d26f659496418ac42
7b75735b6d894d0c3bb40d657dc4c4eb436716c1
/decompiled_code/library/encodings/mac_cyrillic.py
107b50c3a389093639823c79c0bad8ba23a86f8b
[]
no_license
anton-shipulin/TRISIS-TRITON-HATMAN
fe54fb994214e35f80d39c26fbc5289f0b57b2bd
1b167a9414b479331fb35a04eace75bb0e736005
refs/heads/master
2020-04-06T23:57:38.833044
2018-11-16T22:12:01
2018-11-16T22:12:01
157,886,273
3
0
null
2018-11-16T15:30:59
2018-11-16T15:30:58
null
UTF-8
Python
false
false
2,383
py
# uncompyle6 version 2.14.1 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.12 (default, Nov 19 2016, 06:48:10) # [GCC 5.4.0 20160609] # Embedded file name: encodings\mac_cyrillic.pyc # Compiled at: 2016-06-25 21:46:06 """ Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py. """ import codecs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return codecs.charmap_encode(input, errors, encoding_table) def decode(self, input, errors='strict'): return codecs.charmap_decode(input, errors, decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input, self.errors, encoding_table)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input, self.errors, decoding_table)[0] class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec, codecs.StreamReader): pass def getregentry(): return codecs.CodecInfo(name='mac-cyrillic', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter) decoding_table = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\xb0\u0490\xa3\xa7\u2022\xb6\u0406\xae\xa9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\xb1\u2264\u2265\u0456\xb5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\xac\u221a\u0192\u2248\u2206\xab\xbb\u2026\xa0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\xf7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u20ac' encoding_table = codecs.charmap_build(decoding_table)
[ "ICSrepo" ]
ICSrepo
7d2f40e4bd6adcc02a6d9b06df433d2786224b34
78a179ad824b6c70a33e0c6885e8d15e91cdbbdc
/correlation_sgd.py
a45a05f571ef8b9b87fc18bf8f728e5ced0288e2
[]
no_license
bio-ontology-research-group/pgsim
50ea74c9a0505e1a737a62441833aa6e3f2a8b8c
4461828923431235fb6bcd65025aff6522fd267b
refs/heads/master
2020-04-02T02:38:49.243292
2017-02-02T11:34:44
2017-02-02T11:34:44
49,642,348
1
3
null
null
null
null
UTF-8
Python
false
false
1,306
py
#!/usr/bin/env python import os import sys import numpy as np from scipy.stats import spearmanr, pearsonr from data import ( get_total_average_sims, get_diff_average_sims, DATA_ROOT) def get_correlations(measures, filename): ''' Calculates spearman and pearson correlations for annotation size with mean and annotation size with variance ''' corrs = list() # annots, mean, var = get_total_average_sims(measures, filename) annots, mean, var = get_diff_average_sims(measures, filename) r1, p1 = spearmanr(annots, mean) r2, p2 = spearmanr(annots, var) corrs.append((r1, p1, r2, p2)) r1, p1 = pearsonr(annots, mean) r2, p2 = pearsonr(annots, var) corrs.append((r1, p1, r2, p2)) return corrs def main(*args, **kwargs): if len(args) < 3: raise Exception('Please provide measures folder and filename') measures = args[1] filename = args[2] basename = os.path.basename(filename) name = os.path.splitext(basename)[0] corrs = get_correlations(measures, filename) with open(DATA_ROOT + measures + '/' + name + '.diff.tsv', 'w') as f: f.write('MEAN_CORR\tPVAL\tVAR_CORR\tPVAL\n') for corr in corrs: f.write('%f\t%f\t%f\t%f\n' % corr) if __name__ == '__main__': main(*sys.argv)
[ "coolmaksat@gmail.com" ]
coolmaksat@gmail.com
8b06cec79bca3f45e98d3df7c4466d5424a30695
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/62/usersdata/261/29578/submittedfiles/ex1.py
a8820f3dba06441ddcf5f5bb2dec3cd767f23e17
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
333
py
# -*- coding: utf-8 -*- from __future__ import division a = int(input('Digite a: ')) b = int(input('Digite b: ')) c = int(input('Digite c: ')) #COMECE A PARTIR DAQUI! delta = ((b*b) - (4*a*c))**(1/2) if delta <0: print (str("SRR")) else: x1 = (-b+delta)/2*a x2 = (-b-delta)/2*a print ("x1=",x1) print ("x2=",x2)
[ "rafael.mota@ufca.edu.br" ]
rafael.mota@ufca.edu.br
edda0fd39872ba56cf1cbc2084decebee6a9348f
6737ca32fe093c6ac6b203fc71dbc177853bfaee
/curate_orthogene/scripts/calc_identity_from_orthologs.py
5d3aa1e3d635a4b1c9a3209b01f684125c133c40
[]
no_license
lhui2010/bundle
56a47bcdd2d41718b51da8c8cf23ab43577dfb4e
e31c8f2f65260ceff110d07b530b67e465e41800
refs/heads/master
2022-08-31T17:12:26.081984
2022-08-03T08:37:38
2022-08-03T08:37:38
74,002,474
6
0
null
null
null
null
UTF-8
Python
false
false
3,477
py
#!/usr/bin/env python import logging import os import sys from multiprocessing import Pool import argparse import subprocess #TODO #Remove global variable #OptParser usage = """Calculate Identity from orthologs Usage: {} -o workdir REF_TAG Ortho_File QRY.fa REF.fa >A188.identity """.format(__file__) parser = argparse.ArgumentParser() parser.add_argument("REF_TAG", help="The unique keyword in gene IDs of reference genes") parser.add_argument("OrthoFile", help="The tab deliminated ortholog file of orthologs: Eg: A188_A188G12312 B73_Zm00001d001012") parser.add_argument("QRY_FA", help="Fasta of query fasta files") parser.add_argument("REF_FA", help="Fasta of reference fasta files") parser.add_argument("-o", "--output_dir", default='workdir', help="specifying output directory") parser.add_argument("-t", "--threads", default=55, type=int, help="specifying threads") args = parser.parse_args() WORKDIR = args.output_dir THREADS = args.threads REF_ID = args.REF_TAG ORTHO_FILE = args.OrthoFile QRY_FA = args.QRY_FA REF_FA = args.REF_FA #print([WORKDIR, THREADS, ORTHO_FILE, REF_ID, QRY_FA, REF_FA]) #exit() SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) + "/" #Required several scripts: #1. /lustre/home/liuhui/bin/lh_bin/select_fasta.pl #2. muscle in path dir #3. msa2identity.py in current dir #Input example #python parser_ortho.py final_ortho.txt.add_info.format A188.pep B73.pep def os_run_test(input_str, qry_fa = "A188.pep", ref_fa = "B73.pep", workdir="workdir"): print("\t".join([input_str, qry_fa, ref_fa])) #def os_run(input_str, qry_fa, ref_fa, workdir="workdir"): #def os_run(input_str, qry_fa = "A188.pep", ref_fa = "B73.pep", workdir="workdir"): def os_run(input_str, qry_fa = QRY_FA, ref_fa = REF_FA, workdir=WORKDIR): mylist = input_str.rstrip().split() qry_name = mylist[0] ref_names = mylist[1].split(',') output_fa = os.path.join(workdir, qry_name + ".fa") output_aln = os.path.join(workdir, qry_name + ".aln") output_identity = os.path.join(workdir, qry_name + ".identity") logging.warning("{} {} {} > {} ".format("perl " + SCRIPT_DIR + "select_fasta.pl", qry_name, qry_fa, output_fa)) os.system("{} {} {} > {} ".format("perl " + SCRIPT_DIR + "select_fasta.pl", qry_name, qry_fa, output_fa)) for ref_name in ref_names: logging.warning(ref_name) os.system("{} {} {} >> {} ".format("perl " + SCRIPT_DIR + "select_fasta.pl", ref_name, ref_fa, output_fa)) os.system("{} {} > {} ".format("muscle -in ", output_fa, output_aln)) os.system("{} {} {} > {} ".format("python " + SCRIPT_DIR + "msa2identity.py ", REF_ID, output_aln, output_identity)) if __name__ == "__main__": os.system("mkdir -p {}".format(WORKDIR)) file_lines = [] with open(ORTHO_FILE) as fh: file_lines = fh.readlines() #print(file_lines) # qry_fa = sys.argv[2] # ref_fa = sys.argv[3] with Pool(THREADS) as p: #p.apply_async(os_run, (file_lines, qry_fa, ref_fa,)) # p.map(os_run_test, file_lines) p.map(os_run, file_lines) output = subprocess.check_output("for iden_ite in {}/*identity; do sort -k4,4g $iden_ite |sed -n '1p;$p' ; done".format(WORKDIR), shell=True) print(output.decode()) # os.system("touch syn.identity && rm syn.identity") # output = os.system("for iden_ite in {}/*identity; do sort -k4,4g ${iden_ite} |sed -n '1p;$p' >>syn.identity; done".format(WORKDIR))
[ "lhui2010@gmail.com" ]
lhui2010@gmail.com
77674c66ad7d3b0b071716b52e09cf66241e1953
7abbcd16dcf2e639e53665d50ec113e1374b79eb
/checkout/urls.py
c05c00460f8ef6e05ed8dd59477e3f5d3f254c8b
[]
no_license
srajsonu/ROIIM-Assignment-Paysafe
ab6f160641adb69cef2f78bde594322f286ff089
1d9586e29f1871e4e9577ff2befd594c8a9cbbe4
refs/heads/main
2023-01-04T23:42:53.403941
2020-10-31T17:17:57
2020-10-31T17:17:57
null
0
0
null
null
null
null
UTF-8
Python
false
false
231
py
from django.urls import path from . import views app_name = 'checkout' urlpatterns = [ path('checkout/', views.checkout, name='checkout'), path('payment_successful/', views.payment_successful, name='payment_successful') ]
[ "srajsonu02@gmail.com" ]
srajsonu02@gmail.com
647f3deda5f5d676971bc2a4b5ae8dc0768e43ac
fcc0ef512e66483d4f14de8363baa79fbe4d4ab5
/Homework/HW4-Sentiment2/CMP462 HW04 Data/python/NaiveBayesWithNegationFeature.py
e58029d4da9b90ad9065ed59fbba57e8ca274321
[]
no_license
SeanCherngTW/Stanford-NLP
0831ee201dcba514dec1011e453888956c07eb40
41955ba4d8f5695086ace50c1bbe0cef3f9945f0
refs/heads/master
2021-09-07T04:43:41.262922
2018-02-17T16:03:21
2018-02-17T16:03:21
119,244,421
1
2
null
null
null
null
UTF-8
Python
false
false
10,695
py
# NLP Programming Assignment #4 # NaiveBayesWithNegationFeature # 2012 # # The area for you to implement is marked with TODO! # Generally, you should not need to touch things *not* marked TODO # # Remember that when you submit your code, it is not run from the command line # and your main() will *not* be run. To be safest, restrict your changes to # addExample() and classify() and anything you further invoke from there. # import sys import getopt import os import re import math import nltk from ImdbNaiveBayes import ImdbNaiveBayes punctuation_pat = '[.?]+' negation_pat = '(not|Not|n\'t|never|Never|no|No|seldom|neither|nor)' class NaiveBayesWithNegationFeature: imdb_naive_bayes = ImdbNaiveBayes() class TrainSplit: """Represents a set of training/testing data. self.train is a list of Examples, as is self.test. """ def __init__(self): self.train = [] self.test = [] class Example: """Represents a document with a label. klass is 'pos' or 'neg' by convention. words is a list of strings. """ def __init__(self): self.klass = '' self.words = [] def __init__(self): """NaiveBayes initialization""" self.FILTER_STOP_WORDS = False self.stopList = set(self.readFile('../data/english.stop')) self.numFolds = 10 ############################################################################# # TODO TODO TODO TODO TODO def classify(self, words): """ TODO 'words' is a list of words to classify. Return 'pos' or 'neg' classification. """ score_pos, score_neg = self.imdb_naive_bayes.get_score(words) if score_pos > score_neg: return 'pos' else: return 'neg' def addExample(self, klass, words): """ * TODO * Train your model on an example document with label klass ('pos' or 'neg') and * words, a list of strings. * You should store whatever data structures you use for your classifier * in the NaiveBayes class. * Returns nothing """ self.imdb_naive_bayes.add_words(klass, self.filterStopWords(words)) def filterStopWords(self, words): """ * TODO * Filters stop words found in self.stopList. """ new_words = [] isNegation = False # word_tag_list = nltk.pos_tag(words) # for word, tag in word_tag_list: # if re.match(negation_pat, word): # isNegation = True # if re.match(punctuation_pat, word): # isNegation = False # if word not in self.stopList: # if isNegation and (tag.startswith('JJ') or tag.startswith('V')): # word = 'NOT_' + word # new_words.append(word) for word in words: if re.match(negation_pat, word): isNegation = True if re.match(punctuation_pat, word): isNegation = False if word not in self.stopList: word = 'NOT_' + word if isNegation else word new_words.append(word) return new_words # TODO TODO TODO TODO TODO ############################################################################# def readFile(self, fileName): """ * Code for reading a file. you probably don't want to modify anything here, * unless you don't like the way we segment files. """ contents = [] f = open(fileName) for line in f: contents.append(line) f.close() result = self.segmentWords('\n'.join(contents)) return result def segmentWords(self, s): """ * Splits lines on whitespace for file reading """ return s.split() def trainSplit(self, trainDir): """Takes in a trainDir, returns one TrainSplit with train set.""" split = self.TrainSplit() posTrainFileNames = os.listdir('%s/pos/' % trainDir) negTrainFileNames = os.listdir('%s/neg/' % trainDir) for fileName in posTrainFileNames: example = self.Example() example.words = self.readFile('%s/pos/%s' % (trainDir, fileName)) example.klass = 'pos' split.train.append(example) for fileName in negTrainFileNames: example = self.Example() example.words = self.readFile('%s/neg/%s' % (trainDir, fileName)) example.klass = 'neg' split.train.append(example) return split def train(self, split): for example in split.train: words = example.words if self.FILTER_STOP_WORDS: words = self.filterStopWords(words) self.addExample(example.klass, words) def crossValidationSplits(self, trainDir): """Returns a lsit of TrainSplits corresponding to the cross validation splits.""" splits = [] posTrainFileNames = os.listdir('%s/pos/' % trainDir) negTrainFileNames = os.listdir('%s/neg/' % trainDir) # for fileName in trainFileNames: for fold in range(0, self.numFolds): split = self.TrainSplit() for fileName in posTrainFileNames: example = self.Example() example.words = self.readFile('%s/pos/%s' % (trainDir, fileName)) example.klass = 'pos' if fileName[2] == str(fold): split.test.append(example) else: split.train.append(example) for fileName in negTrainFileNames: example = self.Example() example.words = self.readFile('%s/neg/%s' % (trainDir, fileName)) example.klass = 'neg' if fileName[2] == str(fold): split.test.append(example) else: split.train.append(example) splits.append(split) return splits def test(self, split): """Returns a list of labels for split.test.""" labels = [] for example in split.test: words = example.words if self.FILTER_STOP_WORDS: words = self.filterStopWords(words) guess = self.classify(words) labels.append(guess) return labels def buildSplits(self, args): """Builds the splits for training/testing""" trainData = [] testData = [] splits = [] trainDir = args[0] if len(args) == 1: print '[INFO]\tPerforming %d-fold cross-validation on data set:\t%s' % (self.numFolds, trainDir) posTrainFileNames = os.listdir('%s/pos/' % trainDir) negTrainFileNames = os.listdir('%s/neg/' % trainDir) for fold in range(0, self.numFolds): split = self.TrainSplit() for fileName in posTrainFileNames: example = self.Example() example.words = self.readFile('%s/pos/%s' % (trainDir, fileName)) example.klass = 'pos' if fileName[2] == str(fold): split.test.append(example) else: split.train.append(example) for fileName in negTrainFileNames: example = self.Example() example.words = self.readFile('%s/neg/%s' % (trainDir, fileName)) example.klass = 'neg' if fileName[2] == str(fold): split.test.append(example) else: split.train.append(example) splits.append(split) elif len(args) == 2: split = self.TrainSplit() testDir = args[1] print '[INFO]\tTraining on data set:\t%s testing on data set:\t%s' % (trainDir, testDir) posTrainFileNames = os.listdir('%s/pos/' % trainDir) negTrainFileNames = os.listdir('%s/neg/' % trainDir) for fileName in posTrainFileNames: example = self.Example() example.words = self.readFile('%s/pos/%s' % (trainDir, fileName)) example.klass = 'pos' split.train.append(example) for fileName in negTrainFileNames: example = self.Example() example.words = self.readFile('%s/neg/%s' % (trainDir, fileName)) example.klass = 'neg' split.train.append(example) posTestFileNames = os.listdir('%s/pos/' % testDir) negTestFileNames = os.listdir('%s/neg/' % testDir) for fileName in posTestFileNames: example = self.Example() example.words = self.readFile('%s/pos/%s' % (testDir, fileName)) example.klass = 'pos' split.test.append(example) for fileName in negTestFileNames: example = self.Example() example.words = self.readFile('%s/neg/%s' % (testDir, fileName)) example.klass = 'neg' split.test.append(example) splits.append(split) return splits def main(): nb = NaiveBayesWithNegationFeature() # default parameters: no stop word filtering, and # training/testing on ../data/imdb1 if len(sys.argv) < 2: options = [('', '')] args = ['../data/imdb1/'] else: (options, args) = getopt.getopt(sys.argv[1:], 'f') if ('-f', '') in options: nb.FILTER_STOP_WORDS = True splits = nb.buildSplits(args) avgAccuracy = 0.0 fold = 0 for split in splits: classifier = NaiveBayesWithNegationFeature() accuracy = 0.0 for example in split.train: words = example.words if nb.FILTER_STOP_WORDS: words = classifier.filterStopWords(words) classifier.addExample(example.klass, words) for example in split.test: words = example.words if nb.FILTER_STOP_WORDS: words = classifier.filterStopWords(words) guess = classifier.classify(words) if example.klass == guess: accuracy += 1.0 accuracy = accuracy / len(split.test) avgAccuracy += accuracy print '[INFO]\tFold %d Accuracy: %f' % (fold, accuracy) fold += 1 avgAccuracy = avgAccuracy / fold print '[INFO]\tAccuracy: %f' % avgAccuracy if __name__ == "__main__": # nltk.download('all') main()
[ "seancherng.tw@gmail.com" ]
seancherng.tw@gmail.com
b29c08e430263fddd494f44cf1aa620f7cdf25de
5b70fbd53b534306c146ffb98a0f99d2343a948f
/src/Python/Problem99.py
8e774a09fb35eba85b4bcfd02776deb92c9fcb7f
[]
no_license
aniruddhamurali/Project-Euler
1f4ff3aa1e9c4efbc2a85026821e19a28b5edf90
408b3098fbc98ff3954679602c0468ddb56ea0ac
refs/heads/master
2020-03-20T23:07:22.178103
2018-07-27T01:40:46
2018-07-27T01:40:46
137,830,476
0
0
null
null
null
null
UTF-8
Python
false
false
479
py
def max_exp(): name = "Problem99.txt" file = open(name, 'r') maxNum = None track = 1 for line in file: comma = line.find(',') base = line[:comma] exp = line[comma+1:] base = float(base) exp = (int(exp))/700000 num = float(base**exp) if maxNum == None or num > maxNum: maxNum = num maxLine = track track = track + 1 return maxLine
[ "aniruddha.murali@gmail.com" ]
aniruddha.murali@gmail.com
4c7b091a0abe71c1c798652c3b184644b1afa2b9
325bee18d3a8b5de183118d02c480e562f6acba8
/india/india_c/india/ScriptDir/Initialization.py
6c7a76d5cc4ccf59d06d3fe9407de58d01d1dac9
[]
no_license
waynecanfly/spiderItem
fc07af6921493fcfc21437c464c6433d247abad3
1960efaad0d995e83e8cf85e58e1db029e49fa56
refs/heads/master
2022-11-14T16:35:42.855901
2019-10-25T03:43:57
2019-10-25T03:43:57
193,424,274
4
0
null
2022-11-04T19:16:15
2019-06-24T03:00:51
Python
UTF-8
Python
false
false
508
py
#coding:utf-8 import shutil import os class Initialization(object): def InitializeMain(self): shutil.rmtree('D:\item\OPDCMS\listed company update\india\data\zip/full') shutil.rmtree('D:\item\OPDCMS\listed company update\india\data\pdf/full') print("*"*93) for i in range(2): print("*" + '\t'*23 + "*") print("*" + '\t'*10 + '初始化完成!' + '\t'*11 + "*") for i in range(2): print("*" + '\t'*23 + "*") print("*" * 93)
[ "1370153124@qq.com" ]
1370153124@qq.com
de126b11e439484e7edf1502679f25c9f872f105
fba9dd10028ae22eadc6da307f6df66d3c658d2e
/Modulo02/Desafio037-Condicoes-Aninhadas.py
4e3fbc6f1abb423c280f4450d0de158de58b86eb
[]
no_license
GabrielCardoso2019/Curso-de-Python
bbf52330236a5847e6c48fe8ed01efd767a2f92e
2e3b4066d72d0dc599aa68b8ee2ab2571324a372
refs/heads/master
2023-02-25T03:41:35.906086
2021-02-01T17:31:57
2021-02-01T17:31:57
335,028,896
0
0
null
null
null
null
UTF-8
Python
false
false
626
py
num = int(input('Digite um número inteiro: ')) print('-=-' * 20) print('''Escolha uma das bases para conversão: [ 1 ] Converter para BINÁRIO [ 2 ] Converter para OCTAL [ 3 ] Converter para HEXADECIMAL''') opcao = int(input('\nEscolha uma opção: ')) print('-=-' * 20) if opcao == 1: print('{} converção para BINÁRIO é igual a {}'.format(num, bin(num)[2:])) elif opcao == 2: print('{} converção para OCTAL é igual a {}'.format(num, oct(num)[2:])) elif opcao == 3: print('{} converção para HEXADECIMAL é igual a {}'.format(num, hex(num)[2:])) else: print('Opção inválida. Tente novamente!')
[ "gabrielcardososs2016@hotmail.com" ]
gabrielcardososs2016@hotmail.com
858105027bcf88eca80662380259cb50b100db98
9405aa570ede31a9b11ce07c0da69a2c73ab0570
/aliyun-python-sdk-drds/aliyunsdkdrds/request/v20190123/DescribeDrdsParamsRequest.py
1b1483313ef380dd030b344e973375673ae5b08f
[ "Apache-2.0" ]
permissive
liumihust/aliyun-openapi-python-sdk
7fa3f5b7ea5177a9dbffc99e73cf9f00e640b72b
c7b5dd4befae4b9c59181654289f9272531207ef
refs/heads/master
2020-09-25T12:10:14.245354
2019-12-04T14:43:27
2019-12-04T14:43:27
226,002,339
1
0
NOASSERTION
2019-12-05T02:50:35
2019-12-05T02:50:34
null
UTF-8
Python
false
false
1,523
py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # # http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from aliyunsdkcore.request import RpcRequest class DescribeDrdsParamsRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Drds', '2019-01-23', 'DescribeDrdsParams','drds') def get_ParamLevel(self): return self.get_query_params().get('ParamLevel') def set_ParamLevel(self,ParamLevel): self.add_query_param('ParamLevel',ParamLevel) def get_DbName(self): return self.get_query_params().get('DbName') def set_DbName(self,DbName): self.add_query_param('DbName',DbName) def get_DrdsInstanceId(self): return self.get_query_params().get('DrdsInstanceId') def set_DrdsInstanceId(self,DrdsInstanceId): self.add_query_param('DrdsInstanceId',DrdsInstanceId)
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
d5ff0cf688e5fbed28f798dfc48819ae4b88c02e
53d4a3f2ec628c5482c78580064b5a36f85b5a70
/spider/__init__.py
fb47e17d5503683245603b58b54feaf52009f917
[ "BSD-2-Clause" ]
permissive
yaoxiaokui/PSpider
e4e883b4c01abd1f40e99473e1164b9f8508799f
6b1ea034541ea0317aae48d800e348a9a90ff798
refs/heads/master
2020-03-21T12:29:21.859903
2018-06-13T08:38:37
2018-06-13T09:20:45
138,554,987
0
1
BSD-2-Clause
2018-06-25T06:55:08
2018-06-25T06:55:07
null
UTF-8
Python
false
false
284
py
# _*_ coding: utf-8 _*_ """ define WebSpider, WebSpiderDist, and also define utilities and instances for web_spider """ __version__ = "1.3.0" from .utilities import * from .instances import Fetcher, Parser, Saver, Proxieser from .concurrent import TPEnum, WebSpider, WebSpiderDist
[ "qixianhu@qq.com" ]
qixianhu@qq.com
1736498bb96ef9719b6fdac3e8f5e3b846b361c3
947ccd64444a225caec6811a74747bd070a3cfe6
/shop/models.py
9f9b9617feb48ca113d8c2ff15c2855bf8743cf7
[]
no_license
mishaukr7/eschools
a6bca6118f62af6d90badd77848311a7bc3964cf
5dd5bf07901a6871470b54df763164dda67c5f19
refs/heads/master
2020-04-10T00:50:41.555444
2019-01-08T09:14:20
2019-01-08T09:14:20
160,697,869
2
0
null
null
null
null
UTF-8
Python
false
false
231
py
from django.db import models # Create your models here. class News(models.Model): title = models.TextField(max_length=400) content = models.TextField(max_length=4096) video = models.URLField(blank=True, null=True)
[ "mishaukr22@gmail.com" ]
mishaukr22@gmail.com
9d8166fa1ed04426e1ea570b534c19fd26448bfd
f636e71f45170e6cf197bcfc14a50af45fd828ed
/Lesson 7/examples/example1.py
50389e99a91e8bbac016e25a61b26af0bf0949bc
[]
no_license
mcgokable/Cources
872640c62fdb82f19ec7f5d20700fed85c4a3447
960ef7d4e72af0ec29c9a78220b44873f2ef2d35
refs/heads/master
2022-04-06T23:35:30.477455
2019-11-29T13:22:40
2019-12-05T07:31:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
408
py
import smtplib from email.message import EmailMessage server = smtplib.SMTP() server.connect('localhost') if __name__ == '__main__': message = EmailMessage() message['From'] = input('Email From: ') message['To'] = input('Email To: ') message['Subject'] = input('Subject: ') message.set_content(input('Message: ')) server.send_message( msg=message ) server.close()
[ "19941510metalhead@gmail.com" ]
19941510metalhead@gmail.com
4fe960c3b3305e438c3d415d14a910f867aea18b
dbb32a7d5b96a94533b27a6ccf2474c660a863b7
/containers/user/sources/utils/types/component/identity.py
fcfde17dd53b6c70d4fcd4381112bc7db3a823c4
[]
no_license
ankurhcu/FogBus2
772e8346c5e01e2aa8a02da9ef91fd696dd587a7
2cefabdd1d131fc8e9015ca31d414665e6014a69
refs/heads/main
2023-08-07T15:33:54.039724
2021-09-21T05:02:49
2021-09-21T05:02:49
410,610,212
1
0
null
2021-09-26T16:57:23
2021-09-26T16:57:22
null
UTF-8
Python
false
false
2,321
py
from .role import ComponentRole from ..basic import Address class ComponentIdentity: def __init__( self, addr: Address, role: ComponentRole = ComponentRole.DEFAULT, hostID: str = None, componentID: str = None, name: str = None, nameLogPrinting: str = None, nameConsistent: str = None): self.role = role self.addr = addr if componentID is None: self.componentID = '?' else: self.componentID = componentID if hostID is None: self.hostID = self.generateHostID() else: self.hostID = hostID if name is None: self.name = '%s-%s_%s-%d' % ( self.role.value, self.componentID, addr[0], addr[1]) else: self.name = name if nameLogPrinting is None: self.nameLogPrinting = self.name else: self.nameLogPrinting = nameLogPrinting if nameConsistent is None: self.nameConsistent = '%s_%s' % (self.role.value, self.hostID) else: self.nameConsistent = nameConsistent def generateHostID(self): info = self.addr[0] # return sha256(info.encode('utf-8')).hexdigest() return info @staticmethod def getHostIDFromNameConsistent(nameConsistent: str): return nameConsistent[-64:] def setIdentities( self, addr: Address = None, name: str = None, componentID: str = None, nameLogPrinting: str = None, nameConsistent: str = None, hostID: str = None): if addr is not None: self.addr = addr if name is not None: self.name = name else: self.name = '%s-%s_%s-%d' % ( self.role.value, self.componentID, self.addr[0], self.addr[1]) if componentID is not None: self.componentID = componentID if nameLogPrinting is not None: self.nameLogPrinting = nameLogPrinting else: self.nameLogPrinting = self.name if nameConsistent is not None: self.nameConsistent = nameConsistent if hostID is not None: self.hostID = hostID
[ "plocircle@live.com" ]
plocircle@live.com
c4cfc248eac8fcc9673f45a9e0869b6854d36951
8eff7e195a9cb4aba3700ff933782240fc5dfacf
/context-managers/change_path_context.py
bd75c25b168780b2de840c23346872b737fa9309
[]
no_license
ThiaguinhoLS/Code
58ec668df799f10b245267c3184c138d8434878c
8b3c6fb9eeb1479ccf92ae05ed578a9c44fa7138
refs/heads/master
2020-03-22T01:01:07.081909
2018-07-19T04:23:48
2018-07-19T04:23:48
139,278,276
0
0
null
null
null
null
UTF-8
Python
false
false
360
py
# -*- coding: utf-8 -*- from contextlib import contextmanager import os @contextmanager def change_path(path): ''' Altera o path atual e depois do fechamento do contexto retorna o path Como usar: with change_path('../'): do something ''' actual = os.getcwd() os.chdir(path) yield os.chdir(actual)
[ "tthiaguinho638@gmail.com" ]
tthiaguinho638@gmail.com
4c05bef3beda374eb0b8d163120cc24ec35bae39
cbbdbdfa3d69a11de5dbd80f860986c97ec10b67
/test/validate/test_base.py
279edbf7dd38a809869867722912f8a8cb73961a
[ "MIT" ]
permissive
lokeshmeher/schema
757cbc837c91f124774d3a1562ceccc255f17026
3c7478d27f87a2f1a7f2c2da67beced4a76704cc
refs/heads/master
2021-06-04T18:50:42.461646
2016-02-24T04:15:04
2016-02-24T04:15:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,512
py
# encoding: utf-8 from __future__ import unicode_literals import re from marrow.schema import Attribute, Container from marrow.schema.compat import unicode from marrow.schema.testing import ValidationTest from marrow.schema.validate.base import * class TestAlways(ValidationTest): validator = Always().validate valid = (None, False, True, 0, 1, 3.14, '', 'foo', [], ['bar'], {}, {'baz': 'diz'}) class TestNever(ValidationTest): validator = Never().validate invalid = TestAlways.valid class TestTruthy(ValidationTest): validator = Truthy(True).validate valid = (True, 'Foo', 1, [None], (None, ), set("abc")) invalid = (False, '', 0, [], tuple(), set()) class TestFalsy(ValidationTest): validator = Falsy(True).validate valid = TestTruthy.invalid invalid = TestTruthy.valid class TestRequired(ValidationTest): validator = Required(True).validate valid = (True, False, 0, 1, 'abc') invalid = (None, [], '') class TestMissing(ValidationTest): validator = Missing(True).validate valid = TestRequired.invalid invalid = TestRequired.valid class TestEmptyCallback(ValidationTest): validator = Callback().validate valid = TestTruthy.valid + TestTruthy.invalid class TestSuccessCallback(ValidationTest): validator = Callback(lambda V, v, x: v).validate valid = TestEmptyCallback.valid class TestFailureCallback(ValidationTest): validator = Callback(lambda V, v, x: Concern("Uh, no.")).validate invalid = TestSuccessCallback.valid class TestCallbacks(object): @Callback # Yes, you really can use it this way. Implies staticmethod. def raises(validator, value, context): raise Concern("Oh my no.") assert isinstance(raises, Callback) # Let's make sure that worked... def test_raises(self): try: self.raises.validate(None) except Concern as e: assert unicode(e) == "Oh my no." else: assert False, "Failed to raise a Concern." class TestInAny(ValidationTest): validator = In().validate valid = TestAlways.valid class TestInSimple(ValidationTest): validator = In([1, 2, 3]).validate valid = (1, 2, 3) invalid = (None, 0, 4, 'bob') class TestInDescriptive(ValidationTest): validator = In([(1, "First"), (2, "Second"), (3, "Third")]).validate valid = TestInSimple.valid invalid = TestInSimple.invalid class TestInCallback(ValidationTest): validator = In(lambda: [1, 2, 3]).validate valid = TestInSimple.valid invalid = TestInSimple.invalid class TestContains(object): empty = Contains() simple = Contains(27) callback = Contains(lambda: 42) def _do(self, validator): assert validator.validate([1, 27, 42]) == [1, 27, 42] try: validator.validate([1, 2, 3]) except Concern as e: assert unicode(e).startswith("Value does not contain: ") else: assert False, "Failed to raise a Concern." def test_empty(self): assert self.empty.validate([4, 20]) == [4, 20] def test_simple(self): self._do(self.simple) def test_callback(self): self._do(self.callback) class TestLength(object): empty = Length() simple = Length(20) callback = Length(lambda: 10) rangeish = Length(slice(5, 15, 2)) # Yup, even step works here. exact = Length(slice(32, 33)) # I.e. for an MD5 hash. L <= v < R tupleish = Length((5, 15)) # Won't work for now. See TODO. def test_empty(self): assert self.empty.validate('') == '' def _do(self, validator, good, bad): assert validator.validate(good) == good try: validator.validate(bad) except Concern as e: pass else: assert False, "Failed to raise a Concern." def test_simple(self): self._do(self.simple, " " * 5, " " * 25) self._do(self.simple, ('', ) * 5, None) def test_callback(self): self._do(self.callback, " " * 5, " " * 15) def test_rangeish(self): self._do(self.rangeish, " " * 7, " " * 8) self._do(self.rangeish, " " * 11, " " * 4) self._do(self.rangeish, " " * 11, " " * 27) self._do(self.rangeish, ('', ) * 5, None) def test_exact(self): self._do(self.exact, " " * 32, " " * 31) self._do(self.exact, " " * 32, " " * 33) class TestRange(object): empty = Range() minonly = Range(5, None) maxonly = Range(None, 5) minmax = Range(5, 10) odd = Range((2,6), (3,4)) callback = Range(None, lambda: 5) def _do(self, validator, good, bad): assert validator.validate(good) == good try: validator.validate(bad) except Concern as e: pass else: assert False, "Failed to raise a Concern." def test_empty(self): assert self.empty.validate('') == '' def test_minimum(self): self._do(self.minonly, 10, 3) self._do(self.minmax, 5, 4) def test_maximum(self): self._do(self.maxonly, 5, 10) self._do(self.minmax, 10, 11) self._do(self.minmax, 10, 11) self._do(self.callback, 5, 6) def test_odd(self): self._do(self.odd, (2,7), (2,4)) self._do(self.odd, (3,2), (3,5)) self._do(self.odd, (3, ), (2, )) class TestPattern(object): empty = Pattern() simple = Pattern(r'[a-zA-Z]+') # TODO: This is a simple string regex. simple = Pattern(re.compile(r'^[a-zA-Z]+$')) def test_empty(self): assert self.empty.validate('') == '' def test_simple(self): assert self.simple.validate('foo') == 'foo' try: self.simple.validate('Xyzzy-27!') except Concern as e: pass else: assert False, "Failed to raise a Concern." class TestInstance(object): empty = Instance() uni = Instance(unicode) def test_empty(self): assert self.empty.validate('') == '' def test_uni(self): assert self.uni.validate('hello') == 'hello' try: self.uni.validate(27) except Concern as e: pass else: assert False, "Failed to raise a Concern." class TestSubclass(object): empty = Subclass() valid = Subclass(Validator) def test_empty(self): assert self.empty.validate(object) is object def test_valid(self): assert self.valid.validate(Subclass) is Subclass try: self.valid.validate(object) except Concern as e: pass else: assert False, "Failed to raise a Concern." class TestEqual(object): empty = Equal() equal = Equal(27) nil = Equal(None) def test_empty(self): assert self.empty.validate('') == '' assert self.empty.validate(None) is None def test_equal(self): assert self.equal.validate(27) == 27 assert self.equal.validate(27.0) == 27.0 try: self.equal.validate('27') except Concern as e: pass else: assert False, "Failed to raise a Concern." def test_nil(self): assert self.nil.validate(None) is None try: self.equal.validate(False) except Concern as e: pass else: assert False, "Failed to raise a Concern." class TestUnique(object): validator = Unique() def _do(self, good, bad): assert self.validator.validate(good) == good try: self.validator.validate(bad) except Concern as e: pass else: assert False, "Failed to raise a Concern." def test_text(self): self._do('cafe', 'babe') def test_list(self): self._do([27, 42], [1, 3, 3, 7]) def test_dict(self): self._do(dict(bob=27, dole=42), dict(prince=12, pepper=12)) class TestValidated(ValidationTest): class Sample(Container): foo = Validated(validator=Equal(27)) def test_pass(self): inst = self.Sample(27) assert inst.foo == 27 inst = self.Sample() inst.foo = 27 def test_fail(self): try: self.Sample(42) except Concern as e: pass else: assert False, "Failed to raise a Concern." inst = self.Sample() try: inst.foo = 42 except Concern as e: pass else: assert False, "Failed to raise a Concern."
[ "alice@gothcandy.com" ]
alice@gothcandy.com
69056d35e2d53095946c30eb093026ce866e92e3
72f37dabe9cddde460c5f5afad802d7d3d972af7
/data_storage/transform.py
0ac0ff439cc65b183b2945f6b93d14ac2e70b27c
[ "Apache-2.0" ]
permissive
dbca-wa/data-storage
fdf6de6735f9e18688ad8a3d1755295b3c11fa2d
ff8c93978d78042117a9c04217a31c3d7ecb2a3f
refs/heads/master
2023-08-28T20:14:47.823353
2021-11-05T01:22:33
2021-11-05T01:22:33
263,812,682
0
2
Apache-2.0
2021-03-15T03:17:36
2020-05-14T04:13:51
Python
UTF-8
Python
false
false
2,554
py
import tempfile import os import json from .utils import remove_folder,JSONEncoder,JSONDecoder from .resource import ResourceConstant def change_metaindex(repository_metadata,f_metaname_code): """ Change the index calculating logic of the indexed resource repository repository_metadata: the current resource repository's metadata f_metaname_code: the new source code to calculate a resource's metaname """ work_dir = tempfile.mkdtemp() try: #save all existing resource metadatas to a json file with open(os.path.join(work_dir,"resource_metadatas.json"),'w') as f: for res_metadata in repository_metadata.resource_metadatas(throw_exception=False,resource_status=ResourceConstant.ALL_RESOURCE,resource_file=None): f.write(json.dumps(res_metadata,cls=JSONEncoder)) f.write(os.linesep) #meta index file meta_dir = os.path.join(work_dir,"metadata") os.mkdir(meta_dir) repository_metadata.download(os.path.join(meta_dir,"{}.json".format(repository_metadata._metaname))) #download all meta data file for metaname,filename in repository_metadata.json: repository_metadata.create_metadata_client(metaname).download(os.path.join(meta_dir,os.path.split(filename)[1])) #remove meta file for metaname in [o[0] for o in repository_metadata.json]: repository_metadata.create_metadata_client(metaname).delete() #remove meta index file repository_metadata.delete() #create a new repository metadata keywords = dict((key,getattr(repository_metadata,attr)) for key,attr in repository_metadata.meta_metadata_kwargs) keywords["f_metaname_code"] = f_metaname_code new_repository_metadata = repository_metadata.__class__(repository_metadata._storage,**keywords) with open(os.path.join(work_dir,"resource_metadatas.json"),'r') as f: while True: data = f.readline() if not data: break data = data.strip() if not data: continue res_metadata = json.loads(data.strip(),cls=JSONDecoder) new_repository_metadata.update_resource(res_metadata) remove_folder(work_dir) return new_repository_metadata except Exception as ex: print("Failed to change the metadata index, check the folder({}) to get the previous meta data".format(work_dir))
[ "rocky.chen@dpaw.wa.gov.au" ]
rocky.chen@dpaw.wa.gov.au
caf3a1cf2802137ee7375b4b494654cf0276b629
e8cac4db53b22a28f7421ede9089bd3d4df81c82
/TaobaoSdk/Request/CrmMembersGetRequest.py
89b1776c4812b806eae050d2d304f1c5622a7feb
[]
no_license
wangyu0248/TaobaoOpenPythonSDK
af14e84e2bada920b1e9b75cb12d9c9a15a5a1bd
814efaf6e681c6112976c58ec457c46d58bcc95f
refs/heads/master
2021-01-19T05:29:07.234794
2012-06-21T09:31:27
2012-06-21T09:31:27
4,738,026
7
1
null
null
null
null
UTF-8
Python
false
false
9,619
py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim: set ts=4 sts=4 sw=4 et: ## @brief 查询卖家的会员,进行基本的查询,返回符合条件的会员列表 # @author wuliang@maimiaotech.com # @date 2012-06-21 17:17:49 # @version: 0.0.0 import os import sys import time def __getCurrentPath(): return os.path.normpath(os.path.join(os.path.realpath(__file__), os.path.pardir)) __modulePath = os.path.join(__getCurrentPath(), os.path.pardir) __modulePath = os.path.normpath(__modulePath) if __modulePath not in sys.path: sys.path.insert(0, __modulePath) ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">查询卖家的会员,进行基本的查询,返回符合条件的会员列表</SPAN> # <UL> # </UL> class CrmMembersGetRequest(object): def __init__(self): super(self.__class__, self).__init__() ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">获取API名称</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">str</SPAN> # </LI> # </UL> self.method = "taobao.crm.members.get" ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">时间戳,如果不设置,发送请求时将使用当时的时间</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">int</SPAN> # </LI> # </UL> self.timestamp = int(time.time()) ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">买家的昵称</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">String</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.buyer_nick = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">显示第几页的会员,如果输入的页码大于总共的页码数,例如总共10页,但是current_page的值为11,则返回空白页,最小页数为1</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Number</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">required</SPAN> # </LI> # </UL> self.current_page = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">会员等级,0:返回所有会员1:普通客户,2:高级会员,3:VIP会员, 4:至尊VIP会员 (如果要查交易关闭的会员 请选择taobao.crm.members.search接口的 relation_source=2)</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Number</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.grade = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最迟上次交易时间</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Date</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.max_last_trade_time = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最大交易额,单位为元</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Price</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.max_trade_amount = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最大交易量</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Number</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.max_trade_count = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最早上次交易时间</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Date</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.min_last_trade_time = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最小交易额,单位为元</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Price</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.min_trade_amount = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">最小交易量</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Number</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.min_trade_count = None ## @brief <SPAN style="font-size:16px; font-family:'宋体','Times New Roman',Georgia,Serif;">表示每页显示的会员数量,page_size的最大值不能超过100条,最小值不能低于1,</SPAN> # <UL> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Type</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">Number</SPAN> # </LI> # <LI> # <SPAN style="color:DarkRed; font-size:18px; font-family:'Times New Roman',Georgia,Serif;">Required</SPAN>: <SPAN style="color:DarkMagenta; font-size:16px; font-family:'Times New Roman','宋体',Georgia,Serif;">optional</SPAN> # </LI> # </UL> self.page_size = None
[ "liyangmin@maimiaotech.com" ]
liyangmin@maimiaotech.com
990d08d4e433da42d21d96cc7f21a8a023df6a6b
81d45c86a32995518ede50bf550e110c22e6cf2c
/vtgs/v1.0/vtgs_trx_1.py
895dfe01e136b557c60c94f484fd07b9124846f5
[ "MIT" ]
permissive
otilrac/waveforms-1
04ecaa20ed5de63fffe7c789f7ff889ce9ae72b9
a44638ad79744007cf58aaf54f5d9517742004cc
refs/heads/master
2021-06-20T18:02:28.628136
2017-08-13T04:33:45
2017-08-13T04:33:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
38,990
py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: VTGS Rocksat-X 2017 Transceiver v1.0 # Generated: Sat Aug 5 00:47:30 2017 ################################################## if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print "Warning: failed to XInitThreads()" from PyQt4 import Qt from gnuradio import analog from gnuradio import blocks from gnuradio import digital from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr from gnuradio import qtgui from gnuradio import uhd from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.qtgui import Range, RangeWidget from grc_gnuradio import blks2 as grc_blks2 from optparse import OptionParser import kiss import mapper import pmt,struct,numpy,math ; from datetime import datetime as dt; import string import pyqt import sip import sys import time import vtgs from gnuradio import qtgui class vtgs_trx_1(gr.top_block, Qt.QWidget): def __init__(self, gs_name='VTGS', ip='0.0.0.0', iq_file='./rocksat_125kbd_500ksps_date_comment.dat', meta_rate=.1, port='52001', record_iq=0, record_rfo=0, record_snr=0, rfo_file='./rocksat_rfo_date_comment.meta', snr_file='./rocksat_snr_date_comment.meta', tx_correct=0, tx_freq=1265e6, tx_offset=250e3): gr.top_block.__init__(self, "VTGS Rocksat-X 2017 Transceiver v1.0") Qt.QWidget.__init__(self) self.setWindowTitle("VTGS Rocksat-X 2017 Transceiver v1.0") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "vtgs_trx_1") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.gs_name = gs_name self.ip = ip self.iq_file = iq_file self.meta_rate = meta_rate self.port = port self.record_iq = record_iq self.record_rfo = record_rfo self.record_snr = record_snr self.rfo_file = rfo_file self.snr_file = snr_file self.tx_correct = tx_correct self.tx_freq = tx_freq self.tx_offset = tx_offset ################################################## # Variables ################################################## self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y%m%d_%H%M%S.%f" )+'_UTC' self.samp_rate = samp_rate = 500e3 self.baud = baud = 125e3 self.samps_per_symb = samps_per_symb = int(samp_rate/baud) self.rx_freq = rx_freq = 2395e6 self.iq_fn = iq_fn = "{:s}_{:s}_{:s}k.fc32".format(gs_name, ts_str, str(int(samp_rate)/1000)) self.alpha = alpha = 0.5 self.uplink_label = uplink_label = '' self.tx_gain = tx_gain = 15 self.rx_offset = rx_offset = 250e3 self.rx_gain = rx_gain = 1 self.rx_freq_lbl = rx_freq_lbl = "{:4.3f}".format(rx_freq/1e6) self.rrc_filter_taps = rrc_filter_taps = firdes.root_raised_cosine(32, 1.0, 1.0/(samps_per_symb*32), alpha, samps_per_symb*32) self.mult = mult = (samp_rate)/2/3.141593 self.lpf_taps = lpf_taps = firdes.low_pass(1.0, samp_rate, samp_rate/2, 1000, firdes.WIN_HAMMING, 6.76) self.lo = lo = 1833e6 self.khz_offset = khz_offset = 0 self.iq_fp = iq_fp = "/captures/rocksat/{:s}".format(iq_fn) self.bb_gain = bb_gain = .5 ################################################## # Blocks ################################################## self._tx_gain_range = Range(0, 86, 1, 15, 200) self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, 'TX Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._tx_gain_win, 10,8,1,4) self._rx_gain_range = Range(0, 86, 1, 1, 200) self._rx_gain_win = RangeWidget(self._rx_gain_range, self.set_rx_gain, 'RX Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._rx_gain_win, 3,8,1,4) self._khz_offset_range = Range(-150, 150, 1, 0, 200) self._khz_offset_win = RangeWidget(self._khz_offset_range, self.set_khz_offset, 'Offset [kHz]', "counter_slider", float) self.top_grid_layout.addWidget(self._khz_offset_win, 4,8,1,4) self._bb_gain_range = Range(0, 1, .01, .5, 200) self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'bb_gain', "counter_slider", float) self.top_grid_layout.addWidget(self._bb_gain_win, 11,8,1,4) self.vtgs_mult_descrambler_0 = vtgs.mult_descrambler(17, 0x3FFFF) self.vtgs_ao40_decoder_0_0 = vtgs.ao40_decoder() self._uplink_label_tool_bar = Qt.QToolBar(self) if None: self._uplink_label_formatter = None else: self._uplink_label_formatter = lambda x: str(x) self._uplink_label_tool_bar.addWidget(Qt.QLabel('TX MSG'+": ")) self._uplink_label_label = Qt.QLabel(str(self._uplink_label_formatter(self.uplink_label))) self._uplink_label_tool_bar.addWidget(self._uplink_label_label) self.top_grid_layout.addWidget(self._uplink_label_tool_bar, 9,8,1,1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("addr=192.168.40.2", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source('gpsdo', 0) self.uhd_usrp_source_0.set_time_source('gpsdo', 0) self.uhd_usrp_source_0.set_subdev_spec('A:0', 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(rx_freq-lo, rx_offset), 0) self.uhd_usrp_source_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("addr=192.168.40.2", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_clock_source('gpsdo', 0) self.uhd_usrp_sink_0.set_time_source('gpsdo', 0) self.uhd_usrp_sink_0.set_subdev_spec('A:0', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq+tx_correct, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self._rx_freq_lbl_tool_bar = Qt.QToolBar(self) if None: self._rx_freq_lbl_formatter = None else: self._rx_freq_lbl_formatter = lambda x: str(x) self._rx_freq_lbl_tool_bar.addWidget(Qt.QLabel('RX Freq [MHz]'+": ")) self._rx_freq_lbl_label = Qt.QLabel(str(self._rx_freq_lbl_formatter(self.rx_freq_lbl))) self._rx_freq_lbl_tool_bar.addWidget(self._rx_freq_lbl_label) self.top_grid_layout.addWidget(self._rx_freq_lbl_tool_bar, 0,10,1,2) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=1, decimation=10, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=8, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=8, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw '', #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['pre-d', 'post', '', '', '', '', '', '', '', ''] colors = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-130, -20) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 5,0,4,8) self.qtgui_number_sink_2 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_2.set_update_time(0.10) self.qtgui_number_sink_2.set_title("") labels = ['EVM', '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_2.set_min(i, -1) self.qtgui_number_sink_2.set_max(i, 1) self.qtgui_number_sink_2.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_2.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_2.set_label(i, labels[i]) self.qtgui_number_sink_2.set_unit(i, units[i]) self.qtgui_number_sink_2.set_factor(i, factor[i]) self.qtgui_number_sink_2.enable_autoscale(False) self._qtgui_number_sink_2_win = sip.wrapinstance(self.qtgui_number_sink_2.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_2_win, 2,8,1,4) self.qtgui_number_sink_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_0_0_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0_0_0.set_title("") labels = ['SNR', '', '', '', '', '', '', '', '', ''] units = ['dB', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0_0_0_0.set_min(i, 0) self.qtgui_number_sink_0_0_0_0.set_max(i, 30) self.qtgui_number_sink_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_win = sip.wrapinstance(self.qtgui_number_sink_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_win, 1,8,1,4) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ['RX Freq Offset', 'SNR', '', '', '', '', '', '', '', ''] units = ['Hz', 'dB', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 0,8,1,2) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/10, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 9,0,4,8) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024*4, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate , #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.0010) self.qtgui_freq_sink_x_0.set_y_axis(-140, -20) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['pre-d', 'post', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,5,8) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-1, 1) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 5,8,4,4) self.pyqt_text_input_0 = pyqt.text_input() self._pyqt_text_input_0_win = self.pyqt_text_input_0; self.top_grid_layout.addWidget(self._pyqt_text_input_0_win, 9,9,1,3) self.mapper_demapper_soft_0 = mapper.demapper_soft(mapper.BPSK, ([0,1])) self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, (baud *(1+alpha) )/2, 1000, firdes.WIN_HAMMING, 6.76)) self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=48, postamble_bytes=10) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (lpf_taps), khz_offset*1000, samp_rate) self.digital_scrambler_bb_0 = digital.scrambler_bb(0x21, 0x0, 16) self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf(samps_per_symb, math.pi*2/100, (rrc_filter_taps), 32, 16, 1.5, 1) self.digital_gmsk_mod_0 = digital.gmsk_mod( samples_per_symbol=50, bt=alpha, verbose=False, log=False, ) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_costas_loop_cc_0_0 = digital.costas_loop_cc(math.pi*2/100, 2, False) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(math.pi*2/100, 2, False) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_socket_pdu_0_2 = blocks.socket_pdu("UDP_SERVER", ip, '52002', 1024, False) self.blocks_socket_pdu_0_1 = blocks.socket_pdu("TCP_SERVER", ip, '52003', 1024, False) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", ip, port, 1024, False) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1) self.blocks_nlog10_ff_0_1 = blocks.nlog10_ff(10, 1, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((bb_gain, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((mult, )) self.blocks_moving_average_xx_0_0_1 = blocks.moving_average_ff(100000, 0.00001, 4000) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(1000, 0.001, 4000) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(100000, 0.00001, 4000) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, iq_fp, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, )) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=1, num_outputs=2, input_index=0, output_index=int(record_iq), ) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 125e3, 1, 0) self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-3, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_1, 'pdus'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.blocks_socket_pdu_0_2, 'pdus'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.kiss_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.pyqt_text_input_0, 'pdus'), (self.kiss_hdlc_framer_0, 'in')) self.msg_connect((self.vtgs_ao40_decoder_0_0, 'valid_frames'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.vtgs_ao40_decoder_0_0, 'valid_frames'), (self.blocks_socket_pdu_0_1, 'pdus')) self.connect((self.analog_agc2_xx_0_0, 0), (self.digital_costas_loop_cc_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blks2_selector_0, 1), (self.blocks_file_sink_0, 0)) self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_number_sink_2, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0_1, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_moving_average_xx_0_0_1, 0), (self.qtgui_number_sink_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_nlog10_ff_0_1, 0), (self.blocks_moving_average_xx_0_0_1, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_gmsk_mod_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.digital_scrambler_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.mapper_demapper_soft_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 1), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.digital_costas_loop_cc_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.vtgs_mult_descrambler_0, 0)) self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.digital_scrambler_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.mapper_demapper_soft_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_squared_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blks2_selector_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.vtgs_mult_descrambler_0, 0), (self.vtgs_ao40_decoder_0_0, 0)) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "vtgs_trx_1") self.settings.setValue("geometry", self.saveGeometry()) event.accept() def get_gs_name(self): return self.gs_name def set_gs_name(self, gs_name): self.gs_name = gs_name self.set_iq_fn("{:s}_{:s}_{:s}k.fc32".format(self.gs_name, self.ts_str, str(int(self.samp_rate)/1000))) def get_ip(self): return self.ip def set_ip(self, ip): self.ip = ip def get_iq_file(self): return self.iq_file def set_iq_file(self, iq_file): self.iq_file = iq_file def get_meta_rate(self): return self.meta_rate def set_meta_rate(self, meta_rate): self.meta_rate = meta_rate def get_port(self): return self.port def set_port(self, port): self.port = port def get_record_iq(self): return self.record_iq def set_record_iq(self, record_iq): self.record_iq = record_iq self.blks2_selector_0.set_output_index(int(int(self.record_iq))) def get_record_rfo(self): return self.record_rfo def set_record_rfo(self, record_rfo): self.record_rfo = record_rfo def get_record_snr(self): return self.record_snr def set_record_snr(self, record_snr): self.record_snr = record_snr def get_rfo_file(self): return self.rfo_file def set_rfo_file(self, rfo_file): self.rfo_file = rfo_file def get_snr_file(self): return self.snr_file def set_snr_file(self, snr_file): self.snr_file = snr_file def get_tx_correct(self): return self.tx_correct def set_tx_correct(self, tx_correct): self.tx_correct = tx_correct self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(self.tx_freq+self.tx_correct, self.tx_offset), 0) def get_tx_freq(self): return self.tx_freq def set_tx_freq(self, tx_freq): self.tx_freq = tx_freq self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(self.tx_freq+self.tx_correct, self.tx_offset), 0) def get_tx_offset(self): return self.tx_offset def set_tx_offset(self, tx_offset): self.tx_offset = tx_offset self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(self.tx_freq+self.tx_correct, self.tx_offset), 0) def get_ts_str(self): return self.ts_str def set_ts_str(self, ts_str): self.ts_str = ts_str self.set_iq_fn("{:s}_{:s}_{:s}k.fc32".format(self.gs_name, self.ts_str, str(int(self.samp_rate)/1000))) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_samps_per_symb(int(self.samp_rate/self.baud)) self.set_mult((self.samp_rate)/2/3.141593) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate) self.qtgui_waterfall_sink_x_0.set_frequency_range(0, self.samp_rate) self.qtgui_freq_sink_x_1.set_frequency_range(0, self.samp_rate/10) self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate ) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, (self.baud *(1+self.alpha) )/2, 1000, firdes.WIN_HAMMING, 6.76)) self.set_iq_fn("{:s}_{:s}_{:s}k.fc32".format(self.gs_name, self.ts_str, str(int(self.samp_rate)/1000))) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) def get_baud(self): return self.baud def set_baud(self, baud): self.baud = baud self.set_samps_per_symb(int(self.samp_rate/self.baud)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, (self.baud *(1+self.alpha) )/2, 1000, firdes.WIN_HAMMING, 6.76)) def get_samps_per_symb(self): return self.samps_per_symb def set_samps_per_symb(self, samps_per_symb): self.samps_per_symb = samps_per_symb def get_rx_freq(self): return self.rx_freq def set_rx_freq(self, rx_freq): self.rx_freq = rx_freq self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(self.rx_freq-self.lo, self.rx_offset), 0) self.set_rx_freq_lbl(self._rx_freq_lbl_formatter("{:4.3f}".format(self.rx_freq/1e6))) def get_iq_fn(self): return self.iq_fn def set_iq_fn(self, iq_fn): self.iq_fn = iq_fn self.set_iq_fp("/captures/rocksat/{:s}".format(self.iq_fn)) def get_alpha(self): return self.alpha def set_alpha(self, alpha): self.alpha = alpha self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, (self.baud *(1+self.alpha) )/2, 1000, firdes.WIN_HAMMING, 6.76)) def get_uplink_label(self): return self.uplink_label def set_uplink_label(self, uplink_label): self.uplink_label = uplink_label Qt.QMetaObject.invokeMethod(self._uplink_label_label, "setText", Qt.Q_ARG("QString", self.uplink_label)) def get_tx_gain(self): return self.tx_gain def set_tx_gain(self, tx_gain): self.tx_gain = tx_gain self.uhd_usrp_sink_0.set_gain(self.tx_gain, 0) def get_rx_offset(self): return self.rx_offset def set_rx_offset(self, rx_offset): self.rx_offset = rx_offset self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(self.rx_freq-self.lo, self.rx_offset), 0) def get_rx_gain(self): return self.rx_gain def set_rx_gain(self, rx_gain): self.rx_gain = rx_gain self.uhd_usrp_source_0.set_gain(self.rx_gain, 0) def get_rx_freq_lbl(self): return self.rx_freq_lbl def set_rx_freq_lbl(self, rx_freq_lbl): self.rx_freq_lbl = rx_freq_lbl Qt.QMetaObject.invokeMethod(self._rx_freq_lbl_label, "setText", Qt.Q_ARG("QString", self.rx_freq_lbl)) def get_rrc_filter_taps(self): return self.rrc_filter_taps def set_rrc_filter_taps(self, rrc_filter_taps): self.rrc_filter_taps = rrc_filter_taps self.digital_pfb_clock_sync_xxx_0_0.update_taps((self.rrc_filter_taps)) def get_mult(self): return self.mult def set_mult(self, mult): self.mult = mult self.blocks_multiply_const_vxx_0.set_k((self.mult, )) def get_lpf_taps(self): return self.lpf_taps def set_lpf_taps(self, lpf_taps): self.lpf_taps = lpf_taps self.freq_xlating_fir_filter_xxx_0.set_taps((self.lpf_taps)) def get_lo(self): return self.lo def set_lo(self, lo): self.lo = lo self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(self.rx_freq-self.lo, self.rx_offset), 0) def get_khz_offset(self): return self.khz_offset def set_khz_offset(self, khz_offset): self.khz_offset = khz_offset self.freq_xlating_fir_filter_xxx_0.set_center_freq(self.khz_offset*1000) def get_iq_fp(self): return self.iq_fp def set_iq_fp(self, iq_fp): self.iq_fp = iq_fp self.blocks_file_sink_0.open(self.iq_fp) def get_bb_gain(self): return self.bb_gain def set_bb_gain(self, bb_gain): self.bb_gain = bb_gain self.blocks_multiply_const_vxx_0_0.set_k((self.bb_gain, )) def argument_parser(): parser = OptionParser(usage="%prog: [options]", option_class=eng_option) parser.add_option( "", "--gs-name", dest="gs_name", type="string", default='VTGS', help="Set gs_name [default=%default]") parser.add_option( "-a", "--ip", dest="ip", type="string", default='0.0.0.0', help="Set 0.0.0.0 [default=%default]") parser.add_option( "", "--iq-file", dest="iq_file", type="string", default='./rocksat_125kbd_500ksps_date_comment.dat', help="Set iq_file [default=%default]") parser.add_option( "", "--meta-rate", dest="meta_rate", type="eng_float", default=eng_notation.num_to_str(.1), help="Set meta_rate [default=%default]") parser.add_option( "-p", "--port", dest="port", type="string", default='52001', help="Set 52001 [default=%default]") parser.add_option( "", "--record-iq", dest="record_iq", type="intx", default=0, help="Set record_iq [default=%default]") parser.add_option( "", "--record-rfo", dest="record_rfo", type="intx", default=0, help="Set record_rfo [default=%default]") parser.add_option( "", "--record-snr", dest="record_snr", type="intx", default=0, help="Set record_snr [default=%default]") parser.add_option( "", "--rfo-file", dest="rfo_file", type="string", default='./rocksat_rfo_date_comment.meta', help="Set rfo_file [default=%default]") parser.add_option( "", "--snr-file", dest="snr_file", type="string", default='./rocksat_snr_date_comment.meta', help="Set snr_file [default=%default]") parser.add_option( "", "--tx-correct", dest="tx_correct", type="eng_float", default=eng_notation.num_to_str(0), help="Set tx_correct [default=%default]") parser.add_option( "", "--tx-freq", dest="tx_freq", type="eng_float", default=eng_notation.num_to_str(1265e6), help="Set tx_freq [default=%default]") parser.add_option( "", "--tx-offset", dest="tx_offset", type="eng_float", default=eng_notation.num_to_str(250e3), help="Set tx_offset [default=%default]") return parser def main(top_block_cls=vtgs_trx_1, options=None): if options is None: options, _ = argument_parser().parse_args() from distutils.version import StrictVersion if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): style = gr.prefs().get_string('qtgui', 'style', 'raster') Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) tb = top_block_cls(gs_name=options.gs_name, ip=options.ip, iq_file=options.iq_file, meta_rate=options.meta_rate, port=options.port, record_iq=options.record_iq, record_rfo=options.record_rfo, record_snr=options.record_snr, rfo_file=options.rfo_file, snr_file=options.snr_file, tx_correct=options.tx_correct, tx_freq=options.tx_freq, tx_offset=options.tx_offset) tb.start() tb.show() def quitting(): tb.stop() tb.wait() qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) qapp.exec_() if __name__ == '__main__': main()
[ "zleffke@vt.edu" ]
zleffke@vt.edu
e26e05796f0d6099c19bcd248bd8e34c70b566f3
c5fedd852a93dd20bd1ab4db41997e3eeae64e63
/sites/dev/settings.py
3bb980b38c96fc6e417092022163f6ba1fbc5356
[ "MIT" ]
permissive
rishikant42/django-business-logic
deab4e300f243da6428e19cc7c96d3af16375adc
6f3d0774d7d30b64dc73ed32736ec045afb5de48
refs/heads/master
2020-03-31T07:28:24.664684
2018-09-17T13:55:28
2018-09-17T13:55:28
null
0
0
null
null
null
null
UTF-8
Python
false
false
843
py
from ..settings import * DEBUG = True ALLOWED_HOSTS = ['*'] INSTALLED_APPS += [ # 'django_extensions', 'bootstrap3', 'sites.dev.books', ] ROOT_URLCONF = 'sites.dev.urls' WSGI_APPLICATION = 'sites.dev.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(os.path.dirname(__file__), 'db.sqlite3'), } } STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_FINDERS = [ 'sites.dev.utils.staticfiles.finders.AppDirectoriesIndexFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ] MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') if 'test' in sys.argv[1:] or 'jenkins' in sys.argv[1:]: from ..test.settings import *
[ "dgk@dgk.su" ]
dgk@dgk.su
2e1c064f2f9ec480216bc2fec17ee9324f1500a7
eb9f655206c43c12b497c667ba56a0d358b6bc3a
/python/testData/override/methodWithOverloadsInTheSameFile.py
70f8f8ba8877cc6015e8c1b173c3c5aa3f88a862
[ "Apache-2.0" ]
permissive
JetBrains/intellij-community
2ed226e200ecc17c037dcddd4a006de56cd43941
05dbd4575d01a213f3f4d69aa4968473f2536142
refs/heads/master
2023-09-03T17:06:37.560889
2023-09-03T11:51:00
2023-09-03T12:12:27
2,489,216
16,288
6,635
Apache-2.0
2023-09-12T07:41:58
2011-09-30T13:33:05
null
UTF-8
Python
false
false
211
py
from typing import overload class Foo: @overload def fun(self, s:str) -> str: pass @overload def fun(self, i:int) -> int: pass def fun(self, x): pass class B(Foo): <caret>pass
[ "Semyon.Proshev@jetbrains.com" ]
Semyon.Proshev@jetbrains.com
e46ebbee527c297550cc6be199c7e3e85394ba22
061684e59ba5c816419f763a25629af987f60d52
/CashAlgo/weighted_rsi_intraday_strategy.py
61ca7e5b7316c417ea7bfebdcb4aa5cb41feda39
[]
no_license
wangyouan/PythonTest
8d798fc5cde3ecaeb64301c3290fe51ea8577523
62177829b81e918cadb4a24527c4cdcaff734d7d
refs/heads/master
2021-06-17T11:18:11.973935
2017-03-26T07:07:18
2017-03-26T07:07:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,498
py
#!/usr/bin/python # -*- coding: utf-8 -*- # File name: weighted_rsi_intraday_strategy # Author: warn # Date: 27/12/2015 10:20 import numpy import talib import cashAlgoAPI class Strategy: long_flag = False short_flag = False def __init__(self): self.close_data = [] self.cnt = 0 self.last_data = None self.data_number = None self.rsi_period = None self.hold_volume = 0 self.total_capital = 0 self.current_capital = 0 def init(self): self.cnt = 0 self.close_data = [] self.hold_volume = 0 self.data_number = int(self.config.get("Strategy", "MaxDataNumber")) self.rsi_period = int(self.config.get("Strategy", "RsiPeriod")) self.current_capital = self.total_capital = float(self.config.get("Risk", "InitialCapital")) def onMarketDataUpdate(self, market, code, md): # The following time is not allowed to trade. Only trade from 9:30 am to 12:00 am, and from 13:00 to 16:00 time_info = md.timestamp.split('_') if not (int(time_info[1][:2]) in (range(10, 12) + range(13, 16)) or (time_info[1][:2] == '09' and int(time_info[1][2:]) >= 3000) or time_info[1][:4] == '1600'): return # Open price clear all the data if self.last_data != time_info[0]: self.last_data = time_info[0] self.close_data = [] if len(self.close_data) >= self.data_number: self.close_data.pop(0) self.close_data.append([md.lastPrice, md.lastVolume]) if len(self.close_data) >= self.rsi_period: rsi_result = self.get_weighted_rsi() if rsi_result < 30 and not self.long_flag: self.long_flag = True self.short_flag = False elif self.long_flag and 70 > rsi_result >= 30: self.long_flag = False volume = self.total_capital / 10 / md.lastPrice if md.lastPrice * volume > self.current_capital >= md.lastPrice: volume = self.current_capital / md.lastPrice if volume * md.lastPrice <= self.current_capital: self.long_security(md.timestamp, code, md.askPrice1, volume) elif self.long_flag and rsi_result >= 70: self.long_flag = False elif self.hold_volume: if rsi_result > 70 and not self.short_flag: self.short_flag = True elif self.short_flag and 70 >= rsi_result > 30: self.short_flag = False self.short_security(md.timestamp, code, md.lastPrice) if self.hold_volume and md.timestamp.split('_')[1][:4] == '1600': print "Close market at %s, and sell all the belongings" % md.timestamp self.short_security(md.timestamp, code, md.lastPrice) self.short_flag = False self.long_flag = False def long_security(self, timestamp, code, price, volume): order = cashAlgoAPI.Order(timestamp, 'SEHK', code, str(self.cnt), price, int(volume), "open", 1, "insert", "market_order", "today") self.mgr.insertOrder(order) self.cnt += 1 self.hold_volume += int(volume) self.current_capital -= int(volume) * price def short_security(self, timestamp, code, price): order = cashAlgoAPI.Order(timestamp, 'SEHK', code, str(self.cnt), price, self.hold_volume, "open", 1, "insert", "market_order", "today") self.mgr.insertOrder(order) self.cnt += 1 self.current_capital += self.hold_volume * price self.total_capital = self.current_capital self.hold_volume = 0 def onOHLCFeed(self, of): # print "feed price of %s is %s" % (of.productCode, of.close) md = cashAlgoAPI.MarketData([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) md.timestamp = of.timestamp md.market = of.market md.productCode = str(of.productCode) md.lastPrice = of.close md.askPrice1 = of.close md.bidPrice1 = of.close md.lastVolume = of.volume self.onMarketDataUpdate(of.market, of.productCode, md) # Process Order def onOrderFeed(self, of): pass # Process Trade def onTradeFeed(self, tf): # print "Trade feed: %s price: %s, timestamp: %s volume: %s" % (tf.buySell, tf.price, tf.timestamp, tf.volume) pass # Process Position def onPortfolioFeed(self, portfolioFeed): pass # Process PnL def onPnlperffeed(self, pf): # print "dailyPnL: %s" % pf.dailyPnL pass def get_weighted_rsi(self): up_price = [] down_price = [] last_price = None close_data = self.close_data[-self.rsi_period:] for i in close_data: if last_price: if last_price > i[0]: down_price.append(i) elif last_price < i[0]: up_price.append(i) last_price = i[0] up_rs = sum([i[0] * i[1] for i in up_price]) / sum([i[1] for i in up_price]) if down_price: down_rs = sum([i[0] * i[1] for i in down_price]) / sum([i[1] for i in down_price]) else: down_rs = 0.01 rsi = 100 - 100 / (1 + up_rs / down_rs) return rsi
[ "wangyouan0629@hotmail.com" ]
wangyouan0629@hotmail.com
f4a3e6d8a542ab88facff6b22770e3ff898d3050
f6f29c2fa719c53eee73de2acd86db9e1278182e
/design_patterns/observor/event_system.py
6661d910ed6e4bf7106b6ddb905dac47ca3f201a
[]
no_license
byt3-m3/python_code_practice
ca08320e1778449d30204b65f15903d5830b7975
40e215c4d4ab62cf7d55d2456d94550335825906
refs/heads/master
2023-07-24T08:29:06.624850
2021-09-04T02:39:32
2021-09-04T02:39:32
256,984,457
0
0
null
null
null
null
UTF-8
Python
false
false
2,369
py
from dataclasses import dataclass from enum import Enum from queue import Queue from typing import List, Tuple, Any import asyncio class RegisteredMethods(Enum): """""" message_que = Queue() @dataclass class Event: event_name: str data: Any class EventManager: subscribers = dict() def __init__(self, *args, **kwargs): self.name = kwargs.get("name") def subscribe(self, event_name, function): if event_name not in self.subscribers: self.subscribers[event_name] = {function} # self.subscribers[event_name].(function) def publish_event(self, event: Event): if event.event_name not in self.subscribers: return for function in self.subscribers[event.event_name]: test = asyncio.create_task(function(event.data)) # function(event.data) def register_handlers(self, event_handler_tuples: List[Tuple[str, str]]): for event_handler_tuple in event_handler_tuples: print(f"Registering {event_handler_tuple}") self.subscribe(event_handler_tuple[0], event_handler_tuple[1]) @property def registered_handlers(self): return {'registered_handlers': list(self.subscribers.items())} class Handlers: @staticmethod def handle_send_message_event(data): print(f"Sending Message: {data}") @staticmethod def handle_send_email_event(data): print(f"Sending Email1: {data}") @staticmethod def handle_send_email_event2(data): print(f"Sending Email2: {data}") def get_event_manager(name: str): event_manager = EventManager(name) event_manager.register_handlers(event_handler_tuples=[ ('send_message', Handlers.handle_send_message_event), ('send_email', Handlers.handle_send_email_event), # ('send_email', Handlers.handle_send_email_event2) ]) return event_manager def main(): test_data = {"test": "data"} event_1 = Event( data=test_data, event_name='send_email' ) event_2 = Event( data=test_data, event_name='send_message' ) event_manager = get_event_manager(name='TestBus') event_manager.publish_event(event=event_1) event_manager.publish_event(event=event_2) print(event_manager.registered_handlers) if __name__ == '__main__': main()
[ "cbaxtertech@gmail.com" ]
cbaxtertech@gmail.com
7ae1ccf015cbb9f6702d6dbac4c89554e20e7909
ba9e1fc7797ebc55a61a40ee66c51b467f353ff1
/web_scraping_with_python_demos/docx-parser.py
d56bc005da5bfc4c2d478182efe0cc74e860b49e
[]
no_license
sanpianye/the-little-python
77c938164d43cbb120063a6d17d0705cc9e92e93
c04898bf0812afb53b71567699ee523d1bc56a29
refs/heads/master
2021-06-14T01:55:31.452777
2017-03-09T13:31:59
2017-03-09T13:31:59
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,122
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '''''' __author__ = 'Engine' from zipfile import ZipFile from urllib.request import urlopen from io import BytesIO from bs4 import BeautifulSoup # 从.docx文件读取xml的步骤 # 1. 读取.docx文件 wordFile = urlopen("http://pythonscraping.com/pages/AWordDocument.docx").read() # 2. 转换成二进制对象 wordFile = BytesIO(wordFile) # 3. 解压(所有.docx文件为了节省空间都进行过压缩) document = ZipFile(wordFile) # 4. 读取解压文件, 就得到了xml内容 xml_content = document.read("word/document.xml") # 创建BeautifulSoup对象 wordObj = BeautifulSoup(xml_content.decode("utf-8")) # 根据xml标签再处理就很简单了 textStrings = wordObj.findAll("w:t") # 所有正文内容都包含在<w:t>标签里 for textElem in textStrings: closeTag = "" try: style = textElem.parent.previousSibling.find("w:pstyle") if style is not None and style["w:val"] == "Title": print("<h1>") closeTag = "</h1>" except AttributeError: pass print(textElem.text) print(closeTag)
[ "enginechen07@gmail.com" ]
enginechen07@gmail.com
a2a3894ce8cbaf1c0878ecb12053cf13cd82f539
edfcd96f0010ea068a4c046bdcf7067ff92d3f9b
/Cryptography/Find_Files_5.py
c6fe25661616e3f39926bcb2020522f17adf1491
[]
no_license
afsanehshu/python-project
a99ff558f375c1f5e17ea6ffc13af9216ec4733f
48905cfd24df6d1f48460d421ed774f19403cf53
refs/heads/main
2023-08-03T01:53:32.812949
2021-09-22T19:36:25
2021-09-22T19:36:25
409,303,454
0
0
null
null
null
null
UTF-8
Python
false
false
1,080
py
from subprocess import check_output def find_drive(): drive = ["A:","B:","C:","D:","E:","F:","G:","H:","Z:","N:","K:","L:","X:","P:","U:","J:","S:","R:","W:","Q:","T:","Y:","I:","O:","V:","M:"] system_drive = [] cmd = check_output("net share",shell=True) for i in drive: if i in cmd: system_drive.append(i) return system_drive def find_files(drives): for p in Extension_Files: try: cmd = check_output("cd / && dir /S /B *."+p,shell=True) f.writelines(cmd) print p except: pass for d in drives: for p in Extension_Files: try: cmd = check_output(d+"&& dir /S /B *."+p,shell=True) f.writelines(cmd) print p+"-------"+d except: pass f.close() Extension_Files = ["jpg","txt","pdf"] drives = find_drive() f = open("File_Path.txt","w") find_files(drives)
[ "afsanehshu@gmail.com" ]
afsanehshu@gmail.com
5bae2dd0b98a698b47ecc1b62c9b3f817edb250c
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p02706/s376556276.py
52d2b727b08cf6404ff408485c8063321452bc56
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
242
py
def main(): n, m = map(int, input().split()) a_lst = list(map(int, input().split())) total = sum(a_lst) if total > n: ans = -1 else: ans = n - total print(ans) if __name__ == "__main__": main()
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
1c67c11e8d837208916769996d99f60998ebd5a2
431963e431a277ec5682973f275f7d43f8b2b4de
/hackrankoj/strings/design_door_mat.py
85161e85275b6c0c9e950c9dafe9bfb223d3ae88
[]
no_license
gitter-badger/python_me
168e1fd126f42c92de7e82833251abce63fe2d0a
8f31da00530e7132e58d0c1c06b5805a6b0f96e6
refs/heads/master
2020-12-03T01:56:38.909715
2017-03-15T01:02:04
2017-03-15T01:02:04
95,884,399
0
0
null
2017-06-30T11:59:27
2017-06-30T11:59:27
null
UTF-8
Python
false
false
602
py
N, M = map(int,raw_input().split()) #主要是这个输入的,map返回的是一个list,如果只有一个变量接受,那那个变量就是指向一个list, #如果好几个,那就是unpack赋值,此时list当中元素的个数要和变量个数是一致的! for i in xrange(1,N,2): print ('.|.'*i).center(3*N,'-') print 'WELCOME'.center(3*N,'-') for i in xrange(N-2,-1,-2): #还有这个,range的范围到-1为止截止,不要和切片里面的-1混淆,好老是想怎么到最后一个元素去了,这里是一个概念么?!! print ('.|.'*i).center(3*N,'-')
[ "chenye626@gmail.com" ]
chenye626@gmail.com
0edbee8ebd09aff5b83eced5e5ffea2cae7567eb
1860aa3e5c0ba832d6dd12bb9af43a9f7092378d
/modules/xlwt3-0.1.2/examples/formulas.py
460a7b22c17dd8037a1feebf63797f1a29d9c3c6
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
agz1990/GitPython
d90de16451fab9222851af790b67bcccdf35ab75
951be21fbf8477bad7d62423b72c3bc87154357b
refs/heads/master
2020-08-06T18:12:26.459541
2015-07-05T14:58:57
2015-07-05T14:58:57
12,617,111
1
2
null
null
null
null
UTF-8
Python
false
false
1,359
py
#!/usr/bin/env python # -*- coding: windows-1251 -*- # Copyright (C) 2005 Kiseliov Roman from xlwt3 import * w = Workbook() ws = w.add_sheet('F') ws.write(0, 0, Formula("-(1+1)")) ws.write(1, 0, Formula("-(1+1)/(-2-2)")) ws.write(2, 0, Formula("-(134.8780789+1)")) ws.write(3, 0, Formula("-(134.8780789e-10+1)")) ws.write(4, 0, Formula("-1/(1+1)+9344")) ws.write(0, 1, Formula("-(1+1)")) ws.write(1, 1, Formula("-(1+1)/(-2-2)")) ws.write(2, 1, Formula("-(134.8780789+1)")) ws.write(3, 1, Formula("-(134.8780789e-10+1)")) ws.write(4, 1, Formula("-1/(1+1)+9344")) ws.write(0, 2, Formula("A1*B1")) ws.write(1, 2, Formula("A2*B2")) ws.write(2, 2, Formula("A3*B3")) ws.write(3, 2, Formula("A4*B4*sin(pi()/4)")) ws.write(4, 2, Formula("A5%*B5*pi()/1000")) ############## ## NOTE: parameters are separated by semicolon!!! ############## ws.write(5, 2, Formula("C1+C2+C3+C4+C5/(C1+C2+C3+C4/(C1+C2+C3+C4/(C1+C2+C3+C4)+C5)+C5)-20.3e-2")) ws.write(5, 3, Formula("C1^2")) ws.write(6, 2, Formula("SUM(C1;C2;;;;;C3;;;C4)")) ws.write(6, 3, Formula("SUM($A$1:$C$5)")) ws.write(7, 0, Formula('"lkjljllkllkl"')) ws.write(7, 1, Formula('"yuyiyiyiyi"')) ws.write(7, 2, Formula('A8 & B8 & A8')) ws.write(8, 2, Formula('now()')) ws.write(10, 2, Formula('TRUE')) ws.write(11, 2, Formula('FALSE')) ws.write(12, 3, Formula('IF(A1>A2;3;"hkjhjkhk")')) w.save('formulas.xls')
[ "522360568@qq.com" ]
522360568@qq.com
cab031ae11fb3718e0a6baeb7ec9c3ccfef1d7e9
b92e187f60b1bc8bd74eaa0ffc6e1ac50911a08e
/python/randperson.py
34f0715c975e12cabe2b53093dfeccf3c4ab59a7
[]
no_license
code-xD/codefundo-hack
ad5b149726188bd15be7476f14adf90f08ff33d7
f4883015d2d5f4b1b6a493ffa58249c46fc544a1
refs/heads/master
2022-12-10T10:41:30.388439
2019-08-20T12:06:19
2019-08-20T12:06:19
195,676,080
0
1
null
2022-05-25T03:12:11
2019-07-07T16:56:28
CSS
UTF-8
Python
false
false
1,305
py
from random import randint import json def genper(): randperlist = [] with open("randomdata/names.dat", 'r') as names: with open("randomdata/address.dat", 'r') as address: with open("randomdata/pin.dat", 'r') as pins: for i in range(50): randpersonDict = dict() randpersonDict['voter_name'] = names.readline()[:-1] randpersonDict['aLine1'] = address.readline()[:-1] randpersonDict['aLine2'] = address.readline()[:-1] randpersonDict['pin'] = pins.readline()[:-1] randpersonDict['s_code'] = randint(1, 5) randpersonDict['c_code'] = randint(1, randpersonDict['s_code']*2) randpersonDict['d_code'] = randint(1, randpersonDict['c_code']*2) randpersonDict['age'] = randint(18, 100) if i < 25: randpersonDict['gender'] = 1 else: randpersonDict['gender'] = 2 randpersonDict['aadhar_no'] = int( ''.join([str(randint(1, 9)) for i in range(12)])) randperlist.append(json.dumps(randpersonDict)) return randperlist print(genper()[0])
[ "shivansh586@gmail.com" ]
shivansh586@gmail.com
2faad1676557dc4b03d872486ecf0b9987f89875
9a5b0bcc1302373fc37315e15def172e2d5a8e3a
/demo/libdemo/list_mobiles.py
ce3c4a8aad9f7232493144ebd7556683338cf873
[]
no_license
srikanthpragada/PYTHON_06_APR_2020
b74a7d2e80d8a8ffe203ba5bd562484e80b3502b
f999c5ca001137d21b9cd6ca55f3e35dd0e6c3ca
refs/heads/master
2021-05-25T15:02:38.057653
2020-05-07T13:29:01
2020-05-07T13:29:01
253,799,331
1
1
null
null
null
null
UTF-8
Python
false
false
194
py
f = open("mobiles.txt", "rt") mobiles = [] for line in f.readlines(): parts = line.strip().split(',') mobiles.extend(parts) f.close() for mobile in sorted(mobiles): print(mobile)
[ "srikanthpragada@gmail.com" ]
srikanthpragada@gmail.com
2c5cac0cff0f1ded9317a146c18bfbd93283ec12
b4166044870d1c026e86c95ac41e3e3613ee424f
/python_basic/abc083_b.py
2601012108b74d5bd9f1837c7d3fee4758f9b704
[]
no_license
nsakki55/AtCoder
2cbb785415a7c0b9df9953ddc3706c90a5716a03
03c428e8eb8f24b8560d00e2388ba75509619690
refs/heads/master
2020-05-31T04:33:06.400697
2020-01-19T13:41:41
2020-01-19T13:41:41
190,099,669
0
0
null
null
null
null
UTF-8
Python
false
false
133
py
n,a,b=map(int,input().split()) ans=0 for i in range(1,n+1): if a<=sum(map(int,list(str(i))))<=b: ans+=i print(ans)
[ "n.sakki55@gmail.com" ]
n.sakki55@gmail.com
b2081078ee4bfd2203caa42da05edebc5a56f1d9
34bfa980bf04365bde38f30506c4e375a5e40186
/Question3.py
60192f77eb5e5a9f96e621ac29b7a136b6039461
[]
no_license
krishnabojha/Insight_workshopAssignment4
a797f6fa650c099f3d2f3e86dce82bc670d158e6
dcc2b9bae8ada46dc440b73406cea7b79796cff8
refs/heads/master
2022-11-10T15:12:22.742117
2020-07-05T12:55:46
2020-07-05T12:55:46
277,301,683
0
0
null
null
null
null
UTF-8
Python
false
false
491
py
############## find Anagram word of paragraph from collections import defaultdict def find_anagram(words): groupedWords = defaultdict(list) for word in words: groupedWords["".join(sorted(word))].append(word) print("The word and it's anagram : ") for group in groupedWords.values(): print(" ".join(group)) if __name__ == "__main__": paragraph =input("Enter your paragraph : ").split() find_anagram(paragraph)
[ "ojhakrishna010@gmail.com" ]
ojhakrishna010@gmail.com
11def6de3c772d0ff5c0f3a581b1122036c21c10
2f63688febd21dc3ae6b19abfa79ad313c820154
/0918_Maximum_Sum_Circular_Subarray/try_1.py
d4bcafd84f354962e6ea4f78b507e82d76e60c5c
[]
no_license
novayo/LeetCode
cadd03587ee4ed6e35f60294070165afc1539ac8
54d0b3c237e0ffed8782915d6b75b7c6a0fe0de7
refs/heads/master
2023-08-14T00:35:15.528520
2023-07-30T05:56:05
2023-07-30T05:56:05
200,248,146
8
1
null
2022-11-19T04:37:54
2019-08-02T14:24:19
Python
UTF-8
Python
false
false
653
py
class Solution: def maxSubarraySumCircular(self, A: List[int]) -> int: # Kadane's algorithm : https://www.youtube.com/watch?v=86CQq3pKSUw def Kadane(A): cur_max = max_sum = A[0] cur_min = min_sum = A[0] sum = A[0] for i in range(1, len(A)): cur_max = max(A[i], cur_max + A[i]) max_sum = max(max_sum, cur_max) cur_min = min(A[i], cur_min + A[i]) min_sum = min(min_sum, cur_min) sum += A[i] return max(max_sum, sum-min_sum) if max_sum > 0 else max_sum return Kadane(A)
[ "f14051172@gs.ncku.edu.tw" ]
f14051172@gs.ncku.edu.tw
799897d2411998aa3a754bb8328495b8a607867c
74cafb5c10a700fb7aca1447edff45235563b304
/Exercises_2/loops/l12.py
d2c7ddfe1173577eabb409c9819df25394b2d98b
[]
no_license
marcinpgit/Python_exercises
68be4e0e731ba5efb48c4d5cf28189ed7df8d179
149fc3a811c743c2e32d04960f682f158fd34c1f
refs/heads/master
2021-07-04T16:07:38.001001
2017-09-27T21:42:27
2017-09-27T21:42:27
104,941,119
0
0
null
null
null
null
UTF-8
Python
false
false
293
py
# Write a Python program that accepts a sequence of lines (blank line to terminate) as input and # prints the lines as output (all characters in lower case) lines = [] while True: l = input() if l: lines.append(l.upper()) else: break; for l in lines: print(l)
[ "marcinp2012@gmail.com" ]
marcinp2012@gmail.com
0a9067acff6d6d906b49a2d4d1295289d14610ad
d1ad901e1e926d9c92ce4dc7a7ba3c6ee91a65e2
/tests/portstat/test_portstat.py
3750cfd7d64c998e2098e254e336ab52960060f4
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
SubhajitPalKeysight/sonic-mgmt
ff59c2c5baf53cc2575aea2d541278fc9cf56977
e4b308a82572996b531cc09cbc6ba98b9bd283ea
refs/heads/master
2022-12-31T01:03:47.757864
2020-10-15T11:04:37
2020-10-15T11:04:37
286,815,154
1
1
NOASSERTION
2020-08-11T18:08:34
2020-08-11T18:08:33
null
UTF-8
Python
false
false
7,977
py
import logging import pytest from tests.common.helpers.assertions import pytest_assert from tests.common.utilities import wait logger = logging.getLogger('__name__') pytestmark = [ pytest.mark.topology('any') ] def parse_column_positions(separation_line, separation_char='-'): '''Parse the position of each columns in the command output Args: separation_line (string): The output line separating actual data and column headers separation_char (str, optional): The character used in separation line. Defaults to '-'. Returns: [list]: A list. Each item is a tuple with two elements. The first element is start position of a column. The second element is the end position of the column. ''' prev = ' ', positions = [] for pos, char in enumerate(separation_line + ' '): if char == separation_char: if char != prev: left = pos else: if char != prev: right = pos positions.append((left, right)) prev = char return positions def parse_portstat(content_lines): '''Parse the output of portstat command Args: content_lines (list): The output lines of portstat command Returns: list: A dictionary, key is interface name, value is a dictionary of fields/values ''' header_line = '' separation_line = '' separation_line_number = 0 for idx, line in enumerate(content_lines): if line.find('----') >= 0: header_line = content_lines[idx-1] separation_line = content_lines[idx] separation_line_number = idx break try: positions = parse_column_positions(separation_line) except Exception: logger.error('Possibly bad command output') return {} headers = [] for pos in positions: header = header_line[pos[0]:pos[1]].strip().lower() headers.append(header) if not headers: return {} results = {} for line in content_lines[separation_line_number+1:]: portstats = [] for pos in positions: portstat = line[pos[0]:pos[1]].strip() portstats.append(portstat) intf = portstats[0] results[intf] = {} for idx in range(1, len(portstats)): # Skip the first column interface name results[intf][headers[idx]] = portstats[idx] return results @pytest.fixture(scope='function', autouse=True) def reset_portstat(duthost): logger.info('Clear out all tags') duthost.command('portstat -D', become=True, module_ignore_errors=True) yield logger.info("Reset portstate ") duthost.command('portstat -D', become=True, module_ignore_errors=True) @pytest.mark.parametrize('command', ['portstat -c', 'portstat --clear']) def test_portstat_clear(duthost, command): wait(30, 'Wait for DUT to receive/send some packets') before_portstat = parse_portstat(duthost.command('portstat')['stdout_lines']) pytest_assert(before_portstat, 'No parsed command output') duthost.command(command) wait(1, 'Wait for portstat counters to refresh') after_portstat = parse_portstat(duthost.command('portstat')['stdout_lines']) pytest_assert(after_portstat, 'No parsed command output') """ Assert only when rx/tx count is no smaller than COUNT_THRES because DUT may send or receive some packets during test after port status are clear """ COUNT_THRES = 10 for intf in before_portstat: rx_ok_before = int(before_portstat[intf]['rx_ok'].replace(',','')) rx_ok_after = int(after_portstat[intf]['rx_ok'].replace(',','')) tx_ok_before = int(before_portstat[intf]['tx_ok'].replace(',','')) tx_ok_after = int(after_portstat[intf]['tx_ok'].replace(',','')) if int(rx_ok_before >= COUNT_THRES): pytest_assert(rx_ok_before >= rx_ok_after, 'Value of RX_OK after clear should be lesser') if int(tx_ok_before >= COUNT_THRES): pytest_assert(tx_ok_before >= tx_ok_after, 'Value of TX_OK after clear should be lesser') @pytest.mark.parametrize('command', ['portstat -D', 'portstat --delete-all']) def test_portstat_delete_all(duthost, command): stats_files = ('test_1', 'test_2', 'test_test') logger.info('Create several test stats files') for stats_file in stats_files: duthost.command('portstat -c -t {}'.format(stats_file)) logger.info('Verify that the file names are in the /tmp directory') uid = duthost.command('id -u')['stdout'].strip() for stats_file in stats_files: pytest_assert(duthost.stat(path='/tmp/portstat-{uid}/{uid}-{filename}'\ .format(uid=uid, filename=stats_file))['stat']['exists']) logger.info('Run the command to be tested "{}"'.format(command)) duthost.command(command) logger.info('Verify that the file names are not in the /tmp directory') for stats_file in stats_files: pytest_assert(not duthost.stat(path='/tmp/portstat-{uid}/{uid}-{filename}'\ .format(uid=uid, filename=stats_file))['stat']['exists']) @pytest.mark.parametrize('command', ['portstat -d -t', 'portstat -d --tag', 'portstat --delete -t', 'portstat --delete --tag']) def test_portstat_delete_tag(duthost, command): stats_files = ('test_1', 'test_2', 'test_delete_me') file_to_delete = stats_files[2] files_not_deleted = stats_files[:2] logger.info('Create several test stats files') for stats_file in stats_files: duthost.command('portstat -c -t {}'.format(stats_file)) logger.info('Verify that the file names are in the /tmp directory') uid = duthost.command('id -u')['stdout'].strip() for stats_file in stats_files: pytest_assert(duthost.stat(path='/tmp/portstat-{uid}/{uid}-{filename}'\ .format(uid=uid, filename=stats_file))['stat']['exists']) full_delete_command = command + ' ' + file_to_delete logger.info('Run the command to be tested "{}"'.format(full_delete_command)) duthost.command(full_delete_command) logger.info('Verify that the deleted file name is not in the directory') pytest_assert(not duthost.stat(path='/tmp/portstat-{uid}/{uid}-{filename}'\ .format(uid=uid, filename=file_to_delete))['stat']['exists']) logger.info('Verify that the remaining file names are in the directory') for stats_file in files_not_deleted: pytest_assert(duthost.stat(path='/tmp/portstat-{uid}/{uid}-{filename}'\ .format(uid=uid, filename=stats_file))['stat']['exists']) @pytest.mark.parametrize('command', ['portstat -a', 'portstat --all']) def test_portstat_display_all(duthost, command): base_portstat = parse_portstat(duthost.command('portstat')['stdout_lines']) all_portstats = parse_portstat(duthost.command(command)['stdout_lines']) pytest_assert(base_portstat and all_portstats, 'No parsed command output') logger.info('Verify the all number of columns is greater than the base number of columns') for intf in all_portstats.keys(): pytest_assert(len(all_portstats[intf].keys()) > len(base_portstat[intf].keys())) @pytest.mark.parametrize('command', ['portstat -p 1', 'portstat --period 1']) def test_portstat_period(duthost, command): output = duthost.command(command) pytest_assert('The rates are calculated within 1 seconds period' in output['stdout_lines'][0]) @pytest.mark.parametrize('command', ['portstat -h', 'portstat --help', 'portstat', 'portstat -v', 'portstat --version', 'portstat -j', 'portstat --json', 'portstat -r', 'portstat --raw']) def test_portstat_no_exceptions(duthost, command): logger.info('Verify that the commands do not cause tracebacks') duthost.command(command)
[ "noreply@github.com" ]
SubhajitPalKeysight.noreply@github.com
b2c183b7fdf094d29b43ebc5e76045156e4d658c
8930d3c7a4c8441c4129b49fc98c5c88c395fa67
/deepy/core/disconnected_grad.py
49a2afa2ff44e3371c9e54710a7d8925594c2d59
[ "MIT" ]
permissive
degerli/deepy
2b5d1f456cdd025b609aad4a47eaa55494960bdc
090fbad22a08a809b12951cd0d4984f5bd432698
refs/heads/master
2020-04-15T00:27:30.637696
2017-01-10T04:27:39
2017-01-10T04:27:39
null
0
0
null
null
null
null
UTF-8
Python
false
false
358
py
#!/usr/bin/env python # -*- coding: utf-8 -*- from theano.compile import ViewOp from theano.gradient import DisconnectedType class DisconnectedGrad(ViewOp): def grad(self, args, g_outs): return [ DisconnectedType()() for g_out in g_outs] def connection_pattern(self, node): return [[False]] disconnected_grad = DisconnectedGrad()
[ "raphael@uaca.com" ]
raphael@uaca.com
297e61e05829aff2550077a269e98ab8d80e37cd
a60e81b51935fb53c0900fecdadba55d86110afe
/MachineLearning/Softmax Regression/main.py
0835b6604536cd468caf7d5d2807bb8b80fecde4
[]
no_license
FrankieZhen/Lookoop
fab6855f5660467f70dc5024d9aa38213ecf48a7
212f8b83d6ac22db1a777f980075d9e12ce521d2
refs/heads/master
2020-07-27T08:12:45.887814
2019-09-16T11:48:20
2019-09-16T11:48:20
209,021,915
1
0
null
2019-09-17T10:10:46
2019-09-17T10:10:46
null
UTF-8
Python
false
false
4,138
py
# 2018-9-30 # Softmax Regression # python 机器学习算法 import numpy as np import random as rd import matplotlib.pyplot as plt def loadData(file_name, skip=True): """ 载入数据 """ feature = [] label = [] file = open(file_name) for line in file.readlines(): feature_tmp = [] label_tmp = [] data = line.strip().split("\t") # split(" ") feature_tmp.append(1) # 偏置项 if skip: for i in data[:-1]: feature_tmp.append(float(i)) else: for i in data: feature_tmp.append(float(i)) label_tmp.append(int(data[-1])) feature.append(feature_tmp) label.append(label_tmp) file.close() return np.mat(feature), np.mat(label) def train(feature, label, k, max_iteration, alpha): """ 梯度下降法 """ m, n = np.shape(feature) weights = np.mat(np.ones((n, k))) # n x k i = 0 while i <= max_iteration: y = np.exp(feature * weights) # m x k if i % 500 == 0: error_rate = cost(y, label) print("iteration: %d, error rate: %.10f" % (i, error_rate)) row_sum = -y.sum(axis=1) # 按行相加 m x 1 row_sum = row_sum.repeat(k, axis=1) # 每个样本都需要除以总值, 所以转换为 m x k # # 关于sum, repeat函数的用法 # weight = np.mat(np.ones((3, 2))) # print(weight) # # [[1. 1.] # # [1. 1.] # # [1. 1.]] # weight = weight.sum(axis=1) # print(weight) # # [[2.] # # [2.] # # [2.]] # weight = weight.repeat(3, axis=1) # print(weight) # # [[2. 2. 2.] # # [2. 2. 2.] # # [2. 2. 2.]] y = y / row_sum # 得到-P(y|x,w) for x in range(m): y[x, label[x, 0]] += 1 weights = weights + (alpha / m) * feature.T * y i += 1 return weights def cost(err, label_data): ''' 计算损失函数值 input: err(mat):exp的值 label_data(mat):标签的值 output: sum_cost / m(float):损失函数的值 ''' m = np.shape(err)[0] sum_cost = 0.0 for i in range(m): if err[i, label_data[i, 0]] / np.sum(err[i, :]) > 0: sum_cost -= np.log(err[i, label_data[i, 0]] / np.sum(err[i, :])) else: sum_cost -= 0 return sum_cost / m def load_data(num, m): ''' 导入测试数据 input: num(int)生成的测试样本的个数 m(int)样本的维数 output: testDataSet(mat)生成测试样本 ''' testDataSet = np.mat(np.ones((num, m))) for i in range(num): testDataSet[i, 1] = rd.random() * 6 - 3#随机生成[-3,3]之间的随机数 testDataSet[i, 2] = rd.random() * 15#随机生成[0,15]之间是的随机数 return testDataSet def predict(test_data, weights): ''' 利用训练好的Softmax模型对测试数据进行预测 input: test_data(mat)测试数据的特征 weights(mat)模型的权重 output: h.argmax(axis=1)所属的类别 ''' h = test_data * weights print(h) return h.argmax(axis=1) # 获得最大索引位置即标签 if __name__ == "__main__": inputfile = "data.txt" # 1、导入训练数据 feature, label = loadData(inputfile) print(np.shape(feature), np.shape(label)) # x = [] # y = [] # for i in range(np.shape(feature)[0]): # x.append(feature[i, 1]) # y.append(feature[i, 2]) # x = np.array(x) # y = np.array(y) # color = np.arctan2(y, x) # # 绘制散点图 # plt.scatter(x, y, s = 75, c = color, alpha = 0.5) # # 设置坐标轴范围 # plt.xlim((-5, 5)) # plt.ylim((-5, 5)) # # 不显示坐标轴的值 # plt.xticks(()) # plt.yticks(()) # plt.show() # k = 4 # # 2、训练Softmax模型 # weights = train(feature, label, k, 10000, 0.4) # print(weights) # # 3. 预测 # m, n = np.shape(weights) # data = load_data(4000, m) # res = predict(data, weights) # print(res)
[ "33798487+YangXiaoo@users.noreply.github.com" ]
33798487+YangXiaoo@users.noreply.github.com
4d9848e2c6c4c0920d5eb8244bab8e9739ce5e48
82a9077bcb5a90d88e0a8be7f8627af4f0844434
/google-cloud-sdk/lib/tests/unit/command_lib/kuberun/flags_test.py
be981d4155210013659894e9e3bedb5c88470db0
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
piotradamczyk5/gcloud_cli
1ae2553595e569fad6ce84af62b91a7ee5489017
384ece11040caadcd64d51da74e0b8491dd22ca3
refs/heads/master
2023-01-01T23:00:27.858583
2020-10-21T04:21:23
2020-10-21T04:21:23
290,238,061
0
0
null
2020-10-19T16:43:36
2020-08-25T14:31:00
Python
UTF-8
Python
false
false
5,681
py
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, 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. """Unit tests for flags module.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from googlecloudsdk.calliope import arg_parsers from googlecloudsdk.command_lib.kuberun import flags from tests.lib import test_case import mock class FlagsTest(test_case.TestCase): """Unit tests for flags module.""" def SetUp(self): self.parser = mock.Mock() self.args = mock.Mock() def testStringFlag_AddToParser(self): flag_name = '--test-flag' help_text = 'some help text' string_flag = flags.StringFlag(flag_name, help=help_text) string_flag.AddToParser(self.parser) self.parser.assert_has_calls( [mock.call.add_argument(flag_name, help=help_text)]) def testStringFlag_FormatFlags_present(self): expected_value = 'expected_test_value' self.args.test_flag = expected_value self.args.IsSpecified.return_value = True string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('test_flag') self.assertListEqual(['--test-flag', expected_value], actual) def testStringFlag_FormatFlags_missing(self): self.args.IsSpecified.return_value = False string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.assertListEqual([], actual) def testStringFlag_FormatFlags_coerceToString(self): integer_value = 10 self.args.test_flag = integer_value self.args.IsSpecified.return_value = True string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('test_flag') self.assertListEqual(['--test-flag', str(integer_value)], actual) def testBooleanFlag_AddToParser(self): flag_name = '--test-boolean-flag' boolean_flag = flags.BooleanFlag(flag_name) boolean_flag.AddToParser(self.parser) self.parser.assert_has_calls([ mock.call.add_argument( flag_name, action=arg_parsers.StoreTrueFalseAction) ]) def testBooleanFlag_FormatFlags_present(self): flag_name = '--test-boolean-flag' boolean_flag = flags.BooleanFlag(flag_name) self.args.GetSpecifiedArgNames.return_value = [flag_name] actual = boolean_flag.FormatFlags(self.args) self.args.GetSpecifiedArgNames.assert_called() self.assertListEqual([flag_name], actual) def testBooleanFlag_FormatFlags_missing(self): flag_name = '--test-boolean-flag' boolean_flag = flags.BooleanFlag(flag_name) missing_flag_name = '--no-test-boolean-flag' self.args.GetSpecifiedArgNames.return_value = [missing_flag_name] actual = boolean_flag.FormatFlags(self.args) self.args.GetSpecifiedArgNames.assert_called() self.assertListEqual([missing_flag_name], actual) def testBasicFlag_AddToParser(self): flag_name = '--basic-flag' basic_flag = flags.BasicFlag(flag_name) basic_flag.AddToParser(self.parser) self.parser.assert_has_calls( [mock.call.add_argument(flag_name, default=False, action='store_true')]) def testBasicFlag_FormatFlags_present(self): flag_name = '--basic-flag' basic_flag = flags.BasicFlag(flag_name) self.args.IsSpecified.return_value = True actual = basic_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('basic_flag') self.assertListEqual([flag_name], actual) def testBasicFlag_FormatFlags_missing(self): flag_name = '--basic-flag' basic_flag = flags.BasicFlag(flag_name) self.args.IsSpecified.return_value = False actual = basic_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('basic_flag') self.assertListEqual([], actual) def testFlagGroup_AddToParser(self): flag1 = mock.create_autospec(flags.BinaryCommandFlag) flag2 = mock.create_autospec(flags.BinaryCommandFlag) flag3 = mock.create_autospec(flags.BinaryCommandFlag) flag_group = flags.FlagGroup(flag1, flag2, flag3) flag_group.AddToParser(self.parser) flag1.assert_has_calls([mock.call.AddToParser(self.parser)]) flag2.assert_has_calls([mock.call.AddToParser(self.parser)]) flag3.assert_has_calls([mock.call.AddToParser(self.parser)]) def testFlagGroup_FormatFlags(self): flag1 = mock.create_autospec(flags.BinaryCommandFlag) flag2 = mock.create_autospec(flags.BinaryCommandFlag) flag3 = mock.create_autospec(flags.BinaryCommandFlag) flag_group = flags.FlagGroup(flag1, flag2, flag3) flag1.FormatFlags.return_value = ['--flag1'] flag2.FormatFlags.return_value = ['--flag2', 'blah'] flag3.FormatFlags.return_value = ['--no-flag3'] actual = flag_group.FormatFlags(self.args) flag1.assert_has_calls([mock.call.FormatFlags(self.args)]) flag2.assert_has_calls([mock.call.FormatFlags(self.args)]) flag3.assert_has_calls([mock.call.FormatFlags(self.args)]) self.assertListEqual(['--flag1', '--flag2', 'blah', '--no-flag3'], actual) if __name__ == '__main__': test_case.main()
[ "actions@github.com" ]
actions@github.com
840df60864580e08c06aaf11d2f3b0afeb055e6a
2424063d657d643c1f8ccc6cca343271d6d0f708
/Project13/Project13/wsgi.py
4addfcd63c97edcfc6dfdcc82695c6034fef28f0
[]
no_license
pythonwithnaveen/DjangoExamples
a0a07cbc53564522cf39649c235716ef5c3a4ba0
57c7a6302ada4079bd3625481e660587bf8015c6
refs/heads/main
2023-07-16T02:36:01.283938
2021-08-12T07:26:22
2021-08-12T07:26:22
371,881,524
0
3
null
null
null
null
UTF-8
Python
false
false
395
py
""" WSGI config for Project13 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Project13.settings') application = get_wsgi_application()
[ "=" ]
=
bf893e679aad51bcabebe58e925f0b2246a3859d
e23a4f57ce5474d468258e5e63b9e23fb6011188
/125_algorithms/_exercises/templates/_algorithms_challenges/exercism/python-exercises-master_with_unittest/clock/solution.py
3735a17098d16ca49a60887846dc5085ccad67ec
[]
no_license
syurskyi/Python_Topics
52851ecce000cb751a3b986408efe32f0b4c0835
be331826b490b73f0a176e6abed86ef68ff2dd2b
refs/heads/master
2023-06-08T19:29:16.214395
2023-05-29T17:09:11
2023-05-29T17:09:11
220,583,118
3
2
null
2023-02-16T03:08:10
2019-11-09T02:58:47
Python
UTF-8
Python
false
false
442
py
c_ Clock(o.. 'Clock that displays 24 hour clock that rollsover properly' ___ - , hour, minute hour hour minute minute cleanup() ___ -r r.. "%02d:%02d" % (hour, minute) ___ -e other r.. r.. ____ __ r.. (other) ___ add minutes minute += minutes r.. cleanup() ___ cleanup hour += minute // 60 hour %= 24 minute %= 60 r.. _
[ "sergejyurskyj@yahoo.com" ]
sergejyurskyj@yahoo.com
fc72438cce4f775b6b03c893d7c78269c6e4ab9d
fb23f54996ff24fb67181fa6535676a0a08ff5d1
/bank_transactions/bank_transactions/doctype/bank_detail/bank_detail.py
be3bd80f545bee35d03bbb10cb25adffc4144db8
[]
no_license
reddymeghraj/bank_transactions
6b0978478f1f825fc82b46ea113f0c9093ed1b9f
5f0370e2a253431b7d974fceac3e4db8a39fdd0a
refs/heads/master
2020-12-24T17:26:08.946366
2015-06-25T04:08:15
2015-06-25T04:08:15
38,027,058
0
0
null
null
null
null
UTF-8
Python
false
false
233
py
# Copyright (c) 2013, WayzonTech and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class BankDetail(Document): pass
[ "reddymeghraj@gmail.com" ]
reddymeghraj@gmail.com
63b8ffaa5f98128433bc67366be0804a8af07ddf
ecb7156e958d10ceb57c66406fb37e59c96c7adf
/Leetcode Exercise/Leetcode387_First Unique Character in a String/mySolution.py
92de319fd6c8607cbcd19b3a3d878af846188fb4
[]
no_license
chenshanghao/RestartJobHunting
b53141be1cfb8713ae7f65f02428cbe51ea741db
25e5e7be2d584faaf26242f4f6d6328f0a6dc4d4
refs/heads/master
2020-07-27T17:39:58.756787
2019-10-18T06:27:27
2019-10-18T06:27:27
209,175,165
0
0
null
null
null
null
UTF-8
Python
false
false
366
py
class Solution: def firstUniqChar(self, s: str) -> int: dictCharCount = dict() for char in s: if char in dictCharCount: dictCharCount[char] += 1 else: dictCharCount[char] = 1 for i in range(len(s)): if dictCharCount[s[i]] == 1: return i return -1
[ "21551021@zju.edu.cn" ]
21551021@zju.edu.cn
6be6b90977548954cbe0794710c83b0e94a6e2af
626a2e5902972f926a01c58480eb8f162afc5080
/python/sdft.py
e327c3f2c316856b2a44299ff260ea96e81a4bd5
[]
no_license
almighty-bungholio/fpga-fft
9ee83134c844fcd7d8d5eff4dbd52e47a0830781
91cf990c765ff06d71d1e2489a25842e19c73623
refs/heads/master
2020-04-26T20:50:56.559921
2018-06-14T18:36:02
2018-06-14T18:36:02
173,823,387
3
0
null
2019-03-04T21:21:41
2019-03-04T21:21:41
null
UTF-8
Python
false
false
2,116
py
from __future__ import print_function # https://stackoverflow.com/questions/6663222/doing-fft-in-realtime from cmath import cos, sin, pi from scipy import signal import numpy as np # sample history needs to be the same as the number of frequency bins N = 16 samp_hist = N coeffs = [] freqs = [] in_s = [] sig_counter = 0 def init_coeffs(): for i in range(N): a = 2.0 * pi * i / N coeff = complex(cos(a),sin(a)) coeffs.append(coeff) print(coeff) def sdft(delta): for i in range(N): freqs[i] = (freqs[i] + delta) * coeffs[i] # initialise init_coeffs() t = np.linspace(0, 1, samp_hist, endpoint=False) sig_in = signal.square(pi * 2 * t) #sig_in = np.sin(pi * 2 * t) for i in range(N): freqs.append(complex(0,0)) for i in range(samp_hist): in_s.append(complex(0,0)) # run the loop freq_hist = [] for i in range(samp_hist*2): freq_hist.append(list(freqs)) # rotate in new sample last = in_s[samp_hist-1] for i in range(samp_hist-1, 0, -1): in_s[i] = in_s[i-1] in_s[0] = complex(sig_in[sig_counter % samp_hist],0) sig_counter += 1 # run the sdft delta = in_s[0] - last sdft(delta) """ print("dumping frequency history:") for f in range(N): print("%2d : " % f, end='') for i in range(32): print("(%4.1f,%4.1f)" % (freq_hist[i][f].real, freq_hist[i][f].imag), end='') print() """ # plot the results and compare with numpy's fft import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(2,2,3) plot_freqs = [] for i in range(N): plot_freqs.append(abs(freqs[i])) ax.plot(range(N), plot_freqs) ax.set_title("sliding dft") ax = fig.add_subplot(2,2,4) ax.plot(range(samp_hist), abs(np.fft.fft(sig_in[0:samp_hist]))) ax.set_title("numpy fft") ax = fig.add_subplot(2,2,1) ax.plot(range(samp_hist), sig_in[0:samp_hist]) ax.set_title("input signal") ax = fig.add_subplot(2,2,2) coeff_r = [] coeff_i = [] for i in range(N): coeff_r.append( coeffs[i].real) coeff_i.append( coeffs[i].imag) ax.plot(coeff_r, coeff_i) ax.set_title("coeffs/twiddles") plt.show()
[ "matt@mattvenn.net" ]
matt@mattvenn.net
e34e2b2cffecf229d8e237c2d148c400ca05db49
572024902ee45d7246bceff508f1035f8c464693
/third_party/catapult/telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py
bc3832d99b3786768401ba85772df8913c47cddd
[ "BSD-3-Clause", "MIT" ]
permissive
mediabuff/Prelude
539a275a52d65e1bf84dc218772ea24fff384391
601507c6dc8cf27999ceffc0fef97afba2bd764d
refs/heads/master
2020-03-12T16:31:18.951711
2018-03-27T13:36:22
2018-04-05T19:31:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
10,937
py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import os import time from telemetry.core import exceptions from telemetry.core import util from telemetry import decorators from telemetry.internal.backends.chrome import chrome_browser_backend from telemetry.internal.backends.chrome import misc_web_contents_backend import py_utils class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): def __init__(self, cros_platform_backend, browser_options, cri, is_guest): super(CrOSBrowserBackend, self).__init__( cros_platform_backend, supports_tab_control=True, supports_extensions=not is_guest, browser_options=browser_options) assert browser_options.IsCrosBrowserOptions() # Initialize fields so that an explosion during init doesn't break in Close. self._cri = cri self._is_guest = is_guest # TODO(#1977): Move forwarder to network_controller. self._forwarder = None self._remote_debugging_port = None self._port = None extensions_to_load = browser_options.extensions_to_load # Copy extensions to temp directories on the device. # Note that we also perform this copy locally to ensure that # the owner of the extensions is set to chronos. for e in extensions_to_load: extension_dir = cri.RunCmdOnDevice( ['mktemp', '-d', '/tmp/extension_XXXXX'])[0].rstrip() e.local_path = os.path.join(extension_dir, os.path.basename(e.path)) cri.PushFile(e.path, extension_dir) cri.Chown(extension_dir) self._cri.RestartUI(self.browser_options.clear_enterprise_policy) py_utils.WaitFor(self.IsBrowserRunning, 20) # Delete test user's cryptohome vault (user data directory). if not self.browser_options.dont_override_profile: self._cri.RunCmdOnDevice(['cryptohome', '--action=remove', '--force', '--user=%s' % self._username]) @property def log_file_path(self): return None @property def devtools_file_path(self): return '/home/chronos/DevToolsActivePort' def HasBrowserFinishedLaunching(self): try: file_content = self._cri.GetFileContents(self.devtools_file_path) except (IOError, OSError): return False if len(file_content) == 0: return False port_target = file_content.split('\n') self._remote_debugging_port = int(port_target[0]) # Use _remote_debugging_port for _port for now (local telemetry case) # Override it with the forwarded port below for the remote telemetry case. self._port = self._remote_debugging_port if len(port_target) > 1 and port_target[1]: self._browser_target = port_target[1] logging.info('Discovered ephemeral port %s', self._port) logging.info('Browser target: %s', self._browser_target) # TODO(#1977): Simplify when cross forwarder supports missing local ports. if not self._cri.local: self._port = util.GetUnreservedAvailableLocalPort() self._forwarder = self._platform_backend.forwarder_factory.Create( local_port=self._port, remote_port=self._remote_debugging_port, reverse=True) return super(CrOSBrowserBackend, self).HasBrowserFinishedLaunching() def GetBrowserStartupArgs(self): args = super(CrOSBrowserBackend, self).GetBrowserStartupArgs() logging_patterns = ['*/chromeos/net/*', '*/chromeos/login/*', 'chrome_browser_main_posix'] vmodule = '--vmodule=' for pattern in logging_patterns: vmodule += '%s=2,' % pattern vmodule = vmodule.rstrip(',') args.extend([ '--enable-smooth-scrolling', '--enable-threaded-compositing', # Allow devtools to connect to chrome. '--remote-debugging-port=0', # Open a maximized window. '--start-maximized', # Disable system startup sound. '--ash-disable-system-sounds', # Ignore DMServer errors for policy fetches. '--allow-failed-policy-fetch-for-test', # Skip user image selection screen, and post login screens. '--oobe-skip-postlogin', # Disable chrome logging redirect. crbug.com/724273. '--disable-logging-redirect', # Debug logging. vmodule ]) # Disable GAIA services unless we're using GAIA login, or if there's an # explicit request for it. if (self.browser_options.disable_gaia_services and not self.browser_options.gaia_login): args.append('--disable-gaia-services') trace_config_file = (self.platform_backend.tracing_controller_backend .GetChromeTraceConfigFile()) if trace_config_file: args.append('--trace-config-file=%s' % trace_config_file) return args @property def pid(self): return self._cri.GetChromePid() @property def browser_directory(self): result = self._cri.GetChromeProcess() if result and 'path' in result: return os.path.dirname(result['path']) return None @property def profile_directory(self): return '/home/chronos/Default' def __del__(self): self.Close() def Start(self): # Remove the stale file with the devtools port / browser target # prior to restarting chrome. self._cri.RmRF(self.devtools_file_path) # Escape all commas in the startup arguments we pass to Chrome # because dbus-send delimits array elements by commas startup_args = [a.replace(',', '\\,') for a in self.GetBrowserStartupArgs()] # Restart Chrome with the login extension and remote debugging. pid = self.pid logging.info('Restarting Chrome (pid=%d) with remote port', pid) args = ['dbus-send', '--system', '--type=method_call', '--dest=org.chromium.SessionManager', '/org/chromium/SessionManager', 'org.chromium.SessionManagerInterface.EnableChromeTesting', 'boolean:true', 'array:string:"%s"' % ','.join(startup_args)] logging.info(' '.join(args)) self._cri.RunCmdOnDevice(args) # Wait for new chrome and oobe. py_utils.WaitFor(lambda: pid != self.pid, 15) self._WaitForBrowserToComeUp() py_utils.WaitFor(lambda: self.oobe_exists, 30) if self.browser_options.auto_login: if self._is_guest: pid = self.pid self.oobe.NavigateGuestLogin() # Guest browsing shuts down the current browser and launches an # incognito browser in a separate process, which we need to wait for. try: py_utils.WaitFor(lambda: pid != self.pid, 15) except py_utils.TimeoutException: self._RaiseOnLoginFailure( 'Failed to restart browser in guest mode (pid %d).' % pid) elif self.browser_options.gaia_login: self.oobe.NavigateGaiaLogin(self._username, self._password) else: # Wait for few seconds(the time of password typing) to have mini ARC # container up and running. Default is 0. time.sleep(self.browser_options.login_delay) self.oobe.NavigateFakeLogin( self._username, self._password, self._gaia_id, not self.browser_options.disable_gaia_services) try: self._WaitForLogin() except py_utils.TimeoutException: self._RaiseOnLoginFailure('Timed out going through login screen. ' + self._GetLoginStatus()) logging.info('Browser is up!') def Background(self): raise NotImplementedError def Close(self): super(CrOSBrowserBackend, self).Close() if self._cri: self._cri.RestartUI(False) # Logs out. self._cri.CloseConnection() py_utils.WaitFor(lambda: not self._IsCryptohomeMounted(), 180) if self._forwarder: self._forwarder.Close() self._forwarder = None if self._cri: for e in self._extensions_to_load: self._cri.RmRF(os.path.dirname(e.local_path)) self._cri = None def WaitForBrowserToComeUp(self): """If a restart is triggered, wait for the browser to come up, and reconnect to devtools. """ self._WaitForBrowserToComeUp() def IsBrowserRunning(self): if not self._cri: return False return bool(self.pid) def GetStandardOutput(self): return 'Cannot get standard output on CrOS' def GetStackTrace(self): return (False, 'Cannot get stack trace on CrOS') def GetMostRecentMinidumpPath(self): return None def GetAllMinidumpPaths(self): return None def GetAllUnsymbolizedMinidumpPaths(self): return None def SymbolizeMinidump(self, minidump_path): return None @property def supports_overview_mode(self): # pylint: disable=invalid-name return True def EnterOverviewMode(self, timeout): self.devtools_client.window_manager_backend.EnterOverviewMode(timeout) def ExitOverviewMode(self, timeout): self.devtools_client.window_manager_backend.ExitOverviewMode(timeout) @property @decorators.Cache def misc_web_contents_backend(self): """Access to chrome://oobe/login page.""" return misc_web_contents_backend.MiscWebContentsBackend(self) @property def oobe(self): return self.misc_web_contents_backend.GetOobe() @property def oobe_exists(self): return self.misc_web_contents_backend.oobe_exists @property def _username(self): return self.browser_options.username @property def _password(self): return self.browser_options.password @property def _gaia_id(self): return self.browser_options.gaia_id def _IsCryptohomeMounted(self): username = '$guest' if self._is_guest else self._username return self._cri.IsCryptohomeMounted(username, self._is_guest) def _GetLoginStatus(self): """Returns login status. If logged in, empty string is returned.""" status = '' if not self._IsCryptohomeMounted(): status += 'Cryptohome not mounted. ' if not self.HasBrowserFinishedLaunching(): status += 'Browser didn\'t launch. ' if self.oobe_exists: status += 'OOBE not dismissed.' return status def _IsLoggedIn(self): """Returns True if cryptohome has mounted, the browser is responsive to devtools requests, and the oobe has been dismissed.""" return not self._GetLoginStatus() def _WaitForLogin(self): # Wait for cryptohome to mount. py_utils.WaitFor(self._IsLoggedIn, 900) # For incognito mode, the session manager actually relaunches chrome with # new arguments, so we have to wait for the browser to come up. self._WaitForBrowserToComeUp() # Wait for extensions to load. if self._supports_extensions: self._WaitForExtensionsToLoad() def _RaiseOnLoginFailure(self, error): if self._platform_backend.CanTakeScreenshot(): self._cri.TakeScreenshotWithPrefix('login-screen') raise exceptions.LoginException(error)
[ "xzwang2005@gmail.com" ]
xzwang2005@gmail.com
67c098441a88869bf3cf28d12846e54518987ed9
2091dc754d0346a345d84dce32177a4d6aa2097b
/Payload_Type/Apollo/mythic/agent_functions/whoami.py
901b3cc8f3716723efcf65fe64d7d47f55f8f527
[ "BSD-3-Clause", "MIT" ]
permissive
dycsy/Apollo
132d5d5f98ae2951e6c58df796be1dfbc495c03f
6ec815cbb87379b48c12d2108e6dd669ce5ce37e
refs/heads/master
2023-04-21T07:30:38.551661
2021-04-22T19:53:13
2021-04-22T19:53:13
null
0
0
null
null
null
null
UTF-8
Python
false
false
950
py
from CommandBase import * import json class WhoamiArguments(TaskArguments): def __init__(self, command_line): super().__init__(command_line) self.args = {} async def parse_arguments(self): if len(self.command_line) > 0: raise Exception("whoami takes no command line arguments.") pass class WhoamiCommand(CommandBase): cmd = "whoami" needs_admin = False help_cmd = "whoami" description = "Get the username associated with your current thread token." version = 1 is_exit = False is_file_browse = False is_process_list = False is_download_file = False is_upload_file = False is_remove_file = False author = "@djhohnstein" argument_class = WhoamiArguments attackmapping = [] async def create_tasking(self, task: MythicTask) -> MythicTask: return task async def process_response(self, response: AgentResponse): pass
[ "djhohnstein@gmail.com" ]
djhohnstein@gmail.com
c385b92415cd61b11232b74c10796ac7eb295e12
e562f7e0a51273475e50a7e61d1d377f88775622
/WebMirror/Engine.py
fb8fdfb9707541db48b9732bb60055b2895aa2a2
[]
no_license
bloodcurdle/ReadableWebProxy
d1c6ae0220fdb04ea7ab82963c86e776a0dbbfd9
10f68f913a78f8b0e47582996d9860a61da55dd6
refs/heads/master
2021-05-29T19:58:32.965610
2015-11-09T18:25:00
2015-11-09T18:25:00
null
0
0
null
null
null
null
UTF-8
Python
false
false
27,462
py
if __name__ == "__main__": import logSetup logSetup.initLogging() import WebMirror.rules import WebMirror.SpecialCase import WebMirror.LogBase as LogBase import runStatus import time import os.path import os import sys import sqlalchemy.exc from sqlalchemy import desc from sqlalchemy.sql import text from sqlalchemy import distinct from sqlalchemy.dialects import postgresql import WebMirror.util.urlFuncs import urllib.parse import traceback import datetime from sqlalchemy.sql import text from sqlalchemy.sql import func import WebMirror.util.webFunctions as webFunctions import hashlib from WebMirror.Fetch import DownloadException import WebMirror.Fetch import WebMirror.database as db from config import C_RESOURCE_DIR from activePlugins import INIT_CALLS if "debug" in sys.argv: CACHE_DURATION = 1 RSC_CACHE_DURATION = 1 # CACHE_DURATION = 60 * 5 # RSC_CACHE_DURATION = 60 * 60 * 5 else: CACHE_DURATION = 60 * 60 * 24 * 7 RSC_CACHE_DURATION = 60 * 60 * 24 * 147 GLOBAL_BAD = [ '/xmlrpc.php', 'gprofiles.js', 'netvibes.com', 'accounts.google.com', 'edit.yahoo.com', 'add.my.yahoo.com', 'public-api.wordpress.com', 'r-login.wordpress.com', 'twitter.com', 'facebook.com', 'public-api.wordpress.com', 'wretch.cc', 'ws-na.amazon-adsystem.com', 'delicious.com', 'paypal.com', 'digg.com', 'topwebfiction.com', '/page/page/', 'addtoany.com', 'stumbleupon.com', 'delicious.com', '/comments/feed/', 'fbcdn-', 'reddit.com', '/osd.xml', '/wp-login.php', '?openidserver=1', 'newsgator.com', 'technorati.com', 'pixel.wp.com', 'a.wikia-beacon.com', 'b.scorecardresearch.com', '//mail.google.com', 'javascript:void', 'tumblr.com/widgets/', 'www.tumblr.com/login', 'twitter.com/intent/', 'www.pinterest.com/pin/', 'www.wattpad.com/login?', '://tumblr.com', ] def getHash(fCont): m = hashlib.md5() m.update(fCont) return m.hexdigest() def saveCoverFile(filecont, fHash, filename): # use the first 3 chars of the hash for the folder name. # Since it's hex-encoded, that gives us a max of 2^12 bits of # directories, or 4096 dirs. fHash = fHash.upper() dirName = fHash[:3] dirPath = os.path.join(C_RESOURCE_DIR, dirName) if not os.path.exists(dirPath): os.makedirs(dirPath) ext = os.path.splitext(filename)[-1] ext = ext.lower() # The "." is part of the ext. filename = '{filename}{ext}'.format(filename=fHash, ext=ext) # The "." is part of the ext. filename = '{filename}{ext}'.format(filename=fHash, ext=ext) # Flask config values have specious "/./" crap in them. Since that gets broken through # the abspath canonization, we pre-canonize the config path so it compares # properly. confpath = os.path.abspath(C_RESOURCE_DIR) fqpath = os.path.join(dirPath, filename) fqpath = os.path.abspath(fqpath) if not fqpath.startswith(confpath): raise ValueError("Generating the file path to save a cover produced a path that did not include the storage directory?") locpath = fqpath[len(confpath):] if not os.path.exists(fqpath): print("Saving file to path: '{fqpath}'!".format(fqpath=fqpath)) with open(fqpath, "wb") as fp: fp.write(filecont) else: print("File '{fqpath}' already exists!".format(fqpath=fqpath)) if locpath.startswith("/"): locpath = locpath[1:] return locpath ######################################################################################################################## # # ## ## ### #### ## ## ###### ## ### ###### ###### # ### ### ## ## ## ### ## ## ## ## ## ## ## ## ## ## # #### #### ## ## ## #### ## ## ## ## ## ## ## # ## ### ## ## ## ## ## ## ## ## ## ## ## ###### ###### # ## ## ######### ## ## #### ## ## ######### ## ## # ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## # ## ## ## ## #### ## ## ###### ######## ## ## ###### ###### # ######################################################################################################################## class SiteArchiver(LogBase.LoggerMixin): loggerPath = "Main.SiteArchiver" # Fetch items up to 1,000,000 (1 million) links away from the root source # This (functionally) equates to no limit. # The db defaults to (e.g. max signed integer value) anyways FETCH_DISTANCE = 1000 * 1000 def __init__(self, cookie_lock, run_filters=True, response_queue=None): print("SiteArchiver __init__()") super().__init__() self.db = db self.cookie_lock = cookie_lock self.resp_q = response_queue # print("SiteArchiver database imported") ruleset = WebMirror.rules.load_rules() self.ruleset = ruleset self.fetcher = WebMirror.Fetch.ItemFetcher self.wg = webFunctions.WebGetRobust(cookie_lock=cookie_lock) self.specialty_handlers = WebMirror.rules.load_special_case_sites() for item in INIT_CALLS: item(self) # print("SiteArchiver rules loaded") self.relinkable = set() for item in ruleset: [self.relinkable.add(url) for url in item['fileDomains']] #pylint: disable=W0106 if item['netlocs'] != None: [self.relinkable.add(url) for url in item['netlocs']] #pylint: disable=W0106 self.ctnt_filters = {} self.rsc_filters = {} for item in ruleset: if not item['netlocs']: continue for netloc in item['netlocs']: self.ctnt_filters[netloc] = item['netlocs'] for netloc in item['fileDomains']: self.rsc_filters[netloc] = item['fileDomains'] # print("processing rsc") # print(item['fileDomains']) # rsc_vals = self.buildUrlPermutations(item['fileDomains'], item['netlocs']) self.log.info("Content filter size: %s. Resource filter size %s.", len(self.ctnt_filters), len(self.rsc_filters)) # print("SiteArchiver initializer complete") ######################################################################################################################## # # ######## ### ###### ## ## ######## #### ###### ######## ### ######## ###### ## ## ######## ######## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ## ## ## ###### ##### ## ## ## ###### ######## ## ## ## ## ######### ###### ######## # ## ######### ## ## ## ## ## ## ## ## ######### ## ## ## ## ## ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ## ## ## ###### ## ## ######## #### ###### ## ## ## ## ###### ## ## ######## ## ## # ######################################################################################################################## # Minimal proxy because I want to be able to call the fetcher without affecting the DB. def fetch(self, job): fetcher = self.fetcher(self.ruleset, job.url, job.starturl, self.cookie_lock, wg_handle=self.wg, response_queue=self.resp_q) response = fetcher.fetch() return response # This is the main function that's called by the task management system. # Retreive remote content at `url`, call the appropriate handler for the # transferred content (e.g. is it an image/html page/binary file) def dispatchRequest(self, job): response = self.fetch(job) if "file" in response: # No title is present in a file response self.upsertFileResponse(job, response) elif 'rss-content' in response: self.upsertRssItems(job, response['rss-content'], job.url) self.upsertResponseLinks(job, plain=[entry['linkUrl'] for entry in response['rss-content']]) else: self.upsertReponseContent(job, response) self.upsertResponseLinks(job, plain=response['plainLinks'], resource=response['rsrcLinks']) # Reset the fetch time download def special_case_handle(self, job): WebMirror.SpecialCase.handleSpecialCase(job, self, self.specialty_handlers) # Update the row with the item contents def upsertReponseContent(self, job, response): while 1: try: job.title = response['title'] job.content = response['contents'] job.mimetype = response['mimeType'] if "text" in job.mimetype: job.is_text = True else: job.is_text = False job.state = 'complete' # Disabled for space-reasons. # if 'rawcontent' in response: # job.raw_content = response['rawcontent'] job.fetchtime = datetime.datetime.now() self.db.get_session().flush() self.db.get_session().commit() break except sqlalchemy.exc.OperationalError: self.db.get_session().rollback() except sqlalchemy.exc.InvalidRequestError: self.db.get_session().rollback() def insertRssItem(self, entry, feedurl): have = self.db.get_session().query(self.db.FeedItems) \ .filter(self.db.FeedItems.contentid == entry['guid']) \ .limit(1) \ .scalar() if have: return else: assert ("srcname" in entry), "'srcname' not in entry for item from '%s' (contenturl: '%s', title: '%s', guid: '%s')" % (feedurl, entry['linkUrl'], entry['title'], entry['guid']) authors = [tmp['name'] for tmp in entry['authors'] if 'name' in tmp] # Deduplicate repeat tags of the differing case. tags = {} for tag in entry['tags']: tags[tag.lower()] = tag new = self.db.FeedItems( contentid = entry['guid'], title = entry['title'], srcname = entry['srcname'], feedurl = feedurl, contenturl = entry['linkUrl'], type = entry['feedtype'], contents = entry['contents'], author = authors, tags = list(tags.values()), updated = datetime.datetime.fromtimestamp(entry['updated']), published = datetime.datetime.fromtimestamp(entry['published']) ) self.db.get_session().add(new) self.db.get_session().commit() def upsertRssItems(self, job, entrylist, feedurl): while 1: try: job.state = 'complete' job.fetchtime = datetime.datetime.now() break except sqlalchemy.exc.InvalidRequestError: print("InvalidRequest error!") self.db.get_session().rollback() traceback.print_exc() except sqlalchemy.exc.OperationalError: print("InvalidRequest error!") self.db.get_session().rollback() except sqlalchemy.exc.IntegrityError: print("[upsertRssItems] -> Integrity error!") traceback.print_exc() self.db.get_session().rollback() # print("InsertFeed!") for feedentry in entrylist: # print(feedentry) # print(feedentry.keys()) # print(feedentry['contents']) # print(feedentry['published']) while 1: try: self.insertRssItem(feedentry, feedurl) break except sqlalchemy.exc.InvalidRequestError: print("InvalidRequest error!") self.db.get_session().rollback() traceback.print_exc() except sqlalchemy.exc.OperationalError: print("InvalidRequest error!") self.db.get_session().rollback() except sqlalchemy.exc.IntegrityError: print("[upsertRssItems] -> Integrity error!") traceback.print_exc() self.db.get_session().rollback() def generalLinkClean(self, link, badwords): if link.startswith("data:"): return None if any([item in link for item in badwords]): # print("Filtered:", link) return None return link # Todo: FIXME def filterContentLinks(self, job, links, badwords): ret = set() for link in links: link = self.generalLinkClean(link, badwords) if not link: continue netloc = urllib.parse.urlsplit(link).netloc if netloc in self.ctnt_filters and job.netloc in self.ctnt_filters[netloc]: # print("Valid content link: ", link) ret.add(link) return ret def filterResourceLinks(self, job, links, badwords): ret = set() for link in links: link = self.generalLinkClean(link, badwords) if not link: continue netloc = urllib.parse.urlsplit(link).netloc if netloc in self.rsc_filters: # print("Valid resource link: ", link) ret.add(link) return ret def getBadWords(self, job): badwords = GLOBAL_BAD for item in [rules for rules in self.ruleset if rules['netlocs'] and job.netloc in rules['netlocs']]: badwords += item['badwords'] # A "None" can occationally crop up. Filter it. badwords = [badword for badword in badwords if badword] return badwords def upsertResponseLinks(self, job, plain=[], resource=[]): plain = set(plain) resource = set(resource) unfiltered = len(plain)+len(resource) badwords = self.getBadWords(job) plain = self.filterContentLinks(job, plain, badwords) resource = self.filterResourceLinks(job, resource, badwords) filtered = len(plain)+len(resource) self.log.info("Upserting %s links (%s filtered)" % (filtered, unfiltered)) items = [] [items.append((link, True)) for link in plain] [items.append((link, False)) for link in resource] self.log.info("Page had %s unfiltered content links, %s unfiltered resource links.", len(plain), len(resource)) if self.resp_q != None: for link, istext in items: start = urllib.parse.urlsplit(link).netloc assert link.startswith("http") assert start new = { 'url' : link, 'starturl' : job.starturl, 'netloc' : start, 'distance' : job.distance+1, 'is_text' : istext, 'priority' : job.priority, 'type' : job.type, 'state' : "new", 'fetchtime' : datetime.datetime.now(), } self.resp_q.put(("new_link", new)) while self.resp_q.qsize() > 1000: time.sleep(0.1) self.log.info("Links upserted. Items in processing queue: %s", self.resp_q.qsize()) else: while 1: try: for link, istext in items: start = urllib.parse.urlsplit(link).netloc assert link.startswith("http") assert start new = { 'url' : link, 'starturl' : job.starturl, 'netloc' : start, 'distance' : job.distance+1, 'is_text' : istext, 'priority' : job.priority, 'type' : job.type, 'state' : "new", 'fetchtime' : datetime.datetime.now(), } # Fucking huzzah for ON CONFLICT! cmd = text(""" INSERT INTO web_pages (url, starturl, netloc, distance, is_text, priority, type, fetchtime, state) VALUES (:url, :starturl, :netloc, :distance, :is_text, :priority, :type, :fetchtime, :state) ON CONFLICT DO NOTHING """) self.db.get_session().execute(cmd, params=new) self.db.get_session().commit() break except sqlalchemy.exc.InternalError: self.log.info("SQLAlchemy InternalError - Retrying.") self.db.get_session().rollback() except sqlalchemy.exc.OperationalError: self.log.info("SQLAlchemy OperationalError - Retrying.") self.db.get_session().rollback() except sqlalchemy.exc.InvalidRequestError: self.log.info("SQLAlchemy InvalidRequestError - Retrying.") self.db.get_session().rollback() def upsertFileResponse(self, job, response): # Response dict structure: # {"file" : True, "url" : url, "mimeType" : mimeType, "fName" : fName, "content" : content} # print("File response!") # Yeah, I'm hashing twice in lots of cases. Bite me fHash = getHash(response['content']) # Look for existing files with the same MD5sum. If there are any, just point the new file at the # fsPath of the existing one, rather then creating a new file on-disk. have = self.db.get_session().query(self.db.WebFiles) \ .filter(self.db.WebFiles.fhash == fHash) \ .limit(1) \ .scalar() if have: match = self.db.get_session().query(self.db.WebFiles) \ .filter(self.db.WebFiles.fhash == fHash) \ .filter(self.db.WebFiles.filename == response['fName']) \ .limit(1) \ .scalar() if match: job.file = match.id else: new = self.db.WebFiles( filename = response['fName'], fhash = fHash, fspath = have.fspath, ) self.db.get_session().add(new) self.db.get_session().commit() job.file = new.id else: savedpath = saveCoverFile(response['content'], fHash, response['fName']) new = self.db.WebFiles( filename = response['fName'], fhash = fHash, fspath = savedpath, ) self.db.get_session().add(new) self.db.get_session().commit() job.file = new.id job.state = 'complete' job.is_text = False job.fetchtime = datetime.datetime.now() job.mimetype = response['mimeType'] self.db.get_session().commit() # print("have:", have) ######################################################################################################################## # # ######## ######## ####### ###### ######## ###### ###### ###### ####### ## ## ######## ######## ####### ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## # ######## ######## ## ## ## ###### ###### ###### ## ## ## ## ## ## ## ######## ## ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## # ## ## ## ####### ###### ######## ###### ###### ###### ####### ## ## ## ## ## ####### ######## # ######################################################################################################################## def getTask(self, wattpad=False): ''' Get a job row item from the database. Also updates the row to be in the "fetching" state. ''' # self.db.get_session().begin() # Try to get a task untill we are explicitly out of tasks, # or we succeed. while 1: try: if wattpad: filt = """ AND ( web_pages.netloc = 'a.wattpad.com' OR web_pages.netloc = 'www.wattpad.com' ) """ else: filt = """ AND NOT ( web_pages.netloc = 'a.wattpad.com' OR web_pages.netloc = 'www.wattpad.com' ) """ # Hand-tuned query, I couldn't figure out how to # get sqlalchemy to emit /exactly/ what I wanted. # TINY changes will break the query optimizer, and # the 10 ms query will suddenly take 10 seconds! raw_query = text(''' SELECT web_pages.id FROM web_pages WHERE web_pages.state = 'new' AND normal_fetch_mode = true AND web_pages.priority = ( SELECT min(priority) FROM web_pages WHERE state = 'new'::dlstate_enum AND distance < 1000000 AND normal_fetch_mode = true AND ( web_pages.ignoreuntiltime < current_timestamp + '5 minutes'::interval OR web_pages.ignoreuntiltime IS NULL ) %s ) AND web_pages.distance < 1000000 AND ( web_pages.ignoreuntiltime < current_timestamp + '5 minutes'::interval OR web_pages.ignoreuntiltime IS NULL ) %s LIMIT 1; ''' % (filt, filt)) start = time.time() rid = self.db.get_session().execute(raw_query).scalar() xqtim = time.time() - start if not rid: self.db.get_session().flush() self.db.get_session().commit() return False # print("Raw ID From manual query:") # print(rid) # print() self.log.info("Query execution time: %s ms", xqtim * 1000) job = self.db.get_session().query(self.db.WebPages) \ .filter(self.db.WebPages.id == rid) \ .one() if job.state != 'new': self.db.get_session().flush() self.db.get_session().commit() self.log.info("Someone else fetched that job first!") continue if not job: self.db.get_session().flush() self.db.get_session().commit() return False if job.state != "new": raise ValueError("Wat?") job.state = "fetching" self.db.get_session().flush() self.db.get_session().commit() return job except sqlalchemy.exc.OperationalError: self.db.get_session().rollback() except sqlalchemy.exc.InvalidRequestError: self.db.get_session().rollback() def do_job(self, job): try: self.dispatchRequest(job) except urllib.error.URLError: content = "DOWNLOAD FAILED - urllib URLError" content += "<br>" content += traceback.format_exc() job.content = content # job.raw_content = content job.state = 'error' job.errno = -1 self.db.get_session().commit() self.log.error("`urllib.error.URLError` Exception when downloading.") except ValueError: content = "DOWNLOAD FAILED - ValueError" content += "<br>" content += traceback.format_exc() job.content = content # job.raw_content = content job.state = 'error' job.errno = -3 self.db.get_session().commit() except DownloadException: content = "DOWNLOAD FAILED - DownloadException" content += "<br>" content += traceback.format_exc() job.content = content # job.raw_content = content job.state = 'error' job.errno = -2 self.db.get_session().commit() self.log.error("`DownloadException` Exception when downloading.") except KeyboardInterrupt: runStatus.run = False runStatus.run_state.value = 0 print("Keyboard Interrupt!") def taskProcess(self, job_test=None): if job_test: job = job_test else: job = self.getTask() if not job: job = self.getTask(wattpad=True) if not job: time.sleep(5) return if job.netloc in self.specialty_handlers: self.special_case_handle(job) else: if job: self.do_job(job) def synchronousJobRequest(self, url, ignore_cache=False): """ trigger an immediate, synchronous dispatch of a job for url `url`, and return the fetched row upon completion """ self.log.info("Manually initiated request for content at '%s'", url) # Rather then trying to add, and rolling back if it exists, # just do a simple check for the row first. That'll # probably be faster in the /great/ majority of cases. while 1: # self.db.get_session().begin() try: row = self.db.get_session().query(self.db.WebPages) \ .filter(self.db.WebPages.url == url) \ .scalar() self.db.get_session().commit() break except sqlalchemy.exc.InvalidRequestError: self.db.get_session().rollback() if row: self.log.info("Item already exists in database.") else: self.log.info("Row does not exist in DB") start = urllib.parse.urlsplit(url).netloc # New jobs are inserted in the "fetching" state since we # don't want them to be picked up by the fetch engine # while they're still in-progress row = self.db.WebPages( state = 'fetching', url = url, starturl = url, netloc = start, distance = self.db.MAX_DISTANCE-2, is_text = True, priority = self.db.DB_REALTIME_PRIORITY, type = "unknown", fetchtime = datetime.datetime.now(), ) # Because we can have parallel operations happening here, we spin on adding&committing the new # row untill the commit either succeeds, or we get an integrity error, and then successfully # fetch the row inserted by another thread at the same time. while 1: try: # self.db.get_session().begin() self.db.get_session().add(row) self.db.get_session().commit() print("Row added?") break except sqlalchemy.exc.InvalidRequestError: print("InvalidRequest error!") self.db.get_session().rollback() traceback.print_exc() except sqlalchemy.exc.OperationalError: print("InvalidRequest error!") self.db.get_session().rollback() except sqlalchemy.exc.IntegrityError: print("[synchronousJobRequest] -> Integrity error!") self.db.get_session().rollback() row = query = self.db.get_session().query(self.db.WebPages) \ .filter(self.db.WebPages.url == url) \ .one() self.db.get_session().commit() break thresh_text_ago = datetime.datetime.now() - datetime.timedelta(seconds=CACHE_DURATION) thresh_bin_ago = datetime.datetime.now() - datetime.timedelta(seconds=RSC_CACHE_DURATION) # print("now ", datetime.datetime.now()) # print("row.fetchtime ", row.fetchtime) # print("thresh_text_ago ", thresh_text_ago) # print("thresh_bin_ago ", thresh_bin_ago) # print("row.fetchtime > thresh_text_ago ", row.fetchtime > thresh_text_ago) # print("row.fetchtime > thresh_bin_ago ", row.fetchtime > thresh_bin_ago) if ignore_cache: self.log.info("Cache ignored due to override") else: if row.state == "complete" and row.fetchtime > thresh_text_ago: self.log.info("Using cached fetch results as content was retreived within the last %s seconds.", RSC_CACHE_DURATION) self.log.info("dbid: %s", row.id) return row elif row.state == "complete" and row.fetchtime > thresh_bin_ago and "text" not in row.mimetype.lower(): self.log.info("Using cached fetch results as content was retreived within the last %s seconds.", CACHE_DURATION) return row else: self.log.info("Item has exceeded cache time by text: %s, rsc: %s. (fetchtime: %s) Re-acquiring.", thresh_text_ago, thresh_bin_ago, row.fetchtime) row.state = 'new' row.distance = self.db.MAX_DISTANCE-2 row.priority = self.db.DB_REALTIME_PRIORITY # dispatchRequest modifies the row contents directly. self.dispatchRequest(row) # Commit, because why not self.db.get_session().commit() return row def test(): archiver = SiteArchiver(None) new = { 'url' : 'http://www.royalroadl.com/fiction/1484', 'starturl' : 'http://www.royalroadl.com/', 'netloc' : "www.royalroadl.com", 'distance' : 50000, 'is_text' : True, 'priority' : 500000, 'type' : 'unknown', 'fetchtime' : datetime.datetime.now(), } cmd = text(""" INSERT INTO web_pages (url, starturl, netloc, distance, is_text, priority, type, fetchtime) VALUES (:url, :starturl, :netloc, :distance, :is_text, :priority, :type, :fetchtime) ON CONFLICT DO NOTHING """) print("doing") # ins = archiver.db.get_session().execute(cmd, params=new) # print("Doneself. Ret:") # print(ins) # print(archiver.resetDlstate()) print(archiver.getTask()) # print(archiver.getTask()) # print(archiver.getTask()) # print(archiver.taskProcess()) pass if __name__ == "__main__": test()
[ "something@fake-url.com" ]
something@fake-url.com
9c4c9650e44bfe04e59ce5e8c8a18e4c66a162d9
22d91f7054c3d32c82ff9a073c5486295f814523
/setup.py
40f8f15f242635d636dec6818f229e7159b67ec6
[ "MIT" ]
permissive
yrestom/erpnext_telegram
a6e2f1be971415c048fe99d07091bec5319c2e74
d5261a14c01fd936b097eb472add56a2a5c38ac1
refs/heads/master
2023-02-16T13:58:04.785346
2023-01-20T11:27:17
2023-01-20T11:27:17
226,947,005
87
99
NOASSERTION
2023-02-14T07:38:14
2019-12-09T19:08:52
Python
UTF-8
Python
false
false
596
py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('requirements.txt') as f: install_requires = f.read().strip().split('\n') # get version from __version__ variable in erpnext_telegram_integration/__init__.py from erpnext_telegram_integration import __version__ as version setup( name='erpnext_telegram_integration', version=version, description='Telegram Integration For Frappe - Erpnext', author='Youssef Restom', author_email='Youssef@totrox.com', packages=find_packages(), zip_safe=False, include_package_data=True, install_requires=install_requires )
[ "youssefrestom@gmail.com" ]
youssefrestom@gmail.com
39e3de964b63344d0aabc82d98c460760d2bad19
c016088a3bdb255d4f5253185d27b5a4c75feb1b
/04_working_with_list/4_12_more_loops.py
ae2a78812a14fbf60235a02cd4da69fef7ecf1e1
[ "MIT" ]
permissive
simonhoch/python_basics
b0b7c37ff647b653bb4c16a116e5521fc6b438b6
4ecf12c074e641e3cdeb0a6690846eb9133f96af
refs/heads/master
2021-04-03T10:11:10.660454
2018-03-13T20:04:46
2018-03-13T20:26:25
125,107,388
0
0
null
null
null
null
UTF-8
Python
false
false
290
py
my_foods = ['pizza', 'falafel', 'carrotcake'] friends_foods = my_foods[:] my_foods.append('cannoli') friends_foods.append('ice cream') print("My favoourite foods are :") for food in my_foods: print(food) print("\nMy friend's favorite foods are :") for food in friends_foods: print(food)
[ "simonhoch1@gmail.com" ]
simonhoch1@gmail.com
20c532e6927dfd77cb291cdf4b10a9c7cf05c294
26ef1d2a28a438c5a0eb60d30391d4ff764702e9
/main/migrations/0002_customusermodel_password_reseted.py
e68f4945bdd671dbfdfb3be239e0d1983dd47e7b
[]
no_license
EH-GD-MOHIT21/BirthDaywisherApi
249c07c2133555b06d9c1465707dc051bcdae2ef
0f9405054933b9d0d01aebb4f96fc049a7ddf7f9
refs/heads/main
2023-06-14T00:21:44.978716
2021-06-29T19:08:49
2021-06-29T19:08:49
381,467,693
2
0
null
null
null
null
UTF-8
Python
false
false
392
py
# Generated by Django 3.2.4 on 2021-06-27 16:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0001_initial'), ] operations = [ migrations.AddField( model_name='customusermodel', name='password_Reseted', field=models.BooleanField(default=False), ), ]
[ "experimentallyf@gmail.com" ]
experimentallyf@gmail.com
6c6049cac56a1f2ba14af6e3e554c2e99ce3daaa
50f63963e73a8436bef3c0e6e3be7056291e1e3b
/panda/direct/tkwidgets/WidgetPropertiesDialog.py
0693a885d116966f0bbc201c0a8aac26eba1ff48
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
MTTPAM/installer
7f4ad0c29631548345fac29ca7fbfcb38e37a111
aee7a9b75f1da88fdf6d5eae5cdf24739c540438
refs/heads/master
2020-03-09T15:32:48.765847
2018-11-13T03:35:50
2018-11-13T03:35:50
128,861,764
1
4
null
2018-11-13T03:35:50
2018-04-10T02:28:29
Python
UTF-8
Python
false
false
8,127
py
"""Undocumented Module""" __all__ = ['WidgetPropertiesDialog'] from direct.showbase.TkGlobal import * import Pmw, sys """ TODO: Checkboxes for None? Floaters to adjust float values OK and Cancel to allow changes to be delayed Something other than Return to accept a new value """ class WidgetPropertiesDialog(Toplevel): """Class to open dialogs to adjust widget properties.""" def __init__(self, propertyDict, propertyList = None, parent = None, title = 'Widget Properties'): """Initialize a dialog. Arguments: propertyDict -- a dictionary of properties to be edited parent -- a parent window (the application window) title -- the dialog title """ # Record property list self.propertyDict = propertyDict self.propertyList = propertyList if self.propertyList is None: self.propertyList = list(self.propertyDict.keys()) self.propertyList.sort() # Use default parent if none specified if not parent: if sys.version_info >= (3, 0): import tkinter parent = tkinter._default_root else: import Tkinter parent = Tkinter._default_root # Create toplevel window Toplevel.__init__(self, parent) self.transient(parent) # Set title if title: self.title(title) # Record parent self.parent = parent # Initialize modifications self.modifiedDict = {} # Create body body = Frame(self) self.initial_focus = self.body(body) body.pack(padx=5, pady=5) # Create OK Cancel button self.buttonbox() # Initialize window state self.grab_set() self.protocol("WM_DELETE_WINDOW", self.cancel) self.geometry("+%d+%d" % (parent.winfo_rootx()+50, parent.winfo_rooty()+50)) self.initial_focus.focus_set() self.wait_window(self) def destroy(self): """Destroy the window""" self.propertyDict = {} self.initial_focus = None # Clean up balloons! for balloon in self.balloonList: balloon.withdraw() Toplevel.destroy(self) # # construction hooks def body(self, master): """create dialog body. return entry that should have initial focus. This method should be overridden, and is called by the __init__ method. """ count = 0 entryList = [] self.balloonList = [] for property in self.propertyList: propertySet = self.propertyDict[property] # Widget widget = propertySet.get('widget', None) # Get initial value initialvalue = widget[property] # Type of entry entryType = propertySet.get('type', 'real') # Is None an allowable value? fAllowNone = propertySet.get('fNone', 0) # Help string specified? helpString = propertySet.get('help', None) # Create label label = Label(master, text=property, justify=LEFT) label.grid(row=count, column = 0, padx=5, sticky=W) # Create entry entry = Pmw.EntryField(master, entry_justify = 'right') entry.grid(row=count, column = 1, padx=5, sticky=W+E) if initialvalue is None: entry.insert(0, 'None') else: entry.insert(0, initialvalue) # Create balloon for help balloon = Pmw.Balloon(state = 'balloon') self.balloonList.append(balloon) # extra info if None is allowed value if helpString is None: if fAllowNone: extra = ' or None' else: extra = '' # Set up help string and validator based upon type if entryType == 'real': # Only allow real numbers if fAllowNone: entry['validate'] = { 'validator': self.realOrNone } else: entry['validate'] = { 'validator': 'real' } if helpString is None: helpString = 'Enter a floating point number' + extra + '.' elif entryType == 'integer': # Only allow integer values if fAllowNone: entry['validate'] = { 'validator': self.intOrNone } else: entry['validate'] = { 'validator': 'integer' } if helpString is None: helpString = 'Enter an integer' + extra + '.' else: # Anything goes with a string widget if helpString is None: helpString = 'Enter a string' + extra + '.' # Bind balloon with help string to entry balloon.bind(entry, helpString) # Create callback to execute whenever a value is changed modifiedCallback = (lambda f=self.modified, w=widget, e=entry, p=property, t=entryType, fn=fAllowNone: f(w, e, p, t, fn)) entry['modifiedcommand'] = modifiedCallback # Keep track of the entrys entryList.append(entry) count += 1 # Set initial focus if len(entryList) > 0: entry = entryList[0] entry.select_range(0, END) # Set initial focus to first entry in the list return entryList[0] else: # Just set initial focus to self return self def modified(self, widget, entry, property, type, fNone): self.modifiedDict[property] = (widget, entry, type, fNone) def buttonbox(self): """add standard button box buttons. """ box = Frame(self) # Create buttons w = Button(box, text="OK", width=10, command=self.ok) w.pack(side=LEFT, padx=5, pady=5) # Create buttons w = Button(box, text="Cancel", width=10, command=self.cancel) w.pack(side=LEFT, padx=5, pady=5) # Bind commands self.bind("<Return>", self.ok) self.bind("<Escape>", self.cancel) # Pack box.pack() def realOrNone(self, val): val = val.lower() if 'none'.find(val) != -1: if val == 'none': return Pmw.OK else: return Pmw.PARTIAL return Pmw.realvalidator(val) def intOrNone(self, val): val = val.lower() if 'none'.find(val) != -1: if val == 'none': return Pmw.OK else: return Pmw.PARTIAL return Pmw.integervalidator(val) # # standard button semantics def ok(self, event=None): self.withdraw() self.update_idletasks() self.validateChanges() self.apply() self.cancel() def cancel(self, event=None): # put focus back to the parent window self.parent.focus_set() self.destroy() def validateChanges(self): for property in self.modifiedDict: tuple = self.modifiedDict[property] widget = tuple[0] entry = tuple[1] type = tuple[2] fNone = tuple[3] value = entry.get() lValue = value.lower() if 'none'.find(lValue) != -1: if fNone and (lValue == 'none'): widget[property] = None else: if type == 'real': value = float(value) elif type == 'integer': value = int(value) widget[property] = value def apply(self): """process the data This method is called automatically to process the data, *after* the dialog is destroyed. By default, it does nothing. """ pass # override
[ "linktlh@gmail.com" ]
linktlh@gmail.com
432c9801db53735f2bdfd2a7ff3571bcc8a4e49a
ea21f4dee4a3af5882725fa2a5b8c0aaf755cdf6
/gsheets/tools.py
739aa35691df0710d6523bc1e6a24c05c29e4f8d
[ "GPL-1.0-or-later", "MIT" ]
permissive
nkrishnaswami/gsheets
a903077654b89559f69b139e2cd66bf235191c65
cefbb8e4f34d1f30d768d4f1d7ee38d7e92aaa11
refs/heads/master
2023-04-22T20:01:07.357509
2020-07-06T14:26:11
2020-07-06T14:26:11
275,808,436
0
0
MIT
2021-04-30T21:35:39
2020-06-29T12:28:46
Python
UTF-8
Python
false
false
3,206
py
# tools.py - generic helpers import collections __all__ = [ 'lazyproperty', 'doctemplate', 'list_view', 'eval_source', 'uniqued', ] class lazyproperty(object): # noqa: N801 """Non-data descriptor caching the computed result as instance attribute. >>> class Spam(object): ... @lazyproperty ... def eggs(self): ... return 'spamspamspam' >>> spam=Spam(); spam.eggs 'spamspamspam' >>> spam.eggs='eggseggseggs'; spam.eggs 'eggseggseggs' >>> Spam().eggs 'spamspamspam' >>> Spam.eggs # doctest: +ELLIPSIS <...lazyproperty object at 0x...> """ def __init__(self, fget): self.fget = fget for attr in ('__module__', '__name__', '__doc__'): setattr(self, attr, getattr(fget, attr)) def __get__(self, instance, owner): if instance is None: return self result = instance.__dict__[self.__name__] = self.fget(instance) return result def doctemplate(*args): """Return a decorator putting ``args`` into the docstring of the decorated ``func``. >>> @doctemplate('spam', 'spam') ... def spam(): ... '''Returns %s, lovely %s.''' ... return 'Spam' >>> spam.__doc__ 'Returns spam, lovely spam.' """ def decorator(func): func.__doc__ = func.__doc__ % tuple(args) return func return decorator class list_view(object): # noqa: N801 """Readonly view on a list or sequence. >>> list_view(['spam']) ['spam'] """ def __init__(self, items): self._items = items def __repr__(self): return repr(self._items) def __len__(self): """Return the list size. >>> len(list_view(['spam'])) 1 """ return len(self._items) def __iter__(self): """Yield list items. >>> list(list_view(['spam'])) ['spam'] """ return iter(self._items) def __contains__(self, item): """List member check. >>> 'spam' in list_view(['spam']) True """ return item in self._items def __getitem__(self, index): """Member/slice retrieval. >>> list_view(['spam'])[0] 'spam' """ return self._items[index] def group_dict(items, keyfunc): """Return a list defaultdict with ``items`` grouped by ``keyfunc``. >>> sorted(group_dict('eggs', lambda x: x).items()) [('e', ['e']), ('g', ['g', 'g']), ('s', ['s'])] """ result = collections.defaultdict(list) for i in items: key = keyfunc(i) result[key].append(i) return result def eval_source(source): """Return ``eval(source)`` with ``source`` attached as attribute. >>> eval_source("lambda: 'spam'")() 'spam' >>> eval_source("lambda: 'spam'").source "lambda: 'spam'" """ result = eval(source) result.source = source return result def uniqued(iterable): """Return unique list of ``iterable`` items preserving order. >>> uniqued('spameggs') ['s', 'p', 'a', 'm', 'e', 'g'] """ seen = set() return [item for item in iterable if item not in seen and not seen.add(item)]
[ "sebastian.bank@uni-leipzig.de" ]
sebastian.bank@uni-leipzig.de
b4ca96a7550e1cbba0c7a4aac33dbe1d00b63430
00c6ded41b84008489a126a36657a8dc773626a5
/.history/Sizing_Method/ConstrainsAnalysis/DesignPointSelectStrategy_20210715110359.py
458de074dc9d6d681c184895d59628a2bae4f911
[]
no_license
12libao/DEA
85f5f4274edf72c7f030a356bae9c499e3afc2ed
1c6f8109bbc18c4451a50eacad9b4dedd29682bd
refs/heads/master
2023-06-17T02:10:40.184423
2021-07-16T19:05:18
2021-07-16T19:05:18
346,111,158
0
0
null
null
null
null
UTF-8
Python
false
false
11,902
py
# author: Bao Li # # Georgia Institute of Technology # import sys import os sys.path.insert(0, os.getcwd()) import numpy as np import matplotlib.pylab as plt import Sizing_Method.Other.US_Standard_Atmosphere_1976 as atm import Sizing_Method.Aerodynamics.ThrustLapse as thrust_lapse import Sizing_Method.Aerodynamics.Aerodynamics as ad import Sizing_Method.ConstrainsAnalysis.ConstrainsAnalysis as ca import Sizing_Method.ConstrainsAnalysis.ConstrainsAnalysisPD as ca_pd import Sizing_Method.ConstrainsAnalysis.ConstrainsAnalysisPDP1P2 as ca_pd_12 from icecream import ic """ The unit use is IS standard """ class Design_Point_Select_Strategy: """This is a design point select strategy from constrains analysis""" def __init__(self, altitude, velocity, beta, method=1, strategy_apply=0, propulsion_constrains=0, n=12): """ :param altitude: m x 1 matrix :param velocity: m x 1 matrix :param beta: P_motor/P_total m x 1 matrix :param p_turbofan_max: maximum propulsion power for turbofan (threshold value) :param p_motorfun_max: maximum propulsion power for motorfun (threshold value) :param n: number of motor :param method: if method = 0, it is Mattingly Method, otherwise is Gudmundsson Method :param strategy_apply: if strategy_apply = 0, no strategy apply :param propulsion_constrains: if propulsion_constrains = 0, no propulsion_constrains apply the first group of condition is for stall speed the stall speed condition have to use motor, therefore with PD :return: power load: design point p/w and w/s """ self.h = altitude self.v = velocity self.beta = beta self.n_motor = n self.propulsion_constrains = propulsion_constrains self.strategy_apply = strategy_apply # initialize the p_w, w_s, hp, n, m self.n = 100 self.m = altitude.size self.hp = np.linspace(0, 1+1/self.n, self.n+1) self.hp_threshold = 0.5 # method = 0 = Mattingly_Method, method = 1 = Gudmundsson_Method if method == 0: self.method1 = ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun self.method2 = ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_electric else: self.method1 = ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun self.method2 = ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_electric problem = self.method1( self.h[0], self.v[0], self.beta[0], 6000, self.hp_threshold) self.w_s = problem.allFuncs[0](problem) def p_w_compute(self, p_w_turbofan_max, p_w_motorfun_max): p_w = np.zeros([self.m, len(self.hp)]) # m x (n+1) matrix for i in range(1, 8): for j in range(len(self.hp)): problem1 = self.method1(self.h[i], self.v[i], self.beta[i], self.w_s, self.hp[j]) problem2 = self.method2(self.h[i], self.v[i], self.beta[i], self.w_s, self.hp[j]) if i >= 5: p_w_1 = problem1.allFuncs[-1](problem1, roc=15 - 5 * (i - 5)) p_w_2 = problem2.allFuncs[-1](problem2, roc=15 - 5 * (i - 5)) else: p_w_1 = problem1.allFuncs[i](problem1) p_w_2 = problem2.allFuncs[i](problem2) if self.propulsion_constrains != 0: if p_w_1 > p_w_turbofan_max: p_w_1 = 100000 elif p_w_2 > p_w_motorfun_max: p_w_2 = 100000 p_w[i, j] = p_w_1 + p_w_2 return p_w def strategy(self): if self.propulsion_constrains == 0: p_w_turbofan_max = 100000 p_w_motorfun_max = 100000 else: # build p_w_design_point matrix, try p_w_max to find the best one p_w_design_point = np.zeros([50, 40]) for i in range(60): for j in range(50): p_w = Design_Point_Select_Strategy.p_w_compute(self, i, j) #find the min p_w for difference hp for each flight condition: p_w_min = np.amin(p_w, axis=1) p_w_design_point[i, j] = np.amax(p_w_min) print(i) p_w_turbofan_max = np.unravel_index( p_w_design_point.argmin(), p_w_design_point.shape)[0] p_w_motorfun_max = np.unravel_index( p_w_design_point.argmin(), p_w_design_point.shape)[1] p_w = Design_Point_Select_Strategy.p_w_compute( self, p_w_turbofan_max, p_w_motorfun_max) #find the min p_w for difference hp for each flight condition: p_w_min = np.amin(p_w, axis=1) #find the index of p_w_min which is the hp hp_p_w_min = np.zeros(8) for i in range(1, 8): for j in range(len(self.hp)): if p_w[i, j] - p_w_min[i] < 0.001: hp_p_w_min[i] = j * 0.01 hp_p_w_min[0] = p_w_motorfun_max/(p_w_motorfun_max+p_w_turbofan_max) #find the max p_w_min for each flight condition which is the design point we need: design_point = np.array([self.w_s, np.amax(p_w_min)]) return hp_p_w_min, design_point, p_w_turbofan_max, p_w_motorfun_max def no_strategy(self): p_w = Design_Point_Select_Strategy.p_w_compute(self) p_w_min = p_w[:,50] # ic(p_w_min) hp_p_w_min = 0.5*np.ones(8) #find the max p_w_min for each flight condition which is the design point we need: design_point = np.array([self.w_s, np.amax(p_w_min)]) return hp_p_w_min, design_point if __name__ == "__main__": constrains = np.array([[0, 80, 1, 0.2], [0, 68, 0.988, 0.5], [11300, 230, 0.948, 0.8], [11900, 230, 0.78, 0.8], [3000, 100, 0.984, 0.8], [0, 100, 0.984, 0.5], [3000, 200, 0.975, 0.6], [7000, 230, 0.96, 0.7]]) h = constrains[:, 0] v = constrains[:, 1] beta = constrains[:, 2] problem = Design_Point_Select_Strategy(h, v, beta, method=1) hp_p_w_min, design_point, p_w_turbofan_max, p_w_motorfun_max = problem.strategy() ic(hp_p_w_min, design_point, p_w_turbofan_max, p_w_motorfun_max) n = 250 w_s = np.linspace(100, 9000, n) constrains_name = ['stall speed', 'take off', 'cruise', 'service ceiling', 'level turn @3000m', 'climb @S-L', 'climb @3000m', 'climb @7000m', 'feasible region-hybrid', 'feasible region-conventional'] color = ['k', 'c', 'b', 'g', 'y', 'plum', 'violet', 'm'] methods = [ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun, ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun, ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_electric, ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_electric, ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun, ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun, ca_pd_12.ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun, ca_pd_12.ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun] m = constrains.shape[0] p_w = np.zeros([m, n, 8]) # plots fig, ax = plt.subplots(3, 2, sharey=True, sharex=True, figsize=(10, 10)) ax = ax.flatten() for k in range(8): for i in range(m): for j in range(n): h = constrains[i, 0] v = constrains[i, 1] beta = constrains[i, 2] hp = hp_p_w_min[i] # calculate p_w if k < 4: problem = methods[k](h, v, beta, w_s[j], hp) if i >= 5: p_w[i, j, k] = problem.allFuncs[-1](problem, roc=15 - 5 * (i - 5)) else: p_w[i, j, k] = problem.allFuncs[i](problem) elif k > 5: problem = methods[k](h, v, beta, w_s[j], Hp=0) if i >= 5: p_w[i, j, k] = problem.allFuncs[-1](problem, roc=15 - 5 * (i - 5)) else: p_w[i, j, k] = problem.allFuncs[i](problem) elif k == 4: if i == 0: problem = methods[k](h, v, beta, w_s[j], hp) p_w[i, j, k] = problem.allFuncs[i](problem) else: p_w[i, j, k] = p_w[i, j, 0] + p_w[i, j, 2] else: if i == 0: problem = methods[k](h, v, beta, w_s[j], hp) p_w[i, j, k] = problem.allFuncs[i](problem) else: p_w[i, j, k] = p_w[i, j, 1] + p_w[i, j, 3] if k <= 5: if i == 0: ax[k].plot(p_w[i, :, k], np.linspace(0, 100, n), linewidth=1, color=color[i], label=constrains_name[i]) else: ax[k].plot(w_s, p_w[i, :, k], color=color[i], linewidth=1, alpha=1, label=constrains_name[i]) else: if i == 0: ax[k-2].plot(p_w[i, :, k], np.linspace( 0, 100, n), color=color[i], linewidth=1, alpha=0.5, linestyle='--') else: ax[k-2].plot(w_s, p_w[i, :, k], color=color[i], linewidth=1, alpha=0.5, linestyle='--') if k <= 5: p_w[0, :, k] = 10 ** 10 * (w_s - p_w[0, 0, k]) ax[k].fill_between(w_s, np.amax(p_w[0:m, :, k], axis=0), 150, color='b', alpha=0.5, label=constrains_name[-2]) ax[k].set_xlim(200, 9000) ax[k].set_ylim(0, 100) ax[k].grid() else: p_w[0, :, k] = 10 ** 10 * (w_s - p_w[0, 0, k]) ax[k-2].fill_between(w_s, np.amax(p_w[0:m, :, k], axis=0), 150, color='r', alpha=0.5, label=constrains_name[-1]) ax[k-2].plot(6012, 72, 'r*', markersize=5, label='True Conventional') handles, labels = plt.gca().get_legend_handles_labels() fig.legend(handles, labels, bbox_to_anchor=(0.125, 0.02, 0.75, 0.25), loc="lower left", mode="expand", borderaxespad=0, ncol=4, frameon=False) hp = constrains[:, 3] plt.setp(ax[0].set_title(r'$\bf{Mattingly-Method}$')) plt.setp(ax[1].set_title(r'$\bf{Gudmundsson-Method}$')) plt.setp(ax[4:6], xlabel='Wing Load: $W_{TO}$/S (N/${m^2}$)') plt.setp(ax[0], ylabel=r'$\bf{Turbofun}$''\n $P_{SL}$/$W_{TO}$ (W/N)') plt.setp(ax[2], ylabel=r'$\bf{Motor}$ ''\n $P_{SL}$/$W_{TO}$ (W/N)') plt.setp( ax[4], ylabel=r'$\bf{Turbofun+Motor}$' '\n' r'$\bf{vs.Conventional}$ ''\n $P_{SL}$/$W_{TO}$ (W/N)') plt.subplots_adjust(bottom=0.15) plt.suptitle(r'$\bf{Component}$' ' ' r'$\bf{P_{SL}/W_{TO}}$' ' ' r'$\bf{Diagrams}$' ' ' r'$\bf{After}$' ' ' r'$\bf{Adjust}$' ' ' r'$\bf{Degree-of-Hybridization}$' '\n hp: take-off=' + str(hp[0]) + ' stall-speed=' + str(hp[1]) + ' cruise=' + str(hp[2]) + ' service-ceiling=' + str(hp[3]) + '\n level-turn=@3000m' + str(hp[4]) + ' climb@S-L=' + str(hp[5]) + ' climb@3000m=' + str(hp[6]) + ' climb@7000m=' + str(hp[7])) plt.show()
[ "libao@gatech.edu" ]
libao@gatech.edu
57d92fa9e354a050c91008bbcf14dbed05ceae23
f937b8dce0467b13b45e46dae948effce2ef5295
/network/v2_0/vpn/test_service_integration.py
12347934c0eb38ace4f46c3eb997751ca682f3f8
[]
no_license
TerryHowe/oscaft
946410743635c642bc55dbc43503d438e9ddd926
d4bce05488e02c9cba989f48fe7d2a5a5aaf723d
refs/heads/master
2021-01-10T21:45:19.794301
2014-03-05T16:36:42
2014-03-05T16:36:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,823
py
# Copyright 2013 OpenStack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law 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. # import httpretty from openstackclient.network.v2_0.vpn import service from openstackclient.tests.oscaft import common class TestServiceIntegration(common.TestIntegrationBase): HOSTESS = common.TestIntegrationBase.HOST + common.TestIntegrationBase.VER SUBNETS_URL = HOSTESS + "/subnets.json" SUBNETS_ONE = '{ "subnets": [{ "id": "12312311" }]}' ROUTERS_URL = HOSTESS + "/routers.json" ROUTERS_ONE = '{ "routers": [{ "id": "33333333" }]}' CREATE_URL = HOSTESS + "/vpn/vpnservices.json" CREATE = """ { "vpnservice": { "status": "ACTIVE", "name": "nameo", "tenant_id": "33a40233", "id": "a9254bdb" } }""" DELETE_URL = HOSTESS + "/vpn/vpnservices/a9254bdb.json" DELETE = "{}" LIST_URL = HOSTESS + "/vpn/vpnservices.json" LIST_ONE = """ { "vpnservices": [{ "id": "a9254bdb" }] }""" LIST = """ { "vpnservices": [ { "status": "ACTIVE", "name": "nameo", "tenant_id": "33a40233", "id": "a9254bdb" }, { "status": "ACTIVE", "name": "croc", "tenant_id": "33a40233", "id": "b8408dgd" } ] }""" SET_URL = HOSTESS + "/vpn/vpnservices/a9254bdb.json" SET = "{}" SHOW_URL = HOSTESS + "/vpn/vpnservices/a9254bdb.json" SHOW = CREATE @httpretty.activate def test_create(self): pargs = common.FakeParsedArgs() pargs.name = 'nameo' pargs.subnet = 'subby' pargs.router = 'rooty' pargs.admin_state = True pargs.tenant_id = '33a40233' httpretty.register_uri(httpretty.GET, self.SUBNETS_URL, body=self.SUBNETS_ONE) httpretty.register_uri(httpretty.GET, self.ROUTERS_URL, body=self.ROUTERS_ONE) httpretty.register_uri(httpretty.POST, self.CREATE_URL, body=self.CREATE) self.when_run(service.CreateService, pargs) self.assertEqual('', self.stderr()) self.assertEqual(u"""\ Created a new vpnservice: id="a9254bdb" name="nameo" status="ACTIVE" tenant_id="33a40233" """, self.stdout()) @httpretty.activate def test_delete(self): pargs = common.FakeParsedArgs() pargs.identifier = 'nameo' httpretty.register_uri(httpretty.GET, self.LIST_URL, body=self.LIST_ONE) httpretty.register_uri(httpretty.DELETE, self.DELETE_URL, body=self.DELETE) self.when_run(service.DeleteService, pargs) self.assertEqual('', self.stderr()) self.assertEqual(u'Deleted vpnservice: nameo\n', self.stdout()) @httpretty.activate def test_list(self): pargs = common.FakeParsedArgs() pargs.formatter = 'csv' httpretty.register_uri(httpretty.GET, self.LIST_URL, body=self.LIST) self.when_run(service.ListService, pargs) self.assertEqual('', self.stderr()) self.assertEqual("""\ id,name,status a9254bdb,nameo,ACTIVE b8408dgd,croc,ACTIVE """, self.stdout()) @httpretty.activate def test_set(self): pargs = common.FakeParsedArgs() pargs.identifier = 'nameo' httpretty.register_uri(httpretty.GET, self.LIST_URL, body=self.LIST_ONE) httpretty.register_uri(httpretty.PUT, self.SET_URL, body=self.SET) self.when_run(service.SetService, pargs) self.assertEqual('', self.stderr()) self.assertEqual('Updated vpnservice: nameo\n', self.stdout()) @httpretty.activate def test_show(self): pargs = common.FakeParsedArgs() pargs.identifier = 'nameo' httpretty.register_uri(httpretty.GET, self.LIST_URL, body=self.LIST_ONE) httpretty.register_uri(httpretty.GET, self.SHOW_URL, body=self.SHOW) self.when_run(service.ShowService, pargs) self.assertEqual('', self.stderr()) self.assertEqual(u"""\ id="a9254bdb" name="nameo" status="ACTIVE" tenant_id="33a40233" """, self.stdout())
[ "terrylhowe@gmail.com" ]
terrylhowe@gmail.com
f124cc9fc71055e881257d4f7e4a6118f7c307e9
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/4/jq0.py
2a70ce098ef42fbf1eb5c70da84d1e709d261504
[]
no_license
G4te-Keep3r/HowdyHackers
46bfad63eafe5ac515da363e1c75fa6f4b9bca32
fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2
refs/heads/master
2020-08-01T12:08:10.782018
2016-11-13T20:45:50
2016-11-13T20:45:50
73,624,224
0
1
null
null
null
null
UTF-8
Python
false
false
486
py
import sys def printFunction(lineRemaining): if lineRemaining[0] == '"' and lineRemaining[-1] == '"': if len(lineRemaining) > 2: #data to print lineRemaining = lineRemaining[1:-1] print ' '.join(lineRemaining) else: print def main(fileName): with open(fileName) as f: for line in f: data = line.split() if data[0] == 'jQ0': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
[ "juliettaylorswift@gmail.com" ]
juliettaylorswift@gmail.com
fba8f796a41c43d442b43240179a28ee8763ed64
a574d0c0ebc8e17eb641777f93544c0ae43850c9
/part_3/4.5.4_modify_dict.py
c2dbfc9fab278145af88ff9543c5680ec080a8c7
[]
no_license
broepke/GTx
1e33c97d0f86e95124ceb5f0436f965154822466
e12143c9b1fc93d4489eb0f6c093637503139bf6
refs/heads/master
2020-04-08T09:35:41.884572
2020-01-03T03:37:34
2020-01-03T03:37:34
159,230,824
3
2
null
null
null
null
UTF-8
Python
false
false
1,955
py
# Write a function called modify_dict. modify_dict takes one # parameter, a dictionary. The dictionary's keys are people's # last names, and the dictionary's values are people's first # names. For example, the key "Joyner" would have the value # "David". # # modify_dict should delete any key-value pair for which the # key's first letter is not capitalized. For example, the # key-value pair "joyner":"David" would be deleted, but the # key-value pair "Joyner":"david" would not be deleted. Then, # return the modified dictionary. # # Remember, the keyword del deletes items from lists and # dictionaries. For example, to remove the key "key!" from # the dictionary my_dict, you would write: del my_dict["key!"] # Or, if the key was the variable my_key, you would write: # del my_dict[my_key] # # Hint: If you try to delete items from the dictionary while # looping through the dictionary, you'll run into problems! # We should never change the number if items in a list or # dictionary while looping through those items. Think about # what you could do to keep track of which keys should be # deleted so you can delete them after the loop is done. # # Hint 2: To check if the first letter of a string is a # capital letter, use string[0].isupper(). # Write your function here! def modify_dict(a_dict): to_delete = [] for last_names in a_dict.keys(): if not last_names[0].isupper(): to_delete.append(last_names) for names in to_delete: del a_dict[names] return a_dict # Below are some lines of code that will test your function. # You can change the value of the variable(s) to test your # function with different inputs. # # If your function works correctly, this will originally # print (although the order of the keys may vary): # {'Diaddigo':'Joshua', 'Elliott':'jackie'} my_dict = {'Joshua': 'Diaddigo', 'joyner': 'David', 'Elliott': 'jackie', 'murrell': 'marguerite'} print(modify_dict(my_dict))
[ "broepke@gmail.com" ]
broepke@gmail.com
eda246aacebf6179f8d8da7e6cd5e0d64c2be0b3
2bdedcda705f6dcf45a1e9a090377f892bcb58bb
/src/main/output/month_air/city/woman/world.py
f97a907eecbf688cc6b2b1a09bc9bbfce64f5dff
[]
no_license
matkosoric/GenericNameTesting
860a22af1098dda9ea9e24a1fc681bb728aa2d69
03f4a38229c28bc6d83258e5a84fce4b189d5f00
refs/heads/master
2021-01-08T22:35:20.022350
2020-02-21T11:28:21
2020-02-21T11:28:21
242,123,053
1
0
null
null
null
null
UTF-8
Python
false
false
3,939
py
using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; // Install Newtonsoft.Json with NuGet using Newtonsoft.Json; namespace translate_sample { class Program { private const string key_var = "TRANSLATOR_TEXT_SUBSCRIPTION_KEY"; private const string endpoint_var = "TRANSLATOR_TEXT_ENDPOINT"; private static readonly string endpoint = Environment.GetEnvironmentVariable(endpoint_var); static Program() { if (null == subscriptionKey) { throw new Exception("Please set/export the environment variable: " + key_var); } if (null == endpoint) { throw new Exception("Please set/export the environment variable: " + endpoint_var); } } // The code in the next section goes here. // This sample requires C# 7.1 or later for async/await. // Async call to the Translator Text API static public async Task TranslateTextRequest(string subscriptionKey, string endpoint, string route, string inputText) { object[] body = new object[] { new { Text = inputText } }; var requestBody = JsonConvert.SerializeObject(body); using (var client = new HttpClient()) using (var request = new HttpRequestMessage()) private static readonly string subscriptionKey = "93f365052c9e0562bfbb7a88aaa9513e"; { // Build the request. // Set the method to Post. request.Method = HttpMethod.Post; // Construct the URI and add headers. request.RequestUri = new Uri(endpoint + route); request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json"); request.Headers.Add("75fd5c14e7ae7e91692980371ca8be51", subscriptionKey); // Send the request and get response. HttpResponseMessage response = await client.SendAsync(request).ConfigureAwait(false); // Read response as a string. string result = await response.Content.ReadAsStringAsync(); // Deserialize the response using the classes created earlier. TranslationResult[] deserializedOutput = JsonConvert.DeserializeObject<TranslationResult[]>(result); // Iterate over the deserialized results. foreach (TranslationResult o in deserializedOutput) { // Print the detected input language and confidence score. Console.WriteLine("Detected input language: {0}\nConfidence score: {1}\n", o.DetectedLanguage.Language, o.DetectedLanguage.Score); // Iterate over the results and print each translation. foreach (Translation t in o.Translations) { Console.WriteLine("Translated to {0}: {1}", t.To, t.Text); } } } } static async Task Main(string[] args) { // This is our main function. // Output languages are defined in the route. // For a complete list of options, see API reference. // https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate string route = "/translate?api-version=3.0&to=de&to=it&to=ja&to=th"; // Prompts you for text to translate. If you'd prefer, you can // provide a string as textToTranslate. Console.Write("Type the phrase you'd like to translate? "); string textToTranslate = Console.ReadLine(); await TranslateTextRequest(subscriptionKey, endpoint, route, textToTranslate); Console.WriteLine("Press any key to continue."); Console.ReadKey(); } } }
[ "soric.matko@gmail.com" ]
soric.matko@gmail.com
5bc99ce805369e20b7123860247511801e95408a
a08225934c425be313a12975c9563a72ded58be6
/round644/spystring.py
ce55548d95836a56223f6329afb0e371f8c94c36
[]
no_license
marcus-aurelianus/codeforce
27c966554dee9986f23fb2925bd53e6cceb8b9e9
4764df151ade7806e32b6c88283a2de946f99e16
refs/heads/master
2023-03-18T09:30:55.042594
2021-03-12T18:14:08
2021-03-12T18:14:08
231,387,022
2
0
null
null
null
null
UTF-8
Python
false
false
1,221
py
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ def gift(): for _ in range(t): n,m = list(map(int,input().split())) arrys=[] for i in range(n): kap=list(input()) arrys.append(kap) diffdic={} for i in range(n): for j in range(m): for k in range(i+1,n): if arrys[i][j]!=arrys[k][j]: kap=diffdic.get(j,[]) kap.append([i,k]) diffdic[j]=kap if len(diffdic)>2: yield -1 else: ans="" notin=[] for j in range(m): if j not in diffdic: ans+=arrys[0][j] else: counterdic={} for i in range(n): ele=arrys[i][j] freq=counterdic.get(ele,0) counterdi[ele]=freq+1 maxele=max(counterdic, key=counterdic.get) yield diffdic #aaaab #abaaa #aabbb if __name__ == '__main__': t= int(input()) ans = gift() print(*ans,sep='\n')
[ "marcus.lihao@gmail.com" ]
marcus.lihao@gmail.com
d111130febd4bb406c6961126dc1ccc74bee080c
2523b2690fadfccbd56153de011b27faa9c31c61
/urls.py
8c77ab489dea24ded6afb1dcaa2ac4aea5f7be80
[]
no_license
victorhook/django-init
39cf66a33f7a4e10c86f09ade19934996402906a
e38692467ff2c8093e7803b359934ec182fe4681
refs/heads/master
2023-04-05T16:31:17.654905
2021-04-16T10:44:46
2021-04-16T10:44:46
358,564,635
0
0
null
null
null
null
UTF-8
Python
false
false
391
py
from django.conf.urls.static import static from django.conf import settings from django.contrib import admin from django.urls import path, include from . import views urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), path('', views.index, name='index') ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
[ "victorkrook96@gmail.com" ]
victorkrook96@gmail.com
8c2dbaf86f524f55059765161f070307296f1b6a
4809471274d6e136ac66d1998de5acb185d1164e
/pypureclient/flasharray/FA_2_5/models/remote_protection_group_snapshot_transfer.py
6739780776fb0f1bc143dee2bc29bf1b53da6baf
[ "BSD-2-Clause" ]
permissive
astrojuanlu/py-pure-client
053fef697ad03b37ba7ae21a0bbb466abf978827
6fa605079950765c316eb21c3924e8329d5e3e8a
refs/heads/master
2023-06-05T20:23:36.946023
2021-06-28T23:44:24
2021-06-28T23:44:24
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,411
py
# coding: utf-8 """ FlashArray REST API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 2.5 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re import six import typing from ....properties import Property if typing.TYPE_CHECKING: from pypureclient.flasharray.FA_2_5 import models class RemoteProtectionGroupSnapshotTransfer(object): """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'name': 'str', 'destroyed': 'bool', 'started': 'int', 'progress': 'float', 'completed': 'int', 'data_transferred': 'int', 'physical_bytes_written': 'int' } attribute_map = { 'name': 'name', 'destroyed': 'destroyed', 'started': 'started', 'progress': 'progress', 'completed': 'completed', 'data_transferred': 'data_transferred', 'physical_bytes_written': 'physical_bytes_written' } required_args = { } def __init__( self, name=None, # type: str destroyed=None, # type: bool started=None, # type: int progress=None, # type: float completed=None, # type: int data_transferred=None, # type: int physical_bytes_written=None, # type: int ): """ Keyword args: name (str): A user-specified name. The name must be locally unique and can be changed. destroyed (bool): Returns a value of `true` if the snapshot has been destroyed and is pending eradication. The destroyed snapshot can be recovered by setting `destroyed=false`. Once the eradication pending period has elapsed, the snapshot is permanently eradicated and can no longer be recovered. started (int): The timestamp of when the snapshot replication process started. Measured in milliseconds since the UNIX epoch. progress (float): The percentage progress of the snapshot transfer from the source array to the target. Displayed in decimal format. completed (int): The timestamp of when the snapshot replication process completed. Measured in milliseconds since the UNIX epoch. data_transferred (int): The number of bytes transferred from the source to the target as part of the replication process. Measured in bytes. physical_bytes_written (int): The amount of physical/logical data written to the target due to replication. Measured in bytes. """ if name is not None: self.name = name if destroyed is not None: self.destroyed = destroyed if started is not None: self.started = started if progress is not None: self.progress = progress if completed is not None: self.completed = completed if data_transferred is not None: self.data_transferred = data_transferred if physical_bytes_written is not None: self.physical_bytes_written = physical_bytes_written def __setattr__(self, key, value): if key not in self.attribute_map: raise KeyError("Invalid key `{}` for `RemoteProtectionGroupSnapshotTransfer`".format(key)) self.__dict__[key] = value def __getattribute__(self, item): value = object.__getattribute__(self, item) if isinstance(value, Property): raise AttributeError else: return value def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.swagger_types): if hasattr(self, attr): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(RemoteProtectionGroupSnapshotTransfer, dict): for key, value in self.items(): result[key] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, RemoteProtectionGroupSnapshotTransfer): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
[ "hubert.chan@purestorage.com" ]
hubert.chan@purestorage.com
4486aa023f431fbbf7808e49ae5aa6d05d16892a
8878700a71196cc33b7be00357b625cf9883043c
/store/models.py
f9f50d892d1ed47c590678476853e180d3cda592
[ "MIT" ]
permissive
Jerome-Celle/Blitz-API
bc7db966cbbb45b29bbbe944adb954d6cb5a0040
a0f870d6774abf302886ab70e169572a9d0225ef
refs/heads/master
2021-06-10T06:05:03.753314
2018-11-30T15:40:38
2018-11-30T15:46:19
165,642,546
0
0
MIT
2019-01-14T10:32:29
2019-01-14T10:32:28
null
UTF-8
Python
false
false
6,465
py
import decimal from django.db import models from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation ) from django.contrib.contenttypes.models import ContentType from simple_history.models import HistoricalRecords from blitz_api.models import AcademicLevel User = get_user_model() TAX = settings.LOCAL_SETTINGS['SELLING_TAX'] class Order(models.Model): """Represents a transaction.""" class Meta: verbose_name = _("Order") verbose_name_plural = _("Orders") user = models.ForeignKey( User, on_delete=models.CASCADE, verbose_name=_("User"), related_name='orders', ) transaction_date = models.DateTimeField( verbose_name=_("Transaction date"), ) authorization_id = models.CharField( verbose_name=_("Authorization ID"), max_length=253, ) settlement_id = models.CharField( verbose_name=_("Settlement ID"), max_length=253, ) history = HistoricalRecords() @property def total_cost(self): cost = 0 orderlines = self.order_lines.filter( models.Q(content_type__model='membership') | models.Q(content_type__model='package') ) for orderline in orderlines: cost += orderline.content_object.price * orderline.quantity return round(decimal.Decimal(float(cost) + TAX * float(cost)), 2) @property def total_ticket(self): tickets = 0 orderlines = self.order_lines.filter( content_type__model='timeslot' ) for orderline in orderlines: tickets += orderline.content_object.price * orderline.quantity return tickets def __str__(self): return str(self.authorization_id) class OrderLine(models.Model): """ Represents a line of an order. Can specify the product/service with a generic relationship. """ class Meta: verbose_name = _("Order line") verbose_name_plural = _("Order lines") content_type = models.ForeignKey( ContentType, on_delete=models.CASCADE ) object_id = models.PositiveIntegerField() content_object = GenericForeignKey( 'content_type', 'object_id' ) order = models.ForeignKey( Order, on_delete=models.CASCADE, verbose_name=_("Order"), related_name='order_lines', ) quantity = models.PositiveIntegerField( verbose_name=_("Quantity"), ) history = HistoricalRecords() def __str__(self): return str(self.content_object) + ', qt:' + str(self.quantity) class BaseProduct(models.Model): """Abstract model for base products""" name = models.CharField( verbose_name=_("Name"), max_length=253, ) available = models.BooleanField( verbose_name=_("Available") ) price = models.DecimalField( max_digits=6, decimal_places=2, verbose_name=_("Price"), ) details = models.CharField( verbose_name=_("Details"), max_length=1000, null=True, blank=True, ) order_lines = GenericRelation(OrderLine) class Meta: abstract = True class Membership(BaseProduct): """Represents a membership.""" class Meta: verbose_name = _("Membership") verbose_name_plural = _("Memberships") duration = models.DurationField() academic_levels = models.ManyToManyField( AcademicLevel, blank=True, verbose_name=_("Academic levels"), related_name='memberships', ) # History is registered in translation.py # history = HistoricalRecords() def __str__(self): return self.name class Package(BaseProduct): """Represents a reservation package.""" class Meta: verbose_name = _("Package") verbose_name_plural = _("Packages") reservations = models.PositiveIntegerField( verbose_name=_("Reservations"), ) exclusive_memberships = models.ManyToManyField( Membership, blank=True, verbose_name=_("Memberships"), related_name='packages', ) # History is registered in translation.py # history = HistoricalRecords() def __str__(self): return self.name class CustomPayment(models.Model): """ Represents a custom payment that is not directly related to a product. Used for manual custom transactions. """ user = models.ForeignKey( User, on_delete=models.CASCADE, verbose_name=_("User"), related_name='custom_payments', ) name = models.CharField( verbose_name=_("Name"), max_length=253, ) price = models.DecimalField( max_digits=6, decimal_places=2, verbose_name=_("Price"), ) details = models.TextField( verbose_name=_("Details"), max_length=1000, null=True, blank=True, ) transaction_date = models.DateTimeField( verbose_name=_("Transaction date"), ) authorization_id = models.CharField( verbose_name=_("Authorization ID"), max_length=253, ) settlement_id = models.CharField( verbose_name=_("Settlement ID"), max_length=253, ) class Meta: verbose_name = _("Custom payment") verbose_name_plural = _("Custom payments") history = HistoricalRecords() def __str__(self): return self.name class PaymentProfile(models.Model): """Represents a payment profile linked to an external payment API.""" class Meta: verbose_name = _("Payment profile") verbose_name_plural = _("Payment profiles") name = models.CharField( verbose_name=_("Name"), max_length=253, ) owner = models.ForeignKey( User, on_delete=models.CASCADE, verbose_name=_("User"), related_name='payment_profiles', ) external_api_id = models.CharField( verbose_name=_("External profile ID"), max_length=253, ) external_api_url = models.CharField( verbose_name=_("External profile url"), max_length=253, ) history = HistoricalRecords() def __str__(self): return self.name
[ "frank.jeanneau@gmail.com" ]
frank.jeanneau@gmail.com
0901d4428fc72e6ab7427fe2b0ad71f2f49f8bad
9bcf722780efec7994bebe2bb476b0784b0a353a
/307-Range-Sum-Query---Mutable/solution.py
f7918453c713753e26ed2787028a1077c52ef1f3
[]
no_license
wenjie1070116/Leetcode
a1429810513276b845bfb36284bd747308c015b3
5f5791b1e7eefa0205cbb6cb8ae2d5320ffcd916
refs/heads/master
2020-04-06T06:50:23.762233
2016-08-19T19:36:15
2016-08-19T19:36:15
58,875,500
0
0
null
null
null
null
UTF-8
Python
false
false
2,149
py
class SegmentTreeNode(object): def __init__(self, start, end, Sum): self.start, self.end, self.Sum = start, end, Sum self.left = None self.right = None class NumArray(object): def build(self, start, end, nums): if start > end: return None root = SegmentTreeNode(start, end, 0) if start == end: root.Sum = nums[start] else: mid = start + (end-start)/2 root.left = self.build(start, mid, nums) root.right = self.build(mid+1, end, nums) root.Sum = root.left.Sum + root.right.Sum return root def __init__(self, nums): """ initialize your data structure here. :type nums: List[int] """ self.root = None if nums: self.root = self.build(0, len(nums)-1, nums) def updateTree(self, root, i, val): if not root or i < root.start or i > root.end: return if root.start == root.end == i: root.Sum = val return mid = root.start+(root.end-root.start)/2 if i > mid: self.updateTree(root.right, i, val) else: self.updateTree(root.left, i, val) root.Sum = root.left.Sum+root.right.Sum def update(self, i, val): """ :type i: int :type val: int :rtype: int """ return self.updateTree(self.root, i, val) def sumTree(self, root, i, j): if not root or j < root.start or i > root.end: return 0 if i <= root.start and j >= root.end: return root.Sum left = self.sumTree(root.left, i, j) right = self.sumTree(root.right, i, j) return left+right def sumRange(self, i, j): """ sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int """ return self.sumTree(self.root, i, j) # Your NumArray object will be instantiated and called as such: # numArray = NumArray(nums) # numArray.sumRange(0, 1) # numArray.update(1, 10) # numArray.sumRange(1, 2)
[ "wenjie1070116@gmail.com" ]
wenjie1070116@gmail.com
cc8cd1ec82602764bdcdb0ffa52d5ca1d2deafeb
7e40c8bb28c2cee8e023751557b90ef7ef518326
/axb_2019_fmt32/axb_2019_fmt32.py
f6e5ec9ea1fe5058692348efeed119877bb83dff
[]
no_license
1337536723/buuctf_pwn
b6e5d65372ed0638a722faef1775026a89321fa3
cca3c4151a50c7d7c3237dab2c5a283dbcf6fccf
refs/heads/master
2023-08-29T19:35:04.352530
2021-11-16T14:06:20
2021-11-16T14:06:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
737
py
from pwn import * context.log_level = 'debug' pn = './axb_2019_fmt32' #p = process(pn) p = remote('node4.buuoj.cn', 26960) elf = ELF(pn) #libc = ELF('/lib/i386-linux-gnu/libc.so.6') libc = ELF('libc-2.23.so') #gdb.attach(p, 'b *0x804874b') printf_got = elf.got['printf'] read_got = elf.got['read'] #leak libc payload = b'a' + p32(read_got) + b'%8$s' p.sendlineafter('me:', payload) p.recv(14) libc_base = (u32(p.recv(4))) - libc.sym['read'] print('libc_base -> {}'.format(hex(libc_base))) system = libc_base + libc.sym['system'] p.recvuntil(b'me:') payload = b'a' + fmtstr_payload(8, { printf_got: system }, write_size = 'byte', numbwritten = 0x9 + 1) p.sendline(payload) p.sendlineafter(b'\n', b';cat flag') p.interactive()
[ "admin@srmxy.cn" ]
admin@srmxy.cn
2c4749b55b8632ded80bdbe938e0155072f390c3
fd453abf8b9b049894ddd7848be7bb5e6f1aa26d
/setup.py
1cc18dcd8ddbadcb278eb4e7c624ac30f20b794e
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
luzfcb/django-weasyprint-pdf
b9d895f998c467114cfb0e8b7e8ada7ee469d286
c03ccb8229f317b3492ea7a5e748d4c720a6dd23
refs/heads/master
2021-01-23T07:56:38.612731
2017-01-31T21:14:19
2017-01-31T21:44:26
80,524,442
0
0
null
null
null
null
UTF-8
Python
false
false
2,589
py
#!/usr/bin/env python # -*- encoding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function import io import re from glob import glob from os.path import basename from os.path import dirname from os.path import join from os.path import splitext from setuptools import find_packages from setuptools import setup def read(*names, **kwargs): return io.open( join(dirname(__file__), *names), encoding=kwargs.get('encoding', 'utf8') ).read() setup( name='django-weasyprint-pdf', version='0.1.0', license='BSD', description='django helper tools to integrate with WeasyPrint', long_description='%s\n%s' % ( re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst')) ), author='Fabio C. Barrionuevo da Luz', author_email='bnafta@gmail.com', url='https://github.com/luzfcb/django-weasyprint-pdf', packages=find_packages('src'), package_dir={'': 'src'}, py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], include_package_data=True, zip_safe=False, classifiers=[ # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: Unix', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', # uncomment if you test on these interpreters: # 'Programming Language :: Python :: Implementation :: IronPython', # 'Programming Language :: Python :: Implementation :: Jython', # 'Programming Language :: Python :: Implementation :: Stackless', 'Topic :: Utilities', ], keywords=[ # eg: 'keyword1', 'keyword2', 'keyword3', ], install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', ], extras_require={ # eg: # 'rst': ['docutils>=0.11'], # ':python_version=="2.6"': ['argparse'], }, )
[ "bnafta@gmail.com" ]
bnafta@gmail.com
e2ffe3b3f784c2225d4166221373e5d2d572aa63
cb6d888dfe457cf4a80c5187da7f74be92453a3f
/HackerEarth/Complete the Syllabus.py
16020d6070ba82ef2c3fd10d99c70f9faad61620
[]
no_license
abhaykatheria/cp
7e7b6ce971fdbb9207cb1cba237a3d4b47cff111
62cd3895798b64a4b8d307f94d419abe6e6b702f
refs/heads/master
2021-05-22T15:23:47.512506
2020-10-29T09:17:50
2020-10-29T09:17:50
252,980,081
1
7
null
2020-10-29T09:17:52
2020-04-04T11:34:59
Python
UTF-8
Python
false
false
586
py
# -*- coding: utf-8 -*- """ Created on Mon Oct 8 16:16:09 2018 @author: Mithilesh """ def syllabus(k,arr): arr2=["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"] top=[] sum1=0 for i in range(0,7): sum1+=arr[i] top.append(sum1) for j in range(0,7): if sum1<k: k=k%sum1 if k==0: k=sum1 if top[j]==k or (k<top[j]): print(arr2[j]) break t=int(input()) for q in range(t): k=int(input()) arr=list(map(int,input().split())) syllabus(k,arr)
[ "shubhamtiwari.tiwari84@gmail.com" ]
shubhamtiwari.tiwari84@gmail.com
03b1c3aaa4b1a0ecf553a3969d8e37a6882cb547
62e58c051128baef9452e7e0eb0b5a83367add26
/edifact/D05A/SSRECHD05AUN.py
ad47858fe13c1e7b9f99a99290d03be45c4d3a2b
[]
no_license
dougvanhorn/bots-grammars
2eb6c0a6b5231c14a6faf194b932aa614809076c
09db18d9d9bd9d92cefbf00f1c0de1c590fe3d0d
refs/heads/master
2021-05-16T12:55:58.022904
2019-05-17T15:22:23
2019-05-17T15:22:23
105,274,633
0
0
null
2017-09-29T13:21:21
2017-09-29T13:21:21
null
UTF-8
Python
false
false
1,448
py
#Generated by bots open source edi translator from UN-docs. from bots.botsconfig import * from edifact import syntax from recordsD05AUN import recorddefs structure = [ {ID: 'UNH', MIN: 1, MAX: 1, LEVEL: [ {ID: 'BGM', MIN: 1, MAX: 1}, {ID: 'DTM', MIN: 0, MAX: 1}, {ID: 'GEI', MIN: 1, MAX: 1}, {ID: 'RFF', MIN: 0, MAX: 1, LEVEL: [ {ID: 'DTM', MIN: 0, MAX: 1}, ]}, {ID: 'PNA', MIN: 1, MAX: 2, LEVEL: [ {ID: 'ADR', MIN: 0, MAX: 1}, {ID: 'GIR', MIN: 0, MAX: 1}, ]}, {ID: 'IND', MIN: 1, MAX: 99, LEVEL: [ {ID: 'DTM', MIN: 1, MAX: 6}, {ID: 'COT', MIN: 1, MAX: 3}, {ID: 'EMP', MIN: 0, MAX: 1, LEVEL: [ {ID: 'PNA', MIN: 0, MAX: 1}, {ID: 'ADR', MIN: 0, MAX: 1}, ]}, ]}, {ID: 'UNS', MIN: 1, MAX: 1}, {ID: 'PNA', MIN: 1, MAX: 6, LEVEL: [ {ID: 'NAT', MIN: 0, MAX: 1}, {ID: 'DOC', MIN: 0, MAX: 1}, {ID: 'ADR', MIN: 0, MAX: 2}, {ID: 'ATT', MIN: 0, MAX: 5}, {ID: 'DTM', MIN: 0, MAX: 2, LEVEL: [ {ID: 'ADR', MIN: 0, MAX: 1}, ]}, {ID: 'PDI', MIN: 0, MAX: 2, LEVEL: [ {ID: 'DTM', MIN: 0, MAX: 2}, ]}, ]}, {ID: 'COT', MIN: 0, MAX: 9, LEVEL: [ {ID: 'CNT', MIN: 1, MAX: 5}, ]}, {ID: 'FTX', MIN: 0, MAX: 2}, {ID: 'AUT', MIN: 0, MAX: 1, LEVEL: [ {ID: 'DTM', MIN: 0, MAX: 1}, ]}, {ID: 'UNT', MIN: 1, MAX: 1}, ]}, ]
[ "jason.capriotti@gmail.com" ]
jason.capriotti@gmail.com
80b7beb89f444ac0b71e10bbaa5697f4458824a9
fd326562890d4f1987c384fc7c60374938231222
/OOP/IteratorsAndGenerators/CountdownIterator.py
154fdb5c0771576a8a4b29805b0a5cc2c3bfb0cf
[]
no_license
miro-lp/SoftUni
cc3b0ff742218c9ceaf93f05c319ccfeed5bc8a4
283d9328537919de49f7f6a301e58593bae9ca2a
refs/heads/main
2023-08-23T21:22:07.856226
2021-08-25T15:10:18
2021-08-25T15:10:18
318,134,101
2
1
null
2021-08-10T12:51:54
2020-12-03T09:03:08
Python
UTF-8
Python
false
false
368
py
class countdown_iterator: def __init__(self, count): self.count = count def __iter__(self): return self def __next__(self): value = self.count if self.count < 0: raise StopIteration self.count -= 1 return value iterator = countdown_iterator(10) for item in iterator: print(item, end=" ")
[ "miro_lp@abv.bg" ]
miro_lp@abv.bg
bdc796bee4bc8a8d5e9c396427bde2e9c5892227
f5fffd35eb8870150cfd9f700b398b25dfe3534e
/lingvo2/gui/video/video.py
30b89711ebd96f728a5588cf3eed6f3c74df65db
[]
no_license
zaswed76/sling
a09e84e0bcc94e83f43d74b769298544627d271b
22b945983eb94a5a29523ee54e8197fcc4c60a5c
refs/heads/master
2022-09-20T07:11:25.242353
2020-05-25T11:53:01
2020-05-25T11:53:01
254,921,645
0
0
null
null
null
null
UTF-8
Python
false
false
1,303
py
#!/usr/bin/env python3 import sys from PyQt5.QtCore import * from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import * from gui.video.player2 import VideoPlayer from gui.custom.customwidgets import * class Video(QFrame): def __init__(self, main, objectName=None, config=None, *args, **kwargs): super().__init__(*args, **kwargs) self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.main = main self.cfg = config self.setObjectName(objectName) self.player = VideoPlayer(self.cfg, "", self.main, None) self.box = BoxLayout(QBoxLayout.TopToBottom, self) self.box.addWidget(self.player) def setFile(self, file): self.player.setFile(file) self.player.playButton.setEnabled(True) def play(self): self.player.play() def pause(self): self.player.mediaPlayer.pause() def setSizeVideo(self, w, h): qsizef = QSizeF(w, h) self.player.videoItem.setSize(qsizef) self.player.graphicsView.setFixedSize(w+2, h+2) # self.player.graphicsView.setS if __name__ == '__main__': app = QApplication(sys.argv) # app.setStyleSheet(open('./etc/{0}.qss'.format('style'), "r").read()) main = Video() main.show() sys.exit(app.exec_())
[ "zaswed76@gmail.com" ]
zaswed76@gmail.com
5390adbcfe0b2fb0e3b38ef37b9af7675659560b
4f313d7a5a141584a0f28e93bb1e3c9bffa3daec
/9_7.py
a360953002fa7e711b1a58dcd5c9789f68f85e80
[]
no_license
GKPython/A-Byte-of-Python
f19ea8f39589dc073d3e599fe14e8172dee87eb3
a11587b158225363c6ae900da50652046b4ab90d
refs/heads/master
2021-06-21T20:24:44.582310
2017-09-01T09:00:00
2017-09-01T09:00:00
null
0
0
null
null
null
null
UTF-8
Python
false
false
291
py
# coding=utf-8 name = 'Swaroop' if name.startswith('S'): print 'name is started with "S"' if 'oo' in name: print 'name contains "oo"' if name.find('ar') != -1: print 'name contains "ar"' delimiter = '_*_' shoplist = ['apple', 'pear', 'carrot', 'banana'] print delimiter.join(shoplist)
[ "cbb903601682@163.com" ]
cbb903601682@163.com
37323d7388b9fc2043edebc8b3ee17d9c40753a4
ec4c8ec5ea3fc7db5a8552687a21ac554dc49d6f
/seatrekking/users/apps.py
dbc9db0c5f458230678d5d0d95f75027640198c6
[ "MIT" ]
permissive
martin-martin/seatrekking
57710c298665d771dea0337a470012b7ff82b237
fc98fb43f50a070624539a93abcbd189726466fe
refs/heads/master
2020-03-26T23:18:34.829490
2018-08-21T08:11:15
2018-08-21T08:11:15
145,529,183
0
0
null
null
null
null
UTF-8
Python
false
false
254
py
from django.apps import AppConfig class UsersAppConfig(AppConfig): name = "seatrekking.users" verbose_name = "Users" def ready(self): try: import users.signals # noqa F401 except ImportError: pass
[ "breuss.martin@gmail.com" ]
breuss.martin@gmail.com
c6d48c629d6d9d5f2bb99cb6a1d57f4ddd706ac0
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/Event/EventOverlay/EventOverlayJobTransforms/share/BS_Selector_jobOptions.py
cee37f5f9e62ba8c9e9e26053c3a0368e0f760ca
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
Python
false
false
2,245
py
include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) svcMgr = theApp.serviceMgr() ByteStreamInputSvc = svcMgr.ByteStreamInputSvc theApp.EvtMax = 20 theApp.SkipEvents = 0 MessageSvc.OutputLevel = INFO ByteStreamInputSvc.FullFileName += ["/u/at/ahaas/nfs2/temp/minbias/data10_7TeV.00152845.physics_RNDM.merge.RAW/data10_7TeV.00152845.physics_RNDM.merge.RAW._lb0200._0001.1","/u/at/ahaas/nfs2/temp/minbias/data10_7TeV.00152845.physics_RNDM.merge.RAW/data10_7TeV.00152845.physics_RNDM.merge.RAW._lb0201._0001.1"] #ByteStreamInputSvc.ValidateEvent=False #ByteStreamInputSvc.DumpFlag = True #ByteStreamInputSvc.SkipNeventBeforeNext=10 print ByteStreamInputSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # get the filter algortihm from TrigT1ResultByteStream.TrigT1ResultByteStreamConf import CTPByteStreamTool,RecCTPByteStreamTool if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc svcMgr += ByteStreamAddressProviderSvc() svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "ROIB::RoIBResult/RoIBResult", "MuCTPI_RDO/MUCTPI_RDO", "CTP_RDO/CTP_RDO", "MuCTPI_RIO/MUCTPI_RIO", "CTP_RIO/CTP_RIO" ] from OverlayCommonAlgs.OverlayCommonAlgsConf import BSFilter filAlg=BSFilter("BSFilter") filAlg.TriggerBit=63 # The trigger bit to select topSequence+=filAlg # BS OutputStream Tool OutStreamName="OutputStreamBSCopy" from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamEventStorageOutputSvc,ByteStreamOutputStreamCopyTool bsCopyTool = ByteStreamOutputStreamCopyTool("OutputStreamBSCopyTool") svcMgr.ToolSvc += bsCopyTool # Service to write out BS events bsOutputSvc=ByteStreamEventStorageOutputSvc("BSESOutputSvc0",OutputDirectory="temp/",SimpleFileName="SelectedBSEvents") svcMgr += bsOutputSvc bsCopyTool.ByteStreamOutputSvc=bsOutputSvc bsCopyTool.ByteStreamInputSvc=svcMgr.ByteStreamInputSvc # create AthenaOutputStream for BS Copy from AthenaServices.AthenaServicesConf import AthenaOutputStream OutputStreamBSCopy = AthenaOutputStream( OutStreamName, WritingTool=bsCopyTool ) topSequence += OutputStreamBSCopy OutputStreamBSCopy.AcceptAlgs =["BSFilter"]
[ "rushioda@lxplus754.cern.ch" ]
rushioda@lxplus754.cern.ch
5178891a024ece70b7e141b46dcf6e10125719ca
ee721fac058d6c0472be24f95e3cc8df37f4198d
/Stack/letter.py
886078dbf96d36aae384663781528a0a8f35af6d
[]
no_license
Horlawhumy-dev/Python_DataStructures
51af03dcbed86a51009c13657b17584f09d0a40d
c5aad1fe6c6566414c76711a0871abf9529fe04f
refs/heads/master
2023-06-04T09:32:34.776313
2021-07-02T21:43:09
2021-07-02T21:43:09
377,631,264
0
0
null
null
null
null
UTF-8
Python
false
false
611
py
# Letter Frequency import math # You are making a program to analyze text. # Take the text as the first input and a letter as the second input, and output the frequency of that letter in the text as a whole percentage. # Sample Input: # hello # l # Sample Output: # 40 # The letter l appears 2 times in the text hello, which has 5 letters. So, the frequency would be (2/5)*100 = 40 #your code goes here text = input("Enter your sample text: ") letter = input("Enter the letter to be counted: ") if letter in text: result = text.count(letter) / len(text) * 100 print(str(math.floor(result)) + '%')
[ "harof.dev@gmail.com" ]
harof.dev@gmail.com
ab6c198286931579386d1847dbaec01086aabc5d
7f66c9818b2a22e6dbfa832a6bb4f9f21fbd15da
/semester_1/fp/assignment_06-08/src/tests/test_services.py
1bab656276fba77c296f87c0febc5cf5ee2ed7da
[]
no_license
caprapaul/assignments
cc3992833d4f23f74286c1800ac38dc2d9a874da
206b049700d8a3e03b52e57960cd44f85c415fe8
refs/heads/master
2023-05-24T03:46:42.858147
2022-05-03T16:26:58
2022-05-03T16:26:58
248,552,522
0
0
null
2023-05-09T01:49:04
2020-03-19T16:31:37
C
UTF-8
Python
false
false
2,911
py
import unittest import coverage from repository import Repository from services.activity_service import ActivityService, Activity from services.person_service import PersonService, Person from data.activity_data import * from data.person_data import * from cmdsys.cmdsys import CommandSystem class TestServices(unittest.TestCase): def test_activity_service(self): a_repo = Repository() p_repo = Repository() p_repo.add_item(Person('1', get_random_name(), get_random_phone_number()), get_uid=lambda p: p.uid) p_repo.add_item(Person('2', get_random_name(), get_random_phone_number()), get_uid=lambda p: p.uid) p_repo.add_item(Person('3', get_random_name(), get_random_phone_number()), get_uid=lambda p: p.uid) service = ActivityService(a_repo, p_repo) activity1 = Activity('1234', ['1', '2'], get_random_date(), get_random_time(), 'test1') activity2 = Activity('4321', ['1', '3'], get_random_date(), get_random_time(), 'test2') service.add_activity(activity1) self.assertEqual(service.get_activities(), [activity1]) service.add_activity(activity2) self.assertEqual(service.get_activities(), [activity1, activity2]) self.assertEqual(service.get_activity(activity1.uid), activity1) service.remove_activity(activity2.uid) self.assertEqual(service.get_activities(), [activity1]) CommandSystem.global_undo() self.assertEqual(service.get_activities(), [activity1, activity2]) CommandSystem.global_redo() self.assertEqual(service.get_activities(), [activity1]) CommandSystem.global_undo() new_activity = Activity(activity2.uid, ['1'], activity2.date, activity2.time, activity2.description) service.update_activity(activity2.uid, new_activity) self.assertEqual(service.get_activities(), [activity1, new_activity]) self.assertEqual(service.get_date_activities(activity1.date), [activity1]) self.assertEqual(service.get_busiest_days(), [(activity1.date, 1), (new_activity.date, 1)]) self.assertEqual(service.get_person_activities('2'), [activity1]) self.assertEqual(service.search_activities(None, None, 'test1'), [activity1]) def test_person_service(self): a_repo = Repository() p_repo = Repository() service = PersonService(p_repo, a_repo) person1 = Person('1', get_random_name(), get_random_phone_number()) person2 = Person('2', get_random_name(), get_random_phone_number()) service.add_person(person1) self.assertEqual(service.get_persons(), [person1]) service.add_person(person2) self.assertEqual(service.get_persons(), [person1, person2]) if __name__ == '__main__': cov = coverage.Coverage() cov.start() unittest.main() cov.stop() cov.save() cov.html_report(directory='covhtml')
[ "c.paulica@gmail.com" ]
c.paulica@gmail.com
c4afeca91e73abf6bbd3d9882cfda15357dfd482
6136be1772619e92d93d474838b2d9b55071e423
/testPickler.py
26ce40b9bde70e0ee9189bcf0f1e7cba8a784ccd
[]
no_license
Anwesh43/python-url-requests
1aa5314ab1c362db869fbca44605d2631bde17d2
f26ff5c83beadc3442ae087a47f18553af78c890
refs/heads/master
2020-05-15T11:03:44.616768
2019-04-19T13:11:46
2019-04-19T13:11:46
182,210,717
0
0
null
null
null
null
UTF-8
Python
false
false
198
py
from picklerutil import * dict1 = loadFromFile('a.pickle') assert dict1 == {} dict2 = {} dict2["a"] = 1 dict2["b"] = 2 saveToFile('a.pkl', dict2) dict3 = loadFromFile('a.pkl') assert dict3 == dict2
[ "anweshthecool0@gmail.com" ]
anweshthecool0@gmail.com
994deee1e02643256d13d5a378b1b4a3011135f6
1afb1fbfeb696a96a7e3cddfe4c74192c770b97d
/trainer.py
1cb656a38f31ce48a8b43f2a0626505c97134674
[ "Apache-2.0" ]
permissive
Guanwh/Object_Detection_Tracking
b74dc8c3c1dc9ede06b1d9c36d2e80e5af28bc6f
af7f840915f63ae498c8241e5832a4bf4aabfcc1
refs/heads/master
2020-06-03T21:57:43.644703
2019-06-10T05:00:14
2019-06-10T05:00:14
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,667
py
# coding=utf-8 # trainer class, given the model (model has the function to get_loss()) import tensorflow as tf import sys from models import assign_to_device def average_gradients(tower_grads,sum_grads=False): """Calculate the average/summed gradient for each shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: tower_grads: List of lists of (gradient, variable) tuples. The outer list ranges over the devices. The inner list ranges over the different variables. Returns: List of pairs of (gradient, variable) where the gradient has been averaged across all towers. """ average_grads = [] nr_tower = len(tower_grads) for grad_and_vars in zip(*tower_grads): # Note that each grad_and_vars looks like the following: # ((grad0_gpu0, var0_gpu0), ... , (grad0_gpuN, var0_gpuN)) grads = [g for g, _ in grad_and_vars] if sum_grads: #grad = tf.reduce_sum(grads, 0) grad = tf.add_n(grads) else: grad = tf.multiply(tf.add_n(grads), 1.0 / nr_tower) #grad = tf.reduce_mean(grads, 0) # Keep in mind that the Variables are redundant because they are shared # across towers. So .. we will just return the first tower's pointer to # the Variable. v = grad_and_vars[0][1] average_grads.append((grad, v)) return average_grads class Trainer(): def __init__(self,models,config): self.config = config self.models = models self.global_step = models[0].global_step # learning_rate = config.init_lr if config.use_lr_decay: # always use warmup, set step to zero to disable warm_up_start = config.init_lr * 0.33 # linear increasing from 0.33*lr to lr in warm_up_steps warm_up_lr = tf.train.polynomial_decay( warm_up_start, self.global_step, config.warm_up_steps, config.init_lr, power=1.0, ) if config.use_cosine_schedule: max_steps = int(config.train_num_examples / config.im_batch_size * config.num_epochs) schedule_lr = tf.train.cosine_decay( config.init_lr, self.global_step - config.warm_up_steps - config.same_lr_steps, max_steps - config.warm_up_steps - config.same_lr_steps, alpha=0.0 ) else: decay_steps = int(config.train_num_examples / config.im_batch_size * config.num_epoch_per_decay) schedule_lr = tf.train.exponential_decay( config.init_lr, self.global_step, decay_steps, config.learning_rate_decay, staircase=True ) boundaries = [config.warm_up_steps, config.warm_up_steps + config.same_lr_steps] # before reaching warm_up steps, use the warm up learning rate. values = [warm_up_lr, config.init_lr, schedule_lr] learning_rate = tf.train.piecewise_constant(self.global_step, boundaries, values) print "learning rate warm up lr from %s to %s in %s steps, then keep for %s steps, then schedule learning rate decay" % (warm_up_start, config.init_lr, config.warm_up_steps, config.same_lr_steps) self.learning_rate = learning_rate else: self.learning_rate = None if config.optimizer == 'adadelta': self.opt = tf.train.AdadeltaOptimizer(learning_rate) elif config.optimizer == "adam": self.opt = tf.train.AdamOptimizer(learning_rate) elif config.optimizer == "sgd": self.opt = tf.train.GradientDescentOptimizer(learning_rate) elif config.optimizer == "momentum": self.opt = tf.train.MomentumOptimizer(learning_rate, momentum=config.momentum) else: print "optimizer not implemented" sys.exit() self.rpn_label_losses = [model.rpn_label_loss for model in models] self.rpn_box_losses = [model.rpn_box_loss for model in models] self.fastrcnn_label_losses = [model.fastrcnn_label_loss for model in models] self.fastrcnn_box_losses = [model.fastrcnn_box_loss for model in models] if config.wd is not None: self.wd = [model.wd for model in models] if config.use_small_object_head: self.so_label_losses = [model.so_label_loss for model in models] if config.add_act: self.act_losses = [model.act_losses for model in self.models] self.losses = [] self.grads = [] for model in self.models: gpuid = model.gpuid # compute gradients on each gpu devices with tf.device(assign_to_device("/gpu:%s"%(gpuid), config.controller)): self.losses.append(model.loss) grad = self.opt.compute_gradients(model.loss) grad = [(g,var) for g, var in grad if g is not None] # we freeze resnet, so there will be none gradient # whehter to clip gradient if config.clip_gradient_norm is not None: grad = [(tf.clip_by_value(g, -1*config.clip_gradient_norm, config.clip_gradient_norm), var) for g, var in grad] self.grads.append(grad) # apply gradient on the controlling device with tf.device(config.controller): avg_loss = tf.reduce_mean(self.losses) avg_grads = average_gradients(self.grads,sum_grads=True) self.train_op = self.opt.apply_gradients(avg_grads,global_step=self.global_step) self.loss = avg_loss def step(self,sess,batch,get_summary=False): assert isinstance(sess,tf.Session) config = self.config # idxs is a tuple (23,123,33..) index for sample batchIdx,batch_datas = batch #assert len(batch_datas) == len(self.models) # there may be less data in the end feed_dict = {} for batch_data, model in zip(batch_datas, self.models): # if batch is smaller so will the input? feed_dict.update(model.get_feed_dict(batch_data,is_train=True)) sess_input = [] sess_input.append(self.loss) for i in xrange(len(self.models)): sess_input.append(self.rpn_label_losses[i]) sess_input.append(self.rpn_box_losses[i]) sess_input.append(self.fastrcnn_label_losses[i]) sess_input.append(self.fastrcnn_box_losses[i]) if config.wd is not None: sess_input.append(self.wd[i]) if config.use_small_object_head: sess_input.append(self.so_label_losses[i]) if config.add_act: sess_input.append(self.act_losses[i]) sess_input.append(self.train_op) sess_input.append(self.learning_rate) outs = sess.run(sess_input,feed_dict=feed_dict) loss = outs[0] skip = 4 + int(config.add_act) + int(config.use_small_object_head) rpn_label_losses = outs[1::skip][:len(self.models)] rpn_box_losses = outs[2::skip][:len(self.models)] fastrcnn_label_losses = outs[3::skip][:len(self.models)] fastrcnn_box_losses = outs[4::skip][:len(self.models)] now = 4 wd = [-1 for m in self.models] if config.wd is not None: now+=1 wd = outs[now::skip][:len(self.models)] so_label_losses = [-1 for m in self.models] if config.use_small_object_head: now+=1 so_label_losses = outs[now::skip][:len(self.models)] act_losses = [-1 for m in self.models] if config.add_act: now+=1 act_losses = outs[now::skip][:len(self.models)] """ if config.add_act: out = [self.loss, self.rpn_label_loss, self.rpn_box_loss, self.fastrcnn_label_loss, self.fastrcnn_box_loss, self.train_op] act_losses_pl = [model.act_losses for model in self.models] out = act_losses_pl + out things = sess.run(out,feed_dict=feed_dict) act_losses = things[:len(act_losses_pl)] loss,rpn_label_loss, rpn_box_loss, fastrcnn_label_loss, fastrcnn_box_loss, train_op = things[len(act_losses_pl):] else: loss,rpn_label_loss, rpn_box_loss, fastrcnn_label_loss, fastrcnn_box_loss, train_op = sess.run([self.loss,self.rpn_label_loss, self.rpn_box_loss, self.fastrcnn_label_loss, self.fastrcnn_box_loss,self.train_op],feed_dict=feed_dict) act_losses = None """ learning_rate = outs[-1] return loss, wd, rpn_label_losses, rpn_box_losses, fastrcnn_label_losses, fastrcnn_box_losses, so_label_losses, act_losses, learning_rate
[ "junweil@cs.cmu.edu" ]
junweil@cs.cmu.edu
e819a2b88a14f5ede5bdc9836a8c201e69a8ee48
ff5eea95bb0827cb086c32f4ec1c174b28e5b82d
/gammapy/astro/__init__.py
015054cb8f5eec0b26a1bd245e06b6d7a5f3664f
[]
no_license
pflaumenmus/gammapy
4830cc5506a4052658f30077fa4e11d8c685ede0
7b5caf832c9950c886528ca107203ce9b83c7ebf
refs/heads/master
2021-01-15T23:27:46.521337
2013-09-25T14:23:35
2013-09-25T14:23:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
175
py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astrophysical source and population models """ from .pulsar import * from .pwn import * from .snr import *
[ "Deil.Christoph@gmail.com" ]
Deil.Christoph@gmail.com