We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
docs: source: New File source tutorial
The question of how to make a new data source came up [recently](https://gitter.im/dffml/community?at=5e0e4bfbfd580457e7b3e26a). We should have multiple tutorials for sources.

We're going to use https://github.com/intel/dffml/issues/551 as the example for this tutorial, so that issue needs to be closed first.

You'll want to make a

`docs/tutorials/sources/index.rst`

Then take this exist tutorial and move it under

`docs/tutoirials/sources/complex.rst`

You're new one will go under 

`sources/file.rst`

Te idea here is just to explain how you can write a source which reads data from some new filetype, with our example being the `.ini`

Try to follow the new model tutorial format, where we do `literalinclude` and `:lines:` to talk about individual sections of the files we're writing.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `dffml/source/ini.py`
Content:
```
1 from configparser import ConfigParser
2 
3 from ..base import config
4 from ..record import Record
5 from .file import FileSource
6 from .memory import MemorySource
7 from ..util.data import parser_helper
8 from ..util.entrypoint import entrypoint
9 
10 
11 @config
12 class INISourceConfig:
13     filename: str
14     readwrite: bool = False
15     allowempty: bool = False
16 
17 
18 @entrypoint("ini")
19 class INISource(FileSource, MemorySource):
20     """
21     Source to read files in .ini format.
22     """
23 
24     CONFIG = INISourceConfig
25 
26     async def load_fd(self, ifile):
27         # Creating an instance of configparser
28         parser = ConfigParser()
29         # Read from a file object
30         parser.read_file(ifile)
31         # Get all the sections present in the file
32         sections = parser.sections()
33 
34         self.mem = {}
35 
36         # Go over each section
37         for section in sections:
38             # Get data under each section as a dict
39             temp_dict = {}
40             for k, v in parser.items(section):
41                 temp_dict[k] = parser_helper(v)
42             # Each section used as a record
43             self.mem[str(section)] = Record(
44                 str(section), data={"features": temp_dict},
45             )
46 
47         self.logger.debug("%r loaded %d sections", self, len(self.mem))
48 
49     async def dump_fd(self, fd):
50         # Create an instance of configparser
51         parser = ConfigParser()
52 
53         # Go over each section and record in mem
54         for section, record in self.mem.items():
55             # Get each section data as a dict
56             section_data = record.features()
57             if section not in parser.keys():
58                 # If section does not exist add new section
59                 parser.add_section(section)
60             # Set section data
61             parser[section] = section_data
62 
63         # Write to the fileobject
64         parser.write(fd)
65 
66         self.logger.debug("%r saved %d sections", self, len(self.mem))
67
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/dffml/source/ini.py b/dffml/source/ini.py
--- a/dffml/source/ini.py
+++ b/dffml/source/ini.py
@@ -23,11 +23,11 @@
 
     CONFIG = INISourceConfig
 
-    async def load_fd(self, ifile):
+    async def load_fd(self, fileobj):
         # Creating an instance of configparser
         parser = ConfigParser()
         # Read from a file object
-        parser.read_file(ifile)
+        parser.read_file(fileobj)
         # Get all the sections present in the file
         sections = parser.sections()
 
@@ -46,7 +46,7 @@
 
         self.logger.debug("%r loaded %d sections", self, len(self.mem))
 
-    async def dump_fd(self, fd):
+    async def dump_fd(self, fileobj):
         # Create an instance of configparser
         parser = ConfigParser()
 
@@ -61,6 +61,6 @@
             parser[section] = section_data
 
         # Write to the fileobject
-        parser.write(fd)
+        parser.write(fileobj)
 
         self.logger.debug("%r saved %d sections", self, len(self.mem))

{"golden_diff": "diff --git a/dffml/source/ini.py b/dffml/source/ini.py\n--- a/dffml/source/ini.py\n+++ b/dffml/source/ini.py\n@@ -23,11 +23,11 @@\n \n     CONFIG = INISourceConfig\n \n-    async def load_fd(self, ifile):\n+    async def load_fd(self, fileobj):\n         # Creating an instance of configparser\n         parser = ConfigParser()\n         # Read from a file object\n-        parser.read_file(ifile)\n+        parser.read_file(fileobj)\n         # Get all the sections present in the file\n         sections = parser.sections()\n \n@@ -46,7 +46,7 @@\n \n         self.logger.debug(\"%r loaded %d sections\", self, len(self.mem))\n \n-    async def dump_fd(self, fd):\n+    async def dump_fd(self, fileobj):\n         # Create an instance of configparser\n         parser = ConfigParser()\n \n@@ -61,6 +61,6 @@\n             parser[section] = section_data\n \n         # Write to the fileobject\n-        parser.write(fd)\n+        parser.write(fileobj)\n \n         self.logger.debug(\"%r saved %d sections\", self, len(self.mem))\n", "issue": "docs: source: New File source tutorial\nThe question of how to make a new data source came up [recently](https://gitter.im/dffml/community?at=5e0e4bfbfd580457e7b3e26a). We should have multiple tutorials for sources.\r\n\r\nWe're going to use https://github.com/intel/dffml/issues/551 as the example for this tutorial, so that issue needs to be closed first.\r\n\r\nYou'll want to make a\r\n\r\n`docs/tutorials/sources/index.rst`\r\n\r\nThen take this exist tutorial and move it under\r\n\r\n`docs/tutoirials/sources/complex.rst`\r\n\r\nYou're new one will go under \r\n\r\n`sources/file.rst`\r\n\r\nTe idea here is just to explain how you can write a source which reads data from some new filetype, with our example being the `.ini`\r\n\r\nTry to follow the new model tutorial format, where we do `literalinclude` and `:lines:` to talk about individual sections of the files we're writing.\n", "before_files": [{"content": "from configparser import ConfigParser\n\nfrom ..base import config\nfrom ..record import Record\nfrom .file import FileSource\nfrom .memory import MemorySource\nfrom ..util.data import parser_helper\nfrom ..util.entrypoint import entrypoint\n\n\n@config\nclass INISourceConfig:\n    filename: str\n    readwrite: bool = False\n    allowempty: bool = False\n\n\n@entrypoint(\"ini\")\nclass INISource(FileSource, MemorySource):\n    \"\"\"\n    Source to read files in .ini format.\n    \"\"\"\n\n    CONFIG = INISourceConfig\n\n    async def load_fd(self, ifile):\n        # Creating an instance of configparser\n        parser = ConfigParser()\n        # Read from a file object\n        parser.read_file(ifile)\n        # Get all the sections present in the file\n        sections = parser.sections()\n\n        self.mem = {}\n\n        # Go over each section\n        for section in sections:\n            # Get data under each section as a dict\n            temp_dict = {}\n            for k, v in parser.items(section):\n                temp_dict[k] = parser_helper(v)\n            # Each section used as a record\n            self.mem[str(section)] = Record(\n                str(section), data={\"features\": temp_dict},\n            )\n\n        self.logger.debug(\"%r loaded %d sections\", self, len(self.mem))\n\n    async def dump_fd(self, fd):\n        # Create an instance of configparser\n        parser = ConfigParser()\n\n        # Go over each section and record in mem\n        for section, record in self.mem.items():\n            # Get each section data as a dict\n            section_data = record.features()\n            if section not in parser.keys():\n                # If section does not exist add new section\n                parser.add_section(section)\n            # Set section data\n            parser[section] = section_data\n\n        # Write to the fileobject\n        parser.write(fd)\n\n        self.logger.debug(\"%r saved %d sections\", self, len(self.mem))\n", "path": "dffml/source/ini.py"}], "after_files": [{"content": "from configparser import ConfigParser\n\nfrom ..base import config\nfrom ..record import Record\nfrom .file import FileSource\nfrom .memory import MemorySource\nfrom ..util.data import parser_helper\nfrom ..util.entrypoint import entrypoint\n\n\n@config\nclass INISourceConfig:\n    filename: str\n    readwrite: bool = False\n    allowempty: bool = False\n\n\n@entrypoint(\"ini\")\nclass INISource(FileSource, MemorySource):\n    \"\"\"\n    Source to read files in .ini format.\n    \"\"\"\n\n    CONFIG = INISourceConfig\n\n    async def load_fd(self, fileobj):\n        # Creating an instance of configparser\n        parser = ConfigParser()\n        # Read from a file object\n        parser.read_file(fileobj)\n        # Get all the sections present in the file\n        sections = parser.sections()\n\n        self.mem = {}\n\n        # Go over each section\n        for section in sections:\n            # Get data under each section as a dict\n            temp_dict = {}\n            for k, v in parser.items(section):\n                temp_dict[k] = parser_helper(v)\n            # Each section used as a record\n            self.mem[str(section)] = Record(\n                str(section), data={\"features\": temp_dict},\n            )\n\n        self.logger.debug(\"%r loaded %d sections\", self, len(self.mem))\n\n    async def dump_fd(self, fileobj):\n        # Create an instance of configparser\n        parser = ConfigParser()\n\n        # Go over each section and record in mem\n        for section, record in self.mem.items():\n            # Get each section data as a dict\n            section_data = record.features()\n            if section not in parser.keys():\n                # If section does not exist add new section\n                parser.add_section(section)\n            # Set section data\n            parser[section] = section_data\n\n        # Write to the fileobject\n        parser.write(fileobj)\n\n        self.logger.debug(\"%r saved %d sections\", self, len(self.mem))\n", "path": "dffml/source/ini.py"}]}