gurudesh/pytracebugs huggingface dataset:
# Buggy code
def loadhandlers(path, names, global_conf=None, **kwargs):
    loader = ConfigLoader(path)
    handlers = {}
    handlers.update(
        (name, loadhandler(loader, name, global_conf, **kwargs)) for name in names
    )
    return handlers


# Traceback (LookupError)
Traceback (most recent call last):
File "/home/fvennetier/src/public_git/oio-sds/oio/event/agent.py", line 166, in spawn_worker
worker.init()
File "/home/fvennetier/src/public_git/oio-sds/oio/event/consumer.py", line 144, in init
app=self)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 72, in loadhandlers
for name in names
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 72, in <genexpr>
for name in names
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 78, in loadhandler
context = loader.get_context(HANDLER, name, global_conf)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 137, in get_context
obj_type, name=name)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 206, in find_config_section
'No section %r found in config %r' % (name, self.filename))
LookupError: No section 'account.services' found in config '/home/fvennetier/.oio/sds/conf/event-handlers.conf'

# Fixed code
def loadhandlers(path, global_conf=None, **kwargs):
    loader = ConfigLoader(path)
    handlers = {}
    handlers.update(
        (name[8:], loadhandler(loader, name[8:], global_conf, **kwargs))
        for name in loader.get_sections(prefix="handler")
    )
    return handlers
# Buggy code
def __init__(self, namespace, endpoint=None, session=None):
    self.conf = {"namespace": namespace}
    self._volume = None
    self._event = None
    self._cluster = None
    self._meta0 = None
    self.session = session


# Traceback (ConnectionError)
# openio --oio-ns=VCFR1 directory bootstrap --replicas 3 -v --debug
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=meta1 HTTP/1.1" 200 376
Computing meta1 prefix mapping...
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Equilibrating...
META1 Digits = 4
Replicas = 3
Scored positively = 3
Ideal number of prefixes per meta1: 65536
Rebalance moved 0 prefixes
Saving...
Starting new HTTP connection (1): 172.17.25.5
"POST /v3.0/VCFR1/admin/meta0_force HTTP/1.1" 204 0
Assigning rdir services to rawx services...
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=rawx HTTP/1.1" 200 256
"GET /v3.0/VCFR1/conscience/list?full=1&amp;type=rdir HTTP/1.1" 200 642
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/reference/show?acct=_RDIR&amp;ref=172.17.25.7%3A6004&amp;type=rdir HTTP/1.1" 404 59
('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cliff/app.py", line 374, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/dist-packages/cliff/command.py", line 54, in run
self.take_action(parsed_args)
File "/usr/lib/python2.7/dist-packages/oio/cli/admin/directory.py", line 60, in take_action
self.app.client_manager.admin.volume.assign_all_rawx()
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 38, in assign_all_rawx
rdir = self._smart_link_rdir(rawx['addr'], cs, all_rdir)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 68, in _smart_link_rdir
polled = cs.poll('rdir', avoid=avoids, known=known)[0]
File "/usr/lib/python2.7/dist-packages/oio/conscience/client.py", line 47, in poll
data=json.dumps(ibody))
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 51, in _request
return self._direct_request(method, url, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 37, in _direct_request
**kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Exception raised: ('Connection aborted.', BadStatusLine("''",))

# Fixed code
def __init__(self, namespace, session=None, **kwargs):
    self.conf = {"namespace": namespace}
    self.conf.update(kwargs)
    self._volume = None
    self._event = None
    self._cluster = None
    self._meta0 = None
    self.session = session
# Buggy code
def make_client(instance):
    """
    Build an AdminClient that will be added as "admin"
    field of `instance`.

    :param instance: an instance of ClientManager
    :returns: an instance of AdminClient
    """
    endpoint = instance.get_endpoint("admin")
    client = AdminClient(
        session=instance.session, endpoint=endpoint, namespace=instance.namespace
    )
    return client


# Traceback (ConnectionError)
# openio --oio-ns=VCFR1 directory bootstrap --replicas 3 -v --debug
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=meta1 HTTP/1.1" 200 376
Computing meta1 prefix mapping...
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Equilibrating...
META1 Digits = 4
Replicas = 3
Scored positively = 3
Ideal number of prefixes per meta1: 65536
Rebalance moved 0 prefixes
Saving...
Starting new HTTP connection (1): 172.17.25.5
"POST /v3.0/VCFR1/admin/meta0_force HTTP/1.1" 204 0
Assigning rdir services to rawx services...
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=rawx HTTP/1.1" 200 256
"GET /v3.0/VCFR1/conscience/list?full=1&amp;type=rdir HTTP/1.1" 200 642
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/reference/show?acct=_RDIR&amp;ref=172.17.25.7%3A6004&amp;type=rdir HTTP/1.1" 404 59
('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cliff/app.py", line 374, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/dist-packages/cliff/command.py", line 54, in run
self.take_action(parsed_args)
File "/usr/lib/python2.7/dist-packages/oio/cli/admin/directory.py", line 60, in take_action
self.app.client_manager.admin.volume.assign_all_rawx()
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 38, in assign_all_rawx
rdir = self._smart_link_rdir(rawx['addr'], cs, all_rdir)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 68, in _smart_link_rdir
polled = cs.poll('rdir', avoid=avoids, known=known)[0]
File "/usr/lib/python2.7/dist-packages/oio/conscience/client.py", line 47, in poll
data=json.dumps(ibody))
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 51, in _request
return self._direct_request(method, url, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 37, in _direct_request
**kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Exception raised: ('Connection aborted.', BadStatusLine("''",))

# Fixed code
def make_client(instance):
    """
    Build an AdminClient that will be added as "admin"
    field of `instance`.

    :param instance: an instance of ClientManager
    :returns: an instance of AdminClient
    """
    client = AdminClient(**instance.get_process_configuration())
    return client
# Buggy code
def __get__(self, instance, owner):
    if self._handle is None:
        self._handle = self.factory(instance)
    return self._handle


# Traceback (ConnectionError)
# openio --oio-ns=VCFR1 directory bootstrap --replicas 3 -v --debug
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=meta1 HTTP/1.1" 200 376
Computing meta1 prefix mapping...
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Equilibrating...
META1 Digits = 4
Replicas = 3
Scored positively = 3
Ideal number of prefixes per meta1: 65536
Rebalance moved 0 prefixes
Saving...
Starting new HTTP connection (1): 172.17.25.5
"POST /v3.0/VCFR1/admin/meta0_force HTTP/1.1" 204 0
Assigning rdir services to rawx services...
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=rawx HTTP/1.1" 200 256
"GET /v3.0/VCFR1/conscience/list?full=1&amp;type=rdir HTTP/1.1" 200 642
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/reference/show?acct=_RDIR&amp;ref=172.17.25.7%3A6004&amp;type=rdir HTTP/1.1" 404 59
('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cliff/app.py", line 374, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/dist-packages/cliff/command.py", line 54, in run
self.take_action(parsed_args)
File "/usr/lib/python2.7/dist-packages/oio/cli/admin/directory.py", line 60, in take_action
self.app.client_manager.admin.volume.assign_all_rawx()
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 38, in assign_all_rawx
rdir = self._smart_link_rdir(rawx['addr'], cs, all_rdir)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 68, in _smart_link_rdir
polled = cs.poll('rdir', avoid=avoids, known=known)[0]
File "/usr/lib/python2.7/dist-packages/oio/conscience/client.py", line 47, in poll
data=json.dumps(ibody))
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 51, in _request
return self._direct_request(method, url, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 37, in _direct_request
**kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Exception raised: ('Connection aborted.', BadStatusLine("''",))

# Fixed code
def __get__(self, instance, owner):
    instance.setup()
    if self._handle is None:
        self._handle = self.factory(instance)
    return self._handle
# Buggy code
def take_action(self, parsed_args):
    self.log.debug("take_action(%s)", parsed_args)

    account = self.app.client_manager.get_account()
    container = parsed_args.container

    data = self.app.client_manager.storage.container_show(account, container)

    data_dir = self.app.client_manager.directory.get(account, container)

    info = {
        "account": data["system"]["sys.account"],
        "base_name": data["system"]["sys.name"],
        "name": data["system"]["sys.user.name"],
        "meta0": list(),
        "meta1": list(),
        "meta2": list(),
    }

    for d in data_dir["srv"]:
        if d["type"] == "meta2":
            info["meta2"].append(d["host"])

    for d in data_dir["dir"]:
        if d["type"] == "meta0":
            info["meta0"].append(d["host"])
        if d["type"] == "meta1":
            info["meta1"].append(d["host"])

    for stype in ["meta0", "meta1", "meta2"]:
        info[stype] = ", ".join(info[stype])
    return zip(*sorted(info.iteritems()))


# Traceback (KeyError)
### 0 /home/jfs/public_git/github.com/jfsmig/oio-sds
(oio)jfs@jfs-lenovo 14 # openio container create JFS
+------+---------+
| Name | Created |
+------+---------+
| JFS  | True    |
+------+---------+


### 0 /home/jfs/public_git/github.com/jfsmig/oio-sds
(oio)jfs@jfs-lenovo 15 # openio --debug -v container locate JFS
Starting new HTTP connection (1): 127.0.0.1
"GET /v3.0/OPENIO/container/show?acct=ACCT&amp;ref=JFS HTTP/1.1" 200 17
Starting new HTTP connection (1): 127.0.0.1
"GET /v3.0/OPENIO/reference/show?acct=ACCT&amp;ref=JFS HTTP/1.1" 200 194
'system'
Traceback (most recent call last):
File "/home/jfs/.local/python/oio/local/lib/python2.7/site-packages/cliff/app.py", line 387, in run_subcommand
result = cmd.run(parsed_args)
File "/home/jfs/.local/python/oio/local/lib/python2.7/site-packages/cliff/display.py", line 100, in run
column_names, data = self.take_action(parsed_args)
File "/home/jfs/public_git/github.com/jfsmig/oio-sds/oio/cli/storage/container.py", line 361, in take_action
info = {'account': data['system']['sys.account'],
KeyError: 'system'
Exception raised: 'system'

# Fixed code
def take_action(self, parsed_args):
    self.log.debug("take_action(%s)", parsed_args)

    account = self.app.client_manager.get_account()
    container = parsed_args.container

    data = self.app.client_manager.storage.container_get_properties(account, container)

    data_dir = self.app.client_manager.directory.get(account, container)

    info = {
        "account": data["system"]["sys.account"],
        "base_name": data["system"]["sys.name"],
        "name": data["system"]["sys.user.name"],
        "meta0": list(),
        "meta1": list(),
        "meta2": list(),
    }

    for d in data_dir["srv"]:
        if d["type"] == "meta2":
            info["meta2"].append(d["host"])

    for d in data_dir["dir"]:
        if d["type"] == "meta0":
            info["meta0"].append(d["host"])
        if d["type"] == "meta1":
            info["meta1"].append(d["host"])

    for stype in ["meta0", "meta1", "meta2"]:
        info[stype] = ", ".join(info[stype])
    return zip(*sorted(info.iteritems()))
# Buggy code
def delete_chunk(chunk):
    resp = None
    p = urlparse(chunk["id"])
    try:
        with Timeout(CHUNK_TIMEOUT):
            conn = http_connect(p.netloc, "DELETE", p.path)
            resp = conn.getresponse()
            resp.chunk = chunk
    except (Exception, Timeout) as e:
        self.logger.warn(
            'error while deleting chunk %s "%s"', chunk["id"], str(e.message)
        )
    return resp


# Traceback (TypeError)
Sep 06 11:30:47.385138 linux-cgzg OIO,NS,event-agent[11419]: 11419 7F6667BF5690 log ERROR handling event 4452 (bury)
Traceback (most recent call last):
File "/home/fvennetier/src/public_git/oio-sds/oio/event/consumer.py", line 209, in handle
self.process_event(job_id, event, beanstalk)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/consumer.py", line 236, in process_event
handler(event, cb)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/filters/base.py", line 18, in __call__
self.process(env, cb)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/filters/content_cleaner.py", line 61, in process
chunk_method = content_headers['chunk-method']
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def delete_chunk(self, chunk):
    resp = None
    parsed = urlparse(chunk["id"])
    try:
        with Timeout(CHUNK_TIMEOUT):
            conn = http_connect(parsed.netloc, "DELETE", parsed.path)
            resp = conn.getresponse()
            resp.chunk = chunk
    except (Exception, Timeout) as exc:
        self.logger.warn(
            'error while deleting chunk %s "%s"', chunk["id"], str(exc.message)
        )
    return resp
# Buggy code
def register(self):
    # Use a boolean so we can easily convert it to a number in conscience
    self.service_definition["tags"]["tag.up"] = self.last_status
    self.cs.register(self.service["type"], self.service_definition)


# Traceback (ConnectionError)
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345DA59690 log INFO watcher "meta0|127.0.0.1|6005" stopped
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : Traceback (most recent call last):
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : File "/home/jfs/.local/python/oio/local/lib/python2.7/site-packages/eventlet/hubs/poll.py", line 115, in wait
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : listener.cb(fileno)
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : File "/home/jfs/.local/python/oio/local/lib/python2.7/site-packages/eventlet/greenthread.py", line 214, in main
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : result = function(*args, **kwargs)
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : File "/home/jfs/public_git/github.com/jfsmig/oio-sds/oio/conscience/agent.py", line 70, in start
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : self.watch()
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : File "/home/jfs/public_git/github.com/jfsmig/oio-sds/oio/conscience/agent.py", line 120, in watch
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : raise e
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : ConnectionError: ('Connection aborted.', error(111, 'ECONNREFUSED'))
avril 06 18:06:15 jfs-lenovo OIO,NS,conscience-agent,1[30650]: 30650 7F345EAEAEB0 log ERROR STDERR : Removing descriptor: 7

# Fixed code
def register(self):
    # Use a boolean so we can easily convert it to a number in conscience
    self.service_definition["tags"]["tag.up"] = self.last_status
    try:
        self.cs.register(self.service["type"], self.service_definition)
    except requests.RequestException as rqe:
        self.logger.warn(
            "Failed to register service %s: %s", self.service_definition["addr"], rqe
        )
# Buggy code
def get_recipients(service_name, email_field):
    if not frappe.db:
        frappe.connect()

    return split_emails(frappe.db.get_value(service_name, None, email_field))


# Traceback (KeyError)
[2020-04-23 16:08:24 +0000] [3664] [ERROR] Error handling request /
Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 53, in application
init_request(request)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 108, in init_request
frappe.init(site=site, sites_path=_sites_path)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 150, in init
local.conf = _dict(get_site_config())
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 224, in get_site_config
sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 72, in __getattr__
return self.__storage__[self.__ident_func__()][name]
KeyError: 'conf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 309, in _get_current_object
return getattr(self.__local, self.__name__)
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 74, in __getattr__
raise AttributeError(name)
AttributeError: conf

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 231, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/wrappers/base_request.py", line 237, in application
resp = f(*args[:-2] + (request,))
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 96, in application
frappe.monitor.stop(response)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/monitor.py", line 26, in stop
if frappe.conf.monitor and hasattr(frappe.local, "monitor"):
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 348, in __getattr__
return getattr(self._get_current_object(), name)
File "/home/ubuntu/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py", line 311, in _get_current_object
raise RuntimeError("no object bound to %s" % self.__name__)
RuntimeError: no object bound to conf

# Fixed code
def get_recipients(doctype, email_field):
    if not frappe.db:
        frappe.connect()

    return split_emails(frappe.db.get_value(doctype, None, email_field))
# Buggy code
def normalize_launch_params(params: Dict) -> None:
    if "env" in params:
        params["env"] = {name: str(value) for [name, value] in params["env"].items()}
    if "ignoreDefaultArgs" in params:
        if isinstance(params["ignoreDefaultArgs"], bool):
            params["ignoreAllDefaultArgs"] = True
            del params["ignoreDefaultArgs"]
        params["env"] = {name: str(value) for [name, value] in params["env"].items()}
    if "executablePath" in params:
        params["executablePath"] = str(Path(params["executablePath"]))
    if "downloadsPath" in params:
        params["downloadsPath"] = str(Path(params["downloadsPath"]))


# Traceback (playwright.helper.TimeoutError)
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/playwright/browser_type.py", line 68, in launch
return from_channel(await self._channel.send("launch", params))
File "/home/user/.local/lib/python3.8/site-packages/playwright/connection.py", line 39, in send
result = await callback.future
File "/usr/lib/python3.8/asyncio/futures.py", line 260, in __await__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.8/asyncio/tasks.py", line 349, in __wakeup
future.result()
File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result
raise self._exception
playwright.helper.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
<launching> /home/user/.cache/ms-playwright/chromium-799411/chrome-linux/chrome
<launched> pid=301672
[err] [301699:301699:0914/061714.839670:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.

# Fixed code
def normalize_launch_params(params: Dict) -> None:
    if "env" in params:
        params["env"] = {name: str(value) for [name, value] in params["env"].items()}
    if "ignoreDefaultArgs" in params:
        if params["ignoreDefaultArgs"] is True:
            params["ignoreAllDefaultArgs"] = True
            del params["ignoreDefaultArgs"]
    if "executablePath" in params:
        params["executablePath"] = str(Path(params["executablePath"]))
    if "downloadsPath" in params:
        params["downloadsPath"] = str(Path(params["downloadsPath"]))
# Buggy code
def __init__(self, **kwds):
    GLGraphicsItem.__init__(self)
    glopts = kwds.pop("glOptions", "additive")
    self.setGLOptions(glopts)
    self.pos = []
    self.size = 10
    self.color = [1.0, 1.0, 1.0, 0.5]
    self.pxMode = True
    # self.vbo = {}      ## VBO does not appear to improve performance very much.
    self.setData(**kwds)
    self.shader = None


# Traceback (AttributeError)
|==============================>>
|  Traceback (most recent call last):
|    File "filename.py", line 358, in <module>
|      sys.exit(app.exec_())
|    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 193, in paintGL
|      self.drawItemTree(useItemNames=useItemNames)
|    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 233, in drawItemTree
|      self.drawItemTree(i, useItemNames=useItemNames)
|    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 214, in drawItemTree
|      debug.printExc()
|    --- exception caught here ---
|    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 211, in drawItemTree
|      i.paint()
|    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\items\GLScatterPlotItem.py", line 152, in paint
|      glDrawArrays(GL_POINTS, 0, int(pos.size / pos.shape[-1]))
|  AttributeError: 'list' object has no attribute 'size'
|==============================<<
Error while drawing item <pyqtgraph.opengl.items.GLScatterPlotItem.GLScatterPlotItem(0xf20aa30) at 0x101A63A8>.

# Fixed code
def __init__(self, **kwds):
    GLGraphicsItem.__init__(self)
    glopts = kwds.pop("glOptions", "additive")
    self.setGLOptions(glopts)
    self.pos = None
    self.size = 10
    self.color = [1.0, 1.0, 1.0, 0.5]
    self.pxMode = True
    # self.vbo = {}      ## VBO does not appear to improve performance very much.
    self.setData(**kwds)
    self.shader = None
# Buggy code
def keyPressEvent(self, ev):
    # print ev.key()
    if ev.key() == QtCore.Qt.Key_Space:
        if self.playRate == 0:
            self.play()
        else:
            self.play(0)
        ev.accept()
    elif ev.key() == QtCore.Qt.Key_Home:
        self.setCurrentIndex(0)
        self.play(0)
        ev.accept()
    elif ev.key() == QtCore.Qt.Key_End:
        self.setCurrentIndex(self.getProcessedImage().shape[0] - 1)
        self.play(0)
        ev.accept()
    elif ev.key() in self.noRepeatKeys:
        ev.accept()
        if ev.isAutoRepeat():
            return
        self.keysPressed[ev.key()] = 1
        self.evalKeyState()
    else:
        super().keyPressEvent(ev)


# Traceback (KeyError)
Traceback (most recent call last):
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 452, in keyPressEvent
self.evalKeyState()
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 476, in evalKeyState
self.jumpFrames(1)
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 516, in jumpFrames
if self.axes['t'] is not None:
KeyError: 't'

# Fixed code
def keyPressEvent(self, ev):
    if not self.hasTimeAxis():
        super().keyPressEvent(ev)
        return

    if ev.key() == QtCore.Qt.Key_Space:
        if self.playRate == 0:
            self.play()
        else:
            self.play(0)
        ev.accept()
    elif ev.key() == QtCore.Qt.Key_Home:
        self.setCurrentIndex(0)
        self.play(0)
        ev.accept()
    elif ev.key() == QtCore.Qt.Key_End:
        self.setCurrentIndex(self.getProcessedImage().shape[0] - 1)
        self.play(0)
        ev.accept()
    elif ev.key() in self.noRepeatKeys:
        ev.accept()
        if ev.isAutoRepeat():
            return
        self.keysPressed[ev.key()] = 1
        self.evalKeyState()
    else:
        super().keyPressEvent(ev)
# Buggy code
def keyReleaseEvent(self, ev):
    if ev.key() in [QtCore.Qt.Key_Space, QtCore.Qt.Key_Home, QtCore.Qt.Key_End]:
        ev.accept()
    elif ev.key() in self.noRepeatKeys:
        ev.accept()
        if ev.isAutoRepeat():
            return
        try:
            del self.keysPressed[ev.key()]
        except:
            self.keysPressed = {}
        self.evalKeyState()
    else:
        super().keyReleaseEvent(ev)


# Traceback (KeyError)
Traceback (most recent call last):
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 452, in keyPressEvent
self.evalKeyState()
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 476, in evalKeyState
self.jumpFrames(1)
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 516, in jumpFrames
if self.axes['t'] is not None:
KeyError: 't'

# Fixed code
def keyReleaseEvent(self, ev):
    if not self.hasTimeAxis():
        super().keyReleaseEvent(ev)
        return

    if ev.key() in [QtCore.Qt.Key_Space, QtCore.Qt.Key_Home, QtCore.Qt.Key_End]:
        ev.accept()
    elif ev.key() in self.noRepeatKeys:
        ev.accept()
        if ev.isAutoRepeat():
            return
        try:
            del self.keysPressed[ev.key()]
        except:
            self.keysPressed = {}
        self.evalKeyState()
    else:
        super().keyReleaseEvent(ev)
# Buggy code
def timeIndex(self, slider):
    ## Return the time and frame index indicated by a slider
    if self.image is None:
        return (0, 0)

    t = slider.value()

    xv = self.tVals
    if xv is None:
        ind = int(t)
    else:
        if len(xv) < 2:
            return (0, 0)
        totTime = xv[-1] + (xv[-1] - xv[-2])
        inds = np.argwhere(xv <= t)
        if len(inds) < 1:
            return (0, t)
        ind = inds[-1, 0]
    return ind, t


# Traceback (KeyError)
Traceback (most recent call last):
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 452, in keyPressEvent
self.evalKeyState()
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 476, in evalKeyState
self.jumpFrames(1)
File "D:\Repositories\Art\pyqtgraph\pyqtgraph\imageview\ImageView.py", line 516, in jumpFrames
if self.axes['t'] is not None:
KeyError: 't'

# Fixed code
def timeIndex(self, slider):
    ## Return the time and frame index indicated by a slider
    if not self.hasTimeAxis():
        return (0, 0)

    t = slider.value()

    xv = self.tVals
    if xv is None:
        ind = int(t)
    else:
        if len(xv) < 2:
            return (0, 0)
        totTime = xv[-1] + (xv[-1] - xv[-2])
        inds = np.argwhere(xv <= t)
        if len(inds) < 1:
            return (0, t)
        ind = inds[-1, 0]
    return ind, t
# Buggy code
def setParentItem(self, p):
    ret = GraphicsWidget.setParentItem(self, p)
    if self.offset is not None:
        offset = Point(self.opts["offset"])
        anchorx = 1 if offset[0] <= 0 else 0
        anchory = 1 if offset[1] <= 0 else 0
        anchor = (anchorx, anchory)
        self.anchor(itemPos=anchor, parentPos=anchor, offset=offset)
    return ret


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/vin/test/testlegend.py", line 7, in <module>
l.setParentItem(plt.graphicsItem())
File "/home/vin/miniconda3/lib/python3.7/site-packages/pyqtgraph/graphicsItems/LegendItem.py", line 128, in setParentItem
offset = Point(self.opts['offset'])
File "/home/vin/miniconda3/lib/python3.7/site-packages/pyqtgraph/Point.py", line 35, in __init__
QtCore.QPointF.__init__(self, *args)
TypeError: arguments did not match any overloaded call:
QPointF(): too many arguments
QPointF(float, float): argument 1 has unexpected type 'NoneType'
QPointF(QPoint): argument 1 has unexpected type 'NoneType'
QPointF(QPointF): argument 1 has unexpected type 'NoneType'

# Fixed code
def setParentItem(self, p):
    ret = GraphicsWidget.setParentItem(self, p)
    if self.opts["offset"] is not None:
        offset = Point(self.opts["offset"])
        anchorx = 1 if offset[0] <= 0 else 0
        anchory = 1 if offset[1] <= 0 else 0
        anchor = (anchorx, anchory)
        self.anchor(itemPos=anchor, parentPos=anchor, offset=offset)
    return ret
# Buggy code
def checkOpenGLVersion(self, msg):
    ## Only to be called from within exception handler.
    ver = glGetString(GL_VERSION).split()[0]
    if int(ver.split(".")[0]) < 2:
        from .. import debug

        debug.printExc()
        raise Exception(
            msg
            + " The original exception is printed above; however, pyqtgraph requires OpenGL version 2.0 or greater for many of its 3D features and your OpenGL version is %s. Installing updated display drivers may resolve this issue."
            % ver
        )
    else:
        raise


# Traceback (OpenGL.error.GLError)
Using PyQt5 (default graphics system)
Traceback (most recent call last):
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 55, in addItem
item.initializeGL()
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\pyqtgraph\opengl\items\GLImageItem.py", line 34, in initializ
eGL
glEnable(GL_TEXTURE_2D)
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\OpenGL\platform\baseplatform.py", line 402, in __call__
return self( *args, **named )
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\OpenGL\error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1280,
description = b'\xe9num\xe9rant non valide',
baseOperation = glEnable,
cArguments = (GL_TEXTURE_2D,)
)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\pyqtgraph\examples\GLImageItem.py", line 41, in <module>
w.addItem(v1)
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 57, in addItem
self.checkOpenGLVersion('Error while adding item %s to GLViewWidget.' % str(
item))
File "D:\WinPython\basedir34\buildQt5\winpython-3.4.4.amd64\python-3.4.4.amd64
\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 382, in checkOpenGLVe
rsion
if int(ver.split('.')[0]) < 2:
TypeError: 'str' does not support the buffer interface

# Fixed code
def checkOpenGLVersion(self, msg):
    ## Only to be called from within exception handler.
    ver = glGetString(GL_VERSION).split()[0]
    if int(ver.split(b".")[0]) < 2:
        from .. import debug

        debug.printExc()
        raise Exception(
            msg
            + " The original exception is printed above; however, pyqtgraph requires OpenGL version 2.0 or greater for many of its 3D features and your OpenGL version is %s. Installing updated display drivers may resolve this issue."
            % ver
        )
    else:
        raise
# Buggy code
def __init__(self, pos, color, mode=None):
    """
    ===============     ==============================================================
    **Arguments:**
    pos                 Array of positions where each color is defined
    color               Array of RGBA colors.
                        Integer data types are interpreted as 0-255; float data types
                        are interpreted as 0.0-1.0
    mode                Array of color modes (ColorMap.RGB, HSV_POS, or HSV_NEG)
                        indicating the color space that should be used when
                        interpolating between stops. Note that the last mode value is
                        ignored. By default, the mode is entirely RGB.
    ===============     ==============================================================
    """
    self.pos = np.array(pos)
    order = np.argsort(self.pos)
    self.pos = self.pos[order]
    self.color = np.array(color)[order]
    if mode is None:
        mode = np.ones(len(pos))
    self.mode = mode
    self.stopsCache = {}


# Traceback (IndexError)
Traceback (most recent call last):
File "test.py", line 13, in <module>
cmap.getLookupTable()  # Does not work
File "...\venv\lib\site-packages\pyqtgraph\colormap.py", line 223, in getLookupTable
alpha = self.usesAlpha()
File "...\venv\lib\site-packages\pyqtgraph\colormap.py", line 236, in usesAlpha
return np.any(self.color[:,3] != max)
IndexError: index 3 is out of bounds for axis 1 with size 3

# Fixed code
def __init__(self, pos, color, mode=None):
    """
    ===============     ==============================================================
    **Arguments:**
    pos                 Array of positions where each color is defined
    color               Array of colors.
                        Values are interpreted via
                        :func:`mkColor() <pyqtgraph.mkColor>`.
    mode                Array of color modes (ColorMap.RGB, HSV_POS, or HSV_NEG)
                        indicating the color space that should be used when
                        interpolating between stops. Note that the last mode value is
                        ignored. By default, the mode is entirely RGB.
    ===============     ==============================================================
    """
    self.pos = np.array(pos)
    order = np.argsort(self.pos)
    self.pos = self.pos[order]
    self.color = np.apply_along_axis(
        func1d=lambda x: mkColor(x).getRgb(),
        axis=-1,
        arr=color,
    )[order]
    if mode is None:
        mode = np.ones(len(pos))
    self.mode = mode
    self.stopsCache = {}
# Buggy code
def getLookupTable(self, start=0.0, stop=1.0, nPts=512, alpha=None, mode="byte"):
    """
    Return an RGB(A) lookup table (ndarray).

    ===============   =============================================================================
    **Arguments:**
    start             The starting value in the lookup table (default=0.0)
    stop              The final value in the lookup table (default=1.0)
    nPts              The number of points in the returned lookup table.
    alpha             True, False, or None - Specifies whether or not alpha values are included
                      in the table. If alpha is None, it will be automatically determined.
    mode              Determines return type: 'byte' (0-255), 'float' (0.0-1.0), or 'qcolor'.
                      See :func:`map() <pyqtgraph.ColorMap.map>`.
    ===============   =============================================================================
    """
    if isinstance(mode, basestring):
        mode = self.enumMap[mode.lower()]

    if alpha is None:
        alpha = self.usesAlpha()

    x = np.linspace(start, stop, nPts)
    table = self.map(x, mode)

    if not alpha:
        return table[:, :3]
    else:
        return table


# Traceback (IndexError)
Traceback (most recent call last):
File "test.py", line 13, in <module>
cmap.getLookupTable()  # Does not work
File "...\venv\lib\site-packages\pyqtgraph\colormap.py", line 223, in getLookupTable
alpha = self.usesAlpha()
File "...\venv\lib\site-packages\pyqtgraph\colormap.py", line 236, in usesAlpha
return np.any(self.color[:,3] != max)
IndexError: index 3 is out of bounds for axis 1 with size 3

# Fixed code
def getLookupTable(self, start=0.0, stop=1.0, nPts=512, alpha=None, mode="byte"):
    """
    Return an RGB(A) lookup table (ndarray).

    ===============   =============================================================================
    **Arguments:**
    start             The starting value in the lookup table (default=0.0)
    stop              The final value in the lookup table (default=1.0)
    nPts              The number of points in the returned lookup table.
    alpha             True, False, or None - Specifies whether or not alpha values are included
                      in the table. If alpha is None, it will be automatically determined.
    mode              Determines return type: 'byte' (0-255), 'float' (0.0-1.0), or 'qcolor'.
                      See :func:`map() <pyqtgraph.ColorMap.map>`.
    ===============   =============================================================================
    """
    if isinstance(mode, basestring):
        mode = self.enumMap[mode.lower()]

    if alpha is None:
        alpha = self.usesAlpha()

    x = np.linspace(start, stop, nPts)
    table = self.map(x, mode)

    if not alpha and mode != self.QCOLOR:
        return table[:, :3]
    else:
        return table
# Buggy code
def session(self):
    """
    Returns a valid botocore session
    """
    if self._session is None:
        self._session = get_session()
    return self._session


# Traceback (KeyError)
Traceback (most recent call last):
File "./instrumentation/utils.py", line 69, in save_driver_log
driver_log.save()
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/models.py", line 379, in save
data = self._get_connection().put_item(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/table.py", line 83, in put_item
return_item_collection_metrics=return_item_collection_metrics)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 806, in put_item
operation_kwargs.update(self.get_identifier_map(table_name, hash_key, range_key, key=ITEM))
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 648, in get_identifier_map
tbl = self.get_meta_table(table_name)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 399, in get_meta_table
data = self.dispatch(DESCRIBE_TABLE, operation_kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 235, in dispatch
data = self._make_api_call(operation_name, operation_kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 250, in _make_api_call
operation_model = self.client._service_model.operation_model(operation_name)
File "/app/.heroku/python/lib/python2.7/site-packages/pynamodb/connection/base.py", line 387, in client
self._client = self.session.create_client(SERVICE_NAME, self.region, endpoint_url=self.host)
File "/app/.heroku/python/lib/python2.7/site-packages/botocore/session.py", line 809, in create_client
endpoint_resolver = self.get_component('endpoint_resolver')
File "/app/.heroku/python/lib/python2.7/site-packages/botocore/session.py", line 690, in get_component
return self._components.get_component(name)
File "/app/.heroku/python/lib/python2.7/site-packages/botocore/session.py", line 875, in get_component
del self._deferred[name]
KeyError: 'endpoint_resolver'

# Fixed code
def session(self):
    """
    Returns a valid botocore session
    """
    # botocore client creation is not thread safe as of v1.2.5+ (see issue #153)
    if getattr(self._local, "session", None) is None:
        self._local.session = get_session()
    return self._local.session
# Buggy code
def _fetch_model(model_name) -> str:
    model_map = {}
    hu_path: str = "https://nlp.informatik.hu-berlin.de/resources/models"

    model_map["de-offensive-language"] = "/".join(
        [hu_path, "de-offensive-language", "germ-eval-2018-task-1-v0.4.pt"]
    )

    # English sentiment models
    model_map["sentiment"] = "/".join(
        [hu_path, "sentiment-curated-distilbert", "sentiment-en-mix-distillbert.pt"]
    )
    model_map["en-sentiment"] = "/".join(
        [hu_path, "sentiment-curated-distilbert", "sentiment-en-mix-distillbert.pt"]
    )
    model_map["sentiment-fast"] = "/".join(
        [hu_path, "sentiment-curated-fasttext-rnn", "sentiment-en-mix-ft-rnn.pt"]
    )

    # Communicative Functions Model
    model_map["communicative-functions"] = "/".join(
        [hu_path, "comfunc", "communicative-functions-v0.5b.pt"]
    )

    cache_dir = Path("models")
    if model_name in model_map:
        model_name = cached_path(model_map[model_name], cache_dir=cache_dir)

    return model_name


# Traceback (AttributeError)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-26-1ee39d7138b3> in <module>()
----> 1 df_test['flair'] = df_test['word'].apply(lambda x: flair_lstm(x))

10 frames
pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

/usr/local/lib/python3.6/dist-packages/transformers/configuration_utils.py in use_return_dict(self)
217         """
218         # If torchscript is set, force `return_dict=False` to avoid jit errors
--> 219         return self.return_dict and not self.torchscript
220
221     @property

AttributeError: 'DistilBertConfig' object has no attribute 'return_dict'

# Fixed code
def _fetch_model(model_name) -> str:
    model_map = {}
    hu_path: str = "https://nlp.informatik.hu-berlin.de/resources/models"

    model_map["de-offensive-language"] = "/".join(
        [hu_path, "de-offensive-language", "germ-eval-2018-task-1-v0.4.pt"]
    )

    # English sentiment models
    model_map["sentiment"] = "/".join(
        [hu_path, "sentiment-curated-distilbert", "sentiment-en-mix-distillbert_3.1.pt"]
    )
    model_map["en-sentiment"] = "/".join(
        [hu_path, "sentiment-curated-distilbert", "sentiment-en-mix-distillbert_3.1.pt"]
    )
    model_map["sentiment-fast"] = "/".join(
        [hu_path, "sentiment-curated-fasttext-rnn", "sentiment-en-mix-ft-rnn.pt"]
    )

    # Communicative Functions Model
    model_map["communicative-functions"] = "/".join(
        [hu_path, "comfunc", "communicative-functions-v0.5b.pt"]
    )

    cache_dir = Path("models")
    if model_name in model_map:
        model_name = cached_path(model_map[model_name], cache_dir=cache_dir)

    return model_name
# Buggy code
def add_file_handler(log, output_file):
    init_output_file(output_file.parents[0], output_file.name)
    fh = logging.FileHandler(output_file)
    fh.setLevel(logging.INFO)
    formatter = logging.Formatter("%(asctime)-15s %(message)s")
    fh.setFormatter(formatter)
    log.addHandler(fh)
    return fh


# Traceback (UnicodeEncodeError)
--- Logging error ---
Traceback (most recent call last):
File "...\torch\lib\logging\__init__.py", line 1037, in emit
stream.write(msg + self.terminator)
File "...\torch\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 28-31: character maps to <undefined>
Call stack:
File "...flair_lm.py", line 33, in <module>
File "...\torch\lib\site-packages\flair\trainers\language_model_trainer.py", line 336, in train
log.info(self.model.generate_text())
Message: (...)
Arguments: ()

# Fixed code
def add_file_handler(log, output_file):
    init_output_file(output_file.parents[0], output_file.name)
    fh = logging.FileHandler(output_file, mode="w", encoding="utf-8")
    fh.setLevel(logging.INFO)
    formatter = logging.Formatter("%(asctime)-15s %(message)s")
    fh.setFormatter(formatter)
    log.addHandler(fh)
    return fh
# Buggy code
def transform(data, func):
    if compat.USE_PYGEOS:
        coords = pygeos.get_coordinates(data)
        new_coords = func(coords[:, 0], coords[:, 1])
        result = pygeos.set_coordinates(data.copy(), np.array(new_coords).T)
        return result
    else:
        from shapely.ops import transform

        n = len(data)
        result = np.empty(n, dtype=object)
        for i in range(n):
            geom = data[i]
            result[i] = transform(func, geom)

        return result


# Traceback (AttributeError)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
in
15
16 gdf.loc[3,'geometry'] = None
---> 17 gdf.to_crs(epsg=5347)

/opt/miniconda3/envs/stable/lib/python3.8/site-packages/geopandas/geodataframe.py in to_crs(self, crs, epsg, inplace)
814         else:
815             df = self.copy()
--> 816         geom = df.geometry.to_crs(crs=crs, epsg=epsg)
817         df.geometry = geom
818         df.crs = geom.crs

/opt/miniconda3/envs/stable/lib/python3.8/site-packages/geopandas/geoseries.py in to_crs(self, crs, epsg)
541         transformer = Transformer.from_crs(self.crs, crs, always_xy=True)
542
--> 543         new_data = vectorized.transform(self.values.data, transformer.transform)
544         return GeoSeries(
545             GeometryArray(new_data), crs=crs, index=self.index, name=self.name

/opt/miniconda3/envs/stable/lib/python3.8/site-packages/geopandas/_vectorized.py in transform(data, func)
887         for i in range(n):
888             geom = data[i]
--> 889             result[i] = transform(func, geom)
890
891         return result

/opt/miniconda3/envs/stable/lib/python3.8/site-packages/shapely/ops.py in transform(func, geom)
222     also satisfy the requirements for `func`.
223     """
--> 224     if geom.is_empty:
225         return geom
226     if geom.type in ('Point', 'LineString', 'LinearRing', 'Polygon'):

AttributeError: 'NoneType' object has no attribute 'is_empty'

# Fixed code
def transform(data, func):
    if compat.USE_PYGEOS:
        coords = pygeos.get_coordinates(data)
        new_coords = func(coords[:, 0], coords[:, 1])
        result = pygeos.set_coordinates(data.copy(), np.array(new_coords).T)
        return result
    else:
        from shapely.ops import transform

        n = len(data)
        result = np.empty(n, dtype=object)
        for i in range(n):
            geom = data[i]
            if _isna(geom):
                result[i] = geom
            else:
                result[i] = transform(func, geom)

        return result