blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 616 | content_id stringlengths 40 40 | detected_licenses listlengths 0 69 | license_type stringclasses 2 values | repo_name stringlengths 5 118 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 63 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 2.91k 686M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 213 values | src_encoding stringclasses 30 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 2 10.3M | extension stringclasses 246 values | content stringlengths 2 10.3M | authors listlengths 1 1 | author_id stringlengths 0 212 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8ff7977834049b320b320be7cf6cd2b24ef75d81 | 7c6c4f2f19191596611ebe5e1485ce0d519769eb | /sukha_tools/gputx.py | c878fd4d3302b5eca251902f22067eaff319b318 | [] | no_license | mindest/sukha-tools | 240e6084c096fb64e6cc2f0fa0af984d8d497811 | 7af8f38a64a5770c1a9579fd8de6d17331043a76 | refs/heads/master | 2023-07-10T22:20:12.477387 | 2021-08-02T19:05:29 | 2021-08-02T19:05:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,981 | py | import torch.cuda.nvtx as nvtx
try:
import ctypes
roctx = ctypes.cdll.LoadLibrary('/opt/rocm/lib/libroctx64.so')
# roctx.roctxRangePushA(label.encode('utf-8'))
# roctx.roctxRangePop()
roctr = ctypes.cdll.LoadLibrary('/opt/rocm/lib/libroctracer64.so')
# roctr.roctracer_start()
# roctr.roctracer_stop()
except:
pass
# annotate code segment with NVTX or ROCTX using context manager, e.g.
# with gputx_range('forward-pass'):
# do_forward_pass(sample)
from contextlib import contextmanager
@contextmanager
def gputx_range(label):
nvtx.range_push(label.encode('utf-8'))
try:
yield
finally:
nvtx.range_pop()
# decorate function with GPUTX ranges, e.g.
# @gputx_wrap
# my_function(args):
# <function_body>
import functools
def gputx_wrap(func):
@functools.wraps(func)
def gputx_ranged_func(*args, **kwargs):
with gputx_range('{}.{}'.format(func.__module__, func.__qualname__)):
value = func(*args, **kwargs)
return value
return gputx_ranged_func
def for_all_methods(decorator):
def decorate(cls):
for attr in cls.__dict__:
if callable(getattr(cls, attr)):
setattr(cls, attr, decorator(getattr(cls, attr)))
return cls
return decorate
def for_all_functions(module, decorator):
for name in dir(module):
obj = getattr(module, name)
if isinstance(obj, types.FunctionType):
setattr(module, name, decorator(obj))
# add ranges to iterator, e.g.
# dataloader = GputxIterator(dataloader, 'load-samples')
# for i, sample in enumerate(dataloader):
# do_inference(sample)
class GputxWrappedIterator:
def __init__(self, iterable, label, counter=False):
self.iterable = iterable
self.iterator = None
self.label = label
self.counter = counter
def __iter__(self):
self.count = 0
self.iterator = iter(self.iterable)
return self
def __next__(self):
self.count += 1
label = self.label if not self.counter else '{}-{}'.format(self.label, self.count)
with gputx_range(label):
return next(self.iterator)
def __getattr__(self, attr):
if attr in self.__dict__:
return getattr(self, attr)
return getattr(self.iterable, attr)
# add ranges to PyT model, e.g.
# model = GputxWrappedModel(model)
def GputxWrappedModel(model, max_level=10, name=None):
if max_level == 0:
return
if name is None:
name = name = type(model).__name__
else:
name = name + ': ' + type(model).__name__
def push(*args, _name=name, **kwargs):
nvtx.range_push(_name.encode('utf-8'))
def pop(*args, _name=name, **kwargs):
nvtx.range_pop()
model.register_forward_pre_hook(push)
model.register_forward_hook(pop)
for name, child in model.named_children():
GputxWrappedModel(child, max_level-1, name)
return model
| [
"sukha@microsoft.com"
] | sukha@microsoft.com |
aebb4fdcce38879923be7d511c2aa5c144adf0c2 | f8703057540c76645a573fba0833cadc1f39eb67 | /StrukturyDanychIAlgorytmy/scripts/python_decorators.py | e59a31c67b2f15d481490d9c17a5cf0488dac4c8 | [] | no_license | kwasnydam/python_exercises | 88362d57307862fc5b97fec0996c945a8ae98dc9 | 54fc11a42cb6e28c8a5040c8b3d0e5a018d4b83e | refs/heads/master | 2021-04-29T13:08:27.743902 | 2018-03-19T14:23:09 | 2018-03-19T14:23:09 | 121,744,644 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,247 | py | '''
@author: Damian Kwaśny
decorators used to alter the functionality of functions (xD)
Where and why use fnction decorators?:
1. logging -> keeping track of how many times a fucntion was called
and what arguments it received
2. timing how long a function runs
'''
from functools import wraps
#above lib is needed to preserve the info about the function we are decorating
#like its documentation
#Clousures
def outer_function():
message = 'Hi'
def inner_function():
print(message)
return inner_function()
#decorators
def decorator_function(original_function):
''' Using decorator we can enhance the functionality without changing
anything inside the actual fucntion we are decorating
'''
@wraps#u use it to preserve the info about the original_function
def wrapper_function(*args, **kwargs):
print('wrapper run function: {}'.format(original_function.__name__))
return original_function(*args, **kwargs) #multi argument
return wrapper_function
@decorator_function
def display():
'''everytime we use display we actually use wrapper_function thus extenbding
functionality of this function
it's equal to: display = decorator_function(disply) -> EQUAL
'''
print('display()')
@decorator_function
def display_info(name, age):
print('display_info: {} {}'. format(name, age))
decorated_display = decorator_function(display) #it has a wrapper_function ready to be executed
decorated_display() # Executes wrapper so in fact executes the original_function, display
display() #The same output thanks to @decorator_function
display_info('damian', 22)
"""
#class decorators
#this is just another syntax
class decorator_class(object):
#decorator class instead of decorator function
def __init__(self, original_function):
self.original_function = original_function
def __call__(self, *args, **kwargs):
#it raplaces wrapper function
print('call method executed this before {}'. format(\
self.original_function.__name__))
return self.original_function(*args, **kwargs)
@decorator_class
def display_info(name, age):
print('display_info: {} {}'. format(name, age))
display_info('damian', 22)
"""
| [
"damiankwasny95@gmail.com"
] | damiankwasny95@gmail.com |
2fe5243aa2bc7036ff2261a4c53a86d9d40e76fa | 5a61a04e059f2a12eb62a4ede635a75fe5ac1fd3 | /python-social-auth/social/apps/webpy_app/models.py | 71be9975a7b46f4012f998bc57a1d6f7e9b7efeb | [
"Python-2.0",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | blendedlearn/blended_learning | bb44abb419e49274fa5378ec5e648ac85b15d012 | f4e6d41e56921d580e8f92e9b3130049511204b5 | refs/heads/master | 2016-09-05T22:48:51.005440 | 2015-09-17T08:31:36 | 2015-09-17T08:31:36 | 42,153,739 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,027 | py | """Flask SQLAlchemy ORM models for Social Auth"""
import web
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
from social.utils import setting_name, module_member
from social.storage.sqlalchemy_orm import SQLAlchemyUserMixin, \
SQLAlchemyAssociationMixin, \
SQLAlchemyNonceMixin, \
SQLAlchemyCodeMixin, \
BaseSQLAlchemyStorage
from social.apps.webpy_app.fields import JSONType
SocialBase = declarative_base()
UID_LENGTH = web.config.get(setting_name('UID_LENGTH'), 255)
User = module_member(web.config[setting_name('USER_MODEL')])
class UserSocialAuth(SQLAlchemyUserMixin, SocialBase):
"""Social Auth association model"""
__tablename__ = 'social_auth_usersocialauth'
__table_args__ = (UniqueConstraint('provider', 'uid'),)
id = Column(Integer, primary_key=True)
provider = Column(String(32))
uid = Column(String(UID_LENGTH))
extra_data = Column(JSONType)
user_id = Column(Integer, ForeignKey(User.id),
nullable=False, index=True)
user = relationship(User, backref='social_auth')
@classmethod
def username_max_length(cls):
return User.__table__.columns.get('username').type.length
@classmethod
def user_model(cls):
return User
@classmethod
def _session(cls):
return web.db_session
class Nonce(SQLAlchemyNonceMixin, SocialBase):
"""One use numbers"""
__tablename__ = 'social_auth_nonce'
__table_args__ = (UniqueConstraint('server_url', 'timestamp', 'salt'),)
id = Column(Integer, primary_key=True)
server_url = Column(String(255))
timestamp = Column(Integer)
salt = Column(String(40))
@classmethod
def _session(cls):
return web.db_session
class Association(SQLAlchemyAssociationMixin, SocialBase):
"""OpenId account association"""
__tablename__ = 'social_auth_association'
__table_args__ = (UniqueConstraint('server_url', 'handle'),)
id = Column(Integer, primary_key=True)
server_url = Column(String(255))
handle = Column(String(255))
secret = Column(String(255)) # base64 encoded
issued = Column(Integer)
lifetime = Column(Integer)
assoc_type = Column(String(64))
@classmethod
def _session(cls):
return web.db_session
class Code(SQLAlchemyCodeMixin, SocialBase):
__tablename__ = 'social_auth_code'
__table_args__ = (UniqueConstraint('code', 'email'),)
id = Column(Integer, primary_key=True)
email = Column(String(200))
code = Column(String(32), index=True)
@classmethod
def _session(cls):
return web.db_session
class WebpyStorage(BaseSQLAlchemyStorage):
user = UserSocialAuth
nonce = Nonce
association = Association
code = Code
| [
"zhangtianyi@xuetangx.com"
] | zhangtianyi@xuetangx.com |
90cbcce58f97712d1e3f7fc2e3d6c380e5ab5322 | 09e57dd1374713f06b70d7b37a580130d9bbab0d | /benchmark/startQiskit_noisy1297.py | 912aefed3231ca5dcfeaa268881698da8075b3bd | [
"BSD-3-Clause"
] | permissive | UCLA-SEAL/QDiff | ad53650034897abb5941e74539e3aee8edb600ab | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | refs/heads/main | 2023-08-05T04:52:24.961998 | 2021-09-19T02:56:16 | 2021-09-19T02:56:16 | 405,159,939 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,331 | py | # qubit number=5
# total number=52
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as nx
def build_oracle(n: int, f) -> QuantumCircuit:
# implement the oracle O_f^\pm
# NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate
# or multi_control_Z_gate (issue #127)
controls = QuantumRegister(n, "ofc")
oracle = QuantumCircuit(controls, name="Zf")
for i in range(2 ** n):
rep = np.binary_repr(i, n)
if f(rep) == "1":
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
# oracle.h(controls[n])
if n >= 2:
oracle.mcu1(pi, controls[1:], controls[0])
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
# oracle.barrier()
return oracle
def make_circuit(n:int,f) -> QuantumCircuit:
# circuit begin
input_qubit = QuantumRegister(n,"qc")
classical = ClassicalRegister(n, "qm")
prog = QuantumCircuit(input_qubit, classical)
prog.h(input_qubit[0]) # number=3
prog.cx(input_qubit[2],input_qubit[0]) # number=45
prog.z(input_qubit[2]) # number=46
prog.h(input_qubit[0]) # number=49
prog.cz(input_qubit[2],input_qubit[0]) # number=50
prog.h(input_qubit[0]) # number=51
prog.h(input_qubit[1]) # number=4
prog.rx(2.664070570244145,input_qubit[1]) # number=39
prog.h(input_qubit[2]) # number=5
prog.h(input_qubit[3]) # number=6
prog.cx(input_qubit[3],input_qubit[2]) # number=48
prog.h(input_qubit[4]) # number=21
Zf = build_oracle(n, f)
repeat = floor(sqrt(2 ** n) * pi / 4)
for i in range(repeat):
prog.append(Zf.to_gate(), [input_qubit[i] for i in range(n)])
prog.h(input_qubit[0]) # number=1
prog.h(input_qubit[3]) # number=40
prog.y(input_qubit[4]) # number=35
prog.h(input_qubit[1]) # number=2
prog.h(input_qubit[2]) # number=7
prog.h(input_qubit[3]) # number=8
prog.h(input_qubit[0]) # number=25
prog.cz(input_qubit[1],input_qubit[0]) # number=26
prog.h(input_qubit[0]) # number=27
prog.h(input_qubit[0]) # number=36
prog.cz(input_qubit[1],input_qubit[0]) # number=37
prog.h(input_qubit[0]) # number=38
prog.cx(input_qubit[1],input_qubit[0]) # number=41
prog.x(input_qubit[0]) # number=42
prog.cx(input_qubit[1],input_qubit[0]) # number=43
prog.cx(input_qubit[1],input_qubit[0]) # number=34
prog.cx(input_qubit[1],input_qubit[0]) # number=24
prog.cx(input_qubit[0],input_qubit[1]) # number=29
prog.cx(input_qubit[2],input_qubit[3]) # number=44
prog.x(input_qubit[1]) # number=30
prog.cx(input_qubit[0],input_qubit[1]) # number=31
prog.x(input_qubit[2]) # number=11
prog.x(input_qubit[3]) # number=12
if n>=2:
prog.mcu1(pi,input_qubit[1:],input_qubit[0])
prog.x(input_qubit[0]) # number=13
prog.x(input_qubit[1]) # number=14
prog.x(input_qubit[2]) # number=15
prog.x(input_qubit[3]) # number=16
prog.h(input_qubit[0]) # number=17
prog.h(input_qubit[1]) # number=18
prog.h(input_qubit[2]) # number=19
prog.h(input_qubit[3]) # number=20
# circuit end
for i in range(n):
prog.measure(input_qubit[i], classical[i])
return prog
if __name__ == '__main__':
key = "00000"
f = lambda rep: str(int(rep == key))
prog = make_circuit(5,f)
backend = FakeVigo()
sample_shot =7924
info = execute(prog, backend=backend, shots=sample_shot).result().get_counts()
backend = FakeVigo()
circuit1 = transpile(prog,backend,optimization_level=2)
writefile = open("../data/startQiskit_noisy1297.csv","w")
print(info,file=writefile)
print("results end", file=writefile)
print(circuit1.depth(),file=writefile)
print(circuit1,file=writefile)
writefile.close()
| [
"wangjiyuan123@yeah.net"
] | wangjiyuan123@yeah.net |
322938dd6c9b0b54549396c63f4499fdeedfbc05 | 242086b8c6a39cbc7af3bd7f2fd9b78a66567024 | /python/PP4E-Examples-1.4/Examples/PP4E/System/Threads/queuetest3.py | e4adebe5cb3b063d6f3df576b560272064d26fb8 | [] | no_license | chuzui/algorithm | 7537d0aa051ac4cbe9f6a7ca9a3037204803a650 | c3006b24c4896c1242d3ceab43ace995c94f10c8 | refs/heads/master | 2021-01-10T13:05:30.902020 | 2015-09-27T14:39:02 | 2015-09-27T14:39:02 | 8,404,397 | 4 | 4 | null | null | null | null | UTF-8 | Python | false | false | 1,359 | py | "same as queuetest2.py, but uses threading, not _threads"
numconsumers = 2 # how many consumers to start
numproducers = 4 # how many producers to start
nummessages = 4 # messages per producer to put
import threading, queue, time, sys
safeprint = threading.Lock() # else prints may overlap
dataQueue = queue.Queue() # shared global, infinite size
def producer(idnum, dataqueue):
for msgnum in range(nummessages):
time.sleep(idnum)
dataqueue.put('[producer id=%d, count=%d]' % (idnum, msgnum))
def consumer(idnum, dataqueue):
while True:
time.sleep(0.1)
try:
data = dataqueue.get(block=False)
except queue.Empty:
pass
else:
#with safeprint:
print('consumer', idnum, 'got =>', data)
if __name__ == '__main__':
for i in range(numconsumers):
thread = threading.Thread(target=consumer, args=(i, dataQueue))
thread.daemon = True # else cannot exit!
thread.start()
waitfor = []
for i in range(numproducers):
thread = threading.Thread(target=producer, args=(i, dataQueue))
waitfor.append(thread)
thread.start()
for thread in waitfor: thread.join() # or time.sleep() long enough here
print('Main thread exit.')
| [
"zui"
] | zui |
8d9611a930de81afeaa8dd94f21def96e3680dd1 | e60a342f322273d3db5f4ab66f0e1ffffe39de29 | /parts/zodiac/zope/interface/interfaces.py | 7c6dbead34802890c6810649f6ae8057bb64d734 | [] | no_license | Xoting/GAExotZodiac | 6b1b1f5356a4a4732da4c122db0f60b3f08ff6c1 | f60b2b77b47f6181752a98399f6724b1cb47ddaf | refs/heads/master | 2021-01-15T21:45:20.494358 | 2014-01-13T15:29:22 | 2014-01-13T15:29:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 99 | py | /home/alex/myenv/zodiac/eggs/zope.interface-4.0.5-py2.7-linux-i686.egg/zope/interface/interfaces.py | [
"alex.palacioslopez@gmail.com"
] | alex.palacioslopez@gmail.com |
a7932cda3f2ed71987c90b00b6171041ef5f3dee | fb6105ef929acbbbb983178d2184cc9451a7f7e7 | /calculo_simples.py | d4aa1a0b9c3f81b27dc6dfff6b9c2aa0d437bc63 | [] | no_license | vinismarques/codigos-python | 1bd0b35db8732bf1bb8a47ade7eb6cd7e2a3b3fa | 4a0eafa834c9402e3eeb55bd39d5333d89bee542 | refs/heads/master | 2020-04-11T14:20:45.926279 | 2018-12-31T20:54:23 | 2018-12-31T20:54:23 | 161,851,180 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 327 | py | peca_1 = input().split()
peca_2 = input().split()
preco = 0
for pi, p in enumerate(peca_1):
peca_1[pi] = float(p)
for pi, p in enumerate(peca_2):
peca_2[pi] = float(p)
preco = peca_1[1] * peca_1[2] + peca_2[1] * peca_2[2]
# preco = peca_1
# print(type(peca_1[0]))
print("VALOR A PAGAR: R$ {:.2f}" . format(preco))
| [
"vinicius_marques@live.com"
] | vinicius_marques@live.com |
965859c1454a406d54e72a9fe400773760e45a30 | 8e74827f547d5d111ffbb82c43bba39306716db7 | /supreme_buy_mobile.py | 8f175225001c843b565fa36cf3722bd4270ac3ee | [] | no_license | jamie-meyer/Supreme-Bot | 739667391a8f2a03bf3fd2a2c0cc613a74df056a | 30cfd34eb814d0f378595e54cb662a6b185f1dec | refs/heads/main | 2022-12-31T10:47:04.879383 | 2020-10-12T18:33:47 | 2020-10-12T18:33:47 | 303,305,936 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,265 | py | from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.select import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.action_chains import ActionChains
import time
class SupremeBuyer: # SupremeBuyer(Buyer):
def __init__(self):
desired_capabilities = DesiredCapabilities().CHROME
# desired_capabilities["pageLoadStrategy"] = "none"
options = webdriver.ChromeOptions()
# options.add_argument('--headless')
options.add_argument('--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1')
prefs = {'profile.default_content_setting_values': {
'plugins': 2, 'popups': 2, 'geolocation': 2,
'notifications': 2, 'auto_select_certificate': 2,
'fullscreen': 2,
'mouselock': 2, 'mixed_script': 2, 'media_stream': 2,
'media_stream_mic': 2, 'media_stream_camera': 2,
'protocol_handlers': 2,
'ppapi_broker': 2, 'automatic_downloads': 2,
'midi_sysex': 2,
'push_messaging': 2, 'ssl_cert_decisions': 2,
'metro_switch_to_desktop': 2,
'protected_media_identifier': 2, 'app_banner': 2,
'site_engagement': 2,
'durable_storage': 2}}
options.add_argument('--profile-directory=Profile 2')
options.add_argument('--user-data-dir=/Users/jamie/Library/Application Support/Google/Chrome/')
options.add_experimental_option("prefs", prefs)
options.add_argument("--start-maximized")
self.driver = webdriver.Chrome(options=options, desired_capabilities=desired_capabilities)
def buy_item(self, item_id, keywords,
name, email, phone, address, zipcode, city, state, cc_num, exp_month, exp_year, cvv):
if not self.add_to_cart(item_id, keywords):
return False
self.checkout(name, email, phone, address, zipcode, city, state, cc_num, exp_month, exp_year, cvv)
return True
def add_to_cart(self, item_id, keywords):
self.driver.get('https://supremenewyork.com/mobile/#products/{}'.format(item_id))
#self.driver.execute_script("for(i=0;i<document.styleSheets.length;i++){document.styleSheets.item(i).disabled=true;}all=document.getElementsByTagName('*');for(i=0;i<all.length;i++){el=all[i];el.style.cssText='';el.style.width='';el.style.padding='0px';el.style.margin='2px';el.style.backgroundImage='none';el.style.backgroundColor='#fff';el.style.color='#000';}")
# Clicking add to cart
WebDriverWait(self.driver, 5).until(EC.presence_of_element_located((By.CLASS_NAME, 'cart-button')))
atc = self.driver.find_element_by_class_name('cart-button')
self.driver.execute_script("arguments[0].click();", atc)
WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.ID, 'checkout-now')))
checkout = self.driver.find_element_by_id('checkout-now')
self.driver.execute_script("arguments[0].click();", checkout)
#self.driver.execute_script("for(i=0;i<document.styleSheets.length;i++){document.styleSheets.item(i).disabled=true;}all=document.getElementsByTagName('*');for(i=0;i<all.length;i++){el=all[i];el.style.cssText='';el.style.width='';el.style.padding='0px';el.style.margin='2px';el.style.backgroundImage='none';el.style.backgroundColor='#fff';el.style.color='#000';}")
return True
def checkout(self, name, email, phone, address, zipcode, city, state, cc_num, exp_month, exp_year, cvv):
#time.sleep(0.5)
WebDriverWait(self.driver, 5).until(EC.presence_of_element_located((By.ID, 'checkout-form')))
form = self.driver.find_element_by_id('checkout-form')
part1 = form.find_element_by_id('billing-info')
self.driver.execute_script('document.getElementById("order_bn").value="{}";'.format(name))
self.driver.execute_script('document.getElementById("order_email").value="{}";'.format(email))
self.driver.execute_script('document.getElementById("order_tel").value="{}";'.format(phone))
self.driver.execute_script('document.getElementById("order_billing_address").value="{}";'.format(address))
self.driver.execute_script('document.getElementById("order_billing_zip").value="{}";'.format(zipcode))
self.driver.execute_script('document.getElementById("order_billing_city").value="{}";'.format(city))
Select(part1.find_element_by_id('order_billing_state')).select_by_visible_text(state)
part2 = form.find_element_by_id('credit-card')
self.driver.execute_script('document.getElementById("cnid").value="{}";'.format(cc_num))
Select(part2.find_element_by_id('credit_card_month')).select_by_visible_text(exp_month)
Select(part2.find_element_by_id('credit_card_year')).select_by_visible_text(exp_year)
self.driver.execute_script('document.evaluate(\'//input[@placeholder="cvv"]\', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.value="{}";'.format(cvv))
checkbox = part2.find_element_by_id('order_terms')
self.driver.execute_script("arguments[0].click();", checkbox)
#time.sleep(2) # DELAY BEFORE BUY
WebDriverWait(form, 5).until(EC.element_to_be_clickable((By.ID, 'submit_button'))).click()
def close(self):
self.driver.quit()
| [
"jamesmey@usc.edu"
] | jamesmey@usc.edu |
f44c6c5aff27924b53a3d5203b2203a17c776ce9 | 44daec4f9776af6d5ee59b363e24a149bb49598b | /kullanici/migrations/0001_initial.py | 81e8aa9f57f4b886ec46cfa85ec556113a351f7a | [] | no_license | mebaysan/KANBAN-Django | 9ef3e56f5175158bc6572af8533d2236a0f0e354 | d6d7ac7b0469f92750a79ec1b00fa45e34dfce25 | refs/heads/master | 2022-11-27T19:13:35.164581 | 2020-06-01T22:28:49 | 2020-06-01T22:28:49 | 236,877,189 | 10 | 1 | null | 2022-11-22T05:16:37 | 2020-01-29T00:56:51 | JavaScript | UTF-8 | Python | false | false | 3,019 | py | # Generated by Django 3.0.2 on 2020-02-06 23:18
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='Kullanici',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('profil_foto', models.ImageField(default='defaults/default.png', upload_to='profil/foto/')),
('lokasyon', models.CharField(blank=True, max_length=255, null=True)),
('title', models.TextField(blank=True, null=True)),
('password_reset_hash', models.TextField(blank=True, null=True)),
('invite_token', models.TextField(blank=True, null=True)),
('groups', models.ManyToManyField(blank=True, null=True, related_name='gruplar', to='auth.Group')),
('user_permissions', models.ManyToManyField(blank=True, null=True, related_name='izinler', to='auth.Permission')),
],
options={
'verbose_name': 'Kullanıcı',
'verbose_name_plural': 'Kullanıcılar',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
| [
"menesbaysan@gmail.com"
] | menesbaysan@gmail.com |
a92ced6045687faa1ea5c15ab922c0afb8232462 | 505ca5a34bbbc2b63edd7bd7c7f91e7b62425139 | /posts/models.py | 42a900df17538d14d7fdf2f46a9681cf0bc8363f | [] | no_license | lyrdaqs/BlogApplication | 5f33cf13896c87f85a1b67358730dd534da55994 | fbdc9671d87d410688fd115065361d9368e64d64 | refs/heads/master | 2023-06-25T16:07:33.512884 | 2021-07-18T08:53:34 | 2021-07-18T08:53:34 | 387,131,166 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 549 | py | from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length = 100)
text = models.TextField()
date_posted = models.DateTimeField(default = timezone.now)
author = models.ForeignKey(User,on_delete=models.CASCADE)
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse('post-detail',kwargs={'pk':self.pk})
| [
"lyrdaq777@gmail.com"
] | lyrdaq777@gmail.com |
80cb12d64e40932883d524ffc4a087648d542d4a | d200ed5aeb8f6c4c94b2ec9cebe554a3f2c07979 | /apps/django projects/classproject/onlineapp/views/rest_api.py | 74a395f65e69179210aaec09b65666b0c8e911cd | [] | no_license | sanjaybalagam/summer_2019_gvp_balagamsanjay | d3b58fb6089ac3e540248d40e4c020e2f948c2f5 | d32d14d25a16f4dd8eb312257b5d87cbc1d3c48b | refs/heads/master | 2020-06-03T15:27:38.138419 | 2019-06-18T08:57:09 | 2019-06-18T08:57:09 | 191,628,779 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,718 | py | from onlineapp.serilizer import *
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework import status
from rest_framework.views import APIView
@api_view(['GET','POST','PUT','DELETE'])
def college_api(request, *args, **kwargs):
if request.method == 'GET':
if kwargs:
try:
clg = College.objects.get(**kwargs)
print(clg)
return Response(CollegeSerializer(clg).data)
except:
return Response(status=status.HTTP_400_BAD_REQUEST)
clg=College.objects.all()
i=CollegeSerializer(clg, many=True)
return Response(i.data)
elif request.method=='POST':
if kwargs:
return Response(status=status.HTTP_400_BAD_REQUEST)
college= CollegeSerializer(data= request.data)
if college.is_valid():
college.save()
return Response(status=200)
return Response(status=status.HTTP_400_BAD_REQUEST)
elif request.method=='PUT':
if kwargs:
try:
college=College.objects.get(**kwargs)
serializer = CollegeSerializer(college, data=request.data)
if serializer.is_valid():
serializer.save()
return Response(status=200)
except:
pass
return Response(status=400)
elif request.method=='DELETE':
if kwargs:
try:
college =College.objects.get(**kwargs)
college.delete()
return Response(status=200)
except:
pass
return Response(status=400)
class StudentsList(APIView):
"""
List all students, or create a new snippet.
"""
def get(self, request, *args, **kwargs):
try:
if kwargs:
students = Student.objects.filter(college__id= kwargs.get('cpk'))
serializer = StudentSerializer(students, many=True)
return Response(serializer.data)
except:
pass
return Response(status=400)
def post(self, request, *args, **kwargs):
serializer = StudentDetailsSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
class StudentDetails(APIView):
"""
Retrieve, update or delete a snippet instance.
"""
def get(self, request, *args, **kwargs):
try:
if 'spk' in kwargs:
student = Student.objects.filter(id = kwargs.get('spk'))
if student[0].college.id == kwargs.get('cpk'):
serializer = StudentDetailsSerializer(student[0])
return Response(serializer.data)
except:
pass
return Response(status=400)
def put(self, request, pk, format=None):
snippet = self.get_object(pk)
serializer = SnippetSerializer(snippet, data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def delete(self, request, *args, **kwargs):
try:
if 'spk' in kwargs:
student= Student.objects.get(pk=kwargs.get('spk'))
if student.college.id== kwargs.get('cpk'):
student.delete()
return Response(status=200)
except:
pass
return Response(status=400) | [
"balagamsanjay@gmail.com"
] | balagamsanjay@gmail.com |
147b240eae706f70835eac2c598e544d875d7d16 | 65c1b3e12069382f6f98e01534c5a11ecca2a3f6 | /SOURCE/LnFunctionsLight/Common/IniFile.py | 55375fea92139bc3b848f8b7a11f8c40e170ed05 | [] | no_license | Loreton/LnRSync | fbbec2228bea846485580d99d1824c9fcb9d76de | 49a90fe25834293115e5315ab233f86c86c2c9e9 | refs/heads/master | 2021-01-13T14:18:46.784449 | 2015-04-01T06:52:49 | 2015-04-01T06:52:49 | 15,321,797 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,516 | py | #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
#
# Scope: ............
# by Loreto Notarantonio 2013, February
# ######################################################################################
import sys; sys.dont_write_bytecode = True
import os
import collections
import configparser
import codecs
# ######################################################
# # https://docs.python.org/3/library/configparser.html
# ######################################################
def readIniFile(fileName, RAW=False, exitOnError=False):
# Setting del parser
configMain = configparser.ConfigParser( allow_no_value=False,
delimiters=('=', ':'),
comment_prefixes=('#',';'),
inline_comment_prefixes=(';',),
strict=True, # impone key unica
# strict=False,
empty_lines_in_values=True,
default_section='DEFAULT',
interpolation=configparser.ExtendedInterpolation()
)
configMain.optionxform = str # mantiene il case nei nomi delle section e delle Keys (Assicurarsi che i riferimenti a vars interne siano case-sensitive)
try:
data = codecs.open(fileName, "r", "utf8")
configMain.readfp(data)
except (Exception) as why:
print("Errore nella lettura del file: {} - {}".format(fileName, str(why)))
sys.exit(-1)
# Parsing del file
if type(configMain) in [configparser.ConfigParser]:
configDict = iniConfigAsDict(configMain, raw=RAW)
else:
configDict = configMain
return configMain, configDict
############################################################
#
############################################################
def iniConfigAsDict(INIConfig, sectionName=None, raw=False):
"""
Converts a ConfigParser object into a dictionary.
The resulting dictionary has sections as keys which point to a dict of the
sections options as key => value pairs.
"""
the_dict = collections.OrderedDict({})
fDEBUG = False
try:
for section in INIConfig.sections():
the_dict[section] = collections.OrderedDict({})
if fDEBUG: print ()
if fDEBUG: print ('[{}]'.format(section))
for key, val in INIConfig.items(section, raw=raw):
the_dict[section][key] = val
if fDEBUG: print (' {:<30} : {}'.format(key, val))
except (configparser.InterpolationMissingOptionError) as why:
print("\n"*2)
print("="*60)
print("ERRORE nella validazione del file")
print("-"*60)
print(str(why))
print("="*60)
sys.exit(-2)
if sectionName:
return the_dict[sectionName]
else:
return the_dict
############################################################
#
############################################################
def printINIconfigparser(INI_raw):
for section in INI_raw.sections():
print ()
print ('[{}]'.format(section))
for key, val in INI_raw.items(section):
print (' {:<30} : {}'.format(key, val))
| [
"loreto.n@gmail.com"
] | loreto.n@gmail.com |
2a63578249a035ae3dcfa35c5c4db1b637b4bd9c | 9b3828d306716e7de71e38b4eabea8b4ebee73e3 | /TaxiFareModel/trainer.py | dc2d55b16218c47dd5e1607a404b33a0ed428d75 | [] | no_license | Muamenb/TaxiFareModel | 05fffe3c85968b02425b45dfb0462eaead6ae43b | 6d1f2382fab185306deae53c07afda1a8325ce64 | refs/heads/master | 2023-07-10T10:45:38.107669 | 2021-08-17T14:03:03 | 2021-08-17T14:03:03 | 397,274,251 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,971 | py | from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.linear_model import LinearRegression
from TaxiFareModel.encoders import DistanceTransformer, TimeFeaturesEncoder
from TaxiFareModel.utils import compute_rmse
class Trainer():
def __init__(self, X, y):
"""
X: pandas DataFrame
y: pandas Series
"""
self.pipeline = None
self.X = X
self.y = y
def set_pipeline(self):
"""defines the pipeline as a class attribute"""
dist_pipe = Pipeline([('dist_trans', DistanceTransformer()),('stdscaler', StandardScaler())])
time_pipe = Pipeline([('time_enc', TimeFeaturesEncoder('pickup_datetime')),
('ohe', OneHotEncoder(handle_unknown='ignore'))])
preproc_pipe = ColumnTransformer([('distance', dist_pipe,
["pickup_latitude", "pickup_longitude", 'dropoff_latitude', 'dropoff_longitude']),
('time', time_pipe, ['pickup_datetime'])], remainder="drop")
self.pipeline = Pipeline([('preproc', preproc_pipe),
('linear_model', LinearRegression())])
def run(self):
"""set and train the pipeline"""
self.set_pipeline()
self.pipeline.fit(self.X, self.y)
def evaluate(self, X_test, y_test):
"""evaluates the pipeline on df_test and return the RMSE"""
y_pred = self.pipeline.predict(X_test)
rmse = compute_rmse(y_pred, y_test)
return rmse
if __name__ == "__main__":
# get data
df = get_data()
# clean data
df = clean_data()
# set X and y
y = df["fare_amount"]
X = df.drop("fare_amount", axis=1)
# hold out
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)
# train
trainer = Trainer(X_train, y_train)
trainer.run()
# evaluate
trainer.evaluate(X_test, y_test)
| [
"moamen.baset@gmail.com"
] | moamen.baset@gmail.com |
ed424ad30b202b4b2bc579f248f9c708cf697a66 | 94ee84997300baecdebffcc13c6394663c80be61 | /ImageCaption/config.py | b574823705d4b3d54a60f9260ed67a099ac130aa | [] | no_license | dsouzavijeth/ConditionalLearnToPayAttention | a3139899e5e29c16f62b073a5441e6ce0947cc95 | e2ff7194060ebcdc7bf50bbfcacb7a6bf7aa12d3 | refs/heads/master | 2022-03-01T01:37:59.797440 | 2019-11-12T02:34:28 | 2019-11-12T02:34:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,580 | py |
class Config(object):
""" Wrapper class for various (hyper)parameters. """
def __init__(self):
# about the model architecture
self.cnn = 'vgg16'
self.images_size = 224
self.max_caption_length = 20
self.dim_embedding = 512
self.num_lstm_units = 512
self.num_initalize_layers = 2
self.dim_initalize_layer = 512
self.num_attend_layers = 2
self.dim_attend_layer = 512
self.num_decode_layers = 2
self.dim_decode_layer = 1024
# about the weight initialization and regularization
self.fc_kernel_initializer_scale = 0.08
self.fc_kernel_regularizer_scale = 1e-4
self.fc_activity_regularizer_scale = 0.0
self.conv_kernel_regularizer_scale = 1e-4
self.conv_activity_regularizer_scale = 0.0
self.conv_drop_rate_03 = 0.3
self.conv_drop_rate_04 = 0.4
self.fc_drop_rate = 0.5
self.lstm_drop_rate = 0.3
self.attention_loss_factor = 1
# about the optimization
self.num_epochs = 100
self.batch_size = 32
self.optimizer = 'Adam'
self.initial_learning_rate = 0.00005
self.learning_rate_decay_factor = 1.0
self.num_steps_per_decay = 100000
self.clip_gradients = 5.0
self.momentum = 0.0
self.use_nesterov = True
self.decay = 0.9
self.centered = True
self.beta1 = 0.9
self.beta2 = 0.999
self.epsilon = 1e-6
# about the saver
self.save_period = 5000
self.plot_period = 100
self.save_dir = './models/'
self.summary_dir = './summary/'
# about the vocabulary
self.vocabulary_file = './vocabulary.csv'
self.vocabulary_size = 5000
# about the training
self.train_image_dir = './train/images/'
self.train_caption_file = './train/captions_train2014.json'
self.temp_annotation_file = './train/anns.csv'
self.temp_data_file = './train/data.npy'
# about the evaluation
self.eval_image_dir = './val/images/'
self.eval_caption_file = './val/captions_val2014.json'
self.eval_result_dir = './val/results/'
self.eval_result_file = './val/results.json'
self.save_eval_result_as_image = False
# about the testing
self.test_image_dir = './test/images/'
self.test_result_dir = './test/results/'
self.test_result_file = './test/results.csv'
self.test_json_file = './test/results.json'
self.visual = True
| [
"940265904@qq.com"
] | 940265904@qq.com |
6f94d14f7c35aa2c9b8d81bce1a0891c97b02dfb | 3146765403765bf6388e7d330528dbc625552ea2 | /main.py | 1319c421781043d511be2952308c356df0e0b29c | [] | no_license | Onuyau/Smiley | 95be726c4fcb14e30bfbc152076efc256eb5ac9f | 8dceb17de2283c8dd7444923d8b1dc900cb38382 | refs/heads/master | 2020-07-21T08:24:21.665808 | 2019-09-06T13:19:35 | 2019-09-06T13:19:35 | 206,796,147 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,719 | py | import tensorflow as tf
from tensorflow import keras
#from keras import regularizers
import numpy as np
import matplotlib as plt
#from numpy import exp, array, random, dot
# from keras.models import Model
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import SGD
from keras.utils import to_categorical
#from sklearn.model_selection import train_test_split
print(keras.__version__)
INIT_LR = 0.01
EPOCHS = 100
seed = 5
np.random.seed(seed)
x_train = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 0, 1, 0, 0, 0],
[1, 1, 0, 1, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 1, 0, 1, 0, 1, 0, 0],
[1, 1, 0, 1, 0, 1, 0, 0, 0, 0],
[1, 1, 0, 1, 0, 1, 0, 1, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 1, 1, 1, 1, 0],
[1, 1, 0, 1, 1, 1, 1, 0, 0, 0],
[1, 0, 0, 1, 0, 1, 1, 0, 1, 0],
[1, 0, 1, 0, 1, 0, 0, 1, 1, 0],
[0, 0, 1, 1, 0, 1, 0, 1, 1, 0],
[1, 0, 1, 0, 1, 0, 0, 1, 0, 1],
[1, 1, 1, 0, 1, 0, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 0, 0, 1, 1, 0],
[0, 1, 1, 0, 1, 1, 1, 0, 1, 0],
[1, 1, 0, 1, 0, 0, 1, 0, 1, 1],
[0, 1, 0, 1, 1, 1, 1, 1, 0, 1],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 1, 1, 0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])
y_train = np.array([[1], [1], [1], [2], [2], [2], [2], [2], [3], [3], [3], [3], [3], [3], [3], [3], [3], [3], [3], [3], [4], [4], [4], [4], [4], [5], [5], [5], [5], [5]]).T
#y_train = np.array([[1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]]).T
x_test = np.array([[1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 1, 0, 0, 0],
[1, 1, 1, 0, 1, 1, 1, 0, 1, 1],
[0, 1, 0, 1, 0, 1, 0, 0, 0, 1],
[1, 1, 1, 1, 0, 1, 1, 1, 0, 1],
[1, 1, 1, 0, 1, 1, 1, 1, 0, 0],
[1, 0, 0, 1, 1, 0, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
[0, 1, 0, 0, 1, 0, 1, 0, 1, 0],
[0, 0, 0, 1, 0, 1, 0, 1, 0, 0],
[1, 1, 0, 0, 1, 0, 1, 0, 1, 0],
[1, 0, 1, 1, 0, 1, 0, 1, 0, 1],
[1, 1, 0, 1, 1, 0, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1]])
y_test = np.array([[1], [2], [4], [3], [4], [4], [2], [5], [3], [2], [3], [4], [5], [5]]).T
#y_test = np.array([[1, 2, 4, 3, 4, 4, 2, 5, 3, 2, 3, 4, 5, 5]]).T
print("x_train",x_train.shape)
print("y_train",y_train.shape)
print("x_test",x_test.shape)
print("y_test",y_test.shape)
opt = SGD(lr=INIT_LR)
# from sklearn.datasets import load_digits
# digits = load_digits()
# print(digits.data.shape)
# import matplotlib.pyplot as plt
# plt.gray()
# plt.matshow(digits.images[1])
# plt.show()
#
# digits.data[0,:]
#
# from sklearn.preprocessing import StandardScaler
# X_scale = StandardScaler()
# X = X_scale.fit_transform(digits.data)
# X[0,:]
# x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3)
#input_shape 10 входов, скрытый слой 10, 5 нейронов, выходной слой 5 нейронов
model = Sequential()
model.add(Dense(5, activation='relu', batch_size=5, input_dim=10 ))
#model.add(Dense(10, activation='relu', input_shape=(None,10) , batch_size=10 ))
#model.add(Dense(10, activation='relu'))
model.add(Dense(5, input_shape=(5,5),kernel_initializer='uniform', activation='relu'))
model.add(Dense(units=5, kernel_initializer='uniform', activation='sigmoid'))
#model.add(Dense(units=5, activation='relu'))
model.summary()
model.compile(optimizer=opt, loss='mse', metrics=['accuracy'])
#тренировка нейросети
history = model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=EPOCHS, batch_size=10)
model.evaluate(x_test, y_test, verbose=1)
# оцениваем нейросеть
print("[INFO] evaluating network...")
predictions = model.predict(x_test, batch_size=32)
print(classification_report(y_test.argmax(axis=1),
predictions.argmax(axis=1), target_names=lb.classes_))
# строим графики потерь и точности
N = np.arange(0, EPOCHS)
plt.style.use("ggplot")
plt.figure()
plt.plot(N, H.history["loss"], label="train_loss")
plt.plot(N, H.history["val_loss"], label="val_loss")
plt.plot(N, H.history["acc"], label="train_acc")
plt.plot(N, H.history["val_acc"], label="val_acc")
plt.title("Training Loss and Accuracy (Simple NN)")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend()
plt.savefig(args["plot"])
#optimizer
pred = model.predict(x_predict)
print("Предсказанная оценка:", pred[1][0], ", Правильная оценка:", y_test[1]) | [
"noreply@github.com"
] | Onuyau.noreply@github.com |
57d367231e46c6e5560c75bf7980ccce124a5eb4 | 3239f723b792951b877fd50befd85ce8a8a120a5 | /customaddons/sim_inventory_backdate/sim_to_stock_backdate/models/stock_inventory.py | 7dc67419dda6abfae305e063ea28d482bf7865ff | [] | no_license | hiepmagenest/democodeluck | f8773c953b188b5dd889bb05694534334ea73afd | 2bdcfca9febe2fc5e72b9644ef92584e4029bf71 | refs/heads/main | 2023-03-26T04:29:00.776179 | 2021-03-24T07:01:19 | 2021-03-24T07:01:19 | 350,550,081 | 0 | 4 | null | null | null | null | UTF-8 | Python | false | false | 2,140 | py | from odoo import models
from odoo.tools import float_compare
class StockInventory(models.Model):
_inherit = 'stock.inventory'
def action_validate(self):
# somewhere this is called with multi in self, so we need to fallback to the default behaviour in such the case
if not self._context.get('manual_validate_date_time') and self.env.user.has_group(
'sim_to_backdate.group_backdate') and not len(self) > 1:
view = self.env.ref('sim_to_stock_backdate.stock_inventory_backdate_wizard_form_view')
ctx = dict(self._context or {})
ctx.update({'default_inventory_id': self.id})
return {
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'stock.inventory.backdate.wizard',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'context': ctx,
}
elif self.env.user.has_group('sim_to_backdate.group_backdate') and not len(self) > 1:
inventory_lines = self.line_ids.filtered(lambda l: l.product_id.tracking in ['lot',
'serial'] and not l.prod_lot_id and l.theoretical_qty != l.product_qty)
lines = self.line_ids.filtered(lambda l: float_compare(l.product_qty, 1,
precision_rounding=l.product_uom_id.rounding) > 0 and l.product_id.tracking == 'serial' and l.prod_lot_id)
# this should call stock track confirmation wizard for tracked products.
# in such situation, we inject backdate into context
if inventory_lines and not lines:
res = super(StockInventory, self).action_validate()
if isinstance(res, dict):
res.update({'context': {
'manual_validate_date_time': self._context.get('manual_validate_date_time', False)}})
return res
return super(StockInventory, self).action_validate()
| [
"hiepnh@magenest.com"
] | hiepnh@magenest.com |
d5094e55bb2a940a621f7294c8f09052cc6b328d | c9e5164be007b592d511ee33c610478e73e32992 | /setup.py | 5718d5c1916e2ec8ba5c23fb569de5e19aab6ae9 | [] | no_license | TooKennySupreme/warmtuna | 43e9a5afa0491b642d0b2d6707e5d301b2d6c02c | fc1da9b20969f1a0bdb75650b974daaed968d610 | refs/heads/master | 2021-05-26T20:45:47.492293 | 2011-01-31T03:37:57 | 2011-01-31T03:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 745 | py | from setuptools import setup, find_packages
version = '1.0'
setup(name='warmtuna',
version=version,
description="mysql warm backup plugin for holland",
long_description="""\
""",
classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
keywords='',
author='Andrew Garner',
author_email='muzazzi@gmail.com',
url='http://hollandbackup.org',
license='BSD',
packages=find_packages(exclude=['ez_setup']),
include_package_data=True,
zip_safe=False,
install_requires=[
# -*- Extra requirements: -*-
],
entry_points="""
[holland.backup]
warmtuna = holland.backup.warmtuna:WarmTuna
""",
namespace_packages=['holland', 'holland.backup']
)
| [
"muzazzi@gmail.com"
] | muzazzi@gmail.com |
43ebe9abb84d9e7fed32669a292dad822561e85b | 73d511408a6cd456558b059d5d4c0476ef85eeb5 | /ud120-projects/tools/parse_out_email_text.py | d80afee11226126712223d335afaeca7489d3b7f | [] | no_license | AlexGilleran/udacity-machine-learning-120 | 8f935431c2700a59c60441e1ce1ad7b154bcac3a | ecc67cdbc05f6a1d7cede32a90725b7fae602543 | refs/heads/master | 2021-01-17T22:28:59.112037 | 2017-03-07T12:41:28 | 2017-03-07T12:41:28 | 84,197,829 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,441 | py | #!/usr/bin/python
from nltk.stem.snowball import SnowballStemmer
import string
def parseOutText(f):
""" given an opened email file f, parse out all text below the
metadata block at the top
(in Part 2, you will also add stemming capabilities)
and return a string that contains all the words
in the email (space-separated)
example use case:
f = open("email_file_name.txt", "r")
text = parseOutText(f)
"""
f.seek(0) ### go back to beginning of file (annoying)
all_text = f.read()
### split off metadata
content = all_text.split("X-FileName:")
words = ""
if len(content) > 1:
### remove punctuation
text_string = content[1].translate(string.maketrans("", ""), string.punctuation)
### project part 2: comment out the line below
# words = text_string
### split the text string into individual words, stem each word,
### and append the stemmed word to words (make sure there's a single
### space between each stemmed word)
stemmer = SnowballStemmer("english")
split = text_string.split()
stemmed = [stemmer.stem(word) for word in split]
words = " ".join(stemmed)
return words
def main():
ff = open("../text_learning/test_email.txt", "r")
text = parseOutText(ff)
print text
if __name__ == '__main__':
main()
| [
"alex@alexgilleran.com"
] | alex@alexgilleran.com |
a1dedb1182cb91b1b850582b72f6ba338a77d105 | 998e1b4c0e3addd91fc96ec911afb3e371f93e34 | /notifications/notification.py | b287ab859520337fb5f4254b385c7c0b15996f77 | [] | no_license | s3714217/IOT-GreenhouseMonitor | 5860a2c3aeb43797d851040c8a3e5e4b27734491 | 22b3cbf4b2ebe34ab54508712b5754ca81837fde | refs/heads/master | 2022-06-06T00:40:11.187130 | 2019-04-07T06:14:34 | 2019-04-07T06:14:34 | 258,785,822 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,114 | py | import logging
from datetime import datetime
from notifications.pushbullet import Pushbullet
'''
Handles sending notifications and determining if notifications need to be sent
'''
class Notification:
def __init__(self, sensor_data_repository, pushbullet_token = None):
self.__repository = sensor_data_repository
if pushbullet_token is not None:
self.__pushbullet = Pushbullet(pushbullet_token)
'''
Determines if a notification has been sent for the specified device today
'''
def previously_sent(self, device = None):
if self.__pushbullet is None:
logging.error("Add pushbullet_token entry in config.json")
date = datetime.now()
# Haven't sent a notification yet
return self.__repository.count_notifications_sent(date, device) != 0
'''
Will notify via pushbullet because a reading was out of the ranges supplied
in the config
'''
def notify_outside_range(self, reasons):
if self.__pushbullet is None:
logging.error("Add pushbullet_token entry in config.json")
return
self.__pushbullet.send_note("Sensor Monitor",
"Out of range reading! %s" % ", ".join(reasons))
self.__repository.insert_notification_log()
'''
Notify when a connected device is nearby
'''
def notify_connected_device(self, device, sensor_log, reasons):
if self.__pushbullet is None:
logging.error("Add pushbullet_token entry in config.json")
return
temperature = sensor_log.get_temperature()
humidity = sensor_log.get_humidity()
if len(reasons) is 0:
self.__pushbullet.send_note("Connected Device: %s" % device,
"Temp: %d, Humidity: %d, Status: OK" \
% (temperature, humidity))
else:
self.__pushbullet.send_note("Connected Device: %s" % device,
"Temp: %d, Humidity: %d, Status: BAD %s" \
% (temperature, humidity, ", ".join(reasons)))
self.__repository.insert_notification_log(device) | [
"daniel@majoinen.com"
] | daniel@majoinen.com |
89bd72447b27e2018f0169fe676d13560b9e8202 | af5973439da95d6e8a0071f7d404b0235ddc1b02 | /images1/views.py | d428c778f042c89156bfb6f15f133ed73efb484c | [] | no_license | cmunir/images | 7f9ee27a855c045ccd39667a66020a5fb2111523 | 4c8d987e1f055812972af23cbd8ce9752032b639 | refs/heads/master | 2020-05-17T02:38:41.290403 | 2019-04-25T15:18:40 | 2019-04-25T15:18:40 | 183,460,347 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 407 | py | from django.shortcuts import render
# Create your views here.
def home_view(request):
return render(request, 'home.html')
def gallery_view(request):
return render(request,'gallery.html')
def contact_view(request):
return render(request,'contact.html')
def services_view(request):
return render(request,'services.html')
def feedback_view(request):
return render(request,'feedback.html')
| [
"chandigamunirathnam@gmail.com"
] | chandigamunirathnam@gmail.com |
b7819c428f254c93af4484b917b88ddf7072d2f1 | 92fe221ea022a588d6573868f414b7f5cf1918d6 | /problemSolving/codeforces/round_688/suffix_operations.py | 5da88373c262302d19dd0e80e46899ec2f663c26 | [] | no_license | mooyeon-choi/TIL | c2cda2bb495b9ea3bdc6f94806a4b6234c9db792 | 7c16f728de3846cee5f05bbf1392387f0183128c | refs/heads/master | 2023-03-15T18:04:47.591034 | 2022-07-12T16:43:31 | 2022-07-12T16:43:31 | 195,921,150 | 2 | 3 | null | 2023-03-05T18:19:18 | 2019-07-09T02:53:27 | Jupyter Notebook | UTF-8 | Python | false | false | 471 | py | for _ in range(int(input())):
N = int(input())
num = list(map(int, input().split()))
result = 0
maxNum = max(abs(num[-1] - num[-2]), abs(num[0] - num[1]))
for i in range(1, N -1):
result += abs(num[i] - num[i-1])
if maxNum < abs(num[i] - num[i-1]) + abs(num[i+1] - num[i]) - abs(num[i+1] - num[i-1]):
maxNum = abs(num[i] - num[i-1]) + abs(num[i+1] - num[i]) - abs(num[i+1] - num[i-1])
result += abs(num[-1] - num[-2])
print(result - maxNum)
| [
"dus1208@ajou.ac.kr"
] | dus1208@ajou.ac.kr |
29975554a8de3141a4414b1892d88f0518ce282a | 8c255942f7cae3cd501a8af3ffaecf21fdd7a15f | /sites/pycharm-guide/demos/tutorials/intro-aws/crud/create_validator.py | 8ed6ff9e959e7a59a2669c862e1bf18fa8b8b475 | [
"MIT",
"Apache-2.0"
] | permissive | vigneshbrb/jetbrains_guide | 6b493fbe4712fbb958ad24bf3c67e5bc46078453 | 9839abdbe4bc0de8f514008f623b4b86e5f56062 | refs/heads/main | 2023-07-27T06:51:16.480303 | 2021-09-10T16:51:07 | 2021-09-10T16:51:07 | 403,561,438 | 0 | 0 | Apache-2.0 | 2021-09-06T09:25:53 | 2021-09-06T09:25:52 | null | UTF-8 | Python | false | false | 1,172 | py | from marshmallow import Schema, fields, post_load, ValidationError
from argon2 import PasswordHasher
from . import db
def encrypt(plain_text_password):
""" This function takes plain-text password and returns encrypted password """
ph = PasswordHasher()
hashed_password = ph.hash(plain_text_password)
return hashed_password
class UserRegistrationSchema(Schema):
first_name = fields.Str(required=True)
last_name = fields.Str(required=True)
email = fields.Email(required=True)
password = fields.Str(required=True)
@post_load
def encrypt_password(self, data, **kwargs):
data["password"] = encrypt(data["password"])
return data
@post_load
def validate_email(self, data, **kwargs):
mongo = db.MongoDBConnection()
with mongo:
database = mongo.connection["myDB"]
collection = database["registrations"]
# check email already exists in DB. If true
# raise validation error.
if collection.find_one({"email": data["email"]}) is not None:
raise ValidationError('This email address is already taken.')
return data | [
"Mukul.Mantosh@in.bosch.com"
] | Mukul.Mantosh@in.bosch.com |
7b7849ba581739c52e1e0213bc2681bb1a94d2ee | efc333f84b028edef4a60aef8065504cde0d4982 | /packages/package_1/setup.py | bb8b31f2ad75dca1451b480c398836a168ed74e1 | [] | no_license | AlexeyBeley/workspace_mgmt | 402f4ffc99cbbcd217e4e0a01a70e8940b939118 | 90133558afed9482e23d8ef3b4a20af6f4e999b3 | refs/heads/master | 2022-11-13T12:53:37.172077 | 2020-07-05T19:39:29 | 2020-07-05T19:39:29 | 277,126,432 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 605 | py | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "horey", "common"))
from package_1 import __version__
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='horey.common.package_1',
version=__version__,
description='Horey package_1',
long_description=readme(),
author='Horey',
author_email='alexey.beley@gmail.com',
license='MIT',
packages=["horey.common.package_1"],
include_package_data=True,
install_requires=[],
zip_safe=False)
| [
"alexeybe@checkpoint.com"
] | alexeybe@checkpoint.com |
5fd96256d68233fec52aca2f5b9fa70f0e30e35d | 94f5051b07188edce5beac39d760c75a63cf07e0 | /Processing/RawDataSearch_and_FirstRow_SummaryReport.py | c9d0e4421f6867fe5e8bbe967c0657806a78a692 | [] | no_license | DereksProjects/XLWings_ModuleTempTool | 3a072c1bc00e08121a6b04f0245e55b02e8aeb57 | 68711e3d2d703c44d092f9a9899a2a92f5f43664 | refs/heads/master | 2020-08-23T16:29:39.523510 | 2019-10-21T21:59:15 | 2019-10-21T21:59:15 | 216,662,998 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 10,512 | py | # -*- coding: utf-8 -*-
"""
One method of this code will create a summary dataframe. The other method
searches for a user input Site Identifier Code and displays the raw data
@author: Derek Holsapple
"""
import pandas as pd
import glob
import os
import xlwings as xw
'''
HELPER METHOD
dataSummaryFrame()
This will be a dataframe used for user reference table
Clean the datafraem and change variables for readability
@param path -String, path to the folder with the pickle files
@retrun formatted_df -Dataframe, summarized dataframe for user reference table
'''
def dataSummaryFrame( path ):
#import the pickle dataframe for the summary report
formatted_df = pd.read_pickle( path + '\\Pandas_Pickle_DataFrames\\Pickle_FirstRows\\firstRowSummary_Of_CSV_Files.pickle')
# Isolate the WMO column, WMO regions = geographical locations (continents)
wMO_df = formatted_df.loc[:,['WMO region']]
#Set the data type of the frame to a string
# The numbers needs to be converted to a string, only string to string replacement is allowed
wMO_df = wMO_df['WMO region'].astype(str)
# Replace the numbers with location names, Access the 'WMO region' column
# 1 = Africa
# 2 = Asia
# 3 = South America
# 4 = North and Central America
# 5 = South West Pacific
# 6 = Europe
# 7 = Antartica
wMO_df = wMO_df.replace( {
'1' : 'Africa' ,
'2' : 'Asia' ,
'3' : 'South America' ,
'4' : 'North and Central America' ,
'5' : 'South West Pacific' ,
'6' : 'Europe' ,
'7' : 'Antartica' } )
# change the 'WMO region column into the converted continent column
formatted_df[ 'WMO region' ] = wMO_df
return formatted_df
'''
HELPER METHOD
dataSummaryFrame()
This will be a dataframe used for user reference table
Clean the datafraem and change variables for readability
@param path -String, path to the folder with the pickle files
@retrun formatted_df -Dataframe, summarized dataframe for user reference table
'''
def dataSummaryFramePostProcess( path ):
#import the pickle dataframe for the summary report
firstRowSummary_df = pd.read_pickle( path + '\\Pandas_Pickle_DataFrames\\Pickle_Level1_Summary\\Pickle_Level1_Summary.pickle')
return firstRowSummary_df
'''
OUTPUT METHOD
Take a summary dataframe from the helper method and output a report to a
generated excel sheet
param@ currentDirectory - String, where the excel file is located (passed as an argument
from EXCEL if using UDF)
return@ void - Creates a summary csv of all data
'''
def outputFileSummary( FileName , currentDirectory ):
# Reference which sheet inside the workbook you want to manipulate
# Create a .csv file to store the new data
open( FileName , 'wb')
# Reference which sheet inside the workbook you want to manipulate
myWorkBook = xw.Book( FileName )
#Reference sheet 0
mySheet = myWorkBook.sheets[0]
path = currentDirectory
# create a summary data frame from the helper method
summary_df = dataSummaryFrame( path )
# Pull out the column names
columnHeaders_list = list(summary_df)
#Output the column names and summary dataframe
myWorkBook.sheets[mySheet].range(1,1).value = columnHeaders_list
# Convert the dataframe into a list and then export the data "removes columns and headers"
myWorkBook.sheets[mySheet].range(2,1).value = summary_df.values.tolist()
'''
HELPER METHOD
filesNameList()
Pull out the file name from the file pathes and return a list of file names
@param path -String, path to the folder with the pickle files
@retrun allFiles -String List, filenames without the file path
'''
def filesNameList( path ):
#list of strings of all the files
allFiles = glob.glob(path + "/Pandas_Pickle_DataFrames/Pickle_RawData/*")
#for loop to go through the lists of strings and to remove irrelavant data
for i in range( 0, len( allFiles ) ):
# Delete the path and pull out only the file name using the os package from each file
temp = os.path.basename(allFiles[i])
allFiles[i] = temp
return allFiles
'''
OUTPUT METHOD
searchRawPickle_Output()
1) Take user input being a unique Identifier
2) Search the pickle files for a match
3) Output the raw pickle data to the excel sheet
@param path -String, path to the folder where this .py file is located
@param userInput -String, unique Identifier of a location found on sheet one
@return void - Output of raw data to excel sheet two
'''
def searchRawPickle_Output( FileName , currentDirectory , userInput):
#XL Wings
# Create a .csv file to store the new data
open( FileName , 'wb')
# Reference which sheet inside the workbook you want to manipulate
myWorkBook = xw.Book( FileName )
#Reference sheet 1 "This is the second sheet, reference starts at 0"
mySheet = myWorkBook.sheets[0]
#Set path
path = currentDirectory
# Get the file name of each raw data pickle, the unique identifier is inside this list
rawfileNames = filesNameList( path )
# Reference the summary frame to pull out the user Input row and display
summary_df = dataSummaryFrame( path )
for i in range(0 , len( rawfileNames ) ):
#Split the string into a list, The unique identifier will be the 3rd element of this list
# split the string when the file name gives a "_"
splitFile = rawfileNames[i].split('_', 3)
identifier = splitFile[2]
#If the user input is a match with a raw data file
if userInput == identifier:
# Pull out the raw pickle of the located file name
raw_df = pd.read_pickle( path + '/Pandas_Pickle_DataFrames/Pickle_RawData/' + rawfileNames[i] )
# Pull out the column names of Raw data
rawcolumnHeaders_list = list(raw_df)
# Pull out the column names of the summary frame
summaryColumnHeaders_list = list(summary_df)
# pull out the row associated with the unique identifier
# Note: the summary df will have the same index row as the rawFileName list
summaryRow_df = summary_df.iloc[i,:]
#Output the raw column names
myWorkBook.sheets[mySheet].range(4,1).value = rawcolumnHeaders_list
# Export the raw data frame for that location
# Convert the dataframe into a list and then export the data "removes columns and headers"
myWorkBook.sheets[mySheet].range(5,1).value = raw_df.values.tolist()
#Output the summary column names
myWorkBook.sheets[mySheet].range(1,1).value = summaryColumnHeaders_list
# Output the summary row for that location
# Convert the dataframe into a list and then export the data "removes columns and headers"
myWorkBook.sheets[mySheet].range(2,1).value = summaryRow_df.tolist()
#Stop the search for loop once the file is located
break
'''
stringList_UniqueID_List()
This method takes a lists of strings and searches for a unique sample identifier.
It then takes that unique identifier and creates a list. If one of the strings
does not have a unique identifier it will put that original string back into the list
Example List
'690190TYA.pickle',
'GRC_SOUDA(AP)_167460_IW2.pickle',
'GRC_SOUDA-BAY-CRETE_167464_IW2.pickle',
'Test']
Return List
'690190'
'167460'
'167464'
'Test'
param@ listOfStrings -List of Strings , list of strings containing unique identifier
@return - List of Strings, list of filtered strings with unique identifiers
'''
def stringList_UniqueID_List( listOfStrings ):
sampleList = []
#Create a list of ASCII characters to find the sample name from the given string
for i in range(0, len(listOfStrings)):
#Create a list of ASCII characters from the string
ascii_list =[ord(c) for c in listOfStrings[i]]
char_list = list(listOfStrings[i])
#If the first string does not pass the filter set the sample flag to 0
# sampleFlag = 0
count = 0
# j will be the index referencing the next ASCII character
for j in range(0, len(ascii_list)):
#Filter to find a unique combination of characters and ints in sequence
###############
# ASCII characters for numbers 0 - 10
if ascii_list[j] >= 48 and ascii_list[j] <= 57:
#If a number is encountered increase the counter
count = count + 1
# If the count is 6 "This is how many numbers in a row the unique identifier will be"
if count == 3:
# Create a string of the unique identifier
sampleList.append( char_list[ j - 2 ] +
char_list[ j - 1 ] +
char_list[ j ] +
char_list[ j + 1 ] +
char_list[ j + 2 ] +
char_list[ j + 3 ] )
# Stop the search. The identifier has been located
break
# If the next ASCII character is not a number reset the counter to 0
else:
count = 0
# If a unique identifier is not located insert string as placeholder so that indexing is not corrupted
if count == 0 and j == len(ascii_list) - 1 :
sampleList.append(listOfStrings[i])
return sampleList
| [
"dholsapp@nrel.gov"
] | dholsapp@nrel.gov |
c9f3d95369472d1037d160dffe15e640c9f795f9 | 7a470c372892c9ea349b9cdd21128e18ce694d14 | /restaurant/blog/migrations/0011_alter_comments_content.py | d2d187fb204fcda915325c82350161ce06a7fb4f | [] | no_license | MasihJavidan/NamFood | e90ed29982424827cf1845a51398f1843b6def32 | 988bec32737448e3a3f2c05cf509c6884e9b6c7d | refs/heads/master | 2023-08-04T02:29:09.684346 | 2021-09-24T21:05:14 | 2021-09-24T21:05:14 | 398,354,333 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 405 | py | # Generated by Django 3.2.4 on 2021-07-24 07:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0010_rename_blog_comments_comments'),
]
operations = [
migrations.AlterField(
model_name='comments',
name='content',
field=models.TextField(verbose_name='متن'),
),
]
| [
"masih.javidan69@gamil.com"
] | masih.javidan69@gamil.com |
d246ec11165acfa514ec8dcf6afcd93911006956 | 6803395abdd176bb8307e0ade9cd6f11d4ab9a60 | /src/population.py | 772f748d710de2b2f9a132caf793e0e15142615e | [] | no_license | diakodarian/PIC_FEniCS | 550fdc9e06f6220c591a830c3a76932a78f5a558 | dc048a9b3023782dd0070675ec2a6f26b72d79b8 | refs/heads/master | 2021-04-29T07:18:37.110762 | 2017-03-07T22:25:11 | 2017-03-07T22:25:11 | 77,953,877 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 13,111 | py | # __authors__ = ('Sigvald Marholm <sigvaldm@fys.uio.no>')
# __date__ = '2017-02-22'
# __copyright__ = 'Copyright (C) 2017' + __authors__
# __license__ = 'GNU Lesser GPL version 3 or any later version'
#
# Loosely based on fenicstools/LagrangianParticles by Mikeal Mortensen and
# Miroslav Kuchta. Released under same license.
from __future__ import print_function, division
import sys
if sys.version_info.major == 2:
from itertools import izip as zip
range = xrange
#import dolfin as df
from dolfin import *
import numpy as np
from mpi4py import MPI as pyMPI
from collections import defaultdict
from itertools import count
comm = pyMPI.COMM_WORLD
# collisions tests return this value or -1 if there is no collision
__UINT32_MAX__ = np.iinfo('uint32').max
class Particle:
__slots__ = ['x', 'v', 'q', 'm']
def __init__(self, x, v, q, m):
assert(q!=0 and m!=0)
self.x = np.array(x) # Position vector
self.v = np.array(v) # Velocity vector
self.q = q # Charge
self.m = m # Mass
def send(self, dest):
comm.Send(self.x, dest=dest)
comm.Send(self.v, dest=dest)
comm.Send(self.q, dest=dest)
comm.Send(self.m, dest=dest)
def recv(self, source):
comm.Recv(self.x, source=source)
comm.Recv(self.v, source=source)
comm.Recv(self.q, source=source)
comm.Recv(self.m, source=source)
class Population(list):
def __init__(self, mesh, object_type, object_info):
self.mesh = mesh
self.object_info = object_info
self.object_type = object_type
# Allocate a list of particles for each cell
for cell in cells(self.mesh):
self.append(list())
# Create a list of sets of neighbors for each cell
self.tDim = self.mesh.topology().dim()
self.gDim = self.mesh.geometry().dim()
self.mesh.init(0, self.tDim)
self.tree = self.mesh.bounding_box_tree()
self.neighbors = list()
for cell in cells(self.mesh):
neigh = sum([vertex.entities(self.tDim).tolist() for vertex in vertices(cell)], [])
neigh = set(neigh) - set([cell.index()])
self.neighbors.append(neigh)
# Allocate some MPI stuff
self.num_processes = comm.Get_size()
self.myrank = comm.Get_rank()
self.all_processes = list(range(self.num_processes))
self.other_processes = list(range(self.num_processes))
self.other_processes.remove(self.myrank)
self.my_escaped_particles = np.zeros(1, dtype='I')
self.tot_escaped_particles = np.zeros(self.num_processes, dtype='I')
# Dummy particle for receiving/sending at [0, 0, ...]
vZero = np.zeros(self.gDim)
self.particle0 = Particle(vZero,vZero,1,1)
def addParticles(self, xs, vs=None, qs=None, ms=None):
"""
Adds particles to the population and locates them on their home
processor. xs is a list/array of position vectors. vs, qs and ms may
be lists/arrays of velocity vectors, charges, and masses,
respectively, or they may be only a single velocity vector, mass
and/or charge if all particles should have the same value.
"""
if vs is None or qs is None or ms is None:
assert isinstance(xs,list)
if len(xs)==0:
return
assert isinstance(xs[0],Particle)
ps = xs
xs = [p.x for p in ps]
vs = [p.v for p in ps]
qs = [p.q for p in ps]
ms = [p.m for p in ps]
addParticles(xs, vs, qs, ms)
return
# Expand input to lists/arrays if necessary
if len(np.array(vs).shape)==1: vs = np.tile(vs,(len(xs),1))
if not isinstance(qs, (np.ndarray,list)): qs *= np.ones(len(xs))
if not isinstance(ms, (np.ndarray,list)): ms *= np.ones(len(xs))
# Keep track of which particles are located locally and globally
my_found = np.zeros(len(xs), np.int)
all_found = np.zeros(len(xs), np.int)
for i, x, v, q, m in zip(count(), xs, vs, qs, ms):
cell = self.locate(x)
if not (cell == -1 or cell == __UINT32_MAX__):
my_found[i] = True
self[cell].append(Particle(x, v, q, m))
# All particles must be found on some process
comm.Reduce(my_found, all_found, root=0)
if self.myrank == 0:
nMissing = len(np.where(all_found == 0)[0])
assert nMissing==0,'%d particles are not located in mesh'%nMissing
def relocate(self, q_object):
"""
Relocate particles on cells and processors
map such that map[old_cell] = [(new_cell, particle_id), ...]
i.e. new destination of particles formerly in old_cell
"""
new_cell_map = defaultdict(list)
for dfCell in cells(self.mesh):
cindex = dfCell.index()
cell = self[cindex]
for i, particle in enumerate(cell):
point = Point(*particle.x)
# Search only if particle moved outside original cell
if not dfCell.contains(point):
found = False
# Check neighbor cells
for neighbor in self.neighbors[dfCell.index()]:
if Cell(self.mesh,neighbor).contains(point):
new_cell_id = neighbor
found = True
break
# Do a completely new search if not found by now
if not found:
new_cell_id = self.locate(particle)
# Record to map
new_cell_map[dfCell.index()].append((new_cell_id, i))
# Rebuild locally the particles that end up on the process. Some
# have cell_id == -1, i.e. they are on other process
list_of_escaped_particles = []
for old_cell_id, new_data in new_cell_map.iteritems():
# We iterate in reverse becasue normal order would remove some
# particle this shifts the whole list!
for (new_cell_id, i) in sorted(new_data,
key=lambda t: t[1],
reverse=True):
# particle = p_map.pop(old_cell_id, i)
particle = self[old_cell_id][i]
# Delete particle in old cell, fill gap by last element
if not i==len(self[old_cell_id])-1:
self[old_cell_id][i] = self[old_cell_id].pop()
else:
self[old_cell_id].pop()
if new_cell_id == -1 or new_cell_id == __UINT32_MAX__ :
list_of_escaped_particles.append(particle)
else:
# p_map += self.mesh, new_cell_id, particle
self[new_cell_id].append(particle)
# Create a list of how many particles escapes from each processor
self.my_escaped_particles[0] = len(list_of_escaped_particles)
# Make all processes aware of the number of escapees
comm.Allgather(self.my_escaped_particles, self.tot_escaped_particles)
# Send particles to root
if self.myrank != 0:
for particle in list_of_escaped_particles:
particle.send(0)
# Receive the particles escaping from other processors
if self.myrank == 0:
for proc in self.other_processes:
for i in range(self.tot_escaped_particles[proc]):
self.particle0.recv(proc)
list_of_escaped_particles.append(copy.deepcopy(self.particle0))
# What to do with escaped particles
particles_inside_object = []
particles_outside_domain = []
for i in range(len(list_of_escaped_particles)):
particle = list_of_escaped_particles[i]
x = particle.x
q = particle.q
d = len(x)
if self.object_type == 'spherical_object':
if d == 2:
s0 = [self.object_info[0], self.object_info[1]]
r0 = self.object_info[2]
if d == 3:
s0 = [self.object_info[0], self.object_info[1], self.object_info[2]]
r0 = self.object_info[3]
if np.dot(x-s0, x-s0) < r0**2:
particles_inside_object.append(i)
particles_outside_domain = set(particles_outside_domain)
particles_outside_domain = list(particles_outside_domain)
particles_to_be_removed = []
particles_to_be_removed.extend(particles_inside_object)
particles_to_be_removed.extend(particles_outside_domain)
particles_to_be_removed.sort()
print("particles inside object: ", len(particles_inside_object))
print("particles_outside_domain: ", len(particles_outside_domain))
print("particles_to_be_removed: ", len(particles_to_be_removed))
# print("list_of_escaped_particles: ", list_of_escaped_particles)
if (not self.object_type is None):
# Remove particles inside the object and accumulate the charge
for i in reversed(particles_to_be_removed):
p = list_of_escaped_particles[i]
if i in particles_inside_object:
q_object[0] += p.q
list_of_escaped_particles.remove(p)
# Put all travelling particles on all processes, then perform new search
travelling_particles = comm.bcast(list_of_escaped_particles, root=0)
self.addParticles(travelling_particles)
return q_object
def total_number_of_particles(self):
'Return number of particles in total and on process.'
num_p = self.particle_map.total_number_of_particles()
tot_p = comm.allreduce(num_p)
return (tot_p, num_p)
def locate(self, particle):
'Find mesh cell that contains particle.'
assert isinstance(particle, (Particle, np.ndarray))
if isinstance(particle, Particle):
# Convert particle to point
point = Point(*particle.x)
else:
point = Point(*particle)
return self.tree.compute_first_entity_collision(point)
def stdSpecie(mesh, Ld, q, m, N, q0=-1.0, m0=1.0, wp0=1.0, count='per cell'):
"""
Returns standard normalized particle parameters to use for a specie. The
inputs q and m are the charge and mass of the specie in elementary charges
and electron masses, respectively. N is the number of particles per cell
unless count='total' in which case it is the total number of simulation
particles in the domain. For instance to create 8 ions per cell (having
mass of 1836 electrons and 1 positive elementary charge):
q, m, N = stdSpecie(mesh, Ld, 1, 1836, 8)
The returned values are the normalized charge q, mass m and total number of
simulation particles N. The normalization is such that the angular electron
plasma frequency will be 1.
Alternatively, the reference charge q0 and mass m0 which should yield a
angular plasma frequency of 1, or for that sake any other frequency wp0,
could be set through the kwargs. For example, in this case the ions will
have a plasma frequency of 0.1:
q, m, N = stdSpecie(mesh, Ld, 1, 1836, 8, q0=1, m0=1836, wp0=0.1)
"""
assert count in ['per cell','total']
if count=='total':
Np = N
else:
Np = N*mesh.num_cells()
mul = (np.prod(Ld)/np.prod(Np))*(wp0**2)*m0/(q0**2)
return q*mul, m*mul, Np
#==============================================================================
# PERHAPS STUFF BELOW THIS SHOULD GO INTO A SEPARATE MODULE? E.G. INIT. CONDS.?
#------------------------------------------------------------------------------
def randomPoints(pdf, Ld, N, pdfMax=1):
# Creates an array of N points randomly distributed according to pdf in a
# domain size given by Ld (and starting in the origin) using the Monte
# Carlo method. The pdf is assumed to have a max-value of 1 unless
# otherwise specified. Useful for creating arrays of position/velocity
# vectors of various distributions.
Ld = np.array(Ld) # In case it's a list
dim = len(Ld)
assert not isinstance(pdf(np.ones(dim)),(list,np.ndarray)) ,\
"pdf returns non-scalar value"
points = np.array([]).reshape(0,dim)
while len(points)<N:
# Creates missing points
n = N-len(points)
newPoints = np.random.rand(n,dim+1) # Last value to be compared with pdf
newPoints *= np.append(Ld,pdfMax) # Stretch axes
# Only keep points below pdf
newPoints = [x[0:dim] for x in newPoints if x[dim]<pdf(x[0:dim])]
newPoints = np.array(newPoints).reshape(-1,dim)
points = np.concatenate([points,newPoints])
return points
def maxwellian(vd, vth, N):
"""
Returns N maxwellian velocity vectors with drift and thermal velocity
vectors vd and vth, respectively, in an (N,d) array where d is the number
of geometric dimensions. If you have an (N,d) array xs (e.g. position
vectors) the following call would also be valid:
maxwellian(vd, vth, xs.shape)
or even
np.random.normal(vd, vth, xs.shape)
where np stands for numpy. However, np.random.normal fails when one of the
elements in the vector vth is zero. maxwellian replaces zeroes with the
machine epsilon.
Either vd or vth may be a scalar, or both if N is a shape-tuple.
"""
if isinstance(N,int):
d = max(len(vd),len(vth))
else:
(N,d) = N
# Replace zeroes in vth for machine epsilon
if isinstance(vth,(float,int)): vth = [vth]
vth = np.array(vth,dtype=float)
indices = np.where(vth==0.0)[0]
vth[indices] = np.finfo(float).eps
return np.random.normal(vd, vth, (N,d))
def initLangmuir(pop, Ld, vd, vth, A, mode, Npc):
"""
Initializes population pop with particles corresponding to electron-ion
plasma oscillations with amplitude A in density, thermal velocity vth[0]
and vth[1] for electrons and ions, respectively, and drift velocity vector
vd. mesh and Ld is the mesh and it's size, while Npc is the number of
simulation particles per cell per specie. Normalization is such that
angular electron plasma frequency is one. mode is the number of half
periods per domain length in the x-direction.
"""
mesh = pop.mesh
# Adding electrons
q, m, N = stdSpecie(mesh, Ld, -1, 1, Npc)
pdf = lambda x: 1+A*np.sin(mode*2*np.pi*x[0]/Ld[0])
xs = randomPoints(pdf, Ld, N, pdfMax=1+A)
vs = maxwellian(vd, vth[0], xs.shape)
pop.addParticles(xs,vs,q,m)
# Adding ions
q, m, N = stdSpecie(mesh, Ld, 1, 1836, Npc)
pdf = lambda x: 1
xs = randomPoints(pdf, Ld, N)
vs = maxwellian(vd, vth[1], xs.shape)
pop.addParticles(xs,vs,q,m)
| [
"diako.darian@gmail.com"
] | diako.darian@gmail.com |
591a285f8c58a80d99464bb6cb5504b260807dcf | 35fe9e62ab96038705c3bd09147f17ca1225a84e | /a10_ansible/library/a10_cgnv6_lw_4o6_health_check_gateway.py | 3b1f73ae995d232cf6763d916b8be34cc37f1735 | [] | no_license | bmeidell/a10-ansible | 6f55fb4bcc6ab683ebe1aabf5d0d1080bf848668 | 25fdde8d83946dadf1d5b9cebd28bc49b75be94d | refs/heads/master | 2020-03-19T08:40:57.863038 | 2018-03-27T18:25:40 | 2018-03-27T18:25:40 | 136,226,910 | 0 | 0 | null | 2018-06-05T19:45:36 | 2018-06-05T19:45:36 | null | UTF-8 | Python | false | false | 5,814 | py | #!/usr/bin/python
REQUIRED_NOT_SET = (False, "One of ({}) must be set.")
REQUIRED_MUTEX = (False, "Only one of ({}) can be set.")
REQUIRED_VALID = (True, "")
DOCUMENTATION = """
module: a10_health-check-gateway
description:
-
author: A10 Networks 2018
version_added: 1.8
options:
ipv4-addr:
description:
- LW-4over6 IPv4 Gateway
ipv6-addr:
description:
- LW-4over6 IPv6 Gateway
uuid:
description:
- uuid of the object
"""
EXAMPLES = """
"""
ANSIBLE_METADATA = """
"""
# Hacky way of having access to object properties for evaluation
AVAILABLE_PROPERTIES = {"ipv4_addr","ipv6_addr","uuid",}
# our imports go at the top so we fail fast.
from a10_ansible.axapi_http import client_factory
from a10_ansible import errors as a10_ex
def get_default_argspec():
return dict(
a10_host=dict(type='str', required=True),
a10_username=dict(type='str', required=True),
a10_password=dict(type='str', required=True, no_log=True),
state=dict(type='str', default="present", choices=["present", "absent"])
)
def get_argspec():
rv = get_default_argspec()
rv.update(dict(
ipv4_addr=dict(
type='str' , required=True
),
ipv6_addr=dict(
type='str' , required=True
),
uuid=dict(
type='str'
),
))
return rv
def new_url(module):
"""Return the URL for creating a resource"""
# To create the URL, we need to take the format string and return it with no params
url_base = "/axapi/v3/cgnv6/lw-4o6/health-check-gateway/{ipv4-addr}+{ipv6-addr}"
f_dict = {}
f_dict["ipv4-addr"] = ""
f_dict["ipv6-addr"] = ""
return url_base.format(**f_dict)
def existing_url(module):
"""Return the URL for an existing resource"""
# Build the format dictionary
url_base = "/axapi/v3/cgnv6/lw-4o6/health-check-gateway/{ipv4-addr}+{ipv6-addr}"
f_dict = {}
f_dict["ipv4-addr"] = module.params["ipv4-addr"]
f_dict["ipv6-addr"] = module.params["ipv6-addr"]
return url_base.format(**f_dict)
def build_envelope(title, data):
return {
title: data
}
def build_json(title, module):
rv = {}
for x in AVAILABLE_PROPERTIES:
v = module.params.get(x)
if v:
rx = x.replace("_", "-")
rv[rx] = module.params[x]
return build_envelope(title, rv)
def validate(params):
# Ensure that params contains all the keys.
requires_one_of = sorted([])
present_keys = sorted([x for x in requires_one_of if params.get(x)])
errors = []
marg = []
if not len(requires_one_of):
return REQUIRED_VALID
if len(present_keys) == 0:
rc,msg = REQUIRED_NOT_SET
marg = requires_one_of
elif requires_one_of == present_keys:
rc,msg = REQUIRED_MUTEX
marg = present_keys
else:
rc,msg = REQUIRED_VALID
if not rc:
errors.append(msg.format(", ".join(marg)))
return rc,errors
def exists(module):
try:
module.client.get(existing_url(module))
return True
except a10_ex.NotFound:
return False
def create(module, result):
payload = build_json("health-check-gateway", module)
try:
post_result = module.client.post(new_url(module), payload)
result.update(**post_result)
result["changed"] = True
except a10_ex.Exists:
result["changed"] = False
except a10_ex.ACOSException as ex:
module.fail_json(msg=ex.msg, **result)
except Exception as gex:
raise gex
return result
def delete(module, result):
try:
module.client.delete(existing_url(module))
result["changed"] = True
except a10_ex.NotFound:
result["changed"] = False
except a10_ex.ACOSException as ex:
module.fail_json(msg=ex.msg, **result)
except Exception as gex:
raise gex
return result
def update(module, result):
payload = build_json("health-check-gateway", module)
try:
post_result = module.client.put(existing_url(module), payload)
result.update(**post_result)
result["changed"] = True
except a10_ex.ACOSException as ex:
module.fail_json(msg=ex.msg, **result)
except Exception as gex:
raise gex
return result
def present(module, result):
if not exists(module):
return create(module, result)
else:
return update(module, result)
def absent(module, result):
return delete(module, result)
def run_command(module):
run_errors = []
result = dict(
changed=False,
original_message="",
message=""
)
state = module.params["state"]
a10_host = module.params["a10_host"]
a10_username = module.params["a10_username"]
a10_password = module.params["a10_password"]
# TODO(remove hardcoded port #)
a10_port = 443
a10_protocol = "https"
valid, validation_errors = validate(module.params)
map(run_errors.append, validation_errors)
if not valid:
result["messages"] = "Validation failure"
err_msg = "\n".join(run_errors)
module.fail_json(msg=err_msg, **result)
module.client = client_factory(a10_host, a10_port, a10_protocol, a10_username, a10_password)
if state == 'present':
result = present(module, result)
elif state == 'absent':
result = absent(module, result)
return result
def main():
module = AnsibleModule(argument_spec=get_argspec())
result = run_command(module)
module.exit_json(**result)
# standard ansible module imports
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
main() | [
"mdurrant@a10networks.com"
] | mdurrant@a10networks.com |
9bf639aca1a78cd3b1b828cc4998231f9eaf8ecf | 101a3bc5efc89702e93a5f3d209e545b4123ff8a | /pipeline.py | cc24609d088107070cf0890bb9c8260802ad19ea | [] | no_license | DongqinZhou/frap-pub | b0ea1ee379ad6e91896b8e2e190d9876e5bf8a48 | 9c1bbd75f19423c5609838c0872c0370e2c24faf | refs/heads/master | 2022-08-04T02:33:42.530674 | 2020-05-22T14:23:20 | 2020-05-22T14:23:20 | 265,940,020 | 0 | 0 | null | 2020-05-21T19:59:44 | 2020-05-21T19:59:43 | null | UTF-8 | Python | false | false | 20,114 | py | import json
import os
import shutil
import xml.etree.ElementTree as ET
from generator import Generator
from construct_sample import ConstructSample
from updater import Updater
from multiprocessing import Process
from model_pool import ModelPool
import random
import pickle
import model_test
import pandas as pd
import numpy as np
from math import isnan
import sys
import time
class Pipeline:
_LIST_SUMO_FILES = [
"cross.car.type.xml",
"cross.con.xml",
"cross.edg.xml",
"cross.net.xml",
"cross.netccfg",
"cross.nod.xml",
"cross.sumocfg",
"cross.tll.xml",
"cross.typ.xml"
]
@staticmethod
def _set_traffic_file(sumo_config_file_tmp_name, sumo_config_file_output_name, list_traffic_file_name):
# update sumocfg
sumo_cfg = ET.parse(sumo_config_file_tmp_name)
config_node = sumo_cfg.getroot()
input_node = config_node.find("input")
for route_files in input_node.findall("route-files"):
input_node.remove(route_files)
input_node.append(
ET.Element("route-files", attrib={"value": ",".join(list_traffic_file_name)}))
sumo_cfg.write(sumo_config_file_output_name)
def _path_check(self):
# check path
if os.path.exists(self.dic_path["PATH_TO_WORK_DIRECTORY"]):
if self.dic_path["PATH_TO_WORK_DIRECTORY"] != "records/default":
raise FileExistsError
else:
pass
else:
os.makedirs(self.dic_path["PATH_TO_WORK_DIRECTORY"])
if os.path.exists(self.dic_path["PATH_TO_MODEL"]):
if self.dic_path["PATH_TO_MODEL"] != "model/default":
raise FileExistsError
else:
pass
else:
os.makedirs(self.dic_path["PATH_TO_MODEL"])
if self.dic_exp_conf["PRETRAIN"]:
if os.path.exists(self.dic_path["PATH_TO_PRETRAIN_WORK_DIRECTORY"]):
pass
else:
os.makedirs(self.dic_path["PATH_TO_PRETRAIN_WORK_DIRECTORY"])
if os.path.exists(self.dic_path["PATH_TO_PRETRAIN_MODEL"]):
pass
else:
os.makedirs(self.dic_path["PATH_TO_PRETRAIN_MODEL"])
def _copy_conf_file(self, path=None):
# write conf files
if path == None:
path = self.dic_path["PATH_TO_WORK_DIRECTORY"]
json.dump(self.dic_exp_conf, open(os.path.join(path, "exp.conf"), "w"),
indent=4)
json.dump(self.dic_agent_conf, open(os.path.join(path, "agent.conf"), "w"),
indent=4)
json.dump(self.dic_traffic_env_conf,
open(os.path.join(path, "traffic_env.conf"), "w"), indent=4)
def _copy_sumo_file(self, path=None):
if path == None:
path = self.dic_path["PATH_TO_WORK_DIRECTORY"]
# copy sumo files
for file_name in self._LIST_SUMO_FILES:
shutil.copy(os.path.join(self.dic_path["PATH_TO_DATA"], file_name),
os.path.join(path, file_name))
for file_name in self.dic_exp_conf["TRAFFIC_FILE"]:
shutil.copy(os.path.join(self.dic_path["PATH_TO_DATA"], file_name),
os.path.join(path, file_name))
def _copy_anon_file(self, path=None):
# hard code !!!
if path == None:
path = self.dic_path["PATH_TO_WORK_DIRECTORY"]
# copy sumo files
shutil.copy(os.path.join(self.dic_path["PATH_TO_DATA"], self.dic_exp_conf["TRAFFIC_FILE"][0]),
os.path.join(path, self.dic_exp_conf["TRAFFIC_FILE"][0]))
shutil.copy(os.path.join(self.dic_path["PATH_TO_DATA"], self.dic_exp_conf["ROADNET_FILE"]),
os.path.join(path, self.dic_exp_conf["ROADNET_FILE"]))
def _modify_sumo_file(self, path=None):
if path == None:
path = self.dic_path["PATH_TO_WORK_DIRECTORY"]
# modify sumo files
self._set_traffic_file(os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "cross.sumocfg"),
os.path.join(path, "cross.sumocfg"),
self.dic_exp_conf["TRAFFIC_FILE"])
def __init__(self, dic_exp_conf, dic_agent_conf, dic_traffic_env_conf, dic_path):
# load configurations
self.dic_exp_conf = dic_exp_conf
self.dic_agent_conf = dic_agent_conf
self.dic_traffic_env_conf = dic_traffic_env_conf
self.dic_path = dic_path
# do file operations
self._path_check()
self._copy_conf_file()
if self.dic_traffic_env_conf["SIMULATOR_TYPE"] == 'sumo':
self._copy_sumo_file()
self._modify_sumo_file()
elif self.dic_traffic_env_conf["SIMULATOR_TYPE"] == 'anon':
self._copy_anon_file()
# test_duration
self.test_duration = []
def early_stopping(self, dic_path, cnt_round):
print("decide whether to stop")
record_dir = os.path.join(dic_path["PATH_TO_WORK_DIRECTORY"], "test_round", "round_"+str(cnt_round))
# compute duration
df_vehicle_inter_0 = pd.read_csv(os.path.join(record_dir, "vehicle_inter_0.csv"),
sep=',', header=0, dtype={0: str, 1: float, 2: float},
names=["vehicle_id", "enter_time", "leave_time"])
duration = df_vehicle_inter_0["leave_time"].values - df_vehicle_inter_0["enter_time"].values
ave_duration = np.mean([time for time in duration if not isnan(time)])
self.test_duration.append(ave_duration)
if len(self.test_duration) < 30:
return 0
else:
duration_under_exam = np.array(self.test_duration[-15:])
mean_duration = np.mean(duration_under_exam)
std_duration = np.std(duration_under_exam)
max_duration = np.max(duration_under_exam)
if std_duration/mean_duration < 0.1 and max_duration < 1.5 * mean_duration:
return 1
else:
return 0
def generator_wrapper(self, cnt_round, cnt_gen, dic_path, dic_exp_conf, dic_agent_conf, dic_traffic_env_conf,
best_round=None):
generator = Generator(cnt_round=cnt_round,
cnt_gen=cnt_gen,
dic_path=dic_path,
dic_exp_conf=dic_exp_conf,
dic_agent_conf=dic_agent_conf,
dic_traffic_env_conf=dic_traffic_env_conf,
best_round=best_round
)
print("make generator")
generator.generate()
print("generator_wrapper end")
return
def updater_wrapper(self, cnt_round, dic_agent_conf, dic_exp_conf, dic_traffic_env_conf, dic_path, best_round=None, bar_round=None):
updater = Updater(
cnt_round=cnt_round,
dic_agent_conf=dic_agent_conf,
dic_exp_conf=dic_exp_conf,
dic_traffic_env_conf=dic_traffic_env_conf,
dic_path=dic_path,
best_round=best_round,
bar_round=bar_round
)
updater.load_sample()
updater.update_network()
print("updater_wrapper end")
return
def model_pool_wrapper(self, dic_path, dic_exp_conf, cnt_round):
model_pool = ModelPool(dic_path, dic_exp_conf)
model_pool.model_compare(cnt_round)
model_pool.dump_model_pool()
return
#self.best_round = model_pool.get()
#print("self.best_round", self.best_round)
def downsample(self, path_to_log):
path_to_pkl = os.path.join(path_to_log, "inter_0.pkl")
f_logging_data = open(path_to_pkl, "rb")
logging_data = pickle.load(f_logging_data)
subset_data = logging_data[::10]
f_logging_data.close()
os.remove(path_to_pkl)
f_subset = open(path_to_pkl, "wb")
pickle.dump(subset_data, f_subset)
f_subset.close()
def run(self, multi_process=False):
best_round, bar_round = None, None
# pretrain for acceleration
if self.dic_exp_conf["PRETRAIN"]:
if os.listdir(self.dic_path["PATH_TO_PRETRAIN_MODEL"]):
shutil.copy(os.path.join(self.dic_path["PATH_TO_PRETRAIN_MODEL"],
"%s.h5" % self.dic_exp_conf["TRAFFIC_FILE"][0]),
os.path.join(self.dic_path["PATH_TO_MODEL"], "round_0.h5"))
else:
if not os.listdir(self.dic_path["PATH_TO_PRETRAIN_WORK_DIRECTORY"]):
for cnt_round in range(self.dic_exp_conf["PRETRAIN_NUM_ROUNDS"]):
print("round %d starts" % cnt_round)
process_list = []
# ============== generator =============
if multi_process:
for cnt_gen in range(self.dic_exp_conf["PRETRAIN_NUM_GENERATORS"]):
p = Process(target=self.generator_wrapper,
args=(cnt_round, cnt_gen, self.dic_path, self.dic_exp_conf,
self.dic_agent_conf, self.dic_sumo_env_conf, best_round)
)
print("before")
p.start()
print("end")
process_list.append(p)
print("before join")
for p in process_list:
p.join()
print("end join")
else:
for cnt_gen in range(self.dic_exp_conf["PRETRAIN_NUM_GENERATORS"]):
self.generator_wrapper(cnt_round=cnt_round,
cnt_gen=cnt_gen,
dic_path=self.dic_path,
dic_exp_conf=self.dic_exp_conf,
dic_agent_conf=self.dic_agent_conf,
dic_sumo_env_conf=self.dic_sumo_env_conf,
best_round=best_round)
# ============== make samples =============
# make samples and determine which samples are good
train_round = os.path.join(self.dic_path["PATH_TO_PRETRAIN_WORK_DIRECTORY"], "train_round")
if not os.path.exists(train_round):
os.makedirs(train_round)
cs = ConstructSample(path_to_samples=train_round, cnt_round=cnt_round,
dic_sumo_env_conf=self.dic_sumo_env_conf)
cs.make_reward()
if self.dic_exp_conf["MODEL_NAME"] in self.dic_exp_conf["LIST_MODEL_NEED_TO_UPDATE"]:
if multi_process:
p = Process(target=self.updater_wrapper,
args=(0,
self.dic_agent_conf,
self.dic_exp_conf,
self.dic_sumo_env_conf,
self.dic_path,
best_round))
p.start()
p.join()
else:
self.updater_wrapper(cnt_round=0,
dic_agent_conf=self.dic_agent_conf,
dic_exp_conf=self.dic_exp_conf,
dic_sumo_env_conf=self.dic_sumo_env_conf,
dic_path=self.dic_path,
best_round=best_round)
# train with aggregate samples
if self.dic_exp_conf["AGGREGATE"]:
if "aggregate.h5" in os.listdir("model/initial"):
shutil.copy("model/initial/aggregate.h5",
os.path.join(self.dic_path["PATH_TO_MODEL"], "round_0.h5"))
else:
if multi_process:
p = Process(target=self.updater_wrapper,
args=(0,
self.dic_agent_conf,
self.dic_exp_conf,
self.dic_sumo_env_conf,
self.dic_path,
best_round))
p.start()
p.join()
else:
self.updater_wrapper(cnt_round=0,
dic_agent_conf=self.dic_agent_conf,
dic_exp_conf=self.dic_exp_conf,
dic_sumo_env_conf=self.dic_sumo_env_conf,
dic_path=self.dic_path,
best_round=best_round)
self.dic_exp_conf["PRETRAIN"] = False
self.dic_exp_conf["AGGREGATE"] = False
# train
for cnt_round in range(self.dic_exp_conf["NUM_ROUNDS"]):
print("round %d starts" % cnt_round)
round_start_t = time.time()
process_list = []
# ============== generator =============
if multi_process:
for cnt_gen in range(self.dic_exp_conf["NUM_GENERATORS"]):
p = Process(target=self.generator_wrapper,
args=(cnt_round, cnt_gen, self.dic_path, self.dic_exp_conf,
self.dic_agent_conf, self.dic_traffic_env_conf, best_round)
)
p.start()
process_list.append(p)
for i in range(len(process_list)):
p = process_list[i]
p.join()
else:
for cnt_gen in range(self.dic_exp_conf["NUM_GENERATORS"]):
self.generator_wrapper(cnt_round=cnt_round,
cnt_gen=cnt_gen,
dic_path=self.dic_path,
dic_exp_conf=self.dic_exp_conf,
dic_agent_conf=self.dic_agent_conf,
dic_traffic_env_conf=self.dic_traffic_env_conf,
best_round=best_round)
# ============== make samples =============
# make samples and determine which samples are good
train_round = os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "train_round")
if not os.path.exists(train_round):
os.makedirs(train_round)
cs = ConstructSample(path_to_samples=train_round, cnt_round=cnt_round,
dic_traffic_env_conf=self.dic_traffic_env_conf)
cs.make_reward()
# EvaluateSample()
# ============== update network =============
if self.dic_exp_conf["MODEL_NAME"] in self.dic_exp_conf["LIST_MODEL_NEED_TO_UPDATE"]:
if multi_process:
p = Process(target=self.updater_wrapper,
args=(cnt_round,
self.dic_agent_conf,
self.dic_exp_conf,
self.dic_traffic_env_conf,
self.dic_path,
best_round,
bar_round))
p.start()
p.join()
else:
self.updater_wrapper(cnt_round=cnt_round,
dic_agent_conf=self.dic_agent_conf,
dic_exp_conf=self.dic_exp_conf,
dic_traffic_env_conf=self.dic_traffic_env_conf,
dic_path=self.dic_path,
best_round=best_round,
bar_round=bar_round)
if not self.dic_exp_conf["DEBUG"]:
for cnt_gen in range(self.dic_exp_conf["NUM_GENERATORS"]):
path_to_log = os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "train_round",
"round_" + str(cnt_round), "generator_" + str(cnt_gen))
self.downsample(path_to_log)
# ============== test evaluation =============
if multi_process:
p = Process(target=model_test.test,
args=(self.dic_path["PATH_TO_MODEL"], cnt_round, self.dic_exp_conf["TEST_RUN_COUNTS"], self.dic_traffic_env_conf, False))
p.start()
if self.dic_exp_conf["EARLY_STOP"] or self.dic_exp_conf["MODEL_POOL"]:
p.join()
else:
model_test.test(self.dic_path["PATH_TO_MODEL"], cnt_round, self.dic_exp_conf["RUN_COUNTS"], self.dic_traffic_env_conf, if_gui=False)
# ============== early stopping =============
if self.dic_exp_conf["EARLY_STOP"]:
flag = self.early_stopping(self.dic_path, cnt_round)
if flag == 1:
break
# ============== model pool evaluation =============
if self.dic_exp_conf["MODEL_POOL"]:
if multi_process:
p = Process(target=self.model_pool_wrapper,
args=(self.dic_path,
self.dic_exp_conf,
cnt_round),
)
p.start()
p.join()
else:
self.model_pool_wrapper(dic_path=self.dic_path,
dic_exp_conf=self.dic_exp_conf,
cnt_round=cnt_round)
model_pool_dir = os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "best_model.pkl")
if os.path.exists(model_pool_dir):
model_pool = pickle.load(open(model_pool_dir, "rb"))
ind = random.randint(0, len(model_pool) - 1)
best_round = model_pool[ind][0]
ind_bar = random.randint(0, len(model_pool) - 1)
flag = 0
while ind_bar == ind and flag < 10:
ind_bar = random.randint(0, len(model_pool) - 1)
flag += 1
# bar_round = model_pool[ind_bar][0]
bar_round = None
else:
best_round = None
bar_round = None
# downsample
if not self.dic_exp_conf["DEBUG"]:
path_to_log = os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "test_round",
"round_" + str(cnt_round))
self.downsample(path_to_log)
else:
best_round = None
print("best_round: ", best_round)
print("round %s ends" % cnt_round)
round_end_t = time.time()
f_timing = open(os.path.join(self.dic_path["PATH_TO_WORK_DIRECTORY"], "timing.txt"), "a+")
f_timing.write("round_{0}: {1}\n".format(cnt_round, round_end_t-round_start_t))
f_timing.close()
| [
"gjzheng93@gmail.com"
] | gjzheng93@gmail.com |
e68b9f0416ab724289de3fcc938fffcdf47559ee | de74221e4e4af95c0f29fc09f753bb216d3debaa | /narratives.py | ea24d718887567bc7cba731150a9c069620f821c | [] | no_license | marleysudbury/PapaKirill | 067db7b3cc5f4bf7abc633fe46730fe345ee6f00 | 992c7caa316cfc6ea5dcc961e3a07c8401dffa11 | refs/heads/master | 2020-04-01T09:55:42.108419 | 2018-10-29T23:39:51 | 2018-10-29T23:39:51 | 153,095,391 | 0 | 0 | null | 2018-10-25T02:11:20 | 2018-10-15T10:34:11 | Python | UTF-8 | Python | false | false | 953 | py | import player
import map
def demo(room_ver):
if room_ver == 0 and player.current_room == map.rooms["Papa Kirill's"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Papa Kirill's"]["version"] = 1
if room_ver == 0 and player.current_room == map.rooms["Andy's Jazz Club"] and len(player.current_room["rooms"][room_ver]['characters']) == 0:
map.rooms["Andy's Jazz Club"]["version"] = 1
if room_ver == 1 and player.current_room == map.rooms["Andy's Jazz Club"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Alleyway"]["version"] = 1
if room_ver == 1 and player.current_room == map.rooms["Alleyway"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Alleyway"]["version"] = 2
if player.current_room == map.rooms["Papa Kirill's"] and len(player.evidence) == 7:
global win_condition
win_condition = True
| [
"j.bateman@techie.com"
] | j.bateman@techie.com |
7c49d66b14f18ebed39db0587fa286f3def31a72 | dacfac84e2f3665ef3c13b16f99ea8fc8c8dc049 | /onnx/backend/test/case/node/spacetodepth.py | 8d03103c011c4bced0f9aa078177ef0bb169f13f | [
"Apache-2.0"
] | permissive | AlexandreEichenberger/onnx | 37ad194e553f5262c1c76d5912c6879614250543 | e2072611aaac0f86414f4b5cc69d8496a86cc5fd | refs/heads/master | 2023-02-24T04:32:16.824519 | 2021-12-15T23:46:57 | 2021-12-15T23:46:57 | 243,090,562 | 2 | 0 | MIT | 2020-02-25T20:00:38 | 2020-02-25T20:00:37 | null | UTF-8 | Python | false | false | 1,966 | py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class SpaceToDepth(Base):
@staticmethod
def export(): # type: () -> None
b, c, h, w = shape = (2, 2, 6, 6)
blocksize = 2
node = onnx.helper.make_node(
'SpaceToDepth',
inputs=['x'],
outputs=['y'],
blocksize=blocksize,
)
x = np.random.random_sample(shape).astype(np.float32)
tmp = np.reshape(x, [b, c,
h // blocksize, blocksize,
w // blocksize, blocksize])
tmp = np.transpose(tmp, [0, 3, 5, 1, 2, 4])
y = np.reshape(tmp, [b, c * (blocksize**2),
h // blocksize,
w // blocksize])
expect(node, inputs=[x], outputs=[y],
name='test_spacetodepth')
@staticmethod
def export_example(): # type: () -> None
node = onnx.helper.make_node(
'SpaceToDepth',
inputs=['x'],
outputs=['y'],
blocksize=2,
)
# (1, 1, 4, 6) input tensor
x = np.array([[[[0, 6, 1, 7, 2, 8],
[12, 18, 13, 19, 14, 20],
[3, 9, 4, 10, 5, 11],
[15, 21, 16, 22, 17, 23]]]]).astype(np.float32)
# (1, 4, 2, 3) output tensor
y = np.array([[[[0, 1, 2],
[3, 4, 5]],
[[6, 7, 8],
[9, 10, 11]],
[[12, 13, 14],
[15, 16, 17]],
[[18, 19, 20],
[21, 22, 23]]]]).astype(np.float32)
expect(node, inputs=[x], outputs=[y],
name='test_spacetodepth_example')
| [
"noreply@github.com"
] | AlexandreEichenberger.noreply@github.com |
ea4581d7365b9eb409c23a5a38400e4a215418e4 | a325861403c579e508237b8ac1d65b980272b42c | /12_файлы_и_папки/4_sgfbp.py | 170293ddafa7972fd4bc8c0dae6185fcf54721d3 | [] | no_license | emeshch/peer_code_review_2018 | 9fd5f7f8fc5380d2544f46592e3753086747887c | aa5ac299facc093ed621952fe773176234db7cc9 | refs/heads/master | 2021-06-24T16:45:16.452666 | 2018-06-09T07:47:43 | 2018-06-09T07:47:43 | 136,701,853 | 0 | 2 | null | 2018-06-10T08:16:27 | 2018-06-09T07:41:17 | Python | UTF-8 | Python | false | false | 1,293 | py | ##regex = '[a-zA-Z]'
##Программа должна просмотреть все папки и файлы, находящиеся в одной папке с ней, и сообщить следующую информацию (а также смотрите дополнительное задание внизу!):
##Сколько найдено файлов, название которых состоит только из латинских символов
##Кроме этого, программа должна выводить на экран названия всех файлов или папок, которые она нашла, без повторов (это задание на 9 и 10).
import os
import re
def latin():
print('Все файлы и папки:')
l = []
file_list = os.listdir()
for file in file_list:
print(file)
r = re.search('^[a-zA-Z]+?', file)
if r and os.path.isfile(file):
l.append(file)
return l
def counter(spisok):
k = len(spisok)
return k
def main():
a = latin()
print('')
print('Найдено файлов:', counter(a))
for file in a:
print(file)
if __name__ == '__main__':
main()
| [
"emesch@emesch.local"
] | emesch@emesch.local |
c7aae52e1c4139f6a0ea563819675a997c211520 | bf958d7cfbfc0b800483337905ddb6e4e90fcc7f | /transformImage.py | 94a1a294728ff90c7c3b09dd3a8d78368db61289 | [
"MIT"
] | permissive | davidkleiven/Transform3DImage | de5b41cdbb769db233780420ae14ede464e93b03 | e40c57a3c8dbc95561c9f99aa817e8b0e8303bb1 | refs/heads/master | 2020-04-06T04:43:36.711040 | 2017-05-02T10:40:20 | 2017-05-02T10:40:20 | 82,893,359 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,530 | py | import sys
import tkinter as tk
import transform3DApp as tf3
import numpy as np
def extractDimensions( fname ):
splitFname = fname.split("_")
if ( len(splitFname) != 5 ):
msg = "Unexpected format of the filename. Should be prefix_resolution_Nx_Ny_Nz.raw"
raise( Exception(msg) )
res = int( splitFname[1] )
Nx = int( splitFname[2] )
Ny = int( splitFname[3] )
Nz = int( splitFname[4].split(".")[0] )
return res, Nx, Ny, Nz
def main( argv ):
if ( len(argv) < 1 ) or ( len(argv) > 2 ):
print ( "Usage: python3 transformImage.py rawBinaryFile.raw --order=(C,F)" )
return
fname = argv[0]
order = "C"
for arg in argv:
if ( arg.find("--order=") != -1 ):
order = arg.split("--order=")[1]
try:
root = tk.Tk()
root.wm_title("3D Image Transformer")
ci = tf3.ControlInterface( root )
res, Nx, Ny, Nz = extractDimensions( fname )
ci.img.pixels = np.fromfile(fname, dtype=np.uint8)
ci.img.prefix = fname.split("_")[0]+"Rotated"
ci.img.resolution = res
ci.img.order = order
if ( len(ci.img.pixels) != Nx*Ny*Nz ):
print ("Expected length: %d. Length of array from file %d"%(Nx*Ny*Nz, len(ci.img.pixels)))
return 1
ci.img.pixels = ci.img.pixels.reshape((Nx,Ny,Nz), order=order)
root.mainloop()
except Exception as exc:
print (str(exc))
return 1
return 0
if __name__ == "__main__":
main( sys.argv[1:] )
| [
"davidkleiven446@gmail.com"
] | davidkleiven446@gmail.com |
d753782d4f379fb6ccbb83b806ce84e3b5086228 | 1b0efb2174c9ee5f67ef2241b0903718463b563f | /Palindrom_Validator/terminal.py | 7997f4d18c12c5e1a7eb4097a70efa2a9443b423 | [] | no_license | nakuldave/Python | 147efc552d8af5b2601ee215c99f44e39e300ea5 | 00634d9c730d7e73323d0a40e2479c2512729788 | refs/heads/master | 2021-01-18T02:22:02.335995 | 2013-03-08T08:46:21 | 2013-03-08T08:46:21 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Python | false | false | 910 | py | # -*- coding: cp1252 -*-
def main():
repeat = 'j'
while repeat == 'j':
#Börjar med att konvertera texten till
#uppercase eftersom den är casesensetive i if-satsen
text = raw_input("Mata in ett ord: ").upper()
x = ""
print '------------------------------------'
for a in text:
print a+' ['+str(i)+']'
if a in '!,.?#%&/()=*^" ':
a = ""
x += a
y = x[::-1]
print '------------------------------------'
print x, 'blir, ', y, ' baklänges'
if x == y:
print "True, detta är ett palindrom"
else:
print "False, detta är inte ett palindrom"
print '------------------------------------'
repeat = raw_input('Köra programmet engång till? j / n: ')
main()
| [
"hallgren.mikael@gmail.com"
] | hallgren.mikael@gmail.com |
a9e2a95a7a383053be938997ad0b14fe1787f7e4 | 4c535d2c7b76955b014ed87f06f5a9f078730fa7 | /test_recursive.py | 2ff88173ac3c93ff37d9ad1c8cfcb1565094ead0 | [] | no_license | jennyChing/onlineJudge | cf750b5b68456f8949bed0429c3b4a328ca2eeea | 0d317db29c21a9faec7a7cf43de5fa03fda50b3e | refs/heads/master | 2020-04-06T06:56:34.850903 | 2016-08-21T23:38:08 | 2016-08-21T23:38:08 | 52,972,907 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 262 | py | def rec(n ,memo):
if n in memo:
return memo[n]
else:
temp = 0
for i in range(n):
temp += 1
memo[n] = temp
print(memo)
return memo[n]
if __name__ == '__main__':
memo = {}
print(rec(2, memo))
| [
"jklife3@gmail.com"
] | jklife3@gmail.com |
7659326354491ce92828a2acfc49e90744fc607a | 407b13a53539f847af77007406bc2422e4192772 | /hangman.py | b57abe8bea2e0c61ddb3cdb238d0896556042f81 | [] | no_license | captainangela/hangman | d6924abd449a11a92f6c3e663b307407ea15211d | 5f128017765d195395c516d97b531b26ffbcb890 | refs/heads/master | 2020-05-26T17:07:29.630862 | 2017-03-04T19:17:10 | 2017-03-04T19:17:10 | 82,497,398 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,608 | py | # 1. create a list of words
# 2. have a welcome screen for the player with the stand (? I forget the word for it) drawn out
# 3. have the computer randomly pick a word
# 4. count the characters in the word and print the corresponding number of on the screen _ _ _ _
# 5. ask the player to guess a letter
# 6. see if the letter is in the word or not
# 7. if the letter is in the word, reveal the letter and it's location
# 8. else print a part of the man's body
# 9. if the user does not guess the word in the amount of body parts, show's a dead man
# 10. asks the user if they want to play again
#things to add:
# user has 7 guesses
# categories of words
# guess the word in the middle of letter guesses
# ask the user if they want to play again
# prevent them from typing multiple letters at a time
import sys
import constants
def update_display (random_word, display, letter):
for idx, val in enumerate(constants.random_word):
if letter == val:
display[idx] = letter
return display
def check_if_won(word_display):
if '_' not in word_display:
print "Wowza! You've got it!"
new_game()
def opening_display():
print constants.HANGMANPICS[0] + "\n\033[5;32;40m %s \033[m\n" % "Welcome to Hangwoman!"
print "_ " * constants.random_length + '\n'
def check_input_errors(guess, guesses):
if guess in guesses:
return "You've already guessed that."
elif guess == 'exit':
sys.exit()
elif len(guess) > 1:
return "You can only guess 1 letter at a time."
elif not guess.isalpha():
return "You can only put in letters."
else:
return False
def play_hangman():
num_wrong_guesses = 0
guesses = {}
random_word_list = list(constants.random_word)
word_display = list("_"*constants.random_length)
while num_wrong_guesses < constants.GUESS_MAX:
guess = raw_input("What letter would you like to guess? ").lower()
error = check_input_errors(guess, guesses)
guesses[guess] = True
if error:
print error
continue
if guess in random_word_list:
print constants.HANGMANPICS[num_wrong_guesses] + '\n'
word_display = update_display(constants.random_word, word_display, guess)
print word_display #how to print without the quotations and commas
print "\nYep! That letter is in there!\n"
check_if_won(word_display)
elif guess == 'exit':
sys.exit()
else:
num_wrong_guesses += 1
print constants.HANGMANPICS[num_wrong_guesses] + "\n"
print word_display
print "\n\nSorry, guess again."
print "Oh shucks, you've died!"
opening_display()
play_hangman()
| [
"angelalui@angelas-MacBook-Air.local"
] | angelalui@angelas-MacBook-Air.local |
ac17fa48d8db4ad167eba473385c9d956552129f | b69f40757881056db1def0c3a089b5c8d236fb7c | /backend/geoflask/views/layer.py | e98fb4ea9dc638b463bff53245a1983b23ee95f6 | [
"MIT"
] | permissive | PranjalGupta2199/Map-It | 075ad1f1ee6c629fe58a9ae37a797fdd51716f54 | 8182f30d2730a5051d6bc747eaee1106f1fd4268 | refs/heads/master | 2020-05-29T13:49:22.388794 | 2019-10-24T14:17:34 | 2019-10-28T22:38:48 | 189,174,291 | 0 | 1 | MIT | 2020-01-17T15:28:01 | 2019-05-29T07:33:07 | JavaScript | UTF-8 | Python | false | false | 607 | py | import requests as req
from flask import Flask, Blueprint,request,json
from ..app import geoInterface
layer = Blueprint("layer", __name__)
server = geoInterface.GeoServer.link
auth = geoInterface.GeoServer().get_auth()
@layer.route('/layer', methods=['GET'])
def get():
name = request.args.get('layer')
if name is None:
layerLink = server + ('/layers')
else :
layerLink = server + ('/layers/{}'.format(name))
resp = req.get(url=layerLink, auth=auth).json()
try:
return json.jsonify(resp['layers']['layer'])
except:
return json.jsonify(resp) | [
"pranjalgupta2199@gmail.com"
] | pranjalgupta2199@gmail.com |
5bb8aae9fa857751abeaafee55c8a9b7686cb464 | a339b86ac6c9aaad7ca2e81cba2c28adb9db1d27 | /poetry_generator.py | db5ea7dabf19f368013c5d9ec073ec92e0ccb690 | [] | no_license | s16497Michal/NAI | bc57835c5ec84748c1395a9eeb6e727117804336 | 810eeaaadd20aacb12e7e43e89690a6ff8f6acd5 | refs/heads/master | 2023-03-03T04:11:43.709541 | 2021-02-12T20:40:05 | 2021-02-12T20:40:05 | 308,036,480 | 0 | 1 | null | 2020-12-04T21:38:10 | 2020-10-28T14:08:24 | Python | UTF-8 | Python | false | false | 2,644 | py | '''
Autorzy: Michał Kosiński s16497 i Aleksandra Formela s17402
Instrukcja przygotowania środowiska:
Używamy konsoli systemowej i wpsiujemy w niej komendę: pip install tensorflow, pip install numpy
Materiały pomocnicze:
https://medium.com/predict/creating-a-poem-writer-ai-using-keras-and-tensorflow-16eac157cba6
https://towardsdatascience.com/creating-poems-from-ones-own-poems-neural-networks-and-life-paradoxes-a9cffd2b07e3
https://www.youtube.com/watch?v=ZMudJXhsUpY
'''
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirectional
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.optimizers import Adam
import numpy as np
# obróbka danych przed procesowaniem
tokenizer = Tokenizer()
data = open('mickiewicz_poetry.txt', encoding='utf-8').read()
corpus = data.lower().split('\n')
tokenizer.fit_on_texts(corpus)
total_words = len(tokenizer.word_index) + 1
# obróbka danych (dodanie do sekwencji oraz nadanie tokenów)
input_sequence = []
for line in corpus:
token_list = tokenizer.texts_to_sequences([line])[0]
for i in range(1, len(token_list)):
n_gram_sequence = token_list[:i+1]
input_sequence.append(n_gram_sequence)
# tworzenie sekwencji słów wejściowych jako baza do uczenia sieci
max_sequence_len = max([len(x) for x in input_sequence])
input_sequence = np.array(pad_sequences(input_sequence, maxlen=max_sequence_len, padding='pre'))
xs, labels = input_sequence[:, :-1], input_sequence[:, -1]
ys = tf.keras.utils.to_categorical(labels, num_classes=total_words)
# tworzenie modelu
model = Sequential()
model.add(Embedding(total_words, 100, input_length=max_sequence_len-1))
model.add(Bidirectional(LSTM(150)))
model.add(Dense(total_words, activation='softmax'))
adam = Adam(lr=0.01)
model.compile(loss='categorical_crossentropy', optimizer=adam, metrics=['accuracy'])
history = model.fit(xs, ys, epochs=100, verbose=1)
# generowanie wiersza z określeniem ile ma zawierać słów i od jakiego słowa się zaczynać
seed_text = "Okryła rzeki ramiona"
next_words = 100
for _ in range(next_words):
token_list = tokenizer.texts_to_sequences([seed_text])[0]
token_list = pad_sequences([token_list], maxlen=max_sequence_len-1, padding='pre')
predicted = model.predict_classes(token_list, verbose=0)
output_word = ""
for word, index in tokenizer.word_index.items():
if index == predicted:
output_word = word
break
seed_text += " " + output_word
print(seed_text) | [
"michu@sie.skichu"
] | michu@sie.skichu |
2c99626c0a47dd8c9622add6edbe39e3690a2fe3 | 68585730d05b30a0fc4c7b73941a80cceab8fe8f | /gym_snake/envs/__init__.py | d93d56217f8b245ffaab834df1ccadfb98087c67 | [
"MIT"
] | permissive | boangri/gym-snake | 4c508f73b7d7dd612204cb87de65ae4e4acdf80c | ea64c200d20bd7b838017418de884f5ea88937ed | refs/heads/master | 2023-02-05T21:19:12.291038 | 2020-12-29T19:21:42 | 2020-12-29T19:21:42 | 294,216,688 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 47 | py | from gym_snake.envs.snake_env import SnakeEnv
| [
"xinu@yandex.ru"
] | xinu@yandex.ru |
0ed980a3166442c2014937693307f4163e59e504 | 3b593b412c663a34784b1f60ad07cd2ee6ef87d1 | /month01/python base/day18/review.py | 543ab31c1700ca0622a342c564a13937c09c7ba3 | [] | no_license | ShijieLiu-PR/Python_Learning | 88694bd44aeed4f8b022202c1065342bd17c26d2 | ed01cc0956120ea287c51667604db97ff563c829 | refs/heads/master | 2023-05-22T16:35:24.252313 | 2021-06-16T10:56:21 | 2021-06-16T10:56:21 | 337,445,284 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 339 | py | """
day17复习
函数式编程:用一系列函数解决问题,函数式一等公平。
--函数作为参数:将核心逻辑传入方法体,是该方法适用性更为广泛。
传入整数/小数/容器/自定义类的对象。
传入逻辑:方法
--函数作为返回值:
"""
| [
"shijie_liu@outlook.com"
] | shijie_liu@outlook.com |
874fc260533596b58d67e315c0fd653ccec55360 | c66ff30fc99d1d0b6ad2ccbc106d580731de3201 | /ex25.py | ca0798b4c23247be9817f0316850ae55505f9dfa | [] | no_license | mlambie/lpthw | 73df2daaa060f386910c4e5e25bd36faa65e0218 | d01dd4f1a606f4a38937e6bad9aab0b322df476f | refs/heads/master | 2020-05-20T18:33:54.358744 | 2019-07-19T08:38:48 | 2019-07-19T08:38:48 | 185,708,583 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 925 | py | def break_words(stuff):
""" This function will brea up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
""" Sorts the words."""
return sorted(words)
def print_first_word(words):
""" Prints the first word after popping it off."""
word = words.pop(0)
print(word)
def print_last_word(words):
""" Prints the last word after popping it off."""
words = words.pop(-1)
print(word)
def sort_sentence(sentence):
""" Takes in a full sentence and returns the sorted words."""
words = break_words(sentence)
return sort_words(words)
def print_first_and_last(sentence):
""" Prints the first and last words of the sentence."""
words = break_words(sentence)
print_first_word(words)
print_last_word(words)
def print_first_and_last_sorted(sentence):
""" Sorts the words then prints the first and last one."""
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words) | [
"mlambie@lambie.org"
] | mlambie@lambie.org |
12e28fa769ae0c7bb7c6f37e3784421c323f8526 | 73e6b803c54c5383545a672dfa4192cfc6605c7c | /webapp/models.py | 40768e64f5b93320efe56a3cb5b200c7c16ac7db | [] | no_license | tanishagupta2114/diagno | ee1da86105fb797916d83272b781430ecb40f447 | 644c913d7453523b57773da0f2fb9cbb56640960 | refs/heads/master | 2022-07-13T10:00:37.716624 | 2020-05-17T13:52:07 | 2020-05-17T13:52:07 | 263,547,415 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,872 | py | from django.db import models
class data1(models.Model):
firstname = models.CharField(max_length=30)
lastname = models.CharField(max_length=30)
username = models.CharField(max_length=30)
birthday = models.CharField(max_length=30)
gender = models.CharField(max_length=10)
qualification = models.CharField(max_length=30)
email = models.CharField(max_length=30)
state = models.CharField(max_length=30)
specialized = models.CharField(max_length=30)
experience = models.CharField(max_length=30)
license = models.CharField(max_length=30)
hospital = models.CharField(max_length=30)
fee = models.CharField(max_length=5)
res_code = models.CharField(max_length=10)
city = models.CharField(max_length=30)
password = models.CharField(max_length=30)
profilePicture = models.ImageField(upload_to='', default='hlo')
class patient(models.Model):
dr_name= models.ForeignKey(data1,on_delete=models.CASCADE,null=True)
name = models.CharField(max_length=30)
gender = models.CharField(max_length = 8)
age = models.IntegerField()
email = models.CharField(max_length = 50)
city = models.CharField(max_length=30)
state = models.CharField(max_length=30)
ph_no = models.IntegerField()
disease = models.CharField(max_length=100)
class merge(models.Model):
patient_id=models.IntegerField(default=None)
doctor_id=models.IntegerField(default=None)
p_email = models.CharField(max_length=50)
p_gender = models.CharField(max_length=8)
p_age = models.IntegerField()
p_ph_no = models.IntegerField()
dr_name= models.CharField(max_length=30)
dr_username = models.CharField(max_length=30,default=None)
p_disease = models.CharField(max_length=100)
a_date = models.DateField()
a_time = models.TimeField()
hospital_name = models.CharField(max_length=30)
| [
"ranjit45697@gmail.com"
] | ranjit45697@gmail.com |
be4893d3a57c116206de422912636595a4ef233e | fa53cd836823ed6432bda81829f3968874c7134d | /Otros/enumerate_zip.py | 96c7140f6426027bc60641679192f32d9bdf7775 | [] | no_license | AiTechOne/intro-python | a9b7ae9691d48b8f01fde32b298011f8f8eac103 | 73e41bbd14a56aacdcea1309792cc16999ef2d31 | refs/heads/main | 2023-04-11T21:08:11.986158 | 2021-05-06T14:25:55 | 2021-05-06T14:25:55 | 349,105,451 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 309 | py | # colores = ["rojo", "amarillo", "verde", "azul", "morado"]
# # for indice in range(len(colores)):
# # print(indice)
# # for color in colores:
# # print(color)
# # for i, color in enumerate(colores):
# # if i == 1:
# # print(color)
# # if color == "amarillo":
# # print(i)
| [
"felipe.tejada@pm.me"
] | felipe.tejada@pm.me |
3d95b894a74b47bf97178b053b71e17d0e20830a | 5ff9fcff1a81a132102ff7b2e086d2dd60f3e8ad | /mysite/settings.py | 6c2276436e4e07d7492dd8e0d7ce34e9b85a7866 | [] | no_license | simplelife5757/my-first-blog | 04923ee9c58b5a248d1c5478815659ea0929d07c | 19becc0e7b73c43185dac6acbb1d7823d5d08a17 | refs/heads/master | 2020-12-19T10:44:28.063663 | 2020-01-23T02:32:59 | 2020-01-23T02:32:59 | 235,710,234 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,185 | py | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.0.13.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'sf%$ei&!e5r+-byxrzqq$tjor02&oli!xdzxkcxjj5%b$4r-t$'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mysite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'ko'
TIME_ZONE = 'Asia/Seoul'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
| [
"jiwoo627@naver.com"
] | jiwoo627@naver.com |
c8d973155878a910225bf35d57e24cb6e6ea1465 | e33488b2030f832dac6b0367fa2f00331d2aa48f | /app.py | ce42610ce46da27fd0a19d434f9e8763ea57bf56 | [] | no_license | imfromspace/movie_collection_app | 4850a98efc0d5148d11ee29e33f1aa94e4a39cae | f240ba44eff507cedb63cb81196ade1161d1127d | refs/heads/main | 2023-04-01T19:30:56.294396 | 2021-04-09T12:25:50 | 2021-04-09T12:25:50 | 355,981,227 | 0 | 0 | null | 2021-04-09T12:20:55 | 2021-04-08T16:37:19 | Python | UTF-8 | Python | false | false | 1,189 | py | MENU_PROMPT = "\nEnter 'a' to add a movie, 'l' to see your movies, 'f' to find a movie by title, or 'q' to quit: "
movies = []
def add_movie():
title = input("Enter the movie title: ")
director = input("Enter the movie director: ")
year = input("Enter the movie release year: ")
movies.append({
'title': title.lower(),
'director': director.lower(),
'year': year
})
def print_movie(movie):
print(f"{movie['title'].title()} was released in {movie['year']} year and directed by {movie['director'].title()}.")
def list_movies():
for movie in movies:
print_movie(movie)
def find_movie():
search_query = input("Please enter the name/release date/director of the movie: ")
for movie in movies:
if search_query.lower() in movie.values():
print_movie(movie)
user_options = {
'a': add_movie,
'l': list_movies,
'f': find_movie
}
def menu():
command = input(MENU_PROMPT)
while command != 'q':
if command in user_options:
user_options[command]()
else:
print('Unknown command. Please try again.')
command = input(MENU_PROMPT)
menu()
| [
"igor.surgutanov@eca.kz"
] | igor.surgutanov@eca.kz |
e2a6311c653e2aae52316494b25c4e3c8bd0565b | 67c148ef0791d93ea46fa75ae6ecae038d1214e3 | /service/common/utils/launch.py | 3a98791e574aa25da02d8056e7fa5f8910ae2a00 | [] | no_license | monk0062006/business-law-pulse | cb37aa5ce32fe3a348ffaca0120c69efb4c74416 | 2b69699ff2ade0768a3425dcc17dd2e245eae022 | refs/heads/master | 2023-05-14T07:51:44.386221 | 2019-08-18T12:25:43 | 2019-08-18T12:25:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,025 | py | # -*- coding: utf-8 -*-
from core.utils import REDIS
import json,datetime
def get_launch():
launches = json.loads(REDIS['app'].get('push:launch') or '[]')
if not launches:
return None
now_time = datetime.datetime.now().timestamp()*1000
launches_c = launches[:]
for l in launches:
if l['end'] > now_time >= l['start']:
return {
'image': l.get('image'),
'countdown': l.get('countdown'),
'url': l.get('url'),
'expire': l.get('end')
}
elif now_time >= l['end']:
launches_c.pop(launches_c.index(l))
REDIS['app'].set('push:launch', json.dumps(launches_c))
elif now_time < l['start']:
return None
else:
return None
def rm_launch(key, image_url, prefix=None, launch_key='push:launch'):
key_comb = key + image_url
REDIS[prefix].delete(key_comb)
sorted_launches = get_sort_launches(key=key, prefix=prefix)
REDIS[prefix].set(launch_key, json.dumps(sorted_launches))
def get_launches(key, prefix=None):
if prefix:
launches = [':'.join(key.split(':')[1:]) for key in REDIS[prefix].scan_iter(key+'*')]
launches_value = [json.loads(REDIS[prefix].get(key)) for key in launches]
else:
launches = [':'.join(key.split(':')[1:]) for key in REDIS.scan_iter(key+'*')]
launches_value = [json.loads(REDIS.get(key)) for key in launches]
f = lambda x: x['timestamp']
slaunches = sorted(launches_value, key=f)
return slaunches
def get_sort_launches(key, prefix=None):
launches_value = get_launches(key, prefix=prefix)
launches = [l for l in launches_value if l['end'] > int(datetime.datetime.now().timestamp()*1000)]
f = lambda x: -x['timestamp']
slaunches = sorted(launches, key=f)
launche_ters = set()
for launch in launches:
launche_ters.add(launch['start'])
launche_ters.add(launch['end'])
launche_ters = sorted(list(launche_ters))
temp = None
sorted_launches = list()
for p in launche_ters:
pre = temp
temp = p
if pre:
now_time = datetime.datetime.now().timestamp()*1000
if now_time > p:
continue
avg = (pre + p)/2
for la in slaunches:
if la['end'] >= avg >= la['start']:
break
else:
continue
sorted_launches.append({
'start': pre,
'end': p,
'image': la.get('image'),
'countdown': la.get('countdown'),
'url': la.get('url'),
})
return sorted_launches
def set_launches(key, value, expire, prefix=None, launch_key='push:launch'):
key_comb = key + value['image']
REDIS[prefix].set(key_comb, json.dumps(value), ex=expire)
sorted_launches = get_sort_launches(key=key, prefix=prefix)
REDIS[prefix].set(launch_key, json.dumps(sorted_launches))
| [
"331338391@qq.com"
] | 331338391@qq.com |
b5adafc4a8a7afb1ff6dca2331d5d68f9bc0c972 | a8cd314af4c1d5ec4f322a19275e3a706b6844ee | /appimagecraft/builders/script.py | 1f0739d092a3edf06951b20e7bac6f7823a6e513 | [
"MIT"
] | permissive | TheAssassin/appimagecraft | f7b9ca60cde6170685effd1d1c2c1dfb457b6fb1 | 6b36fda05d50b356024bd3b12ca426ba73fe334b | refs/heads/master | 2023-08-03T14:12:53.063846 | 2023-07-20T15:42:59 | 2023-07-20T23:18:37 | 178,573,585 | 30 | 6 | MIT | 2023-07-20T23:18:38 | 2019-03-30T15:05:25 | Python | UTF-8 | Python | false | false | 849 | py | import os.path
from ..generators.bash_script import ProjectAwareBashScriptBuilder
from . import BuilderBase
from .._logging import get_logger
class ScriptBuilder(BuilderBase):
_script_filename = "build-script.sh"
def __init__(self, config: dict = None):
super().__init__(config)
self._logger = get_logger("script_builder")
@staticmethod
def from_dict(data: dict):
# TODO!
raise NotImplementedError()
def generate_build_script(self, project_root_dir: str, build_dir: str) -> str:
script_path = os.path.join(build_dir, self.__class__._script_filename)
generator = ProjectAwareBashScriptBuilder(script_path, project_root_dir, build_dir)
generator.add_lines(self._builder_config["commands"])
generator.build_file()
return os.path.basename(script_path)
| [
"theassassin@assassinate-you.net"
] | theassassin@assassinate-you.net |
6a09d63adf4949e8d274ef54f9459d0a81bfb80c | 8ee5dfd87ce637a46c496853f55d32f226b238f8 | /backend/Experiments/Data/PosControl/custom_PSO_z_lama.py | be9a21cc936388b629be751274c46dcef837e6c4 | [] | no_license | cholazzzb/react-parrotar2-swarm | 71eb6be8682e00015103af3df69a6cc01f7a919f | dccdfa841184af6ec62910f50c3335b812cd0201 | refs/heads/main | 2023-06-16T01:24:57.169242 | 2021-07-08T03:54:08 | 2021-07-08T03:54:08 | 354,490,913 | 0 | 0 | null | 2021-07-08T03:54:08 | 2021-04-04T08:15:37 | JavaScript | UTF-8 | Python | false | false | 8,788 | py | custom_PSO_z_lama = {"time":[0.07,0.22,0.36,0.5,0.64,0.78,0.93,1.07,1.21,1.35,1.49,1.64,1.78,1.92,2.06,2.2,2.34,2.49,2.63,2.77,2.91,3.05,3.2,3.34,3.48,3.62,3.77,3.91,4.05,4.19,4.34,4.48,4.62,4.76,4.9,5.04,5.19,5.33,5.47,5.61,5.75,5.9,6.04,6.18,6.32,6.46,6.6,6.75,6.89,7.03,7.17,7.31,7.45,7.6,7.74,7.88,8.02,8.17,8.31,8.45,8.59,8.73,8.87,9.02,9.16,9.3,9.45,9.58,9.72,9.87,10.01,10.15,10.3,10.43,10.58,10.72,10.86,11,11.14,11.28,11.43,11.57,11.71,11.85,11.99,12.14,12.28,12.42,12.56,12.7,12.84,12.99,13.13,13.27,13.41,13.55,13.7,13.84,13.98,14.12,14.26,14.41,14.55,14.69,14.83,14.97,15.11,15.26,15.4,15.54,15.68,15.82,15.96,16.11,16.25,16.39,16.53,16.67,16.82,16.96,17.1,17.24,17.38,17.52,17.67,17.81,17.95,18.09,18.23,18.38,18.52,18.66,18.8,18.94,19.09,19.23,19.37,19.51,19.65,19.79,19.94,20.08,20.22,20.36,20.5,20.64,20.79,20.93,21.07,21.21,21.36,21.5,21.64,21.78,21.92,22.06,22.2,22.35,22.49,22.63,22.77,22.91,23.06,23.2,23.34,23.48,23.62,23.76,23.91,24.05,24.19,24.33,24.47,24.62,24.76,24.9,25.04,25.18,25.32,25.47,25.61,25.75,25.89,26.03,26.18,26.32,26.46,26.6,26.74,26.89,27.03,27.17,27.31,27.45,27.59,27.73,27.88,28.01,28.16,28.3,28.58,28.72,28.87,29.01,29.15,29.29,29.43,29.58,29.72,29.86,30,30.14,30.29,30.43,30.57,30.71,30.85,30.99,31.14,31.28,31.42,31.56,31.71,31.85,31.99,32.13,32.27,32.41,32.56,32.7,32.84,32.98,33.12,33.26,33.41,33.55,33.69,33.83,33.97,34.12,34.26,34.4,34.54,34.68,34.83,34.97,35.11,35.25,35.39,35.53,35.68,35.82,35.96,36.1,36.24,36.39,36.53,36.67,36.81,36.95,37.09,37.24,37.38,37.52,37.66,37.81,37.95,38.09,38.23,38.37,38.52,38.66,38.8,38.94,39.08,39.22,39.37,39.51,39.65,39.79,39.94,40.08,40.22,40.36,40.5,40.64,40.79,40.93,41.07,41.21,41.35,41.49,41.64,41.78,41.92,42.06,42.2,42.35,42.49,42.63,42.77,42.91,43.05,43.2,43.34,43.48,43.62,43.77,43.91,44.05,44.19,44.33,44.47,44.62,44.76,44.9,45.04,45.18,45.46,45.6,45.75,45.89,46.03,46.17,46.31,46.45,47.02,47.16,47.3,47.45,47.59,47.73,47.87,48.01,48.16,48.3,48.44,48.58,48.72,48.87,49.01,49.15,49.29,49.43,49.57,49.72,49.86,50,50.14,50.28,50.43,50.57,50.71,50.85,50.99,51.13,51.28,51.42,51.56,51.7,51.84,52.13,52.84,52.98,53.12,53.26,53.4,53.55,53.69,53.83,53.97,54.11,54.25,54.4,54.54,54.68,54.82,55.11,55.25,55.39,55.53,55.68,55.82,55.96,56.1,56.24,56.39,56.53,56.67,56.81,56.95,57.1,57.24,57.38,57.52,57.66,57.8,57.95,58.09,58.23,58.37,58.51,58.66,58.8,58.94,59.08,59.22,59.37,59.51,59.65,59.79,59.93,60.07,60.22,60.36,60.5,60.64,60.78,60.92,61.07,61.21,61.35,61.49,61.63,61.78,61.92,62.06,62.2,62.34,62.49,62.63,62.77,62.91,63.05,63.19,63.34,63.48,63.62,63.76,63.9,64.04,64.19,64.33,64.47,64.61,64.75,64.9],"xPos":[0.938,0.937,0.935,0.938,0.938,0.932,0.939,0.95,0.942,0.929,0.934,0.939,0.934,0.932,0.932,0.932,0.938,0.923,0.937,0.935,0.934,0.933,0.923,0.918,0.912,0.924,0.934,0.956,0.974,0.982,0.979,0.987,0.977,0.992,0.992,0.99,0.999,1.005,1.017,1.017,1.042,1.084,1.146,1.203,1.272,1.366,1.444,1.533,1.619,1.722,1.813,1.897,1.98,2.046,2.107,2.164,2.212,2.246,2.273,2.29,2.294,2.285,2.264,2.233,2.198,2.149,2.095,2.039,1.976,1.908,1.849,1.788,1.734,1.694,1.633,1.601,1.586,1.581,1.591,1.607,1.63,1.662,1.712,1.767,1.829,1.897,1.978,2.033,2.098,2.161,2.216,2.266,2.302,2.329,2.342,2.341,2.323,2.303,2.273,2.234,2.186,2.128,2.089,1.997,1.921,1.855,1.788,1.721,1.648,1.608,1.583,1.564,1.559,1.564,1.582,1.61,1.644,1.69,1.779,1.83,1.897,1.973,2.05,2.127,2.201,2.261,2.313,2.349,2.379,2.393,2.39,2.387,2.369,2.342,2.301,2.263,2.211,2.151,2.086,2.015,1.943,1.877,1.84,1.74,1.69,1.661,1.632,1.629,1.633,1.686,1.697,1.733,1.778,1.833,1.89,1.949,2.01,2.065,2.119,2.168,2.202,2.238,2.249,2.249,2.236,2.212,2.179,2.132,2.078,2.014,1.946,1.878,1.813,1.764,1.725,1.697,1.685,1.683,1.696,1.723,1.763,1.81,1.866,1.926,1.987,2.046,2.096,2.132,2.166,2.186,2.192,2.188,2.169,2.143,2.105,2.065,2.011,1.95,1.894,1.834,1.834,1.662,1.626,1.598,1.581,1.58,1.582,1.595,1.619,1.648,1.681,1.723,1.768,1.82,1.865,1.918,1.964,2.006,2.045,2.078,2.093,2.099,2.101,2.093,2.07,2.033,2.009,1.974,1.95,1.919,1.909,1.901,1.91,1.924,1.943,1.968,1.999,2.027,2.045,2.049,2.044,2.029,2.007,1.971,1.929,1.889,1.839,1.788,1.746,1.714,1.692,1.684,1.682,1.701,1.728,1.766,1.811,1.868,1.916,1.966,2.009,2.048,2.079,2.104,2.12,2.132,2.14,2.146,2.145,2.145,2.141,2.135,2.122,2.098,2.072,2.038,1.997,1.945,1.905,1.855,1.804,1.756,1.736,1.709,1.693,1.686,1.689,1.702,1.723,1.752,1.784,1.81,1.853,1.89,1.934,1.969,2.006,2.044,2.064,2.089,2.102,2.107,2.111,2.105,2.095,2.075,2.058,2.035,2.008,1.98,1.958,1.937,1.928,1.925,1.927,1.937,1.968,2,2.076,2.107,2.125,2.136,2.138,2.128,2.11,2.074,1.879,1.824,1.762,1.7,1.639,1.586,1.549,1.526,1.52,1.529,1.546,1.579,1.617,1.668,1.711,1.763,1.815,1.867,1.913,1.952,1.988,2.011,2.038,2.055,2.062,2.073,2.062,2.049,2.025,2.007,1.986,1.962,1.945,1.927,1.917,1.903,1.926,1.931,1.94,1.943,1.943,1.939,1.928,1.911,1.887,1.872,1.86,1.848,1.843,1.848,1.864,1.914,1.947,1.982,2.016,2.052,2.071,2.096,2.106,2.098,2.078,2.058,2.021,1.984,1.939,1.887,1.83,1.791,1.754,1.728,1.709,1.713,1.728,1.756,1.794,1.84,1.888,1.934,1.982,2.017,2.046,2.059,2.063,2.045,2.019,1.976,1.919,1.852,1.794,1.731,1.678,1.63,1.597,1.577,1.571,1.581,1.606,1.646,1.702,1.772,1.85,1.931,2.025,2.108,2.2,2.286,2.364,2.434,2.498,2.548,2.594,2.624,2.643,2.65,2.642,2.62,2.584,2.533,2.481,2.416,2.342],"yPos":[1.264,1.266,1.265,1.264,1.265,1.26,1.262,1.264,1.264,1.265,1.266,1.264,1.244,1.253,1.235,1.257,1.264,1.268,1.269,1.27,1.272,1.271,1.263,1.258,1.263,1.257,1.27,1.277,1.266,1.266,1.271,1.275,1.285,1.29,1.306,1.324,1.329,1.339,1.351,1.38,1.385,1.385,1.379,1.367,1.347,1.326,1.292,1.244,1.198,1.173,1.129,1.104,1.077,1.079,1.088,1.108,1.136,1.176,1.224,1.275,1.335,1.386,1.44,1.482,1.516,1.538,1.549,1.544,1.531,1.505,1.476,1.431,1.379,1.306,1.269,1.205,1.146,1.076,1.024,0.982,0.948,0.934,0.926,0.942,0.967,1.005,1.051,1.141,1.227,1.314,1.393,1.466,1.531,1.584,1.626,1.642,1.639,1.628,1.602,1.566,1.521,1.462,1.433,1.344,1.278,1.224,1.176,1.134,1.104,1.085,1.048,1.026,1.004,0.992,0.988,0.997,1.026,1.065,1.115,1.183,1.266,1.365,1.453,1.527,1.594,1.634,1.662,1.671,1.667,1.638,1.606,1.556,1.501,1.433,1.363,1.292,1.22,1.158,1.097,1.05,1.004,0.972,0.92,0.971,0.971,0.993,1.019,1.064,1.112,1.167,1.222,1.285,1.338,1.392,1.44,1.466,1.49,1.497,1.484,1.459,1.418,1.382,1.322,1.26,1.197,1.139,1.083,1.045,1.01,0.998,0.999,1.02,1.057,1.1,1.168,1.241,1.318,1.395,1.469,1.532,1.578,1.61,1.626,1.625,1.604,1.564,1.516,1.454,1.389,1.321,1.238,1.173,1.104,1.04,0.99,0.944,0.918,0.905,0.895,0.907,0.907,1.041,1.11,1.188,1.271,1.349,1.424,1.488,1.535,1.577,1.596,1.598,1.584,1.55,1.504,1.436,1.367,1.287,1.228,1.132,1.057,0.988,0.928,0.878,0.846,0.839,0.834,0.847,0.871,0.916,0.958,1.01,1.072,1.14,1.221,1.301,1.377,1.451,1.515,1.581,1.639,1.684,1.715,1.727,1.728,1.717,1.7,1.672,1.634,1.58,1.525,1.456,1.384,1.304,1.218,1.132,1.045,0.976,0.913,0.851,0.8,0.772,0.759,0.764,0.792,0.831,0.888,0.95,1.028,1.114,1.216,1.326,1.435,1.55,1.658,1.758,1.848,1.915,1.986,2.032,2.065,2.081,2.091,2.078,2.048,1.997,1.939,1.859,1.763,1.652,1.546,1.438,1.319,1.217,1.109,1.009,0.912,0.82,0.746,0.686,0.641,0.612,0.597,0.6,0.612,0.646,0.688,0.741,0.803,0.875,0.965,1.051,1.16,1.265,1.362,1.464,1.55,1.612,1.728,1.762,1.783,1.794,1.791,1.785,1.767,1.731,1.555,1.508,1.459,1.422,1.385,1.347,1.319,1.295,1.269,1.257,1.228,1.213,1.194,1.175,1.142,1.104,1.074,1.04,1.009,0.99,0.983,0.973,0.983,0.995,1.017,1.054,1.099,1.154,1.217,1.297,1.373,1.448,1.521,1.577,1.645,1.738,1.749,1.721,1.678,1.643,1.594,1.544,1.481,1.414,1.342,1.275,1.213,1.145,1.081,1.018,0.974,0.872,0.844,0.818,0.791,0.775,0.767,0.767,0.772,0.781,0.793,0.82,0.85,0.895,0.943,1.004,1.076,1.146,1.223,1.312,1.391,1.479,1.568,1.651,1.72,1.775,1.818,1.845,1.854,1.857,1.849,1.824,1.798,1.766,1.707,1.657,1.599,1.535,1.469,1.394,1.321,1.241,1.181,1.113,1.051,1.006,0.971,0.929,0.918,0.901,0.886,0.882,0.886,0.88,0.907,0.944,0.996,1.064,1.148,1.241,1.334,1.44,1.536,1.631,1.717,1.795,1.859,1.902,1.944,1.978,1.995],"zPos":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]} | [
"nicsphehehe@gmail.com"
] | nicsphehehe@gmail.com |
d9a8d19b7a0fb7c4a5a70472c5d4259452f40dc9 | e73b80c82e224933f4b76a3284413b30e42de6b6 | /Numpy/series.py | ad3cdd8c9e145dd3d893c885947bda021d36c314 | [] | no_license | VarunKesarwani/PythonFinance | 076786eca57c9582c99970f5e6ce493b86b47bf8 | 9cd993f342012469b1c8d5b9c7d76fdfedd35c08 | refs/heads/master | 2021-05-20T21:11:34.389149 | 2020-06-27T16:26:05 | 2020-06-27T16:26:05 | 252,417,092 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 306 | py | import numpy as np
import Pandas as nypd
print(nypd.__version__)
labels = ['a','b','c']
my_list = [10,20,30]
arr = np.array([10,20,30])
d = {'a':10,'b':20,'c':30}
print(nypd.Series(data=my_list))
print(nypd.Series(data=my_list,index=labels))
print(nypd.Series(my_list,labels))
print(nypd.Series(arr)) | [
"varungupta.v@outlook.com"
] | varungupta.v@outlook.com |
6201007827edaf08e8e8897ca9a380cd6d22fc80 | 5beba520206b908f0715456d1b107be39f32a7ea | /Chapter_2/work_with_file.py | 2a57807d194b68509cea2a225d0313aa1d347933 | [] | no_license | disp1air/Programming_Python | 622c99e61b1c8bfe03807d104cd146a8329a26ce | ed3996d6d4f6bc35b2ddab6f1f08668b412b568b | refs/heads/master | 2021-05-01T11:24:47.677976 | 2018-02-22T18:32:05 | 2018-02-22T18:32:05 | 121,119,525 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 152 | py | file = open('text.txt', 'w')
file_symbols = file.write(('spam' * 2) + '\n')
print(file_symbols)
file = open('text.txt')
text = file.read()
print(text) | [
"hola-shola@mail.ru"
] | hola-shola@mail.ru |
2a8fb7143b5eb037a1e4bd48dafc7a573c3e7064 | 3ccc65a3bdac77de13621657c79d9ae232622c0e | /messagesapp/templatetags/messages_tags.py | 16e93601adbd4dd5837db30daca9a69066715200 | [] | no_license | fardinhakimi/django-messaging-app | 3fc2d58917ea493f09c80c2f80126665c16c2262 | e6aaaccf34bdc4d1f94e88b9bb8118d1c0212640 | refs/heads/master | 2021-05-13T12:36:35.168477 | 2018-01-22T00:05:47 | 2018-01-22T00:05:47 | 116,676,986 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 923 | py | from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from messagesapp.models import (Message, Conversation)
register = template.Library()
@register.simple_tag
def get_stats(user_id):
user = User.objects.get(pk=user_id)
sent_messages_count= Message.objects.filter(owner=user).count()
received_messages_count = Message.objects.filter(recipient=user).count()
return {
"sent_messages": sent_messages_count,
"conversations": user.conversations.all().count(),
"received_messages": received_messages_count
}
@register.simple_tag
def get_unread_messages(sender_id, user_id):
sender = User.objects.get(pk=sender_id)
recipient = User.objects.get(pk=user_id)
unread_messages_count = Message.objects.filter(owner=sender, recipient =recipient, read=False).count()
return unread_messages_count
| [
"fardinhakimi@gmail.com"
] | fardinhakimi@gmail.com |
613f055d9b61ec031ee51c6d5e3b947a197b19c1 | f40f3a484c26abe0a7d185f5436bf3912ddc5105 | /tensorflow/contrib/distributions/python/ops/categorical.py | 68e4cad73ce40da3613ee763333fe9ddbc9a8b21 | [
"Apache-2.0"
] | permissive | pcm17/tensorflow | 53b56995f2ba3308910831d73309a63716a34b3b | a0f669027666bdfe66b5602097939c309fa37d7f | refs/heads/master | 2020-12-03T04:09:56.528329 | 2017-04-19T18:46:20 | 2017-04-19T18:46:20 | 59,691,129 | 0 | 2 | null | 2017-04-19T18:46:20 | 2016-05-25T19:20:00 | C++ | UTF-8 | Python | false | false | 8,770 | py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by 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.
# ==============================================================================
"""The Categorical distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops import distribution
from tensorflow.contrib.distributions.python.ops import distribution_util
from tensorflow.contrib.distributions.python.ops import kullback_leibler
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import random_ops
class Categorical(distribution.Distribution):
"""Categorical distribution.
The categorical distribution is parameterized by the log-probabilities
of a set of classes.
#### Examples
Creates a 3-class distribution, with the 2nd class, the most likely to be
drawn from.
```python
p = [0.1, 0.5, 0.4]
dist = Categorical(probs=p)
```
Creates a 3-class distribution, with the 2nd class the most likely to be
drawn from, using logits.
```python
logits = [-50, 400, 40]
dist = Categorical(logits=logits)
```
Creates a 3-class distribution, with the 3rd class is most likely to be drawn.
The distribution functions can be evaluated on counts.
```python
# counts is a scalar.
p = [0.1, 0.4, 0.5]
dist = Categorical(probs=p)
dist.prob(0) # Shape []
# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts.
counts = [1, 0]
dist.prob(counts) # Shape [2]
# p will be broadcast to shape [3, 5, 7, 3] to match counts.
counts = [[...]] # Shape [5, 7, 3]
dist.prob(counts) # Shape [5, 7, 3]
```
"""
def __init__(
self,
logits=None,
probs=None,
dtype=dtypes.int32,
validate_args=False,
allow_nan_stats=True,
name="Categorical"):
"""Initialize Categorical distributions using class log-probabilities.
Args:
logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities
of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension
represents a vector of logits for each class. Only one of `logits` or
`probs` should be passed in.
probs: An N-D `Tensor`, `N >= 1`, representing the probabilities
of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension
represents a vector of probabilities for each class. Only one of
`logits` or `probs` should be passed in.
dtype: The type of the event samples (default: int32).
validate_args: Python `bool`, default `False`. When `True` distribution
parameters are checked for validity despite possibly degrading runtime
performance. When `False` invalid inputs may silently render incorrect
outputs.
allow_nan_stats: Python `bool`, default `True`. When `True`, statistics
(e.g., mean, mode, variance) use the value "`NaN`" to indicate the
result is undefined. When `False`, an exception is raised if one or
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
with ops.name_scope(name, values=[logits, probs]) as ns:
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits=logits,
probs=probs,
validate_args=validate_args,
multidimensional=True,
name=name)
logits_shape_static = self._logits.get_shape().with_rank_at_least(1)
if logits_shape_static.ndims is not None:
self._batch_rank = ops.convert_to_tensor(
logits_shape_static.ndims - 1,
dtype=dtypes.int32,
name="batch_rank")
else:
with ops.name_scope(name="batch_rank"):
self._batch_rank = array_ops.rank(self._logits) - 1
logits_shape = array_ops.shape(self._logits, name="logits_shape")
if logits_shape_static[-1].value is not None:
self._event_size = ops.convert_to_tensor(
logits_shape_static[-1].value,
dtype=dtypes.int32,
name="event_size")
else:
with ops.name_scope(name="event_size"):
self._event_size = logits_shape[self._batch_rank]
if logits_shape_static[:-1].is_fully_defined():
self._batch_shape_val = constant_op.constant(
logits_shape_static[:-1].as_list(),
dtype=dtypes.int32,
name="batch_shape")
else:
with ops.name_scope(name="batch_shape"):
self._batch_shape_val = logits_shape[:-1]
super(Categorical, self).__init__(
dtype=dtype,
reparameterization_type=distribution.NOT_REPARAMETERIZED,
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
parameters=parameters,
graph_parents=[self._logits,
self._probs],
name=ns)
@property
def event_size(self):
"""Scalar `int32` tensor: the number of classes."""
return self._event_size
@property
def logits(self):
"""Vector of coordinatewise logits."""
return self._logits
@property
def probs(self):
"""Vector of coordinatewise probabilities."""
return self._probs
def _batch_shape_tensor(self):
return array_ops.identity(self._batch_shape_val)
def _batch_shape(self):
return self.logits.get_shape()[:-1]
def _event_shape_tensor(self):
return constant_op.constant([], dtype=dtypes.int32)
def _event_shape(self):
return tensor_shape.scalar()
def _sample_n(self, n, seed=None):
if self.logits.get_shape().ndims == 2:
logits_2d = self.logits
else:
logits_2d = array_ops.reshape(self.logits, [-1, self.event_size])
samples = random_ops.multinomial(logits_2d, n, seed=seed)
samples = math_ops.cast(samples, self.dtype)
ret = array_ops.reshape(
array_ops.transpose(samples),
array_ops.concat([[n], self.batch_shape_tensor()], 0))
return ret
def _log_prob(self, k):
k = ops.convert_to_tensor(k, name="k")
if self.logits.get_shape()[:-1] == k.get_shape():
logits = self.logits
else:
logits = self.logits * array_ops.ones_like(
array_ops.expand_dims(k, -1), dtype=self.logits.dtype)
logits_shape = array_ops.shape(logits)[:-1]
k *= array_ops.ones(logits_shape, dtype=k.dtype)
k.set_shape(tensor_shape.TensorShape(logits.get_shape()[:-1]))
return -nn_ops.sparse_softmax_cross_entropy_with_logits(labels=k,
logits=logits)
def _prob(self, k):
return math_ops.exp(self._log_prob(k))
def _entropy(self):
return -math_ops.reduce_sum(
nn_ops.log_softmax(self.logits) * self.probs, axis=-1)
def _mode(self):
ret = math_ops.argmax(self.logits, dimension=self._batch_rank)
ret = math_ops.cast(ret, self.dtype)
ret.set_shape(self.batch_shape)
return ret
@kullback_leibler.RegisterKL(Categorical, Categorical)
def _kl_categorical_categorical(a, b, name=None):
"""Calculate the batched KL divergence KL(a || b) with a and b Categorical.
Args:
a: instance of a Categorical distribution object.
b: instance of a Categorical distribution object.
name: (optional) Name to use for created operations.
default is "kl_categorical_categorical".
Returns:
Batchwise KL(a || b)
"""
with ops.name_scope(name, "kl_categorical_categorical",
values=[a.logits, b.logits]):
# sum(probs log(probs / (1 - probs)))
delta_log_probs1 = (nn_ops.log_softmax(a.logits) -
nn_ops.log_softmax(b.logits))
return math_ops.reduce_sum(nn_ops.softmax(a.logits) * delta_log_probs1,
axis=-1)
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
6a0b91c038c98de5f5fcc56c9155a0d3c62fd567 | 9aa14256867487df3efef44be3a4e6cce21f9a61 | /ServerBugCheckByPython/proto/CMD_Common_pb2.py | 0194b377e0ed7b2012fc3b39f7b9aa07bafebb49 | [] | no_license | zgame/PythonCode | 9548a6e46ed4b698edf596d019da9015e982677d | 41a8996c4e352ae1c690131a224d6f4f9252a02c | refs/heads/master | 2021-06-21T13:40:16.026664 | 2020-12-02T10:12:12 | 2020-12-02T10:12:12 | 129,094,092 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | true | 197,306 | py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: CMD_Common.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='CMD_Common.proto',
package='CMD',
syntax='proto2',
serialized_pb=_b('\n\x10\x43MD_Common.proto\x12\x03\x43MD\"\xf0\x02\n\x15tagMBInsureRecordData\x12\x11\n\trecord_id\x18\x01 \x01(\x05\x12\x0f\n\x07kind_id\x18\x02 \x01(\x05\x12\x0f\n\x07game_id\x18\x03 \x01(\x05\x12\x16\n\x0esource_user_id\x18\x04 \x01(\r\x12\x16\n\x0etarget_user_id\x18\x05 \x01(\r\x12\x12\n\nswap_score\x18\x06 \x01(\x03\x12\x13\n\x0bsource_bank\x18\x07 \x01(\x03\x12\x13\n\x0btarget_bank\x18\x08 \x01(\x03\x12\x0f\n\x07revenue\x18\t \x01(\x03\x12\x15\n\ris_game_plaza\x18\n \x01(\x05\x12\x12\n\ntrade_type\x18\x0b \x01(\x05\x12\x18\n\x10source_nick_name\x18\r \x01(\x0c\x12\x18\n\x10target_nick_name\x18\x0e \x01(\x0c\x12\x16\n\x0esource_game_id\x18\x0f \x01(\r\x12\x16\n\x0etarget_game_id\x18\x10 \x01(\r\x12\x14\n\x0c\x63ollect_note\x18\x11 \x01(\x0c\"\x8d\x01\n\x15\x43MD_MB_C2S_ADD_REWARD\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x13\n\x0b\x63lient_type\x18\x02 \x01(\r\x12\x12\n\nchannel_id\x18\x03 \x01(\r\x12\x0f\n\x07game_id\x18\x04 \x01(\r\x12\x13\n\x0breason_type\x18\x05 \x01(\r\x12\x14\n\x0c\x65xtend_infos\x18\x64 \x03(\x05\"p\n\x15\x43MD_MB_S2C_ADD_REWARD\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x13\n\x0breason_type\x18\x02 \x01(\r\x12\x0e\n\x06status\x18\x03 \x01(\r\x12\x0b\n\x03msg\x18\x04 \x01(\x0c\x12\x14\n\x0c\x65xtend_infos\x18\x64 \x03(\x05\"\x7f\n%CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x16\n\x0elocal_language\x18\x02 \x01(\x0c\x12\x15\n\rrecharge_type\x18\x03 \x01(\r\x12\x16\n\x0erecharge_value\x18\x04 \x01(\r\"O\n%CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS\x12\x12\n\nvisibility\x18\x01 \x01(\r\x12\x12\n\npayability\x18\x02 \x01(\r\"a\n\x0ctagUserSkill\x12\x0f\n\x07item_id\x18\x01 \x01(\r\x12\x10\n\x08skill_id\x18\x02 \x01(\r\x12\x0c\n\x04used\x18\x03 \x01(\x05\x12\r\n\x05total\x18\x04 \x01(\x05\x12\x11\n\tused_time\x18\x05 \x01(\x03\"A\n\x15\x43MD_GR_C_INVITE_MATCH\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x17\n\x0fis_invite_guild\x18\x02 \x01(\x08\"\xbb\x01\n\x15\x43MD_GR_S_INVITE_MATCH\x12\x17\n\x0finviter_user_id\x18\x01 \x01(\r\x12\x14\n\x0cinviter_name\x18\x02 \x01(\x0c\x12\x19\n\x11inviter_vip_level\x18\x03 \x01(\r\x12\x1d\n\x15inviter_match_kind_id\x18\x04 \x01(\r\x12 \n\x18inviter_match_cell_score\x18\x05 \x01(\r\x12\x17\n\x0fis_invite_guild\x18\x06 \x01(\x08\"\xf2\x01\n\x16\x43MD_Speaker_S_UserChat\x12\x12\n\nchat_color\x18\x01 \x01(\r\x12\x19\n\x11send_user_game_id\x18\x02 \x01(\r\x12\x16\n\x0etarget_user_id\x18\x03 \x01(\r\x12\x18\n\x10source_nick_name\x18\x04 \x01(\x0c\x12\x0c\n\x04\x63hat\x18\x05 \x01(\x0c\x12\r\n\x05times\x18\x06 \x01(\x05\x12\x12\n\ncost_value\x18\x07 \x01(\x03\x12\x11\n\tcost_type\x18\x08 \x01(\x05\x12\x18\n\x10send_user_vip_lv\x18\t \x01(\x05\x12\x19\n\x11send_user_face_id\x18\n \x01(\r\"R\n\x16\x43MD_Speaker_C_UserChat\x12\x12\n\nchat_color\x18\x01 \x01(\r\x12\x16\n\x0etarget_user_id\x18\x02 \x01(\r\x12\x0c\n\x04\x63hat\x18\x03 \x01(\x0c\"G\n\x1b\x43MD_Speaker_S_UserChat_Fail\x12\x13\n\x0bresult_code\x18\x01 \x01(\r\x12\x13\n\x0b\x66robid_time\x18\x02 \x01(\r\"\"\n CMD_C_QueryPurchaseUndealedTrade\"E\n\rtagRewardItem\x12\x0f\n\x07item_id\x18\x01 \x01(\r\x12\x10\n\x08item_num\x18\x02 \x01(\x05\x12\x11\n\titem_type\x18\x03 \x01(\r\"\x17\n\x15\x43MD_MB_C_LOAD_MISSION\"J\n\x12tagEveryDayMission\x12\x12\n\nmission_id\x18\x01 \x01(\x05\x12\x10\n\x08progress\x18\x02 \x01(\x05\x12\x0e\n\x06status\x18\x03 \x01(\x05\"\x94\x01\n\x15tagEveryDayExtMission\x12\x1e\n\x16\x65verymission_finishnum\x18\x01 \x01(\x05\x12\x1b\n\x13\x65verymission_maxnum\x18\x02 \x01(\x05\x12 \n\x18\x65verymission_basediamond\x18\x03 \x01(\x05\x12\x1c\n\x14\x65verymission_starnum\x18\x04 \x01(\x05\"X\n\x13tagWeekDayExtReward\x12\x12\n\npuzzles_id\x18\x01 \x01(\x05\x12\x16\n\x0epuzzles_reward\x18\x02 \x01(\x0c\x12\x15\n\rpuzzles_state\x18\x03 \x01(\x05\"\xb9\x01\n\x14tagWeekDayExtMission\x12\x1e\n\x16weekmission_haspuzzles\x18\x01 \x01(\x0c\x12\x1c\n\x14weekmission_resetnum\x18\x02 \x01(\x05\x12\x1f\n\x17weekmission_basediamond\x18\x03 \x01(\x05\x12!\n\x19weekmission_puzzlesnumber\x18\x04 \x01(\x05\x12\x1f\n\x17weekmission_puzzleschip\x18\x05 \x01(\x05\"\xee\x02\n\x15\x43MD_MB_S_LOAD_MISSION\x12\x32\n\x11\x65veryday_missions\x18\x01 \x03(\x0b\x32\x17.CMD.tagEveryDayMission\x12.\n\rweek_missions\x18\x02 \x03(\x0b\x32\x17.CMD.tagEveryDayMission\x12\x17\n\x0fliveness_reward\x18\x03 \x03(\r\x12\x30\n\x0fgropup_missions\x18\x04 \x03(\x0b\x32\x17.CMD.tagEveryDayMission\x12\x39\n\x15\x65veryday_ext_missions\x18\x05 \x01(\x0b\x32\x1a.CMD.tagEveryDayExtMission\x12\x37\n\x14weekday_ext_missions\x18\x06 \x01(\x0b\x32\x19.CMD.tagWeekDayExtMission\x12\x32\n\x10week_ext_rewards\x18\x07 \x03(\x0b\x32\x18.CMD.tagWeekDayExtReward\"G\n\x1b\x43MD_MB_C_GET_MISSION_REWARD\x12\x14\n\x0cmission_type\x18\x01 \x01(\r\x12\x12\n\nmission_id\x18\x02 \x01(\x05\"\x9e\x01\n\x1b\x43MD_MB_S_GET_MISSION_REWARD\x12\x14\n\x0cmission_type\x18\x01 \x01(\r\x12\x12\n\nmission_id\x18\x02 \x01(\x05\x12\x14\n\x0creturn_value\x18\x03 \x01(\x05\x12\'\n\x0breward_list\x18\x04 \x03(\x0b\x32\x12.CMD.tagRewardItem\x12\x16\n\x0epuzzleschip_id\x18\x05 \x01(\x05\"1\n\x1c\x43MD_MB_C_GET_LIVENESS_REWARD\x12\x11\n\treward_id\x18\x01 \x01(\x05\"W\n\x1c\x43MD_MB_S_GET_LIVENESS_REWARD\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\'\n\x0breward_list\x18\x02 \x03(\x0b\x32\x12.CMD.tagRewardItem\"\xbd\x02\n\x1f\x43MD_MB_S_GET_NEW_MISSION_REWARD\x12\x16\n\x0e\x64wMissionType1\x18\x01 \x01(\x05\x12\x14\n\x0c\x64wMissionID1\x18\x02 \x01(\x05\x12\x15\n\rdwMissionNum1\x18\x03 \x01(\x05\x12\x15\n\rdwReawrdType1\x18\x04 \x01(\x05\x12\x18\n\x10\x64wReawrdSubType1\x18\x05 \x01(\x05\x12\x16\n\x0e\x64wReawrdValue1\x18\x06 \x01(\x05\x12\x16\n\x0e\x64wMissionType2\x18\x07 \x01(\x05\x12\x14\n\x0c\x64wMissionID2\x18\x08 \x01(\x05\x12\x15\n\rdwMissionNum2\x18\t \x01(\x05\x12\x15\n\rdwReawrdType2\x18\n \x01(\x05\x12\x18\n\x10\x64wReawrdSubType2\x18\x0b \x01(\x05\x12\x16\n\x0e\x64wReawrdValue2\x18\x0c \x01(\x05\".\n\x16\x43MD_MB_C_RESET_MISSION\x12\x14\n\x0cmission_type\x18\x01 \x01(\r\"\xa2\x01\n\x16\x43MD_MB_S_RESET_MISSION\x12\x14\n\x0cmission_type\x18\x01 \x01(\r\x12\x0e\n\x06result\x18\x02 \x01(\x05\x12\x32\n\x11\x65veryday_missions\x18\x03 \x03(\x0b\x32\x17.CMD.tagEveryDayMission\x12.\n\rweek_missions\x18\x04 \x03(\x0b\x32\x17.CMD.tagEveryDayMission\".\n\x18\x43MD_MB_C_GET_WEEK_REWARD\x12\x12\n\npuzzles_id\x18\x01 \x01(\x05\">\n\x18\x43MD_MB_S_GET_WEEK_REWARD\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x12\n\npuzzles_id\x18\x02 \x01(\x05\"\x1e\n\x1c\x43MD_MB_C2S_ACHIEVEMENT_TITLE\"O\n\x1c\x43MD_MB_S2C_ACHIEVEMENT_TITLE\x12\x10\n\x08title_id\x18\x01 \x01(\r\x12\x1d\n\x15\x61rr_achievement_title\x18\x02 \x03(\r\"@\n#CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE\x12\x19\n\x11\x61\x63hievement_title\x18\x01 \x01(\r\"U\n#CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE\x12\x13\n\x0bresult_code\x18\x01 \x01(\r\x12\x19\n\x11\x61\x63hievement_title\x18\x02 \x01(\r\"H\n\x11\x43MD_MB_C_SDK_BIND\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x0e\n\x06sdk_id\x18\x02 \x01(\x0c\x12\x12\n\nlogin_type\x18\x03 \x01(\r\"(\n\x11\x43MD_MB_S_SDK_BIND\x12\x13\n\x0bresult_code\x18\x01 \x01(\r\"|\n\rtagRankReward\x12\x0c\n\x04rank\x18\x01 \x01(\x05\x12\x11\n\titem_type\x18\x02 \x01(\r\x12\x0f\n\x07item_id\x18\x03 \x01(\r\x12\x10\n\x08item_num\x18\x04 \x01(\r\x12\x10\n\x08\x65nd_rank\x18\x05 \x01(\x05\x12\x15\n\rlast_integral\x18\x06 \x01(\r\">\n\x0ctagArenaRank\x12\x0c\n\x04rank\x18\x01 \x01(\x05\x12\x11\n\tnick_name\x18\x02 \x01(\x0c\x12\r\n\x05score\x18\x03 \x01(\x05\"\x19\n\nCMD_GM_CMD\x12\x0b\n\x03\x63md\x18\x01 \x01(\x0c\"\x1f\n\x0f\x43MD_GM_CMD_RESP\x12\x0c\n\x04text\x18\x01 \x01(\x0c\"\x18\n\x16\x43MD_C_CHAT_SERVER_INFO\"`\n\x16\x43MD_S_CHAT_SERVER_INFO\x12\x0c\n\x04port\x18\x01 \x01(\r\x12\x0c\n\x04\x61\x64\x64r\x18\x02 \x01(\t\x12\r\n\x05token\x18\x03 \x01(\t\x12\x0c\n\x04rand\x18\x04 \x01(\r\x12\r\n\x05rand2\x18\x05 \x01(\x04\"\x19\n\x17\x43MD_C_LUCKY_NUMBER_INFO\"N\n\x17\x43MD_S_LUCKY_NUMBER_INFO\x12\x12\n\nstart_time\x18\x01 \x01(\x03\x12\x0e\n\x06is_got\x18\x02 \x01(\x08\x12\x0f\n\x07\x63ur_day\x18\x03 \x01(\r\"3\n$CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS\x12\x0b\n\x03\x64\x61y\x18\x01 \x01(\r\"\x9e\x01\n\x0fLuckyNumberTask\x12\n\n\x02id\x18\x01 \x01(\r\x12\x10\n\x08progress\x18\x02 \x01(\r\x12+\n\x06status\x18\x03 \x01(\x0e\x32\x1b.CMD.LuckyNumberTask.Status\x12\x11\n\tlucky_num\x18\x04 \x01(\r\"-\n\x06Status\x12\n\n\x06Undone\x10\x00\x12\x08\n\x04\x44one\x10\x01\x12\r\n\tGetReward\x10\x02\"X\n$CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS\x12\x0b\n\x03\x64\x61y\x18\x01 \x01(\r\x12#\n\x05tasks\x18\x02 \x03(\x0b\x32\x14.CMD.LuckyNumberTask\"5\n\"CMD_C_GET_LUCKY_NUMBER_TASK_REWARD\x12\x0f\n\x07task_id\x18\x01 \x01(\r\"\xe1\x01\n\"CMD_S_GET_LUCKY_NUMBER_TASK_REWARD\x12\x0f\n\x07task_id\x18\x01 \x01(\r\x12>\n\x06result\x18\x02 \x01(\x0e\x32..CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.Result\x12\x11\n\titem_type\x18\x03 \x01(\r\x12\x0f\n\x07item_id\x18\x04 \x01(\r\x12\x10\n\x08item_num\x18\x05 \x01(\r\x12\x11\n\tlucky_num\x18\x06 \x01(\r\"!\n\x06Result\x12\x0b\n\x07Success\x10\x00\x12\n\n\x06\x46\x61iled\x10\x01\"\x1b\n\x19\x43MD_C_LOOKUP_LUCKY_NUMBER\"K\n\x19\x43MD_S_LOOKUP_LUCKY_NUMBER\x12\x0c\n\x04nums\x18\x01 \x03(\x05\x12\x11\n\tlucky_num\x18\x02 \x01(\r\x12\r\n\x05\x63ount\x18\x03 \x01(\r\"\x1f\n\x1d\x43MD_C_GET_LUCKY_NUMBER_REWARD\"\xc4\x01\n\x1d\x43MD_S_GET_LUCKY_NUMBER_REWARD\x12\x39\n\x06result\x18\x01 \x01(\x0e\x32).CMD.CMD_S_GET_LUCKY_NUMBER_REWARD.Result\x12\x0f\n\x07item_id\x18\x02 \x01(\r\x12\x10\n\x08item_num\x18\x03 \x01(\r\"E\n\x06Result\x12\x0b\n\x07Success\x10\x00\x12\n\n\x06\x46\x61iled\x10\x01\x12\x0b\n\x07Not7Day\x10\x02\x12\x0c\n\x08NoReward\x10\x03\x12\x07\n\x03Got\x10\x04\"C\n\x1e\x43MD_C_RECHARGE_IN_LUCKY_NUMBER\x12\x0f\n\x07task_id\x18\x01 \x01(\r\x12\x10\n\x08recharge\x18\x02 \x01(\r\"\'\n\x14\x43MD_C_NEWPLAYER_INFO\x12\x0f\n\x07user_id\x18\x01 \x01(\r\"\xcd\x01\n\x14\x43MD_S_NEWPLAYER_INFO\x12\x12\n\nlogin_days\x18\x01 \x01(\x05\x12\x1c\n\x14is_give_login_reward\x18\x02 \x01(\x08\x12\x17\n\x0fleft_login_days\x18\x03 \x01(\x05\x12\x18\n\x10\x62onus_mission_id\x18\x04 \x01(\x05\x12\x1e\n\x16\x62onus_mission_progress\x18\x05 \x01(\x05\x12\x15\n\ris_give_bonus\x18\x06 \x01(\x08\x12\x19\n\x11left_mission_days\x18\x07 \x01(\x05\"-\n\x1a\x43MD_C_USER_LOGINDAY_REWARD\x12\x0f\n\x07user_id\x18\x01 \x01(\r\"\x82\x01\n\x1a\x43MD_S_USER_LOGINDAY_REWARD\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x11\n\tvip_level\x18\x02 \x01(\x05\x12\x13\n\x0breward_type\x18\x03 \x01(\x05\x12\x16\n\x0ereward_subtype\x18\x04 \x01(\x05\x12\x14\n\x0creward_value\x18\x05 \x01(\x05\".\n\x1b\x43MD_C_CARNIVAL_WELFARE_INFO\x12\x0f\n\x07user_id\x18\x01 \x01(\r\"\x8f\x01\n\x1b\x43MD_S_CARNIVAL_WELFARE_INFO\x12\x10\n\x08reg_time\x18\x01 \x01(\x03\x12\x11\n\treset_mum\x18\x02 \x01(\x05\x12\x10\n\x08\x63ur_days\x18\x03 \x01(\x05\x12\x16\n\x0eis_give_reward\x18\x04 \x01(\x08\x12\x13\n\x0breward_type\x18\x05 \x01(\x05\x12\x0c\n\x04nums\x18\x06 \x01(\x05\".\n\x1b\x43MD_C_CARNIVAL_WELFARE_DRAW\x12\x0f\n\x07user_id\x18\x01 \x01(\r\"c\n\x1b\x43MD_S_CARNIVAL_WELFARE_DRAW\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x11\n\treset_mum\x18\x02 \x01(\x05\x12\x0f\n\x07new_num\x18\x03 \x01(\x05\x12\x10\n\x08\x63ur_days\x18\x04 \x01(\x05\"0\n\x1d\x43MD_C_CARNIVAL_WELFARE_REWARD\x12\x0f\n\x07user_id\x18\x01 \x01(\r\"Z\n\x1d\x43MD_S_CARNIVAL_WELFARE_REWARD\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x13\n\x0breward_type\x18\x02 \x01(\x05\x12\x14\n\x0creward_value\x18\x03 \x01(\x05\"9\n\x15\x43MD_C_SEAGOD_GIFT_GET\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x0f\n\x07gift_id\x18\x02 \x01(\r\"q\n\x15\x43MD_S_SEAGOD_GIFT_GET\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x0f\n\x07user_id\x18\x02 \x01(\r\x12\x0f\n\x07gift_id\x18\x03 \x01(\r\x12\x11\n\tadd_score\x18\x04 \x01(\r\x12\x13\n\x0b\x61\x64\x64_diamond\x18\x05 \x01(\r\"C\n\x13\x43MD_S_ANTIADDICTION\x12\x13\n\x0bonline_time\x18\x01 \x01(\r\x12\x17\n\x0f\x61\x64\x64iction_state\x18\x02 \x01(\r\" \n\x10\x43MD_S_SMT_POP_UP\x12\x0c\n\x04text\x18\x01 \x01(\x0c\"\x87\x01\n\x1a\x43MD_C_GuestRegisterAccount\x12\x0f\n\x07user_id\x18\x01 \x01(\r\x12\x10\n\x08\x61\x63\x63ounts\x18\x02 \x01(\x0c\x12\x12\n\nlogon_pass\x18\x03 \x01(\x0c\x12\x12\n\nmachine_id\x18\x04 \x01(\x0c\x12\x10\n\x08passport\x18\x05 \x01(\x0c\x12\x0c\n\x04name\x18\x06 \x01(\x0c\"n\n!CMD_S_GuestRegisterAccount_Result\x12\x13\n\x0bresult_code\x18\x01 \x01(\x05\x12\x11\n\tnick_name\x18\x02 \x01(\x0c\x12\x10\n\x08\x64\x65scribe\x18\x03 \x01(\x0c\x12\x0f\n\x07IsAdult\x18\x04 \x01(\x08\"\x1e\n\x1c\x43MD_C_UserBonusMissionReward\"8\n\"CMD_S_Mission_AcceptMission_Result\x12\x12\n\nmission_id\x18\x01 \x01(\r\"0\n\x1a\x43MD_S_Mission_Reach_Target\x12\x12\n\nmission_id\x18\x01 \x01(\r\",\n\x16\x43MD_C_Mission_BeReward\x12\x12\n\nmission_id\x18\x01 \x01(\r\"]\n\x16\x43MD_S_Mission_BeReward\x12\x12\n\nmission_id\x18\x01 \x01(\r\x12\r\n\x05types\x18\x02 \x03(\r\x12\x10\n\x08subtypes\x18\x03 \x03(\r\x12\x0e\n\x06\x61mount\x18\x04 \x03(\r\"\x15\n\x13\x43MD_C_Mission_Datas\"D\n\x0bMissionData\x12\x12\n\nmission_id\x18\x01 \x01(\r\x12\x0f\n\x07targets\x18\x02 \x01(\r\x12\x10\n\x08progress\x18\x03 \x01(\r\"L\n\x13\x43MD_S_Mission_Datas\x12\x12\n\nmission_id\x18\x01 \x03(\r\x12\x0f\n\x07targets\x18\x02 \x03(\r\x12\x10\n\x08progress\x18\x03 \x03(\r\"-\n\x17\x43MD_S_Mission_Completed\x12\x12\n\nmission_id\x18\x01 \x01(\r\"&\n\x14\x43MD_C_Cannon_GetList\x12\x0e\n\x06userid\x18\x01 \x01(\r\"a\n\x14\x43MD_S_Cannon_GetList\x12\x0b\n\x03ids\x18\x01 \x03(\r\x12\x12\n\nis_equiped\x18\x02 \x03(\r\x12\x12\n\nexpiration\x18\x03 \x03(\x03\x12\x14\n\x0cis_expirated\x18\x04 \x03(\x08\"*\n\x18\x43MD_C_CANNON_GetMaterial\x12\x0e\n\x06userid\x18\x01 \x01(\r\"I\n\x18\x43MD_S_CANNON_GetMaterial\x12\x14\n\x0cmaterial_ids\x18\x01 \x03(\r\x12\x17\n\x0fmaterial_amount\x18\x02 \x03(\r\"T\n\x12\x43MD_C_Cannon_Equip\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x12\n\ncannon_num\x18\x02 \x01(\r\x12\x17\n\x0f\x63\x61nnon_mulriple\x18\x03 \x01(\r\"N\n\x12\x43MD_S_Cannon_Equip\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x15\n\rcannon_old_id\x18\x02 \x01(\r\x12\x0e\n\x06result\x18\x03 \x01(\x03\"<\n\x15\x43MD_C_Cannon_Compound\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x10\n\x08valid_id\x18\x02 \x01(\r\"h\n\x15\x43MD_S_Cannon_Compound\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x0e\n\x06result\x18\x02 \x01(\x03\x12\x13\n\x0bmaterial_id\x18\x03 \x01(\r\x12\x17\n\x0fmaterial_amount\x18\x04 \x01(\r\"9\n\x12\x43MD_C_Cannon_Renew\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x10\n\x08valid_id\x18\x02 \x01(\r\"^\n\x12\x43MD_S_Cannon_Renew\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x0e\n\x06result\x18\x02 \x01(\x03\x12\x11\n\tcost_type\x18\x03 \x01(\r\x12\x12\n\ncost_value\x18\x04 \x01(\x03\"7\n\x10\x43MD_C_Cannon_Buy\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x10\n\x08valid_id\x18\x03 \x01(\r\"\\\n\x10\x43MD_S_Cannon_Buy\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x0e\n\x06result\x18\x02 \x01(\x03\x12\x11\n\tcost_type\x18\x03 \x01(\r\x12\x12\n\ncost_value\x18\x04 \x01(\x03\"\'\n\x14\x43MD_S_Cannon_Overdue\x12\x0f\n\x07item_id\x18\x01 \x01(\r\"\\\n\x10\x43MD_S_Cannon_Get\x12\x11\n\tcannon_id\x18\x01 \x01(\r\x12\x12\n\nexpiration\x18\x02 \x01(\x03\x12\x10\n\x08valid_id\x18\x03 \x01(\r\x12\x0f\n\x07is_show\x18\x04 \x01(\x08\"H\n\x1c\x43MD_S_Cannon_SyncAttackSpeed\x12\x12\n\nvalue_type\x18\x01 \x01(\r\x12\x14\n\x0c\x61ttack_speed\x18\x02 \x01(\r\"k\n\x17\x43MD_S_Cannon_ChangeFire\x12\x17\n\x0f\x62ullet_mulriple\x18\x01 \x01(\x05\x12\x10\n\x08\x63hair_id\x18\x02 \x01(\x05\x12\x11\n\tcannon_id\x18\x03 \x01(\r\x12\x12\n\ncannon_num\x18\x04 \x01(\r*-\n\rMissionStatus\x12\t\n\x05\x44oing\x10\x00\x12\x08\n\x04\x44one\x10\x01\x12\x07\n\x03Got\x10\x02*\'\n\x0cReturnResult\x12\x0b\n\x07Success\x10\x00\x12\n\n\x06\x46\x61iled\x10\x01\x42\x02H\x03')
)
_MISSIONSTATUS = _descriptor.EnumDescriptor(
name='MissionStatus',
full_name='CMD.MissionStatus',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Doing', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Done', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Got', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=8660,
serialized_end=8705,
)
_sym_db.RegisterEnumDescriptor(_MISSIONSTATUS)
MissionStatus = enum_type_wrapper.EnumTypeWrapper(_MISSIONSTATUS)
_RETURNRESULT = _descriptor.EnumDescriptor(
name='ReturnResult',
full_name='CMD.ReturnResult',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Success', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Failed', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=8707,
serialized_end=8746,
)
_sym_db.RegisterEnumDescriptor(_RETURNRESULT)
ReturnResult = enum_type_wrapper.EnumTypeWrapper(_RETURNRESULT)
Doing = 0
Done = 1
Got = 2
Success = 0
Failed = 1
_LUCKYNUMBERTASK_STATUS = _descriptor.EnumDescriptor(
name='Status',
full_name='CMD.LuckyNumberTask.Status',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Undone', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Done', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GetReward', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=4677,
serialized_end=4722,
)
_sym_db.RegisterEnumDescriptor(_LUCKYNUMBERTASK_STATUS)
_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD_RESULT = _descriptor.EnumDescriptor(
name='Result',
full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.Result',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Success', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Failed', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=5062,
serialized_end=5095,
)
_sym_db.RegisterEnumDescriptor(_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD_RESULT)
_CMD_S_GET_LUCKY_NUMBER_REWARD_RESULT = _descriptor.EnumDescriptor(
name='Result',
full_name='CMD.CMD_S_GET_LUCKY_NUMBER_REWARD.Result',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Success', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Failed', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Not7Day', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NoReward', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Got', index=4, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=5364,
serialized_end=5433,
)
_sym_db.RegisterEnumDescriptor(_CMD_S_GET_LUCKY_NUMBER_REWARD_RESULT)
_TAGMBINSURERECORDDATA = _descriptor.Descriptor(
name='tagMBInsureRecordData',
full_name='CMD.tagMBInsureRecordData',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='record_id', full_name='CMD.tagMBInsureRecordData.record_id', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='kind_id', full_name='CMD.tagMBInsureRecordData.kind_id', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='game_id', full_name='CMD.tagMBInsureRecordData.game_id', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_user_id', full_name='CMD.tagMBInsureRecordData.source_user_id', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_user_id', full_name='CMD.tagMBInsureRecordData.target_user_id', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='swap_score', full_name='CMD.tagMBInsureRecordData.swap_score', index=5,
number=6, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_bank', full_name='CMD.tagMBInsureRecordData.source_bank', index=6,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_bank', full_name='CMD.tagMBInsureRecordData.target_bank', index=7,
number=8, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='revenue', full_name='CMD.tagMBInsureRecordData.revenue', index=8,
number=9, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_game_plaza', full_name='CMD.tagMBInsureRecordData.is_game_plaza', index=9,
number=10, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='trade_type', full_name='CMD.tagMBInsureRecordData.trade_type', index=10,
number=11, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_nick_name', full_name='CMD.tagMBInsureRecordData.source_nick_name', index=11,
number=13, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_nick_name', full_name='CMD.tagMBInsureRecordData.target_nick_name', index=12,
number=14, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_game_id', full_name='CMD.tagMBInsureRecordData.source_game_id', index=13,
number=15, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_game_id', full_name='CMD.tagMBInsureRecordData.target_game_id', index=14,
number=16, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='collect_note', full_name='CMD.tagMBInsureRecordData.collect_note', index=15,
number=17, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=26,
serialized_end=394,
)
_CMD_MB_C2S_ADD_REWARD = _descriptor.Descriptor(
name='CMD_MB_C2S_ADD_REWARD',
full_name='CMD.CMD_MB_C2S_ADD_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_MB_C2S_ADD_REWARD.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='client_type', full_name='CMD.CMD_MB_C2S_ADD_REWARD.client_type', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='channel_id', full_name='CMD.CMD_MB_C2S_ADD_REWARD.channel_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='game_id', full_name='CMD.CMD_MB_C2S_ADD_REWARD.game_id', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reason_type', full_name='CMD.CMD_MB_C2S_ADD_REWARD.reason_type', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='extend_infos', full_name='CMD.CMD_MB_C2S_ADD_REWARD.extend_infos', index=5,
number=100, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=397,
serialized_end=538,
)
_CMD_MB_S2C_ADD_REWARD = _descriptor.Descriptor(
name='CMD_MB_S2C_ADD_REWARD',
full_name='CMD.CMD_MB_S2C_ADD_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_MB_S2C_ADD_REWARD.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reason_type', full_name='CMD.CMD_MB_S2C_ADD_REWARD.reason_type', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='status', full_name='CMD.CMD_MB_S2C_ADD_REWARD.status', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='msg', full_name='CMD.CMD_MB_S2C_ADD_REWARD.msg', index=3,
number=4, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='extend_infos', full_name='CMD.CMD_MB_S2C_ADD_REWARD.extend_infos', index=4,
number=100, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=540,
serialized_end=652,
)
_CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS = _descriptor.Descriptor(
name='CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS',
full_name='CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='local_language', full_name='CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS.local_language', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='recharge_type', full_name='CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS.recharge_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='recharge_value', full_name='CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS.recharge_value', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=654,
serialized_end=781,
)
_CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS = _descriptor.Descriptor(
name='CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS',
full_name='CMD.CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='visibility', full_name='CMD.CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS.visibility', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='payability', full_name='CMD.CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS.payability', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=783,
serialized_end=862,
)
_TAGUSERSKILL = _descriptor.Descriptor(
name='tagUserSkill',
full_name='CMD.tagUserSkill',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.tagUserSkill.item_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='skill_id', full_name='CMD.tagUserSkill.skill_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='used', full_name='CMD.tagUserSkill.used', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='total', full_name='CMD.tagUserSkill.total', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='used_time', full_name='CMD.tagUserSkill.used_time', index=4,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=864,
serialized_end=961,
)
_CMD_GR_C_INVITE_MATCH = _descriptor.Descriptor(
name='CMD_GR_C_INVITE_MATCH',
full_name='CMD.CMD_GR_C_INVITE_MATCH',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_GR_C_INVITE_MATCH.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_invite_guild', full_name='CMD.CMD_GR_C_INVITE_MATCH.is_invite_guild', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=963,
serialized_end=1028,
)
_CMD_GR_S_INVITE_MATCH = _descriptor.Descriptor(
name='CMD_GR_S_INVITE_MATCH',
full_name='CMD.CMD_GR_S_INVITE_MATCH',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='inviter_user_id', full_name='CMD.CMD_GR_S_INVITE_MATCH.inviter_user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='inviter_name', full_name='CMD.CMD_GR_S_INVITE_MATCH.inviter_name', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='inviter_vip_level', full_name='CMD.CMD_GR_S_INVITE_MATCH.inviter_vip_level', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='inviter_match_kind_id', full_name='CMD.CMD_GR_S_INVITE_MATCH.inviter_match_kind_id', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='inviter_match_cell_score', full_name='CMD.CMD_GR_S_INVITE_MATCH.inviter_match_cell_score', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_invite_guild', full_name='CMD.CMD_GR_S_INVITE_MATCH.is_invite_guild', index=5,
number=6, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1031,
serialized_end=1218,
)
_CMD_SPEAKER_S_USERCHAT = _descriptor.Descriptor(
name='CMD_Speaker_S_UserChat',
full_name='CMD.CMD_Speaker_S_UserChat',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='chat_color', full_name='CMD.CMD_Speaker_S_UserChat.chat_color', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='send_user_game_id', full_name='CMD.CMD_Speaker_S_UserChat.send_user_game_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_user_id', full_name='CMD.CMD_Speaker_S_UserChat.target_user_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_nick_name', full_name='CMD.CMD_Speaker_S_UserChat.source_nick_name', index=3,
number=4, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='chat', full_name='CMD.CMD_Speaker_S_UserChat.chat', index=4,
number=5, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='times', full_name='CMD.CMD_Speaker_S_UserChat.times', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_value', full_name='CMD.CMD_Speaker_S_UserChat.cost_value', index=6,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_type', full_name='CMD.CMD_Speaker_S_UserChat.cost_type', index=7,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='send_user_vip_lv', full_name='CMD.CMD_Speaker_S_UserChat.send_user_vip_lv', index=8,
number=9, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='send_user_face_id', full_name='CMD.CMD_Speaker_S_UserChat.send_user_face_id', index=9,
number=10, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1221,
serialized_end=1463,
)
_CMD_SPEAKER_C_USERCHAT = _descriptor.Descriptor(
name='CMD_Speaker_C_UserChat',
full_name='CMD.CMD_Speaker_C_UserChat',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='chat_color', full_name='CMD.CMD_Speaker_C_UserChat.chat_color', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='target_user_id', full_name='CMD.CMD_Speaker_C_UserChat.target_user_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='chat', full_name='CMD.CMD_Speaker_C_UserChat.chat', index=2,
number=3, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1465,
serialized_end=1547,
)
_CMD_SPEAKER_S_USERCHAT_FAIL = _descriptor.Descriptor(
name='CMD_Speaker_S_UserChat_Fail',
full_name='CMD.CMD_Speaker_S_UserChat_Fail',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result_code', full_name='CMD.CMD_Speaker_S_UserChat_Fail.result_code', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='frobid_time', full_name='CMD.CMD_Speaker_S_UserChat_Fail.frobid_time', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1549,
serialized_end=1620,
)
_CMD_C_QUERYPURCHASEUNDEALEDTRADE = _descriptor.Descriptor(
name='CMD_C_QueryPurchaseUndealedTrade',
full_name='CMD.CMD_C_QueryPurchaseUndealedTrade',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1622,
serialized_end=1656,
)
_TAGREWARDITEM = _descriptor.Descriptor(
name='tagRewardItem',
full_name='CMD.tagRewardItem',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.tagRewardItem.item_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_num', full_name='CMD.tagRewardItem.item_num', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_type', full_name='CMD.tagRewardItem.item_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1658,
serialized_end=1727,
)
_CMD_MB_C_LOAD_MISSION = _descriptor.Descriptor(
name='CMD_MB_C_LOAD_MISSION',
full_name='CMD.CMD_MB_C_LOAD_MISSION',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1729,
serialized_end=1752,
)
_TAGEVERYDAYMISSION = _descriptor.Descriptor(
name='tagEveryDayMission',
full_name='CMD.tagEveryDayMission',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.tagEveryDayMission.mission_id', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='progress', full_name='CMD.tagEveryDayMission.progress', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='status', full_name='CMD.tagEveryDayMission.status', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1754,
serialized_end=1828,
)
_TAGEVERYDAYEXTMISSION = _descriptor.Descriptor(
name='tagEveryDayExtMission',
full_name='CMD.tagEveryDayExtMission',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='everymission_finishnum', full_name='CMD.tagEveryDayExtMission.everymission_finishnum', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='everymission_maxnum', full_name='CMD.tagEveryDayExtMission.everymission_maxnum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='everymission_basediamond', full_name='CMD.tagEveryDayExtMission.everymission_basediamond', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='everymission_starnum', full_name='CMD.tagEveryDayExtMission.everymission_starnum', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1831,
serialized_end=1979,
)
_TAGWEEKDAYEXTREWARD = _descriptor.Descriptor(
name='tagWeekDayExtReward',
full_name='CMD.tagWeekDayExtReward',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='puzzles_id', full_name='CMD.tagWeekDayExtReward.puzzles_id', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='puzzles_reward', full_name='CMD.tagWeekDayExtReward.puzzles_reward', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='puzzles_state', full_name='CMD.tagWeekDayExtReward.puzzles_state', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1981,
serialized_end=2069,
)
_TAGWEEKDAYEXTMISSION = _descriptor.Descriptor(
name='tagWeekDayExtMission',
full_name='CMD.tagWeekDayExtMission',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='weekmission_haspuzzles', full_name='CMD.tagWeekDayExtMission.weekmission_haspuzzles', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='weekmission_resetnum', full_name='CMD.tagWeekDayExtMission.weekmission_resetnum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='weekmission_basediamond', full_name='CMD.tagWeekDayExtMission.weekmission_basediamond', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='weekmission_puzzlesnumber', full_name='CMD.tagWeekDayExtMission.weekmission_puzzlesnumber', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='weekmission_puzzleschip', full_name='CMD.tagWeekDayExtMission.weekmission_puzzleschip', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2072,
serialized_end=2257,
)
_CMD_MB_S_LOAD_MISSION = _descriptor.Descriptor(
name='CMD_MB_S_LOAD_MISSION',
full_name='CMD.CMD_MB_S_LOAD_MISSION',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='everyday_missions', full_name='CMD.CMD_MB_S_LOAD_MISSION.everyday_missions', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='week_missions', full_name='CMD.CMD_MB_S_LOAD_MISSION.week_missions', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='liveness_reward', full_name='CMD.CMD_MB_S_LOAD_MISSION.liveness_reward', index=2,
number=3, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='gropup_missions', full_name='CMD.CMD_MB_S_LOAD_MISSION.gropup_missions', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='everyday_ext_missions', full_name='CMD.CMD_MB_S_LOAD_MISSION.everyday_ext_missions', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='weekday_ext_missions', full_name='CMD.CMD_MB_S_LOAD_MISSION.weekday_ext_missions', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='week_ext_rewards', full_name='CMD.CMD_MB_S_LOAD_MISSION.week_ext_rewards', index=6,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2260,
serialized_end=2626,
)
_CMD_MB_C_GET_MISSION_REWARD = _descriptor.Descriptor(
name='CMD_MB_C_GET_MISSION_REWARD',
full_name='CMD.CMD_MB_C_GET_MISSION_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_type', full_name='CMD.CMD_MB_C_GET_MISSION_REWARD.mission_type', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_MB_C_GET_MISSION_REWARD.mission_id', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2628,
serialized_end=2699,
)
_CMD_MB_S_GET_MISSION_REWARD = _descriptor.Descriptor(
name='CMD_MB_S_GET_MISSION_REWARD',
full_name='CMD.CMD_MB_S_GET_MISSION_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_type', full_name='CMD.CMD_MB_S_GET_MISSION_REWARD.mission_type', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_MB_S_GET_MISSION_REWARD.mission_id', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='return_value', full_name='CMD.CMD_MB_S_GET_MISSION_REWARD.return_value', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_list', full_name='CMD.CMD_MB_S_GET_MISSION_REWARD.reward_list', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='puzzleschip_id', full_name='CMD.CMD_MB_S_GET_MISSION_REWARD.puzzleschip_id', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2702,
serialized_end=2860,
)
_CMD_MB_C_GET_LIVENESS_REWARD = _descriptor.Descriptor(
name='CMD_MB_C_GET_LIVENESS_REWARD',
full_name='CMD.CMD_MB_C_GET_LIVENESS_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='reward_id', full_name='CMD.CMD_MB_C_GET_LIVENESS_REWARD.reward_id', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2862,
serialized_end=2911,
)
_CMD_MB_S_GET_LIVENESS_REWARD = _descriptor.Descriptor(
name='CMD_MB_S_GET_LIVENESS_REWARD',
full_name='CMD.CMD_MB_S_GET_LIVENESS_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_MB_S_GET_LIVENESS_REWARD.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_list', full_name='CMD.CMD_MB_S_GET_LIVENESS_REWARD.reward_list', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2913,
serialized_end=3000,
)
_CMD_MB_S_GET_NEW_MISSION_REWARD = _descriptor.Descriptor(
name='CMD_MB_S_GET_NEW_MISSION_REWARD',
full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='dwMissionType1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionType1', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwMissionID1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionID1', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwMissionNum1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionNum1', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdType1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdType1', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdSubType1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdSubType1', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdValue1', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdValue1', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwMissionType2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionType2', index=6,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwMissionID2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionID2', index=7,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwMissionNum2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwMissionNum2', index=8,
number=9, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdType2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdType2', index=9,
number=10, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdSubType2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdSubType2', index=10,
number=11, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dwReawrdValue2', full_name='CMD.CMD_MB_S_GET_NEW_MISSION_REWARD.dwReawrdValue2', index=11,
number=12, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3003,
serialized_end=3320,
)
_CMD_MB_C_RESET_MISSION = _descriptor.Descriptor(
name='CMD_MB_C_RESET_MISSION',
full_name='CMD.CMD_MB_C_RESET_MISSION',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_type', full_name='CMD.CMD_MB_C_RESET_MISSION.mission_type', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3322,
serialized_end=3368,
)
_CMD_MB_S_RESET_MISSION = _descriptor.Descriptor(
name='CMD_MB_S_RESET_MISSION',
full_name='CMD.CMD_MB_S_RESET_MISSION',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_type', full_name='CMD.CMD_MB_S_RESET_MISSION.mission_type', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_MB_S_RESET_MISSION.result', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='everyday_missions', full_name='CMD.CMD_MB_S_RESET_MISSION.everyday_missions', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='week_missions', full_name='CMD.CMD_MB_S_RESET_MISSION.week_missions', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3371,
serialized_end=3533,
)
_CMD_MB_C_GET_WEEK_REWARD = _descriptor.Descriptor(
name='CMD_MB_C_GET_WEEK_REWARD',
full_name='CMD.CMD_MB_C_GET_WEEK_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='puzzles_id', full_name='CMD.CMD_MB_C_GET_WEEK_REWARD.puzzles_id', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3535,
serialized_end=3581,
)
_CMD_MB_S_GET_WEEK_REWARD = _descriptor.Descriptor(
name='CMD_MB_S_GET_WEEK_REWARD',
full_name='CMD.CMD_MB_S_GET_WEEK_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_MB_S_GET_WEEK_REWARD.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='puzzles_id', full_name='CMD.CMD_MB_S_GET_WEEK_REWARD.puzzles_id', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3583,
serialized_end=3645,
)
_CMD_MB_C2S_ACHIEVEMENT_TITLE = _descriptor.Descriptor(
name='CMD_MB_C2S_ACHIEVEMENT_TITLE',
full_name='CMD.CMD_MB_C2S_ACHIEVEMENT_TITLE',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3647,
serialized_end=3677,
)
_CMD_MB_S2C_ACHIEVEMENT_TITLE = _descriptor.Descriptor(
name='CMD_MB_S2C_ACHIEVEMENT_TITLE',
full_name='CMD.CMD_MB_S2C_ACHIEVEMENT_TITLE',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='title_id', full_name='CMD.CMD_MB_S2C_ACHIEVEMENT_TITLE.title_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='arr_achievement_title', full_name='CMD.CMD_MB_S2C_ACHIEVEMENT_TITLE.arr_achievement_title', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3679,
serialized_end=3758,
)
_CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE = _descriptor.Descriptor(
name='CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE',
full_name='CMD.CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='achievement_title', full_name='CMD.CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE.achievement_title', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3760,
serialized_end=3824,
)
_CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE = _descriptor.Descriptor(
name='CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE',
full_name='CMD.CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result_code', full_name='CMD.CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE.result_code', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='achievement_title', full_name='CMD.CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE.achievement_title', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3826,
serialized_end=3911,
)
_CMD_MB_C_SDK_BIND = _descriptor.Descriptor(
name='CMD_MB_C_SDK_BIND',
full_name='CMD.CMD_MB_C_SDK_BIND',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_MB_C_SDK_BIND.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='sdk_id', full_name='CMD.CMD_MB_C_SDK_BIND.sdk_id', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='login_type', full_name='CMD.CMD_MB_C_SDK_BIND.login_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3913,
serialized_end=3985,
)
_CMD_MB_S_SDK_BIND = _descriptor.Descriptor(
name='CMD_MB_S_SDK_BIND',
full_name='CMD.CMD_MB_S_SDK_BIND',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result_code', full_name='CMD.CMD_MB_S_SDK_BIND.result_code', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3987,
serialized_end=4027,
)
_TAGRANKREWARD = _descriptor.Descriptor(
name='tagRankReward',
full_name='CMD.tagRankReward',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='rank', full_name='CMD.tagRankReward.rank', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_type', full_name='CMD.tagRankReward.item_type', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.tagRankReward.item_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_num', full_name='CMD.tagRankReward.item_num', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='end_rank', full_name='CMD.tagRankReward.end_rank', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='last_integral', full_name='CMD.tagRankReward.last_integral', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4029,
serialized_end=4153,
)
_TAGARENARANK = _descriptor.Descriptor(
name='tagArenaRank',
full_name='CMD.tagArenaRank',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='rank', full_name='CMD.tagArenaRank.rank', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='nick_name', full_name='CMD.tagArenaRank.nick_name', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='score', full_name='CMD.tagArenaRank.score', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4155,
serialized_end=4217,
)
_CMD_GM_CMD = _descriptor.Descriptor(
name='CMD_GM_CMD',
full_name='CMD.CMD_GM_CMD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cmd', full_name='CMD.CMD_GM_CMD.cmd', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4219,
serialized_end=4244,
)
_CMD_GM_CMD_RESP = _descriptor.Descriptor(
name='CMD_GM_CMD_RESP',
full_name='CMD.CMD_GM_CMD_RESP',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='text', full_name='CMD.CMD_GM_CMD_RESP.text', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4246,
serialized_end=4277,
)
_CMD_C_CHAT_SERVER_INFO = _descriptor.Descriptor(
name='CMD_C_CHAT_SERVER_INFO',
full_name='CMD.CMD_C_CHAT_SERVER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4279,
serialized_end=4303,
)
_CMD_S_CHAT_SERVER_INFO = _descriptor.Descriptor(
name='CMD_S_CHAT_SERVER_INFO',
full_name='CMD.CMD_S_CHAT_SERVER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='port', full_name='CMD.CMD_S_CHAT_SERVER_INFO.port', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='addr', full_name='CMD.CMD_S_CHAT_SERVER_INFO.addr', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='token', full_name='CMD.CMD_S_CHAT_SERVER_INFO.token', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='rand', full_name='CMD.CMD_S_CHAT_SERVER_INFO.rand', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='rand2', full_name='CMD.CMD_S_CHAT_SERVER_INFO.rand2', index=4,
number=5, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4305,
serialized_end=4401,
)
_CMD_C_LUCKY_NUMBER_INFO = _descriptor.Descriptor(
name='CMD_C_LUCKY_NUMBER_INFO',
full_name='CMD.CMD_C_LUCKY_NUMBER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4403,
serialized_end=4428,
)
_CMD_S_LUCKY_NUMBER_INFO = _descriptor.Descriptor(
name='CMD_S_LUCKY_NUMBER_INFO',
full_name='CMD.CMD_S_LUCKY_NUMBER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time', full_name='CMD.CMD_S_LUCKY_NUMBER_INFO.start_time', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_got', full_name='CMD.CMD_S_LUCKY_NUMBER_INFO.is_got', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cur_day', full_name='CMD.CMD_S_LUCKY_NUMBER_INFO.cur_day', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4430,
serialized_end=4508,
)
_CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS = _descriptor.Descriptor(
name='CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS',
full_name='CMD.CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='day', full_name='CMD.CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS.day', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4510,
serialized_end=4561,
)
_LUCKYNUMBERTASK = _descriptor.Descriptor(
name='LuckyNumberTask',
full_name='CMD.LuckyNumberTask',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='CMD.LuckyNumberTask.id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='progress', full_name='CMD.LuckyNumberTask.progress', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='status', full_name='CMD.LuckyNumberTask.status', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='lucky_num', full_name='CMD.LuckyNumberTask.lucky_num', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
_LUCKYNUMBERTASK_STATUS,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4564,
serialized_end=4722,
)
_CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS = _descriptor.Descriptor(
name='CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS',
full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='day', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS.day', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='tasks', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS.tasks', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4724,
serialized_end=4812,
)
_CMD_C_GET_LUCKY_NUMBER_TASK_REWARD = _descriptor.Descriptor(
name='CMD_C_GET_LUCKY_NUMBER_TASK_REWARD',
full_name='CMD.CMD_C_GET_LUCKY_NUMBER_TASK_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='task_id', full_name='CMD.CMD_C_GET_LUCKY_NUMBER_TASK_REWARD.task_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4814,
serialized_end=4867,
)
_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD = _descriptor.Descriptor(
name='CMD_S_GET_LUCKY_NUMBER_TASK_REWARD',
full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='task_id', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.task_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.result', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_type', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.item_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.item_id', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_num', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.item_num', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='lucky_num', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.lucky_num', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD_RESULT,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4870,
serialized_end=5095,
)
_CMD_C_LOOKUP_LUCKY_NUMBER = _descriptor.Descriptor(
name='CMD_C_LOOKUP_LUCKY_NUMBER',
full_name='CMD.CMD_C_LOOKUP_LUCKY_NUMBER',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5097,
serialized_end=5124,
)
_CMD_S_LOOKUP_LUCKY_NUMBER = _descriptor.Descriptor(
name='CMD_S_LOOKUP_LUCKY_NUMBER',
full_name='CMD.CMD_S_LOOKUP_LUCKY_NUMBER',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='nums', full_name='CMD.CMD_S_LOOKUP_LUCKY_NUMBER.nums', index=0,
number=1, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='lucky_num', full_name='CMD.CMD_S_LOOKUP_LUCKY_NUMBER.lucky_num', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='count', full_name='CMD.CMD_S_LOOKUP_LUCKY_NUMBER.count', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5126,
serialized_end=5201,
)
_CMD_C_GET_LUCKY_NUMBER_REWARD = _descriptor.Descriptor(
name='CMD_C_GET_LUCKY_NUMBER_REWARD',
full_name='CMD.CMD_C_GET_LUCKY_NUMBER_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5203,
serialized_end=5234,
)
_CMD_S_GET_LUCKY_NUMBER_REWARD = _descriptor.Descriptor(
name='CMD_S_GET_LUCKY_NUMBER_REWARD',
full_name='CMD.CMD_S_GET_LUCKY_NUMBER_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_REWARD.result', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_REWARD.item_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='item_num', full_name='CMD.CMD_S_GET_LUCKY_NUMBER_REWARD.item_num', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
_CMD_S_GET_LUCKY_NUMBER_REWARD_RESULT,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5237,
serialized_end=5433,
)
_CMD_C_RECHARGE_IN_LUCKY_NUMBER = _descriptor.Descriptor(
name='CMD_C_RECHARGE_IN_LUCKY_NUMBER',
full_name='CMD.CMD_C_RECHARGE_IN_LUCKY_NUMBER',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='task_id', full_name='CMD.CMD_C_RECHARGE_IN_LUCKY_NUMBER.task_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='recharge', full_name='CMD.CMD_C_RECHARGE_IN_LUCKY_NUMBER.recharge', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5435,
serialized_end=5502,
)
_CMD_C_NEWPLAYER_INFO = _descriptor.Descriptor(
name='CMD_C_NEWPLAYER_INFO',
full_name='CMD.CMD_C_NEWPLAYER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_NEWPLAYER_INFO.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5504,
serialized_end=5543,
)
_CMD_S_NEWPLAYER_INFO = _descriptor.Descriptor(
name='CMD_S_NEWPLAYER_INFO',
full_name='CMD.CMD_S_NEWPLAYER_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='login_days', full_name='CMD.CMD_S_NEWPLAYER_INFO.login_days', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_give_login_reward', full_name='CMD.CMD_S_NEWPLAYER_INFO.is_give_login_reward', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='left_login_days', full_name='CMD.CMD_S_NEWPLAYER_INFO.left_login_days', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='bonus_mission_id', full_name='CMD.CMD_S_NEWPLAYER_INFO.bonus_mission_id', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='bonus_mission_progress', full_name='CMD.CMD_S_NEWPLAYER_INFO.bonus_mission_progress', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_give_bonus', full_name='CMD.CMD_S_NEWPLAYER_INFO.is_give_bonus', index=5,
number=6, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='left_mission_days', full_name='CMD.CMD_S_NEWPLAYER_INFO.left_mission_days', index=6,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5546,
serialized_end=5751,
)
_CMD_C_USER_LOGINDAY_REWARD = _descriptor.Descriptor(
name='CMD_C_USER_LOGINDAY_REWARD',
full_name='CMD.CMD_C_USER_LOGINDAY_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_USER_LOGINDAY_REWARD.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5753,
serialized_end=5798,
)
_CMD_S_USER_LOGINDAY_REWARD = _descriptor.Descriptor(
name='CMD_S_USER_LOGINDAY_REWARD',
full_name='CMD.CMD_S_USER_LOGINDAY_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_USER_LOGINDAY_REWARD.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='vip_level', full_name='CMD.CMD_S_USER_LOGINDAY_REWARD.vip_level', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_type', full_name='CMD.CMD_S_USER_LOGINDAY_REWARD.reward_type', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_subtype', full_name='CMD.CMD_S_USER_LOGINDAY_REWARD.reward_subtype', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_value', full_name='CMD.CMD_S_USER_LOGINDAY_REWARD.reward_value', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5801,
serialized_end=5931,
)
_CMD_C_CARNIVAL_WELFARE_INFO = _descriptor.Descriptor(
name='CMD_C_CARNIVAL_WELFARE_INFO',
full_name='CMD.CMD_C_CARNIVAL_WELFARE_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_CARNIVAL_WELFARE_INFO.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5933,
serialized_end=5979,
)
_CMD_S_CARNIVAL_WELFARE_INFO = _descriptor.Descriptor(
name='CMD_S_CARNIVAL_WELFARE_INFO',
full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='reg_time', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.reg_time', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reset_mum', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.reset_mum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cur_days', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.cur_days', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_give_reward', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.is_give_reward', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_type', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.reward_type', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='nums', full_name='CMD.CMD_S_CARNIVAL_WELFARE_INFO.nums', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5982,
serialized_end=6125,
)
_CMD_C_CARNIVAL_WELFARE_DRAW = _descriptor.Descriptor(
name='CMD_C_CARNIVAL_WELFARE_DRAW',
full_name='CMD.CMD_C_CARNIVAL_WELFARE_DRAW',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_CARNIVAL_WELFARE_DRAW.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6127,
serialized_end=6173,
)
_CMD_S_CARNIVAL_WELFARE_DRAW = _descriptor.Descriptor(
name='CMD_S_CARNIVAL_WELFARE_DRAW',
full_name='CMD.CMD_S_CARNIVAL_WELFARE_DRAW',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_CARNIVAL_WELFARE_DRAW.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reset_mum', full_name='CMD.CMD_S_CARNIVAL_WELFARE_DRAW.reset_mum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='new_num', full_name='CMD.CMD_S_CARNIVAL_WELFARE_DRAW.new_num', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cur_days', full_name='CMD.CMD_S_CARNIVAL_WELFARE_DRAW.cur_days', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6175,
serialized_end=6274,
)
_CMD_C_CARNIVAL_WELFARE_REWARD = _descriptor.Descriptor(
name='CMD_C_CARNIVAL_WELFARE_REWARD',
full_name='CMD.CMD_C_CARNIVAL_WELFARE_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_CARNIVAL_WELFARE_REWARD.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6276,
serialized_end=6324,
)
_CMD_S_CARNIVAL_WELFARE_REWARD = _descriptor.Descriptor(
name='CMD_S_CARNIVAL_WELFARE_REWARD',
full_name='CMD.CMD_S_CARNIVAL_WELFARE_REWARD',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_CARNIVAL_WELFARE_REWARD.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_type', full_name='CMD.CMD_S_CARNIVAL_WELFARE_REWARD.reward_type', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='reward_value', full_name='CMD.CMD_S_CARNIVAL_WELFARE_REWARD.reward_value', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6326,
serialized_end=6416,
)
_CMD_C_SEAGOD_GIFT_GET = _descriptor.Descriptor(
name='CMD_C_SEAGOD_GIFT_GET',
full_name='CMD.CMD_C_SEAGOD_GIFT_GET',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_SEAGOD_GIFT_GET.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='gift_id', full_name='CMD.CMD_C_SEAGOD_GIFT_GET.gift_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6418,
serialized_end=6475,
)
_CMD_S_SEAGOD_GIFT_GET = _descriptor.Descriptor(
name='CMD_S_SEAGOD_GIFT_GET',
full_name='CMD.CMD_S_SEAGOD_GIFT_GET',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_SEAGOD_GIFT_GET.result', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_S_SEAGOD_GIFT_GET.user_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='gift_id', full_name='CMD.CMD_S_SEAGOD_GIFT_GET.gift_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='add_score', full_name='CMD.CMD_S_SEAGOD_GIFT_GET.add_score', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='add_diamond', full_name='CMD.CMD_S_SEAGOD_GIFT_GET.add_diamond', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6477,
serialized_end=6590,
)
_CMD_S_ANTIADDICTION = _descriptor.Descriptor(
name='CMD_S_ANTIADDICTION',
full_name='CMD.CMD_S_ANTIADDICTION',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='online_time', full_name='CMD.CMD_S_ANTIADDICTION.online_time', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='addiction_state', full_name='CMD.CMD_S_ANTIADDICTION.addiction_state', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6592,
serialized_end=6659,
)
_CMD_S_SMT_POP_UP = _descriptor.Descriptor(
name='CMD_S_SMT_POP_UP',
full_name='CMD.CMD_S_SMT_POP_UP',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='text', full_name='CMD.CMD_S_SMT_POP_UP.text', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6661,
serialized_end=6693,
)
_CMD_C_GUESTREGISTERACCOUNT = _descriptor.Descriptor(
name='CMD_C_GuestRegisterAccount',
full_name='CMD.CMD_C_GuestRegisterAccount',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='CMD.CMD_C_GuestRegisterAccount.user_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='accounts', full_name='CMD.CMD_C_GuestRegisterAccount.accounts', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='logon_pass', full_name='CMD.CMD_C_GuestRegisterAccount.logon_pass', index=2,
number=3, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='machine_id', full_name='CMD.CMD_C_GuestRegisterAccount.machine_id', index=3,
number=4, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='passport', full_name='CMD.CMD_C_GuestRegisterAccount.passport', index=4,
number=5, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='name', full_name='CMD.CMD_C_GuestRegisterAccount.name', index=5,
number=6, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6696,
serialized_end=6831,
)
_CMD_S_GUESTREGISTERACCOUNT_RESULT = _descriptor.Descriptor(
name='CMD_S_GuestRegisterAccount_Result',
full_name='CMD.CMD_S_GuestRegisterAccount_Result',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='result_code', full_name='CMD.CMD_S_GuestRegisterAccount_Result.result_code', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='nick_name', full_name='CMD.CMD_S_GuestRegisterAccount_Result.nick_name', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='describe', full_name='CMD.CMD_S_GuestRegisterAccount_Result.describe', index=2,
number=3, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='IsAdult', full_name='CMD.CMD_S_GuestRegisterAccount_Result.IsAdult', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6833,
serialized_end=6943,
)
_CMD_C_USERBONUSMISSIONREWARD = _descriptor.Descriptor(
name='CMD_C_UserBonusMissionReward',
full_name='CMD.CMD_C_UserBonusMissionReward',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6945,
serialized_end=6975,
)
_CMD_S_MISSION_ACCEPTMISSION_RESULT = _descriptor.Descriptor(
name='CMD_S_Mission_AcceptMission_Result',
full_name='CMD.CMD_S_Mission_AcceptMission_Result',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_S_Mission_AcceptMission_Result.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6977,
serialized_end=7033,
)
_CMD_S_MISSION_REACH_TARGET = _descriptor.Descriptor(
name='CMD_S_Mission_Reach_Target',
full_name='CMD.CMD_S_Mission_Reach_Target',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_S_Mission_Reach_Target.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7035,
serialized_end=7083,
)
_CMD_C_MISSION_BEREWARD = _descriptor.Descriptor(
name='CMD_C_Mission_BeReward',
full_name='CMD.CMD_C_Mission_BeReward',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_C_Mission_BeReward.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7085,
serialized_end=7129,
)
_CMD_S_MISSION_BEREWARD = _descriptor.Descriptor(
name='CMD_S_Mission_BeReward',
full_name='CMD.CMD_S_Mission_BeReward',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_S_Mission_BeReward.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='types', full_name='CMD.CMD_S_Mission_BeReward.types', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='subtypes', full_name='CMD.CMD_S_Mission_BeReward.subtypes', index=2,
number=3, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='amount', full_name='CMD.CMD_S_Mission_BeReward.amount', index=3,
number=4, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7131,
serialized_end=7224,
)
_CMD_C_MISSION_DATAS = _descriptor.Descriptor(
name='CMD_C_Mission_Datas',
full_name='CMD.CMD_C_Mission_Datas',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7226,
serialized_end=7247,
)
_MISSIONDATA = _descriptor.Descriptor(
name='MissionData',
full_name='CMD.MissionData',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.MissionData.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='targets', full_name='CMD.MissionData.targets', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='progress', full_name='CMD.MissionData.progress', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7249,
serialized_end=7317,
)
_CMD_S_MISSION_DATAS = _descriptor.Descriptor(
name='CMD_S_Mission_Datas',
full_name='CMD.CMD_S_Mission_Datas',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_S_Mission_Datas.mission_id', index=0,
number=1, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='targets', full_name='CMD.CMD_S_Mission_Datas.targets', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='progress', full_name='CMD.CMD_S_Mission_Datas.progress', index=2,
number=3, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7319,
serialized_end=7395,
)
_CMD_S_MISSION_COMPLETED = _descriptor.Descriptor(
name='CMD_S_Mission_Completed',
full_name='CMD.CMD_S_Mission_Completed',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mission_id', full_name='CMD.CMD_S_Mission_Completed.mission_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7397,
serialized_end=7442,
)
_CMD_C_CANNON_GETLIST = _descriptor.Descriptor(
name='CMD_C_Cannon_GetList',
full_name='CMD.CMD_C_Cannon_GetList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='userid', full_name='CMD.CMD_C_Cannon_GetList.userid', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7444,
serialized_end=7482,
)
_CMD_S_CANNON_GETLIST = _descriptor.Descriptor(
name='CMD_S_Cannon_GetList',
full_name='CMD.CMD_S_Cannon_GetList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ids', full_name='CMD.CMD_S_Cannon_GetList.ids', index=0,
number=1, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_equiped', full_name='CMD.CMD_S_Cannon_GetList.is_equiped', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='expiration', full_name='CMD.CMD_S_Cannon_GetList.expiration', index=2,
number=3, type=3, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_expirated', full_name='CMD.CMD_S_Cannon_GetList.is_expirated', index=3,
number=4, type=8, cpp_type=7, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7484,
serialized_end=7581,
)
_CMD_C_CANNON_GETMATERIAL = _descriptor.Descriptor(
name='CMD_C_CANNON_GetMaterial',
full_name='CMD.CMD_C_CANNON_GetMaterial',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='userid', full_name='CMD.CMD_C_CANNON_GetMaterial.userid', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7583,
serialized_end=7625,
)
_CMD_S_CANNON_GETMATERIAL = _descriptor.Descriptor(
name='CMD_S_CANNON_GetMaterial',
full_name='CMD.CMD_S_CANNON_GetMaterial',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='material_ids', full_name='CMD.CMD_S_CANNON_GetMaterial.material_ids', index=0,
number=1, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='material_amount', full_name='CMD.CMD_S_CANNON_GetMaterial.material_amount', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7627,
serialized_end=7700,
)
_CMD_C_CANNON_EQUIP = _descriptor.Descriptor(
name='CMD_C_Cannon_Equip',
full_name='CMD.CMD_C_Cannon_Equip',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_C_Cannon_Equip.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cannon_num', full_name='CMD.CMD_C_Cannon_Equip.cannon_num', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cannon_mulriple', full_name='CMD.CMD_C_Cannon_Equip.cannon_mulriple', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7702,
serialized_end=7786,
)
_CMD_S_CANNON_EQUIP = _descriptor.Descriptor(
name='CMD_S_Cannon_Equip',
full_name='CMD.CMD_S_Cannon_Equip',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_Equip.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cannon_old_id', full_name='CMD.CMD_S_Cannon_Equip.cannon_old_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_Cannon_Equip.result', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7788,
serialized_end=7866,
)
_CMD_C_CANNON_COMPOUND = _descriptor.Descriptor(
name='CMD_C_Cannon_Compound',
full_name='CMD.CMD_C_Cannon_Compound',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_C_Cannon_Compound.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='valid_id', full_name='CMD.CMD_C_Cannon_Compound.valid_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7868,
serialized_end=7928,
)
_CMD_S_CANNON_COMPOUND = _descriptor.Descriptor(
name='CMD_S_Cannon_Compound',
full_name='CMD.CMD_S_Cannon_Compound',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_Compound.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_Cannon_Compound.result', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='material_id', full_name='CMD.CMD_S_Cannon_Compound.material_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='material_amount', full_name='CMD.CMD_S_Cannon_Compound.material_amount', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7930,
serialized_end=8034,
)
_CMD_C_CANNON_RENEW = _descriptor.Descriptor(
name='CMD_C_Cannon_Renew',
full_name='CMD.CMD_C_Cannon_Renew',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_C_Cannon_Renew.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='valid_id', full_name='CMD.CMD_C_Cannon_Renew.valid_id', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8036,
serialized_end=8093,
)
_CMD_S_CANNON_RENEW = _descriptor.Descriptor(
name='CMD_S_Cannon_Renew',
full_name='CMD.CMD_S_Cannon_Renew',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_Renew.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_Cannon_Renew.result', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_type', full_name='CMD.CMD_S_Cannon_Renew.cost_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_value', full_name='CMD.CMD_S_Cannon_Renew.cost_value', index=3,
number=4, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8095,
serialized_end=8189,
)
_CMD_C_CANNON_BUY = _descriptor.Descriptor(
name='CMD_C_Cannon_Buy',
full_name='CMD.CMD_C_Cannon_Buy',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_C_Cannon_Buy.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='valid_id', full_name='CMD.CMD_C_Cannon_Buy.valid_id', index=1,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8191,
serialized_end=8246,
)
_CMD_S_CANNON_BUY = _descriptor.Descriptor(
name='CMD_S_Cannon_Buy',
full_name='CMD.CMD_S_Cannon_Buy',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_Buy.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='result', full_name='CMD.CMD_S_Cannon_Buy.result', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_type', full_name='CMD.CMD_S_Cannon_Buy.cost_type', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cost_value', full_name='CMD.CMD_S_Cannon_Buy.cost_value', index=3,
number=4, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8248,
serialized_end=8340,
)
_CMD_S_CANNON_OVERDUE = _descriptor.Descriptor(
name='CMD_S_Cannon_Overdue',
full_name='CMD.CMD_S_Cannon_Overdue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='item_id', full_name='CMD.CMD_S_Cannon_Overdue.item_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8342,
serialized_end=8381,
)
_CMD_S_CANNON_GET = _descriptor.Descriptor(
name='CMD_S_Cannon_Get',
full_name='CMD.CMD_S_Cannon_Get',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_Get.cannon_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='expiration', full_name='CMD.CMD_S_Cannon_Get.expiration', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='valid_id', full_name='CMD.CMD_S_Cannon_Get.valid_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='is_show', full_name='CMD.CMD_S_Cannon_Get.is_show', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8383,
serialized_end=8475,
)
_CMD_S_CANNON_SYNCATTACKSPEED = _descriptor.Descriptor(
name='CMD_S_Cannon_SyncAttackSpeed',
full_name='CMD.CMD_S_Cannon_SyncAttackSpeed',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value_type', full_name='CMD.CMD_S_Cannon_SyncAttackSpeed.value_type', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='attack_speed', full_name='CMD.CMD_S_Cannon_SyncAttackSpeed.attack_speed', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8477,
serialized_end=8549,
)
_CMD_S_CANNON_CHANGEFIRE = _descriptor.Descriptor(
name='CMD_S_Cannon_ChangeFire',
full_name='CMD.CMD_S_Cannon_ChangeFire',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='bullet_mulriple', full_name='CMD.CMD_S_Cannon_ChangeFire.bullet_mulriple', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='chair_id', full_name='CMD.CMD_S_Cannon_ChangeFire.chair_id', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cannon_id', full_name='CMD.CMD_S_Cannon_ChangeFire.cannon_id', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cannon_num', full_name='CMD.CMD_S_Cannon_ChangeFire.cannon_num', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8551,
serialized_end=8658,
)
_CMD_MB_S_LOAD_MISSION.fields_by_name['everyday_missions'].message_type = _TAGEVERYDAYMISSION
_CMD_MB_S_LOAD_MISSION.fields_by_name['week_missions'].message_type = _TAGEVERYDAYMISSION
_CMD_MB_S_LOAD_MISSION.fields_by_name['gropup_missions'].message_type = _TAGEVERYDAYMISSION
_CMD_MB_S_LOAD_MISSION.fields_by_name['everyday_ext_missions'].message_type = _TAGEVERYDAYEXTMISSION
_CMD_MB_S_LOAD_MISSION.fields_by_name['weekday_ext_missions'].message_type = _TAGWEEKDAYEXTMISSION
_CMD_MB_S_LOAD_MISSION.fields_by_name['week_ext_rewards'].message_type = _TAGWEEKDAYEXTREWARD
_CMD_MB_S_GET_MISSION_REWARD.fields_by_name['reward_list'].message_type = _TAGREWARDITEM
_CMD_MB_S_GET_LIVENESS_REWARD.fields_by_name['reward_list'].message_type = _TAGREWARDITEM
_CMD_MB_S_RESET_MISSION.fields_by_name['everyday_missions'].message_type = _TAGEVERYDAYMISSION
_CMD_MB_S_RESET_MISSION.fields_by_name['week_missions'].message_type = _TAGEVERYDAYMISSION
_LUCKYNUMBERTASK.fields_by_name['status'].enum_type = _LUCKYNUMBERTASK_STATUS
_LUCKYNUMBERTASK_STATUS.containing_type = _LUCKYNUMBERTASK
_CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS.fields_by_name['tasks'].message_type = _LUCKYNUMBERTASK
_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD.fields_by_name['result'].enum_type = _CMD_S_GET_LUCKY_NUMBER_TASK_REWARD_RESULT
_CMD_S_GET_LUCKY_NUMBER_TASK_REWARD_RESULT.containing_type = _CMD_S_GET_LUCKY_NUMBER_TASK_REWARD
_CMD_S_GET_LUCKY_NUMBER_REWARD.fields_by_name['result'].enum_type = _CMD_S_GET_LUCKY_NUMBER_REWARD_RESULT
_CMD_S_GET_LUCKY_NUMBER_REWARD_RESULT.containing_type = _CMD_S_GET_LUCKY_NUMBER_REWARD
DESCRIPTOR.message_types_by_name['tagMBInsureRecordData'] = _TAGMBINSURERECORDDATA
DESCRIPTOR.message_types_by_name['CMD_MB_C2S_ADD_REWARD'] = _CMD_MB_C2S_ADD_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_S2C_ADD_REWARD'] = _CMD_MB_S2C_ADD_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS'] = _CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS
DESCRIPTOR.message_types_by_name['CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS'] = _CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS
DESCRIPTOR.message_types_by_name['tagUserSkill'] = _TAGUSERSKILL
DESCRIPTOR.message_types_by_name['CMD_GR_C_INVITE_MATCH'] = _CMD_GR_C_INVITE_MATCH
DESCRIPTOR.message_types_by_name['CMD_GR_S_INVITE_MATCH'] = _CMD_GR_S_INVITE_MATCH
DESCRIPTOR.message_types_by_name['CMD_Speaker_S_UserChat'] = _CMD_SPEAKER_S_USERCHAT
DESCRIPTOR.message_types_by_name['CMD_Speaker_C_UserChat'] = _CMD_SPEAKER_C_USERCHAT
DESCRIPTOR.message_types_by_name['CMD_Speaker_S_UserChat_Fail'] = _CMD_SPEAKER_S_USERCHAT_FAIL
DESCRIPTOR.message_types_by_name['CMD_C_QueryPurchaseUndealedTrade'] = _CMD_C_QUERYPURCHASEUNDEALEDTRADE
DESCRIPTOR.message_types_by_name['tagRewardItem'] = _TAGREWARDITEM
DESCRIPTOR.message_types_by_name['CMD_MB_C_LOAD_MISSION'] = _CMD_MB_C_LOAD_MISSION
DESCRIPTOR.message_types_by_name['tagEveryDayMission'] = _TAGEVERYDAYMISSION
DESCRIPTOR.message_types_by_name['tagEveryDayExtMission'] = _TAGEVERYDAYEXTMISSION
DESCRIPTOR.message_types_by_name['tagWeekDayExtReward'] = _TAGWEEKDAYEXTREWARD
DESCRIPTOR.message_types_by_name['tagWeekDayExtMission'] = _TAGWEEKDAYEXTMISSION
DESCRIPTOR.message_types_by_name['CMD_MB_S_LOAD_MISSION'] = _CMD_MB_S_LOAD_MISSION
DESCRIPTOR.message_types_by_name['CMD_MB_C_GET_MISSION_REWARD'] = _CMD_MB_C_GET_MISSION_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_S_GET_MISSION_REWARD'] = _CMD_MB_S_GET_MISSION_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_C_GET_LIVENESS_REWARD'] = _CMD_MB_C_GET_LIVENESS_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_S_GET_LIVENESS_REWARD'] = _CMD_MB_S_GET_LIVENESS_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_S_GET_NEW_MISSION_REWARD'] = _CMD_MB_S_GET_NEW_MISSION_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_C_RESET_MISSION'] = _CMD_MB_C_RESET_MISSION
DESCRIPTOR.message_types_by_name['CMD_MB_S_RESET_MISSION'] = _CMD_MB_S_RESET_MISSION
DESCRIPTOR.message_types_by_name['CMD_MB_C_GET_WEEK_REWARD'] = _CMD_MB_C_GET_WEEK_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_S_GET_WEEK_REWARD'] = _CMD_MB_S_GET_WEEK_REWARD
DESCRIPTOR.message_types_by_name['CMD_MB_C2S_ACHIEVEMENT_TITLE'] = _CMD_MB_C2S_ACHIEVEMENT_TITLE
DESCRIPTOR.message_types_by_name['CMD_MB_S2C_ACHIEVEMENT_TITLE'] = _CMD_MB_S2C_ACHIEVEMENT_TITLE
DESCRIPTOR.message_types_by_name['CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE'] = _CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE
DESCRIPTOR.message_types_by_name['CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE'] = _CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE
DESCRIPTOR.message_types_by_name['CMD_MB_C_SDK_BIND'] = _CMD_MB_C_SDK_BIND
DESCRIPTOR.message_types_by_name['CMD_MB_S_SDK_BIND'] = _CMD_MB_S_SDK_BIND
DESCRIPTOR.message_types_by_name['tagRankReward'] = _TAGRANKREWARD
DESCRIPTOR.message_types_by_name['tagArenaRank'] = _TAGARENARANK
DESCRIPTOR.message_types_by_name['CMD_GM_CMD'] = _CMD_GM_CMD
DESCRIPTOR.message_types_by_name['CMD_GM_CMD_RESP'] = _CMD_GM_CMD_RESP
DESCRIPTOR.message_types_by_name['CMD_C_CHAT_SERVER_INFO'] = _CMD_C_CHAT_SERVER_INFO
DESCRIPTOR.message_types_by_name['CMD_S_CHAT_SERVER_INFO'] = _CMD_S_CHAT_SERVER_INFO
DESCRIPTOR.message_types_by_name['CMD_C_LUCKY_NUMBER_INFO'] = _CMD_C_LUCKY_NUMBER_INFO
DESCRIPTOR.message_types_by_name['CMD_S_LUCKY_NUMBER_INFO'] = _CMD_S_LUCKY_NUMBER_INFO
DESCRIPTOR.message_types_by_name['CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS'] = _CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS
DESCRIPTOR.message_types_by_name['LuckyNumberTask'] = _LUCKYNUMBERTASK
DESCRIPTOR.message_types_by_name['CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS'] = _CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS
DESCRIPTOR.message_types_by_name['CMD_C_GET_LUCKY_NUMBER_TASK_REWARD'] = _CMD_C_GET_LUCKY_NUMBER_TASK_REWARD
DESCRIPTOR.message_types_by_name['CMD_S_GET_LUCKY_NUMBER_TASK_REWARD'] = _CMD_S_GET_LUCKY_NUMBER_TASK_REWARD
DESCRIPTOR.message_types_by_name['CMD_C_LOOKUP_LUCKY_NUMBER'] = _CMD_C_LOOKUP_LUCKY_NUMBER
DESCRIPTOR.message_types_by_name['CMD_S_LOOKUP_LUCKY_NUMBER'] = _CMD_S_LOOKUP_LUCKY_NUMBER
DESCRIPTOR.message_types_by_name['CMD_C_GET_LUCKY_NUMBER_REWARD'] = _CMD_C_GET_LUCKY_NUMBER_REWARD
DESCRIPTOR.message_types_by_name['CMD_S_GET_LUCKY_NUMBER_REWARD'] = _CMD_S_GET_LUCKY_NUMBER_REWARD
DESCRIPTOR.message_types_by_name['CMD_C_RECHARGE_IN_LUCKY_NUMBER'] = _CMD_C_RECHARGE_IN_LUCKY_NUMBER
DESCRIPTOR.message_types_by_name['CMD_C_NEWPLAYER_INFO'] = _CMD_C_NEWPLAYER_INFO
DESCRIPTOR.message_types_by_name['CMD_S_NEWPLAYER_INFO'] = _CMD_S_NEWPLAYER_INFO
DESCRIPTOR.message_types_by_name['CMD_C_USER_LOGINDAY_REWARD'] = _CMD_C_USER_LOGINDAY_REWARD
DESCRIPTOR.message_types_by_name['CMD_S_USER_LOGINDAY_REWARD'] = _CMD_S_USER_LOGINDAY_REWARD
DESCRIPTOR.message_types_by_name['CMD_C_CARNIVAL_WELFARE_INFO'] = _CMD_C_CARNIVAL_WELFARE_INFO
DESCRIPTOR.message_types_by_name['CMD_S_CARNIVAL_WELFARE_INFO'] = _CMD_S_CARNIVAL_WELFARE_INFO
DESCRIPTOR.message_types_by_name['CMD_C_CARNIVAL_WELFARE_DRAW'] = _CMD_C_CARNIVAL_WELFARE_DRAW
DESCRIPTOR.message_types_by_name['CMD_S_CARNIVAL_WELFARE_DRAW'] = _CMD_S_CARNIVAL_WELFARE_DRAW
DESCRIPTOR.message_types_by_name['CMD_C_CARNIVAL_WELFARE_REWARD'] = _CMD_C_CARNIVAL_WELFARE_REWARD
DESCRIPTOR.message_types_by_name['CMD_S_CARNIVAL_WELFARE_REWARD'] = _CMD_S_CARNIVAL_WELFARE_REWARD
DESCRIPTOR.message_types_by_name['CMD_C_SEAGOD_GIFT_GET'] = _CMD_C_SEAGOD_GIFT_GET
DESCRIPTOR.message_types_by_name['CMD_S_SEAGOD_GIFT_GET'] = _CMD_S_SEAGOD_GIFT_GET
DESCRIPTOR.message_types_by_name['CMD_S_ANTIADDICTION'] = _CMD_S_ANTIADDICTION
DESCRIPTOR.message_types_by_name['CMD_S_SMT_POP_UP'] = _CMD_S_SMT_POP_UP
DESCRIPTOR.message_types_by_name['CMD_C_GuestRegisterAccount'] = _CMD_C_GUESTREGISTERACCOUNT
DESCRIPTOR.message_types_by_name['CMD_S_GuestRegisterAccount_Result'] = _CMD_S_GUESTREGISTERACCOUNT_RESULT
DESCRIPTOR.message_types_by_name['CMD_C_UserBonusMissionReward'] = _CMD_C_USERBONUSMISSIONREWARD
DESCRIPTOR.message_types_by_name['CMD_S_Mission_AcceptMission_Result'] = _CMD_S_MISSION_ACCEPTMISSION_RESULT
DESCRIPTOR.message_types_by_name['CMD_S_Mission_Reach_Target'] = _CMD_S_MISSION_REACH_TARGET
DESCRIPTOR.message_types_by_name['CMD_C_Mission_BeReward'] = _CMD_C_MISSION_BEREWARD
DESCRIPTOR.message_types_by_name['CMD_S_Mission_BeReward'] = _CMD_S_MISSION_BEREWARD
DESCRIPTOR.message_types_by_name['CMD_C_Mission_Datas'] = _CMD_C_MISSION_DATAS
DESCRIPTOR.message_types_by_name['MissionData'] = _MISSIONDATA
DESCRIPTOR.message_types_by_name['CMD_S_Mission_Datas'] = _CMD_S_MISSION_DATAS
DESCRIPTOR.message_types_by_name['CMD_S_Mission_Completed'] = _CMD_S_MISSION_COMPLETED
DESCRIPTOR.message_types_by_name['CMD_C_Cannon_GetList'] = _CMD_C_CANNON_GETLIST
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_GetList'] = _CMD_S_CANNON_GETLIST
DESCRIPTOR.message_types_by_name['CMD_C_CANNON_GetMaterial'] = _CMD_C_CANNON_GETMATERIAL
DESCRIPTOR.message_types_by_name['CMD_S_CANNON_GetMaterial'] = _CMD_S_CANNON_GETMATERIAL
DESCRIPTOR.message_types_by_name['CMD_C_Cannon_Equip'] = _CMD_C_CANNON_EQUIP
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Equip'] = _CMD_S_CANNON_EQUIP
DESCRIPTOR.message_types_by_name['CMD_C_Cannon_Compound'] = _CMD_C_CANNON_COMPOUND
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Compound'] = _CMD_S_CANNON_COMPOUND
DESCRIPTOR.message_types_by_name['CMD_C_Cannon_Renew'] = _CMD_C_CANNON_RENEW
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Renew'] = _CMD_S_CANNON_RENEW
DESCRIPTOR.message_types_by_name['CMD_C_Cannon_Buy'] = _CMD_C_CANNON_BUY
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Buy'] = _CMD_S_CANNON_BUY
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Overdue'] = _CMD_S_CANNON_OVERDUE
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_Get'] = _CMD_S_CANNON_GET
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_SyncAttackSpeed'] = _CMD_S_CANNON_SYNCATTACKSPEED
DESCRIPTOR.message_types_by_name['CMD_S_Cannon_ChangeFire'] = _CMD_S_CANNON_CHANGEFIRE
DESCRIPTOR.enum_types_by_name['MissionStatus'] = _MISSIONSTATUS
DESCRIPTOR.enum_types_by_name['ReturnResult'] = _RETURNRESULT
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
tagMBInsureRecordData = _reflection.GeneratedProtocolMessageType('tagMBInsureRecordData', (_message.Message,), dict(
DESCRIPTOR = _TAGMBINSURERECORDDATA,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagMBInsureRecordData)
))
_sym_db.RegisterMessage(tagMBInsureRecordData)
CMD_MB_C2S_ADD_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_C2S_ADD_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C2S_ADD_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C2S_ADD_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_C2S_ADD_REWARD)
CMD_MB_S2C_ADD_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_S2C_ADD_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S2C_ADD_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S2C_ADD_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_S2C_ADD_REWARD)
CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS = _reflection.GeneratedProtocolMessageType('CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS)
))
_sym_db.RegisterMessage(CMD_MB_C2S_PURCHASE_TRADE_VIEW_STATUS)
CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS = _reflection.GeneratedProtocolMessageType('CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS)
))
_sym_db.RegisterMessage(CMD_MB_S2C_PURCHASE_TRADE_VIEW_STATUS)
tagUserSkill = _reflection.GeneratedProtocolMessageType('tagUserSkill', (_message.Message,), dict(
DESCRIPTOR = _TAGUSERSKILL,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagUserSkill)
))
_sym_db.RegisterMessage(tagUserSkill)
CMD_GR_C_INVITE_MATCH = _reflection.GeneratedProtocolMessageType('CMD_GR_C_INVITE_MATCH', (_message.Message,), dict(
DESCRIPTOR = _CMD_GR_C_INVITE_MATCH,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_GR_C_INVITE_MATCH)
))
_sym_db.RegisterMessage(CMD_GR_C_INVITE_MATCH)
CMD_GR_S_INVITE_MATCH = _reflection.GeneratedProtocolMessageType('CMD_GR_S_INVITE_MATCH', (_message.Message,), dict(
DESCRIPTOR = _CMD_GR_S_INVITE_MATCH,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_GR_S_INVITE_MATCH)
))
_sym_db.RegisterMessage(CMD_GR_S_INVITE_MATCH)
CMD_Speaker_S_UserChat = _reflection.GeneratedProtocolMessageType('CMD_Speaker_S_UserChat', (_message.Message,), dict(
DESCRIPTOR = _CMD_SPEAKER_S_USERCHAT,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_Speaker_S_UserChat)
))
_sym_db.RegisterMessage(CMD_Speaker_S_UserChat)
CMD_Speaker_C_UserChat = _reflection.GeneratedProtocolMessageType('CMD_Speaker_C_UserChat', (_message.Message,), dict(
DESCRIPTOR = _CMD_SPEAKER_C_USERCHAT,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_Speaker_C_UserChat)
))
_sym_db.RegisterMessage(CMD_Speaker_C_UserChat)
CMD_Speaker_S_UserChat_Fail = _reflection.GeneratedProtocolMessageType('CMD_Speaker_S_UserChat_Fail', (_message.Message,), dict(
DESCRIPTOR = _CMD_SPEAKER_S_USERCHAT_FAIL,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_Speaker_S_UserChat_Fail)
))
_sym_db.RegisterMessage(CMD_Speaker_S_UserChat_Fail)
CMD_C_QueryPurchaseUndealedTrade = _reflection.GeneratedProtocolMessageType('CMD_C_QueryPurchaseUndealedTrade', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_QUERYPURCHASEUNDEALEDTRADE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_QueryPurchaseUndealedTrade)
))
_sym_db.RegisterMessage(CMD_C_QueryPurchaseUndealedTrade)
tagRewardItem = _reflection.GeneratedProtocolMessageType('tagRewardItem', (_message.Message,), dict(
DESCRIPTOR = _TAGREWARDITEM,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagRewardItem)
))
_sym_db.RegisterMessage(tagRewardItem)
CMD_MB_C_LOAD_MISSION = _reflection.GeneratedProtocolMessageType('CMD_MB_C_LOAD_MISSION', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_LOAD_MISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_LOAD_MISSION)
))
_sym_db.RegisterMessage(CMD_MB_C_LOAD_MISSION)
tagEveryDayMission = _reflection.GeneratedProtocolMessageType('tagEveryDayMission', (_message.Message,), dict(
DESCRIPTOR = _TAGEVERYDAYMISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagEveryDayMission)
))
_sym_db.RegisterMessage(tagEveryDayMission)
tagEveryDayExtMission = _reflection.GeneratedProtocolMessageType('tagEveryDayExtMission', (_message.Message,), dict(
DESCRIPTOR = _TAGEVERYDAYEXTMISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagEveryDayExtMission)
))
_sym_db.RegisterMessage(tagEveryDayExtMission)
tagWeekDayExtReward = _reflection.GeneratedProtocolMessageType('tagWeekDayExtReward', (_message.Message,), dict(
DESCRIPTOR = _TAGWEEKDAYEXTREWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagWeekDayExtReward)
))
_sym_db.RegisterMessage(tagWeekDayExtReward)
tagWeekDayExtMission = _reflection.GeneratedProtocolMessageType('tagWeekDayExtMission', (_message.Message,), dict(
DESCRIPTOR = _TAGWEEKDAYEXTMISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagWeekDayExtMission)
))
_sym_db.RegisterMessage(tagWeekDayExtMission)
CMD_MB_S_LOAD_MISSION = _reflection.GeneratedProtocolMessageType('CMD_MB_S_LOAD_MISSION', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_LOAD_MISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_LOAD_MISSION)
))
_sym_db.RegisterMessage(CMD_MB_S_LOAD_MISSION)
CMD_MB_C_GET_MISSION_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_C_GET_MISSION_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_GET_MISSION_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_GET_MISSION_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_C_GET_MISSION_REWARD)
CMD_MB_S_GET_MISSION_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_S_GET_MISSION_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_GET_MISSION_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_GET_MISSION_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_S_GET_MISSION_REWARD)
CMD_MB_C_GET_LIVENESS_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_C_GET_LIVENESS_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_GET_LIVENESS_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_GET_LIVENESS_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_C_GET_LIVENESS_REWARD)
CMD_MB_S_GET_LIVENESS_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_S_GET_LIVENESS_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_GET_LIVENESS_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_GET_LIVENESS_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_S_GET_LIVENESS_REWARD)
CMD_MB_S_GET_NEW_MISSION_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_S_GET_NEW_MISSION_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_GET_NEW_MISSION_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_GET_NEW_MISSION_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_S_GET_NEW_MISSION_REWARD)
CMD_MB_C_RESET_MISSION = _reflection.GeneratedProtocolMessageType('CMD_MB_C_RESET_MISSION', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_RESET_MISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_RESET_MISSION)
))
_sym_db.RegisterMessage(CMD_MB_C_RESET_MISSION)
CMD_MB_S_RESET_MISSION = _reflection.GeneratedProtocolMessageType('CMD_MB_S_RESET_MISSION', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_RESET_MISSION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_RESET_MISSION)
))
_sym_db.RegisterMessage(CMD_MB_S_RESET_MISSION)
CMD_MB_C_GET_WEEK_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_C_GET_WEEK_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_GET_WEEK_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_GET_WEEK_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_C_GET_WEEK_REWARD)
CMD_MB_S_GET_WEEK_REWARD = _reflection.GeneratedProtocolMessageType('CMD_MB_S_GET_WEEK_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_GET_WEEK_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_GET_WEEK_REWARD)
))
_sym_db.RegisterMessage(CMD_MB_S_GET_WEEK_REWARD)
CMD_MB_C2S_ACHIEVEMENT_TITLE = _reflection.GeneratedProtocolMessageType('CMD_MB_C2S_ACHIEVEMENT_TITLE', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C2S_ACHIEVEMENT_TITLE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C2S_ACHIEVEMENT_TITLE)
))
_sym_db.RegisterMessage(CMD_MB_C2S_ACHIEVEMENT_TITLE)
CMD_MB_S2C_ACHIEVEMENT_TITLE = _reflection.GeneratedProtocolMessageType('CMD_MB_S2C_ACHIEVEMENT_TITLE', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S2C_ACHIEVEMENT_TITLE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S2C_ACHIEVEMENT_TITLE)
))
_sym_db.RegisterMessage(CMD_MB_S2C_ACHIEVEMENT_TITLE)
CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE = _reflection.GeneratedProtocolMessageType('CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE)
))
_sym_db.RegisterMessage(CMD_MB_C2S_PUT_ON_ACHIEVEMENT_TITLE)
CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE = _reflection.GeneratedProtocolMessageType('CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE)
))
_sym_db.RegisterMessage(CMD_MB_S2C_PUT_ON_ACHIEVEMENT_TITLE)
CMD_MB_C_SDK_BIND = _reflection.GeneratedProtocolMessageType('CMD_MB_C_SDK_BIND', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_C_SDK_BIND,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_C_SDK_BIND)
))
_sym_db.RegisterMessage(CMD_MB_C_SDK_BIND)
CMD_MB_S_SDK_BIND = _reflection.GeneratedProtocolMessageType('CMD_MB_S_SDK_BIND', (_message.Message,), dict(
DESCRIPTOR = _CMD_MB_S_SDK_BIND,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_MB_S_SDK_BIND)
))
_sym_db.RegisterMessage(CMD_MB_S_SDK_BIND)
tagRankReward = _reflection.GeneratedProtocolMessageType('tagRankReward', (_message.Message,), dict(
DESCRIPTOR = _TAGRANKREWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagRankReward)
))
_sym_db.RegisterMessage(tagRankReward)
tagArenaRank = _reflection.GeneratedProtocolMessageType('tagArenaRank', (_message.Message,), dict(
DESCRIPTOR = _TAGARENARANK,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.tagArenaRank)
))
_sym_db.RegisterMessage(tagArenaRank)
CMD_GM_CMD = _reflection.GeneratedProtocolMessageType('CMD_GM_CMD', (_message.Message,), dict(
DESCRIPTOR = _CMD_GM_CMD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_GM_CMD)
))
_sym_db.RegisterMessage(CMD_GM_CMD)
CMD_GM_CMD_RESP = _reflection.GeneratedProtocolMessageType('CMD_GM_CMD_RESP', (_message.Message,), dict(
DESCRIPTOR = _CMD_GM_CMD_RESP,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_GM_CMD_RESP)
))
_sym_db.RegisterMessage(CMD_GM_CMD_RESP)
CMD_C_CHAT_SERVER_INFO = _reflection.GeneratedProtocolMessageType('CMD_C_CHAT_SERVER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CHAT_SERVER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_CHAT_SERVER_INFO)
))
_sym_db.RegisterMessage(CMD_C_CHAT_SERVER_INFO)
CMD_S_CHAT_SERVER_INFO = _reflection.GeneratedProtocolMessageType('CMD_S_CHAT_SERVER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CHAT_SERVER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_CHAT_SERVER_INFO)
))
_sym_db.RegisterMessage(CMD_S_CHAT_SERVER_INFO)
CMD_C_LUCKY_NUMBER_INFO = _reflection.GeneratedProtocolMessageType('CMD_C_LUCKY_NUMBER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_LUCKY_NUMBER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_LUCKY_NUMBER_INFO)
))
_sym_db.RegisterMessage(CMD_C_LUCKY_NUMBER_INFO)
CMD_S_LUCKY_NUMBER_INFO = _reflection.GeneratedProtocolMessageType('CMD_S_LUCKY_NUMBER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_LUCKY_NUMBER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_LUCKY_NUMBER_INFO)
))
_sym_db.RegisterMessage(CMD_S_LUCKY_NUMBER_INFO)
CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS = _reflection.GeneratedProtocolMessageType('CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS)
))
_sym_db.RegisterMessage(CMD_C_GET_LUCKY_NUMBER_TASK_PROGRESS)
LuckyNumberTask = _reflection.GeneratedProtocolMessageType('LuckyNumberTask', (_message.Message,), dict(
DESCRIPTOR = _LUCKYNUMBERTASK,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.LuckyNumberTask)
))
_sym_db.RegisterMessage(LuckyNumberTask)
CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS = _reflection.GeneratedProtocolMessageType('CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS)
))
_sym_db.RegisterMessage(CMD_S_GET_LUCKY_NUMBER_TASK_PROGRESS)
CMD_C_GET_LUCKY_NUMBER_TASK_REWARD = _reflection.GeneratedProtocolMessageType('CMD_C_GET_LUCKY_NUMBER_TASK_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_GET_LUCKY_NUMBER_TASK_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_GET_LUCKY_NUMBER_TASK_REWARD)
))
_sym_db.RegisterMessage(CMD_C_GET_LUCKY_NUMBER_TASK_REWARD)
CMD_S_GET_LUCKY_NUMBER_TASK_REWARD = _reflection.GeneratedProtocolMessageType('CMD_S_GET_LUCKY_NUMBER_TASK_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_GET_LUCKY_NUMBER_TASK_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_GET_LUCKY_NUMBER_TASK_REWARD)
))
_sym_db.RegisterMessage(CMD_S_GET_LUCKY_NUMBER_TASK_REWARD)
CMD_C_LOOKUP_LUCKY_NUMBER = _reflection.GeneratedProtocolMessageType('CMD_C_LOOKUP_LUCKY_NUMBER', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_LOOKUP_LUCKY_NUMBER,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_LOOKUP_LUCKY_NUMBER)
))
_sym_db.RegisterMessage(CMD_C_LOOKUP_LUCKY_NUMBER)
CMD_S_LOOKUP_LUCKY_NUMBER = _reflection.GeneratedProtocolMessageType('CMD_S_LOOKUP_LUCKY_NUMBER', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_LOOKUP_LUCKY_NUMBER,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_LOOKUP_LUCKY_NUMBER)
))
_sym_db.RegisterMessage(CMD_S_LOOKUP_LUCKY_NUMBER)
CMD_C_GET_LUCKY_NUMBER_REWARD = _reflection.GeneratedProtocolMessageType('CMD_C_GET_LUCKY_NUMBER_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_GET_LUCKY_NUMBER_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_GET_LUCKY_NUMBER_REWARD)
))
_sym_db.RegisterMessage(CMD_C_GET_LUCKY_NUMBER_REWARD)
CMD_S_GET_LUCKY_NUMBER_REWARD = _reflection.GeneratedProtocolMessageType('CMD_S_GET_LUCKY_NUMBER_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_GET_LUCKY_NUMBER_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_GET_LUCKY_NUMBER_REWARD)
))
_sym_db.RegisterMessage(CMD_S_GET_LUCKY_NUMBER_REWARD)
CMD_C_RECHARGE_IN_LUCKY_NUMBER = _reflection.GeneratedProtocolMessageType('CMD_C_RECHARGE_IN_LUCKY_NUMBER', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_RECHARGE_IN_LUCKY_NUMBER,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_RECHARGE_IN_LUCKY_NUMBER)
))
_sym_db.RegisterMessage(CMD_C_RECHARGE_IN_LUCKY_NUMBER)
CMD_C_NEWPLAYER_INFO = _reflection.GeneratedProtocolMessageType('CMD_C_NEWPLAYER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_NEWPLAYER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_NEWPLAYER_INFO)
))
_sym_db.RegisterMessage(CMD_C_NEWPLAYER_INFO)
CMD_S_NEWPLAYER_INFO = _reflection.GeneratedProtocolMessageType('CMD_S_NEWPLAYER_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_NEWPLAYER_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_NEWPLAYER_INFO)
))
_sym_db.RegisterMessage(CMD_S_NEWPLAYER_INFO)
CMD_C_USER_LOGINDAY_REWARD = _reflection.GeneratedProtocolMessageType('CMD_C_USER_LOGINDAY_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_USER_LOGINDAY_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_USER_LOGINDAY_REWARD)
))
_sym_db.RegisterMessage(CMD_C_USER_LOGINDAY_REWARD)
CMD_S_USER_LOGINDAY_REWARD = _reflection.GeneratedProtocolMessageType('CMD_S_USER_LOGINDAY_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_USER_LOGINDAY_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_USER_LOGINDAY_REWARD)
))
_sym_db.RegisterMessage(CMD_S_USER_LOGINDAY_REWARD)
CMD_C_CARNIVAL_WELFARE_INFO = _reflection.GeneratedProtocolMessageType('CMD_C_CARNIVAL_WELFARE_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CARNIVAL_WELFARE_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_CARNIVAL_WELFARE_INFO)
))
_sym_db.RegisterMessage(CMD_C_CARNIVAL_WELFARE_INFO)
CMD_S_CARNIVAL_WELFARE_INFO = _reflection.GeneratedProtocolMessageType('CMD_S_CARNIVAL_WELFARE_INFO', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CARNIVAL_WELFARE_INFO,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_CARNIVAL_WELFARE_INFO)
))
_sym_db.RegisterMessage(CMD_S_CARNIVAL_WELFARE_INFO)
CMD_C_CARNIVAL_WELFARE_DRAW = _reflection.GeneratedProtocolMessageType('CMD_C_CARNIVAL_WELFARE_DRAW', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CARNIVAL_WELFARE_DRAW,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_CARNIVAL_WELFARE_DRAW)
))
_sym_db.RegisterMessage(CMD_C_CARNIVAL_WELFARE_DRAW)
CMD_S_CARNIVAL_WELFARE_DRAW = _reflection.GeneratedProtocolMessageType('CMD_S_CARNIVAL_WELFARE_DRAW', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CARNIVAL_WELFARE_DRAW,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_CARNIVAL_WELFARE_DRAW)
))
_sym_db.RegisterMessage(CMD_S_CARNIVAL_WELFARE_DRAW)
CMD_C_CARNIVAL_WELFARE_REWARD = _reflection.GeneratedProtocolMessageType('CMD_C_CARNIVAL_WELFARE_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CARNIVAL_WELFARE_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_CARNIVAL_WELFARE_REWARD)
))
_sym_db.RegisterMessage(CMD_C_CARNIVAL_WELFARE_REWARD)
CMD_S_CARNIVAL_WELFARE_REWARD = _reflection.GeneratedProtocolMessageType('CMD_S_CARNIVAL_WELFARE_REWARD', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CARNIVAL_WELFARE_REWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_CARNIVAL_WELFARE_REWARD)
))
_sym_db.RegisterMessage(CMD_S_CARNIVAL_WELFARE_REWARD)
CMD_C_SEAGOD_GIFT_GET = _reflection.GeneratedProtocolMessageType('CMD_C_SEAGOD_GIFT_GET', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_SEAGOD_GIFT_GET,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_SEAGOD_GIFT_GET)
))
_sym_db.RegisterMessage(CMD_C_SEAGOD_GIFT_GET)
CMD_S_SEAGOD_GIFT_GET = _reflection.GeneratedProtocolMessageType('CMD_S_SEAGOD_GIFT_GET', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_SEAGOD_GIFT_GET,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_SEAGOD_GIFT_GET)
))
_sym_db.RegisterMessage(CMD_S_SEAGOD_GIFT_GET)
CMD_S_ANTIADDICTION = _reflection.GeneratedProtocolMessageType('CMD_S_ANTIADDICTION', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_ANTIADDICTION,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_ANTIADDICTION)
))
_sym_db.RegisterMessage(CMD_S_ANTIADDICTION)
CMD_S_SMT_POP_UP = _reflection.GeneratedProtocolMessageType('CMD_S_SMT_POP_UP', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_SMT_POP_UP,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_SMT_POP_UP)
))
_sym_db.RegisterMessage(CMD_S_SMT_POP_UP)
CMD_C_GuestRegisterAccount = _reflection.GeneratedProtocolMessageType('CMD_C_GuestRegisterAccount', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_GUESTREGISTERACCOUNT,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_GuestRegisterAccount)
))
_sym_db.RegisterMessage(CMD_C_GuestRegisterAccount)
CMD_S_GuestRegisterAccount_Result = _reflection.GeneratedProtocolMessageType('CMD_S_GuestRegisterAccount_Result', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_GUESTREGISTERACCOUNT_RESULT,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_GuestRegisterAccount_Result)
))
_sym_db.RegisterMessage(CMD_S_GuestRegisterAccount_Result)
CMD_C_UserBonusMissionReward = _reflection.GeneratedProtocolMessageType('CMD_C_UserBonusMissionReward', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_USERBONUSMISSIONREWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_UserBonusMissionReward)
))
_sym_db.RegisterMessage(CMD_C_UserBonusMissionReward)
CMD_S_Mission_AcceptMission_Result = _reflection.GeneratedProtocolMessageType('CMD_S_Mission_AcceptMission_Result', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_MISSION_ACCEPTMISSION_RESULT,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Mission_AcceptMission_Result)
))
_sym_db.RegisterMessage(CMD_S_Mission_AcceptMission_Result)
CMD_S_Mission_Reach_Target = _reflection.GeneratedProtocolMessageType('CMD_S_Mission_Reach_Target', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_MISSION_REACH_TARGET,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Mission_Reach_Target)
))
_sym_db.RegisterMessage(CMD_S_Mission_Reach_Target)
CMD_C_Mission_BeReward = _reflection.GeneratedProtocolMessageType('CMD_C_Mission_BeReward', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_MISSION_BEREWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Mission_BeReward)
))
_sym_db.RegisterMessage(CMD_C_Mission_BeReward)
CMD_S_Mission_BeReward = _reflection.GeneratedProtocolMessageType('CMD_S_Mission_BeReward', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_MISSION_BEREWARD,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Mission_BeReward)
))
_sym_db.RegisterMessage(CMD_S_Mission_BeReward)
CMD_C_Mission_Datas = _reflection.GeneratedProtocolMessageType('CMD_C_Mission_Datas', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_MISSION_DATAS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Mission_Datas)
))
_sym_db.RegisterMessage(CMD_C_Mission_Datas)
MissionData = _reflection.GeneratedProtocolMessageType('MissionData', (_message.Message,), dict(
DESCRIPTOR = _MISSIONDATA,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.MissionData)
))
_sym_db.RegisterMessage(MissionData)
CMD_S_Mission_Datas = _reflection.GeneratedProtocolMessageType('CMD_S_Mission_Datas', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_MISSION_DATAS,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Mission_Datas)
))
_sym_db.RegisterMessage(CMD_S_Mission_Datas)
CMD_S_Mission_Completed = _reflection.GeneratedProtocolMessageType('CMD_S_Mission_Completed', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_MISSION_COMPLETED,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Mission_Completed)
))
_sym_db.RegisterMessage(CMD_S_Mission_Completed)
CMD_C_Cannon_GetList = _reflection.GeneratedProtocolMessageType('CMD_C_Cannon_GetList', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_GETLIST,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Cannon_GetList)
))
_sym_db.RegisterMessage(CMD_C_Cannon_GetList)
CMD_S_Cannon_GetList = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_GetList', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_GETLIST,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_GetList)
))
_sym_db.RegisterMessage(CMD_S_Cannon_GetList)
CMD_C_CANNON_GetMaterial = _reflection.GeneratedProtocolMessageType('CMD_C_CANNON_GetMaterial', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_GETMATERIAL,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_CANNON_GetMaterial)
))
_sym_db.RegisterMessage(CMD_C_CANNON_GetMaterial)
CMD_S_CANNON_GetMaterial = _reflection.GeneratedProtocolMessageType('CMD_S_CANNON_GetMaterial', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_GETMATERIAL,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_CANNON_GetMaterial)
))
_sym_db.RegisterMessage(CMD_S_CANNON_GetMaterial)
CMD_C_Cannon_Equip = _reflection.GeneratedProtocolMessageType('CMD_C_Cannon_Equip', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_EQUIP,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Cannon_Equip)
))
_sym_db.RegisterMessage(CMD_C_Cannon_Equip)
CMD_S_Cannon_Equip = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Equip', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_EQUIP,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Equip)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Equip)
CMD_C_Cannon_Compound = _reflection.GeneratedProtocolMessageType('CMD_C_Cannon_Compound', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_COMPOUND,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Cannon_Compound)
))
_sym_db.RegisterMessage(CMD_C_Cannon_Compound)
CMD_S_Cannon_Compound = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Compound', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_COMPOUND,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Compound)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Compound)
CMD_C_Cannon_Renew = _reflection.GeneratedProtocolMessageType('CMD_C_Cannon_Renew', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_RENEW,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Cannon_Renew)
))
_sym_db.RegisterMessage(CMD_C_Cannon_Renew)
CMD_S_Cannon_Renew = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Renew', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_RENEW,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Renew)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Renew)
CMD_C_Cannon_Buy = _reflection.GeneratedProtocolMessageType('CMD_C_Cannon_Buy', (_message.Message,), dict(
DESCRIPTOR = _CMD_C_CANNON_BUY,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_C_Cannon_Buy)
))
_sym_db.RegisterMessage(CMD_C_Cannon_Buy)
CMD_S_Cannon_Buy = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Buy', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_BUY,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Buy)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Buy)
CMD_S_Cannon_Overdue = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Overdue', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_OVERDUE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Overdue)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Overdue)
CMD_S_Cannon_Get = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_Get', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_GET,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_Get)
))
_sym_db.RegisterMessage(CMD_S_Cannon_Get)
CMD_S_Cannon_SyncAttackSpeed = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_SyncAttackSpeed', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_SYNCATTACKSPEED,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_SyncAttackSpeed)
))
_sym_db.RegisterMessage(CMD_S_Cannon_SyncAttackSpeed)
CMD_S_Cannon_ChangeFire = _reflection.GeneratedProtocolMessageType('CMD_S_Cannon_ChangeFire', (_message.Message,), dict(
DESCRIPTOR = _CMD_S_CANNON_CHANGEFIRE,
__module__ = 'CMD_Common_pb2'
# @@protoc_insertion_point(class_scope:CMD.CMD_S_Cannon_ChangeFire)
))
_sym_db.RegisterMessage(CMD_S_Cannon_ChangeFire)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('H\003'))
# @@protoc_insertion_point(module_scope)
| [
"zgamecn@gmail.com"
] | zgamecn@gmail.com |
ea6fdf478c90c30efb64a2ba95b12e17e9f6ad75 | eabb3c95950f300af29006f5a5c26b90e7a69215 | /cogs/exams.py | 6e9761e8f9342e2ac8c45e0b91b7fc6ea5db034f | [] | no_license | Naapperas/discord-spam-bot | c54516273198a8e075bfebf4c1d04a714be498a7 | 228ea1f54e9e6f052774933c558479eaa65893d5 | refs/heads/main | 2023-04-26T05:15:52.202854 | 2021-02-26T23:34:52 | 2021-02-26T23:34:52 | 325,410,961 | 4 | 1 | null | 2021-05-26T17:25:02 | 2020-12-29T23:48:22 | Python | UTF-8 | Python | false | false | 214 | py | from discord.ext import commands
class Exams(commands.Cog):
""" WORK IN PROGRESS """
the_bot = None
def __init__(self, bot):
self.the_bot = bot
def setup(bot):
bot.add_cog(Exams(bot)) | [
"nunoafonso2002@gmail.com"
] | nunoafonso2002@gmail.com |
16f3ec1bc9e51e73213915cc185e07a78720012c | ffe07381cfe69811a7a33216df945bbef1035c19 | /Exams/Exam_12_December_2020/project/factory/chocolate_factory.py | 4e596caed3b7a5135c6a502f1aef2ff316f9a055 | [
"MIT"
] | permissive | MNikov/Python-OOP-October-2020 | 7448e2bb6a2753a2eb6a8a33173d0ad560be9c3a | a53e4555758ec810605e31e7b2c71b65c49b2332 | refs/heads/main | 2023-01-31T06:46:55.013236 | 2020-12-14T21:57:09 | 2020-12-14T21:57:09 | 306,955,136 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,132 | py | from collections import defaultdict
from project.factory.factory import Factory
class ChocolateFactory(Factory):
def __init__(self, name: str, capacity: int):
super().__init__(name, capacity)
self.recipes = {}
self.products = defaultdict(int)
def add_ingredient(self, ingredient_type: str, quantity: int):
correct_ingredients = ["white chocolate", "dark chocolate", "milk chocolate", "sugar"]
if ingredient_type in correct_ingredients and self.can_add(quantity):
if ingredient_type not in self.ingredients:
self.ingredients[ingredient_type] = 0
self.ingredients[ingredient_type] += quantity
# self.capacity -= quantity # BEWARE OF THIS
elif not self.can_add(quantity):
raise ValueError("Not enough space in factory")
elif ingredient_type not in correct_ingredients:
raise TypeError(f"Ingredient of type {ingredient_type} not allowed in {self.__class__.__name__}")
def remove_ingredient(self, ingredient_type: str, quantity: int):
if ingredient_type not in self.ingredients:
raise KeyError("No such product in the factory")
if ingredient_type in self.ingredients and self.ingredients[ingredient_type] >= quantity:
self.ingredients[ingredient_type] -= quantity
# self.capacity += quantity ############
elif self.ingredients[ingredient_type] < quantity:
raise ValueError("Ingredient quantity cannot be less than zero")
def add_recipe(self, recipe_name: str, recipe: dict):
if recipe_name not in self.recipes:
self.recipes[recipe_name] = recipe
else:
self.recipes[recipe_name].update(recipe)
def make_chocolate(self, recipe_name: str):
if recipe_name in self.recipes.keys():
self.products[recipe_name] += 1
for pr in self.recipes[recipe_name].keys():
self.remove_ingredient(pr, quantity=self.recipes[recipe_name][pr])
if recipe_name not in self.recipes.keys():
raise TypeError("No such recipe")
| [
"momchildnikov@gmail.com"
] | momchildnikov@gmail.com |
a60df399e75a0d5b78134275b9093e6522bd29f8 | 39326d9b822e6cde7cabec6c4cf94c662ef1563d | /src/utils/__init__.py | ba3ef44cec166b7507bcbedb8cd8c88f23d4bdfe | [
"MIT"
] | permissive | saurabh1e/FlaskStructure | 5c5f0c9f3460a0d50cbf1679c159312fdff8aff2 | 5291e2c6d994863b7962b07a9fab8b8580405c56 | refs/heads/master | 2021-01-19T03:18:24.502382 | 2016-11-07T07:07:06 | 2016-11-07T07:07:06 | 54,580,083 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 218 | py | from .api import api, BaseResource, OpenResource, CommonResource
from .models import db, ReprMixin, BaseMixin
from .factory import create_app
from .schema import ma
from .blue_prints import bp
from .admin import admin
| [
"saurabh.1e1@gmail.com"
] | saurabh.1e1@gmail.com |
fea95fa83e55873b4d370be0a5fb6868f3e0d931 | a560269290749e10466b1a29584f06a2b8385a47 | /Notebooks/py/ruthwikmasina/keras-to-rescue-passengers/keras-to-rescue-passengers.py | 2a42f15ee31f3edcce08e19a500f1543ca933e58 | [] | no_license | nischalshrestha/automatic_wat_discovery | c71befad1aa358ae876d5494a67b0f4aa1266f23 | 982e700d8e4698a501afffd6c3a2f35346c34f95 | refs/heads/master | 2022-04-07T12:40:24.376871 | 2020-03-15T22:27:39 | 2020-03-15T22:27:39 | 208,379,586 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 7,961 | py | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
import matplotlib.pyplot as plt
plt.rc("font", size=14)
import seaborn as sns
sns.set(style="white") #white background style for seaborn plots
sns.set(style="whitegrid", color_codes=True)
import tensorflow as tf
from tensorflow.python.framework import ops
import math
from keras.models import Sequential
from keras.layers import Dense
import keras.backend as K
from keras import optimizers
# In[ ]:
# Read CSV train data file into DataFrame
train_df = pd.read_csv("../input/train.csv")
# Read CSV test data file into DataFrame
test_df = pd.read_csv("../input/test.csv")
# preview train data
train_df.head()
# In[ ]:
print('The number of samples into the train data is {}.'.format(train_df.shape[0]))
# In[ ]:
# preview test data
test_df.head()
# In[ ]:
print('The number of samples into the test data is {}.'.format(test_df.shape[0]))
# In[ ]:
# check missing values in train data
train_df.isnull().sum()
# ### Age - Missing Values
# In[ ]:
# percent of missing "Age"
print('Percent of missing "Age" records is %.2f%%' %((train_df['Age'].isnull().sum()/train_df.shape[0])*100))
# In[ ]:
ax = train_df["Age"].hist(bins=15, density=True, stacked=True, color='teal', alpha=0.6)
train_df["Age"].plot(kind='density', color='teal')
ax.set(xlabel='Age')
plt.xlim(-10,85)
plt.show()
# In[ ]:
# mean age
print('The mean of "Age" is %.2f' %(train_df["Age"].mean(skipna=True)))
# median age
print('The median of "Age" is %.2f' %(train_df["Age"].median(skipna=True)))
# ### Cabin - Missing Values
# In[ ]:
# percent of missing "Cabin"
print('Percent of missing "Cabin" records is %.2f%%' %((train_df['Cabin'].isnull().sum()/train_df.shape[0])*100))
# ### Embarked - Missing Values
# In[ ]:
# percent of missing "Embarked"
print('Percent of missing "Embarked" records is %.2f%%' %((train_df['Embarked'].isnull().sum()/train_df.shape[0])*100))
# In[ ]:
print('Boarded passengers grouped by port of embarkation (C = Cherbourg, Q = Queenstown, S = Southampton):')
print(train_df['Embarked'].value_counts())
sns.countplot(x='Embarked', data=train_df, palette='Set2')
plt.show()
# In[ ]:
print('The most common boarding port of embarkation is %s.' %train_df['Embarked'].value_counts().idxmax())
# ### Final Adjustments to Data (Train & Test)
# In[ ]:
train_data = train_df.copy()
train_data["Age"].fillna(train_df["Age"].median(skipna=True), inplace=True)
train_data["Embarked"].fillna(train_df['Embarked'].value_counts().idxmax(), inplace=True)
train_data.drop('Cabin', axis=1, inplace=True)
# In[ ]:
# check missing values in adjusted train data
train_data.isnull().sum()
# In[ ]:
# preview adjusted train data
train_data.head()
# In[ ]:
plt.figure(figsize=(15,8))
ax = train_df["Age"].hist(bins=15, density=True, stacked=True, color='teal', alpha=0.6)
train_df["Age"].plot(kind='density', color='teal')
ax = train_data["Age"].hist(bins=15, density=True, stacked=True, color='orange', alpha=0.5)
train_data["Age"].plot(kind='density', color='orange')
ax.legend(['Raw Age', 'Adjusted Age'])
ax.set(xlabel='Age')
plt.xlim(-10,85)
plt.show()
# ### Additional Variables
#
# In[ ]:
## Create categorical variable for traveling alone
train_data['TravelAlone']=np.where((train_data["SibSp"]+train_data["Parch"])>0, 0, 1)
train_data.drop('SibSp', axis=1, inplace=True)
train_data.drop('Parch', axis=1, inplace=True)
# In[ ]:
#create categorical variables and drop some variables
training=pd.get_dummies(train_data, columns=["Pclass","Embarked","Sex"])
training.drop('Sex_female', axis=1, inplace=True)
# training.drop('PassengerId', axis=1, inplace=True)
training.drop('Name', axis=1, inplace=True)
training.drop('Ticket', axis=1, inplace=True)
final_train = training
final_train.head()
# In[ ]:
test_df.isnull().sum()
# In[ ]:
test_data = test_df.copy()
test_data["Age"].fillna(train_df["Age"].median(skipna=True), inplace=True)
test_data["Fare"].fillna(train_df["Fare"].median(skipna=True), inplace=True)
test_data.drop('Cabin', axis=1, inplace=True)
test_data['TravelAlone']=np.where((test_data["SibSp"]+test_data["Parch"])>0, 0, 1)
test_data.drop('SibSp', axis=1, inplace=True)
test_data.drop('Parch', axis=1, inplace=True)
testing = pd.get_dummies(test_data, columns=["Pclass","Embarked","Sex"])
testing.drop('Sex_female', axis=1, inplace=True)
# testing.drop('PassengerId', axis=1, inplace=True)
testing.drop('Name', axis=1, inplace=True)
testing.drop('Ticket', axis=1, inplace=True)
final_test = testing
final_test.head()
# ### Exploratory Data Analysis
# In[ ]:
plt.figure(figsize=(15,8))
ax = sns.kdeplot(final_train["Age"][final_train.Survived == 1], color="darkturquoise", shade=True)
sns.kdeplot(final_train["Age"][final_train.Survived == 0], color="lightcoral", shade=True)
plt.legend(['Survived', 'Died'])
plt.title('Density Plot of Age for Surviving Population and Deceased Population')
ax.set(xlabel='Age')
plt.xlim(-10,85)
plt.show()
# The age distribution for survivors and deceased is actually very similar. One notable difference is that, of the survivors, a larger proportion were children. The passengers evidently made an attempt to save children by giving them a place on the life rafts.
# In[ ]:
plt.figure(figsize=(20,8))
avg_survival_byage = final_train[["Age", "Survived"]].groupby(['Age'], as_index=False).mean()
g = sns.barplot(x='Age', y='Survived', data=avg_survival_byage, color="LightSeaGreen")
plt.show()
# In[ ]:
final_train['IsMinor']=np.where(final_train['Age']<=16, 1, 0)
final_test['IsMinor']=np.where(final_test['Age']<=16, 1, 0)
# ### Exploration of Gender Variable
# In[ ]:
# In[ ]:
sns.barplot('Sex', 'Survived', data=train_df, color="aquamarine")
plt.show()
# ### Input and Output
# In[ ]:
final_train.head(10)
# In[ ]:
final_test.head()
# In[ ]:
def one_hot_encoder(labels, C):
C = tf.constant(C, dtype = tf.int32)
one_hot_matrix = tf.one_hot(labels, depth = C, axis = 0)
session = tf.Session()
one_hot_mat = session.run(one_hot_matrix)
session.close()
return one_hot_mat
# In[ ]:
survived = final_train['Survived'].tolist()
test_labels = survived[:]
test_labels = np.array(test_labels)
test_labels = one_hot_encoder(test_labels, 2)
print(test_labels.shape)
# In[ ]:
cols = ["Age","TravelAlone","Pclass_1","Pclass_2","Embarked_C","Embarked_S","Sex_male","IsMinor"]
# X = final_train[cols]
# y = final_train['Survived']
# In[ ]:
# Get labels
# y = test_labels.T
y = final_train[['Survived']].values
# Get inputs; we define our x and y here.
X = final_train[cols]
print(X.shape, y.shape) # Print shapes just to check
# In[ ]:
#Split the dataset into train and test sets
# X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20,random_state=0)
# In[ ]:
# print(X_train.shape, X_test.shape, y_train.shape, y_test.shape)
# In[ ]:
def get_model(n_x, n_h1, n_h2):
# np.random.seed(10)
# K.clear_session()
model = Sequential()
model.add(Dense(n_h1, input_dim=n_x, activation='relu'))
model.add(Dense(n_h2, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
adam = optimizers.Adam(lr=0.01)
model.compile(loss='binary_crossentropy', optimizer=adam, metrics=['accuracy'])
print(model.summary())
return model
# In[ ]:
(n_x, m) = X.T.shape
n_h1 = 8
n_h2 = 12
batch_size = 128
epochs = 200
print(n_x)
# In[ ]:
model = get_model(n_x, n_h1, n_h2)
model.fit(X, y,epochs=epochs, batch_size=batch_size, verbose=2)
# In[ ]:
# predictions = model.predict_classes(final_test[cols])
final_test['Survived'] = model.predict_classes(final_test[cols])
# In[ ]:
final_test.head(10)
# In[ ]:
submit = final_test[['PassengerId','Survived']]
submit.to_csv("../working/submit.csv", index=False)
# In[ ]:
| [
"bitsorific@gmail.com"
] | bitsorific@gmail.com |
48870732e4026ee935f88cc91d7e123e8711f6a5 | b944cea3e35225fbf13a5c1a50694bb24fb3176a | /scripts/subWsInfoWsOlt.py | df669ea1c95a37f89aa414805e2202a8350e8139 | [] | no_license | QingyuFeng/pyapex | dc2b167905d483a11c156998b9c7ba429e0607c2 | 3909806679f606c5b681261dd33f259c03d5cb54 | refs/heads/main | 2023-04-10T03:04:30.517124 | 2021-04-11T05:48:53 | 2021-04-11T05:48:53 | 297,032,259 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,487 | py | # -*- coding: utf-8 -*-
import copy
class subWsInfoWsOlt():
def __init__(self, ascInfoWSOlt, subWsVarJSON):
## Json file storing all necessary variables
# After getting the information for routing, it is time
# to process the information into the json files.
self.WsJSON = subWsVarJSON
self.WsJSON, ascInfoWSOlt.wsSubSolOpsLatLon = self.modifywsJSON(
self.WsJSON, ascInfoWSOlt)
def modifywsJSON(self,
json,
GetSubInfo):
wssubsolopslatlong = GetSubInfo.wsSubSolOpsLatLon.copy()
subPath = []
subPathSign = []
for sidx in GetSubInfo.subPurePath[::-1]:
subPath.append(sidx)
for sidx2 in GetSubInfo.subRouting[::-1]:
subPathSign.append(sidx2)
for subid in range(len(subPath)):
# Add the subarea to the JSON
subNo = 0
subNo = int(subPath[subid])
#print(subid, subNo)
wssubsolopslatlong[subid+1] = {}
wssubsolopslatlong[subid+1]['subNorecal'] = subid + 1
# Append ws sub no to the dictionary
wssubsolopslatlong[subid+1]['wsno'] = 1
wssubsolopslatlong[subid+1]['subno'] = subNo
# Subarea information are stored in lists
# Update subarea NO: for routing
json['tempws']['model_setup'][
'subid_snum'].append(subid + 1)
# Update description line:
json['tempws']['model_setup'][
'description_title'].append(subNo)
# Updating Latitude and longitude
json['tempws']['geographic']['latitude_xct'
].append(GetSubInfo.subLatLong[subNo][0])
json['tempws']['geographic']['longitude_yct'
].append(GetSubInfo.subLatLong[subNo][1])
json['tempws']['geographic']['subarea_elev_sael'
].append(GetSubInfo.avgElev[str(subNo)])
# Append iops no to the dictionary
wssubsolopslatlong[subid+1]['lat'] = GetSubInfo.subLatLong[subNo][0]
wssubsolopslatlong[subid+1]['lon'] = GetSubInfo.subLatLong[subNo][1]
# Updating Average upland slope
slplen = 0.0
slplen = GetSubInfo.avgSlope[str(subNo)]
if (slplen > 50.0):
json['tempws']['geographic']['avg_upland_slp'
].append(50.0)
elif( (slplen > 0.0) and (slplen <= 80.0)):
json['tempws']['geographic']['avg_upland_slp'
].append(slplen)
else:
json['tempws']['geographic']['avg_upland_slp'
].append(5.0)
# Updating Average upland slope length
json['tempws']['geographic']['avg_upland_slplen_splg'
].append(GetSubInfo.avgSlpLen[str(subNo)])
# Updating Manning N upland
# tempCSS: temp list storing the crop soil slope
# combination [sub, nass lu, soil mukey, slop group]
tempCSS = []
tempCSS = GetSubInfo.subCSSMaxDict[subNo]
json['tempws']['geographic']['uplandmanningn_upn'
].append(GetSubInfo.nassLuMgtUpn[tempCSS[1]][12])
# Updating soil id
json['tempws']['soil']['soilid'
].append(subid+1)
# Append soil no to the dictionary
wssubsolopslatlong[subid+1]['mukey'] = tempCSS[2]
# Update IOPS NO
json['tempws']['management']['opeartionid_iops'
].append(subid+1)
json['tempws']['management']['OPSName_Reference'
].append(GetSubInfo.nassLuMgtUpn[tempCSS[1]][3])
# Append iops no to the dictionary
wssubsolopslatlong[subid+1]['iopsno'] = GetSubInfo.nassLuMgtUpn[tempCSS[1]][4]
wssubsolopslatlong[subid+1]['iopsnm'] = GetSubInfo.nassLuMgtUpn[tempCSS[1]][3]
# Updating land use no
# There are other conditions, we will use the first
# as default. TODO: may need to refine this later.
json['tempws']['land_use_type']['land_useid_luns'
].append(GetSubInfo.nassLuMgtUpn[tempCSS[1]][5])
# Updating Channel slope:TODO: Calculate the channel and
# Reach slope later some how
#print(GetSubInfo.strmAtt[subNo][10])
json['tempws']['geographic']['channelslope_chs'
].append(GetSubInfo.strmAtt[str(subNo)][10])
# Updating Reach slope:
json['tempws']['geographic']['reach_slope_rchs'
].append(GetSubInfo.strmAtt[str(subNo)][10])
# Updating Channel manning n
json['tempws']['geographic']['channelmanningn_chn'
].append(GetSubInfo.channelManN[0][4])
subarea_area = 0.0
subarea_area = GetSubInfo.subareaArea[str(subNo)]*GetSubInfo.cellsize*GetSubInfo.cellsize/10000.0
rchchllen = 0.0
chllen = 0.0
rchchllen = GetSubInfo.rchchannenLen[str(subNo)]/1000.0
chllen = GetSubInfo.channenLen[str(subNo)]/1000.0
# make sure we have value not 0, had a minimum of 30 m
if (rchchllen < 0.03):
rchchllen = 0.03
if (chllen < 0.03):
chllen = 0.03
if (rchchllen >= chllen):
chllen = rchchllen + 0.01
if (subarea_area < 20.0):
# Updating Channel Length and reach length
# Reach (stream in TauDEM) length: strmAtt[str(subNo)][6]
# If it is an extreme watershed, channel length is the max Plen
if ((GetSubInfo.strmAtt[str(subNo)][2] == '-1')
and (GetSubInfo.strmAtt[str(subNo)][3] == '-1')):
json['tempws']['geographic']['channellength_chl'
].append(0.5)
json['tempws']['geographic']['reach_length_rchl'
].append(0.5)
# If it is a routing watershed, channel length is the reach len
# + max channel TODO: will be modified to get the channel length
# for the watershed outlet
else:
json['tempws']['geographic']['channellength_chl'
].append(0.8)
json['tempws']['geographic']['reach_length_rchl'
].append(0.5)
else:
# Updating Channel Length and reach length
# Reach (stream in TauDEM) length: strmAtt[str(subNo)][6]
# If it is an extreme watershed, channel length is the max Plen
if ((GetSubInfo.strmAtt[str(subNo)][2] == '-1')
and (GetSubInfo.strmAtt[str(subNo)][3] == '-1')):
json['tempws']['geographic']['channellength_chl'
].append(rchchllen)
json['tempws']['geographic']['reach_length_rchl'
].append(rchchllen)
# If it is a routing watershed, channel length is the reach len
# + max channel TODO: will be modified to get the channel length
# for the watershed outlet
else:
json['tempws']['geographic']['channellength_chl'
].append(chllen)
json['tempws']['geographic']['reach_length_rchl'
].append(rchchllen)
# Updating Watershed area:
#print(float(GetSubInfo.subareaArea[str(subNo)])*GetSubInfo.cellsize/10000.0)
# The area for adding should be minus
if '-' in subPathSign[subid]:
json['tempws']['geographic']['wsa_ha'
].append('-%.5f' %(GetSubInfo.subareaArea[str(subNo)]
*GetSubInfo.cellsize*GetSubInfo.cellsize/10000.0))
else:
json['tempws']['geographic']['wsa_ha'
].append('%.5f' %(GetSubInfo.subareaArea[str(subNo)]
*GetSubInfo.cellsize*GetSubInfo.cellsize/10000.0))
# At this time, tile drainage is sitll unknow, but need to be
# initiated.
json['tempws']['drainage']['drainage_depth_idr'
].append('0')
return json, wssubsolopslatlong
| [
"qyfeng86@hotmail.com"
] | qyfeng86@hotmail.com |
26d57e305f3d7afe9d43fbd8999e4a00cae98bbb | f1f29e12b6e421b620bbab56e82f883b6108bebb | /yxs/demo_hotel_rating2.py | 60ea7f75b95954847284ed538c5c65409c4aa0cc | [] | no_license | yizt/notebook | dca829e3b6071a8b00ced82a59912ad0c142ae74 | 00cf892e8de3f5a55ad9feb826ae51be6b77d1c2 | refs/heads/master | 2022-08-18T23:03:26.739347 | 2022-08-15T03:52:57 | 2022-08-15T03:52:57 | 139,810,366 | 7 | 3 | null | null | null | null | UTF-8 | Python | false | false | 3,829 | py | # -*- coding: utf-8 -*-
"""
@File : demo_hotel_rating2.py
@Time : 2020/11/6 上午10:14
@Author : yizuotian
@Description : 使用transformers.Trainer训练
"""
import argparse
import os
import sys
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from torch.utils.data import Dataset
from transformers import BertForSequenceClassification
from transformers import BertTokenizer, TrainingArguments, Trainer
class HotelDataSet(Dataset):
def __init__(self, encodings, labels):
self.encodings = encodings
self.labels = labels
def __getitem__(self, idx):
# encodings.key(): ['input_ids', 'token_type_ids', 'attention_mask']
item = {key: val[idx] for key, val in self.encodings.items()} # 取指定的那个元素
item['labels'] = torch.tensor(self.labels[idx])
return item
def __len__(self):
return len(self.labels)
class HotelTestDataSet(Dataset):
def __init__(self, encodings):
self.encodings = encodings
def __getitem__(self, idx):
# encodings.key(): ['input_ids', 'token_type_ids', 'attention_mask']
item = {key: val[idx] for key, val in self.encodings.items()} # 取指定的那个元素
return item
def __len__(self):
return len(self.labels)
def main(args):
train_csv_path = os.path.join(args.data_root, 'train.csv')
train_data = pd.read_csv(train_csv_path, sep=',')
review_np = train_data['review'].values
rating_np = train_data['rating'].values.astype(np.long) - 1 # 从0开始
# 分割训练和验证
train_texts, val_texts, train_labels, val_labels = train_test_split(review_np, rating_np, test_size=.2)
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
train_encodings = tokenizer(list(train_texts), truncation=True, padding=True)
val_encodings = tokenizer(list(val_texts), truncation=True, padding=True)
train_dataset = HotelDataSet(train_encodings, train_labels)
val_dataset = HotelDataSet(val_encodings, val_labels)
#
# device = torch.device('cuda:5')
model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=5)
# model.to(device)
training_args = TrainingArguments(
output_dir='./results', # output directory
num_train_epochs=3, # total number of training epochs
per_device_train_batch_size=6, # batch size per device during training
per_device_eval_batch_size=6, # batch size for evaluation
warmup_steps=500, # number of warmup steps for learning rate scheduler
weight_decay=0.01, # strength of weight decay
logging_dir='./logs', # directory for storing logs
learning_rate=2e-5,
logging_steps=10,
)
trainer = Trainer(
model=model, # the instantiated 🤗 Transformers model to be trained
args=training_args, # training arguments, defined above
train_dataset=train_dataset, # training dataset
eval_dataset=val_dataset # evaluation dataset
)
trainer.train()
# 预测
test_csv_path = os.path.join(args.data_root, 'test.csv')
test_df = pd.read_csv(test_csv_path, sep=',')
test_encoding = tokenizer(list(test_df['review'].values), truncation=True, padding=True)
test_dataset = HotelTestDataSet(test_encoding)
outputs = trainer.predict(test_dataset)
labels = np.argmax(outputs.predictions, axis=-1) + 1 # label还原
test_df['rating'] = labels
test_df[['id', 'rating']].to_csv('./rst_hotel_rating.csv', header=None, index=None)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--data-root', type=str, default='./Hotel_rating')
arguments = parser.parse_args(sys.argv[1:])
main(arguments)
| [
"csuyzt@163.com"
] | csuyzt@163.com |
ebf99575454919a734421312f4be90cf76d23ca6 | 898330d1cca89a46cb83c9d6d9657f99b8e95da7 | /models/cross_validator.py | 5d5d02324beb430f617838d904253080733488a0 | [] | no_license | HamedBabaei/semeval2021-task5-tsd | 1bc00d6f42bb65fd63178108bf7a041c8cfe140e | 1d8ef3aa26a86aafd29178718b729db97fcf3298 | refs/heads/main | 2023-03-25T14:14:59.324303 | 2021-03-26T12:28:26 | 2021-03-26T12:28:26 | 332,460,832 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,916 | py | from tqdm import tqdm
from sklearn.model_selection import KFold
from scipy.stats import sem
import numpy as np
from tqdm import tqdm
def cross_validate(train, datamodel, model, evaluator, output_maker,
cv=5, print_results=False, dataset_logger=False,
calculate_average=False, return_folds=True):
'''
Cross Validator
Arguments:
train: a train dataset in df fromat
datamodel: data handler model for model
model: model to be cross validated
evaluator: evaluation metrics
output_maker: model output transition for evaluator
cv: a cross validation fold
print_results: to print each fold F1, P, and R or not
dataset_logger: to display how much will take dataset prepration for train or not
calculate_average: to calculate averaged result of F1, R, and P
Returns:
cv_f1: cross validation f1 scores
cv_p: cross validation P scores
cv_r: corss validation R scores
'''
logger_cv, kf = 0, KFold(n_splits=cv)
cv_f1, cv_p, cv_r = [], [], []
for train_idx, test_idx in tqdm(kf.split(train)):
logger_cv += 1
if print_results and dataset_logger:
print("Cross-validation fold-", logger_cv)
elif print_results:
print("Cross-validation fold-", logger_cv, end=' ')
X_train, Y_train, T_train, _ = load_data(train, train_idx, datamodel, dataset_logger)
X_test, Y_test, T_test, test_texts = load_data(train, test_idx, datamodel, dataset_logger)
model.fit(X_train, Y_train)
preds = model.predict(X_test)
predictions = output_maker(X_test, test_texts, preds)
f1, p, r = evaluator.evaluate(gold = Y_test, predictions = predictions)
if print_results:
print("F1:{}, \t P:{}, \t R:{}".format(f1, p, r))
cv_f1.append(f1)
cv_p.append(p)
cv_r.append(r)
if calculate_average:
print("---------------------------------------------------------------------------")
print(str(cv) + "-Fold Cross Validation Averaged Results:")
average(cv_f1, cv_p, cv_r)
print("---------------------------------------------------------------------------")
if return_folds:
return cv_f1, cv_p, cv_r
def load_data(train, idx, datamodel, logger):
'''
Loading Dataset
Arguments:
train: a train dataset
idx: indexs of data to be taken
datamodel: a model to transform data for model
logger: to display model transformations steps and how much time it taking using tqdm
Returns:
X: dataset in the same format of model inputs
Y: truth spans
T: taboo words
texts: a toxic texts
'''
X, Y, T, texts = [], [], [], []
if logger:
for i in tqdm(range(len(idx))):
x, y, taboo_words, text = datamodel.transform(train.iloc[idx[i]])
X.append(x)
Y.append(y)
T.append(taboo_words)
texts.append(text)
else:
for i in range(len(idx)):
x, y, taboo_words, text = datamodel.transform(train.iloc[idx[i]])
X.append(x)
Y.append(y)
T.append(taboo_words)
texts.append(text)
return X, Y, T, texts
def average(f1_cv, p_cv, r_cv):
'''
Averaging Folds
Arguments:
f1_cv(list): list of f1 scores for each folds
p_cv(list): list of p scores for each folds
r_cv(list): list of r scores for each folds
Returns: None
'''
f1_cv = np.array(f1_cv)
r_cv = np.array(r_cv)
p_cv = np.array(p_cv)
#print("Cross-validation AVG ", end=' ')
print (f"F1 = {f1_cv.mean():.2f} ± {sem(f1_cv):.2f}", end=', \t ')
print (f"P = {p_cv.mean():.2f} ± {sem(p_cv):.2f}", end=', \t ')
print (f"R = {r_cv.mean():.2f} ± {sem(r_cv):.2f}")
| [
"hamedbabaeigiglou@gmail.com"
] | hamedbabaeigiglou@gmail.com |
0ed835b0ceff285f6c4cf324440b2ce19a14dd4f | d90d8422379e5de81e00cab939289c30721aec16 | /Search a 2D Matrix.py | e749e01daf91bc70fec2ec59a485bcafa674b08c | [] | no_license | csvenja/LeetCode | 6a8f41cc205b494d6a50cdaa7c54db807a8fd553 | 034a6b52b847de7b12b81fbe32db64936f1f97b8 | refs/heads/master | 2016-09-10T21:46:22.478216 | 2014-08-01T04:04:40 | 2014-08-01T04:04:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,386 | py | class Solution:
# @param matrix, a list of lists of integers
# @param target, an integer
# @return a boolean
def searchMatrix(self, matrix, target):
n = len(matrix)
if n < 1:
return False
m = len(matrix[0])
if m < 1:
return False
start = 0
end = n - 1
if matrix[start][0] == target or matrix[end][0] == target:
return True
while end - start > 1:
mid = start + (end - start) / 2
if matrix[mid][0] == target:
return True
elif matrix[mid][0] < target:
start = mid
else:
end = mid
current = matrix[start]
if matrix[end][0] < target:
current = matrix[end]
start = 0
end = m - 1
while end - start > 1:
mid = start + (end - start) / 2
if current[mid] == target:
return True
elif current[mid] < target:
start = mid
else:
end = mid
if current[start] == target or current[end] == target:
return True
return False
matrix = [[1, 3, 5, 7],
[10, 11, 16, 20],
[23, 30, 34, 50]]
target = 3
# matrix = []
# matrix = [[1], [3]]
result = Solution()
print result.searchMatrix(matrix, target)
| [
"c.svenjax@gmail.com"
] | c.svenjax@gmail.com |
e0dba5bcc43fa2abccb865bc3ba5cadcc5e070e4 | 06c5365e17a6cb7fb557e3295c46506d1d32e20a | /leetcode/easy/122.Best_Time_To_Buy_And_Sell_Stock_2.py | e609ed0b9e79acec7b18474f3fff744bbadbf4c8 | [] | no_license | hyun0k/problem-solving | cd1d612416ef4a0ad671be4ea8c37ce6305089c3 | 72d0ba61eb49c0c56554f14bb47261a0f04446b7 | refs/heads/master | 2023-06-09T06:43:38.135557 | 2021-07-04T11:56:06 | 2021-07-04T11:56:06 | 380,132,884 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 634 | py | class Solution(object):
def maxProfit(self, prices: 'List[int]') -> 'int':
"""[summary]
여러 번 사고 팔 수 있으므로 산 시점 이후에 오르기만 하면 무조건 팔고 이를 계속 반복한다.
"""
return sum(max(prices[i + 1] - prices[i], 0) for i in range(len(prices) - 1))
# profit = 0
# for i in range(len(prices) - 1):
# if prices[i + 1] > prices[i]:
# profit += prices[i + 1] - prices[i]
# return profit
# solution = Solution()
# prices = [7,1,5,3,6,4]
# print(solution.maxProfit(prices))
| [
"hyunyoung9310@gmail.com"
] | hyunyoung9310@gmail.com |
ee13624810362180282997cadc95590b8120c419 | 45208ab398cc3a7e62048ea2c4d08bcd910c15b0 | /ipl.py | 931b7ff278a24792f228e09c48793c7ea839bf20 | [] | no_license | Meet2147/rasaIPL | ec4f282940a39ec3d1039aa54f8dd8e508d49bce | 2f6c694fa40bee8d2482343572fae5810dfd45c6 | refs/heads/master | 2023-01-30T03:25:37.536845 | 2020-10-02T07:53:59 | 2020-10-02T07:53:59 | 320,798,661 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 432 | py | import json
def IPL(date):
f = open('ipl.json')
response = json.load(f)
list1 = []
#list2 = []
for match in response:
if match['Date'] == date:
list1.append((match['Matches'],match['Time']))
#list2.append(match['Time'])
message = "the requested scheule \n"
#message1 = "the time is"
for text in list1:
message += text[0]+ "time: "+text[1] +"\n"
#for text in list2:
#message1 += message + text
return message
| [
"meetjethwa3@gmail.com"
] | meetjethwa3@gmail.com |
a9c32f12bb7e0611caebcff3ef81fe4b544ba184 | 4234f9f33f9b0a0aa66935ff1c668973785659ef | /entries/urls.py | 924e92136b3d6721a71634e33b91517ab0f16e68 | [] | no_license | chaitany10/Invite-friends-within-x-km | d2c3e2efc8f2f3844a74c500b299f9b50e27f105 | d490558744ea55501c72b94c540454479c3054d0 | refs/heads/master | 2020-04-10T12:25:21.710131 | 2018-12-10T19:13:38 | 2018-12-10T19:13:38 | 161,022,284 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 149 | py | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('<int:userid>/', views.detail),
] | [
"chaitany.pandiya@gmail.com"
] | chaitany.pandiya@gmail.com |
744eba19202e44b4123e246e64343a613a483eaa | cf7c4947d6f792a469b0c05c26636a4a625d3b4d | /node.py | 783e19f848c4bb7604d9cff75f75902c98028e1a | [] | no_license | mpheinze/TSP-ACO | 17f6f7e8e05591d6ada4ac3f6687c4468436c240 | ccd9a05db975f1096db24d82247750531b927e77 | refs/heads/master | 2020-08-11T20:57:56.628888 | 2019-11-26T20:12:22 | 2019-11-26T20:12:22 | 214,626,183 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 133 | py | class Node():
def __init__(self, i=0, x_cord=0, y_cord=0):
self.index = i
self.x = x_cord
self.y = y_cord | [
"heinze89@hotmail.com"
] | heinze89@hotmail.com |
aac50345e2f482288311a3cba78931db63f16ad3 | bc00bdc08d76c8be38c51b1f1caeced2a4668592 | /abjad_demo/env/lib/python3.6/site-packages/abjad/core/Mutation.py | 529bcbacb1cb3399d595d50959a9c34a07f767c4 | [] | no_license | gsy/gmajor | 769afd6e87f6712e4059f3f779f41932cbca962d | 7f5f20a19494256615fbaaa840b2a0bbbf6e311f | refs/heads/master | 2023-02-08T07:00:44.479895 | 2019-05-20T13:58:03 | 2019-05-20T13:58:03 | 161,866,236 | 0 | 0 | null | 2023-02-02T06:26:34 | 2018-12-15T03:32:48 | Scheme | UTF-8 | Python | false | false | 109,999 | py | from abjad.system.AbjadObject import AbjadObject
from abjad import enums
from abjad.indicators.TimeSignature import TimeSignature
from abjad.meter import Meter
from abjad.pitch.NamedInterval import NamedInterval
from abjad.top.attach import attach
from abjad.top.detach import detach
from abjad.top.inspect import inspect
from abjad.top.iterate import iterate
from abjad.top.select import select
from abjad.top.sequence import sequence
from abjad.utilities.Duration import Duration
from .Chord import Chord
from .Component import Component
from .Container import Container
from .Leaf import Leaf
from .Note import Note
from .Selection import Selection
class Mutation(AbjadObject):
"""
Mutation.
.. container:: example
Creates mutation for last two notes in staff:
>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[2:])
Mutation(client=Selection([Note("d'4"), Note("f'4")]))
"""
### CLASS VARIABLES ###
__documentation_section__ = 'Collaborators'
__slots__ = (
'_client',
)
### INITIALIZER ###
def __init__(self, client=None):
self._client = client
### PUBLIC PROPERTIES ###
@property
def client(self):
"""
Gets client.
Returns selection or component.
"""
return self._client
### PUBLIC METHODS ###
def copy(self):
r"""
Copies client.
.. container:: example
Copies explicit clefs:
>>> staff = abjad.Staff("c'8 cs'8 d'8 ef'8 e'8 f'8 fs'8 g'8")
>>> clef = abjad.Clef('treble')
>>> abjad.attach(clef, staff[0])
>>> clef = abjad.Clef('bass')
>>> abjad.attach(clef, staff[4])
>>> copied_notes = abjad.mutate(staff[:2]).copy()
>>> staff.extend(copied_notes)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\clef "treble"
c'8
cs'8
d'8
ef'8
\clef "bass"
e'8
f'8
fs'8
g'8
\clef "treble"
c'8
cs'8
}
.. container:: example
Does not copy implicit clefs:
>>> staff = abjad.Staff("c'8 cs'8 d'8 ef'8 e'8 f'8 fs'8 g'8")
>>> clef = abjad.Clef('treble')
>>> abjad.attach(clef, staff[0])
>>> clef = abjad.Clef('bass')
>>> abjad.attach(clef, staff[4])
>>> copied_notes = abjad.mutate(staff[2:4]).copy()
>>> staff.extend(copied_notes)
.. docs::
>>> abjad.f(staff)
\new Staff
{
\clef "treble"
c'8
cs'8
d'8
ef'8
\clef "bass"
e'8
f'8
fs'8
g'8
d'8
ef'8
}
.. container:: example
Copy components one time:
>>> staff = abjad.Staff(r"c'8 ( d'8 e'8 f'8 )")
>>> staff.extend(r"g'8 a'8 b'8 c''8")
>>> time_signature = abjad.TimeSignature((2, 4))
>>> abjad.attach(time_signature, staff[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 2/4
c'8
(
d'8
e'8
f'8
)
g'8
a'8
b'8
c''8
}
>>> selection = staff[2:4]
>>> result = selection._copy()
>>> new_staff = abjad.Staff(result)
>>> abjad.show(new_staff) # doctest: +SKIP
.. docs::
>>> abjad.f(new_staff)
\new Staff
{
e'8
(
f'8
)
}
>>> staff[2] is new_staff[0]
False
Returns selection of new components.
"""
if isinstance(self.client, Component):
selection = select(self.client)
else:
selection = self.client
result = selection._copy()
if isinstance(self.client, Component):
if len(result) == 1:
result = result[0]
return result
def eject_contents(self):
r"""
Ejects contents from outside-of-score container.
.. container:: example
Ejects leaves from container:
>>> container = abjad.Container("c'4 ~ c'4 d'4 ~ d'4")
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'4
~
c'4
d'4
~
d'4
}
Returns container contents as a selection with spanners preserved:
>>> contents = abjad.mutate(container).eject_contents()
>>> contents
Selection([Note("c'4"), Note("c'4"), Note("d'4"), Note("d'4")])
Container contents can be safely added to a new container:
>>> staff = abjad.Staff(contents, lilypond_type='RhythmicStaff')
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new RhythmicStaff
{
c'4
~
c'4
d'4
~
d'4
}
New container is well formed:
>>> abjad.inspect(staff).is_well_formed()
True
Old container is empty:
>>> container
Container()
Returns container contents as selection.
"""
return self.client._eject_contents()
def extract(self, scale_contents=False):
r"""
Extracts mutation client from score.
Leaves children of mutation client in score.
.. container:: example
Extract tuplets:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Tuplet((3, 2), "c'4 e'4"))
>>> staff.append(abjad.Tuplet((3, 2), "d'4 f'4"))
>>> hairpin = abjad.Hairpin('p < f')
>>> leaves = abjad.select(staff).leaves()
>>> time_signature = abjad.TimeSignature((3, 4))
>>> abjad.attach(time_signature, leaves[0])
>>> abjad.attach(hairpin, leaves)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\tweak text #tuplet-number::calc-fraction-text
\times 3/2 {
\time 3/4
c'4
\<
\p
e'4
}
\tweak text #tuplet-number::calc-fraction-text
\times 3/2 {
d'4
f'4
\f
}
}
>>> empty_tuplet = abjad.mutate(staff[-1]).extract()
>>> empty_tuplet = abjad.mutate(staff[0]).extract()
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 3/4
c'4
\<
\p
e'4
d'4
f'4
\f
}
.. container:: example
Scales tuplet contents and then extracts tuplet:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Tuplet((3, 2), "c'4 e'4"))
>>> staff.append(abjad.Tuplet((3, 2), "d'4 f'4"))
>>> leaves = abjad.select(staff).leaves()
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, leaves)
>>> time_signature = abjad.TimeSignature((3, 4))
>>> abjad.attach(time_signature, leaves[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\tweak text #tuplet-number::calc-fraction-text
\times 3/2 {
\time 3/4
c'4
\<
\p
e'4
}
\tweak text #tuplet-number::calc-fraction-text
\times 3/2 {
d'4
f'4
\f
}
}
>>> empty_tuplet = abjad.mutate(staff[-1]).extract(
... scale_contents=True)
>>> empty_tuplet = abjad.mutate(staff[0]).extract(
... scale_contents=True)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 3/4
c'4.
\<
\p
e'4.
d'4.
f'4.
\f
}
Returns mutation client.
"""
return self.client._extract(scale_contents=scale_contents)
def fuse(self):
r"""
Fuses mutation client.
.. container:: example
Fuses in-score leaves:
>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[1:]).fuse()
Selection([Note("d'4.")])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
d'4.
}
.. container:: example
Fuses parent-contiguous tuplets in selection:
>>> tuplet_1 = abjad.Tuplet((2, 3), "c'8 d' e'")
>>> beam = abjad.Beam()
>>> abjad.attach(beam, tuplet_1[:])
>>> tuplet_2 = abjad.Tuplet((2, 3), "c'16 d' e'")
>>> slur = abjad.Slur()
>>> abjad.attach(slur, tuplet_2[:])
>>> staff = abjad.Staff([tuplet_1, tuplet_2])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 2/3 {
c'8
[
d'8
e'8
]
}
\times 2/3 {
c'16
(
d'16
e'16
)
}
}
>>> tuplets = staff[:]
>>> abjad.mutate(tuplets).fuse()
Tuplet(Multiplier(2, 3), "c'8 d'8 e'8 c'16 d'16 e'16")
>>> abjad.show(staff) #doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 2/3 {
c'8
[
d'8
e'8
]
c'16
(
d'16
e'16
)
}
}
Returns new tuplet in selection.
Fuses zero or more parent-contiguous ``tuplets``.
Allows in-score ``tuplets``.
Allows outside-of-score ``tuplets``.
All ``tuplets`` must carry the same multiplier.
All ``tuplets`` must be of the same type.
.. container:: example
Fuses in-score measures:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Measure((1, 4), "c'8 d'8"))
>>> staff.append(abjad.Measure((2, 8), "e'8 f'8"))
>>> slur = abjad.Slur()
>>> leaves = abjad.select(staff).leaves()
>>> abjad.attach(slur, leaves)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 1/4
c'8
(
d'8
} % measure
{ % measure
\time 2/8
e'8
f'8
)
} % measure
}
>>> measures = staff[:]
>>> abjad.mutate(measures).fuse()
Measure((2, 4), "c'8 d'8 e'8 f'8")
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 2/4
c'8
(
d'8
e'8
f'8
)
} % measure
}
Returns selection.
"""
if isinstance(self.client, Component):
selection = select(self.client)
return selection._fuse()
elif (
isinstance(self.client, Selection) and
self.client.are_contiguous_logical_voice()
):
selection = select(self.client)
return selection._fuse()
def replace(self, recipients, wrappers=False):
r"""
Replaces mutation client (and contents of mutation client) with
``recipients``.
.. container:: example
Replaces in-score tuplet (and children of tuplet) with notes.
Functions exactly the same as container setitem:
>>> tuplet_1 = abjad.Tuplet((2, 3), "c'4 d'4 e'4")
>>> tuplet_2 = abjad.Tuplet((2, 3), "d'4 e'4 f'4")
>>> staff = abjad.Staff([tuplet_1, tuplet_2])
>>> hairpin = abjad.Hairpin('p < f')
>>> leaves = abjad.select(staff).leaves()
>>> abjad.attach(hairpin, leaves)
>>> slur = abjad.Slur()
>>> abjad.attach(slur, leaves)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 2/3 {
c'4
\<
\p
(
d'4
e'4
}
\times 2/3 {
d'4
e'4
f'4
\f
)
}
}
>>> maker = abjad.NoteMaker()
>>> notes = maker("c' d' e' f' c' d' e' f'", (1, 16))
>>> abjad.mutate([tuplet_1]).replace(notes)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'16
\<
\p
(
d'16
e'16
f'16
c'16
d'16
e'16
f'16
\times 2/3 {
d'4
e'4
f'4
\f
)
}
}
Preserves both hairpin and slur.
.. container:: example
Copies no wrappers when ``wrappers`` is false:
>>> staff = abjad.Staff("c'2 f'4 g'")
>>> abjad.attach(abjad.Clef('alto'), staff[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\clef "alto"
c'2
f'4
g'4
}
>>> for leaf in staff:
... leaf, abjad.inspect(leaf).effective(abjad.Clef)
...
(Note("c'2"), Clef('alto'))
(Note("f'4"), Clef('alto'))
(Note("g'4"), Clef('alto'))
>>> chord = abjad.Chord("<d' e'>2")
>>> abjad.mutate(staff[0]).replace(chord)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
<d' e'>2
f'4
g'4
}
>>> for leaf in staff:
... leaf, abjad.inspect(leaf).effective(abjad.Clef)
...
(Chord("<d' e'>2"), None)
(Note("f'4"), None)
(Note("g'4"), None)
>>> abjad.inspect(staff).is_well_formed()
True
.. container:: example
Set ``wrappers`` to true to copy all wrappers from one leaf to
another leaf (and avoid full-score update). Only works from one
leaf to another leaf:
>>> staff = abjad.Staff("c'2 f'4 g'")
>>> abjad.attach(abjad.Clef('alto'), staff[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\clef "alto"
c'2
f'4
g'4
}
>>> for leaf in staff:
... leaf, abjad.inspect(leaf).effective(abjad.Clef)
...
(Note("c'2"), Clef('alto'))
(Note("f'4"), Clef('alto'))
(Note("g'4"), Clef('alto'))
>>> chord = abjad.Chord("<d' e'>2")
>>> abjad.mutate(staff[0]).replace(chord, wrappers=True)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\clef "alto"
<d' e'>2
f'4
g'4
}
>>> for leaf in staff:
... leaf, abjad.inspect(leaf).effective(abjad.Clef)
...
(Chord("<d' e'>2"), Clef('alto'))
(Note("f'4"), Clef('alto'))
(Note("g'4"), Clef('alto'))
>>> abjad.inspect(staff).is_well_formed()
True
.. container:: example
.. todo:: Fix.
Introduces duplicate ties:
>>> staff = abjad.Staff("c'2 ~ c'2")
>>> maker = abjad.NoteMaker()
>>> tied_notes = maker(0, abjad.Duration(5, 8))
>>> abjad.mutate(staff[:1]).replace(tied_notes)
>>> abjad.f(staff)
\new Staff
{
c'2
~
~
c'8
~
c'2
}
Returns none.
"""
if isinstance(self.client, Selection):
donors = self.client
else:
donors = select(self.client)
assert donors.are_contiguous_same_parent()
if not isinstance(recipients, Selection):
recipients = select(recipients)
assert recipients.are_contiguous_same_parent()
if not donors:
return
if wrappers is True:
if 1 < len(donors) or not isinstance(donors[0], Leaf):
message = f'set wrappers only with single leaf: {donors!r}.'
raise Exception(message)
if (1 < len(recipients) or
not isinstance(recipients[0], Leaf)):
message = f'set wrappers only with single leaf: {recipients!r}.'
raise Exception(message)
donor = donors[0]
wrappers = inspect(donor).wrappers()
recipient = recipients[0]
parent, start, stop = donors._get_parent_and_start_stop_indices()
assert parent is not None, repr(donors)
parent.__setitem__(slice(start, stop + 1), recipients)
if not wrappers:
return
for wrapper in wrappers:
# bypass Wrapper._bind_to_component()
# to avoid full-score update / traversal;
# this works because one-to-one leaf replacement
# including all (persistent) indicators
# doesn't change score structure:
donor._wrappers.remove(wrapper)
wrapper._component = recipient
recipient._wrappers.append(wrapper)
context = wrapper._find_correct_effective_context()
if context is not None:
context._dependent_wrappers.append(wrapper)
# TODO: fix bug in function that causes tied notes to become untied
def replace_measure_contents(self, new_contents):
r"""
Replaces contents of measures in client with ``new_contents``.
.. container:: example
Replaces skip-filled measures with notes:
>>> maker = abjad.MeasureMaker()
>>> measures = maker([(1, 8), (3, 16)])
>>> staff = abjad.Staff(measures)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 1/8
s1 * 1/8
} % measure
{ % measure
\time 3/16
s1 * 3/16
} % measure
}
>>> notes = [
... abjad.Note("c'16"),
... abjad.Note("d'16"),
... abjad.Note("e'16"),
... abjad.Note("f'16"),
... ]
>>> abjad.mutate(staff).replace_measure_contents(notes)
[Measure((1, 8), "c'16 d'16"), Measure((3, 16), "e'16 f'16 s1 * 1/16")]
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 1/8
c'16
d'16
} % measure
{ % measure
\time 3/16
e'16
f'16
s1 * 1/16
} % measure
}
Preserves duration of all measures.
Skips measures that are too small.
Pads extra space at end of measures with spacer skip.
Raises stop iteration if not enough measures.
Returns measures iterated.
"""
# init return list
result = []
# get first measure and first time signature
current_measure = self.client._get_next_measure()
result.append(current_measure)
current_time_signature = current_measure.time_signature
# to avoide pychecker slice assignment error
#del(current_measure[:])
current_measure.__delitem__(slice(0, len(current_measure)))
# iterate new contents
new_contents = list(new_contents)
while new_contents:
# find candidate duration of new element plus current measure
current_element = new_contents[0]
multiplier = current_time_signature.implied_prolation
preprolated_duration = current_element._get_preprolated_duration()
duration = multiplier * preprolated_duration
candidate_duration = current_measure._get_duration() + duration
# if new element fits in current measure
if candidate_duration <= current_time_signature.duration:
current_element = new_contents.pop(0)
current_measure._append_without_withdrawing_from_crossing_spanners(
current_element)
# otherwise restore current measure and advance to next measure
else:
current_time_signature = TimeSignature(current_time_signature)
detach(TimeSignature, current_measure)
attach(current_time_signature, current_measure)
current_measure._append_spacer_skip()
current_measure = current_measure._get_next_measure()
if current_measure is None:
raise StopIteration
result.append(current_measure)
current_time_signature = current_measure.time_signature
# to avoid pychecker slice assignment error
#del(current_measure[:])
current_measure.__delitem__(slice(0, len(current_measure)))
# restore last iterated measure
current_time_signature = TimeSignature(current_time_signature)
detach(TimeSignature, current_measure)
attach(current_time_signature, current_measure)
current_measure._append_spacer_skip()
# return iterated measures
return result
def rewrite_meter(
self,
meter,
boundary_depth=None,
initial_offset=None,
maximum_dot_count=None,
rewrite_tuplets=True,
repeat_ties=False,
):
r"""
Rewrites the contents of logical ties in an expression to match
``meter``.
.. container:: example
Rewrites the contents of a measure in a staff using the default
meter for that measure's time signature:
>>> string = "abj: | 2/4 c'2 ~ |"
>>> string += "| 4/4 c'32 d'2.. ~ d'16 e'32 ~ |"
>>> string += "| 2/4 e'2 |"
>>> staff = abjad.Staff(string)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 2/4
c'2
~
} % measure
{ % measure
\time 4/4
c'32
d'2..
~
d'16
e'32
~
} % measure
{ % measure
\time 2/4
e'2
} % measure
}
>>> meter = abjad.Meter((4, 4))
>>> print(meter.pretty_rtm_format)
(4/4 (
1/4
1/4
1/4
1/4))
>>> abjad.mutate(staff[1][:]).rewrite_meter(meter)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 2/4
c'2
~
} % measure
{ % measure
\time 4/4
c'32
d'8..
~
d'2
~
d'8..
e'32
~
} % measure
{ % measure
\time 2/4
e'2
} % measure
}
.. container:: example
Rewrites the contents of a measure in a staff using a custom meter:
>>> staff = abjad.Staff(string)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 2/4
c'2
~
} % measure
{ % measure
\time 4/4
c'32
d'2..
~
d'16
e'32
~
} % measure
{ % measure
\time 2/4
e'2
} % measure
}
>>> rtm = '(4/4 ((2/4 (1/4 1/4)) (2/4 (1/4 1/4))))'
>>> meter = abjad.Meter(rtm)
>>> print(meter.pretty_rtm_format) # doctest: +SKIP
(4/4 (
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))))
>>> abjad.mutate(staff[1][:]).rewrite_meter(meter)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 2/4
c'2
~
} % measure
{ % measure
\time 4/4
c'32
d'4...
~
d'4...
e'32
~
} % measure
{ % measure
\time 2/4
e'2
} % measure
}
.. container:: example
Limit the maximum number of dots per leaf using
``maximum_dot_count``:
>>> string = "abj: | 3/4 c'32 d'8 e'8 fs'4... |"
>>> measure = abjad.parse(string)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 3/4
c'32
d'8
e'8
fs'4...
} % measure
Without constraining the ``maximum_dot_count``:
>>> abjad.mutate(measure[:]).rewrite_meter(measure)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 3/4
c'32
d'16.
~
d'32
e'16.
~
e'32
fs'4...
} % measure
Constraining the ``maximum_dot_count`` to ``2``:
>>> measure = abjad.parse(string)
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... maximum_dot_count=2,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 3/4
c'32
d'16.
~
d'32
e'16.
~
e'32
fs'8..
~
fs'4
} % measure
Constraining the ``maximum_dot_count`` to ``1``:
>>> measure = abjad.parse(string)
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... maximum_dot_count=1,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 3/4
c'32
d'16.
~
d'32
e'16.
~
e'32
fs'16.
~
fs'8
~
fs'4
} % measure
Constraining the ``maximum_dot_count`` to ``0``:
>>> measure = abjad.parse(string)
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... maximum_dot_count=0,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 3/4
c'32
d'16
~
d'32
~
d'32
e'16
~
e'32
~
e'32
fs'16
~
fs'32
~
fs'8
~
fs'4
} % measure
.. container:: example
Split logical ties at different depths of the ``Meter``, if those
logical ties cross any offsets at that depth, but do not also both
begin and end at any of those offsets.
Consider the default meter for ``9/8``:
>>> meter = abjad.Meter((9, 8))
>>> print(meter.pretty_rtm_format)
(9/8 (
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))))
We can establish that meter without specifying
a ``boundary_depth``:
>>> string = "abj: | 9/8 c'2 d'2 e'8 |"
>>> measure = abjad.parse(string)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 9/8
c'2
d'2
e'8
} % measure
>>> abjad.mutate(measure[:]).rewrite_meter(measure)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 9/8
c'2
d'4
~
d'4
e'8
} % measure
With a ``boundary_depth`` of `1`, logical ties which cross any
offsets created by nodes with a depth of `1` in this Meter's rhythm
tree - i.e. `0/8`, `3/8`, `6/8` and `9/8` - which do not also
begin and end at any of those offsets, will be split:
>>> measure = abjad.parse(string)
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... boundary_depth=1,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 9/8
c'4.
~
c'8
d'4
~
d'4
e'8
} % measure
For this `9/8` meter, and this input notation, A ``boundary_depth``
of `2` causes no change, as all logical ties already align to
multiples of `1/8`:
>>> measure = abjad.parse(string)
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... boundary_depth=2,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 9/8
c'2
d'4
~
d'4
e'8
} % measure
.. container:: example
Comparison of `3/4` and `6/8`, at ``boundary_depths`` of 0 and 1:
>>> triple = "abj: | 3/4 2 4 || 3/4 4 2 || 3/4 4. 4. |"
>>> triple += "| 3/4 2 ~ 8 8 || 3/4 8 8 ~ 2 |"
>>> duples = "abj: | 6/8 2 4 || 6/8 4 2 || 6/8 4. 4. |"
>>> duples += "| 6/8 2 ~ 8 8 || 6/8 8 8 ~ 2 |"
>>> score = abjad.Score([
... abjad.Staff(triple),
... abjad.Staff(duples),
... ])
In order to see the different time signatures on each staff,
we need to move some engravers from the Score context to the
Staff context:
>>> engravers = [
... 'Timing_translator',
... 'Time_signature_engraver',
... 'Default_bar_line_engraver',
... ]
>>> score.remove_commands.extend(engravers)
>>> score[0].consists_commands.extend(engravers)
>>> score[1].consists_commands.extend(engravers)
>>> abjad.show(score) # doctest: +SKIP
.. docs::
>>> abjad.f(score)
\new Score
\with
{
\remove Timing_translator
\remove Time_signature_engraver
\remove Default_bar_line_engraver
}
<<
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 3/4
c'2
c'4
} % measure
{ % measure
c'4
c'2
} % measure
{ % measure
c'4.
c'4.
} % measure
{ % measure
c'2
~
c'8
c'8
} % measure
{ % measure
c'8
c'8
~
c'2
} % measure
}
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 6/8
c'2
c'4
} % measure
{ % measure
c'4
c'2
} % measure
{ % measure
c'4.
c'4.
} % measure
{ % measure
c'2
~
c'8
c'8
} % measure
{ % measure
c'8
c'8
~
c'2
} % measure
}
>>
Here we establish a meter without specifying any boundary depth:
>>> for measure in abjad.iterate(score).components(abjad.Measure):
... abjad.mutate(measure[:]).rewrite_meter(measure)
...
>>> abjad.show(score) # doctest: +SKIP
.. docs::
>>> abjad.f(score)
\new Score
\with
{
\remove Timing_translator
\remove Time_signature_engraver
\remove Default_bar_line_engraver
}
<<
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 3/4
c'2
c'4
} % measure
{ % measure
c'4
c'2
} % measure
{ % measure
c'4.
c'4.
} % measure
{ % measure
c'2
~
c'8
c'8
} % measure
{ % measure
c'8
c'8
~
c'2
} % measure
}
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 6/8
c'2
c'4
} % measure
{ % measure
c'4
c'2
} % measure
{ % measure
c'4.
c'4.
} % measure
{ % measure
c'4.
~
c'4
c'8
} % measure
{ % measure
c'8
c'4
~
c'4.
} % measure
}
>>
Here we reestablish meter at a boundary depth of `1`:
>>> for measure in abjad.iterate(score).components(abjad.Measure):
... abjad.mutate(measure[:]).rewrite_meter(
... measure,
... boundary_depth=1,
... )
...
>>> abjad.show(score) # doctest: +SKIP
.. docs::
>>> abjad.f(score)
\new Score
\with
{
\remove Timing_translator
\remove Time_signature_engraver
\remove Default_bar_line_engraver
}
<<
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 3/4
c'2
c'4
} % measure
{ % measure
c'4
c'2
} % measure
{ % measure
c'4
~
c'8
c'8
~
c'4
} % measure
{ % measure
c'2
~
c'8
c'8
} % measure
{ % measure
c'8
c'8
~
c'2
} % measure
}
\new Staff
\with
{
\consists Timing_translator
\consists Time_signature_engraver
\consists Default_bar_line_engraver
}
{
{ % measure
\time 6/8
c'4.
~
c'8
c'4
} % measure
{ % measure
c'4
c'8
~
c'4.
} % measure
{ % measure
c'4.
c'4.
} % measure
{ % measure
c'4.
~
c'4
c'8
} % measure
{ % measure
c'8
c'4
~
c'4.
} % measure
}
>>
Note that the two time signatures are much more clearly
disambiguated above.
.. container:: example
Establishing meter recursively in measures with nested tuplets:
>>> string = "abj: | 4/4 c'16 ~ c'4 d'8. ~ "
>>> string += "2/3 { d'8. ~ 3/5 { d'16 e'8. f'16 ~ } } "
>>> string += "f'4 |"
>>> measure = abjad.parse(string)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 4/4
c'16
~
c'4
d'8.
~
\times 2/3 {
d'8.
~
\tweak text #tuplet-number::calc-fraction-text
\times 3/5 {
d'16
e'8.
f'16
~
}
}
f'4
} % measure
When establishing a meter on a selection of components which
contain containers, like tuplets or containers, ``rewrite_meter()``
will recurse into those containers, treating them as measures whose
time signature is derived from the preprolated preprolated_duration
of the container's contents:
>>> abjad.mutate(measure[:]).rewrite_meter(
... measure,
... boundary_depth=1,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 4/4
c'4
~
c'16
d'8.
~
\times 2/3 {
d'8
~
d'16
~
\tweak text #tuplet-number::calc-fraction-text
\times 3/5 {
d'16
e'8
~
e'16
f'16
~
}
}
f'4
} % measure
.. container:: example
Default rewrite behavior doesn't subdivide the first note in this
measure because the first note in the measure starts at the
beginning of a level-0 beat in meter:
>>> measure = abjad.Measure((6, 8), "c'4.. c'16 ~ c'4")
>>> meter = abjad.Meter((6, 8))
>>> abjad.mutate(measure[:]).rewrite_meter(meter)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/8
c'4..
c'16
~
c'4
} % measure
Setting boundary depth to 1 subdivides the first note in this
measure:
>>> measure = abjad.Measure((6, 8), "c'4.. c'16 ~ c'4")
>>> meter = abjad.Meter((6, 8))
>>> abjad.mutate(measure[:]).rewrite_meter(meter, boundary_depth=1)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/8
c'4.
~
c'16
c'16
~
c'4
} % measure
Another way of doing this is by setting preferred boundary depth on
the meter itself:
>>> measure = abjad.Measure((6, 8), "c'4.. c'16 ~ c'4")
>>> meter = abjad.Meter(
... (6, 8),
... preferred_boundary_depth=1,
... )
>>> abjad.mutate(measure[:]).rewrite_meter(meter)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/8
c'4.
~
c'16
c'16
~
c'4
} % measure
This makes it possible to divide different meters in different
ways.
.. container:: example
Uses repeat ties:
>>> measure = abjad.Measure((4, 4), "c'4. c'4. c'4")
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 4/4
c'4.
c'4.
c'4
} % measure
>>> meter = abjad.Meter((4, 4))
>>> abjad.mutate(measure[:]).rewrite_meter(
... meter,
... boundary_depth=1,
... repeat_ties=True,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 4/4
c'4
c'8
\repeatTie
c'8
c'4
\repeatTie
c'4
} % measure
.. container:: example
Rewrites notes and tuplets:
>>> measure = abjad.Measure((6, 4), [
... abjad.Note("c'4."),
... abjad.Tuplet((6, 7), "c'4. r16"),
... abjad.Tuplet((6, 7), "r16 c'4."),
... abjad.Note("c'4."),
... ])
>>> string = r"c'8 ~ c'8 ~ c'8 \times 6/7 { c'4. r16 }"
>>> string += r" \times 6/7 { r16 c'4. } c'8 ~ c'8 ~ c'8"
>>> measure = abjad.Measure((6, 4), string)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/4
c'8
~
c'8
~
c'8
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
c'4.
r16
}
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
r16
c'4.
}
c'8
~
c'8
~
c'8
} % measure
>>> meter = abjad.Meter((6, 4))
>>> abjad.mutate(measure[:]).rewrite_meter(
... meter,
... boundary_depth=1,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/4
c'4.
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
c'8.
~
c'8
~
c'16
r16
}
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
r16
c'8
~
c'4
}
c'4.
} % measure
The tied note rewriting is good while the tuplet rewriting
could use some adjustment.
Rewrites notes but not tuplets:
>>> measure = abjad.Measure((6, 4), [
... abjad.Note("c'4."),
... abjad.Tuplet((6, 7), "c'4. r16"),
... abjad.Tuplet((6, 7), "r16 c'4."),
... abjad.Note("c'4."),
... ])
>>> string = r"c'8 ~ c'8 ~ c'8 \times 6/7 { c'4. r16 }"
>>> string += r" \times 6/7 { r16 c'4. } c'8 ~ c'8 ~ c'8"
>>> measure = abjad.Measure((6, 4), string)
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/4
c'8
~
c'8
~
c'8
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
c'4.
r16
}
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
r16
c'4.
}
c'8
~
c'8
~
c'8
} % measure
>>> meter = abjad.Meter((6, 4))
>>> abjad.mutate(measure[:]).rewrite_meter(
... meter,
... boundary_depth=1,
... rewrite_tuplets=False,
... )
>>> abjad.show(measure) # doctest: +SKIP
.. docs::
>>> abjad.f(measure)
{ % measure
\time 6/4
c'4.
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
c'4.
r16
}
\tweak text #tuplet-number::calc-fraction-text
\times 6/7 {
r16
c'4.
}
c'4.
} % measure
Operates in place and returns none.
"""
selection = self.client
if isinstance(selection, Container):
selection = selection[:]
assert isinstance(selection, Selection)
result = Meter._rewrite_meter(
selection,
meter,
boundary_depth=boundary_depth,
initial_offset=initial_offset,
maximum_dot_count=maximum_dot_count,
rewrite_tuplets=rewrite_tuplets,
repeat_ties=repeat_ties,
)
return result
def scale(self, multiplier):
r"""
Scales mutation client by ``multiplier``.
.. container:: example
Scales note duration by dot-generating multiplier:
>>> staff = abjad.Staff("c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[1]).scale(abjad.Multiplier(3, 2))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
(
d'8.
e'8
f'8
)
}
.. container:: example
Scales nontrivial logical tie by dot-generating ``multiplier``:
>>> staff = abjad.Staff(r"c'8 \accent ~ c'8 d'8")
>>> time_signature = abjad.TimeSignature((3, 8))
>>> abjad.attach(time_signature, staff[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 3/8
c'8
-\accent
~
c'8
d'8
}
>>> logical_tie = abjad.inspect(staff[0]).logical_tie()
>>> agent = abjad.mutate(logical_tie)
>>> logical_tie = agent.scale(abjad.Multiplier(3, 2))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 3/8
c'4.
-\accent
d'8
}
.. container:: example
Scales container by dot-generating multiplier:
>>> container = abjad.Container(r"c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'8
(
d'8
e'8
f'8
)
}
>>> abjad.mutate(container).scale(abjad.Multiplier(3, 2))
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'8.
(
d'8.
e'8.
f'8.
)
}
.. container:: example
Scales note by tie-generating multiplier:
>>> staff = abjad.Staff("c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[1]).scale(abjad.Multiplier(5, 4))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
(
d'8
~
d'32
e'8
f'8
)
}
.. container:: example
Scales nontrivial logical tie by tie-generating ``multiplier``:
>>> staff = abjad.Staff(r"c'8 \accent ~ c'8 d'16")
>>> time_signature = abjad.TimeSignature((5, 16))
>>> abjad.attach(time_signature, staff[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 5/16
c'8
-\accent
~
c'8
d'16
}
>>> logical_tie = abjad.inspect(staff[0]).logical_tie()
>>> agent = abjad.mutate(logical_tie)
>>> logical_tie = agent.scale(abjad.Multiplier(5, 4))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\time 5/16
c'4
-\accent
~
c'16
d'16
}
.. container:: example
Scales container by tie-generating multiplier:
>>> container = abjad.Container(r"c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'8
(
d'8
e'8
f'8
)
}
>>> abjad.mutate(container).scale(abjad.Multiplier(5, 4))
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'8
~
(
c'32
d'8
~
d'32
e'8
~
e'32
f'8
~
f'32
)
}
.. container:: example
Scales note by tuplet-generating multiplier:
>>> staff = abjad.Staff("c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[1]).scale(abjad.Multiplier(2, 3))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
(
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
d'8
}
e'8
f'8
)
}
.. container:: example
Scales trivial logical tie by tuplet-generating multiplier:
>>> staff = abjad.Staff(r"c'8 \accent")
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
-\accent
}
>>> logical_tie = abjad.inspect(staff[0]).logical_tie()
>>> agent = abjad.mutate(logical_tie)
>>> logical_tie = agent.scale(abjad.Multiplier(4, 3))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
c'4
-\accent
}
}
.. container:: example
Scales container by tuplet-generating multiplier:
>>> container = abjad.Container(r"c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
c'8
(
d'8
e'8
f'8
)
}
>>> abjad.mutate(container).scale(abjad.Multiplier(4, 3))
>>> abjad.show(container) # doctest: +SKIP
.. docs::
>>> abjad.f(container)
{
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
c'4
(
}
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
d'4
}
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
e'4
}
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
f'4
)
}
}
.. container:: example
Scales note by tie- and tuplet-generating multiplier:
>>> staff = abjad.Staff("c'8 ( d'8 e'8 f'8 )")
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.mutate(staff[1]).scale(abjad.Multiplier(5, 6))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
(
\tweak edge-height #'(0.7 . 0)
\times 2/3 {
d'8
~
d'32
}
e'8
f'8
)
}
.. container:: example
Scales note carrying LilyPond multiplier:
>>> note = abjad.Note("c'8")
>>> abjad.attach(abjad.Multiplier(1, 2), note)
>>> abjad.show(note) # doctest: +SKIP
.. docs::
>>> abjad.f(note)
c'8 * 1/2
>>> abjad.mutate(note).scale(abjad.Multiplier(5, 3))
>>> abjad.show(note) # doctest: +SKIP
.. docs::
>>> abjad.f(note)
c'8 * 5/6
.. container:: example
Scales tuplet:
>>> staff = abjad.Staff()
>>> tuplet = abjad.Tuplet((4, 5), [])
>>> tuplet.extend("c'8 d'8 e'8 f'8 g'8")
>>> staff.append(tuplet)
>>> time_signature = abjad.TimeSignature((4, 8))
>>> leaves = abjad.select(staff).leaves()
>>> abjad.attach(time_signature, leaves[0])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 4/5 {
\time 4/8
c'8
d'8
e'8
f'8
g'8
}
}
>>> abjad.mutate(tuplet).scale(abjad.Multiplier(2))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 4/5 {
\time 4/8
c'4
d'4
e'4
f'4
g'4
}
}
.. container:: example
Scales tuplet:
>>> staff = abjad.Staff()
>>> tuplet = abjad.Tuplet((4, 5), "c'8 d'8 e'8 f'8 g'8")
>>> staff.append(tuplet)
>>> time_signature = abjad.TimeSignature((4, 8))
>>> leaf = abjad.inspect(staff).leaf(0)
>>> abjad.attach(time_signature, leaf)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 4/5 {
\time 4/8
c'8
d'8
e'8
f'8
g'8
}
}
>>> abjad.mutate(tuplet).scale(abjad.Multiplier(2))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 4/5 {
\time 4/8
c'4
d'4
e'4
f'4
g'4
}
}
Returns none.
"""
if hasattr(self.client, '_scale'):
self.client._scale(multiplier)
else:
assert isinstance(self.client, Selection)
for component in self.client:
component._scale(multiplier)
def splice(
self,
components,
direction=enums.Right,
grow_spanners=True,
):
"""
Splices ``components`` to the right or left of selection.
.. todo:: Add examples.
Returns list of components.
"""
return self.client._splice(
components,
direction=direction,
grow_spanners=grow_spanners,
)
# TODO: fix bug that unintentionally fractures ties.
# TODO: add tests of tupletted notes and rests.
# TODO: add examples that show indicator handling.
# TODO: add example showing grace and after grace handling.
def split(
self,
durations,
fracture_spanners=False,
cyclic=False,
tie_split_notes=True,
repeat_ties=False,
):
r"""
Splits mutation client by ``durations``.
.. container:: example
Splits leaves:
>>> staff = abjad.Staff("c'8 e' d' f' c' e' d' f'")
>>> leaves = staff[:]
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, leaves)
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'8
d'8
f'8
c'8
e'8
d'8
f'8
\f
}
>>> durations = [(3, 16), (7, 32)]
>>> result = abjad.mutate(leaves).split(
... durations,
... tie_split_notes=False,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'16
e'16
d'8
f'32
f'16.
c'8
e'8
d'8
f'8
\f
}
.. container:: example
Splits leaves and fracture crossing spanners:
>>> staff = abjad.Staff("c'8 e' d' f' c' e' d' f'")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, staff[:])
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'8
d'8
f'8
c'8
e'8
d'8
f'8
\f
}
>>> durations = [(3, 16), (7, 32)]
>>> leaves = staff[:]
>>> result = abjad.mutate(leaves).split(
... durations,
... fracture_spanners=True,
... tie_split_notes=False,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'16
\f
e'16
\<
\p
d'8
f'32
\f
f'16.
\<
\p
c'8
e'8
d'8
f'8
\f
}
.. container:: example
Splits leaves cyclically:
>>> staff = abjad.Staff("c'8 e' d' f' c' e' d' f'")
>>> leaves = staff[:]
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, leaves)
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'8
d'8
f'8
c'8
e'8
d'8
f'8
\f
}
>>> durations = [(3, 16), (7, 32)]
>>> result = abjad.mutate(leaves).split(
... durations,
... cyclic=True,
... tie_split_notes=False,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'16
e'16
d'8
f'32
f'16.
c'16.
c'32
e'8
d'16
d'16
f'8
\f
}
.. container:: example
Splits leaves cyclically and fracture spanners:
>>> staff = abjad.Staff("c'8 e' d' f' c' e' d' f'")
>>> leaves = staff[:]
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, leaves)
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'8
d'8
f'8
c'8
e'8
d'8
f'8
\f
}
>>> durations = [(3, 16), (7, 32)]
>>> result = abjad.mutate(leaves).split(
... durations,
... cyclic=True,
... fracture_spanners=True,
... tie_split_notes=False,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'8
\<
\p
e'16
\f
e'16
\<
\p
d'8
f'32
\f
f'16.
\<
\p
c'16.
\f
c'32
\<
\p
e'8
d'16
\f
d'16
\<
\p
f'8
\f
}
.. container:: example
Splits tupletted leaves and fracture crossing spanners:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Tuplet((2, 3), "c'4 d' e'"))
>>> staff.append(abjad.Tuplet((2, 3), "c'4 d' e'"))
>>> leaves = abjad.select(staff).leaves()
>>> slur = abjad.Slur()
>>> abjad.attach(slur, leaves)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 2/3 {
c'4
(
d'4
e'4
}
\times 2/3 {
c'4
d'4
e'4
)
}
}
>>> durations = [(1, 4)]
>>> result = abjad.mutate(leaves).split(
... durations,
... fracture_spanners=True,
... tie_split_notes=False,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 2/3 {
c'4
(
d'8
)
d'8
(
e'4
}
\times 2/3 {
c'4
d'4
e'4
)
}
}
.. container:: example
Splits leaves cyclically and ties split notes:
>>> staff = abjad.Staff("c'1 d'1")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, staff[:])
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'1
\<
\p
d'1
\f
}
>>> durations = [(3, 4)]
>>> result = abjad.mutate(staff[:]).split(
... durations,
... cyclic=True,
... fracture_spanners=False,
... tie_split_notes=True,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'2.
~
\<
\p
c'4
d'2
~
d'2
\f
}
As above but with repeat ties:
>>> staff = abjad.Staff("c'1 d'1")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, staff[:])
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> durations = [(3, 4)]
>>> result = abjad.mutate(staff[:]).split(
... durations,
... cyclic=True,
... fracture_spanners=False,
... tie_split_notes=True,
... repeat_ties=True,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
c'2.
\<
\p
c'4
\repeatTie
d'2
d'2
\repeatTie
\f
}
.. container:: example
Splits custom voice and preserves context name:
>>> voice = abjad.Voice(
... "c'4 d' e' f'",
... lilypond_type='CustomVoice',
... name='1',
... )
>>> staff = abjad.Staff([voice])
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[:])
>>> abjad.override(staff).dynamic_line_spanner.staff_padding = 3
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
\context CustomVoice = "1"
{
c'4
\<
\p
d'4
e'4
f'4
\f
}
}
>>> durations = [(1, 8)]
>>> result = abjad.mutate(staff[:]).split(
... durations,
... cyclic=True,
... fracture_spanners=False,
... tie_split_notes=True,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
\with
{
\override DynamicLineSpanner.staff-padding = #3
}
{
\context CustomVoice = "1"
{
c'8
~
\<
\p
}
\context CustomVoice = "1"
{
c'8
}
\context CustomVoice = "1"
{
d'8
~
}
\context CustomVoice = "1"
{
d'8
}
\context CustomVoice = "1"
{
e'8
~
}
\context CustomVoice = "1"
{
e'8
}
\context CustomVoice = "1"
{
f'8
~
}
\context CustomVoice = "1"
{
f'8
\f
}
}
>>> for voice in staff:
... voice
...
Voice("c'8 ~", lilypond_type='CustomVoice', name='1')
Voice("c'8", lilypond_type='CustomVoice', name='1')
Voice("d'8 ~", lilypond_type='CustomVoice', name='1')
Voice("d'8", lilypond_type='CustomVoice', name='1')
Voice("e'8 ~", lilypond_type='CustomVoice', name='1')
Voice("e'8", lilypond_type='CustomVoice', name='1')
Voice("f'8 ~", lilypond_type='CustomVoice', name='1')
Voice("f'8", lilypond_type='CustomVoice', name='1')
.. container:: example
Splits parallel container:
>>> voice_1 = abjad.Voice(
... "e''4 ( es'' f'' fs'' )",
... name='Voice 1',
... )
>>> voice_2 = abjad.Voice(
... r"c'4 \p \< cs' d' ds' \f",
... name='Voice 2',
... )
>>> abjad.override(voice_1).stem.direction = abjad.Up
>>> abjad.override(voice_1).slur.direction = abjad.Up
>>> container = abjad.Container(
... [voice_1, voice_2],
... is_simultaneous=True,
... )
>>> abjad.override(voice_2).stem.direction = abjad.Down
>>> staff = abjad.Staff([container])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
<<
\context Voice = "Voice 1"
\with
{
\override Slur.direction = #up
\override Stem.direction = #up
}
{
e''4
(
es''4
f''4
fs''4
)
}
\context Voice = "Voice 2"
\with
{
\override Stem.direction = #down
}
{
c'4
\p
\<
cs'4
d'4
ds'4
\f
}
>>
}
>>> durations = [(3, 8)]
>>> result = abjad.mutate(container).split(
... durations,
... cyclic=False,
... fracture_spanners=False,
... tie_split_notes=True,
... )
>>> abjad.show(staff) # doctest: +SKIP
>>> abjad.f(staff)
\new Staff
{
<<
\context Voice = "Voice 1"
\with
{
\override Slur.direction = #up
\override Stem.direction = #up
}
{
e''4
(
es''8
~
}
\context Voice = "Voice 2"
\with
{
\override Stem.direction = #down
}
{
c'4
\p
\<
cs'8
~
}
>>
<<
\context Voice = "Voice 1"
\with
{
\override Slur.direction = #up
\override Stem.direction = #up
}
{
es''8
f''4
fs''4
)
}
\context Voice = "Voice 2"
\with
{
\override Stem.direction = #down
}
{
cs'8
d'4
ds'4
\f
}
>>
}
.. container:: example
Splits leaves with articulations:
>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.Articulation('^'), staff[0])
>>> abjad.attach(abjad.LaissezVibrer(), staff[1])
>>> abjad.attach(abjad.Articulation('^'), staff[2])
>>> abjad.attach(abjad.LaissezVibrer(), staff[3])
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'4
-\marcato
d'4
\laissezVibrer
e'4
-\marcato
f'4
\laissezVibrer
}
>>> durations = [(1, 8)]
>>> result = abjad.mutate(staff[:]).split(
... durations,
... cyclic=True,
... fracture_spanners=False,
... tie_split_notes=True,
... )
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
-\marcato
~
c'8
d'8
~
d'8
\laissezVibrer
e'8
-\marcato
~
e'8
f'8
~
f'8
\laissezVibrer
}
Returns list of selections.
"""
# check input
components = self.client
single_component_input = False
if isinstance(components, Component):
single_component_input = True
components = select(components)
assert all(isinstance(_, Component) for _ in components)
if not isinstance(components, Selection):
components = select(components)
durations = [Duration(_) for _ in durations]
# return if no split to be done
if not durations:
if single_component_input:
return components
else:
return [], components
# calculate total component duration
total_component_duration = inspect(components).duration()
total_split_duration = sum(durations)
# calculate durations
if cyclic:
durations = sequence(durations)
durations = durations.repeat_to_weight(total_component_duration)
durations = list(durations)
elif total_split_duration < total_component_duration:
final_offset = total_component_duration - sum(durations)
durations.append(final_offset)
elif total_component_duration < total_split_duration:
weight = total_component_duration
durations = sequence(durations).truncate(weight=weight)
durations = list(durations)
# keep copy of durations to partition result components
durations_copy = durations[:]
# calculate total split duration
total_split_duration = sum(durations)
assert total_split_duration == total_component_duration
# initialize loop variables
result, shard = [], []
offset_index = 0
current_shard_duration = Duration(0)
remaining_components = list(components[:])
advance_to_next_offset = True
# build shards:
# grab next component and next duration each time through loop
while True:
# grab next split point
if advance_to_next_offset:
if durations:
next_split_point = durations.pop(0)
else:
break
advance_to_next_offset = True
# grab next component from input stack of components
if remaining_components:
current_component = remaining_components.pop(0)
else:
break
# find where current component endpoint will position us
duration_ = inspect(current_component).duration()
candidate_shard_duration = current_shard_duration + duration_
# if current component would fill current shard exactly
if candidate_shard_duration == next_split_point:
shard.append(current_component)
result.append(shard)
shard = []
current_shard_duration = Duration(0)
offset_index += 1
# if current component would exceed current shard
elif next_split_point < candidate_shard_duration:
local_split_duration = next_split_point
local_split_duration -= current_shard_duration
if isinstance(current_component, Leaf):
leaf_split_durations = [local_split_duration]
duration_ = inspect(current_component).duration()
current_duration = duration_
additional_required_duration = current_duration
additional_required_duration -= local_split_duration
split_durations = sequence(durations)
split_durations = split_durations.split(
[additional_required_duration],
cyclic=False,
overhang=True,
)
split_durations = [list(_) for _ in split_durations]
additional_durations = split_durations[0]
leaf_split_durations.extend(additional_durations)
durations = split_durations[-1]
leaf_shards = current_component._split_by_durations(
leaf_split_durations,
cyclic=False,
fracture_spanners=fracture_spanners,
tie_split_notes=tie_split_notes,
repeat_ties=repeat_ties,
)
shard.extend(leaf_shards)
result.append(shard)
offset_index += len(additional_durations)
else:
assert isinstance(current_component, Container)
pair = current_component._split_by_duration(
local_split_duration,
fracture_spanners=fracture_spanners,
tie_split_notes=tie_split_notes,
repeat_ties=repeat_ties,
)
left_list, right_list = pair
shard.extend(left_list)
result.append(shard)
remaining_components.__setitem__(slice(0, 0), right_list)
shard = []
offset_index += 1
current_shard_duration = Duration(0)
# if current component would not fill current shard
elif candidate_shard_duration < next_split_point:
shard.append(current_component)
duration_ = inspect(current_component).duration()
current_shard_duration += duration_
advance_to_next_offset = False
else:
message = 'can not process candidate duration: {!r}.'
message = message.format(candidate_shard_duration)
raise ValueError(message)
# append any stub shard
if len(shard):
result.append(shard)
# append any unexamined components
if len(remaining_components):
result.append(remaining_components)
# partition split components according to input durations
result = sequence(result).flatten(depth=-1)
result = select(result).partition_by_durations(
durations_copy,
fill=enums.Exact,
)
# return list of shards
assert all(isinstance(_, Selection) for _ in result)
return result
def swap(self, container):
r"""
Swaps mutation client for empty ``container``.
.. container:: example
Swaps measures for tuplet:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Measure((3, 4), "c'4 d'4 e'4"))
>>> staff.append(abjad.Measure((3, 4), "d'4 e'4 f'4"))
>>> leaves = abjad.select(staff).leaves()
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, leaves)
>>> measures = staff[:]
>>> slur = abjad.Slur()
>>> abjad.attach(slur, leaves)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 3/4
c'4
\<
\p
(
d'4
e'4
} % measure
{ % measure
d'4
e'4
f'4
\f
)
} % measure
}
>>> measures = staff[:]
>>> tuplet = abjad.Tuplet((2, 3), [])
>>> tuplet.denominator = 4
>>> abjad.mutate(measures).swap(tuplet)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
\times 4/6 {
c'4
\<
\p
(
d'4
e'4
d'4
e'4
f'4
\f
)
}
}
Returns none.
"""
if isinstance(self.client, Selection):
donors = self.client
else:
donors = select(self.client)
assert donors.are_contiguous_same_parent()
assert isinstance(container, Container)
assert not container, repr(container)
donors._give_components_to_empty_container(container)
donors._give_dominant_spanners([container])
donors._give_position_in_parent_to_container(container)
def transpose(self, argument):
r"""
Transposes notes and chords in mutation client by ``argument``.
.. todo:: Move to abjad.pitch package.
.. container:: example
Transposes notes and chords in staff:
>>> staff = abjad.Staff()
>>> staff.append(abjad.Measure((4, 4), "c'4 d'4 e'4 r4"))
>>> staff.append(abjad.Measure((3, 4), "d'4 e'4 <f' a' c''>4"))
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 4/4
c'4
d'4
e'4
r4
} % measure
{ % measure
\time 3/4
d'4
e'4
<f' a' c''>4
} % measure
}
>>> abjad.mutate(staff).transpose("+m3")
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 4/4
ef'4
f'4
g'4
r4
} % measure
{ % measure
\time 3/4
f'4
g'4
<af' c'' ef''>4
} % measure
}
Returns none.
"""
named_interval = NamedInterval(argument)
for x in iterate(self.client).components((Note, Chord)):
if isinstance(x, Note):
old_written_pitch = x.note_head.written_pitch
new_written_pitch = old_written_pitch.transpose(named_interval)
x.note_head.written_pitch = new_written_pitch
else:
for note_head in x.note_heads:
old_written_pitch = note_head.written_pitch
new_written_pitch = old_written_pitch.transpose(
named_interval)
note_head.written_pitch = new_written_pitch
def wrap(self, container):
r"""
Wraps mutation client in empty ``container``.
.. container:: example
Wraps in-score notes in tuplet:
>>> staff = abjad.Staff("c'8 [ ( d' e' ] ) c' [ ( d' e' ] )")
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
[
(
d'8
e'8
]
)
c'8
[
(
d'8
e'8
]
)
}
>>> tuplet = abjad.Tuplet((2, 3), [])
>>> abjad.mutate(staff[-3:]).wrap(tuplet)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
c'8
[
(
d'8
e'8
]
)
\times 2/3 {
c'8
[
(
d'8
e'8
]
)
}
}
.. container:: example
Wraps outside-score notes in tuplet:
>>> maker = abjad.NoteMaker()
>>> notes = maker([0, 2, 4], [(1, 8)])
>>> tuplet = abjad.Tuplet((2, 3), [])
>>> abjad.mutate(notes).wrap(tuplet)
>>> abjad.show(tuplet) # doctest: +SKIP
.. docs::
>>> abjad.f(tuplet)
\times 2/3 {
c'8
d'8
e'8
}
(This usage merely substitutes for the tuplet initializer.)
.. container:: example
Wraps leaves in measure:
>>> notes = [abjad.Note(n, (1, 8)) for n in range(8)]
>>> voice = abjad.Voice(notes)
>>> measure = abjad.Measure((4, 8), [])
>>> abjad.mutate(voice[:4]).wrap(measure)
>>> abjad.show(voice) # doctest: +SKIP
.. docs::
>>> abjad.f(voice)
\new Voice
{
{ % measure
\time 4/8
c'8
cs'8
d'8
ef'8
} % measure
e'8
f'8
fs'8
g'8
}
.. container:: example
Wraps each leaf in measure:
>>> notes = [abjad.Note(n, (1, 1)) for n in range(4)]
>>> staff = abjad.Staff(notes)
>>> for note in staff:
... measure = abjad.Measure((1, 1), [])
... abjad.mutate(note).wrap(measure)
...
.. docs::
>>> abjad.f(staff)
\new Staff
{
{ % measure
\time 1/1
c'1
} % measure
{ % measure
cs'1
} % measure
{ % measure
d'1
} % measure
{ % measure
ef'1
} % measure
}
.. container:: example
Raises exception on nonempty ``container``:
>>> import pytest
>>> staff = abjad.Staff("c'8 [ ( d' e' ] ) c' [ ( d' e' ] )")
>>> tuplet = abjad.Tuplet((2, 3), "g'8 a' fs'")
>>> statement = 'abjad.mutate(staff[-3:]).wrap(tuplet)'
>>> pytest.raises(Exception, statement)
<ExceptionInfo Exception tblen=...>
.. container:: example
REGRESSION. Contexted indicators (like time signature) survive
wrap:
>>> staff = abjad.Staff("c'4 d' e' f'")
>>> leaves = abjad.select(staff).leaves()
>>> abjad.attach(abjad.TimeSignature((3, 8)), leaves[0])
>>> container = abjad.Container()
>>> abjad.mutate(leaves).wrap(container)
>>> abjad.show(staff) # doctest: +SKIP
.. docs::
>>> abjad.f(staff)
\new Staff
{
{
\time 3/8
c'4
d'4
e'4
f'4
}
}
>>> prototype = abjad.TimeSignature
>>> for component in abjad.iterate(staff).components():
... inspection = abjad.inspect(component)
... time_signature = inspection.effective(prototype)
... print(component, time_signature)
...
<Staff{1}> 3/8
Container("c'4 d'4 e'4 f'4") 3/8
c'4 3/8
d'4 3/8
e'4 3/8
f'4 3/8
Returns none.
"""
if (
not isinstance(container, Container) or
0 < len(container)):
message = f'must be empty container: {container!r}.'
raise Exception(message)
if isinstance(self.client, Component):
selection = select(self.client)
else:
selection = self.client
assert isinstance(selection, Selection), repr(selection)
parent, start, stop = selection._get_parent_and_start_stop_indices()
if not selection.are_contiguous_logical_voice():
message = 'must be contiguous components in same logical voice:'
message += f' {selection!r}.'
raise Exception(message)
container._components = list(selection)
container[:]._set_parents(container)
if parent is not None:
parent._components.insert(start, container)
container._set_parent(parent)
for component in selection:
for wrapper in component._wrappers:
wrapper._effective_context = None
wrapper._update_effective_context()
| [
"chenxuanguang@chuangxin.com"
] | chenxuanguang@chuangxin.com |
06b5f49e79b349ad70faa988064b4336dd5369dc | fa76cf45d7bf4ed533e5a776ecd52cea15da8c90 | /robotframework-ls/src/robotframework_ls/impl/keyword_completions.py | ba1562f27c938347a18fc2151fd96c373f00b5ed | [
"Apache-2.0"
] | permissive | martinRenou/robotframework-lsp | 8a5d63b7cc7d320c9fed2372a79c8c6772d6481e | 5f23b7374139e83d0aa1ebd30675e762d7a0db86 | refs/heads/master | 2023-08-18T22:26:01.386975 | 2021-10-25T13:46:11 | 2021-10-25T13:46:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,392 | py | from robocorp_ls_core.robotframework_log import get_logger
from robotframework_ls.impl.protocols import ICompletionContext, IKeywordFound
from typing import List
log = get_logger(__name__)
class _Collector(object):
def __init__(self, completion_context: ICompletionContext, token):
from robotframework_ls.impl.string_matcher import RobotStringMatcher
from robotframework_ls.impl.string_matcher import (
build_matchers_with_resource_or_library_scope,
)
from robotframework_ls.robot_config import create_convert_keyword_format_func
token_str = token.value
self.completion_items: List[dict] = []
self.completion_context = completion_context
self.selection = completion_context.sel
self.token = token
self._matcher = RobotStringMatcher(token_str)
self._scope_matchers = build_matchers_with_resource_or_library_scope(token_str)
config = completion_context.config
self._convert_keyword_format = create_convert_keyword_format_func(config)
def accepts(self, keyword_name):
if self._matcher.accepts_keyword_name(keyword_name):
return True
for matcher in self._scope_matchers:
if matcher.accepts_keyword_name(keyword_name):
return True
return False
def _create_completion_item_from_keyword(
self, keyword_found: IKeywordFound, selection, token, col_delta=0
):
from robocorp_ls_core.lsp import (
CompletionItem,
InsertTextFormat,
Position,
Range,
TextEdit,
)
from robocorp_ls_core.lsp import MarkupKind
from robotframework_ls.impl.protocols import IKeywordArg
label = keyword_found.keyword_name
if keyword_found.library_name:
# If we found the keyword in a library, convert its format depending on
# the user configuration.
label = self._convert_keyword_format(label)
text = label
arg: IKeywordArg
for i, arg in enumerate(keyword_found.keyword_args):
if arg.is_keyword_arg or arg.is_star_arg or arg.default_value is not None:
continue
arg_name = arg.arg_name
arg_name = arg_name.replace("$", "\\$").replace("{", "").replace("}", "")
text += " ${%s:%s}" % (i + 1, arg_name)
text_edit = TextEdit(
Range(
start=Position(selection.line, token.col_offset + col_delta),
end=Position(selection.line, token.end_col_offset),
),
text,
)
# text_edit = None
return CompletionItem(
label,
kind=keyword_found.completion_item_kind,
text_edit=text_edit,
insertText=text_edit.newText,
documentation=keyword_found.docs,
insertTextFormat=InsertTextFormat.Snippet,
documentationFormat=(
MarkupKind.Markdown
if keyword_found.docs_format == "markdown"
else MarkupKind.PlainText
),
).to_dict()
def on_keyword(self, keyword_found):
col_delta = 0
if not self._matcher.accepts_keyword_name(keyword_found.keyword_name):
for matcher in self._scope_matchers:
if matcher.accepts_keyword(keyword_found):
# +1 for the dot
col_delta = len(matcher.resource_or_library_name) + 1
break
else:
return # i.e.: don't add completion
item = self._create_completion_item_from_keyword(
keyword_found, self.selection, self.token, col_delta=col_delta
)
self.completion_items.append(item)
def complete(completion_context: ICompletionContext) -> List[dict]:
from robotframework_ls.impl.collect_keywords import collect_keywords
from robotframework_ls.impl import ast_utils
token_info = completion_context.get_current_token()
if token_info is not None:
token = ast_utils.get_keyword_name_token(token_info.node, token_info.token)
if token is not None:
collector = _Collector(completion_context, token)
collect_keywords(completion_context, collector)
return collector.completion_items
return []
| [
"fabiofz@gmail.com"
] | fabiofz@gmail.com |
d319da9fb58fa68d2b8a777c4b1806438f11568a | c18a82df70c5aec94e692d57f5458b03d3c74e4d | /pys/request.py | 808c9bfe2a8fbc06e76b3d95f9a9a8bde760051a | [] | no_license | swat199538/LeranPython | 80eba3f1c26cae9efa3e54d85846149dea0a277b | 2e413c5fddd4cb2cf2b58cb27b7e35be42699f22 | refs/heads/master | 2021-01-10T23:23:38.631892 | 2016-10-31T09:51:17 | 2016-10-31T09:51:17 | 70,589,283 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 465 | py | # _*_ coding: utf-8 _*_
import sys
import requests
reload(sys)
sys.setdefaultencoding('utf8')
paramss = {"wd": "python"}
headers = {'content-type': 'application/json',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0'}
r = requests.get('https://www.baidu.com/s', params=paramss, headers=headers)
print r.url
abc = r.text
abc.encode('utf-8')
files = open('./abcd.html', 'w')
files.write(abc)
files.close()
| [
"wangliang199538@live.com"
] | wangliang199538@live.com |
d5041c51ebe11f081577b6160fbce711fcff2e24 | ae122999dfb63f6bef6e7e5e99424b90eed9cab1 | /source/sampleProcess.py | 832e06cb5b072a7c0c755b36ad91133a6c5ccb23 | [
"MIT-0"
] | permissive | prasunanand/aws-batch-python-sample | a00199aedfa611e4ff4d9a190dcb4ce57f77bab4 | 57f824c1b900d9f57d0cccc94feb27bb6cf8cfdd | refs/heads/master | 2021-05-15T02:14:47.652322 | 2020-01-07T04:44:03 | 2020-01-07T04:44:03 | 250,239,852 | 0 | 0 | NOASSERTION | 2020-03-26T11:28:33 | 2020-03-26T11:28:33 | null | UTF-8 | Python | false | false | 884 | py | import logging
import os
import urllib.request
"""
This is a simple sample that downloads a json formatted address and writes the output to a directory
"""
class SampleProcess:
def __init__(self, uri="http://maps.googleapis.com/maps/api/geocode/json?address=google"):
self.uri = uri
@property
def logger(self):
return logging.getLogger(__name__)
def run(self, output_dir):
output_filename = os.path.join(output_dir, "sample.json")
self.logger.info("Downloading from {} to {}".format(self.uri, output_filename))
with urllib.request.urlopen(self.uri) as url:
data = url.read().decode()
self.logger.debug("Writing {} to {}", data, output_filename)
with open(output_filename, "w") as out:
out.write(data)
self.logger.info("Download complete..")
return output_filename
| [
"aeg@amazon.com"
] | aeg@amazon.com |
554b9e16b03d93e3d46ffc856dcdcc7ac9ee49f4 | 72753441d92170e6b54ab759cb81a92764e8abde | /data/cifar_view.py | 2ef2b546090e7a0933f1ca77f3da1a49e1628c30 | [] | no_license | pokem1402/CSED703 | 2bec168d1610695f9070ed8a195babeee00dc01a | fe2292a81777c37e401297a56859ff5513ec8097 | refs/heads/master | 2022-09-08T21:49:31.248963 | 2022-08-26T08:42:39 | 2022-08-26T08:42:39 | 107,729,622 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,939 | py | import numpy as np
import matplotlib.pyplot as plt
import pickle
CIFAR10_LABELS_LIST = [
'airplane',
'automobile',
'bird',
'cat',
'deer',
'dog',
'frog',
'horse',
'ship',
'truck'
]
CIFAR100_LABELS_LIST = [
'apple', 'aquarium_fish', 'baby', 'bear', 'beaver', 'bed', 'bee', 'beetle',
'bicycle', 'bottle', 'bowl', 'boy', 'bridge', 'bus', 'butterfly', 'camel',
'can', 'castle', 'caterpillar', 'cattle', 'chair', 'chimpanzee', 'clock',
'cloud', 'cockroach', 'couch', 'crab', 'crocodile', 'cup', 'dinosaur',
'dolphin', 'elephant', 'flatfish', 'forest', 'fox', 'girl', 'hamster',
'house', 'kangaroo', 'keyboard', 'lamp', 'lawn_mower', 'leopard', 'lion',
'lizard', 'lobster', 'man', 'maple_tree', 'motorcycle', 'mountain', 'mouse',
'mushroom', 'oak_tree', 'orange', 'orchid', 'otter', 'palm_tree', 'pear',
'pickup_truck', 'pine_tree', 'plain', 'plate', 'poppy', 'porcupine',
'possum', 'rabbit', 'raccoon', 'ray', 'road', 'rocket', 'rose',
'sea', 'seal', 'shark', 'shrew', 'skunk', 'skyscraper', 'snail', 'snake',
'spider', 'squirrel', 'streetcar', 'sunflower', 'sweet_pepper', 'table',
'tank', 'telephone', 'television', 'tiger', 'tractor', 'train', 'trout',
'tulip', 'turtle', 'wardrobe', 'whale', 'willow_tree', 'wolf', 'woman',
'worm'
]
def view_cifar100(file, spec = False, no = None):
f = open(file,'rb')
datadict = pickle.load(f, encoding='bytes')
f.close()
X = datadict[b'data']
Y = datadict[b'fine_labels']
X = X.reshape(50000, 3, 32, 32).transpose(0,2,3,1).astype("uint8")
Y = np.array(Y)
labels = []
if not spec:
fig, axes1 = plt.subplots(5,5,figsize=(3,3))
for i in range(5):
for k in range(5):
j = np.random.choice(range(len(X)))
axes1[i][k].set_axis_off()
axes1[i][k].imshow(X[j:j+1][0])
labels.append(CIFAR100_LABELS_LIST[Y[j]])
for i in range(5):
print(labels[i*5:i*5+5])
elif spec & no <= 50000:
fig = plt.imshow(X[no:no+1][0])
print(CIFAR100_LABELS_LIST[Y[no]])
def view_cifar10(file, spec = False, no = None):
f = open(file,'rb')
datadict = pickle.load(f, encoding='bytes')
f.close()
X = datadict[b'data']
Y = datadict[b'labels']
X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype("uint8")
Y = np.array(Y)
labels = []
if not spec:
fig, axes1 = plt.subplots(5,5,figsize=(3,3))
for i in range(5):
for k in range(5):
j = np.random.choice(range(len(X)))
axes1[i][k].set_axis_off()
axes1[i][k].imshow(X[j:j+1][0])
labels.append(CIFAR10_LABELS_LIST[Y[j]])
for i in range(5):
print(labels[i*5:i*5+5])
elif spec & no <= 10000:
fig = plt.imshow(X[no:no+1][0])
print(CIFAR10_LABELS_LIST[Y[no]])
| [
"pokem@naver.com"
] | pokem@naver.com |
ade25c7dbd8c099a51d073326d1e6c6f180b61f6 | aa11593e5508cdcaea3cb10b37e26623da3936b4 | /wangdanfeng.py | bdbb63a1f46f822ec674771327c8c9dcdf2770e6 | [
"Apache-2.0"
] | permissive | No1group/Practice | 9a5b17b1c616efd07e63b558a4541176f77b73b0 | bc8d55ffb3a794f869a2b7e7a111d828c7e1ad5c | refs/heads/master | 2021-04-06T04:01:43.012915 | 2018-03-13T13:11:15 | 2018-03-13T13:11:15 | 125,048,853 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 24 | py | print('猜猜我是谁') | [
"pythonW@126.com"
] | pythonW@126.com |
bf50b75bd9e55637ad8c0d461a4a79783180775e | f8845af1f51562b9d56497de435d37270e059660 | /DeepLearning_filmClassify/predict.py | d01564da376d0a62cb0f7caeca963688c1b426fa | [] | no_license | ZJ96/deeplearning_project | 1bf2c33d90f46a49588fc9eb7c827bc76186d977 | 48367b58090519d9e63344f8287abe29606b3933 | refs/heads/master | 2023-03-12T05:40:03.848643 | 2021-03-09T06:43:09 | 2021-03-09T06:43:09 | 345,907,705 | 6 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,568 | py | import config
import jieba
import torch
from model import SentimentModel, pre_weight
from util import build_word_dict, set_seed
from train import *
def predict(comment_str, model, device, word2ix):
model = model.to(device)
seg_list = jieba.lcut(comment_str, cut_all=False)
words_to_idx = []
for w in seg_list:
try:
index = word2ix[w]
except BaseException:
index = 0 # 可能出现没有收录的词语,置为0
words_to_idx.append(index)
inputs = torch.tensor(words_to_idx).to(device)
inputs = inputs.reshape(1, len(inputs))
outputs, _ = model(inputs, [len(inputs), ])
#print("outputs",outputs)
pred = outputs.argmax(1).item()
return pred
def main():
Config = config.get_args()
set_seed(Config.seed)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
word2ix, ix2word, max_len, avg_len = build_word_dict(Config.train_path)
weight = torch.zeros(len(word2ix), Config.embedding_dim)
model = SentimentModel(embedding_dim=Config.embedding_dim,
hidden_dim=Config.hidden_dim,
LSTM_layers=Config.LSTM_layers,
drop_prob=Config.drop_prob,
pre_weight=weight)
model.load_state_dict(
torch.load(
Config.model_save_path),
strict=True) # 模型加载
result = predict(Config.comment_str, model, device, word2ix)
print(Config.comment_str)
print(result)
if __name__ == '__main__':
main() | [
"807524568@qq.com"
] | 807524568@qq.com |
e7f5baad382a26f24197a5c9175cca98b7075e17 | cbd1c52de6cd45208ecce076c238dfc75cebd70a | /core/rc_rpc.py | a2ed18df473374275e4bf53f78759acbc01b2dd4 | [
"Apache-2.0"
] | permissive | enterpriseih/distributed-realtime-capfaiss | 2e20cad0c788c0700df948b6a46be52d91ac5b9b | 3346f540b6c9d17a6be446fefa8c9b79164929d9 | refs/heads/main | 2023-08-16T20:30:20.807161 | 2020-12-11T02:50:41 | 2020-12-11T02:50:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,722 | py | # encoding: utf-8
"""
@time : 2019/5/24 下午10:22
@author : liuning11@jd.com
@file : recall_sku_rec_core.py
@description : sku推荐
##########################################################
#
#
#
#
##########################################################
"""
import json
from config import model_man, context # , cache_r2m, cache_r2mp
from core.uconstant.response_code import *
from core.uconstant.response_code import SUCCESS
from core.grpc import syncindex_pb2
from core.grpc import syncindex_pb2_grpc
from core.rc import meta as _meta
import grpc
from core.grpc_ser.syncindex_server_master import vector_2_internalArray
def get_elect_master():
ducc = context.contain['ducc']
req = ducc.query('elect')
obj = json.loads(req.content)
data = obj['data']
elect_master = data['value']
return elect_master
def meta(ha, rc_id):
if ha.is_leader:
status, instance = _meta(model_man, rc_id)
return syncindex_pb2.SyncReply(code=status, message=RESPONSE_CODE[status], data=instance)
elect_master = get_elect_master()
with grpc.insecure_channel('%s:50051' % elect_master) as channel:
stub = syncindex_pb2_grpc.SyncIndexStub(channel)
response = stub.Meta(syncindex_pb2.SyncRequest(rcId=rc_id))
return {'code': SUCCESS, 'msg': RESPONSE_CODE[SUCCESS], 'data': str(response)}
def add(ha, rc_id, ids, vectors):
def _add(host, port, rc_id, ids, vectors):
vs = vector_2_internalArray(vectors)
with grpc.insecure_channel('%s:%s' % (host, port)) as channel:
stub = syncindex_pb2_grpc.SyncIndexStub(channel)
response = stub.Add(syncindex_pb2.SyncRequest(rcId=rc_id, ids=ids, vectors=vs))
return {'code': SUCCESS, 'msg': RESPONSE_CODE[SUCCESS], 'data': str(response)}
port = context.get_rpcConfig()['master']['port']
if ha.is_leader:
result = _add('localhost', port, rc_id, ids, vectors)
return result
else:
elect_master = get_elect_master()
result = _add(elect_master, port, rc_id, ids, vectors)
return result
def reindex(ha, rc_id, ids, vectors):
def _reindex(host, port, rc_id, ids, vectors):
vs = vector_2_internalArray(vectors)
with grpc.insecure_channel('%s:%s' % (host, port)) as channel:
stub = syncindex_pb2_grpc.SyncIndexStub(channel)
response = stub.Reindex(syncindex_pb2.SyncRequest(rcId=rc_id, ids=ids, vectors=vs))
return {'code': SUCCESS, 'msg': RESPONSE_CODE[SUCCESS], 'data': str(response)}
port = context.get_rpcConfig()['master']['port']
if ha.is_leader:
result = _reindex('localhost', port, rc_id, ids, vectors)
return result
else:
elect_master = get_elect_master()
result = _reindex(elect_master, port, rc_id, ids, vectors)
return result
def delete(ha, rc_id, ids):
def _del(host, port, rc_id, ids):
with grpc.insecure_channel('%s:%s' % (host, port)) as channel:
stub = syncindex_pb2_grpc.SyncIndexStub(channel)
response = stub.Delete(syncindex_pb2.SyncRequest(rcId=rc_id, ids=ids))
return {'code': SUCCESS, 'msg': RESPONSE_CODE[SUCCESS], 'data': str(response)}
# print('aaaaaa delete enter')
port = context.get_rpcConfig()['master']['port']
if ha.is_leader:
# print('aaaaaa delete localhost')
result = _del('localhost', port, rc_id, ids)
return result
else:
elect_master = get_elect_master()
# print('aaaaaa delete %s' % elect_master)
result = _del(elect_master, port, rc_id, ids)
return result
def replace(instance, ids, vectors):
pass
| [
"liuning11@jd.com"
] | liuning11@jd.com |
f38ba158f0d5da73f046966b14e6959374ad87b5 | 8ccd60a46c4e2551e03fbdf7efd45c37c94da9ac | /scouts/admin.py | e659669534e4a85da4cff1c8f4b41f6868914676 | [] | no_license | nickpack/BasScouts | 56220226c444ba25c1843a4e781adcd7a715f5ff | 4828d82f38529cf5be2d56aa9a36f64f48ef4790 | refs/heads/master | 2021-01-19T06:37:34.867141 | 2012-05-25T09:00:44 | 2012-05-25T09:00:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 310 | py | __author__ = 'Nick Pack'
from scouts.models import *
from django.contrib import admin
admin.site.register(FAQEntry)
admin.site.register(ScoutPack)
admin.site.register(ScoutLeader)
admin.site.register(NewsCategory)
admin.site.register(NewsArticle)
admin.site.register(Gallery)
admin.site.register(GalleryImage) | [
"nick@nickpack.com"
] | nick@nickpack.com |
7e529373a47653de3ecb8ec3abf1e32c6d4f9a1e | 08539fe5f1fbf9b4be09756825265569477e5280 | /scapy-network-scanner.py | cfe2d1e9f1bc8128444f9caf58f0be71bff66812 | [] | no_license | poetsec/network-scanners | abeabe58616f0c04f624934ebf07685b0bce09ec | 974ef3f6da973243e677d93e147c5d438a7a7f3d | refs/heads/main | 2023-07-14T18:14:18.469958 | 2021-08-27T07:05:11 | 2021-08-27T07:05:11 | 389,490,489 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 129 | py | #!/usr/bin/env python
import scapy.all as scapy
def scan(ip):
scapy.arping(ip)
scan("# add IP and/or range here")
| [
"noreply@github.com"
] | poetsec.noreply@github.com |
61c238b475be55c5fe52336ecc02e40ad6a44d5f | ecc2c6a8cb7c383a63b4a68ba51adc05847f0cd0 | /05.定制后台和修改模型/article/migrations/0001_initial.py | 807a434da0b7b102728def1103d86fcffe5e2647 | [] | no_license | daiqing5/django2.0-course | 677e97994bf47eec4742c70100b5609fd93b15ca | f4446fee5282d08f62d3bbe74ccfefba16afe6f3 | refs/heads/master | 2023-01-22T01:08:39.252609 | 2020-12-02T09:03:27 | 2020-12-02T09:03:27 | 275,532,806 | 1 | 0 | null | 2020-06-28T07:37:55 | 2020-06-28T07:37:54 | null | UTF-8 | Python | false | false | 534 | py | # Generated by Django 2.0 on 2018-07-24 17:53
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=30)),
('content', models.TextField()),
],
),
]
| [
"624644925@qq.com"
] | 624644925@qq.com |
15b810c22d83d347776d4b42314bd5f8e80f1f8b | ba25734f14956d77bd492b1edc50c8fca3783b13 | /ev3devices/4-ultra.py | 2614d462ba47b99004af1689aa3c52dca155cda4 | [] | no_license | akorea/ev3micropython | 41880fd53a2f6b39361e8e36237bbc33a2b27594 | 234e7f778982320f6ae8bf106407aa2a30fee0c1 | refs/heads/main | 2023-01-10T03:07:21.919282 | 2020-11-13T06:31:52 | 2020-11-13T06:31:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 879 | py | #!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port, Stop, Direction, Button, Color
from pybricks.tools import wait, StopWatch, DataLog
from pybricks.robotics import DriveBase
from pybricks.media.ev3dev import SoundFile, ImageFile
# This program requires LEGO EV3 MicroPython v2.0 or higher.
# Click "Open user guide" on the EV3 extension tab for more information.
# Create your objects here.
ev3 = EV3Brick()
# Write your program here.
ev3.speaker.beep()
ultra = UltrasonicSensor(Port.S2)
#물체 사이의 거리 반환 (단위:mm)
distance = ultra.distance()
print(distance)
#초음파 존재 유무 반환(True, False)
presence = ultra.presence()
print(presence)
| [
"serenax001@gmail.com"
] | serenax001@gmail.com |
576fd469a699f9e63a9eb104de5965f973058d62 | 927bd5c34d51d24eacaf24d0ab556126fd7ae16b | /day_08/Dominik/solution.py | 8b8630bb29eac2fa9699eaaeda56a23a86a885af | [] | no_license | voidlessVoid/advent_of_code_2019 | 3dbef85f1753fedd6418cfb6989604f70f745d64 | fa59c3383ef846c237869a5f8a5284ea3a6ce4e9 | refs/heads/master | 2020-09-18T11:25:41.798889 | 2020-09-16T10:12:59 | 2020-09-16T10:12:59 | 224,144,892 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,820 | py | def read_input_to_list(path):
with open(path, "r") as f:
content = f.readline()
return content
content = read_input_to_list("input.txt")
image_size = (25, 6)
def layer_splitting(image_data, size: int):
start = 0
for i in range(0, len(image_data), size):
yield image_data[start:start + size]
start += size
splitted_image = list(layer_splitting(image_data=content, size=image_size[0]))
layered_image = list(layer_splitting(image_data=splitted_image, size=image_size[1]))
def checksum(image_data):
def counter(layer, pattern: str):
count = 0
for row in layer:
count += row.count(pattern)
return count
dic = {}
for layer in image_data:
zero = counter(layer=layer, pattern="0")
dic[zero] = layer
check = counter(layer=dic[min(dic.keys())], pattern="1") * counter(layer=dic[min(dic.keys())], pattern="2")
print(f"The checksum for the image is: {check}")
# checksum(image_data=layered_image)
import copy
def decode_image(image_data):
image_data_reversed = image_data[::-1]
for i, layer in enumerate(image_data_reversed.copy()):
for m, row in enumerate(layer):
image_data_reversed[i][m]= list(row)
for i, layer in enumerate(image_data_reversed.copy()):
if i > 0:
print(f"Layer {i}")
for nrow in range(len(layer)):
top_layer = image_data_reversed[i][nrow]
lower_layer = image_data_reversed[i - 1][nrow]
for n,char in enumerate(top_layer.copy()):
if char == "2":
top_layer[n] = lower_layer[n]
return image_data_reversed[-1]
image= decode_image(image_data=layered_image)
# correct answer CFLUL
# conditional formatting in Excel for visualisation | [
"noreply@github.com"
] | voidlessVoid.noreply@github.com |
dc05cdbaf04f61da245f5a9fa52bbc06550f2a2b | 2772b58d09f3cc8fad2b4354dee7a06c481b7d23 | /forum/migrations/0043_auto_20150513_1003.py | 701ce197db9b45b5753879a2fb2b2b14c10d4ea6 | [
"MIT"
] | permissive | shmilyoo/ggxxBBS | 33cef10ac2284010028556c6d946566de05537da | cef6408e533bd0b0f57c3e2f5da4e93ea07c4331 | refs/heads/master | 2020-04-25T02:56:02.116161 | 2019-02-25T07:57:02 | 2019-02-25T07:57:02 | 172,458,753 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,098 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0042_auto_20150508_1059'),
]
operations = [
migrations.AddField(
model_name='topic',
name='is_top_all',
field=models.BooleanField(default=False, verbose_name='\u662f\u5426\u5168\u7ad9\u7f6e\u9876'),
preserve_default=True,
),
migrations.AlterField(
model_name='forum',
name='content',
field=models.TextField(default=b'', verbose_name='\u7248\u5757\u8be6\u7ec6\u4ecb\u7ecd(\u663e\u793a\u5728\u6b64\u7248\u5757\u9875\u9762\u4e2d)', blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='forum',
name='descr',
field=models.TextField(default=b'', verbose_name='\u7248\u5757\u7b80\u8981\u4ecb\u7ecd(\u663e\u793a\u5728\u7248\u5757\u5217\u8868\u4e2d)', blank=True),
preserve_default=True,
),
]
| [
"fighter_yy@qq.com"
] | fighter_yy@qq.com |
1e95250d9420099583ef36604b6e7a625c4afbf7 | 06a7dc7cc93d019e4a9cbcf672b23a0bbacf8e8b | /2018_euaims_leap_predict_vbm/supervised_analysis/VBM/1.5mm/by_site/05_svm_site5.py | feab05287682a38dbe71c03cb56bbccbdcb92fee | [] | no_license | neurospin/scripts | 6c06cd218a5f32de9c3c2b7d1d8bda3f3d107458 | f14a2c9cf2cd7f5fbea767b017c3faf36d170bdb | refs/heads/master | 2021-07-11T22:55:46.567791 | 2021-07-02T13:08:02 | 2021-07-02T13:08:02 | 10,549,286 | 2 | 2 | null | null | null | null | UTF-8 | Python | false | false | 10,415 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 10:04:13 2017
@author: ad247405
"""
import os
import json
import numpy as np
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import precision_recall_fscore_support
from scipy.stats import binom_test
from collections import OrderedDict
from sklearn import preprocessing
from sklearn.metrics import roc_auc_score
from sklearn import svm
import pandas as pd
import shutil
WD = '/neurospin/brainomics/2018_euaims_leap_predict_vbm/results/VBM/1.5mm/by_site/site5/svm'
WD_CLUSTER = WD.replace("/neurospin/", "/mnt/neurospin/sel-poivre/")
def config_filename(): return os.path.join(WD,"config_dCV.json")
def results_filename(): return os.path.join(WD,"results_dCV.xlsx")
#############################################################################
def load_globals(config):
import mapreduce as GLOBAL # access to global variables
GLOBAL.DATA = GLOBAL.load_data(config["data"])
def resample(config, resample_nb):
import mapreduce as GLOBAL # access to global variables
GLOBAL.DATA = GLOBAL.load_data(config["data"])
resample = config["resample"][resample_nb]
GLOBAL.DATA_RESAMPLED = {k: [GLOBAL.DATA[k][idx, ...] for idx in resample]
for k in GLOBAL.DATA}
def mapper(key, output_collector):
import mapreduce as GLOBAL
Xtr = GLOBAL.DATA_RESAMPLED["X"][0]
Xte = GLOBAL.DATA_RESAMPLED["X"][1]
ytr = GLOBAL.DATA_RESAMPLED["y"][0]
yte = GLOBAL.DATA_RESAMPLED["y"][1]
c = float(key[0])
print("c:%f" % (c))
class_weight='balanced' # unbiased
mask = np.ones(Xtr.shape[0], dtype=bool)
scaler = preprocessing.StandardScaler().fit(Xtr)
Xtr = scaler.transform(Xtr)
Xte=scaler.transform(Xte)
mod = svm.LinearSVC(C=c,fit_intercept=False,class_weight= class_weight)
mod.fit(Xtr, ytr.ravel())
y_pred = mod.predict(Xte)
y_proba_pred = mod.decision_function(Xte)
ret = dict(y_pred=y_pred, y_true=yte,prob_pred = y_proba_pred, beta=mod.coef_, mask=mask)
if output_collector:
output_collector.collect(key, ret)
else:
return ret
def scores(key, paths, config):
import mapreduce
print (key)
values = [mapreduce.OutputCollector(p) for p in paths]
values = [item.load() for item in values]
y_true = [item["y_true"].ravel() for item in values]
y_pred = [item["y_pred"].ravel() for item in values]
y_true = np.concatenate(y_true)
y_pred = np.concatenate(y_pred)
prob_pred = [item["prob_pred"].ravel() for item in values]
prob_pred = np.concatenate(prob_pred)
p, r, f, s = precision_recall_fscore_support(y_true, y_pred, average=None)
auc = roc_auc_score(y_true, prob_pred) #area under curve score.
#betas = np.hstack([item["beta"] for item in values]).T
# threshold betas to compute fleiss_kappa and DICE
#betas_t = np.vstack([array_utils.arr_threshold_from_norm2_ratio(betas[i, :], .99)[0] for i in range(betas.shape[0])])
#Compute pvalue
success = r * s
success = success.astype('int')
prob_class1 = np.count_nonzero(y_true) / float(len(y_true))
pvalue_recall0_true_prob = binom_test(success[0], s[0], 1 - prob_class1,alternative = 'greater')
pvalue_recall1_true_prob = binom_test(success[1], s[1], prob_class1,alternative = 'greater')
pvalue_recall0_unknwon_prob = binom_test(success[0], s[0], 0.5,alternative = 'greater')
pvalue_recall1_unknown_prob = binom_test(success[1], s[1], 0.5,alternative = 'greater')
pvalue_recall_mean = binom_test(success[0]+success[1], s[0] + s[1], p=0.5,alternative = 'greater')
scores = OrderedDict()
try:
a, l1, l2 , tv = [float(par) for par in key.split("_")]
scores['a'] = a
scores['l1'] = l1
scores['l2'] = l2
scores['tv'] = tv
left = float(1 - tv)
if left == 0: left = 1.
scores['l1_ratio'] = float(l1) / left
except:
pass
scores['recall_0'] = r[0]
scores['recall_1'] = r[1]
scores['recall_mean'] = r.mean()
scores["auc"] = auc
scores['pvalue_recall0_true_prob_one_sided'] = pvalue_recall0_true_prob
scores['pvalue_recall1_true_prob_one_sided'] = pvalue_recall1_true_prob
scores['pvalue_recall0_unknwon_prob_one_sided'] = pvalue_recall0_unknwon_prob
scores['pvalue_recall1_unknown_prob_one_sided'] = pvalue_recall1_unknown_prob
scores['pvalue_recall_mean'] = pvalue_recall_mean
#scores['prop_non_zeros_mean'] = float(np.count_nonzero(betas_t)) / \
# float(np.prod(betas.shape))
scores['param_key'] = key
return scores
def reducer(key, values):
import os, glob, pandas as pd
os.chdir(os.path.dirname(config_filename()))
config = json.load(open(config_filename()))
paths = glob.glob(os.path.join(config['map_output'], "*", "*", "*"))
#paths = [p for p in paths if not p.count("0.8_-1")]
def close(vec, val, tol=1e-4):
return np.abs(vec - val) < tol
def groupby_paths(paths, pos):
groups = {g:[] for g in set([p.split("/")[pos] for p in paths])}
for p in paths:
groups[p.split("/")[pos]].append(p)
return groups
def argmaxscore_bygroup(data, groupby='fold', param_key="param_key", score="recall_mean"):
arg_max_byfold = list()
for fold, data_fold in data.groupby(groupby):
assert len(data_fold) == len(set(data_fold[param_key])) # ensure all param are diff
arg_max_byfold.append([fold, data_fold.ix[data_fold[score].argmax()][param_key], data_fold[score].max()])
return pd.DataFrame(arg_max_byfold, columns=[groupby, param_key, score])
print('## Refit scores')
print('## ------------')
byparams = groupby_paths([p for p in paths if p.count("all") and not p.count("all/all")],3)
byparams_scores = {k:scores(k, v, config) for k, v in byparams.items()}
data = [list(byparams_scores[k].values()) for k in byparams_scores]
columns = list(byparams_scores[list(byparams_scores.keys())[0]].keys())
scores_refit = pd.DataFrame(data, columns=columns)
print('## doublecv scores by outer-cv and by params')
print('## -----------------------------------------')
data = list()
bycv = groupby_paths([p for p in paths if p.count("cvnested")],1)
for fold, paths_fold in bycv.items():
print(fold)
byparams = groupby_paths([p for p in paths_fold], 3)
byparams_scores = {k:scores(k, v, config) for k, v in byparams.items()}
data += [[fold] + list(byparams_scores[k].values()) for k in byparams_scores]
scores_dcv_byparams = pd.DataFrame(data, columns=["fold"] + columns)
print('## Model selection')
print('## ---------------')
svm = argmaxscore_bygroup(scores_dcv_byparams); svm["method"] = "svm"
scores_argmax_byfold = svm
print('## Apply best model on refited')
print('## ---------------------------')
scores_svm = scores("nestedcv", [os.path.join(config['map_output'], row["fold"], "all", row["param_key"]) for index, row in svm.iterrows()], config)
scores_cv = pd.DataFrame([["svm"] + list(scores_svm.values())], columns=["method"] + list(scores_svm.keys()))
with pd.ExcelWriter(results_filename()) as writer:
scores_refit.to_excel(writer, sheet_name='cv_by_param', index=False)
scores_dcv_byparams.to_excel(writer, sheet_name='cv_cv_byparam', index=False)
scores_argmax_byfold.to_excel(writer, sheet_name='cv_argmax', index=False)
scores_cv.to_excel(writer, sheet_name='dcv', index=False)
##############################################################################
if __name__ == "__main__":
WD = '/neurospin/brainomics/2018_euaims_leap_predict_vbm/results/VBM/1.5mm/by_site/site5/svm'
INPUT_DATA_X = '/neurospin/brainomics/2018_euaims_leap_predict_vbm/results/VBM/1.5mm/by_site/data/site5/X.npy'
INPUT_DATA_y = '/neurospin/brainomics/2018_euaims_leap_predict_vbm/results/VBM/1.5mm/by_site/data/site5/y.npy'
INPUT_MASK_PATH = '/neurospin/brainomics/2018_euaims_leap_predict_vbm/results/VBM/1.5mm/data/mask.nii'
NFOLDS_OUTER = 5
NFOLDS_INNER = 5
shutil.copy(INPUT_DATA_X, WD)
shutil.copy(INPUT_DATA_y, WD)
shutil.copy(INPUT_MASK_PATH, WD)
#############################################################################
## Create config file
y = np.load(INPUT_DATA_y)
cv_outer = [[tr, te] for tr,te in StratifiedKFold(y.ravel(), n_folds=NFOLDS_OUTER, random_state=42)]
if cv_outer[0] is not None: # Make sure first fold is None
cv_outer.insert(0, None)
null_resampling = list(); null_resampling.append(np.arange(0,len(y))),null_resampling.append(np.arange(0,len(y)))
cv_outer[0] = null_resampling
import collections
cv = collections.OrderedDict()
for cv_outer_i, (tr_val, te) in enumerate(cv_outer):
if cv_outer_i == 0:
cv["all/all"] = [tr_val, te]
else:
cv["cv%02d/all" % (cv_outer_i -1)] = [tr_val, te]
cv_inner = StratifiedKFold(y[tr_val].ravel(), n_folds=NFOLDS_INNER, random_state=42)
for cv_inner_i, (tr, val) in enumerate(cv_inner):
cv["cv%02d/cvnested%02d" % ((cv_outer_i-1), cv_inner_i)] = [tr_val[tr], tr_val[val]]
for k in cv:
cv[k] = [cv[k][0].tolist(), cv[k][1].tolist()]
print(list(cv.keys()))
C_range = [[10],[1],[1e-1]]
user_func_filename = "/home/ad247405/git/scripts/2018_euaims_leap_predict_vbm/supervised_analysis/VBM/1.5mm/by_site/05_svm_site5.py"
config = dict(data=dict(X="X.npy", y="y.npy"),
params=C_range, resample=cv,
structure="mask.nii",
map_output="model_selectionCV",
user_func=user_func_filename,
reduce_input="results/*/*",
reduce_group_by="params",
reduce_output="model_selectionCV.csv")
json.dump(config, open(os.path.join(WD, "config_dCV.json"), "w"))
# Build utils files: sync (push/pull) and PBS
import brainomics.cluster_gabriel as clust_utils
cmd = "mapreduce.py --map %s/config_dCV.json" % WD_CLUSTER
clust_utils.gabriel_make_qsub_job_files(WD, cmd,walltime = "250:00:00",
suffix="_cv_largerange",
freecores=2) | [
"ad247405@is228932.intra.cea.fr"
] | ad247405@is228932.intra.cea.fr |
70c471a0c8c7b801ecf6784c2946caea96718340 | 5c4c98523fc40fb7a24b02b7a8306425b893f39a | /easy/min_cost_houses.py | 14f48db1868e53a6394c2fed297ffd16e268049b | [] | no_license | Hashah1/Leetcode-Practice | a8dfe8b01b8a01fca15464531d31be4e41877611 | 1639a4b13c692d87c658a7e0a11212bf0e98d443 | refs/heads/master | 2022-11-29T02:09:06.050073 | 2020-08-17T05:23:30 | 2020-08-17T05:23:30 | 174,291,419 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,025 | py | class Solution(object):
def minCost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
prev_cost_red = prev_cost_blue = prev_cost_green = 0
for each_house in costs:
# Get the minimum cost to paint each color
# Each color cost is the sum of either of the previous two colors
# (since no adj allowed) with the current color of its kind
min_cost_red = min(prev_cost_blue, prev_cost_green) + each_house[0]
min_cost_blue = min(prev_cost_red, prev_cost_green) + each_house[1]
min_cost_green = min(prev_cost_red, prev_cost_blue) + each_house[2]
# Store record of each color.
prev_cost_red = min_cost_red
prev_cost_blue = min_cost_blue
prev_cost_green = min_cost_green
return min(min_cost_red,min_cost_blue,min_cost_green)
if __name__ == "__main__":
a = Solution()
a.minCost([[17,2,17],[16,16,5],[14,3,19]]) | [
"mian_hashim_shah@hotmail.com"
] | mian_hashim_shah@hotmail.com |
010f7ef28030f1f299d6033646b60ef8f40c3091 | c6368425c629298fd8b32074da71707e54298aa4 | /iteration of elements of a tuple.py | c11d858f9bc2005cd7aeadf1b91619ad2c76c757 | [] | no_license | Khushi-S-B/Python_3.x_Programmes | e2c91b554c6840ee1ea254490e19ee62430c4a57 | 64e47df728d93cdc2f0ce90202d5ddb1269e1d68 | refs/heads/master | 2020-06-27T17:24:01.065795 | 2019-08-01T13:38:36 | 2019-08-01T13:38:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 42 | py | x=(1,2,3,4,5)
for i in x:
print(i)
| [
"kb104242@gmail.com"
] | kb104242@gmail.com |
bd507008a85e834e6fcc8b6238059ddfd960c7da | 1ea38f360f0a0b923742a37c65123986df427d58 | /modelP4.py | a85649af737b7da2653e4a891879118492990477 | [] | no_license | kainanfariaUFC/Pesquisa-Grafos | ce0b313486368602699853dcb78ca529293a4d32 | b31456bb0f7b6b3edfb051e78f298d17747fe8e2 | refs/heads/master | 2020-12-13T11:11:19.398299 | 2019-12-19T01:20:56 | 2019-12-19T01:20:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,962 | py | from pulp import *
import graphviz
class ModelP4:
def __init__(self, name_file):
self.name_file = name_file
self.tableX = []
self.tableY = []
self.file = open("/home/kainan/Documentos/Pesquisa/Python/final_files/files_txt/"+name_file+".txt", "r")
self.file2 = open("/home/kainan/Documentos/Pesquisa/Python/final_files/files_txt/"+name_file+".txt", "r")
self.file3 = open("/home/kainan/Documentos/Pesquisa/Python/final_files/files_txt/"+name_file+".txt", "r")
self.file4 = open("/home/kainan/Documentos/Pesquisa/Python/final_files/files_txt/"+name_file+".txt", "r")
self.nodes = []
self.matrixComp = []
self.contX = 0
self.contY = 0
self.graph = graphviz.Digraph()
self.vizinhos = []
self.rep = []
self.j = 1
self.j1 = 1
def vizinho(self,v):
ret =[]
for i in self.matrixComp:
if i[0] == v:
ret.append(i[1])
if i[1] == v:
ret.append(i[0])
return ret
def vizinhop4(self, v):
ret =[]
for i in self.matrixComp:
if i[0] == v:
ret.append(i[1])
if i[1] == v:
ret.append(i[0])
return ret
def vizinhanca(self, a,b):
for i in a:
if i in b:
return True
def vizinhoComum(self, w, u):
vizinhosW = []
vizinhosU = []
for i in self.matrixComp:
if i[0] == w:
vizinhosW.append(i[1])
if i[0] == u:
vizinhosU.append(i[1])
for i in range(len(vizinhosW)):
for j in range(len(vizinhosU)):
if vizinhosW[i]:
if vizinhosU[j]:
if vizinhosW[i] in self.vizinhop4(vizinhosU[j]):
return True
return False
def init_node(self):
for i in self.file2:
t = i
t = t.split()
if(t[0] == 'c'):
continue
if(t[0] == 'e'):
self.matrixComp.append([int(t[1]), int(t[2])])
self.nodes.append([t[1], t[2]])
def p4(self,w,p):
if p in self.vizinho(w) or w in self.vizinho(p):
return False
if w != p:
vizp = self.vizinho(p)
vizw = self.vizinho(w)
for i in range(len(vizw)):
for j in range(len(vizp)):
if vizw[i] != vizp[j]:
if vizw[i] in self.vizinho(vizp[j]):
return True
else:
return False
def init_table_x(self):
for i in self.file:
t = i
t = t.split()
if(t[0] == 'c'):
continue
if (t[0] == 'p'):
self.contX = int(t[2])
if(t[0] == 'e'):
for i in range(1, self.contX + 1):
for j in range(1, self.contX + 1):
if str(i) + "_" + str(j) not in self.tableX:
self.tableX.append(str(i) + "_" + str(j))
def init_table_y(self):
for i in self.file3:
t = i
t = t.split()
if(t[0] == 'c'):
continue
if (t[0] == 'p'):
self.contY = int(t[2])
if(t[0] == 'e'):
for i in range(1, self.contY + 1):
for k in range(1, self.contY + 1):
for u in range(1, self.contY + 1):
if i == k:
break
if self.p4(i,k):
if str(i) +"_"+str(k) + "_" + str(u) not in self.tableY:
self.tableY.append(str(i) +"_"+str(k) + "_" + str(u))
if self.j1 >= self.contY:
break
self.j1 += 1
def create_graph(self,nodesN, infected):
self.graph = graphviz.Graph(filename="/home/kainan/Documentos/Pesquisa/Python/final_files/files_txt/p4_"+self.name_file, format='png')
for i in range(1,self.contX+1):
if str(i) in infected:
self.graph.node(str(i), color='red', style='filled')
else:
self.graph.node(str(i))
for l in self.file4:
linha = l
linha = linha.split()
if(linha[0] == 'c'):
continue
if(linha[0] == 'e'):
self.graph.edge(str(linha[1]), str(linha[2]))
def run_algo(self):
self.init_node()
self.init_table_x()
self.init_table_y()
self.run_p4()
def run_p4(self):
p4hull = LpProblem("minimize P3-hull", LpMinimize)
#________________________Variables_________________________
x = LpVariable.dicts("X", self.tableX, cat=LpBinary)
y = LpVariable.dicts("Y", self.tableY, cat=LpBinary)
#__________________________F.O.____________________________
p4hull += lpSum(x.get(str(v) + '_1') for v in range(1, self.contX + 1)), 'Minimize the quantity of infected vertex'
#__________________________S.a.____________________________
#restrição 1
for t in range(1, self.contX + 1):
for v in range(1, self.contX + 1):
if str(v)+'_'+str(t) in self.tableX:
if t > 1:
p4hull += (x.get(str(v) + '_' + str(t))) - lpSum(y.get(str(w) + '_' + str(u) + '_' + str(int(t - 1))) for w in range(1, self.contY + 1) for u in range(1, self.contY + 1) if v in self.vizinho(w) and self.vizinhanca(self.vizinho(v), self.vizinho(u))) - x.get(str(v) + '_' + str(t-1)) <= 0
#restrição 2
for t in range(1, self.contX + 1):
for v in range(1, self.contX + 1):
if x.get(str(v) + '_' + str(t)) != None and x.get(str(v) + '_' + str(t-1)) != None:
if t > 1:
p4hull += x.get(str(v) + '_' + str(t)) >= x.get(str(v) + '_' + str(int(t - 1)))
#restrição 3
for t in range(1, self.contX+1):
for w in range(1, self.contX + 1):
for u in range(1, self.contX + 1):
if t > 1:
if(y.get(str(w) + '_' + str(u) + '_' + str(int(t - 1)))) != None:
if(x.get(str(w) + '_' + str(t - 1))) != None:
p4hull += y.get(str(w) + '_' + str(u) + '_' + str(int(t - 1))) <= x.get(str(w) + '_' + str(t-1))
#restrição 4
for t in range(1, self.contX+1):
for w in range(1, self.contX + 1):
for u in range(1, self.contX + 1):
if t > 1:
if (y.get(str(w) + '_' + str(u) + '_' + str(int(t - 1)))) != None:
if (x.get(str(w) + '_' + str(t - 1))) != None:
p4hull += y.get(str(w) + '_' + str(u) + '_' + str(int(t - 1))) <= x.get(str(u) + '_' + str(t - 1))
#restrição 5
p4hull += lpSum(x.get(str(v) + '_' + str(self.contX)) for v in range(1, self.contX + 1)) >= abs(self.contX)
p4hull.writeLP("P4Model.lp")
p4hull.solve(CPLEX(timeLimit=600))
#print(p4hull)
#print("Status:", LpStatus[p4hull.status])
for v in p4hull.variables():
#print(v.name, "=", v.varValue)
a = v.name.split("_")
if a[0] == 'X':
if a[2] == '1' and v.varValue == 1.0:
self.rep.append(a[1])
#print("Min vertex quantity = ",value(p4hull.objective))
#print("Solution time = ", p4hull.solutionTime)
self.create_graph(self.nodes, self.rep)
self.graph.view()
| [
"noreply@github.com"
] | kainanfariaUFC.noreply@github.com |
9155496243525236f48b1950e5f3e01539d6c6e5 | e5d4345bf084bd8ffc0797d14bbca6032202c9e5 | /tests/test_package_helper.py | 3f4405824a4247698bf71965b42cf4a6f006b559 | [
"MIT"
] | permissive | iranianpep/iautomate | 0a318402de6801ce35d541ddf7a2392766e08eca | c187aedaf8f71c63e06a2112fbcf65f60217c5bc | refs/heads/master | 2020-03-26T15:24:25.605974 | 2018-08-19T16:12:23 | 2018-08-19T16:12:23 | 145,041,148 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,088 | py | import unittest
import mock
from iautomate.helpers.package_helper import PackageHelper
class TestShellHelper(unittest.TestCase):
@mock.patch('subprocess.Popen')
def test_run_command(self, mock_subproc_popen):
process_mock = mock.Mock()
# mock ShellHelper.run_command function and returned installed
attrs = {'communicate.return_value': ('installed', 'error')}
process_mock.configure_mock(**attrs)
mock_subproc_popen.return_value = process_mock
helper = PackageHelper()
helper.is_package_installed('apache2')
self.assertTrue(helper.is_package_installed('apache2'))
self.assertTrue(mock_subproc_popen.called)
# mock ShellHelper.run_command function and returned None
attrs = {'communicate.return_value': (None, 'error')}
process_mock.configure_mock(**attrs)
mock_subproc_popen.return_value = process_mock
helper.is_package_installed('apache2')
self.assertFalse(helper.is_package_installed('apache2'))
self.assertTrue(mock_subproc_popen.called)
| [
"iranianpep@gmail.com"
] | iranianpep@gmail.com |
60fd130c4ad4a8d7e26bb9aa923ad0b8eb0c704b | f1c48f9d3afb08104cb2ec777a72bdf2989d984b | /TASK1/29.py | 2e9fc1ebba99d358c724ca87fda730b63d259a49 | [] | no_license | DIas-code/ICT_2021 | 4af0bf09869bd3b6e816806c3b49986abb4967b9 | 5a8a080b66f14263e5d8dda8eacca9fe62ada7c0 | refs/heads/master | 2023-04-13T17:06:02.594802 | 2021-04-22T14:55:02 | 2021-04-22T14:55:02 | 338,098,731 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 101 | py | celsius=int(input("Celsius: "))
print("Farhneit: ", celsius*9/5+32)
print("Kelvein: ",celsius+273.15) | [
"diasermekov09@gmail.com"
] | diasermekov09@gmail.com |
0502b29ae3d830832f8dabcee9d1a06ae9e45abf | b9a0f3e2950521cf0e7181632b77333e0365d55f | /blog-master/accounts/views.py | 0b29e4f00a7328cc8709bea6eb1ed20a223b983c | [] | no_license | yunsuu/Django-study | 86b557ec67234856b161a06687f080f23ee7101a | aeadbda27e2b9d8470318dcc5ff414c61bd4d3f8 | refs/heads/master | 2020-04-18T02:15:20.593899 | 2019-03-10T10:16:54 | 2019-03-10T10:16:54 | 167,155,047 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,130 | py | from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from django.contrib import auth
def signup(request):
if request.method == 'POST':
if request.POST['password1'] == request.POST['password2']:
user = User.objects.create_user(username=request.POST['username'], password=request.POST['password1'])
auth.login(request, user)
return redirect('home')
return render(request, 'signup.html')
def login(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(request, username=username, password=password)
if user is not None:
auth.login(request, user)
return redirect('home')
else:
return render(request, 'login.html', {'error': 'username or password is incorrect.'})
else:
return render(request, 'login.html')
def logout(request):
if request.method == 'POST':
auth.logout(request)
return redirect('home')
return render(request, 'login.html')
| [
"ljsql934@gmail.com"
] | ljsql934@gmail.com |
9140de8119fd4de74a177d50b4b9aa0fb0cd14da | 35ba45c9706e1d46eaa09a51f20997c319e41aff | /server/pages/models.py | e8148bdedd5dc57ed92eaa5965180066762e9f09 | [] | no_license | mcpetri/CyberSecProject | a3f8e2ea2fd0ba2feb6ded428b3d17d6a705acd0 | 5013e0a77cd7506922e862b92680a6d7b6cc5292 | refs/heads/main | 2023-07-04T01:25:14.210005 | 2021-08-16T10:40:37 | 2021-08-16T10:40:37 | 322,878,415 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 557 | py | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Account(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
balance = models.IntegerField()
class Mail(models.Model):
content = models.TextField()
class Message(models.Model):
source = models.ForeignKey(User, on_delete=models.CASCADE, related_name='source')
target = models.ForeignKey(User, on_delete=models.CASCADE, related_name='target')
content = models.TextField()
time = models.DateTimeField(auto_now_add=True)
| [
"noreply@github.com"
] | mcpetri.noreply@github.com |
2eff722279b116b5e6f89e12ecbf881df6d39e23 | 7855482b1c4e97ac41b9c1f3b4166b0473fe54d3 | /Get_Episode_Ids.py | 2fccdee0baa75a232163f8047c06df17b6b91a9c | [] | no_license | frimelle/Bubblewatch | f309c7877d0ec2ab3f0549bd857b94726966a44a | 4524079b68d1702af146157318073c8d8e7f181f | refs/heads/master | 2021-01-22T09:09:07.787866 | 2015-03-06T14:11:49 | 2015-03-06T14:11:49 | 31,738,979 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,593 | py | # This Python file uses the following encoding: utf-8
#!/usr/bin/python
import gzip
import json
__author__ = "Lucie-Aimée Kaffee"
__email__ = "lucie.kaffee@gmail.com"
__license__ = "GNU GPL v2+"
#check if entity is an isntance of episode (Q1983062)
def is_episode( json_l ):
if 'claims' in json_l and 'P31' in json_l['claims']:
if 'datavalue' in json_l['claims']['P31'][0]['mainsnak']:
instance_of_id = json_l['claims']['P31'][0]['mainsnak']['datavalue']['value']['numeric-id']
if instance_of_id == 1983062:
return True
#check if entity has the property series (which shows, which series it belogs to)
def has_series_property( json_l ):
if 'claims' in json_l and 'P179' in json_l['claims']:
return True
#check for the different series
#check if entity belongs to buffy
def check_serie_buffy( json_l ):
if '183513' in json_l['claims']['P179'][0]['mainsnak']:
if '183513' == json_l['claims']['P179'][0]['mainsnak']['datavalue']['value']['numeric-id']:
return True
def check_serie_firefly( json_l ):
if '11622' in json_l['claims']['P179'][0]['mainsnak']:
if '11622' == json_l['claims']['P179'][0]['mainsnak']['datavalue']['value']['numeric-id']:
return True
file = gzip.open('20141215.json.gz')
for line in file:
line = line.rstrip().rstrip(',')
try:
json_l = json.loads(line)
except ValueError, e:
continue
if is_episode( json_l ) and has_series_property( json_l ):
if check_serie_buffy( json_l ):
print json_l['id']
| [
"lucie.kaffee@wikimedia.de"
] | lucie.kaffee@wikimedia.de |
e47dbe1c9618e9a367461469aa1535b4218551f4 | 59f027697b2d28ca5a457625751c6c87c8ba94d9 | /solutions/pub_lab/basic_solution/tests/drink_test.py | a371d4116a2da3902753fd9f971bba31f1a099ea | [] | no_license | ecoBela/pub_lab_wk2_day3 | f227daf22f4cc5bcc2258f1ced6763a8e95733d3 | b5ff4a67021404ddd70c1e6dfd7b1da21b6ad123 | refs/heads/main | 2023-02-06T07:04:44.018035 | 2021-01-01T21:36:22 | 2021-01-01T21:36:22 | 315,912,404 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 398 | py | import unittest
from src.drink import Drink
class TestDrink(unittest.TestCase):
def setUp(self):
self.drink = Drink("wine", 4.00)
def test_drink_has_name(self):
self.assertEqual("wine", self.drink.name)
def test_drink_has_price(self):
self.assertEqual(4.00, self.drink.price)
| [
"belahamid@gmail.com"
] | belahamid@gmail.com |
5c56a2be5c8fa6a1e87dc49bd94bad29ab8d58af | 3f8c7a90cd87274c5e288ddf73b43d08c2239259 | /task4/Task_4_VD_1600/Task_4_VD_1600_position_controller.py | 3d71aa7af7f99f9c5deb92c59042ded397fe36c9 | [] | no_license | TejasPhutane/E-Yantra_Tasks | 2e402ba691b1d6d6f423be3d3928beec59799267 | 168ca6465266b52950774477449ceeef40d406e4 | refs/heads/main | 2023-04-14T03:14:54.471143 | 2021-05-04T11:15:06 | 2021-05-04T11:15:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 32,307 | py | #!/usr/bin/env python
# Importing the required libraries
from vitarana_drone.msg import edrone_cmd, location_custom
from sensor_msgs.msg import NavSatFix, LaserScan
from vitarana_drone.srv import Gripper, GripperRequest
from std_msgs.msg import Float32, String, Int32
from pid_tune.msg import PidTune
import rospy
import time
import tf
import math
import numpy as np
import csv
import os
import rospkg
class Edrone():
"""
This is the main class for Vitarana E-Drone.
It handles
----------
1) Initialization of variables
2) PID tuning of Longitude, Latitude, and Altitude
3) Callbacks for PID constants
4) Basic Tasks like initalizing a node and Subscribing
5) Obstacle handling
6) Getting waypoints and travelling
Note : [ Longitude, Latitude, Altitude ] is the convention followed
Methods :
----------
1) pid :
The main PID algorithm (for Position control) runs when this method is called
2) imu_callback :
Its called when IMU messages are received
3) gps_callback :
Receive the setpoint as in coordinates in 3d space [Latitudes, Longitude, Altitude]
4) altitude_set_pid :
Callback to assign Kp,Ki,Kd for Altitude
5) long_set_pid :
Callback to assign Kp,Ki,Kd for Longitude
6) lat_set_pid :
Callback to assign Kp,Ki,Kd for Latitude
7) range_bottom:
Callback to get values of the bottom ranger sensor
8) range_top:
Callback to get values of the top ranger sensor
9) gripper_callback:
Callback for the finding if the drone is in range of gripper activation
10) activate_gripper:
Function Controlling gripper activation
11) lat_to_x:
Function for converting latitude to meters
12) long_to_y:
Function for converting longitude to meters
13) controller :
Function for checking if the drone has reached the checkpoint
and setting a new checkpoint
14) handle_obstacle_x_y :
Function handles obstacle detection and avoidance
15) provide_current_loc_as_target:
Function for defining the safe distance from an obstacle
16) landing_control:
Function for handling the landing, scanning and gripper operations of the drone
17) takeoff_control:
Function handles take off operation of the drone
18) target_refresh:
Function refreshes the waypoint list to provide for new desitnation scanned by the Qr scanner
19) target_list:
Function generates new waypoints between the current location and destination and inserts into the waypoint list
20) delete_inserted:
Deleting the previously added waypoints in the list before refreshing the list for new waypoints
21) get_gps_coordinates:
Function creates the target and building list by decoding the data from the given csv file
"""
def __init__(self):
# Initializing ros node with name position_control
rospy.init_node('position_controller')
# Creating an instance of NavSatFix message and edrone_cmd message
self.location = NavSatFix()
self.drone_cmd = edrone_cmd()
# Created a flag for changing the setpoints
self.targets_achieved = 0
# Counter for csv file
self.csv_counter = 0
# Counter Check if obstacle was deteceted
self.obstacle_count = 0
# Gripper check vaiable
self.gripper_data = False
# A multiplication factor to increase number of waypoints proportional to distance between final and initial
self.stride = 0.1
# Hardcoded initial target point
"""
Building 1: lat: 18.9990965928, long: 72.0000664814, alt: 10.75
Building 2: lat: 18.9990965925, long: 71.9999050292, alt: 22.2
Building 3: lat: 18.9993675932, long: 72.0000569892, alt: 10.7
"""
#0:takeoff,1:transverse,2:landing,3:takeoff W/P,4:transverse W/P,5:landing W/P
self.states = 0
#List of target buildings
self.buiding_locations = []
# Initial Longitude , latitude and altitude
self.targets = [
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0]
]
# Variable to store scanned waypoints
self.scanned_target = [0.0, 0.0, 0.0]
# Marker ids
self.marker_id = 0
# To store bottom range finder values
self.range_finder_bottom = 0
# Variable for top range finder sensor data
# [1] right, [2] back, [3] left, [0,4] front w.r.t eyantra logo
self.range_finder_top_list = [0.0, 0.0, 0.0, 0.0, 0.0]
# Weights for left right sensor values
self.weights_lr = [1.3, -1.3]
# Counter for number of landings made
self.bottom_count = 0
# Offset altitude
self.offset_alt = 3.00
# Safety distances
self.safe_dist_lat = 21.555/105292.0089353767
self.safe_dist_long = 6/110692.0702932625
# To store the x and y co-ordinates in meters
self.err_x_m = 0.0
self.err_y_m = 0.0
# Number of waypoints initialized to -1
self.n = -1
# List to store waypoints Points calculated
self.points = []
# Check if height attained
self.start_to_check_for_obstacles = False
# Kp, Ki and Kd found out experimentally using PID tune
self.Kp = [125000.0, 125000.0, 1082*0.06]
self.Ki = [0.008*10*1.05, 0.008*10*1.05, 0.0*0.008]
self.Kd = [8493425, 8493425, 4476*0.3]
# Output, Error ,Cummulative Error and Previous Error of the PID equation in the form [Long, Lat, Alt]
self.error = [0.0, 0.0, 0.0]
self.ouput = [0.0, 0.0, 0.0]
self.cummulative_error = [0.0, 0.0, 0.0]
self.previous_error = [0.0, 0.0, 0.0]
self.max_cummulative_error = [1e-3, 1e-3, 100]
self.throttle = 0
self.base_pwm = 1500
# ----------------------------------------------------------------------------------------------------------
# Allowed errors in long.,and lat.
self.allowed_lon_error = 0.0000047487/4
self.allowed_lat_error = 0.000004517/4
# Checking if we have to scan or Land
self.scan = False
#Variable representing if the box has been grabbed
self.box_grabbed = 0
#Constraining the no of times location_error has been called
self.count = 0
# Time in which PID algorithm runs
self.pid_break_time = 0.060 # in seconds
# Publishing servo-control messaages and altitude,longitude,latitude and zero error on errors /drone_command, /alt_error, /long_error, /lat_error, and current marker id
self.drone_pub = rospy.Publisher(
'/drone_command', edrone_cmd, queue_size=1)
self.alt_error = rospy.Publisher('/alt_error', Float32, queue_size=1)
self.long_error = rospy.Publisher('/long_error', Float32, queue_size=1)
self.lat_error = rospy.Publisher('/lat_error', Float32, queue_size=1)
self.zero_error = rospy.Publisher('/zero_error', Float32, queue_size=1)
self.curr_m_id = rospy.Publisher(
'/edrone/curr_marker_id', Int32, queue_size=1)
self.alt_diff = rospy.Publisher("/alt_diff",Float32, queue_size=1)
# -----------------------------------------------------------------------------------------------------------
# Subscribers for gps co-ordinates, and pid_tune GUI, gripper,rangefinder, custom location message and x,y errors in meters
rospy.Subscriber('/edrone/gps', NavSatFix, self.gps_callback)
rospy.Subscriber('/pid_tuning_altitude',
PidTune, self.altitude_set_pid)
rospy.Subscriber('/pid_tuning_roll', PidTune, self.long_set_pid)
rospy.Subscriber('/pid_tuning_pitch', PidTune, self.lat_set_pid)
rospy.Subscriber('/edrone/location_custom',
location_custom, self.scanQR)
rospy.Subscriber('/edrone/range_finder_bottom',
LaserScan, self.range_bottom)
rospy.Subscriber('/edrone/range_finder_top', LaserScan, self.range_top)
rospy.Subscriber('/edrone/gripper_check',
String, self.gripper_callback)
rospy.Subscriber('/edrone/err_x_m', Float32, self.handle_x_m_err)
rospy.Subscriber('/edrone/err_y_m', Float32, self.handle_y_m_err)
# Callback for getting gps co-ordinates
def gps_callback(self, msg):
self.location.altitude = msg.altitude
self.location.latitude = msg.latitude
self.location.longitude = msg.longitude
if self.csv_counter == 0:
self.get_gps_coordinates()
self.csv_counter = 1
# Callback function for /pid_tuning_altitude in case required
# This function gets executed each time when /tune_pid publishes /pid_tuning_altitude
def altitude_set_pid(self, alt):
self.Kp = alt.Kp * 0.06
self.Ki = alt.Ki * 0.008
self.Kd = alt.Kd * 0.3
# Callback function for longitude tuning in case required
# This function gets executed each time when /tune_pid publishes /pid_tuning_roll
def long_set_pid(self, long):
self.Kp[0] = long.Kp * 0.06*1000
self.Ki[0] = long.Ki * 0.008
self.Kd[0] = long.Kd * 0.3*10000
# Callback function for latitude tuning in case required
# This function gets executed each time when /tune_pid publishes /pid_tuning_pitch
def lat_set_pid(self, lat):
self.Kp[1] = lat.Kp * 0.06*1000
self.Ki[1] = lat.Ki * 0.008*1000
self.Kd[1] = lat.Kd * 0.3*10000
# Callback for qr code scanner
def scanQR(self, msg):
self.scanned_target[0] = msg.longitude
self.scanned_target[1] = msg.latitude
self.scanned_target[2] = msg.altitude
self.scan = msg.scan
# print self.scan
# Callback for bottom rangefinder
def range_bottom(self, msg):
self.range_finder_bottom = msg.ranges[0]
# Callback for top rangefinder
def range_top(self, msg):
self.range_finder_top_list = msg.ranges
# Callback for gripper
def gripper_callback(self, data):
if data.data == "True":
self.gripper_data = True
else:
self.gripper_data = False
def handle_x_m_err(self, msg):
self.err_x_m = float(msg.data)
def handle_y_m_err(self, msg):
self.err_y_m = float(msg.data)
# Activating the gripper
def activate_gripper(self, shall_i):
rospy.wait_for_service('/edrone/activate_gripper')
act_gripper = rospy.ServiceProxy('/edrone/activate_gripper', Gripper)
req = GripperRequest(shall_i)
resp = act_gripper(req)
# converting latitude to meters
def lat_to_x(self, input_latitude):
self.x_lat = 110692.0702932625 * (input_latitude - 19)
# converting longitude to meters
def long_to_y(self, input_longitude):
self.y_long = -105292.0089353767 * (input_longitude - 72)
def x_to_lat(self):
return -self.err_x_m/(110692.0702932625)
def y_to_long(self):
return self.err_y_m/(-105292.0089353767)
# ----------------------------------------------------------------------------------------------------------------------
def pid(self):
# Error is defined as setpoint minus current orientaion
self.error[0] = self.location.longitude - \
self.targets[self.targets_achieved][0]
self.error[1] = self.location.latitude - \
self.targets[self.targets_achieved][1]
self.error[2] = self.location.altitude - \
self.targets[self.targets_achieved][2]
for i in range(3):
# Cummulative error as sum of previous errors
self.cummulative_error[i] += self.error[i]
# Limiting the cummulative error
if abs(self.cummulative_error[i]) >= self.max_cummulative_error[i]:
self.cummulative_error[i] = 0.0
# Main PID Equation i.e assigning the output its value acc. to output = kp*error + kd*(error-previous_error) + ki*cummulative_error
for i in range(3):
self.ouput[i] = self.Kp[i] * self.error[i] + self.Ki[i] * \
self.cummulative_error[i] + self.Kd[i] * \
(self.error[i]-self.previous_error[i])
# Contoller handles the states of landing , takeoff, mid-air
self.controller()
if self.start_to_check_for_obstacles:
self.handle_obstacle_x_y()
# Storing Previous Error values for differential error
for i in range(3):
self.previous_error[i] = self.error[i]
# Setting the throttle that balances the error
self.drone_cmd.rcThrottle = self.base_pwm - self.ouput[2]
# CLamping the throttle values between 1000 and 2000
if self.drone_cmd.rcThrottle > 2000:
self.drone_cmd.rcThrottle = 2000
elif self.drone_cmd.rcThrottle < 1000:
self.drone_cmd.rcThrottle = 1000
# Publishing the Drone commands for R,P,Y of drone
self.drone_pub.publish(self.drone_cmd)
# Publishing errors for plotjuggler
self.long_error.publish(self.error[0])
self.lat_error.publish(self.error[1])
self.alt_error.publish(self.error[2])
self.zero_error.publish(0.0)
self.curr_m_id.publish(self.marker_id+1)
#0:takeoff,1:transverse,2:landing,3:takeoff W/P,4:transverse W/P,5:landing W/P
def control_state(self,i):
self.states = i
def controller(self):
# For debug
# print(self.targets_achieved, self.n,self.states)
self.alt_diff.publish(self.location.altitude-self.targets[-1][2])
# Checking if the drone has reached the nth checkpoint and then incrementing the counter by 1
# As stated in the problem statement , we have a permissible error of +- 0.05
if self.location.altitude > self.targets[self.targets_achieved][2]-0.05 and self.location.altitude < self.targets[self.targets_achieved][2]+0.05 and self.targets_achieved == 0:
if round(self.previous_error[2], 2) == round(self.error[2], 2) and round(0.2, 2) > abs(self.error[2]):
# Incrementing the counter of waypoints
self.targets_achieved += 1
if self.states == 0:
#
self.control_state(1)
self.count = 0
else:
self.control_state(4)
self.count = 0
if self.n < 0:
self.n = 0
if self.n!=0 and self.states!=5:
self.allowed_lon_error = 0.000047487
self.allowed_lat_error = 0.00004517
# Specifying the values for R,P,Y
self.drone_cmd.rcRoll = self.base_pwm - self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm - self.ouput[1]
self.start_to_check_for_obstacles = True
# Checking if the drone has reached the lat and long then imcrementing the counter
# As stated in the problem statement , we have a permissible error of +- self.allowed_lat_error in latitude and +- self.allowed_lon_error in longitude
elif self.location.latitude > self.targets[self.targets_achieved][1]-self.allowed_lat_error and self.location.latitude < self.targets[self.targets_achieved][1]+self.allowed_lat_error and 0 < self.targets_achieved <= self.n:
if round(self.previous_error[1], 6) == round(self.error[1], 6) and round(self.allowed_lat_error, 8) > abs(self.error[1]):
if self.location.longitude > self.targets[self.targets_achieved][0]-self.allowed_lon_error and self.location.longitude < self.targets[self.targets_achieved][0]+self.allowed_lon_error and 0 < self.targets_achieved <= self.n:
self.targets_achieved += 1
# Specifying the values for R,P,Y
self.drone_cmd.rcRoll = self.base_pwm - self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm - self.ouput[1]
if self.targets_achieved == self.n:
if self.states == 1:
#Updating the state of the drone from transvering to landing
self.control_state(2)
elif self.states == 4:
#Updating the state of the drone from transvering with package to landing with package
self.control_state(5)
if self.targets_achieved == self.n and self.states == 2:
self.allowed_lon_error = 0.0000047487/4
self.allowed_lat_error = 0.000004517/4
self.start_to_check_for_obstacles = True
# print "Navigating around"
else:
# Drone is taking off
if self.targets_achieved == 0:
# print "Taking Off."
self.start_to_check_for_obstacles = False
# Specifying the values for R,P,Y
self.takeoff_control()
# In mid air
elif self.targets_achieved <= self.n:
# Specifying the values for R,P,Y
self.drone_cmd.rcRoll = self.base_pwm - self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm - self.ouput[1]
# If all the waypoints are reached
elif self.targets_achieved >= self.n+1:
if self.states == 1:
#Updating the state of the drone from takeoff to transversing
self.control_state(2)
elif self.states == 4:
#Updating the state of the drone from takeoff with package to tranversing with package
self.control_state(5)
# Specifying the values for R,P,Y
self.drone_cmd.rcRoll = self.base_pwm - self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm - self.ouput[1]
# Check if it reached correct location
if self.location.latitude > self.targets[self.targets_achieved][1]-self.allowed_lat_error and self.location.latitude < self.targets[self.targets_achieved][1]+self.allowed_lat_error:
if round(self.previous_error[1], 7) == round(self.error[1], 7) and round(self.allowed_lat_error, 8) > abs(self.error[1]):
if self.location.longitude > self.targets[self.targets_achieved][0]-self.allowed_lon_error and self.location.longitude < self.targets[self.targets_achieved][0]+self.allowed_lon_error:
# Function controls the landing, scanning and gripping of the drone
self.targets_achieved = self.n+2
self.landing_control()
# Handling multiple markers
if self.box_grabbed == 1 and self.states == 5:
self.handle_marker()
def handle_marker(self):
# Check if errors are within given 0.2 m threshold
if abs(self.err_x_m) < 0.2 and abs(self.err_y_m) < 0.2 and (self.location.altitude > self.targets[self.targets_achieved][2]-0.05 and self.location.altitude < self.targets[self.targets_achieved][2]+0.05):
print "Errors in X and Y in meters are {}, {} ".format(
self.err_x_m, self.err_y_m)
# If marker id (0,1,2,3,4,5,6) is 6 then it has achieved all the markers
if self.marker_id == 6:
print "All the targets achieved"
self.landing_control()
return
#if marker <6 new target building will be provided
elif self.marker_id < 6:
print("New building")
self.activate_gripper(shall_i=False)
self.box_grabbed = 0
self.bottom_count = 0
self.marker_id += 1
self.set_new_building_as_target()
#Updating the state of the drone from landing with package to takeoff
self.control_state(0)
elif abs(self.err_x_m) < 0.2 and abs(self.err_y_m) < 0.2 :
self.targets_achieved = 2
else:
print "Navigating Drone to marker position"
if self.count == 0:
self.set_location_using_err()
self.count = 1
self.drone_cmd.rcRoll = self.base_pwm-self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm-self.ouput[1]
self.drone_cmd.rcYaw = self.base_pwm
# ------------------------------HANDLING MARKERS-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def set_new_building_as_target(self):
self.delete_inserted()
self.targets_achieved = 0
self.targets[0][0] = self.location.longitude
self.targets[0][1] = self.location.latitude
self.targets[1][0] = self.buiding_locations[self.marker_id][0]
self.targets[1][1] = self.buiding_locations[self.marker_id][1]
self.targets[2][0] = self.buiding_locations[self.marker_id][0]
self.targets[2][1] = self.buiding_locations[self.marker_id][1]
if self.targets[2][2] > self.buiding_locations[self.marker_id][2]:
self.targets[0][2] = self.targets[2][2]+5
self.targets[1][2] = self.targets[0][2]
else:
self.targets[0][2] = self.buiding_locations[self.marker_id][2] + 15
self.targets[1][2] = self.buiding_locations[self.marker_id][2] + 15
self.targets[2][2] = self.buiding_locations[self.marker_id][2]
self.target_list()
print(self.targets)
self.takeoff_control()
def set_location_using_err(self):
self.delete_inserted()
self.targets[0][0] = self.location.longitude
self.targets[0][1] = self.location.latitude
self.targets[-2][0] = self.y_to_long()+self.location.longitude
self.targets[-2][1] = self.x_to_lat()+self.location.latitude
self.targets[-1][0] = self.y_to_long()+self.location.longitude
self.targets[-1][1] = self.x_to_lat()+self.location.latitude
self.targets[-1][2] = self.buiding_locations[self.marker_id][2]+1
self.target_list()
self.targets_achieved = 1
# ------------------------------HANDLING OBSTACLES-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def handle_obstacle_x_y(self):
"""
Check if obstacle is occured:
if yes:
then recalulate waypoints with safety distance in apptopriate direction
if no:
nothing
"""
front_range_finder_avg = (
self.range_finder_top_list[0] + self.range_finder_top_list[4])/2
left = self.range_finder_top_list[3] < 8 and self.range_finder_top_list[3]>3
right = self.range_finder_top_list[1] < 8 and self.range_finder_top_list[1]>3
front = front_range_finder_avg < 4 and front_range_finder_avg > 1
#handling obstacle for left range finder
if left and (not right) and (not front):
print "Handling obstacle due to left rangefinder"
self.targets_achieved = 1
self.provide_current_loc_as_target(-0.8)
#handling obstacle for right range finder
if right and (not left) and (not front):
print "Handling obstacle due to right rangefinder"
self.targets_achieved = 1
self.provide_current_loc_as_target(0.8)
#handling obstacle for front range finder
if front and (not right) and (not left) :
print "Handling obstacle due to front rangefinder"
self.delete_inserted()
self.targets[0][0] = self.location.longitude+1.5*(self.safe_dist_long)
self.targets[0][1] = self.location.latitude -self.safe_dist_lat/5
self.target_list()
self.targets_achieved = 1
# Providing current location with safety distance and recalculating the waypoints
def provide_current_loc_as_target(self,n):
self.delete_inserted()
self.targets[0][0] = self.location.longitude + 1.5*self.safe_dist_long
self.targets[0][1] = self.location.latitude - n*self.safe_dist_lat
self.target_list()
self.targets_achieved = 1
# --------------------------------HANDLING LANDING SCANNING AND GRIPPING-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def landing_control(self):
# checking if the box is scanned
self.drone_cmd.rcRoll = self.base_pwm-self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm-self.ouput[1]
self.drone_cmd.rcYaw = self.base_pwm
if self.scan == True and self.states == 2:
self.targets[self.targets_achieved][2] -= self.range_finder_bottom
if self.bottom_count == 0:
print "Image Scanned. Targets acquired."
self.targets[self.targets_achieved][2] -= self.range_finder_bottom
# checking if the drone is properly aligned for the box to be gripped
if not self.gripper_data:
self.drone_cmd.rcRoll = self.base_pwm-self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm-self.ouput[1]
self.drone_cmd.rcYaw = self.base_pwm
print "Waiting to get aligned"
else:
self.activate_gripper(shall_i=True)
if self.gripper_data and self.states == 2:
self.targets_achieved = 0
self.marker_id += 1
self.set_new_building_as_target()
#Updating the state of the drone from landing to takeoff with package
self.control_state(3)
self.bottom_count = 1
self.box_grabbed = 1
# Landing the drone
else:
self.drone_cmd.rcRoll = self.base_pwm-self.ouput[0]
self.drone_cmd.rcPitch = self.base_pwm-self.ouput[1]
self.drone_cmd.rcYaw = self.base_pwm
# Changing the allowed error to its maximum once the box is picked up to fast up the drone
if self.gripper_data:
self.allowed_lat_error = 0.000004517/2
self.allowed_lon_error = 0.0000047487/2
if self.marker_id == 7:
self.csv_counter == -1
return
# ------------------------------HANDLING TAKE OFF-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def takeoff_control(self):
# Specifying the values for R,P,Y
self.drone_cmd.rcRoll = self.base_pwm
self.drone_cmd.rcPitch = self.base_pwm
self.drone_cmd.rcYaw = self.base_pwm
# ----------------------------------------HANDLING WAYPOINTS SUBSTITUTION---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def delete_inserted(self):
# Deleting the inserted waypoints
del self.targets[1:-2]
def target_refresh(self):
# Coordinates of 0th new are co-ordinates of last old +- altitude
self.targets[0][0] = self.targets[2][0]
self.targets[0][1] = self.targets[2][1]
self.targets[1][0] = self.scanned_target[1]
self.targets[1][1] = self.scanned_target[0]
self.targets[2][0] = self.scanned_target[1]
self.targets[2][1] = self.scanned_target[0]
self.targets[2][2] = self.scanned_target[2]
if self.scanned_target[2] > self.targets[0][2]:
self.targets[0][2] = self.scanned_target[2] + self.offset_alt
self.targets[1][2] = self.scanned_target[2] + self.offset_alt
else:
self.targets[0][2] = self.targets[0][2] + self.offset_alt
self.targets[1][2] = self.targets[0][2]
self.target_list()
def target_list(self):
# getting the coordinates for current point
PosX, PosY, alt1 = self.targets[0]
# getting the coordinates for destiantion point
ToX, ToY, alt1 = self.targets[1]
last_alt = self.targets[2][-1]
# Finding the distance between them
dist = math.sqrt(pow((110692.0702932625 * (PosX-ToX)), 2) +
pow((-105292.0089353767 * (PosY-ToY)), 2))
# Defining the number of waypoints to be inserted between current and goal location
self.n = int(math.floor(dist*self.stride))
# Initialize list
points = [[0.0, 0.0, 0.0] for i in range(self.n)]
x = float(self.n)
# Finding the waypoints and inserting them into the targets list
if self.n > 1:
for i in range(self.n):
points[i][0] = ((PosX*(1-((i+1)/x))) + ToX*((i+1)/x))
points[i][1] = ((PosY*(1-((i+1)/x))) + ToY*((i+1)/x))
points[i][2] = alt1
self.targets.insert(i+1, points[i][:])
self.targets[-1][-1] = last_alt
#Reading coordinates of cells through csv file
def get_gps_coordinates(self):
path = rospkg.RosPack().get_path("vitarana_drone")
path = os.path.join(path,"scripts/manifest.csv")
with open(path,'r') as file:
csvreader = csv.reader(file)
#list of rows in csv file
list_of_contents=list(csvreader)
columns={'A': 18.9999864489, 'B': 19.0000000009, 'C': 19.0000135529}
rows={'1': 71.9999430161, '2': 71.9999572611, '3': 71.9999715061}
#Altitude is constant for all cells since the grid is planar
altitude=8.44099749139
#Creating list for the targets buildings
for i in range(3):
cell = list_of_contents[i][0]
coordinate = [rows[cell[1]],columns[cell[0]],altitude]
self.buiding_locations.append(coordinate)
coordinate = [float(item) for item in list_of_contents[i][1:]]
z = coordinate[0]
coordinate[0] = coordinate[1]
coordinate[1] = z
self.buiding_locations.append(coordinate)
self.buiding_locations.append([self.location.longitude,self.location.latitude,self.location.altitude])
self.targets[2] = [self.location.longitude,self.location.latitude,self.location.altitude]
#seting the first parcel as the target
self.set_new_building_as_target()
print(self.buiding_locations)
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if __name__ == '__main__':
# Waiting for Gazebo to start
time.sleep(0.5)
# Creating an instance of the above class
e_drone = Edrone()
# PID sampling rate
r = rospy.Rate(1/e_drone.pid_break_time)
while not rospy.is_shutdown():
#Condition for calling the pid after the target lists are created
if e_drone.csv_counter == 1:
# Call pid function
e_drone.pid()
# Sleep for specified sampling rate
r.sleep() | [
"shreyasatre16@gmail.com"
] | shreyasatre16@gmail.com |
7c134f6c33ff981cfc8dd4e203525f6c6d4abbd5 | 64d5bfbe2a2d2ed2d14c34f6e8be7a368b29b22e | /blog/urls.py | 9cc9463c785a6870aa55668b696b434a92259a9a | [] | no_license | transpac/my-first-blog | a828e2dde49bf949fc92afa85fa78a8c9ce7e028 | 183cdfe41376f5bd226da69b60dc4918160f7c5e | refs/heads/master | 2021-03-10T04:46:19.268744 | 2020-03-12T16:56:36 | 2020-03-12T16:56:36 | 246,420,276 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 309 | py | from django.urls import path
from . import views
urlpatterns = [
path('', views.post_list, name='post_list'),
path('post/<int:pk>/', views.post_detail, name='post_detail'),
path('post/new/', views.post_new, name='post_new'),
path('post/<int:pk>/edit/', views.post_edit, name='post_edit'),
]
| [
"hkoo@transpacgroup.ca"
] | hkoo@transpacgroup.ca |
1b0ee748166c453488c46842a4ab8596101eef19 | 755572a007cd02d1b70f66b1a9c439c123cbef6c | /ABC240/A.py | 13600be0edea2b2840e761aa3188148a3a22a9fc | [] | no_license | tsubame-misa/Atcoder | 633fa10fe161c512112282b6148abedb56f0b77d | 95814dbd9f5ae511f57841eab3aba49c4121dfe3 | refs/heads/master | 2023-02-03T18:57:10.616225 | 2023-01-31T10:10:45 | 2023-01-31T10:10:45 | 217,071,053 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 171 | py | a, b = list(map(int, input().split()))
if abs(a-b) == 1:
print("Yes")
exit()
if (a == 10 or b == 10) and abs(a-b) == 9:
print("Yes")
exit()
print("No")
| [
"watamisa080513@gmail.com"
] | watamisa080513@gmail.com |
2027b9eae327774a4019a1cd5750223dbc1d0785 | a87bb87212cbf9e7bf883e130558061385608ba2 | /RenderMan/RIB/16.python/affine.py | 825c164655c9921c97bd5ba05764b53c081d0b9f | [] | no_license | RosieCampbell/EngD-courses | 3ef359f64902da8a96cb904c7c25d3fe05d9ee09 | d36b0338d3008b0b6004e13a58bb5d1c8007fcee | refs/heads/master | 2021-03-24T11:44:06.851142 | 2016-01-14T11:14:53 | 2016-01-14T11:14:53 | 46,414,045 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,413 | py | #!/usr/bin/python
# for bash we need to add the following to our .bashrc
# export PYTHONPATH=$PYTHONPATH:$RMANTREE/bin
import getpass
import time
# import the python renderman library
import prman
ri = prman.Ri() # create an instance of the RenderMan interface
filename = "affine.rib"
# this is the begining of the rib archive generation we can only
# make RI calls after this function else we get a core dump
ri.Begin("__render")
# ArchiveRecord is used to add elements to the rib stream in this case comments
# note the function is overloaded so we can concatinate output
ri.ArchiveRecord(ri.COMMENT, 'File ' +filename)
ri.ArchiveRecord(ri.COMMENT, "Created by " + getpass.getuser())
ri.ArchiveRecord(ri.COMMENT, "Creation Date: " +time.ctime(time.time()))
# now we add the display element using the usual elements
# FILENAME DISPLAY Type Output format
ri.Display("affine.exr", "framebuffer", "rgba")
# Specify PAL resolution 1:1 pixel Aspect ratio
ri.Format(720,576,1)
# now set the projection to perspective
ri.Projection(ri.PERSPECTIVE)
# now we start our world
ri.WorldBegin()
ri.Translate(0,0,2)
ri.TransformBegin()
ri.Translate(-1,0,0)
ri.Scale(0.3,0.3,0.3)
ri.Rotate(45,0,1,0)
ri.Geometry("teapot")
ri.Identity()
ri.Translate(1,-0.5,2)
ri.Scale(0.3,0.8,0.3)
ri.Rotate(-90,1,0,0)
ri.Rotate(35,0,0,1)
ri.Geometry("teapot")
ri.TransformEnd()
ri.WorldEnd()
# and finally end the rib file
ri.End()
| [
"rosiekcampbell@gmail.com"
] | rosiekcampbell@gmail.com |
125135cd5217d66bdf4096d7faeefc27f52bdbc4 | 28d8f6b621bd756cc7501caff9edb8781b25f436 | /MITADS-Speech/m-ailabs_importer.py | e0e7c4237a8f90550a0c83b47fe738da779cbfb9 | [] | no_license | Flavio58it/DeepSpeech-Italian-Model | f0c1c2bcbeadcee630d19044155742a91ce9771f | 97c9fbd1c23f604ebc92b620ba0c38c19f734940 | refs/heads/master | 2023-02-20T16:38:01.473021 | 2021-01-19T14:01:27 | 2021-01-19T14:01:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,997 | py | #!/usr/bin/env python3
import time
import os
import re
from corpora_importer import ArchiveImporter,Corpus,encoding_from_path
from glob import glob
CORPUS_NAME = 'm-ailabs'
class MAILabsImporter(ArchiveImporter):
def get_corpus(self):
SKIP_LIST = [] ## filter(None, CLI_ARGS.skiplist.split(","))
##extract training and development datasets
##do data merge, ArchiveImporter make final train/test/dev datasets
utterances = {}
audios = []
wav_root_dir = os.path.join(self.origin_data_path,'it_IT')
# Get audiofile path and transcript for each sentence in tsv
samples = []
glob_dir = os.path.join(wav_root_dir, "**/metadata.csv")
for record in glob(glob_dir, recursive=True):
if any(
map(lambda sk: sk in record, SKIP_LIST)
):
continue
enc = encoding_from_path(record)
with open(record, "r",encoding=enc) as rec:
for re in rec.readlines():
re = re.strip().split("|")
audio = os.path.join(os.path.dirname(record), "wavs", re[0] + ".wav")
transcript = re[2]
samples.append((audio, transcript))
##append data manifest
utterances[audio] = transcript
audios.append(audio)
##collect corpus
corpus = Corpus(utterances,audios)
#################
## evalita2009 have clips WAV 16000Hz - 1 chnl
## not require resample
corpus.make_wav_resample = False
return corpus
if __name__ == "__main__":
corpus_name=CORPUS_NAME
archivie_url = 'https://www.caito.de/data/Training/stt_tts/it_IT.tgz'
data_dir = None
##data_dir = 'F:\\DATASET-MODELS\\speech_dataset\\CORPORA-IT-AUDIO\\M-AILABS'
m_ailabs_importer = MAILabsImporter(corpus_name,archivie_url,data_dir=data_dir)
m_ailabs_importer.run() | [
"noreply@github.com"
] | Flavio58it.noreply@github.com |
59e5bf8b420b7aa726ad91843cc9a610a5e83147 | 9d39f6ec24ea355ee82adfd4487453172953dd37 | /tao_tracking_release/tao_post_processing/track_concat.py | 0fdfff40bdef748b85946943a6bbda28cc689391 | [
"Apache-2.0"
] | permissive | feiaxyt/Winner_ECCV20_TAO | d69c0efdb1b09708c5d95c3f0a38460dedd0e65f | dc36c2cd589b096d27f60ed6f8c56941b750a0f9 | refs/heads/main | 2023-03-19T14:17:36.867803 | 2021-03-16T14:04:31 | 2021-03-16T14:04:31 | 334,864,331 | 82 | 6 | null | null | null | null | UTF-8 | Python | false | false | 3,617 | py | import argparse
import itertools
import json
import logging
import pickle
import sys
from collections import defaultdict
from multiprocessing import Pool
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from tqdm import tqdm
# Add current directory to path
sys.path.insert(0, str(Path(__file__).resolve().parent))
def track_concat(detections1, detections2):
id_gen = itertools.count(1)
unique_track_ids = defaultdict(lambda: next(id_gen))
all_detections = []
tids = np.unique(detections1[:, 1].astype(int))
for tid in tids:
det = detections1[detections1[:, 1].astype(int)==tid].copy()
det[:,1] = unique_track_ids[(tid, 0)]
all_detections.append(det)
tids = np.unique(detections2[:,1].astype(int))
for tid in tids:
det = detections2[detections2[:,1].astype(int)==tid].copy()
det[:, 1] = unique_track_ids[(tid, 1)]
all_detections.append(det)
detections = np.vstack(all_detections)
return detections
def track_and_save(det_path1, det_path2, output):
detections1 = np.load(det_path1)
detections2 = np.load(det_path2)
#image_id, track_id, bb_left, bb_top, bb_width, bb_height, score, category, feature
detections = track_concat(detections1, detections2)
output.parent.mkdir(exist_ok=True, parents=True)
np.save(output, detections)
def track_and_save_star(args):
track_and_save(*args)
def main():
# Use first line of file docstring as description if it exists.
parser = argparse.ArgumentParser(
description=__doc__.split('\n')[0] if __doc__ else '',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--results-dir1',
type=Path,
required=True,
help='the first results')
parser.add_argument('--results-dir2',
type=Path,
required=True,
help='the second results')
parser.add_argument('--annotations',
type=Path,
required=True,
help='Annotations json')
parser.add_argument(
'--output-dir',
type=Path,
required=True,
help=('Output directory, where a results.json will be output, as well '
'as a .npz file for each video, containing a boxes array of '
'size (num_boxes, 6), of the format [x0, y0, x1, y1, class, '
'score, box_index, track_id], where box_index maps into the '
'pickle files'))
parser.add_argument('--workers', default=8, type=int)
args = parser.parse_args()
args.output_dir.mkdir(exist_ok=True, parents=True)
#npz_dir = dir_path(args.output_dir)
def get_output_path(video):
return args.output_dir / (video + '.npy')
with open(args.annotations, 'r') as f:
groundtruth = json.load(f)
videos = [x['name'] for x in groundtruth['videos']]
tasks = []
for video in tqdm(videos):
path1 = args.results_dir1 / (video + '.npy')
path2 = args.results_dir2 / (video + '.npy')
output = get_output_path(video)
tasks.append((path1, path2, output))
if args.workers > 0:
pool = Pool(args.workers)
list(
tqdm(pool.imap_unordered(track_and_save_star, tasks),
total=len(tasks),
desc='Tracking'))
else:
for task in tqdm(tasks):
track_and_save(*task)
print(f'Finished')
if __name__ == "__main__":
main()
| [
"feiaxyt@163.com"
] | feiaxyt@163.com |
b80d1c85edf42a29361b7158c0a8511f0fa7d734 | a459e784ec9dbdd9c919f7438cdf32c457d9a695 | /polls/models.py | b8371d67d603bac726592ee0626a9e159fa93280 | [] | no_license | eisscerav/mysite | 46261ed81bf024dc54441005a643825d42b9e71d | 8e2879abcd5296c407c3828d3673c3123b2418f9 | refs/heads/master | 2021-05-05T20:22:32.792043 | 2018-02-08T08:46:58 | 2018-02-08T08:46:58 | 106,006,830 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 729 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Create your models here.
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
def __str__(self):
return self.question_text
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
def __str__(self):
return self.choice_text
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
| [
"eisscerav@163.com"
] | eisscerav@163.com |
d457512b9082a87bd382e9d0bd8e6ddc0090fedd | d427d523c17831aaef89c2a1a12994e4ef702cd1 | /tojson.py | a00d806c74ee58f2683fcb82b5a9fa316e092391 | [] | no_license | li39000yun/pytest | e5e8455145da51ede15acb15422409ad8c66b29b | ca303ebfb27e86b0120e2563f2d70d1caf1e82db | refs/heads/master | 2021-01-02T09:16:27.546353 | 2017-08-03T01:52:05 | 2017-08-03T01:52:05 | 99,178,505 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 815 | py | import tushare as ts;
import datetime;
# 中国平安(601318);万科(000002);天音控股(000829)
arr = ['601318','000002','000829'];
date = datetime.datetime.now().strftime('%Y%m%d');
today = datetime.date.today(); #获得今天的日期
lastmonth = today - datetime.timedelta(days=31); #用今天日期减掉时间差,参数为31天,获得上月的日期
endDate = today.strftime('%Y-%m-%d');
startDate = lastmonth.strftime('%Y-%m-%d');
for code in arr :
df = ts.get_k_data(code,start=startDate, end=endDate);
df.to_json('D:/java/python/PycharmProjects/pytest/day/'+date+code+'.json',orient='records');
# df = ts.get_hist_data('000875')
# df.to_json('D:/java/python/PycharmProjects/pytest/day/000875.json',orient='records')
#或者直接使用
# print(df.to_json(orient='records')) | [
"li39000yun@qq.com"
] | li39000yun@qq.com |
22c988958773de54be8cd107dfe7721f2f259e49 | 5ac521d6a3a7d070877da4a59dc038a0568ba378 | /backend/config.py | ffac1d4b678a646791eb3dc91c7402bb4dabbb4c | [] | no_license | duanribeiro/exponential_ventures_challenge | 047d2bc3637fea2b17953b83c7f9c25cf0794255 | aab4271fb3dd8a713e927fe91f9da2c40ba7c2d2 | refs/heads/main | 2023-01-15T07:34:40.630263 | 2020-11-30T09:51:44 | 2020-11-30T09:51:44 | 316,333,655 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 1,073 | py | import logging
from logging.config import dictConfig
logger = logging.getLogger(__name__)
class BaseConfig:
DEBUG = True
RESTPLUS_VALIDATE = True
ERROR_INCLUDE_MESSAGE = False
RESTPLUS_MASK_SWAGGER = False
PROPAGATE_EXCEPTIONS = True
class DevConfig(BaseConfig):
SQLALCHEMY_DATABASE_URI = 'mssql+pymssql://sa:game@123@mssql_db:1433/master'
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProdConfig(BaseConfig):
DEBUG = False
dictConfig({
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "[%(levelname)s] - [%(asctime)s] - %(name)s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "simple",
}
},
"loggers": {
"werkzeug": {
"level": "INFO",
"handlers": ["console"],
"propagate": False
}
},
"root": {
"level": "DEBUG",
"handlers": ["console"]
}
})
| [
"duan.ribeiro@hotmail.com"
] | duan.ribeiro@hotmail.com |
9350ae0dad129afa51567e3f2a5590c9760b7305 | 0a1cbf94ad14cc7af7543b76c3f617530887acff | /challenge/challenge.py | a57dc9c138f254204f09b8a701ab88001a456e69 | [] | no_license | Roxy786/mycode | 1c616e8e639ec59442f345a54927e655aaae6fb6 | 5c7008f4c8a81ffbc955ae78da617338fada2ec8 | refs/heads/master | 2020-06-25T23:47:37.054495 | 2019-08-01T18:39:40 | 2019-08-01T18:39:40 | 199,458,274 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 152 | py | #!usr/bin/env python3
list = ["Pinta","Nina","Santa-Maria",3]
print ("Columbus had" + str(list[3]) + "ships the Nina, the Pinta and the Santa-Maria.")
| [
"roxybegum@alta3.com"
] | roxybegum@alta3.com |
7ab3735ad8551c4d0d269fe53de919a2381a8599 | 8d26b4b70d5a4e1ac9dcb7956ea39cf444cdffab | /qs-RegressTest-yg/RunFast/Common/__init__.py | 89b208fb1f38d72e208f32f645df5d661051a0db | [] | no_license | zyy120/qs-RegressTest | dec8808e35efe362b510ff0e312a2c476fa575d9 | 6a5bd9f815236f2a7f164b63161b9496934aa8e7 | refs/heads/master | 2020-04-17T03:38:26.072417 | 2019-02-25T02:05:17 | 2019-02-25T02:05:17 | 166,193,379 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 140 | py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@ author: Hubery
@ create on: 2018/11/22 10:29
@ file: __init__.py.py
@ site:
@ purpose:
""" | [
"1014868589@qq.com"
] | 1014868589@qq.com |
2371ec1a4185f11f3f44cb205c59ff7bf70400cd | 85f5dff291acf1fe7ab59ca574ea9f4f45c33e3b | /api/tacticalrmm/clients/migrations/0019_remove_deployment_client.py | 9a0695a9ae3a2f8d1629acffc8c14fc92ddbd8ec | [
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sadnub/tacticalrmm | a4ecaf994abe39244a6d75ed2166222abb00d4f4 | 0af95aa9b1084973642da80e9b01a18dcacec74a | refs/heads/develop | 2023-08-30T16:48:33.504137 | 2023-04-10T22:57:44 | 2023-04-10T22:57:44 | 243,405,684 | 0 | 2 | MIT | 2020-09-08T13:03:30 | 2020-02-27T01:43:56 | Python | UTF-8 | Python | false | false | 332 | py | # Generated by Django 3.2.6 on 2021-10-28 00:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('clients', '0018_auto_20211010_0249'),
]
operations = [
migrations.RemoveField(
model_name='deployment',
name='client',
),
]
| [
"josh@torchlake.com"
] | josh@torchlake.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.