Skip to content

Commit

Permalink
vali
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed Mar 20, 2024
1 parent 6795997 commit ce97ffe
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 522 deletions.
11 changes: 0 additions & 11 deletions commune/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@
import aiohttp
import json


from aiohttp.streams import StreamReader

# Define a custom StreamReader with a higher limit
class CustomStreamReader(StreamReader):
def __init__(self, *args, **kwargs):
# You can adjust the limit here to a value that fits your needs
# This example sets it to 1MB
super().__init__(*args, limit=1024*1024, **kwargs)


class Client(c.Module):

def __init__(
Expand Down
1 change: 1 addition & 0 deletions commune/client/http/client_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def all_history(cls, key=None, history_path='history'):




@classmethod
def rm_key_history(cls, key=None, history_path='history'):
key = c.get_key(key)
Expand Down
15 changes: 2 additions & 13 deletions commune/key/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,11 @@ def rm_key(cls, key=None):
assert c.exists(key2path[key]) == False, 'key not deleted'

return {'deleted':[key]}

@property
def crypto_type_name(self):
return self.crypto_type2name(self.crypto_type)


@classmethod
def rm_keys(cls, rm_keys, verbose:bool=False):

Expand All @@ -488,6 +488,7 @@ def rm_keys(cls, rm_keys, verbose:bool=False):
@classmethod
def rm_all_keys(cls):
return cls.rm_keys(cls.keys())

crypto_types = ['ED25519', 'SR25519', 'ECDSA']

@classmethod
Expand Down Expand Up @@ -522,15 +523,6 @@ def resolve_crypto_type(cls, crypto_type):
assert crypto_type in list(KeypairType.__dict__.values()), f'crypto_type {crypto_type} not supported'
return crypto_type

@classmethod
def gen_n(cls, n=10, **kwargs):
keys = []
for i in range(n):
keys.append(cls.gen(**kwargs))

return keys


@classmethod
def gen(cls,
mnemonic:str = None,
Expand All @@ -557,11 +549,8 @@ def gen(cls,
else:
mnemonic = cls.generate_mnemonic()
key = cls.create_from_mnemonic(mnemonic, crypto_type=crypto_type)

if json:
return key.to_json()



return key

Expand Down
97 changes: 0 additions & 97 deletions commune/key/key_docs.md

This file was deleted.

6 changes: 2 additions & 4 deletions commune/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2988,9 +2988,7 @@ def serve(cls,
else:
port = c.free_port()


# NOTE REMOVE THIS FROM THE KWARGS REMOTE

if remote:

# GET THE LOCAL KWARGS FOR SENDING TO THE REMOTE
Expand Down Expand Up @@ -3033,7 +3031,7 @@ def serve(cls,
tag = None

self.tag = tag
self.key = server_name


address = c.get_address(server_name, network=network)
if address != None and ':' in address:
Expand All @@ -3053,7 +3051,7 @@ def serve(cls,
setattr(self, 'whitelist', whitelist)
setattr(self, 'blacklist', blacklist)

c.module(f'server.{mode}')(module=self,
c.module(f'server')(module=self,
name=server_name,
port=port,
network=network,
Expand Down
17 changes: 14 additions & 3 deletions commune/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ def __init__(
self.name = name


self.schema = {}
if hasattr(module, 'schema'):
self.schema = module.schema()
else:
self.schema = c.get_schema(module)
self.schema = c.schema(module)

module.ip = self.ip
module.port = self.port
Expand All @@ -78,6 +77,8 @@ def set_key(self, key):
self.key = c.get_key(self.name)
if isinstance(self.key, str):
self.key = c.get_key(self.key)
self.module.key = self.key
c.print(f'🔑 Key: {self.key} 🔑\033')


def set_address(self,ip='0.0.0.0', port:int=None):
Expand Down Expand Up @@ -276,13 +277,23 @@ def generator_wrapper(self, generator):


@classmethod
def test(cls):
def test_serving(cls):
module_name = 'storage::test'
module = c.serve(module_name, wait_for_server=True)
module = c.connect(module_name)
module.put("hey",1)
c.kill(module_name)

@classmethod
def test_serving_with_different_key(cls):
module_name = 'storage::test'
module = c.serve(module_name, wait_for_server=True)
module = c.connect(module_name)
module.put("hey",1)
c.kill(module_name)





# HISTORY
Expand Down
Empty file removed commune/server/ucall/__init__.py
Empty file.
Empty file.
117 changes: 0 additions & 117 deletions commune/server/ucall/client/ucall_client.py

This file was deleted.

Loading

0 comments on commit ce97ffe

Please sign in to comment.