anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: red-hat-storage/cephci
Issue: Interop: FileNotFoundError - in create_xunit_results method

```
2021-11-24 11:02:29,361 - utility.xunit - INFO - Creating xUnit result file for test suite: suites/nautilus/cephfs/tier-0_fs.yaml
Traceback (most recent call last):
  File "run.py", line 1127, in <module>
    rc = run(args)
  File "run.py", line 1044, in run
    create_xunit_results(suite_name, tcs, run_dir)
  File "/home/psathyan/source/cephci/utility/xunit.py", line 37, in create_xunit_results
    xml.write(xml_file, pretty=True)
  File "/home/psathyan/venv/cephci.venv/lib64/python3.6/site-packages/junitparser/junitparser.py", line 310, in write
    write_xml(self, filepath=filepath, pretty=pretty)
  File "/home/psathyan/venv/cephci.venv/lib64/python3.6/site-packages/junitparser/junitparser.py", line 50, in write_xml
    with open(filepath, "wb") as xmlfile:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cephci-run-Y457FX/suites/nautilus/cephfs/tier-0_fs.yaml.xml'
```
One of the recent changes has broken this feature.

Changed files:
utility/xunit.py

diff --git a/utility/xunit.py b/utility/xunit.py
index 22c1851b..88ffe8dd 100644
--- a/utility/xunit.py
+++ b/utility/xunit.py
@@ -18,7 +18,8 @@ def create_xunit_results(suite_name, test_cases, run_dir):
 
     Returns: None
     """
-    xml_file = f"{run_dir}/{suite_name}.xml"
+    _file = suite_name.split("/")[-1]
+    xml_file = f"{run_dir}/{_file}.xml"
 
     log.info(f"Creating xUnit result file for test suite: {suite_name}")
Repository: sparcs-kaist/new-ara-api
Issue: Handle side_articles with not enough recents

Side articles make an IndexError when there is not enough recents. [#](https://sparcs.slack.com/archives/CV6H8N4EM/p1631709944000600?thread_ts=1630331076.011200&cid=CV6H8N4EM)


Changed files:
tests/test_recent.py, apps/core/serializers/article.py

diff --git a/apps/core/serializers/article.py b/apps/core/serializers/article.py
index 3f0c149..3e525a7 100644
--- a/apps/core/serializers/article.py
+++ b/apps/core/serializers/article.py
@@ -268,17 +268,19 @@ class ArticleSerializer(BaseArticleSerializer):
         }
 
     def get_side_articles_of_recent_article(self, obj, request):
-        article_read_log_set = obj.article_read_log_set.all()
+        article_user_read_log_set = obj.article_read_log_set.filter(
+            read_by=request.user,
+        ).order_by('-created_at')
+
+        # abort if there is not enough recent articles
+        if article_user_read_log_set.count() <= 1:
+            return None, None
 
         # 현재 ArticleReadLog
-        curr_read_log_of_obj = article_read_log_set.filter(
-            read_by=request.user,
-        ).order_by('-created_at')[0]
+        curr_read_log_of_obj = article_user_read_log_set[0]
 
         # 직전 ArticleReadLog
-        last_read_log_of_obj = article_read_log_set.filter(
-            read_by=request.user,
-        ).order_by('-created_at')[1]
+        last_read_log_of_obj = article_user_read_log_set[1]
 
         # 특정 글의 마지막 ArticleReadLog 를 찾기 위한 Subquery
         last_read_log_of_article = ArticleReadLog.objects.filter(
diff --git a/tests/test_recent.py b/tests/test_recent.py
index 7c5fd77..72695b2 100644
--- a/tests/test_recent.py
+++ b/tests/test_recent.py
@@ -233,3 +233,9 @@ class TestRecent(TestCase, RequestSetting):
         assert resp['side_articles']['before']['id'] == before_id
         assert resp['side_articles']['after']['id'] == after_id
 
+    # 첫 번째 읽기가 from_view=recent일 경우 테스트
+    def test_read_first_article_from_recent(self):
+
+        resp = self.http_request(self.user, 'get', f'articles/{self.articles[2].id}', querystring='from_view=recent').data
+        assert resp['side_articles']['before'] is None
+        assert resp['side_articles']['after'] is None
Repository: usepa/flowsa
Issue: Memory error running FBS on ghgi-recursive-yaml/recursive-refac branches with pandas 1.5+

pandas 1.5+ results in memory error and incomplete FBS generation. For now, generate FBS with < pandas 1.5 

@matthewlchambers @bl-young 

Changed files:
flowsa/flowby.py

diff --git a/flowsa/flowby.py b/flowsa/flowby.py
index 17c49c94..8a81ed7d 100644
--- a/flowsa/flowby.py
+++ b/flowsa/flowby.py
@@ -1,4 +1,4 @@
-from typing import List, Literal, TypeVar
+from typing import List, Literal, TypeVar, Union
 import pandas as pd
 from pandas import ExcelWriter
 import numpy as np
@@ -613,6 +613,28 @@ class _FlowBy(pd.DataFrame):
         #     to_parquet method inherited from DatFrame from working, so this
         #     casts the data back to plain DataFrame to write to a parquet.
 
+    def astype(self: FB, *args, **kwargs) -> FB:
+        '''
+        Overrides DataFrame.astype(). Necessary only for pandas >= 1.5.0.
+        With this update, DataFrame.astype() calls the constructor method
+        of the calling dataframe. The FlowBy constructor 1) calls .astype() and
+        2) adds missing FlowBy columns. Consequently, when it's called in the
+        middle of DataFrame.astype() it creates an infinite loop. When the
+        infinite loop is fixed elsewhere, a problem still exists because of
+        missing columns being added (the data submitted to the constructor by
+        DataFrame.astype() don't have column names, so a bunch of empty columns
+        are added on the end and then .astype() can't assign data types and add
+        column names back properly). This function fixes the problem by making
+        it so DataFrame.astype() is not called by a FlowBy dataframe, but
+        instead by a plain pd.DataFrame.
+        '''
+        metadata = {attribute: self.__getattr__(attribute)
+                    for attribute in self._metadata}
+        df = pd.DataFrame(self).astype(*args, **kwargs)
+        fb = type(self)(df, **metadata)
+
+        return fb
+
 
 class FlowByActivity(_FlowBy):
     _metadata = [*_FlowBy()._metadata]
Repository: usepa/flowsa
Issue: BTS_airlines.py not wrapped in function

Importing this module is causing errors due to a required local file

https://github.com/USEPA/flowsa/blob/ghgi-recursive-yaml/flowsa/data_source_scripts/BTS_Airlines.py

https://github.com/USEPA/flowsa/blob/d7c9403491c3b2fe45910bbee938369e7c5602c2/flowsa/data_source_scripts/BTS_Airlines.py#L6-L7

This should be wrapped inside a function.

Changed files:
flowsa/data_source_scripts/BTS_Airlines.py

diff --git a/flowsa/data_source_scripts/BTS_Airlines.py b/flowsa/data_source_scripts/BTS_Airlines.py
index 061d16ea..bfb36564 100644
--- a/flowsa/data_source_scripts/BTS_Airlines.py
+++ b/flowsa/data_source_scripts/BTS_Airlines.py
@@ -3,31 +3,33 @@ import numpy as np
 from flowsa.flowby import FlowByActivity
 from flowsa import flowsa_yaml, settings
 
-with open(f'{settings.sourceconfigpath}BTS_Airlines.yaml') as f:
-    config = flowsa_yaml.load(f)
 
-year_list = config['years']
+def generate_fba():
+    with open(f'{settings.sourceconfigpath}BTS_Airlines.yaml') as f:
+        config = flowsa_yaml.load(f)
 
-df = pd.DataFrame(FlowByActivity((
-    pd.read_csv(config['file_path'])
-    [[c for c in config['parse']['rename_columns']]]
-    .rename(columns=config['parse']['rename_columns'])
-    .query('Year in @year_list')
-    .reset_index(drop=True)
-    .groupby('Year').agg('sum').reset_index()
-    .assign(
-        Class='Fuel',
-        Compartment='air',
-        SourceName='BTS_Airlines',
-        LocationSystem='FIPS_2015',
-        ActivityConsumedBy='Commercial Aircraft',
-        Unit='gal',
-        FlowName='Total Gallons Consumed',
-        FlowType='TECHNOSPHERE_FLOW',
-        Location='00000',
-        DataReliability=3,
-        DataCollection=5
-    )
-)))
+    year_list = config['years']
 
-df.to_parquet(f'{settings.fbaoutputpath}BTS_Airlines.parquet')
+    df = pd.DataFrame(FlowByActivity((
+        pd.read_csv(config['file_path'])
+        [[c for c in config['parse']['rename_columns']]]
+        .rename(columns=config['parse']['rename_columns'])
+        .query('Year in @year_list')
+        .reset_index(drop=True)
+        .groupby('Year').agg('sum').reset_index()
+        .assign(
+            Class='Fuel',
+            Compartment='air',
+            SourceName='BTS_Airlines',
+            LocationSystem='FIPS_2015',
+            ActivityConsumedBy='Commercial Aircraft',
+            Unit='gal',
+            FlowName='Total Gallons Consumed',
+            FlowType='TECHNOSPHERE_FLOW',
+            Location='00000',
+            DataReliability=3,
+            DataCollection=5
+        )
+    )))
+
+    df.to_parquet(f'{settings.fbaoutputpath}BTS_Airlines.parquet')