Pārlūkot izejas kodu

Move camelcase() to Translator class.

Stefano Cossu 7 gadi atpakaļ
vecāks
revīzija
c2675ac270
2 mainītis faili ar 11 papildinājumiem un 10 dzēšanām
  1. 1 10
      lakesuperior/ldp/ldpr.py
  2. 10 0
      lakesuperior/util/translator.py

+ 1 - 10
lakesuperior/ldp/ldpr.py

@@ -124,7 +124,7 @@ class Ldpr(metaclass=ABCMeta):
 
         @return rdflib.URIRef
         '''
-        return self._uuid_to_uri(self.uuid)
+        return Translator.uuid_to_uri(self.uuid)
 
 
     @property
@@ -437,15 +437,6 @@ class Ldpr(metaclass=ABCMeta):
 
 
 
-    def _camelcase(self, word):
-        '''
-        Convert a string with underscores with a camel-cased one.
-
-        Ripped from https://stackoverflow.com/a/6425628
-        '''
-        return ''.join(x.capitalize() or '_' for x in word.split('_'))
-
-
 
 class LdpRs(Ldpr):
     '''LDP-RS (LDP RDF source).

+ 10 - 0
lakesuperior/util/translator.py

@@ -10,6 +10,16 @@ class Translator:
     All static methods.
     '''
 
+    @staticmethod
+    def camelcase(word):
+        '''
+        Convert a string with underscores with a camel-cased one.
+
+        Ripped from https://stackoverflow.com/a/6425628
+        '''
+        return ''.join(x.capitalize() or '_' for x in word.split('_'))
+
+
     @staticmethod
     def uuid_to_uri(uuid):
         '''Convert a UUID to a URI.