
import sys
import os
from openregister import Item
from openregister.representations.jsonl import Writer

register = sys.argv[1] or "register"
dirname = "data/" + register + "/"

writer = Writer(sys.stdout)

for file in os.listdir(dirname):
    if file.endswith(".yaml"):
        item = Item()
        item.yaml = open(dirname + file).read()
        writer.write(item)

writer.close()


import sys
import os
from openregister import Item
from openregister.representations.jsonl import Writer

register = sys.argv[1] or "register"
dirname = os.path.join("data", register)

writer = Writer(sys.stdout)

for file in os.listdir(dirname):
    if file.endswith(".yaml"):
        item = Item()
        item.yaml = open(os.path.join(dirname, file)).read()
        writer.write(item)

writer.close()

Use os.path.join to build prod
Use os.path.join to build prod

  
  import sys
  import os
  from openregister import Item
  from openregister.representations.jsonl import Writer
  
  register = sys.argv[1] or "register"
- dirname = "data/" + register + "/"
+ dirname = os.path.join("data", register)
  
  writer = Writer(sys.stdout)
  
  for file in os.listdir(dirname):
      if file.endswith(".yaml"):
          item = Item()
-         item.yaml = open(dirname + file).read()
+         item.yaml = open(os.path.join(dirname, file)).read()
          writer.write(item)
  
  writer.close()
  
Use os.path.join to build prod
## Code Before:

import sys
import os
from openregister import Item
from openregister.representations.jsonl import Writer

register = sys.argv[1] or "register"
dirname = "data/" + register + "/"

writer = Writer(sys.stdout)

for file in os.listdir(dirname):
    if file.endswith(".yaml"):
        item = Item()
        item.yaml = open(dirname + file).read()
        writer.write(item)

writer.close()

## Instruction:
Use os.path.join to build prod
## Code After:

import sys
import os
from openregister import Item
from openregister.representations.jsonl import Writer

register = sys.argv[1] or "register"
dirname = os.path.join("data", register)

writer = Writer(sys.stdout)

for file in os.listdir(dirname):
    if file.endswith(".yaml"):
        item = Item()
        item.yaml = open(os.path.join(dirname, file)).read()
        writer.write(item)

writer.close()
